2016-06-29 17:57:58 +05:30
|
|
|
/*globals $,OC,fileDownloadPath,t,document,odf,alert,require,dojo,runtime,Handlebars */
|
2014-04-26 02:05:11 +03:00
|
|
|
|
|
|
|
$.widget('oc.documentGrid', {
|
|
|
|
options : {
|
|
|
|
context : '.documentslist',
|
|
|
|
documents : {},
|
|
|
|
sessions : {},
|
2016-04-15 17:24:30 +02:00
|
|
|
members : {}
|
2014-04-26 02:05:11 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-06-09 00:39:17 +05:30
|
|
|
render : function(fileId){
|
2014-04-26 02:05:11 +03:00
|
|
|
var that = this;
|
2016-06-09 00:39:17 +05:30
|
|
|
jQuery.when(this._load(fileId))
|
2014-04-26 02:05:11 +03:00
|
|
|
.then(function(){
|
|
|
|
that._render();
|
2016-06-29 21:45:42 +05:30
|
|
|
documentsMain.renderComplete = true;
|
2014-04-26 02:05:11 +03:00
|
|
|
});
|
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-06-09 00:39:17 +05:30
|
|
|
_load : function (fileId){
|
2016-12-07 00:57:01 +01:00
|
|
|
documentsMain.initSession();
|
2014-04-26 02:05:11 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-04-26 02:05:11 +03:00
|
|
|
_render : function (data){
|
|
|
|
var that = this,
|
|
|
|
documents = data && data.documents || this.options.documents,
|
|
|
|
sessions = data && data.sessions || this.options.sessions,
|
|
|
|
members = data && data.members || this.options.members,
|
|
|
|
hasDocuments = false
|
|
|
|
;
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-04-26 02:05:11 +03:00
|
|
|
$(this.options.context + ' .document:not(.template,.progress)').remove();
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-04-15 16:55:15 +02:00
|
|
|
if (documentsMain.loadError) {
|
|
|
|
$(this.options.context).after('<div id="errormessage">'
|
2016-04-15 17:24:30 +02:00
|
|
|
+ '<p>' + documentsMain.loadErrorMessage + '</p><p>'
|
|
|
|
+ documentsMain.loadErrorHint
|
2016-04-15 16:55:15 +02:00
|
|
|
+ '</p></div>'
|
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
2014-04-26 02:05:11 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-04-30 13:20:36 +03:00
|
|
|
$.widget('oc.documentOverlay', {
|
|
|
|
options : {
|
|
|
|
parent : 'document.body'
|
|
|
|
},
|
|
|
|
_create : function (){
|
|
|
|
$(this.element).hide().appendTo(document.body);
|
|
|
|
},
|
|
|
|
show : function(){
|
|
|
|
$(this.element).fadeIn('fast');
|
|
|
|
},
|
|
|
|
hide : function(){
|
|
|
|
$(this.element).fadeOut('fast');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-08-28 12:02:27 +02:00
|
|
|
var documentsMain = {
|
2016-06-26 20:51:06 +05:30
|
|
|
isEditorMode : false,
|
|
|
|
isViewerMode: false,
|
2013-10-22 16:18:03 +03:00
|
|
|
ready :false,
|
2013-12-05 14:04:36 +01:00
|
|
|
fileName: null,
|
2015-10-28 10:46:36 +01:00
|
|
|
baseName: null,
|
2014-12-02 03:34:05 +03:00
|
|
|
canShare : false,
|
2016-10-11 13:00:20 +05:30
|
|
|
canEdit: false,
|
2016-04-15 16:55:15 +02:00
|
|
|
loadError : false,
|
2016-04-15 17:24:30 +02:00
|
|
|
loadErrorMessage : '',
|
|
|
|
loadErrorHint : '',
|
2016-06-29 21:45:42 +05:30
|
|
|
renderComplete: false, // false till page is rendered with all required data about the document(s)
|
2014-12-02 03:34:05 +03:00
|
|
|
toolbar : '<div id="ocToolbar"><div id="ocToolbarInside"></div><span id="toolbar" class="claro"></span></div>',
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2018-01-31 17:55:33 +05:30
|
|
|
// generates docKey for given fileId
|
|
|
|
_generateDocKey: function(wopiFileId) {
|
|
|
|
var ocurl = OC.generateUrl('apps/richdocuments/wopi/files/{file_id}', {file_id: wopiFileId});
|
|
|
|
if (richdocuments_canonical_webroot) {
|
|
|
|
if (!richdocuments_canonical_webroot.startsWith('/'))
|
|
|
|
richdocuments_canonical_webroot = '/' + richdocuments_canonical_webroot;
|
|
|
|
|
|
|
|
ocurl = ocurl.replace(OC.webroot, richdocuments_canonical_webroot);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ocurl;
|
|
|
|
},
|
|
|
|
|
2015-10-29 19:05:36 +02:00
|
|
|
UI : {
|
2013-09-18 18:48:52 +03:00
|
|
|
/* Editor wrapper HTML */
|
2015-10-28 19:45:12 +02:00
|
|
|
container : '<div id="mainContainer" class="claro">' +
|
2015-10-23 17:17:35 +02:00
|
|
|
'</div>',
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-06-26 20:51:06 +05:30
|
|
|
viewContainer: '<div id="revViewerContainer" class="claro">' +
|
|
|
|
'<div id="revViewer"></div>' +
|
|
|
|
'</div>',
|
|
|
|
|
|
|
|
revHistoryContainerTemplate: '<div id="revPanelContainer" class="loleaflet-font">' +
|
|
|
|
'<div id="revPanelHeader">' +
|
|
|
|
'<h2>Revision History</h2>' +
|
|
|
|
'<span>{{filename}}</span>' +
|
2016-06-28 17:00:58 +05:30
|
|
|
'<a class="closeButton"><img src={{closeButtonUrl}} width="22px" height="22px"></a>' +
|
2016-06-26 20:51:06 +05:30
|
|
|
'</div>' +
|
|
|
|
'<div id="revisionsContainer" class="loleaflet-font">' +
|
|
|
|
'<ul></ul>' +
|
|
|
|
'</div>' +
|
|
|
|
'<input type="button" id="show-more-versions" class="loleaflet-font" value="{{moreVersionsLabel}}" />' +
|
|
|
|
'</div>',
|
|
|
|
|
|
|
|
revHistoryItemTemplate: '<li>' +
|
2016-11-28 13:05:40 +05:30
|
|
|
'<a href="{{downloadUrl}}" class="downloadVersion has-tooltip" title="' + t('richdocuments', 'Download this revision') + '"><img src="{{downloadIconUrl}}" />' +
|
2016-09-30 23:17:46 +05:30
|
|
|
'<a class="versionPreview"><span class="versiondate has-tooltip" title="{{formattedTimestamp}}">{{relativeTimestamp}}</span></a>' +
|
2016-11-28 13:05:40 +05:30
|
|
|
'<a href="{{restoreUrl}}" class="restoreVersion has-tooltip" title="' + t('richdocuments', 'Restore this revision') + '"><img src="{{restoreIconUrl}}" />' +
|
2016-06-26 20:51:06 +05:30
|
|
|
'</a>' +
|
|
|
|
'</li>',
|
|
|
|
|
2013-09-18 18:48:52 +03:00
|
|
|
/* Previous window title */
|
|
|
|
mainTitle : '',
|
2016-06-26 20:51:06 +05:30
|
|
|
/* Number of revisions already loaded */
|
|
|
|
revisionsStart: 0,
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2013-09-18 18:48:52 +03:00
|
|
|
init : function(){
|
2018-01-31 03:01:25 +05:30
|
|
|
documentsMain.UI.mainTitle = parent.document.title;
|
2013-09-18 18:48:52 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-06-26 20:51:06 +05:30
|
|
|
showViewer: function(fileId, title){
|
|
|
|
// remove previous viewer, if open, and set a new one
|
|
|
|
if (documentsMain.isViewerMode) {
|
|
|
|
$('#revViewer').remove();
|
|
|
|
$('#revViewerContainer').prepend($('<div id="revViewer">'));
|
|
|
|
}
|
|
|
|
|
2018-01-31 17:55:33 +05:30
|
|
|
var ocurl = documentsMain._generateDocKey(fileId);
|
2016-12-06 21:09:40 +01:00
|
|
|
// WOPISrc - URL that loolwsd will access (ie. pointing to ownCloud)
|
2018-01-31 17:55:33 +05:30
|
|
|
var wopiurl = window.location.protocol + '//' + window.location.host + ocurl;
|
2016-12-06 21:09:40 +01:00
|
|
|
|
|
|
|
// urlsrc - the URL from discovery xml that we access for the particular
|
|
|
|
// document; we add various parameters to that.
|
|
|
|
// The discovery is available at
|
|
|
|
// https://<loolwsd-server>:9980/hosting/discovery
|
|
|
|
var urlsrc = documentsMain.urlsrc +
|
|
|
|
"WOPISrc=" + wopisrc +
|
|
|
|
"&title=" + encodeURIComponent(title) +
|
2017-04-05 15:53:07 +05:30
|
|
|
"&lang=" + OC.getLocale().replace('_', '-') + // loleaflet expects a BCP47 language tag syntax
|
2016-12-06 21:09:40 +01:00
|
|
|
"&closebutton=1" +
|
|
|
|
"&revisionhistory=1";
|
|
|
|
if (!documentsMain.canEdit || action === "view") {
|
|
|
|
urlsrc += "&permission=readonly";
|
|
|
|
}
|
2016-04-13 19:06:03 +02:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// access_token - must be passed via a form post
|
|
|
|
var access_token = encodeURIComponent(documentsMain.token);
|
2016-04-13 19:06:03 +02:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// form to post the access token for WOPISrc
|
|
|
|
var form = '<form id="loleafletform" name="loleafletform" target="loleafletframe" action="' + urlsrc + '" method="post">' +
|
|
|
|
'<input name="access_token" value="' + access_token + '" type="hidden"/></form>';
|
2016-04-13 19:06:03 +02:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// iframe that contains the Collabora Online
|
|
|
|
var frame = '<iframe id="loleafletframe" name= "loleafletframe" allowfullscreen style="width:100%;height:100%;position:absolute;" />';
|
2016-04-07 17:53:15 -04:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
$('#mainContainer').append(form);
|
|
|
|
$('#mainContainer').append(frame);
|
2016-04-13 19:06:03 +02:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// Listen for App_LoadingStatus as soon as possible
|
|
|
|
$('#loleafletframe').ready(function() {
|
|
|
|
var editorInitListener = function(e) {
|
|
|
|
var msg = JSON.parse(e.data);
|
|
|
|
if (msg.MessageId === 'App_LoadingStatus') {
|
|
|
|
window.removeEventListener('message', editorInitListener, false);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
window.addEventListener('message', editorInitListener, false);
|
|
|
|
});
|
2016-10-26 18:59:27 +05:30
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
$('#loleafletframe').load(function(){
|
|
|
|
// And start listening to incoming post messages
|
|
|
|
window.addEventListener('message', function(e){
|
|
|
|
if (documentsMain.isViewerMode) {
|
|
|
|
return;
|
|
|
|
}
|
2016-10-26 18:59:27 +05:30
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
try {
|
2017-10-20 11:26:26 +02:00
|
|
|
var msg = JSON.parse(e.data);
|
|
|
|
var msgId = msg.MessageId;
|
|
|
|
var args = msg.Values;
|
|
|
|
var deprecated = !!args.Deprecated;
|
2016-12-06 21:09:40 +01:00
|
|
|
} catch(exc) {
|
2017-10-20 11:26:26 +02:00
|
|
|
msgId = e.data;
|
2016-12-06 21:09:40 +01:00
|
|
|
}
|
2017-10-20 11:26:26 +02:00
|
|
|
|
|
|
|
if (msgId === 'UI_Close' || msgId === 'close' /* deprecated */) {
|
|
|
|
// If a postmesage API is deprecated, we must ignore it and wait for the standard postmessage
|
|
|
|
// (or it might already have been fired)
|
|
|
|
if (deprecated)
|
|
|
|
return;
|
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
documentsMain.onClose();
|
2017-10-20 11:26:26 +02:00
|
|
|
} else if (msgId === 'UI_FileVersions' || msgId === 'rev-history' /* deprecated */) {
|
|
|
|
if (deprecated)
|
|
|
|
return;
|
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
documentsMain.UI.showRevHistory(documentsMain.fullPath);
|
2017-11-22 20:53:55 +05:30
|
|
|
} else if (msgId === 'UI_SaveAs') {
|
|
|
|
// TODO it's not possible to enter the
|
|
|
|
// filename into the OC.dialogs.filepicker; so
|
|
|
|
// it will be necessary to use an own tree
|
|
|
|
// view or something :-(
|
|
|
|
//OC.dialogs.filepicker(t('richdocuments', 'Save As'),
|
|
|
|
// function(val) {
|
|
|
|
// console.log(val);
|
|
|
|
// documentsMain.WOPIPostMessage($('#loleafletframe')[0], Action_SaveAs', {'Filename': val});
|
|
|
|
// }, false, null, true);
|
2017-12-11 16:10:54 +01:00
|
|
|
OC.dialogs.prompt(t('richdocuments', 'Please enter the filename to store the document as.'),
|
2017-11-22 20:53:55 +05:30
|
|
|
t('richdocuments', 'Save As'),
|
|
|
|
function(result, value) {
|
|
|
|
if (result === true) {
|
|
|
|
documentsMain.WOPIPostMessage($('#loleafletframe')[0], 'Action_SaveAs', {'Filename': value});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
true,
|
|
|
|
t('richdocuments', 'New filename'),
|
|
|
|
false);
|
2016-12-06 21:09:40 +01:00
|
|
|
}
|
|
|
|
});
|
2016-10-26 18:59:27 +05:30
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// Tell the LOOL iframe that we are ready now
|
|
|
|
documentsMain.WOPIPostMessage($('#loleafletframe')[0], 'Host_PostmessageReady', {});
|
2016-10-28 17:29:05 +05:30
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// LOOL Iframe is ready, turn off our overlay
|
|
|
|
// This should ideally be taken off when we receive App_LoadingStatus, but
|
|
|
|
// for backward compatibility with older lool, lets keep it here till we decide
|
|
|
|
// to break older lools
|
|
|
|
documentsMain.overlay.documentOverlay('hide');
|
|
|
|
});
|
2016-04-07 17:53:15 -04:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// submit that
|
|
|
|
$('#loleafletform').submit();
|
2016-10-26 18:59:27 +05:30
|
|
|
|
2013-09-18 18:48:52 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2013-09-18 18:48:52 +03:00
|
|
|
hideEditor : function(){
|
2014-04-30 13:20:36 +03:00
|
|
|
// Fade out editor
|
|
|
|
$('#mainContainer').fadeOut('fast', function() {
|
|
|
|
$('#mainContainer').remove();
|
2015-06-11 01:31:01 +03:00
|
|
|
$('#content-wrapper').fadeIn('fast');
|
2014-04-30 13:20:36 +03:00
|
|
|
$(document.body).removeClass('claro');
|
2018-01-31 03:01:25 +05:30
|
|
|
parent.document.title = documentsMain.UI.mainTitle;
|
2014-04-30 13:20:36 +03:00
|
|
|
});
|
2013-11-12 19:16:05 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2013-12-06 03:12:58 +03:00
|
|
|
showProgress : function(message){
|
|
|
|
if (!message){
|
|
|
|
message = ' ';
|
|
|
|
}
|
|
|
|
$('.documentslist .progress div').text(message);
|
2013-11-12 19:16:05 +03:00
|
|
|
$('.documentslist .progress').show();
|
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2013-11-12 19:16:05 +03:00
|
|
|
hideProgress : function(){
|
|
|
|
$('.documentslist .progress').hide();
|
2013-11-14 19:02:46 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-04-02 23:18:39 +03:00
|
|
|
notify : function(message){
|
|
|
|
OC.Notification.show(message);
|
2014-04-07 17:18:14 +03:00
|
|
|
setTimeout(OC.Notification.hide, 10000);
|
2013-09-18 18:48:52 +03:00
|
|
|
}
|
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2013-07-12 16:00:07 +02:00
|
|
|
onStartup: function() {
|
2013-10-22 16:18:03 +03:00
|
|
|
var fileId;
|
2013-09-18 18:48:52 +03:00
|
|
|
documentsMain.UI.init();
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-12-06 21:09:40 +01:00
|
|
|
// Does anything indicate that we need to autostart a session?
|
2016-12-07 00:57:01 +01:00
|
|
|
fileId = getURLParameter('fileid').replace(/^\W*/, '');
|
2016-06-07 12:11:50 +02:00
|
|
|
|
2016-06-09 00:39:17 +05:30
|
|
|
documentsMain.show(fileId);
|
2015-10-30 16:51:44 +01:00
|
|
|
|
2016-04-15 17:24:30 +02:00
|
|
|
if (fileId) {
|
2014-04-30 13:20:36 +03:00
|
|
|
documentsMain.overlay.documentOverlay('show');
|
2015-10-30 16:51:44 +01:00
|
|
|
documentsMain.prepareSession();
|
2013-09-18 23:41:43 +03:00
|
|
|
}
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2015-10-29 20:41:54 -04:00
|
|
|
documentsMain.ready = true;
|
2013-07-12 16:00:07 +02:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-10-26 18:59:27 +05:30
|
|
|
WOPIPostMessage: function(iframe, msgId, values) {
|
|
|
|
if (iframe) {
|
|
|
|
var msg = {
|
|
|
|
'MessageId': msgId,
|
|
|
|
'SendTime': Date.now(),
|
|
|
|
'Values': values
|
|
|
|
};
|
|
|
|
|
|
|
|
iframe.contentWindow.postMessage(JSON.stringify(msg), '*');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-09-17 18:06:37 +03:00
|
|
|
prepareSession : function(){
|
|
|
|
documentsMain.isEditorMode = true;
|
2014-04-30 13:20:36 +03:00
|
|
|
documentsMain.overlay.documentOverlay('show');
|
2013-09-18 18:48:52 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-12-07 00:57:01 +01:00
|
|
|
initSession: function() {
|
|
|
|
documentsMain.urlsrc = richdocuments_urlsrc;
|
|
|
|
documentsMain.fullPath = richdocuments_path;
|
|
|
|
documentsMain.token = richdocuments_token;
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-12-02 03:34:05 +03:00
|
|
|
$('footer,nav').hide();
|
|
|
|
$(documentsMain.toolbar).appendTo('#header');
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2018-01-11 01:36:49 +05:30
|
|
|
documentsMain.canShare = typeof OC.Share !== 'undefined' && richdocuments_permissions & OC.PERMISSION_SHARE;
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2015-11-02 14:56:36 +01:00
|
|
|
// fade out file list and show the cloudsuite
|
|
|
|
$('#content-wrapper').fadeOut('fast').promise().done(function() {
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-12-07 00:57:01 +01:00
|
|
|
documentsMain.fileId = richdocuments_fileId;
|
|
|
|
documentsMain.fileName = richdocuments_title;
|
2015-10-28 10:46:36 +01:00
|
|
|
|
2016-12-07 00:57:01 +01:00
|
|
|
documentsMain.canEdit = Boolean(richdocuments_permissions & OC.PERMISSION_UPDATE);
|
2015-10-28 10:46:36 +01:00
|
|
|
|
2016-12-07 00:57:01 +01:00
|
|
|
documentsMain.loadDocument(documentsMain.fileName, documentsMain.fileId);
|
2015-11-02 14:56:36 +01:00
|
|
|
});
|
2013-07-01 22:36:17 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2013-12-05 01:02:08 +03:00
|
|
|
view : function(id){
|
2015-12-16 17:57:44 +03:00
|
|
|
OC.addScript('richdocuments', 'viewer/viewer', function() {
|
2013-12-05 01:02:08 +03:00
|
|
|
$(window).off('beforeunload');
|
2014-03-21 20:14:57 +03:00
|
|
|
$(window).off('unload');
|
2013-12-05 01:02:08 +03:00
|
|
|
var path = $('li[data-id='+ id +']>a').attr('href');
|
|
|
|
odfViewer.isDocuments = true;
|
|
|
|
odfViewer.onView(path);
|
|
|
|
});
|
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-12-07 00:57:01 +01:00
|
|
|
loadDocument: function(title, fileId) {
|
|
|
|
documentsMain.UI.showEditor(title, fileId, 'write');
|
2013-12-05 14:04:36 +01:00
|
|
|
},
|
|
|
|
|
2014-01-21 22:23:45 +03:00
|
|
|
onEditorShutdown : function (message){
|
|
|
|
OC.Notification.show(message);
|
|
|
|
|
|
|
|
$(window).off('beforeunload');
|
2014-03-21 20:14:57 +03:00
|
|
|
$(window).off('unload');
|
2014-01-21 22:23:45 +03:00
|
|
|
if (documentsMain.isEditorMode){
|
|
|
|
documentsMain.isEditorMode = false;
|
|
|
|
parent.location.hash = "";
|
|
|
|
} else {
|
|
|
|
setTimeout(OC.Notification.hide, 7000);
|
|
|
|
}
|
2015-10-29 20:46:57 -04:00
|
|
|
documentsMain.UI.hideEditor();
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-01-21 22:23:45 +03:00
|
|
|
documentsMain.show();
|
2014-12-02 03:34:05 +03:00
|
|
|
$('footer,nav').show();
|
2014-03-21 20:14:57 +03:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-01-21 22:23:45 +03:00
|
|
|
|
2016-07-16 18:25:14 +05:30
|
|
|
onClose: function() {
|
2013-09-08 11:43:38 +03:00
|
|
|
documentsMain.isEditorMode = false;
|
2013-09-27 19:54:31 +03:00
|
|
|
$(window).off('beforeunload');
|
2014-03-21 20:14:57 +03:00
|
|
|
$(window).off('unload');
|
2013-09-17 18:06:37 +03:00
|
|
|
parent.location.hash = "";
|
2013-09-18 18:48:52 +03:00
|
|
|
|
2015-10-29 20:32:59 -04:00
|
|
|
$('footer,nav').show();
|
|
|
|
documentsMain.UI.hideEditor();
|
2015-10-29 21:52:52 -04:00
|
|
|
$('#ocToolbar').remove();
|
2016-06-07 12:11:50 +02:00
|
|
|
|
2018-01-31 03:01:25 +05:30
|
|
|
parent.document.title = documentsMain.UI.mainTitle;
|
2016-12-07 00:57:01 +01:00
|
|
|
parent.postMessage('close', '*');
|
2013-08-28 16:51:17 +02:00
|
|
|
},
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2016-06-26 20:51:06 +05:30
|
|
|
onCloseViewer: function() {
|
2016-07-16 18:25:14 +05:30
|
|
|
$('#revisionsContainer *').off();
|
|
|
|
|
2016-06-26 20:51:06 +05:30
|
|
|
$('#revPanelContainer').remove();
|
|
|
|
$('#revViewerContainer').remove();
|
|
|
|
documentsMain.isViewerMode = false;
|
2016-07-16 18:25:14 +05:30
|
|
|
documentsMain.UI.revisionsStart = 0;
|
2016-06-26 20:51:06 +05:30
|
|
|
|
|
|
|
$('#loleafletframe').focus();
|
|
|
|
},
|
|
|
|
|
2016-06-09 00:39:17 +05:30
|
|
|
show: function(fileId){
|
2017-06-02 00:16:30 +05:30
|
|
|
documentsMain.UI.showProgress(t('richdocuments', 'Loading documents…'));
|
2016-06-09 00:39:17 +05:30
|
|
|
documentsMain.docs.documentGrid('render', fileId);
|
2014-04-26 02:05:11 +03:00
|
|
|
documentsMain.UI.hideProgress();
|
2013-07-01 22:36:17 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
2015-10-31 18:21:59 -04:00
|
|
|
|
|
|
|
if (!OCA.Files) {
|
|
|
|
OCA.Files = {};
|
|
|
|
OCA.Files.App = {};
|
|
|
|
OCA.Files.App.fileList = FileList;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!OC.Share) {
|
|
|
|
OC.Share = {};
|
|
|
|
}
|
|
|
|
|
2015-11-01 09:12:24 -04:00
|
|
|
window.Files = FileList;
|
|
|
|
|
2014-04-26 02:05:11 +03:00
|
|
|
documentsMain.docs = $('.documentslist').documentGrid();
|
2014-04-30 13:20:36 +03:00
|
|
|
documentsMain.overlay = $('<div id="documents-overlay" class="icon-loading"></div><div id="documents-overlay-below" class="icon-loading-dark"></div>').documentOverlay();
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2014-09-24 22:29:38 +03:00
|
|
|
$('li.document a').tipsy({fade: true, live: true});
|
2015-10-29 19:05:36 +02:00
|
|
|
|
2015-10-26 13:07:30 +01:00
|
|
|
|
2015-10-29 20:41:54 -04:00
|
|
|
documentsMain.onStartup();
|
2013-09-12 23:02:56 +03:00
|
|
|
});
|