[limb-svn] r6741 - in 3.x/examples/shop: . lib/limb settings src/controller src/controller/cart src/fetcher src/model template template/cart template/login template/main_page template/product template/profile var
svn at limb-project.com
svn at limb-project.com
Thu Jan 24 16:38:44 MSK 2008
Author: serega
Date: 2008-01-24 16:38:44 +0300 (Thu, 24 Jan 2008)
New Revision: 6741
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6741
Added:
3.x/examples/shop/settings/macro.conf.php
3.x/examples/shop/settings/wact.conf.override.php
3.x/examples/shop/src/controller/NotFoundController.class.php
3.x/examples/shop/src/controller/cart/CartCheckoutHelper.class.php
3.x/examples/shop/src/model/AlphabetHelper.class.php
3.x/examples/shop/template/cart/checkout.phtml
3.x/examples/shop/template/cart/display.phtml
3.x/examples/shop/template/flash_box.phtml
3.x/examples/shop/template/form_errors.phtml
3.x/examples/shop/template/login/display.phtml
3.x/examples/shop/template/main_page/display.phtml
3.x/examples/shop/template/not_found.phtml
3.x/examples/shop/template/page.phtml
3.x/examples/shop/template/pager.phtml
3.x/examples/shop/template/product/display.phtml
3.x/examples/shop/template/profile/display.phtml
3.x/examples/shop/template/profile/orders.phtml
3.x/examples/shop/template/profile/register.phtml
3.x/examples/shop/template/profile/show_order.phtml
3.x/examples/shop/var/
Removed:
3.x/examples/shop/src/controller/cart/CartCheckoutCommand.class.php
Modified:
3.x/examples/shop/lib/limb/
3.x/examples/shop/settings/
3.x/examples/shop/setup.php
3.x/examples/shop/src/controller/CartController.class.php
3.x/examples/shop/src/controller/LoginController.class.php
3.x/examples/shop/src/controller/ProductController.class.php
3.x/examples/shop/src/controller/ProfileController.class.php
3.x/examples/shop/src/fetcher/AlphabetFetcher.class.php
3.x/examples/shop/src/model/User.class.php
3.x/examples/shop/template/flash_box.html
3.x/examples/shop/template/page.html
Log:
-- intermediate revision in making SHOP example to be compatible with 2007.4 and to work both with MACRO and WACT
Property changes on: 3.x/examples/shop/lib/limb
___________________________________________________________________
Name: svn:externals
- active_record https://svn.limb-project.com/3.x/tags/2007.3/limb/active_record
config https://svn.limb-project.com/3.x/tags/2007.3/limb/config
core https://svn.limb-project.com/3.x/tags/2007.3/limb/core
dbal https://svn.limb-project.com/3.x/tags/2007.3/limb/dbal
fs https://svn.limb-project.com/3.x/tags/2007.3/limb/fs
filter_chain https://svn.limb-project.com/3.x/tags/2007.3/limb/filter_chain
i18n https://svn.limb-project.com/3.x/tags/2007.3/limb/i18n
log https://svn.limb-project.com/3.x/tags/2007.3/limb/log
net https://svn.limb-project.com/3.x/tags/2007.3/limb/net
session https://svn.limb-project.com/3.x/tags/2007.3/limb/session
toolkit https://svn.limb-project.com/3.x/tags/2007.3/limb/toolkit
validation https://svn.limb-project.com/3.x/tags/2007.3/limb/validation
view https://svn.limb-project.com/3.x/tags/2007.3/limb/view
wact https://svn.limb-project.com/3.x/tags/2007.3/limb/wact
web_app https://svn.limb-project.com/3.x/tags/2007.3/limb/web_app
web_cache https://svn.limb-project.com/3.x/tags/2007.3/limb/web_cache
+ active_record https://svn.limb-project.com/3.x/tags/2007.4/limb/active_record
config https://svn.limb-project.com/3.x/tags/2007.4/limb/config
core https://svn.limb-project.com/3.x/tags/2007.4/limb/core
dbal https://svn.limb-project.com/3.x/tags/2007.4/limb/dbal
fs https://svn.limb-project.com/3.x/tags/2007.4/limb/fs
filter_chain https://svn.limb-project.com/3.x/tags/2007.4/limb/filter_chain
i18n https://svn.limb-project.com/3.x/tags/2007.4/limb/i18n
log https://svn.limb-project.com/3.x/tags/2007.4/limb/log
net https://svn.limb-project.com/3.x/tags/2007.4/limb/net
macro https://svn.limb-project.com/3.x/tags/2007.4/limb/macro
session https://svn.limb-project.com/3.x/tags/2007.4/limb/session
toolkit https://svn.limb-project.com/3.x/tags/2007.4/limb/toolkit
validation https://svn.limb-project.com/3.x/tags/2007.4/limb/validation
view https://svn.limb-project.com/3.x/tags/2007.4/limb/view
wact https://svn.limb-project.com/3.x/tags/2007.4/limb/wact
web_app https://svn.limb-project.com/3.x/tags/2007.4/limb/web_app
web_cache https://svn.limb-project.com/3.x/tags/2007.4/limb/web_cache
Property changes on: 3.x/examples/shop/settings
___________________________________________________________________
Name: svn:ignore
- db.conf.override.php
wact.conf.override.php
+ db.conf.override.php
macro.conf.override.php
Added: 3.x/examples/shop/settings/macro.conf.php
===================================================================
--- 3.x/examples/shop/settings/macro.conf.php (rev 0)
+++ 3.x/examples/shop/settings/macro.conf.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,8 @@
+<?php
+$conf = array(
+'forcescan' => false, #Force to scan directories for tags, filters and properties (very slow)
+'forcecompile' => false #Force every template to be re-compiled on every request. Option is used
+ #for debugging templates when developing template generation code
+
+);
+
Added: 3.x/examples/shop/settings/wact.conf.override.php
===================================================================
--- 3.x/examples/shop/settings/wact.conf.override.php (rev 0)
+++ 3.x/examples/shop/settings/wact.conf.override.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,8 @@
+<?php
+$conf = array(
+'forcescan' => false, #Force to scan directories for tags, filters and properties (very slow)
+'forcecompile' => true #Force every template to be re-compiled on every request. Option is used
+ #for debugging templates when developing template
+
+);
+?>
Modified: 3.x/examples/shop/setup.php
===================================================================
--- 3.x/examples/shop/setup.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/setup.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -16,4 +16,8 @@
require_once('limb/web_app/common.inc.php');
require_once('common.inc.php');
+lmbToolkit :: instance()->setSupportedViewTypes(array('.phtml' => 'lmbMacroView',
+ '.html' => 'lmbWactView'));
+
+lmb_require('src/model/*.class.php')
?>
\ No newline at end of file
Modified: 3.x/examples/shop/src/controller/CartController.class.php
===================================================================
--- 3.x/examples/shop/src/controller/CartController.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/controller/CartController.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -12,13 +12,14 @@
function doCheckout()
{
$cart = $this->_getCart();
- $this->performCommand('src/controller/cart/CartCheckoutCommand', $cart);
+ lmb_require('src/controller/cart/CartCheckoutHelper.class.php');
+ return CartCheckoutHelper :: checkoutCart($cart);
}
function doEmpty()
{
$cart = $this->_getCart();
- $cart->removeAll();
+ $cart->reset();
$this->redirect();
}
Modified: 3.x/examples/shop/src/controller/LoginController.class.php
===================================================================
--- 3.x/examples/shop/src/controller/LoginController.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/controller/LoginController.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -9,7 +9,7 @@
return;
$this->useForm('login_form');
- $this->setViewFormDatasource($this->request);
+ $this->setFormDatasource($this->request);
$this->_validateLoginForm();
Added: 3.x/examples/shop/src/controller/NotFoundController.class.php
===================================================================
--- 3.x/examples/shop/src/controller/NotFoundController.class.php (rev 0)
+++ 3.x/examples/shop/src/controller/NotFoundController.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,27 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require('limb/web_app/src/controller/lmbController.class.php');
+
+/**
+ * class NotFoundController.
+ *
+ * @package web_app
+ * @version $Id: NotFoundController.class.php 6243 2007-08-29 11:53:10Z pachanga $
+ */
+class NotFoundController extends lmbController
+{
+ function doDisplay()
+ {
+ $this->response->header('HTTP/1.x 404 Not Found');
+ $this->setTemplate($this->_findTemplateByAlias('not_found'));
+ }
+}
+
+
Modified: 3.x/examples/shop/src/controller/ProductController.class.php
===================================================================
--- 3.x/examples/shop/src/controller/ProductController.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/controller/ProductController.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -5,9 +5,9 @@
{
function doSearch()
{
- $this->setTemplate('product/display.html');
+ $this->setTemplate($this->_findTemplateForAction('display'));
$this->useForm('search_form');
- $this->setViewFormDatasource($this->request);
+ $this->setFormDatasource($this->request);
}
}
?>
Modified: 3.x/examples/shop/src/controller/ProfileController.class.php
===================================================================
--- 3.x/examples/shop/src/controller/ProfileController.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/controller/ProfileController.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -6,7 +6,7 @@
function doDisplay()
{
$this->useForm('profile_form');
- $this->setViewFormDatasource($this->toolkit->getUser());
+ $this->setFormDatasource($this->toolkit->getUser());
if($this->request->hasAttribute('change_password'))
$this->_changeUserPassword();
@@ -55,7 +55,7 @@
protected function _updateUserProfile()
{
$this->useForm('profile_form');
- $this->setViewFormDatasource($this->toolkit->getUser());
+ $this->setFormDatasource($this->toolkit->getUser());
$user = $this->toolkit->getUser();
$user->setEmail($this->request->get('email'));
@@ -85,7 +85,7 @@
function doRegister()
{
$this->useForm('register_form');
- $this->setViewFormDatasource($this->request);
+ $this->setFormDatasource($this->request);
if($this->request->hasPost())
{
Deleted: 3.x/examples/shop/src/controller/cart/CartCheckoutCommand.class.php
===================================================================
--- 3.x/examples/shop/src/controller/cart/CartCheckoutCommand.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/controller/cart/CartCheckoutCommand.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -1,56 +0,0 @@
-<?php
-lmb_require('limb/web_app/src/command/lmbFormCommand.class.php');
-lmb_require('src/model/Order.class.php');
-
-class CartCheckoutCommand extends lmbFormCommand
-{
- protected $cart;
- protected $user;
-
- function __construct($cart)
- {
- parent :: __construct(null, 'checkout_form');
-
- $this->cart = $cart;
- $this->user = $this->toolkit->getUser();
- }
-
- function _onBefore()
- {
- if(!$this->cart->getItemsCount())
- {
- $this->flashMessage('Your cart is empty! Nothing to checkout!');
- $this->redirect(array('controller' => 'main_page'));
- $this->halt();
- }
-
- if(!$this->user->getIsLoggedIn())
- {
- $this->flashMessage('Your are not logged in yet! Please login or register to checkout!');
- $this->redirect();
- $this->halt();
- }
- }
-
- function _onShow()
- {
- $this->view->set('cart', $this->cart);
- $this->setViewFormDatasource($this->user);
- }
-
- function _onValid()
- {
- $order = Order :: createForCart($this->cart);
- $order->setAddress($this->request->get('address'));
- $order->setUser($this->user);
-
- if($order->trySave($this->error_list))
- {
- $this->cart->removeAll();
- $this->flashMessage('Your order has been sent. Your cart is now empty.');
- $this->redirect(array('controller' => 'main_page'));
- $this->halt();
- }
- }
-}
-?>
Copied: 3.x/examples/shop/src/controller/cart/CartCheckoutHelper.class.php (from rev 6736, 3.x/examples/shop/src/controller/cart/CartCheckoutCommand.class.php)
===================================================================
--- 3.x/examples/shop/src/controller/cart/CartCheckoutHelper.class.php (rev 0)
+++ 3.x/examples/shop/src/controller/cart/CartCheckoutHelper.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,36 @@
+<?php
+lmb_require('limb/web_app/src/command/lmbFormCommand.class.php');
+lmb_require('src/model/Order.class.php');
+
+class CartCheckoutHelper extends lmbController
+{
+ function checkoutCart($cart)
+ {
+ $user = $this->toolkit->getUser();
+ $this->view->set('cart', $cart);
+ $this->useForm('checkout_form');
+ $this->setFormDatasource($user);
+
+ if(!$this->request->hasPost())
+ {
+ if(!$cart->getItemsCount())
+ return $this->flashAndRedirect('Your cart is empty! Nothing to checkout!', array('controller' => 'main_page'));
+
+ if(!$user->getIsLoggedIn())
+ return $this->flashAndRedirect('Your are not logged in yet! Please login or register to checkout!');
+ }
+ else
+ {
+ $order = Order :: createForCart($cart);
+ $order->setAddress($this->request->get('address'));
+ $order->setUser($user);
+
+ if($order->trySave($this->error_list))
+ {
+ $cart->reset();
+ return $this->flashAndRedirect('Your order has been sent. Your cart is now empty.', array('controller' => 'main_page'));
+ }
+ }
+ }
+}
+?>
Modified: 3.x/examples/shop/src/fetcher/AlphabetFetcher.class.php
===================================================================
--- 3.x/examples/shop/src/fetcher/AlphabetFetcher.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/fetcher/AlphabetFetcher.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -6,29 +6,8 @@
{
function _createDataset()
{
- $current_letter = '';
- $request = lmbToolkit :: instance()->getRequest();
- if($request->hasAttribute('letter'))
- $current_letter = $request->get('letter');
-
- return new lmbCollection($this->_getEnglishLetters($current_letter));
+ return new lmbCollection(AlphabetHelper :: getAlphabet());
}
-
- function _getEnglishLetters($current_letter = '')
- {
- $result = array();
- for($i = 'A'; $i <= 'Z'; $i++)
- {
- if(strlen($i) == 2)
- break;
-
- $result[$i]['letter'] = $i;
- if ($i == $current_letter)
- $result[$i]['current'] = true;
- }
-
- return $result;
- }
}
?>
Added: 3.x/examples/shop/src/model/AlphabetHelper.class.php
===================================================================
--- 3.x/examples/shop/src/model/AlphabetHelper.class.php (rev 0)
+++ 3.x/examples/shop/src/model/AlphabetHelper.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,32 @@
+<?php
+
+class AlphabetHelper
+{
+ static function getAlphabet()
+ {
+ $current_letter = '';
+ $request = lmbToolkit :: instance()->getRequest();
+ if($request->hasAttribute('letter'))
+ $current_letter = $request->get('letter');
+
+ return self :: _getEnglishLetters($current_letter);
+ }
+
+ function _getEnglishLetters($current_letter = '')
+ {
+ $result = array();
+ for($i = 'A'; $i <= 'Z'; $i++)
+ {
+ if(strlen($i) == 2)
+ break;
+
+ $result[$i]['letter'] = $i;
+ if ($i == $current_letter)
+ $result[$i]['current'] = true;
+ }
+
+ return $result;
+ }
+}
+
+?>
Modified: 3.x/examples/shop/src/model/User.class.php
===================================================================
--- 3.x/examples/shop/src/model/User.class.php 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/src/model/User.class.php 2008-01-24 13:38:44 UTC (rev 6741)
@@ -68,7 +68,7 @@
function logout()
{
- $this->removeAll();
+ $this->reset();
$this->is_logged_in = false;
}
}
Added: 3.x/examples/shop/template/cart/checkout.phtml
===================================================================
--- 3.x/examples/shop/template/cart/checkout.phtml (rev 0)
+++ 3.x/examples/shop/template/cart/checkout.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,38 @@
+<? $this->title ='Checkout'; ?>
+{{wrap with="page.phtml" in="content"}}
+
+Your cart contains {$#cart.items_count} items.
+
+{{list using="$#cart.items"}}
+<table cellpadding="0" cellspacing="0" class='list'>
+ <thead>
+ <tr>
+ <th>Title</th>
+ <th>Price</th>
+ <th>Quantity</th>
+ <th>Summ</th>
+ </tr>
+ </thead>
+ {{list:item}}
+ <tr class='{$Parity}'>
+ <td>{$item.product.title}</td>
+ <td>${$item.price|number:2, '.', ' '}</td>
+ <td>{$item.quantity}</td>
+ <td>${$item.summ|number:2, '.', ' '}</td>
+ </tr>
+ {{/list:item}}
+</table>
+{{/list}}
+
+Total summ is : <b>${$#cart.total_summ|number:2, '.', ' '}</b>
+<br/>
+
+{{form name='checkout_form' id='checkout_form' method='POST'}}
+
+ <label for='address'>Delivery address:</label><br/>
+ {{textarea type="text" name="address" id="address" title="Delivery address"/}}<br/>
+
+ <input type='submit' class='button' name='submitted' value="Finish order" class='button'/><br/>
+{{/form}}
+
+{{/wrap}}
Added: 3.x/examples/shop/template/cart/display.phtml
===================================================================
--- 3.x/examples/shop/template/cart/display.phtml (rev 0)
+++ 3.x/examples/shop/template/cart/display.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,36 @@
+<? $this->title ='Your Cart'; ?>
+{{wrap with="page.phtml" in="content"}}
+
+<? if($this->cart->items_count) {?>
+Your cart contains {$#cart.items_count} items.
+
+{{list using="$#cart.items" parity="$parity"}}
+<table cellpadding="0" cellspacing="0" class='list'>
+ <thead>
+ <tr>
+ <th>Title</th>
+ <th>Price</th>
+ <th>Quantity</th>
+ <th>Summ</th>
+ </tr>
+ </thead>
+ {{list:item}}
+ <tr class='{$parity}'>
+ <td>{$item.product.title}</td>
+ <td>${$item.price|number:2, '.',' '}</td>
+ <td>{$item.quantity}</td>
+ <td>${$item.summ|number:2, '.', ' '}</td>
+ </tr>
+ {{/list:item}}
+</table>
+{{/list}}
+
+Total summ is : <b>${$#cart.total_summ|number:2, '.', ' '}</b>
+<br/>
+<a href="{{route_url params='action:empty'}}">Empty cart</a><br/>
+<a href="{{route_url params='action:checkout'}}">Checkout</a>
+<? } else { ?>
+You cart is empty at the moment!
+<? } ?>
+
+{{/wrap}}
Modified: 3.x/examples/shop/template/flash_box.html
===================================================================
--- 3.x/examples/shop/template/flash_box.html 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/template/flash_box.html 2008-01-24 13:38:44 UTC (rev 6741)
@@ -1,8 +1,8 @@
-<flash_box target='flash_messages' />
+<?php $flash_messages = lmbToolkit :: instance()->getFlashBox()->getUnifiedList(); ?>
-<list:list id='flash_messages'>
+<list:list from='$flash_messages'>
<list:ITEM>
-<core:OPTIONAL for='is_error'><div class="error_border"><b>{$text}</b></div></core:OPTIONAL>
-<core:OPTIONAL for='is_message'><div class="border"><b>{$text}</b></div></core:OPTIONAL>
+<core:OPTIONAL for='is_error'><div class="error_border"><b>{$message}</b></div></core:OPTIONAL>
+<core:OPTIONAL for='is_message'><div class="border"><b>{$message}</b></div></core:OPTIONAL>
</list:ITEM>
</list:list>
Added: 3.x/examples/shop/template/flash_box.phtml
===================================================================
--- 3.x/examples/shop/template/flash_box.phtml (rev 0)
+++ 3.x/examples/shop/template/flash_box.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,8 @@
+<? $flash_messages = $this->toolkit->getFlashBox()->getUnifiedList(); ?>
+
+{{list using='$flash_messages'}}
+{{list:item}}
+<? if($item['is_error']){ ?><div class="error_border"><b>{$item.message}</b></div><? } ?>
+<? if($item['is_message']){ ?><div class="border"><b>{$item.message}</b></div><? } ?>
+{{/list:item}}
+{{/list}}
Added: 3.x/examples/shop/template/form_errors.phtml
===================================================================
--- 3.x/examples/shop/template/form_errors.phtml (rev 0)
+++ 3.x/examples/shop/template/form_errors.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,12 @@
+{{form:errors to='$form_errors'/}}
+
+{{list using='$form_errors'}}
+<span class='title_error'>Form was not saved since form fields have the following errors:</span>
+ <ul class='list_errors'>
+ {{list:item}}
+ <li>{$item.message}</li>
+ {{/list:item}}
+ </ul>
+<p><strong>Please fix these errors and submit the form once again</strong></p>
+<div class="hr"></div>
+{{/list}}
Added: 3.x/examples/shop/template/login/display.phtml
===================================================================
--- 3.x/examples/shop/template/login/display.phtml (rev 0)
+++ 3.x/examples/shop/template/login/display.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,21 @@
+<? $this->title='Login'; ?>
+{{wrap with="page.phtml" into="content"}}
+
+{{form method="POST" id='login_form'}}
+
+ {{include file='form_errors.phtml'/}}
+
+ <div class="field">
+ <label for='login'>Login:</label>
+ {{input type="text" name="login" id="login" title="Login" class='input'/}}
+ </div>
+
+ <div class="field">
+ <label for='passwd'>Password:</label>
+ {{input type="text" name="password" id="password" type="password" title="Password" class='input'/}}
+ </div>
+
+ <input type='submit' class='button' name='submitted' value="Submit" class='button'/>
+{{/form}}
+
+{{/wrap}}
Added: 3.x/examples/shop/template/main_page/display.phtml
===================================================================
--- 3.x/examples/shop/template/main_page/display.phtml (rev 0)
+++ 3.x/examples/shop/template/main_page/display.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,8 @@
+<? $this->title = 'Main page'; ?>
+{{wrap with="page.phtml" slot="content"}}
+<p>Wellcome to our bookstore!</p>
+<br/>
+<p>To play with control panel use left login form with <b>"admin"</b> as login and <b>"123"</b> as password.</p>
+<br/>
+<p>Hope you will like this example</p>
+{{/wrap}}
Added: 3.x/examples/shop/template/not_found.phtml
===================================================================
--- 3.x/examples/shop/template/not_found.phtml (rev 0)
+++ 3.x/examples/shop/template/not_found.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,5 @@
+<? $this->title = 'Not found'; ?>
+{{wrap with="page.phtml" in="content"}}
+<b>Error 404.</b>
+<p>Page not found.</p>
+{{/wrap}}
Modified: 3.x/examples/shop/template/page.html
===================================================================
--- 3.x/examples/shop/template/page.html 2008-01-24 13:06:04 UTC (rev 6740)
+++ 3.x/examples/shop/template/page.html 2008-01-24 13:38:44 UTC (rev 6741)
@@ -3,7 +3,7 @@
<html>
<head>
<base href="{$'LIMB_HTTP_BASE_PATH'|const}" />
- <title>{$title} :: Limb3 shop example application</title>
+ <title>{$title} :: Limb3 shop example application on WACT</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<link rel=stylesheet type="text/css" href="styles/main.css"/>
</head>
Added: 3.x/examples/shop/template/page.phtml
===================================================================
--- 3.x/examples/shop/template/page.phtml (rev 0)
+++ 3.x/examples/shop/template/page.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,82 @@
+<!-- Powered by LIMB | http://www.limb-project.com/ -->
+<!-- Designed by BIT | http://www.bit-creative.com/ -->
+<html>
+<head>
+ <base href="<?= LIMB_HTTP_BASE_PATH ?>" />
+ <title>{$#title} :: Limb3 shop example application on MACRO</title>
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
+ <link rel=stylesheet type="text/css" href="styles/main.css"/>
+</head>
+<body>
+
+<div id="header">
+ <div class="center">
+ <img src="images/logo.limb.gif" width='384' height='46' alt='logo.limb' id='logo'/>
+ <div id="limb_links"><a href="http://limb-project.com">limb-project.com</a> | <a href="http://projects.limb-project.com">projects.limb-project.com</a></div>
+ </div>
+</div>
+
+
+ <div id="center">
+
+ <div id="wrapper" >
+
+ <div id="container">
+ <div id="content">
+ <h1>{$#title}</h1>
+
+ {{include file='flash_box.phtml'}}
+
+ {{slot id='content'/}}
+
+ </div>
+ </div>
+
+ <div id="sidebar">
+ <div id="navigation">
+ <ul>
+ <li><a href="product">Products</a></li>
+ <li><a href="cart">Your Cart</a></li>
+ <? if($this->user->is_logged_in) { ?>
+ <li><a href="{{route_url params='controller:profile,action:orders'}}">Your Orders</a></li>
+ <? } ?>
+ </ul>
+ </div>
+
+ <dl id="profile">
+ <dt>Profile</dt>
+ <? if($this->user->is_logged_in) { ?>
+ <dd>
+ User: {$#user.name}<br/>
+ Login: {$#user.login}<br/>
+ Email: {$#user.email}<br/>
+ <a href="{{route_url params='controller:profile'}}">edit</a>
+ <a href="{{route_url params='controller:login,action:logout'}}">logout</a>
+ </dd>
+ <? } else {?>
+ <dd>
+ <form method="POST" id='login_form' action='login'>
+
+ <label for='login'>Login:</label><br/>
+ <input type="text" name="login" id="login" title="Login" class='input'/><br/>
+
+ <label for='passwd'>Password:</label><br/>
+ <input type="text" name="password" id="password" type="password" title="Password" class='input'/><br/>
+
+ <input type='submit' name='submitted' value="Submit"/><br/>
+ </form>
+ <a href="{{route_url params='controller:profile,action:register'}}">Register</a>
+ </dd>
+ <? } ?>
+ </dl>
+
+ <a href='wact_template_source/?t[]={$#this_template_path}' target='_blank' class='view_template'>View template</a>
+
+ </div>
+
+ </div>
+</div>
+
+</body>
+</html>
+
Added: 3.x/examples/shop/template/pager.phtml
===================================================================
--- 3.x/examples/shop/template/pager.phtml (rev 0)
+++ 3.x/examples/shop/template/pager.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,30 @@
+{{pager id="pager" items="5"}}
+
+<table width='690' border='0' cellspacing='0' cellpadding='0' class='pager'>
+<tr>
+ <td width='50%' align='left'>
+ {{pager:first}}<a href="{$href}" title="First page"><< </a>{{/pager:first}}
+
+ {{pager:prev}}<a href="{$href}" title="Previous page">< </a>{{/pager:prev}}
+
+ {{pager:list}}
+
+ {{pager:current}} <b>[ {$number} ]</b> {{/pager:current}}
+ {{pager:number}}<a href="{$href}"> {$number} </a>{{/pager:number}}
+
+ {{/pager:list}}
+
+
+ {{pager:next}}<a href="{$href}" title="Next page">></a>{{/pager:next}}
+
+ {{pager:last}}<a href="{$href}" title="Last page">>></a>{{/pager:last}}
+ </td>
+ <td align='right'>
+ Shown: from <b>{$begin_item_number}</b> to <b>{$end_item_number}</b>
+ Total: <b>{$total_items}</b><br />
+ </td>
+</tr>
+</table>
+
+{{/pager}}
+
Added: 3.x/examples/shop/template/product/display.phtml
===================================================================
--- 3.x/examples/shop/template/product/display.phtml (rev 0)
+++ 3.x/examples/shop/template/product/display.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,65 @@
+<? $this->title ='Products'; ?>
+{{wrap with="page.phtml" into="content"}}
+
+<p/>
+<? $alphabet = AlphabetHelper :: getAlphabet(); ?>
+
+<a href="{{route_url params='controller:product'}}">Display all</a>
+
+{{list using="$alphabet"}}
+ {{list:item}}
+ <? if(isset($item['current'])) { ?>
+ <b>{$item.letter|uppercase}</b>
+ <? } else { ?>
+ <a href='product?letter={$item.letter}'>{$item.letter|uppercase}</a>
+ <? } ?>
+ {{/list:item}}
+{{/list}}
+
+<p/><b>Search the products:</b>
+{{form method="GET" id='search_form' name='search_form' action='product'}}
+
+ <label for='product'>Product title:</label>
+ {{input type="text" name="product" id="product" size='10'/}}
+
+ <label for='price_greater'>Price greater:</label>
+ {{input type="text" name="price_greater" id="price_greater" type="text" size='4'/}}
+
+ <label for='price_less'>Price less:</label>
+ {{input type="text" name="price_less" id="price_less" type="text" size='4'/}}
+
+ <input type='submit' name='search' value="Search!" class='button'/><br/>
+ <input type='hidden' name='action' value='search'/>
+{{/form}}
+
+<? $products = Product :: findForFront(); ?>
+
+{{paginate iterator='$products' pager="pager"/}}
+
+{{include file='pager.phtml'/}}
+
+{{list using="$products"}}
+<table cellpadding="0" cellspacing="0" class='list'>
+ <thead>
+ </thead>
+ {{list:item}}
+ <tr>
+ <td>
+ <dl>
+ <dt>
+ <b>{$item.title}</b><br />
+ Price:<b>${$item.price|number:2, '.', ' '}</b><br/>
+ <a href="{{route_url params='controller:cart,action:add,id:{$item.id}'}}">Add to cart</a><br/>
+ </dt>
+ <dd>
+ <img src='{$item.image_path}' class='img'/>
+ {$item.description|nl2br}
+ </dd>
+ </dl>
+ </td>
+ </tr>
+ {{/list:item}}
+</table>
+{{/list}}
+
+{{/wrap}}
Added: 3.x/examples/shop/template/profile/display.phtml
===================================================================
--- 3.x/examples/shop/template/profile/display.phtml (rev 0)
+++ 3.x/examples/shop/template/profile/display.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,42 @@
+<? $this->title = 'Your profile'; ?>
+{{wrap with="page.phtml" in="content"}}
+
+This is your profile page. You can change some of your profile fields as well as your password<br/>
+
+<h2>Profile</h2>
+
+{{form id='profile_form' name='profile_form' method='post'}}
+
+ {{include file='form_errors.phtml'/}}
+
+ <label for="name" errorclass='error'>Name:</label><br/>
+ {{input name="name" id='name' type="text" title="Name" class='input'/}}<br/>
+
+ <label for="email" errorclass='error'>Email:</label><br/>
+ {{input name="email" id='email' type="text" title="Email" class='input'/}} <br/>
+
+ <label for="address" errorclass='error'>Delivery address:</label><br/>
+ {{textarea name="address" id='address' type="text" title="Delivery address" cols='40' rows='5' class='input'/}} <br/>
+
+ <input id='edit' name='edit' type='submit' value='Update profile'/>
+{{/form}}
+
+<h2>Password change form</h2>
+
+{{form id='change_password_form' name='change_password_form' method='post'}}
+
+ {{include file='form_errors.phtml'/}}
+
+ <label for="old_password" errorclass='error'>Old Password:</label><br/>
+ {{input name="old_password" id='old_password' type="password" title="Old Password" class='input'/}}<br/>
+
+ <label for="password" errorclass='error'>Password:</label><br/>
+ {{input name="password" id='password' type="password" title="Password" class='input'/}}<br/>
+
+ <label for="repeat_password" errorclass='error'>Repeat password:</label><br/>
+ {{input name="repeat_password" id="repeat_password" type="password" title="Repeat password" class='input'/}}<br/>
+
+ <input id='change_password' name='change_password' type='submit' value='Change password'/>
+{{/form}}
+
+{{/wrap}}
Added: 3.x/examples/shop/template/profile/orders.phtml
===================================================================
--- 3.x/examples/shop/template/profile/orders.phtml (rev 0)
+++ 3.x/examples/shop/template/profile/orders.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,27 @@
+<? $this->title ='Your orders'; ?>
+{{wrap with="page.phtml" in="content"}}
+
+{{list using='$#user.orders'}}
+<table cellpadding="0" cellspacing="0" class='list'>
+ <thead>
+ <tr>
+ <th>#</th>
+ <th>Date</th>
+ <th>Summ</th>
+ <th>Status</th>
+ </tr>
+ </thead>
+ {{list:item}}
+ <tr class='{$Parity}'>
+ <td><a href="{{route_url field='order_url' params='action:show_order,id:{$item.id}'}}">{$item.id}</a></td>
+ <td><a href="{{route_url field='order_url' params='action:show_order,id:{$item.id}'}}">{$item.date|date:"F j, Y, G:i"}</a></td>
+ <td>${$item.summ|number:2, '.', ' '}</td>
+ <td>{$item.status_name}</td>
+ </tr>
+ {{/list:item}}
+</table>
+{{list:empty}}
+ You made no orders in our shop yet.
+ {{/list:empty}}
+{{/list}}
+{{/wrap}}
Added: 3.x/examples/shop/template/profile/register.phtml
===================================================================
--- 3.x/examples/shop/template/profile/register.phtml (rev 0)
+++ 3.x/examples/shop/template/profile/register.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,42 @@
+<? $this->title = 'Registration'; ?>
+{{wrap with="page.phtml" in="content"}}
+
+{{form id='register_form' name='register_form' method='post'}}
+
+ {{include file='form_errors.phtml'/}}
+
+ <div class="field">
+ <label for="login" errorclass='error'>Login<span class='star'>*</span>:</label>
+ {{input name="login" id='login' type="text" title="Login" class='input'/}}
+ </div>
+
+ <div class="field">
+ <label for="name" errorclass='error'>Name<span class='star'>*</span>:</label>
+ {{input name="name" id='name' type="text" title="Name" class='input'/}}
+ </div>
+
+ <div class="field">
+ <label for="email" errorclass='error'>Email<span class='star'>*</span>:</label>
+ {{input name="email" id='email' type="text" title="Email" class='input'/}}
+ </div>
+
+ <div class="field">
+ <label for="password" errorclass='error'>Password<span class='star'>*</span>:</label>
+ {{input name="password" id='password' type="password" title="Password" class='input'/}}
+ </div>
+
+ <div class="field">
+ <label for="repeat_password" errorclass='error'>Repeat password<span class='star'>*</span>:</label>
+ {{input name="repeat_password" id="repeat_password" type="password" title="Repeat password" class='input'/}}
+ </div>
+
+ <div class="field">
+ <label for="address" errorclass='error'>Delivery address:</label>
+ {{textarea name="address" id='address' type="text" title="Delivery address" size='40' class='textarea'/}}
+ </div>
+
+ <div class="hr"></div>
+ <input id='register' type='submit' value='Register'/>
+{{/form}}
+
+{{/wrap}}
Added: 3.x/examples/shop/template/profile/show_order.phtml
===================================================================
--- 3.x/examples/shop/template/profile/show_order.phtml (rev 0)
+++ 3.x/examples/shop/template/profile/show_order.phtml 2008-01-24 13:38:44 UTC (rev 6741)
@@ -0,0 +1,24 @@
+<? $this->title ='Order details'; ?>
+{{wrap with="page.phtml" in="content"}}
+
+{{list using='$#order.lines'}}
+<table cellpadding="0" cellspacing="0" class='list'>
+ <thead>
+ <tr>
+ <th>Title</th>
+ <th>Price</th>
+ <th>Quantity</th>
+ <th>Summ</th>
+ </tr>
+ </thead>
+ {{list:item}}
+ <tr class='{$Parity}'>
+ <td>{$item.product.title}</td>
+ <td>${$item.price|number:2, '.', ' '}</td>
+ <td>{$item.quantity}</td>
+ <td>${$item.summ|number:2, '.', ' '}</td>
+ </tr>
+ {{/list:item}}
+</table>
+{{/list}}
+{{/wrap}}
Property changes on: 3.x/examples/shop/var
___________________________________________________________________
Name: svn:ignore
+ *
More information about the limb-svn
mailing list