Commit a6c79e22 authored by Vincent Bechu's avatar Vincent Bechu Committed by Eteri

[erp5_officejs_ooffice] Fix view and presentation site layout

parent 26b5ac00
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
editable: (options.doc.content_type === undefined || editable: options.editable ? 1 : 0,
options.doc.content_type.indexOf("application/x-asc") === 0) ? content_editable: options.doc.content_type.indexOf("application/x-asc") === 0
(options.editable ? 1 : 0) : 0
}); });
}) })
...@@ -81,7 +80,7 @@ ...@@ -81,7 +80,7 @@
}); });
}) })
.push(function (blob) { .push(function (blob) {
if (gadget.state.editable) { if (gadget.state.content_editable) {
return jIO.util.readBlobAsDataURL(blob); return jIO.util.readBlobAsDataURL(blob);
} }
return jIO.util.readBlobAsText(blob); return jIO.util.readBlobAsText(blob);
...@@ -91,7 +90,7 @@ ...@@ -91,7 +90,7 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable; var editable = gadget.state.editable && gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -151,13 +150,13 @@ ...@@ -151,13 +150,13 @@
"type": "StringField" "type": "StringField"
}, },
"my_content": { "my_content": {
"default": editable ? data : "", "default": ((gadget.state.editable || !gadget.state.content_editable) ? data : ""),
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": editable ? "content-iframe-maximize" : "",
"required": 0, "required": 0,
"editable": editable, "editable": editable,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
"url": "../ooffice_presentation_gadget/development/", "url": "../ooffice_presentation_gadget/development/",
"sandbox": "iframe" "sandbox": "iframe"
} }
...@@ -196,10 +195,12 @@ ...@@ -196,10 +195,12 @@
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; };
if (gadget.state.editable) { if (gadget.state.content_editable) {
header_dict.edit_content = url_list[3].replace("n.editable=true", "").replace("p.editable=true", ""); if (gadget.state.editable) {
} else { header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
header_dict.edit_properties = url_list[3]; } else {
header_dict.edit_content = url_list[3];
}
} }
return gadget.updateHeader(header_dict); return gadget.updateHeader(header_dict);
}); });
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.8941.47778.20736</string> </value> <value> <string>961.12049.45812.375</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>1501674778.2</float> <float>1501852055.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
editable: (options.doc.content_type === undefined || editable: options.editable ? 1 : 0,
options.doc.content_type.indexOf("application/x-asc") === 0) ? content_editable: options.doc.content_type.indexOf("application/x-asc") === 0
(options.editable ? 1 : 0) : 0
}); });
}) })
...@@ -91,7 +90,7 @@ ...@@ -91,7 +90,7 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable; var editable = gadget.state.editable && gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -151,13 +150,13 @@ ...@@ -151,13 +150,13 @@
"type": "StringField" "type": "StringField"
}, },
"my_content": { "my_content": {
"default": editable ? data : "", "default": gadget.state.editable || !gadget.state.content_editable ? data: "",
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": editable ? "content-iframe-maximize" : "",
"required": 0, "required": 0,
"editable": editable, "editable": editable,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
"url": "../ooffice_spreadsheet_gadget/development/", "url": "../ooffice_spreadsheet_gadget/development/",
"sandbox": "iframe" "sandbox": "iframe"
} }
...@@ -196,10 +195,12 @@ ...@@ -196,10 +195,12 @@
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; };
if (gadget.state.editable) { if (gadget.state.content_editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", ""); if (gadget.state.editable) {
} else { header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
header_dict.edit_content = url_list[3]; } else {
header_dict.edit_content = url_list[3];
}
} }
return gadget.updateHeader(header_dict); return gadget.updateHeader(header_dict);
}); });
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.8942.12786.29798</string> </value> <value> <string>961.12049.61422.61457</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>1501674744.05</float> <float>1501852106.78</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -23,9 +23,8 @@ ...@@ -23,9 +23,8 @@
return this.changeState({ return this.changeState({
jio_key: options.jio_key, jio_key: options.jio_key,
doc: options.doc, doc: options.doc,
editable: (options.doc.content_type === undefined || editable: options.editable ? 1 : 0,
options.doc.content_type.indexOf("application/x-asc") === 0) ? content_editable: options.doc.content_type.indexOf("application/x-asc") === 0
(options.editable ? 1 : 0) : 0
}); });
}) })
...@@ -91,7 +90,7 @@ ...@@ -91,7 +90,7 @@
return gadget.getDeclaredGadget('form_view'); return gadget.getDeclaredGadget('form_view');
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var editable = gadget.state.editable; var editable = gadget.state.editable && gadget.state.content_editable;
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -151,13 +150,13 @@ ...@@ -151,13 +150,13 @@
"type": "StringField" "type": "StringField"
}, },
"my_content": { "my_content": {
"default": editable ? data : "", "default": gadget.state.editable || !gadget.state.content_editable ? data: "",
"css_class": editable === 1 ? "content-iframe-maximize" : "", "css_class": editable ? "content-iframe-maximize" : "",
"required": 0, "required": 0,
"editable": editable, "editable": editable,
"key": "text_content", "key": "text_content",
"hidden": 0, "hidden": 0,
"type": editable === 1 ? "GadgetField" : "EditorField", "type": editable ? "GadgetField" : "EditorField",
"url": "../ooffice_text_gadget/development/", "url": "../ooffice_text_gadget/development/",
"sandbox": "iframe" "sandbox": "iframe"
} }
...@@ -196,10 +195,12 @@ ...@@ -196,10 +195,12 @@
next_url: url_list[2], next_url: url_list[2],
save_action: true save_action: true
}; };
if (gadget.state.editable) { if (gadget.state.content_editable) {
header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", ""); if (gadget.state.editable) {
} else { header_dict.edit_properties = url_list[3].replace("n.editable=true", "").replace("p.editable=true", "");
header_dict.edit_content = url_list[3]; } else {
header_dict.edit_content = url_list[3];
}
} }
return gadget.updateHeader(header_dict); return gadget.updateHeader(header_dict);
}); });
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.8942.56202.26999</string> </value> <value> <string>961.12050.13423.63675</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>1501674679.08</float> <float>1501852115.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
</item> </item>
<item> <item>
<key> <string>configuration_default_jio_document_page_gadget_url</string> </key> <key> <string>configuration_default_jio_document_page_gadget_url</string> </key>
<value> <string>ojs_document_list</string> </value> <value> <string>ojs_controller</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_default_view_action_reference</string> </key> <key> <string>configuration_default_view_action_reference</string> </key>
...@@ -325,7 +325,7 @@ ...@@ -325,7 +325,7 @@
</item> </item>
<item> <item>
<key> <string>configuration_frontpage_gadget_url</string> </key> <key> <string>configuration_frontpage_gadget_url</string> </key>
<value> <string>ojs_controller</string> </value> <value> <string>ojs_document_list</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_hateoas_url</string> </key> <key> <string>configuration_hateoas_url</string> </key>
...@@ -570,7 +570,7 @@ ...@@ -570,7 +570,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.1764.47271.40089</string> </value> <value> <string>961.10686.10882.5973</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -588,7 +588,7 @@ ...@@ -588,7 +588,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501234963.4</float> <float>1501848515.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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