Commit 514a097a authored by Boris Kocherov's avatar Boris Kocherov Committed by Boris Kocherov

erp5_officejs: block runing if application files synchronize

integrate text, spreadsheet, presentation router to one officejs_router
add global settings gadget configuration string
speedup replication modification_date use
parent b3240580
......@@ -10,7 +10,7 @@
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_presentation_router.js" type="text/javascript"></script>
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
......@@ -18,5 +18,6 @@
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">document_module</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Presentation</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Presentations</script>
<script data-renderjs-configuration="global_setting_gadget_url" type="text/x-renderjs-configuration">https://setting-gadget.app.officejs.com</script>
</body>
</html>
\ No newline at end of file
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.13908.13658.50363</string> </value>
<value> <string>953.30719.44077.50978</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1471734252.05</float>
<float>1472140672.24</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, jIO, URI, location, console, document, RSVP, loopEventListener, navigator */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
var gadget_klass = rJS(window),
NAME = "presentation",
MAIN_PAGE_PREFIX = "gadget_officejs_",
DEFAULT_PAGE = "document_list",
REDIRECT_TIMEOUT = 5000;
(function () {
var erp5_query,
jio_erp5_cache_storage;
if ('serviceWorker' in navigator) {
erp5_query = [
"ooffice/apps/common/%",
"ooffice/apps/presentationeditor/main/%",
"ooffice/vendor/%",
"ooffice/sdkjs/common/%",
"ooffice/sdkjs/cell/%",
"ooffice/sdkjs/word/%",
"ooffice/sdkjs/slide/%"
].map(function (currentValue) {
return 'url_string: "' + currentValue + '"';
}).join(' OR ');
erp5_query = erp5_query + ' OR ' + [
"ooffice/gadget_ooffice.js",
"ooffice/gadget_ooffice.html",
"ooffice/apps/require.js",
"ooffice/apps/css.js",
"ooffice/apps/underscore.js",
"ooffice/apps/backbone.js",
"ooffice/apps/bootstrap.js",
"ooffice/apps/text.js",
"ooffice/apps/xregexp-all-min.js",
"ooffice/apps/jquery.mousewheel.js"
].map(function (currentValue) {
return 'url_string: ="' + currentValue + '"';
}).join(' OR ');
erp5_query = '(' + erp5_query + ' OR ' + [
"gadget_officejs_presentation_router.html",
"gadget_officejs_presentation_router.js",
"gadget_officejs_page_document_list.html",
"gadget_officejs_page_document_list.js",
"gadget_officejs_jio_presentation_view.html",
"gadget_officejs_jio_spreadsheet_view.js",
"gadget_officejs_page_add_document.html",
"gadget_officejs_page_add_document.js",
"gadget_erp5_editor_panel.html",
"gadget_erp5_editor_panel.js",
"URI.js",
"dygraph.js",
"gadget_erp5.css",
"gadget_global.js",
"gadget_jio.html",
"gadget_jio.js",
"gadget_translate.html",
"gadget_translate.js",
"i18next.js",
"jiodev.js",
"jquery.js",
"jquerymobile.css",
"jquerymobile.js",
"renderjs.js",
"rsvp.js",
"gadget_officejs_header.html",
"gadget_officejs_jio.html",
"gadget_officejs_page_add_text_document.html",
"gadget_officejs_page_jio_configurator.html",
"gadget_officejs_page_jio_dav_configurator.html",
"gadget_officejs_page_login.html",
"gadget_officejs_page_logout.html",
"gadget_officejs_page_share_webrtc_jio.html",
"gadget_officejs_page_sync.html",
"gadget_translation.html",
"gadget_officejs_webrtc_jio.html",
"gadget_officejs_widget_listbox.html",
"gadget_officejs_header.js",
"gadget_officejs_jio.js",
"gadget_officejs_page_add_text_document.js",
"gadget_officejs_page_jio_configurator.js",
"gadget_officejs_page_jio_dav_configurator.js",
"gadget_officejs_page_login.js",
"gadget_officejs_page_logout.js",
"gadget_officejs_page_share_webrtc_jio.js",
"gadget_officejs_page_sync.js",
"gadget_officejs_application_panel.html",
"gadget_officejs_application_panel.js",
"gadget_translation.js",
"gadget_translation_data.js",
"gadget_officejs_webrtc_jio.js",
"gadget_officejs_widget_listbox.js",
"erp5_launcher.js",
"erp5_launcher.html"
].map(function (currentValue) {
return '(reference: ="' + currentValue + '")';
}).join(' OR ') + ')';
jio_erp5_cache_storage = {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: 'officejs_' + NAME + '_cache_erp5'
}
}
};
jio_erp5_cache_storage = jIO.createJIO({
type: "replicate",
query: {
query: '(portal_type: ("Web Style", "Web Page", "Web Script")) AND ' +
erp5_query,
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 2,
check_local_modification: false,
check_local_creation: false,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "attachasproperty",
map: {
text_content: "text_content",
data: "data"
},
sub_storage: jio_erp5_cache_storage
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoasnoauth"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
});
/*navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.then(undefined, function (error) {
// registration failed
console.log('Registration failed with ' + error);
});*/
jio_erp5_cache_storage.repair().push(function () {
navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.then(undefined, function (error) {
// registration failed
console.log('Registration failed with ' + error);
});
}, console.log);
}
}());
function listenHashChange(gadget) {
function extractHashAndDispatch(evt) {
var hash = (evt.newURL || window.location.toString()).split('#')[1],
subhashes,
subhash,
keyvalue,
index,
args = {};
if (hash !== undefined) {
subhashes = hash.split('&');
for (index in subhashes) {
if (subhashes.hasOwnProperty(index)) {
subhash = subhashes[index];
if (subhash !== '') {
keyvalue = subhash.split('=');
if (keyvalue.length === 2) {
args[decodeURIComponent(keyvalue[0])] = decodeURIComponent(keyvalue[1]);
}
}
}
}
}
return gadget.renderApplication({
args: args
});
}
var result = loopEventListener(window, 'hashchange', false,
extractHashAndDispatch),
event = document.createEvent("Event");
event.initEvent('hashchange', true, true);
event.newURL = window.location.toString();
window.dispatchEvent(event);
return result;
}
gadget_klass
.ready(function (gadget) {
gadget.props = {
start_deferred: RSVP.defer()
};
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
});
})
.declareMethod("getCommandUrlFor", function (options) {
var prefix = '',
result,
key;
result = "#";
for (key in options) {
if (options.hasOwnProperty(key) && options[key] !== undefined) {
// Don't keep empty values
result += prefix + encodeURIComponent(key) + "=" + encodeURIComponent(options[key]);
prefix = '&';
}
}
return result;
})
.declareMethod('redirect', function (options) {
if (options !== undefined && options.toExternal) {
window.location.replace(options.url);
return RSVP.timeout(REDIRECT_TIMEOUT); // timeout if not redirected
}
else {
return this.getCommandUrlFor(options)
.push(function (hash) {
window.location.replace(hash);
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT);
});
}
})
.declareMethod('route', function (options) {
var gadget = this,
args = options.args;
gadget.options = options;
if (args.jio_key === undefined || args.jio_key === '') {
if (args.page === undefined || args.page === '' || args.page === "document_list") {
args.page = DEFAULT_PAGE;
}
return {
url: MAIN_PAGE_PREFIX + "page_" + args.page + ".html",
options: args
};
}
return gadget.jio_get(args.jio_key)
.push(function (doc) {
var sub_options = {},
base_portal_type = doc.portal_type.toLowerCase().replace(/\s/g, "_");
sub_options = {
doc: doc,
jio_key: args.jio_key,
search: args.search
};
if (base_portal_type.search(/_temp$/) >= 0) {
//Remove "_temp"
base_portal_type = base_portal_type.substr(
0,
base_portal_type.length - 5
);
}
return {
url: MAIN_PAGE_PREFIX + "jio_"
+ base_portal_type
+ "_" + args.page + ".html",
options: sub_options
};
});
})
.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 () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.start_deferred.promise;
})
.push(function () {
return listenHashChange(gadget);
});
});
}(window, rJS));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_presentation_router.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_presentation_router_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS presentation router Gadget JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1471105019.41</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.23671.55314.54732</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1471734254.06</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1471091644.63</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
/*global window, rJS */
/*global window, rJS, jIO, URI, location, console, document, RSVP, loopEventListener, navigator */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
var gadget_klass = rJS(window),
NAME,
MAIN_PAGE_PREFIX = "gadget_officejs_",
DEFAULT_PAGE = "document_list",
REDIRECT_TIMEOUT = 5000;
function get_jio_cache_storage(name) {
return {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: 'officejs_' + name + '_cache_erp5'
}
}
};
}
function get_jio_replicate_storage(name, modification_date) {
var erp5_query,
sdk_name;
erp5_query = [
"ooffice/apps/common/%",
"ooffice/vendor/%",
"ooffice/sdkjs/common/%"
];
switch (name) {
case "spreadsheet":
sdk_name = "cell";
erp5_query.push("ooffice/apps/" + name + "editor/main/%");
erp5_query.push("ooffice/sdkjs/word/%");
break;
case "text":
sdk_name = "word";
erp5_query.push("ooffice/apps/documenteditor/main/%");
erp5_query.push("ooffice/sdkjs/cell/model/%");
erp5_query.push("ooffice/sdkjs/cell/utils/%");
break;
case "presentation":
sdk_name = "slide";
erp5_query.push("ooffice/apps/" + name + "editor/main/%");
erp5_query.push("ooffice/sdkjs/word/%");
erp5_query.push("ooffice/sdkjs/cell/%");
break;
}
erp5_query.push("ooffice/sdkjs/" + sdk_name + "/%");
erp5_query = erp5_query.map(function (currentValue) {
return 'url_string: "' + currentValue + '"';
}).join(' OR ');
erp5_query = erp5_query + ' OR ' + [
"ooffice/gadget_ooffice.js",
"ooffice/gadget_ooffice.html",
"ooffice/apps/require.js",
"ooffice/apps/css.js",
"ooffice/apps/underscore.js",
"ooffice/apps/backbone.js",
"ooffice/apps/bootstrap.js",
"ooffice/apps/text.js",
"ooffice/apps/xregexp-all-min.js",
"ooffice/apps/jquery.mousewheel.js"
].map(function (currentValue) {
return 'url_string: ="' + currentValue + '"';
}).join(' OR ');
erp5_query = erp5_query + ' OR ' + [
"gadget_officejs_spreadsheet_router.html",
"gadget_officejs_router.js",
"gadget_officejs_page_document_list.html",
"gadget_officejs_page_document_list.js",
"gadget_officejs_jio_" + name + "_view.html",
"gadget_officejs_jio_spreadsheet_view.js",
"gadget_officejs_page_add_document.html",
"gadget_officejs_page_add_document.js",
"gadget_erp5_editor_panel.html",
"gadget_erp5_editor_panel.js",
"URI.js",
"dygraph.js",
"gadget_erp5.css",
"gadget_global.js",
"gadget_jio.html",
"gadget_jio.js",
"gadget_translate.html",
"gadget_translate.js",
"i18next.js",
"jiodev.js",
"jquery.js",
"jquerymobile.css",
"jquerymobile.js",
"renderjs.js",
"rsvp.js",
"gadget_officejs_header.html",
"gadget_officejs_jio.html",
"gadget_officejs_page_add_text_document.html",
"gadget_officejs_page_jio_configurator.html",
"gadget_officejs_page_jio_dav_configurator.html",
"gadget_officejs_page_login.html",
"gadget_officejs_page_logout.html",
"gadget_officejs_page_share_webrtc_jio.html",
"gadget_officejs_page_sync.html",
"gadget_translation.html",
"gadget_officejs_webrtc_jio.html",
"gadget_officejs_widget_listbox.html",
"gadget_officejs_header.js",
"gadget_officejs_jio.js",
"gadget_officejs_page_add_text_document.js",
"gadget_officejs_page_jio_configurator.js",
"gadget_officejs_page_jio_dav_configurator.js",
"gadget_officejs_page_login.js",
"gadget_officejs_page_logout.js",
"gadget_officejs_page_share_webrtc_jio.js",
"gadget_officejs_page_sync.js",
"gadget_officejs_application_panel.html",
"gadget_officejs_application_panel.js",
"gadget_translation.js",
"gadget_translation_data.js",
"gadget_officejs_webrtc_jio.js",
"gadget_officejs_widget_listbox.js",
"erp5_launcher.js",
"erp5_launcher.html"
].map(function (currentValue) {
return '(reference: ="' + currentValue + '")';
}).join(' OR ');
erp5_query = "(" + erp5_query + ")";
if (modification_date) {
modification_date = ' AND modification_date:>="'
+ modification_date + '" '
} else {
modification_date = "";
}
return jIO.createJIO({
type: "replicate",
query: {
query: '(portal_type: ("Web Style", "Web Page", "Web Script")) AND ' +
erp5_query + modification_date,
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 2,
check_local_modification: false,
check_local_creation: false,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "attachasproperty",
map: {
text_content: "text_content",
data: "data"
},
sub_storage: get_jio_cache_storage(name)
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoasnoauth"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
});
}
function listenHashChange(gadget) {
function extractHashAndDispatch(evt) {
var hash = (evt.newURL || window.location.toString()).split('#')[1],
......@@ -38,7 +199,7 @@
}
var result = loopEventListener(window, 'hashchange', false,
extractHashAndDispatch),
extractHashAndDispatch),
event = document.createEvent("Event");
event.initEvent('hashchange', true, true);
event.newURL = window.location.toString();
......@@ -58,7 +219,9 @@
});
})
.declareMethod("getCommandUrlFor", function(options) {
.declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('setSetting', 'setSetting')
.declareMethod("getCommandUrlFor", function (options) {
var prefix = '',
result,
key;
......@@ -121,13 +284,13 @@
}
return {
url: MAIN_PAGE_PREFIX + "jio_"
+ base_portal_type
+ "_" + args.page + ".html",
+ base_portal_type
+ "_" + args.page + ".html",
options: sub_options
};
});
})
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod('renderApplication', 'renderApplication')
.declareMethod('start', function () {
......@@ -142,6 +305,9 @@
function push(a, b) {
queue.push(function () {
if (a == "portal_type") {
NAME = b.toLowerCase();
}
return gadget.setSetting(a, b);
});
}
......@@ -159,6 +325,53 @@
.push(function () {
return gadget.props.start_deferred.promise;
})
.push(function () {
if (('serviceWorker' in navigator) && (NAME != "web page")) {
return jIO.createJIO(get_jio_cache_storage(NAME)).allDocs({
query: '',
sort_on: [
['modification_date', 'descending']
],
limit: [0, 1],
select_list: ['modification_date']
})
.push(function (data) {
var modification_date,
jio_store;
if (data.data.total_rows == 1) {
modification_date = data.data.rows[0].value.modification_date
}
jio_store = get_jio_replicate_storage(NAME);
return gadget.getSetting('jio_' + NAME + '_cache_description')
.push(function (query) {
if (jio_store.__storage._query_options.query == query) {
return get_jio_replicate_storage(NAME, modification_date).repair();
} else {
return gadget.setSetting(
'jio_' + NAME + '_cache_description', jio_store.__storage._query_options.query
)
.push(function () {
return jio_store.repair();
});
}
})
.push(function () {
navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.then(undefined, function (error) {
// registration failed
console.log('Registration failed with ' + error);
});
return {}
});
});
} else {
return {};
}
})
.push(function () {
return listenHashChange(gadget);
});
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.54085.31754.65399</string> </value>
<value> <string>953.30941.12978.18978</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1450274255.9</float>
<float>1472135853.24</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -10,7 +10,7 @@
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_spreadsheet_router.js" type="text/javascript"></script>
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
......@@ -18,5 +18,6 @@
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">document_module</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Spreadsheet</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Spreadsheets</script>
<script data-renderjs-configuration="global_setting_gadget_url" type="text/x-renderjs-configuration">https://setting-gadget.app.officejs.com</script>
</body>
</html>
</html>
\ No newline at end of file
......@@ -220,7 +220,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.15311.14919.61593</string> </value>
<value> <string>953.30717.14538.34184</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1448034205.49</float>
<float>1472140702.02</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, jIO, URI, location, console, document, RSVP, loopEventListener, navigator */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
var gadget_klass = rJS(window),
NAME = "spreadsheet",
MAIN_PAGE_PREFIX = "gadget_officejs_",
DEFAULT_PAGE = "document_list",
REDIRECT_TIMEOUT = 5000;
(function () {
var erp5_query,
jio_erp5_cache_storage;
if ('serviceWorker' in navigator) {
erp5_query = [
"ooffice/apps/common/%",
"ooffice/apps/spreadsheeteditor/main/%",
"ooffice/vendor/%",
"ooffice/sdkjs/common/%",
"ooffice/sdkjs/word/%",
"ooffice/sdkjs/cell/%"
].map(function (currentValue) {
return 'url_string: "' + currentValue + '"';
}).join(' OR ');
erp5_query = erp5_query + ' OR ' + [
"ooffice/gadget_ooffice.js",
"ooffice/gadget_ooffice.html",
"ooffice/apps/require.js",
"ooffice/apps/css.js",
"ooffice/apps/underscore.js",
"ooffice/apps/backbone.js",
"ooffice/apps/bootstrap.js",
"ooffice/apps/text.js",
"ooffice/apps/xregexp-all-min.js",
"ooffice/apps/jquery.mousewheel.js"
].map(function (currentValue) {
return 'url_string: ="' + currentValue + '"';
}).join(' OR ');
erp5_query = erp5_query + ' OR ' + [
"gadget_officejs_spreadsheet_router.html",
"gadget_officejs_spreadsheet_router.js",
"gadget_officejs_page_document_list.html",
"gadget_officejs_page_document_list.js",
"gadget_officejs_jio_spreadsheet_view.html",
"gadget_officejs_jio_spreadsheet_view.js",
"gadget_officejs_page_add_document.html",
"gadget_officejs_page_add_document.js",
"gadget_erp5_editor_panel.html",
"gadget_erp5_editor_panel.js",
"URI.js",
"dygraph.js",
"gadget_erp5.css",
"gadget_global.js",
"gadget_jio.html",
"gadget_jio.js",
"gadget_translate.html",
"gadget_translate.js",
"i18next.js",
"jiodev.js",
"jquery.js",
"jquerymobile.css",
"jquerymobile.js",
"renderjs.js",
"rsvp.js",
"gadget_officejs_header.html",
"gadget_officejs_jio.html",
"gadget_officejs_page_add_text_document.html",
"gadget_officejs_page_jio_configurator.html",
"gadget_officejs_page_jio_dav_configurator.html",
"gadget_officejs_page_login.html",
"gadget_officejs_page_logout.html",
"gadget_officejs_page_share_webrtc_jio.html",
"gadget_officejs_page_sync.html",
"gadget_translation.html",
"gadget_officejs_webrtc_jio.html",
"gadget_officejs_widget_listbox.html",
"gadget_officejs_header.js",
"gadget_officejs_jio.js",
"gadget_officejs_page_add_text_document.js",
"gadget_officejs_page_jio_configurator.js",
"gadget_officejs_page_jio_dav_configurator.js",
"gadget_officejs_page_login.js",
"gadget_officejs_page_logout.js",
"gadget_officejs_page_share_webrtc_jio.js",
"gadget_officejs_page_sync.js",
"gadget_officejs_application_panel.html",
"gadget_officejs_application_panel.js",
"gadget_translation.js",
"gadget_translation_data.js",
"gadget_officejs_webrtc_jio.js",
"gadget_officejs_widget_listbox.js",
"erp5_launcher.js",
"erp5_launcher.html"
].map(function (currentValue) {
return '(reference: ="' + currentValue + '")';
}).join(' OR ');
jio_erp5_cache_storage = {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: 'officejs_' + NAME + '_cache_erp5'
}
}
};
jio_erp5_cache_storage = jIO.createJIO({
type: "replicate",
query: {
query: '(portal_type: ("Web Style", "Web Page", "Web Script")) AND ' +
erp5_query,
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 2,
check_local_modification: false,
check_local_creation: false,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "attachasproperty",
map: {
text_content: "text_content",
data: "data"
},
sub_storage: jio_erp5_cache_storage
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoasnoauth"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
});
/*navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.then(undefined, function (error) {
// registration failed
console.log('Registration failed with ' + error);
});*/
jio_erp5_cache_storage.repair().push(function () {
navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.then(undefined, function (error) {
// registration failed
console.log('Registration failed with ' + error);
});
}, console.log);
}
}());
function listenHashChange(gadget) {
function extractHashAndDispatch(evt) {
var hash = (evt.newURL || window.location.toString()).split('#')[1],
subhashes,
subhash,
keyvalue,
index,
args = {};
if (hash !== undefined) {
subhashes = hash.split('&');
for (index in subhashes) {
if (subhashes.hasOwnProperty(index)) {
subhash = subhashes[index];
if (subhash !== '') {
keyvalue = subhash.split('=');
if (keyvalue.length === 2) {
args[decodeURIComponent(keyvalue[0])] = decodeURIComponent(keyvalue[1]);
}
}
}
}
}
return gadget.renderApplication({
args: args
});
}
var result = loopEventListener(window, 'hashchange', false,
extractHashAndDispatch),
event = document.createEvent("Event");
event.initEvent('hashchange', true, true);
event.newURL = window.location.toString();
window.dispatchEvent(event);
return result;
}
gadget_klass
.ready(function (gadget) {
gadget.props = {
start_deferred: RSVP.defer()
};
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
});
})
.declareMethod("getCommandUrlFor", function (options) {
var prefix = '',
result,
key;
result = "#";
for (key in options) {
if (options.hasOwnProperty(key) && options[key] !== undefined) {
// Don't keep empty values
result += prefix + encodeURIComponent(key) + "=" + encodeURIComponent(options[key]);
prefix = '&';
}
}
return result;
})
.declareMethod('redirect', function (options) {
if (options !== undefined && options.toExternal) {
window.location.replace(options.url);
return RSVP.timeout(REDIRECT_TIMEOUT); // timeout if not redirected
}
else {
return this.getCommandUrlFor(options)
.push(function (hash) {
window.location.replace(hash);
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT);
});
}
})
.declareMethod('route', function (options) {
var gadget = this,
args = options.args;
gadget.options = options;
if (args.jio_key === undefined || args.jio_key === '') {
if (args.page === undefined || args.page === '' || args.page === "document_list") {
args.page = DEFAULT_PAGE;
}
return {
url: MAIN_PAGE_PREFIX + "page_" + args.page + ".html",
options: args
};
}
return gadget.jio_get(args.jio_key)
.push(function (doc) {
var sub_options = {},
base_portal_type = doc.portal_type.toLowerCase().replace(/\s/g, "_");
sub_options = {
doc: doc,
jio_key: args.jio_key,
search: args.search
};
if (base_portal_type.search(/_temp$/) >= 0) {
//Remove "_temp"
base_portal_type = base_portal_type.substr(
0,
base_portal_type.length - 5
);
}
return {
url: MAIN_PAGE_PREFIX + "jio_"
+ base_portal_type
+ "_" + args.page + ".html",
options: sub_options
};
});
})
.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 () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.start_deferred.promise;
})
.push(function () {
return listenHashChange(gadget);
});
});
}(window, rJS));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_spreadsheet_router.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_spreadsheet_router_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS spreadsheet router Gadget JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1448034214.11</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.24296.32010.24814</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1471769908.85</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1448034169.01</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
......@@ -10,7 +10,7 @@
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_text_router.js" type="text/javascript"></script>
<script src="gadget_officejs_router.js" type="text/javascript"></script>
</head>
<body>
......@@ -18,5 +18,6 @@
<script data-renderjs-configuration="parent_relative_url" type="text/x-renderjs-configuration">document_module</script>
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Text</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Text documents</script>
<script data-renderjs-configuration="global_setting_gadget_url" type="text/x-renderjs-configuration">https://setting-gadget.app.officejs.com</script>
</body>
</html>
</html>
\ No newline at end of file
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>947.62778.13711.18073</string> </value>
<value> <string>953.30720.20594.2577</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1450795865.64</float>
<float>1472140729.45</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, jIO, URI, location, console, document, RSVP, loopEventListener, navigator */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
var gadget_klass = rJS(window),
NAME = "text",
MAIN_PAGE_PREFIX = "gadget_officejs_",
DEFAULT_PAGE = "document_list",
REDIRECT_TIMEOUT = 5000;
(function () {
var erp5_query,
jio_erp5_cache_storage;
if ('serviceWorker' in navigator) {
erp5_query = [
"ooffice/apps/common/%",
"ooffice/apps/documenteditor/main/%",
"ooffice/vendor/%",
"ooffice/sdkjs/common/%",
"ooffice/sdkjs/word/%",
"ooffice/sdkjs/cell/model/%",
"ooffice/sdkjs/cell/utils/%"
].map(function (currentValue) {
return 'url_string: "' + currentValue + '"';
}).join(' OR ');
erp5_query = erp5_query + ' OR ' + [
"ooffice/gadget_ooffice.js",
"ooffice/gadget_ooffice.html",
"ooffice/apps/require.js",
"ooffice/apps/css.js",
"ooffice/apps/underscore.js",
"ooffice/apps/backbone.js",
"ooffice/apps/bootstrap.js",
"ooffice/apps/text.js",
"ooffice/apps/xregexp-all-min.js",
"ooffice/apps/jquery.mousewheel.js"
].map(function (currentValue) {
return 'url_string: ="' + currentValue + '"';
}).join(' OR ');
erp5_query = '(' + erp5_query + ' OR ' + [
"gadget_officejs_text_router.html",
"gadget_officejs_text_router.js",
"gadget_officejs_page_document_list.html",
"gadget_officejs_page_document_list.js",
"gadget_officejs_jio_text_view.html",
"gadget_officejs_jio_spreadsheet_view.js",
"gadget_officejs_page_add_document.html",
"gadget_officejs_page_add_document.js",
"gadget_erp5_editor_panel.html",
"gadget_erp5_editor_panel.js",
"URI.js",
"dygraph.js",
"gadget_erp5.css",
"gadget_global.js",
"gadget_jio.html",
"gadget_jio.js",
"gadget_translate.html",
"gadget_translate.js",
"i18next.js",
"jiodev.js",
"jquery.js",
"jquerymobile.css",
"jquerymobile.js",
"renderjs.js",
"rsvp.js",
"gadget_officejs_header.html",
"gadget_officejs_jio.html",
"gadget_officejs_page_add_text_document.html",
"gadget_officejs_page_jio_configurator.html",
"gadget_officejs_page_jio_dav_configurator.html",
"gadget_officejs_page_login.html",
"gadget_officejs_page_logout.html",
"gadget_officejs_page_share_webrtc_jio.html",
"gadget_officejs_page_sync.html",
"gadget_translation.html",
"gadget_officejs_webrtc_jio.html",
"gadget_officejs_widget_listbox.html",
"gadget_officejs_header.js",
"gadget_officejs_jio.js",
"gadget_officejs_page_add_text_document.js",
"gadget_officejs_page_jio_configurator.js",
"gadget_officejs_page_jio_dav_configurator.js",
"gadget_officejs_page_login.js",
"gadget_officejs_page_logout.js",
"gadget_officejs_page_share_webrtc_jio.js",
"gadget_officejs_page_sync.js",
"gadget_officejs_application_panel.html",
"gadget_officejs_application_panel.js",
"gadget_translation.js",
"gadget_translation_data.js",
"gadget_officejs_webrtc_jio.js",
"gadget_officejs_widget_listbox.js",
"erp5_launcher.js",
"erp5_launcher.html"
].map(function (currentValue) {
return '(reference: ="' + currentValue + '")';
}).join(' OR ') + ')';
jio_erp5_cache_storage = {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: 'officejs_' + NAME + '_cache_erp5'
}
}
};
jio_erp5_cache_storage = jIO.createJIO({
type: "replicate",
query: {
query: '(portal_type: ("Web Style", "Web Page", "Web Script")) AND ' +
erp5_query,
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 2,
check_local_modification: false,
check_local_creation: false,
check_local_deletion: false,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "attachasproperty",
map: {
text_content: "text_content",
data: "data"
},
sub_storage: jio_erp5_cache_storage
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoasnoauth"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
});
jio_erp5_cache_storage.repair().push(function () {
navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.then(undefined, function (error) {
// registration failed
console.log('Registration failed with ' + error);
});
}, console.log);
}
}());
function listenHashChange(gadget) {
function extractHashAndDispatch(evt) {
var hash = (evt.newURL || window.location.toString()).split('#')[1],
subhashes,
subhash,
keyvalue,
index,
args = {};
if (hash !== undefined) {
subhashes = hash.split('&');
for (index in subhashes) {
if (subhashes.hasOwnProperty(index)) {
subhash = subhashes[index];
if (subhash !== '') {
keyvalue = subhash.split('=');
if (keyvalue.length === 2) {
args[decodeURIComponent(keyvalue[0])] = decodeURIComponent(keyvalue[1]);
}
}
}
}
}
return gadget.renderApplication({
args: args
});
}
var result = loopEventListener(window, 'hashchange', false,
extractHashAndDispatch),
event = document.createEvent("Event");
event.initEvent('hashchange', true, true);
event.newURL = window.location.toString();
window.dispatchEvent(event);
return result;
}
gadget_klass
.ready(function (gadget) {
gadget.props = {
start_deferred: RSVP.defer()
};
return gadget.getElement()
.push(function (element) {
gadget.props.element = element;
});
})
.declareMethod("getCommandUrlFor", function (options) {
var prefix = '',
result,
key;
result = "#";
for (key in options) {
if (options.hasOwnProperty(key) && options[key] !== undefined) {
// Don't keep empty values
result += prefix + encodeURIComponent(key) + "=" + encodeURIComponent(options[key]);
prefix = '&';
}
}
return result;
})
.declareMethod('redirect', function (options) {
if (options !== undefined && options.toExternal) {
window.location.replace(options.url);
return RSVP.timeout(REDIRECT_TIMEOUT); // timeout if not redirected
}
else {
return this.getCommandUrlFor(options)
.push(function (hash) {
window.location.replace(hash);
// prevent returning unexpected response
// wait for the hash change to occur
// fail if nothing happens
return RSVP.timeout(REDIRECT_TIMEOUT);
});
}
})
.declareMethod('route', function (options) {
var gadget = this,
args = options.args;
gadget.options = options;
if (args.jio_key === undefined || args.jio_key === '') {
if (args.page === undefined || args.page === '' || args.page === "document_list") {
args.page = DEFAULT_PAGE;
}
return {
url: MAIN_PAGE_PREFIX + "page_" + args.page + ".html",
options: args
};
}
return gadget.jio_get(args.jio_key)
.push(function (doc) {
var sub_options = {},
base_portal_type = doc.portal_type.toLowerCase().replace(/\s/g, "_");
sub_options = {
doc: doc,
jio_key: args.jio_key,
search: args.search
};
if (base_portal_type.search(/_temp$/) >= 0) {
//Remove "_temp"
base_portal_type = base_portal_type.substr(
0,
base_portal_type.length - 5
);
}
return {
url: MAIN_PAGE_PREFIX + "jio_"
+ base_portal_type
+ "_" + args.page + ".html",
options: sub_options
};
});
})
.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 () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.start_deferred.promise;
})
.push(function () {
return listenHashChange(gadget);
});
});
}(window, rJS));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_text_router.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_text_router_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS Text Router Gadget JS</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>bk</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1450796064.81</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>953.24890.11410.5649</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1471769918.23</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1450795757.87</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
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