Commit 6e377384 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs] Change global setting url in dav configurator

parent 0c1e24fb
...@@ -4,22 +4,14 @@ ...@@ -4,22 +4,14 @@
(function (window, rJS, RSVP) { (function (window, rJS, RSVP) {
"use strict"; "use strict";
function setjIODAVConfiguration(gadget) { function setjIODAVConfiguration(gadget, options) {
var dav_url = gadget.props.element.querySelector("input[name='dav_url']").value;
return gadget.getSetting("portal_type", "Web Page") return gadget.getSetting("portal_type", "Web Page")
.push(function (portal_type) { .push(function (portal_type) {
var old_date = new Date(), var configuration = {
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", type: "replicate",
// XXX This drop the signature lists... // XXX This drop the signature lists...
query: { query: {
query: 'portal_type:"' + portal_type + '" ', query: 'portal_type:"' + portal_type + '" ',
// 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, 100] limit: [0, 100]
}, },
use_remote_post: false, use_remote_post: false,
...@@ -66,14 +58,13 @@ ...@@ -66,14 +58,13 @@
property: { property: {
"portal_type": [ "portal_type": [
"switchPropertyValue", "switchPropertyValue",
{"PDF":"pdf", "Web Page": "txt"} {"PDF": "pdf", "Web Page": "txt"}
] ]
}, },
sub_storage: { sub_storage: {
type: "dav", type: "dav",
url: gadget.props.element.querySelector("input[name='dav_url']").value, url: options.dav_url,
basic_login: btoa(gadget.props.element.querySelector("input[name='dav_username']").value basic_login: btoa(options.username + ':' + options.password),
+ ':' + gadget.props.element.querySelector("input[name='dav_password']").value),
with_credentials: true with_credentials: true
} }
} }
...@@ -87,7 +78,7 @@ ...@@ -87,7 +78,7 @@
return gadget.setSetting('jio_storage_name', "DAV"); return gadget.setSetting('jio_storage_name', "DAV");
}) })
.push(function () { .push(function () {
return gadget.setGlobalSetting('dav_url', dav_url); return gadget.setGlobalSetting('dav_url', options.dav_url);
}) })
.push(function () { .push(function () {
return gadget.setSetting('sync_reload', true); return gadget.setSetting('sync_reload', true);
...@@ -95,7 +86,7 @@ ...@@ -95,7 +86,7 @@
.push(function () { .push(function () {
return gadget.redirect({ return gadget.redirect({
command: "display", command: "display",
options: {page: 'sync', auto_repair: 'true'} options: {page: 'ojs_sync', auto_repair: 'true'}
}); });
}); });
} }
...@@ -155,7 +146,7 @@ ...@@ -155,7 +146,7 @@
.declareService(function () { .declareService(function () {
var gadget = this; var gadget = this;
return gadget.getSetting("global_setting_gadget_url", "officejs_setting_gadget/app/") return gadget.getSetting("global_setting_gadget_url", "../officejs_setting_gadget/app/")
.push(function (global_setting_gadget_url) { .push(function (global_setting_gadget_url) {
return gadget.declareGadget(global_setting_gadget_url, { return gadget.declareGadget(global_setting_gadget_url, {
"scope": "global_setting_gadget", "scope": "global_setting_gadget",
...@@ -214,7 +205,7 @@ ...@@ -214,7 +205,7 @@
"editable": 1, "editable": 1,
"key": "password", "key": "password",
"hidden": 0, "hidden": 0,
"type": "StringField" "type": "PasswordField"
} }
}}, }},
"_links": { "_links": {
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.10686.10882.5973</string> </value> <value> <string>961.29545.56354.24985</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502107775.92</float> <float>1502901834.19</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