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 @@ ...@@ -63,6 +63,14 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -130,17 +138,15 @@ renderjs.js\n ...@@ -130,17 +138,15 @@ renderjs.js\n
rsvp.js\n rsvp.js\n
gadget_officejs_header.html\n gadget_officejs_header.html\n
gadget_officejs_jio.html\n gadget_officejs_jio.html\n
gadget_officejs_jio_web_page_view.html\n gadget_officejs_page_add_document.html\n
gadget_officejs_page_add_text_document.html\n
gadget_officejs_page_jio_configurator.html\n gadget_officejs_page_jio_configurator.html\n
gadget_officejs_page_jio_dav_configurator.html\n gadget_officejs_page_jio_dav_configurator.html\n
gadget_officejs_page_login.html\n gadget_officejs_page_login.html\n
gadget_officejs_page_logout.html\n gadget_officejs_page_logout.html\n
gadget_officejs_page_share_webrtc_jio.html\n gadget_officejs_page_share_webrtc_jio.html\n
gadget_officejs_page_sync.html\n gadget_officejs_page_sync.html\n
gadget_officejs_page_text_editor_list.html\n gadget_officejs_page_document_list.html\n
gadget_officejs_router.html\n gadget_officejs_application_panel.html\n
gadget_officejs_text_editor_application_panel.html\n
gadget_translation.html\n gadget_translation.html\n
gadget_officejs_webrtc_jio.html\n gadget_officejs_webrtc_jio.html\n
gadget_officejs_widget_listbox.html\n gadget_officejs_widget_listbox.html\n
...@@ -148,23 +154,25 @@ gadget_erp5_editor_panel.html\n ...@@ -148,23 +154,25 @@ gadget_erp5_editor_panel.html\n
gadget_erp5_editor_panel.js\n gadget_erp5_editor_panel.js\n
gadget_officejs_header.js\n gadget_officejs_header.js\n
gadget_officejs_jio.js\n gadget_officejs_jio.js\n
gadget_officejs_jio_web_page_view.js\n gadget_officejs_page_add_document.js\n
gadget_officejs_page_add_text_document.js\n
gadget_officejs_page_jio_configurator.js\n gadget_officejs_page_jio_configurator.js\n
gadget_officejs_page_jio_dav_configurator.js\n gadget_officejs_page_jio_dav_configurator.js\n
gadget_officejs_page_login.js\n gadget_officejs_page_login.js\n
gadget_officejs_page_logout.js\n gadget_officejs_page_logout.js\n
gadget_officejs_page_share_webrtc_jio.js\n gadget_officejs_page_share_webrtc_jio.js\n
gadget_officejs_page_sync.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_router.js\n
gadget_officejs_text_editor_application_panel.js\n gadget_officejs_application_panel.js\n
gadget_translation.js\n gadget_translation.js\n
gadget_translation_data.js\n gadget_translation_data.js\n
gadget_officejs_webrtc_jio.js\n gadget_officejs_webrtc_jio.js\n
gadget_officejs_widget_listbox.js\n gadget_officejs_widget_listbox.js\n
erp5_launcher.js\n erp5_launcher.js\n
erp5_launcher.html\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.js\n
rjsunsafe/gadget_ckeditor.html\n rjsunsafe/gadget_ckeditor.html\n
NETWORK:\n NETWORK:\n
...@@ -285,7 +293,7 @@ NETWORK:\n ...@@ -285,7 +293,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -299,7 +307,7 @@ NETWORK:\n ...@@ -299,7 +307,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>949.23979.35291.18500</string> </value> <value> <string>951.28225.30234.4522</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -317,7 +325,7 @@ NETWORK:\n ...@@ -317,7 +325,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1456912025.89</float> <float>1464192136.06</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<script id="panel-template-body" type="text/x-handlebars-template"> <script id="panel-template-body" type="text/x-handlebars-template">
<div class="ui-content"> <div class="ui-content">
<ul data-role="listview" class="ui-listview"> <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=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> <li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</script> </script>
<!-- custom 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> </head>
<body> <body>
......
...@@ -63,6 +63,14 @@ ...@@ -63,6 +63,14 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -73,22 +81,51 @@ ...@@ -73,22 +81,51 @@
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>text/html</string> </value> <value> <string>text/html</string> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <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>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Jio access</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <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>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
<value> <string>en</string> </value> <value> <string>en</string> </value>
</item> </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> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value> <value> <string>Web Page</string> </value>
...@@ -101,7 +138,7 @@ ...@@ -101,7 +138,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Text Editor Application Panel Gadget</string> </value> <value> <string>OfficeJS Application Panel Gadget</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -218,7 +255,7 @@ ...@@ -218,7 +255,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -232,7 +269,7 @@ ...@@ -232,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>947.12629.17894.55808</string> </value> <value> <string>951.28216.64976.63368</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -250,7 +287,7 @@ ...@@ -250,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1448034490.12</float> <float>1464191586.4</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
}); });
}) })
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('setSetting', 'setSetting')
.declareMethod('toggle', function () { .declareMethod('toggle', function () {
this.props.jelement.panel("toggle"); this.props.jelement.panel("toggle");
}) })
...@@ -59,7 +63,29 @@ ...@@ -59,7 +63,29 @@
}) })
.declareMethod('render', function () { .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 @@ ...@@ -63,15 +63,31 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <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>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -81,12 +97,31 @@ ...@@ -81,12 +97,31 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <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>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
<value> <string>en</string> </value> <value> <string>en</string> </value>
</item> </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> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
...@@ -99,7 +134,7 @@ ...@@ -99,7 +134,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <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>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -216,7 +251,7 @@ ...@@ -216,7 +251,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -230,7 +265,7 @@ ...@@ -230,7 +265,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.4378.53544.28347</string> </value> <value> <string>951.28200.51773.38570</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +283,7 @@ ...@@ -248,7 +283,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1446730020.92</float> <float>1464190613.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<script src="rsvp.js"></script> <script src="rsvp.js"></script>
<script src="renderjs.js"></script> <script src="renderjs.js"></script>
<script src="handlebars.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> </head>
......
...@@ -63,6 +63,14 @@ ...@@ -63,6 +63,14 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -73,9 +81,17 @@ ...@@ -73,9 +81,17 @@
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>text/html</string> </value> <value> <string>text/html</string> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <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>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -85,7 +101,7 @@ ...@@ -85,7 +101,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <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>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -93,6 +109,25 @@ ...@@ -93,6 +109,25 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value> <value> <string>Web Page</string> </value>
...@@ -105,7 +140,7 @@ ...@@ -105,7 +140,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OfficeJS Add Text Document</string> </value> <value> <string>OfficeJS Add Document</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -224,7 +259,7 @@ ...@@ -224,7 +259,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -238,7 +273,7 @@ ...@@ -238,7 +273,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.18366.40175.43093</string> </value> <value> <string>951.28177.1205.52650</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +291,7 @@ ...@@ -256,7 +291,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1440439606.24</float> <float>1464189188.67</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -18,13 +18,25 @@ ...@@ -18,13 +18,25 @@
.declareAcquiredMethod("post", "jio_post") .declareAcquiredMethod("post", "jio_post")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting')
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
gadget.props.options = options; gadget.props.options = options;
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({ return gadget.updateHeader({
title: "New Web Page" title: "New " + gadget.props.document_title
});
}) })
.push(function () { .push(function () {
gadget.props.deferred.resolve(); gadget.props.deferred.resolve();
...@@ -41,8 +53,8 @@ ...@@ -41,8 +53,8 @@
.push(function () { .push(function () {
var doc = { var doc = {
// XXX Hardcoded // XXX Hardcoded
parent_relative_url: "web_page_module", parent_relative_url: gadget.props.parent_relative_url,
portal_type: "Web Page" portal_type: gadget.props.portal_type
}; };
return gadget.post(doc); return gadget.post(doc);
}) })
......
...@@ -63,15 +63,31 @@ ...@@ -63,15 +63,31 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <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>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -81,7 +97,7 @@ ...@@ -81,7 +97,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <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>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -89,6 +105,25 @@ ...@@ -89,6 +105,25 @@
<none/> <none/>
</value> </value>
</item> </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> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
...@@ -101,7 +136,7 @@ ...@@ -101,7 +136,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OfficeJS Add Text Document JS</string> </value> <value> <string>OfficeJS Add Document JS</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -220,7 +255,7 @@ ...@@ -220,7 +255,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -234,7 +269,7 @@ ...@@ -234,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.34038.48545.63795</string> </value> <value> <string>951.28187.42881.35293</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +287,7 @@ ...@@ -252,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1443093586.17</float> <float>1464189839.22</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<script src="rsvp.js"></script> <script src="rsvp.js"></script>
<script src="renderjs.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> </head>
......
...@@ -63,6 +63,14 @@ ...@@ -63,6 +63,14 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
...@@ -73,9 +81,17 @@ ...@@ -73,9 +81,17 @@
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>text/html</string> </value> <value> <string>text/html</string> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <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>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -85,7 +101,7 @@ ...@@ -85,7 +101,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <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>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -93,6 +109,25 @@ ...@@ -93,6 +109,25 @@
<none/> <none/>
</value> </value>
</item> </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>
</value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value> <value> <string>Web Page</string> </value>
...@@ -105,7 +140,7 @@ ...@@ -105,7 +140,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OfficeJS Text Editor List</string> </value> <value> <string>OfficeJS Document List</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -224,7 +259,7 @@ ...@@ -224,7 +259,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -238,7 +273,7 @@ ...@@ -238,7 +273,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.18323.23284.1450</string> </value> <value> <string>951.28165.23904.20428</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +291,7 @@ ...@@ -256,7 +291,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1440439735.48</float> <float>1464188540.8</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
.declareAcquiredMethod("translate", "translate") .declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("jio_allDocs", function (param_list) { .allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this; var gadget = this;
...@@ -60,11 +61,19 @@ ...@@ -60,11 +61,19 @@
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.getUrlFor({page: "add_text_document"}); return RSVP.all([
gadget.getSetting("portal_type"),
gadget.getSetting("document_title_plural")
]);
})
.push(function (answer_list) {
gadget.props.portal_type = answer_list[0];
gadget.props.document_title_plural = answer_list[1];
return gadget.getUrlFor({page: "add_document"});
}) })
.push(function (url) { .push(function (url) {
return gadget.updateHeader({ return gadget.updateHeader({
title: "Text Documents", title: gadget.props.document_title_plural,
add_url: url add_url: url
}); });
}) })
...@@ -73,7 +82,7 @@ ...@@ -73,7 +82,7 @@
}) })
.push(function (listbox) { .push(function (listbox) {
return listbox.render({ return listbox.render({
search_page: 'text_editor_list', search_page: 'document_list',
search: options.search, search: options.search,
column_list: [{ column_list: [{
select: 'title', select: 'title',
...@@ -95,11 +104,11 @@ ...@@ -95,11 +104,11 @@
title: 'Modification Date' title: 'Modification Date'
}], }],
query: { query: {
query: 'portal_type:("Web Page")', query: 'portal_type:("' + gadget.props.portal_type + '")',
select_list: ['title', 'reference', 'language', select_list: ['title', 'reference', 'language',
'description', 'version', 'modification_date'], 'description', 'version', 'modification_date'],
limit: [0, 30] limit: [0, 30],
//sort_on: [["date", "descending"]] sort_on: [["modification_date", "descending"]]
} }
}); });
}); });
......
...@@ -63,15 +63,31 @@ ...@@ -63,15 +63,31 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>contributor/person_module/1</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>content_md5</string> </key> <key> <string>content_md5</string> </key>
<value> <value>
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>creators</string> </key>
<value>
<tuple>
<string>cedric.le.ninivin</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_page_text_editor_list.js</string> </value> <value> <string>gadget_officejs_page_document_list.js</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -81,7 +97,7 @@ ...@@ -81,7 +97,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_officejs_page_text_editor_list_js</string> </value> <value> <string>gadget_officejs_page_document_list_js</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -89,6 +105,25 @@ ...@@ -89,6 +105,25 @@
<none/> <none/>
</value> </value>
</item> </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.18</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value> <value> <string>Web Script</string> </value>
...@@ -101,7 +136,7 @@ ...@@ -101,7 +136,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OfficeJS Text Editor List JS</string> </value> <value> <string>OfficeJS Document List JS</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
...@@ -214,7 +249,7 @@ ...@@ -214,7 +249,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -228,7 +263,7 @@ ...@@ -228,7 +263,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.58608.35906.7321</string> </value> <value> <string>951.28163.54980.41130</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +281,7 @@ ...@@ -246,7 +281,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442858189.31</float> <float>1464188897.32</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
"use strict"; "use strict";
function setERP5Configuration(gadget) { function setERP5Configuration(gadget) {
return gadget.getSetting("portal_type")
.push(function (portal_type) {
var old_date = new Date(), var old_date = new Date(),
configuration = {}; configuration = {};
// We are looking for documents modified in the past 3 month // We are looking for documents modified in the past 3 month
...@@ -13,7 +15,7 @@ ...@@ -13,7 +15,7 @@
type: "replicate", type: "replicate",
// XXX This drop the signature lists... // XXX This drop the signature lists...
query: { query: {
query: 'portal_type:"Web Page" ' query: 'portal_type:' + portal_type
// XX Synchonizing the whole module is too much, here is a way to start quietly // XX Synchonizing the whole module is too much, here is a way to start quietly
// Supsended until modification_date is handled for synchronization // Supsended until modification_date is handled for synchronization
+ ' AND modification_date:>="' + ' AND modification_date:>="'
...@@ -46,7 +48,8 @@ ...@@ -46,7 +48,8 @@
default_view_reference: "jio_view" default_view_reference: "jio_view"
} }
}; };
return gadget.setSetting('jio_storage_description', configuration) return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () { .push(function () {
return gadget.setSetting('jio_storage_name', "ERP5"); return gadget.setSetting('jio_storage_name', "ERP5");
}) })
......
...@@ -5,11 +5,17 @@ ...@@ -5,11 +5,17 @@
"use strict"; "use strict";
function setjIODAVConfiguration(gadget) { function setjIODAVConfiguration(gadget) {
var configuration = { return gadget.getSetting("portal_type")
.push(function (portal_type) {
var old_date = new Date(),
configuration = {};
// We are looking for documents modified in the past 3 month
old_date = new Date(old_date.getFullYear(), old_date.getMonth() - 3);
configuration = {
type: "replicate", type: "replicate",
// XXX This drop the signature lists... // XXX This drop the signature lists...
query: { query: {
query: 'portal_type:"Web Page" ', query: 'portal_type:"' + portal_type + '" ',
// XX Synchonizing the whole module is too much, here is a way to start quietly // XX Synchonizing the whole module is too much, here is a way to start quietly
//+ 'AND local_roles: ("Owner") ' //+ 'AND local_roles: ("Owner") '
//+ 'AND validation_state: ("draft", "released_alive", "shared_alive", "published_alive") ', //+ 'AND validation_state: ("draft", "released_alive", "shared_alive", "published_alive") ',
...@@ -47,7 +53,8 @@ ...@@ -47,7 +53,8 @@
} }
} }
}; };
return gadget.setSetting('jio_storage_description', configuration) return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () { .push(function () {
return gadget.setSetting('jio_storage_name', "DAV"); return gadget.setSetting('jio_storage_name', "DAV");
}) })
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
MAIN_PAGE_PREFIX = "gadget_officejs_", MAIN_PAGE_PREFIX = "gadget_officejs_",
DEFAULT_PAGE = "text_editor_list", DEFAULT_PAGE = "document_list",
REDIRECT_TIMEOUT = 5000; REDIRECT_TIMEOUT = 5000;
function listenHashChange(gadget) { function listenHashChange(gadget) {
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
gadget.props = { gadget.props = {
start_deferred: RSVP.defer() start_deferred: RSVP.defer()
}; };
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
});
}) })
.declareMethod("getCommandUrlFor", function(options) { .declareMethod("getCommandUrlFor", function(options) {
...@@ -127,6 +131,26 @@ ...@@ -127,6 +131,26 @@
.declareAcquiredMethod('jio_get', 'jio_get') .declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod('renderApplication', 'renderApplication') .declareAcquiredMethod('renderApplication', 'renderApplication')
.declareMethod('start', function () { .declareMethod('start', function () {
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);
}
this.props.start_deferred.resolve(); this.props.start_deferred.resolve();
}) })
.declareService(function () { .declareService(function () {
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>OfficeJS Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Web Page</script>
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">web_page_module</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Text Document</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Text Documents</script>
</body>
</html>
\ No newline at end of file
...@@ -437,11 +437,11 @@ ...@@ -437,11 +437,11 @@
</item> </item>
<item> <item>
<key> <string>configuration_panel_gadget_url</string> </key> <key> <string>configuration_panel_gadget_url</string> </key>
<value> <string>gadget_officejs_text_editor_application_panel.html</string> </value> <value> <string>gadget_officejs_application_panel.html</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_router_gadget_url</string> </key> <key> <string>configuration_router_gadget_url</string> </key>
<value> <string>gadget_officejs_router.html</string> </value> <value> <string>gadget_officejs_text_editor_router.html</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_translation_gadget_url</string> </key> <key> <string>configuration_translation_gadget_url</string> </key>
...@@ -481,7 +481,7 @@ ...@@ -481,7 +481,7 @@
</item> </item>
<item> <item>
<key> <string>layout_configuration_form_id</string> </key> <key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value> <value> <string>WebSection_viewRenderJSPreference</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -722,7 +722,7 @@ ...@@ -722,7 +722,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>supercedriclen</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -736,7 +736,7 @@ ...@@ -736,7 +736,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>950.31827.25865.23859</string> </value> <value> <string>951.28218.17096.4539</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -754,7 +754,7 @@ ...@@ -754,7 +754,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1460563397.66</float> <float>1464191710.27</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