Merge pull request #216 from ONLYOFFICE/feature/download-as
Feature/download as
This commit is contained in:
commit
dbd8ee98be
|
@ -65,7 +65,7 @@
|
|||
iframePrint.contentWindow.blur();
|
||||
window.focus();
|
||||
} catch (e) {
|
||||
api.asc_DownloadAs(Asc.c_oAscFileType.PDF);
|
||||
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ define([
|
|||
Common.Gateway.requestRestore(record.get('revision'));
|
||||
else {
|
||||
this.isFromSelectRevision = record.get('revision');
|
||||
this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -339,14 +339,14 @@ define([
|
|||
|
||||
switch (this.type) {
|
||||
case Common.Utils.importTextType.CSV:
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this));
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this));
|
||||
break;
|
||||
case Common.Utils.importTextType.TXT:
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(encoding), _.bind(this.previewCallback, this));
|
||||
this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTextOptions(encoding), _.bind(this.previewCallback, this));
|
||||
break;
|
||||
case Common.Utils.importTextType.Paste:
|
||||
case Common.Utils.importTextType.Columns:
|
||||
this.api.asc_TextImport(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste);
|
||||
this.api.asc_TextImport(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar), _.bind(this.previewCallback, this), this.type == Common.Utils.importTextType.Paste);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -204,7 +204,7 @@ DE.ApplicationController = new(function(){
|
|||
|
||||
function onPrint() {
|
||||
if ( permissions.print!==false )
|
||||
api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera);
|
||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera));
|
||||
}
|
||||
|
||||
function onPrintUrl(url) {
|
||||
|
@ -259,7 +259,7 @@ DE.ApplicationController = new(function(){
|
|||
common.utils.openLink(embedConfig.saveUrl);
|
||||
} else
|
||||
if (api && permissions.print!==false){
|
||||
api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera);
|
||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera));
|
||||
}
|
||||
|
||||
Common.Analytics.trackEvent('Save');
|
||||
|
@ -458,7 +458,7 @@ DE.ApplicationController = new(function(){
|
|||
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||
return;
|
||||
}
|
||||
if (api) api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
||||
if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true));
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
|
|
@ -237,7 +237,7 @@ define([
|
|||
if ( isopts ) close_menu = false;
|
||||
else this.clickSaveCopyAsFormat(undefined);
|
||||
break;
|
||||
case 'print': this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); break;
|
||||
case 'print': this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); break;
|
||||
case 'exit': Common.NotificationCenter.trigger('goback'); break;
|
||||
case 'edit':
|
||||
this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText);
|
||||
|
@ -302,13 +302,35 @@ define([
|
|||
buttons: ['ok', 'cancel'],
|
||||
callback: _.bind(function(btn){
|
||||
if (btn == 'ok') {
|
||||
this.api.asc_DownloadAs(format);
|
||||
Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.TXT, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format));
|
||||
menu.hide();
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
} else if (format == Asc.c_oAscFileType.DOCX) {
|
||||
if (!Common.Utils.InternalSettings.get("de-settings-compatible") && !Common.localStorage.getBool("de-hide-save-compatible") /* && this.api.checkCompatibility()*/) {
|
||||
Common.UI.warning({
|
||||
closable: false,
|
||||
width: 600,
|
||||
title: this.notcriticalErrorTitle,
|
||||
msg: this.txtCompatible,
|
||||
buttons: ['ok', 'cancel'],
|
||||
dontshow: true,
|
||||
callback: _.bind(function(btn, dontshow){
|
||||
if (dontshow) Common.localStorage.setItem("de-hide-save-compatible", 1);
|
||||
if (btn == 'ok') {
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
menu.hide();
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
} else {
|
||||
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX);
|
||||
opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible"));
|
||||
this.api.asc_DownloadAs(opts);
|
||||
}
|
||||
} else {
|
||||
this.api.asc_DownloadAs(format);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
menu.hide();
|
||||
}
|
||||
} else
|
||||
|
@ -326,14 +348,38 @@ define([
|
|||
callback: _.bind(function(btn){
|
||||
if (btn == 'ok') {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
this.api.asc_DownloadAs(format, true);
|
||||
Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.TXT, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true));
|
||||
menu.hide();
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
} else if (format == Asc.c_oAscFileType.DOCX) {
|
||||
if (!Common.Utils.InternalSettings.get("de-settings-compatible") && !Common.localStorage.getBool("de-hide-save-compatible") /* && this.api.checkCompatibility()*/) {
|
||||
Common.UI.warning({
|
||||
closable: false,
|
||||
width: 600,
|
||||
title: this.notcriticalErrorTitle,
|
||||
msg: this.txtCompatible,
|
||||
buttons: ['ok', 'cancel'],
|
||||
dontshow: true,
|
||||
callback: _.bind(function(btn, dontshow){
|
||||
if (dontshow) Common.localStorage.setItem("de-hide-save-compatible", 1);
|
||||
if (btn == 'ok') {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true));
|
||||
menu.hide();
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
} else {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true);
|
||||
opts.asc_setCompatible(!!Common.Utils.InternalSettings.get("de-settings-compatible"));
|
||||
this.api.asc_DownloadAs(opts);
|
||||
}
|
||||
} else {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
this.api.asc_DownloadAs(format, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true));
|
||||
menu.hide();
|
||||
}
|
||||
} else {
|
||||
|
@ -822,6 +868,8 @@ define([
|
|||
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.',
|
||||
warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?',
|
||||
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'
|
||||
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.'
|
||||
|
||||
}, DE.Controllers.LeftMenu || {}));
|
||||
});
|
|
@ -195,6 +195,7 @@ define([
|
|||
|
||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||
|
||||
this.isShowOpenDialog = false;
|
||||
|
||||
|
@ -463,7 +464,7 @@ define([
|
|||
|
||||
if ( !_format || _supported.indexOf(_format) < 0 )
|
||||
_format = Asc.c_oAscFileType.DOCX;
|
||||
this.api.asc_DownloadAs(_format, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -890,6 +891,9 @@ define([
|
|||
Common.Utils.InternalSettings.set("de-settings-spellcheck", value);
|
||||
me.api.asc_setSpellCheck(value);
|
||||
|
||||
value = Common.localStorage.getBool("de-settings-compatible", false);
|
||||
Common.Utils.InternalSettings.set("de-settings-compatible", value);
|
||||
|
||||
Common.Utils.InternalSettings.set("de-settings-showsnaplines", me.api.get_ShowSnapLines());
|
||||
|
||||
function checkWarns() {
|
||||
|
@ -1945,25 +1949,28 @@ define([
|
|||
this.getApplication().getController('Toolbar').getView().updateMetricUnit();
|
||||
},
|
||||
|
||||
onAdvancedOptions: function(advOptions, mode) {
|
||||
onAdvancedOptions: function(type, advOptions, mode, formatOptions) {
|
||||
if (this._state.openDlg) return;
|
||||
|
||||
var type = advOptions.asc_getOptionId(),
|
||||
me = this;
|
||||
var me = this;
|
||||
if (type == Asc.c_oAscAdvancedOptionsID.TXT) {
|
||||
me._state.openDlg = new Common.Views.OpenDialog({
|
||||
title: Common.Views.OpenDialog.prototype.txtTitle.replace('%1', 'TXT'),
|
||||
closable: (mode==2), // if save settings
|
||||
type: Common.Utils.importTextType.TXT,
|
||||
preview: advOptions.asc_getOptions().asc_getData(),
|
||||
codepages: advOptions.asc_getOptions().asc_getCodePages(),
|
||||
settings: advOptions.asc_getOptions().asc_getRecommendedSettings(),
|
||||
preview: advOptions.asc_getData(),
|
||||
codepages: advOptions.asc_getCodePages(),
|
||||
settings: advOptions.asc_getRecommendedSettings(),
|
||||
api: me.api,
|
||||
handler: function (result, encoding) {
|
||||
me.isShowOpenDialog = false;
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding));
|
||||
if (mode==2) {
|
||||
formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding));
|
||||
me.api.asc_DownloadAs(formatOptions);
|
||||
} else
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding));
|
||||
me.loadMask && me.loadMask.show();
|
||||
}
|
||||
}
|
||||
|
@ -2002,7 +2009,7 @@ define([
|
|||
},
|
||||
|
||||
onTryUndoInFastCollaborative: function() {
|
||||
if (!window.localStorage.getBool("de-hide-try-undoredo"))
|
||||
if (!Common.localStorage.getBool("de-hide-try-undoredo"))
|
||||
Common.UI.info({
|
||||
width: 500,
|
||||
msg: this.textTryUndoRedo,
|
||||
|
@ -2012,7 +2019,7 @@ define([
|
|||
customButtonText: this.textStrict,
|
||||
dontshow: true,
|
||||
callback: _.bind(function(btn, dontshow){
|
||||
if (dontshow) window.localStorage.setItem("de-hide-try-undoredo", 1);
|
||||
if (dontshow) Common.localStorage.setItem("de-hide-try-undoredo", 1);
|
||||
if (btn == 'custom') {
|
||||
Common.localStorage.setItem("de-settings-coauthmode", 0);
|
||||
Common.Utils.InternalSettings.set("de-settings-coauthmode", false);
|
||||
|
@ -2070,7 +2077,7 @@ define([
|
|||
if (!this.appOptions.canPrint || this.isModalShowed) return;
|
||||
|
||||
if (this.api)
|
||||
this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
Common.component.Analytics.trackEvent('Print');
|
||||
},
|
||||
|
||||
|
@ -2096,7 +2103,7 @@ define([
|
|||
me.iframePrint.contentWindow.blur();
|
||||
window.focus();
|
||||
} catch (e) {
|
||||
me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ define([
|
|||
if ( !_format || _supported.indexOf(_format) < 0 )
|
||||
_format = Asc.c_oAscFileType.PDF;
|
||||
|
||||
_main.api.asc_DownloadAs(_format);
|
||||
_main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format));
|
||||
},
|
||||
'go:editor': function() {
|
||||
Common.Gateway.requestEditRights();
|
||||
|
@ -966,7 +966,7 @@ define([
|
|||
|
||||
onPrint: function(e) {
|
||||
if (this.api)
|
||||
this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
|
||||
|
|
|
@ -198,6 +198,10 @@ define([
|
|||
'<td class="left"><label><%= scope.textAlignGuides %></label></td>',
|
||||
'<td class="right"><span id="fms-chb-align-guides" /></td>',
|
||||
'</tr>','<tr class="divider edit"></tr>',
|
||||
'<tr class="edit">',
|
||||
'<td class="left"><label><%= scope.textCompatible %></label></td>',
|
||||
'<td class="right"><span id="fms-chb-compatible" /></td>',
|
||||
'</tr>','<tr class="divider edit"></tr>',
|
||||
'<tr class="autosave">',
|
||||
'<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>',
|
||||
'<td class="right"><span id="fms-chb-autosave" /></td>',
|
||||
|
@ -270,6 +274,11 @@ define([
|
|||
labelText: this.strSpellCheckMode
|
||||
});
|
||||
|
||||
this.chCompatible = new Common.UI.CheckBox({
|
||||
el: $('#fms-chb-compatible'),
|
||||
labelText: this.textOldVersions
|
||||
});
|
||||
|
||||
this.chAutosave = new Common.UI.CheckBox({
|
||||
el: $('#fms-chb-autosave'),
|
||||
labelText: this.strAutosave
|
||||
|
@ -448,6 +457,7 @@ define([
|
|||
|
||||
this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck"));
|
||||
this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
|
||||
this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible"));
|
||||
},
|
||||
|
||||
applySettings: function() {
|
||||
|
@ -469,6 +479,8 @@ define([
|
|||
if (this.mode.canForcesave)
|
||||
Common.localStorage.setItem("de-settings-forcesave", this.chForcesave.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
|
||||
Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
|
||||
Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
|
||||
Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked());
|
||||
Common.localStorage.save();
|
||||
|
||||
|
@ -531,7 +543,9 @@ define([
|
|||
txtFitWidth: 'Fit to Width',
|
||||
textForceSave: 'Save to Server',
|
||||
strForcesave: 'Always save to server (otherwise save to server on document close)',
|
||||
strResolvedComment: 'Turn on display of the resolved comments'
|
||||
strResolvedComment: 'Turn on display of the resolved comments',
|
||||
textCompatible: 'Compatibility',
|
||||
textOldVersions: 'Make the files compatible with older MS Word versions'
|
||||
}, DE.Views.FileMenuPanels.Settings || {}));
|
||||
|
||||
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
|
||||
|
|
|
@ -330,6 +330,7 @@
|
|||
"DE.Controllers.LeftMenu.txtUntitled": "Untitled",
|
||||
"DE.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?",
|
||||
"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.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.",
|
||||
"DE.Controllers.Main.applyChangesTextText": "Loading the changes...",
|
||||
"DE.Controllers.Main.applyChangesTitleText": "Loading the Changes",
|
||||
"DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.",
|
||||
|
@ -1423,6 +1424,8 @@
|
|||
"DE.Views.FileMenuPanels.Settings.txtPt": "Point",
|
||||
"DE.Views.FileMenuPanels.Settings.txtSpellCheck": "Spell Checking",
|
||||
"DE.Views.FileMenuPanels.Settings.txtWin": "as Windows",
|
||||
"DE.Views.FileMenuPanels.Settings.textCompatible": "Compatibility",
|
||||
"DE.Views.FileMenuPanels.Settings.textOldVersions": "Make the files compatible with older MS Word versions",
|
||||
"DE.Views.HeaderFooterSettings.textBottomCenter": "Bottom center",
|
||||
"DE.Views.HeaderFooterSettings.textBottomLeft": "Bottom left",
|
||||
"DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page",
|
||||
|
|
|
@ -322,7 +322,7 @@ define([
|
|||
if (type && typeof type[1] === 'string') {
|
||||
this.api.asc_DownloadOrigin(true)
|
||||
} else {
|
||||
this.api.asc_DownloadAs(Asc.c_oAscFileType.DOCX, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1113,17 +1113,16 @@ define([
|
|||
Common.Utils.ThemeColor.setColors(colors, standart_colors);
|
||||
},
|
||||
|
||||
onAdvancedOptions: function(advOptions) {
|
||||
onAdvancedOptions: function(type, advOptions) {
|
||||
if (this._state.openDlg) return;
|
||||
|
||||
var type = advOptions.asc_getOptionId(),
|
||||
me = this;
|
||||
var me = this;
|
||||
if (type == Asc.c_oAscAdvancedOptionsID.TXT) {
|
||||
var picker,
|
||||
pages = [],
|
||||
pagesName = [];
|
||||
|
||||
_.each(advOptions.asc_getOptions().asc_getCodePages(), function(page) {
|
||||
_.each(advOptions.asc_getCodePages(), function(page) {
|
||||
pages.push(page.asc_getCodePage());
|
||||
pagesName.push(page.asc_getCodePageName());
|
||||
});
|
||||
|
@ -1150,7 +1149,7 @@ define([
|
|||
var encoding = picker.value;
|
||||
|
||||
if (me.api) {
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding));
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding));
|
||||
|
||||
if (!me._isDocReady) {
|
||||
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
|
||||
|
@ -1166,7 +1165,7 @@ define([
|
|||
container: '#txt-encoding',
|
||||
toolbar: false,
|
||||
rotateEffect: true,
|
||||
value: [advOptions.asc_getOptions().asc_getRecommendedSettings().asc_getCodePage()],
|
||||
value: [advOptions.asc_getRecommendedSettings().asc_getCodePage()],
|
||||
cols: [{
|
||||
values: pages,
|
||||
displayValues: pagesName
|
||||
|
|
|
@ -567,13 +567,13 @@ define([
|
|||
me.warnDownloadAs,
|
||||
me.notcriticalErrorTitle,
|
||||
function () {
|
||||
me.api.asc_DownloadAs(format);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
_.defer(function () {
|
||||
me.api.asc_DownloadAs(format);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ PE.ApplicationController = new(function(){
|
|||
|
||||
function onPrint() {
|
||||
if (permissions.print!==false)
|
||||
api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera);
|
||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera));
|
||||
}
|
||||
|
||||
function onPrintUrl(url) {
|
||||
|
@ -267,7 +267,7 @@ PE.ApplicationController = new(function(){
|
|||
common.utils.openLink(embedConfig.saveUrl);
|
||||
} else
|
||||
if (api && permissions.print!==false){
|
||||
api.asc_Print($.browser.chrome || $.browser.safari || $.browser.opera);
|
||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera));
|
||||
}
|
||||
|
||||
Common.Analytics.trackEvent('Save');
|
||||
|
@ -558,7 +558,7 @@ PE.ApplicationController = new(function(){
|
|||
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||
return;
|
||||
}
|
||||
if (api) api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
|
||||
if (api) api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true));
|
||||
}
|
||||
// Helpers
|
||||
// -------------------------
|
||||
|
|
|
@ -215,7 +215,7 @@ define([
|
|||
case 'back': break;
|
||||
case 'save': this.api.asc_Save(); break;
|
||||
case 'save-desktop': this.api.asc_DownloadAs(); break;
|
||||
case 'print': this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); break;
|
||||
case 'print': this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); break;
|
||||
case 'exit': Common.NotificationCenter.trigger('goback'); break;
|
||||
case 'edit':
|
||||
this.getApplication().getController('Statusbar').setStatusCaption(this.requestEditRightsText);
|
||||
|
@ -247,13 +247,13 @@ define([
|
|||
},
|
||||
|
||||
clickSaveAsFormat: function(menu, format) {
|
||||
this.api.asc_DownloadAs(format);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
menu.hide();
|
||||
},
|
||||
|
||||
clickSaveCopyAsFormat: function(menu, format, ext) {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
this.api.asc_DownloadAs(format, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true));
|
||||
menu.hide();
|
||||
},
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ define([
|
|||
|
||||
if ( !_format || _supported.indexOf(_format) < 0 )
|
||||
_format = Asc.c_oAscFileType.PPTX;
|
||||
this.api.asc_DownloadAs(_format, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true));
|
||||
},
|
||||
|
||||
onProcessMouse: function(data) {
|
||||
|
@ -1758,7 +1758,7 @@ define([
|
|||
if (!this.appOptions.canPrint || this.isModalShowed) return;
|
||||
|
||||
if (this.api)
|
||||
this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
Common.component.Analytics.trackEvent('Print');
|
||||
},
|
||||
|
||||
|
@ -1784,18 +1784,17 @@ define([
|
|||
me.iframePrint.contentWindow.blur();
|
||||
window.focus();
|
||||
} catch (e) {
|
||||
me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF));
|
||||
}
|
||||
};
|
||||
}
|
||||
if (url) this.iframePrint.src = url;
|
||||
},
|
||||
|
||||
onAdvancedOptions: function(advOptions) {
|
||||
onAdvancedOptions: function(type, advOptions) {
|
||||
if (this._state.openDlg) return;
|
||||
|
||||
var type = advOptions.asc_getOptionId(),
|
||||
me = this;
|
||||
var me = this;
|
||||
if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||
me._state.openDlg = new Common.Views.OpenDialog({
|
||||
title: Common.Views.OpenDialog.prototype.txtTitleProtected,
|
||||
|
|
|
@ -161,7 +161,7 @@ define([
|
|||
if ( !_format || _supported.indexOf(_format) < 0 )
|
||||
_format = Asc.c_oAscFileType.PDF;
|
||||
|
||||
_main.api.asc_DownloadAs(_format);
|
||||
_main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format));
|
||||
},
|
||||
'go:editor': function() {
|
||||
Common.Gateway.requestEditRights();
|
||||
|
@ -893,7 +893,7 @@ define([
|
|||
|
||||
onPrint: function(e) {
|
||||
if (this.api)
|
||||
this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
this.api.asc_Print(new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera)); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
|
||||
|
|
|
@ -311,7 +311,7 @@ define([
|
|||
return;
|
||||
}
|
||||
this._state.isFromGatewayDownloadAs = true;
|
||||
this.api.asc_DownloadAs(Asc.c_oAscFileType.PPTX, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true));
|
||||
},
|
||||
|
||||
goBack: function(current) {
|
||||
|
@ -1089,11 +1089,10 @@ define([
|
|||
this.isThumbnailsShow = isShow;
|
||||
},
|
||||
|
||||
onAdvancedOptions: function(advOptions) {
|
||||
onAdvancedOptions: function(type, advOptions) {
|
||||
if (this._state.openDlg) return;
|
||||
|
||||
var type = advOptions.asc_getOptionId(),
|
||||
me = this;
|
||||
var me = this;
|
||||
|
||||
if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||
$(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask);
|
||||
|
|
|
@ -381,7 +381,7 @@ define([
|
|||
|
||||
if (format) {
|
||||
_.defer(function () {
|
||||
me.api.asc_DownloadAs(format);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ SSE.ApplicationController = new(function(){
|
|||
|
||||
function onPrint() {
|
||||
if ( permissions.print!==false )
|
||||
api.asc_Print(undefined, $.browser.chrome || $.browser.safari || $.browser.opera);
|
||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera));
|
||||
}
|
||||
|
||||
function onPrintUrl(url) {
|
||||
|
@ -204,7 +204,7 @@ SSE.ApplicationController = new(function(){
|
|||
common.utils.openLink(embedConfig.saveUrl);
|
||||
} else
|
||||
if (permissions.print!==false){
|
||||
api.asc_Print(undefined, $.browser.chrome || $.browser.safari || $.browser.opera);
|
||||
api.asc_Print(new Asc.asc_CDownloadOptions(null, $.browser.chrome || $.browser.safari || $.browser.opera));
|
||||
}
|
||||
|
||||
Common.Analytics.trackEvent('Save');
|
||||
|
@ -464,7 +464,7 @@ SSE.ApplicationController = new(function(){
|
|||
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny);
|
||||
return;
|
||||
}
|
||||
api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true);
|
||||
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true));
|
||||
}
|
||||
|
||||
function onApiMouseMove(array) {
|
||||
|
|
|
@ -68,7 +68,7 @@ define([
|
|||
});
|
||||
|
||||
this._state = {
|
||||
CSVOptions: new Asc.asc_CCSVAdvancedOptions(0, 4, '')
|
||||
CSVOptions: new Asc.asc_CTextOptions(0, 4, '')
|
||||
};
|
||||
},
|
||||
onLaunch: function () {
|
||||
|
@ -177,7 +177,7 @@ define([
|
|||
handler: function (result, encoding, delimiter, delimiterChar) {
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_TextToColumns(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
|
||||
me.api.asc_TextToColumns(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2204,7 +2204,7 @@ define([
|
|||
if (me && me.api) {
|
||||
var props = new Asc.SpecialPasteProps();
|
||||
props.asc_setProps(Asc.c_oSpecialPasteProps.useTextImport);
|
||||
props.asc_setAdvancedOptions(new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
|
||||
props.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar));
|
||||
me.api.asc_SpecialPaste(props);
|
||||
}
|
||||
me._state.lastSpecPasteChecked = item;
|
||||
|
|
|
@ -264,7 +264,7 @@ define([
|
|||
buttons: ['ok', 'cancel'],
|
||||
callback: _.bind(function(btn){
|
||||
if (btn == 'ok') {
|
||||
this.api.asc_DownloadAs(format);
|
||||
Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format));
|
||||
menu.hide();
|
||||
}
|
||||
}, this)
|
||||
|
@ -273,7 +273,7 @@ define([
|
|||
menu.hide();
|
||||
Common.NotificationCenter.trigger('download:settings', this.leftMenu, format);
|
||||
} else {
|
||||
this.api.asc_DownloadAs(format);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
menu.hide();
|
||||
}
|
||||
},
|
||||
|
@ -287,7 +287,7 @@ define([
|
|||
callback: _.bind(function(btn){
|
||||
if (btn == 'ok') {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
this.api.asc_DownloadAs(format, true);
|
||||
Common.NotificationCenter.trigger('download:advanced', Asc.c_oAscAdvancedOptionsID.CSV, this.api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format, true));
|
||||
menu.hide();
|
||||
}
|
||||
}, this)
|
||||
|
@ -298,7 +298,7 @@ define([
|
|||
Common.NotificationCenter.trigger('download:settings', this.leftMenu, format, true);
|
||||
} else {
|
||||
this.isFromFileDownloadAs = ext;
|
||||
this.api.asc_DownloadAs(format, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format, true));
|
||||
menu.hide();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -168,6 +168,7 @@ define([
|
|||
Common.NotificationCenter.on('goback', _.bind(this.goBack, this));
|
||||
Common.NotificationCenter.on('namedrange:locked', _.bind(this.onNamedRangeLocked, this));
|
||||
Common.NotificationCenter.on('download:cancel', _.bind(this.onDownloadCancel, this));
|
||||
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
|
||||
|
||||
this.stackLongActions = new Common.IrregularStack({
|
||||
strongCompare : this._compareActionStrong,
|
||||
|
@ -434,7 +435,7 @@ define([
|
|||
if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA)
|
||||
Common.NotificationCenter.trigger('download:settings', this, _format, true);
|
||||
else
|
||||
this.api.asc_DownloadAs(_format, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true));
|
||||
},
|
||||
|
||||
onProcessMouse: function(data) {
|
||||
|
@ -1602,25 +1603,28 @@ define([
|
|||
return false;
|
||||
},
|
||||
|
||||
onAdvancedOptions: function(advOptions, mode) {
|
||||
onAdvancedOptions: function(type, advOptions, mode, formatOptions) {
|
||||
if (this._state.openDlg) return;
|
||||
|
||||
var type = advOptions.asc_getOptionId(),
|
||||
me = this;
|
||||
var me = this;
|
||||
if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
|
||||
me._state.openDlg = new Common.Views.OpenDialog({
|
||||
title: Common.Views.OpenDialog.prototype.txtTitle.replace('%1', 'CSV'),
|
||||
closable: (mode==2), // if save settings
|
||||
type: Common.Utils.importTextType.CSV,
|
||||
preview: advOptions.asc_getOptions().asc_getData(),
|
||||
codepages: advOptions.asc_getOptions().asc_getCodePages(),
|
||||
settings: advOptions.asc_getOptions().asc_getRecommendedSettings(),
|
||||
preview: advOptions.asc_getData(),
|
||||
codepages: advOptions.asc_getCodePages(),
|
||||
settings: advOptions.asc_getRecommendedSettings(),
|
||||
api: me.api,
|
||||
handler: function (result, encoding, delimiter, delimiterChar) {
|
||||
me.isShowOpenDialog = false;
|
||||
if (result == 'ok') {
|
||||
if (me && me.api) {
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter, delimiterChar));
|
||||
if (mode==2) {
|
||||
formatOptions && formatOptions.asc_setAdvancedOptions(new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar));
|
||||
me.api.asc_DownloadAs(formatOptions);
|
||||
} else
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter, delimiterChar));
|
||||
me.loadMask && me.loadMask.show();
|
||||
}
|
||||
}
|
||||
|
@ -2021,7 +2025,9 @@ define([
|
|||
me.iframePrint.contentWindow.blur();
|
||||
window.focus();
|
||||
} catch (e) {
|
||||
me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF, false, me.getApplication().getController('Print').getPrintParams());
|
||||
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
|
||||
opts.asc_setAdvancedOptions(me.getApplication().getController('Print').getPrintParams());
|
||||
me.api.asc_DownloadAs(opts);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -266,10 +266,15 @@ define([
|
|||
this.adjPrintParams.asc_setIgnorePrintArea(this.printSettingsDlg.getIgnorePrintArea());
|
||||
Common.localStorage.setItem("sse-print-settings-range", printtype);
|
||||
|
||||
if ( this.printSettingsDlg.type=='print' )
|
||||
this.api.asc_Print(this.adjPrintParams, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera);
|
||||
else
|
||||
this.api.asc_DownloadAs(this.downloadFormat, this.asUrl, this.adjPrintParams);
|
||||
if ( this.printSettingsDlg.type=='print' ) {
|
||||
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera);
|
||||
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||
this.api.asc_Print(opts);
|
||||
} else {
|
||||
var opts = new Asc.asc_CDownloadOptions(this.downloadFormat, this.asUrl);
|
||||
opts.asc_setAdvancedOptions(this.adjPrintParams);
|
||||
this.api.asc_DownloadAs(opts);
|
||||
}
|
||||
Common.component.Analytics.trackEvent((this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs');
|
||||
Common.component.Analytics.trackEvent('ToolBar', (this.printSettingsDlg.type=='print') ? 'Print' : 'DownloadAs');
|
||||
Common.NotificationCenter.trigger('edit:complete', view);
|
||||
|
|
|
@ -113,7 +113,7 @@ define([
|
|||
if (_format == Asc.c_oAscFileType.PDF || _format == Asc.c_oAscFileType.PDFA)
|
||||
Common.NotificationCenter.trigger('download:settings', this.toolbar, _format);
|
||||
else
|
||||
_main.api.asc_DownloadAs(_format);
|
||||
_main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format));
|
||||
},
|
||||
'go:editor': function() {
|
||||
Common.Gateway.requestEditRights();
|
||||
|
|
|
@ -319,7 +319,7 @@ define([
|
|||
return;
|
||||
}
|
||||
this._state.isFromGatewayDownloadAs = true;
|
||||
this.api.asc_DownloadAs(Asc.c_oAscFileType.XLSX, true);
|
||||
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true));
|
||||
},
|
||||
|
||||
goBack: function(current) {
|
||||
|
@ -1213,17 +1213,16 @@ define([
|
|||
Common.Utils.ThemeColor.setColors(colors, standart_colors);
|
||||
},
|
||||
|
||||
onAdvancedOptions: function(advOptions) {
|
||||
onAdvancedOptions: function(type, advOptions) {
|
||||
if (this._state.openDlg) return;
|
||||
|
||||
var type = advOptions.asc_getOptionId(),
|
||||
me = this;
|
||||
var me = this;
|
||||
if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
|
||||
var picker,
|
||||
pages = [],
|
||||
pagesName = [];
|
||||
|
||||
_.each(advOptions.asc_getOptions().asc_getCodePages(), function(page) {
|
||||
_.each(advOptions.asc_getCodePages(), function(page) {
|
||||
pages.push(page.asc_getCodePage());
|
||||
pagesName.push(page.asc_getCodePageName());
|
||||
});
|
||||
|
@ -1252,7 +1251,7 @@ define([
|
|||
delimiter = picker.cols[1].value;
|
||||
|
||||
if (me.api) {
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CCSVAdvancedOptions(encoding, delimiter));
|
||||
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter));
|
||||
|
||||
if (!me._isDocReady) {
|
||||
me.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument);
|
||||
|
@ -1264,7 +1263,7 @@ define([
|
|||
]
|
||||
});
|
||||
|
||||
var recommendedSettings = advOptions.asc_getOptions().asc_getRecommendedSettings();
|
||||
var recommendedSettings = advOptions.asc_getRecommendedSettings();
|
||||
|
||||
picker = uiApp.picker({
|
||||
container: '#txt-encoding',
|
||||
|
|
|
@ -676,11 +676,11 @@ define([
|
|||
me.warnDownloadAs,
|
||||
me.notcriticalErrorTitle,
|
||||
function () {
|
||||
me.api.asc_DownloadAs(format);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
}
|
||||
);
|
||||
} else {
|
||||
me.api.asc_DownloadAs(format);
|
||||
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
|
||||
}
|
||||
|
||||
me.hideModal();
|
||||
|
|
Loading…
Reference in a new issue