parentNode : dojo.byId('acq_vl:' + widg.key)
}).build(function(dijit) {
widg.dijit = dijit;
+ self.attachOnChange(widg);
});
} else { // bools
widg.dijit = dijit.byId('acq_vl:' + widg.key);
+ self.attachOnChange(widg);
}
}
);
this.loaded = true;
}
+ this.attachOnChange = function(widg) {
+ var self = this;
+ var qInputChange;
+
+ var qSelChange = function(val) {
+ // user selected a queue from the selector; clear the text input
+ // and set the item import profile already defined for the queue
+
+ var qInput = self.getDijit('queue_name');
+ var matchSetSelector = self.getDijit('match_set');
+ var qSelector = self.getDijit('existing_queue');
+
+ if(val) {
+ qSelector.store.fetch({
+ query : {id : val+''},
+ onComplete : function(items) {
+ matchSetSelector.attr('value', items[0].match_set[0] || '');
+ matchSetSelector.attr('disabled', true);
+ }
+ });
+ } else {
+ matchSetSelector.attr('value', '');
+ matchSetSelector.attr('disabled', false);
+ }
+
+ // detach and reattach to avoid onchange firing while when we clear
+ dojo.disconnect(qInput._onchange);
+ qInput.attr('value', '');
+ qInput._onchange = dojo.connect(qInput, 'onChange', qInputChange);
+ }
+
+ qInputChange = function(val) {
+ // TODO: user may enter the name of an existing queue.
+ // Detect this and disable/update match_set accordingly
+ self.getDijit('match_set').attr('disabled', false);
+ var qSelector = self.getDijit('existing_queue');
+ dojo.disconnect(qSelector._onchange);
+ qSelector.attr('value', '');
+ qSelector._onchange = dojo.connect(qSelector, 'onChange', qSelChange);
+ }
+
+ if (widg.key == 'existing_queue') {
+ var qSelector = self.getDijit('existing_queue');
+ qSelector._onchange = dojo.connect(qSelector, 'onChange', qSelChange);
+ } else if(widg.key == 'queue_name') {
+ var qInput = self.getDijit('queue_name');
+ qInput._onchange = dojo.connect(qInput, 'onChange', qInputChange);
+ }
+ }
+
+ this.getDijit = function(key) {
+ return this.widgets.filter(
+ function(w) {return (w.key == key)}
+ )[0].dijit;
+ }
+
this.values = function() {
var values = {};
dojo.forEach(this.widgets,