Commit 7f4bd09b authored by Boris Kocherov's avatar Boris Kocherov

integrate jio rails with ooffice

parent 75a1c300
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
"../common/apiBase.js", "../common/apiBase.js",
"../common/Private/license.js", "../common/Private/license.js",
"../word/apiCommon.js", "../word/apiCommon.js",
"../cell/api.js" "../cell/api.js",
"../common/Local/license.js",
"../common/Local/jio.js"
], ],
"common": [ "common": [
"../common/downloaderfiles.js", "../common/downloaderfiles.js",
...@@ -95,7 +97,6 @@ ...@@ -95,7 +97,6 @@
"../common/easysax.js", "../common/easysax.js",
"../common/openxml.js", "../common/openxml.js",
"../cell/document/empty-workbook.js",
"../cell/model/UndoRedo.js", "../cell/model/UndoRedo.js",
"../cell/model/clipboard.js", "../cell/model/clipboard.js",
"../cell/model/autofilters.js", "../cell/model/autofilters.js",
...@@ -217,7 +218,9 @@ ...@@ -217,7 +218,9 @@
"../common/text_input.js", "../common/text_input.js",
"../common/Drawings/Format/OleObject.js", "../common/Drawings/Format/OleObject.js",
"../common/Drawings/Format/DrawingContent.js", "../common/Drawings/Format/DrawingContent.js",
"../common/plugins.js" "../common/plugins.js",
"../common/Local/common_jio.js",
"../cell/Local/api_jio.js"
], ],
"private": [ "private": [
"../cell/Private/comments.js" "../cell/Private/comments.js"
......
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
"../common/apiBase.js", "../common/apiBase.js",
"../common/Private/license.js", "../common/Private/license.js",
"../word/apiCommon.js", "../word/apiCommon.js",
"../slide/api.js" "../slide/api.js",
"../common/Local/license.js",
"../common/Local/empty_slide.js",
"../common/Local/jio.js"
], ],
"common": [ "common": [
"../common/downloaderfiles.js", "../common/downloaderfiles.js",
...@@ -204,7 +207,9 @@ ...@@ -204,7 +207,9 @@
"../common/text_input.js", "../common/text_input.js",
"../common/Drawings/Format/OleObject.js", "../common/Drawings/Format/OleObject.js",
"../common/Drawings/Format/DrawingContent.js", "../common/Drawings/Format/DrawingContent.js",
"../common/plugins.js" "../common/plugins.js",
"../common/Local/common_jio.js",
"../slide/Local/api_jio.js"
], ],
"private": [ "private": [
"../slide/Private/comments.js", "../slide/Private/comments.js",
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
"../common/apiBase.js", "../common/apiBase.js",
"../common/Private/license.js", "../common/Private/license.js",
"../word/apiCommon.js", "../word/apiCommon.js",
"../word/api.js" "../word/api.js",
"../common/Local/license.js",
"../common/Local/jio.js"
], ],
"common": [ "common": [
"../common/downloaderfiles.js", "../common/downloaderfiles.js",
...@@ -195,7 +197,9 @@ ...@@ -195,7 +197,9 @@
"../common/text_input.js", "../common/text_input.js",
"../common/Drawings/Format/OleObject.js", "../common/Drawings/Format/OleObject.js",
"../common/Drawings/Format/DrawingContent.js", "../common/Drawings/Format/DrawingContent.js",
"../common/plugins.js" "../common/plugins.js",
"../common/Local/common_jio.js",
"../word/Local/api_jio.js"
], ],
"private": [ "private": [
"../common/Private/versionHistory.js", "../common/Private/versionHistory.js",
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
// Import
var c_oAscError = Asc.c_oAscError;
/////////////////////////////////////////////////////////
////////////// OPEN ////////////////////////
/////////////////////////////////////////////////////////
(/**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
*/
function($, window, undefined) {
var asc = window["Asc"];
var prot;
asc['spreadsheet_api'].prototype._OfflineAppDocumentStartLoad = function()
{
this.asc_registerCallback('asc_onDocumentContentReady', function(){
DesktopOfflineUpdateLocalName(window["Asc"]["editor"]);
});
this.jio_open();
};
asc['spreadsheet_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
return;
}
this.openDocument(_data);
AscCommon.History.UserSaveMode = true;
DesktopOfflineUpdateLocalName(this);
this.onUpdateDocumentModified(AscCommon.History.Is_Modified());
};
asc['spreadsheet_api'].prototype._onNeedParams = function(data)
{
var cp = JSON.parse("{\"codepage\":46,\"delimiter\":1}");
cp['encodings'] = AscCommon.getEncodingParams();
this.handlers.trigger("asc_onAdvancedOptions", new AscCommon.asc_CAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, cp), AscCommon.c_oAscAdvancedOptionsAction.Open);
};
asc['spreadsheet_api'].prototype.asc_addImageDrawingObject = function(url)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
var ws = this.wb.getWorksheet();
if (ws)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
ws.objectRender.addImageDrawingObject(AscCommon.g_oDocumentUrls.getImageUrl(_url) , null);
}
};
asc['spreadsheet_api'].prototype.asc_showImageFileDialog = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
asc['spreadsheet_api'].prototype.asc_addImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
})(jQuery, window);
window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions = function(idOption, option)
{
window["AscDesktopEditor"]["SetAdvancedOptions"]("" + option.asc_getCodePage(), "" + option.asc_getDelimiter());
};
window["Asc"]['spreadsheet_api'].prototype["asc_setAdvancedOptions"] = window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions;
window["asc_initAdvancedOptions"] = function()
{
window["Asc"]["editor"]._onNeedParams(undefined);
};
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
{
AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
{
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("/") != 0)
AscCommon.g_oDocumentUrls.documentUrl = "/" + AscCommon.g_oDocumentUrls.documentUrl;
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
}
window["Asc"]["editor"]._OfflineAppDocumentEndLoad(_data);
};
/////////////////////////////////////////////////////////
////////////// CHANGES /////////////////////
/////////////////////////////////////////////////////////
AscCommon.CHistory.prototype.Reset_SavedIndex = function(IsUserSave)
{
if (true === this.Is_UserSaveMode())
{
this.SavedIndex = this.Index;
if (true === IsUserSave)
{
this.UserSavedIndex = this.Index;
this.ForceSave = false;
}
}
else
{
this.SavedIndex = this.Index;
this.ForceSave = false;
}
};
AscCommon.CHistory.prototype.Is_Modified = function(IsNotUserSave, IsNoSavedNoModifyed)
{
var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex;
if (-1 === this.Index && null === checkIndex && false === this.ForceSave)
{
if (window["AscDesktopEditor"])
{
if (0 != window["AscDesktopEditor"]["LocalFileGetOpenChangesCount"]())
return true;
if (!window["AscDesktopEditor"]["LocalFileGetSaved"]() && IsNoSavedNoModifyed !== true)
return true;
}
return false;
}
return (this.Index != checkIndex || true === this.ForceSave);
};
window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
{
for (var i = 0, l = _changes.length; i < l; ++i)
{
window["Asc"]["editor"].CoAuthoringApi.onSaveChanges(_changes[i], null, true);
}
};
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
window["Asc"]['spreadsheet_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{
this.asc_Save(false, true);
};
window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function()
{
return true;
};
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
{
window["Asc"]["editor"].sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
var _param = "";
if (isSaveAs === true)
_param += "saveas=true;";
if (AscCommon.AscBrowser.isRetina)
_param += "retina=true;";
window["AscDesktopEditor"]["LocalFileSave"](_param);
};
window["DesktopOfflineAppDocumentEndSave"] = function(error)
{
window["Asc"]["editor"].sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
if (0 == error)
DesktopOfflineUpdateLocalName(window["Asc"]["editor"]);
else
AscCommon.History.UserSavedIndex = window["Asc"]["editor"].LastUserSavedIndex;
window["Asc"]["editor"].onUpdateDocumentModified(AscCommon.History.Is_Modified());
window["Asc"]["editor"].LastUserSavedIndex = undefined;
if (2 == error)
window["Asc"]["editor"].sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.NoCritical);
};
window["Asc"]['spreadsheet_api'].prototype["asc_addImageDrawingObject"] = window["Asc"]['spreadsheet_api'].prototype.asc_addImageDrawingObject;
window["Asc"]['spreadsheet_api'].prototype["asc_showImageFileDialog"] = window["Asc"]['spreadsheet_api'].prototype.asc_showImageFileDialog;
window["Asc"]['spreadsheet_api'].prototype["asc_Save"] = window["Asc"]['spreadsheet_api'].prototype.asc_Save;
window["Asc"]['spreadsheet_api'].prototype["asc_DownloadAs"] = window["Asc"]['spreadsheet_api'].prototype.asc_DownloadAs;
window["Asc"]['spreadsheet_api'].prototype["asc_isOffline"] = window["Asc"]['spreadsheet_api'].prototype.asc_isOffline;
window["Asc"]['spreadsheet_api'].prototype["asc_addImage"] = window["Asc"]['spreadsheet_api'].prototype.asc_addImage;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{
if (url == "")
return;
var ws = window["Asc"]["editor"].wb.getWorksheet();
if (ws)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
ws.objectRender.addImageDrawingObject(AscCommon.g_oDocumentUrls.getImageUrl(_url) , null);
}
};
window["on_editor_native_message"] = function(sCommand, sParam)
{
if (!window["Asc"]["editor"])
return;
if (sCommand == "save")
window["Asc"]["editor"].asc_Save();
else if (sCommand == "saveAs")
window["Asc"]["editor"].asc_Save(false, true);
else if (sCommand == "print")
window["Asc"]["editor"].asc_Print();
};
\ No newline at end of file
...@@ -1641,6 +1641,7 @@ var editor; ...@@ -1641,6 +1641,7 @@ var editor;
// Обновляем состояние возможности сохранения документа // Обновляем состояние возможности сохранения документа
t.onUpdateDocumentModified(History.Have_Changes()); t.onUpdateDocumentModified(History.Have_Changes());
t.jio_save();
if (undefined !== window["AscDesktopEditor"]) { if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["OnSave"](); window["AscDesktopEditor"]["OnSave"]();
} }
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
///////////////////////////////////////////////////////
//////////// FONTS ////////////////////////
///////////////////////////////////////////////////////
//AscFonts.CFontFileLoader.prototype.LoadFontAsync = function(basePath, _callback, isEmbed)
//{
// debugger;
// this.callback = _callback;
// if (-1 != this.Status)
// return true;
//
// var oThis = this;
// this.Status = 2;
// if (window["AscDesktopEditor"] !== undefined && !this.CanUseOriginalFormat)
// {
// this.callback = null;
// window["AscDesktopEditor"]["LoadFontBase64"](this.Id);
// this._callback_font_load();
// return;
// }
//
// var xhr = new XMLHttpRequest();
// xhr.open('GET', "ascdesktop://fonts/" + this.Id, true);
// xhr.responseType = 'arraybuffer';
//
// if (xhr.overrideMimeType)
// xhr.overrideMimeType('text/plain; charset=x-user-defined');
// else
// xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
//
// xhr.onload = function()
// {
// if (this.status != 200)
// {
// oThis.Status = 1;
// return;
// }
//
// oThis.Status = 0;
//
// var fontStreams = AscFonts.g_fonts_streams;
// if (this.response)
// {
// var __font_data_idx = fontStreams.length;
// var _uintData = new Uint8Array(this.response);
// fontStreams[__font_data_idx] = new AscFonts.FT_Stream(_uintData, _uintData.length);
// oThis.SetStreamIndex(__font_data_idx);
// }
// else
// {
// var __font_data_idx = fontStreams.length;
// fontStreams[__font_data_idx] = AscFonts.CreateFontData3(this.responseText);
// oThis.SetStreamIndex(__font_data_idx);
//
// if (null != oThis.callback)
// oThis.callback();
// }
// };
//
// xhr.send(null);
//};
/////////////////////////////////////////////////////////
////////////// IMAGES ////////////////////////
/////////////////////////////////////////////////////////
//var prot = AscCommon.DocumentUrls.prototype;
//prot.mediaPrefix = 'media/';
//prot.init = function(urls) {
//};
//prot.getUrls = function() {
// return this.urls;
//};
//prot.addUrls = function(urls){
//};
//prot.addImageUrl = function(strPath, url){
//};
//prot.getImageUrl = function(strPath){
// if (0 === strPath.indexOf('theme'))
// return null;
//
// if (window.editor && window.editor.ThemeLoader && window.editor.ThemeLoader.ThemesUrl != "" && strPath.indexOf(window.editor.ThemeLoader.ThemesUrl) == 0)
// return null;
//
// return this.documentUrl + "/media/" + strPath;
//};
//prot.getImageLocal = function(url){
// var _first = this.documentUrl + "/media/";
// if (0 == url.indexOf(_first))
// return url.substring(_first.length);
//
// if (window.editor && window.editor.ThemeLoader && 0 == url.indexOf(editor.ThemeLoader.ThemesUrlAbs)) {
// return url.substring(editor.ThemeLoader.ThemesUrlAbs.length);
// }
//
// return null;
//};
//prot.imagePath2Local = function(imageLocal){
// return this.getImageLocal(imageLocal);
//};
//prot.getUrl = function(strPath){
// if (0 === strPath.indexOf('theme'))
// return null;
//
// if (window.editor && window.editor.ThemeLoader && window.editor.ThemeLoader.ThemesUrl != "" && strPath.indexOf(window.editor.ThemeLoader.ThemesUrl) == 0)
// return null;
//
// return this.documentUrl + "/media/" + strPath;
//};
//prot.getLocal = function(url){
// return this.getImageLocal(url);
//};
//
//AscCommon.sendImgUrls = function(api, images, callback)
//{
// var _data = [];
// for (var i = 0; i < images.length; i++)
// {
// var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](images[i]);
// _data[i] = { url: images[i], path : AscCommon.g_oDocumentUrls.getImageUrl(_url) };
// }
// callback(_data);
//};
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
function DesktopOfflineUpdateLocalName(_api)
{
//var _name = window["AscDesktopEditor"]["LocalFileGetSourcePath"]();
//
//var _ind1 = _name.lastIndexOf("\\");
//var _ind2 = _name.lastIndexOf("/");
//
//if (_ind1 == -1)
// _ind1 = 1000000;
//if (_ind2 == -1)
// _ind2 = 1000000;
//
//var _ind = Math.min(_ind1, _ind2);
//if (_ind != 1000000)
// _name = _name.substring(_ind + 1);
//
//_api.documentTitle = _name;
//_api.sendEvent("asc_onDocumentName", _name);
//window["AscDesktopEditor"]["SetDocumentName"](_name);
}
AscCommon.CDocsCoApi.prototype.askSaveChanges = function(callback)
{
callback({"saveLock": false});
};
AscCommon.CDocsCoApi.prototype.saveChanges = function(arrayChanges, deleteIndex, excelAdditionalInfo)
{
//window["AscDesktopEditor"]["LocalFileSaveChanges"](arrayChanges.join("\",\""), deleteIndex, arrayChanges.length);
this.onUnSaveLock();
};
//window["NativeCorrectImageUrlOnCopy"] = function(url)
//{
// AscCommon.g_oDocumentUrls.getImageUrl(url);
//};
//window["NativeCorrectImageUrlOnPaste"] = function(url)
//{
// return window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
//};
//window["UpdateInstallPlugins"] = function()
//{
// var _plugins = JSON.parse(window["AscDesktopEditor"]["GetInstallPlugins"]());
// var _editor = window["Asc"]["editor"] ? window["Asc"]["editor"] : window.editor;
// _editor.asc_fireCallback("asc_onPluginsInit", _plugins);
//};
//AscCommon.InitDragAndDrop = function(oHtmlElement, callback) {
// if ("undefined" != typeof(FileReader) && null != oHtmlElement) {
// oHtmlElement["ondragover"] = function (e) {
// e.preventDefault();
// e.dataTransfer.dropEffect = AscCommon.CanDropFiles(e) ? 'copy' : 'none';
// return false;
// };
// oHtmlElement["ondrop"] = function (e) {
// e.preventDefault();
//
// var _files = window["AscDesktopEditor"]["GetDropFiles"]();
// for (var i = 0; i < _files.length; i++)
// {
// if (window["AscDesktopEditor"]["IsImageFile"](_files[i]))
// {
// window["DesktopOfflineAppDocumentAddImageEnd"](_files[i]);
// break;
// }
// }
// };
// }
//};
// меняем среду
//AscBrowser.isSafari = false;
//AscBrowser.isSafariMacOs = false;
//window.USER_AGENT_SAFARI_MACOS = false;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
// Import
var c_oAscError = Asc.c_oAscError;
/////////////////////////////////////////////////////////
////////////// OPEN ////////////////////////
/////////////////////////////////////////////////////////
Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
{
this.asc_registerCallback('asc_onDocumentContentReady', function(){
DesktopOfflineUpdateLocalName(editor);
});
AscCommon.History.UserSaveMode = true;
this.jio_open();
};
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
return;
}
this.OpenDocument2(_url, _data);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
this.DocumentOrientation = (null == this.WordControl.m_oLogicDocument) ? true : !this.WordControl.m_oLogicDocument.Orientation;
DesktopOfflineUpdateLocalName(this);
};
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
{
AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
{
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("/") != 0)
AscCommon.g_oDocumentUrls.documentUrl = "/" + AscCommon.g_oDocumentUrls.documentUrl;
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
}
editor._OfflineAppDocumentEndLoad(_url, _data);
};
/////////////////////////////////////////////////////////
////////////// CHANGES /////////////////////
/////////////////////////////////////////////////////////
AscCommon.CHistory.prototype.Reset_SavedIndex = function(IsUserSave)
{
if (true === this.Is_UserSaveMode())
{
this.SavedIndex = this.Index;
if (true === IsUserSave)
{
this.UserSavedIndex = this.Index;
this.ForceSave = false;
}
}
else
{
this.SavedIndex = this.Index;
this.ForceSave = false;
}
};
AscCommon.CHistory.prototype.Have_Changes = function(IsNotUserSave, IsNoSavedNoModifyed)
{
if (true === this.Is_UserSaveMode() && true !== IsNotUserSave)
{
if (-1 === this.Index && null === this.UserSavedIndex && false === this.ForceSave)
{
if (window["AscDesktopEditor"])
{
if (0 != window["AscDesktopEditor"]["LocalFileGetOpenChangesCount"]())
return true;
if (!window["AscDesktopEditor"]["LocalFileGetSaved"]() && IsNoSavedNoModifyed !== true)
return true;
}
return false;
}
if (this.Index != this.UserSavedIndex || true === this.ForceSave)
return true;
return false;
}
else
{
if (-1 === this.Index && null === this.SavedIndex && false === this.ForceSave)
return false;
if (this.Index != this.SavedIndex || true === this.ForceSave)
return true;
return false;
}
};
window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
{
editor._coAuthoringSetChanges(_changes, new CDocumentColor( 191, 255, 199 ));
//editor["asc_nativeApplyChanges"](_changes);
//editor["asc_nativeCalculateFile"]();
};
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
Asc['asc_docs_api'].prototype.SetDocumentModified = function(bValue)
{
this.isDocumentModify = bValue;
this.asc_fireCallback("asc_onDocumentModifiedChanged");
if (undefined !== window["AscDesktopEditor"])
{
window["AscDesktopEditor"]["onDocumentModifiedChanged"](AscCommon.History ? AscCommon.History.Have_Changes(undefined, true) : bValue);
}
};
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
{
editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
var _param = "";
if (isSaveAs === true)
_param += "saveas=true;";
if (AscCommon.AscBrowser.isRetina)
_param += "retina=true;";
window["AscDesktopEditor"]["LocalFileSave"](_param);
};
window["DesktopOfflineAppDocumentEndSave"] = function(error)
{
editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
if (0 == error)
DesktopOfflineUpdateLocalName(editor);
else
AscCommon.History.UserSavedIndex = editor.LastUserSavedIndex;
editor.UpdateInterfaceState();
editor.LastUserSavedIndex = undefined;
if (2 == error)
editor.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
};
Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{
this.asc_Save(false, true);
};
Asc['asc_docs_api'].prototype.AddImageUrl = function(url, imgProp)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
this.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url), imgProp);
};
Asc['asc_docs_api'].prototype.AddImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_addImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_isOffline = function()
{
return true;
};
Asc['asc_docs_api'].prototype.SetThemesPath = function(path)
{
this.ThemeLoader.ThemesUrl = path;
this.ThemeLoader.ThemesUrlAbs = path;
};
Asc['asc_docs_api'].prototype["asc_addImage"] = Asc['asc_docs_api'].prototype.asc_addImage;
Asc['asc_docs_api'].prototype["AddImageUrl"] = Asc['asc_docs_api'].prototype.AddImageUrl;
Asc['asc_docs_api'].prototype["AddImage"] = Asc['asc_docs_api'].prototype.AddImage;
Asc['asc_docs_api'].prototype["asc_Save"] = Asc['asc_docs_api'].prototype.asc_Save;
Asc['asc_docs_api'].prototype["asc_DownloadAs"] = Asc['asc_docs_api'].prototype.asc_DownloadAs;
Asc['asc_docs_api'].prototype["asc_isOffline"] = Asc['asc_docs_api'].prototype.asc_isOffline;
Asc['asc_docs_api'].prototype["SetDocumentModified"] = Asc['asc_docs_api'].prototype.SetDocumentModified;
Asc['asc_docs_api'].prototype["SetThemesPath"] = Asc['asc_docs_api'].prototype.SetThemesPath;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{
if (url == "")
return;
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
editor.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url));
};
window["on_editor_native_message"] = function(sCommand, sParam)
{
if (!window.editor)
return;
if (sCommand == "save")
editor.asc_Save();
else if (sCommand == "saveAs")
editor.asc_Save(false, true);
else if (sCommand == "print")
editor.asc_Print();
else if (sCommand == "editor:stopDemonstration")
editor.EndDemonstration(true);
};
...@@ -1898,6 +1898,7 @@ background-repeat: no-repeat;\ ...@@ -1898,6 +1898,7 @@ background-repeat: no-repeat;\
// Обновляем состояние возможности сохранения документа // Обновляем состояние возможности сохранения документа
t._onUpdateDocumentCanSave(); t._onUpdateDocumentCanSave();
t.jio_save();
if (undefined !== window["AscDesktopEditor"]) if (undefined !== window["AscDesktopEditor"])
{ {
window["AscDesktopEditor"]["OnSave"](); window["AscDesktopEditor"]["OnSave"]();
......
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
"use strict";
// Import
var c_oAscError = Asc.c_oAscError;
/////////////////////////////////////////////////////////
////////////// OPEN ////////////////////////
/////////////////////////////////////////////////////////
Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
{
this.asc_registerCallback('asc_onDocumentContentReady', function(){
DesktopOfflineUpdateLocalName(editor);
//setTimeout(function(){window["UpdateInstallPlugins"]();}, 10);
});
AscCommon.History.UserSaveMode = true;
this.jio_open();
};
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.Critical);
return;
}
if (AscCommon.c_oSerFormat.Signature !== _data.substring(0, AscCommon.c_oSerFormat.Signature.length))
{
this.OpenDocument(_url, _data);
}
else
{
this.OpenDocument2(_url, _data);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
}
DesktopOfflineUpdateLocalName(this);
};
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
{
AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
{
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("/") != 0)
AscCommon.g_oDocumentUrls.documentUrl = "/" + AscCommon.g_oDocumentUrls.documentUrl;
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
}
editor._OfflineAppDocumentEndLoad(_url, _data);
};
Asc['asc_docs_api'].prototype.asc_setAdvancedOptions = function(idOption, option)
{
window["AscDesktopEditor"]["SetAdvancedOptions"]("" + option.asc_getCodePage());
};
Asc['asc_docs_api'].prototype["asc_setAdvancedOptions"] = Asc['asc_docs_api'].prototype.asc_setAdvancedOptions;
window["asc_initAdvancedOptions"] = function()
{
editor._onNeedParams(undefined);
};
/////////////////////////////////////////////////////////
////////////// CHANGES /////////////////////
/////////////////////////////////////////////////////////
AscCommon.CHistory.prototype.Reset_SavedIndex = function(IsUserSave)
{
if (true === this.Is_UserSaveMode())
{
this.SavedIndex = this.Index;
if (true === IsUserSave)
{
this.UserSavedIndex = this.Index;
this.ForceSave = false;
}
}
else
{
this.SavedIndex = this.Index;
this.ForceSave = false;
}
};
AscCommon.CHistory.prototype.Have_Changes = function(IsNotUserSave, IsNoSavedNoModifyed)
{
if (true === this.Is_UserSaveMode() && true !== IsNotUserSave)
{
if (-1 === this.Index && null === this.UserSavedIndex && false === this.ForceSave)
{
if (window["AscDesktopEditor"])
{
if (0 != window["AscDesktopEditor"]["LocalFileGetOpenChangesCount"]())
return true;
if (!window["AscDesktopEditor"]["LocalFileGetSaved"]() && IsNoSavedNoModifyed !== true)
return true;
}
return false;
}
if (this.Index != this.UserSavedIndex || true === this.ForceSave)
return true;
return false;
}
else
{
if (-1 === this.Index && null === this.SavedIndex && false === this.ForceSave)
return false;
if (this.Index != this.SavedIndex || true === this.ForceSave)
return true;
return false;
}
};
window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
{
editor._coAuthoringSetChanges(_changes, new AscCommonWord.CDocumentColor( 191, 255, 199 ));
//editor["asc_nativeApplyChanges"](_changes);
//editor["asc_nativeCalculateFile"]();
};
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
{
editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
var _param = "";
if (isSaveAs === true)
_param += "saveas=true;";
if (AscCommon.AscBrowser.isRetina)
_param += "retina=true;";
window["AscDesktopEditor"]["LocalFileSave"](_param);
};
window["DesktopOfflineAppDocumentEndSave"] = function(error)
{
editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
if (error == 0)
DesktopOfflineUpdateLocalName(editor);
else
AscCommon.History.UserSavedIndex = editor.LastUserSavedIndex;
editor.UpdateInterfaceState();
editor.LastUserSavedIndex = undefined;
if (2 == error)
editor.sendEvent("asc_onError", c_oAscError.ID.ConvertationError, c_oAscError.Level.NoCritical);
};
Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{
this.asc_Save(false, true);
};
Asc['asc_docs_api'].prototype.AddImageUrl = function(url, imgProp)
{
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
this.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url), imgProp);
};
Asc['asc_docs_api'].prototype.AddImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_addImage = function()
{
window["AscDesktopEditor"]["LocalFileGetImageUrlFromOpenFileDialog"]();
};
Asc['asc_docs_api'].prototype.asc_isOffline = function()
{
return true;
};
Asc['asc_docs_api'].prototype["asc_addImage"] = Asc['asc_docs_api'].prototype.asc_addImage;
Asc['asc_docs_api'].prototype["AddImageUrl"] = Asc['asc_docs_api'].prototype.AddImageUrl;
Asc['asc_docs_api'].prototype["AddImage"] = Asc['asc_docs_api'].prototype.AddImage;
Asc['asc_docs_api'].prototype["asc_Save"] = Asc['asc_docs_api'].prototype.asc_Save;
Asc['asc_docs_api'].prototype["asc_DownloadAs"] = Asc['asc_docs_api'].prototype.asc_DownloadAs;
Asc['asc_docs_api'].prototype["asc_isOffline"] = Asc['asc_docs_api'].prototype.asc_isOffline;
Asc['asc_docs_api'].prototype["SetDocumentModified"] = Asc['asc_docs_api'].prototype.SetDocumentModified;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{
if (url == "")
return;
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](url);
editor.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url));
};
window["on_editor_native_message"] = function(sCommand, sParam)
{
if (!window.editor)
return;
if (sCommand == "save")
editor.asc_Save();
else if (sCommand == "saveAs")
editor.asc_Save(false, true);
else if (sCommand == "print")
editor.asc_Print();
};
\ No newline at end of file
...@@ -2263,6 +2263,7 @@ background-repeat: no-repeat;\ ...@@ -2263,6 +2263,7 @@ background-repeat: no-repeat;\
// Обновляем состояние возможности сохранения документа // Обновляем состояние возможности сохранения документа
t._onUpdateDocumentCanSave(); t._onUpdateDocumentCanSave();
t.jio_save();
if (undefined !== window["AscDesktopEditor"]) if (undefined !== window["AscDesktopEditor"])
{ {
window["AscDesktopEditor"]["OnSave"](); window["AscDesktopEditor"]["OnSave"]();
......
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