diff options
author | Andrew Dolgov <[email protected]> | 2010-11-20 12:53:02 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-20 12:53:02 +0300 |
commit | 48b05a29860da1b2181689bc93622ca6f89d87ab (patch) | |
tree | 199071d44ff5173664d42bb32e1c471b3724ec99 /prefs.js | |
parent | 1a709d21d57bd8bc905c02caa62379f547214e64 (diff) |
rework label editor to use dijit.form validation
Diffstat (limited to 'prefs.js')
-rw-r--r-- | prefs.js | 37 |
1 files changed, 30 insertions, 7 deletions
@@ -1100,6 +1100,7 @@ function init() { dojo.require("dijit.Dialog"); dojo.require("dijit.form.Button"); dojo.require("dijit.form.TextBox"); + dojo.require("dijit.form.ValidationTextBox"); dojo.require("dijit.form.RadioButton"); dojo.require("dijit.form.Select"); dojo.require("dijit.Toolbar"); @@ -1956,16 +1957,38 @@ function editCat(id, item, event) { function editLabel(id, event) { try { - var query = "?op=pref-labels&subop=edit&id=" + + var query = "backend.php?op=pref-labels&subop=edit&id=" + param_escape(id); - notify_progress("Loading, please wait...", true); + if (dijit.byId("labelEditDlg")) + dijit.byId("labelEditDlg").destroyRecursive(); + + dialog = new dijit.Dialog({ + id: "labelEditDlg", + title: __("Label Editor"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + var caption = this.attr('value').id; + var caption = this.attr('value').caption; + var fg_color = this.attr('value').fg_color; + var bg_color = this.attr('value').bg_color; + var query = dojo.objectToQuery(this.attr('value')); + + dijit.byId('labelTree').setNameById(id, caption); + setLabelColor(id, fg_color, bg_color); + this.hide(); + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + updateFilterList(); + } }); + } + }, + href: query}); - new Ajax.Request("backend.php", { - parameters: query, - onComplete: function(transport) { - infobox_callback2(transport); - } }); + dialog.show(); } catch (e) { exception_error("editLabel", e); |