Commit 84348d7e authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_travel_expense: add storage selection

parent b63d0819
...@@ -172,6 +172,13 @@ gadget_officejs_page_add_travel_request_record.js\n ...@@ -172,6 +172,13 @@ gadget_officejs_page_add_travel_request_record.js\n
gadget_officejs_jio_travel_request_record_view.html\n gadget_officejs_jio_travel_request_record_view.html\n
gadget_officejs_jio_travel_request_record_view.js\n gadget_officejs_jio_travel_request_record_view.js\n
\n \n
gadget_officejs_page_jio_configurator.html\n
gadget_officejs_page_jio_configurator.js\n
gadget_officejs_page_jio_erp5_configurator.html\n
gadget_officejs_page_jio_erp5_configurator.js\n
gadget_officejs_page_jio_dav_configurator.html\n
gadget_officejs_page_jio_dav_configurator.js\n
\n
\n \n
gadget_officejs_page_expense_sheet_list.html\n gadget_officejs_page_expense_sheet_list.html\n
gadget_officejs_page_expense_sheet_list.js\n gadget_officejs_page_expense_sheet_list.js\n
...@@ -195,8 +202,8 @@ gadget_officejs_hr_panel.html\n ...@@ -195,8 +202,8 @@ gadget_officejs_hr_panel.html\n
gadget_officejs_application_panel.js\n gadget_officejs_application_panel.js\n
chartist.min.js\n chartist.min.js\n
chartist.min.css\n chartist.min.css\n
gadget_hr_jio.html\n gadget_officejs_hr_jio.html\n
gadget_hr_jio.js\n gadget_officejs_hr_jio.js\n
gadget_officejs_jio_text_post.html\n gadget_officejs_jio_text_post.html\n
gadget_officejs_jio_text_post.js\n gadget_officejs_jio_text_post.js\n
\n \n
...@@ -350,7 +357,7 @@ NETWORK:\n ...@@ -350,7 +357,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.54125.49590.58624</string> </value> <value> <string>966.54128.62182.28825</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -368,7 +375,7 @@ NETWORK:\n ...@@ -368,7 +375,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523605496.88</float> <float>1523605559.57</float>
<string>GMT+2</string> <string>GMT+2</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 Router Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_officejs_page_jio_configurator.js" type="text/javascript"></script>
</head>
<body>
<article class="ui-content ui-body-c message" style="display: none;">
<section class="ui-content-header-plain">
<h3 class="ui-content-title ui-body-c" style="color: #085078;">
<span class="ui-icon ui-icon-custom ui-icon-info-circle">&nbsp;</span>
</3>
</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&auto_repair=true" data-i18n="Synchronize">Synchronize</a>
</div>
<div class="ui-block-b">
<a class="ui-btn" href="#page=hr_front" data-i18n="Go to document List">Access document List</a>
</div>
</div>
</div>
</section>
</article>
<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 Storage Choice
</h3>
</section>
<section class="ui-body-c ui-content-section">
<p>Select a storage to synchronize your data with</p>
<!--div class="select-storage ui-controlgroup ui-controlgroup-horizontal"-->
<div class="ui-grid-b ui-responsive">
<div class="ui-block-a">
<form class="select-dav-form" style="margin-right: .3125em; margin-left: .3125em;">
<button class="ui-btn ui-btn-b" type="submit" data-i18n="DAV Storage">DAV Storage</button>
</form>
</div>
<div class="ui-block-b">
<form class="select-erp5-form" style="margin-right: .3125em; margin-left: .3125em;">
<button class="ui-btn ui-btn-b" type="submit" data-i18n="ERP5">ERP5</button>
</form>
</div>
<div class="ui-block-c">
<form class="select-local-form" style="margin-right: .3125em; margin-left: .3125em;">
<button class="ui-btn ui-btn-b" type="submit" data-i18n="Local is Enough">Local is Enough</button>
</form>
</div>
</div>
<!--/div-->
</section>
</article>
</body>
</html>
\ No newline at end of file
/*global window, document, rJS, RSVP, URI, location,
loopEventListener*/
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) {
"use strict";
function setERP5Configuration(gadget) {
return gadget.redirect({page: 'jio_erp5_configurator'});
}
function setLocalConfiguration(gadget) {
var configuration = {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs"
}
}
};
return gadget.setSetting('jio_storage_description', configuration)
.push(function () {
return gadget.setSetting('jio_storage_name', "LOCAL");
})
.push(function () {
return gadget.reload();
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
});
}
function setDAVConfiguration(gadget) {
return gadget.redirect({page: 'jio_dav_configurator'});
}
var gadget_klass = rJS(window);
gadget_klass
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.deferred = RSVP.defer();
});
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getSetting", "getSetting")
.declareMethod("render", function () {
var gadget = this;
return gadget.updateHeader({
title: "Storage Configuration"
}).push(function () {
return RSVP.all([
gadget.getSetting('jio_storage_name'),
gadget.getSetting('application_title')
]);
}).push(function (setting_list) {
switch (setting_list[0]) {
case "ERP5":
gadget.props.element.querySelector("form.select-erp5-form button").classList.add("ui-btn-active");
break;
case "DAV":
gadget.props.element.querySelector("form.select-dav-form button").classList.add("ui-btn-active");
break;
case "LOCAL":
gadget.props.element.querySelector("form.select-local-form button").classList.add("ui-btn-active");
break;
default:
gadget.props.element.querySelector(".message h3").appendChild(document.createTextNode("Welcome in OfficeJS " + setting_list[1] + ". Please start by choosing a storage."));
gadget.props.element.querySelector(".message").setAttribute("style", "");
gadget.props.element.querySelector(".document-access").setAttribute("style", "display: none;");
break;
}
return;
}).push(function () {
return gadget.props.deferred.resolve();
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
return RSVP.all([
loopEventListener(
gadget.props.element.querySelector('form.select-erp5-form'),
'submit',
true,
function () {
return setERP5Configuration(gadget);
}
),
loopEventListener(
gadget.props.element.querySelector('form.select-local-form'),
'submit',
true,
function () {
return setLocalConfiguration(gadget);
}
),
loopEventListener(
gadget.props.element.querySelector('form.select-dav-form'),
'submit',
true,
function () {
return setDAVConfiguration(gadget);
}
)
]);
});
});
}(window, rJS, RSVP));
\ 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 jIO DAV Configurator Page</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_officejs_page_jio_dav_configurator.js"></script>
</head>
<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 WebDAV Connection parameters
</h3>
</section>
<section class="ui-body-c ui-content-section">
<form class="dav-configuration-form">
<div class="ui-form">
<div class="ui-field-contain">
<label data-i18n="Connection URL:">Connection URL:</label>
<input type="url" name="dav_url" required value=""/>
</div>
<div class="ui-field-contain">
<label data-i18n="Username:">Username:</label>
<input type="text" name="dav_username" value=""/>
</div>
<div class="ui-field-contain">
<label data-i18n="Password:">Password:</label>
<input type="password" name="dav_password" value=""/>
</div>
</div>
<div class="select-storage ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-b ui-responsive">
<div class="ui-block-a"></div>
<div class="ui-block-b"></div>
<div class="ui-block-c">
<button type="submit" data-i18n="Connect" class="ui-btn-btn-right">Connect</button>
</div>
</div>
</div>
</form>
</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=hr_front" data-i18n="Go to document List">Access document List</a>
</div>
</div>
</div>
</section>
</article>
</body>
</html>
/*global window, rJS, RSVP, URI, location,
loopEventListener, btoa */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) {
"use strict";
function setjIODAVConfiguration(gadget) {
return gadget.getSetting("portal_type")
.push(function (portal_type) {
var old_date = new Date(),
configuration = {};
// We are looking for documents modified in the past 3 month
old_date = new Date(old_date.getFullYear(), old_date.getMonth() - 3);
configuration = {
type: "replicate",
// XXX This drop the signature lists...
query: {
query: '(portal_type: "Expense Record" AND (simulation_state:"draft" OR simulation_state:"sent" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Travel Request Record" AND (simulation_state:"draft" OR simulation_state:"sent" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Leave Report Record" AND simulation_state:"stopped") ' +
'OR (portal_type: "Leave Request Record" AND (simulation_state:"draft" OR simulation_state:"sent" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Localisation Record" AND (simulation_state:"draft" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Expense Sheet" AND (reference: "expense_sheet")) ' +
'OR (portal_type: "Currency" AND validation_state:"validated") ' +
'OR (portal_type: "Service" AND validation_state:"validated") ',
// XX Synchonizing the whole module is too much, here is a way to start quietly
//+ 'AND local_roles: ("Owner") '
//+ 'AND validation_state: ("draft", "released_alive", "shared_alive", "published_alive") ',
limit: [0, 1234567890]
},
use_remote_post: false,
conflict_handling: 2,
check_local_modification: true,
check_local_creation: true,
check_local_deletion: true,
check_remote_modification: true,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-dav"
}
}
},
remote_sub_storage: {
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav",
url: gadget.props.element.querySelector("input[name='dav_url']").value,
basic_login: btoa(gadget.props.element.querySelector("input[name='dav_username']").value
+ ':' + gadget.props.element.querySelector("input[name='dav_password']").value),
with_credentials: true
}
}
}
};
return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () {
return gadget.setSetting('jio_storage_name', "DAV");
})
.push(function () {
return gadget.setSetting('sync_reload', true);
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
});
}
var gadget_klass = rJS(window);
gadget_klass
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.deferred = RSVP.defer();
return g.getSetting('jio_storage_name');
})
.push(function (jio_storage_name) {
if (jio_storage_name === "DAV") {
return g.getSetting('jio_storage_description')
.push(function (jio_storage_description) {
g.props.element.querySelector("input[name='dav_url']").value =
jio_storage_description.remote_sub_storage.sub_storage.sub_storage.url;
});
}
});
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod("render", function () {
var gadget = this;
return gadget.updateHeader({
title: "Connect To DAV Storage",
back_url: "#page=jio_configurator",
panel_action: false
}).push(function () {
return gadget.props.deferred.resolve();
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
return loopEventListener(
gadget.props.element.querySelector('form'),
'submit',
true,
function () {
return setjIODAVConfiguration(gadget);
}
);
});
});
}(window, rJS, RSVP));
\ 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 jIO ERP5 Configurator Page</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jiodev.js" type="text/javascript"></script>
<script src="gadget_officejs_page_jio_erp5_configurator.js"></script>
</head>
<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 ERP5 Connection parameters
</h3>
</section>
<section class="ui-content-header-plain">
<p>You have to be logged in this ERP5 prior to synchronising</p>
</section>
<section class="ui-body-c ui-content-section">
<form class="erp5-configuration-form">
<div class="ui-form">
<div class="ui-field-contain">
<label data-i18n="Connection URL:">Connection URL:</label>
<input type="url" name="erp5_url" class="ui-focus" required disabled/>
</div>
<div class="select-storage ui-controlgroup ui-controlgroup-horizontal">
<div class="ui-grid-b ui-responsive">
<div class="ui-block-a"></div>
<div class="ui-block-b"></div>
<div class="ui-block-c">
<button type="submit" data-i18n="Connect" class="ui-btn-btn-right">Connect</button>
</div>
</div>
</div>
</form>
</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&auto_repair=true" data-i18n="Synchronize">Synchronize</a>
</div>
<div class="ui-block-b">
<a class="ui-btn" href="#page=hr_front" 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>
</html>
/*global window, rJS, RSVP, URI, location,
loopEventListener, btoa */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) {
"use strict";
function setjIOERP5Configuration(gadget) {
var erp5_url = gadget.props.element.querySelector("input[name='erp5_url']").value;
return gadget.setSetting("me", '')
.push(function () {
var configuration = {
type: "replicate",
query: {
query: '(portal_type: "Expense Record" AND (simulation_state:"draft" OR simulation_state:"sent" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Travel Request Record" AND (simulation_state:"draft" OR simulation_state:"sent" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Leave Report Record" AND simulation_state:"stopped") ' +
'OR (portal_type: "Leave Request Record" AND (simulation_state:"draft" OR simulation_state:"sent" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Localisation Record" AND (simulation_state:"draft" OR simulation_state:"stopped")) ' +
'OR (portal_type: "Expense Sheet" AND (reference: "expense_sheet")) ' +
'OR (portal_type: "Currency" AND validation_state:"validated") ' +
'OR (portal_type: "Service" AND validation_state:"validated") ',
limit: [0, 1234567890]
},
use_remote_post: true,
conflict_handling: 2,
check_local_modification: false,
check_local_creation: true,
check_local_deletion: false,
check_remote_modification: false,
check_remote_creation: true,
check_remote_deletion: true,
local_sub_storage: {
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
type: "indexeddb",
database: "officejs-erp5-hr"
}
}
},
remote_sub_storage: {
type: "erp5",
url: (new URI("hateoas"))
.absoluteTo(erp5_url)
.toString(),
default_view_reference: "jio_view"
},
signature_sub_storage: {
type: "query",
sub_storage: {
type: "indexeddb",
database: "expense-hash-list"
}
}
};
return gadget.setSetting('jio_storage_description', configuration);
})
.push(function () {
return gadget.setSetting('jio_storage_name', "ERP5");
})
.push(function () {
return gadget.setGlobalSetting('erp5_url', erp5_url);
})
.push(function () {
return gadget.setSetting('sync_reload', true);
})
.push(function () {
return gadget.redirect({page: 'sync', auto_repair: 'true'});
});
}
var gadget_klass = rJS(window);
gadget_klass
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
g.props.deferred = RSVP.defer();
});
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("getSetting", "getSetting")
.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 () {
var gadget = this;
return gadget.updateHeader({
title: "Connect To ERP5 Storage",
back_url: "#page=jio_configurator",
panel_action: false
})
.push(function () {
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 () {
return gadget.props.deferred.resolve();
});
})
/////////////////////////////////////////
// Form submit
/////////////////////////////////////////
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
return loopEventListener(
gadget.props.element.querySelector('form'),
'submit',
true,
function () {
return setjIOERP5Configuration(gadget);
}
);
});
})
.declareService(function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
return gadget.declareGadget(
'gadget_officejs_setting.html',
{
scope: "global_setting_gadget",
sandbox: "iframe",
element: gadget.props.element.querySelector(".global_setting_gadget")
}
);
})
.push(function (global_setting_gadget) {
return global_setting_gadget.getSetting("erp5_url");
})
.push(function (erp5_url) {
var erp5_url_input =
gadget.props.element.querySelector("input[name='erp5_url']");
erp5_url_input.value = erp5_url || "https://nexedijs.erp5.net";
erp5_url_input.removeAttribute("disabled");
erp5_url_input.parentNode.classList.remove('ui-state-disabled');
erp5_url_input.focus();
});
});
}(window, rJS, RSVP));
\ 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_officejs_hr_jio.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS, jIO, FormData, UriTemplate */
/*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;
if (storage === undefined) {
return gadget.redirect({page: "jio_configurator"});
}
return storage[method_name].apply(storage, argument_list)
.push(undefined, function (error) {
if ((error.target !== undefined) && (error.target.status === 401)) {
var regexp,
site,
auth_page;
if (gadget.state_parameter_dict.jio_storage_name === "ERP5") {
regexp = /^X-Delegate uri=\"(http[s]?:\/\/[\/\-\[\]{}()*+=:?&.,\\\^$|#\s\w%]+)\"$/;
auth_page = error.target.getResponseHeader('WWW-Authenticate');
if (regexp.test(auth_page)) {
site = UriTemplate.parse(
regexp.exec(auth_page)[1]
).expand({
came_from: window.location.href,
cors_origin: window.location.origin,
});
}
}
if (gadget.state_parameter_dict.jio_storage_name === "DAV") {
regexp = /^Nayookie login_url=(http[s]?:\/\/[\/\-\[\]{}()*+=:?&.,\\\^$|#\s\w%]+)$/;
auth_page = error.target.getResponseHeader('WWW-Authenticate');
if (regexp.test(auth_page)) {
site = UriTemplate.parse(
regexp.exec(auth_page)[1]
).expand({
back_url: window.location.href,
origin: window.location.origin,
});
}
}
if (site) {
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")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod('createJio', function (jio_options) {
var gadget = this;
if (jio_options === undefined) {
return;
}
this.state_parameter_dict.jio_storage = jIO.createJIO(jio_options);
return this.getSetting("jio_storage_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 () {
var gadget = this;
return this.getSetting("jio_storage_name")
.push(function (jio_storage_name) {
//try to specify me
if (jio_storage_name === 'ERP5') {
return gadget.getSetting('me')
.push(function (me) {
if (!me) {
return gadget.getSetting('jio_storage_description')
.push(function (configuration) {
gadget.state_parameter_dict.jio_storage = jIO.createJIO(configuration.remote_sub_storage);
return wrapJioCall(gadget, 'getAttachment', ['acl_users', configuration.remote_sub_storage.url, {format: "json"}])
.push(function (result) {
//recreate erp5 storage with indexeddb
me = result._links.me ? result._links.me.href : 'manager';
configuration.query.query += 'OR (portal_type: "Person" AND id: "' + me.split("/")[1] + '")',
gadget.state_parameter_dict.jio_storage = jIO.createJIO(configuration);
return gadget.setSetting('me', me);
})
.push(function () {
return gadget.setSetting('jio_storage_description', configuration);
});
});
}
});
}
})
.push(function () {
return wrapJioCall(gadget, 'repair', arguments);
})
.push(function () {
return gadget.setSetting('last_sync_date', new Date().toLocaleString());
});
});
}(window, rJS, jIO));
\ No newline at end of file
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<li><a href="#page=expense_report" data-i18n="Reports">Reports</a></li> <li><a href="#page=expense_report" data-i18n="Reports">Reports</a></li>
<!-- li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li --> <!-- li><a href="#page=jio_configurator" data-i18n="Storage Configuration">Storage Configuration</a></li -->
<li><a href="#page=preference" data-i18n="Preferences">PReferences</a></li> <li><a href="#page=preference" data-i18n="Preferences">PReferences</a></li>
<li><a href="#page=jio_configurator" data-i18n="Storages">Storages</a></li>
<li><a href="#page=sync&auto_repair=true" data-i18n="Synchronize">Synchronize</a></li> <li><a href="#page=sync&auto_repair=true" data-i18n="Synchronize">Synchronize</a></li>
</ul> </ul>
</div> </div>
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>966.48804.57481.19029</string> </value> <value> <string>966.48812.55170.9762</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1523286530.45</float> <float>1523438716.34</float>
<string>GMT+2</string> <string>GMT+2</string>
</tuple> </tuple>
</state> </state>
......
...@@ -19,6 +19,5 @@ ...@@ -19,6 +19,5 @@
<script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Expense Record</script> <script data-renderjs-configuration="document_title" type="text/x-renderjs-configuration">Expense Record</script>
<script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Expense Records</script> <script data-renderjs-configuration="document_title_plural" type="text/x-renderjs-configuration">Expense Records</script>
<script data-renderjs-configuration="query" type="text/x-renderjs-configuration">portal_type: "Expense Record" OR (portal_type:"Currency" AND validation_state:"validated")</script> <script data-renderjs-configuration="query" type="text/x-renderjs-configuration">portal_type: "Expense Record" OR (portal_type:"Currency" AND validation_state:"validated")</script>
<script data-renderjs-configuration="global_setting_gadget_url" type="text/x-renderjs-configuration">https://setting-gadget.app.officejs.com/0.1.1/</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>supercedriclen</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.64150.43979.2508</string> </value> <value> <string>966.48777.48028.12578</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -288,8 +288,8 @@ ...@@ -288,8 +288,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481817049.16</float> <float>1523437340.15</float>
<string>UTC</string> <string>GMT+2</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -339,7 +339,7 @@ ...@@ -339,7 +339,7 @@
</item> </item>
<item> <item>
<key> <string>configuration_application_title</string> </key> <key> <string>configuration_application_title</string> </key>
<value> <string>Officejs HR</string> </value> <value> <string>HR</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_content_security_policy</string> </key> <key> <string>configuration_content_security_policy</string> </key>
...@@ -363,7 +363,7 @@ ...@@ -363,7 +363,7 @@
</item> </item>
<item> <item>
<key> <string>configuration_jio_gadget_url</string> </key> <key> <string>configuration_jio_gadget_url</string> </key>
<value> <string>gadget_hr_jio.html</string> </value> <value> <string>gadget_officejs_hr_jio.html</string> </value>
</item> </item>
<item> <item>
<key> <string>configuration_manifest_url</string> </key> <key> <string>configuration_manifest_url</string> </key>
...@@ -525,11 +525,17 @@ ...@@ -525,11 +525,17 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>edit_workflow</string> </key> <key> <string>category_publication_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -537,6 +543,59 @@ ...@@ -537,6 +543,59 @@
</pickle> </pickle>
</record> </record>
<record id="9" aka="AAAAAAAAAAk="> <record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish</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>1523435963.64</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
...@@ -551,7 +610,7 @@ ...@@ -551,7 +610,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>cedric.le.ninivin</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -565,7 +624,7 @@ ...@@ -565,7 +624,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.4233.53000.41642</string> </value> <value> <string>966.51303.25888.32000</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -583,8 +642,8 @@ ...@@ -583,8 +642,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1505315259.92</float> <float>1523518073.81</float>
<string>UTC</string> <string>GMT+2</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
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