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