diff options
author | xue <> | 2006-08-02 12:06:13 +0000 |
---|---|---|
committer | xue <> | 2006-08-02 12:06:13 +0000 |
commit | dc76ce6c04347a42bdd03b2c6060395d071ddb0e (patch) | |
tree | 4329e844da42e72190041f58221793b0fdbbb3ac /framework/Web/UI/TClientScriptManager.php | |
parent | 38fc83fb70a87f0f8a1b4bc0f4753e3063749522 (diff) |
Fixed #316.
Diffstat (limited to 'framework/Web/UI/TClientScriptManager.php')
-rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 752b61ea..9a83c550 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -215,10 +215,14 @@ class TClientScriptManager extends TApplicationComponent * Registers a CSS file to be rendered in the page head * @param string a unique key identifying the file * @param string URL to the CSS file + * @param string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types. */ - public function registerStyleSheetFile($key,$url) + public function registerStyleSheetFile($key,$url,$media='') { - $this->_styleSheetFiles[$key]=$url; + if($media==='') + $this->_styleSheetFiles[$key]=$url; + else + $this->_styleSheetFiles[$key]=array($url,$media); } /** @@ -226,7 +230,7 @@ class TClientScriptManager extends TApplicationComponent * @param string a unique key identifying the CSS block * @param string CSS block */ - public function registerStyleSheet($key,$css) + public function registerStyleSheet($key,$css,$media='') { $this->_styleSheets[$key]=$css; } @@ -373,7 +377,12 @@ class TClientScriptManager extends TApplicationComponent { $str=''; foreach($this->_styleSheetFiles as $url) - $str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n"; + { + if(is_array($url)) + $str.="<link rel=\"stylesheet\" type=\"text/css\" media=\"{$url[1]}\" href=\"".THttpUtility::htmlEncode($url[0])."\" />\n"; + else + $str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n"; + } $writer->write($str); } |