summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/I18N/core/CultureInfo.php5
-rw-r--r--framework/Web/UI/WebControls/TStyle.php62
-rw-r--r--framework/Web/UI/WebControls/TWebControl.php16
3 files changed, 80 insertions, 3 deletions
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)