Commit 4908fe22 authored by Vincent Bechu's avatar Vincent Bechu

erp5_officjs: add redirect in router for dropbox and fix bookmark

/reviewed-on nexedi/erp5!302
parent 66cfe1e0
...@@ -12,41 +12,6 @@ ...@@ -12,41 +12,6 @@
<script src="gadget_officejs_page_jio_dropbox_configurator.js"></script> <script src="gadget_officejs_page_jio_dropbox_configurator.js"></script>
</head> </head>
<body> <body>
<article class="ui-content ui-body-c">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">
<span class="ui-icon ui-icon-custom ui-icon-database">&nbsp;</span>
Your Dropbox Connection parameters
</h3>
</section>
<section class="ui-content-header-plain">
<p>Connecting to Dropbox</p>
</section>
</article>
<article class="ui-content ui-body-c document-access">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c">
<span class="ui-icon ui-icon-custom ui-icon-file-text-o">&nbsp;</span>
Your Documents
</h3>
</section>
<section class="ui-body-c ui-content-section">
<p style="color: red">Continue by <b>synchronizing</b> with your remote storage or <b>accessing</b> your documents</p>
<div class="ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<a class="ui-btn" href="#page=sync" data-i18n="Synchronize">Synchronize</a>
</div>
<div class="ui-block-b">
<a class="ui-btn" href="#page=document_list" data-i18n="Go to document List">Access document List</a>
</div>
</div>
</div>
</section>
</article>
<div class="global_setting_gadget" style="display: none;"></div>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.64672.3552.2918</string> </value> <value> <string>958.24259.25538.21094</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>1485780527.48</float> <float>1498039956.08</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, URI, location, /*global window, rJS, RSVP, URI, location,
loopEventListener, btoa */ loopEventListener, btoa */
/*jslint nomen: true, indent: 2, maxerr: 3*/ /*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) { (function (window, rJS, RSVP, console) {
"use strict"; "use strict";
function setDropboxConfiguration(gadget) { function setDropboxConfiguration(gadget) {
...@@ -100,39 +100,21 @@ ...@@ -100,39 +100,21 @@
.declareAcquiredMethod("reload", "reload") .declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting") .declareAcquiredMethod("setSetting", "setSetting")
.declareMethod("getGlobalSetting", function (key) {
var gadget = this;
return gadget.getDeclaredGadget("global_setting_gadget")
.push(function (global_setting_gadget) {
return global_setting_gadget.getSetting(key);
});
})
.declareMethod("setGlobalSetting", function (key, value) {
var gadget = this;
return gadget.getDeclaredGadget("global_setting_gadget")
.push(function (global_setting_gadget) {
return global_setting_gadget.setSetting(key, value);
});
})
.declareMethod("render", function (options) { .declareMethod("render", function (options) {
var gadget = this; var gadget = this;
return gadget.updateHeader({ return gadget.updateHeader({
title: "Connect To Drobox Storage", title: "Connect To Drobox Storage",
back_url: "#page=jio_configurator", back_url: "#page=jio_configurator",
panel_action: false panel_action: false
})
.push(function (options) {
return gadget.getSetting('jio_storage_name');
})
.push(function (jio_storage_name) {
if (!jio_storage_name) {
gadget.props.element.querySelector(".document-access").setAttribute("style", "display: none;");
}
}) })
.push(function () { .push(function () {
gadget.props.access_token = options.token; gadget.props.access_token = options.token;
return setDropboxConfiguration(gadget); return gadget.props.deferred.resolve();
}); });
})
.declareService(function () {
var gadget = this;
return setDropboxConfiguration(gadget);
}); });
}(window, rJS, RSVP)); }(window, rJS, RSVP, console));
\ No newline at end of file \ No newline at end of file
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.64671.54901.45909</string> </value> <value> <string>960.12610.20791.23552</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>1485780514.28</float> <float>1498039829.6</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -94,6 +94,19 @@ ...@@ -94,6 +94,19 @@
var gadget = this, var gadget = this,
args = options.args; args = options.args;
gadget.options = options; gadget.options = options;
if (args.access_token) {
if (args.state === "gdrive") {
args.page = "jio_gdrive_configurator";
} else {
args.page = "jio_dropbox_configurator";
}
return this.getCommandUrlFor({"page": args.page,
"token": args.access_token})
.push(function (hash) {
window.location.replace(hash);
return RSVP.timeout(REDIRECT_TIMEOUT);
});
}
if (args.jio_key === undefined || args.jio_key === '') { if (args.jio_key === undefined || args.jio_key === '') {
if (args.page === undefined || args.page === '' || args.page === "document_list") { if (args.page === undefined || args.page === '' || args.page === "document_list") {
args.page = DEFAULT_PAGE; args.page = DEFAULT_PAGE;
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>957.15167.59077.43741</string> </value> <value> <string>960.12474.59711.2781</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>1486742528.7</float> <float>1498033186.77</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