Commit 9684a873 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

saveAs

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66845 954022d7-b5bf-4e40-9824-e11837661b57
parent f80aaed7
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
{ {
if (true) if (true)
{ {
this._startOpenDocument(_data); this._startOpenDocument(_data);
History.UserSaveMode = true; History.UserSaveMode = true;
} }
...@@ -133,11 +133,16 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) ...@@ -133,11 +133,16 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//////////////// SAVE ////////////////////// //////////////// SAVE //////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
window["Asc"]['spreadsheet_api'].prototype.asc_Save = function (isNoUserSave) window["Asc"]['spreadsheet_api'].prototype.asc_Save = function (isNoUserSave, isSaveAs)
{ {
var t = this; var t = this;
if (true !== isNoUserSave) if (true !== isNoUserSave)
this.IsUserSave = true; this.IsUserSave = true;
if (this.IsUserSave)
{
this.LastUserSavedIndex = History.UserSavedIndex;
}
if (true === this.canSave && !this.isLongAction()) if (true === this.canSave && !this.isLongAction())
{ {
...@@ -149,13 +154,12 @@ window["Asc"]['spreadsheet_api'].prototype.asc_Save = function (isNoUserSave) ...@@ -149,13 +154,12 @@ window["Asc"]['spreadsheet_api'].prototype.asc_Save = function (isNoUserSave)
this.CoAuthoringApi.onUnSaveLock(); this.CoAuthoringApi.onUnSaveLock();
if (_isNaturalSave === true) if (_isNaturalSave === true)
window["DesktopOfflineAppDocumentStartSave"](); window["DesktopOfflineAppDocumentStartSave"](isSaveAs);
} }
}; };
window["Asc"]['spreadsheet_api'].asc_DownloadAs = function(typeFile, bIsDownloadEvent) window["Asc"]['spreadsheet_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{ {
window["Asc"]["editor"].sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); this.asc_Save(false, true);
window["AscDesktopEditor"]["LocalFileSave"](true);
}; };
window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function() window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function()
...@@ -163,16 +167,27 @@ window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function() ...@@ -163,16 +167,27 @@ window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function()
return true; return true;
}; };
window["DesktopOfflineAppDocumentStartSave"] = function() window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
{ {
window["Asc"]["editor"].sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); window["Asc"]["editor"].sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
window["AscDesktopEditor"]["LocalFileSave"](); if (isSaveAs === true)
window["AscDesktopEditor"]["LocalFileSave"](true);
else
window["AscDesktopEditor"]["LocalFileSave"]();
}; };
window["DesktopOfflineAppDocumentEndSave"] = function(isCancel) window["DesktopOfflineAppDocumentEndSave"] = function(isCancel)
{ {
window["Asc"]["editor"].sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); window["Asc"]["editor"].sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
if (isCancel !== true) if (isCancel !== true)
DesktopOfflineUpdateLocalName(window["Asc"]["editor"]); DesktopOfflineUpdateLocalName(window["Asc"]["editor"]);
else
{
History.UserSavedIndex = window["Asc"]["editor"].LastUserSavedIndex;
window["Asc"]["editor"].onUpdateDocumentModified(History.Is_Modified(true));
}
window["Asc"]["editor"].LastUserSavedIndex = undefined;
}; };
window["Asc"]['spreadsheet_api'].prototype["asc_addImageDrawingObject"] = window["Asc"]['spreadsheet_api'].prototype.asc_addImageDrawingObject; window["Asc"]['spreadsheet_api'].prototype["asc_addImageDrawingObject"] = window["Asc"]['spreadsheet_api'].prototype.asc_addImageDrawingObject;
......
...@@ -93,10 +93,15 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) ...@@ -93,10 +93,15 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//////////////// SAVE ////////////////////// //////////////// SAVE //////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
asc_docs_api.prototype.asc_Save = function (isNoUserSave) asc_docs_api.prototype.asc_Save = function (isNoUserSave, isSaveAs)
{ {
if (true !== isNoUserSave) if (true !== isNoUserSave)
this.IsUserSave = true; this.IsUserSave = true;
if (this.IsUserSave)
{
this.LastUserSavedIndex = History.UserSavedIndex;
}
if (true === this.canSave && !this.isLongAction()) if (true === this.canSave && !this.isLongAction())
{ {
...@@ -108,24 +113,33 @@ asc_docs_api.prototype.asc_Save = function (isNoUserSave) ...@@ -108,24 +113,33 @@ asc_docs_api.prototype.asc_Save = function (isNoUserSave)
this.CoAuthoringApi.onUnSaveLock(); this.CoAuthoringApi.onUnSaveLock();
if (_isNaturalSave === true) if (_isNaturalSave === true)
window["DesktopOfflineAppDocumentStartSave"](); window["DesktopOfflineAppDocumentStartSave"](isSaveAs);
} }
}; };
window["DesktopOfflineAppDocumentStartSave"] = function() window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
{ {
editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
window["AscDesktopEditor"]["LocalFileSave"](); if (isSaveAs === true)
window["AscDesktopEditor"]["LocalFileSave"](true);
else
window["AscDesktopEditor"]["LocalFileSave"]();
}; };
window["DesktopOfflineAppDocumentEndSave"] = function(isCancel) window["DesktopOfflineAppDocumentEndSave"] = function(isCancel)
{ {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
if (isCancel !== true) if (isCancel !== true)
DesktopOfflineUpdateLocalName(editor); DesktopOfflineUpdateLocalName(editor);
else
{
History.UserSavedIndex = editor.LastUserSavedIndex;
editor.UpdateInterfaceState();
}
editor.LastUserSavedIndex = undefined;
}; };
asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent) asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{ {
editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); this.asc_Save(false, true);
window["AscDesktopEditor"]["LocalFileSave"](true);
}; };
asc_docs_api.prototype.AddImageUrl = function(url, imgProp) asc_docs_api.prototype.AddImageUrl = function(url, imgProp)
......
...@@ -110,10 +110,15 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes) ...@@ -110,10 +110,15 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
//////////////// SAVE ////////////////////// //////////////// SAVE //////////////////////
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
asc_docs_api.prototype.asc_Save = function (isNoUserSave) asc_docs_api.prototype.asc_Save = function (isNoUserSave, isSaveAs)
{ {
if (true !== isNoUserSave) if (true !== isNoUserSave)
this.IsUserSave = true; this.IsUserSave = true;
if (this.IsUserSave)
{
this.LastUserSavedIndex = History.UserSavedIndex;
}
if (true === this.canSave && !this.isLongAction()) if (true === this.canSave && !this.isLongAction())
{ {
...@@ -125,24 +130,33 @@ asc_docs_api.prototype.asc_Save = function (isNoUserSave) ...@@ -125,24 +130,33 @@ asc_docs_api.prototype.asc_Save = function (isNoUserSave)
this.CoAuthoringApi.onUnSaveLock(); this.CoAuthoringApi.onUnSaveLock();
if (_isNaturalSave === true) if (_isNaturalSave === true)
window["DesktopOfflineAppDocumentStartSave"](); window["DesktopOfflineAppDocumentStartSave"](isSaveAs);
} }
}; };
window["DesktopOfflineAppDocumentStartSave"] = function() window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
{ {
editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
window["AscDesktopEditor"]["LocalFileSave"](); if (isSaveAs === true)
window["AscDesktopEditor"]["LocalFileSave"](true);
else
window["AscDesktopEditor"]["LocalFileSave"]();
}; };
window["DesktopOfflineAppDocumentEndSave"] = function(isCancel) window["DesktopOfflineAppDocumentEndSave"] = function(isCancel)
{ {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
if (isCancel !== true) if (isCancel !== true)
DesktopOfflineUpdateLocalName(editor); DesktopOfflineUpdateLocalName(editor);
else
{
History.UserSavedIndex = editor.LastUserSavedIndex;
editor.UpdateInterfaceState();
}
editor.LastUserSavedIndex = undefined;
}; };
asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent) asc_docs_api.prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{ {
editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save); this.asc_Save(false, true);
window["AscDesktopEditor"]["LocalFileSave"](true);
}; };
asc_docs_api.prototype.AddImageUrl = function(url, imgProp) asc_docs_api.prototype.AddImageUrl = function(url, imgProp)
......
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