diff options
Diffstat (limited to 'framework/Web/UI')
| -rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 15 | ||||
| -rw-r--r-- | framework/Web/UI/TControl.php | 28 | ||||
| -rw-r--r-- | framework/Web/UI/TTemplateManager.php | 14 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TDataTypeValidator.php | 2 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 14 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/THead.php | 19 | 
6 files changed, 52 insertions, 40 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 504cfb40..3d0ced60 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -133,7 +133,7 @@ class TClientScriptManager extends TApplicationComponent  				$this->_registeredPradoScripts[$name]=true;  			else  				throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name); -			$basePath=Prado::getFrameworkPath().'/'.self::SCRIPT_PATH; +			$basePath=$this->getPradoBaseScriptPath();  			foreach(self::$_pradoScripts[$name] as $script)  			{  				if(!isset($this->_publishedPradoFiles[$script])) @@ -145,6 +145,15 @@ class TClientScriptManager extends TApplicationComponent  		}  	} +	protected function getPradoBaseScriptPath() +	{ +		$basePath = Prado::getFrameworkPath().'/'.self::SCRIPT_PATH; +		if($this->getApplication()->getMode()===TApplication::STATE_DEBUG) +			return $basePath.'/debug'; +		else +			return $basePath.'/compressed'; +	} +  	/**  	 * Renders the <script> tag that will load the javascript library files.  	 * @param THtmlWriter writer that renders the <script> tag. @@ -154,7 +163,7 @@ class TClientScriptManager extends TApplicationComponent  		$files=implode(',',array_keys($this->_publishedPradoFiles));  		if($files!=='')  		{ -			$basePath=Prado::getFrameworkPath().'/'.self::SCRIPT_PATH; +			$basePath=$this->getPradoBaseScriptPath();  			$scriptLoader=$basePath.'/'.self::SCRIPT_LOADER;  			$url=$this->publishFilePath($scriptLoader).'?js='.trim($files,',');  			if($this->getApplication()->getMode()===TApplication::STATE_DEBUG) @@ -631,4 +640,4 @@ abstract class TClientSideOptions extends TComponent  	}  } -?>
\ No newline at end of file +?> diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index a347b0ba..ed6213cd 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -782,11 +782,8 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable  	 */
  	public function dataBind()
  	{
 -		Prado::trace("Data bind properties",'System.Web.UI.TControl');
  		$this->dataBindProperties();
 -		Prado::trace("onDataBinding()",'System.Web.UI.TControl');
  		$this->onDataBinding(null);
 -		Prado::trace("dataBindChildren()",'System.Web.UI.TControl');
  		$this->dataBindChildren();
  	}
 @@ -795,6 +792,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable  	 */
  	protected function dataBindProperties()
  	{
 +		Prado::trace("Data bind properties",'System.Web.UI.TControl');
  		if(isset($this->_rf[self::RF_DATA_BINDINGS]))
  		{
  			if(($context=$this->getTemplateControl())===null)
 @@ -823,6 +821,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable  	 */
  	protected function dataBindChildren()
  	{
 +		Prado::trace("dataBindChildren()",'System.Web.UI.TControl');
  		if(isset($this->_rf[self::RF_CONTROLS]))
  		{
  			foreach($this->_rf[self::RF_CONTROLS] as $control)
 @@ -1082,26 +1081,8 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable  	}
  	/**
 -	 * This method is invoked after the control is instantiated by a template.
 -	 * When this method is invoked, the control should have a valid TemplateControl
 -	 * and has its properties initialized according to template configurations.
 -	 * The control, however, has not been added to the page hierarchy yet.
 -	 * The default implementation of this method will invoke
 -	 * the potential parent control's {@link addParsedObject} to add the control as a child.
 -	 * This method can be overriden.
 -	 * @param TControl potential parent of this control
 -	 * @see addParsedObject
 -	 */
 -	public function createdOnTemplate($parent)
 -	{
 -		$parent->addParsedObject($this);
 -	}
 -
 -	/**
 -	 * Processes an object that is created during parsing template.
 -	 * The object can be either a component or a static text string.
 -	 * By default, the object will be added into the child control collection.
 -	 * This method can be overriden to customize the handling of newly created objects in template.
 +	 * Adds the object instantiated on a template to the child control collection.
 +	 * This method overrides the parent implementation.
  	 * Only framework developers and control developers should use this method.
  	 * @param string|TComponent text string or component parsed and instantiated in template
  	 * @see createdOnTemplate
 @@ -1361,6 +1342,7 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable  	 */
  	public function onDataBinding($param)
  	{
 +		Prado::trace("onDataBinding()",'System.Web.UI.TControl');
  		$this->raiseEvent('OnDataBinding',$this,$param);
  	}
 diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index c13b5a9d..b3317709 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -286,11 +286,8 @@ class TTemplate extends TApplicationComponent implements ITemplate  		$directChildren=array();
  		foreach($this->_tpl as $key=>$object)
  		{
 -			if($object[0]===-1)
 -				$parent=$tplControl;
 -			else if(isset($controls[$object[0]]))
 -				$parent=$controls[$object[0]];
 -			else
 +			$parent=isset($controls[$object[0]])?$controls[$object[0]]:$tplControl;
 +			if(($parent instanceof TControl) && !$parent->getAllowChildControls())
  				continue;
  			if(isset($object[2]))	// component
  			{
 @@ -328,6 +325,7 @@ class TTemplate extends TApplicationComponent implements ITemplate  				}
  				else if($component instanceof TComponent)
  				{
 +					$controls[$key]=$component;
  					if(isset($properties['id']))
  					{
  						if(is_array($properties['id']))
 @@ -341,7 +339,7 @@ class TTemplate extends TApplicationComponent implements ITemplate  					if($parent===$tplControl)
  						$directChildren[]=$component;
  					else
 -						$parent->addParsedObject($component);
 +						$component->createdOnTemplate($parent);
  				}
  			}
  			else
 @@ -370,7 +368,7 @@ class TTemplate extends TApplicationComponent implements ITemplate  		// if the child needs its own child controls.
  		foreach($directChildren as $control)
  		{
 -			if($control instanceof TControl)
 +			if($control instanceof TComponent)
  				$control->createdOnTemplate($tplControl);
  			else
  				$tplControl->addParsedObject($control);
 @@ -950,4 +948,4 @@ class TTemplate extends TApplicationComponent implements ITemplate  	}
  }
 -?>
\ No newline at end of file +?>
 diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php index 3e91ec15..ec39e8a3 100644 --- a/framework/Web/UI/WebControls/TDataTypeValidator.php +++ b/framework/Web/UI/WebControls/TDataTypeValidator.php @@ -91,7 +91,7 @@ class TDataTypeValidator extends TBaseValidator  	{
  		if($value=='')
  			return true;
 -		
 +
  		switch($this->getDataType())
  		{
  			case 'Integer':
 diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 0c3e0b9a..02361e54 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -317,14 +317,14 @@ class TDatePicker extends TTextBox  	/**
  	 * Returns the value to be validated.
  	 * This methid is required by IValidatable interface.
 -	 * @return integer the value of the property to be validated.
 +	 * @return integer the interger timestamp if valid, otherwise the original text.
  	 */
  	public function getValidationPropertyValue()
  	{
 -		if($this->getText() === '')
 +		if(($text = $this->getText()) === '')
  			return '';
  		$date = $this->getTimeStamp();
 -		return $date == null ? '' : $date;
 +		return $date == null ? $text : $date;
  	}
  	/**
 @@ -422,7 +422,9 @@ class TDatePicker extends TTextBox  		else
  			$year = $date['year'];
 -		$date = @mktime(0, 0, 0, $month, $day, $year);
 +		$s = Prado::createComponent('System.Util.TDateTimeStamp');
 +		$date = $s->getTimeStamp(0, 0, 0, $month, $day, $year);
 +		//$date = @mktime(0, 0, 0, $month, $day, $year);
  		$pattern = $this->getDateFormat();
  		$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
 @@ -509,7 +511,9 @@ class TDatePicker extends TTextBox  			$writer->addAttribute('class', $class);
  		$writer->renderBeginTag('span');
 -		$date = @getdate($this->getTimeStampFromText());
 +		$s = Prado::createComponent('System.Util.TDateTimeStamp');
 +		$date = $s->getDate($this->getTimeStampFromText());
 +		//$date = @getdate($this->getTimeStampFromText());
  		$this->renderCalendarSelections($writer, $date);
 diff --git a/framework/Web/UI/WebControls/THead.php b/framework/Web/UI/WebControls/THead.php index 5c91002b..a803d484 100644 --- a/framework/Web/UI/WebControls/THead.php +++ b/framework/Web/UI/WebControls/THead.php @@ -113,6 +113,22 @@ class THead extends TControl  	}
  	/**
 +	 * @return string the URL for the shortcut icon of the page. Defaults to ''.
 +	 */
 +	public function getShortcutIcon()
 +	{
 +		return $this->getViewState('ShortcutIcon','');
 +	}
 +
 +	/**
 +	 * @param string the URL for the shortcut icon of the page.
 +	 */
 +	public function setShortcutIcon($url)
 +	{
 +		$this->setViewState('ShortcutIcon',$url,'');
 +	}
 +
 +	/**
  	 * @return TMetaTagCollection meta tag collection
  	 */
  	public function getMetaTags()
 @@ -136,6 +152,9 @@ class THead extends TControl  		$writer->write("<head>\n<title>".THttpUtility::htmlEncode($title)."</title>\n");
  		if(($baseUrl=$this->getBaseUrl())!=='')
  			$writer->write('<base href="'.$baseUrl."\" />\n");
 +		if(($icon=$this->getShortcutIcon())!=='')
 +			$writer->write('<link rel="shortcut icon" href="'.$icon."\" />\n");
 +
  		if(($metaTags=$this->getMetaTags())!==null)
  		{
  			foreach($metaTags as $metaTag)
  | 
