Commit 7ba249f0 authored by Vincent Bechu's avatar Vincent Bechu

[OfficeJS] Remove editable and links Properties/Content from views

OfficeJS bt5: erp5_officejs, erp5_officejs_jquery_app, erp5_officejs_ooffice, erp5_officejs_ui_test
parent bcad1a71
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
return gadget.changeState({ return gadget.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: result, doc: result,
child_gadget_url: child_gadget_url, child_gadget_url: child_gadget_url
editable: options.editable
}); });
}); });
}) })
...@@ -76,8 +75,7 @@ ...@@ -76,8 +75,7 @@
.push(function (form_gadget) { .push(function (form_gadget) {
return form_gadget.render({ return form_gadget.render({
jio_key: gadget.state.jio_key, jio_key: gadget.state.jio_key,
doc: gadget.state.doc, doc: gadget.state.doc
editable: gadget.state.editable
}); });
}); });
}); });
......
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.47399.35230.56951</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1508165120.02</float> <float>1515602403.02</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -122,13 +122,6 @@ ...@@ -122,13 +122,6 @@
}); });
}) })
.push(function () {
return context.declareGadget('gadget_erp5_field_multicheckbox.html', {
scope: "erp5_checkbox",
element: tmp_element.querySelector('[data-gadget-scope="erp5_checkbox"]')
});
})
.push(function () { .push(function () {
context.element.querySelector("div").appendChild(tmp_element); context.element.querySelector("div").appendChild(tmp_element);
return context.listenResize(); return context.listenResize();
...@@ -157,28 +150,6 @@ ...@@ -157,28 +150,6 @@
.push(function (result) { .push(function (result) {
context.element.querySelector("ul").innerHTML = result; context.element.querySelector("ul").innerHTML = result;
// Update the checkbox field value
return RSVP.all([
context.getDeclaredGadget("erp5_checkbox"),
context.translate("Edit Content")
]);
})
.push(function (result_list) {
var value = [],
search_gadget = result_list[0],
title = result_list[1];
if (context.state.editable) {
value = ['editable'];
}
return search_gadget.render({field_json: {
editable: true,
name: 'editable',
key: 'editable',
hidden: false,
items: [[title, 'editable']],
default: value
}});
}); });
} }
......
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.6228.20782.273</string> </value> <value> <string>964.45954.1063.61457</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501682796.44</float> <float>1515509961.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
</form> </form>
<ul data-role="listview" class="ui-listview" data-enhanced="true"></ul> <ul data-role="listview" class="ui-listview" data-enhanced="true"></ul>
<div data-gadget-url="gadget_erp5_field_checkbox.html"
data-gadget-scope="erp5_checkbox"
data-gadget-sandbox="public"></div>
<dl></dl> <dl></dl>
</div> </div>
</script> </script>
......
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -231,7 +231,7 @@ ...@@ -231,7 +231,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.7872.48022.62771</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501601900.29</float> <float>1515509919.32</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc
editable: options.editable ? 1 : 0
}); });
}) })
...@@ -38,12 +37,6 @@ ...@@ -38,12 +37,6 @@
return form_gadget.getContent(); return form_gadget.getContent();
}) })
.push(function (content) { .push(function (content) {
if (gadget.state.editable) {
return jIO.util.dataURItoBlob(content)
.push(function (blob) {
return gadget.jio_putAttachment(gadget.state.doc.jio_key, "data", blob);
});
}
return gadget.updateDocument(content); return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
...@@ -78,7 +71,6 @@ ...@@ -78,7 +71,6 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -88,9 +80,9 @@ ...@@ -88,9 +80,9 @@
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -99,9 +91,9 @@ ...@@ -99,9 +91,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -110,9 +102,9 @@ ...@@ -110,9 +102,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -121,9 +113,9 @@ ...@@ -121,9 +113,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -132,19 +124,19 @@ ...@@ -132,19 +124,19 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": data, "default": data,
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 0,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "type": "GadgetField",
"url": "../officejs_pdf_viewer_gadget/app/", "url": "../officejs_pdf_viewer_gadget/app/",
"sandbox": "iframe" "sandbox": "iframe"
} }
...@@ -159,7 +151,13 @@ ...@@ -159,7 +151,13 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -171,24 +169,17 @@ ...@@ -171,24 +169,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP, jIO, Blob)); }(window, rJS, RSVP, jIO, Blob));
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.37367.12390.34440</string> </value> <value> <string>964.47156.20414.37922</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1507276424.45</float> <float>1515582223.13</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc
editable: options.editable ? 1 : 0
}); });
}) })
...@@ -51,18 +50,18 @@ ...@@ -51,18 +50,18 @@
var gadget = this; var gadget = this;
return gadget.getDeclaredGadget('form_view') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: {"_embedded": {"_view": { erp5_document: {
"_embedded": {"_view": {
"my_title": { "my_title": {
"description": "", "description": "",
"title": "Title", "title": "Title",
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -71,9 +70,9 @@ ...@@ -71,9 +70,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -82,9 +81,9 @@ ...@@ -82,9 +81,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -93,9 +92,9 @@ ...@@ -93,9 +92,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -104,19 +103,19 @@ ...@@ -104,19 +103,19 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": gadget.state.doc.text_content, "default": gadget.state.doc.text_content,
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "type": "GadgetField",
"url": "../officejs_svg_editor_gadget/" + "url": "../officejs_svg_editor_gadget/" +
"app/method-draw/method-draw.gadget.html", "app/method-draw/method-draw.gadget.html",
"sandbox": "iframe" "sandbox": "iframe"
...@@ -127,11 +126,18 @@ ...@@ -127,11 +126,18 @@
// form_list display portal_type in header // form_list display portal_type in header
name: "" name: ""
} }
}}, }
},
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -143,24 +149,17 @@ ...@@ -143,24 +149,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP));
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.3430.40377.1177</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1510310205.61</float> <float>1515588571.99</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -131,7 +131,13 @@ ...@@ -131,7 +131,13 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.45581.43675.37307</string> </value> <value> <string>964.45862.32132.53930</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515490519.85</float> <float>1515509644.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,13 +23,12 @@ ...@@ -23,13 +23,12 @@
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc
editable: options.editable ? 1 : 0
}); });
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, doc; var gadget = this, data;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -38,17 +37,17 @@ ...@@ -38,17 +37,17 @@
return form_gadget.getContent(); return form_gadget.getContent();
}) })
.push(function (content) { .push(function (content) {
if (gadget.state.editable) { data = content.text_content;
return new RSVP.Queue() delete content.text_content;
.push(function () {
return jIO.util.dataURItoBlob(content.text_content);
})
.push(function (blob) {
return gadget.jio_putAttachment(gadget.state.jio_key, "data", blob);
});
}
return gadget.updateDocument(content); return gadget.updateDocument(content);
}) })
.push(function () {
return gadget.jio_putAttachment(
gadget.state.jio_key,
"data",
jIO.util.dataURItoBlob(data)
);
})
.push(function () { .push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'}); return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
}); });
...@@ -76,7 +75,6 @@ ...@@ -76,7 +75,6 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -86,9 +84,9 @@ ...@@ -86,9 +84,9 @@
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -97,9 +95,9 @@ ...@@ -97,9 +95,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -108,9 +106,9 @@ ...@@ -108,9 +106,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -119,9 +117,9 @@ ...@@ -119,9 +117,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -130,19 +128,19 @@ ...@@ -130,19 +128,19 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": editable ? data : data.blob, "default": data,
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "ImageField", "type": "GadgetField",
"url": "../officejs_image_editor_gadget/app/", "url": "../officejs_image_editor_gadget/app/",
"sandbox": "iframe" "sandbox": "iframe"
} }
...@@ -157,7 +155,13 @@ ...@@ -157,7 +155,13 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -169,24 +173,17 @@ ...@@ -169,24 +173,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP, jIO, Blob)); }(window, rJS, RSVP, jIO, Blob));
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.54506.51685.58146</string> </value> <value> <string>964.47145.12565.62412</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1508245149.26</float> <float>1515581646.48</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc
editable: options.editable ? 1 : 0
}); });
}) })
...@@ -51,18 +50,18 @@ ...@@ -51,18 +50,18 @@
var gadget = this; var gadget = this;
return gadget.getDeclaredGadget('form_view') return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: {"_embedded": {"_view": { erp5_document: {
"_embedded": {"_view": {
"my_title": { "my_title": {
"description": "", "description": "",
"title": "Title", "title": "Title",
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -71,9 +70,9 @@ ...@@ -71,9 +70,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -82,9 +81,9 @@ ...@@ -82,9 +81,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -93,9 +92,9 @@ ...@@ -93,9 +92,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -104,19 +103,19 @@ ...@@ -104,19 +103,19 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": gadget.state.doc.text_content, "default": gadget.state.doc.text_content,
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "type": "GadgetField",
"url": "../officejs_web_table_editor_gadget/app/", "url": "../officejs_web_table_editor_gadget/app/",
"sandbox": "iframe" "sandbox": "iframe"
} }
...@@ -126,11 +125,18 @@ ...@@ -126,11 +125,18 @@
// form_list display portal_type in header // form_list display portal_type in header
name: "" name: ""
} }
}}, }
},
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -142,24 +148,17 @@ ...@@ -142,24 +148,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP));
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.47399.35230.56951</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1508245160.26</float> <float>1515589222.3</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,14 +23,13 @@ ...@@ -23,14 +23,13 @@
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
editable: options.editable ? 1 : 0,
content_editable: options.doc.content_type === undefined || content_editable: options.doc.content_type === undefined ||
options.doc.content_type.indexOf("application/x-asc") === 0 options.doc.content_type.indexOf("application/x-asc") === 0
}); });
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, doc; var gadget = this, data;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -39,14 +38,18 @@ ...@@ -39,14 +38,18 @@
return form_gadget.getContent(); return form_gadget.getContent();
}) })
.push(function (content) { .push(function (content) {
if (gadget.state.editable) { data = content.text_content;
delete content.text_content;
return gadget.updateDocument(content);
})
.push(function () {
if (gadget.state.content_editable) {
return gadget.jio_putAttachment( return gadget.jio_putAttachment(
gadget.state.jio_key, gadget.state.jio_key,
"data", "data",
jIO.util.dataURItoBlob(content.text_content) jIO.util.dataURItoBlob(data)
); );
} }
return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'}); return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
...@@ -80,7 +83,7 @@ ...@@ -80,7 +83,7 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable && gadget.state.content_editable; var editable = gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -90,9 +93,9 @@ ...@@ -90,9 +93,9 @@
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -101,9 +104,9 @@ ...@@ -101,9 +104,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -112,9 +115,9 @@ ...@@ -112,9 +115,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -123,9 +126,9 @@ ...@@ -123,9 +126,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -134,16 +137,16 @@ ...@@ -134,16 +137,16 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": ((gadget.state.editable || !gadget.state.content_editable) ? data : ""), "default": data,
"css_class": editable ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
...@@ -161,7 +164,13 @@ ...@@ -161,7 +164,13 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -173,26 +182,17 @@ ...@@ -173,26 +182,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.content_editable) {
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP, jIO, Blob)); }(window, rJS, RSVP, jIO, Blob));
\ No newline at end of file
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.55416.10226.28381</string> </value> <value> <string>964.47368.60527.10205</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1512145557.5</float> <float>1515594873.98</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,14 +23,13 @@ ...@@ -23,14 +23,13 @@
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
editable: options.editable ? 1 : 0,
content_editable: options.doc.content_type === undefined || content_editable: options.doc.content_type === undefined ||
options.doc.content_type.indexOf("application/x-asc") === 0 options.doc.content_type.indexOf("application/x-asc") === 0
}); });
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, doc; var gadget = this, data;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -39,14 +38,18 @@ ...@@ -39,14 +38,18 @@
return form_gadget.getContent(); return form_gadget.getContent();
}) })
.push(function (content) { .push(function (content) {
if (gadget.state.editable) { data = content.text_content;
delete content.text_content;
return gadget.updateDocument(content);
})
.push(function () {
if (gadget.state.content_editable) {
return gadget.jio_putAttachment( return gadget.jio_putAttachment(
gadget.state.jio_key, gadget.state.jio_key,
"data", "data",
jIO.util.dataURItoBlob(content.text_content) jIO.util.dataURItoBlob(data)
); );
} }
return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'}); return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
...@@ -80,7 +83,7 @@ ...@@ -80,7 +83,7 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable && gadget.state.content_editable; var editable = gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -90,9 +93,9 @@ ...@@ -90,9 +93,9 @@
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -101,9 +104,9 @@ ...@@ -101,9 +104,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -112,9 +115,9 @@ ...@@ -112,9 +115,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -123,9 +126,9 @@ ...@@ -123,9 +126,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -134,16 +137,16 @@ ...@@ -134,16 +137,16 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": gadget.state.editable || !gadget.state.content_editable ? data: "", "default": data,
"css_class": editable ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
...@@ -161,7 +164,13 @@ ...@@ -161,7 +164,13 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -173,26 +182,17 @@ ...@@ -173,26 +182,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.content_editable) {
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP, jIO, Blob)); }(window, rJS, RSVP, jIO, Blob));
\ No newline at end of file
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.38374.35315.699</string> </value> <value> <string>964.45947.24858.9318</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1512145431.3</float> <float>1515594900.37</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,14 +23,13 @@ ...@@ -23,14 +23,13 @@
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
editable: options.editable ? 1 : 0,
content_editable: options.doc.content_type === undefined || content_editable: options.doc.content_type === undefined ||
options.doc.content_type.indexOf("application/x-asc") === 0 options.doc.content_type.indexOf("application/x-asc") === 0
}); });
}) })
.onEvent('submit', function () { .onEvent('submit', function () {
var gadget = this, doc; var gadget = this, data;
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
...@@ -39,14 +38,18 @@ ...@@ -39,14 +38,18 @@
return form_gadget.getContent(); return form_gadget.getContent();
}) })
.push(function (content) { .push(function (content) {
if (gadget.state.editable) { data = content.text_content;
delete content.text_content;
return gadget.updateDocument(content);
})
.push(function () {
if (gadget.state.content_editable) {
return gadget.jio_putAttachment( return gadget.jio_putAttachment(
gadget.state.jio_key, gadget.state.jio_key,
"data", "data",
jIO.util.dataURItoBlob(content.text_content) jIO.util.dataURItoBlob(data)
); );
} }
return gadget.updateDocument(content);
}) })
.push(function () { .push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'}); return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
...@@ -80,7 +83,7 @@ ...@@ -80,7 +83,7 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable && gadget.state.content_editable; var editable = gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -90,9 +93,9 @@ ...@@ -90,9 +93,9 @@
"default": gadget.state.doc.title, "default": gadget.state.doc.title,
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1 - editable, "editable": 1,
"key": "title", "key": "title",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_reference": { "my_reference": {
...@@ -101,9 +104,9 @@ ...@@ -101,9 +104,9 @@
"default": gadget.state.doc.reference, "default": gadget.state.doc.reference,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "reference", "key": "reference",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_version": { "my_version": {
...@@ -112,9 +115,9 @@ ...@@ -112,9 +115,9 @@
"default": gadget.state.doc.version, "default": gadget.state.doc.version,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "version", "key": "version",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_language": { "my_language": {
...@@ -123,9 +126,9 @@ ...@@ -123,9 +126,9 @@
"default": gadget.state.doc.language, "default": gadget.state.doc.language,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "language", "key": "language",
"hidden": editable, "hidden": 0,
"type": "StringField" "type": "StringField"
}, },
"my_description": { "my_description": {
...@@ -134,16 +137,16 @@ ...@@ -134,16 +137,16 @@
"default": gadget.state.doc.description, "default": gadget.state.doc.description,
"css_class": "", "css_class": "",
"required": 0, "required": 0,
"editable": 1 - editable, "editable": 1,
"key": "description", "key": "description",
"hidden": editable, "hidden": 0,
"type": "TextAreaField" "type": "TextAreaField"
}, },
"my_content": { "my_content": {
"default": gadget.state.editable || !gadget.state.content_editable ? data: "", "default": data,
"css_class": editable ? "content-iframe-maximize" : "", "css_class": "",
"required": 0, "required": 0,
"editable": editable, "editable": 1,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
...@@ -161,7 +164,13 @@ ...@@ -161,7 +164,13 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_reference"], ["my_version"], ["my_language"], ["my_description"]] [["my_title"], ["my_reference"]]
], [
"right",
[["my_version"], ["my_language"]]
], [
"center",
[["my_description"]]
], [ ], [
"bottom", "bottom",
[["my_content"]] [["my_content"]]
...@@ -173,26 +182,17 @@ ...@@ -173,26 +182,17 @@
return RSVP.all([ return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}), gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}), gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'})
gadget.getUrlFor({command: "change", options: {editable: true}})
]); ]);
}) })
.push(function (url_list) { .push(function (url_list) {
var header_dict = { return gadget.updateHeader({
page_title: gadget.state.doc.title, page_title: gadget.state.doc.title,
selection_url: url_list[0], selection_url: url_list[0],
previous_url: url_list[1], previous_url: url_list[1],
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; });
if (gadget.state.content_editable) {
if (gadget.state.editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
} else {
header_dict.edit_content = url_list[3];
}
}
return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP, jIO, Blob)); }(window, rJS, RSVP, jIO, Blob));
\ No newline at end of file
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.38374.35315.699</string> </value> <value> <string>964.45947.24858.9318</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1512145404.19</float> <float>1515594907.58</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -87,37 +87,37 @@ ...@@ -87,37 +87,37 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//button[@data-i18n='Save']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Menu']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>waitForElementPresent</td>
<td>name=editable</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -175,6 +175,17 @@ ...@@ -175,6 +175,17 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=canvas_front</td>
<td></td>
</tr>
<!-- Wait for editor completly loaded, this is workaround, wait for lock in renderjs -->
<tr>
<td>pause</td>
<td>2713</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -235,19 +246,3 @@ ...@@ -235,19 +246,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>identifier=canvas_front</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -119,16 +125,6 @@ ...@@ -119,16 +125,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td>
...@@ -184,6 +180,7 @@ ...@@ -184,6 +180,7 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_presentation"/>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -244,24 +241,3 @@ ...@@ -244,24 +241,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=id_main</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -119,16 +125,6 @@ ...@@ -119,16 +125,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td>
...@@ -149,6 +145,7 @@ ...@@ -149,6 +145,7 @@
<td>name=reference</td> <td>name=reference</td>
<td>reference</td> <td>reference</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_presentation"/>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -159,39 +156,3 @@ ...@@ -159,39 +156,3 @@
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td> <td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td> <td></td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=id_main</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n="Save"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -119,16 +125,6 @@ ...@@ -119,16 +125,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td>
...@@ -184,6 +180,7 @@ ...@@ -184,6 +180,7 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -244,24 +241,3 @@ ...@@ -244,24 +241,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=ws-canvas</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -46,6 +46,12 @@ ...@@ -46,6 +46,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -86,8 +92,7 @@ ...@@ -86,8 +92,7 @@
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/choice_erp5_storage"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/choice_erp5_storage"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//li[@data-label="Sheet2"]/a</td> <td>//li[@data-label="Sheet2"]/a</td>
...@@ -103,8 +108,7 @@ ...@@ -103,8 +108,7 @@
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//li[@data-label="Sheet2"]/a</td> <td>//li[@data-label="Sheet2"]/a</td>
......
...@@ -19,11 +19,6 @@ ...@@ -19,11 +19,6 @@
<td tal:content="python: 'test.officejs.onlyoffice.spreadsheet.replication.xlsy.%s' % DateTime().strftime('%Y%m%d%H%M%S')">Titre</td> <td tal:content="python: 'test.officejs.onlyoffice.spreadsheet.replication.xlsy.%s' % DateTime().strftime('%Y%m%d%H%M%S')">Titre</td>
<td>title</td> <td>title</td>
</tr> </tr>
<tr>
<td>store</td>
<td>ooffice_spreadsheet</td>
<td>test_url</td>
</tr>
<!-- Initialize --> <!-- Initialize -->
<tr> <tr>
...@@ -89,7 +84,13 @@ ...@@ -89,7 +84,13 @@
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/ooffice_spreadsheet/</td>
<td></td>
</tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>30000</td>
<td></td> <td></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/choice_erp5_storage"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/choice_erp5_storage"/>
...@@ -97,8 +98,8 @@ ...@@ -97,8 +98,8 @@
<!--1--> <!--1-->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/><!-- first time after open -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tal:block tal:define="check_value string:1; <tal:block tal:define="check_value string:1;
set_value string:2"> set_value string:2">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" />
...@@ -108,7 +109,7 @@ ...@@ -108,7 +109,7 @@
<!-- XXX Romain --> <!-- XXX Romain -->
<!--tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <!--tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tal:block tal:define="check_value string:2; <tal:block tal:define="check_value string:2;
set_value string:2"> set_value string:2">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" />
...@@ -120,7 +121,7 @@ ...@@ -120,7 +121,7 @@
<!-- XXX Romain --> <!-- XXX Romain -->
<!--tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <!--tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_content"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tal:block tal:define="check_value string:2; <tal:block tal:define="check_value string:2;
set_value string:2"> set_value string:2">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" />
...@@ -132,7 +133,7 @@ ...@@ -132,7 +133,7 @@
<!--2--> <!--2-->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<tal:block tal:define="check_value string:2; <tal:block tal:define="check_value string:2;
set_value string:3"> set_value string:3">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" /> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOfficeCell/macros/current_cell" />
......
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -119,16 +125,6 @@ ...@@ -119,16 +125,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td>
...@@ -149,37 +145,8 @@ ...@@ -149,37 +145,8 @@
<td>name=reference</td> <td>name=reference</td>
<td>reference</td> <td>reference</td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load_spreadsheet"/>
<td>click</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_align_center"/>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=ws-canvas</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n="Save"]</td> <td>//button[@data-i18n="Save"]</td>
......
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -119,19 +125,9 @@ ...@@ -119,19 +125,9 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td>Titre</td>
<td>title</td> <td>title</td>
</tr> </tr>
<tr> <tr>
...@@ -184,6 +180,7 @@ ...@@ -184,6 +180,7 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -199,21 +196,7 @@ ...@@ -199,21 +196,7 @@
<td>//a[@data-i18n='Document']</td> <td>//a[@data-i18n='Document']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/open_document_with_title"/>
<td>waitForElementPresent</td>
<td>link=Add</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>link=${title}</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=${title}</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
...@@ -244,24 +227,3 @@ ...@@ -244,24 +227,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=id_main</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
<td>${base_url}/web_site_module/ooffice_text/</td> <td>${base_url}/web_site_module/ooffice_text/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>30000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -77,16 +83,6 @@ ...@@ -77,16 +83,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>identifier=title</td> <td>identifier=title</td>
...@@ -122,6 +118,8 @@ ...@@ -122,6 +118,8 @@
<td>identifier=description</td> <td>identifier=description</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<!-- Keep content empty, conversion still failed -->
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -132,61 +130,6 @@ ...@@ -132,61 +130,6 @@
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td> <td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//canvas[@id='id_target_cursor']</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@id='id-toolbar-btn-align-center']</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Properties</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=title</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Document</td> <td>link=Document</td>
......
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
<td>${base_url}/web_site_module/${test_url}/</td> <td>${base_url}/web_site_module/${test_url}/</td>
<td></td> <td></td>
</tr> </tr>
<!-- Install can be longer than 90s -->
<tr>
<td>pause</td>
<td>60000</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[@data-i18n="Storages"]</td> <td>//a[@data-i18n="Storages"]</td>
...@@ -119,16 +125,6 @@ ...@@ -119,16 +125,6 @@
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//button[@data-i18n='Menu']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=editable</td>
<td></td>
</tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td> <td tal:content="python: 'Test Titre %s' % DateTime()">Titre</td>
...@@ -149,42 +145,8 @@ ...@@ -149,42 +145,8 @@
<td>name=reference</td> <td>name=reference</td>
<td>reference</td> <td>reference</td>
</tr> </tr>
<tr> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/wait_for_load"/>
<td>click</td> <tal:block metal:use-macro="here/Zuite_CommonTemplateForOnlyOffice/macros/click_to_align_center"/>
<td>//button[@data-i18n='Save']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[text()='Data Updated']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=id_main</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n="Save"]</td> <td>//button[@data-i18n="Save"]</td>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -87,38 +87,38 @@ ...@@ -87,38 +87,38 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//button[@data-i18n='Save']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Menu']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>waitForElementPresent</td>
<td>name=editable</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -176,6 +176,11 @@ ...@@ -176,6 +176,11 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=viewerContainer</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -236,19 +241,3 @@ ...@@ -236,19 +241,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>identifier=viewerContainer</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -87,37 +87,37 @@ ...@@ -87,37 +87,37 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//button[@data-i18n='Save']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Menu']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>waitForElementPresent</td>
<td>name=editable</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -175,6 +175,17 @@ ...@@ -175,6 +175,17 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=workarea</td>
<td></td>
</tr>
<!-- Wait for editor completly loaded, this is workaround, wait for lock in renderjs -->
<tr>
<td>pause</td>
<td>2713</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -235,19 +246,3 @@ ...@@ -235,19 +246,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>identifier=workarea</td>
<td></td>
</tr>
\ No newline at end of file
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -87,37 +87,37 @@ ...@@ -87,37 +87,37 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Local is Enough</td> <td>//a[@data-i18n='Storages']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>link=Add</td> <td>link=Local is Enough</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//button[@data-i18n='Save']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Menu']</td> <td>link=Add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>waitForElementPresent</td>
<td>name=editable</td> <td>//button[@data-i18n='Save']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -175,6 +175,17 @@ ...@@ -175,6 +175,17 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=jquery_sheet_gadget</td>
<td></td>
</tr>
<!-- Wait for editor completly loaded, this is workaround, wait for lock in renderjs -->
<tr>
<td>pause</td>
<td>2713</td>
<td></td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//button[@data-i18n='Save']</td> <td>//button[@data-i18n='Save']</td>
...@@ -235,19 +246,3 @@ ...@@ -235,19 +246,3 @@
<td>//textarea[@title='Description']</td> <td>//textarea[@title='Description']</td>
<td>${description}</td> <td>${description}</td>
</tr> </tr>
\ No newline at end of file
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
<!-- Stop Generic -->
<tr>
<td>waitForElementPresent</td>
<td>identifier=jquery_sheet_gadget</td>
<td></td>
</tr>
\ No newline at end of file
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal" <tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"> xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="wait_for_load"> <tal:block metal:define-macro="wait_for_load_spreadsheet">
<!-- Wait for OnlyOffice run --> <!-- Wait for OnlyOffice run -->
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
...@@ -18,6 +18,42 @@ ...@@ -18,6 +18,42 @@
<td></td> <td></td>
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="wait_for_load">
<!-- Wait for OnlyOffice run -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=id_viewer</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[@id='id-toolbar-btn-align-center' and not(contains(@class, "disabled"))]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="wait_for_load_presentation">
<!-- Wait for OnlyOffice run -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@class='asc-loadmask-title']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>identifier=id_viewer</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@id='id-toolbar-btn-insertimage' and not(contains(@class, "disabled"))]</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="open_document_with_title"> <tal:block metal:define-macro="open_document_with_title">
<tr> <tr>
<td colspan="3"><b>Open Document</b></td> <td colspan="3"><b>Open Document</b></td>
...@@ -137,21 +173,6 @@ ...@@ -137,21 +173,6 @@
<td></td> <td></td>
</tr> </tr>
</tal:block> </tal:block>
<tal:block metal:define-macro="click_to_content">
<tr>
<td colspan="3"><b>Click to Content</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>link=Content</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Content</td>
<td></td>
</tr>
</tal:block>
<tal:block metal:define-macro="synchronize"> <tal:block metal:define-macro="synchronize">
<tr> <tr>
<td colspan="3"><b>Synchronize</b></td> <td colspan="3"><b>Synchronize</b></td>
......
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