From 103d30ad3f92ed03156fee400801d9a38f946b34 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 13 Feb 2021 22:16:17 +0300 Subject: batch subscribe: use client dialog --- js/PrefFeedTree.js | 94 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 26 deletions(-) (limited to 'js/PrefFeedTree.js') diff --git a/js/PrefFeedTree.js b/js/PrefFeedTree.js index 3e3584a9a..c3dda4187 100644 --- a/js/PrefFeedTree.js +++ b/js/PrefFeedTree.js @@ -378,35 +378,77 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dojo/_b } }, batchSubscribe: function() { - const dialog = new fox.SingleUseDialog({ - id: "batchSubDlg", - title: __("Batch subscribe"), - execute: function () { - if (this.validate()) { - Notify.progress(__("Subscribing to feeds..."), true); - - xhrPost("backend.php", this.attr('value'), () => { - Notify.close(); - - const tree = dijit.byId("feedTree"); - if (tree) tree.reload(); - - dialog.hide(); - }); - } - }, - content: __("Loading, please wait...") - }); + xhrJson("backend.php", {op: 'pref-feeds', method: 'batchSubscribe'}, (reply) => { + const dialog = new fox.SingleUseDialog({ + id: "batchSubDlg", + title: __("Batch subscribe"), + execute: function () { + if (this.validate()) { + Notify.progress(__("Subscribing to feeds..."), true); - const tmph = dojo.connect(dialog, 'onShow', function () { - dojo.disconnect(tmph); + xhrPost("backend.php", this.attr('value'), () => { + Notify.close(); - xhrPost("backend.php", {op: 'pref-feeds', method: 'batchSubscribe'}, (transport) => { - dialog.attr('content', transport.responseText); - }) - }); + const tree = dijit.byId("feedTree"); + if (tree) tree.reload(); + + dialog.hide(); + }); + } + }, + content: ` +
+ ${App.FormFields.hidden("op", "pref-feeds")} + ${App.FormFields.hidden("method", "batchaddfeeds")} + +
+ ${__("One valid feed per line (no detection is done)")} +
+ +
+ + + ${reply.enable_cats ? + `
+ + ${reply.cat_select} +
+ ` : '' + } +
+ + + + + +
+ +
+ + +
+ ` + }); - dialog.show(); + dialog.show(); + + }); }, showInactiveFeeds: function() { xhrJson("backend.php", {op: 'pref-feeds', method: 'inactivefeeds'}, function (reply) { -- cgit v1.2.3-54-g00ecf