diff options
Diffstat (limited to 'demos/quickstart/protected')
11 files changed, 288 insertions, 4 deletions
| 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 @@ +<com:TContent ID="body">
 +<!-- $Id$ -->
 +<h1>TDropContainer</h1>
 +<com:DocLink ClassPath="System.Web.UI.ActiveControls.TDropContainer" />
 +
 +<p class="block-content"><tt>TDropContainer</tt> represent an area where  +<tt>TDraggable</tt> controls can be dropped.
 +When a <tt>TDraggable</tt> is dropped,  a
 +callback request is initiated. The <tt>OnCallback</tt> event is raised
 +during a callback request and it is raised <strong>after</strong>
 +the <tt>OnDropk</tt> event.
 +</p> + +
 +<h1>TDraggable</h1> +<com:DocLink ClassPath="System.Web.UI.ActiveControls.TDraggable" /> + +<p class="block-content"><tt>TDraggable</tt> will make its child controls 'draggable'. +When a <tt>TDraggable</tt> is dropped,  a +callback request is initiated. The <tt>OnCallback</tt> event is raised +during a callback request and it is raised <strong>after</strong> +the <tt>OnDropk</tt> event. +</p>
 +<com:RunBar PagePath="ActiveControls.Samples.DragDrop.Home" />
 +
 +<div class="last-modified">$Id$</div></com:TContent>
