summaryrefslogtreecommitdiff
path: root/js/PrefLabelTree.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-02 12:03:28 +0300
committerAndrew Dolgov <[email protected]>2018-12-02 12:03:28 +0300
commitf26d404890a55a34ed5779b6f36e949d38705e8d (patch)
tree8578175725bce862828739b80f9ac18de767b7ce /js/PrefLabelTree.js
parent60cd4676943169a057518634e3060745e9112511 (diff)
prefs: move other tree-related functions to respective trees
Diffstat (limited to 'js/PrefLabelTree.js')
-rw-r--r--js/PrefLabelTree.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/js/PrefLabelTree.js b/js/PrefLabelTree.js
index e5eb595e5..ba052eb07 100644
--- a/js/PrefLabelTree.js
+++ b/js/PrefLabelTree.js
@@ -48,6 +48,69 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
return rv;
},
+ editLabel: function(id) {
+ const query = "backend.php?op=pref-labels&method=edit&id=" +
+ param_escape(id);
+
+ if (dijit.byId("labelEditDlg"))
+ dijit.byId("labelEditDlg").destroyRecursive();
+
+ const dialog = new dijit.Dialog({
+ id: "labelEditDlg",
+ title: __("Label Editor"),
+ style: "width: 600px",
+ setLabelColor: function (id, fg, bg) {
+
+ let kind = '';
+ let color = '';
+
+ if (fg && bg) {
+ kind = 'both';
+ } else if (fg) {
+ kind = 'fg';
+ color = fg;
+ } else if (bg) {
+ kind = 'bg';
+ color = bg;
+ }
+
+ const e = $("LICID-" + id);
+
+ if (e) {
+ if (fg) e.style.color = fg;
+ if (bg) e.style.backgroundColor = bg;
+ }
+
+ const query = {
+ op: "pref-labels", method: "colorset", kind: kind,
+ ids: id, fg: fg, bg: bg, color: color
+ };
+
+ xhrPost("backend.php", query, () => {
+ updateFilterList(); // maybe there's labels in there
+ });
+
+ },
+ execute: function () {
+ if (this.validate()) {
+ const caption = this.attr('value').caption;
+ const fg_color = this.attr('value').fg_color;
+ const bg_color = this.attr('value').bg_color;
+
+ dijit.byId('labelTree').setNameById(id, caption);
+ this.setLabelColor(id, fg_color, bg_color);
+ this.hide();
+
+ xhrPost("backend.php", this.attr('value'), () => {
+ updateFilterList(); // maybe there's labels in there
+ });
+ }
+ },
+ href: query
+ });
+
+ dialog.show();
+ },
resetColors: function() {
const labels = this.getSelectedLabels();