From 682f7ef6933f4ad485baedddf7a30367d003d7bf Mon Sep 17 00:00:00 2001 From: wei <> Date: Thu, 25 Jan 2007 05:49:22 +0000 Subject: Fixed #502 --- .gitattributes | 3 ++ HISTORY | 4 ++ buildscripts/texbuilder/Page2Tex.php | 5 +- framework/I18N/core/CultureInfo.php | 5 +- framework/Web/UI/WebControls/TStyle.php | 62 +++++++++++++++++++++- framework/Web/UI/WebControls/TWebControl.php | 16 ++++++ .../protected/pages/DisplayStyleTest.page | 22 ++++++++ .../protected/pages/DisplayStyleTest.php | 26 +++++++++ .../validators/tests/DatePickerTestCase.php | 1 + tests/simple_unit/I18N/CultureInfoTest.php | 13 +++++ 10 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.page create mode 100644 tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.php create mode 100644 tests/simple_unit/I18N/CultureInfoTest.php diff --git a/.gitattributes b/.gitattributes index 5c2dc5e1..ca1df998 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2117,6 +2117,8 @@ tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.page tests/FunctionalTests/active-controls/protected/pages/DatePickerInCallback.php -text tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.page -text tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.php -text +tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.page -text +tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.php -text tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.page -text tests/FunctionalTests/active-controls/protected/pages/DynamicRepeaterDataTest.php -text tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page -text @@ -2411,6 +2413,7 @@ tests/simple_unit/ActiveRecord/records/DepartmentRecord.php -text tests/simple_unit/ActiveRecord/records/SimpleUser.php -text tests/simple_unit/ActiveRecord/records/SqliteUsers.php -text tests/simple_unit/ActiveRecord/records/UserRecord.php -text +tests/simple_unit/I18N/CultureInfoTest.php -text tests/simple_unit/Soap/ContactManager.php -text tests/simple_unit/Soap/SoapTestCase.php -text tests/simple_unit/SqlMap/ActiveRecordSqlMapTest.php -text diff --git a/HISTORY b/HISTORY index 8c7dfdf9..840e0fd8 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,10 @@ Version 3.1.0 beta to be released ================================= ENH: Added PRADO_CHMOD constant so that users can specify the permission of PRADO-created directories (Qiang) +ENH: Ticket#519 - Update TActiveRecord implementation (Wei) +ENH: Add Display property to TWebControl (Wei) +BUG: Ticket#517 - Quickstart I18N sample: conflicting module ID (Wei) +BUG: Ticket#521 - comment tag on TActiveButton stop callback (Wei) Version 3.1.0 alpha January 15, 2007 ==================================== diff --git a/buildscripts/texbuilder/Page2Tex.php b/buildscripts/texbuilder/Page2Tex.php index 2374647c..7ee4a171 100644 --- a/buildscripts/texbuilder/Page2Tex.php +++ b/buildscripts/texbuilder/Page2Tex.php @@ -211,6 +211,7 @@ class Page2Tex array($this, 'tabular'), $html); $html = preg_replace('//', '', $html); + $html = preg_replace('/
((.|\n)*?)<\/div>/', '', $html); $html = html_entity_decode($html); @@ -300,7 +301,7 @@ class Page2Tex $page = $this->page_count*1000; return "

"; } - + function set_block_content_id($content) { $content = preg_replace_callback('/

