Fixed customer front controller, events, addec admion config.

This commit is contained in:
franck
2013-08-30 19:46:12 +02:00
parent cce270fdcc
commit 6867eae9b7
35 changed files with 810 additions and 284 deletions

View File

@@ -75,7 +75,7 @@ class Category extends BaseAction implements EventSubscriberInterface
{
$this->checkAuth("ADMIN", "admin.category.delete");
$category = CategoryQuery::create()->findPk($event->getId());
$category = CategoryQuery::create()->findPk($event->getCategoryId());
if ($category !== null) {
@@ -98,7 +98,7 @@ class Category extends BaseAction implements EventSubscriberInterface
{
$this->checkAuth("ADMIN", "admin.category.edit");
$category = CategoryQuery::create()->findPk($event->getId());
$category = CategoryQuery::create()->findPk($event->getCategoryId());
if ($category !== null) {
@@ -136,7 +136,7 @@ class Category extends BaseAction implements EventSubscriberInterface
*/
protected function exchangePosition(CategoryChangePositionEvent $event)
{
$category = CategoryQuery::create()->findPk($event->getId());
$category = CategoryQuery::create()->findPk($event->getCategoryId());
if ($category !== null) {
@@ -195,7 +195,7 @@ class Category extends BaseAction implements EventSubscriberInterface
{
$this->checkAuth("ADMIN", "admin.category.edit");
$category = CategoryQuery::create()->findPk($event->getId());
$category = CategoryQuery::create()->findPk($event->getCategoryId());
if ($category !== null) {

View File

@@ -38,6 +38,7 @@ use Symfony\Component\Validator\Exception\ValidatorException;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\UsernameNotFoundException;
use Propel\Runtime\Exception\PropelException;
use Thelia\Core\Event\CustomerLoginEvent;
class Customer extends BaseAction implements EventSubscriberInterface
{
@@ -46,7 +47,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
{
$customer = new CustomerModel();
$customer->setDispatcher($this->getDispatcher());
$this->createOrUpdateCustomer($customer, $event);
@@ -56,7 +56,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
{
$customer = $event->getCustomer();
$customer->setDispatcher($this->getDispatcher());
$this->createOrUpdateCustomer($customer, $event);
@@ -64,6 +63,8 @@ class Customer extends BaseAction implements EventSubscriberInterface
private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event)
{
$customer->setDispatcher($this->getDispatcher());
$customer->createOrUpdate(
$event->getTitle(),
$event->getFirstname(),
@@ -87,6 +88,12 @@ class Customer extends BaseAction implements EventSubscriberInterface
$event->setCustomer($customer);
}
public function login(CustomerLoginEvent $event)
{
$this->getSecurityContext()->setCustomerUser($event->getCustomer());
}
/**
* Perform user logout. The user is redirected to the provided view, if any.
*
@@ -94,8 +101,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
*/
public function logout(ActionEvent $event)
{
$event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGOUT, $event);
$this->getSecurityContext()->clearCustomerUser();
}
@@ -129,6 +134,8 @@ class Customer extends BaseAction implements EventSubscriberInterface
return array(
TheliaEvents::CUSTOMER_CREATEACCOUNT => array("create", 128),
TheliaEvents::CUSTOMER_UPDATEACCOUNT => array("modify", 128),
TheliaEvents::CUSTOMER_LOGOUT => array("logout", 128),
TheliaEvents::CUSTOMER_LOGIN => array("login" , 128),
);
}
}

View File

@@ -22,12 +22,12 @@
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.category" class="Thelia\Action\Image">
<service id="thelia.action.image" class="Thelia\Action\Image">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="thelia.action.customer" class="Thelia\Action\Category">
<service id="thelia.action.category" class="Thelia\Action\Category">
<argument type="service" id="service_container"/>
<tag name="kernel.event_subscriber"/>
</service>

View File

@@ -18,10 +18,14 @@
<default key="_controller">Thelia\Controller\Front\CustomerController::updateAction</default>
</route>
<route id="customler.login.process" path="/customer/login" methods="post">
<route id="customer.login.process" path="/customer/login" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::loginAction</default>
</route>
<route id="customer.logout.process" path="/customer/logout">
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
</route>
<route id="cart.add.process" path="/cart/add">
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
<default key="_view">cart</default>

View File

@@ -52,11 +52,13 @@ class BaseAdminController extends BaseController
if (! empty($template)) {
// If we have a view in the URL, render this view
return $this->render($template);
} elseif (null != $view = $this->getRequest()->get('view')) {
}
elseif (null != $view = $this->getRequest()->get('view')) {
return $this->render($view);
}
} catch (\Exception $ex) {
// Nothing special
}
catch (\Exception $ex) {
return new Response($this->errorPage($ex->getMessage()));
}
return $this->pageNotFound();

View File

@@ -33,6 +33,7 @@ use Thelia\Core\Event\CategoryDeleteEvent;
use Thelia\Core\Event\CategoryToggleVisibilityEvent;
use Thelia\Core\Event\CategoryChangePositionEvent;
use Thelia\Form\CategoryDeletionForm;
use Thelia\Model\Lang;
class CategoryController extends BaseAdminController
{
@@ -99,7 +100,7 @@ class CategoryController extends BaseAdminController
$this->adminLogAppend(sprintf("Category %s (ID %s) deleted", $category->getTitle(), $category->getId()));
// Substitute _ID_ in the URL with the ID of the created category
$successUrl = str_replace('_ID_', $categoryDeleteEvent->getDeletedCategory()->getId(), $categoryDeletionForm->getSuccessUrl());
$successUrl = str_replace('_ID_', $categoryDeleteEvent->getDeletedCategory()->getParent(), $categoryDeletionForm->getSuccessUrl());
// Redirect to the success URL
$this->redirect($successUrl);
@@ -185,11 +186,34 @@ class CategoryController extends BaseAdminController
// Get the category ID
$id = $this->getRequest()->get('id', 0);
// Find the current order
$category_order = $this->getRequest()->get(
'category_order',
$this->getSession()->get('admin.category_order', 'manual')
);
// Find the current edit language ID
$edition_language = $this->getRequest()->get(
'edition_language',
$this->getSession()->get('admin.edition_language', Lang::getDefaultLanguage()->getId())
);
$args = array(
'action' => $action,
'current_category_id' => $id
'current_category_id' => $id,
'category_order' => $category_order,
'edition_language' => $edition_language,
'date_format' => Lang::getDefaultLanguage()->getDateFormat(),
'time_format' => Lang::getDefaultLanguage()->getTimeFormat(),
'datetime_format' => Lang::getDefaultLanguage()->getDateTimeFormat(),
);
// Store the current sort order in session
$this->getSession()->set('admin.category_order', $category_order);
// Store the current edition language in session
$this->getSession()->set('admin.edition_language', $edition_language);
try {
switch ($action) {
case 'browse' : // Browse categories

View File

@@ -51,13 +51,16 @@ class SessionController extends BaseAdminController
public function checkLoginAction()
{
$adminLoginForm = new AdminLogin($this->getRequest());
$request = $this->getRequest();
$authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm);
$adminLoginForm = new AdminLogin($request);
try {
$form = $this->validateForm($adminLoginForm, "post");
$authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm);
$user = $authenticator->getAuthentifiedUser();
// Success -> store user in security context
@@ -85,7 +88,7 @@ class SessionController extends BaseAdminController
// Log authentication failure
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
$message = "Unable to process your request. Please try again.";
$message = "Unable to process your request. Please try again.".$ex->getMessage();
}
// Store error information in the form

View File

@@ -35,6 +35,7 @@ use Thelia\Core\Factory\ActionEventFactory;
use Thelia\Form\BaseForm;
use Thelia\Form\Exception\FormValidationException;
use Symfony\Component\EventDispatcher\Event;
use Thelia\Core\Event\DefaultActionEvent;
/**
*
@@ -60,10 +61,12 @@ class BaseController extends ContainerAware
* Dispatch a Thelia event
*
* @param string $eventName a TheliaEvent name, as defined in TheliaEvents class
* @param Event $event the event
* @param Event $event the action event, or null (a DefaultActionEvent will be dispatched)
*/
protected function dispatch($eventName, Event $event = null)
protected function dispatch($eventName, ActionEvent $event = null)
{
if ($event == null) $event = new DefaultActionEvent();
$this->getDispatcher()->dispatch($eventName, $event);
}
@@ -145,7 +148,8 @@ class BaseController extends ContainerAware
/**
*
* redirect request to specify url
* redirect request to the specified url
*
* @param string $url
*/
public function redirect($url)
@@ -154,12 +158,21 @@ class BaseController extends ContainerAware
}
/**
* If success_url param is present in request, follow this link.
* If success_url param is present in request or in the provided form, redirect to this URL.
*
* @param BaseForm $form a base form, which may contains the success URL
*/
protected function redirectSuccess()
protected function redirectSuccess(BaseForm $form = null)
{
if (null !== $url = $this->getRequest()->get("success_url")) {
$this->redirect($url);
if ($form != null) {
$url = $form->getSuccessUrl();
}
else {
$url = $this->getRequest()->get("success_url");
}
echo "url=$url";
if (null !== $url) $this->redirect($url);
}
}

View File

@@ -22,8 +22,6 @@
/*************************************************************************************/
namespace Thelia\Controller\Front;
use Propel\Runtime\Exception\PropelException;
use Symfony\Component\Validator\Exception\ValidatorException;
use Thelia\Core\Event\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\CustomerLoginEvent;
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
@@ -37,65 +35,101 @@ use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\Customer;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\CustomerEvent;
use Thelia\Core\Factory\ActionEventFactory;
use Thelia\Tools\URL;
use Thelia\Log\Tlog;
use Thelia\Core\Security\Exception\WrongPasswordException;
class CustomerController extends BaseFrontController
{
/**
* create a new Customer. Retrieve data in form and dispatch a action.createCustomer event
*
* if error occurs, message is set in the parserContext
* Create a new customer.
* On success, redirect to success_url if exists, otherwise, display the same view again.
*/
public function createAction()
{
$request = $this->getRequest();
$customerCreation = new CustomerCreation($request);
try {
$form = $this->validateForm($customerCreation, "post");
if (! $this->getSecurityContext()->hasCustomerUser()) {
$customerCreateEvent = $this->createEventInstance($form->getData());
$message = false;
$this->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);
$customerCreation = new CustomerCreation($this->getRequest());
$this->processLogin($customerCreateEvent->getCustomer());
try {
$form = $this->validateForm($customerCreation, "post");
$this->redirectSuccess();
$customerCreateEvent = $this->createEventInstance($form->getData());
} catch (FormValidationException $e) {
$customerCreation->setErrorMessage($e->getMessage());
$this->getParserContext()->setErrorForm($customerCreation);
} catch (PropelException $e) {
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during customer creation process in front context with message : %s", $e->getMessage()));
$this->getParserContext()->setGeneralError($e->getMessage());
$this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);
$this->processLogin($customerCreateEvent->getCustomer());
$this->redirectSuccess($customerCreation);
}
catch (FormValidationException $e) {
$message = "Invalid or missing data. Please check your input";
}
catch (\Exception $e) {
$message = "Sorry, an unknown error occured.";
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer creation process : %s. Exception was %s", $message, $e->getMessage()));
$customerLoginForm->setErrorMessage($message);
$this->getParserContext()
->setErrorForm($customerLoginForm)
->setGeneralError($message)
;
}
}
}
/**
* Update customer data. On success, redirect to success_url if exists.
* Otherwise, display the same view again.
*/
public function updateAction()
{
$request = $this->getRequest();
$customerModification = new CustomerModification($request);
if ($this->getSecurityContext()->hasCustomerUser()) {
try {
$message = false;
$customer = $this->getSecurityContext()->getCustomerUser();
$customerModification = new CustomerModification($this->getRequest());
$form = $this->validateForm($customerModification, "post");
try {
$customerChangeEvent = $this->createEventInstance($form->getData());
$customerChangeEvent->setCustomer($customer);
$customer = $this->getSecurityContext()->getCustomerUser();
$this->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent);
$form = $this->validateForm($customerModification, "post");
$this->processLogin($customerChangeEvent->getCustomer());
$customerChangeEvent = $this->createEventInstance($form->getData());
$customerChangeEvent->setCustomer($customer);
$this->redirectSuccess();
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent);
} catch (FormValidationException $e) {
$customerModification->setErrorMessage($e->getMessage());
$this->getParserContext()->setErrorForm($customerModification);
} catch (PropelException $e) {
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during updating customer in front context with message : %s", $e->getMessage()));
$this->getParserContext()->setGeneralError($e->getMessage());
$this->processLogin($customerChangeEvent->getCustomer());
$this->redirectSuccess($customerModification);
}
catch (FormValidationException $e) {
$message = "Invalid or missing data. Please check your input";
}
catch (\Exception $e) {
$message = "Sorry, an unknown error occured.";
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer modification process : %s. Exception was %s", $message, $e->getMessage()));
$customerLoginForm->setErrorMessage($message);
$this->getParserContext()
->setErrorForm($customerLoginForm)
->setGeneralError($message)
;
}
}
}
@@ -103,39 +137,75 @@ class CustomerController extends BaseFrontController
* Perform user login. On a successful login, the user is redirected to the URL
* found in the success_url form parameter, or / if none was found.
*
* If login is not successfull, the same view is dispolyed again.
* If login is not successfull, the same view is displayed again.
*
*/
public function loginAction()
{
$request = $this->getRequest();
if (! $this->getSecurityContext()->hasCustomerUser()) {
$message = false;
$customerLoginForm = new CustomerLogin($request);
$request = $this->getRequest();
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
try {
try {
$customer = $authenticator->getAuthentifiedUser();
$customerLoginForm = new CustomerLogin($request);
$this->processLogin($customer);
$form = $this->validateForm($customerLoginForm, "post");
$this->redirectSuccess();
} catch (ValidatorException $e) {
$authenticator = new CustomerUsernamePasswordFormAuthenticator($request, $customerLoginForm);
} catch(UsernameNotFoundException $e) {
$customer = $authenticator->getAuthentifiedUser();
} catch(AuthenticationException $e) {
$this->processLogin($customer);
} catch (\Exception $e) {
$this->redirectSuccess($customerLoginForm);
}
catch (FormValidationException $e) {
$message = "Invalid or missing data. Please check your input";
}
catch(UsernameNotFoundException $e) {
$message = "This customer email was not found.";
}
catch (WrongPasswordException $e) {
$message = "Wrong password. Please try again.";
}
catch(AuthenticationException $e) {
$message = "Sorry, we failed to authentify you. Please try again.";
}
catch (\Exception $e) {
$message = "Sorry, an unknown error occured.";
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer login process : %s. Exception was %s", $message, $e->getMessage()));
$customerLoginForm->setErrorMessage($message);
$this->getParserContext()->setErrorForm($customerLoginForm);
}
}
}
public function processLogin(Customer $customer)
/**
* Perform customer logout.
*
* @param Customer $customer
*/
public function logoutAction()
{
$this->getSecurityContext()->setCustomerUser($customer);
if ($this->getSecurityContext()->hasCustomerUser()) {
$this->dispatch(TheliaEvents::CUSTOMER_LOGOUT);
}
if($event) $this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
// Redirect to home page
$this->redirect(URL::getIndexPage());
}
protected function processLogin(Customer $customer)
{
$this->dispatch(TheliaEvents::CUSTOMER_LOGIN, new CustomerLoginEvent($customer));
}
/**
@@ -161,10 +231,9 @@ class CustomerController extends BaseFrontController
$this->getRequest()->getSession()->getLang(),
isset($data["reseller"])?$data["reseller"]:null,
isset($data["sponsor"])?$data["sponsor"]:null,
isset($data["discount"])?$data["discount"]:nullsch
isset($data["discount"])?$data["discount"]:null
);
return $customerCreateEvent;
}
}

View File

@@ -0,0 +1,44 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Category;
class CategoryCreateEvent extends ActionEvent
{
protected $category_id;
protected $locale;
protected $title;
protected $chapo;
protected $description;
protected $postscriptum;
protected $url;
protected $visibility;
protected $parent;
public function __construct($category_id)
{
$this->category_id = $category_id;
}
}

View File

@@ -30,28 +30,18 @@ class CategoryChangePositionEvent extends ActionEvent
const POSITION_DOWN = 2;
const POSITION_ABSOLUTE = 3;
protected $id;
protected $category_id;
protected $mode;
protected $position;
protected $category;
public function __construct($id, $mode, $position = null)
public function __construct($category_id, $mode, $position = null)
{
$this->id = $id;
$this->category_id = $category_id;
$this->mode = $mode;
$this->position = $position;
}
public function getId()
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
}
public function getMode()
{
return $this->mode;
@@ -81,4 +71,15 @@ class CategoryChangePositionEvent extends ActionEvent
{
$this->category = $category;
}
}
public function getCategoryId()
{
return $this->category_id;
}
public function setCategoryId($category_id)
{
$this->category_id = $category_id;
}
}

View File

@@ -77,6 +77,5 @@ class CategoryCreateEvent extends ActionEvent
public function setCreatedCategory(Category $created_category)
{
$this->created_category = $created_category;
var_dump($this->created_category);
}
}

View File

@@ -26,22 +26,22 @@ use Thelia\Model\Category;
class CategoryDeleteEvent extends ActionEvent
{
protected $id;
protected $category_id;
protected $deleted_category;
public function __construct($id)
public function __construct($category_id)
{
$this->id = $id;
$this->category_id = $category_id;
}
public function getId()
public function getCategoryId()
{
return $this->id;
return $this->category_id;
}
public function setId($id)
public function setCategoryId($category_id)
{
$this->id = $id;
$this->category_id = $category_id;
}
public function getDeletedCategory()

View File

@@ -26,22 +26,22 @@ use Thelia\Model\Category;
class CategoryToggleVisibilityEvent extends ActionEvent
{
protected $id;
protected $category_id;
protected $category;
public function __construct($id)
public function __construct($category_id)
{
$this->id = $id;
$this->category_id = $category_id;
}
public function getId()
public function getCategoryId()
{
return $this->id;
return $this->category_id;
}
public function setId($id)
public function setCategoryId($category_id)
{
$this->id = $id;
$this->category_id = $category_id;
}
public function getCategory()

View File

@@ -26,7 +26,7 @@ namespace Thelia\Core\Event;
use Thelia\Model\Customer;
class CustomerLoginEvent {
class CustomerLoginEvent extends ActionEvent {
protected $customer;

View File

@@ -59,12 +59,7 @@ class ControllerListener implements EventSubscriberInterface
$event = new ActionEventFactory($request, $action, $event->getKernel()->getContainer()->getParameter("thelia.actionEvent"));
$actionEvent = $event->createActionEvent();
$dispatcher->dispatch("action.".$action, $actionEvent);
// Process form errors
if ($actionEvent->hasErrorForm()) {
$this->parserContext->setErrorForm($actionEvent->getErrorForm());
}
}
}
}
public static function getSubscribedEvents()

View File

@@ -55,8 +55,6 @@ class UsernamePasswordFormAuthenticator implements AuthenticatorInterface
);
$this->options = array_merge($defaults, $options);
$this->loginForm->bind($this->request);
}
/**

View File

@@ -60,6 +60,16 @@ class SecurityContext
return $this->getSession()->getAdminUser();
}
/**
* Check if an admin user is logged in.
*
* @return true if an admin user is logged in, false otherwise.
*/
public function hasAdminUser()
{
return $this->getSession()->getAdminUser() != null;
}
/**
* Gets the currently authenticated customer, or null if none is defined
*
@@ -70,6 +80,16 @@ class SecurityContext
return $this->getSession()->getCustomerUser();
}
/**
* Check if a customer user is logged in.
*
* @return true if a customer is logged in, false otherwise.
*/
public function hasCustomerUser()
{
return $this->getSession()->getCustomerUser() != null;
}
/**
* Check if a user has at least one of the required roles
*

View File

@@ -138,7 +138,7 @@ abstract class BaseLoop
} elseif ($value !== null && !$argument->type->isValid($value)) {
/* check type */
$faultActor[] = $argument->name;
$faultDetails[] = sprintf('Invalid value for "%s" argument in loop type: %s, name: %s', $argument->name, $loopType, $loopName);
$faultDetails[] = sprintf('Invalid value "%s" for "%s" argument in loop type: %s, name: %s', $value, $argument->name, $loopType, $loopName);
} else {
/* set default */
/* did it as last checking for we consider default value is acceptable no matter type or empty restriction */

View File

@@ -79,7 +79,7 @@ class Category extends BaseLoop
new Argument(
'order',
new TypeCollection(
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'random'))
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random'))
),
'manual'
),
@@ -146,6 +146,12 @@ class Category extends BaseLoop
case "manual":
$search->orderByPosition(Criteria::ASC);
break;
case "visible":
$search->orderByVisible(Criteria::ASC);
break;
case "visible_reverse":
$search->orderByVisible(Criteria::DESC);
break;
case "random":
$search->clearOrderByColumns();
$search->addAscendingOrderByColumn('RAND()');
@@ -173,7 +179,7 @@ class Category extends BaseLoop
$loopResultRow
->set("ID", $category->getId())
->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED'))
->set("TITLE",$category->getVirtualColumn('i18n_TITLE'))
->set("TITLE", $category->getVirtualColumn('i18n_TITLE'))
->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM'))

View File

@@ -63,7 +63,6 @@ class Image extends BaseLoop
$queryClass = sprintf("\Thelia\Model\%sImageQuery", $object);
$filterMethod = sprintf("filterBy%sId", $object);
$mapClass = sprintf("\Thelia\Model\Map\%sI18nTableMap", $object);
// xxxImageQuery::create()
$method = new \ReflectionMethod($queryClass, 'create');
@@ -73,19 +72,16 @@ class Image extends BaseLoop
$method = new \ReflectionMethod($queryClass, $filterMethod);
$method->invoke($search, $object_id);
$map = new \ReflectionClass($mapClass);
$title_map = $map->getConstant('TITLE');
$orders = $this->getOrder();
// Results ordering
foreach ($orders as $order) {
switch ($order) {
case "alpha":
$search->addAscendingOrderByColumn($title_map);
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case "alpha-reverse":
$search->addDescendingOrderByColumn($title_map);
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case "manual-reverse":
$search->orderByPosition(Criteria::DESC);
@@ -122,7 +118,7 @@ class Image extends BaseLoop
$source_id = $this->getSourceId();
// echo "source = ".$this->getSource().", id=".$id."<br />";
// echo "source = ".$this->getSource().", id=".$source_id." - ".$this->getArg('source_id')->getValue()."<br />";
if (is_null($source_id)) {
throw new \InvalidArgumentException("'source_id' argument cannot be null if 'source' argument is specified.");
@@ -167,6 +163,9 @@ class Image extends BaseLoop
$search = $this->getSearchQuery($object_type, $object_id);
/* manage translations */
$this->configureI18nProcessing($search);
$id = $this->getId();
if (! is_null($id)) {
@@ -207,8 +206,7 @@ class Image extends BaseLoop
}
/* manage translations */
$this->configureI18nProcessing($search);
// echo "sql=".$search->toString();
$results = $this->search($search, $pagination);

View File

@@ -56,11 +56,15 @@ class ParserContext implements \IteratorAggregate
public function setErrorForm(BaseForm $form)
{
$this->set('error_form', $form);
return $this;
}
public function setGeneralError($error)
{
$this->set('general_error', $error);
return $this;
}
public function getErrorForm()

View File

@@ -474,7 +474,6 @@ abstract class Category implements ActiveRecordInterface
if (!$this->hasVirtualColumn($name)) {
throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
}
return $this->virtualColumns[$name];
}

View File

@@ -6,4 +6,33 @@ use Thelia\Model\Base\Lang as BaseLang;
class Lang extends BaseLang {
/**
* Return the default language object, using a local variable to cache it.
*
* @throws RuntimeException
*/
private static $default_lang = null;
public static function getDefaultLanguage() {
if (self::$default_lang == null) {
$default_lang = LangQuery::create()->findOneByByDefault(true);
if ($default_lang == null) throw new RuntimeException("No default language is defined. Please define one.");
}
return $default_lang;
}
public function getDateFormat() {
return "d/m/Y";
}
public function getTimeFormat() {
return "H:i:s";
}
public function getDateTimeFormat() {
return "d/m/Y H:i:s";
}
}

View File

@@ -7,6 +7,7 @@ use Propel\Runtime\ActiveQuery\Join;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Thelia\Model\Base\LangQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Lang;
/**
* Class ModelCriteriaTools
@@ -52,7 +53,7 @@ class ModelCriteriaTools
$search->withColumn('`' . $requestedLocaleI18nAlias . '`.`' . $column . '`', $aliasPrefix . 'i18n_' . $column);
}
} else {
$defaultLocale = LangQuery::create()->findOneById($defaultLangWithoutTranslation)->getLocale();
$defaultLocale = Lang::getDefaultLanguage()->getLocale();
$defaultLocaleJoin = new Join();
$defaultLocaleJoin->addExplicitCondition($search->getTableMap()->getName(), $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias);

View File

@@ -240,7 +240,7 @@ try {
//categories and products
$productIdList = array();
$categoryIdList = array();
for($i=0; $i<4; $i++) {
for($i=1; $i<5; $i++) {
$category = createCategory($faker, 0, $i, $categoryIdList, $contentIdList);
for($j=1; $j<rand(0, 5); $j++) {
@@ -251,7 +251,7 @@ try {
}
}
for($k=0; $k<rand(1, 5); $k++) {
for($k=1; $k<rand(1, 6); $k++) {
createProduct($faker, $category, $k, $productIdList);
}
}
@@ -380,7 +380,7 @@ function createProduct($faker, $category, $position, &$productIdList)
$image = new ProductImage();
$image->setProductId($productId);
generate_image($image, 1, 'product', $productId);
return $product;
}
@@ -415,7 +415,7 @@ function createCategory($faker, $parent, $position, &$categoryIdList, $contentId
$image = new CategoryImage();
$image->setCategoryId($categoryId);
generate_image($image, 1, 'category', $categoryId);
return $category;
}

View File

@@ -216,6 +216,10 @@ hr {
width: 23px;
height: @top-bar-height;
}
a.profile {
color: #fff;
}
}
.view-shop {
@@ -233,10 +237,6 @@ hr {
.loginpage {
.brandbar {
width: 100%;
}
.hero-unit {
background-color: transparent !important;
@@ -316,6 +316,10 @@ hr {
}
}
.brandbar-wide {
width: 100%;
}
// -- Navigation bar ----------------------------------------------------------
.navbar {
@@ -717,4 +721,40 @@ label {
// Center the alert box (20px bottom margin) in the table cell
padding: 20px 20px 0 20px;
}
th {
a {
color: inherit;
}
}
td {
vertical-align: middle;
img {
border: 2px solid white;
border-radius: 4px 4px 4px 4px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
}
}
.menu-list-table .table-striped {
td, th {
text-align: left;
}
td:nth-child(2) {
text-align: right;
}
caption {
background-color: #FFFFFF;
border-bottom: 2px solid #A5CED8;
color: #5A6876;
font-weight: bold;
line-height: 30px;
text-align: left;
text-transform: uppercase;
}
}

View File

@@ -41,20 +41,72 @@
{ifloop rel="category_list"}
<thead>
<tr>
<th class="object-title">{intl l="Category title"}</th>
<th class="object-image">&nbsp;</th>
<th class="object-title">
{if $category_order == 'alpha'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'alpha_reverse'}
{elseif $category_order == 'alpha_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'alpha'}
{else}
{$order_change = 'alpha'}
{/if}
<a href="{url path='/admin/catalog/category' id="{$current_category_id}" category_order="$order_change"}">
{intl l="Category title"}
</a>
</th>
{module_include location='category_list_header'}
<th>{intl l="Online"}</th>
<th>{intl l="Position"}</th>
<th>
{if $category_order == 'visible'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'visible_reverse'}
{elseif $category_order == 'visible_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'visible'}
{else}
{$order_change = 'visible'}
{/if}
<a href="{url path='admin/catalog/category' id="{$current_category_id}" category_order="$order_change"}">
{intl l="Online"}
</a>
</th>
<th>
{if $category_order == 'manual'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'manual_reverse'}
{elseif $category_order == 'manual_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'manual'}
{else}
{$order_change = 'manual'}
{/if}
<a href="{url path='admin/catalog/category' id="{$current_category_id}" category_order="$order_change"}">{intl l="Position"}</a>
</th>
<th>{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop name="category_list" type="category" visible="*" parent="{$current_category_id}" order="manual"}
{loop name="category_list" type="category" visible="*" parent="{$current_category_id}" order="$category_order"}
<tr>
<td class="object-title"><a href="{url path='admin/catalog/category' id="$ID" action='browse'}" title="{intl l='Browse this category'}">{$TITLE}</a></td>
<td>
{loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/catalog/category' id="$ID" action='browse'}" title="{intl l='Browse this category'}"><img src="#IMAGE_URL" alt="#TITLE" /></a>
{/loop}
</td>
<td class="object-title">
<a href="{url path='admin/catalog/category' id="$ID" action='browse'}" title="{intl l='Browse this category'}">
{$TITLE}
</a>
</td>
{module_include location='category_list_row'}
@@ -141,7 +193,7 @@
{ifloop rel="product_list"}
<thead>
<tr>
<th>{intl l="Image"}</th>
<th>&nbsp;</th>
<th class="object-title">{intl l="Product title"}</th>
@@ -156,7 +208,12 @@
<tbody>
{loop name="product_list" type="product" category="{$current_category_id}" order="manual"}
<tr>
<td><a href="{url path='admin/catalog/product' id="$ID" action='edit'}" title="{intl l='Edit this product'}">Image !</a></td>
<td>
{loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/catalog/product' id="$ID" action='edit'}" title="{intl l='Edit this product'}">
<img src="#IMAGE_URL" alt="#TITLE" />
</a>
{/loop}
<td class="object-title"><a href="{url path='admin/catalog/product' id="$ID" action='edit'}" title="{intl l='Edit this product'}">{$TITLE}</a></td>

View File

@@ -0,0 +1,174 @@
{check_auth context="admin" roles="ADMIN" permissions="admin.configuration.view" login_tpl="/admin/login"}
{$page_title={intl l='Configuration'}}
{include file='includes/header.inc.html'}
<div class="configuration">
<div id="wrapper" class="container">
{module_include location='configuration_top'}
<h2>{intl l="Thelia configuration"}</h2>
<div class="row-fluid">
<div class="span4">
<div class="menu-list-table general-block-decorator">
<table class="table table-striped table-condensed">
<caption>{intl l='Product catalog configuration'}</caption>
{module_include location='catalog_configuration_top'}
{loop type="auth" name="pcc1" context="admin" roles="ADMIN" permissions="admin.configuration.product_templates"}
<tr>
<td><a href="{url path='/admin/configuration/product_templates'}">{intl l='Product templates'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/product_templates'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc2" context="admin" roles="ADMIN" permissions="admin.configuration.product_attributes"}
<tr>
<td><a href="{url path='/admin/configuration/product_attributes'}">{intl l='Product attributes'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/product_attributes'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc3" context="admin" roles="ADMIN" permissions="admin.configuration.product_features"}
<tr>
<td><a href="{url path='/admin/configuration/product_features'}">{intl l='Product features'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/product_features'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc4" context="admin" roles="ADMIN" permissions="admin.configuration.mailing_template"}
<tr>
<td><a href="{url path='/admin/configuration/mailing_templates'}">{intl l='Mailing templates'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/mailing_templates'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc5" context="admin" roles="ADMIN" permissions="admin.configuration.currencies"}
<tr>
<td><a href="{url path='/admin/configuration/currencies'}">{intl l='Currencies'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/currencies'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{module_include location='catalog_configuration_bottom'}
</table>
</div>
</div>
<div class="span4">
<div class="menu-list-table general-block-decorator">
<table class="table table-striped table-condensed">
<caption>{intl l='Shipping configuration'}</caption>
{module_include location='shipping_configuration_top'}
{loop type="auth" name="pcc1" context="admin" roles="ADMIN" permissions="admin.configuration.contries"}
<tr>
<td><a href="{url path='/admin/configuration/countries'}">{intl l='Countries'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/countries'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc2" context="admin" roles="ADMIN" permissions="admin.configuration.shipping_zones"}
<tr>
<td><a href="{url path='/admin/configuration/shipping_zones'}">{intl l='Shipping zones'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/shipping_zones'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc3" context="admin" roles="ADMIN" permissions="admin.configuration.shipping_configuration"}
<tr>
<td><a href="{url path='/admin/configuration/shipping_configuration'}">{intl l='Shipping configuration'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/shipping_configuration'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{module_include location='shipping_configuration_bottom'}
</table>
</div>
</div>
<div class="span4">
<div class="menu-list-table general-block-decorator">
<table class="table table-striped table-condensed">
<caption>{intl l='System parameters'}</caption>
{module_include location='system_configuration_top'}
{loop type="auth" name="pcc1" context="admin" roles="ADMIN" permissions="admin.configuration.modules"}
<tr>
<td><a href="{url path='/admin/configuration/modules'}">{intl l='Modules activation'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/modules'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc2" context="admin" roles="ADMIN" permissions="admin.configuration.variables"}
<tr>
<td><a href="{url path='/admin/configuration/variables'}">{intl l='System variables'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/variables'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc3" context="admin" roles="ADMIN" permissions="admin.configuration.admin_profiles"}
<tr>
<td><a href="{url path='/admin/configuration/admin_profiles'}">{intl l='Back-office profiles'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/admin_profiles'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc4" context="admin" roles="ADMIN" permissions="admin.configuration.admin_users"}
<tr>
<td><a href="{url path='/admin/configuration/admin_users'}">{intl l='Back-office users'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/admin_users'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc5" context="admin" roles="ADMIN" permissions="admin.configuration.languages"}
<tr>
<td><a href="{url path='/admin/configuration/languages'}">{intl l='Languages &amp; URLs'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/languages'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc6" context="admin" roles="ADMIN" permissions="admin.configuration.mailing_system"}
<tr>
<td><a href="{url path='/admin/configuration/mailing_system'}">{intl l='Mailing system'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/mailing_system'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc7" context="admin" roles="ADMIN" permissions="admin.configuration.admin_logs"}
<tr>
<td><a href="{url path='/admin/configuration/admin_logs'}">{intl l='Administration logs'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/admin_logs'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{loop type="auth" name="pcc8" context="admin" roles="ADMIN" permissions="admin.configuration.system_logs"}
<tr>
<td><a href="{url path='/admin/configuration/system_logs'}">{intl l='System logs'}</a></td>
<td><a class="btn btn-mini" href="{url path='/admin/configuration/system_logs'}"><i class="icon-edit"></i></a></td>
</tr>
{/loop}
{module_include location='system_configuration_bottom'}
</table>
</div>
</div>
{module_include location='configuration_bottom'}
</div>
</div>
</div>
{include file='includes/js.inc.html'}
{include file='includes/footer.inc.html'}

View File

@@ -11,7 +11,7 @@
</ul>
<div class="row-fluid">
{loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edition_language"}
<div class="span12 general-block-decorator">
<div class="row-fluid">
<div class="span7 title">
@@ -25,156 +25,187 @@
</div>
</div>
<div class="tabbable">
<ul class="nav nav-tabs admin-tabs" id="tabbed_menu">
<li class="active">
<a href="#general_description">{intl l="General description"}</a>
</li>
<form method="post">
<div class="tabbable">
<ul class="nav nav-tabs admin-tabs" id="tabbed_menu">
<li class="active">
<a href="#general_description">{intl l="General description"}</a>
</li>
<li>
<a href="#details">{intl l="Details"}</a>
</li>
<li>
<a href="#images">{intl l="Images"}</a>
</li>
<li>
<a href="#documents">{intl l="Documents"}</a>
</li>
<li>
<a href="#modules">{intl l="Modules"}</a>
</li>
</ul>
<li>
<a href="#details">{intl l="Details"}</a>
</li>
<li>
<a href="#images">{intl l="Images"}</a>
</li>
<li>
<a href="#documents">{intl l="Documents"}</a>
</li>
<li>
<a href="#modules">{intl l="Modules"}</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-content">
<div class="tab-pane active form-container" id="general_description">
<form class="form-horizontal span12">
<fieldset>
<div class="tab-pane active form-container" id="general_description">
<div class="form-horizontal span12">
<fieldset>
{include file="includes/inner-form-toolbar.html"}
{include file="includes/inner-form-toolbar.html"}
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label">
{intl l='Title *'}
</label>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label">
{intl l='Title *'}
</label>
<div class="controls">
<input type="text" required="required" title="{intl l='Category title'}" placeholder="{intl l='Category title'}" class="input-block-level">
</div>
</div>
<div class="controls">
<input type="text" required="required" title="{intl l='Category title'}" placeholder="{intl l='Category title'}" class="input-block-level" value="{$TITLE|htmlspecialchars}">
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Summary'}
<span class="label-help-block">{intl l="A short category description, used when a summary or an introduction is required"}</span>
</label>
<div class="control-group">
<label class="control-label">
{intl l='Summary'}
<span class="label-help-block">{intl l="A short category description, used when a summary or an introduction is required"}</span>
</label>
<div class="controls">
<textarea name="summary" rows="3" title="{intl l='Short category description'}" placeholder="{intl l='Short category description'}" class="input-block-level"></textarea>
</div>
</div>
<div class="controls">
<textarea name="summary" rows="3" title="{intl l='Short category description'}" placeholder="{intl l='Short category description'}" class="input-block-level">{$CHAPO|htmlspecialchars}</textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Detailed description'}
<span class="label-help-block">{intl l="The détailed category description."}</span>
</label>
<div class="control-group">
<label class="control-label">
{intl l='Detailed description'}
<span class="label-help-block">{intl l="The détailed category description."}</span>
</label>
<div class="controls">
<textarea name="summary" rows="10" class="input-block-level"></textarea>
<div class="controls">
<textarea name="summary" rows="10" class="input-block-level">{$DESCRIPTION|htmlspecialchars}</textarea>
</div>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Conclusion'}
<span class="label-help-block">{intl l="A short post-description information"}</span>
</label>
<div class="control-group">
<label class="control-label">
{intl l='Conclusion'}
<span class="label-help-block">{intl l="A short post-description information"}</span>
</label>
<div class="controls">
<textarea name="summary" rows="3" title="{intl l='Short category description'}" placeholder="{intl l='Short category description'}" class="input-block-level"></textarea>
</div>
</div>
<div class="controls">
<textarea name="summary" rows="3" title="{intl l='Short category description'}" placeholder="{intl l='Short category description'}" class="input-block-level">{$POSTSCRIPTUM|htmlspecialchars}</textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">
{intl l='Rewriten URL'}
</label>
<div class="control-group">
<label class="control-label">
{intl l='Rewriten URL'}
</label>
<div class="controls">
<div class="input-append input-block-level">
<input type="text" required="required" title="{intl l='Rewriten URL'}" placeholder="{intl l='Rewriten URL'}" class="input-block-level">
<a class="btn add-on" href="#">{intl l='Use default'}</a>
<div class="controls">
<div class="input-append input-block-level">
<input type="text" required="required" title="{intl l='Rewriten URL'}" placeholder="{intl l='Rewriten URL'}" class="input-block-level" value="{$URL|htmlspecialchars}">
<a class="btn add-on use_default_rewriten_url" href="#">{intl l='Use default'}</a>
</div>
<div class="help-block">{intl l="The rewritten URL to the category page. Click \"Use Default\" button to use the default URL. Use only digits, letters, - and _ characters."}</div>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<lablel>&nbsp;</lablel>
<div class="controls">
<p>{intl l='Category created on %date_create. Last modification: %date_change' date_create=$CREATE_DATE->format($datetime_format) date_change=$UPDATE_DATE->format($datetime_format)}</p>
</div>
</div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="tab-pane form-container" id="details">
<div class="form-horizontal span12">
<fieldset>
{include file="includes/inner-form-toolbar.html"}
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<label class="control-label">
{intl l='Category ID'}
</label>
<div class="controls">
<input type="text" name="id" disabled="disabled" value="#ID" />
</div>
<div class="help-block">{intl l="The rewritten URL to the category page. Click \"Use Default\" button to use the default URL. Use only digits, letters, - and _ characters."}</div>
</div>
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label">
{intl l='Parent category *'}
</label>
<div class="row-fluid">
<div class="span6">
<div class="controls">
<select required="required" name="parent">
<option value="0">{intl l="Top level"}</option>
<div class="control-group">
<label class="control-label">
{intl l='Parent category *'}
</label>
{loop name="cat-parent" type="category-tree" visible="*" category="0" exclude="{$current_category_id}"}
<option value="#ID" style="padding-left: {3 + $LEVEL * 20}px" {if $parent_category_id == $ID}selected="selected"{/if}>{$TITLE}</option>
{/loop}
<div class="controls">
<select required="required" name="parent" class="input-block-level">
<option value="0">{intl l="Top level"}</option>
</select>
</div>
</div>
</div>
</div>
{loop name="cat-parent" type="category-tree" visible="*" category="0" exclude="{$current_category_id}"}
<option value="#ID" style="padding-left: {3 + $LEVEL * 20}px" {if $parent_category_id == $ID}selected="selected"{/if}>{$TITLE}</option>
{/loop}
<div class="row-fluid">
<div class="span12">
<div class="control-group">
<label class="control-label">
{intl l='Visibility'}
</label>
</select>
</div>
</div>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="visible" {if $VISIBLE}checked="checked"{/if}> {intl l="Display this category on front-office"}
</label>
</div>
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label">
{intl l='Visibility'}
</label>
</fieldset>
</div>
</div>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="visible"> {intl l="Display this category on front-office"}
</label>
</div>
</div>
</div>
</div>
<p>aff Date creation ?</p>
<p>aff date modif ?</p>
</fieldset>
</form>
</div>
<div class="tab-pane" id="images">
<p>Images</p>
</div>
<div class="tab-pane" id="details">
<p>Détails divers</p>
</div>
<div class="tab-pane" id="documents">
<p>Documents</p>
</div>
<div class="tab-pane" id="images">
<p>Images</p>
</div>
<div class="tab-pane" id="modules">
<p>Modules</p>
</div>
<div class="tab-pane" id="documents">
<p>Documents</p>
</div>
<div class="tab-pane" id="modules">
<p>Modules</p>
</div>
</div>
</div>
</div>
</div>
</form>
{/loop}
</div>
</div>
</div>
@@ -189,6 +220,12 @@ $(function() {
e.preventDefault();
$(this).tab('show');
});
$('.use_default_rewriten_url').click(function(ev) {
alert("Not functionnal");
ev.preventDefault();
});
})
</script>

View File

@@ -1,4 +1,4 @@
{$page_title={intl l='AN error occured'}}
{$page_title={intl l='An error occured'}}
{include file='includes/header.inc.html'}

View File

@@ -54,7 +54,9 @@
{module_include location='inside_topbar'}
<div class="user-info">{admin attr="firstname"} {admin attr="lastname"} <a class="logout" href="{url path='admin/logout'}" title="{intl l='Close administation session'}">{intl l="Logout"}</a></div>
<div class="user-info">
<a class="profile" href="href="{url path='admin/edit_profile'}">{admin attr="firstname"} {admin attr="lastname"}</a>
<a class="logout" href="{url path='admin/logout'}" title="{intl l='Close administation session'}">{intl l="Logout"}</a></div>
{loop name="top-bar-search" type="auth" context="admin" roles="ADMIN" permissions="admin.search"}
<form class="form-search pull-right" action="{url path='/admin/search'}">
@@ -156,4 +158,10 @@
{module_include location='after_top_menu'}
{/loop}
{/loop}
{elseloop rel="top-bar-auth"}
<div class="brandbar brandbar-wide container">
<a class="brand" href="{url path='/admin'}">{images file='../assets/img/logo-thelia-34px.png'}<img src="{$asset_url}" alt="{intl l='Thelia, solution e-commerce libre'}" />{/images}</a>
</div>
{/elseloop}

View File

@@ -2,9 +2,6 @@
{include file='includes/header.inc.html'}
<div class="loginpage">
<div class="brandbar container">
<a class="brand" href="index.php">{images file='assets/img/logo-thelia-34px.png'}<img src="{$asset_url}" alt="{intl l='Thelia, solution e-commerce libre'}" />{/images}</a>
</div>
<div id="wrapper" class="container">

View File

@@ -11,11 +11,11 @@
<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>
<p>Your are logged in as {customer attr="firstname"} {customer attr="lastname"} ! <a href="{url path='/customer/logout'}">Logout</a></p>
{/loop}
{loop type="auth" name="admin_info_block" roles="ADMIN" context="admin"}
<p>You are logged as administrator</p>
<p>You are logged as administrator {admin attr="firstname"} {admin attr="lastname"}</p>
{/loop}
{elseloop rel="customer_info_block"}

View File

@@ -3,15 +3,12 @@
<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}>
<form action="{url path='/customer/login'}" 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
The field below are not par of the Login form, it defines view to render if the form cannot be validated
*}
<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 *}
<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
@@ -34,11 +31,11 @@
{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 />
<label>{intl l="Your e-mail address"}: </label><input type="email" name="{$name}" {$attr} value="{$value}"><br />
{/form_field}
{form_field form=$form field='password'}
<label>{intl l="Your password"}: </label><input type="password" name="{$name}" {$attr}> <br />
<label>{intl l="Your password"}: </label><input type="password" name="{$name}" {$attr} value="{$value}"> <br />
{/form_field}
{form_field form=$form field='remember_me'}