Commit 8d00b49a authored by Vincent Bechu's avatar Vincent Bechu Committed by Cédric Le Ninivin

erp5_officejs: delete logout from menu and add maximize button in header

/reviewed-on !167
parent 9fc4ddfd
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
g.props.ckeditor = CKEDITOR.replace( g.props.ckeditor = CKEDITOR.replace(
textarea, textarea,
{ {
removeButtons: 'NewPage,Preview', removeButtons: 'NewPage,Preview,Cut,Paste,Copy,PasteText,' +
'PasteFromWord,Flash,Iframe,Form,Checkbox,Radio,TextField,' +
'Textarea,Select,Button,ImageButton,HiddenField,Maximize',
removePlugins: '', removePlugins: '',
disableNativeSpellChecker: false, disableNativeSpellChecker: false,
extraAllowedContent: "details section article" extraAllowedContent: "details section article"
...@@ -32,13 +34,12 @@ ...@@ -32,13 +34,12 @@
command: 'saveRJS', command: 'saveRJS',
toolbar: 'document,1' toolbar: 'document,1'
}); });
g.props.ckeditor.on('maximize', function () { g.props.ckeditor.on('instanceReady', function (event) {
return g.maximize(); event.editor.execCommand('maximize');
}); });
}); });
}) })
.declareAcquiredMethod("submitContent", "triggerSubmit") .declareAcquiredMethod("submitContent", "triggerSubmit")
.declareAcquiredMethod("maximize", "triggerMaximize")
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
this.props.key = options.key || "text_content"; this.props.key = options.key || "text_content";
this.props.ckeditor.setData(options.value || ""); this.props.ckeditor.setData(options.value || "");
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>948.31859.27287.17783</string> </value> <value> <string>954.4005.3918.16742</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1452872881.96</float> <float>1474449146.05</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
<li><a href="#page=document_list" data-i18n="Document List">Document List</a></li> <li><a href="#page=document_list" data-i18n="Document List">Document List</a></li>
<li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li> <li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li>
<li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li> <li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li>
<li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>
</ul> </ul>
</div> </div>
</script> </script>
......
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.28216.64976.63368</string> </value> <value> <string>954.2922.61218.8379</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1464191586.4</float> <float>1474450659.36</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
left_button, left_button,
right_link, right_link,
right_button, right_button,
maximize_button,
default_right_text, default_right_text,
default_right_icon = "", default_right_icon = "",
title_link = {}, title_link = {},
...@@ -257,6 +258,26 @@ ...@@ -257,6 +258,26 @@
promise_list.push(gadget.translateHtml("")); promise_list.push(gadget.translateHtml(""));
} }
// handle maximize button
if (options.hasOwnProperty('maximize_action')) {
if (!options.maximized) {
maximize_button = {
title: "Maximize",
icon: "expand",
name: "maximize"
};
} else {
maximize_button = {
title: "Minimize",
icon: "compress",
name: "maximize"
};
}
promise_list.push(gadget.translateHtml(header_button_template(maximize_button)));
} else {
promise_list.push(gadget.translateHtml(""));
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all(promise_list); return RSVP.all(promise_list);
...@@ -264,7 +285,8 @@ ...@@ -264,7 +285,8 @@
.push(function (my_translated_html_list) { .push(function (my_translated_html_list) {
gadget.props.title_element.innerHTML = my_translated_html_list[0]; gadget.props.title_element.innerHTML = my_translated_html_list[0];
gadget.props.left_link.innerHTML = my_translated_html_list[1]; gadget.props.left_link.innerHTML = my_translated_html_list[1];
gadget.props.right_link.innerHTML = my_translated_html_list[2]; gadget.props.right_link.innerHTML = my_translated_html_list[3]
+ my_translated_html_list[2];
}); });
}) })
...@@ -283,6 +305,14 @@ ...@@ -283,6 +305,14 @@
if (name === "submit") { if (name === "submit") {
return form_gadget.triggerSubmit(); return form_gadget.triggerSubmit();
} }
if (name === "maximize") {
form_gadget.stats.options.maximized =
!form_gadget.stats.options.maximized;
return form_gadget.triggerSubmit("maximize")
.push(function () {
return form_gadget.render(form_gadget.stats.options);
});
}
throw new Error("Unsupported button " + name); throw new Error("Unsupported button " + name);
} }
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.58607.14824.6775</string> </value> <value> <string>954.15931.48097.6604</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442857960.12</float> <float>1475164833.83</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -71,22 +71,25 @@ ...@@ -71,22 +71,25 @@
.declareAcquiredMethod('allDocs', 'jio_allDocs') .declareAcquiredMethod('allDocs', 'jio_allDocs')
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.allowPublicAcquisition('triggerMaximize', function () { .allowPublicAcquisition('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this; var gadget = this;
return RSVP.Queue() return RSVP.Queue()
.push(function () { .push(function () {
return maximize(gadget); return maximize(gadget);
})
.fail(function (e) {
console.log(e);
}); });
}) }
.allowPublicAcquisition('triggerSubmit', function () {
return this.props.element.querySelector('button').click(); return this.props.element.querySelector('button').click();
}) })
.declareMethod('triggerSubmit', function () { .declareMethod('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
});
}
return this.props.element.querySelector('button').click(); return this.props.element.querySelector('button').click();
}) })
...@@ -102,7 +105,9 @@ ...@@ -102,7 +105,9 @@
gadget.props.element.innerHTML = html; gadget.props.element.innerHTML = html;
return gadget.updateHeader({ return gadget.updateHeader({
title: options.doc.title + " | Web Illustration", title: options.doc.title + " | Web Illustration",
save_action: true save_action: true,
maximize_action: true,
maximized: options.doc.title !== ""
}); });
}) })
.push(function () { .push(function () {
...@@ -114,8 +119,7 @@ ...@@ -114,8 +119,7 @@
// Render text content gadget // Render text content gadget
///////////////////////////////////////// /////////////////////////////////////////
.declareService(function () { .declareService(function () {
var gadget = this, var gadget = this;
text_gadget = null;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
...@@ -137,15 +141,17 @@ ...@@ -137,15 +141,17 @@
'style', 'style',
'width:100%; border: 0 none; height: 600px' 'width:100%; border: 0 none; height: 600px'
); );
text_gadget = text_content_gadget;
return text_content_gadget.render({ return text_content_gadget.render({
"key": 'text_content', "key": 'text_content',
"value": gadget.options.doc.text_content "value": gadget.options.doc.text_content
}); });
}) })
.push(function () { .push(function () {
return text_gadget.getElement(); if (gadget.options.doc.title !== "") {
}, function (error) { return gadget.triggerSubmit("maximize");
}
})
.push(undefined, function (error) {
var display_error_element; var display_error_element;
if (error === "Timed out after 5000 ms") { if (error === "Timed out after 5000 ms") {
display_error_element = display_error_element =
......
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>951.45471.29918.56183</string> </value> <value> <string>954.15924.25382.7799</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1465463607.76</float> <float>1475164165.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -72,22 +72,25 @@ ...@@ -72,22 +72,25 @@
.declareAcquiredMethod('allDocs', 'jio_allDocs') .declareAcquiredMethod('allDocs', 'jio_allDocs')
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.allowPublicAcquisition('triggerMaximize', function () { .allowPublicAcquisition('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this; var gadget = this;
return RSVP.Queue() return RSVP.Queue()
.push(function () { .push(function () {
return maximize(gadget); return maximize(gadget);
})
.fail(function (e) {
console.log(e);
}); });
}) }
.allowPublicAcquisition('triggerSubmit', function () {
return this.props.element.querySelector('button').click(); return this.props.element.querySelector('button').click();
}) })
.declareMethod('triggerSubmit', function () { .declareMethod('triggerSubmit', function (option) {
if (option[0] === "maximize" || option === "maximize") {
var gadget = this;
return RSVP.Queue()
.push(function () {
return maximize(gadget);
});
}
return this.props.element.querySelector('button').click(); return this.props.element.querySelector('button').click();
}) })
...@@ -103,7 +106,9 @@ ...@@ -103,7 +106,9 @@
gadget.props.element.innerHTML = html; gadget.props.element.innerHTML = html;
return gadget.updateHeader({ return gadget.updateHeader({
title: options.doc.title + " | Web Page", title: options.doc.title + " | Web Page",
save_action: true save_action: true,
maximize_action: true,
maximized: gadget.options.doc.title !== ""
}); });
}) })
.push(function () { .push(function () {
...@@ -115,8 +120,7 @@ ...@@ -115,8 +120,7 @@
// Render text content gadget // Render text content gadget
///////////////////////////////////////// /////////////////////////////////////////
.declareService(function () { .declareService(function () {
var gadget = this, var gadget = this;
text_gadget = null;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
...@@ -138,15 +142,17 @@ ...@@ -138,15 +142,17 @@
'style', 'style',
'width:100%; border: 0 none; height: 600px' 'width:100%; border: 0 none; height: 600px'
); );
text_gadget = text_content_gadget;
return text_content_gadget.render({ return text_content_gadget.render({
"key": 'text_content', "key": 'text_content',
"value": gadget.options.doc.text_content "value": gadget.options.doc.text_content
}); });
}) })
.push(function () { .push(function () {
return text_gadget.getElement(); if (gadget.options.doc.title !== "") {
}, function (error) { return gadget.triggerSubmit("maximize");
}
})
.push(undefined, function (error) {
var display_error_element; var display_error_element;
if (error === "Timed out after 5000 ms") { if (error === "Timed out after 5000 ms") {
display_error_element = display_error_element =
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.59099.34897.19985</string> </value> <value> <string>954.15935.39380.57002</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446740911.15</float> <float>1475164868.59</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