\ 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</a> control. See also the later part of the <a href="?page=Tutoria  	* <a href="?page=ActiveControls.ValueTriggeredCallback">TValueTriggeredCallback</a>
  	monitors (using a timer) an attribute of an HTML element and triggers a callback request
  	when the attribute value changes.
 +	</li> +	 +	<li> +	<a href="?page=ActiveControls.DragDrop">TDropContainer & TDraggable</a> 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.  	</li>
  </ul>
 @@ -310,7 +316,21 @@ if Javascript was disabled on the client's browser.</p>  	<a href="?page=ActiveControls.ValueTriggeredCallback">TValueTriggeredCallback</a>
  	</td>
  	<td>Yes</td><td>No</td>
 -  </tr>
 +  </tr> +   +  <tr><td> +  	<a href="?page=ActiveControls.DragDrop">TDropContainer</a> +  	</td> +  	<td>Yes</td><td>No</td> +  </tr> + +  <tr><td> +  	<a href="?page=ActiveControls.DragDrop">TDraggable</a> +  	</td> +  	<td>No</td><td>No</td> +  </tr> + +  
  </table>
  <h2 id="128036">Active Control Infrastructure Classes</h2>
 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 @@ +<com:TContent id="body"> +<style> +.cart { +	border: 1px solid #E8A400; +	background-color: white; +	padding: 8px; +	width: 500px; +	height: 150px; +} + +.cart-hover { +	background-color: #E8A400; +} + +.cart-items { +	width: 30px; +	height: 30px; +} + +.products { +	float: left; +	width: 100px; +	height: 100px; +	margin-right: 10px; +} + +.draggable { +	cursor: move +} + +.removable { +} + +.trash { +	width: 50px; +	height: 50px; +	border: 1px solid black; +} + +.trash-hover { +	background-image: url(<%~ assets/trash.png%>); +} + +</style> +<h1>Drag & Drop demo !</h1> + +<h2>Product List :</h2> + +<div style="margin-bottom: 20px; height: 120px"> + +<com:TRepeater Id="ProductList" DataKeyField="ProductId"> +	<prop:ItemTemplate> +		<com:TDraggable CssClass="products draggable" > +		<com:TImage ImageUrl=<%#$this->Data['ProductImageUrl']%> /> +		</com:TDraggable> +	</prop:ItemTemplate> +</com:TRepeater> +</div> +<h2>Your shopping cart :</h2> +<com:TDropContainer CssClass="cart" Id="cart" +	AcceptCssClass="draggable"  +	HoverCssClass="cart-hover" +	OnDrop="addItemToCart" +	OnCallback="redrawCart" +	> +	<com:TRepeater id="ShoppingList" DataKeyField="ProductId"> +		<prop:EmptyTemplate> +			Your shopping cart is empty, please add some items ! +		</prop:EmptyTemplate> +		<prop:ItemTemplate> +			<com:TDraggable CssClass="removable"  +				Revert="true"  +				Handle="<%=$this->itemImage->ClientId%>"  +				Ghosting=<%#($this->Data['ProductCount'] > 1)%>  +				> +			<com:TImage id="itemImage" CssClass="cart-items" Style="cursor:move" ImageUrl=<%#$this->Data['ProductImageUrl']%>/> +			<com:TLabel id="itemTitle" Text=<%#$this->Data['ProductTitle']%>/> +			<com:TLabel id="itemCount" Text="(<%#$this->Data['ProductCount']%>)" /> +			</com:TDraggable> +		</prop:ItemTemplate> +	</com:TRepeater> +</com:TDropContainer> +<h2>Remove Items from cart by dropping them here</h2> +<com:TDropContainer CssClass="trash" id="trash" +	AcceptCssClass="removable" +	OnDrop="removeItemFromCart" +	OnCallback="redrawCart" +	HoverCssClass="trash-hover" +/> +</com:TContent> 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 @@ +<?php + +prado::using ('System.Web.UI.ActiveControls.*'); + +class Home extends TPage +{ +	public function onInit ($param) +	{ +		parent::onInit($param); +		if (!$this->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.pngBinary files differ new file mode 100755 index 00000000..ae03d551 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product1.png diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.png b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.pngBinary files differ new file mode 100755 index 00000000..25e81ad7 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/product2.png diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.png b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.pngBinary files differ new file mode 100755 index 00000000..184f7628 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/assets/trash.png 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 <tt>string</tt> will be translated to different languages according to the end-user's language preference. Localization tags are in fact shortcuts to the function call <tt>Prado::localize(string)</tt>.
  </p>
 +
 +<a name="ut"></a>
 +<h3 id="1609">URL Tags</h3>
 +<p id="190195" class="block-content">
 +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: 
 +</p>
 +<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_190087">
 +<%/ image.jpg %>
 +</com:TTextHighlighter>
 +</p>
 +<p id="190196" class="block-content">
 +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.
 +</p>
 +
  <div class="last-modified">$Id$</div></com:TContent>
\ 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 <tt>ServiceID</tt> and <tt>ServiceParameter</tt>  By default, <tt>TUrlMapping</tt> will construct URLs prefixed with the currently requesting PHP script path, such as <tt><b>/path/to/index.php</b>/article/3</tt>. Users may change this behavior by explicitly specifying the URL prefix through its <tt>UrlPrefix</tt> property. For example, if the Web server configuration treats <tt>index.php</tt> as the default script, we can set <tt>UrlPrefix</tt> as <tt>/path/to</tt> and the constructed URL will look like <tt>/path/to/article/3</tt>.
  </p>
 -<div class="last-modified">$Id$</div></com:TContent>
\ No newline at end of file +<div class="note"><b class="tip">Note:</b> If you use <tt>constructUrl()</tt> 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 <tt>AllowEncodedSlashes On</tt> to your <tt>VirtualHost</tt> configuration to resolve this. (Available since Apache 2.0.46).
 +</div>
 +
 +<div class="last-modified">$Id$</div></com:TContent>
 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, <tt>TABLE = "`database1`.`table1`"</tt>.  </div> +<div class="note"><b class="note">Note:</b> +Since version <b>3.1.3</b> you can also use a method <tt>table()</tt> to define the table name.  +This allows you to dynamically specify which table should be used by the ActiveRecord. +<com:TTextHighlighter Language="php" CssClass="source block-content"> +class TeamRecord extends TActiveRecord +{ +    public function table() { +        return 'Teams'; +    } +} +</com:TTextHighlighter> +</div> +  <p class="block-content" id="ar_as_component">      Since <tt>TActiveRecord</tt> extends <tt>TComponent</tt>, setter and      getter methods can be defined to allow control over how variables @@ -1183,4 +1196,4 @@ instead of <tt>$userRecord->first_name</tt>. This helps separation of logic and  </ul> -<div class="last-modified">$Id$</div></com:TContent>
\ No newline at end of file +<div class="last-modified">$Id$</div></com:TContent> 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 @@  <p id="40005" class="block-content">
  This page summarizes the main new features that are introduced in each PRADO release.
 -</p>
 +</p> + +<h2>Version 3.1.3</h2> +<ul> +<li>Added <a href="?page=ActiveControls.DragDrop">Drag and drop controls</a></li> +<li>Added TActiveDatePicker control</li> +</ul>
  <h2>Version 3.1.2</h2>  <ul> | 
