Commit ab881cb3 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs_ooffice] Fix view and presentation site layout

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