Commit 9f983e4f authored by Oleg Korshul's avatar Oleg Korshul

plugins

parent 50707df3
......@@ -1494,8 +1494,6 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
CPluginVariation.prototype["set_Description"] = function(value) { this.description = value; } ;
CPluginVariation.prototype["get_Url"] = function() { return this.url; };
CPluginVariation.prototype["set_Url"] = function(value) { this.url = value; };
CPluginVariation.prototype["get_BaseUrl"] = function() { return this.baseUrl; };
CPluginVariation.prototype["set_BaseUrl"] = function(value) { this.baseUrl = value; };
CPluginVariation.prototype["get_Icons"] = function() { return this.icons; };
CPluginVariation.prototype["set_Icons"] = function(value) { this.icons = value; };
......@@ -1523,10 +1521,56 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
CPluginVariation.prototype["get_Buttons"] = function() { return this.buttons; };
CPluginVariation.prototype["set_Buttons"] = function(value) { this.buttons = value; };
CPluginVariation.prototype["serialize"] = function()
{
var _object = {};
_object["description"] = this.description;
_object["url"] = this.url;
_object["index"] = this.index;
_object["icons"] = this.icons;
_object["isViewer"] = this.isViewer;
_object["EditorsSupport"] = this.EditorsSupport;
_object["isVisual"] = this.isVisual;
_object["isModal"] = this.isModal;
_object["isInsideMode"] = this.isInsideMode;
_object["initDataType"] = this.initDataType;
_object["initData"] = this.initData;
_object["isUpdateOleOnResize"] = this.isUpdateOleOnResize;
_object["buttons"] = this.buttons;
return _object;
}
CPluginVariation.prototype["deserialize"] = function(_object)
{
this.description = _object["description"];
this.url = _object["url"];
this.index = _object["index"];
this.icons = _object["icons"];
this.isViewer = _object["isViewer"];
this.EditorsSupport = _object["EditorsSupport"];
this.isVisual = _object["isVisual"];
this.isModal = _object["isModal"];
this.isInsideMode = _object["isInsideMode"];
this.initDataType = _object["initDataType"];
this.initData = _object["initData"];
this.isUpdateOleOnResize = _object["isUpdateOleOnResize"];
this.buttons = _object["buttons"];
}
function CPlugin()
{
this.name = "";
this.guid = "";
this.baseUrl = "";
this.variations = [];
}
......@@ -1535,10 +1579,39 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
CPlugin.prototype["set_Name"] = function(value) { this.name = value; } ;
CPlugin.prototype["get_Guid"] = function() { return this.guid; };
CPlugin.prototype["set_Guid"] = function(value) { this.guid = value; };
CPlugin.prototype["get_BaseUrl"] = function() { return this.baseUrl; };
CPlugin.prototype["set_BaseUrl"] = function(value) { this.baseUrl = value; };
CPlugin.prototype["get_Variations"] = function() { return this.variations; };
CPlugin.prototype["set_Variations"] = function(value) { this.variations = value; };
CPlugin.prototype["serialize"] = function()
{
var _object = {};
_object["name"] = this.name;
_object["guid"] = this.guid;
_object["baseUrl"] = this.baseUrl;
_object["variations"] = this.variations;
for (var i = 0; i < this.variations; i++)
{
_object["variations"].push(this.variations[i].serialize());
}
return _object;
}
CPlugin.prototype["deserialize"] = function(_object)
{
this.name = _object["name"];
this.guid = _object["guid"];
this.baseUrl = _object["baseUrl"];
this.variations = [];
for (var i = 0; i < _object["variations"].length; i++)
{
var _variation = new CPluginVariation();
_variation["deserialize"](_object["variations"][i]);
this.variations.push(_variation);
}
}
window["Asc"]["CPluginVariation"] = CPluginVariation;
window["Asc"]["CPlugin"] = CPlugin;
// --------------------------------------------------------------------- //
......
......@@ -129,7 +129,7 @@
var ifr = document.createElement("iframe");
ifr.name = "plugin_iframe";
ifr.id = "plugin_iframe";
var _add = this.current.variations[0].baseUrl == "" ? this.path : this.current.variations[0].baseUrl;
var _add = this.current.baseUrl == "" ? this.path : this.current.baseUrl;
ifr.src = _add + this.current.variations[0].url;
ifr.style.position = 'absolute';
ifr.style.top = '-100px';
......@@ -209,38 +209,21 @@
for (var i = 0; i < _plugins.length; i++)
{
var _p = new Asc.CPlugin();
_p.name = _plugins[i].name;
_p.guid = _plugins[i].guid;
_p["deserialize"](_plugins[i]);
if (_map[_p.guid] === true)
continue;
for (var j = 0; j < _plugins[i].variations.length; j++)
{
var _pv = new Asc.CPluginVariation();
for (var k in _plugins[i].variations[j])
{
_pv[k] = _plugins[i].variations[j][k];
}
_p.variations.push(_pv);
}
this.plugins.push(_p);
}
// добавляем кнопки (тест)
var _elem = document.getElementById("view-left-menu").childNodes[1];
for (var i = 0; i < _plugins.length; i++)
var _pluginsInstall = { "url" : this.path, "pluginsData" : [] };
for (var i = 0; i < this.plugins.length; i++)
{
var _button = "<button class='btn btn-category' content-target='' data-toggle='tooltip' data-original-title='' title='' " +
"onclick='window.g_asc_plugins.run(\"" + _plugins[i].guid + "\")'><span>" + (i + 1) + "</span></button>";
_elem.innerHTML += _button;
_pluginsInstall["pluginsData"].push(this.plugins[i].serialize());
}
this.api.asc_fireCallback("asc_onPluginsInit", _pluginsInstall);
}
};
......
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