summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/js')
-rw-r--r--framework/Web/Javascripts/js/ajax.js4
-rw-r--r--framework/Web/Javascripts/js/prado.js69
2 files changed, 51 insertions, 22 deletions
diff --git a/framework/Web/Javascripts/js/ajax.js b/framework/Web/Javascripts/js/ajax.js
index e0e9ae7e..fbbd3ecf 100644
--- a/framework/Web/Javascripts/js/ajax.js
+++ b/framework/Web/Javascripts/js/ajax.js
@@ -215,4 +215,6 @@ this.timeout=(t+this.options.Interval)*1000;this.count++;return parseInt(this.ti
{if(this.timers[id])
this.timers[id].startTimer();},stop:function(id)
{if(this.timers[id])
-this.timers[id].stopTimer();}}); \ No newline at end of file
+this.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options)
+{this.element=$(options.ID);this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));},doCallback:function(event)
+{new Prado.CallbackRequest(this.options.EventTarget,this.options);Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl; \ No newline at end of file
diff --git a/framework/Web/Javascripts/js/prado.js b/framework/Web/Javascripts/js/prado.js
index c2f2fdfd..0e71f733 100644
--- a/framework/Web/Javascripts/js/prado.js
+++ b/framework/Web/Javascripts/js/prado.js
@@ -251,9 +251,9 @@ lastFocus.value=options['EventTarget'];}}
$('PRADO_POSTBACK_TARGET').value=options['EventTarget'];$('PRADO_POSTBACK_PARAMETER').value=options['EventParameter'];Event.stop(event);Event.fireEvent(form,"submit");}
Prado.Element={setValue:function(element,value)
{var el=$(element);if(el&&typeof(el.value)!="undefined")
-el.value=value;},select:function(element,method,value)
-{var el=$(element);var isList=element.indexOf('[]')>-1;if(!el&&!isList)return;method=isList?'check'+method:el.tagName.toLowerCase()+method;var selection=Prado.Element.Selection;if(typeof(selection[method])=="function")
-selection[method](isList?element:el,value);},click:function(element)
+el.value=value;},select:function(element,method,value,total)
+{var el=$(element);var selection=Prado.Element.Selection;if(typeof(selection[method])=="function")
+{control=selection.isSelectable(el)?[el]:selection.getListElements(element,total);selection[method](control,value);}},click:function(element)
{var el=$(element);if(el)
Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value)
{var el=$(element);if(attribute=="disabled"&&value==false)
@@ -278,32 +278,59 @@ else
return result[2];else
return null;},evaluateScript:function(content)
{content.evalScripts();}}
-Prado.Element.Selection={inputValue:function(el,value)
+Prado.Element.Selection={isSelectable:function(el)
+{if(el&&el.type)
{switch(el.type.toLowerCase())
-{case'checkbox':case'radio':return el.checked=value;}},selectValue:function(el,value)
+{case'checkbox':case'radio':case'select':case'select-one':return true;}}
+return false;},inputValue:function(el,value)
+{switch(el.type.toLowerCase())
+{case'checkbox':case'radio':return el.checked=value;}},selectValue:function(elements,value)
+{elements.each(function(el)
{$A(el.options).each(function(option)
-{option.selected=option.value==value;});},selectIndex:function(el,index)
-{if(el.type=='select-one')
+{if(typeof(value)=="boolean")
+options.selected=value;else if(option.value==value)
+option.selected=true;});})},selectValues:function(elements,values)
+{selection=this;values.each(function(value)
+{selection.selectValue(elements,value);})},selectIndex:function(elements,index)
+{elements.each(function(el)
+{if(el.type.toLowerCase()=='select-one')
el.selectedIndex=index;else
{for(var i=0;i<el.length;i++)
{if(i==index)
-el.options[i].selected=true;}}},selectClear:function(el)
-{el.selectedIndex=-1;},selectAll:function(el)
+el.options[i].selected=true;}}})},selectAll:function(elements)
+{elements.each(function(el)
+{if(el.type.toLowerCase()!='select-one')
{$A(el.options).each(function(option)
-{option.selected=true;Logger.warn(option.value);});},selectInvert:function(el)
+{option.selected=true;})}})},selectInvert:function(elements)
+{elements.each(function(el)
+{if(el.type.toLowerCase()!='select-one')
{$A(el.options).each(function(option)
-{option.selected=!option.selected;});},checkValue:function(name,value)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=el.value==value});},checkIndex:function(name,index)
-{var elements=$A(document.getElementsByName(name));for(var i=0;i<elements.length;i++)
+{option.selected=!options.selected;})}})},selectIndices:function(elements,indices)
+{selection=this;indices.each(function(index)
+{selection.selectIndex(elements,index);})},selectClear:function(elements)
+{elements.each(function(el)
+{el.selectedIndex=-1;})},getListElements:function(element,total)
+{elements=new Array();for(i=0;i<total;i++)
+{el=$(element+"_c"+i);if(el)
+elements.push(el);}
+return elements;},checkValue:function(elements,value)
+{elements.each(function(el)
+{if(typeof(value)=="boolean")
+el.checked=value;else if(el.value==value)
+el.checked=true;});},checkValues:function(elements,values)
+{selection=this;values.each(function(value)
+{selection.checkValue(elements,value);})},checkIndex:function(elements,index)
+{for(var i=0;i<elements.length;i++)
{if(i==index)
-elements[i].checked=true;}},checkClear:function(name)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=false;});},checkAll:function(name)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=true;});},checkInvert:function(name)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=!el.checked;});}};Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={_elementOnClick:null,initialize:function(options)
+elements[i].checked=true;}},checkIndices:function(elements,indices)
+{selection=this;indices.each(function(index)
+{selection.checkIndex(elements,index);})},checkClear:function(elements)
+{elements.each(function(el)
+{el.checked=false;});},checkAll:function(elements)
+{elements.each(function(el)
+{el.checked=true;})},checkInvert:function(elements)
+{elements.each(function(el)
+{el.checked!=el.checked;})}};Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={_elementOnClick:null,initialize:function(options)
{this.element=$(options.ID);if(this.onInit)
this.onInit(options);},onInit:function(options)
{if(typeof(this.element.onclick)=="function")