Add onRequestSaveAs event
This commit is contained in:
parent
dc5d6576a1
commit
1cff575fd6
|
@ -202,6 +202,7 @@
|
||||||
_config.editorConfig.canRequestUsers = _config.events && !!_config.events.onRequestUsers;
|
_config.editorConfig.canRequestUsers = _config.events && !!_config.events.onRequestUsers;
|
||||||
_config.editorConfig.canRequestSendNotify = _config.events && !!_config.events.onRequestSendNotify;
|
_config.editorConfig.canRequestSendNotify = _config.events && !!_config.events.onRequestSendNotify;
|
||||||
_config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl;
|
_config.editorConfig.mergeFolderUrl = _config.editorConfig.mergeFolderUrl || _config.editorConfig.saveAsUrl;
|
||||||
|
_config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs;
|
||||||
_config.frameEditorId = placeholderId;
|
_config.frameEditorId = placeholderId;
|
||||||
|
|
||||||
_config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead.");
|
_config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead.");
|
||||||
|
|
|
@ -250,6 +250,16 @@ if (Common === undefined) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
requestSaveAs: function(url, title) {
|
||||||
|
_postMessage({
|
||||||
|
event: 'onRequestSaveAs',
|
||||||
|
data: {
|
||||||
|
url: url,
|
||||||
|
title: title
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
collaborativeChanges: function() {
|
collaborativeChanges: function() {
|
||||||
_postMessage({event: 'onCollaborativeChanges'});
|
_postMessage({event: 'onCollaborativeChanges'});
|
||||||
},
|
},
|
||||||
|
|
|
@ -400,6 +400,9 @@ define([
|
||||||
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
|
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me.mode.canRequestSaveAs) {
|
||||||
|
Common.Gateway.requestSaveAs(url, defFileName);
|
||||||
|
} else {
|
||||||
me._saveCopyDlg = new Common.Views.SaveAsDlg({
|
me._saveCopyDlg = new Common.Views.SaveAsDlg({
|
||||||
saveFolderUrl: me.mode.saveAsUrl,
|
saveFolderUrl: me.mode.saveAsUrl,
|
||||||
saveFileUrl: url,
|
saveFileUrl: url,
|
||||||
|
@ -422,6 +425,7 @@ define([
|
||||||
});
|
});
|
||||||
me._saveCopyDlg.show();
|
me._saveCopyDlg.show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.isFromFileDownloadAs = false;
|
this.isFromFileDownloadAs = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,7 @@ define([
|
||||||
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
|
this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink;
|
||||||
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
|
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
|
||||||
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
||||||
|
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
|
||||||
|
|
||||||
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||||
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
||||||
|
|
|
@ -259,7 +259,7 @@ define([
|
||||||
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
||||||
|
|
||||||
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && this.mode.saveAsUrl ?'show':'hide']();
|
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide']();
|
||||||
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||||
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
|
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ define([
|
||||||
} else if (this.mode.canDownloadOrigin)
|
} else if (this.mode.canDownloadOrigin)
|
||||||
$('a',this.miDownload.$el).text(this.textDownload);
|
$('a',this.miDownload.$el).text(this.textDownload);
|
||||||
|
|
||||||
if (this.mode.canDownload && this.mode.saveAsUrl) {
|
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||||
this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render());
|
this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,9 @@ define([
|
||||||
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
|
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me.mode.canRequestSaveAs) {
|
||||||
|
Common.Gateway.requestSaveAs(url, defFileName);
|
||||||
|
} else {
|
||||||
me._saveCopyDlg = new Common.Views.SaveAsDlg({
|
me._saveCopyDlg = new Common.Views.SaveAsDlg({
|
||||||
saveFolderUrl: me.mode.saveAsUrl,
|
saveFolderUrl: me.mode.saveAsUrl,
|
||||||
saveFileUrl: url,
|
saveFileUrl: url,
|
||||||
|
@ -291,6 +294,7 @@ define([
|
||||||
});
|
});
|
||||||
me._saveCopyDlg.show();
|
me._saveCopyDlg.show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.isFromFileDownloadAs = false;
|
this.isFromFileDownloadAs = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -316,6 +316,7 @@ define([
|
||||||
this.appOptions.canPlugins = false;
|
this.appOptions.canPlugins = false;
|
||||||
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
|
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
|
||||||
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
||||||
|
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
|
||||||
|
|
||||||
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||||
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
||||||
|
|
|
@ -214,8 +214,6 @@ define([
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
me.panels = {
|
me.panels = {
|
||||||
'saveas' : (new PE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(),
|
|
||||||
'save-copy' : (new PE.Views.FileMenuPanels.ViewSaveCopy({menu:me})).render(),
|
|
||||||
'opts' : (new PE.Views.FileMenuPanels.Settings({menu:me})).render(),
|
'opts' : (new PE.Views.FileMenuPanels.Settings({menu:me})).render(),
|
||||||
'info' : (new PE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(),
|
'info' : (new PE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(),
|
||||||
'rights' : (new PE.Views.FileMenuPanels.DocumentRights({menu:me})).render()
|
'rights' : (new PE.Views.FileMenuPanels.DocumentRights({menu:me})).render()
|
||||||
|
@ -256,7 +254,7 @@ define([
|
||||||
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
||||||
|
|
||||||
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && this.mode.saveAsUrl ?'show':'hide']();
|
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide']();
|
||||||
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||||
|
|
||||||
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
|
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
|
||||||
|
@ -297,6 +295,14 @@ define([
|
||||||
this.panels['protect'].setMode(this.mode);
|
this.panels['protect'].setMode(this.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.mode.canDownload) {
|
||||||
|
this.panels['saveas'] = ((new PE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||||
|
this.panels['save-copy'] = ((new PE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render());
|
||||||
|
}
|
||||||
|
|
||||||
if (this.mode.canHelp) {
|
if (this.mode.canHelp) {
|
||||||
this.panels['help'] = ((new PE.Views.FileMenuPanels.Help({menu: this})).render());
|
this.panels['help'] = ((new PE.Views.FileMenuPanels.Help({menu: this})).render());
|
||||||
this.panels['help'].setLangConfig(this.mode.lang);
|
this.panels['help'].setLangConfig(this.mode.lang);
|
||||||
|
|
|
@ -315,6 +315,9 @@ define([
|
||||||
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
|
defFileName = defFileName.substring(0, idx) + this.isFromFileDownloadAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me.mode.canRequestSaveAs) {
|
||||||
|
Common.Gateway.requestSaveAs(url, defFileName);
|
||||||
|
} else {
|
||||||
me._saveCopyDlg = new Common.Views.SaveAsDlg({
|
me._saveCopyDlg = new Common.Views.SaveAsDlg({
|
||||||
saveFolderUrl: me.mode.saveAsUrl,
|
saveFolderUrl: me.mode.saveAsUrl,
|
||||||
saveFileUrl: url,
|
saveFileUrl: url,
|
||||||
|
@ -337,6 +340,7 @@ define([
|
||||||
});
|
});
|
||||||
me._saveCopyDlg.show();
|
me._saveCopyDlg.show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.isFromFileDownloadAs = false;
|
this.isFromFileDownloadAs = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,7 @@ define([
|
||||||
this.appOptions.canPlugins = false;
|
this.appOptions.canPlugins = false;
|
||||||
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
|
this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers;
|
||||||
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
|
||||||
|
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
|
||||||
|
|
||||||
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
|
||||||
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
|
||||||
|
|
|
@ -203,8 +203,6 @@ define([
|
||||||
|
|
||||||
var me = this;
|
var me = this;
|
||||||
me.panels = {
|
me.panels = {
|
||||||
'saveas' : (new SSE.Views.FileMenuPanels.ViewSaveAs({menu:me})).render(),
|
|
||||||
'save-copy' : (new SSE.Views.FileMenuPanels.ViewSaveCopy({menu:me})).render(),
|
|
||||||
'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:me})).render(),
|
'opts' : (new SSE.Views.FileMenuPanels.Settings({menu:me})).render(),
|
||||||
'info' : (new SSE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(),
|
'info' : (new SSE.Views.FileMenuPanels.DocumentInfo({menu:me})).render(),
|
||||||
'rights' : (new SSE.Views.FileMenuPanels.DocumentRights({menu:me})).render()
|
'rights' : (new SSE.Views.FileMenuPanels.DocumentRights({menu:me})).render()
|
||||||
|
@ -245,7 +243,7 @@ define([
|
||||||
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide']();
|
||||||
|
|
||||||
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && this.mode.saveAsUrl ?'show':'hide']();
|
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide']();
|
||||||
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||||
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
|
// this.hkSaveAs[this.mode.canDownload?'enable':'disable']();
|
||||||
|
|
||||||
|
@ -288,6 +286,14 @@ define([
|
||||||
this.panels['protect'].setMode(this.mode);
|
this.panels['protect'].setMode(this.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.mode.canDownload) {
|
||||||
|
this.panels['saveas'] = ((new SSE.Views.FileMenuPanels.ViewSaveAs({menu: this})).render());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||||
|
this.panels['save-copy'] = ((new SSE.Views.FileMenuPanels.ViewSaveCopy({menu: this})).render());
|
||||||
|
}
|
||||||
|
|
||||||
if (this.mode.canHelp) {
|
if (this.mode.canHelp) {
|
||||||
this.panels['help'] = ((new SSE.Views.FileMenuPanels.Help({menu: this})).render());
|
this.panels['help'] = ((new SSE.Views.FileMenuPanels.Help({menu: this})).render());
|
||||||
this.panels['help'].setLangConfig(this.mode.lang);
|
this.panels['help'].setLangConfig(this.mode.lang);
|
||||||
|
|
Loading…
Reference in a new issue