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>
</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 Text Editor List</string> </value>
<value> <string>OfficeJS Document List</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.18323.23284.1450</string> </value>
<value> <string>951.28165.23904.20428</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1440439735.48</float>
<float>1464188540.8</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -33,6 +33,7 @@
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
......@@ -60,11 +61,19 @@
var gadget = this;
return new RSVP.Queue()
.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) {
return gadget.updateHeader({
title: "Text Documents",
title: gadget.props.document_title_plural,
add_url: url
});
})
......@@ -73,7 +82,7 @@
})
.push(function (listbox) {
return listbox.render({
search_page: 'text_editor_list',
search_page: 'document_list',
search: options.search,
column_list: [{
select: 'title',
......@@ -95,11 +104,11 @@
title: 'Modification Date'
}],
query: {
query: 'portal_type:("Web Page")',
query: 'portal_type:("' + gadget.props.portal_type + '")',
select_list: ['title', 'reference', 'language',
'description', 'version', 'modification_date'],
limit: [0, 30]
//sort_on: [["date", "descending"]]
limit: [0, 30],
sort_on: [["modification_date", "descending"]]
}
});
});
......
......@@ -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_text_editor_list.js</string> </value>
<value> <string>gadget_officejs_page_document_list.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_text_editor_list_js</string> </value>
<value> <string>gadget_officejs_page_document_list_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>1455284352.18</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 Text Editor List JS</string> </value>
<value> <string>OfficeJS Document List JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -214,7 +249,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>
......@@ -228,7 +263,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>945.58608.35906.7321</string> </value>
<value> <string>951.28163.54980.41130</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +281,7 @@
</tuple>
<state>
<tuple>
<float>1442858189.31</float>
<float>1464188897.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,48 +5,51 @@
"use strict";
function setERP5Configuration(gadget) {
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",
// XXX This drop the signature lists...
query: {
query: 'portal_type:"Web Page" '
// XX Synchonizing the whole module is too much, here is a way to start quietly
// Supsended until modification_date is handled for synchronization
+ ' AND modification_date:>="'
+ old_date.toISOString() + '" ',
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 1,
check_local_modification: true,
check_local_creation: true,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-erp5"
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",
// XXX This drop the signature lists...
query: {
query: 'portal_type:' + portal_type
// XX Synchonizing the whole module is too much, here is a way to start quietly
// Supsended until modification_date is handled for synchronization
+ ' AND modification_date:>="'
+ old_date.toISOString() + '" ',
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 1,
check_local_modification: true,
check_local_creation: true,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-erp5"
}
}
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoas"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
}
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoas"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
};
return gadget.setSetting('jio_storage_description', configuration)
};
return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () {
return gadget.setSetting('jio_storage_name', "ERP5");
})
......
......@@ -5,49 +5,56 @@
"use strict";
function setjIODAVConfiguration(gadget) {
var configuration = {
type: "replicate",
// XXX This drop the signature lists...
query: {
query: 'portal_type:"Web Page" ',
// XX Synchonizing the whole module is too much, here is a way to start quietly
//+ 'AND local_roles: ("Owner") '
//+ 'AND validation_state: ("draft", "released_alive", "shared_alive", "published_alive") ',
limit: [0, 1234567890]
},
use_remote_post: false,
conflict_handling: 2,
check_local_modification: true,
check_local_creation: true,
check_local_deletion: true,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-dav"
}
}
},
remote_sub_storage: {
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: gadget.props.element.querySelector("input[name='dav_url']").value,
basic_login: btoa(gadget.props.element.querySelector("input[name='dav_username']").value
+ ':' + gadget.props.element.querySelector("input[name='dav_password']").value),
with_credentials: true
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",
// XXX This drop the signature lists...
query: {
query: 'portal_type:"' + portal_type + '" ',
// XX Synchonizing the whole module is too much, here is a way to start quietly
//+ 'AND local_roles: ("Owner") '
//+ 'AND validation_state: ("draft", "released_alive", "shared_alive", "published_alive") ',
limit: [0, 1234567890]
},
use_remote_post: false,
conflict_handling: 2,
check_local_modification: true,
check_local_creation: true,
check_local_deletion: true,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-dav"
}
}
},
remote_sub_storage: {
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: gadget.props.element.querySelector("input[name='dav_url']").value,
basic_login: btoa(gadget.props.element.querySelector("input[name='dav_username']").value
+ ':' + gadget.props.element.querySelector("input[name='dav_password']").value),
with_credentials: true
}
}
}
}
}
};
return gadget.setSetting('jio_storage_description', configuration)
};
return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () {
return gadget.setSetting('jio_storage_name', "DAV");
})
......
......@@ -5,7 +5,7 @@
var gadget_klass = rJS(window),
MAIN_PAGE_PREFIX = "gadget_officejs_",
DEFAULT_PAGE = "text_editor_list",
DEFAULT_PAGE = "document_list",
REDIRECT_TIMEOUT = 5000;
function listenHashChange(gadget) {
......@@ -52,6 +52,10 @@
gadget.props = {
start_deferred: RSVP.defer()
};
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
});
})
.declareMethod("getCommandUrlFor", function(options) {
......@@ -127,6 +131,26 @@
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod('renderApplication', 'renderApplication')
.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();
})
.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 @@
</item>
<item>
<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>
<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>
<key> <string>configuration_translation_gadget_url</string> </key>
......@@ -481,7 +481,7 @@
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewHateoasPreference</string> </value>
<value> <string>WebSection_viewRenderJSPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -722,7 +722,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>
......@@ -736,7 +736,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>950.31827.25865.23859</string> </value>
<value> <string>951.28218.17096.4539</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -754,7 +754,7 @@
</tuple>
<state>
<tuple>
<float>1460563397.66</float>
<float>1464191710.27</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