Commit 882b3eb2 authored by Alexander.Trofimov's avatar 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 f4c63aa5
......@@ -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 - означает, что автосохранения нет)
baseEditorsApi.prototype.asc_setAutoSaveGap = function(autoSaveGap) {
if (typeof autoSaveGap === "number") {
......
......@@ -35,8 +35,8 @@
constructor: asc_CAscEditorPermissions,
asc_getCanLicense: function(){ return this.canLicense; },
asc_getCanEdit: function(){ return this.canEdit; },
asc_getCanDownload: function(){ return this.canDownload; },
asc_getCanEdit: function(){ return this.canEdit; }, //ToDo убрать
asc_getCanDownload: function(){ return this.canDownload; }, //ToDo убрать
asc_getCanCoAuthoring: function(){ return this.canCoAuthoring; },
asc_getCanReaderMode: function(){ return this.canReaderMode; },
asc_getCanBranding: function(){ return this.canBranding; },
......
......@@ -80,6 +80,13 @@ var c_oAscAsyncActionType = {
BlockInteraction : 1
};
var DownloadType = {
None : '',
Download : 'asc_onDownloadUrl',
Print : 'asc_onPrintUrl',
MailMerge : 'asc_onSaveMailMerge'
};
var CellValueType = {
Number : 0,
String : 1,
......
......@@ -377,7 +377,7 @@ var editor;
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) {
......@@ -410,7 +410,7 @@ var editor;
}
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() {
......@@ -605,14 +605,6 @@ var editor;
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) {
var sheetIndex = (undefined !== index && null !== index) ? index : this.wbModel.getActive();
......@@ -692,7 +684,7 @@ var editor;
if ('ok' == input["status"]) {
var url = input["data"];
if (url) {
t.asc_processSavedFile(url, false);
t.processSavedFile(url, false);
} else {
t.handlers.trigger("asc_onError", c_oAscError.ID.Unknown, c_oAscError.Level.NoCritical);
}
......@@ -761,7 +753,7 @@ var editor;
var url = input["data"];
if (url) {
error = c_oAscError.ID.No;
t.asc_processSavedFile(url, options.downloadType);
t.processSavedFile(url, options.downloadType);
}
} else {
error = g_fMapAscServerErrorToAscError(parseInt(input["data"]));
......
......@@ -1023,7 +1023,7 @@ asc_docs_api.prototype.asc_Print = function(bIsDownloadEvent){
window["AscDesktopEditor"]["Print"]();
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);
};
asc_docs_api.prototype.Undo = function(){
......@@ -1178,16 +1178,8 @@ asc_docs_api.prototype.asc_Save = function(isAutoSave) {
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){//передаем число соответствующее своему формату.
var options = bIsDownloadEvent ? {downloadType: 'asc_onDownloadUrl'} : null;
var options = {downloadType: bIsDownloadEvent ? DownloadType.Download: DownloadType.None};
_downloadAs(this, typeFile, c_oAscAsyncAction.DownloadAs, options);
};
asc_docs_api.prototype.Resize = function(){
......
......@@ -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['Share'] = asc_docs_api.prototype.Share;
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['Resize'] = asc_docs_api.prototype.Resize;
asc_docs_api.prototype['AddURL'] = asc_docs_api.prototype.AddURL;
......
......@@ -148,7 +148,7 @@ asc_docs_api.prototype.asc_DownloadAsMailMerge = function(typeFile, StartIndex,
if (null != oDocumentMailMerge)
{
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) {
actionType = c_oAscAsyncAction.DownloadMerge;
options.downloadType = null;
......
......@@ -1697,7 +1697,7 @@ asc_docs_api.prototype.asc_Print = function(bIsDownloadEvent)
}
}
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) {
command = 'savefromorigin';
options.isNoData = true;
......@@ -1866,7 +1866,7 @@ asc_docs_api.prototype.asc_Save = function(isAutoSave) {
asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent) {//передаем число соответствующее своему формату.
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);
};
asc_docs_api.prototype.Resize = function(){
......@@ -1931,7 +1931,7 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode)
};
asc_docs_api.prototype.processSavedFile = function(url, downloadType) {
var t = this;
if (this.mailMergeFileData) {
if (DownloadType.MailMerge === downloadType) {
this.mailMergeFileData = null;
asc_ajax({
url: url,
......@@ -1948,12 +1948,7 @@ asc_docs_api.prototype.processSavedFile = function(url, downloadType) {
}
});
} else {
if (downloadType) {
this.asc_fireCallback(downloadType, url, function (hasError) {
});
} else {
getFile(url);
}
this.constructor.prototype.processSavedFile(url, downloadType);
}
};
asc_docs_api.prototype.startGetDocInfo = function(){
......
......@@ -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['asc_setAdvancedOptions'] = asc_docs_api.prototype.asc_setAdvancedOptions;
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['stopGetDocInfo'] = asc_docs_api.prototype.stopGetDocInfo;
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