summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorxue <>2006-08-02 02:24:29 +0000
committerxue <>2006-08-02 02:24:29 +0000
commit550ba06593b467b643862d41a00ca2dd12ee704b (patch)
tree16ad8180c2f0b96454453effff89dc236469ee4f /framework/Web/UI
parentccfa7850dc435ae9941cde18be827b3aac550f85 (diff)
merge from 3.0 branch till 1320.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/TTemplateControl.php2
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php33
2 files changed, 29 insertions, 6 deletions
diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php
index c7364d4b..3bbe52c5 100644
--- a/framework/Web/UI/TTemplateControl.php
+++ b/framework/Web/UI/TTemplateControl.php
@@ -129,7 +129,7 @@ class TTemplateControl extends TCompositeControl
*/
public function createChildControls()
{
- if($tpl=$this->getTemplate(true))
+ if($tpl=$this->getTemplate())
{
foreach($tpl->getDirective() as $name=>$value)
{
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 27d080c6..42cb305e 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -69,6 +69,15 @@ Prado::using('System.Web.UI.WebControls.TTextBox');
class TDatePicker extends TTextBox
{
/**
+ * AutoPostBack is not supported.
+ */
+ public function setAutoPostBack($value)
+ {
+ throw new TNotSupportedException('tdatepicker_autopostback_unsupported',
+ get_class($this));
+ }
+
+ /**
* @return string the format of the date string
*/
public function getDateFormat()
@@ -328,7 +337,7 @@ class TDatePicker extends TTextBox
*/
protected function renderDatePickerButtons($writer)
{
- if($this->getShowCalendar())
+ if($this->getShowCalendar() && $this->getEnabled(true))
{
switch ($this->getMode())
{
@@ -384,7 +393,9 @@ class TDatePicker extends TTextBox
$year = intval($values[$key.'$year']);
else
$year = $date['year'];
+
$date = @mktime(0, 0, 0, $month, $day, $year);
+
$pattern = $this->getDateFormat();
$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
@@ -497,12 +508,13 @@ class TDatePicker extends TTextBox
{
$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
$this->getDateFormat());
+
foreach($formatter->getDayMonthYearOrdering() as $type)
{
if($type == 'day')
$this->renderCalendarDayOptions($writer,$date['mday']);
elseif($type == 'month')
- $this->renderCalendarMonthOptions($writer,$date['mon']-1);
+ $this->renderCalendarMonthOptions($writer,$date['mon']);
elseif($type == 'year')
$this->renderCalendarYearOptions($writer,$date['year']);
}
@@ -550,6 +562,8 @@ class TDatePicker extends TTextBox
$writer->addAttribute('id', $this->getClientID().'_day');
$writer->addAttribute('name', $this->getUniqueID().'$day');
$writer->addAttribute('class', 'datepicker_day_options');
+ if($this->getReadOnly() || !$this->getEnabled(true))
+ $writer->addAttribute('disabled', 'disabled');
$writer->renderBeginTag('select');
$this->renderDropDownListOptions($writer, $days, $selected);
$writer->renderEndTag();
@@ -562,13 +576,16 @@ class TDatePicker extends TTextBox
*/
protected function renderCalendarMonthOptions($writer, $selected=null)
{
+
$info = $this->getLocalizedCalendarInfo();
$writer->addAttribute('id', $this->getClientID().'_month');
$writer->addAttribute('name', $this->getUniqueID().'$month');
$writer->addAttribute('class', 'datepicker_month_options');
+ if($this->getReadOnly() || !$this->getEnabled(true))
+ $writer->addAttribute('disabled', 'disabled');
$writer->renderBeginTag('select');
$this->renderDropDownListOptions($writer,
- $this->getLocalizedMonthNames($info), $selected);
+ $this->getLocalizedMonthNames($info), $selected-1);
$writer->renderEndTag();
}
@@ -585,8 +602,12 @@ class TDatePicker extends TTextBox
$this->getDateFormat());
switch($formatter->getMonthPattern())
{
- case 'MMM':
- case 'MM': return $info->getAbbreviatedMonthNames();
+ case 'MMM': return $info->getAbbreviatedMonthNames();
+ case 'MM':
+ $array = array();
+ for($i=1;$i<=12;$i++)
+ $array[$i-1] = $i < 10 ? '0'.$i : $i;
+ return $array;
case 'M':
$array = array(); for($i=1;$i<=12;$i++) $array[$i-1] = $i;
return $array;
@@ -606,6 +627,8 @@ class TDatePicker extends TTextBox
$years[$i] = $i;
$writer->addAttribute('id', $this->getClientID().'_year');
$writer->addAttribute('name', $this->getUniqueID().'$year');
+ if($this->getReadOnly() || !$this->getEnabled(true))
+ $writer->addAttribute('disabled', 'disabled');
$writer->renderBeginTag('select');
$writer->addAttribute('class', 'datepicker_year_options');
$this->renderDropDownListOptions($writer, $years, $selected);