Commit 36d170b6 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_officejs: Text Editor Application use generic gadget when not viewing document

parent 27ef7772
......@@ -63,6 +63,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
......@@ -130,17 +138,15 @@ renderjs.js\n
rsvp.js\n
gadget_officejs_header.html\n
gadget_officejs_jio.html\n
gadget_officejs_jio_web_page_view.html\n
gadget_officejs_page_add_text_document.html\n
gadget_officejs_page_add_document.html\n
gadget_officejs_page_jio_configurator.html\n
gadget_officejs_page_jio_dav_configurator.html\n
gadget_officejs_page_login.html\n
gadget_officejs_page_logout.html\n
gadget_officejs_page_share_webrtc_jio.html\n
gadget_officejs_page_sync.html\n
gadget_officejs_page_text_editor_list.html\n
gadget_officejs_router.html\n
gadget_officejs_text_editor_application_panel.html\n
gadget_officejs_page_document_list.html\n
gadget_officejs_application_panel.html\n
gadget_translation.html\n
gadget_officejs_webrtc_jio.html\n
gadget_officejs_widget_listbox.html\n
......@@ -148,23 +154,25 @@ gadget_erp5_editor_panel.html\n
gadget_erp5_editor_panel.js\n
gadget_officejs_header.js\n
gadget_officejs_jio.js\n
gadget_officejs_jio_web_page_view.js\n
gadget_officejs_page_add_text_document.js\n
gadget_officejs_page_add_document.js\n
gadget_officejs_page_jio_configurator.js\n
gadget_officejs_page_jio_dav_configurator.js\n
gadget_officejs_page_login.js\n
gadget_officejs_page_logout.js\n
gadget_officejs_page_share_webrtc_jio.js\n
gadget_officejs_page_sync.js\n
gadget_officejs_page_text_editor_list.js\n
gadget_officejs_page_document_list.js\n
gadget_officejs_router.js\n
gadget_officejs_text_editor_application_panel.js\n
gadget_officejs_application_panel.js\n
gadget_translation.js\n
gadget_translation_data.js\n
gadget_officejs_webrtc_jio.js\n
gadget_officejs_widget_listbox.js\n
erp5_launcher.js\n
erp5_launcher.html\n
gadget_officejs_text_editor_router.html\n
gadget_officejs_jio_web_page_view.html\n
gadget_officejs_jio_web_page_view.js\n
rjsunsafe/gadget_ckeditor.js\n
rjsunsafe/gadget_ckeditor.html\n
NETWORK:\n
......@@ -285,7 +293,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>supercedriclen</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -299,7 +307,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>949.23979.35291.18500</string> </value>
<value> <string>951.28225.30234.4522</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -317,7 +325,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1456912025.89</float>
<float>1464192136.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -35,7 +35,7 @@
<script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content">
<ul data-role="listview" class="ui-listview">
<li><a href="#page=text_editor_list" data-i18n="Text Documents">Text Documents</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=sync" data-i18n="Synchronization">Synchronization</a></li>
<li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>
......@@ -44,7 +44,7 @@
</script>
<!-- custom script -->
<script src="gadget_officejs_text_editor_application_panel.js" type="text/javascript"></script>
<script src="gadget_officejs_application_panel.js" type="text/javascript"></script>
</head>
<body>
......
......@@ -63,6 +63,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
......@@ -73,22 +81,51 @@
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_text_editor_application_panel.html</string> </value>
<value> <string>gadget_officejs_application_panel.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Jio access</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_text_editor_application_panel_html</string> </value>
<value> <string>gadget_officejs_application_panel_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284352.46</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
......@@ -101,7 +138,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Text Editor Application Panel Gadget</string> </value>
<value> <string>OfficeJS Application Panel Gadget</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -218,7 +255,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>supercedriclen</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -232,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.12629.17894.55808</string> </value>
<value> <string>951.28216.64976.63368</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -250,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1448034490.12</float>
<float>1464191586.4</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -50,6 +50,10 @@
});
})
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('setSetting', 'setSetting')
.declareMethod('toggle', function () {
this.props.jelement.panel("toggle");
})
......@@ -59,7 +63,29 @@
})
.declareMethod('render', function () {
return;
// Extract configuration parameters stored in HTML
// XXX Will work only if top gadget...
var gadget = this,
element_list =
gadget.props.element.querySelectorAll("[data-renderjs-configuration]"),
len = element_list.length,
key,
value,
i,
queue = new RSVP.Queue();
function push(a, b) {
queue.push(function () {
return gadget.setSetting(a, b);
});
}
for (i = 0; i < len; i += 1) {
key = element_list[i].getAttribute('data-renderjs-configuration');
value = element_list[i].textContent;
push(key, value);
}
return queue;
})
/////////////////////////////////////////////////////////////////
......
......@@ -63,15 +63,31 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_text_editor_application_panel.js</string> </value>
<value> <string>gadget_officejs_application_panel.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -81,12 +97,31 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_text_editor_application_panel_js</string> </value>
<value> <string>gadget_officejs_application_panel_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284352.49</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
......@@ -99,7 +134,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Text Editor Application Panel Gadget JS</string> </value>
<value> <string>OfficeJS Application Panel Gadget JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -216,7 +251,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>supercedriclen</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.4378.53544.28347</string> </value>
<value> <string>951.28200.51773.38570</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +283,7 @@
</tuple>
<state>
<tuple>
<float>1446730020.92</float>
<float>1464190613.09</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,7 +9,7 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_officejs_page_add_text_document.js"></script>
<script src="gadget_officejs_page_add_document.js"></script>
</head>
......
......@@ -63,6 +63,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
......@@ -73,9 +81,17 @@
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_page_add_text_document.html</string> </value>
<value> <string>gadget_officejs_page_add_document.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -85,7 +101,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_page_add_text_document_html</string> </value>
<value> <string>gadget_officejs_page_add_document_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -93,6 +109,25 @@
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284351.46</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
......@@ -105,7 +140,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Add Text Document</string> </value>
<value> <string>OfficeJS Add Document</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -224,7 +259,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>supercedriclen</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -238,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.18366.40175.43093</string> </value>
<value> <string>951.28177.1205.52650</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1440439606.24</float>
<float>1464189188.67</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -18,14 +18,26 @@
.declareAcquiredMethod("post", "jio_post")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting')
.declareMethod("render", function (options) {
var gadget = this;
gadget.props.options = options;
return gadget.updateHeader({
title: "New Web Page"
})
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getSetting("portal_type"),
gadget.getSetting("document_title"),
gadget.getSetting("parent_relative_url")
]);
}).push(function (answer_list) {
gadget.props.portal_type = answer_list[0];
gadget.props.document_title = answer_list[1];
gadget.props.parent_relative_url = answer_list[2];
return gadget.updateHeader({
title: "New " + gadget.props.document_title
});
})
.push(function () {
gadget.props.deferred.resolve();
});
......@@ -41,8 +53,8 @@
.push(function () {
var doc = {
// XXX Hardcoded
parent_relative_url: "web_page_module",
portal_type: "Web Page"
parent_relative_url: gadget.props.parent_relative_url,
portal_type: gadget.props.portal_type
};
return gadget.post(doc);
})
......
......@@ -63,15 +63,31 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_page_add_text_document.js</string> </value>
<value> <string>gadget_officejs_page_add_document.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -81,7 +97,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_page_add_text_document_js</string> </value>
<value> <string>gadget_officejs_page_add_document_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -89,6 +105,25 @@
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284351.49</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
......@@ -101,7 +136,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Add Text Document JS</string> </value>
<value> <string>OfficeJS Add Document JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -220,7 +255,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>supercedriclen</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.34038.48545.63795</string> </value>
<value> <string>951.28187.42881.35293</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1443093586.17</float>
<float>1464189839.22</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,7 +9,7 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_officejs_page_text_editor_list.js"></script>
<script src="gadget_officejs_page_document_list.js"></script>
</head>
......
......@@ -63,6 +63,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
......@@ -73,9 +81,17 @@
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_page_text_editor_list.html</string> </value>
<value> <string>gadget_officejs_page_document_list.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -85,7 +101,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_page_text_editor_list_html</string> </value>
<value> <string>gadget_officejs_page_document_list_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -93,6 +109,25 @@
<none/>
</value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1455284352.14</float>
<string>UTC</string>
</tuple>
</state>
</object>