From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- framework/Web/UI/WebControls/THyperLink.php | 454 ++++++++++++++-------------- 1 file changed, 227 insertions(+), 227 deletions(-) (limited to 'framework/Web/UI/WebControls/THyperLink.php') diff --git a/framework/Web/UI/WebControls/THyperLink.php b/framework/Web/UI/WebControls/THyperLink.php index 1e32d6c9..b745f7b0 100644 --- a/framework/Web/UI/WebControls/THyperLink.php +++ b/framework/Web/UI/WebControls/THyperLink.php @@ -1,227 +1,227 @@ - - * @link http://www.xisc.com/ - * @copyright Copyright © 2005-2012 PradoSoft - * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @version $Id$ - * @package System.Web.UI.WebControls - */ - -/** - * THyperLink class - * - * THyperLink displays a hyperlink on a page. The hyperlink URL is specified - * via the {@link setNavigateUrl NavigateUrl} property, and link text is via - * the {@link setText Text} property. It is also possible to display an image - * by setting the {@link setImageUrl ImageUrl} property. In this case, - * {@link getText Text} is displayed as the alternate text of the image. - * The link target is specified via the {@link setTarget Target} property. - * If both {@link getImageUrl ImageUrl} and {@link getText Text} are empty, - * the content enclosed within the control tag will be rendered. - * - * @author Qiang Xue - * @version $Id$ - * @package System.Web.UI.WebControls - * @since 3.0 - */ -class THyperLink extends TWebControl implements IDataRenderer -{ - /** - * @return string tag name of the hyperlink - */ - protected function getTagName() - { - return 'a'; - } - - /** - * Adds attributes related to a hyperlink element to renderer. - * @param THtmlWriter the writer used for the rendering purpose - */ - protected function addAttributesToRender($writer) - { - $isEnabled=$this->getEnabled(true); - if($this->getEnabled() && !$isEnabled) - $writer->addAttribute('disabled','disabled'); - parent::addAttributesToRender($writer); - if(($url=$this->getNavigateUrl())!=='' && $isEnabled) - $writer->addAttribute('href',$url); - if(($target=$this->getTarget())!=='') - $writer->addAttribute('target',$target); - } - - /** - * Renders the body content of the hyperlink. - * @param THtmlWriter the writer for rendering - */ - public function renderContents($writer) - { - if(($imageUrl=$this->getImageUrl())==='') - { - if(($text=$this->getText())!=='') - $writer->write(THttpUtility::htmlEncode($text)); - else if($this->getHasControls()) - parent::renderContents($writer); - else - $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl())); - } - else - { - $this->createImage($imageUrl)->renderControl($writer); - } - } - - /** - * Gets the TImage for rendering the ImageUrl property. This is not for - * creating dynamic images. - * @param string image url. - * @return TImage image control for rendering. - */ - protected function createImage($imageUrl) - { - $image=Prado::createComponent('System.Web.UI.WebControls.TImage'); - $image->setImageUrl($imageUrl); - if(($width=$this->getImageWidth())!=='') - $image->setWidth($width); - if(($height=$this->getImageHeight())!=='') - $image->setHeight($height); - if(($toolTip=$this->getToolTip())!=='') - $image->setToolTip($toolTip); - if(($text=$this->getText())!=='') - $image->setAlternateText($text); - $image->setBorderWidth('0'); - return $image; - } - - /** - * @return string the text caption of the THyperLink - */ - public function getText() - { - return $this->getViewState('Text',''); - } - - /** - * Sets the text caption of the THyperLink. - * @param string the text caption to be set - */ - public function setText($value) - { - $this->setViewState('Text',$value,''); - } - - /** - * @return string height of the image in the THyperLink - */ - public function getImageHeight() - { - return $this->getViewState('ImageHeight',''); - } - - /** - * Sets the height of the image in the THyperLink - * @param string height of the image in the THyperLink - */ - public function setImageHeight($value) - { - $this->setViewSTate('ImageHeight',$value,''); - } - - /** - * @return string the location of the image file for the THyperLink - */ - public function getImageUrl() - { - return $this->getViewState('ImageUrl',''); - } - - /** - * Sets the location of image file of the THyperLink. - * @param string the image file location - */ - public function setImageUrl($value) - { - $this->setViewState('ImageUrl',$value,''); - } - - /** - * @return string width of the image in the THyperLink - */ - public function getImageWidth() - { - return $this->getViewState('ImageWidth',''); - } - - /** - * Sets the width of the image in the THyperLink - * @param string width of the image - */ - public function setImageWidth($value) - { - $this->setViewState('ImageWidth',$value,''); - } - - /** - * @return string the URL to link to when the THyperLink component is clicked. - */ - public function getNavigateUrl() - { - return $this->getViewState('NavigateUrl',''); - } - - /** - * Sets the URL to link to when the THyperLink component is clicked. - * @param string the URL - */ - public function setNavigateUrl($value) - { - $this->setViewState('NavigateUrl',$value,''); - } - - /** - * Returns the URL to link to when the THyperLink component is clicked. - * This method is required by {@link IDataRenderer}. - * It is the same as {@link getText()}. - * @return string the text caption - * @see getText - * @since 3.1.0 - */ - public function getData() - { - return $this->getText(); - } - - /** - * Sets the URL to link to when the THyperLink component is clicked. - * This method is required by {@link IDataRenderer}. - * It is the same as {@link setText()}. - * @param string the text caption to be set - * @see setText - * @since 3.1.0 - */ - public function setData($value) - { - $this->setText($value); - } - - /** - * @return string the target window or frame to display the Web page content linked to when the THyperLink component is clicked. - */ - public function getTarget() - { - return $this->getViewState('Target',''); - } - - /** - * Sets the target window or frame to display the Web page content linked to when the THyperLink component is clicked. - * @param string the target window, valid values include '_blank', '_parent', '_self', '_top' and empty string. - */ - public function setTarget($value) - { - $this->setViewState('Target',$value,''); - } -} - + + * @link http://www.xisc.com/ + * @copyright Copyright © 2005-2012 PradoSoft + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version $Id$ + * @package System.Web.UI.WebControls + */ + +/** + * THyperLink class + * + * THyperLink displays a hyperlink on a page. The hyperlink URL is specified + * via the {@link setNavigateUrl NavigateUrl} property, and link text is via + * the {@link setText Text} property. It is also possible to display an image + * by setting the {@link setImageUrl ImageUrl} property. In this case, + * {@link getText Text} is displayed as the alternate text of the image. + * The link target is specified via the {@link setTarget Target} property. + * If both {@link getImageUrl ImageUrl} and {@link getText Text} are empty, + * the content enclosed within the control tag will be rendered. + * + * @author Qiang Xue + * @version $Id$ + * @package System.Web.UI.WebControls + * @since 3.0 + */ +class THyperLink extends TWebControl implements IDataRenderer +{ + /** + * @return string tag name of the hyperlink + */ + protected function getTagName() + { + return 'a'; + } + + /** + * Adds attributes related to a hyperlink element to renderer. + * @param THtmlWriter the writer used for the rendering purpose + */ + protected function addAttributesToRender($writer) + { + $isEnabled=$this->getEnabled(true); + if($this->getEnabled() && !$isEnabled) + $writer->addAttribute('disabled','disabled'); + parent::addAttributesToRender($writer); + if(($url=$this->getNavigateUrl())!=='' && $isEnabled) + $writer->addAttribute('href',$url); + if(($target=$this->getTarget())!=='') + $writer->addAttribute('target',$target); + } + + /** + * Renders the body content of the hyperlink. + * @param THtmlWriter the writer for rendering + */ + public function renderContents($writer) + { + if(($imageUrl=$this->getImageUrl())==='') + { + if(($text=$this->getText())!=='') + $writer->write(THttpUtility::htmlEncode($text)); + else if($this->getHasControls()) + parent::renderContents($writer); + else + $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl())); + } + else + { + $this->createImage($imageUrl)->renderControl($writer); + } + } + + /** + * Gets the TImage for rendering the ImageUrl property. This is not for + * creating dynamic images. + * @param string image url. + * @return TImage image control for rendering. + */ + protected function createImage($imageUrl) + { + $image=Prado::createComponent('System.Web.UI.WebControls.TImage'); + $image->setImageUrl($imageUrl); + if(($width=$this->getImageWidth())!=='') + $image->setWidth($width); + if(($height=$this->getImageHeight())!=='') + $image->setHeight($height); + if(($toolTip=$this->getToolTip())!=='') + $image->setToolTip($toolTip); + if(($text=$this->getText())!=='') + $image->setAlternateText($text); + $image->setBorderWidth('0'); + return $image; + } + + /** + * @return string the text caption of the THyperLink + */ + public function getText() + { + return $this->getViewState('Text',''); + } + + /** + * Sets the text caption of the THyperLink. + * @param string the text caption to be set + */ + public function setText($value) + { + $this->setViewState('Text',$value,''); + } + + /** + * @return string height of the image in the THyperLink + */ + public function getImageHeight() + { + return $this->getViewState('ImageHeight',''); + } + + /** + * Sets the height of the image in the THyperLink + * @param string height of the image in the THyperLink + */ + public function setImageHeight($value) + { + $this->setViewSTate('ImageHeight',$value,''); + } + + /** + * @return string the location of the image file for the THyperLink + */ + public function getImageUrl() + { + return $this->getViewState('ImageUrl',''); + } + + /** + * Sets the location of image file of the THyperLink. + * @param string the image file location + */ + public function setImageUrl($value) + { + $this->setViewState('ImageUrl',$value,''); + } + + /** + * @return string width of the image in the THyperLink + */ + public function getImageWidth() + { + return $this->getViewState('ImageWidth',''); + } + + /** + * Sets the width of the image in the THyperLink + * @param string width of the image + */ + public function setImageWidth($value) + { + $this->setViewState('ImageWidth',$value,''); + } + + /** + * @return string the URL to link to when the THyperLink component is clicked. + */ + public function getNavigateUrl() + { + return $this->getViewState('NavigateUrl',''); + } + + /** + * Sets the URL to link to when the THyperLink component is clicked. + * @param string the URL + */ + public function setNavigateUrl($value) + { + $this->setViewState('NavigateUrl',$value,''); + } + + /** + * Returns the URL to link to when the THyperLink component is clicked. + * This method is required by {@link IDataRenderer}. + * It is the same as {@link getText()}. + * @return string the text caption + * @see getText + * @since 3.1.0 + */ + public function getData() + { + return $this->getText(); + } + + /** + * Sets the URL to link to when the THyperLink component is clicked. + * This method is required by {@link IDataRenderer}. + * It is the same as {@link setText()}. + * @param string the text caption to be set + * @see setText + * @since 3.1.0 + */ + public function setData($value) + { + $this->setText($value); + } + + /** + * @return string the target window or frame to display the Web page content linked to when the THyperLink component is clicked. + */ + public function getTarget() + { + return $this->getViewState('Target',''); + } + + /** + * Sets the target window or frame to display the Web page content linked to when the THyperLink component is clicked. + * @param string the target window, valid values include '_blank', '_parent', '_self', '_top' and empty string. + */ + public function setTarget($value) + { + $this->setViewState('Target',$value,''); + } +} + -- cgit v1.2.3