summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-12 10:35:13 +0300
committerAndrew Dolgov <[email protected]>2021-02-12 10:35:13 +0300
commitbf6d0f28173ca38968e5a23b86758d1dce133e1d (patch)
tree3daef1f2edb3a320a56eac6a48d3dc08c885b010
parent72e38bfe1faa57ec15068c5ac0e53a0d7a4dc8cf (diff)
various dialog-related fixes; stop referring to many dialogs by name; move filter test initial dialog to client side
-rwxr-xr-xclasses/feeds.php5
-rwxr-xr-xclasses/pref/feeds.php15
-rwxr-xr-xclasses/pref/filters.php17
-rw-r--r--classes/pref/labels.php4
-rw-r--r--classes/pref/prefs.php42
-rw-r--r--classes/pref/users.php4
-rw-r--r--js/CommonFilters.js15
-rw-r--r--js/PrefHelpers.js31
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 "<footer>";
print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit'
- onclick=\"App.dialogOf(this).execute()\">".__('Subscribe')."</button>";
+ onclick='App.dialogOf(this).execute()'>".__('Subscribe')."</button>";
- print "<button dojoType='dijit.form.Button' onclick=\"App.dialogOf(this).hide()\">".__('Cancel')."</button>";
+ print "<button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
+ __('Cancel')."</button>";
print "</footer>";
print "</form>";
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 {
<button dojoType='dijit.form.Button' type='submit' class='alt-primary' type='submit'>".
__('Save')."</button>
<button dojoType='dijit.form.Button'
- onclick=\"App.dialogOf(this).hide()\">".
+ onclick='App.dialogOf(this).hide()'>".
__('Cancel')."</button>
</footer>";
@@ -1509,9 +1509,9 @@ class Pref_Feeds extends Handler_Protected {
print "</div>";
print "<footer>
- <button style='float : left' class=\"alt-danger\" dojoType='dijit.form.Button' onclick=\"dijit.byId('inactiveFeedsDlg').removeSelected()\">"
+ <button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>"
.__('Unsubscribe from selected feeds')."</button>
- <button dojoType='dijit.form.Button' onclick=\"dijit.byId('inactiveFeedsDlg').hide()\">"
+ <button dojoType='dijit.form.Button' class='alt-primary' type='submit'>"
.__('Close this window')."</button>
</footer>";
@@ -1568,10 +1568,9 @@ class Pref_Feeds extends Handler_Protected {
print "</div>";
print "<footer>";
- print "<button style='float : left' class=\"alt-danger\" dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').removeSelected()\">"
+ print "<button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>"
.__('Unsubscribe from selected feeds')."</button> ";
-
- print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('errorFeedsDlg').hide()\">".
+ print "<button dojoType='dijit.form.Button' class='alt-primary' type='submit'>".
__('Close this window')."</button>";
print "</footer>";
@@ -1665,9 +1664,9 @@ class Pref_Feeds extends Handler_Protected {
print "</fieldset>";
print "<footer>
- <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('batchSubDlg').execute()\" type='submit' class='alt-primary'>".
+ <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).execute()' type='submit' class='alt-primary'>".
__('Subscribe')."</button>
- <button dojoType='dijit.form.Button' onclick=\"return dijit.byId('batchSubDlg').hide()\">".__('Cancel')."</button>
+ <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".__('Cancel')."</button>
</footer>";
print "</form>";
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() {
- ?>
- <div>
- <img id='prefFilterLoadingIndicator' src='images/indicator_tiny.gif'>&nbsp;
- <span id='prefFilterProgressMsg'>Looking for articles...</span>
- </div>
-
- <ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'></ul>
-
- <footer class='text-center'>
- <button dojoType='dijit.form.Button' onclick="dijit.byId('filterTestDlg').hide()"><?php echo __('Close this window') ?></button>
- </footer>
- <?php
- }
-
private function getfilterrules_list($filter_id) {
$sth = $this->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 "</section>";
print "<footer>";
- print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick=\"dijit.byId('labelEditDlg').execute()\">".
+ print "<button dojoType='dijit.form.Button' type='submit' class='alt-primary' onclick='App.dialogOf(this).execute()'>".
__('Save')."</button>";
- print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('labelEditDlg').hide()\">".
+ print "<button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
__('Cancel')."</button>";
print "</footer>";
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("<br/>", "\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 "<div id='css_edit_apply_msg' style='display : none'>";
- print_warning(__("User CSS has been applied, you might need to reload the page to see all changes."));
- print "</div>";
-
- print "<textarea class='panel user-css-editor' dojoType='dijit.form.SimpleTextarea'
- style='font-size : 12px;' name='value'>$value</textarea>";
-
- print "<footer>";
- print "<button dojoType='dijit.form.Button' class='alt-success'
- onclick=\"dijit.byId('cssEditDlg').apply()\">".__('Apply')."</button> ";
- print "<button dojoType='dijit.form.Button' class='alt-primary'
- onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save and reload')."</button> ";
- print "<button dojoType='dijit.form.Button'
- onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
- print "</footer>";*/
-
}
function editPrefProfiles() {
@@ -1220,9 +1197,9 @@ class Pref_Prefs extends Handler_Protected {
WHERE owner_uid = ? ORDER BY title");
$sth->execute([$_SESSION['uid']]);
- print "<div class='panel panel-scrollable'>";
+ print "<form onsubmit='return false'>";
- print "<form id='profile_edit_form' onsubmit='return false'>";
+ print "<div class='panel panel-scrollable'>";
print "<table width='100%' id='pref-profiles-list'>";
@@ -1277,18 +1254,19 @@ class Pref_Prefs extends Handler_Protected {
}
print "</table>";
- print "</form>";
print "</div>";
print "<footer>
- <button style='float : left' class='alt-danger' dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('profileEditDlg').removeSelected()\">".
- __('Remove selected profiles')."</button>
- <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"dijit.byId('profileEditDlg').activateProfile()\">".
- __('Activate profile')."</button>
- <button dojoType='dijit.form.Button' onclick=\"dijit.byId('profileEditDlg').hide()\">".
- __('Cancel')."</button>";
+ <button style='float : left' class='alt-danger' dojoType='dijit.form.Button' onclick='App.dialogOf(this).removeSelected()'>".
+ __('Remove selected profiles')."</button>
+ <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick='App.dialogOf(this).execute()'>".
+ __('Activate profile')."</button>
+ <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
+ __('Cancel')."</button>";
print "</footer>";
+ print "</form>";
+
}
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 '</div>';
print "<footer>
- <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick=\"dijit.byId('userEditDlg').execute()\">".
+ <button dojoType='dijit.form.Button' class='alt-primary' type='submit' onclick='App.dialogOf(this).execute()'>".
__('Save')."</button>
- <button dojoType='dijit.form.Button' onclick=\"dijit.byId('userEditDlg').hide()\">".
+ <button dojoType='dijit.form.Button' onclick='App.dialogOf(this).hide()'>".
__('Cancel')."</button>
</footer>";
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: `
+ <div>
+ <img id='prefFilterLoadingIndicator' src='images/indicator_tiny.gif'>&nbsp;
+ <span id='prefFilterProgressMsg'>Looking for articles...</span>
+ </div>
+
+ <ul class='panel panel-scrollable list list-unstyled' id='prefFilterTestResultList'></ul>
+
+ <footer class='text-center'>
+ <button dojoType='dijit.form.Button' onclick="dijit.byId('filterTestDlg').hide()"><?php echo __('Close this window') ?></button>
+ </footer>
+ `
});
- 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