Commit 71e8f118 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs] Simplify bootloader: no more separate app and editor gadget

parent 69511d90
...@@ -200,6 +200,7 @@ gadget_html5_textarea.js\n ...@@ -200,6 +200,7 @@ gadget_html5_textarea.js\n
gadget_erp5_configure_editor.html\n gadget_erp5_configure_editor.html\n
gadget_erp5_configure_editor.js\n gadget_erp5_configure_editor.js\n
\n \n
#bookmark\n
gadget_erp5_field_checkbox.html\n gadget_erp5_field_checkbox.html\n
gadget_erp5_field_checkbox.js\n gadget_erp5_field_checkbox.js\n
gadget_officejs_bookmark_manager_router.html\n gadget_officejs_bookmark_manager_router.html\n
...@@ -215,8 +216,10 @@ gadget_erp5_page_ojs_bookmark_dispatcher.html\n ...@@ -215,8 +216,10 @@ gadget_erp5_page_ojs_bookmark_dispatcher.html\n
gadget_erp5_page_ojs_bookmark_dispatcher.js\n gadget_erp5_page_ojs_bookmark_dispatcher.js\n
gadget_erp5_page_ojs_bookmark_preference.html\n gadget_erp5_page_ojs_bookmark_preference.html\n
gadget_erp5_page_ojs_bookmark_preference.js\n gadget_erp5_page_ojs_bookmark_preference.js\n
GADGET:\n \n
officejs_setting_gadget/\n #setting\n
gadget_officejs_setting.html\n
gadget_officejs_setting.js\n
NETWORK:\n NETWORK:\n
*</string> </value> *</string> </value>
</item> </item>
...@@ -359,7 +362,7 @@ NETWORK:\n ...@@ -359,7 +362,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.45561.47559.9591</string> </value> <value> <string>964.48513.5538.10342</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -377,7 +380,7 @@ NETWORK:\n ...@@ -377,7 +380,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515590093.02</float> <float>1516115771.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<script src="${latest_version}/rsvp.js"></script> <script src="${latest_version}/rsvp.js"></script>
<script src="${latest_version}/renderjs.js"></script> <script src="${latest_version}/renderjs.js"></script>
<script src="${latest_version}/jiodev.js"></script> <script src="${latest_version}/jiodev.js"></script>
<script src="jio_limitalldocsstorage.js"></script>
<script src="jio_appcachestorage.js"></script> <script src="jio_appcachestorage.js"></script>
<script src="gadget_officejs_bootloader.js"></script> <script src="gadget_officejs_bootloader.js"></script>
......
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.23296.14479.51302</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1510305002.75</float> <float>1515750984.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -19,15 +19,11 @@ var repair = false; ...@@ -19,15 +19,11 @@ var repair = false;
check_local_deletion: false, check_local_deletion: false,
check_local_modification: false, check_local_modification: false,
signature_sub_storage: { signature_sub_storage: {
type: "limitalldocs",
document: window.location.href,
sub_storage: {
type: "query", type: "query",
sub_storage: { sub_storage: {
type: "indexeddb", type: "indexeddb",
database: "officejs-hash" database: "officejs-hash"
} }
}
}, },
local_sub_storage: { local_sub_storage: {
type: "query", type: "query",
...@@ -41,8 +37,8 @@ var repair = false; ...@@ -41,8 +37,8 @@ var repair = false;
}, },
remote_sub_storage: { remote_sub_storage: {
type: "appcache", type: "appcache",
manifest: gadget.state.cache_file, manifest: gadget.props.cache_file,
version: gadget.state.version_url, version: gadget.props.version_url,
take_installer: true take_installer: true
} }
}); });
...@@ -58,7 +54,7 @@ var repair = false; ...@@ -58,7 +54,7 @@ var repair = false;
serviceWorker = registration.active; serviceWorker = registration.active;
} }
if (serviceWorker.state !== "activated") { if (serviceWorker.state !== "activated") {
RSVP.Promise(function (resolve, reject) { return RSVP.Promise(function (resolve, reject) {
serviceWorker.addEventListener('statechange', function (e) { serviceWorker.addEventListener('statechange', function (e) {
if (e.target.state === "activated") { if (e.target.state === "activated") {
resolve(); resolve();
...@@ -75,125 +71,80 @@ var repair = false; ...@@ -75,125 +71,80 @@ var repair = false;
.setState({error_amount: 0}) .setState({error_amount: 0})
.ready(function (gadget) { .ready(function (gadget) {
var i, var i,
state = {},
element_list = element_list =
gadget.element.querySelectorAll('[data-install-configuration]'); gadget.element.querySelectorAll('[data-install-configuration]');
if (window.Bootloader === undefined) {
window.Bootloader = gadget;
}
gadget.props = {};
for (i = 0; i < element_list.length; i += 1) { for (i = 0; i < element_list.length; i += 1) {
state[element_list[i].getAttribute('data-install-configuration')] = gadget.props[element_list[i].getAttribute(
element_list[i].textContent; 'data-install-configuration'
} )] = element_list[i].textContent;
state.redirect_url = new URL(window.location); }
state.redirect_url.pathname += state.version_url; gadget.props.redirect_url = new URL(window.location);
if (state.redirect_url.hash) { gadget.props.redirect_url.pathname += gadget.props.version_url;
if (state.redirect_url.hash.startsWith('#access_token')) { if (gadget.props.redirect_url.hash) {
if (gadget.props.redirect_url.hash.startsWith('#access_token')) {
// This is a bad hack to support dropbox. // This is a bad hack to support dropbox.
state.redirect_url.hash = state.redirect_url.hash.replace( gadget.props.redirect_url.hash =
gadget.props.redirect_url.hash.replace(
'#access_token', '#access_token',
'#/?page=ojs_dropbox_configurator&access_token' '#/?page=ojs_dropbox_configurator&access_token'
); );
} else if (state.redirect_url.hash } else if (gadget.props.redirect_url.hash
.startsWith('#page=settings_configurator')) { .startsWith('#page=settings_configurator')) {
// Make monitoring app still compatible with old instances setup URLs // Make monitoring app still compatible with old instances setup URLs
state.redirect_url.hash = state.redirect_url.hash.replace( gadget.props.redirect_url.hash =
gadget.props.redirect_url.hash.replace(
'#page=settings_configurator', '#page=settings_configurator',
'#/?page=settings_configurator' '#/?page=settings_configurator'
); );
} }
} }
return gadget.changeState(state);
}) })
.allowPublicAcquisition('isChildren', function () {
return true;
})
.declareAcquiredMethod('isChildren', 'isChildren')
.declareAcquiredMethod('renderError', 'renderError')
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this;
return gadget.isChildren()
.push(undefined, function (error) {
if (error instanceof rJS.AcquisitionError) {
return RSVP.all([ return RSVP.all([
new RSVP.Queue() new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.delay(600); return RSVP.delay(600);
}) })
.push(function () { .push(function () {
return gadget.changeState({main: true}); return gadget.changeState({
app_name: gadget.props.app_name,
redirect_url: gadget.props.redirect_url
});
}), }),
gadget.install() gadget.install()
.push(function () { .push(function () {
window.location = gadget.state.redirect_url; window.location = gadget.props.redirect_url;
}) })
]); ]);
}
throw error;
});
})
.allowPublicAcquisition('renderError', function (param_list) {
param_list[0].error_amount = this.state.error_amount + 1;
return this.changeState(param_list[0]);
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
return this.getDeclaredGadget('view_gadget') var gadget = this;
.push(function (view_gadget) { return new RSVP.Queue()
return view_gadget.render(options); .push(function () {
}); var element = gadget.element.querySelector('.presentation');
}) if (element) {
return gadget.getDeclaredGadget('view');
.onStateChange(function (modification_dict) { }
var gadget = this, element, options;
if (modification_dict.main) {
element = document.createElement("div"); element = document.createElement("div");
element.className = "presentation"; element.className = "presentation";
gadget.element.insertBefore(element, gadget.element.firstChild); gadget.element.appendChild(element);
return gadget.declareGadget( return gadget.declareGadget(
"gadget_officejs_bootloader_presentation.html", "gadget_officejs_bootloader_presentation.html",
{"scope": "view_gadget", "element": element} {"scope": "view", "element": element}
) );
})
.push(function (view_gadget) { .push(function (view_gadget) {
return view_gadget.render({ return view_gadget.render(options);
app_name: gadget.state.app_name,
redirect_url: gadget.state.redirect_url
});
}); });
}
if (modification_dict.error) {
options = {
error: gadget.state.error,
error_amount: gadget.state.error_amount
};
if (modification_dict.error_source) {
options.error_source = gadget.state.error_source;
}
if (gadget.state.main) {
return gadget.render(options);
}
options.error_source = gadget.state.app_name;
return gadget.renderError(options);
}
}) })
.declareMethod('declareAndInstall', function (url) { .onStateChange(function (modification_dict) {
var element = document.createElement("div"); return this.render(modification_dict);
element.setAttribute("style", "display: none");
this.element.appendChild(element);
return this.declareGadget(url,
{
"element": element,
"scope": url,
"sandbox": "iframe"
})
.push(function (sub_gadget) {
return sub_gadget.install();
});
}) })
.declareMethod("install", function () { .declareMethod("install", function () {
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.29130.48991.23978</string> </value> <value> <string>964.54546.48173.5239</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1510654966.6</float> <float>1516029576.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
<div class="loader"></div> <div class="loader"></div>
<a class="skip-link" href="#">Skip</a> <a class="skip-link" href="#">Skip</a>
<div class="error-message"></div> <div class="error-message"></div>
<div class="error-source"></div>
<div class="error-amount"></div> <div class="error-amount"></div>
</div> </div>
</center> </center>
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.59243.21205.33843</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504683723.57</float> <float>1515751622.79</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
app_name_div.textContent = gadget.state.app_name + app_name_div.textContent = gadget.state.app_name +
" is being prepared for 100 % offline mode"; " is being prepared for 100 % offline mode";
} }
if (modification_dict.error_source) {
app_name_div = gadget.element.querySelector(".error-source");
app_name_div.textContent = "Source: " + gadget.state.error_source;
}
if (modification_dict.error_amount) { if (modification_dict.error_amount) {
app_name_div = gadget.element.querySelector(".error-amount"); app_name_div = gadget.element.querySelector(".error-amount");
app_name_div.textContent = "Retry: " + gadget.state.error_amount; app_name_div.textContent = "Retry: " + gadget.state.error_amount;
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.59243.59705.49169</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1504683865.92</float> <float>1515751635.24</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -179,9 +179,47 @@ gadget_officejs_jio_crib_from.html\n ...@@ -179,9 +179,47 @@ gadget_officejs_jio_crib_from.html\n
gadget_officejs_page_jio_crib_configurator.html\n gadget_officejs_page_jio_crib_configurator.html\n
gadget_officejs_page_jio_crib_configurator.js\n gadget_officejs_page_jio_crib_configurator.js\n
gadget_officejs_crib_panel.html\n gadget_officejs_crib_panel.html\n
GADGET:\n \n
officejs_codemirror/\n #setting\n
officejs_setting_gadget/\n gadget_officejs_setting.js\n
gadget_officejs_setting.html\n
\n
#codemirror\n
codemirror/lib/codemirror.js\n
codemirror/lib/codemirror.css\n
codemirror/addon/cm_edit/matchbrackets.js\n
codemirror/addon/cm_edit/trailingspace.js\n
codemirror/addon/dialog/dialog.css\n
codemirror/addon/dialog/dialog.js\n
codemirror/addon/display/fullscreen.css\n
codemirror/addon/display/fullscreen.js\n
codemirror/addon/display/rulers.js\n
codemirror/addon/search/searchcursor.js\n
codemirror/addon/search/search.js\n
codemirror/addon/search/jump-to-line.js\n
codemirror/addon/selection/active-line.js\n
codemirror/addon/hint/show-hint.css\n
codemirror/addon/hint/show-hint.js\n
codemirror/addon/hint/anyword-hint.js\n
codemirror/addon/fold/foldgutter.css\n
codemirror/addon/fold/foldcode.js\n
codemirror/addon/fold/foldgutter.js\n
codemirror/addon/fold/indent-fold.js\n
codemirror/addon/fold/comment-fold.js\n
codemirror/addon/merge/merge.css\n
diff_match_patch/javascript/diff_match_patch_uncompressed.js\n
codemirror/addon/merge/merge.js\n
codemirror/addon/lint/lint.css\n
codemirror/addon/lint/lint.js\n
jshint.js\n
codemirror/addon/lint/javascript-lint.js\n
csslint.js\n
codemirror/addon/lint/css-lint.js\n
codemirror/mode/xml/xml.js\n
codemirror/mode/javascript/javascript.js\n
codemirror/mode/css/css.js\n
codemirror/mode/htmlmixed/htmlmixed.js\n
codemirror.gadget.js\n
NETWORK:\n NETWORK:\n
*</string> </value> *</string> </value>
</item> </item>
...@@ -310,7 +348,7 @@ NETWORK:\n ...@@ -310,7 +348,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -324,7 +362,7 @@ NETWORK:\n ...@@ -324,7 +362,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.11887.7068.10717</string> </value> <value> <string>964.56117.35717.62617</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -342,7 +380,7 @@ NETWORK:\n ...@@ -342,7 +380,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515517761.42</float> <float>1516267653.77</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -220,8 +220,10 @@ drive_app_landing_page.html\n ...@@ -220,8 +220,10 @@ drive_app_landing_page.html\n
gadget_officejs_drive_app_router.html\n gadget_officejs_drive_app_router.html\n
gadget_officejs_jio_drive_record_view.html\n gadget_officejs_jio_drive_record_view.html\n
gadget_officejs_jio_drive_record_view.js\n gadget_officejs_jio_drive_record_view.js\n
GADGET:\n \n
officejs_setting_gadget/\n #setting\n
gadget_officejs_setting.js\n
gadget_officejs_setting.html\n
NETWORK:\n NETWORK:\n
*</string> </value> *</string> </value>
</item> </item>
...@@ -350,7 +352,7 @@ NETWORK:\n ...@@ -350,7 +352,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -364,7 +366,7 @@ NETWORK:\n ...@@ -364,7 +366,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.52711.11260.52684</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -382,8 +384,8 @@ NETWORK:\n ...@@ -382,8 +384,8 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1508137848.27</float> <float>1515771172.06</float>
<string>GMT+9</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -7,12 +7,10 @@ ...@@ -7,12 +7,10 @@
function AppCacheStorage(spec) { function AppCacheStorage(spec) {
this._manifest = spec.manifest; this._manifest = spec.manifest;
this._gadget = spec.gadget;
this._take_installer = spec.take_installer || false; this._take_installer = spec.take_installer || false;
this._origin_url = spec.origin_url !== undefined ? this._origin_url = spec.origin_url !== undefined ?
spec.origin_url : window.location.href; spec.origin_url : window.location.href;
this._version = spec.version || ""; this._version = spec.version || "";
this._gadget_list = [];
this._prefix = spec.prefix || "./"; this._prefix = spec.prefix || "./";
this._documents = {}; this._documents = {};
// Harcoded here, find a better way. // Harcoded here, find a better way.
...@@ -26,8 +24,7 @@ ...@@ -26,8 +24,7 @@
this._prefix + "gadget_officejs_bootloader_serviceworker.js", this._prefix + "gadget_officejs_bootloader_serviceworker.js",
this._prefix + "gadget_erp5_nojqm.css", this._prefix + "gadget_erp5_nojqm.css",
this._prefix + "officejs_logo.png", this._prefix + "officejs_logo.png",
this._prefix + "jio_appcachestorage.js", this._prefix + "jio_appcachestorage.js"
this._prefix + "jio_limitalldocsstorage.js"
]; ];
} else { } else {
this._relative_url_list = [this._prefix + "/"]; this._relative_url_list = [this._prefix + "/"];
...@@ -51,13 +48,6 @@ ...@@ -51,13 +48,6 @@
AppCacheStorage.prototype.getAttachment = function (origin_url, AppCacheStorage.prototype.getAttachment = function (origin_url,
relative_url) { relative_url) {
var storage = this;
if (storage._gadget_list.indexOf(relative_url) >= 0) {
return window.Bootloader.declareAndInstall(relative_url)
.push(function () {
return new Blob([]);
});
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return jIO.util.ajax({ return jIO.util.ajax({
...@@ -77,9 +67,6 @@ ...@@ -77,9 +67,6 @@
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
result[this._relative_url_list[i]] = {}; result[this._relative_url_list[i]] = {};
} }
for (i = 0; i < this._gadget_list.length; i += 1) {
result[this._gadget_list[i]] = {};
}
return result; return result;
} }
return []; return [];
...@@ -120,22 +107,17 @@ ...@@ -120,22 +107,17 @@
storage._relative_url_list.push(storage._version + storage._manifest); storage._relative_url_list.push(storage._version + storage._manifest);
for (i = 0; i < relative_url_list.length; i += 1) { for (i = 0; i < relative_url_list.length; i += 1) {
if (relative_url_list[i].indexOf("NETWORK:") >= 0) { if (relative_url_list[i].indexOf("NETWORK:") >= 0) {
take = 3; take = false;
} else if (relative_url_list[i].indexOf('GADGET:') >= 0) {
take = 2;
} else if (relative_url_list[i] !== "" && } else if (relative_url_list[i] !== "" &&
relative_url_list[i].charAt(0) !== '#' && relative_url_list[i].charAt(0) !== '#' &&
relative_url_list[i].charAt(0) !== ' ') { relative_url_list[i].charAt(0) !== ' ' &&
if (take === 1) { take) {
storage._relative_url_list.push( storage._relative_url_list.push(
storage._version + relative_url_list[i] storage._version + relative_url_list[i]
); );
} else if (take === 2) {
storage._gadget_list.push(relative_url_list[i]);
}
} }
if (relative_url_list[i].indexOf("CACHE:") >= 0) { if (relative_url_list[i].indexOf("CACHE:") >= 0) {
take = 1; take = true;
} }
} }
}) })
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.23286.30579.38041</string> </value> <value> <string>964.50005.13436.62685</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1510304670.05</float> <float>1515753347.5</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -9,138 +9,85 @@ ...@@ -9,138 +9,85 @@
application_dict = { application_dict = {
"Text Editor": { "Text Editor": {
"url": "officejs_text_editor/", "url": "officejs_text_editor/",
"cache": "gadget_officejs_text_editor.appcache", "cache": "gadget_officejs_text_editor.appcache"
"sub_gadget": ["officejs_setting_gadget"]
}, },
"Illustration Editor": { "Illustration Editor": {
"url": "officejs_svg_editor/", "url": "officejs_svg_editor/",
"cache": "gadget_officejs_illustration.appcache", "cache": "gadget_officejs_illustration.appcache"
"sub_gadget": ["officejs_svg_editor_gadget", "officejs_setting_gadget"]
}, },
"PDF Viewer": { "PDF Viewer": {
"url": "officejs_pdf_viewer/", "url": "officejs_pdf_viewer/",
"cache": "gadget_officejs_pdf_viewer.appcache", "cache": "gadget_officejs_pdf_viewer.appcache"
"sub_gadget": ["officejs_pdf_viewer_gadget", "officejs_setting_gadget"]
}, },
"Cribjs": { "Cribjs": {
"url": "officejs_cribjs/", "url": "officejs_cribjs/",
"cache": "gadget_officejs_crib.appcache", "cache": "gadget_officejs_crib.appcache"
"sub_gadget": ["officejs_codemirror", "officejs_setting_gadget"]
}, },
"Bookmark Manager": { "Bookmark Manager": {
"url": "officejs_bookmark_manager/", "url": "officejs_bookmark_manager/",
"cache" : "gadget_officejs_bookmark_manager.appcache", "cache" : "gadget_officejs_bookmark_manager.appcache"
"sub_gadget": ["officejs_setting_gadget"]
}, },
"Onlyoffice Text": { "Onlyoffice Text": {
"url": "ooffice_text/", "url": "ooffice_text/",
"cache": "gadget_ooffice_text.appcache", "cache": "gadget_ooffice_text.appcache"
"sub_gadget": ["ooffice_onlyoffice_gadget", "officejs_setting_gadget"]
}, },
"Onlyoffice Spreadsheet": { "Onlyoffice Spreadsheet": {
"url": "ooffice_spreadsheet/", "url": "ooffice_spreadsheet/",
"cache": "gadget_ooffice_spreadsheet.appcache", "cache": "gadget_ooffice_spreadsheet.appcache"
"sub_gadget": ["ooffice_onlyoffice_gadget", "officejs_setting_gadget"]
}, },
"Onlyoffice Presentation": { "Onlyoffice Presentation": {
"url": "ooffice_presentation/", "url": "ooffice_presentation/",
"cache": "gadget_ooffice_presentation.appcache", "cache": "gadget_ooffice_presentation.appcache"
"sub_gadget": ["ooffice_onlyoffice_gadget", "officejs_setting_gadget"]
}, },
"Web Table Editor": { "Web Table Editor": {
"url": "officejs_web_table_editor/", "url": "officejs_web_table_editor/",
"cache": "gadget_officejs_web_table.appcache", "cache": "gadget_officejs_web_table.appcache"
"sub_gadget": [
"officejs_web_table_editor_gadget",
"officejs_setting_gadget"
]
}, },
"Image Editor": { "Image Editor": {
"url": "officejs_image_editor/", "url": "officejs_image_editor/",
"cache": "gadget_officejs_image_editor.appcache", "cache": "gadget_officejs_image_editor.appcache"
"sub_gadget": [
"officejs_image_editor_gadget",
"officejs_setting_gadget"
]
}, },
"Awesome Free Software Publisher List": { "Awesome Free Software Publisher List": {
"url": "afs/", "url": "afs/",
"cache": "gadget_erp5_afs.appcache", "cache": "gadget_erp5_afs.appcache",
"no_installer": true, "no_installer": true
"sub_gadget": []
}, },
"Jabber Client": { "Jabber Client": {
"url": "jabber_client/", "url": "jabber_client/",
"cache": "gadget_jabberclient.appcache", "cache": "gadget_jabberclient.appcache",
"no_installer": true, "no_installer": true
"sub_gadget": ["connection"]
}, },
"Monitoring App": { "Monitoring App": {
"url": "officejs_monitoring/", "url": "officejs_monitoring/",
"cache" : "gadget_officejs_monitoring.appcache", "cache" : "gadget_officejs_monitoring.appcache"
"sub_gadget": []
}, },
"App Store": { "App Store": {
"url": "officejsoldv1/", "url": "officejsoldv1/",
"cache": "officejs_store.appcache", "cache": "officejs_store.appcache",
"no_installer": true, "no_installer": true
"sub_gadget": []
}, },
"MediaPlayer": { "MediaPlayer": {
"url": "officejs_audioplayer/", "url": "officejs_audioplayer/",
"cache": "gadget_officejs_audioplayer.appcache", "cache": "gadget_officejs_audioplayer.appcache",
"no_installer": true, "no_installer": true
"sub_gadget": []
}, },
"Trade Application": { "Trade Application": {
"url": "osp-9/", "url": "osp-9/",
"cache": "gadget_trade_application.appcache", "cache": "gadget_trade_application.appcache",
"no_installer": true, "no_installer": true
"sub_gadget": []
}, },
"Todomvc": { "Todomvc": {
"url": "officejs_todomvc/", "url": "officejs_todomvc/",
"cache": "officejs_todomvc.appcache", "cache": "officejs_todomvc.appcache",
"no_installer": true, "no_installer": true
"sub_gadget": []
}, },
"Wall Search": { "Wall Search": {
"url": "officejs_wallsearch/", "url": "officejs_wallsearch/",
"cache": "gadget_erp5_page_ojs_wallsearch.appcache", "cache": "gadget_erp5_page_ojs_wallsearch.appcache"
"sub_gadget": []
}, },
"Drive App": { "Drive App": {
"url": "officejs_drive_app/", "url": "officejs_drive_app/",
"cache": "gadget_officejs_drive_app.appcache", "cache": "gadget_officejs_drive_app.appcache"
"sub_gadget": ["officejs_setting_gadget"]
},
"connection": {
"cache": "gadget_jabberconnection.appcache",
"no_installer": true
},
"officejs_ckeditor_gadget": {
"cache": "gadget_ckeditor.appcache"
},
"officejs_setting_gadget": {
"cache": "gadget_officejs_setting.appcache"
},
"officejs_svg_editor_gadget": {
"cache": "gadget_officejs_svg_editor.appcache"
},
"officejs_pdf_viewer_gadget": {
"cache": "gadget_officejs_pdf_viewer_gadget.appcache"
},
"officejs_codemirror": {
"cache": "gadget_officejs_codemirror.appcache"
},
"ooffice_onlyoffice_gadget": {
"cache": "onlyoffice.gadget.appcache"
},
"officejs_web_table_editor_gadget": {
"cache": "gadget_officejs_web_table_editor.appcache"
},
"officejs_image_editor_gadget": {
"cache": "gadget_officejs_image_editor_gadget.appcache"
} }
}; };
...@@ -157,32 +104,10 @@ ...@@ -157,32 +104,10 @@
} }
app = application_dict[form_result.web_site]; app = application_dict[form_result.web_site];
zip_name = form_result.filename; zip_name = form_result.filename;
len = app.sub_gadget.length;
function fill(zip_file) {
if (i < len) {
var sub_app = app.sub_gadget[i];
return gadget.fillZip(
application_dict[sub_app].cache,
origin_url + app.url,
application_dict[sub_app].no_installer,
zip_file,
sub_app + "/"
)
.push(function (zip_file) {
i += 1;
return fill(zip_file);
});
}
return zip_file;
}
return gadget.fillZip(app.cache, origin_url + app.url, app.no_installer) return gadget.fillZip(app.cache, origin_url + app.url, app.no_installer)
.push(function (zip_file) { .push(function (zip_file) {
return fill(zip_file); var element = gadget.element,
})
.push(function (zip_file) {
var element = gadget.props.element,
a = document.createElement("a"), a = document.createElement("a"),
url = URL.createObjectURL(zip_file), url = URL.createObjectURL(zip_file),
default_name = form_result.web_site.toLocaleLowerCase() default_name = form_result.web_site.toLocaleLowerCase()
...@@ -200,13 +125,8 @@ ...@@ -200,13 +125,8 @@
rJS(window) rJS(window)
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
});
}) })
.declareMethod("fillZip", function (cache_file, site_url, no_installer, .declareMethod("fillZip", function (cache_file, site_url, no_installer) {
zip_file, prefix) {
var gadget = this, var gadget = this,
file_storage = jIO.createJIO({ file_storage = jIO.createJIO({
type: "replicate", type: "replicate",
...@@ -225,7 +145,7 @@ ...@@ -225,7 +145,7 @@
take_installer: no_installer === undefined, take_installer: no_installer === undefined,
manifest: cache_file, manifest: cache_file,
origin_url: site_url, origin_url: site_url,
prefix: './' + (prefix || "") prefix: './'
} }
}, },
signature_sub_storage: { signature_sub_storage: {
...@@ -235,8 +155,7 @@ ...@@ -235,8 +155,7 @@
} }
}, },
local_sub_storage: { local_sub_storage: {
type: "zipfile", type: "zipfile"
file: zip_file
} }
}); });
return file_storage.repair() return file_storage.repair()
...@@ -253,7 +172,7 @@ ...@@ -253,7 +172,7 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return loopEventListener( return loopEventListener(
gadget.props.element.querySelector('form.export-form'), gadget.element.querySelector('form.export-form'),
'submit', 'submit',
true, true,
function (event) { function (event) {
......
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.45862.32132.53930</string> </value> <value> <string>964.50048.10199.31402</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515504420.29</float> <float>1515755593.09</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent:2, maxlen: 80, nomen: true */
/*global jIO */
(function (jIO) {
"use strict";
function LimitAllDocsStorage(spec) {
this._document = spec.document;
this._sub_storage = jIO.createJIO(spec.sub_storage);
}
LimitAllDocsStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.allAttachments = function () {
return this._sub_storage.allAttachments.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.post = function () {
return this._sub_storage.post.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.put = function () {
return this._sub_storage.put.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.remove = function () {
return this._sub_storage.remove.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.getAttachment = function () {
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.putAttachment = function () {
return this._sub_storage.putAttachment.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.removeAttachment = function () {
return this._sub_storage.removeAttachment.apply(this._sub_storage,
arguments);
};
LimitAllDocsStorage.prototype.repair = function () {
return this._sub_storage.repair.apply(this._sub_storage, arguments);
};
LimitAllDocsStorage.prototype.hasCapacity = function (name) {
return this._sub_storage.hasCapacity(name);
};
LimitAllDocsStorage.prototype.buildQuery = function (options) {
var storage = this;
return this._sub_storage.allDocs(options)
.push(function (result) {
var i;
for (i = 0; i < result.data.total_rows; i += 1) {
if (result.data.rows[i].id === storage._document) {
return [result.data.rows[i]];
}
}
return [];
});
};
jIO.addStorage('limitalldocs', LimitAllDocsStorage);
}(jIO));
...@@ -198,7 +198,6 @@ gadget_erp5_search_editor.html\n ...@@ -198,7 +198,6 @@ gadget_erp5_search_editor.html\n
jio_cachealldocsstorage.js\n jio_cachealldocsstorage.js\n
wallsearch_privacy_policy.html\n wallsearch_privacy_policy.html\n
fb_sdk.js\n fb_sdk.js\n
GADGET:\n
NETWORK:\n NETWORK:\n
*</string> </value> *</string> </value>
</item> </item>
...@@ -327,7 +326,7 @@ NETWORK:\n ...@@ -327,7 +326,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -341,7 +340,7 @@ NETWORK:\n ...@@ -341,7 +340,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.22868.65392.39372</string> </value> <value> <string>964.45561.47559.9591</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -359,7 +358,7 @@ NETWORK:\n ...@@ -359,7 +358,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1506433645.19</float> <float>1515773947.57</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment