Commit 79169bc7 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

[erp5_only_office] add gui for xmla settings

parent ba3d09d0
......@@ -234,6 +234,16 @@ gadget_officejs_jio_spreadsheet_view.js\n
gadget_ooffice_spreadsheet.json\n
500px-Gnome-x-office-spreadsheet.svg.png\n
\n
#jsonform\n
json-schema/schema4.json\n
json-schema/schema6.json\n
json-schema/schema7.json\n
jsonform.gadget.html\n
jsonform.gadget.js\n
jsonform/gadget_json_generated_form_child.html\n
jsonform/gadget_json_generated_form_child.js\n
jsonform/tv4.js\n
\n
#onlyoffice editor\n
jio.js\n
zipfilestorage-with-jszip.js\n
......@@ -241,6 +251,8 @@ onlyoffice.gadget.html\n
onlyoffice.gadget.js\n
onlyoffice.gadget.appcache\n
#autogenerated for: erp5_onlyoffice_webapps\n
onlyoffice/remote_settings.json\n
onlyoffice/xmla_connection.json\n
onlyoffice/web-apps/apps/common/Analytics.js\n
onlyoffice/web-apps/apps/common/Gateway.js\n
onlyoffice/web-apps/apps/common/IrregularStack.js\n
......@@ -339,6 +351,7 @@ onlyoffice/web-apps/apps/common/main/lib/view_folder/Plugins.js\n
onlyoffice/web-apps/apps/common/main/lib/view_folder/RenameDialog.js\n
onlyoffice/web-apps/apps/common/main/lib/view_folder/ReviewChanges.js\n
onlyoffice/web-apps/apps/common/main/lib/view_folder/SearchDialog.js\n
onlyoffice/web-apps/apps/common/main/lib/view_folder/RenderJSDialog.js\n
onlyoffice/web-apps/apps/css.js\n
onlyoffice/web-apps/apps/documenteditor/main/app.js\n
onlyoffice/web-apps/apps/documenteditor/main/app/collection/EquationGroups.js\n
......
......@@ -4,7 +4,24 @@ rsvp.js
renderjs.js
jio.js
jiodev.js
#jsonform
gadget_erp5_global.js
gadget_html5_select.html
gadget_html5_select.js
json-schema/schema4.json
json-schema/schema6.json
json-schema/schema7.json
jsonform.gadget.html
jsonform.gadget.js
jsonform/gadget_json_generated_form_child.html
jsonform/gadget_json_generated_form_child.js
jsonform/tv4.js
#autogenerated for: erp5_onlyoffice_webapps
onlyoffice/remote_settings.json
onlyoffice/xmla_connection.json
onlyoffice/web-apps/apps/common/Analytics.js
onlyoffice/web-apps/apps/common/Gateway.js
onlyoffice/web-apps/apps/common/IrregularStack.js
......@@ -103,6 +120,7 @@ onlyoffice/web-apps/apps/common/main/lib/view_folder/Plugins.js
onlyoffice/web-apps/apps/common/main/lib/view_folder/RenameDialog.js
onlyoffice/web-apps/apps/common/main/lib/view_folder/ReviewChanges.js
onlyoffice/web-apps/apps/common/main/lib/view_folder/SearchDialog.js
onlyoffice/web-apps/apps/common/main/lib/view_folder/RenderJSDialog.js
onlyoffice/web-apps/apps/css.js
onlyoffice/web-apps/apps/documenteditor/main/app.js
onlyoffice/web-apps/apps/documenteditor/main/app/collection/EquationGroups.js
......
......@@ -70,6 +70,7 @@ DocsAPI.DocEditor.version = function () {
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")
.declareAcquiredMethod("triggerMaximize", "triggerMaximize")
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('notifyChange', 'notifyChange')
.declareMethod("jio_getAttachment", function (docId, attId, opt) {
var g = this,
convert;
......@@ -165,6 +166,25 @@ DocsAPI.DocEditor.version = function () {
}
return queue;
})
.allowPublicAcquisition("notifyChange", function (arr, scope) {
var gadget = this;
if (scope === "remote_settings") {
return this.getDeclaredGadget(scope)
.push(function (g) {
return g.getContent();
})
.push(function (data) {
return gadget
.jio_putAttachment('/', 'remote_settings.json', data);
})
.push(function () {
return gadget.notifyChange();
})
.push(undefined, function (e) {
console.error(e);
});
}
})
// methods emulating Gateway used for connection with ooffice begin.
.declareMethod('appReady', function () {
......
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "remote XMLA connections",
"additionalProperties": {
"$ref": "xmla_connection.json"
}
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>remote_settings.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/json</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -116,15 +116,17 @@
}
function discover_hierarchies(connection) {
var settings = getProperties(connection),
prop = settings.prop;
prop.restrictions = {
// 'CATALOG_NAME': 'FoodMart',
// 'HIERARCHY_NAME': hierarchy_name,
// 'HIERARCHY_UNIQUE_NAME': hierarchy_name,
'CUBE_NAME': settings["cube"]
};
return xmla_request_retry("discoverMDHierarchies", prop)
return getProperties(connection)
.push(function (settings) {
var prop = settings.prop;
prop.restrictions = {
// 'CATALOG_NAME': 'FoodMart',
// 'HIERARCHY_NAME': hierarchy_name,
// 'HIERARCHY_UNIQUE_NAME': hierarchy_name,
'CUBE_NAME': settings["cube"]
};
return xmla_request_retry("discoverMDHierarchies", prop);
})
.push(function (response) {
var hierarchies = {},
hierarchy,
......@@ -168,36 +170,32 @@
});
}
function getProperties(connection) {
var connections = {
"xmla": {
"prop": {
"url": "https://d1.erp5.ru/saiku/xmla",
"properties": {
"DataSourceInfo": "FoodMart",
"Catalog": "FoodMart"
}
},
"cube": "Sales"
},
"olapy": {
"prop": {
"url": "https://d1.erp5.ru/olapy/xmla",
"properties": {
"DataSourceInfo": "-",
"Catalog": "sales"
}
},
"cube": "Sales"
}
};
connection = connections[connection];
if (!connection) {
throw "connection not exist";
}
connection = JSON.parse(JSON.stringify(connection));
return connection;
}
function getProperties(connection) {
return Common.Gateway.jio_getAttachment('/', 'remote_settings.json', {format: 'json'})
.push(undefined, function (e) {
if (e.status_code === 404) {
return {};
}
throw e;
})
.push(function (value) {
var c;
if (!value.hasOwnProperty(connection)) {
throw "connection not exist";
}
c = value[connection];
return {
prop: {
url: c.url,
properties: {
DataSourceInfo: c.properties.DataSourceInfo,
Catalog: c.properties.Catalog
}
},
cube: c.properties.Cube
};
});
}
function getScheme(connection) {
var scheme = cubeScheme[connection],
......@@ -324,16 +322,22 @@
scheme;
if (!execution_scheme.execute) {
execution_scheme.execute = RSVP.defer();
return getScheme(connection)
.push(function (s) {
var settings = getProperties(connection),
return RSVP.Queue()
.push(function () {
return RSVP.all([
getScheme(connection),
getProperties(connection)
]);
})
.push(function (arr) {
var settings = arr[1],
prop = settings.prop,
hierarchies = execution_scheme.hierarchies,
hierarchy,
mdx = [],
tuple_str,
all_member;
scheme = s;
scheme = arr[0];
for (hierarchy in hierarchies) {
tuple_str = hierarchies[hierarchy].join(",");
all_member = scheme.hierarchies[hierarchy]["all_member"];
......@@ -410,10 +414,9 @@
}
function discover_members(connection, opt) {
return new RSVP.Queue()
.push(function () {
var settings = getProperties(connection),
prop = settings.prop,
return getProperties(connection)
.push(function (settings) {
var prop = settings.prop,
cached_member,
scheme = getExecutionScheme(connection);
prop.restrictions = {
......
define([
'common/main/lib/component/Window',
'common/main/lib/component/LoadMask'
], function () {
'use strict';
Common.Views.RenderJSDialog = Common.UI.Window.extend(_.extend({
initialize : function(options) {
var _options = {};
_.extend(_options, {
title: this.textTitle,
width: 1024,
height: 621,
header: true
}, options);
this.template = [
'<div id="<%= scope %>"></div>'
].join('');
_options.tpl = _.template(this.template)(_options);
Common.UI.Window.prototype.initialize.call(this, _options);
},
render: function() {
var q,
me = this,
element;
Common.UI.Window.prototype.render.call(this);
element = document.getElementById(this.options.scope);
this.$window.find('> .body').css({height: 'auto', overflow: 'hidden'});
// this.loadMask = new Common.UI.LoadMask({owner: $(element)});
// this.loadMask.setTitle(this.textLoading);
// this.loadMask.show();
if (!me.gadget) {
q = Common.Gateway.declareGadget(this.options.gadget_url, {
scope: this.options.scope,
element: element,
sandbox: "iframe"
})
.push(function (sub_gadget) {
me.gadget = sub_gadget;
var iframe = sub_gadget.element.querySelector("iframe");
iframe.width = '100%';
iframe.height = "585px";
iframe.setAttribute("frameBorder","0");
// iframe.style = "border: none;";
// iframe.align = "top";
// iframe.scrolling = "no";
// this._eventfunc = function(msg) {
// me._onWindowMessage(msg);
// };
// this._bindWindowEvents.call(this);
//
// this.on('close', function(obj){
// me._unbindWindowEvents();
// });
});
} else {
q = RSVP.Queue();
}
return q.push(function () {
return me.gadget.render(me.options.gadget_render_opt);
})
.push(undefined, function () {
// XXX
return;
})
.push(function () {
me._onLoad();
});
},
_bindWindowEvents: function() {
if (window.addEventListener) {
window.addEventListener("message", this._eventfunc, false);
} else if (window.attachEvent) {
window.attachEvent("onmessage", this._eventfunc);
}
},
_unbindWindowEvents: function() {
if (window.removeEventListener) {
window.removeEventListener("message", this._eventfunc);
} else if (window.detachEvent) {
window.detachEvent("onmessage", this._eventfunc);
}
},
_onWindowMessage: function(msg) {
// TODO: check message origin
if (msg && window.JSON) {
try {
this._onMessage.call(this, window.JSON.parse(msg.data));
} catch(e) {}
}
},
_onMessage: function(msg) {
if (msg && msg.file !== undefined) {
Common.NotificationCenter.trigger('window:close', this);
var me = this;
setTimeout(function() {
if ( !_.isEmpty(msg.file) ) {
me.trigger('mailmergerecepients', me, msg.file);
}
}, 50);
}
},
_onLoad: function() {
if (this.loadMask)
this.loadMask.hide();
},
textTitle : 'Select Data Source',
textLoading : 'Loading'
}, Common.Views.RenderJSDialog || {}));
});
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>RenderJSDialog.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -34,7 +34,8 @@ define([
'core',
'common/main/lib/util/Shortcuts',
'spreadsheeteditor/main/app/view/LeftMenu',
'spreadsheeteditor/main/app/view/FileMenu'
'spreadsheeteditor/main/app/view/FileMenu',
'common/main/lib/view/RenderJSDialog'
], function () {
'use strict';
......@@ -88,6 +89,7 @@ define([
onLaunch: function() {
this.leftMenu = this.createView('LeftMenu').render();
this.leftMenu.btnSearch.on('toggle', _.bind(this.onMenuSearch, this));
this.leftMenu.btnRemote.on('toggle', _.bind(this.onRemote, this));
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
......@@ -476,6 +478,51 @@ define([
this.showSearchDlg(show);
},
onRemote: function(obj, show) {
var queue,
me = this;
if ( !this.dlgRemote ) {
queue = Common.Gateway.jio_getAttachment('/', 'remote_settings.json', {format: 'json'})
.push(undefined, function (e) {
if (e.status_code === 404) {
return {};
}
throw e;
})
.push(function (value) {
me.dlgRemote = new Common.Views.RenderJSDialog({
toolclose: "hide",
gadget_url: "jsonform.gadget.html",
scope: "remote_settings",
gadget_render_opt: {
schema_url: "onlyoffice/remote_settings.json",
value: value
}
});
me.dlgRemote.on("hide", _.bind(function () {
this.leftMenu.btnRemote.toggle(false, true);
}, me));
});
} else {
queue = RSVP.Queue();
}
queue.push(function () {
if (show) {
if (me.dlgRemote.isVisible()) {
me.dlgRemote.focus();
} else {
me.dlgRemote.show();
}
me.api.asc_closeCellEditor();
}
})
.push(undefined, function (e) {
console.error(e);
});
},
onSearchDlgHide: function() {
this.leftMenu.btnSearch.toggle(false, true);
$(this.leftMenu.btnSearch.el).blur();
......@@ -716,4 +763,4 @@ define([
textSearch: 'Search',
textLookin: 'Look in'
}, SSE.Controllers.LeftMenu || {}));
});
\ No newline at end of file
});
......@@ -7,6 +7,7 @@
<button id="left-btn-chat" class="btn btn-category" content-target="left-panel-chat"><span class="btn-icon img-toolbarmenu btn-menu-chat">&nbsp;</span></button>
<!-- /** coauthoring end **/ -->
<button id="left-btn-plugins" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-plugin">&nbsp;</span></button>
<button id="left-btn-remote" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-settings">&nbsp;</span></button>
<button id="left-btn-support" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-support">&nbsp;</span></button>
<button id="left-btn-about" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-about">&nbsp;</span></button>
</div>
......@@ -17,4 +18,4 @@
<!-- /** coauthoring end **/ -->
<div id="left-panel-plugins" class="" style="display: none; height: 100%;" />
</div>
</div>
\ No newline at end of file
</div>
......@@ -107,6 +107,14 @@ define([
toggleGroup: 'leftMenuGroup'
});
this.btnRemote = new Common.UI.Button({
action: 'remote',
el: $('#left-btn-remote', this.el),
hint: this.tipRemote,
enableToggle: true,
disabled: true
});
this.btnSupport = new Common.UI.Button({
action: 'support',
el: $('#left-btn-support', this.el),
......@@ -150,6 +158,7 @@ define([
this.btnPlugins.on('click', _.bind(this.onBtnMenuClick, this));
this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this));
this.btnRemote.on('toggle', _.bind(this.onBtnMenuClick, this));
this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this));
this.btnFile.on('toggle', _.bind(this.onBtnMenuToggle, this));
......@@ -187,7 +196,8 @@ define([
this.btnFile.toggle(false);
this.btnAbout.toggle(false);
if (btn.options.action == 'search') {
if (btn.options.action == 'search' ||
btn.options.action == 'remote') {
} else {
if (btn.pressed) {
if (!(this.$el.width() > SCALE_MIN)) {
......@@ -289,6 +299,7 @@ define([
disableMenu: function(menu, disable) {
this.btnFile.setDisabled(false);
this.btnAbout.setDisabled(false);
this.btnRemote.setDisabled(false);
this.btnSupport.setDisabled(false);
this.btnSearch.setDisabled(false);
/** coauthoring begin **/
......@@ -369,6 +380,7 @@ define([
tipChat : 'Chat',
/** coauthoring end **/
tipAbout : 'About',
tipRemote : 'Remote Connections Settings',
tipSupport : 'Feedback & Support',
tipFile : 'File',
tipSearch : 'Search',
......
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "XMLA connection",
"type": "object",
"properties": {
"url": {
"uniqueItems": true,
"items": {
"format": "uri",
"minLength": 1,
"type": "string"
},
"minItems": 1,
"type": "array"
},
"properties": {
"type": "object",
"additionalProperties": false,
"required": ["Cube"],
"properties": {
"DataSourceInfo": {"type": "string"},
"Catalog": {"type": "string"},
"Cube": {"type": "string"}
}
},
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"url"
],
"additionalProperties": false
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>xmla_connection.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/json</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_dms
\ No newline at end of file
erp5_dms
erp5_json_form
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