Commit e41236ef authored by Alain Takoudjou's avatar Alain Takoudjou

erp5_web_mynij_search: redirect to search page after load a source json file

parent 42f85155
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted") .declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.ready(function () { .ready(function () {
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.updateHeader({ return gadget.updateHeader({
page_title: "Torrent Source import" page_title: "JSON Source import"
}); });
}); });
}) })
...@@ -89,15 +90,30 @@ ...@@ -89,15 +90,30 @@
}) })
.push(function (result) { .push(function (result) {
var count = result.length; var count = result.length;
return gadget.notifySubmitted({
message: count + " Source(s) correctly imported!", return gadget.getSetting("build_dict", {})
status: "success" .push(function (build_dict) {
var i;
for (i = 0; i < result.length; i += 1) {
build_dict[result[i]] = {
links: source_list[i].links,
index_name: source_list[i].title,
jio_key: result[i],
id: Date.now()
};
}
return gadget.setSetting("build_dict", build_dict);
}) })
.push(function () { .push(function () {
var options = {page : "ojs_local_controller"}; return gadget.notifySubmitted({
if (count > 0) { message: count + " Source(s) correctly imported!\n" +
options.jio_key = result[0]; "Build of imported source(s) will start!",
} status: "success"
});
})
.push(function () {
var options = {page : "mynij_search"};
return gadget.redirect({command: 'display', options: options}); return gadget.redirect({command: 'display', options: options});
}); });
}); });
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>994.43703.49451.32375</string> </value> <value> <string>994.55525.49822.47940</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>1631197348.88</float> <float>1632233519.34</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