From 1bc5daba808067a1db85ab8b8a401c217c9a8097 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 26 Nov 2005 03:04:23 +0000 Subject: --- framework/Web/TTemplateManager.php | 4 +-- framework/Web/TThemeManager.php | 4 +-- framework/Web/UI/WebControls/TImage.php | 46 +++++++++++++++++---------- framework/Web/UI/WebControls/TImageButton.php | 11 +++---- framework/Web/UI/WebControls/TPanel.php | 6 ++-- framework/Web/UI/WebControls/TTextBox.php | 6 ++-- 6 files changed, 44 insertions(+), 33 deletions(-) (limited to 'framework') diff --git a/framework/Web/TTemplateManager.php b/framework/Web/TTemplateManager.php index 6b9ccfc0..1f3044a2 100644 --- a/framework/Web/TTemplateManager.php +++ b/framework/Web/TTemplateManager.php @@ -294,7 +294,7 @@ class TTemplate extends TComponent implements ITemplate if($value[0]===1) $value=$component->evaluateExpression($value[1]); else if($value[0]===2) - $value=$assetManager->publishFilePath($this->_contextPath.'/'.$value[1]); + $value=$assetManager->publishFilePath($this->_contextPath.'/'.ltrim($value[1],'/')); else throw new TTemplateRuntimeException('template_attribute_unbindable',get_class($component),$name); } @@ -342,7 +342,7 @@ class TTemplate extends TComponent implements ITemplate $component->$setter($component->evaluateExpression($value[1])); else if($value[0]===2) { - $url=$assetManager->publishFilePath($this->_contextPath.'/'.$value[1]); + $url=$assetManager->publishFilePath($this->_contextPath.'/'.ltrim($value[1],'/')); $component->$setter($url); } else diff --git a/framework/Web/TThemeManager.php b/framework/Web/TThemeManager.php index 5d7319e8..0a54cf8e 100644 --- a/framework/Web/TThemeManager.php +++ b/framework/Web/TThemeManager.php @@ -150,7 +150,7 @@ class TThemeManager extends TComponent implements IModule if(strpos($basePath,$appPath)===false) throw new TConfigurationException('thememanager_baseurl_required'); $appUrl=dirname($this->_application->getRequest()->getApplicationPath()); - $this->_baseUrl=$appUrl.'/'.strtr(substr($basePath,strlen($appPath)),'\\','/'); + $this->_baseUrl=$appUrl.strtr(substr($basePath,strlen($appPath)),'\\','/'); } return $this->_baseUrl; } @@ -306,7 +306,7 @@ class TTheme extends TComponent if($value[0]===1) $value=$this->evaluateExpression($value[1]); else if($value[0]===2) - $value=$this->_themeUrl.'/'.$value[1]; + $value=$this->_themeUrl.'/'.ltrim($value[1],'/'); } if(strpos($name,'.')===false) // is simple property or custom attribute { diff --git a/framework/Web/UI/WebControls/TImage.php b/framework/Web/UI/WebControls/TImage.php index 0033209a..dd0387a5 100644 --- a/framework/Web/UI/WebControls/TImage.php +++ b/framework/Web/UI/WebControls/TImage.php @@ -3,9 +3,9 @@ * TImage class file. * * @author Qiang Xue - * @link http://www.xisc.com/ - * @copyright Copyright © 2004-2005, Qiang Xue - * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls */ @@ -13,6 +13,13 @@ /** * TImage class * + * TImage displays an image on a page. The image is specified via the + * {@link setImageUrl ImageUrl} property which takes a relative or absolute + * URL to the image file. The alignment of the image displayed is set by + * the {@link setImageAlign ImageAlign} property. To set alternative texts + * or long description of the image, use {@link setAlternativeText AlternativeText} + * or {@link setDescriptionUrl DescriptionUrl} property, respectively. + * * @author Qiang Xue * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls @@ -20,30 +27,34 @@ */ class TImage extends TWebControl { - public static $IMAGE_ALIGN=array('NotSet','AbsBottom','AbsMiddle','Baseline','Bottom','Left','Middle','Right','TextTop','Top'); - // todo: TControl::resolveClientUrl() /** - * @return string tag name of the image + * @return string tag name of image control */ protected function getTagName() { return 'img'; } + /** + * Adds attributes related to an HTML image element to renderer. + * @param THtmlWriter the writer used for the rendering purpose + */ protected function addAttributesToRender($writer) { $writer->addAttribute('src',$this->getImageUrl()); $writer->addAttribute('alt',$this->getAlternateText()); if(($desc=$this->getDescriptionUrl())!=='') - $writer->addAttribute('longdesc',$this->resolveClientUrl($desc)); - if(($align=$this->getImageAlign())!=='NotSet') - $writer->addAttribute('align',strtolower($align)); + $writer->addAttribute('longdesc',$desc); + if(($align=$this->getImageAlign())!=='') + $writer->addAttribute('align',$align); + if(($width=$this->getBorderWidth())==='') + $writer->addStyleAttribute('border-width','0px'); parent::addAttributesToRender($writer); } /** * Renders the body content of the image. - * None will be rendered for an image. + * Nothing to be rendered within image tags. * @param THtmlWriter the writer for rendering */ protected function renderContents($writer) @@ -68,7 +79,7 @@ class TImage extends TWebControl } /** - * @return string the alignment of the image with respective to other elements on the page. + * @return string the alignment of the image with respective to other elements on the page, defaults to empty. */ public function getImageAlign() { @@ -77,15 +88,18 @@ class TImage extends TWebControl /** * Sets the alignment of the image with respective to other elements on the page. + * Possible values include: absbottom, absmiddle, baseline, bottom, left, + * middle, right, texttop, and top. If an empty string is passed in, + * imagealign attribute will not be rendered. * @param string the alignment of the image */ public function setImageAlign($value) { - $this->setViewState('ImageAlign',TPropertyValue::ensureEnum($value,self::$IMAGE_ALIGN),'NotSet'); + $this->setViewState('ImageAlign',$value,''); } /** - * @return string the location of the image file to be displayed + * @return string the URL of the image file */ public function getImageUrl() { @@ -93,8 +107,7 @@ class TImage extends TWebControl } /** - * Sets the location of the image file to be displayed. - * @param string the location of the image file (file path or URL) + * @param string the URL of the image file */ public function setImageUrl($value) { @@ -110,8 +123,7 @@ class TImage extends TWebControl } /** - * Sets the link to long description - * @param string the link to long description + * @param string the URL to the long description of the image. */ public function setDescriptionUrl($value) { diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php index 724dcf5c..d715480d 100644 --- a/framework/Web/UI/WebControls/TImageButton.php +++ b/framework/Web/UI/WebControls/TImageButton.php @@ -3,15 +3,15 @@ * TImageButton class file * * @author Qiang Xue - * @link http://www.xisc.com/ - * @copyright Copyright © 2004-2005, Qiang Xue - * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls */ /** - * TImage class file + * Includes TImage class file */ Prado::using('System.Web.UI.WebControls.TImage'); @@ -19,7 +19,7 @@ Prado::using('System.Web.UI.WebControls.TImage'); * TImageButton class * * TImageButton displays an image on the Web page and responds to mouse clicks on the image. - * It is similar to the TButton component except that the TImageButton also captures the + * It is similar to the {@link TButton} control except that the TImageButton also captures the * coordinates where the image is clicked. * * Write a OnClick event handler to programmatically determine the coordinates @@ -42,7 +42,6 @@ Prado::using('System.Web.UI.WebControls.TImage'); * @package System.Web.UI.WebControls * @since 3.0 */ - class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEventHandler { private $_x=0; diff --git a/framework/Web/UI/WebControls/TPanel.php b/framework/Web/UI/WebControls/TPanel.php index 0f85a52f..ae6a1244 100644 --- a/framework/Web/UI/WebControls/TPanel.php +++ b/framework/Web/UI/WebControls/TPanel.php @@ -3,9 +3,9 @@ * TPanel class file * * @author Qiang Xue - * @link http://www.xisc.com/ - * @copyright Copyright © 2004-2005, Qiang Xue - * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls */ diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index b8c594f3..5e57e240 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -3,9 +3,9 @@ * TTextBox class file. * * @author Qiang Xue - * @link http://www.xisc.com/ - * @copyright Copyright © 2004-2005, Qiang Xue - * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls */ -- cgit v1.2.3