From b26ef59b9ffbc9b8dfa15b6456fd0071474b9608 Mon Sep 17 00:00:00 2001 From: knut <> Date: Mon, 18 Aug 2008 23:00:14 +0000 Subject: fixed #876 --- .gitattributes | 3 +++ HISTORY | 1 + framework/Web/UI/WebControls/TTabPanel.php | 22 +++++++++++++++------ .../tickets/protected/pages/Ticket876.page | 17 ++++++++++++++++ .../tickets/protected/pages/Ticket876.php | 11 +++++++++++ .../tickets/tests/Ticket876TestCase.php | 23 ++++++++++++++++++++++ 6 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket876.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket876.php create mode 100644 tests/FunctionalTests/tickets/tests/Ticket876TestCase.php diff --git a/.gitattributes b/.gitattributes index 01b4064e..ba36f9df 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3085,6 +3085,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket769.page -text tests/FunctionalTests/tickets/protected/pages/Ticket785.page -text tests/FunctionalTests/tickets/protected/pages/Ticket828.page -text tests/FunctionalTests/tickets/protected/pages/Ticket849.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket876.page -text +tests/FunctionalTests/tickets/protected/pages/Ticket876.php -text tests/FunctionalTests/tickets/protected/pages/Ticket886.page -text tests/FunctionalTests/tickets/protected/pages/Ticket886.php -text tests/FunctionalTests/tickets/protected/pages/Ticket897.page -text @@ -3152,6 +3154,7 @@ tests/FunctionalTests/tickets/tests/Ticket703TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket708TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket72TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket769TestCase.php -text +tests/FunctionalTests/tickets/tests/Ticket876TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket886TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket897TestCase.php -text tests/FunctionalTests/tickets/tests/Ticket93TestCase.php -text diff --git a/HISTORY b/HISTORY index ea6bd3d7..e28a637b 100644 --- a/HISTORY +++ b/HISTORY @@ -19,6 +19,7 @@ BUG: Ticket#904 - TDbConnection: Add emulate prepares workaround for boolean com BUG: Ticket#908 - TDbCache::init / Exception (Knut) ENH: Added Prado.Validation.validateControl(id) on client side to validate a specific control (Michael) ENH: Added MessageSource_Database to I18N (uses TDbConnection) (Michael) +ENH: Ticket#876 - Assign empty string to CssUrl on TTabPanel to avoid loading extra css (GoDZilla, Knut) ENH: Ticket#890 - Minor optimization: Use $var===null over is_null($var) (Knut) ENH: Ticket#893 - Added page parameter to queryForPagedList() to specify the initial page to load (Michael) ENH: Ticket#896 - TTheme - enhance for subclassing (Knut) diff --git a/framework/Web/UI/WebControls/TTabPanel.php b/framework/Web/UI/WebControls/TTabPanel.php index 6688211e..961d0797 100644 --- a/framework/Web/UI/WebControls/TTabPanel.php +++ b/framework/Web/UI/WebControls/TTabPanel.php @@ -4,7 +4,7 @@ * * @author Tomasz Wolny and Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -175,7 +175,7 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler */ public function getCssUrl() { - return $this->getViewState('CssUrl',''); + return $this->getViewState('CssUrl','default'); } /** @@ -383,9 +383,19 @@ class TTabPanel extends TWebControl implements IPostBackDataHandler */ protected function registerStyleSheet() { - if(($url=$this->getCssUrl())==='') - $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css'); - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); + $url = $this->getCssUrl(); + + if($url === '') { + return; + } + + if($url === 'default') { + $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css'); + } + + if($url !== '') { + $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); + } } /** @@ -684,4 +694,4 @@ class TTabViewCollection extends TControlCollection } } -?> +?> diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket876.page b/tests/FunctionalTests/tickets/protected/pages/Ticket876.page new file mode 100644 index 00000000..af673461 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket876.page @@ -0,0 +1,17 @@ + + + + + + + content for view 1 + + + content for view 2 + + + content for view 3 + + + + diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket876.php b/tests/FunctionalTests/tickets/protected/pages/Ticket876.php new file mode 100644 index 00000000..e95a677c --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket876.php @@ -0,0 +1,11 @@ +TabPanel->CssUrl = ""; + } + +} + +?> diff --git a/tests/FunctionalTests/tickets/tests/Ticket876TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket876TestCase.php new file mode 100644 index 00000000..0ad9ebfa --- /dev/null +++ b/tests/FunctionalTests/tickets/tests/Ticket876TestCase.php @@ -0,0 +1,23 @@ +open('tickets/index.php?page=Ticket876'); + $this->assertTitle("Verifying Ticket 876"); + $base = 'ctl0_Content_'; + + $this->assertElementPresent('xpath=//link[@rel="stylesheet"]'); + $this->clickAndWait($base.'Button'); + $this->assertElementNotPresent('xpath=//link[@rel="stylesheet"]'); + + /*$this->select($base.'Date_month', 10); + $this->select($base.'Date_day', 22); + + $this->clickAndWait($base.'SendButton'); + $this->assertTextPresent('2008-10-22');*/ + } + +} + +?> -- cgit v1.2.3