From 91496a0d24d58621503ae86ee217b0ce27d256f2 Mon Sep 17 00:00:00 2001 From: wn_ Date: Mon, 6 Jan 2025 00:25:56 +0000 Subject: Add the ability to copy an existing filter. --- js/PrefFilterTree.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'js') diff --git a/js/PrefFilterTree.js b/js/PrefFilterTree.js index 4ccddfa75..10c4d7de3 100644 --- a/js/PrefFilterTree.js +++ b/js/PrefFilterTree.js @@ -165,6 +165,28 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio alert(__("No filters selected.")); } + return false; + }, + copySelectedFilters: function() { + const sel_rows = this.getSelectedFilters(); + + if (sel_rows.length > 0) { + if (confirm(__("Copy selected filters?"))) { + Notify.progress("Copying selected filters..."); + + const query = { + op: "Pref_Filters", method: "copy", + ids: sel_rows.toString() + }; + + xhr.post("backend.php", query, () => { + this.reload(); + }); + } + } else { + alert(__("No filters selected.")); + } + return false; }, }); -- cgit v1.2.3-54-g00ecf