Commit b6c604be authored by Oleg Korshul's avatar Oleg Korshul

.

parent 70ab3428
......@@ -249,8 +249,15 @@ window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function()
return true;
};
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs, password, isForce)
{
window.doadssIsSaveAs = isSaveAs;
if (true !== isForce && window.g_asc_plugins && window.g_asc_plugins.isRunned("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}"))
{
window.g_asc_plugins.init({ "type" : "generatePassword" });
return;
}
window["Asc"]["editor"].sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
var _param = "";
......@@ -259,9 +266,9 @@ window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
if (AscCommon.AscBrowser.isRetina)
_param += "retina=true;";
window["AscDesktopEditor"]["LocalFileSave"](_param);
window["AscDesktopEditor"]["LocalFileSave"](_param, password);
};
window["DesktopOfflineAppDocumentEndSave"] = function(error)
window["DesktopOfflineAppDocumentEndSave"] = function(error, hash, password)
{
window["Asc"]["editor"].sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
if (0 == error)
......@@ -284,6 +291,14 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error)
window.SaveQuestionObjectBeforeSign = null;
}
}
if (hash !== null && hash !== undefined && hash != "")
{
if (window.g_asc_plugins && window.g_asc_plugins.isRunned("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}"))
{
window.g_asc_plugins.init("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}", {"type": "setPasswordByFile", "hash": hash, "password": password});
}
}
};
window["Asc"]['spreadsheet_api'].prototype["asc_addImageDrawingObject"] = window["Asc"]['spreadsheet_api'].prototype.asc_addImageDrawingObject;
......
......@@ -209,6 +209,45 @@ window["UpdateInstallPlugins"] = function()
_editor.sendEvent("asc_onPluginsInit", _plugins);
};
window["UpdateSystemPlugins"] = function()
{
var _plugins = JSON.parse(window["AscDesktopEditor"]["GetInstallPlugins"]());
_plugins["url"] = _plugins["url"].replace(" ", "%20");
var _len = _plugins["pluginsData"].length;
for (var i = 0; i < _len; i++)
_plugins["pluginsData"][i]["baseUrl"] = _plugins["url"] + _plugins["pluginsData"][i]["guid"].substring(4) + "/";
var _editor = window["Asc"]["editor"] ? window["Asc"]["editor"] : window.editor;
var _array = [];
for (var i = 0; i < _len; i++)
{
var _plugin = _plugins["pluginsData"][i];
for (var j = 0; j < _plugin["variations"].length; j++)
{
var _variation = _plugin["variations"][j];
if (_variation["initDataType"] == "desktop")
{
_array.push(_plugin);
break;
}
}
}
var _arraySystem = [];
for (var i = 0; i < _array.length; i++)
{
var plugin = new Asc.CPlugin();
plugin.deserialize(_array[i]);
_arraySystem.push(plugin);
}
window.g_asc_plugins.registerSystem("", _arraySystem);
window.g_asc_plugins.runAllSystem();
};
AscCommon.InitDragAndDrop = function(oHtmlElement, callback) {
if ("undefined" != typeof(FileReader) && null != oHtmlElement) {
oHtmlElement["ondragover"] = function (e) {
......@@ -232,9 +271,16 @@ AscCommon.InitDragAndDrop = function(oHtmlElement, callback) {
}
}
window["asc_initAdvancedOptions"] = function(_code)
window["asc_initAdvancedOptions"] = function(_code, _file_hash)
{
var _editor = window["Asc"]["editor"] ? window["Asc"]["editor"] : window.editor;
if ((_code == 90 || _code == 91) && window.g_asc_plugins && window.g_asc_plugins.isRunned("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}"))
{
window.g_asc_plugins.init("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}", { "type" : "getPasswordByFile", "hash" : _file_hash });
return;
}
_editor._onNeedParams(undefined, (_code == 90 || _code == 91) ? true : undefined);
};
......@@ -426,6 +472,33 @@ function getBinaryArray(_data, _len)
return _array;
}
// OnlyPass ----------------------------------
Asc['asc_docs_api'].prototype["pluginMethod_OnlyPass"] = function(obj)
{
switch (obj.type)
{
case "generatePassword":
{
window["DesktopOfflineAppDocumentStartSave"](window.doadssIsSaveAs, obj["password"], true);
break;
}
case "getPasswordByFile":
{
if ("" != obj["password"])
{
var _param = ("<m_sPassword>" + AscCommon.CopyPasteCorrectString(obj["password"]) + "</m_sPassword>");
window["AscDesktopEditor"]["SetAdvancedOptions"](_param);
}
else
{
this._onNeedParams(undefined, true);
}
break;
}
}
};
// -------------------------------------------
// меняем среду
//AscBrowser.isSafari = false;
//AscBrowser.isSafariMacOs = false;
......
......@@ -150,6 +150,13 @@
this.pluginsMap[guid] = { isSystem : true };
}
},
runAllSystem : function()
{
for (var i = 0; i < this.systemPlugins.length; i++)
{
this.run(this.systemPlugins[i].guid, 0, "");
}
},
// pointer events methods -------------------
enablePointerEvents : function()
{
......@@ -212,6 +219,10 @@
}
return false;
},
isRunned : function(guid)
{
return (undefined !== this.runnedPluginsMap[guid]);
},
run : function(guid, variation, data, isNoUse_isNoSystemPluginsOnlyOne)
{
if (this.runAndCloseData) // run only on close!!!
......@@ -422,7 +433,7 @@
}
},
init : function(guid)
init : function(guid, raw_data)
{
var plugin = this.getPluginByGuid(guid);
var runObject = this.runnedPluginsMap[guid];
......@@ -430,46 +441,53 @@
if (!plugin || !runObject || !runObject.startData)
return;
switch (plugin.variations[runObject.currentVariation].initDataType)
if (undefined === raw_data)
{
case Asc.EPluginDataType.text:
switch (plugin.variations[runObject.currentVariation].initDataType)
{
var text_data = {
data : "",
pushData : function(format, value)
{
this.data = value;
}
};
this.api.asc_CheckCopy(text_data, 1);
if (text_data.data == null)
text_data.data = "";
runObject.startData.setAttribute("data", text_data.data);
break;
}
case Asc.EPluginDataType.html:
{
var text_data = {
data : "",
pushData : function(format, value)
{
this.data = value;
}
};
this.api.asc_CheckCopy(text_data, 2);
if (text_data.data == null)
text_data.data = "";
runObject.startData.setAttribute("data", text_data.data);
break;
}
case Asc.EPluginDataType.ole:
{
// теперь выше задается
break;
case Asc.EPluginDataType.text:
{
var text_data = {
data: "",
pushData: function (format, value)
{
this.data = value;
}
};
this.api.asc_CheckCopy(text_data, 1);
if (text_data.data == null)
text_data.data = "";
runObject.startData.setAttribute("data", text_data.data);
break;
}
case Asc.EPluginDataType.html:
{
var text_data = {
data: "",
pushData: function (format, value)
{
this.data = value;
}
};
this.api.asc_CheckCopy(text_data, 2);
if (text_data.data == null)
text_data.data = "";
runObject.startData.setAttribute("data", text_data.data);
break;
}
case Asc.EPluginDataType.ole:
{
// теперь выше задается
break;
}
}
}
else
{
runObject.startData.setAttribute("data", raw_data);
}
var _iframe = document.getElementById(runObject.frameId);
if (_iframe)
......@@ -865,6 +883,9 @@
});
if (window["AscDesktopEditor"] && window["UpdateSystemPlugins"])
window["UpdateSystemPlugins"]();
return window.g_asc_plugins;
};
......
......@@ -179,8 +179,15 @@ Asc['asc_docs_api'].prototype.asc_Save = function (isNoUserSave, isSaveAs)
window["DesktopOfflineAppDocumentStartSave"](isSaveAs);
}
};
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs, password, isForce)
{
window.doadssIsSaveAs = isSaveAs;
if (true !== isForce && window.g_asc_plugins && window.g_asc_plugins.isRunned("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}"))
{
window.g_asc_plugins.init("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}", { "type" : "generatePassword" });
return;
}
editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
var _param = "";
......@@ -189,9 +196,9 @@ window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
if (AscCommon.AscBrowser.isRetina)
_param += "retina=true;";
window["AscDesktopEditor"]["LocalFileSave"](_param);
window["AscDesktopEditor"]["LocalFileSave"](_param, password);
};
window["DesktopOfflineAppDocumentEndSave"] = function(error)
window["DesktopOfflineAppDocumentEndSave"] = function(error, hash, password)
{
editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.Save);
if (0 == error)
......@@ -214,6 +221,14 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error)
window.SaveQuestionObjectBeforeSign = null;
}
}
if (hash !== null && hash !== undefined && hash != "")
{
if (window.g_asc_plugins && window.g_asc_plugins.isRunned("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}"))
{
window.g_asc_plugins.init("asc.{F2402876-659F-47FB-A646-67B49F2B57D0}", {"type": "setPasswordByFile", "hash": hash, "password": password});
}
}
};
Asc['asc_docs_api'].prototype.asc_DownloadAs = function(typeFile, bIsDownloadEvent)
{
......
This diff is collapsed.
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