Commit e0d94f9a authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_officejs: Update default parameters for automatic redirection and default search engine

parent b25768be
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
var gadget = this, var gadget = this,
portal_type = null, portal_type = null,
option = { option = {
auto_redirect: false, auto_redirect: true,
search_engine: "" search_engine: "https://duckduckgo.com/?q="
}; };
return new RSVP.Queue() return new RSVP.Queue()
......
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1499162399.03</float> <float>1499162533.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
</head> </head>
<body> <body>
<fieldset class="ui-controlgroup ui-corner-all">
<div class="center ui-controlgroup-controls">
<div class="ui-field-contain">
<p>To use the bookmark manager as a search engine, add this url to the search engine list of your browser : </p>
<input type="text" class="search-engine-url" style="font-weight:bold;" readonly></input>
</div>
</div>
</fieldset>
<form class="options"> <form class="options">
<fieldset class="ui-controlgroup ui-corner-all"> <fieldset class="ui-controlgroup ui-corner-all">
<div class="center ui-controlgroup-controls"> <div class="center ui-controlgroup-controls">
...@@ -25,7 +34,7 @@ ...@@ -25,7 +34,7 @@
<div class="ui-field-contain"> <div class="ui-field-contain">
<label for="search_engine">Default Search Engine :</label> <label for="search_engine">Default Search Engine :</label>
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset"> <div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset">
<input type="text" name="search_engine" value="https://duckduckgo.com/?q="> <input type="text" name="search_engine">
</div> </div>
</div> </div>
...@@ -35,8 +44,5 @@ ...@@ -35,8 +44,5 @@
</fieldset> </fieldset>
</form> </form>
<hr />
<p>To use the bookmark manager as a search engine, add this url to the search engine list of your browser : <span class="search-engine-url" style="font-weight:bold;"></span></p>
</body> </body>
</html> </html>
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.64450.52709.9386</string> </value> <value> <string>960.32715.46116.17902</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1485780641.43</float> <float>1499161500.2</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -11,20 +11,6 @@ ...@@ -11,20 +11,6 @@
return gadget.setSetting("option", option_dict); return gadget.setSetting("option", option_dict);
} }
function setSearchUrl(gadget) {
return RSVP.Queue()
.push(function() {
return gadget.getSetting("option");
})
.push(function(option) {
return gadget.getUrlFor({page: 'bookmark_dispatcher'});
})
.push(function(url) {
url = window.location.origin + window.location.pathname + url + '&search=%s';
gadget.props.element.getElementsByClassName("search-engine-url")[0].innerHTML = url;
});
}
rJS(window) rJS(window)
.ready(function (g) { .ready(function (g) {
g.props = {}; g.props = {};
...@@ -55,21 +41,26 @@ ...@@ -55,21 +41,26 @@
return RSVP.Queue() return RSVP.Queue()
// Set the URL used to set the Bookmark Manager as a search engine. // Set the URL used to set the Bookmark Manager as a search engine.
.push(function () { .push(function () {
return setSearchUrl(gadget); return gadget.getUrlFor({page: 'bookmark_dispatcher'});
}) })
// Set elements in form to reflect option dict .push(function (url) {
.push(function () { url = window.location.origin + window.location.pathname
return gadget.getSetting("option") + url + '&search=%s';
.push(function(option_dict) { gadget.props.element.getElementsByClassName("search-engine-url")[0].value = url;
if (option_dict) { return gadget.getSetting("option");
})
.push(function (option_dict) {
if (option_dict === undefined) {
option_dict = {
search_engine: "https://duckduckgo.com/?q=",
auto_redirect: true
};
}
gadget.props.element.querySelector(".options input[name=\"search_engine\"]").value = option_dict.search_engine; gadget.props.element.querySelector(".options input[name=\"search_engine\"]").value = option_dict.search_engine;
gadget.props.element.querySelector(".options input[name=\"auto_redirect\"]").checked = option_dict.auto_redirect; gadget.props.element.querySelector(".options input[name=\"auto_redirect\"]").checked = option_dict.auto_redirect;
} return gadget.updateHeader({title: 'Bookmark Manager Preferences', save_action: true});
}); });
}) })
// Adds a save button
.push(gadget.updateHeader({title: 'Bookmark Manager Preferences', save_action: true}));
})
.onEvent("submit", function () { .onEvent("submit", function () {
saveOptionDict(this); saveOptionDict(this);
}); });
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.64450.52709.9386</string> </value> <value> <string>960.32743.2629.17442</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1485780623.37</float> <float>1499161566.28</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