Commit 4351a193 authored by Rafael Monnerat's avatar Rafael Monnerat

Initial release of the JSON Editor

See merge request nexedi/erp5!1843
parents 4170ce5a b9489817
<?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_editor</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
url_list = [
"ref-parser.min.js",
"json-editor.gadget.css",
"json-editor.gadget.html",
"json-editor.gadget.js",
"jsoneditor.js"
]
return url_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getJsonEditorPrecacheManifestList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
div.json-editor-container .je-object__container .level-1 {
display: none !important;
}
div.json-editor-container .container {
width: 100%;
padding-right: var(--bs-gutter-x, 0.75rem);
padding-left: var(--bs-gutter-x, 0.75rem);
margin-right: 0px;
margin-left: 0px;
}
div.json-editor-container p {
margin-bottom: 1rem;
}
div.json-editor-container label {
display: inline-block;
}
div.json-editor-container .alert-danger {
color: #842029;
background-color: #f8d7da;
border-color: #f5c2c7;
}
div.json-editor-container .alert {
position: relative;
padding: 1rem 1rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
}
div.json-editor-container .form-label {
margin-bottom: 0.5rem;
}
div.json-editor-container .bg-light {
--bs-bg-opacity: 1;
background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity)) !important;
}
div.json-editor-container .card {
display: flex;
flex-direction: column;
border: 1px solid rgba(0, 0, 0, 0.125);
border-radius: 0.25rem;
padding: 1rem 1rem;
background-color: #fff;
}
div.json-editor-container .je-switcher {
background-color: transparent;
height: auto;
width: auto;
margin-bottom: 0px;
margin-left: 5px;
padding: 0px 0px 0px 3px;
}
div.json-editor-container .btn {
vertical-align: middle;
border: 1px solid transparent;
padding: 0.25rem 0.5rem;
flex: 1 1 auto;
color: #fff;
background-color: #6c757d;
border-color: #6c757d;
font-size: 0.875rem;
border-radius: 0.2rem;
}
div.json-editor-container .btn:hover {
color: #fff;
background-color: #5c636a;
border-color: #565e64;
}
div.json-editor-container .fas {
font-family: 'FontAwesome';
-webkit-font-smoothing: antialiased;
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
}
div.json-editor-container .row {
--bs-gutter-x: 1.5rem;
--bs-gutter-y: 0;
display: flex;
flex-wrap: wrap;
margin-top: calc(-1 * var(--bs-gutter-y));
margin-right: calc(-0.5 * var(--bs-gutter-x));
margin-left: calc(-0.5 * var(--bs-gutter-x));
}
div.json-editor-container .row > * {
flex-shrink: 0;
width: 100%;
max-width: 100%;
padding-right: calc(var(--bs-gutter-x) * 0.5);
padding-left: calc(var(--bs-gutter-x) * 0.5);
margin-top: var(--bs-gutter-y);
}
div.json-editor-container .my-3 {
margin-bottom: 1rem!important;
}
div.json-editor-container .form-control:disabled,
div.json-editor-container .form-control[readonly] {
background-color: #e9ecef !important;
opacity: 1;
}
\ 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>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>json-editor.gadget.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</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>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JSON Editor</title>
<!-- <link rel="stylesheet" id="iconlib-link" href="font-awesome.5.1/font-awesome.5.1.css"> -->
<link rel="stylesheet" href="json-editor.gadget.css">
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="domsugar.js"></script>
<script src="ref-parser.min.js"></script>
<script src="jsoneditor.js"></script>
<script src="json-editor.gadget.js"></script>
</head>
<body>
<div class="container">
<div class='json-editor-container'></div>
<input type='hidden' class='json-editor-value'></input>
</div>
</body>
</html>
\ 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>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>json-editor.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></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*jslint nomen: true, indent: 2 */
/*global window, rJS, RSVP, JSONEditor, domsugar, JSON, $RefParser, URL */
(function (window, rJS, RSVP, JSONEditor, domsugar, JSON, $RefParser, URL) {
'use strict';
JSONEditor.AbstractEditor.prototype.getDefault = function () {
/* Append an empty value and never load the default value on the field */
if (this.schema.enum !== undefined) {
this.schema.enum.unshift("");
return "";
}
return undefined;
};
function isEmpty(obj) {
return obj === undefined || obj === '' ||
(
obj === Object(obj) &&
Object.keys(obj).length === 0 &&
(obj.constructor === Object || obj.constructor === Array)
);
}
JSONEditor.defaults.editors.object.prototype.getValue = function () {
if (!this.dependenciesFulfilled) {
return undefined;
}
/* original code uses super.getValue() but we cannot use super here */
var result = this.value;
if (result && (this.jsoneditor.options.remove_empty_properties || this.options.remove_empty_properties)) {
Object.keys(result).forEach(function (key) {
if (isEmpty(result[key])) {
delete result[key];
}
});
}
return result;
};
JSONEditor.AbstractEditor.prototype.preBuild = function () {
if (this.jsoneditor.options.readonly) {
this.schema.readOnly = this.jsoneditor.options.readonly;
}
};
if (JSONEditor.defaults.editors.select.prototype.original_preBuild === undefined) {
JSONEditor.defaults.editors.select.prototype.original_preBuild = JSONEditor.defaults.editors.select.prototype.preBuild;
}
JSONEditor.defaults.editors.select.prototype.preBuild = function () {
if (this.jsoneditor.options.readonly) {
this.schema.readOnly = this.jsoneditor.options.readonly;
}
if (this.schema.enum !== undefined) {
this.schema.enum.unshift("");
}
this.original_preBuild();
if (this.schema.type === 'boolean') {
/* the original code on preBuild include an empty first value if the value
is not required, but we always want the empty value */
if (this.isRequired()) {
this.enum_display.unshift(' ');
this.enum_options.unshift('undefined');
this.enum_values.unshift(undefined);
}
}
};
JSONEditor.defaults.editors.select.prototype.getValue = function () {
if (this.value === "") {
return undefined;
}
if (this.value === undefined) {
return undefined;
}
if (!this.dependenciesFulfilled) {
return undefined;
}
return this.typecast(this.value);
};
JSONEditor.defaults.editors.select.prototype.typecast = function (value) {
if (this.schema.type === 'boolean') {
return value === 'undefined' || value === undefined ? undefined : !!value;
}
if (this.schema.type === 'number' && value === "") {
return undefined;
}
if (this.schema.type === 'integer' && value === "") {
return undefined;
}
if (this.schema.type === 'number') {
return parseFloat(value) || 0;
}
if (this.schema.type === 'integer') {
return Math.floor(parseFloat(value) || 0);
}
if (this.schema.enum && value === undefined) {
return undefined;
}
if (value === undefined) {
return undefined;
}
return value.toString();
};
/* The original code would remove the field if value is undefined */
JSONEditor.defaults.editors.object.prototype.setValue = function (value, initial) {
var object_editor = this;
value = value || {};
if (typeof value !== 'object' || Array.isArray(value)) {
value = {};
}
/* First, set the values for all of the defined properties */
// @ts-ignore
Object.entries(this.cached_editors).forEach(function (entry) {
var i = entry[0],
editor = entry[1];
/* Value explicitly set */
if (value[i] !== undefined) {
object_editor.addObjectProperty(i);
editor.setValue(value[i], initial);
editor.activate();
/* Otherwise if it is read only remove the field */
} else if (editor.schema.readOnly) {
object_editor.removeObjectProperty(i);
/* Otherwise, set the value to the default */
} else {
editor.setValue(editor.getDefault(), initial);
}
});
// @ts-ignore
Object.entries(value).forEach(function (entry) {
var i = entry[0],
val = entry[1];
if (!object_editor.cached_editors[i]) {
object_editor.addObjectProperty(i);
if (object_editor.editors[i]) {
object_editor.editors[i].setValue(val, initial, !!object_editor.editors[i].template);
}
}
});
object_editor.refreshValue();
object_editor.layoutEditors();
object_editor.onChange();
};
JSONEditor.defaults.editors.string.prototype.setValueToInputField = function (value) {
this.input.value = value === undefined ? '' : value;
/* ERP5: Once you set the value to the input, you also
updates the field value, otherwise the getValue will miss the value */
this.value = this.input.value;
};
/* Backward compatibility with the usage of textarea property
if converts into json-editor proper property */
JSONEditor.defaults.editors.string.prototype.preBuild = function () {
if ((this.schema.textarea === true) || (this.schema.textarea === 1)) {
this.schema.format = 'textarea';
}
if (this.jsoneditor.options.readonly) {
this.schema.readOnly = this.jsoneditor.options.readonly;
}
};
rJS(window)
.declareAcquiredMethod("notifySubmit", "notifySubmit")
.declareJob("deferNotifySubmit", function () {
// Ensure error will be correctly handled
return this.notifySubmit();
})
.declareAcquiredMethod("notifyChange", "notifyChange")
.declareJob("deferNotifyChange", function () {
// Ensure error will be correctly handled
return this.notifyChange();
})
.declareMethod('render', function (options) {
var gadget = this;
function deferNotifyChange() {
if (!gadget.state.ignoredChangeDuringInitialization && gadget.state.editable) {
return gadget.deferNotifyChange();
}
// Ignore the first attempt since editor trigger change on the after the
// end of the rendering, so ignore the first attempt is reaquired.
// Later calls that trigger change
gadget.state.ignoredChangeDuringInitialization = false;
}
gadget.deferNotifyChangeBinded = deferNotifyChange.bind(gadget);
return gadget.changeState({
schema_url: options.schema_url,
value: options.value || '{}',
editable: options.editable,
key: options.key,
ignoredChangeDuringInitialization: true,
// Force refresh in any case
render_timestamp: new Date().getTime()
});
})
.onStateChange(function () {
var gadget = this,
json_editor_container = gadget.element.querySelector('.json-editor-container');
if (!gadget.state.schema_url) {
return domsugar(json_editor_container);
}
return new RSVP.Queue()
.push(function () {
var schema_url = new URL(gadget.state.schema_url, window.location.href);
return $RefParser.dereference(schema_url.href);
})
.push(function (schema) {
return new JSONEditor(domsugar(json_editor_container), {
schema: schema,
ajax: true,
theme: 'bootstrap5',
show_errors: 'always',
//iconlib: 'fontawesome5',
object_layout: 'normal',
disable_collapse: false,
disable_edit_json: true,
disable_properties: false,
keep_only_existing_values: false,
use_default_values: false,
disable_array_reorder: true,
disable_array_delete_all_rows: true,
disable_array_delete_last_row: true,
no_additional_properties: false,
remove_empty_properties: true,
keep_oneof_values: false,
startval: JSON.parse(gadget.state.value),
readonly: gadget.state.editable ? false : true
});
})
.push(function (editor) {
gadget.editor = editor;
gadget.editor.on('change', gadget.deferNotifyChangeBinded.bind(gadget));
// return complex object is not possible throught iframe
// it seems to crash rjs somewhere. To check...
// https://lab.nexedi.com/nexedi/renderjs/blob/master/renderjs.js#L2070
//return editor;
});
})
.declareMethod('getContent', function () {
var form_data = {};
if (this.editor === undefined) {
return form_data;
}
if (this.state.editable) {
form_data[this.state.key] = JSON.stringify(this.editor.getValue());
// Change the value state in place
// This will prevent the gadget to be changed if
// its parent call render with the same value
// (as ERP5 does in case of formulator error)
this.state.value = form_data[this.state.key];
}
return form_data;
})
.declareMethod('checkValidity', function () {
if (this.state.errors !== undefined) {
return this.state.errors.length === 0;
}
return true;
});
}(window, rJS, RSVP, JSONEditor, domsugar, JSON, $RefParser, URL));
\ 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>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>json-editor.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></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
div.json-editor-container {
& .je-object__container .level-1 {
display: none !important;
}
& .container {
width: 100%;
padding-right: var(--bs-gutter-x,.75rem);
padding-left: var(--bs-gutter-x,.75rem);
margin-right: 0px;
margin-left: 0px;
}
& p {
margin-bottom: 1rem;
}
& label {
display: inline-block;
}
& .alert-danger {
color: #842029;
background-color: #f8d7da;
border-color: #f5c2c7;
}
& .alert {
position: relative;
padding: 1rem 1rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
}
& .form-label {
margin-bottom: 0.5rem;
}
& .bg-light {
--bs-bg-opacity: 1;
background-color: rgba(var(--bs-light-rgb),var(--bs-bg-opacity))!important;
}
& .card {
display: flex;
flex-direction: column;
border: 1px solid rgba(0,0,0,.125);
border-radius: 0.25rem;
padding: 1rem 1rem;
background-color: #fff
}
& .je-switcher {
background-color: transparent;
height: auto;
width: auto;
margin-bottom: 0px;
margin-left: 5px;
padding: 0px 0px 0px 3px;
}
& .btn {
vertical-align: middle;
border: 1px solid transparent;
padding: 0.25rem 0.5rem;
flex: 1 1 auto;
color: #fff;
background-color: #6c757d;
border-color: #6c757d;
font-size: .875rem;
border-radius: 0.2rem;
}
& .btn:hover {
color: #fff;
background-color: #5c636a;
border-color: #565e64;
}
& .fas {
font-family: 'FontAwesome';
-webkit-font-smoothing: antialiased;
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
line-height: 1;
}
& .row {
--bs-gutter-x: 1.5rem;
--bs-gutter-y: 0;
display: flex;
flex-wrap: wrap;
margin-top: calc(-1 * var(--bs-gutter-y));
margin-right: calc(-.5 * var(--bs-gutter-x));
margin-left: calc(-.5 * var(--bs-gutter-x));
}
& .row>* {
flex-shrink: 0;
width: 100%;
max-width: 100%;
padding-right: calc(var(--bs-gutter-x) * .5);
padding-left: calc(var(--bs-gutter-x) * .5);
margin-top: var(--bs-gutter-y)
}
& .my-3 {
margin-bottom: 1rem!important;
}
& .form-control:disabled, .form-control[readonly] {
background-color: #e9ecef !important;
opacity: 1;
}
}
<?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>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>json-editor.gadget.less</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</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>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?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>must_revalidate_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>jsoneditor.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>jsoneditor.js</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This source diff could not be displayed because it is too large. You can view the blob instead.
<?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>ref-parser.min.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>
erp5_font
\ No newline at end of file
https://github.com/json-editor/json-editor as Json Editor using json schemas
\ No newline at end of file
erp5_json_editor
\ No newline at end of file
erp5_json_editor
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Form to edit JSON using a dummy schema.</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_json_editor</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>88.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View JSON Editor</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Foo_viewJsonEditor</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Zuite" module="Products.Zelenium.zuite"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>json_editor_zuite</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="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsonEditorCacheManifest</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>Json Editor Cache Manifest</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title tal:content="template/title_and_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3" tal:content="template/title_and_id"></td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/foo_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Make a new web site using our cache manifest</b></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/?ignore_layout:int=1&editable_mode:int=1</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_createCloneDocument:method</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Created Clone Web Site.</td>
<td></td>
</tr>
<tr>
<td>storeValue</td>
<td>name=field_my_id</td>
<td>new_web_site_id</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Layout Configuration</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>field_my_configuration_precache_manifest_script_list</td>
<td><br/>WebSection_getJsonEditorPrecacheManifestList</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>name=Base_edit:method</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Data updated.</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Switch to renderjs UI and check the manifest is loaded</b></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/${new_web_site_id}/#/web_page_module?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.currentWindow.navigator.serviceWorker.controller !== null</td>
<td>180000</td>
</tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsonEditorRenderJSStyle</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Web Page Editor Gadget RenderJS Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Web Page Editor Gadget RenderJS Style</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/foo_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Switch to renderjs UI and edit a web page</b></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module?editable=true</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Add'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>select</td>
<td>//select[@name='field_your_select_action']</td>
<td>label=Foo</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Object created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'View JSON Editor'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td colspan="3"><b>Wait for editor to be loaded</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>css=div.json-editor-container</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Edit Json Form Property</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td>bar</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<tr>
<td colspan="3"><b>Check that our edition is reflected on preview.</b></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Views'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'View JSON Editor'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//div[@data-gadget-scope="editor"]//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td>bar</td>
</tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testJsonEditorXHTMLStyle</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Json Editor Gadget XHTML Style</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">Web Page Editor Gadget XHTML Style</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/foo_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/foo_module/FooModule_createObjects?num:int=1</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Created Successfully.</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/foo_module/Zuite_waitForActivities</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Done.</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Edit a web page</b></td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/foo_module/0/Foo_viewJsonEditor</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Wait for editor to be loaded</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-editable="field_my_text_content"]//iframe</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//div[@data-gadget-editable="field_my_text_content"]//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>css=div.json-editor-container</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Edit Json Form Property</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td>bar</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@name='Base_edit:method']</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//button[@name='Base_edit:method']</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check that our edition is reflected on preview</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="actions"]//span[text() = "View JSON Editor"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@class="actions"]//span[text() = "View JSON Editor"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@class="actions"]//span[text() = "View JSON Editor"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-editable="field_my_text_content"]//iframe</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//div[@data-gadget-editable="field_my_text_content"]//iframe</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td></td>
</tr>
<tr>
<td>assertValue</td>
<td>//div[@data-schemapath="root.foo"]//input</td>
<td>bar</td>
</tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>40.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_json_editor_ui_test</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="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>my_text_content</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Foo_viewJsonEditor</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Foo_viewJsonEditor</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Json Editor</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_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="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>renderjs_extra</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_text_content</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Content of the web page</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_text_content</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>JSON Content</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'jio_key\', context.getRelativeUrl()), (\'editor\', \'jsoneditor\'), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\')), (\'language\', context.getPortalObject().Localizer.get_selected_language()), (\'schema_url\', \'test-schema.json\')]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Sample",
"type": "object",
"additionalProperties": false,
"properties": {
"foo": {
"description": "Foo description",
"default": "bar",
"type": "string"
}
}
}
<?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>test-schema.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</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>
##############################################################################
#
# Copyright (c) 2023 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestFunctionalJsonEditor(ERP5TypeFunctionalTestCase):
run_only = "json_editor_zuite"
del ERP5TypeFunctionalTestCase # ( not to run ERP5TypeFunctionalTestCase itself )
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testFunctionalJsonEditor</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testFunctionalJsonEditor</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_administration
erp5_json_editor
erp5_ui_test_core
erp5_web_renderjs_ui_test
\ No newline at end of file
GPL
\ No newline at end of file
Foo | view_json_editor
\ No newline at end of file
portal_tests/json_editor_zuite
portal_tests/json_editor_zuite/**
\ No newline at end of file
erp5_json_editor_ui_test
\ No newline at end of file
test.erp5.testFunctionalJsonEditor
\ No newline at end of file
erp5_full_text_mroonga_catalog
\ No newline at end of file
erp5_json_editor_ui_test
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* @property {string} password a password to decrypt the content * @property {string} password a password to decrypt the content
* @property {boolean} run a hack for jsmd editor * @property {boolean} run a hack for jsmd editor
* @property {string} key Key for ERP5 form * @property {string} key Key for ERP5 form
* @property {string} schema_url Schema's URL for json editor
*/ */
(function (window, rJS, RSVP, document, FileReader, Blob) { (function (window, rJS, RSVP, document, FileReader, Blob) {
...@@ -34,7 +35,8 @@ ...@@ -34,7 +35,8 @@
"pdf": {"url": "pdf_js/pdfjs.gadget.html"}, "pdf": {"url": "pdf_js/pdfjs.gadget.html"},
"notebook_editor": {"url": "gadget_notebook.html"}, "notebook_editor": {"url": "gadget_notebook.html"},
"jsmd_editor": {"url": "gadget_jsmd_viewer.html"}, "jsmd_editor": {"url": "gadget_jsmd_viewer.html"},
"jexcel" : {"url": "jexcel.gadget.html"} "jexcel" : {"url": "jexcel.gadget.html"},
"jsoneditor" : {"url": "json-editor.gadget.html"}
}; };
...@@ -93,6 +95,7 @@ ...@@ -93,6 +95,7 @@
run: options.run || false, run: options.run || false,
key: options.key, key: options.key,
password: options.password, password: options.password,
schema_url: options.schema_url,
// Force calling subfield render // Force calling subfield render
// as user may have modified the input value // as user may have modified the input value
render_timestamp: new Date().getTime() render_timestamp: new Date().getTime()
...@@ -161,6 +164,7 @@ ...@@ -161,6 +164,7 @@
(editor_dict.hasOwnProperty(gadget.state.editor))) || (editor_dict.hasOwnProperty(gadget.state.editor))) ||
(!gadget.state.editable && gadget.state.editor === 'jsmd_editor') || (!gadget.state.editable && gadget.state.editor === 'jsmd_editor') ||
(!gadget.state.editable && gadget.state.editor === 'monaco') || (!gadget.state.editable && gadget.state.editor === 'monaco') ||
(!gadget.state.editable && gadget.state.editor === 'jsoneditor') ||
(gadget.state.editor === 'pdf')) { (gadget.state.editor === 'pdf')) {
queue queue
.push(function () { .push(function () {
...@@ -206,6 +210,7 @@ ...@@ -206,6 +210,7 @@
(gadget.state.editor === 'html_viewer') || (gadget.state.editor === 'html_viewer') ||
(!gadget.state.editable && gadget.state.editor === 'jsmd_editor') || (!gadget.state.editable && gadget.state.editor === 'jsmd_editor') ||
(!gadget.state.editable && gadget.state.editor === 'monaco') || (!gadget.state.editable && gadget.state.editor === 'monaco') ||
(!gadget.state.editable && gadget.state.editor === 'jsoneditor') ||
(gadget.state.editor === 'pdf')) { (gadget.state.editor === 'pdf')) {
queue queue
.push(function () { .push(function () {
...@@ -214,7 +219,6 @@ ...@@ -214,7 +219,6 @@
.push(function (editor_gadget) { .push(function (editor_gadget) {
return editor_gadget.render(gadget.state); return editor_gadget.render(gadget.state);
}); });
if (modification_dict.maximize === "auto") { if (modification_dict.maximize === "auto") {
queue queue
.push(function () { .push(function () {
......
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