Commit befc621f authored by Romain Courteaud's avatar Romain Courteaud Committed by Cédric Le Ninivin

[erp5_officejs] Allow to preset the linshare username

parent 38f379f1
...@@ -13,7 +13,16 @@ ...@@ -13,7 +13,16 @@
}) })
.push(function (setting) { .push(function (setting) {
var configuration = {}, var configuration = {},
attachment_synchro = setting[1] !== ""; attachment_synchro = setting[1] !== "",
linshare_json = {
type: "linshare",
url: options.url
};
if (options.username || options.password) {
linshare_json.access_token = window.btoa(
options.username + ':' + options.password
);
}
configuration = { configuration = {
type: "replicate", type: "replicate",
query: { query: {
...@@ -69,13 +78,7 @@ ...@@ -69,13 +78,7 @@
}, },
sub_storage: { sub_storage: {
type: "query", type: "query",
sub_storage: { sub_storage: linshare_json
type: "linshare",
url: options.url,
access_token: window.btoa(
options.username + ':' + options.password
)
}
} }
} }
} }
...@@ -111,7 +114,8 @@ ...@@ -111,7 +114,8 @@
var gadget = this; var gadget = this;
if (options.url) { if (options.url) {
return gadget.changeState({ return gadget.changeState({
url: options.url || "" url: options.url || "",
username: options.username || ""
}); });
} }
return gadget.getSetting('linshare_storage', "") return gadget.getSetting('linshare_storage', "")
...@@ -160,7 +164,7 @@ ...@@ -160,7 +164,7 @@
"my_username": { "my_username": {
"description": "", "description": "",
"title": "Username", "title": "Username",
"default": "", "default": gadget.state.username || "",
"css_class": "", "css_class": "",
"required": 1, "required": 1,
"editable": 1, "editable": 1,
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>973.24661.29279.57753</string> </value> <value> <string>973.43371.54750.44595</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>1549019475.4</float> <float>1550139619.39</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