/', array($this, 'add_p'), $content); @@ -322,7 +323,7 @@ class Page2Tex return $matches[0]; } else - { + { $changes = str_replace('"source"', '"source block-content" id="code-'.$id.'"', $matches[0]); return $changes; } diff --git a/framework/I18N/core/CultureInfo.php b/framework/I18N/core/CultureInfo.php index bcf2f245..404c81fe 100644 --- a/framework/I18N/core/CultureInfo.php +++ b/framework/I18N/core/CultureInfo.php @@ -414,7 +414,7 @@ class CultureInfo * Gets the culture name in English. * Returns array('Language','Country'); * 'Country' is omitted if the culture is neutral. - * @return array array with language and country as elements. + * @return string language (country), it may locale code string if english name does not exist. */ function getEnglishName() { @@ -423,6 +423,9 @@ class CultureInfo $culture = $this->getInvariantCulture(); $language = $culture->findInfo("Languages/{$lang}"); + if(count($language) == 0) + return $this->culture; + $region = $culture->findInfo("Countries/{$reg}"); if($region) return $language[0].' ('.$region[0].')'; diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index cc383766..73ff4adf 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -43,6 +43,10 @@ class TStyle extends TComponent * @var string CSS style string (those not represented by specific fields of TStyle) */ private $_customStyle=null; + /** + * @var string display style + */ + private $_displayStyle='Fixed'; /** * Constructor. @@ -173,7 +177,7 @@ class TStyle extends TComponent $this->_font=new TFont; return $this->_font; } - + /** * @return boolean true if font is set. */ @@ -182,6 +186,37 @@ class TStyle extends TComponent return $this->_font !== null; } + /** + * @param TDisplayStyle control display style, default is TDisplayStyle::Fixed + */ + public function setDisplayStyle($value) + { + $this->_displayStyle = TPropertyValue::ensureEnum($value, 'TDisplayStyle'); + switch($this->_displayStyle) + { + case TDisplayStyle::None: + $this->_fields['display'] = 'none'; + break; + case TDisplayStyle::Dynamic: + $this->_fields['display'] = ''; //remove the display property + break; + case TDisplayStyle::Fixed: + $this->_fields['visibility'] = 'visible'; + break; + case TDisplayStyle::Hidden: + $this->_fields['visibility'] = 'hidden'; + break; + } + } + + /** + * @return TDisplayStyle display style + */ + public function getDisplayStyle() + { + return $this->_displayStyle; + } + /** * @return string the foreground color of the control */ @@ -362,7 +397,7 @@ class TStyle extends TComponent if($this->_class!==null) $writer->addAttribute('class',$this->_class); } - + /** * @return array list of style fields. */ @@ -372,6 +407,29 @@ class TStyle extends TComponent } } +/** + * TDisplayStyle defines the enumerable type for the possible styles + * that a web control can display. + * + * The following enumerable values are defined: + * - None: the control is not displayed and not included in the layout. + * - Dynamic: the control is displayed and included in the layout, the layout flow is dependent on the control (equivalent to display:'' in css). + * - Fixed: Similar to Dynamic with CSS "visibility" set "shown". + * - Hidden: the control is not displayed and is included in the layout. + * + * @author Wei Zhuo + * @version $Id$ + * @package System.Web.UI.WebControls + * @since 3.1 + */ +class TDisplayStyle extends TEnumerable +{ + const None='None'; + const Dynamic='Dynamic'; + const Fixed='Fixed'; + const Hidden='Hidden'; +} + /** * TTableStyle class. * TTableStyle represents the CSS style specific for HTML table. diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php index a45bab05..78c1aa98 100644 --- a/framework/Web/UI/WebControls/TWebControl.php +++ b/framework/Web/UI/WebControls/TWebControl.php @@ -193,6 +193,22 @@ class TWebControl extends TControl return ''; } + /** + * @param TDisplayStyle display style of the control, default is TDisplayStyle::Fixed + */ + public function setDisplay($value) + { + $this->getStyle()->setDisplayStyle($value); + } + + /** + * @return TDisplayStyle display style of the control, default is TDisplayStyle::Fixed + */ + public function getDisplay() + { + return $this->getStyle()->getDisplayStyle(); + } + /** * @param string the css class of the control */ diff --git a/tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.page b/tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.page new file mode 100644 index 00000000..df1db27a --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.page @@ -0,0 +1,22 @@ + +

Display Style Test

+ +
+Some test + +buttons + +here. +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.php b/tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.php new file mode 100644 index 00000000..a49a8bfa --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.php @@ -0,0 +1,26 @@ +button1->Display="Dynamic"; + } + + function hide_button1() + { + $this->button1->Display="None"; + } + + function show_button2() + { + $this->button2->Display="Fixed"; + } + + function hide_button2() + { + $this->button2->Display="Hidden"; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php index 95eb88e3..320802e4 100644 --- a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php +++ b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php @@ -29,6 +29,7 @@ class DatePickerTestCase extends SeleniumTestCase $this->type("{$base}picker1", "13/4/2006"); $this->select("{$base}picker2_month", "label=9"); $this->select("{$base}picker2_day", "label=10"); + $this->select("{$base}picker2_year", "label=2006"); $this->type("{$base}picker3", "14/4/2006"); $this->type("{$base}picker4", "7/4/2006"); $this->select("{$base}picker5_day", "label=6"); diff --git a/tests/simple_unit/I18N/CultureInfoTest.php b/tests/simple_unit/I18N/CultureInfoTest.php new file mode 100644 index 00000000..840d8f17 --- /dev/null +++ b/tests/simple_unit/I18N/CultureInfoTest.php @@ -0,0 +1,13 @@ +assertEqual($culture->getEnglishName(), 'iw'); + } +} + +?> \ No newline at end of file -- cgit v1.2.3