diff options
| -rw-r--r-- | .gitattributes | 3 | ||||
| -rw-r--r-- | demos/northwind-db/protected/pages/Home.page | 17 | ||||
| -rw-r--r-- | demos/northwind-db/protected/pages/NorthwindCrud.page | 10 | ||||
| -rw-r--r-- | demos/northwind-db/protected/pages/NorthwindCrud.php (renamed from demos/northwind-db/protected/pages/Home.php) | 4 | ||||
| -rw-r--r-- | demos/northwind-db/protected/pages/northwind.gif | bin | 25177 -> 36713 bytes | |||
| -rw-r--r-- | framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php | 10 | 
6 files changed, 30 insertions, 14 deletions
| diff --git a/.gitattributes b/.gitattributes index 38ae357b..d09bc815 100644 --- a/.gitattributes +++ b/.gitattributes @@ -901,7 +901,8 @@ demos/northwind-db/protected/database/Supplier.php -text  demos/northwind-db/protected/database/Territory.php -text  demos/northwind-db/protected/database/sqlmap.xml -text  demos/northwind-db/protected/pages/Home.page -text -demos/northwind-db/protected/pages/Home.php -text +demos/northwind-db/protected/pages/NorthwindCrud.page -text +demos/northwind-db/protected/pages/NorthwindCrud.php -text  demos/northwind-db/protected/pages/northwind.gif -text  demos/personal/index.php -text  demos/personal/protected/.htaccess -text diff --git a/demos/northwind-db/protected/pages/Home.page b/demos/northwind-db/protected/pages/Home.page index e2c3668e..ba88bb43 100644 --- a/demos/northwind-db/protected/pages/Home.page +++ b/demos/northwind-db/protected/pages/Home.page @@ -1,12 +1,13 @@  <html>
 -<com:THead Title="Welcome to Prado" />
 +<com:THead Title="Northwind Database Sample" />
  <body>
 -<h1>Welcome to PRADO!</h1>
 -<com:TForm>
 -	
 -	<com:TDropDownList ID="class_list" AutoPostBack="true"/>
 -	<com:TScaffoldView ID="scaffold1" RecordClass="<%= $this->class_list->selectedItem->Text %>" />
 -
 -</com:TForm>
 +<h1>Northwind Database Sample</h1>
 +<p>
 +The Northwind Traders sample database contains the sales data for a fictitious 
 +company called Northwind Traders, which imports and exports specialty foods from around the world.
 +The database contains information about customers, suppliers, products, orders and employees (as well as a few other bits of miscellaneous information). 
 +<a href="?page=NorthwindCrud">View database</a>
 +</p>
 +<img src=<%~ northwind.gif %> />
  </body>
  </html>
\ No newline at end of file diff --git a/demos/northwind-db/protected/pages/NorthwindCrud.page b/demos/northwind-db/protected/pages/NorthwindCrud.page new file mode 100644 index 00000000..34d8ecd0 --- /dev/null +++ b/demos/northwind-db/protected/pages/NorthwindCrud.page @@ -0,0 +1,10 @@ +<html>
 +<com:THead Title="Northwind Database" />
 +<body>
 +<h1>Northwind Database</h1>
 +<com:TForm>
 +	<com:TDropDownList ID="class_list" AutoPostBack="true"/>
 +	<com:TScaffoldView ID="scaffold1" RecordClass="<%= $this->class_list->selectedItem->Text %>" />
 +</com:TForm>
 +</body>
 +</html>
\ No newline at end of file diff --git a/demos/northwind-db/protected/pages/Home.php b/demos/northwind-db/protected/pages/NorthwindCrud.php index 06035069..57694caa 100644 --- a/demos/northwind-db/protected/pages/Home.php +++ b/demos/northwind-db/protected/pages/NorthwindCrud.php @@ -1,6 +1,6 @@  <?php
 -class Home extends TPage
 +class NorthwindCrud extends TPage
  {
  	function onInit($param)
  	{
 @@ -17,7 +17,7 @@ class Home extends TPage  		{
  			if($entry[0]==='.')
  				continue;
 -			else if(is_file($directory.'/'.$entry))
 +			else if(is_file($directory.'/'.$entry) && strpos($entry,'.php'))
  				$list[] = str_replace('.php', '', $entry);
  		}
  		closedir($folder);
 diff --git a/demos/northwind-db/protected/pages/northwind.gif b/demos/northwind-db/protected/pages/northwind.gifBinary files differ index 34e1f2ed..acbacaea 100644 --- a/demos/northwind-db/protected/pages/northwind.gif +++ b/demos/northwind-db/protected/pages/northwind.gif diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php index f5121a44..851bf903 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php @@ -77,8 +77,11 @@ class TScaffoldListView extends TScaffoldBase  	public function onPreRender($param)
  	{
  		parent::onPreRender($param);
 -		//if(!$this->getPage()->getIsPostBack())
 -		$this->initializeSort();
 +		if(!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass')!=$this->getRecordClass())
 +		{
 +			$this->initializeSort();
 +			$this->setViewState('CurrentClass', $this->getRecordClass());
 +		}
  		$this->loadRecordData();
  	}
 @@ -87,9 +90,10 @@ class TScaffoldListView extends TScaffoldBase  	 */
  	protected function loadRecordData()
  	{
 +		$search = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters());
 +		$this->_list->setVirtualItemCount($this->getRecordFinder()->count($search));
  		$finder = $this->getRecordFinder();
  		$criteria = $this->getRecordCriteria();
 -		$this->_list->setVirtualItemCount($this->getRecordFinder()->count($criteria));
  		$this->_list->setDataSource($finder->findAll($criteria));
  		$this->_list->dataBind();
  	}
 | 
