From 6228873cf9d6471463d2413e7dfd7447f759baf2 Mon Sep 17 00:00:00 2001 From: "christophe.boulain" <> Date: Wed, 3 Dec 2008 14:22:03 +0000 Subject: Merge from trunk --- demos/personal/protected/Pages/Settings.page | 2 +- demos/personal/protected/Pages/config.php | 6 +- demos/personal/protected/application.php | 2 +- .../protected/pages/ActiveControls/DragDrop.page | 26 +++++ .../protected/pages/ActiveControls/Home.page | 22 +++- .../ActiveControls/Samples/DragDrop/Home.page | 90 +++++++++++++++++ .../pages/ActiveControls/Samples/DragDrop/Home.php | 112 +++++++++++++++++++++ .../Samples/DragDrop/assets/product1.png | Bin 0 -> 10711 bytes .../Samples/DragDrop/assets/product2.png | Bin 0 -> 9550 bytes .../Samples/DragDrop/assets/trash.png | Bin 0 -> 783 bytes .../protected/pages/Configurations/Templates2.page | 14 +++ .../protected/pages/Configurations/UrlMapping.page | 5 +- .../protected/pages/Database/ActiveRecord.page | 15 ++- .../pages/GettingStarted/NewFeatures.page | 8 +- 14 files changed, 292 insertions(+), 10 deletions(-) create mode 100755 demos/quickstart/protected/pages/ActiveControls/DragDrop.page create mode 100755 demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.page create mode 100755 demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php create mode 100755 demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product1.png create mode 100755 demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.png create mode 100755 demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.png (limited to 'demos') diff --git a/demos/personal/protected/Pages/Settings.page b/demos/personal/protected/Pages/Settings.page index 48dfde96..f461fa13 100644 --- a/demos/personal/protected/Pages/Settings.page +++ b/demos/personal/protected/Pages/Settings.page @@ -1,4 +1,4 @@ - + Welcome, User->Name %> />! This page contains site settings accessible only to site admin. \ No newline at end of file diff --git a/demos/personal/protected/Pages/config.php b/demos/personal/protected/Pages/config.php index 7a6c9a6c..23cb184e 100644 --- a/demos/personal/protected/Pages/config.php +++ b/demos/personal/protected/Pages/config.php @@ -3,10 +3,8 @@ return array( 'authorization' => array( array( 'action' => 'deny', - 'properties' => array( - 'pages' => 'Settings', - 'users' => '?', - ), + 'pages' => 'Settings', + 'users' => '?', ), ), 'pages' => array( diff --git a/demos/personal/protected/application.php b/demos/personal/protected/application.php index 0d9cadd4..26100576 100644 --- a/demos/personal/protected/application.php +++ b/demos/personal/protected/application.php @@ -5,7 +5,7 @@ return array( 'mode' => 'Debug', ), 'paths' => array( - 'using'=>array('Application.common.*'), + 'using'=>array('Application.Common.*'), ), 'modules' => array( ), diff --git a/demos/quickstart/protected/pages/ActiveControls/DragDrop.page b/demos/quickstart/protected/pages/ActiveControls/DragDrop.page new file mode 100755 index 00000000..0969ddd0 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/DragDrop.page @@ -0,0 +1,26 @@ + + +

TDropContainer

+ + +

TDropContainer represent an area where +TDraggable controls can be dropped. +When a TDraggable is dropped, a +callback request is initiated. The OnCallback event is raised +during a callback request and it is raised after +the OnDropk event. +

+ + +

TDraggable

+ + +

TDraggable will make its child controls 'draggable'. +When a TDraggable is dropped, a +callback request is initiated. The OnCallback event is raised +during a callback request and it is raised after +the OnDropk event. +

+ + +
$Id$
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page index 5cf4ab17..49855980 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Home.page @@ -160,6 +160,12 @@ TActiveButton control. See also the later part of the TValueTriggeredCallback monitors (using a timer) an attribute of an HTML element and triggers a callback request when the attribute value changes. + + +
  • + TDropContainer & TDraggable represents drag and drop containers. + The former will make its child controls "draggable" while the latter will raise a callback when a draggable + control is dropped on it.
  • @@ -310,7 +316,21 @@ if Javascript was disabled on the client's browser.

    TValueTriggeredCallback YesNo - + + + + TDropContainer + + YesNo + + + + TDraggable + + NoNo + + +

    Active Control Infrastructure Classes

    diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.page new file mode 100755 index 00000000..89d64110 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.page @@ -0,0 +1,90 @@ + + +

    Drag & Drop demo !

    + +

    Product List :

    + +
    + + + + + Data['ProductImageUrl']%> /> + + + +
    +

    Your shopping cart :

    + + + + Your shopping cart is empty, please add some items ! + + + Data['ProductCount'] > 1)%> + > + Data['ProductImageUrl']%>/> + Data['ProductTitle']%>/> + + + + + +

    Remove Items from cart by dropping them here

    + +
    diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php new file mode 100755 index 00000000..276ee6a4 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php @@ -0,0 +1,112 @@ +getIsPostBack() && !$this->getIsCallBack()) + { + + $this->populateProductList(); + $this->populateShoppingList(); + } + } + + private function getProductData () + { + return array ( + array ( + 'ProductId' => 'Product1', + 'ProductImageUrl' => $this->publishAsset('assets/product1.png'), + 'ProductTitle' => 'Cup' + ), + array ( + 'ProductId' => 'Product2', + 'ProductImageUrl' => $this->publishAsset('assets/product2.png'), + 'ProductTitle' => 'T-Shirt' + ) + ); + } + + private function getProduct ($key) + { + foreach ($this->getProductData() as $product) + if ($product['ProductId']==$key) return $product; + 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 () + { + return $this->getViewState('ShoppingList', array ()); + } + + public function setShoppingListData ($value) + { + $this->setViewState('ShoppingList', TPropertyValue::ensureArray($value), array ()); + } + + public function addItemToCart ($sender, $param) + { + $control=$param->getDroppedControl(); + // Get the Key from the repeater item + $item=$control->getNamingContainer(); + $key=$this->ProductList->getDataKeys()->itemAt($item->getItemIndex()); + $product=$this->getProduct($key); + $shoppingList=$this->getShoppingListData(); + if (isset ($shoppingList[$key])) + { + // Already an item of this type, increment counter + $shoppingList[$key]['ProductCount']++; + } + else + { + // Add an item to the shopping list + $shoppingList[$key]=$product; + $shoppingList[$key]['ProductCount']=1; + } + $this->setShoppingListData($shoppingList); + + } + + public function removeItemFromCart ($sender, $param) + { + $control=$param->getDroppedControl(); + $item=$control->getNamingContainer(); + $key=$this->ShoppingList->getDataKeys()->itemAt($item->getItemIndex()); + $shoppingList=$this->getShoppingListData(); + if (isset($shoppingList[$key])) + { + if ($shoppingList[$key]['ProductCount'] > 1) + $shoppingList[$key]['ProductCount'] --; + else + unset($shoppingList[$key]); + } + $this->setShoppingListData($shoppingList); + + } + + public function redrawCart ($sender, $param) + { + $this->populateShoppingList(); + $this->cart->render($param->NewWriter); + + } +} +?> \ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product1.png b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product1.png new file mode 100755 index 00000000..ae03d551 Binary files /dev/null and b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product1.png differ diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.png b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.png new file mode 100755 index 00000000..25e81ad7 Binary files /dev/null and b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.png differ diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.png b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.png new file mode 100755 index 00000000..184f7628 Binary files /dev/null and b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.png differ diff --git a/demos/quickstart/protected/pages/Configurations/Templates2.page b/demos/quickstart/protected/pages/Configurations/Templates2.page index e8442f1f..8a17c72c 100644 --- a/demos/quickstart/protected/pages/Configurations/Templates2.page +++ b/demos/quickstart/protected/pages/Configurations/Templates2.page @@ -96,4 +96,18 @@ Localization tags represent localized texts. They are in the following format, where string will be translated to different languages according to the end-user's language preference. Localization tags are in fact shortcuts to the function call Prado::localize(string).

    + + +

    URL Tags

    +

    +URL tags are used to insert the relative web url path to the Prado application in the template. You can use it in the following format: +

    + +<%/ image.jpg %> + +

    +

    +If your Prado application is deployed on http://localhost/pradoapp/, the tag above will produce "/pradoapp/image.jpg". This tag will help you to use the correct file path even with UrlFormat set to Path, or if you are using url mappings. +

    +
    $Id$
    \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index 0837d50d..ec393012 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -124,4 +124,7 @@ A matching pattern is one whose ServiceID and ServiceParameter By default, TUrlMapping will construct URLs prefixed with the currently requesting PHP script path, such as /path/to/index.php/article/3. Users may change this behavior by explicitly specifying the URL prefix through its UrlPrefix property. For example, if the Web server configuration treats index.php as the default script, we can set UrlPrefix as /path/to and the constructed URL will look like /path/to/article/3.

    -
    $Id$
    \ No newline at end of file +
    Note: If you use constructUrl() with string parameters that contain slashes ("/") they will get encoded to %2F. By default most Apache installations give a "404 Not found" if a URL contains a %2F. You can add AllowEncodedSlashes On to your VirtualHost configuration to resolve this. (Available since Apache 2.0.46). +
    + +
    $Id$
    diff --git a/demos/quickstart/protected/pages/Database/ActiveRecord.page b/demos/quickstart/protected/pages/Database/ActiveRecord.page index 70998587..bc0df529 100644 --- a/demos/quickstart/protected/pages/Database/ActiveRecord.page +++ b/demos/quickstart/protected/pages/Database/ActiveRecord.page @@ -129,6 +129,19 @@ class UserRecord extends TActiveRecord You may specify qualified table names. E.g. for MySQL, TABLE = "`database1`.`table1`". +
    Note: +Since version 3.1.3 you can also use a method table() to define the table name. +This allows you to dynamically specify which table should be used by the ActiveRecord. + +class TeamRecord extends TActiveRecord +{ + public function table() { + return 'Teams'; + } +} + +
    +

    Since TActiveRecord extends TComponent, setter and getter methods can be defined to allow control over how variables @@ -1183,4 +1196,4 @@ instead of $userRecord->first_name. This helps separation of logic and -

    $Id$
    \ No newline at end of file +
    $Id$
    diff --git a/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page b/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page index 66e3111d..51dbb981 100644 --- a/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page +++ b/demos/quickstart/protected/pages/GettingStarted/NewFeatures.page @@ -4,7 +4,13 @@

    This page summarizes the main new features that are introduced in each PRADO release. -

    +

    + +

    Version 3.1.3

    +

    Version 3.1.2