diff options
| author | christophe.boulain <> | 2008-12-03 14:22:03 +0000 | 
|---|---|---|
| committer | christophe.boulain <> | 2008-12-03 14:22:03 +0000 | 
| commit | 6228873cf9d6471463d2413e7dfd7447f759baf2 (patch) | |
| tree | 496a0e658330c39d4caa35602ba9f783b6f24f9c /framework/Web/Javascripts | |
| parent | e8f239fea7351b248302a593a8e5eaa2a88c3e80 (diff) | |
Merge from trunk
Diffstat (limited to 'framework/Web/Javascripts')
19 files changed, 794 insertions, 686 deletions
| diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php index 511515c8..9c4741a4 100644 --- a/framework/Web/Javascripts/TJavaScript.php +++ b/framework/Web/Javascripts/TJavaScript.php @@ -227,4 +227,3 @@ class TJavaScript  	}
  }
 -?> diff --git a/framework/Web/Javascripts/source/packages.php b/framework/Web/Javascripts/source/packages.php index 1cca7b7c..d6c04e7f 100644 --- a/framework/Web/Javascripts/source/packages.php +++ b/framework/Web/Javascripts/source/packages.php @@ -47,7 +47,8 @@ $packages = array(  	),
  	'dragdrop'=>array(
 -		SCRIPTACULOUS_DIR.'/dragdrop.js'
 +		SCRIPTACULOUS_DIR.'/dragdrop.js', +		'prado/activecontrols/dragdrop.js'
  	),
  	'slider'=>array(
 @@ -60,6 +61,14 @@ $packages = array(  	'tabpanel'=>array(
  		'prado/controls/tabpanel.js'
 +	), +	 +	'activedatepicker' => array( +		'prado/activecontrols/activedatepicker.js' +	), +	 +	'activefileupload' => array( +		'prado/activefileupload/activefileupload.js'  	),
  );
 @@ -67,19 +76,20 @@ $packages = array(  //package names and their dependencies
  $dependencies = array(
 -		'prado'			=> array('prado'),
 -		'effects'		=> array('prado', 'effects'),
 -		'validator'		=> array('prado', 'validator'),
 -		'logger'		=> array('prado', 'logger'),
 -		'datepicker'	=> array('prado', 'datepicker'),
 -		'colorpicker'	=> array('prado', 'colorpicker'),
 -		'ajax'			=> array('prado', 'effects', 'ajax'),
 -		'dragdrop'		=> array('prado', 'effects', 'dragdrop'),
 -		'slider'		=> array('prado', 'slider'),
 -		'keyboard'		=> array('prado', 'keyboard'),
 -		'tabpanel'		=> array('prado', 'tabpanel'),
 +		'prado'				=> array('prado'),
 +		'effects'			=> array('prado', 'effects'),
 +		'validator'			=> array('prado', 'validator'),
 +		'logger'			=> array('prado', 'logger'),
 +		'datepicker'		=> array('prado', 'datepicker'),
 +		'colorpicker'		=> array('prado', 'colorpicker'),
 +		'ajax'				=> array('prado', 'effects', 'ajax'),
 +		'dragdrop'			=> array('prado', 'effects', 'ajax', 'dragdrop'),
 +		'slider'			=> array('prado', 'slider'),
 +		'keyboard'			=> array('prado', 'keyboard'),
 +		'tabpanel'			=> array('prado', 'tabpanel'), +		'activedatepicker' 	=> array('datepicker', 'ajax', 'activedatepicker'), +		'activefileupload' 	=> array('prado', 'ajax', 'activefileupload'),
  );
  return array($packages, $dependencies);
 -?> diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js index 7ee4c0e6..d5cae7b8 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js @@ -1,362 +1,387 @@ -/**
 - * 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);
 -	}
 -});
 -/**
 - * 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;
 -		}
 -	},
 -
 -	onTimerEvent : function()
 -	{
 -		var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
 -		request.dispatch();
 -	}
 -},
 -//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();
 -	}
 -});
 -
 -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) +	{ +		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(); +	} +}); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js new file mode 100755 index 00000000..87b48bf3 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js @@ -0,0 +1,79 @@ +/** + * TActiveDatePicker control + */ +Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker, +{ +	initialize : function(options) +	{ +		this.options = options || []; +		this.control = $(options.ID); +		this.dateSlot = new Array(42); +		this.weekSlot = new Array(6); +		this.minimalDaysInFirstWeek	= 4; +		this.selectedDate = this.newDate(); +		this.positionMode = 'Bottom'; + +		//which element to trigger to show the calendar +		if(this.options.Trigger) +		{ +			this.trigger = $(this.options.Trigger) ; +			var triggerEvent = this.options.TriggerEvent || "click"; +		} +		else +		{ +			this.trigger  = this.control; +			var triggerEvent = this.options.TriggerEvent || "focus"; +		} +		 +		// Popup position +		if(this.options.PositionMode == 'Top') +		{ +			this.positionMode = this.options.PositionMode; +		} + +		Object.extend(this,options); + +		Event.observe(this.trigger, triggerEvent, this.show.bindEvent(this)); +		 +		// Listen to change event  +		if(this.options.InputMode == "TextBox") +		{ +			Event.observe(this.control, "change", this.onDateChanged.bindEvent(this)); +		}  +		else +		{ +			var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); +			var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control); +			var year = Prado.WebUI.TDatePicker.getYearListControl(this.control); +			Event.observe (day, "change", this.onDateChanged.bindEvent(this)); +			Event.observe (month, "change", this.onDateChanged.bindEvent(this)); +			Event.observe (year, "change", this.onDateChanged.bindEvent(this)); +				 +		} + +	},	 +	 +	// Respond to change event on the textbox or dropdown list +	// This method raises OnDateChanged event on client side if it has been defined, +	// and raise the callback request +	onDateChanged : function () +	{ +		var date; +		if (this.options.InputMode == "TextBox") +		{ +			date=this.control.value; +		 }  +		 else +		 { +		 	var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1; +			var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control).selectedIndex; +			var year = Prado.WebUI.TDatePicker.getYearListControl(this.control).value; +			date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this); +		} +		if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date); +		 +		// Make callback request +		var request = new Prado.CallbackRequest(this.options.EventTarget,this.options); +		request.dispatch(); +	} +});  diff --git a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js new file mode 100755 index 00000000..0b42afd5 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js @@ -0,0 +1,24 @@ +/** + * 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); +	} +}); diff --git a/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js b/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js index 87b8ddde..51e3f489 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js @@ -188,7 +188,7 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(  			if(this.options.AutoHide)
  				this.showLabel();
  		}
 -		else if (Event.keyCode(e) == Event.KEY_RETURN)
 +		else if (Event.keyCode(e) == Event.KEY_RETURN && this.options.TextMode != 'MultiLine')
  			Event.stop(e);
  	},
 diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html new file mode 100755 index 00000000..44f50ce4 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html @@ -0,0 +1 @@ +<!-- Nothing here to see, move right along. -->
\ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.pngBinary files differ new file mode 100755 index 00000000..98badd7f --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.pngBinary files differ new file mode 100755 index 00000000..26c529fc --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gifBinary files differ new file mode 100755 index 00000000..085ccaec --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js new file mode 100755 index 00000000..9f57f912 --- /dev/null +++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js @@ -0,0 +1,63 @@ +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 diff --git a/framework/Web/Javascripts/source/prado/activeratings/blocks.css b/framework/Web/Javascripts/source/prado/activeratings/blocks.css deleted file mode 100644 index bb846094..00000000 --- a/framework/Web/Javascripts/source/prado/activeratings/blocks.css +++ /dev/null @@ -1,42 +0,0 @@ -.TActiveRatingList_blocks
 -{
 -	border-collapse: collapse;
 -}
 -.TActiveRatingList_blocks input, .TActiveRatingList_blocks label
 -{
 -	display: none;
 -}
 -
 -.TActiveRatingList_blocks td
 -{
 -	width: 18px;
 -	height: 9px;
 -	padding: 1px;
 -}
 -
 -.TActiveRatingList_blocks td.rating
 -{
 -	background-image: url(blocks_combined.gif);
 -	background-repeat: no-repeat;
 -	cursor: pointer;
 -	background-position: 1px 0px;
 -}
 -.TActiveRatingList_blocks td.rating_selected
 -{
 -	background-position: 1px -100px;
 -}
 -
 -.TActiveRatingList_blocks td.rating_half
 -{
 -	background-position: 1px -200px;
 -}
 -
 -.TActiveRatingList_blocks td.rating_hover
 -{
 -	background-position: 1px -300px;
 -}
 -
 -.TActiveRatingList_blocks td.rating_disabled
 -{
 -	cursor: default !important;
 -}
 diff --git a/framework/Web/Javascripts/source/prado/activeratings/default.css b/framework/Web/Javascripts/source/prado/activeratings/default.css deleted file mode 100644 index ba90eb27..00000000 --- a/framework/Web/Javascripts/source/prado/activeratings/default.css +++ /dev/null @@ -1,43 +0,0 @@ -.TActiveRatingList_default
 -{
 -	border-collapse: collapse;
 -}
 -.TActiveRatingList_default input, .TActiveRatingList_default label
 -{
 -	display: none;
 -}
 -
 -.TActiveRatingList_default td
 -{
 -	width: 18px;
 -	height: 18px;
 -	padding: 0;
 -}
 -
 -.TActiveRatingList_default td.rating
 -{
 -	background-image: url(default_combined.gif);
 -	background-repeat: no-repeat;
 -	cursor: pointer;
 -	background-position: 0px 0px;
 -}
 -
 -.TActiveRatingList_default td.rating_selected
 -{
 -	background-position: 0px -100px;
 -}
 -
 -.TActiveRatingList_default td.rating_half
 -{
 -	background-position: 0px -200px;
 -}
 -
 -.TActiveRatingList_default td.rating_hover
 -{
 -	background-position: 0px -300px;
 -}
 -
 -.TActiveRatingList_default td.rating_disabled
 -{
 -	cursor: default !important;
 -}
\ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/activeratings/ratings.js b/framework/Web/Javascripts/source/prado/activeratings/ratings.js deleted file mode 100644 index 4eeddbd8..00000000 --- a/framework/Web/Javascripts/source/prado/activeratings/ratings.js +++ /dev/null @@ -1,178 +0,0 @@ -Prado.WebUI.TActiveRatingList = Base.extend(
 -{
 -	selectedIndex : -1,
 -	rating: -1,
 -	enabled : true,
 -	readOnly : false,
 -
 -	constructor : function(options)
 -	{
 -		var cap = $(options.CaptionID);
 -		this.options = Object.extend(
 -		{
 -			caption : cap ? cap.innerHTML : ''
 -		}, options || {});
 -
 -		Prado.WebUI.TActiveRatingList.register(this);
 -		this._init();
 -		this.selectedIndex = options.SelectedIndex;
 -		this.rating = options.Rating;
 -		if(options.Rating <= 0 && options.SelectedIndex >= 0)
 -			this.rating = options.SelectedIndex+1;
 -		this.showRating(this.rating);
 -	},
 -
 -	_init: function(options)
 -	{
 -		Element.addClassName($(this.options.ListID),this.options.Style);
 -		this.radios = new Array();
 -		var index=0;
 -		for(var i = 0; i<this.options.ItemCount; i++)
 -		{
 -			var radio = $(this.options.ListID+'_c'+i);
 -			var td = radio.parentNode.parentNode;
 -			if(radio && td.tagName.toLowerCase()=='td')
 -			{
 -				this.radios.push(radio);
 -				Event.observe(td, "mouseover", this.hover.bindEvent(this,index));
 -				Event.observe(td, "mouseout", this.recover.bindEvent(this,index));
 -				Event.observe(td, "click", this.click.bindEvent(this, index));
 -				index++;
 -				Element.addClassName(td,"rating");
 -			}
 -		}
 -	},
 -
 -	hover : function(ev,index)
 -	{
 -		if(this.enabled==false) return;
 -		for(var i = 0; i<this.radios.length; i++)
 -		{
 -			var node = this.radios[i].parentNode.parentNode;
 -			var action = i <= index ? 'addClassName' : 'removeClassName'
 -			Element[action](node,"rating_hover");
 -			Element.removeClassName(node,"rating_selected");
 -			Element.removeClassName(node,"rating_half");
 -		}
 -		this.showCaption(this.getIndexCaption(index));
 -	},
 -
 -	recover : function(ev,index)
 -	{
 -		if(this.enabled==false) return;
 -		this.showRating(this.rating);
 -		this.showCaption(this.options.caption);
 -	},
 -
 -	click : function(ev, index)
 -	{
 -		if(this.enabled==false) return;
 -		for(var i = 0; i<this.radios.length; i++)
 -			this.radios[i].checked = (i == index);
 -
 -		this.selectedIndex = index;
 -		this.setRating(index+1);
 -
 -		this.dispatchRequest(ev);
 -	},
 -
 -	dispatchRequest : function(ev)
 -	{
 -		var requestOptions = Object.extend(
 -		{
 -			ID : this.options.ListID+"_c"+this.selectedIndex,
 -			EventTarget : this.options.ListName+"$c"+this.selectedIndex
 -		},this.options);
 -		var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
 -		if(request.dispatch()==false)
 -			Event.stop(ev);
 -	},
 -
 -	setRating : function(value)
 -	{
 -		this.rating = value;
 -		var base = Math.floor(value-1);
 -		var remainder = value - base-1;
 -		var halfMax = this.options.HalfRating["1"];
 -		var index = remainder > halfMax ? base+1 : base;
 -		for(var i = 0; i<this.radios.length; i++)
 -			this.radios[i].checked = (i == index);
 -
 -		var caption = this.getIndexCaption(index);
 -		this.setCaption(caption);
 -		this.showCaption(caption);
 -
 -		this.showRating(value);
 -	},
 -
 -	showRating: function(value)
 -	{
 -		var base = Math.floor(value-1);
 -		var remainder = value - base-1;
 -		var halfMin = this.options.HalfRating["0"];
 -		var halfMax = this.options.HalfRating["1"];
 -		var index = remainder > halfMax ? base+1 : base;
 -		var hasHalf = remainder >= halfMin && remainder <= halfMax;
 -		for(var i = 0; i<this.radios.length; i++)
 -		{
 -			var node = this.radios[i].parentNode.parentNode;
 -			var action = i > index ? 'removeClassName' : 'addClassName';
 -			Element[action](node, "rating_selected");
 -			if(i==index+1 && hasHalf)
 -				Element.addClassName(node, "rating_half");
 -			else
 -				Element.removeClassName(node, "rating_half");
 -			Element.removeClassName(node,"rating_hover");
 -		}
 -	},
 -
 -	getIndexCaption : function(index)
 -	{
 -		return index > -1 ? this.radios[index].value : this.options.caption;
 -	},
 -
 -	showCaption : function(value)
 -	{
 -		var caption = $(this.options.CaptionID);
 -		if(caption) caption.innerHTML = value;
 -		$(this.options.ListID).title = value;
 -	},
 -
 -	setCaption : function(value)
 -	{
 -		this.options.caption = value;
 -		this.showCaption(value);
 -	},
 -
 -	setEnabled : function(value)
 -	{
 -		this.enabled = value;
 -		for(var i = 0; i<this.radios.length; i++)
 -		{
 -			var action = value ? 'removeClassName' : 'addClassName'
 -			Element[action](this.radios[i].parentNode.parentNode, "rating_disabled");
 -		}
 -	}
 -},
 -{
 -ratings : {},
 -register : function(rating)
 -{
 -	Prado.WebUI.TActiveRatingList.ratings[rating.options.ListID] = rating;
 -},
 -
 -setEnabled : function(id,value)
 -{
 -	Prado.WebUI.TActiveRatingList.ratings[id].setEnabled(value);
 -},
 -
 -setRating : function(id,value)
 -{
 -	Prado.WebUI.TActiveRatingList.ratings[id].setRating(value);
 -},
 -
 -setCaption : function(id,value)
 -{
 -	Prado.WebUI.TActiveRatingList.ratings[id].setCaption(value);
 -}
 -});
\ No newline at end of file diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js index bea18e76..dac7a0c0 100644 --- a/framework/Web/Javascripts/source/prado/controls/controls.js +++ b/framework/Web/Javascripts/source/prado/controls/controls.js @@ -69,12 +69,9 @@ Object.extend(Prado.WebUI.TImageButton.prototype,  	 */
  	onPostBack : function(event, options)
  	{
 -		if(!this.hasXYInput)
 -		{
 -			this.addXYInput(event,options);
 -			this.hasXYInput = true;
 -		}
 +		this.addXYInput(event,options);
  		Prado.PostBack(event, options);
 +		this.removeXYInput(event,options);
  	},
  	/**
 @@ -111,6 +108,18 @@ Object.extend(Prado.WebUI.TImageButton.prototype,  			y_input = INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});
  			this.element.parentNode.appendChild(y_input);
  		}
 +	},
 +
 +	/**
 +	 * Remove hidden inputs for x,y-click capturing
 +	 * @param event DOM click event.
 +	 * @param array image button options.
 +	 */
 +	removeXYInput : function(event,options)
 +	{
 +		id = options['EventTarget'];
 +		this.element.parentNode.removeChild($(id+"_x"));
 +		this.element.parentNode.removeChild($(id+"_y"));
  	}
  });
 diff --git a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js index 834e89cf..a16cc3d6 100644 --- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js +++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js @@ -67,6 +67,7 @@ Prado.WebUI.TDatePicker.prototype =  		this.weekSlot = new Array(6);
  		this.minimalDaysInFirstWeek	= 4;
  		this.selectedDate = this.newDate();
 +		this.positionMode = 'Bottom';
  		//which element to trigger to show the calendar
  		if(this.options.Trigger)
 @@ -79,6 +80,12 @@ Prado.WebUI.TDatePicker.prototype =  			this.trigger  = this.control;
  			var triggerEvent = this.options.TriggerEvent || "focus";
  		}
 +		
 +		// Popup position
 +		if(this.options.PositionMode == 'Top')
 +		{
 +			this.positionMode = this.options.PositionMode;
 +		}
  		Object.extend(this,options);
 @@ -309,8 +316,8 @@ Prado.WebUI.TDatePicker.prototype =  		if(this.iePopUp)
  		{
  			this.iePopUp.style.display = "block";
 -			this.iePopUp.style.top = (this._calDiv.offsetTop -1 ) + "px";
  			this.iePopUp.style.left = (this._calDiv.offsetLeft -1)+ "px";
 +			this.iePopUp.style.top = (this._calDiv.offsetTop -1 ) + "px";
  			this.iePopUp.style.width = Math.abs(this._calDiv.offsetWidth -2)+ "px";
  			this.iePopUp.style.height = (this._calDiv.offsetHeight + 1)+ "px";
  			if(cleanup) this.iePopUp.style.display = "none";
 @@ -603,12 +610,10 @@ Prado.WebUI.TDatePicker.prototype =  			var pos = this.control.positionedOffset();
  			pos[1] += this.getDatePickerOffsetHeight();
 -
 -			this._calDiv.style.display = "block";
  			this._calDiv.style.top = (pos[1]-1) + "px";
 +			this._calDiv.style.display = "block";
  			this._calDiv.style.left = pos[0] + "px";
 -			this.ieHack(false);
  			this.documentClickEvent = this.hideOnClick.bindEvent(this);
  			this.documentKeyDownEvent = this.keyPressed.bindEvent(this);
  			Event.observe(document.body, "click", this.documentClickEvent);
 @@ -620,6 +625,14 @@ Prado.WebUI.TDatePicker.prototype =  			}
  			Event.observe(document,"keydown", this.documentKeyDownEvent);
  			this.showing = true;
 +			
 +			if(this.positionMode=='Top')
 +			{
 +				this._calDiv.style.top = ((pos[1]-1) - this.getDatePickerOffsetHeight() - this._calDiv.offsetHeight) + 'px';
 +				if(Prado.Browser().ie)
 +					this.iePopup = this._calDiv.style.top;					
 +			}
 +			this.ieHack(false);
  		}
  	},
 diff --git a/framework/Web/Javascripts/source/prado/ratings/ratings.js b/framework/Web/Javascripts/source/prado/ratings/ratings.js index e1770f1f..8af32bb9 100644 --- a/framework/Web/Javascripts/source/prado/ratings/ratings.js +++ b/framework/Web/Javascripts/source/prado/ratings/ratings.js @@ -1,60 +1,205 @@ -Prado.WebUI.TRatingList = Class.create();
 -Prado.WebUI.TRatingList.prototype =
 +Prado.WebUI.TRatingList = Base.extend(
  {
  	selectedIndex : -1,
 +	rating: -1,
 +	readOnly : false,
 -	initialize : function(options)
 +	constructor : function(options)
  	{
 -		this.options = options;
 -		this.element = $(options['ID']);
 -		Element.addClassName(this.element,options.cssClass);
 -		this.radios = document.getElementsByName(options.field);
 -		for(var i = 0; i<this.radios.length; i++)
 +		var cap = $(options.CaptionID);
 +		this.options = Object.extend(
 +		{
 +			caption : cap ? cap.innerHTML : ''
 +		}, options || {});
 +
 +		Prado.WebUI.TRatingList.register(this);
 +		this._init();
 +		this.selectedIndex = options.SelectedIndex;
 +		this.rating = options.Rating;
 +		this.readOnly = options.ReadOnly
 +		if(options.Rating <= 0 && options.SelectedIndex >= 0)
 +			this.rating = options.SelectedIndex+1;
 +		this.setReadOnly(this.readOnly);
 +	},
 +
 +	_init: function(options)
 +	{
 +		Element.addClassName($(this.options.ListID),this.options.Style);
 +		this.radios = new Array();
 +		this._mouseOvers = new Array();
 +		this._mouseOuts = new Array();
 +		this._clicks = new Array();
 +		var index=0;
 +		for(var i = 0; i<this.options.ItemCount; i++)
  		{
 -			Event.observe(this.radios[i].parentNode.parentNode, "mouseover", this.hover.bindEvent(this,i));
 -			Event.observe(this.radios[i].parentNode.parentNode, "mouseout", this.recover.bindEvent(this,i));
 -			Event.observe(this.radios[i].parentNode.parentNode, "click", this.click.bindEvent(this, i));
 +			var radio = $(this.options.ListID+'_c'+i);
 +			var td = radio.parentNode.parentNode;
 +			if(radio && td.tagName.toLowerCase()=='td')
 +			{
 +				this.radios.push(radio);
 +				this._mouseOvers.push(this.hover.bindEvent(this,index));
 +				this._mouseOuts.push(this.recover.bindEvent(this,index));
 +				this._clicks.push(this.click.bindEvent(this,index));
 +				index++;
 +				Element.addClassName(td,"rating");
 +			}
  		}
 -		this.caption = CAPTION();
 -		this.element.appendChild(this.caption);
 -		this.selectedIndex = options.selectedIndex;
 -		this.setRating(this.selectedIndex);
  	},
  	hover : function(ev,index)
  	{
 +		if(this.readOnly==true) return;
  		for(var i = 0; i<this.radios.length; i++)
 -			this.radios[i].parentNode.parentNode.className = (i<=index) ? "rating_hover" : "";
 -		this.setCaption(index);
 +		{
 +			var node = this.radios[i].parentNode.parentNode;
 +			var action = i <= index ? 'addClassName' : 'removeClassName'
 +			Element[action](node,"rating_hover");
 +			Element.removeClassName(node,"rating_selected");
 +			Element.removeClassName(node,"rating_half");
 +		}
 +		this.showCaption(this.getIndexCaption(index));
  	},
  	recover : function(ev,index)
  	{
 -		for(var i = 0; i<=index; i++)
 -			Element.removeClassName(this.radios[i].parentNode.parentNode, "rating_hover");
 -		this.setRating(this.selectedIndex);
 +		if(this.readOnly==true) return;
 +		this.showRating(this.rating);
 +		this.showCaption(this.options.caption);
  	},
  	click : function(ev, index)
  	{
 +		if(this.readOnly==true) return;
  		for(var i = 0; i<this.radios.length; i++)
  			this.radios[i].checked = (i == index);
  		this.selectedIndex = index;
 -		this.setRating(index);
 -		if(typeof(this.options.onChange)=="function")
 -			this.options.onChange(this,index);
 +		this.setRating(index+1);
 +
 +		if(this.options['AutoPostBack']==true){
 +			this.dispatchRequest(ev);
 +		}
 +	},
 +
 +	dispatchRequest : function(ev)
 +	{
 +		var requestOptions = Object.extend(
 +		{
 +			ID : this.options.ListID+"_c"+this.selectedIndex,
 +			EventTarget : this.options.ListName+"$c"+this.selectedIndex
 +		},this.options);
 +		Prado.PostBack(ev, requestOptions);
 +	},
 +
 +	setRating : function(value)
 +	{
 +		this.rating = value;
 +		var base = Math.floor(value-1);
 +		var remainder = value - base-1;
 +		var halfMax = this.options.HalfRating["1"];
 +		var index = remainder > halfMax ? base+1 : base;
 +		for(var i = 0; i<this.radios.length; i++)
 +			this.radios[i].checked = (i == index);
 +
 +		var caption = this.getIndexCaption(index);
 +		this.setCaption(caption);
 +		this.showCaption(caption);
 +
 +		this.showRating(this.rating);
 +	},
 +
 +	showRating: function(value)
 +	{
 +		var base = Math.floor(value-1);
 +		var remainder = value - base-1;
 +		var halfMin = this.options.HalfRating["0"];
 +		var halfMax = this.options.HalfRating["1"];
 +		var index = remainder > halfMax ? base+1 : base;
 +		var hasHalf = remainder >= halfMin && remainder <= halfMax;
 +		for(var i = 0; i<this.radios.length; i++)
 +		{
 +			var node = this.radios[i].parentNode.parentNode;
 +			var action = i > index ? 'removeClassName' : 'addClassName';
 +			Element[action](node, "rating_selected");
 +			if(i==index+1 && hasHalf)
 +				Element.addClassName(node, "rating_half");
 +			else
 +				Element.removeClassName(node, "rating_half");
 +			Element.removeClassName(node,"rating_hover");
 +		}
 +	},
 +	
 +	getIndexCaption : function(index)
 +	{
 +		return index > -1 ? this.radios[index].value : this.options.caption;
 +	},
 +
 +	showCaption : function(value)
 +	{
 +		var caption = $(this.options.CaptionID);
 +		if(caption) caption.innerHTML = value;
 +		$(this.options.ListID).title = value;
  	},
 -	setRating: function(index)
 +	setCaption : function(value)
  	{
 -		for(var i = 0; i<=index; i++)
 -			this.radios[i].parentNode.parentNode.className = "rating_selected";
 -		this.setCaption(index);
 +		this.options.caption = value;
 +		this.showCaption(value);
  	},
 -	setCaption : function(index)
 +	setReadOnly : function(value)
 +	{
 +		this.readOnly = value;
 +		for(var i = 0; i<this.radios.length; i++)
 +		{
 +			
 +			var action = value ? 'addClassName' : 'removeClassName';
 +			Element[action](this.radios[i].parentNode.parentNode, "rating_disabled");
 +			
 +			var action = value ? 'stopObserving' : 'observe';
 +			var td = this.radios[i].parentNode.parentNode;
 +			Event[action](td, "mouseover", this._mouseOvers[i]);
 +			Event[action](td, "mouseout", this._mouseOuts[i]);
 +			Event[action](td, "click", this._clicks[i]);
 +		}
 +
 +		this.showRating(this.rating);
 +	}
 +},
 +{
 +ratings : {},
 +register : function(rating)
 +{
 +	Prado.WebUI.TRatingList.ratings[rating.options.ListID] = rating;
 +},
 +
 +setReadOnly : function(id,value)
 +{
 +	Prado.WebUI.TRatingList.ratings[id].setReadOnly(value);
 +},
 +
 +setRating : function(id,value)
 +{
 +	Prado.WebUI.TRatingList.ratings[id].setRating(value);
 +},
 +
 +setCaption : function(id,value)
 +{
 +	Prado.WebUI.TRatingList.ratings[id].setCaption(value);
 +}
 +});
 +
 +Prado.WebUI.TActiveRatingList = Prado.WebUI.TRatingList.extend( 
 +{	
 +	dispatchRequest : function(ev)
  	{
 -		this.caption.innerHTML = index > -1 ?
 -			this.radios[index].value : this.options.caption;
 +		var requestOptions = Object.extend(
 +		{
 +			ID : this.options.ListID+"_c"+this.selectedIndex,
 +			EventTarget : this.options.ListName+"$c"+this.selectedIndex
 +		},this.options);
 +		var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
 +		if(request.dispatch()==false)
 +			Event.stop(ev);
  	}
 -};
 +	
 +});
 diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index c9dba7a1..a3b803d8 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -686,7 +686,7 @@ Prado.WebUI.TValidationSummary.prototype =  	{
  		switch(type)
  		{
 -			case "List":
 +			case "SimpleList":
  				return { header : "<br />", first : "", pre : "", post : "<br />", last : ""};
  			case "SingleParagraph":
  				return { header : " ", first : "", pre : "", post : " ", last : "<br />"};
 @@ -1668,6 +1668,7 @@ Prado.WebUI.TRegularExpressionValidator = Class.extend(Prado.WebUI.TBaseValidato  	 * @constructor initialize
  	 * @param {object} options - Additional constructor option:
  	 * @... {string} ValidationExpression - Regular expression to match against.
 +	 * @... {string} PatternModifiers - Pattern modifiers: combinations of g, i, and m
  	 */
  	/**
 @@ -1678,12 +1679,12 @@ Prado.WebUI.TRegularExpressionValidator = Class.extend(Prado.WebUI.TBaseValidato  	evaluateIsValid : function()
  	{
  		var value = this.getValidationValue();
 -	    if (value.length <= 0)
 +		if (value.length <= 0)
  	    	return true;
 -	    var rx = new RegExp(this.options.ValidationExpression);
 -	    var matches = rx.exec(value);
 -	    return (matches != null && value == matches[0]);
 +		var rx = new RegExp(this.options.ValidationExpression,this.options.PatternModifiers);
 +		var matches = rx.exec(value);
 +		return (matches != null && value == matches[0]);
  	}
  });
 @@ -1847,6 +1848,8 @@ Prado.WebUI.TCaptchaValidator = Class.extend(Prado.WebUI.TBaseValidator,  	{
  		var a = this.getValidationValue();
  		var h = 0;
 +		if (this.options.CaseSensitive==false)
 +			a = a.toUpperCase();
  		for(var i = a.length-1; i >= 0; --i)
  			h += a.charCodeAt(i);
  		return h == this.options.TokenHash;
 diff --git a/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js b/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js index bf429c26..14f9546e 100644 --- a/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js +++ b/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js @@ -407,7 +407,7 @@ var Draggable = Class.create({      if(this.options.ghosting) {        if (!this.element._originallyAbsolute)          Position.relativize(this.element); -      delete this.element._originallyAbsolute; +      this.element._originallyAbsolute=null;        Element.remove(this._clone);        this._clone = null;      } | 
