mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
[Wopi] Save file copy
This commit is contained in:
@ -89,7 +89,12 @@ define([
|
||||
'menu:hide': _.bind(this.menuFilesShowHide, this, 'hide'),
|
||||
'menu:show': _.bind(this.menuFilesShowHide, this, 'show'),
|
||||
'item:click': _.bind(this.clickMenuFileItem, this),
|
||||
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
||||
'saveas:format': _.bind(function(menu, format, ext) {
|
||||
if (this.mode && this.mode.wopi && ext!==undefined) { // save copy as in wopi
|
||||
this.saveAsInWopi(menu, format, ext);
|
||||
} else
|
||||
this.clickSaveAsFormat(menu, format, ext);
|
||||
}, this),
|
||||
'settings:apply': _.bind(this.applySettings, this),
|
||||
'create:new': _.bind(this.onCreateNew, this),
|
||||
'recent:open': _.bind(this.onOpenRecent, this)
|
||||
@ -307,10 +312,11 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
_saveAsFormat: function(menu, format, ext, textParams) {
|
||||
_saveAsFormat: function(menu, format, ext, textParams, wopiPath) {
|
||||
var needDownload = !!ext;
|
||||
var options = new Asc.asc_CDownloadOptions(format, needDownload);
|
||||
options.asc_setIsSaveAs(needDownload);
|
||||
wopiPath && options.asc_setWopiSaveAsPath(wopiPath);
|
||||
|
||||
if (menu) {
|
||||
options.asc_setTextParams(textParams);
|
||||
@ -366,18 +372,19 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
clickSaveAsFormat: function(menu, format, ext) { // ext isn't undefined for save copy as
|
||||
clickSaveAsFormat: function(menu, format, ext, wopiPath) { // ext isn't undefined for save copy as
|
||||
var me = this,
|
||||
fileType = this.getApplication().getController('Main').document.fileType;
|
||||
|
||||
if ( /^pdf|xps|oxps|djvu$/.test(fileType)) {
|
||||
if (format===undefined) {
|
||||
this._saveAsFormat(undefined, format, ext); // download original
|
||||
this._saveAsFormat(undefined, format, ext, undefined, wopiPath); // download original
|
||||
menu && menu.hide();
|
||||
} else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA || format == Asc.c_oAscFileType.JPG || format == Asc.c_oAscFileType.PNG)
|
||||
this._saveAsFormat(menu, format, ext);
|
||||
this._saveAsFormat(menu, format, ext, undefined, wopiPath);
|
||||
else {
|
||||
if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) // don't show message about pdf/xps/oxps
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine), wopiPath);
|
||||
else {
|
||||
Common.UI.warning({
|
||||
width: 600,
|
||||
@ -386,14 +393,14 @@ define([
|
||||
buttons: ['ok', 'cancel'],
|
||||
callback: _.bind(function(btn){
|
||||
if (btn == 'ok') {
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine), wopiPath);
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
}
|
||||
} else
|
||||
this._saveAsFormat(menu, format, ext);
|
||||
this._saveAsFormat(menu, format, ext, undefined, wopiPath);
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url, fileType) {
|
||||
@ -437,6 +444,28 @@ define([
|
||||
this.isFromFileDownloadAs = false;
|
||||
},
|
||||
|
||||
saveAsInWopi: function(menu, format, ext) {
|
||||
var me = this,
|
||||
defFileName = this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption(),
|
||||
fileInfo = this.getApplication().getController('Main').document.info;
|
||||
!defFileName && (defFileName = me.txtUntitled);
|
||||
|
||||
if (typeof ext === 'string') {
|
||||
var idx = defFileName.lastIndexOf('.');
|
||||
if (idx>0)
|
||||
defFileName = defFileName.substring(0, idx) + ext;
|
||||
}
|
||||
(new Common.Views.TextInputDialog({
|
||||
label: me.textSelectPath,
|
||||
value: (fileInfo ? fileInfo.folder || '' : '') + (defFileName || ''),
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
me.clickSaveAsFormat(menu, format, ext, value);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
applySettings: function(menu) {
|
||||
var value;
|
||||
|
||||
@ -997,7 +1026,8 @@ define([
|
||||
txtUntitled: 'Untitled',
|
||||
txtCompatible: 'The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.<br>Use the \'Compatibility\' option of the advanced settings if you want to make the files compatible with older MS Word versions.',
|
||||
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.',
|
||||
warnReplaceString: '{0} is not a valid special character for the Replace With box.'
|
||||
warnReplaceString: '{0} is not a valid special character for the Replace With box.',
|
||||
textSelectPath: 'Enter a path for saving file copy'
|
||||
|
||||
}, DE.Controllers.LeftMenu || {}));
|
||||
});
|
||||
@ -415,7 +415,7 @@ define([
|
||||
|
||||
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||
var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false;
|
||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||
this.miSave[this.mode.showSaveButton && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();
|
||||
|
||||
@ -495,7 +495,7 @@ define([
|
||||
} else if (this.mode.canDownloadOrigin)
|
||||
$('a',this.miDownload.$el).text(this.textDownload);
|
||||
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi)) {
|
||||
!this.panels['save-copy'] && (this.panels['save-copy'] = ((new DE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document ? this.document.fileType : undefined, mode: this.mode})).render()));
|
||||
}
|
||||
|
||||
|
||||
@ -849,6 +849,7 @@
|
||||
"DE.Controllers.LeftMenu.warnDownloadAsPdf": "Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.",
|
||||
"DE.Controllers.LeftMenu.warnDownloadAsRTF": "If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?",
|
||||
"DE.Controllers.LeftMenu.warnReplaceString": "{0} is not a valid special character for the replacement field.",
|
||||
"DE.Controllers.LeftMenu.textSelectPath": "Enter a path for saving file copy",
|
||||
"DE.Controllers.Main.applyChangesTextText": "Loading the changes...",
|
||||
"DE.Controllers.Main.applyChangesTitleText": "Loading the Changes",
|
||||
"DE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
|
||||
|
||||
@ -85,7 +85,12 @@ define([
|
||||
'menu:hide': _.bind(this.menuFilesShowHide, this, 'hide'),
|
||||
'menu:show': _.bind(this.menuFilesShowHide, this, 'show'),
|
||||
'item:click': _.bind(this.clickMenuFileItem, this),
|
||||
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
||||
'saveas:format': _.bind(function(menu, format, ext) {
|
||||
if (this.mode && this.mode.wopi && ext!==undefined) { // save copy as in wopi
|
||||
this.saveAsInWopi(menu, format, ext);
|
||||
} else
|
||||
this.clickSaveAsFormat(menu, format, ext);
|
||||
}, this),
|
||||
'settings:apply': _.bind(this.applySettings, this),
|
||||
'create:new': _.bind(this.onCreateNew, this),
|
||||
'recent:open': _.bind(this.onOpenRecent, this)
|
||||
@ -263,10 +268,11 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
_saveAsFormat: function(menu, format, ext, textParams) {
|
||||
_saveAsFormat: function(menu, format, ext, textParams, wopiPath) {
|
||||
var needDownload = !!ext;
|
||||
var options = new Asc.asc_CDownloadOptions(format, needDownload);
|
||||
options.asc_setIsSaveAs(needDownload);
|
||||
wopiPath && options.asc_setWopiSaveAsPath(wopiPath);
|
||||
|
||||
if (menu) {
|
||||
options.asc_setTextParams(textParams);
|
||||
@ -321,18 +327,19 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
clickSaveAsFormat: function(menu, format, ext) { // ext isn't undefined for save copy as
|
||||
clickSaveAsFormat: function(menu, format, ext, wopiPath) { // ext isn't undefined for save copy as
|
||||
var me = this,
|
||||
fileType = this.getApplication().getController('Main').document.fileType;
|
||||
|
||||
if ( /^pdf|xps|oxps|djvu$/.test(fileType)) {
|
||||
if (format===undefined) {
|
||||
this._saveAsFormat(undefined, format, ext); // download original
|
||||
this._saveAsFormat(undefined, format, ext, undefined, wopiPath); // download original
|
||||
menu && menu.hide();
|
||||
} else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA || format == Asc.c_oAscFileType.JPG || format == Asc.c_oAscFileType.PNG)
|
||||
this._saveAsFormat(menu, format, ext);
|
||||
this._saveAsFormat(menu, format, ext, undefined, wopiPath);
|
||||
else {
|
||||
if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) // don't show message about pdf/xps/oxps
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine), wopiPath);
|
||||
else {
|
||||
Common.UI.warning({
|
||||
width: 600,
|
||||
@ -341,14 +348,36 @@ define([
|
||||
buttons: ['ok', 'cancel'],
|
||||
callback: _.bind(function(btn){
|
||||
if (btn == 'ok') {
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
||||
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine), wopiPath);
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
}
|
||||
}
|
||||
} else
|
||||
this._saveAsFormat(menu, format, ext);
|
||||
this._saveAsFormat(menu, format, ext, undefined, wopiPath);
|
||||
},
|
||||
|
||||
saveAsInWopi: function(menu, format, ext) {
|
||||
var me = this,
|
||||
defFileName = this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption(),
|
||||
fileInfo = this.getApplication().getController('Main').document.info;
|
||||
!defFileName && (defFileName = me.txtUntitled);
|
||||
|
||||
if (typeof ext === 'string') {
|
||||
var idx = defFileName.lastIndexOf('.');
|
||||
if (idx>0)
|
||||
defFileName = defFileName.substring(0, idx) + ext;
|
||||
}
|
||||
(new Common.Views.TextInputDialog({
|
||||
label: me.textSelectPath,
|
||||
value: (fileInfo ? fileInfo.folder || '' : '') + (defFileName || ''),
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
me.clickSaveAsFormat(menu, format, ext, value);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url, fileType) {
|
||||
@ -898,7 +927,8 @@ define([
|
||||
warnDownloadAsRTF : 'If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?',
|
||||
txtUntitled: 'Untitled',
|
||||
txtCompatible: 'The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.<br>Use the \'Compatibility\' option of the advanced settings if you want to make the files compatible with older MS Word versions.',
|
||||
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.'
|
||||
warnDownloadAsPdf: 'Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.',
|
||||
textSelectPath: 'Enter a path for saving file copy'
|
||||
|
||||
}, PDFE.Controllers.LeftMenu || {}));
|
||||
});
|
||||
@ -399,7 +399,7 @@ define([
|
||||
|
||||
this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||
var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false;
|
||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||
this.miSave[this.mode.showSaveButton && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();
|
||||
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
|
||||
@ -472,7 +472,7 @@ define([
|
||||
} else if (this.mode.canDownloadOrigin)
|
||||
$('a',this.miDownload.$el).text(this.textDownload);
|
||||
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi)) {
|
||||
!this.panels['save-copy'] && (this.panels['save-copy'] = ((new PDFE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType, mode: this.mode})).render()));
|
||||
}
|
||||
|
||||
|
||||
@ -861,6 +861,7 @@
|
||||
"PDFE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
|
||||
"PDFE.Controllers.LeftMenu.warnDownloadAsPdf": "Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics.",
|
||||
"PDFE.Controllers.LeftMenu.warnDownloadAsRTF": "If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?",
|
||||
"PDFE.Controllers.LeftMenu.textSelectPath": "Enter a path for saving file copy",
|
||||
"PDFE.Controllers.Main.applyChangesTextText": "Loading the changes...",
|
||||
"PDFE.Controllers.Main.applyChangesTitleText": "Loading the changes",
|
||||
"PDFE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
|
||||
|
||||
@ -89,7 +89,12 @@ define([
|
||||
'menu:show': _.bind(this.menuFilesShowHide, this, 'show'),
|
||||
'item:click': _.bind(this.clickMenuFileItem, this),
|
||||
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
||||
'savecopy:format': _.bind(this.clickSaveCopyAsFormat, this),
|
||||
'savecopy:format': _.bind(function(menu, format, ext) {
|
||||
if (this.mode && this.mode.wopi && ext!==undefined) { // save copy as in wopi
|
||||
this.saveAsInWopi(menu, format, ext);
|
||||
} else
|
||||
this.clickSaveCopyAsFormat(menu, format, ext);
|
||||
}, this),
|
||||
'settings:apply': _.bind(this.applySettings, this),
|
||||
'create:new': _.bind(this.onCreateNew, this),
|
||||
'recent:open': _.bind(this.onOpenRecent, this)
|
||||
@ -286,15 +291,38 @@ define([
|
||||
menu.hide();
|
||||
},
|
||||
|
||||
clickSaveCopyAsFormat: function(menu, format, ext) {
|
||||
clickSaveCopyAsFormat: function(menu, format, ext, wopiPath) {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
var options = new Asc.asc_CDownloadOptions(format, true);
|
||||
options.asc_setIsSaveAs(true);
|
||||
wopiPath && options.asc_setWopiSaveAsPath(wopiPath);
|
||||
this.api.asc_DownloadAs(options);
|
||||
|
||||
menu.hide();
|
||||
},
|
||||
|
||||
saveAsInWopi: function(menu, format, ext) {
|
||||
var me = this,
|
||||
defFileName = this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption(),
|
||||
fileInfo = this.getApplication().getController('Main').document.info;
|
||||
!defFileName && (defFileName = me.txtUntitled);
|
||||
|
||||
if (typeof ext === 'string') {
|
||||
var idx = defFileName.lastIndexOf('.');
|
||||
if (idx>0)
|
||||
defFileName = defFileName.substring(0, idx) + ext;
|
||||
}
|
||||
(new Common.Views.TextInputDialog({
|
||||
label: me.textSelectPath,
|
||||
value: (fileInfo ? fileInfo.folder || '' : '') + (defFileName || ''),
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
me.clickSaveCopyAsFormat(menu, format, ext, value);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url, fileType) {
|
||||
if (this.isFromFileDownloadAs) {
|
||||
var me = this,
|
||||
@ -859,6 +887,7 @@ define([
|
||||
textReplaceSuccess : 'Search has been done. {0} occurrences have been replaced',
|
||||
textReplaceSkipped : 'The replacement has been made. {0} occurrences were skipped.',
|
||||
textLoadHistory : 'Loading version history...',
|
||||
leavePageText: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.'
|
||||
leavePageText: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
|
||||
textSelectPath: 'Enter a path for saving file copy'
|
||||
}, PE.Controllers.LeftMenu || {}));
|
||||
});
|
||||
@ -410,7 +410,7 @@ define([
|
||||
|
||||
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||
var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false;
|
||||
this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||
this.miSave[this.mode.showSaveButton && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();
|
||||
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
|
||||
@ -488,7 +488,7 @@ define([
|
||||
!this.panels['saveas'] && (this.panels['saveas'] = ((new PE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType})).render()));
|
||||
}
|
||||
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi)) {
|
||||
!this.panels['save-copy'] && (this.panels['save-copy'] = ((new PE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType})).render()));
|
||||
}
|
||||
|
||||
|
||||
@ -897,6 +897,7 @@
|
||||
"PE.Controllers.LeftMenu.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",
|
||||
"PE.Controllers.LeftMenu.textReplaceSuccess": "The search has been done. Occurrences replaced: {0}",
|
||||
"PE.Controllers.LeftMenu.txtUntitled": "Untitled",
|
||||
"PE.Controllers.LeftMenu.textSelectPath": "Enter a path for saving file copy",
|
||||
"PE.Controllers.Main.applyChangesTextText": "Loading data...",
|
||||
"PE.Controllers.Main.applyChangesTitleText": "Loading Data",
|
||||
"PE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
|
||||
|
||||
@ -81,7 +81,12 @@ define([
|
||||
'menu:show': _.bind(this.menuFilesShowHide, this, 'show'),
|
||||
'item:click': _.bind(this.clickMenuFileItem, this),
|
||||
'saveas:format': _.bind(this.clickSaveAsFormat, this),
|
||||
'savecopy:format': _.bind(this.clickSaveCopyAsFormat, this),
|
||||
'savecopy:format': _.bind(function(menu, format, ext) {
|
||||
if (this.mode && this.mode.wopi && ext!==undefined) { // save copy as in wopi
|
||||
this.saveAsInWopi(menu, format, ext);
|
||||
} else
|
||||
this.clickSaveCopyAsFormat(menu, format, ext);
|
||||
}, this),
|
||||
'settings:apply': _.bind(this.applySettings, this),
|
||||
'spellcheck:apply': _.bind(this.applySpellcheckSettings, this),
|
||||
'create:new': _.bind(this.onCreateNew, this),
|
||||
@ -374,7 +379,7 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
clickSaveCopyAsFormat: function(menu, format, ext) {
|
||||
clickSaveCopyAsFormat: function(menu, format, ext, wopiPath) {
|
||||
if (format == Asc.c_oAscFileType.CSV) {
|
||||
var me = this;
|
||||
if (this.api.asc_getWorksheetsCount()>1) {
|
||||
@ -388,6 +393,7 @@ define([
|
||||
me.isFromFileDownloadAs = ext;
|
||||
var options = new Asc.asc_CDownloadOptions(format, true);
|
||||
options.asc_setIsSaveAs(true);
|
||||
wopiPath && options.asc_setWopiSaveAsPath(wopiPath);
|
||||
Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, me.api.asc_getAdvancedOptions(), 2, options);
|
||||
menu.hide();
|
||||
});
|
||||
@ -399,22 +405,46 @@ define([
|
||||
me.isFromFileDownloadAs = ext;
|
||||
var options = new Asc.asc_CDownloadOptions(format, true);
|
||||
options.asc_setIsSaveAs(true);
|
||||
wopiPath && options.asc_setWopiSaveAsPath(wopiPath);
|
||||
Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, me.api.asc_getAdvancedOptions(), 2, options);
|
||||
menu.hide();
|
||||
});
|
||||
} else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA) {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
menu.hide();
|
||||
Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, true);
|
||||
Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, true, wopiPath);
|
||||
} else {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
var options = new Asc.asc_CDownloadOptions(format, true);
|
||||
options.asc_setIsSaveAs(true);
|
||||
wopiPath && options.asc_setWopiSaveAsPath(wopiPath);
|
||||
this.api.asc_DownloadAs(options);
|
||||
menu.hide();
|
||||
}
|
||||
},
|
||||
|
||||
saveAsInWopi: function(menu, format, ext) {
|
||||
var me = this,
|
||||
defFileName = this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption(),
|
||||
fileInfo = this.mode.spreadsheet.info;
|
||||
!defFileName && (defFileName = me.txtUntitled);
|
||||
|
||||
if (typeof ext === 'string') {
|
||||
var idx = defFileName.lastIndexOf('.');
|
||||
if (idx>0)
|
||||
defFileName = defFileName.substring(0, idx) + ext;
|
||||
}
|
||||
(new Common.Views.TextInputDialog({
|
||||
label: me.textSelectPath,
|
||||
value: (fileInfo ? fileInfo.folder || '' : '') + (defFileName || ''),
|
||||
handler: function(result, value) {
|
||||
if (result == 'ok') {
|
||||
me.clickSaveCopyAsFormat(menu, format, ext, value);
|
||||
}
|
||||
}
|
||||
})).show();
|
||||
},
|
||||
|
||||
onDownloadUrl: function(url, fileType) {
|
||||
if (this.isFromFileDownloadAs) {
|
||||
var me = this,
|
||||
@ -1023,6 +1053,7 @@ define([
|
||||
textLoadHistory : 'Loading version history...',
|
||||
leavePageText: 'All unsaved changes in this document will be lost.<br> Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.',
|
||||
warnDownloadCsvSheets: 'The CSV format does not support saving a multi-sheet file.<br>To keep the selected format and save only the current sheet, press Save.<br>To save the current spreadsheet, click Cancel and save it in a different format.',
|
||||
textSave: 'Save'
|
||||
textSave: 'Save',
|
||||
textSelectPath: 'Enter a path for saving file copy'
|
||||
}, SSE.Controllers.LeftMenu || {}));
|
||||
});
|
||||
@ -390,7 +390,7 @@ define([
|
||||
!!pageCount && this.updatePreview();
|
||||
},
|
||||
|
||||
openPrintSettings: function(type, cmp, format, asUrl) {
|
||||
openPrintSettings: function(type, cmp, format, asUrl, wopiPath) {
|
||||
if (this.printSettingsDlg && this.printSettingsDlg.isVisible()) {
|
||||
asUrl && Common.NotificationCenter.trigger('download:cancel');
|
||||
return;
|
||||
@ -400,6 +400,7 @@ define([
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.asUrl = asUrl;
|
||||
this.downloadFormat = format;
|
||||
this.downloadWopiPath = wopiPath;
|
||||
this.printSettingsDlg = (new SSE.Views.PrintSettings({
|
||||
type: type,
|
||||
handler: _.bind(this.resultPrintSettings,this),
|
||||
@ -478,6 +479,7 @@ define([
|
||||
var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl);
|
||||
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||
opts.asc_setIsSaveAs(this.asUrl);
|
||||
this.downloadWopiPath && opts.asc_setWopiSaveAsPath(this.downloadWopiPath);
|
||||
this.api.asc_DownloadAs(opts);
|
||||
}
|
||||
Common.component.Analytics.trackEvent((this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs');
|
||||
|
||||
@ -393,7 +393,7 @@ define([
|
||||
|
||||
this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide']();
|
||||
var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false;
|
||||
this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi) && !isBCSupport ?'show':'hide']();
|
||||
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||
this.miExportToPDF[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
|
||||
this.miSave[this.mode.showSaveButton && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide']();
|
||||
@ -471,7 +471,7 @@ define([
|
||||
!this.panels['saveas'] && (this.panels['saveas'] = (new SSE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType})).render());
|
||||
}
|
||||
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl)) {
|
||||
if (this.mode.canDownload && (this.mode.canRequestSaveAs || this.mode.saveAsUrl || this.mode.wopi)) {
|
||||
!this.panels['save-copy'] && (this.panels['save-copy'] = (new SSE.Views.FileMenuPanels.ViewSaveCopy({menu: this, fileType: this.document.fileType})).render());
|
||||
}
|
||||
|
||||
|
||||
@ -962,6 +962,7 @@
|
||||
"SSE.Controllers.LeftMenu.txtUntitled": "Untitled",
|
||||
"SSE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
|
||||
"SSE.Controllers.LeftMenu.warnDownloadCsvSheets": "The CSV format does not support saving a multi-sheet file.<br>To keep the selected format and save only the current sheet, press Save.<br>To save the current spreadsheet, click Cancel and save it in a different format.",
|
||||
"SSE.Controllers.LeftMenu.textSelectPath": "Enter a path for saving file copy",
|
||||
"SSE.Controllers.Main.confirmAddCellWatches": "This action will add {0} cell watches.<br>Do you want to continue?",
|
||||
"SSE.Controllers.Main.confirmAddCellWatchesMax": "This action will add only {0} cell watches by memory save reason.<br>Do you want to continue?",
|
||||
"SSE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
|
||||
|
||||
Reference in New Issue
Block a user