diff options
| -rw-r--r-- | .gitattributes | 3 | ||||
| -rw-r--r-- | HISTORY | 4 | ||||
| -rw-r--r-- | buildscripts/texbuilder/Page2Tex.php | 5 | ||||
| -rw-r--r-- | framework/I18N/core/CultureInfo.php | 5 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TStyle.php | 62 | ||||
| -rw-r--r-- | framework/Web/UI/WebControls/TWebControl.php | 16 | ||||
| -rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.page | 22 | ||||
| -rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/DisplayStyleTest.php | 26 | ||||
| -rw-r--r-- | tests/FunctionalTests/validators/tests/DatePickerTestCase.php | 1 | ||||
| -rw-r--r-- | tests/simple_unit/I18N/CultureInfoTest.php | 13 | 
10 files changed, 152 insertions, 5 deletions
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 @@ -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('/<div class="last-modified">((.|\n)*?)<\/div>/', '', $html);
  		$html = html_entity_decode($html);
 @@ -300,7 +301,7 @@ class Page2Tex  		$page = $this->page_count*1000;
  		return "<h3 id=\"".($page + (++self::$header_count))."\">";
  	}
 -	
 +
  	function set_block_content_id($content)
  	{
  		$content = preg_replace_callback('/<p>/',  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 <code>array('Language','Country');</code>
  	 * '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.
  	 */
 @@ -183,6 +187,37 @@ class TStyle extends TComponent  	}
  	/**
 +	 * @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
  	 */
  	public function getForeColor()
 @@ -362,7 +397,7 @@ class TStyle extends TComponent  		if($this->_class!==null)
  			$writer->addAttribute('class',$this->_class);
  	}
 -	
 +
  	/**
  	 * @return array list of style fields.
  	 */
 @@ -373,6 +408,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 <weizhuo[at]gmail[dot]com>
 + * @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 @@ -194,6 +194,22 @@ class TWebControl extends TControl  	}
  	/**
 +	 * @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
  	 */
  	public function setCssClass($value)
 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 @@ +<com:TForm>
 +<h1>Display Style Test</h1>
 +
 +<div>
 +Some test
 +<com:TActiveButton ID="button1" Display="None" Text="Button 1" />
 +buttons
 +<com:TActiveButton ID="button2" Display="Hidden" Text="Button 2" />
 +here.
 +</div>
 +
 +<com:TActiveButton Text="Display Button 1" OnClick="display_button1" />
 +<com:TActiveButton Text="Hide Button 1" OnClick="hide_button1" />
 +
 +<com:TActiveButton Text="Show Button 2" OnClick="show_button2" />
 +<com:TActiveButton Text="Hide Button 2" OnClick="hide_button2" />
 +
 +<com:TActiveLabel ID="status" />
 +
 +<com:TJavascriptLogger />
 +
 +</com:TForm>
\ 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 @@ +<?php
 +
 +class DisplayStyleTest extends TPage
 +{
 +	function display_button1()
 +	{
 +		$this->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 @@ +<?php
 +
 +Prado::using('System.I18N.core.*');
 +class CultureInfoTest extends UnitTestCase
 +{
 +	function test_missing_english_names_returns_culture_code()
 +	{
 +		$culture = new CultureInfo('iw');
 +		$this->assertEqual($culture->getEnglishName(), 'iw');
 +	}
 +}
 +
 +?>
\ No newline at end of file  | 
