Commit 559c7477 authored by Boris Kocherov's avatar Boris Kocherov

erp5_officejs: onlyoffice: cleanup landing sites and scripts

remove devtool site and scripts
parent 22cb9663
<!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 Text Editor Panel Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquerymobile.js" type="text/javascript"></script>
<script id="panel-template-header" type="text/x-handlebars-template">
<div data-role="header" class="ui-bar-inherit">
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">
<div class="ui-controlgroup-controls">
<form action="#" method="post">
<input type="submit" data-i18n="[value]Close" data-icon="delete" data-iconpos="notext" value="Close" />
</form>
</div>
</div>
<img class="ui-title" alt="ERP5" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJcAAAA/CAMAAADaDqrIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowMEM5NUE4MzQ5NjQxMUUzOUZEQUU2NUY1RTI1RjdCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMEM5NUE4NDQ5NjQxMUUzOUZEQUU2NUY1RTI1RjdCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjAwQzk1QTgxNDk2NDExRTM5RkRBRTY1RjVFMjVGN0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAwQzk1QTgyNDk2NDExRTM5RkRBRTY1RjVFMjVGN0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+J9MJsAAAAwBQTFRF///////M//+Z//9m//8z//8A/8z//8zM/8yZ/8xm/8wz/8wA/5n//5nM/5mZ/5lm/5kz/5kA/2b//2bM/2aZ/2Zm/2Yz/2YA/zP//zPM/zOZ/zNm/zMz/zMA/wD//wDM/wCZ/wBm/wAz/wAAzP//zP/MzP+ZzP9mzP8zzP8AzMz/zMzMzMyZzMxmzMwzzMwAzJn/zJnMzJmZzJlmzJkzzJkAzGb/zGbMzGaZzGZmzGYzzGYAzDP/zDPMzDOZzDNmzDMzzDMAzAD/zADMzACZzABmzAAzzAAAmf//mf/Mmf+Zmf9mmf8zmf8Amcz/mczMmcyZmcxmmcwzmcwAmZn/mZnMmZmZmZlmmZkzmZkAmWb/mWbMmWaZmWZmmWYzmWYAmTP/mTPMmTOZmTNmmTMzmTMAmQD/mQDMmQCZmQBmmQAzmQAAZv//Zv/MZv+ZZv9mZv8zZv8AZsz/ZszMZsyZZsxmZswzZswAZpn/ZpnMZpmZZplmZpkzZpkAZmb/ZmbMZmaZZmZmZmYzZmYAZjP/ZjPMZjOZZjNmZjMzZjMAZgD/ZgDMZgCZZgBmZgAzZgAAM///M//MM/+ZM/9mM/8zM/8AM8z/M8zMM8yZM8xmM8wzM8wAM5n/M5nMM5mZM5lmM5kzM5kAM2b/M2bMM2aZM2ZmM2YzM2YAMzP/MzPMMzOZMzNmMzMzMzMAMwD/MwDMMwCZMwBmMwAzMwAAAP//AP/MAP+ZAP9mAP8zAP8AAMz/AMzMAMyZAMxmAMwzAMwAAJn/AJnMAJmZAJlmAJkzAJkAAGb/AGbMAGaZAGZmAGYzAGYAADP/ADPMADOZADNmADMzADMAAAD/AADMAACZAABmAAAzAAAAHHa7K3/AOojESZHJWZvNaKTSd63Whrbblb/fpMjks9Howtrt4e320uTx8Pb6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdfKHSQAAAOh0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ALItoLoAAAJkSURBVHja7NlZsqsgEABQ979C5kGGddxo4os0Q8BAynoFn0nUU23TNGRB9xzLdE3XdE3XdP2fLnIzF2VSrsYvC72HizAh9eZ5DVuOl15S4/jWwC+kDC8HPzCSJVHcRY8QXV2PwQuujUYTsYrvYlBv1yKLrsXHsPghnvR3Lazoip/JKuwpF8sm6/bY01Ow9CBlTXi53PNoRcUktEZT1NV1PIPnXAjtMJIMlzerFIzU1dVWF7aPj3Tetae4gjdxktG2et/qQjJ4kZFrv6ED4bK4eR1qduHzvEi4+PbGwD0EGu9CQQLFrv1F4jBc6BcuW3YhkPiPX1hOfxQvnHfh0HVMRqc4HuqiQf5k3mO6dq1s8Hx0H/Le5kq9YaNcxAcrZLpOvAv+ClcgNcZFtnrucd5Fwx4mXj0drnbBYXMuJmFDAV3Uhm4qlbHh3ddOrmholHNxFTVC+xTl2mf6pI4uVe4LwSp0DPGOmh/hAnM94bKZjkHlWuiLeV+cTab4luMKk82wy/Px2fLJskvKUk03hRf9RZ0wiYiZ4uVwVwTb9E71y0XboTYXGuTaa33Y47W5zBjXM3P11y7TfR2ycFdxyaW7uwSc5m0un9ix91m3TWJfW+1ijfW+wcVAfjS5dOP62LyvZZdcLHnA1MkFAtbgwq+Vm47po8OA1buwyy/a1ec5urzveAes2sV8kfW963mFaHNhlT0b6+Yi5+StchH1CtaK0ThXELDPLiyOPZHldzm/J1z9O/B14g7/K+DtkP7U8ivSeD4xaPCTSQvy+YIfubZWzRgtRe1iMP+3mq7pmq7p6jv+BBgAPrgi/TzwWzkAAAAASUVORK5CYII="/>
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">
<div class="ui-controlgroup-controls">
<a href="#" class="ui-btn ui-btn-icon-notext ui-icon-home" data-i18n="Home">Home</a>
</div>
</div>
</div>
</script>
<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=document_list" data-i18n="Web Elements">Web Elements</a></li>
<li><a href="#page=sync" data-i18n="Synchronization">Synchronization</a></li>
<li class="ui-last-child"><a href="#page=logout" data-i18n="Logout">Logout</a></li>
</ul>
</div>
</script>
<!-- custom script -->
<script src="gadget_officejs_application_panel.js" type="text/javascript"></script>
</head>
<body>
<div class="jqm-navmenu-panel"></div>
</body>
</html>
\ No newline at end of file
<!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>Jio Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_devtool_jio.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS, jIO, FormData, UriTemplate, URI, location */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, jIO) {
"use strict";
// jIO call wrapper for redirection to authentication page if needed
function wrapJioCall(gadget, method_name, argument_list) {
var storage = gadget.state_parameter_dict.jio_storage;
return storage[method_name].apply(storage, argument_list)
.push(undefined, function (error) {
if ((error.target !== undefined) && (error.target.status === 401)) {
if (gadget.state_parameter_dict.jio_storage_name === "ERP5") {
return gadget.redirect({ page: "login" });
}
if (gadget.state_parameter_dict.jio_storage_name === "DAV") {
var regexp = /^Nayookie login_url=(http[s]?:\/\/[\/\-\[\]{}()*+=:?&.,\\\^$|#\s\w%]+)$/,
auth_page = error.target.getResponseHeader('WWW-Authenticate'),
site;
if (regexp.test(auth_page)) {
site = UriTemplate.parse(
regexp.exec(auth_page)[1]
).expand({back_url: window.location.href,
origin: window.location.protocol + '//' +
window.location.host});
return gadget.redirect({ toExternal: true, url: site});
}
}
}
throw error;
});
}
rJS(window)
.ready(function (gadget) {
// Initialize the gadget local parameters
gadget.state_parameter_dict = {};
})
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareMethod('createJio', function (jio_options) {
var gadget = this;
if (jio_options === undefined) {
jio_options = {
type: "replicate",
// XXX This drop the signature lists...
query: {
query: 'portal_type: ("Web Style", "Web Page", "Web Script")',
// 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: "attachasproperty",
map: {
text_content: "text_content"
},
sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "webdevtool"
}
}
}
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoas"))
.absoluteTo(location.href)
.toString(),
default_view_reference: "jio_view"
}
};
}
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);
return this.getSetting("jio_devstorage_name")
.push(function (jio_storage_name) {
gadget.state_parameter_dict.jio_storage_name = jio_storage_name;
});
})
.declareMethod('allDocs', function () {
return wrapJioCall(this, 'allDocs', arguments);
})
.declareMethod('allAttachments', function () {
return wrapJioCall(this, 'allAttachments', arguments);
})
.declareMethod('get', function () {
return wrapJioCall(this, 'get', arguments);
})
.declareMethod('put', function () {
return wrapJioCall(this, 'put', arguments);
})
.declareMethod('post', function () {
return wrapJioCall(this, 'post', arguments);
})
.declareMethod('remove', function () {
return wrapJioCall(this, 'remove', arguments);
})
.declareMethod('getAttachment', function () {
return wrapJioCall(this, 'gettAttachment', arguments);
})
.declareMethod('putAttachment', function () {
return wrapJioCall(this, 'putAttachment', arguments);
})
.declareMethod('removeAttachment', function () {
return wrapJioCall(this, 'removeAttachment', arguments);
})
.declareMethod('repair', function () {
return wrapJioCall(this, 'repair', arguments);
});
}(window, rJS, jIO));
\ No newline at end of file
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Text Editor List</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_devtool_page_webs_list.js"></script>
</head>
<body>
<div data-gadget-url="gadget_officejs_widget_listbox.html" data-gadget-scope="listbox"></div>
</body>
</html>
/*globals window, RSVP, rJS*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, RSVP, rJS) {
"use strict";
rJS(window)
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
});
})
.ready(function (g) {
return new RSVP.Queue()
.push(function () {
return RSVP.all([
g.translate("validated"),
g.translate("invalidated"),
g.translate("Not synced!"),
g.translate("Waiting for approval")
]);
})
.push(function (result_list) {
g.props.translation_dict = {
"validated": result_list[0],
"invalidated": result_list[1],
"Not synced!": result_list[2],
"Waiting for approval": result_list[3]
};
});
})
.declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return this.jio_allDocs.apply(this, param_list)
.push(function (result) {
var i,
len;
for (i = 0, len = result.data.total_rows; i < len; i += 1) {
// XXX jIO does not create UUID with module inside
if (result.data.rows[i].id.indexOf("module") === -1) {
result.data.rows[i].value.state =
gadget.props.translation_dict["Not synced!"];
} else {
result.data.rows[i].value.state =
gadget.props.translation_dict[
result.data.rows[i].value.local_state ||
"Waiting for approval"
];
}
}
return result;
});
})
.declareMethod("render", function (options) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.getUrlFor({page: "add_spreadsheet"});
})
.push(function (url) {
return gadget.updateHeader({
title: "Web Elements",
add_url: url
});
})
.push(function () {
return gadget.getDeclaredGadget("listbox");
})
.push(function (listbox) {
return listbox.render({
search_page: 'webs_list',
search: options.search,
column_list: [{
select: 'title',
title: 'Title'
}, {
select: 'reference',
title: 'File Name'
}, {
select: 'url_string',
title: 'Full Path'
}, {
select: 'description',
title: 'Description'
}, {
select: 'version',
title: 'version'
}, {
select: 'modification_date',
title: 'Modification Date'
}],
query: {
query: 'portal_type:("Web Style", "Web Script", "Web Page")',
select_list: ['title', 'reference', 'url_string',
'language','description', 'version',
'modification_date'],
//limit: [0, 30],
sort_on: [["url_string", "ascending"]]
}
});
});
});
}(window, RSVP, rJS));
\ No newline at end of file
<!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>DevTool 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_devtool_router.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS, loopEventListener, document, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
/* if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('gadget_officejs_spreadsheet_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);
});
}
*/
var gadget_klass = rJS(window),
MAIN_PAGE_PREFIX = "gadget_devtool_",
DEFAULT_PAGE = "webs_list",
REDIRECT_TIMEOUT = 5000;
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()
};
})
.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) {
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,
url = MAIN_PAGE_PREFIX + 'page_';
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;
} else if (args.page === "sync") {
url = 'gadget_officejs_page_';
}
return {
url: url + 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 () {
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
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
</head> </head>
<body> <body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Text</script> <script data-renderjs-configuration="child-gadget" type="text/x-renderjs-configuration">ooffice/gadget_ooffice.html</script>
<script data-renderjs-configuration="child-gadget" type="text/x-renderjs-configuration">rjsunsafe/ooffice/gadget_ooffice.html</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_text_landing.html</string> </value> <value> <string>gadget_officejs_onlyoffice_landing.html</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>gadget_officejs_text_landing._html</string> </value> <value> <string>gadget_officejs_onlyoffice_landing_html</string> </value>
</item> </item>
<item> <item>
<key> <string>language</string> </key> <key> <string>language</string> </key>
...@@ -97,6 +97,10 @@ ...@@ -97,6 +97,10 @@
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value> <value> <string>Web Page</string> </value>
</item> </item>
<item>
<key> <string>revision</string> </key>
<value> <string>10</string> </value>
</item>
<item> <item>
<key> <string>short_title</string> </key> <key> <string>short_title</string> </key>
<value> <value>
...@@ -105,13 +109,15 @@ ...@@ -105,13 +109,15 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OnlyOffice Text gadget landing</string> </value> <value> <string>OnlyOffice gadget landing</string> </value>
</item>
<item>
<key> <string>url_string</string> </key>
<value> <string>/</string> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <value> <string>onlyoffice</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
...@@ -238,7 +244,7 @@ ...@@ -238,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.11235.11821.27221</string> </value> <value> <string>957.27792.36839.44390</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +262,7 @@ ...@@ -256,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1478728573.0</float> <float>1487499975.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -16,175 +16,6 @@ ...@@ -16,175 +16,6 @@
database: "setting" database: "setting"
}); });
function get_jio_cache_storage(name) {
return {
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_" + name + "_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_onlyoffice_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",
"zipfilestorage-with-jszip.js",
"jquery.js",
"jquerymobile.css",
"jquerymobile.js",
"renderjs.js",
"rsvp.js",
"gadget_officejs_header.html",
"gadget_officejs_jio.html",
"gadget_officejs_page_add_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_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: 'reference: "%" AND (portal_type: ("Web Style", "Web Page", "Web Script")) AND ' +
erp5_query + modification_date,
select_list: ["url_string"],
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,
use_bulk_get: true,
use_bulk: true,
attachment_list: [],
signature_storage: get_jio_cache_storage(name + "_hash"),
local_sub_storage: {
type: "mapping",
map_all_property: true,
map_id: ["equalSubProperty", "relative_url"],
mapping_dict: {
"url_string": ["equalSubId"]
},
sub_storage: {
type: "query",
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"
}
});
}
gadget_klass gadget_klass
...@@ -206,70 +37,6 @@ ...@@ -206,70 +37,6 @@
gadget.props.configuration[key] = value; gadget.props.configuration[key] = value;
} }
}) })
.push(function () {
var NAME = gadget.props.configuration.portal_type.toLowerCase(),
jio_store;
if (navigator.serviceWorker !== undefined) {
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getSetting('jio_' + NAME + '_modification_date'),
gadget.getSetting('jio_' + NAME + '_cache_description')
]);
})
.push(function (result) {
var modification_date = result[0],
query = result[1],
queue;
jio_store = get_jio_replicate_storage(NAME);
if (jio_store.__storage._query_options.query === query && modification_date) {
queue = get_jio_replicate_storage(NAME, modification_date).repair();
} else {
queue = jio_store.repair();
}
return queue;
})
.push(undefined, function (error) {
// fix offline mode bypass network errors
if (!(error instanceof ProgressEvent &&
error.srcElement instanceof XMLHttpRequest &&
error.type === "error")) {
throw error;
}
})
.push(function () {
gadget.setSetting(
'jio_' + NAME + '_cache_description',
jio_store.__storage._query_options.query
);
jIO.createJIO(get_jio_cache_storage(NAME)).allDocs({
query: '',
sort_on: [
['modification_date', 'descending']
],
limit: [0, 1],
select_list: ['modification_date']
})
.push(function (data) {
if (data.data.total_rows === 1) {
return gadget.setSetting('jio_' + NAME + '_modification_date',
data.data.rows[0].value.modification_date);
}
});
return new RSVP.Promise(function (resolve, reject) {
console.log("Will register SW");
navigator.serviceWorker.register('gadget_officejs_' + NAME + '_serviceworker.js')
.then(function (reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
resolve();
})
.then(undefined, reject);
});
});
}
throw "Your browser do not support service workers";
})
.push(function () { .push(function () {
// Resources are now ready // Resources are now ready
// Modify base to provides same base as gadget // Modify base to provides same base as gadget
......
...@@ -107,11 +107,13 @@ ...@@ -107,11 +107,13 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>OnlyOffice gadget landing</string> </value> <value> <string>OnlyOffice gadget landing</string> </value>
</item> </item>
<item>
<key> <string>url_string</string> </key>
<value> <string>gadget_officejs_onlyoffice_landing.js</string> </value>
</item>
<item> <item>
<key> <string>version</string> </key> <key> <string>version</string> </key>
<value> <value> <string>onlyoffice</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
...@@ -238,7 +240,7 @@ ...@@ -238,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.8440.53688.40516</string> </value> <value> <string>957.26090.131.631</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +258,7 @@ ...@@ -256,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1482407020.46</float> <float>1487399207.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!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 Spreadsheet Loader Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_onlyoffice_landing.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Presentation</script>
<script data-renderjs-configuration="child-gadget" type="text/x-renderjs-configuration">rjsunsafe/ooffice/gadget_ooffice.html</script>
</body>
</html>
\ No newline at end of file
<!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 Spreadsheet Loader Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_onlyoffice_landing.js" type="text/javascript"></script>
</head>
<body>
<script data-renderjs-configuration="portal_type" type="text/x-renderjs-configuration">Spreadsheet</script>
<script data-renderjs-configuration="child-gadget" type="text/x-renderjs-configuration">rjsunsafe/ooffice/gadget_ooffice.html</script>
</body>
</html>
\ No newline at end of file
...@@ -8,29 +8,21 @@ web_page_module/gadget_officejs_* ...@@ -8,29 +8,21 @@ web_page_module/gadget_officejs_*
web_page_module/gadget_ooffice_* web_page_module/gadget_ooffice_*
web_page_module/codemirror_* web_page_module/codemirror_*
web_page_module/codeeditor_* web_page_module/codeeditor_*
web_site_module/devtool
web_site_module/devtool/**
web_site_module/officejs_bookmark_manager web_site_module/officejs_bookmark_manager
web_site_module/officejs_bookmark_manager/** web_site_module/officejs_bookmark_manager/**
web_site_module/officejs_text_editor web_site_module/officejs_text_editor
web_site_module/officejs_text_editor/** web_site_module/officejs_text_editor/**
web_site_module/officejs_spreadsheet web_site_module/officejs_spreadsheet
web_site_module/officejs_spreadsheet/** web_site_module/officejs_spreadsheet/**
web_site_module/officejs_spreadsheet_landing
web_site_module/officejs_spreadsheet_landing/**
web_site_module/officejs_gadget_onlyoffice web_site_module/officejs_gadget_onlyoffice
web_site_module/officejs_gadget_onlyoffice/** web_site_module/officejs_gadget_onlyoffice/**
web_site_module/officejs_presentation web_site_module/officejs_presentation
web_site_module/officejs_presentation/** web_site_module/officejs_presentation/**
web_site_module/officejs_presentation_landing
web_site_module/officejs_presentation_landing/**
web_site_module/officejs_text web_site_module/officejs_text
web_site_module/officejs_text/** web_site_module/officejs_text/**
web_site_module/officejs_text_landing
web_site_module/officejs_text_landing/**
web_site_module/officejs_gadget_codemirror web_site_module/officejs_gadget_codemirror
web_site_module/officejs_gadget_codemirror/** web_site_module/officejs_gadget_codemirror/**
web_site_module/officejs_code_editor web_site_module/officejs_code_editor
web_site_module/officejs_code_editor/** web_site_module/officejs_code_editor/**
web_site_module/officejs_setting_gadget web_site_module/officejs_setting_gadget
web_site_module/officejs_setting_gadget/** web_site_module/officejs_setting_gadget/**
\ No newline at end of file
...@@ -8,8 +8,6 @@ web_page_module/gadget_officejs_* ...@@ -8,8 +8,6 @@ web_page_module/gadget_officejs_*
web_page_module/gadget_ooffice_* web_page_module/gadget_ooffice_*
web_page_module/codemirror_* web_page_module/codemirror_*
web_page_module/codeeditor_* web_page_module/codeeditor_*
web_site_module/devtool
web_site_module/devtool/**
web_site_module/officejs_bookmark_manager web_site_module/officejs_bookmark_manager
web_site_module/officejs_bookmark_manager/** web_site_module/officejs_bookmark_manager/**
web_site_module/officejs_text_editor web_site_module/officejs_text_editor
...@@ -18,21 +16,15 @@ web_site_module/officejs_setting_gadget ...@@ -18,21 +16,15 @@ web_site_module/officejs_setting_gadget
web_site_module/officejs_setting_gadget/** web_site_module/officejs_setting_gadget/**
web_site_module/officejs_spreadsheet web_site_module/officejs_spreadsheet
web_site_module/officejs_spreadsheet/** web_site_module/officejs_spreadsheet/**
web_site_module/officejs_spreadsheet_landing
web_site_module/officejs_spreadsheet_landing/**
web_site_module/officejs_gadget_onlyoffice web_site_module/officejs_gadget_onlyoffice
web_site_module/officejs_gadget_onlyoffice/** web_site_module/officejs_gadget_onlyoffice/**
web_site_module/officejs_presentation web_site_module/officejs_presentation
web_site_module/officejs_presentation/** web_site_module/officejs_presentation/**
web_site_module/officejs_presentation_landing
web_site_module/officejs_presentation_landing/**
web_site_module/officejs_text web_site_module/officejs_text
web_site_module/officejs_text/** web_site_module/officejs_text/**
web_site_module/officejs_text_landing
web_site_module/officejs_text_landing/**
web_site_module/officejs_gadget_codemirror web_site_module/officejs_gadget_codemirror
web_site_module/officejs_gadget_codemirror/** web_site_module/officejs_gadget_codemirror/**
web_site_module/officejs_code_editor web_site_module/officejs_code_editor
web_site_module/officejs_code_editor/* web_site_module/officejs_code_editor/*
web_site_module/officejs_setting_gadget web_site_module/officejs_setting_gadget
web_site_module/officejs_setting_gadget/** web_site_module/officejs_setting_gadget/**
\ No newline at end of file
...@@ -8,8 +8,6 @@ web_page_module/gadget_ooffice_* ...@@ -8,8 +8,6 @@ web_page_module/gadget_ooffice_*
web_page_module/officejs_* web_page_module/officejs_*
web_page_module/slideditor_* web_page_module/slideditor_*
web_page_module/wordeditor_* web_page_module/wordeditor_*
web_site_module/devtool
web_site_module/devtool/**
web_site_module/officejs_bookmark_manager web_site_module/officejs_bookmark_manager
web_site_module/officejs_bookmark_manager/** web_site_module/officejs_bookmark_manager/**
web_site_module/officejs_code_editor web_site_module/officejs_code_editor
...@@ -20,19 +18,13 @@ web_site_module/officejs_gadget_onlyoffice ...@@ -20,19 +18,13 @@ web_site_module/officejs_gadget_onlyoffice
web_site_module/officejs_gadget_onlyoffice/** web_site_module/officejs_gadget_onlyoffice/**
web_site_module/officejs_presentation web_site_module/officejs_presentation
web_site_module/officejs_presentation/** web_site_module/officejs_presentation/**
web_site_module/officejs_presentation_landing
web_site_module/officejs_presentation_landing/**
web_site_module/officejs_setting_gadget web_site_module/officejs_setting_gadget
web_site_module/officejs_setting_gadget/** web_site_module/officejs_setting_gadget/**
web_site_module/officejs_spreadsheet web_site_module/officejs_spreadsheet
web_site_module/officejs_spreadsheet/** web_site_module/officejs_spreadsheet/**
web_site_module/officejs_spreadsheet_landing
web_site_module/officejs_spreadsheet_landing/**
web_site_module/officejs_svg_editor web_site_module/officejs_svg_editor
web_site_module/officejs_svg_editor/** web_site_module/officejs_svg_editor/**
web_site_module/officejs_text web_site_module/officejs_text
web_site_module/officejs_text/** web_site_module/officejs_text/**
web_site_module/officejs_text_editor web_site_module/officejs_text_editor
web_site_module/officejs_text_editor/** web_site_module/officejs_text_editor/**
web_site_module/officejs_text_landing \ No newline at end of file
web_site_module/officejs_text_landing/**
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