diff options
author | xue <> | 2006-07-03 12:44:34 +0000 |
---|---|---|
committer | xue <> | 2006-07-03 12:44:34 +0000 |
commit | 2a1d1054624ce2673515ace042a8e933ea350683 (patch) | |
tree | 5710dba3aea2623bc484709fb20d42e298713d93 | |
parent | 38cc7a09ab2feca2172bc4fddf6c406a9285c55f (diff) |
Some furnishings to TStyleSheet.
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | UPGRADE | 5 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TStyleSheet.php | 77 |
3 files changed, 48 insertions, 39 deletions
@@ -1,3 +1,8 @@ +Version 3.0.3 August 6, 2006
+============================
+BUG: Ticket#264 - Typos in some exception throw statements (Knut)
+NEW: Added TStyleSheet (Wei)
+
Version 3.0.2 July 2, 2006
==========================
BUG: Ticket#182 - List and validator controls cause problem in child classes (Qiang)
@@ -1,5 +1,5 @@ - Upgrading Instructions for PRADO Framework v3.0.2
+ Upgrading Instructions for PRADO Framework v3.0.3
=================================================
!!!IMPORTANT!!!
@@ -14,6 +14,9 @@ version B between A and C, you need to following the instructions for both A and B.
+Upgrading from v3.0.2
+---------------------
+
Upgrading from v3.0.1
---------------------
- Postback enabled control will always disable default client-side browser action.
diff --git a/framework/Web/UI/WebControls/TStyleSheet.php b/framework/Web/UI/WebControls/TStyleSheet.php index 5b4cc944..e5b6ac6d 100644 --- a/framework/Web/UI/WebControls/TStyleSheet.php +++ b/framework/Web/UI/WebControls/TStyleSheet.php @@ -1,8 +1,27 @@ <?php +/** + * TStyleSheet class file. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + */ /** * TStyleSheet class. * + * TStyleSheet represents the link to a stylesheet file and/or a piece of + * stylesheet code. To specify the link to a CSS file, set {@link setStyleSheetUrl StyleSheetUrl}. + * The child rendering result of TStyleSheet is treated as CSS code and + * is rendered within an appropriate style HTML element. + * Therefore, if the child content is not empty, you should place the TStyleSheet + * control in the head section of your page to conform to the HTML standard. + * If only CSS file URL is specified, you may place the control anywhere on your page + * and the style element will be rendered in the right position. + * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> * @version : $ Tue Jul 4 04:38:16 EST 2006 $ * @package System.Web.UI.WebControl @@ -11,65 +30,47 @@ class TStyleSheet extends TControl { /** - * @param string stylesheet url or asset resource. + * @param string URL to the stylesheet file */ - public function setStyleUrl($value) + public function setStyleSheetUrl($value) { - $this->setViewState('StyleUrl', $value); + $this->setViewState('StyleSheetUrl', $value); } - + /** - * @return string stylesheet url. + * @return string URL to the stylesheet file */ - public function getStyleUrl() + public function getStyleSheetUrl() { - return $this->getViewState('StyleUrl', ''); + return $this->getViewState('StyleSheetUrl', ''); } - + /** - * Registers the stylesheet urls. Calls {@link renderChildren} to capture - * the body content to render the stylesheet in the head. + * Registers the stylesheet file and content to be rendered. + * This method overrides the parent implementation and is invoked right before rendering. * @param mixed event parameter */ public function onPreRender($param) { if($this->getEnabled(true)) { - $this->registerCustomStyleSheetFile(); - $this->registerCustomStyleSheet(); + if(($url=$this->getStyleSheetUrl())!=='') + $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); } } - - /** - * Overrides parent implementation, renders nothing. - */ - public function renderChildren($writer) - { - - } - - /** - * Register custom stylesheet file. - */ - protected function registerCustomStyleSheetFile() - { - $cs = $this->getPage()->getClientScript(); - $url = $this->getStyleUrl(); - if(strlen($url) > 0) - $cs->registerStyleSheetFile($url, $url); - } - + /** - * Registers the body content as stylesheet. + * Renders the control. + * This method overrides the parent implementation and renders nothing. + * @param ITextWriter writer */ - protected function registerCustomStyleSheet() + public function render($writer) { - $cs = $this->getPage()->getClientScript(); $textWriter=new TTextWriter; parent::renderChildren(new THtmlWriter($textWriter)); - $text = $textWriter->flush(); - if(strlen($text)>0) - $cs->registerStyleSheet(sprintf('%08X', crc32($text)), $text); + if(($css=trim($textWriter->flush()))!=='') + $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n{$css}\n/*]]>*/\n</style>\n"); } } + ?>
\ No newline at end of file |