From b7f95ce37ae577e95a81e64aa2aaf3e2e698109d Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 5 Aug 2006 21:34:30 +0000 Subject: merge from 3.0 branch till 1329. --- framework/Web/UI/WebControls/TBaseValidator.php | 4 +++ framework/Web/UI/WebControls/TDataGrid.php | 1 + framework/Web/UI/WebControls/TDataList.php | 2 +- .../Web/UI/WebControls/TDataTypeValidator.php | 3 ++ framework/Web/UI/WebControls/TDatePicker.php | 3 +- framework/Web/UI/WebControls/TOutputCache.php | 2 +- framework/Web/UI/WebControls/TPanelStyle.php | 2 +- framework/Web/UI/WebControls/TStyle.php | 33 +++++++++++++++++++--- framework/Web/UI/WebControls/TStyleSheet.php | 18 +++++++++++- framework/Web/UI/WebControls/TWizard.php | 10 ++++--- 10 files changed, 65 insertions(+), 13 deletions(-) (limited to 'framework/Web/UI/WebControls') diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 6660184e..ff026b49 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -167,6 +167,10 @@ abstract class TBaseValidator extends TLabel implements IValidator $options['ControlCssClass'] = $this->getControlCssClass(); $options['ControlType'] = $this->getClientControlClass($control); + + //get date format from date picker target control + if($control instanceof TDatePicker) + $options['DateFormat'] = $control->getDateFormat(); if(!is_null($this->_clientSide)) $options = array_merge($options,$this->_clientSide->getOptions()->toArray()); diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 2687ac35..e27f6ead 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -278,6 +278,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $style=new TTableStyle; $style->setGridLines('Both'); $style->setCellSpacing(0); + $style->setBorderCollapse(true); return $style; } diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index 42c47f86..22bec07e 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -1357,7 +1357,7 @@ class TDataListItem extends TWebControl implements INamingContainer /** * Creates a style object for the control. - * This method creates a {@link TTableStyle} to be used by checkbox list. + * This method creates a {@link TTableItemStyle} to be used by a datalist item. * @return TStyle control style to be used */ protected function createStyle() diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php index bd7569fc..3e91ec15 100644 --- a/framework/Web/UI/WebControls/TDataTypeValidator.php +++ b/framework/Web/UI/WebControls/TDataTypeValidator.php @@ -89,6 +89,9 @@ class TDataTypeValidator extends TBaseValidator */ protected function evaluateDataTypeCheck($value) { + if($value=='') + return true; + switch($this->getDataType()) { case 'Integer': diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 42cb305e..001c7c46 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -296,7 +296,8 @@ class TDatePicker extends TTextBox { if($this->getText() === '') return ''; - return $this->getTimeStamp(); + $date = $this->getTimeStamp(); + return $date == null ? '' : $date; } /** diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php index 20c04f7c..ff07a6db 100644 --- a/framework/Web/UI/WebControls/TOutputCache.php +++ b/framework/Web/UI/WebControls/TOutputCache.php @@ -37,7 +37,7 @@ * to respond to the {@link onCheckDependency OnCheckDependency} event and set * the event parameter's {@link TOutputCacheCheckDependencyEventParameter::getIsValid IsValid} * property to indicate whether the cached data remains valid or not. - * One can also extend TOutputCache and override its {@link getCacheDependency CacheDependency} + * One can also extend TOutputCache and override its {@link getCacheDependency} * function. While the former is easier to use, the latter offers more extensibility. * * The content fetched from cache may be variated with respect to diff --git a/framework/Web/UI/WebControls/TPanelStyle.php b/framework/Web/UI/WebControls/TPanelStyle.php index 02f366b8..dc20806e 100644 --- a/framework/Web/UI/WebControls/TPanelStyle.php +++ b/framework/Web/UI/WebControls/TPanelStyle.php @@ -171,7 +171,7 @@ class TPanelStyle extends TStyle /** * Sets the style attributes to default values. * This method overrides the parent implementation by - * resetting additional TTableStyle specific attributes. + * resetting additional TPanelStyle specific attributes. */ public function reset() { diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index 597229ea..d4cb6154 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -403,6 +403,10 @@ class TTableStyle extends TStyle * @var string grid line setting of the table */ private $_gridLines=null; + /** + * @var boolean whether the table border should be collapsed + */ + private $_borderCollapse=null; /** * Sets the style attributes to default values. @@ -416,6 +420,7 @@ class TTableStyle extends TStyle $this->_cellPadding=null; $this->_cellSpacing=null; $this->_gridLines=null; + $this->_borderCollapse=null; } /** @@ -439,6 +444,8 @@ class TTableStyle extends TStyle $this->_cellSpacing=$style->_cellSpacing; if($style->_gridLines!==null) $this->_gridLines=$style->_gridLines; + if($style->_borderCollapse!==null) + $this->_borderCollapse=$style->_borderCollapse; } } @@ -463,6 +470,8 @@ class TTableStyle extends TStyle $this->_cellSpacing=$style->_cellSpacing; if($this->_gridLines===null && $style->_gridLines!==null) $this->_gridLines=$style->_gridLines; + if($this->_borderCollapse===null && $style->_borderCollapse!==null) + $this->_borderCollapse=$style->_borderCollapse; } } @@ -484,11 +493,10 @@ class TTableStyle extends TStyle $writer->addAttribute('cellpadding',"$cellPadding"); if(($cellSpacing=$this->getCellSpacing())>=0) - { $writer->addAttribute('cellspacing',"$cellSpacing"); - if($this->getCellSpacing()===0) - $writer->addStyleAttribute('border-collapse','collapse'); - } + + if($this->getBorderCollapse()) + $writer->addStyleAttribute('border-collapse','collapse'); switch($this->getGridLines()) { @@ -588,6 +596,23 @@ class TTableStyle extends TStyle { $this->_gridLines=TPropertyValue::ensureEnum($value,array('None', 'Horizontal', 'Vertical', 'Both')); } + + + /** + * @return boolean whether the table borders should be collapsed. Defaults to false. + */ + public function getBorderCollapse() + { + return $this->_borderCollapse===null?false:$this->_borderCollapse; + } + + /** + * @param boolean whether the table borders should be collapsed. + */ + public function setBorderCollapse($value) + { + $this->_borderCollapse=TPropertyValue::ensureBoolean($value); + } } /** diff --git a/framework/Web/UI/WebControls/TStyleSheet.php b/framework/Web/UI/WebControls/TStyleSheet.php index 5925645c..3e172697 100644 --- a/framework/Web/UI/WebControls/TStyleSheet.php +++ b/framework/Web/UI/WebControls/TStyleSheet.php @@ -45,6 +45,22 @@ class TStyleSheet extends TControl return $this->getViewState('StyleSheetUrl', ''); } + /** + * @return string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types. + */ + public function getMediaType() + { + return $this->getViewState('MediaType',''); + } + + /** + * @param string media type of the CSS (such as 'print', 'screen', etc.). If empty, it means the CSS applies to all media types. + */ + public function setMediaType($value) + { + $this->setViewState('MediaType',$value,''); + } + /** * Registers the stylesheet file and content to be rendered. * This method overrides the parent implementation and is invoked right before rendering. @@ -53,7 +69,7 @@ class TStyleSheet extends TControl public function onPreRender($param) { if(($url=$this->getStyleSheetUrl())!=='') - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); + $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url,$this->getMediaType()); } /** diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php index fa0fd92a..684ef5dc 100644 --- a/framework/Web/UI/WebControls/TWizard.php +++ b/framework/Web/UI/WebControls/TWizard.php @@ -715,9 +715,11 @@ class TWizard extends TWebControl implements INamingContainer } /** + * Returns the multiview that holds the wizard steps. + * This method should only be used by control developers. * @return TMultiView the multiview holding wizard steps */ - protected function getMultiView() + public function getMultiView() { if($this->_multiView===null) { @@ -740,7 +742,6 @@ class TWizard extends TWebControl implements INamingContainer if(($wizard=$step->getWizard())!==null) $wizard->getWizardSteps()->remove($step); $step->setWizard($this); - $this->getMultiView()->getViews()->add($step); $this->wizardStepsChanged(); } @@ -752,7 +753,6 @@ class TWizard extends TWebControl implements INamingContainer */ public function removedWizardStep($step) { - $this->getMultiView()->getViews()->remove($step); $step->setWizard(null); $this->wizardStepsChanged(); } @@ -1262,7 +1262,7 @@ class TWizard extends TWebControl implements INamingContainer if($this->_sideBarDataList!==null) { $this->_sideBarDataList->setDataSource($this->getWizardSteps()); - $this->_sideBarDataList->setSelectedIndex($this->getActiveStepIndex()); + $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); $this->_sideBarDataList->dataBind(); } } @@ -1816,6 +1816,7 @@ class TWizardStepCollection extends TList if($item instanceof TWizardStep) { parent::insertAt($index,$item); + $this->_wizard->getMultiView()->getViews()->insertAt($index,$item); $this->_wizard->addedWizardStep($item); } else @@ -1830,6 +1831,7 @@ class TWizardStepCollection extends TList public function removeAt($index) { $step=parent::removeAt($index); + $this->_wizard->getMultiView()->getViews()->remove($step); $this->_wizard->removedWizardStep($step); return $step; } -- cgit v1.2.3