From 7cd0bdea1d094485ae197fd80297791555c08d1c Mon Sep 17 00:00:00 2001
From: xue <>
Date: Sun, 5 Mar 2006 00:03:10 +0000
Subject: Some minor updates.
---
framework/Web/UI/WebControls/TDatePicker.php | 48 ++++++++++++----------
framework/Web/UI/WebControls/TJavascriptLogger.php | 23 ++++-------
framework/Web/UI/WebControls/TRatingList.php | 21 ++++++++--
3 files changed, 53 insertions(+), 39 deletions(-)
(limited to 'framework/Web/UI/WebControls')
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 929ee297..71358ee7 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -10,6 +10,11 @@
* @package System.Web.UI.WebControls
*/
+/**
+ * Includes TTextBox class
+ */
+Prado::using('System.Web.UI.WebControls.TTextBox');
+
/**
*
* TDatePicker class.
@@ -51,8 +56,8 @@
*
* The InputMode property can be set to "TextBox" or "DropDownList" with
* default as "TextBox".
- * In DropDownList mode, in addition to the popup date picker, three
- * drop down list (day, month and year) are presented to select the date .
+ * In DropDownList mode, in addition to the popup date picker, three
+ * drop down list (day, month and year) are presented to select the date .
*
* @author Wei Zhuo
* @version $Revision: $ $Date: $
@@ -251,7 +256,7 @@ class TDatePicker extends TTextBox
public function setDate($value)
{
$date = TPropertyValue::ensureInteger($value);
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
$this->getDateFormat());
$this->setText($formatter->format($date));
}
@@ -311,7 +316,8 @@ class TDatePicker extends TTextBox
* @param string the key that can be used to retrieve data from the input data collection
* @param array the input data collection
* @return boolean whether the data of the component has been changed
- */ public function loadPostData($key,$values)
+ */
+ public function loadPostData($key,$values)
{
if($this->getInputMode() == "TextBox")
return parent::loadPostData($key, $values);
@@ -324,7 +330,7 @@ class TDatePicker extends TTextBox
else
return false;
}
-
+
/**
* Loads date from drop down list data.
* @param string the key that can be used to retrieve data from the input data collection
@@ -334,7 +340,7 @@ class TDatePicker extends TTextBox
protected function getDateFromPostData($key, $values)
{
$date = @getdate();
-
+
if(isset($values[$key.'$day']))
$day = intval($values[$key.'$day']);
else
@@ -399,7 +405,7 @@ class TDatePicker extends TTextBox
protected function getCurrentCulture()
{
$app = $this->getApplication()->getGlobalization();
- return $this->getCulture() == '' ?
+ return $this->getCulture() == '' ?
($app ? $app->getCulture() : 'en') : $this->getCulture();
}
@@ -414,7 +420,7 @@ class TDatePicker extends TTextBox
$info = Prado::createComponent('System.I18N.core.CultureInfo', $culture);
return $info->getDateTimeFormat();
}
-
+
/**
* Renders the drop down list date picker.
*/
@@ -426,28 +432,28 @@ class TDatePicker extends TTextBox
$writer->removeAttribute('name');
$writer->removeAttribute('type');
$writer->addAttribute('id', $this->getClientID());
-
+
if(strlen($class = $this->getCssClass()) > 0)
$writer->addAttribute('class', $class);
$writer->renderBeginTag('span');
$date = $this->getDateFromText();
$this->renderCalendarSelections($writer, $date);
-
+
//render a hidden input field
$writer->addAttribute('name', $this->getUniqueID());
$writer->addAttribute('type', 'hidden');
$writer->addAttribute('value', $this->getText());
$writer->renderBeginTag('input');
-
+
$writer->renderEndTag();
}
protected function hasDayPattern()
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
$this->getDateFormat());
- return !is_null($formatter->getDayPattern());
+ return !is_null($formatter->getDayPattern());
}
/**
@@ -457,7 +463,7 @@ class TDatePicker extends TTextBox
*/
protected function renderCalendarSelections($writer, $date)
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
$this->getDateFormat());
foreach($formatter->getDayMonthYearOrdering() as $type)
{
@@ -469,7 +475,7 @@ class TDatePicker extends TTextBox
$this->renderCalendarYearOptions($writer,$date['year']);
}
}
-
+
/**
* Gets the date from the text input using TSimpleDateFormatter
* @return array current selected date
@@ -508,7 +514,7 @@ class TDatePicker extends TTextBox
*/
protected function renderCalendarDayOptions($writer, $selected=null)
{
- $days = array(); for($i=1;$i<=31;$i++) $days[$i] = $i;
+ $days = array(); for($i=1;$i<=31;$i++) $days[$i] = $i;
$writer->addAttribute('id', $this->getClientID().'_day');
$writer->addAttribute('name', $this->getUniqueID().'$day');
$writer->addAttribute('class', 'datepicker_day_options');
@@ -529,7 +535,7 @@ class TDatePicker extends TTextBox
$writer->addAttribute('name', $this->getUniqueID().'$month');
$writer->addAttribute('class', 'datepicker_month_options');
$writer->renderBeginTag('select');
- $this->renderDropDownListOptions($writer,
+ $this->renderDropDownListOptions($writer,
$this->getLocalizedMonthNames($info), $selected);
$writer->renderEndTag();
}
@@ -543,13 +549,13 @@ class TDatePicker extends TTextBox
*/
protected function getLocalizedMonthNames($info)
{
- $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
+ $formatter = Prado::createComponent('System.Data.TSimpleDateFormatter',
$this->getDateFormat());
switch($formatter->getMonthPattern())
{
case 'MMM':
case 'MM': return $info->getAbbreviatedMonthNames();
- case 'M':
+ case 'M':
$array = array(); for($i=1;$i<=12;$i++) $array[$i] = $i;
return $array;
default : return $info->getMonthNames();
@@ -571,7 +577,7 @@ class TDatePicker extends TTextBox
$writer->renderBeginTag('select');
$writer->addAttribute('class', 'datepicker_year_options');
$this->renderDropDownListOptions($writer, $years, $selected);
- $writer->renderEndTag();
+ $writer->renderEndTag();
}
/**
@@ -654,7 +660,7 @@ class TDatePicker extends TTextBox
$this->registerCalendarClientScript();
}
-
+
/**
* Registers the javascript code to initialize the date picker.
* Must use "Event.OnLoad" to initialize the date picker when the
diff --git a/framework/Web/UI/WebControls/TJavascriptLogger.php b/framework/Web/UI/WebControls/TJavascriptLogger.php
index c38f7bc4..3196d3b6 100644
--- a/framework/Web/UI/WebControls/TJavascriptLogger.php
+++ b/framework/Web/UI/WebControls/TJavascriptLogger.php
@@ -1,18 +1,12 @@
- * @version $Revision: 1.2 $ $Date: 2005/11/06 23:02:33 $
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
*/
@@ -32,13 +26,12 @@
* http://gleepglop.com/javascripts/logger/
*
* @author Wei Zhuo
- * @version $Revision: 1.2 $ $Date: 2005/11/06 23:02:33 $
+ * @version $Revision: $ $Date: $
* @package System.Web.UI.WebControls
- * @since 2.0.2
+ * @since 3.0
*/
class TJavascriptLogger extends TWebControl
{
-
/**
* @return string tag name of the panel
*/
@@ -54,7 +47,7 @@ class TJavascriptLogger extends TWebControl
*/
public function renderContents($writer)
{
- $this->Page->ClientScript->registerPradoScript('logger');
+ $this->getPage()->getClientScript()->registerPradoScript('logger');
$info = '(more info).';
$usage = 'Press ALT-D (Or CTRL-D on OS X) to toggle the javascript log console';
$writer->write("{$usage} {$info}");
diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php
index b2861f2b..9a6932b0 100644
--- a/framework/Web/UI/WebControls/TRatingList.php
+++ b/framework/Web/UI/WebControls/TRatingList.php
@@ -1,9 +1,24 @@
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ */
+/**
+ * Includes TRadioButtonList class
+ */
Prado::using('System.Web.UI.WebControls.TRadioButtonList');
/**
- * TRatingList
+ * TRatingList class.
+ *
+ * This class is EXPERIMENTAL.
*
* @author Wei Zhuo
* @version $Revision: $ $Date: $
@@ -81,7 +96,7 @@ class TRatingList extends TRadioButtonList
public function setHalfRatingLimit($value)
{
- $this->setViewState('HalfRating',
+ $this->setViewState('HalfRating',
TPropertyValue::ensureArray($value), array(0.3, 0.7));
}
@@ -168,7 +183,7 @@ class TRatingList extends TRadioButtonList
protected function renderRatingListItem($writer, $repeatInfo, $itemType, $index)
{
- $image = new TImage;
+ $image = new TImage;
$image->setImageUrl($this->_ratingImages[$this->getRatingImageType($index)]);
$image->setAlternateText($this->getRating());
$image->render($writer);
--
cgit v1.2.3