Browse Source

filter edit dialog: load rule editor via XHR

Andrew Dolgov 6 months ago
parent
commit
4f62f5f3f1
1 changed files with 9 additions and 4 deletions
  1. 9 4
      js/CommonFilters.js

+ 9 - 4
js/CommonFilters.js

@@ -143,9 +143,6 @@ define(["dojo/_base/declare"], function (declare) {
 			if (dijit.byId("filterNewRuleDlg"))
 				dijit.byId("filterNewRuleDlg").destroyRecursive();
 
-			const query = "backend.php?op=pref-filters&method=newrule&rule=" +
-				encodeURIComponent(ruleStr);
-
 			const rule_dlg = new dijit.Dialog({
 				id: "filterNewRuleDlg",
 				title: ruleStr ? __("Edit rule") : __("Add rule"),
@@ -156,7 +153,15 @@ define(["dojo/_base/declare"], function (declare) {
 						this.hide();
 					}
 				},
-				href: query
+				content: __('Loading, please wait...'),
+			});
+
+			const tmph = dojo.connect(rule_dlg, "onShow", null, function (e) {
+				dojo.disconnect(tmph);
+
+				xhrPost("backend.php", {op: 'pref-filters', method: 'newrule', rule: ruleStr}, (transport) => {
+					rule_dlg.attr('content', transport.responseText);
+				});
 			});
 
 			rule_dlg.show();