summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/3rdParty/readme.html42
-rw-r--r--framework/Data/ActiveRecord/TActiveRecord.php23
-rw-r--r--framework/Exceptions/messages/messages.txt2
-rw-r--r--framework/Web/Javascripts/packages.php27
-rw-r--r--framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js11
-rw-r--r--framework/Web/Javascripts/source/prado/controls/controls.js30
-rw-r--r--framework/Web/Javascripts/source/prado/ratings/ratings.js153
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCheckBoxList.php26
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButtonList.php28
-rw-r--r--framework/Web/UI/JuiControls/TJuiDroppable.php5
-rw-r--r--framework/Web/UI/JuiControls/TJuiSelectable.php57
-rw-r--r--framework/Web/UI/JuiControls/TJuiSortable.php69
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php12
-rw-r--r--framework/Web/UI/WebControls/TRadioButtonList.php10
-rw-r--r--framework/Web/UI/WebControls/TRatingList.php2
15 files changed, 339 insertions, 158 deletions
diff --git a/framework/3rdParty/readme.html b/framework/3rdParty/readme.html
index 2855ba74..5889a943 100644
--- a/framework/3rdParty/readme.html
+++ b/framework/3rdParty/readme.html
@@ -19,6 +19,30 @@ projects.
</tr>
<tr>
+ <td><a href="jQuery">jQuery</a></td>
+ <td><a href="http://jquery.com/">jQuery - Write less, do more</a></td>
+ <td><a href="http://jquery.org/license/">MIT License</a></td>
+ <td></td>
+ <td>Core of Prado javascript library.</td>
+</tr>
+
+<tr>
+ <td><a href="jQueryUI">jQuery UI</a></td>
+ <td><a href="http://jqueryui.com/">jQuery user interface</a></td>
+ <td><a href="http://jquery.org/license/">MIT License</a></td>
+ <td>System.Web.UI.JuiControls</td>
+ <td>jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.</td>
+</tr>
+
+<tr>
+ <td><a href="Low Pro JQ">Low Pro JQ</a></td>
+ <td><a href="http://github.com/danwrong/low-pro-for-jquery">jQuery - Write less, do more</a></td>
+ <td><a href="http://github.com/danwrong/low-pro-for-jquery/blob/master/MIT-LICENCE">MIT License</a></td>
+ <td></td>
+ <td> A jQuery port of the Low Pro behavior framework that was originally written for Prototype. Prado actually uses it as a base to emulate OOP subclassing, inheritance and contructor events.</td>
+</tr>
+
+<tr>
<td><a href="ReCaptcha">ReCaptcha</a></td>
<td><a href="http://www.google.com/recaptcha">ReCaptcha - Stop spam, read books</a></td>
<td><a href="ReCaptcha/LICENSE">BSD-like</a></td>
@@ -41,10 +65,10 @@ projects.
</tr>
<tr>
<td><a href="TinyMCE">TinyMCE</a></td>
- <td><a href="http://tinymce.moxiecode.com/">TinyMCE Javascript Content Editor</a> (v3.5.6)</td>
+ <td><a href="http://tinymce.moxiecode.com/">TinyMCE Javascript WYSIWYG Editor</a></td>
<td><a href="TinyMCE/license.txt">GNU LESSER GENERAL PUBLIC LICENSE</a></td>
- <td>System.Web.UI.WebControls.THtmlArea</td>
- <td>TinyMCE is a powerful WYSIWYG editor control for web browsers such as MSIE or Mozilla that enables the user to edit HTML contents in a more user friendly way.</td>
+ <td>System.Web.UI.WebControls.THtmlArea, System.Web.UI.WebControls.THtmlArea4</td>
+ <td>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL. TinyMCE has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</td>
</tr>
<tr>
<td>N.A.</td>
@@ -92,8 +116,8 @@ projects.
<td><a href="../Web/Javascripts/prototype/">../Web/Javascripts/prototype</a></td>
<td><a href="http://dev.rubyonrails.org/browser/spinoffs/prototype">Prototype javascript library</a></td>
<td><a href="../Web/Javascripts/prototype/LICENSE">The Prototype License (MIT based)</a></td>
- <td>N.A.</td>
- <td>Core of Prado javascript library.</td>
+ <td>System.Web.UI.TAutoComplete, TDraggable, TDropContainer</td>
+ <td>Prototype used to be the core of Prado javascript library. Now it's still supported for backwards compatibility</td>
</tr>
<tr>
<td><a href="../Web/Javascripts/prado/logger/logger.js">../Web/Javascripts/prado/logger/logger.js</a></td>
@@ -113,14 +137,6 @@ projects.
</tr>
<tr>
- <td><a href="adodb">adodb</a></td>
- <td><a href="http://adodb.sourceforge.net/">ADOdb Database Abstraction Library for PHP</a></td>
- <td><a href="adodb/license.txt">Dual licensed using BSD and LGPL.</a></td>
- <td>Provides one database access abstraction layer.</td>
- <td>Slightly modified to work nicely with E_STRICT in php 5.</td>
-</tr>
-
-<tr>
<td><a href="Markdown">Markdown</a></td>
<td><a href="http://www.michelf.com/projects/php-markdown/">PHP Markdown</a></td>
<td><a href="Markdown/License.text">BSD</a></td>
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php
index b94f1336..735579cd 100644
--- a/framework/Data/ActiveRecord/TActiveRecord.php
+++ b/framework/Data/ActiveRecord/TActiveRecord.php
@@ -1023,6 +1023,29 @@ abstract class TActiveRecord extends TComponent
{
return isset(self::$_relations[get_class($this)][strtolower($property)]);
}
+
+ /**
+ * Return record data as array
+ * @return array of column name and column values
+ * @since 3.2.4
+ */
+ public function toArray(){
+ $result=array();
+ foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){
+ $result[$columnName]=$this->getColumnValue($columnName);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return record data as JSON
+ * @return JSON
+ * @since 3.2.4
+ */
+ public function toJSON(){
+ return json_encode($this->toArray());
+ }
}
/**
diff --git a/framework/Exceptions/messages/messages.txt b/framework/Exceptions/messages/messages.txt
index 2c4de1da..8ea41292 100644
--- a/framework/Exceptions/messages/messages.txt
+++ b/framework/Exceptions/messages/messages.txt
@@ -504,3 +504,5 @@ tactivetablerow_control_notincollection = {0} '{1}' no member of the TTableRowCo
juioptions_control_invalid = Control '{0}' must implement IJuiOptions.
juioptions_option_invalid = '{1}' is not a valid option for control '{0}'.
+
+ratinglist_invalid_caption_id = '{0}' is not a valid caption control for TRatingList '{0}'. \ No newline at end of file
diff --git a/framework/Web/Javascripts/packages.php b/framework/Web/Javascripts/packages.php
index dd55729e..19cda98b 100644
--- a/framework/Web/Javascripts/packages.php
+++ b/framework/Web/Javascripts/packages.php
@@ -64,6 +64,18 @@ $packages = array(
'prado/controls/htmlarea4.js'
),
+ 'accordion'=>array(
+ 'prado/controls/accordion.js'
+ ),
+
+ 'inlineeditor' => array(
+ 'prado/activecontrols/inlineeditor.js'
+ ),
+
+ 'ratings' => array(
+ 'prado/ratings/ratings.js',
+ ),
+
// jquery
'jquery' => array(
JQUERY_DIR.'/jquery.js',
@@ -89,18 +101,6 @@ $packages = array(
'prado/activecontrols/dragdropextra.js',
),
- 'accordion'=>array(
- 'prado/controls/accordion.js'
- ),
-
- 'ratings' => array(
- 'prado/ratings/ratings.js',
- ),
-
- 'inlineeditor' => array(
- 'prado/activecontrols/inlineeditor.js'
- ),
-
'autocomplete' => array(
SCRIPTACULOUS_DIR.'/controls.js',
'prado/activecontrols/autocomplete.js'
@@ -127,12 +127,11 @@ $dependencies = array(
'slider' => array('jquery', 'prado', 'slider'),
'inlineeditor' => array('jquery', 'prado', 'ajax', 'inlineeditor'),
'accordion' => array('jquery', 'prado', 'accordion'),
+ 'ratings' => array('jquery', 'prado', 'ajax', 'ratings'),
'jqueryui' => array('jquery', 'jqueryui'),
-
'prototype' => array('prototype'),
'dragdrop' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop'),
'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop','dragdropextra'),
- 'ratings' => array('prototype', 'jquery', 'prado', 'ajax', 'ratings'),
'autocomplete' => array('prototype', 'jquery', 'prado', 'ajax', 'autocomplete'),
);
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
index b471a300..907d930e 100644
--- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
@@ -50,18 +50,17 @@ Prado.WebUI.TActiveCheckBox = jQuery.klass(Prado.WebUI.CallbackControl,
Prado.WebUI.TActiveRadioButton = jQuery.klass(Prado.WebUI.TActiveCheckBox);
-Prado.WebUI.TActiveCheckBoxList = jQuery.extend(
+Prado.WebUI.TActiveCheckBoxList = jQuery.klass(Prado.WebUI.Control,
{
- constructor : function(options)
+ onInit : function(options)
{
- Prado.Registry[options.ListID] = this;
for(var i = 0; i<options.ItemCount; i++)
{
- var checkBoxOptions = jQuery.extend(
+ var checkBoxOptions = jQuery.extend({}, options,
{
- ID : options.ListID+"_c"+i,
+ ID : options.ID+"_c"+i,
EventTarget : options.ListName+"$c"+i
- }, options);
+ });
new Prado.WebUI.TActiveCheckBox(checkBoxOptions);
}
}
diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js
index fa01e2e2..00a39e66 100644
--- a/framework/Web/Javascripts/source/prado/controls/controls.js
+++ b/framework/Web/Javascripts/source/prado/controls/controls.js
@@ -290,11 +290,11 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl,
* Override parent onPostBack function, tried to add hidden forms
* inputs to capture x,y clicked point.
*/
- onPostBack : function(event, options)
+ onPostBack : function(options, event)
{
- this.addXYInput(event,options);
- new Prado.PostBack(event, options);
- this.removeXYInput(event,options);
+ this.addXYInput(options, event);
+ new Prado.PostBack(options, event);
+ this.removeXYInput(options, event);
},
/**
@@ -302,7 +302,7 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl,
* @param event DOM click event.
* @param array image button options.
*/
- addXYInput : function(event,options)
+ addXYInput : function(options, event)
{
var imagePos = jQuery(this.element).offset();
var clickedPos = [event.clientX, event.clientY];
@@ -335,7 +335,7 @@ Prado.WebUI.TImageButton = jQuery.klass(Prado.WebUI.PostBackControl,
* @param event DOM click event.
* @param array image button options.
*/
- removeXYInput : function(event,options)
+ removeXYInput : function(options, event)
{
var id = this.element.id;
jQuery('#'+id+'_x').remove();
@@ -496,16 +496,15 @@ jQuery.klass(Prado.WebUI.TTextHighlighter,
Prado.WebUI.TCheckBoxList = jQuery.klass(Prado.WebUI.Control,
{
- constructor : function(options)
+ onInit : function(options)
{
- Prado.Registry.set(options.ListID, this);
for(var i = 0; i<options.ItemCount; i++)
{
- var checkBoxOptions = jQuery.extend(
+ var checkBoxOptions = jQuery.extend({}, options,
{
- ID : options.ListID+"_c"+i,
+ ID : options.ID+"_c"+i,
EventTarget : options.ListName+"$c"+i
- }, options);
+ });
new Prado.WebUI.TCheckBox(checkBoxOptions);
}
}
@@ -513,16 +512,15 @@ Prado.WebUI.TCheckBoxList = jQuery.klass(Prado.WebUI.Control,
Prado.WebUI.TRadioButtonList = jQuery.klass(Prado.WebUI.Control,
{
- constructor : function(options)
+ onInit : function(options)
{
- Prado.Registry.set(options.ListID, this);
for(var i = 0; i<options.ItemCount; i++)
{
- var radioButtonOptions = jQuery.extend(
+ var radioButtonOptions = jQuery.extend({}, options,
{
- ID : options.ListID+"_c"+i,
+ ID : options.ID+"_c"+i,
EventTarget : options.ListName+"$c"+i
- }, options);
+ });
new Prado.WebUI.TRadioButton(radioButtonOptions);
}
}
diff --git a/framework/Web/Javascripts/source/prado/ratings/ratings.js b/framework/Web/Javascripts/source/prado/ratings/ratings.js
index 1369c740..eb541b99 100644
--- a/framework/Web/Javascripts/source/prado/ratings/ratings.js
+++ b/framework/Web/Javascripts/source/prado/ratings/ratings.js
@@ -1,78 +1,67 @@
-Prado.WebUI.TRatingList = Base.extend(
+Prado.WebUI.TRatingList = jQuery.klass(Prado.WebUI.Control,
{
selectedIndex : -1,
rating: -1,
readOnly : false,
- constructor : function(options)
+ onInit : function(options)
{
- var cap = $(options.CaptionID);
- this.options = Object.extend(
+ var cap = $('#'+options.CaptionID).get(0);
+ this.options = jQuery.extend(
{
caption : cap ? cap.innerHTML : ''
}, options || {});
- 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
- if(options.Rating <= 0 && options.SelectedIndex >= 0)
- this.rating = options.SelectedIndex+1;
- this.setReadOnly(this.readOnly);
- },
+ this.radios = [];
- _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++)
+ $('#'+options.ID).addClass(options.Style);
+ for(var i = 0; i<options.ItemCount; i++)
{
- var radio = $(this.options.ListID+'_c'+i);
+ var radio = $('#'+options.ID+"_c"+i).get(0);
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");
+ $(td).addClass("rating");
}
}
+
+ 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);
},
- hover : function(ev,index)
+ hover : function(index, ev)
{
if(this.readOnly==true) 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");
+ if(i <= index)
+ $(node).addClass('rating_hover');
+ else
+ $(node).removeClass('rating_hover');
+ $(node).removeClass("rating_selected");
+ $(node).removeClass("rating_half");
}
this.showCaption(this.getIndexCaption(index));
},
- recover : function(ev,index)
+ recover : function(index, ev)
{
if(this.readOnly==true) return;
this.showRating(this.rating);
this.showCaption(this.options.caption);
},
- click : function(ev, index)
+ click : function(index, ev)
{
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+1);
@@ -83,13 +72,13 @@ Prado.WebUI.TRatingList = Base.extend(
dispatchRequest : function(ev)
{
- var requestOptions = Object.extend(
+ var requestOptions =jQuery.extend({}, this.options,
{
- ID : this.options.ListID+"_c"+this.selectedIndex,
+ ID : this.options.ID+"_c"+this.selectedIndex,
EventTarget : this.options.ListName+"$c"+this.selectedIndex
- },this.options);
- Prado.PostBack(ev, requestOptions);
- },
+ });
+ new Prado.PostBack(requestOptions, ev);
+ },
setRating : function(value)
{
@@ -119,16 +108,19 @@ Prado.WebUI.TRatingList = Base.extend(
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)
+ $(node).addClass('rating_selected');
+ else
+ $(node).removeClass('rating_selected');
+
if(i==index+1 && hasHalf)
- Element.addClassName(node, "rating_half");
+ $(node).addClass("rating_half");
else
- Element.removeClassName(node, "rating_half");
- Element.removeClassName(node,"rating_hover");
+ $(node).removeClass("rating_half");
+ $(node).removeClass("rating_hover");
}
},
-
+
getIndexCaption : function(index)
{
return index > -1 ? this.radios[index].value : this.options.caption;
@@ -136,9 +128,8 @@ Prado.WebUI.TRatingList = Base.extend(
showCaption : function(value)
{
- var caption = $(this.options.CaptionID);
- if(caption) caption.innerHTML = value;
- $(this.options.ListID).title = value;
+ $('#'+this.options.CaptionID).html(value);
+ $('#'+this.options.ID).attr( "title", value);
},
setCaption : function(value)
@@ -152,55 +143,37 @@ Prado.WebUI.TRatingList = Base.extend(
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]);
+ var node = this.radios[i].parentNode.parentNode;
+ if(value)
+ {
+ $(node).addClass('rating_disabled');
+ $(node).off('mouseover', jQuery.proxy(this.hover, this, i));
+ $(node).off('mouseout', jQuery.proxy(this.recover, this, i));
+ $(node).off('click', jQuery.proxy(this.click, this, i));
+ } else {
+ $(node).removeClass('rating_disabled');
+ $(node).on('mouseover', jQuery.proxy(this.hover, this, i));
+ $(node).on('mouseout', jQuery.proxy(this.recover, this, i));
+ $(node).on('click', jQuery.proxy(this.click, this, 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(
-{
+Prado.WebUI.TActiveRatingList = jQuery.klass(Prado.WebUI.TRatingList,
+{
dispatchRequest : function(ev)
{
- var requestOptions = Object.extend(
+ var requestOptions =jQuery.extend({}, this.options,
{
- ID : this.options.ListID+"_c"+this.selectedIndex,
+ ID : this.options.ID+"_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);
+ ev.preventDefault();
}
-
+
});
diff --git a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
index aa2d5f94..ea174c94 100644
--- a/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
+++ b/framework/Web/UI/ActiveControls/TActiveCheckBoxList.php
@@ -76,7 +76,7 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall
*/
protected function createRepeatedControl()
{
- $control = new TActiveCheckBox;
+ $control = new TActiveCheckBoxListItem;
$control->getAdapter()->setBaseActiveControl($this->getActiveControl());
return $control;
}
@@ -115,5 +115,29 @@ class TActiveCheckBoxList extends TCheckBoxList implements IActiveControl, ICall
$this->getClientClassName(), $this->getPostBackOptions());
}
+ /**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TActiveCheckBoxList';
+ }
+}
+
+class TActiveCheckBoxListItem extends TActiveCheckBox
+{
+ /**
+ * Override client implementation to avoid emitting the javascript
+ *
+ * @param THtmlWriter the writer for the rendering purpose
+ * @param string checkbox id
+ * @param string onclick js
+ */
+ protected function renderInputTag($writer,$clientID,$onclick)
+ {
+ TCheckBox::renderInputTag($writer,$clientID,$onclick);
+ }
}
diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
index 5c76aed1..84a71951 100644
--- a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
@@ -77,7 +77,7 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl,
*/
protected function createRepeatedControl()
{
- $control = new TActiveRadioButton;
+ $control = new TActiveRadioButtonItem;
$control->getAdapter()->setBaseActiveControl($this->getActiveControl());
return $control;
}
@@ -115,5 +115,31 @@ class TActiveRadioButtonList extends TRadioButtonList implements IActiveControl,
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getPostBackOptions());
}
+
+ /**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TActiveRadioButtonList';
+ }
+
}
+
+class TActiveRadioButtonItem extends TActiveRadioButton
+{
+ /**
+ * Override client implementation to avoid emitting the javascript
+ *
+ * @param THtmlWriter the writer for the rendering purpose
+ * @param string checkbox id
+ * @param string onclick js
+ */
+ protected function renderInputTag($writer,$clientID,$onclick)
+ {
+ TRadioButton::renderInputTag($writer,$clientID,$onclick);
+ }
+} \ No newline at end of file
diff --git a/framework/Web/UI/JuiControls/TJuiDroppable.php b/framework/Web/UI/JuiControls/TJuiDroppable.php
index 49fc1e96..6c07e49c 100644
--- a/framework/Web/UI/JuiControls/TJuiDroppable.php
+++ b/framework/Web/UI/JuiControls/TJuiDroppable.php
@@ -106,7 +106,7 @@ class TJuiDroppable extends TActivePanel implements IJuiOptions, ICallbackEventH
/**
* Raises the onDrop event.
- * The drop parameters are encapsulated into a {@link TDropContainerEventParameter}
+ * The drop parameters are encapsulated into a {@link TJuiDroppableEventParameter}
*
* @param object $dropControlId
*/
@@ -150,8 +150,7 @@ class TJuiDroppable extends TActivePanel implements IJuiOptions, ICallbackEventH
* TJuiDroppableEventParameter encapsulate the parameter
* data for <b>OnDrop</b> event of TJuiDroppable components
*
- * @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
- * @copyright Copyright &copy; 2008, PradoSoft
+ * @author Fabio Bas <ctrlaltca[at]gmail[dot]com>
* @license http://www.pradosoft.com/license
* @package System.Web.UI.JuiControls
*/
diff --git a/framework/Web/UI/JuiControls/TJuiSelectable.php b/framework/Web/UI/JuiControls/TJuiSelectable.php
index 6c020951..e895c1f8 100644
--- a/framework/Web/UI/JuiControls/TJuiSelectable.php
+++ b/framework/Web/UI/JuiControls/TJuiSelectable.php
@@ -31,7 +31,7 @@ Prado::using('System.Web.UI.JuiControls.TJuiControlAdapter');
* @package System.Web.UI.JuiControls
* @since 3.3
*/
-class TJuiSelectable extends TActivePanel implements IJuiOptions
+class TJuiSelectable extends TActivePanel implements IJuiOptions, ICallbackEventHandler
{
/**
* Creates a new callback control, sets the adapter to
@@ -71,6 +71,7 @@ class TJuiSelectable extends TActivePanel implements IJuiOptions
protected function getPostBackOptions()
{
$options = $this->getOptions()->toArray();
+ $options['stop'] = new TJavaScriptLiteral('function( event, ui ) { var selected = new Array(); jQuery(\'#'.$this->getClientID().' .ui-selected\').each(function(idx, item){ selected.push(item.id) }); Prado.Callback('.TJavascript::encode($this->getUniqueID()).', { \'indexes\' : selected }) }');
return $options;
}
@@ -89,6 +90,43 @@ class TJuiSelectable extends TActivePanel implements IJuiOptions
}
/**
+ * Raises callback event. This method is required bu {@link ICallbackEventHandler}
+ * interface.
+ * It raises the {@link onSelectedIndexChanged onSelectedIndexChanged} event, then, the {@link onCallback OnCallback} event
+ * This method is mainly used by framework and control developers.
+ * @param TCallbackEventParameter the parameter associated with the callback event
+ */
+ public function raiseCallbackEvent($param)
+ {
+ $this->onSelectedIndexChanged($param->getCallbackParameter());
+ $this->onCallback($param);
+ }
+
+ /**
+ * Raises the onSelect event.
+ * The selection parameters are encapsulated into a {@link TJuiSelectableEventParameter}
+ *
+ * @param object $params
+ */
+ public function onSelectedIndexChanged($params)
+ {
+ $this->raiseEvent('onSelectedIndexChanged', $this, new TJuiSelectableEventParameter ($this->getResponse(), $params));
+
+ }
+
+ /**
+ * This method is invoked when a callback is requested. The method raises
+ * 'OnCallback' event to fire up the event handlers. If you override this
+ * method, be sure to call the parent implementation so that the event
+ * handler can be invoked.
+ * @param TCallbackEventParameter event parameter to be passed to the event handlers
+ */
+ public function onCallback($param)
+ {
+ $this->raiseEvent('OnCallback', $this, $param);
+ }
+
+ /**
* @var ITemplate template for repeater items
*/
private $_repeater=null;
@@ -130,7 +168,7 @@ class TJuiSelectable extends TActivePanel implements IJuiOptions
$repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater');
$repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="'.$this->getClientId().'_0'.'">'));
$repeater->setFooterTemplate(new TJuiSelectableTemplate('</ul>'));
- $repeater->setItemTemplate(new TTemplate('<li><%# $this->DataItem %></li>',null));
+ $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->DataItem %></li>',null));
$repeater->setEmptyTemplate(new TJuiSelectableTemplate('<ul></ul>'));
$this->getControls()->add($repeater);
return $repeater;
@@ -165,4 +203,19 @@ class TJuiSelectableTemplate extends TComponent implements ITemplate
{
$parent->getControls()->add($this->_template);
}
+}
+
+/**
+ * TJuiSelectableEventParameter class
+ *
+ * TJuiSelectableEventParameter encapsulate the parameter
+ * data for <b>OnSelectedIndexChanged</b> event of TJuiSelectable components
+ *
+ * @author Fabio Bas <ctrlaltca[at]gmail[dot]com>
+ * @license http://www.pradosoft.com/license
+ * @package System.Web.UI.JuiControls
+ */
+class TJuiSelectableEventParameter extends TCallbackEventParameter
+{
+ public function getSelectedIndexes() { return $this->getCallbackParameter()->indexes; }
} \ No newline at end of file
diff --git a/framework/Web/UI/JuiControls/TJuiSortable.php b/framework/Web/UI/JuiControls/TJuiSortable.php
index 87e4237e..557d62ba 100644
--- a/framework/Web/UI/JuiControls/TJuiSortable.php
+++ b/framework/Web/UI/JuiControls/TJuiSortable.php
@@ -28,7 +28,7 @@ Prado::using('System.Web.UI.JuiControls.TJuiControlAdapter');
* @package System.Web.UI.JuiControls
* @since 3.3
*/
-class TJuiSortable extends TActivePanel implements IJuiOptions
+class TJuiSortable extends TActivePanel implements IJuiOptions, ICallbackEventHandler
{
/**
* Creates a new callback control, sets the adapter to
@@ -68,6 +68,7 @@ class TJuiSortable extends TActivePanel implements IJuiOptions
protected function getPostBackOptions()
{
$options = $this->getOptions()->toArray();
+ $options['stop'] = new TJavaScriptLiteral("function( event, ui ) { Prado.Callback(".TJavascript::encode($this->getUniqueID()).", { 'order' : jQuery(this).sortable('toArray') }) }");
return $options;
}
@@ -86,33 +87,70 @@ class TJuiSortable extends TActivePanel implements IJuiOptions
}
/**
+ * Raises callback event. This method is required bu {@link ICallbackEventHandler}
+ * interface.
+ * It raises the {@link onSort onSort} event, then, the {@link onCallback OnCallback} event
+ * This method is mainly used by framework and control developers.
+ * @param TCallbackEventParameter the parameter associated with the callback event
+ */
+ public function raiseCallbackEvent($param)
+ {
+ $this->onSort($param->getCallbackParameter());
+ $this->onCallback($param);
+ }
+
+ /**
+ * Raises the onSort event.
+ * The order parameters are encapsulated into a {@link TJuiSortableEventParameter}
+ *
+ * @param object $params
+ */
+ public function onSort($params)
+ {
+ $this->raiseEvent('onSort', $this, new TJuiSortableEventParameter ($this->getResponse(), $params));
+
+ }
+
+ /**
+ * This method is invoked when a callback is requested. The method raises
+ * 'OnCallback' event to fire up the event handlers. If you override this
+ * method, be sure to call the parent implementation so that the event
+ * handler can be invoked.
+ * @param TCallbackEventParameter event parameter to be passed to the event handlers
+ */
+ public function onCallback($param)
+ {
+ $this->raiseEvent('OnCallback', $this, $param);
+ }
+
+ /**
* @var ITemplate template for repeater items
*/
private $_repeater=null;
/**
- * @param array data source for Selectables.
+ * @param array data source for Sortables.
*/
public function setDataSource($data)
{
- $this->getSelectables()->setDataSource($data);
+ $this->getSortables()->setDataSource($data);
}
/**
- * Overrides parent implementation. Callback {@link renderSelectables()} when
+ * Overrides parent implementation. Callback {@link renderSortables()} when
* page's IsCallback property is true.
*/
public function dataBind()
{
parent::dataBind();
if($this->getPage()->getIsCallback())
- $this->renderSelectables($this->getResponse()->createHtmlWriter());
+ $this->renderSortables($this->getResponse()->createHtmlWriter());
}
/**
* @return TRepeater suggestion list repeater
*/
- public function getSelectables()
+ public function getSortables()
{
if($this->_repeater===null)
$this->_repeater = $this->createRepeater();
@@ -120,14 +158,14 @@ class TJuiSortable extends TActivePanel implements IJuiOptions
}
/**
- * @return TRepeater new instance of TRepater to render the list of Selectables.
+ * @return TRepeater new instance of TRepater to render the list of Sortables.
*/
protected function createRepeater()
{
$repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater');
$repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="'.$this->getClientId().'_0'.'">'));
$repeater->setFooterTemplate(new TJuiSortableTemplate('</ul>'));
- $repeater->setItemTemplate(new TTemplate('<li><%# $this->DataItem %></li>',null));
+ $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>',null));
$repeater->setEmptyTemplate(new TJuiSortableTemplate('<ul></ul>'));
$this->getControls()->add($repeater);
return $repeater;
@@ -162,4 +200,19 @@ class TJuiSortableTemplate extends TComponent implements ITemplate
{
$parent->getControls()->add($this->_template);
}
+}
+
+/**
+ * TJuiSortableEventParameter class
+ *
+ * TJuiSortableEventParameter encapsulate the parameter
+ * data for <b>OnSort</b> event of TJuiSortable components
+ *
+ * @author Fabio Bas <ctrlaltca[at]gmail[dot]com>
+ * @license http://www.pradosoft.com/license
+ * @package System.Web.UI.JuiControls
+ */
+class TJuiSortableEventParameter extends TCallbackEventParameter
+{
+ public function getOrder() { return $this->getCallbackParameter()->order; }
} \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index af59545c..029b6c89 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -72,7 +72,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
*/
protected function createRepeatedControl()
{
- return new TCheckBox;
+ return new TCheckBoxItem;
}
/**
@@ -489,7 +489,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
*/
protected function getPostBackOptions()
{
- $options['ListID'] = $this->getClientID();
+ $options['ID'] = $this->getClientID();
$options['ValidationGroup'] = $this->getValidationGroup();
$options['CausesValidation'] = $this->getCausesValidation();
$options['ListName'] = $this->getUniqueID();
@@ -499,3 +499,11 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
}
+class TCheckBoxItem extends TCheckBox {
+ /**
+ * Override client implementation to avoid emitting the javascript
+ */
+ protected function renderClientControlScript($writer)
+ {
+ }
+}
diff --git a/framework/Web/UI/WebControls/TRadioButtonList.php b/framework/Web/UI/WebControls/TRadioButtonList.php
index bead3582..3afe3ec2 100644
--- a/framework/Web/UI/WebControls/TRadioButtonList.php
+++ b/framework/Web/UI/WebControls/TRadioButtonList.php
@@ -47,7 +47,7 @@ class TRadioButtonList extends TCheckBoxList
*/
protected function createRepeatedControl()
{
- return new TRadioButton;
+ return new TRadioButtonItem;
}
/**
@@ -97,3 +97,11 @@ class TRadioButtonList extends TCheckBoxList
}
}
+class TRadioButtonItem extends TRadioButton {
+ /**
+ * Override client implementation to avoid emitting the javascript
+ */
+ protected function renderClientControlScript($writer)
+ {
+ }
+}
diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php
index 09d7fc6a..c48b3cdb 100644
--- a/framework/Web/UI/WebControls/TRatingList.php
+++ b/framework/Web/UI/WebControls/TRatingList.php
@@ -173,7 +173,7 @@ class TRatingList extends TRadioButtonList
{
if(($id=$this->getCaptionID())!=='')
{
- if($control=$this->getParent()->findControl($id))
+ if($control=$this->getPage()->findControl($id))
return $control;
}
throw new TInvalidDataValueException(