Commit 0aaf178f authored by Oleg Korshul's avatar Oleg Korshul

plugins

parent b51ce1e4
......@@ -1546,24 +1546,24 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
}
CPluginVariation.prototype["deserialize"] = function(_object)
{
this.description = _object["description"];
this.url = _object["url"];
this.index = _object["index"];
this.description = (_object["description"] != null) ? _object["description"] : this.description;
this.url = (_object["url"] != null) ? _object["url"] : this.url;
this.index = (_object["index"] != null) ? _object["index"] : this.index;
this.icons = _object["icons"];
this.isViewer = _object["isViewer"];
this.EditorsSupport = _object["EditorsSupport"];
this.icons = (_object["icons"] != null) ? _object["icons"] : this.icons;
this.isViewer = (_object["isViewer"] != null) ? _object["isViewer"] : this.isViewer;
this.EditorsSupport = (_object["EditorsSupport"] != null) ? _object["EditorsSupport"] : this.EditorsSupport;
this.isVisual = _object["isVisual"];
this.isModal = _object["isModal"];
this.isInsideMode = _object["isInsideMode"];
this.isVisual = (_object["isVisual"] != null) ? _object["isVisual"] : this.isVisual;
this.isModal = (_object["isModal"] != null) ? _object["isModal"] : this.isModal;
this.isInsideMode = (_object["isInsideMode"] != null) ? _object["isInsideMode"] : this.isInsideMode;
this.initDataType = _object["initDataType"];
this.initData = _object["initData"];
this.initDataType = (_object["initDataType"] != null) ? _object["initDataType"] : this.initDataType;
this.initData = (_object["initData"] != null) ? _object["initData"] : this.initData;
this.isUpdateOleOnResize = _object["isUpdateOleOnResize"];
this.isUpdateOleOnResize = (_object["isUpdateOleOnResize"] != null) ? _object["isUpdateOleOnResize"] : this.isUpdateOleOnResize;
this.buttons = _object["buttons"];
this.buttons = (_object["buttons"] != null) ? _object["buttons"] : this.buttons;
}
function CPlugin()
......@@ -1600,9 +1600,9 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
}
CPlugin.prototype["deserialize"] = function(_object)
{
this.name = _object["name"];
this.guid = _object["guid"];
this.baseUrl = _object["baseUrl"];
this.name = (_object["name"] != null) ? _object["name"] : this.name;
this.guid = (_object["guid"] != null) ? _object["guid"] : this.guid;
this.baseUrl = (_object["baseUrl"] != null) ? _object["baseUrl"] : this.baseUrl;
this.variations = [];
for (var i = 0; i < _object["variations"].length; i++)
{
......
......@@ -47,11 +47,13 @@
{
this.plugins = [];
this.current = null;
this.path = "";
this.path = "../../../../sdkjs-plugins/";
this.api = null;
this.startData = null;
this.runAndCloseData = null;
this.closeAttackTimer = -1; // защита от плагитнов, которые не закрываются
}
CPluginsManager.prototype =
......@@ -97,8 +99,18 @@
},
runResize : function(data)
{
var guid = data.getAttribute("guid");
for (var i = 0; i < this.plugins.length; i++)
{
if (this.plugins[i].guid == guid)
{
if (this.plugins[i].variations[0].isUpdateOleOnResize !== true)
return;
}
}
data.setAttribute("resize", true);
return this.run(data.getAttribute("guid"), 0, data);
return this.run(guid, 0, data);
},
close : function()
{
......@@ -144,6 +156,17 @@
buttonClick : function(id)
{
if (this.closeAttackTimer != -1)
{
clearTimeout(this.closeAttackTimer);
this.closeAttackTimer = -1;
}
if (-1 == id)
{
// защита от плохого плагина
this.closeAttackTimer = setTimeout(function(){ window.g_asc_plugins.close(); }, 5000);
}
var _iframe = document.getElementById("plugin_iframe");
if (_iframe)
{
......@@ -252,6 +275,12 @@
}
else if ("close" == name)
{
if (window.g_asc_plugins.closeAttackTimer != -1)
{
clearTimeout(window.g_asc_plugins.closeAttackTimer);
window.g_asc_plugins.closeAttackTimer = -1;
}
if (value && value != "")
{
try
......@@ -438,7 +467,7 @@ function TEST_PLUGINS()
initDataType : "ole",
initData : "",
isUpdateOleOnResize : true,
isUpdateOleOnResize : false,
buttons : [ { text: "Ok", primary: true },
{ text: "Cancel", primary: false } ]
......
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