Commit b0f0e605 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

WIP [erp5_json_form/erp5_web_renderjs_ui/erp5_only_office] BK XMLA work

Squash of: https://lab.nexedi.com/bk/erp5/commits/onlyoffice_gui_for_xmla

initial add from https://lab.nexedi.com/bk/rjs_json_form

erp5_web_renderjs_ui: use 'error' class for validation errors

i need it because use span for displaying icons in json form

erp5_web_renderjs_ui: add design for erp5_json_form

erp5_web_renderjs_ui: html5_select: event option for notifyChange added. needs for determine event.type on parent gadget

[erp5_only_office] add gui for xmla settings

[erp5_only_office] jslint fix

[erp5_only_office] fix cube functions: use xmla_request_retry always

[erp5_only_office] use url array in cube functions for failover mirrors

[erp5_only_office] use jio.getAttachment optional parameter format

[erp5_only_office] allow use object as jio_putAttachment argument
parent a9f36f6e
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_json_form</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>json-schema</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"id": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"positiveInteger": {
"type": "integer",
"minimum": 0
},
"positiveIntegerDefault0": {
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
},
"simpleTypes": {
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
}
},
"type": "object",
"properties": {
"id": {
"type": "string"
},
"$schema": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": {},
"multipleOf": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "boolean",
"default": false
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "boolean",
"default": false
},
"maxLength": { "$ref": "#/definitions/positiveInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"items": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": {}
},
"maxItems": { "$ref": "#/definitions/positiveInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"enum": {
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"dependencies": {
"exclusiveMaximum": [ "maximum" ],
"exclusiveMinimum": [ "minimum" ]
},
"default": {}
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>schema4.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>schema4.json</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "http://json-schema.org/draft-06/schema#",
"title": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"nonNegativeInteger": {
"type": "integer",
"minimum": 0
},
"nonNegativeIntegerDefault0": {
"allOf": [
{ "$ref": "#/definitions/nonNegativeInteger" },
{ "default": 0 }
]
},
"simpleTypes": {
"enum": [
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true,
"default": []
}
},
"type": ["object", "boolean"],
"properties": {
"$id": {
"type": "string",
"format": "uri-reference"
},
"$schema": {
"type": "string",
"format": "uri"
},
"$ref": {
"type": "string",
"format": "uri-reference"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": {},
"examples": {
"type": "array",
"items": {}
},
"multipleOf": {
"type": "number",
"exclusiveMinimum": 0
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "number"
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "number"
},
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": { "$ref": "#" },
"items": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": {}
},
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"contains": { "$ref": "#" },
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": { "$ref": "#" },
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"propertyNames": { "$ref": "#" },
"const": {},
"enum": {
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"default": {}
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>schema6.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>schema6.json</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://json-schema.org/draft-07/schema#",
"title": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"nonNegativeInteger": {
"type": "integer",
"minimum": 0
},
"nonNegativeIntegerDefault0": {
"allOf": [
{ "$ref": "#/definitions/nonNegativeInteger" },
{ "default": 0 }
]
},
"simpleTypes": {
"enum": [
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true,
"default": []
}
},
"type": ["object", "boolean"],
"properties": {
"$id": {
"type": "string",
"format": "uri-reference"
},
"$schema": {
"type": "string",
"format": "uri"
},
"$ref": {
"type": "string",
"format": "uri-reference"
},
"$comment": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": true,
"readOnly": {
"type": "boolean",
"default": false
},
"examples": {
"type": "array",
"items": true
},
"multipleOf": {
"type": "number",
"exclusiveMinimum": 0
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "number"
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "number"
},
"maxLength": { "$ref": "#/definitions/nonNegativeInteger" },
"minLength": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": { "$ref": "#" },
"items": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": true
},
"maxItems": { "$ref": "#/definitions/nonNegativeInteger" },
"minItems": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"contains": { "$ref": "#" },
"maxProperties": { "$ref": "#/definitions/nonNegativeInteger" },
"minProperties": { "$ref": "#/definitions/nonNegativeIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": { "$ref": "#" },
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"propertyNames": { "format": "regex" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"propertyNames": { "$ref": "#" },
"const": true,
"enum": {
"type": "array",
"items": true,
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"contentMediaType": { "type": "string" },
"contentEncoding": { "type": "string" },
"if": {"$ref": "#"},
"then": {"$ref": "#"},
"else": {"$ref": "#"},
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"default": true
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>schema7.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>schema7.json</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
#shared
rsvp.js
renderjs.js
handlebars.js
gadget_erp5_nojqm.css
gadget_erp5_global.js
gadget_html5_select.html
gadget_html5_select.js
#jsonform
jio.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
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>jsonform.gadget.appcache</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/cache-manifest</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jsonform.gadget.appcache</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!DOCTYPE html>
<html manifest="jsonform.gadget.appcache">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ERP5</title>
<link rel="stylesheet" href="gadget_erp5_nojqm.css">
<script src="rsvp.js" type="text/javascript"></script>
<script src="jsonform/tv4.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jio.js" type="text/javascript"></script>
<script src="jsonform.gadget.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>jsonform.gadget.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>schema.gadget.html</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>jsonform.gadget.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>jsonform.gadget.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jsonform</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ERP5</title>
<link rel="stylesheet" href="../gadget_erp5_nojqm.css">
<script src="../rsvp.js" type="text/javascript"></script>
<script src="tv4.js" type="text/javascript"></script>
<script src="../renderjs.js" type="text/javascript"></script>
<script src="gadget_json_generated_form_child.js" type="text/javascript"></script>
</head>
<body>
<div data-json-path="/">
</div>
</body>
</html>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_json_generated_form_child.html</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>gadget_json_generated_form_child.html</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>gadget_json_generated_form_child.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>gadget_json_generated_form_child.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>tv4.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>tv4.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
jsonform is available at:
https://lab.nexedi.com/bk/rjs_json_form
\ No newline at end of file
erp5_view_style
\ No newline at end of file
Form generation based on http://json-schema.org/
\ No newline at end of file
bk
\ No newline at end of file
erp5_json_form
\ No newline at end of file
erp5_json_form
\ No newline at end of file
5.4.7
\ No newline at end of file
......@@ -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
......
/*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha, define,
Uint8ClampedArray,
TextDecoder, DesktopOfflineAppDocumentEndSave*/
/*jslint nomen: true, maxlen:80, indent:2*/
"use strict";
......@@ -69,11 +70,13 @@ 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,
queue;
convert;
opt = opt || {};
if (attId === 'body.txt' || attId === 'Editor.bin') {
opt = 'asBinArray';
opt = { 'format': 'bin_array' };
if (!docId) {
docId = '/';
}
......@@ -82,49 +85,44 @@ DocsAPI.DocEditor.version = function () {
docId = '/media/';
}
}
queue = g.props.value_zip_storage.getAttachment(docId, attId)
if (opt.format === "blob_url") {
convert = opt.format;
delete opt.format;
}
if (opt.format === "bin_array") {
convert = opt.format;
opt.format = 'array_buffer';
}
return g.props.value_zip_storage.getAttachment(docId, attId, opt)
.push(function (blob) {
var data;
if (opt === "asText") {
data = jIO.util.readBlobAsText(blob)
.then(function (evt) {
return evt.target.result;
});
} else if (opt === "asBinArray") {
data = jIO.util.readBlobAsArrayBuffer(blob)
.then(function (evt) {
return new Uint8ClampedArray(evt.target.result);
});
} else if (opt === "asBlobURL") {
data = URL.createObjectURL(blob);
} else if (opt === "asDataURL") {
data = new RSVP.Promise(function (resolve, reject) {
var reader = new FileReader();
reader.addEventListener('load', function () {
resolve(reader.result);
});
reader.addEventListener('error', reject);
reader.readAsDataURL(blob);
});
} else {
data = blob;
if (convert === "bin_array") {
return new Uint8ClampedArray(blob);
}
return data;
if (convert === "blob_url") {
return URL.createObjectURL(blob);
}
return blob;
});
return queue;
})
.declareMethod("jio_putAttachment", function (docId, atId, data) {
var g = this,
zip = g.props.value_zip_storage,
queue,
content_type,
start = data.slice(0, 5);
start;
if (!docId) {
docId = '/media/';
}
if (typeof data === 'string' && start === "data:") {
if (typeof data === 'string') {
start = data.slice(0, 5);
if (start === "data:") {
data = dataURLtoBlob(data);
}
}
if (typeof data === 'object' &&
!(data instanceof Blob)) {
data = new Blob([JSON.stringify(data, undefined, 2)]);
}
if (atId) {
queue = zip.putAttachment(docId, atId, data)
.push(undefined, function (error) {
......@@ -168,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>
......@@ -509,7 +509,7 @@
queue,
oThis = this;
if (0 === start.indexOf('jio:')) {
queue = Common.Gateway.jio_getAttachment(this.Api.documentId, image_id.slice(4), 'asBlobURL')
queue = Common.Gateway.jio_getAttachment(this.Api.documentId, image_id.slice(4), {format:'blob_url'})
.push(undefined, function (error) {
console.error(error);
return "";
......
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();
......
......@@ -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>
......
......@@ -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": {
"urls": {
"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": [
"urls"
],
"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>
......@@ -141,6 +141,7 @@
if (this.state.error_text) {
if (span === null) {
span = document.createElement('span');
span.setAttribute('class', 'error');
span.textContent = this.state.error_text;
this.props.container_element.appendChild(span);
} else {
......
......@@ -1190,11 +1190,11 @@ div[data-gadget-scope='header'] .ui-header ul {
.gadget-content form .ui-field-contain {
position: relative;
}
.gadget-content form .ui-field-contain > span {
.gadget-content form .ui-field-contain > span.error {
animation: fadein 0.2s ease-out;
}
@media not screen and (max-width: 85em), only screen and (min-width: 45em) and (max-width: 85em) {
.gadget-content form .ui-field-contain > span {
.gadget-content form .ui-field-contain > span.error {
background-color: #FF6600;
color: #f8fff3;
left: 25%;
......@@ -1206,7 +1206,7 @@ div[data-gadget-scope='header'] .ui-header ul {
width: auto;
z-index: 1001;
}
.gadget-content form .ui-field-contain > span:before {
.gadget-content form .ui-field-contain > span.error:before {
position: absolute;
top: 100%;
left: 2em;
......@@ -1218,7 +1218,7 @@ div[data-gadget-scope='header'] .ui-header ul {
}
}
@media not screen and (min-width: 45em) {
.gadget-content form .ui-field-contain > span {
.gadget-content form .ui-field-contain > span.error {
margin-left: 6pt;
color: #FF6600;
}
......@@ -1807,6 +1807,39 @@ div[data-gadget-url$="gadget_erp5_page_front.html"] > ul > li li {
padding: 3pt 6pt;
}
/**********************************************
* JSONForm
**********************************************/
fieldset > .jsonformfield {
padding-left: 0;
}
.jsonformfield {
display: flex;
/*padding-left: 20px;*/
padding-top: 3px;
/*margin-left: 15px;*/
}
.jsonformfield button {
display: block;
vertical-align: top;
}
.jsonformfield .ui-btn-icon-top::before {
vertical-align: top;
}
.jsonformfield label {
word-break: keep-all;
hyphens: none;
}
.jsonformfield span {
color: #5e7f8d;
}
.jsonformfield .error {
color: #E82525;
font-weight: 600;
}
.jsonformfield input[type=number] {
text-align: right;
}
/**********************************************
* Icons
**********************************************/
.ui-btn-icon-top::before,
......
......@@ -125,16 +125,16 @@
})
.declareAcquiredMethod("notifyChange", "notifyChange")
.onEvent('change', function change() {
.onEvent('change', function change(e) {
return RSVP.all([
this.checkValidity(),
this.notifyChange()
this.notifyChange(e)
]);
}, false, false)
.onEvent('input', function input() {
.onEvent('input', function input(e) {
return RSVP.all([
this.checkValidity(),
this.notifyChange()
this.notifyChange(e)
]);
}, false, false)
......
......@@ -1403,7 +1403,7 @@ div[data-gadget-scope='header'] .ui-header {
// relative for displaying popups with errors
position: relative;
& > span {
& > span.error {
animation: fadein @transition-timing;
@media @desktop, @tablet {
......@@ -2050,6 +2050,42 @@ div[data-gadget-url$="gadget_erp5_page_front.html"] {
}
}
/**********************************************
* JSONForm
**********************************************/
fieldset > .jsonformfield {
padding-left: 0
}
.jsonformfield {
display: flex;
/*padding-left: 20px;*/
padding-top: 3px;
/*margin-left: 15px;*/
button {
display: block;
vertical-align: top;
}
.ui-btn-icon-top::before {
vertical-align: top;
}
label {
word-break: keep-all;
hyphens: none;
}
span {
color: rgb(94, 127, 141)
}
.error {
color: #E82525;
font-weight: 600;
}
input[type=number] {
text-align:right;
}
}
/**********************************************
* Icons
**********************************************/
......
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