summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes3
-rw-r--r--demos/quickstart/protected/pages/Controls/List.page1
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.page69
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php12
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page6
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page6
-rw-r--r--framework/Web/UI/WebControls/TBulletedList.php230
-rw-r--r--framework/Web/UI/WebControls/TLinkButton.php2
8 files changed, 324 insertions, 5 deletions
diff --git a/.gitattributes b/.gitattributes
index b16270db..7022ed95 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -40,6 +40,8 @@ demos/quickstart/protected/pages/Configurations/Templates3.page -text
demos/quickstart/protected/pages/Construction.page -text
demos/quickstart/protected/pages/Controls/List.page -text
demos/quickstart/protected/pages/Controls/Overview.page -text
+demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.page -text
+demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page -text
demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php -text
demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.page -text
@@ -213,6 +215,7 @@ framework/Web/UI/TTemplateControl.php -text
framework/Web/UI/TTemplateManager.php -text
framework/Web/UI/TThemeManager.php -text
framework/Web/UI/WebControls/TBaseValidator.php -text
+framework/Web/UI/WebControls/TBulletedList.php -text
framework/Web/UI/WebControls/TButton.php -text
framework/Web/UI/WebControls/TCheckBox.php -text
framework/Web/UI/WebControls/TCheckBoxList.php -text
diff --git a/demos/quickstart/protected/pages/Controls/List.page b/demos/quickstart/protected/pages/Controls/List.page
index f70c4368..5b0e766a 100644
--- a/demos/quickstart/protected/pages/Controls/List.page
+++ b/demos/quickstart/protected/pages/Controls/List.page
@@ -24,5 +24,6 @@ List controls covered in this section are all inherit directly or indirectly fro
<com:RunBar PagePath="Controls.Samples.TRadioButtonList.Home" />
<h2>TBulletList</h2>
+<com:RunBar PagePath="Controls.Samples.TBulletedList.Home" />
</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.page
new file mode 100644
index 00000000..c5171868
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.page
@@ -0,0 +1,69 @@
+<com:TContent ID="body">
+
+<h1>TBulletedList Samples</h1>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Bulleted list with default settings:
+</td>
+<td class="sampleaction">
+<com:TBulletedList>
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TBulletedList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Bulleted list with customized color, font, bullet style:
+</td>
+<td class="sampleaction">
+<com:TBulletedList
+ BulletStyle="UpperRoman"
+ FirstBulletNumber="5"
+ BackColor="silver"
+ Font.Size="12pt">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TBulletedList>
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Bulleted list of hyperlinks:
+</td>
+<td class="sampleaction">
+<com:TBulletedList DisplayMode="HyperLink" Target="_blank">
+ <com:TListItem Value="http://www.google.com/" Text="google" />
+ <com:TListItem Value="http://www.yahoo.com/" Text="yahoo" />
+ <com:TListItem Value="http://www.amazon.com/" Text="amazon" />
+</com:TBulletedList>
+</td>
+
+<tr>
+<td class="samplenote">
+Bulleted list of link buttons (click on them to see the result):
+</td>
+<td class="sampleaction">
+<com:TBulletedList DisplayMode="LinkButton" Click="buttonClicked">
+ <com:TListItem Value="http://www.google.com/" Text="google" />
+ <com:TListItem Value="http://www.yahoo.com/" Text="yahoo" />
+ <com:TListItem Value="http://www.amazon.com/" Text="amazon" />
+</com:TBulletedList>
+<com:TLabel ID="Result" ForeColor="red" />
+</td>
+
+</tr>
+
+
+</table>
+
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php
new file mode 100644
index 00000000..d3e04787
--- /dev/null
+++ b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php
@@ -0,0 +1,12 @@
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $item=$sender->Items[$param->Index];
+ $this->Result->Text="You clicked $item->Text : $item->Value.";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page
index ac9de17e..d4833ea9 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.page
@@ -104,7 +104,8 @@ Check box list's behavior upon postback:
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
- <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+ <com:TListItem Value="value 4" Text="item 4" Enabled="false" />
+ <com:TListItem Value="value 5" Text="item 5" Selected="true" />
</com:TCheckBoxList>
<com:TButton Text="Submit" Click="buttonClicked" />
<br/>
@@ -121,7 +122,8 @@ Auto postback check box list:
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
- <com:TListItem Value="value 4" Text="item 4" Selected="true" />
+ <com:TListItem Value="value 4" Text="item 4" Enabled="false" />
+ <com:TListItem Value="value 5" Text="item 5" Selected="true" />
</com:TCheckBoxList>
<com:TLabel ID="SelectionResult2" ForeColor="red" />
</td>
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page
index 95fea89b..3f5f7053 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.page
@@ -104,7 +104,8 @@ Radio button list's behavior upon postback:
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
- <com:TListItem Value="value 4" Text="item 4" />
+ <com:TListItem Value="value 4" Text="item 4" Enabled="false" />
+ <com:TListItem Value="value 5" Text="item 5" />
</com:TRadioButtonList>
<com:TButton Text="Submit" Click="buttonClicked" />
<br/>
@@ -121,7 +122,8 @@ Auto postback radio button list:
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
- <com:TListItem Value="value 4" Text="item 4" />
+ <com:TListItem Value="value 4" Text="item 4" Enabled="false" />
+ <com:TListItem Value="value 5" Text="item 5" />
</com:TRadioButtonList>
<com:TLabel ID="SelectionResult2" ForeColor="red" />
</td>
diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php
new file mode 100644
index 00000000..f2540644
--- /dev/null
+++ b/framework/Web/UI/WebControls/TBulletedList.php
@@ -0,0 +1,230 @@
+<?php
+
+class TBulletedList extends TListControl implements IPostBackEventHandler
+{
+ private $_isEnabled;
+ private $_postBackOptions;
+
+ public function raisePostBackEvent($param)
+ {
+ if($this->getCausesValidation())
+ $this->getPage()->validate($this->getValidationGroup());
+ $this->onClick(new TBulletedListEventParameter((int)$param));
+ }
+
+ protected function getTagName()
+ {
+ switch($this->getBulletStyle())
+ {
+ case 'Numbered':
+ case 'LowerAlpha':
+ case 'UpperAlpha':
+ case 'LowerRoman':
+ case 'UpperRoman':
+ return 'ol';
+ }
+ return 'ul';
+ }
+
+ protected function addAttributesToRender($writer)
+ {
+ $needStart=false;
+ switch($this->getBulletStyle())
+ {
+ case 'Numbered':
+ $writer->addStyleAttribute('list-style-type','decimal');
+ $needStart=true;
+ break;
+ case 'LowerAlpha':
+ $writer->addStyleAttribute('list-style-type','lower-alpha');
+ $needStart=true;
+ break;
+ case 'UpperAlpha':
+ $writer->addStyleAttribute('list-style-type','upper-alpha');
+ $needStart=true;
+ break;
+ case 'LowerRoman':
+ $writer->addStyleAttribute('list-style-type','lower-roman');
+ $needStart=true;
+ break;
+ case 'UpperRoman':
+ $writer->addStyleAttribute('list-style-type','upper-roman');
+ $needStart=true;
+ break;
+ case 'Disc':
+ $writer->addStyleAttribute('list-style-type','disc');
+ break;
+ case 'Circle':
+ $writer->addStyleAttribute('list-style-type','circle');
+ break;
+ case 'Square':
+ $writer->addStyleAttribute('list-style-type','square');
+ break;
+ case 'CustomImage':
+ $url=$this->getBulletImageUrl();
+ $writer->addStyleAttribute('list-style-image',"url($url)");
+ break;
+ }
+ if($needStart && ($start=$this->getFirstBulletNumber())!=1)
+ $writer->addAttribute('start',"$start");
+ parent::addAttributesToRender($writer);
+ }
+
+ public function getBulletImageUrl()
+ {
+ return $this->getViewState('BulletImageUrl','');
+ }
+
+ public function setBulletImageUrl($value)
+ {
+ $this->setViewState('BulletImageUrl',$value,'');
+ }
+
+ public function getBulletStyle()
+ {
+ return $this->getViewState('BulletStyle','NotSet');
+ }
+
+ public function setBulletStyle($value)
+ {
+ $this->setViewState('BulletStyle',TPropertyValue::ensureEnum($value,'NotSet','Numbered','LowerAlpha','UpperAlpha','LowerRoman','UpperRoman','Disc','Circle','Square','CustomImage'),'NotSet');
+ }
+
+ public function getDisplayMode()
+ {
+ return $this->getViewState('DisplayMode','Text');
+ }
+
+ public function setDisplayMode($value)
+ {
+ $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'Text','HyperLink','LinkButton'),'Text');
+ }
+
+ public function getFirstBulletNumber()
+ {
+ return $this->getViewState('FirstBulletNumber',1);
+ }
+
+ public function setFirstBulletNumber($value)
+ {
+ $this->setViewState('FirstBulletNumber',TPropertyValue::ensureInteger($value),1);
+ }
+
+ public function onClick($param)
+ {
+ $this->raiseEvent('Click',$this,$param);
+ }
+
+ /**
+ * @return string the target window or frame to display the Web page content linked to when the THyperLink component is clicked.
+ */
+ public function getTarget()
+ {
+ return $this->getViewState('Target','');
+ }
+
+ /**
+ * Sets the target window or frame to display the Web page content linked to when the THyperLink component is clicked.
+ * @param string the target window, valid values include '_blank', '_parent', '_self', '_top' and empty string.
+ */
+ public function setTarget($value)
+ {
+ $this->setViewState('Target',$value,'');
+ }
+
+ protected function render($writer)
+ {
+ if($this->getHasItems())
+ parent::render($writer);
+ }
+
+ protected function renderContents($writer)
+ {
+ $this->_isEnabled=$this->getEnabled(true);
+ $this->_postBackOptions=$this->getPostBackOptions();
+ $writer->writeLine();
+ foreach($this->getItems() as $index=>$item)
+ {
+ if($item->getHasAttributes())
+ {
+ foreach($item->getAttributes() as $name=>$value)
+ $writer->addAttribute($name,$value);
+ }
+ $writer->renderBeginTag('li');
+ $this->renderBulletText($writer,$item,$index);
+ $writer->renderEndTag();
+ $writer->writeLine();
+ }
+ }
+
+ protected function renderBulletText($writer,$item,$index)
+ {
+ 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;
+ 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);
+ }
+ 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);
+ }
+ }
+ if(($accesskey=$this->getAccessKey())!=='')
+ $writer->addAttribute('accesskey',$accesskey);
+ $writer->renderBeginTag('a');
+ $writer->write(THttpUtility::htmlEncode($item->getText()));
+ $writer->renderEndTag();
+ }
+
+ protected function getPostBackOptions()
+ {
+ $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;
+ }
+}
+
+class TBulletedListEventParameter extends TEventParameter
+{
+ private $_index;
+ public function __construct($index)
+ {
+ $this->_index=$index;
+ }
+
+ public function getIndex()
+ {
+ return $this->_index;
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php
index d3518ee4..16d670b3 100644
--- a/framework/Web/UI/WebControls/TLinkButton.php
+++ b/framework/Web/UI/WebControls/TLinkButton.php
@@ -86,7 +86,7 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler
{
$url = $this->getPostBackUrl();
//create unique no-op url references
- $nop = "javascript:;//{$this->ClientID}";
+ $nop = "javascript:;//".$this->getClientID();
$writer->addAttribute('href', $url ? $url : $nop);
$scripts = $this->getPage()->getClientScript();