diff options
author | Christophe.Boulain <> | 2009-02-21 16:05:01 +0000 |
---|---|---|
committer | Christophe.Boulain <> | 2009-02-21 16:05:01 +0000 |
commit | 8df351ed171f896b5780e3e9b3b4afa891fd18a4 (patch) | |
tree | 77245f9044945330e9f914b006c8d41dc15251c1 /framework/Web/Javascripts | |
parent | ddbf7c7ae0eeb933d7c1bbe8adc29a2a2825e88a (diff) |
Fixed Issue #115
Diffstat (limited to 'framework/Web/Javascripts')
11 files changed, 502 insertions, 477 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js index d5cae7b8..5402c4e7 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js @@ -1,387 +1,391 @@ -/** - * Generic postback control. - */ -Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl, -{ - onPostBack : function(event, options) - { - var request = new Prado.CallbackRequest(options.EventTarget, options); - request.dispatch(); - Event.stop(event); - } -}); - -/** - * TActiveButton control. - */ -Prado.WebUI.TActiveButton = Class.extend(Prado.WebUI.CallbackControl); -/** - * TActiveLinkButton control. - */ -Prado.WebUI.TActiveLinkButton = Class.extend(Prado.WebUI.CallbackControl); - -Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton, -{ - onPostBack : function(event, options) - { - this.addXYInput(event,options); - var request = new Prado.CallbackRequest(options.EventTarget, options); - request.dispatch(); - Event.stop(event); - this.removeXYInput(event,options); - } -}); -/** - * Active check box. - */ -Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl, -{ - onPostBack : function(event, options) - { - var request = new Prado.CallbackRequest(options.EventTarget, options); - if(request.dispatch()==false) - Event.stop(event); - } -}); - -/** - * TActiveRadioButton control. - */ -Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox); - - -Prado.WebUI.TActiveCheckBoxList = Base.extend( -{ - constructor : function(options) - { - for(var i = 0; i<options.ItemCount; i++) - { - var checkBoxOptions = Object.extend( - { - ID : options.ListID+"_c"+i, - EventTarget : options.ListName+"$c"+i - }, options); - new Prado.WebUI.TActiveCheckBox(checkBoxOptions); - } - } -}); - -Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList; - -/** - * TActiveTextBox control, handles onchange event. - */ -Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox, -{ - onInit : function(options) - { - this.options=options; - if(options['TextMode'] != 'MultiLine') - Event.observe(this.element, "keydown", this.handleReturnKey.bind(this)); - if(this.options['AutoPostBack']==true) - Event.observe(this.element, "change", this.doCallback.bindEvent(this,options)); - }, - - doCallback : function(event, options) - { - var request = new Prado.CallbackRequest(options.EventTarget, options); - request.dispatch(); - if (!Prototype.Browser.IE) - Event.stop(event); - } -}); - -/** - * TAutoComplete control. - */ -Prado.WebUI.TAutoComplete = Class.extend(Autocompleter.Base, Prado.WebUI.TActiveTextBox.prototype); -Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete, -{ - initialize : function(options) - { - this.options = options; - this.hasResults = false; - this.baseInitialize(options.ID, options.ResultPanel, options); - Object.extend(this.options, - { - onSuccess : this.onComplete.bind(this) - }); - - if(options.AutoPostBack) - this.onInit(options); - }, - - doCallback : function(event, options) - { - if(!this.active) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, options); - request.dispatch(); - Event.stop(event); - } - }, - - //Overrides parent implementation, fires onchange event. - onClick: function(event) - { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - Event.fireEvent(this.element, "change"); - }, - - getUpdatedChoices : function() - { - var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__"); - Prado.Callback(this.options.EventTarget, options, null, this.options); - }, - - /** - * Overrides parent implements, don't update if no results. - */ - selectEntry: function() - { - if(this.hasResults) - { - this.active = false; - this.updateElement(this.getCurrentEntry()); - var options = [this.index, "__TAutoComplete_onSuggestionSelected__"]; - Prado.Callback(this.options.EventTarget, options, null, this.options); - } - }, - - onComplete : function(request, boundary) - { - var result = Prado.Element.extractContent(request.transport.responseText, boundary); - if(typeof(result) == "string") - { - if(result.length > 0) - { - this.hasResults = true; - this.updateChoices(result); - } - else - { - this.active = false; - this.hasResults = false; - this.hide(); - } - } - } -}); - -/** - * Time Triggered Callback class. - */ -Prado.WebUI.TTimeTriggeredCallback = Base.extend( -{ - constructor : function(options) - { - this.options = Object.extend({ Interval : 1 }, options || {}); - Prado.WebUI.TTimeTriggeredCallback.register(this); - }, - - startTimer : function() - { - setTimeout(this.onTimerEvent.bind(this), 100); - if(typeof(this.timer) == 'undefined' || this.timer == null) - this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000); - }, - - stopTimer : function() - { - if(typeof(this.timer) != 'undefined') - { - clearInterval(this.timer); - this.timer = null; - } - }, - - resetTimer : function() - { - if(typeof(this.timer) != 'undefined') - { - clearInterval(this.timer); - this.timer = null; - this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000); - } - }, - - onTimerEvent : function() - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - request.dispatch(); - }, - - setInterval : function(value) - { - if (this.options.Interval != value){ - this.options.Interval = value; - this.resetTimer(); - } - } -}, -//class methods -{ - timers : {}, - - register : function(timer) - { - Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer; - }, - - start : function(id) - { - if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) - Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer(); - }, - - stop : function(id) - { - if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) - Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer(); - }, - - setInterval : function (id,value) - { - if(Prado.WebUI.TTimeTriggeredCallback.timers[id]) - Prado.WebUI.TTimeTriggeredCallback.timers[id].setInterval(value); - } -}); - -Prado.WebUI.ActiveListControl = Base.extend( -{ - constructor : function(options) - { - this.element = $(options.ID); - if(this.element) - { - this.options = options; - Event.observe(this.element, "change", this.doCallback.bind(this)); - } - }, - - doCallback : function(event) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - request.dispatch(); - Event.stop(event); - } -}); - -Prado.WebUI.TActiveDropDownList = Prado.WebUI.ActiveListControl; -Prado.WebUI.TActiveListBox = Prado.WebUI.ActiveListControl; - -/** - * Observe event of a particular control to trigger a callback request. - */ -Prado.WebUI.TEventTriggeredCallback = Base.extend( -{ - constructor : function(options) - { - this.options = options; - var element = $(options['ControlID']); - if(element) - Event.observe(element, this.getEventName(element), this.doCallback.bind(this)); - }, - - getEventName : function(element) - { - var name = this.options.EventName; - if(typeof(name) == "undefined" && element.type) - { - switch (element.type.toLowerCase()) - { - case 'password': - case 'text': - case 'textarea': - case 'select-one': - case 'select-multiple': - return 'change'; - } - } - return typeof(name) == "undefined" || name == "undefined" ? 'click' : name; - }, - - doCallback : function(event) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - request.dispatch(); - if(this.options.StopEvent == true) - Event.stop(event); - } -}); - -/** - * Observe changes to a property of a particular control to trigger a callback. - */ -Prado.WebUI.TValueTriggeredCallback = Base.extend( -{ - count : 1, - - observing : true, - - constructor : function(options) - { - this.options = options; - this.options.PropertyName = this.options.PropertyName || 'value'; - var element = $(options['ControlID']); - this.value = element ? element[this.options.PropertyName] : undefined; - Prado.WebUI.TValueTriggeredCallback.register(this); - this.startObserving(); - }, - - stopObserving : function() - { - clearTimeout(this.timer); - this.observing = false; - }, - - startObserving : function() - { - this.timer = setTimeout(this.checkChanges.bind(this), this.options.Interval*1000); - }, - - checkChanges : function() - { - var element = $(this.options.ControlID); - if(element) - { - var value = element[this.options.PropertyName]; - if(this.value != value) - { - this.doCallback(this.value, value); - this.value = value; - this.count=1; - } - else - this.count = this.count + this.options.Decay; - if(this.observing) - this.time = setTimeout(this.checkChanges.bind(this), - parseInt(this.options.Interval*1000*this.count)); - } - }, - - doCallback : function(oldValue, newValue) - { - var request = new Prado.CallbackRequest(this.options.EventTarget, this.options); - var param = {'OldValue' : oldValue, 'NewValue' : newValue}; - request.setCallbackParameter(param); - request.dispatch(); - } -}, -//class methods -{ - timers : {}, - - register : function(timer) - { - Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer; - }, - - stop : function(id) - { - Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving(); - } -}); +/**
+ * Generic postback control.
+ */
+Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl,
+{
+ onPostBack : function(event, options)
+ {
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ request.dispatch();
+ Event.stop(event);
+ }
+});
+
+/**
+ * TActiveButton control.
+ */
+Prado.WebUI.TActiveButton = Class.extend(Prado.WebUI.CallbackControl);
+/**
+ * TActiveLinkButton control.
+ */
+Prado.WebUI.TActiveLinkButton = Class.extend(Prado.WebUI.CallbackControl);
+
+Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton,
+{
+ onPostBack : function(event, options)
+ {
+ this.addXYInput(event,options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ request.dispatch();
+ Event.stop(event);
+ this.removeXYInput(event,options);
+ }
+});
+/**
+ * Active check box.
+ */
+Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl,
+{
+ onPostBack : function(event, options)
+ {
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ if(request.dispatch()==false)
+ Event.stop(event);
+ }
+});
+
+/**
+ * TActiveRadioButton control.
+ */
+Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox);
+
+
+Prado.WebUI.TActiveCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ Prado.Registry.set(options.ListID, this);
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var checkBoxOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TActiveCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList;
+
+/**
+ * TActiveTextBox control, handles onchange event.
+ */
+Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox,
+{
+ onInit : function(options)
+ {
+ this.options=options;
+ if(options['TextMode'] != 'MultiLine')
+ Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
+ },
+
+ doCallback : function(event, options)
+ {
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ request.dispatch();
+ if (!Prototype.Browser.IE)
+ Event.stop(event);
+ }
+});
+
+/**
+ * TAutoComplete control.
+ */
+Prado.WebUI.TAutoComplete = Class.extend(Autocompleter.Base, Prado.WebUI.TActiveTextBox.prototype);
+Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
+{
+ initialize : function(options)
+ {
+ this.options = options;
+ this.hasResults = false;
+ this.baseInitialize(options.ID, options.ResultPanel, options);
+ Object.extend(this.options,
+ {
+ onSuccess : this.onComplete.bind(this)
+ });
+
+ if(options.AutoPostBack)
+ this.onInit(options);
+ },
+
+ doCallback : function(event, options)
+ {
+ if(!this.active)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, options);
+ request.dispatch();
+ Event.stop(event);
+ }
+ },
+
+ //Overrides parent implementation, fires onchange event.
+ onClick: function(event)
+ {
+ var element = Event.findElement(event, 'LI');
+ this.index = element.autocompleteIndex;
+ this.selectEntry();
+ this.hide();
+ Event.fireEvent(this.element, "change");
+ },
+
+ getUpdatedChoices : function()
+ {
+ var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ },
+
+ /**
+ * Overrides parent implements, don't update if no results.
+ */
+ selectEntry: function()
+ {
+ if(this.hasResults)
+ {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ var options = [this.index, "__TAutoComplete_onSuggestionSelected__"];
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ }
+ },
+
+ onComplete : function(request, boundary)
+ {
+ var result = Prado.Element.extractContent(request.transport.responseText, boundary);
+ if(typeof(result) == "string")
+ {
+ if(result.length > 0)
+ {
+ this.hasResults = true;
+ this.updateChoices(result);
+ }
+ else
+ {
+ this.active = false;
+ this.hasResults = false;
+ this.hide();
+ }
+ }
+ }
+});
+
+/**
+ * Time Triggered Callback class.
+ */
+Prado.WebUI.TTimeTriggeredCallback = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = Object.extend({ Interval : 1 }, options || {});
+ Prado.WebUI.TTimeTriggeredCallback.register(this);
+ Prado.Registry.set(options.ID, this);
+ },
+
+ startTimer : function()
+ {
+ setTimeout(this.onTimerEvent.bind(this), 100);
+ if(typeof(this.timer) == 'undefined' || this.timer == null)
+ this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
+ },
+
+ stopTimer : function()
+ {
+ if(typeof(this.timer) != 'undefined')
+ {
+ clearInterval(this.timer);
+ this.timer = null;
+ }
+ },
+
+ resetTimer : function()
+ {
+ if(typeof(this.timer) != 'undefined')
+ {
+ clearInterval(this.timer);
+ this.timer = null;
+ this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
+ }
+ },
+
+ onTimerEvent : function()
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.dispatch();
+ },
+
+ setInterval : function(value)
+ {
+ if (this.options.Interval != value){
+ this.options.Interval = value;
+ this.resetTimer();
+ }
+ }
+},
+//class methods
+{
+ timers : {},
+
+ register : function(timer)
+ {
+ Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer;
+ },
+
+ start : function(id)
+ {
+ if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();
+ },
+
+ stop : function(id)
+ {
+ if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();
+ },
+
+ setInterval : function (id,value)
+ {
+ if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].setInterval(value);
+ }
+});
+
+Prado.WebUI.ActiveListControl = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.element = $(options.ID);
+ Prado.Registry.set(options.ID, this);
+ if(this.element)
+ {
+ this.options = options;
+ Event.observe(this.element, "change", this.doCallback.bind(this));
+ }
+ },
+
+ doCallback : function(event)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.dispatch();
+ Event.stop(event);
+ }
+});
+
+Prado.WebUI.TActiveDropDownList = Prado.WebUI.ActiveListControl;
+Prado.WebUI.TActiveListBox = Prado.WebUI.ActiveListControl;
+
+/**
+ * Observe event of a particular control to trigger a callback request.
+ */
+Prado.WebUI.TEventTriggeredCallback = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = options;
+ var element = $(options['ControlID']);
+ if(element)
+ Event.observe(element, this.getEventName(element), this.doCallback.bind(this));
+ },
+
+ getEventName : function(element)
+ {
+ var name = this.options.EventName;
+ if(typeof(name) == "undefined" && element.type)
+ {
+ switch (element.type.toLowerCase())
+ {
+ case 'password':
+ case 'text':
+ case 'textarea':
+ case 'select-one':
+ case 'select-multiple':
+ return 'change';
+ }
+ }
+ return typeof(name) == "undefined" || name == "undefined" ? 'click' : name;
+ },
+
+ doCallback : function(event)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.dispatch();
+ if(this.options.StopEvent == true)
+ Event.stop(event);
+ }
+});
+
+/**
+ * Observe changes to a property of a particular control to trigger a callback.
+ */
+Prado.WebUI.TValueTriggeredCallback = Base.extend(
+{
+ count : 1,
+
+ observing : true,
+
+ constructor : function(options)
+ {
+ this.options = options;
+ this.options.PropertyName = this.options.PropertyName || 'value';
+ var element = $(options['ControlID']);
+ this.value = element ? element[this.options.PropertyName] : undefined;
+ Prado.WebUI.TValueTriggeredCallback.register(this);
+ Prado.Registry.set(options.ID, this);
+ this.startObserving();
+ },
+
+ stopObserving : function()
+ {
+ clearTimeout(this.timer);
+ this.observing = false;
+ },
+
+ startObserving : function()
+ {
+ this.timer = setTimeout(this.checkChanges.bind(this), this.options.Interval*1000);
+ },
+
+ checkChanges : function()
+ {
+ var element = $(this.options.ControlID);
+ if(element)
+ {
+ var value = element[this.options.PropertyName];
+ if(this.value != value)
+ {
+ this.doCallback(this.value, value);
+ this.value = value;
+ this.count=1;
+ }
+ else
+ this.count = this.count + this.options.Decay;
+ if(this.observing)
+ this.time = setTimeout(this.checkChanges.bind(this),
+ parseInt(this.options.Interval*1000*this.count));
+ }
+ },
+
+ doCallback : function(oldValue, newValue)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var param = {'OldValue' : oldValue, 'NewValue' : newValue};
+ request.setCallbackParameter(param);
+ request.dispatch();
+ }
+},
+//class methods
+{
+ timers : {},
+
+ register : function(timer)
+ {
+ Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer;
+ },
+
+ stop : function(id)
+ {
+ Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();
+ }
+});
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js index 0b42afd5..fab7808f 100755 --- a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js @@ -1,24 +1,25 @@ -/** - * DropContainer control - */ - -Prado.WebUI.DropContainer = Class.extend(Prado.WebUI.CallbackControl); - -Object.extend(Prado.WebUI.DropContainer.prototype, -{ - initialize: function(options) - { - this.options = options; - Object.extend (this.options, - { - onDrop: this.onDrop.bind(this) - }); - - Droppables.add (options.ID, this.options); - }, - - onDrop: function(dragElement, dropElement) - { - Prado.Callback(this.options.EventTarget, dragElement.id, null, this.options); - } -}); +/**
+ * DropContainer control
+ */
+
+Prado.WebUI.DropContainer = Class.extend(Prado.WebUI.CallbackControl);
+
+Object.extend(Prado.WebUI.DropContainer.prototype,
+{
+ initialize: function(options)
+ {
+ this.options = options;
+ Object.extend (this.options,
+ {
+ onDrop: this.onDrop.bind(this)
+ });
+
+ Droppables.add (options.ID, this.options);
+ Prado.Registry.set(options.ID, this);
+ },
+
+ onDrop: function(dragElement, dropElement)
+ {
+ Prado.Callback(this.options.EventTarget, dragElement.id, null, this.options);
+ }
+});
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js index 9f57f912..faaab19a 100755 --- a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js +++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js @@ -1,63 +1,65 @@ -Prado.WebUI.TActiveFileUpload = Base.extend( -{ - constructor : function(options) - { - this.options = options || {}; - Prado.WebUI.TActiveFileUpload.register(this); - - this.input = $(options.inputID); - this.flag = $(options.flagID); - this.form = $(options.formID); - - this.indicator = $(options.indicatorID); - this.complete = $(options.completeID); - this.error = $(options.errorID); - - // set up events - Event.observe(this.input,"change",this.fileChanged.bind(this)); - }, - - fileChanged:function(){ - // show the upload indicator, and hide the complete and error indicators (if they areSn't already). - this.flag.value = '1'; - this.complete.style.display = 'none'; - this.error.style.display = 'none'; - this.indicator.style.display = ''; - - // set the form to submit in the iframe, submit it, and then reset it. - this.oldtargetID = this.form.target; - this.form.target = this.options.targetID; - this.form.submit(); - this.form.target = this.oldtargetID; - }, - - finishUpload:function(options){ - // hide the display indicator. - this.flag.value = ''; - this.indicator.style.display = 'none'; - if (this.options.targetID == options.targetID){ - // show the complete indicator. - if (options.errorCode == 0){ - this.complete.style.display = ''; - this.input.value = ''; - } else { - this.error.style.display = ''; - } - Prado.Callback(this.options.EventTarget, options, null, this.options); - } - } -}, -{ -// class methods - controls : {}, - - register : function(control) - { - Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control; - }, - - onFileUpload: function(options) - { - Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options); - } -});
\ No newline at end of file +Prado.WebUI.TActiveFileUpload = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = options || {};
+ Prado.WebUI.TActiveFileUpload.register(this);
+
+ this.input = $(options.inputID);
+ this.flag = $(options.flagID);
+ this.form = $(options.formID);
+
+ this.indicator = $(options.indicatorID);
+ this.complete = $(options.completeID);
+ this.error = $(options.errorID);
+
+ Prado.Registry.set(options.inputID, this);
+
+ // set up events
+ Event.observe(this.input,"change",this.fileChanged.bind(this));
+ },
+
+ fileChanged:function(){
+ // show the upload indicator, and hide the complete and error indicators (if they areSn't already).
+ this.flag.value = '1';
+ this.complete.style.display = 'none';
+ this.error.style.display = 'none';
+ this.indicator.style.display = '';
+
+ // set the form to submit in the iframe, submit it, and then reset it.
+ this.oldtargetID = this.form.target;
+ this.form.target = this.options.targetID;
+ this.form.submit();
+ this.form.target = this.oldtargetID;
+ },
+
+ finishUpload:function(options){
+ // hide the display indicator.
+ this.flag.value = '';
+ this.indicator.style.display = 'none';
+ if (this.options.targetID == options.targetID){
+ // show the complete indicator.
+ if (options.errorCode == 0){
+ this.complete.style.display = '';
+ this.input.value = '';
+ } else {
+ this.error.style.display = '';
+ }
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ }
+ }
+},
+{
+// class methods
+ controls : {},
+
+ register : function(control)
+ {
+ Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control;
+ },
+
+ onFileUpload: function(options)
+ {
+ Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options);
+ }
+});
diff --git a/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js b/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js index 66a79922..fd361469 100644 --- a/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js +++ b/framework/Web/Javascripts/source/prado/colorpicker/colorpicker.js @@ -297,6 +297,8 @@ Object.extend(Prado.WebUI.TColorPicker.prototype, if(options['ShowColorPicker'])
Event.observe(this.button, "click", this._buttonOnClick);
Event.observe(this.input, "change", this.updatePicker.bind(this));
+
+ Prado.Registry.set(options.ID, this);
},
updatePicker : function(e)
diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js index dac7a0c0..463b95a7 100644 --- a/framework/Web/Javascripts/source/prado/controls/controls.js +++ b/framework/Web/Javascripts/source/prado/controls/controls.js @@ -9,6 +9,7 @@ Prado.WebUI.PostBackControl.prototype = this._elementOnClick = null, //capture the element's onclick function
this.element = $(options.ID);
+ Prado.Registry.set(options.ID, this);
if(this.element)
{
if(this.onInit)
@@ -270,6 +271,7 @@ Prado.WebUI.TCheckBoxList = Base.extend( {
constructor : function(options)
{
+ Prado.Registry.set(options.ListID, this);
for(var i = 0; i<options.ItemCount; i++)
{
var checkBoxOptions = Object.extend(
@@ -286,6 +288,7 @@ Prado.WebUI.TRadioButtonList = Base.extend( {
constructor : function(options)
{
+ Prado.Registry.set(options.ListID, this);
for(var i = 0; i<options.ItemCount; i++)
{
var radioButtonOptions = Object.extend(
diff --git a/framework/Web/Javascripts/source/prado/controls/keyboard.js b/framework/Web/Javascripts/source/prado/controls/keyboard.js index 978aedb9..b808a46c 100644 --- a/framework/Web/Javascripts/source/prado/controls/keyboard.js +++ b/framework/Web/Javascripts/source/prado/controls/keyboard.js @@ -5,6 +5,7 @@ Prado.WebUI.TKeyboard.prototype = {
this.element = $(options.ID);
this.onInit(options);
+ Prado.Registry.set(options.ID, this);
},
onInit : function(options)
@@ -165,4 +166,4 @@ Prado.WebUI.TKeyboard.prototype = this.forControl.selectionEnd = selectStart + value.length;
}
}
-};
\ No newline at end of file +};
diff --git a/framework/Web/Javascripts/source/prado/controls/tabpanel.js b/framework/Web/Javascripts/source/prado/controls/tabpanel.js index 8033a2ee..c46a5fea 100644 --- a/framework/Web/Javascripts/source/prado/controls/tabpanel.js +++ b/framework/Web/Javascripts/source/prado/controls/tabpanel.js @@ -5,6 +5,7 @@ Prado.WebUI.TTabPanel.prototype = {
this.element = $(options.ID);
this.onInit(options);
+ Prado.Registry.set(options.ID, this);
},
onInit : function(options)
@@ -47,4 +48,4 @@ Prado.WebUI.TTabPanel.prototype = }
}
}
-};
\ No newline at end of file +};
diff --git a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js index a16cc3d6..9236c32e 100644 --- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js +++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js @@ -68,6 +68,8 @@ Prado.WebUI.TDatePicker.prototype = this.minimalDaysInFirstWeek = 4;
this.selectedDate = this.newDate();
this.positionMode = 'Bottom';
+
+ Prado.Registry.set(options.ID, this);
//which element to trigger to show the calendar
if(this.options.Trigger)
@@ -760,4 +762,4 @@ Prado.WebUI.TDatePicker.prototype = }
}
-};
\ No newline at end of file +};
diff --git a/framework/Web/Javascripts/source/prado/prado.js b/framework/Web/Javascripts/source/prado/prado.js index ae96bb6d..9db01b42 100644 --- a/framework/Web/Javascripts/source/prado/prado.js +++ b/framework/Web/Javascripts/source/prado/prado.js @@ -9,6 +9,12 @@ var Prado = * @var Version
*/
Version: '3.1',
+
+ /**
+ * Registry for Prado components
+ * @var Registry
+ */
+ Registry: $H(),
/**
* Returns browser information.
diff --git a/framework/Web/Javascripts/source/prado/ratings/ratings.js b/framework/Web/Javascripts/source/prado/ratings/ratings.js index 8af32bb9..c7322983 100644 --- a/framework/Web/Javascripts/source/prado/ratings/ratings.js +++ b/framework/Web/Javascripts/source/prado/ratings/ratings.js @@ -14,6 +14,7 @@ Prado.WebUI.TRatingList = Base.extend( Prado.WebUI.TRatingList.register(this);
this._init();
+ Prado.Registry.set(options.ListID, this);
this.selectedIndex = options.SelectedIndex;
this.rating = options.Rating;
this.readOnly = options.ReadOnly
diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index a3b803d8..9db1e7d6 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -545,6 +545,7 @@ Prado.WebUI.TValidationSummary.prototype = * @var {element} messages
*/
this.messages = $(options.ID);
+ Prado.Registry.set(options.ID, this);
if(this.messages)
{
/**
@@ -831,6 +832,7 @@ Prado.WebUI.TBaseValidator.prototype = * @var {element} message
*/
this.message = $(options.ID);
+ Prado.Registry.set(options.ID, this);
if(this.control && this.message)
{
this.group = options.ValidationGroup;
|