Rejoin session on F5. Ref #35
This commit is contained in:
parent
eb52fcc447
commit
69fdb475d9
@ -6,7 +6,6 @@ var documentsMain = {
|
|||||||
isEditormode : false,
|
isEditormode : false,
|
||||||
useUnstable : false,
|
useUnstable : false,
|
||||||
mainTitle : '',
|
mainTitle : '',
|
||||||
documentTitle : '',
|
|
||||||
onStartup: function() {
|
onStartup: function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
documentsMain.mainTitle = $('title').text();
|
documentsMain.mainTitle = $('title').text();
|
||||||
@ -17,6 +16,11 @@ var documentsMain = {
|
|||||||
require({}, ["dojo/ready"], function(ready) {
|
require({}, ["dojo/ready"], function(ready) {
|
||||||
ready(function() {
|
ready(function() {
|
||||||
require({}, ["webodf/editor/Editor"], function(Editor) {
|
require({}, ["webodf/editor/Editor"], function(Editor) {
|
||||||
|
var esId = parent.location.hash.replace(/\W*/g, '');
|
||||||
|
if (esId){
|
||||||
|
documentsMain.prepareSession();
|
||||||
|
documentsMain.joinSession(esId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -24,6 +28,12 @@ var documentsMain = {
|
|||||||
});
|
});
|
||||||
//setInterval(documentsMain.updateInfo, 10000);
|
//setInterval(documentsMain.updateInfo, 10000);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
prepareSession : function(){
|
||||||
|
documentsMain.isEditorMode = true;
|
||||||
|
documentsMain.showOverlay();
|
||||||
|
},
|
||||||
|
|
||||||
initSession: function(response) {
|
initSession: function(response) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -45,7 +55,7 @@ var documentsMain = {
|
|||||||
t('documents', 'Close') +
|
t('documents', 'Close') +
|
||||||
' </button>' +
|
' </button>' +
|
||||||
'<div id="document-title"><div>' +
|
'<div id="document-title"><div>' +
|
||||||
documentsMain.documentTitle +
|
documentsMain.getNameByFileid(response.file_id) +
|
||||||
'</div></div>' +
|
'</div></div>' +
|
||||||
' <button id="odf-invite">' +
|
' <button id="odf-invite">' +
|
||||||
t('documents', 'Invite') +
|
t('documents', 'Invite') +
|
||||||
@ -86,9 +96,10 @@ var documentsMain = {
|
|||||||
|
|
||||||
// load the document and get called back when it's live
|
// load the document and get called back when it's live
|
||||||
documentsMain.webodfEditorInstance.openSession(response.es_id, memberId, function() {
|
documentsMain.webodfEditorInstance.openSession(response.es_id, memberId, function() {
|
||||||
$('title').text(documentsMain.mainTitle + '| ' + documentsMain.documentTitle);
|
$('title').text(documentsMain.mainTitle + '| ' + documentsMain.getNameByFileid(response.file_id));
|
||||||
documentsMain.webodfEditorInstance.startEditing();
|
documentsMain.webodfEditorInstance.startEditing();
|
||||||
documentsMain.hideOverlay();
|
documentsMain.hideOverlay();
|
||||||
|
parent.location.hash = response.es_id;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -165,7 +176,7 @@ var documentsMain = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
documentsMain.isEditorMode = false;
|
documentsMain.isEditorMode = false;
|
||||||
|
parent.location.hash = "";
|
||||||
//close editor
|
//close editor
|
||||||
documentsMain.webodfEditorInstance.endEditing();
|
documentsMain.webodfEditorInstance.endEditing();
|
||||||
documentsMain.webodfEditorInstance.close(function() {
|
documentsMain.webodfEditorInstance.close(function() {
|
||||||
@ -189,6 +200,9 @@ var documentsMain = {
|
|||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getNameByFileid : function(fileid){
|
||||||
|
return $('.documentslist li[data-id='+ fileid + ']').find('label').text();
|
||||||
|
},
|
||||||
showOverlay : function(){
|
showOverlay : function(){
|
||||||
$('#documents-overlay,#documents-overlay-below').fadeIn('slow');
|
$('#documents-overlay,#documents-overlay-below').fadeIn('slow');
|
||||||
},
|
},
|
||||||
@ -262,9 +276,7 @@ $(document).ready(function() {
|
|||||||
if (documentsMain.isEditorMode){
|
if (documentsMain.isEditorMode){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
documentsMain.isEditorMode = true;
|
documentsMain.prepareSession();
|
||||||
documentsMain.documentTitle = $(this).find('label').text();
|
|
||||||
documentsMain.showOverlay();
|
|
||||||
|
|
||||||
if ($(this).attr('data-esid')){
|
if ($(this).attr('data-esid')){
|
||||||
documentsMain.joinSession($(this).attr('data-esid'));
|
documentsMain.joinSession($(this).attr('data-esid'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user