From bf6d0f28173ca38968e5a23b86758d1dce133e1d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 12 Feb 2021 10:35:13 +0300 Subject: various dialog-related fixes; stop referring to many dialogs by name; move filter test initial dialog to client side --- classes/feeds.php | 5 +++-- classes/pref/feeds.php | 15 +++++++-------- classes/pref/filters.php | 17 +---------------- classes/pref/labels.php | 4 ++-- classes/pref/prefs.php | 42 ++++++++++-------------------------------- classes/pref/users.php | 4 ++-- js/CommonFilters.js | 15 +++++++++++++-- js/PrefHelpers.js | 31 +++++++++++++------------------ 8 files changed, 51 insertions(+), 82 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index d995b4be1..031a671ae 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -730,9 +730,10 @@ class Feeds extends Handler_Protected { print ""; print ""; diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 06e0e4c3d..659f7e183 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -975,7 +975,7 @@ class Pref_Feeds extends Handler_Protected { "; @@ -1509,9 +1509,9 @@ class Pref_Feeds extends Handler_Protected { print ""; print ""; @@ -1568,10 +1568,9 @@ class Pref_Feeds extends Handler_Protected { print ""; print ""; @@ -1665,9 +1664,9 @@ class Pref_Feeds extends Handler_Protected { print ""; print ""; print ""; diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 43a625989..096ab826d 100755 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -3,7 +3,7 @@ class Pref_Filters extends Handler_Protected { function csrf_ignore($method) { $csrf_ignored = array("index", "getfiltertree", "edit", "newfilter", "newrule", - "newaction", "savefilterorder", "testfilterdlg"); + "newaction", "savefilterorder"); return array_search($method, $csrf_ignored) !== false; } @@ -163,21 +163,6 @@ class Pref_Filters extends Handler_Protected { print json_encode($rv); } - function testFilterDlg() { - ?> -
-   - Looking for articles... -
- - - - - pdo->prepare("SELECT reg_exp, inverse, diff --git a/classes/pref/labels.php b/classes/pref/labels.php index 4f83ad16e..a7869c379 100644 --- a/classes/pref/labels.php +++ b/classes/pref/labels.php @@ -69,9 +69,9 @@ class Pref_Labels extends Handler_Protected { print ""; print ""; diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index df4540c5e..7385ae28c 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -1169,29 +1169,6 @@ class Pref_Prefs extends Handler_Protected { $value = str_replace("
", "\n", $value); print json_encode(["value" => $value]); - - /*print_notice(__("You can override colors, fonts and layout of your currently selected theme with custom CSS declarations here.")); - - print_hidden("op", "rpc"); - print_hidden("method", "setpref"); - print_hidden("key", "USER_STYLESHEET"); - - print ""; - - print ""; - - print "";*/ - } function editPrefProfiles() { @@ -1220,9 +1197,9 @@ class Pref_Prefs extends Handler_Protected { WHERE owner_uid = ? ORDER BY title"); $sth->execute([$_SESSION['uid']]); - print "
"; + print "
"; - print ""; + print "
"; print ""; @@ -1277,18 +1254,19 @@ class Pref_Prefs extends Handler_Protected { } print "
"; - print ""; print "
"; print "
- - - "; + + + "; print "
"; + print ""; + } private function getShortDesc($pref_name) { diff --git a/classes/pref/users.php b/classes/pref/users.php index 67daa884f..16c2d3142 100644 --- a/classes/pref/users.php +++ b/classes/pref/users.php @@ -110,9 +110,9 @@ class Pref_Users extends Handler_Protected { print '
'; print ""; diff --git a/js/CommonFilters.js b/js/CommonFilters.js index 27bf78a02..61e6b2f95 100644 --- a/js/CommonFilters.js +++ b/js/CommonFilters.js @@ -248,10 +248,21 @@ const Filters = { }); }, - href: "backend.php?op=pref-filters&method=testFilterDlg" + content: ` +
+   + Looking for articles... +
+ + + + + ` }); - dojo.connect(test_dlg, "onLoad", null, function (/* e */) { + dojo.connect(test_dlg, "onShow", null, function (/* e */) { test_dlg.getTestResults(params, 0); }); diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index 966e8151e..dd8fef5c6 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -118,22 +118,6 @@ const Helpers = { alert(__("No profiles selected.")); } }, - activateProfile: function () { - const sel_rows = this.getSelectedProfiles(); - - if (sel_rows.length == 1) { - if (confirm(__("Activate selected profile?"))) { - Notify.progress("Loading, please wait..."); - - xhrPost("backend.php", {op: "rpc", method: "setprofile", id: sel_rows.toString()}, () => { - window.location.reload(); - }); - } - - } else { - alert(__("Please choose a profile to activate.")); - } - }, addProfile: function () { if (this.validate()) { Notify.progress("Creating profile...", true); @@ -148,8 +132,19 @@ const Helpers = { } }, execute: function () { - if (this.validate()) { - // + const sel_rows = this.getSelectedProfiles(); + + if (sel_rows.length == 1) { + if (confirm(__("Activate selected profile?"))) { + Notify.progress("Loading, please wait..."); + + xhrPost("backend.php", {op: "rpc", method: "setprofile", id: sel_rows.toString()}, () => { + window.location.reload(); + }); + } + + } else { + alert(__("Please choose a profile to activate.")); } }, href: query -- cgit v1.2.3