Commit 433c8fee authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

processSavedFile to baseEditorsApi

Add type DownloadType

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66772 954022d7-b5bf-4e40-9824-e11837661b57
parent 63893368
...@@ -315,6 +315,15 @@ baseEditorsApi.prototype.asyncImagesDocumentStartLoaded = function() { ...@@ -315,6 +315,15 @@ baseEditorsApi.prototype.asyncImagesDocumentStartLoaded = function() {
// евент о заморозке не нужен... оно и так заморожено // евент о заморозке не нужен... оно и так заморожено
// просто нужно вывести информацию в статус бар (что началась загрузка картинок) // просто нужно вывести информацию в статус бар (что началась загрузка картинок)
}; };
// Save
baseEditorsApi.prototype.processSavedFile = function(url, downloadType) {
if (DownloadType.None !== downloadType) {
this.sendEvent(downloadType, url, function(hasError) {
});
} else {
getFile(url);
}
};
// Выставление интервала автосохранения (0 - означает, что автосохранения нет) // Выставление интервала автосохранения (0 - означает, что автосохранения нет)
baseEditorsApi.prototype.asc_setAutoSaveGap = function(autoSaveGap) { baseEditorsApi.prototype.asc_setAutoSaveGap = function(autoSaveGap) {
if (typeof autoSaveGap === "number") { if (typeof autoSaveGap === "number") {
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
constructor: asc_CAscEditorPermissions, constructor: asc_CAscEditorPermissions,
asc_getCanLicense: function(){ return this.canLicense; }, asc_getCanLicense: function(){ return this.canLicense; },
asc_getCanEdit: function(){ return this.canEdit; }, asc_getCanEdit: function(){ return this.canEdit; }, //ToDo убрать
asc_getCanDownload: function(){ return this.canDownload; }, asc_getCanDownload: function(){ return this.canDownload; }, //ToDo убрать
asc_getCanCoAuthoring: function(){ return this.canCoAuthoring; }, asc_getCanCoAuthoring: function(){ return this.canCoAuthoring; },
asc_getCanReaderMode: function(){ return this.canReaderMode; }, asc_getCanReaderMode: function(){ return this.canReaderMode; },
asc_getCanBranding: function(){ return this.canBranding; }, asc_getCanBranding: function(){ return this.canBranding; },
......
...@@ -80,6 +80,13 @@ var c_oAscAsyncActionType = { ...@@ -80,6 +80,13 @@ var c_oAscAsyncActionType = {
BlockInteraction : 1 BlockInteraction : 1
}; };
var DownloadType = {
None : '',
Download : 'asc_onDownloadUrl',
Print : 'asc_onPrintUrl',
MailMerge : 'asc_onSaveMailMerge'
};
var CellValueType = { var CellValueType = {
Number : 0, Number : 0,
String : 1, String : 1,
......
...@@ -377,7 +377,7 @@ var editor; ...@@ -377,7 +377,7 @@ var editor;
return; return;
} }
this._asc_downloadAs(typeFile, c_oAscAsyncAction.DownloadAs, {downloadType: bIsDownloadEvent ? 'asc_onDownloadUrl': null}); this._asc_downloadAs(typeFile, c_oAscAsyncAction.DownloadAs, {downloadType: bIsDownloadEvent ? DownloadType.Download: DownloadType.None});
}; };
spreadsheet_api.prototype.asc_Save = function(isAutoSave) { spreadsheet_api.prototype.asc_Save = function(isAutoSave) {
...@@ -410,7 +410,7 @@ var editor; ...@@ -410,7 +410,7 @@ var editor;
} }
this.adjustPrint = adjustPrint ? adjustPrint : new asc_CAdjustPrint(); this.adjustPrint = adjustPrint ? adjustPrint : new asc_CAdjustPrint();
this._asc_downloadAs(c_oAscFileType.PDF, c_oAscAsyncAction.Print, {downloadType: bIsDownloadEvent ? 'asc_onPrintUrl': null}); this._asc_downloadAs(c_oAscFileType.PDF, c_oAscAsyncAction.Print, {downloadType: bIsDownloadEvent ? DownloadType.Print: DownloadType.None});
}; };
spreadsheet_api.prototype.asc_Copy = function() { spreadsheet_api.prototype.asc_Copy = function() {
...@@ -605,14 +605,6 @@ var editor; ...@@ -605,14 +605,6 @@ var editor;
break; break;
} }
}; };
spreadsheet_api.prototype.asc_processSavedFile = function(url, downloadType) {
if (downloadType) {
this.handlers.trigger(downloadType, url, function(hasError) {
});
} else {
getFile(url);
}
};
// Опции страницы (для печати) // Опции страницы (для печати)
spreadsheet_api.prototype.asc_setPageOptions = function(options, index) { spreadsheet_api.prototype.asc_setPageOptions = function(options, index) {
var sheetIndex = (undefined !== index && null !== index) ? index : this.wbModel.getActive(); var sheetIndex = (undefined !== index && null !== index) ? index : this.wbModel.getActive();
...@@ -692,7 +684,7 @@ var editor; ...@@ -692,7 +684,7 @@ var editor;
if ('ok' == input["status"]) { if ('ok' == input["status"]) {
var url = input["data"]; var url = input["data"];
if (url) { if (url) {
t.asc_processSavedFile(url, false); t.processSavedFile(url, false);
} else { } else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
} }
...@@ -761,7 +753,7 @@ var editor; ...@@ -761,7 +753,7 @@ var editor;
var url = input["data"]; var url = input["data"];
if (url) { if (url) {
error = c_oAscError.ID.No; error = c_oAscError.ID.No;
t.asc_processSavedFile(url, options.downloadType); t.processSavedFile(url, options.downloadType);
} }
} else { } else {
error = g_fMapAscServerErrorToAscError(parseInt(input["data"])); error = g_fMapAscServerErrorToAscError(parseInt(input["data"]));
......
...@@ -1023,7 +1023,7 @@ asc_docs_api.prototype.asc_Print = function(bIsDownloadEvent){ ...@@ -1023,7 +1023,7 @@ asc_docs_api.prototype.asc_Print = function(bIsDownloadEvent){
window["AscDesktopEditor"]["Print"](); window["AscDesktopEditor"]["Print"]();
return; return;
} }
var options = bIsDownloadEvent ? {downloadType: 'asc_onPrintUrl'} : null; var options = {downloadType: bIsDownloadEvent ? DownloadType.Print: DownloadType.None};
_downloadAs(this, c_oAscFileType.PDF, c_oAscAsyncAction.Print, options); _downloadAs(this, c_oAscFileType.PDF, c_oAscAsyncAction.Print, options);
}; };
asc_docs_api.prototype.Undo = function(){ asc_docs_api.prototype.Undo = function(){
...@@ -1178,16 +1178,8 @@ asc_docs_api.prototype.asc_Save = function(isAutoSave) { ...@@ -1178,16 +1178,8 @@ asc_docs_api.prototype.asc_Save = function(isAutoSave) {
this.CoAuthoringApi.askSaveChanges(OnSave_Callback); this.CoAuthoringApi.askSaveChanges(OnSave_Callback);
} }
}; };
asc_docs_api.prototype.processSavedFile = function(url, downloadType){
if(downloadType)
editor.asc_fireCallback(downloadType, url, function(hasError){});
else
{
getFile(url);
}
};
asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent){//передаем число соответствующее своему формату. asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent){//передаем число соответствующее своему формату.
var options = bIsDownloadEvent ? {downloadType: 'asc_onDownloadUrl'} : null; var options = {downloadType: bIsDownloadEvent ? DownloadType.Download: DownloadType.None};
_downloadAs(this, typeFile, c_oAscAsyncAction.DownloadAs, options); _downloadAs(this, typeFile, c_oAscAsyncAction.DownloadAs, options);
}; };
asc_docs_api.prototype.Resize = function(){ asc_docs_api.prototype.Resize = function(){
......
...@@ -66,7 +66,6 @@ asc_docs_api.prototype['Cut'] = asc_docs_api.prototype.Cut; ...@@ -66,7 +66,6 @@ asc_docs_api.prototype['Cut'] = asc_docs_api.prototype.Cut;
asc_docs_api.prototype['Paste'] = asc_docs_api.prototype.Paste; asc_docs_api.prototype['Paste'] = asc_docs_api.prototype.Paste;
asc_docs_api.prototype['Share'] = asc_docs_api.prototype.Share; asc_docs_api.prototype['Share'] = asc_docs_api.prototype.Share;
asc_docs_api.prototype['asc_Save'] = asc_docs_api.prototype.asc_Save; asc_docs_api.prototype['asc_Save'] = asc_docs_api.prototype.asc_Save;
asc_docs_api.prototype['processSavedFile'] = asc_docs_api.prototype.processSavedFile;
asc_docs_api.prototype['asc_DownloadAs'] = asc_docs_api.prototype.asc_DownloadAs; asc_docs_api.prototype['asc_DownloadAs'] = asc_docs_api.prototype.asc_DownloadAs;
asc_docs_api.prototype['Resize'] = asc_docs_api.prototype.Resize; asc_docs_api.prototype['Resize'] = asc_docs_api.prototype.Resize;
asc_docs_api.prototype['AddURL'] = asc_docs_api.prototype.AddURL; asc_docs_api.prototype['AddURL'] = asc_docs_api.prototype.AddURL;
......
...@@ -148,7 +148,7 @@ asc_docs_api.prototype.asc_DownloadAsMailMerge = function(typeFile, StartIndex, ...@@ -148,7 +148,7 @@ asc_docs_api.prototype.asc_DownloadAsMailMerge = function(typeFile, StartIndex,
if (null != oDocumentMailMerge) if (null != oDocumentMailMerge)
{ {
var actionType = null; var actionType = null;
var options = {oDocumentMailMerge: oDocumentMailMerge, downloadType: 'asc_onSaveMailMerge', errorDirect: c_oAscError.ID.MailMergeSaveFile}; var options = {oDocumentMailMerge: oDocumentMailMerge, downloadType: DownloadType.MailMerge, errorDirect: c_oAscError.ID.MailMergeSaveFile};
if (bIsDownload) { if (bIsDownload) {
actionType = c_oAscAsyncAction.DownloadMerge; actionType = c_oAscAsyncAction.DownloadMerge;
options.downloadType = null; options.downloadType = null;
......
...@@ -1697,7 +1697,7 @@ asc_docs_api.prototype.asc_Print = function(bIsDownloadEvent) ...@@ -1697,7 +1697,7 @@ asc_docs_api.prototype.asc_Print = function(bIsDownloadEvent)
} }
} }
var command; var command;
var options = {isNoData: false, downloadType: bIsDownloadEvent ? 'asc_onPrintUrl' : null}; var options = {isNoData: false, downloadType: bIsDownloadEvent ? DownloadType.Print: DownloadType.None};
if (null == this.WordControl.m_oLogicDocument) { if (null == this.WordControl.m_oLogicDocument) {
command = 'savefromorigin'; command = 'savefromorigin';
options.isNoData = true; options.isNoData = true;
...@@ -1866,7 +1866,7 @@ asc_docs_api.prototype.asc_Save = function(isAutoSave) { ...@@ -1866,7 +1866,7 @@ asc_docs_api.prototype.asc_Save = function(isAutoSave) {
asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent) {//передаем число соответствующее своему формату. asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent) {//передаем число соответствующее своему формату.
var actionType = this.mailMergeFileData ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs; var actionType = this.mailMergeFileData ? c_oAscAsyncAction.MailMergeLoadFile : c_oAscAsyncAction.DownloadAs;
var options = {downloadType: bIsDownloadEvent ? 'asc_onDownloadUrl' : null}; var options = {downloadType: bIsDownloadEvent ? DownloadType.Download: DownloadType.None};
_downloadAs(this, "save", typeFile, actionType, options, null); _downloadAs(this, "save", typeFile, actionType, options, null);
}; };
asc_docs_api.prototype.Resize = function(){ asc_docs_api.prototype.Resize = function(){
...@@ -1931,7 +1931,7 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode) ...@@ -1931,7 +1931,7 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode)
}; };
asc_docs_api.prototype.processSavedFile = function(url, downloadType) { asc_docs_api.prototype.processSavedFile = function(url, downloadType) {
var t = this; var t = this;
if (this.mailMergeFileData) { if (DownloadType.MailMerge === downloadType) {
this.mailMergeFileData = null; this.mailMergeFileData = null;
asc_ajax({ asc_ajax({
url: url, url: url,
...@@ -1948,12 +1948,7 @@ asc_docs_api.prototype.processSavedFile = function(url, downloadType) { ...@@ -1948,12 +1948,7 @@ asc_docs_api.prototype.processSavedFile = function(url, downloadType) {
} }
}); });
} else { } else {
if (downloadType) { this.constructor.prototype.processSavedFile(url, downloadType);
this.asc_fireCallback(downloadType, url, function (hasError) {
});
} else {
getFile(url);
}
} }
}; };
asc_docs_api.prototype.startGetDocInfo = function(){ asc_docs_api.prototype.startGetDocInfo = function(){
......
...@@ -158,7 +158,6 @@ asc_docs_api.prototype['AddURL'] = asc_docs_api.prototype.AddURL; ...@@ -158,7 +158,6 @@ asc_docs_api.prototype['AddURL'] = asc_docs_api.prototype.AddURL;
asc_docs_api.prototype['Help'] = asc_docs_api.prototype.Help; asc_docs_api.prototype['Help'] = asc_docs_api.prototype.Help;
asc_docs_api.prototype['asc_setAdvancedOptions'] = asc_docs_api.prototype.asc_setAdvancedOptions; asc_docs_api.prototype['asc_setAdvancedOptions'] = asc_docs_api.prototype.asc_setAdvancedOptions;
asc_docs_api.prototype['SetFontRenderingMode'] = asc_docs_api.prototype.SetFontRenderingMode; asc_docs_api.prototype['SetFontRenderingMode'] = asc_docs_api.prototype.SetFontRenderingMode;
asc_docs_api.prototype['processSavedFile'] = asc_docs_api.prototype.processSavedFile;
asc_docs_api.prototype['startGetDocInfo'] = asc_docs_api.prototype.startGetDocInfo; asc_docs_api.prototype['startGetDocInfo'] = asc_docs_api.prototype.startGetDocInfo;
asc_docs_api.prototype['stopGetDocInfo'] = asc_docs_api.prototype.stopGetDocInfo; asc_docs_api.prototype['stopGetDocInfo'] = asc_docs_api.prototype.stopGetDocInfo;
asc_docs_api.prototype['sync_DocInfoCallback'] = asc_docs_api.prototype.sync_DocInfoCallback; asc_docs_api.prototype['sync_DocInfoCallback'] = asc_docs_api.prototype.sync_DocInfoCallback;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment