summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TBulletedList.php
diff options
context:
space:
mode:
authorwei <>2006-01-18 04:20:26 +0000
committerwei <>2006-01-18 04:20:26 +0000
commit0226f8f5f430d34b3cead40c4eb7b458933d16c6 (patch)
tree68b21c4bec09ed73edc64019b4e20a2e3853d477 /framework/Web/UI/WebControls/TBulletedList.php
parente2219c91b98088289080bfa451d3083851eddf76 (diff)
update javascript library and usage in web controls
Diffstat (limited to 'framework/Web/UI/WebControls/TBulletedList.php')
-rw-r--r--framework/Web/UI/WebControls/TBulletedList.php90
1 files changed, 55 insertions, 35 deletions
diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php
index 8256237d..63183233 100644
--- a/framework/Web/UI/WebControls/TBulletedList.php
+++ b/framework/Web/UI/WebControls/TBulletedList.php
@@ -48,6 +48,8 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
*/
private $_postBackOptions;
+ private $_currentRenderItemIndex;
+
/**
* Raises the postback event.
* This method is required by {@link IPostBackEventHandler} interface.
@@ -274,34 +276,12 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
switch($this->getDisplayMode())
{
case 'Text':
- if($item->getEnabled())
- $writer->write(THttpUtility::htmlEncode($item->getText()));
- else
- {
- $writer->addAttribute('disabled','disabled');
- $writer->renderBeginTag('span');
- $writer->write(THttpUtility::htmlEncode($item->getText()));
- $writer->renderEndTag();
- }
- return;
+ return $this->renderTextItem($writer, $item, $index);
case 'HyperLink':
- if(!$this->_isEnabled || !$item->getEnabled())
- $writer->addAttribute('disabled','disabled');
- else
- {
- $writer->addAttribute('href',$item->getValue());
- if(($target=$this->getTarget())!=='')
- $writer->addAttribute('target',$target);
- }
+ $this->renderHyperLinkItem($writer, $item, $index);
break;
case 'LinkButton':
- if(!$this->_isEnabled || !$item->getEnabled())
- $writer->addAttribute('disabled','disabled');
- else
- {
- $postback=$this->getPage()->getClientScript()->getPostBackEventReference($this,"$index",$this->_postBackOptions);
- $writer->addAttribute('href',$postback);
- }
+ $this->renderLinkButtonItem($writer, $item, $index);
}
if(($accesskey=$this->getAccessKey())!=='')
$writer->addAttribute('accesskey',$accesskey);
@@ -310,22 +290,62 @@ class TBulletedList extends TListControl implements IPostBackEventHandler
$writer->renderEndTag();
}
+ protected function renderTextItem($writer, $item, $index)
+ {
+ if($item->getEnabled())
+ $writer->write(THttpUtility::htmlEncode($item->getText()));
+ else
+ {
+ $writer->addAttribute('disabled','disabled');
+ $writer->renderBeginTag('span');
+ $writer->write(THttpUtility::htmlEncode($item->getText()));
+ $writer->renderEndTag();
+ }
+ }
+
+ protected function renderHyperLinkItem($writer, $item, $index)
+ {
+ if(!$this->_isEnabled || !$item->getEnabled())
+ $writer->addAttribute('disabled','disabled');
+ else
+ {
+ $writer->addAttribute('href',$item->getValue());
+ if(($target=$this->getTarget())!=='')
+ $writer->addAttribute('target',$target);
+ }
+ }
+
+ protected function renderLinkButtonItem($writer, $item, $index)
+ {
+ if(!$this->_isEnabled || !$item->getEnabled())
+ $writer->addAttribute('disabled','disabled');
+ else
+ {
+ $this->_currentRenderItemIndex = $index;
+ $this->getPage()->getClientScript()->registerPostbackControl($this);
+ $writer->addAttribute('id', $this->getClientID().$index);
+ $writer->addAttribute('href', "javascript:;//".$this->getClientID().$index);
+ }
+ }
+
/**
* @return TPostBackOptions postback options used for linkbuttons.
*/
- protected function getPostBackOptions()
+ public function getPostBackOptions()
+ {
+ $options['ValidationGroup'] = $this->getValidationGroup();
+ $options['CausesValidation'] = $this->getCausesValidation();
+ $options['EventTarget'] = $this->getUniqueID();
+ $options['EventParameter'] = $this->_currentRenderItemIndex;
+ $options['ID'] = $this->getClientID().$this->_currentRenderItemIndex;
+ return $options;
+ }
+
+ protected function canCauseValidation()
{
- $option=new TPostBackOptions();
$group = $this->getValidationGroup();
$hasValidators = $this->getPage()->getValidators($group)->getCount()>0;
- if($this->getCausesValidation() && $hasValidators)
- {
- $options->setPerformValidation(true);
- $options->setValidationGroup($this->getValidationGroup());
- return $options;
- }
- else
- return null;
+ return $this->getCausesValidation() && $hasValidators;
}
/**