diff options
11 files changed, 60 insertions, 9 deletions
| @@ -3,6 +3,7 @@ Version 3.1.0 beta to be released  BUG: Ticket#517 - Quickstart I18N sample: conflicting module ID (Wei)  BUG: Ticket#521 - comment tag on TActiveButton stop callback (Wei)  BUG: TXmlElement did not encode attribute and text values when being saved as a string (Qiang) +BUG: SelectedIndices not return expected result for ActiveListBox (Wei)  ENH: Ticket#513 - Display last modified / revision in quickstart (Wei)  ENH: Ticket#519 - Update TActiveRecord implementation (Wei)  ENH: Added PRADO_CHMOD constant so that users can specify the permission of PRADO-created directories (Qiang) diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php index e7e7ceb8..d659851f 100644 --- a/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TMysqlColumnMetaData.php @@ -25,6 +25,7 @@ class TMysqlColumnMetaData extends TComponent  	private $_autoIncrement;
  	private $_default;
  	private $_notNull=true;
 +	private $_property;
  	private $_isPrimary=null;
 @@ -38,8 +39,9 @@ class TMysqlColumnMetaData extends TComponent  	 * @param string serial name.
  	 * @param string default value.
  	 */
 -	public function __construct($name,$type,$notNull,$autoIncrement,$default,$primary)
 +	public function __construct($property, $name,$type,$notNull,$autoIncrement,$default,$primary)
  	{
 +		$this->_property=$property;
  		$this->_name=$name;
  		$this->_type=$type;
  		$this->_notNull=$notNull;
 @@ -56,6 +58,14 @@ class TMysqlColumnMetaData extends TComponent  		return $this->_name;
  	}
 +	/**
 +	 * @return string column name, used as active record property name
 +	 */
 +	public function getProperty()
 +	{
 +		return $this->_property;
 +	}
 +
  	public function getPHPType()
  	{
  		switch(strtolower($this->_type))
 diff --git a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php index dcbf6ada..5e438e37 100644 --- a/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TMysqlMetaDataInspector.php @@ -51,7 +51,7 @@ class TMysqlMetaDataInspector extends TDbMetaDataInspector  		$autoIncrement=is_int(strpos(strtolower($col['Extra']), 'auto_increment'));
  		$default = $col['Default'];
  		$primaryKey = $col['Key']==='PRI';
 -		return new TMysqlColumnMetaData($name,$type,$notNull,$autoIncrement,$default,$primaryKey);
 +		return new TMysqlColumnMetaData($col['Field'],$name,$type,$notNull,$autoIncrement,$default,$primaryKey);
  	}
  	/**
 diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php index 1e799aac..a51c435d 100644 --- a/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TPgsqlColumnMetaData.php @@ -26,6 +26,7 @@ class TPgsqlColumnMetaData extends TComponent  	private $_default;
  	private $_length;
  	private $_notNull=true;
 +	private $_property;
  	private $_isPrimary=null;
 @@ -39,8 +40,9 @@ class TPgsqlColumnMetaData extends TComponent  	 * @param string serial name.
  	 * @param string default value.
  	 */
 -	public function __construct($name,$type,$length,$notNull,$serial,$default)
 +	public function __construct($property,$name,$type,$length,$notNull,$serial,$default)
  	{
 +		$this->_property=$property;
  		$this->_name=$name;
  		$this->_type=$type;
  		$this->_length=$length;
 @@ -57,6 +59,14 @@ class TPgsqlColumnMetaData extends TComponent  		return $this->_name;
  	}
 +	/**
 +	 * @return string column name, used as active record property name
 +	 */
 +	public function getProperty()
 +	{
 +		return $this->_property;
 +	}
 +
  	public function getPHPType()
  	{
  		switch(strtolower($this->_type))
 diff --git a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php index 910b826e..6f787942 100644 --- a/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TPgsqlMetaDataInspector.php @@ -150,7 +150,7 @@ EOD;  		$notNull = $col['attnotnull'];
  		$serial = $col['attisserial'] ? $schema.'.'.$this->getSerialName($col['adsrc']) : null;
  		$default = $serial === null && $col['atthasdef'] ? $col['adsrc'] : null;
 -		return new TPgsqlColumnMetaData($name,$type,$length,$notNull,$serial,$default);
 +		return new TPgsqlColumnMetaData($col['attname'],$name,$type,$length,$notNull,$serial,$default);
  	}
  	/**
 diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php index abb50caf..92315a1a 100644 --- a/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php +++ b/framework/Data/ActiveRecord/Vendor/TSqliteColumnMetaData.php @@ -28,9 +28,11 @@ class TSqliteColumnMetaData extends TComponent  	private $_autoIncrement;
  	private $_default;
  	private $_primary=false;
 +	private $_property;
 -	public function __construct($name,$type,$notNull,$autoIncrement,$default,$primary)
 +	public function __construct($property,$name,$type,$notNull,$autoIncrement,$default,$primary)
  	{
 +		$this->_property=$property;
  		$this->_name=$name;
  		$this->_type=$type;
  		$this->_notNull=$notNull;
 @@ -55,6 +57,14 @@ class TSqliteColumnMetaData extends TComponent  	}
  	/**
 +	 * @return string column name, used as active record property name
 +	 */
 +	public function getProperty()
 +	{
 +		return $this->_property;
 +	}
 +
 +	/**
  	 * @return string quoted column name.
  	 */
  	public function getName()
 diff --git a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php index 29bc3b8a..3621c666 100644 --- a/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php +++ b/framework/Data/ActiveRecord/Vendor/TSqliteMetaDataInspector.php @@ -73,7 +73,7 @@ class TSqliteMetaDataInspector extends TDbMetaDataInspector  		$primary = $col['pk']==='1';
  		$autoIncrement = strtolower($type)==='integer' && $primary;
  		$default = $col['dflt_value'];
 -		return new TSqliteColumnMetaData($name,$type,$notNull,$autoIncrement,$default,$primary);
 +		return new TSqliteColumnMetaData($col['name'],$name,$type,$notNull,$autoIncrement,$default,$primary);
  	}
  	/**
 diff --git a/framework/Web/UI/ActiveControls/TActiveListBox.php b/framework/Web/UI/ActiveControls/TActiveListBox.php index 21816961..97b28ac7 100644 --- a/framework/Web/UI/ActiveControls/TActiveListBox.php +++ b/framework/Web/UI/ActiveControls/TActiveListBox.php @@ -127,6 +127,10 @@ class TActiveListBox extends TListBox implements IActiveControl, ICallbackEventH  	{  		parent::onPreRender($param);  		$this->getAdapter()->updateListItems(); +		$multiple = $this->getIsMultiSelect(); +		$id = $this->getUniqueID(); $multi_id = $id.'[]'; +		if($multiple) +			$this->getPage()->registerPostDataLoader($multi_id);  	}  } diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php index 000e896f..ebd9d168 100644 --- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php +++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php @@ -360,10 +360,17 @@ class TBaseActiveCallbackControl extends TBaseActiveControl  	 * request for this control call the <tt>dispatch()</tt> method on the
  	 * request instance. Example code in javascript
  	 * <code>
 -	 *   request = <%= $this->mycallback->ActiveControl->Javascript %>;
 +	 *   var request = <%= $this->mycallback->ActiveControl->Javascript %>;
  	 *   request.setParameter('hello');
  	 *   request.dispatch(); //make the callback request.
  	 * </code>
 +	 *
 +	 * Alternatively,
 +	 * <code>
 +	 * //dispatches immediately
 +	 * Prado.Callback("<%= $this->mycallback->UniqueID %>",
 +	 *    $this->mycallback->ActiveControl->JsCallbackOptions);
 +	 * </code>
  	 * @return string javascript client-side callback request object (javascript
  	 * code)
  	 */
 @@ -372,6 +379,14 @@ class TBaseActiveCallbackControl extends TBaseActiveControl  		$client = $this->getPage()->getClientScript();
  		return $client->getCallbackReference($this->getControl(),$this->getClientSideOptions());
  	}
 +
 +	/**
 +	 * @param string callback requestion options as javascript code.
 +	 */
 +	public function getJsCallbackOptions()
 +	{
 +		return TJavascript::encode($this->getClientSideOptions());
 +	}
  }
  ?>
