From 0b60336c37f91d79ecaefbe0f8b86cc324264451 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 10 May 2012 21:09:10 +0000 Subject: fix for #399, addresses ratings.js and inlineeditor.js --- framework/Web/Javascripts/packages.php | 26 +++++++++----- .../Web/UI/ActiveControls/TInPlaceTextBox.php | 19 ++++++++++ framework/Web/UI/WebControls/TRatingList.php | 12 ++++++- framework/Web/UI/WebControls/TTextBox.php | 42 +++++++++++----------- 4 files changed, 68 insertions(+), 31 deletions(-) (limited to 'framework') diff --git a/framework/Web/Javascripts/packages.php b/framework/Web/Javascripts/packages.php index d48dfdd5..a32c54b5 100644 --- a/framework/Web/Javascripts/packages.php +++ b/framework/Web/Javascripts/packages.php @@ -14,8 +14,7 @@ $packages = array( SCRIPTACULOUS_DIR.'/effects.js', 'prado/prado.js', 'prado/scriptaculous-adapter.js', - 'prado/controls/controls.js', - 'prado/ratings/ratings.js', + 'prado/controls/controls.js' ), 'effects' => array( @@ -42,8 +41,7 @@ $packages = array( SCRIPTACULOUS_DIR.'/controls.js', 'prado/activecontrols/json2.js', 'prado/activecontrols/ajax3.js', - 'prado/activecontrols/activecontrols3.js', - 'prado/activecontrols/inlineeditor.js' + 'prado/activecontrols/activecontrols3.js' ), 'dragdrop'=>array( @@ -83,6 +81,14 @@ $packages = array( 'prado/controls/htmlarea.js' ), + 'ratings' => array( + 'prado/ratings/ratings.js', + ), + + 'inlineeditor' => array( + 'prado/activecontrols/inlineeditor.js' + ), + ); @@ -92,18 +98,20 @@ $dependencies = array( 'effects' => array('prado', 'effects'), 'validator' => array('prado', 'validator'), 'logger' => array('prado', 'logger'), - 'datepicker' => array('prado', 'datepicker'), - 'colorpicker' => array('prado', 'colorpicker'), + '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('prado', 'datepicker', 'ajax', 'activedatepicker'), - 'activefileupload' => array('prado', 'effects', 'ajax', 'activefileupload'), - 'dragdropextra' => array('prado', 'effects', 'ajax', 'dragdrop','dragdropextra'), + 'activedatepicker' => array('prado', 'datepicker', 'ajax', 'activedatepicker'), + 'activefileupload' => array('prado', 'effects', 'ajax', 'activefileupload'), + 'dragdropextra' => array('prado', 'effects', 'ajax', 'dragdrop','dragdropextra'), 'accordion' => array('prado', 'effects', 'accordion'), 'htmlarea' => array('prado', 'htmlarea'), + 'ratings' => array('prado', 'effects', 'ajax', 'ratings'), + 'inlineeditor' => array('prado', 'effects', 'ajax', 'inlineeditor'), ); return array($packages, $dependencies); diff --git a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php index 47d8022e..1f19918e 100644 --- a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php +++ b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php @@ -268,4 +268,23 @@ class TInPlaceTextBox extends TActiveTextBox $this->getClientClassName(), $this->getPostBackOptions()); } + /** + * Registers CSS and JS. + * This method is invoked right before the control rendering, if the control is visible. + * @param mixed event parameter + */ + public function onPreRender($param) + { + parent::onPreRender($param); + $this->registerClientScript(); + } + + /** + * Registers the relevant JavaScript. + */ + protected function registerClientScript() + { + $cs=$this->getPage()->getClientScript(); + $cs->registerPradoScript('inlineeditor'); + } } diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php index f939a210..457bcd74 100644 --- a/framework/Web/UI/WebControls/TRatingList.php +++ b/framework/Web/UI/WebControls/TRatingList.php @@ -283,7 +283,8 @@ class TRatingList extends TRadioButtonList parent::onPreRender($param); $this->publishStyle($this->getRatingStyle()); $this->_ratingImages = $this->publishImages($this->getRatingStyle()); - } + $this->registerClientScript(); + } /** * @param string rating style name @@ -312,6 +313,15 @@ class TRatingList extends TRadioButtonList return $files; } + /** + * Registers the relevant JavaScript. + */ + protected function registerClientScript() + { + $cs=$this->getPage()->getClientScript(); + $cs->registerPradoScript('ratings'); + } + /** * @param string asset file in the self::SCRIPT_PATH directory. * @return string asset file url. diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index a19d35cd..6535fc63 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2011 PradoSoft + * @copyright Copyright © 2005-2011 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -67,7 +67,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable */ private $_safeText; private $_dataChanged=false; - private $_isValid=true; + private $_isValid=true; /** * @return string tag name of the textbox @@ -129,7 +129,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable $writer->addAttribute('value',$text); $writer->addAttribute('type','password'); } - + if(($act=$this->getAutoCompleteType())!=='None') { if($act==='Disabled') @@ -149,7 +149,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable $writer->addAttribute('vcard_name','vCard.'.$act); } } - + if(($cols=$this->getColumns())>0) $writer->addAttribute('size',"$cols"); if(($maxLength=$this->getMaxLength())>0) @@ -246,23 +246,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable return $this->getText(); } - /** - * Returns true if this control validated successfully. - * Defaults to true. - * @return bool wether this control validated successfully. - */ - public function getIsValid() - { - return $this->_isValid; - } - /** - * @param bool wether this control is valid. - */ - public function setIsValid($value) - { - $this->_isValid=TPropertyValue::ensureBoolean($value); - } - + /** + * Returns true if this control validated successfully. + * Defaults to true. + * @return bool wether this control validated successfully. + */ + public function getIsValid() + { + return $this->_isValid; + } + /** + * @param bool wether this control is valid. + */ + public function setIsValid($value) + { + $this->_isValid=TPropertyValue::ensureBoolean($value); + } + /** * Raises OnTextChanged event. * This method is invoked when the value of the {@link getText Text} -- cgit v1.2.3