Merge branch 'master' into loops

This commit is contained in:
Etienne Roudeix
2013-07-23 10:44:41 +02:00
218 changed files with 4272 additions and 3653 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,9 @@
body {
font-size: 12px;
font-family: Arial, helvetica, sans serif;
background-image: url("../img/test-background.jpg");
}
div {
margin: 10px 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

6
templates/default/assets/js/jquery.min.js vendored Executable file

File diff suppressed because one or more lines are too long

55
templates/default/category.html Executable file
View File

@@ -0,0 +1,55 @@
{*loop name="category0" type="category" parent="0"}
<h2>CATEGORY : #TITLE</h2>
{loop name="category1" type="category" parent="#ID"}
<hr />
<h3>SUBCATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h3>
{loop name="product" type="product" category="#ID"}
<h3>PRODUCT : #REF / #TITLE</h3>
#PRICE €
{/loop}
<hr />
<hr />
{/loop}
{loop name="product" type="product" category="#ID"}
<h3>PRODUCT : #REF / #TITLE</h3>
#PRICE €
{/loop}
<hr />
<hr />
{/loop*}
<h2>PRODUCTS</h2>
{*loop name="product" type="product" order="promo,min_price" exclude_category="3"}
<h3>PRODUCT : #REF / #TITLE</h3>
price : #PRICE €<br />
promo price : #PROMO_PRICE €<br />
is promo : #PROMO<br />
is new : #NEW<br />
weight : #WEIGHT<br />
{/loop*}
{*loop name="product" type="product" order="ref" feature_available="1: (1 | 2) , 2: 4, 3: 433"}
<h3>PRODUCT : #REF / #TITLE</h3>
price : #PRICE €<br />
promo price : #PROMO_PRICE €<br />
is promo : #PROMO<br />
is new : #NEW<br />
weight : #WEIGHT<br />
{/loop*}
{*loop name="product" type="product" order="ref" feature_values="1: foo"}
<h3>PRODUCT : #REF / #TITLE</h3>
price : #PRICE €<br />
promo price : #PROMO_PRICE €<br />
is promo : #PROMO<br />
is new : #NEW<br />
weight : #WEIGHT<br />
{/loop*}
{loop name="product" type="product" order="ref"}
<h3>PRODUCT : #REF / #TITLE</h3>
<h4>Accessories</h4>
{loop name="acc" type="accessory" product="#ID" order="accessory,max_price"}
#REF -
{/loop}
{/loop}

162
templates/default/connexion.html Executable file
View File

@@ -0,0 +1,162 @@
{include file="includes/header.html"}
{form name="thelia.customer.creation"}
{* We use $INDEX_PAGE as form action to avoid mixing post and get data *}
<form action="{$INDEX_PAGE}" method="post" {form_enctype form=$form}>
{*
The two fields below are not par of the Login form, they are here to defines
the action to process, and the view to render once the form is submited
*}
<input type="hidden" name="action" value="createCustomer" /> {* the action triggered by this form *}
<input type="hidden" name="view" value="connexion" /> {* the view to return to if the form cannot be validated *}
{*
This field is common to all BaseForm instances (thus, this one), and defines
the URL the customer is redirected to once the form has been successfully
processed
*}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{$RETURN_TO_URL}" /> {* the url the user is redirected to on login success *}
{/form_field}
{*
customer_creation_error_message is defined in Customer action processor class,
and passed the parser through the ParserContext service.
*}
{if isset($customer_creation_error_message)}<div class="alert alert-error">{$customer_creation_error_message}</div>{/if}
{form_hidden_fields form=$form}
{form_field form=$form field="title"}
{form_error form=$form field="title"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label>
<select name="{$name}">
<option value="1">M.</option>
<option value="2">Mme.</option>
</select>
<br />
{/form_field}
{form_field form=$form field="firstname"}
{form_error form=$form field="firstname"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="lastname"}
{form_error form=$form field="lastname"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="address1"}
{form_error form=$form field="address1"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="address2"}
{form_error form=$form field="address2"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="address3"}
{form_error form=$form field="address3"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="zipcode"}
{form_error form=$form field="zipcode"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="city"}
{form_error form=$form field="city"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr} > <br />
{/form_field}
{form_field form=$form field="country"}
{form_error form=$form field="country"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label>
<select name="{$name}">
<option value="1">France</option>
<option value="2">Belgium</option>
</select>
<br />
{/form_field}
{form_field form=$form field="phone"}
{form_error form=$form field="phone"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr}> <br />
{/form_field}
{form_field form=$form field="cellphone"}
{form_error form=$form field="cellphone"}
{$message}
{/form_error}
<label> <span>{intl l="{$label}"} : </span></label><input type="text" name="{$name}" value="{$value}" {$attr}> <br />
{/form_field}
{form_field form=$form field="email"}
{form_error form=$form field="email"}
{#message}
{/form_error}
<label><span>{intl l="{$label}"}</span></label><input type="email" name="{$name}" value="{$value}" {$attr} ><br />
{/form_field}
{form_field form=$form field="email_confirm"}
{form_error form=$form field="email_confirm"}
{#message}
{/form_error}
<label><span>{intl l="{$label}"}</span></label><input type="email" name="{$name}" {$attr} ><br />
{/form_field}
{form_field form=$form field="password"}
{form_error form=$form field="password"}
{#message}
{/form_error}
<label><span>{intl l="{$label}"}</span></label><input type="password" name="{$name}" {$attr} ><br />
{/form_field}
{form_field form=$form field="password_confirm"}
{form_error form=$form field="password_confirm"}
{#message}
{/form_error}
<label><span>{intl l="{$label}"}</span></label><input type="password" name="{$name}" {$attr} ><br />
{/form_field}
<input type="submit" value="valider">
</form>
{/form}
{include file="includes/footer.html"}

0
templates/default/i18n/en.php Executable file
View File

1
templates/default/i18n/fr.php Executable file
View File

@@ -0,0 +1 @@
<?php

View File

@@ -1,2 +0,0 @@
include 1 success<br />
#INCLUDE "subinclude1.html"

12
templates/default/included.html Executable file
View File

@@ -0,0 +1,12 @@
{loop name="included0" type="category" parent="0"}
<h2>Out before - CATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h2>
{loop name="category1" type="category" parent="#ID"}
<h3>Inner - SUBCATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h3>
{/loop}
{loop name="category2" type="category" parent="#ID"}
<h3>Inner 2 - SUBCATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h3>
{/loop}
<h2>Out after - CATEGORY : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h2>
<hr />
{/loop}

View File

@@ -0,0 +1,18 @@
{* Include required JS files *}
{javascripts file='../assets/js/*'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
$('#jquery_block').html("Jquery is now loaded.").hover(function() {
$(this).css('font-weight', 'bold');
}, function() {
$(this).css('font-weight', 'normal');
});
});
</script>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>{$page_title|default:{intl l="Thelia II"}}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{stylesheets file='../assets/css/*' filters='less,cssembed'}
<link rel="stylesheet" href="{$asset_url}">
{/stylesheets}
</head>
<body>
<div>
{loop type="auth" name="customer_info_block" roles="CUSTOMER" context="front"}
<p>Your are logged in ! <a href="{viewurl view='index' action='logoutCustomer'}">Logout</a></p>
{/loop}
{loop type="auth" name="admin_info_block" roles="ADMIN" context="admin"}
<p>You are logged as administrator</p>
{/loop}
{elseloop rel="customer_info_block"}
You are not logged in. <a href="{viewurl view='login'}">Login now</a> or <a href="{viewurl view='connexion'}">create your account</a>
{/elseloop}
</div>
<hr />

View File

@@ -1,26 +1,151 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div>TODO write content<br />
<THELIA_cat type="category">
#__COUNT__ - #TITLE <br />
nb child : #NB_CHILD <br /><br />
</THELIA_cat>
{include file="includes/header.html"}
<div>
<TEST_equal test="equal" variable="3" value="1">
test vrai
</TEST_equal>
test faux
<//TEST_equal>
<br />
<REPEAT_loopy start="6" end="12" increment="1">
Compteur = #INDEX<br />
</REPEAT_loopy>
{loop type="auth" name="auth_test" context="front" roles="CUSTOMER"}
</div>
</body>
</html>
<p>Customer is authentified :-)</p>
{/loop}
{elseloop rel="auth_test"}
<p>Customer is not authentified :-(</p>
{/elseloop}
An image from asset directory :
{images file='assets/img/logo-thelia-34px.png'}<img src="{$asset_url}" alt="{intl l='Thelia, solution e-commerce libre'}" />{/images}
</div>
<div>
{intl l='An internationalized string'}
</div>
<div>
jQuery data: <span id="jquery_block"></span>
</div>
<div>
<p>Category loop example</p>
<ul>
{loop type="category" name="catloop1"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}, children: {$NB_CHILD}
{ifloop rel="inner1"}
<ul>
{loop type="category" name="inner1" parent="{$ID}"}
<li>Sub cat {$ID} (parent is {$PARENT}): {$TITLE}</li>
{/loop}
</ul>
{/ifloop}
</li>
{/loop}
</ul>
</div>
<div>
<p>Conditional example #1</p>
{ifloop rel="catloop2"}
Hey ! Loop catloop2 is not empty:
<ul>
{loop type="category" name="catloop2" parent="12"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
{/loop}
</ul>
{/ifloop}
{elseloop rel="catloop2"}
<p>Loop catloop2 is empty</p>
{/elseloop}
</div>
<div>
<p>Conditional example #2</p>
{ifloop rel="catloop3"}
Loop catloop3 is not empty:
<ul>
{loop type="category" name="catloop3" parent="0"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
{/loop}
</ul>
{/ifloop}
{elseloop rel="catloop3"}
<p>Loop catloop3 is empty</p>
{/elseloop}
{elseloop rel="catloop2"}
<p>... but catloop2 is still empty :-)</p>
{/elseloop}
</div>
<div>
<p>Traditional for loop</p>
{for $index=5 to 12 step 1}
Compteur = {$index}<br />
{/for}
</div>
<div>
<p>Some pagination</p>
<p>PAGE 1</p>
<ul>
{loop type="category" name="catloopwithpagination1" limit="2" page="1"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
{/loop}
</ul>
<p>PAGE 2</p>
<ul>
{loop type="category" name="catloopwithpagination2" limit="2" page="2"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
{/loop}
</ul>
<p>PAGE 1000</p>
<ul>
{loop type="category" name="catloopwithpagination1000" limit="2" page="1000"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
{/loop}
{elseloop rel="catloopwithpagination1000"}
NO RESULTS
{/elseloop}
</ul>
</div>
<div>
<p>Some pagination with page choice</p>
{assign var=current_page value=2}
<p>PAGE {$current_page} :</p>
<ul>
{loop type="category" name="catloopwithpaginationchoice" limit="2" page="{$current_page}"}
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
{/loop}
</ul>
<p>page choice</p>
{pageloop rel="catloopwithpaginationchoice"}
{if ${PAGE} != {$current_page}}
{if {$PAGE} > {$current_page}-10 AND {$PAGE} < {$current_page}+10}
{$PAGE}
{/if}
{if {$PAGE} == {$current_page}-10 OR {$PAGE} == {$current_page}+10}
...
{/if}
{if ({$PAGE} < {$current_page}-10 OR {$PAGE} > {$current_page}+10) AND ({$PAGE}%10 == 0 OR ${PAGE} == {$LAST} OR ${PAGE} == 1)}
{$PAGE}
{/if}
{else}
{ {$PAGE} }
{/if}
{if {$PAGE} != {$LAST}}
-
{/if}
{/pageloop}
</div>
{include file="includes/footer.html"}

View File

@@ -0,0 +1,52 @@
{include file="includes/header.html"}
<h1>{intl l='Please login'}</h1>
{form name="thelia.customer.login" }
{* We use $INDEX_PAGE as form action to avoid mixing post and get data *}
<form action="{$INDEX_PAGE}" method="post" {form_enctype form=$form}>
{*
The two fields below are not par of the Login form, they are here to defines
the action to process, and the view to render once the form is submited
*}
<input type="hidden" name="action" value="loginCustomer" /> {* the action triggered by this form *}
<input type="hidden" name="view" value="login" /> {* the view to return to if the form cannot be validated *}
{*
This field is common to all BaseForm instances (thus, this one), and defines
the URL the customer is redirected to once the form has been successfully
processed
*}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{$RETURN_TO_URL}" /> {* the url the user is redirected to on login success *}
{/form_field}
{*
customer_login_error_message is defined in Customer action processor class,
and passed the parser through the ParserContext service.
*}
{if isset($customer_login_error_message)}<div class="alert alert-error">{$customer_login_error_message}</div>{/if}
{form_hidden_fields form=$form}
{form_field form=$form field="email"}
{if #error}{#message}{/if}
<label>{intl l="Your e-mail address"}: </label><input type="email" name="{$name}" {$attr} ><br />
{/form_field}
{form_field form=$form field='password'}
<label>{intl l="Your password"}: </label><input type="password" name="{$name}" {$attr}> <br />
{/form_field}
{form_field form=$form field='remember_me'}
<label class="checkbox"> <input type="checkbox" name="{$name}" value="{$value}" {$attr} {if $options.checked}checked="checked"{/if}/> {intl l='Remember me'}</label>
{/form_field}
<button type="submit">{intl l='Login'}</button>
</form>
{/form}
{include file='includes/footer.html'}

View File

@@ -0,0 +1,6 @@
{check_auth context="front" roles="CUSTOMER" login_tpl="login"}
{$page_title="{intl l='My Account'}"}
{include file="includes/header.html"}
{include file="includes/footer.html"}

View File

@@ -0,0 +1,94 @@
{assign var=category_current_page value={$smarty.get.category_page|default:1}}
<h1>Pagination</h1>
<h2>Categories</h2>
<div style="border: solid 1px; padding: 20px;">
{loop name="cat" type="category" page="{$category_current_page}" limit="2"}
<h2>#LOOP_COUNT - #TITLE</h2>
<h3>Products :</h3>
<div style="border: solid 1px; padding: 20px;">
{assign var=this_product_getter value="product_`$ID`_page"}
{assign var=product_current_page value={$smarty.get.$this_product_getter|default:1}}
<ul>
{loop name="prod" type="product" category="#ID" page="{$product_current_page}" limit="2"}
<li>
#ID:#REF
</li>
{/loop}
</ul>
</div>
<p>#TITLE page choice</p>
{pageloop rel="prod"}
{if ${PAGE} != {$product_current_page}}
<a href="index_dev.php?view=pagination&category_page={$category_current_page}&{$this_product_getter}=#PAGE">#PAGE</a>
{else}
{ #PAGE }
{/if}
{if {$PAGE} != {$LAST}}
-
{/if}
{/pageloop}
{/loop}
</div>
<p>categories page choice</p>
{pageloop rel="cat"}
{if ${PAGE} != {$category_current_page}}
<a href="index_dev.php?view=pagination&category_page=#PAGE">#PAGE</a>
{else}
{ #PAGE }
{/if}
{if {$PAGE} != {$LAST}}
-
{/if}
{/pageloop}
<hr>
Pagination before loop
<hr>
{assign var=product_current_page value={$smarty.get.$this_product_getter|default:1}}
{capture name="prod2"}
{loop name="prod2" type="product" page="{$product_current_page}" limit="2"}
<li>
#ID:#REF
</li>
{/loop}
{/capture}
{pageloop rel="prod2"}
{if ${PAGE} != {$product_current_page}}
<a href="index_dev.php?view=pagination&category_page={$category_current_page}&{$this_product_getter}=#PAGE">#PAGE</a>
{else}
{ #PAGE }
{/if}
{if {$PAGE} != {$LAST}}
-
{/if}
{/pageloop}
{$smarty.capture.prod2}
{pageloop rel="prod2"}
{if ${PAGE} != {$product_current_page}}
<a href="index_dev.php?view=pagination&category_page={$category_current_page}&{$this_product_getter}=#PAGE">#PAGE</a>
{else}
{ #PAGE }
{/if}
{if {$PAGE} != {$LAST}}
-
{/if}
{/pageloop}

View File

@@ -1 +0,0 @@
subinclude1 success