\ No newline at end of file diff --git a/framework/Web/UI/ActiveControls/TCallback.php b/framework/Web/UI/ActiveControls/TCallback.php index 60bdaf10..47d36d54 100644 --- a/framework/Web/UI/ActiveControls/TCallback.php +++ b/framework/Web/UI/ActiveControls/TCallback.php @@ -29,7 +29,8 @@ Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');   *  <script type="text/javascript">
   * 		function do_callback1()
   *      {
 - *           <%= $this->callback1->ActiveControl->Javascript %>
 + *           var request = <%= $this->callback1->ActiveControl->Javascript %>;
 + *			 request.dispatch();
   *      }
   *  </script>
   *  <div onclick="do_callback1()">Click Me!</div>
 diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 53c9b03f..96ac6d36 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -846,7 +846,7 @@ class TPage extends TTemplateControl  					if($control->loadPostData($key,$postData))
  						$this->_controlsPostDataChanged[]=$control;
  				}
 -				else if($control instanceof IPostBackEventHandler && 
 +				else if($control instanceof IPostBackEventHandler &&
  					empty($this->_postData[self::FIELD_POSTBACK_TARGET]))
  				{
  					$this->_postData->add(self::FIELD_POSTBACK_TARGET,$key);  // not calling setPostBackEventTarget() because the control may be removed later
 | 
