From e33efebbe5971909226d18b24d2b7030d3772665 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 5 Jan 2014 22:44:09 +0100 Subject: Re-enable prototype-based scripts, and enable old drag&drop controls --- .../pages/ActiveControls/Samples/DragDrop/Home.php | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'demos/quickstart/protected/pages/ActiveControls') diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php index 30ef750b..7d3163dc 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php @@ -9,12 +9,12 @@ class Home extends TPage parent::onInit($param); if (!$this->getIsPostBack() && !$this->getIsCallBack()) { - + $this->populateProductList(); $this->populateShoppingList(); } } - + private function getProductData () { return array ( @@ -30,38 +30,41 @@ class Home extends TPage ) ); } - + private function getProduct ($key) { foreach ($this->getProductData() as $product) if ($product['ProductId']==$key) return $product; - return null; + return null; } - + protected function populateProductList () { $this->ProductList->DataSource=$this->getProductData(); $this->ProductList->Databind(); } - + protected function populateShoppingList () { $this->ShoppingList->DataSource=$this->getShoppingListData(); $this->ShoppingList->Databind(); - + } - - + + public function getShoppingListData () { + $a=$this->getViewState('ShoppingList', array ()); + var_export($a); return $this->getViewState('ShoppingList', array ()); } - + public function setShoppingListData ($value) { + var_export($value); $this->setViewState('ShoppingList', TPropertyValue::ensureArray($value), array ()); } - + public function addItemToCart ($sender, $param) { $control=$param->getDroppedControl(); @@ -82,9 +85,9 @@ class Home extends TPage $shoppingList[$key]['ProductCount']=1; } $this->setShoppingListData($shoppingList); - + } - + public function removeItemFromCart ($sender, $param) { $control=$param->getDroppedControl(); @@ -99,13 +102,13 @@ class Home extends TPage unset($shoppingList[$key]); } $this->setShoppingListData($shoppingList); - + } - + public function redrawCart ($sender, $param) { $this->populateShoppingList(); $this->cart->render($param->NewWriter); - + } } -- cgit v1.2.3