From 47a3cb88e7ed7f2a87bbf024dff3416fc6cd8002 Mon Sep 17 00:00:00 2001
From: xue <>
Date: Thu, 31 Aug 2006 20:17:39 +0000
Subject: merge from 3.0 branch till 1374.
---
.gitattributes | 1 +
HISTORY | 1 +
.../protected/pages/Controls/DataGrid.page | 4 +-
.../pages/Controls/Samples/TDataGrid/Sample3.page | 28 +-
.../pages/Controls/Samples/TDataGrid/Sample3.php | 2 +-
framework/Util/TSimpleDateFormatter.php | 3 +-
framework/Web/UI/TClientScriptManager.php | 13 +-
framework/Web/UI/WebControls/TDataBoundControl.php | 1 +
framework/Web/UI/WebControls/TDatePicker.php | 7 +-
.../Web/UI/WebControls/TDropDownListColumn.php | 286 +++++++++++++++++++++
framework/Web/UI/WebControls/TStyleSheet.php | 2 +-
.../quickstart/Controls/DataGrid3TestCase.php | 2 +-
.../tickets/protected/pages/Ticket351.page | 1 +
.../tickets/tests/Ticket274TestCase.php | 4 +-
14 files changed, 324 insertions(+), 31 deletions(-)
create mode 100644 framework/Web/UI/WebControls/TDropDownListColumn.php
diff --git a/.gitattributes b/.gitattributes
index b158779a..2606fb46 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1800,6 +1800,7 @@ framework/Web/UI/WebControls/TDataSourceView.php -text
framework/Web/UI/WebControls/TDataTypeValidator.php -text
framework/Web/UI/WebControls/TDatePicker.php -text
framework/Web/UI/WebControls/TDropDownList.php -text
+framework/Web/UI/WebControls/TDropDownListColumn.php -text
framework/Web/UI/WebControls/TEditCommandColumn.php -text
framework/Web/UI/WebControls/TEmailAddressValidator.php -text
framework/Web/UI/WebControls/TExpression.php -text
diff --git a/HISTORY b/HISTORY
index 97191f40..92ff82dc 100644
--- a/HISTORY
+++ b/HISTORY
@@ -28,6 +28,7 @@ CHG: Added more conditions in the requirement checker (Qiang)
CHG: TControl::findControlsByType() now only returns objects of the specified type (Qiang)
CHG: Moved createdOnTemplate() and addParsedObject() from TControl to TComponent (Qiang)
NEW: TDateTimeStamp class for supporting time stamps outside 1970-2038 using float (Wei)
+NEW: TDropDownListColumn (Qiang)
Version 3.0.3 August 6, 2006
============================
diff --git a/demos/quickstart/protected/pages/Controls/DataGrid.page b/demos/quickstart/protected/pages/Controls/DataGrid.page
index 392b78ab..2a51a3de 100644
--- a/demos/quickstart/protected/pages/Controls/DataGrid.page
+++ b/demos/quickstart/protected/pages/Controls/DataGrid.page
@@ -22,6 +22,7 @@ PRADO provides five types of columns:
- TBoundColumn associates cells with a specific field of data and displays the cells according to their modes.
- TCheckBoxColumn associates cells with a specific field of data and displays in each cell a checkbox whose check state is determined by the data field value.
+ - TDropDownListColumn associates cells with a specific field of data and displays the cells according to their modes. If in edit mode, a cell will be displayed with a TDropDownList.
- THyperLinkColumn displays in the cells a hyperlink whose caption and URL can be either statically specified or bound to some fields of data.
- TEditCommandColumn displays in the cells edit/update/cancel command buttons according to the state of the item that a cell resides in.
- TButtonColumn displays in the cells a command button.
@@ -114,7 +115,8 @@ The following example uses manually specified columns to show a list of book inf
Besides the rich data presentation functionalities as demonstrated in previous section, TDataGrid is also highly user interactive. An import usage of TDataGrid is editing or deleting rows of data. The TBoundColumn can adjust the associated cell presentation according to the mode of datagrid items. When an item is in browsing mode, the cell is displayed with a static text; when the item is in editing mode, a textbox is displayed to collect user inputs. TDataGrid provides TEditCommandColumn for switching item modes. In addition, TButtonColumn offers developers the flexibility of creating arbitrary buttons for various user interactions.
-The following example shows how to make the previous book information table an interactive one. It allows users to edit and delete book items from the table. Two additional columns are used in the example to allow users interact with the datagrid: TEditCommandColumn and TButtonColumn.
+The following example shows how to make the previous book information table an interactive one. It allows users to edit and delete book items from the table. Two additional columns are used in the example to allow users interact with the datagrid: TEditCommandColumn and TButtonColumn. In addition,
+TDropDownListColumn replaces the previous TTemplateColumn to allow users to select a rating from a dropdown list. Note, it is also possible to use TTemplateColumn to achieve the same task.
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page
index 96affa4a..5fb19c6f 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.page
@@ -50,22 +50,18 @@
HeaderText="In-stock"
DataField="instock"
/>
-
-
-
-
-
- Parent->DataItem['rating'] %>
- ID="Rating">
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
PublisherColumn->TextBox->Text, // publisher
$item->PriceColumn->TextBox->Text, // price
$item->InStockColumn->CheckBox->Checked, // instock
- $item->RatingColumn->Rating->SelectedValue // rating
+ $item->RatingColumn->DropDownList->SelectedValue // rating
);
$this->DataGrid->EditItemIndex=-1;
$this->DataGrid->DataSource=$this->Data;
diff --git a/framework/Util/TSimpleDateFormatter.php b/framework/Util/TSimpleDateFormatter.php
index 9c2975d5..046a3442 100644
--- a/framework/Util/TSimpleDateFormatter.php
+++ b/framework/Util/TSimpleDateFormatter.php
@@ -118,7 +118,8 @@ class TSimpleDateFormatter
$bits['dd'] = str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT);
$bits['d'] = $date['mday'];
- return str_replace(array_keys($bits), $bits, $this->pattern);
+ $pattern = preg_replace('/M{3,4}/', 'MM', $this->pattern);
+ return str_replace(array_keys($bits), $bits, $pattern);
}
public function getMonthPattern()
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 3d0ced60..18d6089e 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -133,7 +133,7 @@ class TClientScriptManager extends TApplicationComponent
$this->_registeredPradoScripts[$name]=true;
else
throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name);
- $basePath=$this->getPradoBaseScriptPath();
+ $basePath=$this->getPradoScriptBasePath();
foreach(self::$_pradoScripts[$name] as $script)
{
if(!isset($this->_publishedPradoFiles[$script]))
@@ -145,7 +145,10 @@ class TClientScriptManager extends TApplicationComponent
}
}
- protected function getPradoBaseScriptPath()
+ /**
+ * @return string the directory containing the PRADO js script files
+ */
+ protected function getPradoScriptBasePath()
{
$basePath = Prado::getFrameworkPath().'/'.self::SCRIPT_PATH;
if($this->getApplication()->getMode()===TApplication::STATE_DEBUG)
@@ -155,15 +158,15 @@ class TClientScriptManager extends TApplicationComponent
}
/**
- * Renders the