Merge remote-tracking branch 'origin/coupon' into coupon
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"require":{
|
"require":{
|
||||||
"php": ">=5.4",
|
"php": ">=5.4",
|
||||||
"ezyang/htmlpurifier": "dev-master",
|
|
||||||
"ircmaxell/password-compat": "dev-master",
|
"ircmaxell/password-compat": "dev-master",
|
||||||
"propel/propel": "dev-master",
|
"propel/propel": "dev-master",
|
||||||
"psr/log" : "1.0",
|
"psr/log" : "1.0",
|
||||||
@@ -42,7 +41,8 @@
|
|||||||
},
|
},
|
||||||
"require-dev" : {
|
"require-dev" : {
|
||||||
"phpunit/phpunit": "3.7.*",
|
"phpunit/phpunit": "3.7.*",
|
||||||
"fzaninotto/faker": "dev-master"
|
"fzaninotto/faker": "dev-master",
|
||||||
|
"maximebf/debugbar": "1.*"
|
||||||
},
|
},
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"config" : {
|
"config" : {
|
||||||
|
|||||||
147
composer.lock
generated
147
composer.lock
generated
@@ -3,52 +3,9 @@
|
|||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
|
||||||
],
|
],
|
||||||
"hash": "3f5204c6eb90cd0dc23fad39555eff6c",
|
"hash": "ba2f3e0943f00c7c3bf0c086bc611b0f",
|
||||||
|
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
|
||||||
"name": "ezyang/htmlpurifier",
|
|
||||||
"version": "dev-master",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/ezyang/htmlpurifier.git",
|
|
||||||
"reference": "fac747bdbdba6aeaba4bed91ef49b2378c1798e4"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/fac747bdbdba6aeaba4bed91ef49b2378c1798e4",
|
|
||||||
"reference": "fac747bdbdba6aeaba4bed91ef49b2378c1798e4",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.2"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"HTMLPurifier": "library/"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"library/HTMLPurifier.composer.php"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"LGPL"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Edward Z. Yang",
|
|
||||||
"email": "admin@htmlpurifier.org",
|
|
||||||
"homepage": "http://ezyang.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Standards compliant HTML filter written in PHP",
|
|
||||||
"homepage": "http://htmlpurifier.org/",
|
|
||||||
"keywords": [
|
|
||||||
"html"
|
|
||||||
],
|
|
||||||
"time": "2013-08-18 02:27:26"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "imagine/imagine",
|
"name": "imagine/imagine",
|
||||||
"version": "dev-master",
|
"version": "dev-master",
|
||||||
@@ -128,7 +85,7 @@
|
|||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Anthony Ferrara",
|
"name": "Anthony Ferrara",
|
||||||
"email": "ircmaxell@ircmaxell.com",
|
"email": "ircmaxell@php.net",
|
||||||
"homepage": "http://blog.ircmaxell.com"
|
"homepage": "http://blog.ircmaxell.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1451,53 +1408,6 @@
|
|||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2013-08-23 14:06:02"
|
"time": "2013-08-23 14:06:02"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "symfony/serializer",
|
|
||||||
"version": "dev-master",
|
|
||||||
"target-dir": "Symfony/Component/Serializer",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/Serializer.git",
|
|
||||||
"reference": "ac373bb2cc40385031b50758f479d413679bb18c"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/Serializer/zipball/ac373bb2cc40385031b50758f479d413679bb18c",
|
|
||||||
"reference": "ac373bb2cc40385031b50758f479d413679bb18c",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=5.3.3"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "2.4-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"Symfony\\Component\\Serializer\\": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Fabien Potencier",
|
|
||||||
"email": "fabien@symfony.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "http://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Symfony Serializer Component",
|
|
||||||
"homepage": "http://symfony.com",
|
|
||||||
"time": "2013-08-09 06:59:22"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/translation",
|
"name": "symfony/translation",
|
||||||
"version": "v2.2.6",
|
"version": "v2.2.6",
|
||||||
@@ -1709,6 +1619,55 @@
|
|||||||
],
|
],
|
||||||
"time": "2013-08-29 19:11:59"
|
"time": "2013-08-29 19:11:59"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "maximebf/debugbar",
|
||||||
|
"version": "1.5.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||||
|
"reference": "37dccc40da52bf9f85571c30cf302da696db0d05"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/37dccc40da52bf9f85571c30cf302da696db0d05",
|
||||||
|
"reference": "37dccc40da52bf9f85571c30cf302da696db0d05",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0",
|
||||||
|
"psr/log": "~1.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"kriswallsmith/assetic": "The best way to manage assets",
|
||||||
|
"monolog/monolog": "Log using Monolog"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"DebugBar": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maxime Bouroumeau-Fuseau",
|
||||||
|
"email": "maxime.bouroumeau@gmail.com",
|
||||||
|
"homepage": "http://maximebf.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Debug bar in the browser for php application",
|
||||||
|
"homepage": "https://github.com/maximebf/php-debugbar",
|
||||||
|
"keywords": [
|
||||||
|
"debug"
|
||||||
|
],
|
||||||
|
"time": "2013-08-17 02:02:49"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "1.2.12",
|
"version": "1.2.12",
|
||||||
@@ -2082,7 +2041,6 @@
|
|||||||
],
|
],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"ezyang/htmlpurifier": 20,
|
|
||||||
"ircmaxell/password-compat": 20,
|
"ircmaxell/password-compat": 20,
|
||||||
"propel/propel": 20,
|
"propel/propel": 20,
|
||||||
"kriswallsmith/assetic": 20,
|
"kriswallsmith/assetic": 20,
|
||||||
@@ -2090,7 +2048,6 @@
|
|||||||
"ptachoire/cssembed": 20,
|
"ptachoire/cssembed": 20,
|
||||||
"simplepie/simplepie": 20,
|
"simplepie/simplepie": 20,
|
||||||
"imagine/imagine": 20,
|
"imagine/imagine": 20,
|
||||||
"symfony/serializer": 20,
|
|
||||||
"fzaninotto/faker": 20
|
"fzaninotto/faker": 20
|
||||||
},
|
},
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class Category extends BaseAction implements EventSubscriberInterface
|
|||||||
$event->getParent(),
|
$event->getParent(),
|
||||||
$event->getLocale()
|
$event->getLocale()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$event->setCategory($category);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(CategoryChangeEvent $event)
|
public function update(CategoryChangeEvent $event)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace %%NAMESPACE%%;
|
|||||||
|
|
||||||
use Thelia\Module\BaseModule;
|
use Thelia\Module\BaseModule;
|
||||||
|
|
||||||
class Class extends BaseModule
|
class %%CLASSNAME%% extends BaseModule
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
|
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||||
|
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||||
</loops>
|
</loops>
|
||||||
|
|
||||||
<forms>
|
<forms>
|
||||||
@@ -48,7 +49,10 @@
|
|||||||
<form name="thelia.address.update" class="Thelia\Form\AddressUpdateForm" />
|
<form name="thelia.address.update" class="Thelia\Form\AddressUpdateForm" />
|
||||||
|
|
||||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||||
<form name="thelia.admin.category.deletion" class="Thelia\Form\CategoryDeletionForm"/>
|
<form name="thelia.admin.category.deletion" class="Thelia\Form\CategoryModificationForm"/>
|
||||||
|
|
||||||
|
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
|
||||||
|
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
|
||||||
|
|
||||||
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
||||||
|
|
||||||
@@ -82,7 +86,6 @@
|
|||||||
|
|
||||||
<service id="thelia.url.manager" class="Thelia\Tools\URL">
|
<service id="thelia.url.manager" class="Thelia\Tools\URL">
|
||||||
<argument type="service" id="service_container" />
|
<argument type="service" id="service_container" />
|
||||||
<argument >%kernel.environment%</argument>
|
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="event_dispatcher" class="Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher">
|
<service id="event_dispatcher" class="Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher">
|
||||||
@@ -101,7 +104,7 @@
|
|||||||
<!-- Translation and internationalisation -->
|
<!-- Translation and internationalisation -->
|
||||||
|
|
||||||
<service id="thelia.translator" class="Thelia\Core\Translation\Translator">
|
<service id="thelia.translator" class="Thelia\Core\Translation\Translator">
|
||||||
<argument type="string" id="en_US"></argument>
|
<argument type="string" id="en_UK"></argument>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<!-- Security context for front and back office -->
|
<!-- Security context for front and back office -->
|
||||||
@@ -188,6 +191,7 @@
|
|||||||
|
|
||||||
<service id="smarty.plugin.dataAccess" class="Thelia\Core\Template\Smarty\Plugins\DataAccessFunctions" scope="request">
|
<service id="smarty.plugin.dataAccess" class="Thelia\Core\Template\Smarty\Plugins\DataAccessFunctions" scope="request">
|
||||||
<tag name="thelia.parser.register_plugin"/>
|
<tag name="thelia.parser.register_plugin"/>
|
||||||
|
<argument type="service" id="request" />
|
||||||
<argument type="service" id="thelia.securityContext" />
|
<argument type="service" id="thelia.securityContext" />
|
||||||
<argument type="service" id="thelia.parser.context"/>
|
<argument type="service" id="thelia.parser.context"/>
|
||||||
</service>
|
</service>
|
||||||
|
|||||||
@@ -25,14 +25,40 @@
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
|
||||||
<!-- Route to the catalog controller (process category browsing) -->
|
<!-- Route to the catalog controller -->
|
||||||
|
|
||||||
<route id="admin.catalog" path="/admin/catalog">
|
<route id="admin.catalog" path="/admin/catalog">
|
||||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::indexAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::defaultAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="admin.category" path="/admin/catalog/category">
|
<!-- Categories management -->
|
||||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::processAction</default>
|
|
||||||
|
<route id="admin.categories.default" path="/admin/categories">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::defaultAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.create" path="/admin/categories/create">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::createAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.update" path="/admin/categories/update">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::changeAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.save" path="/admin/categories/save">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::saveChangeAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.set-default" path="/admin/categories/toggle-online">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::toggleOnlineAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.delete" path="/admin/categories/delete">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::deleteAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.update-position" path="/admin/categories/update-position">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::updatePositionAction</default>
|
||||||
</route>
|
</route>
|
||||||
<route id="admin.category.ajax" path="/admin/catalog/category/parent/{parentId}.{_format}" methods="GET">
|
<route id="admin.category.ajax" path="/admin/catalog/category/parent/{parentId}.{_format}" methods="GET">
|
||||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::getByParentIdAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CategoryController::getByParentIdAction</default>
|
||||||
@@ -134,6 +160,10 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::setDefaultAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CurrencyController::setDefaultAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.configuration.currencies.update-position" path="/admin/configuration/currencies/update-position">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
<route id="admin.configuration.currencies.update-rates" path="/admin/configuration/currencies/update-rates">
|
<route id="admin.configuration.currencies.update-rates" path="/admin/configuration/currencies/update-rates">
|
||||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updateRatesAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updateRatesAction</default>
|
||||||
</route>
|
</route>
|
||||||
@@ -146,6 +176,18 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default>
|
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<!-- attribute and feature routes management -->
|
||||||
|
|
||||||
|
<route id="admin.configuration.attribute" path="/admin/configuration/product_attributes">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::defaultAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.configuration.attribute.edit" path="/admin/configuration/product_attributes/update">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AttributeController::updateAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<!-- end attribute and feature routes management -->
|
||||||
|
|
||||||
<!-- The default route, to display a template -->
|
<!-- The default route, to display a template -->
|
||||||
|
|
||||||
<route id="admin.processTemplate" path="/admin/{template}">
|
<route id="admin.processTemplate" path="/admin/{template}">
|
||||||
|
|||||||
@@ -60,4 +60,11 @@
|
|||||||
<default key="_view">cart</default>
|
<default key="_view">cart</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<!-- order management process -->
|
||||||
|
<route id="order.delivery.add" path="/delivery/choose/{delivery_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Front\DeliveryController::select</default>
|
||||||
|
<requirement key="delivery_id">\d+</requirement>
|
||||||
|
</route>
|
||||||
|
<!-- end order management process -->
|
||||||
|
|
||||||
</routes>
|
</routes>
|
||||||
|
|||||||
63
core/lib/Thelia/Controller/Admin/AttributeController.php
Normal file
63
core/lib/Thelia/Controller/Admin/AttributeController.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?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\Controller\Admin;
|
||||||
|
|
||||||
|
use Thelia\Core\Event\MessageDeleteEvent;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
use Thelia\Tools\URL;
|
||||||
|
use Thelia\Core\Event\MessageUpdateEvent;
|
||||||
|
use Thelia\Core\Event\MessageCreateEvent;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
|
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||||
|
use Thelia\Model\MessageQuery;
|
||||||
|
use Thelia\Form\MessageModificationForm;
|
||||||
|
use Thelia\Form\MessageCreationForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages messages sent by mail
|
||||||
|
*
|
||||||
|
* @author Franck Allimant <franck@cqfdev.fr>
|
||||||
|
*/
|
||||||
|
class AttributeController extends BaseAdminController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The default action is displaying the attributes list.
|
||||||
|
*
|
||||||
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
public function defaultAction() {
|
||||||
|
|
||||||
|
if (null !== $response = $this->checkAuth("admin.configuration.attributes.view")) return $response;
|
||||||
|
|
||||||
|
return $this->render('product-attributes');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateAction() {
|
||||||
|
|
||||||
|
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||||
|
|
||||||
|
return $this->render('product-attributes-edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,9 @@ use Thelia\Core\Security\SecurityContext;
|
|||||||
use Thelia\Model\AdminLog;
|
use Thelia\Model\AdminLog;
|
||||||
use Thelia\Model\Lang;
|
use Thelia\Model\Lang;
|
||||||
use Thelia\Model\LangQuery;
|
use Thelia\Model\LangQuery;
|
||||||
|
use Thelia\Form\BaseForm;
|
||||||
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
|
|
||||||
class BaseAdminController extends BaseController
|
class BaseAdminController extends BaseController
|
||||||
{
|
{
|
||||||
@@ -66,7 +69,7 @@ class BaseAdminController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
return new Response($this->errorPage($ex->getMessage()));
|
return $this->errorPage($ex->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->pageNotFound();
|
return $this->pageNotFound();
|
||||||
@@ -92,7 +95,7 @@ class BaseAdminController extends BaseController
|
|||||||
protected function errorPage($message)
|
protected function errorPage($message)
|
||||||
{
|
{
|
||||||
if ($message instanceof \Exception) {
|
if ($message instanceof \Exception) {
|
||||||
$message = sprintf("Sorry, an error occured: %s", $message->getMessage());
|
$message = sprintf($this->getTranslator()->trans("Sorry, an error occured: %msg"), array('msg' => $message->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('general_error', array(
|
return $this->render('general_error', array(
|
||||||
@@ -123,7 +126,56 @@ class BaseAdminController extends BaseController
|
|||||||
// Generate the proper response
|
// Generate the proper response
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
|
|
||||||
return $response->setContent($this->errorPage("Sorry, you're not allowed to perform this action"));
|
return $this->errorPage($this->getTranslator()->trans("Sorry, you're not allowed to perform this action"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the standard message displayed to the user when the form cannot be validated.
|
||||||
|
*/
|
||||||
|
protected function createStandardFormValidationErrorMessage(FormValidationException $exception) {
|
||||||
|
return $this->getTranslator()->trans(
|
||||||
|
"Please check your input: %error",
|
||||||
|
array(
|
||||||
|
'%error' => $exception->getMessage()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the error context when an error occurs in a action method.
|
||||||
|
*
|
||||||
|
* @param string $action the action that caused the error (category modification, variable creation, currency update, etc.)
|
||||||
|
* @param BaseForm $form the form where the error occured, or null if no form was involved
|
||||||
|
* @param string $error_message the error message
|
||||||
|
* @param Exception $exception the exception or null if no exception
|
||||||
|
*/
|
||||||
|
protected function setupFormErrorContext($action, $error_message, BaseForm $form = null, \Exception $exception = null) {
|
||||||
|
|
||||||
|
if ($error_message !== false) {
|
||||||
|
|
||||||
|
// Log the error message
|
||||||
|
Tlog::getInstance()->error(
|
||||||
|
$this->getTranslator()->trans(
|
||||||
|
"Error during %action process : %error. Exception was %exc",
|
||||||
|
array(
|
||||||
|
'%action' => $action,
|
||||||
|
'%error' => $error_message,
|
||||||
|
'%exc' => $exception != null ? $exception->getMessage() : 'no exception'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($form != null) {
|
||||||
|
// Mark the form as errored
|
||||||
|
$form->setErrorMessage($error_message);
|
||||||
|
|
||||||
|
// Pass it to the parser context
|
||||||
|
$this->getParserContext()->addForm($form);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass the error message to the parser.
|
||||||
|
$this->getParserContext()->setGeneralError($error_message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -261,7 +313,7 @@ class BaseAdminController extends BaseController
|
|||||||
}
|
}
|
||||||
catch (AuthorizationException $ex) {
|
catch (AuthorizationException $ex) {
|
||||||
// User is not allowed to perform the required action. Return the error page instead of the requested page.
|
// User is not allowed to perform the required action. Return the error page instead of the requested page.
|
||||||
return $this->errorPage("Sorry, you are not allowed to perform this action.");
|
return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,238 +34,305 @@ use Thelia\Core\Event\CategoryToggleVisibilityEvent;
|
|||||||
use Thelia\Core\Event\CategoryChangePositionEvent;
|
use Thelia\Core\Event\CategoryChangePositionEvent;
|
||||||
use Thelia\Form\CategoryDeletionForm;
|
use Thelia\Form\CategoryDeletionForm;
|
||||||
use Thelia\Model\Lang;
|
use Thelia\Model\Lang;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\Core\Event\CategoryUpdatePositionEvent;
|
||||||
|
use Thelia\Model\CategoryQuery;
|
||||||
|
use Thelia\Form\CategoryModificationForm;
|
||||||
|
|
||||||
class CategoryController extends BaseAdminController
|
class CategoryController extends BaseAdminController
|
||||||
{
|
{
|
||||||
protected function createNewCategory($args)
|
/**
|
||||||
{
|
* Render the categories list, ensuring the sort order is set.
|
||||||
try {
|
*
|
||||||
$categoryCreationForm = new CategoryCreationForm($this->getRequest());
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
$form = $this->validateForm($categoryCreationForm, "POST");
|
protected function renderList() {
|
||||||
|
return $this->render('categories', $this->getTemplateArgs());
|
||||||
$data = $form->getData();
|
|
||||||
|
|
||||||
$categoryCreateEvent = new CategoryCreateEvent(
|
|
||||||
$data["title"],
|
|
||||||
$data["parent"],
|
|
||||||
$data["locale"]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_CREATE, $categoryCreateEvent);
|
|
||||||
|
|
||||||
$category = $categoryCreateEvent->getCreatedCategory();
|
|
||||||
|
|
||||||
$this->adminLogAppend(sprintf("Category %s (ID %s) created", $category->getTitle(), $category->getId()));
|
|
||||||
|
|
||||||
// Substitute _ID_ in the URL with the ID of the created category
|
|
||||||
$successUrl = str_replace('_ID_', $category->getId(), $categoryCreationForm->getSuccessUrl());
|
|
||||||
|
|
||||||
// Redirect to the success URL
|
|
||||||
$this->redirect($successUrl);
|
|
||||||
}
|
|
||||||
catch (FormValidationException $e) {
|
|
||||||
$categoryCreationForm->setErrorMessage($e->getMessage());
|
|
||||||
$this->getParserContext()->addForm($categoryCreationForm);
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
Tlog::getInstance()->error(sprintf("Failed to create category: %s", $e->getMessage()));
|
|
||||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has error, and should be redisplayed.
|
|
||||||
return $this->render('categories', $args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function editCategory($args)
|
protected function getTemplateArgs() {
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth("admin.category.edit")) return $response;
|
|
||||||
|
|
||||||
return $this->render('edit_category', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function deleteCategory($args)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$categoryDeletionForm = new CategoryDeletionForm($this->getRequest());
|
|
||||||
|
|
||||||
$data = $this->validateForm($categoryDeletionForm, "POST")->getData();
|
|
||||||
|
|
||||||
$categoryDeleteEvent = new CategoryDeleteEvent($data['category_id']);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_DELETE, $categoryDeleteEvent);
|
|
||||||
|
|
||||||
$category = $categoryDeleteEvent->getDeletedCategory();
|
|
||||||
|
|
||||||
$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()->getParent(), $categoryDeletionForm->getSuccessUrl());
|
|
||||||
|
|
||||||
// Redirect to the success URL
|
|
||||||
$this->redirect($successUrl);
|
|
||||||
}
|
|
||||||
catch (FormValidationException $e) {
|
|
||||||
$categoryDeletionForm->setErrorMessage($e->getMessage());
|
|
||||||
$this->getParserContext()->addForm($categoryDeletionForm);
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
Tlog::getInstance()->error(sprintf("Failed to delete category: %s", $e->getMessage()));
|
|
||||||
$this->getParserContext()->setGeneralError($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, something was wrong, category was not deleted. Display parent category list
|
|
||||||
return $this->render('categories', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function browseCategory($args)
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth("admin.catalog.view")) return $response;
|
|
||||||
|
|
||||||
return $this->render('categories', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function visibilityToggle($args)
|
|
||||||
{
|
|
||||||
$event = new CategoryToggleVisibilityEvent($this->getRequest()->get('category_id', 0));
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_TOGGLE_VISIBILITY, $event);
|
|
||||||
|
|
||||||
return $this->nullResponse();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function changePosition($args)
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$event = new CategoryChangePositionEvent(
|
|
||||||
$request->get('category_id', 0),
|
|
||||||
CategoryChangePositionEvent::POSITION_ABSOLUTE,
|
|
||||||
$request->get('position', null)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_CHANGE_POSITION, $event);
|
|
||||||
|
|
||||||
return $this->render('categories', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function positionDown($args)
|
|
||||||
{
|
|
||||||
$event = new CategoryChangePositionEvent(
|
|
||||||
$this->getRequest()->get('category_id', 0),
|
|
||||||
CategoryChangePositionEvent::POSITION_DOWN
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_CHANGE_POSITION, $event);
|
|
||||||
|
|
||||||
return $this->render('categories', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function positionUp($args)
|
|
||||||
{
|
|
||||||
$event = new CategoryChangePositionEvent(
|
|
||||||
$this->getRequest()->get('category_id', 0),
|
|
||||||
CategoryChangePositionEvent::POSITION_UP
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CATEGORY_CHANGE_POSITION, $event);
|
|
||||||
|
|
||||||
return $this->render('categories', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
return $this->processAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processAction()
|
|
||||||
{
|
|
||||||
// Get the current action
|
|
||||||
$action = $this->getRequest()->get('action', 'browse');
|
|
||||||
|
|
||||||
// Get the category ID
|
// Get the category ID
|
||||||
$id = $this->getRequest()->get('id', 0);
|
$category_id = $this->getRequest()->get('category_id', 0);
|
||||||
|
|
||||||
// Find the current order
|
// Find the current category order
|
||||||
$category_order = $this->getRequest()->get(
|
$category_order = $this->getRequest()->get(
|
||||||
'order',
|
'order',
|
||||||
$this->getSession()->get('admin.category_order', 'manual')
|
$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(
|
$args = array(
|
||||||
'action' => $action,
|
'current_category_id' => $category_id,
|
||||||
'current_category_id' => $id,
|
|
||||||
'category_order' => $category_order,
|
'category_order' => $category_order,
|
||||||
'edition_language' => $edition_language,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store the current sort order in session
|
// Store the current sort order in session
|
||||||
$this->getSession()->set('admin.category_order', $category_order);
|
$this->getSession()->set('admin.category_order', $category_order);
|
||||||
|
|
||||||
// Store the current edition language in session
|
return $args;
|
||||||
$this->getSession()->set('admin.edition_language', $edition_language);
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch ($action) {
|
|
||||||
case 'browse' : // Browse categories
|
|
||||||
|
|
||||||
return $this->browseCategory($args);
|
|
||||||
|
|
||||||
case 'create' : // Create a new category
|
|
||||||
|
|
||||||
return $this->createNewCategory($args);
|
|
||||||
|
|
||||||
case 'edit' : // Edit an existing category
|
|
||||||
|
|
||||||
return $this->editCategory($args);
|
|
||||||
|
|
||||||
case 'delete' : // Delete an existing category
|
|
||||||
|
|
||||||
return $this->deleteCategory($args);
|
|
||||||
|
|
||||||
case 'visibilityToggle' : // Toggle visibility
|
|
||||||
|
|
||||||
return $this->visibilityToggle($id);
|
|
||||||
|
|
||||||
case 'changePosition' : // Change position
|
|
||||||
|
|
||||||
return $this->changePosition($args);
|
|
||||||
|
|
||||||
case 'positionUp' : // Move up category
|
|
||||||
|
|
||||||
return $this->positionUp($args);
|
|
||||||
|
|
||||||
case 'positionDown' : // Move down category
|
|
||||||
|
|
||||||
return $this->positionDown($args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (AuthorizationException $ex) {
|
|
||||||
return $this->errorPage($ex->getMessage());
|
|
||||||
}
|
|
||||||
catch (AuthenticationException $ex) {
|
|
||||||
return $this->errorPage($ex->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
// We did not recognized the action -> return a 404 page
|
|
||||||
return $this->pageNotFound();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Category from its parent id
|
* The default action is displaying the categories list.
|
||||||
*
|
*
|
||||||
* @return mixed|\Symfony\Component\HttpFoundation\Response
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
*/
|
*/
|
||||||
public function getByParentIdAction($parentId, $_format = 'json')
|
public function defaultAction() {
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth("admin.catalog.view")) return $response;
|
|
||||||
|
|
||||||
return $this->render('categories', $args);
|
if (null !== $response = $this->checkAuth("admin.categories.view")) return $response;
|
||||||
|
|
||||||
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Create a new category object
|
||||||
|
*
|
||||||
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
public function createAction() {
|
||||||
|
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.categories.create")) return $response;
|
||||||
|
|
||||||
|
$error_msg = false;
|
||||||
|
|
||||||
|
// Create the Creation Form
|
||||||
|
$creationForm = new CategoryCreationForm($this->getRequest());
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Validate the form, create the CategoryCreation event and dispatch it.
|
||||||
|
$form = $this->validateForm($creationForm, "POST");
|
||||||
|
|
||||||
|
$data = $form->getData();
|
||||||
|
|
||||||
|
$createEvent = new CategoryCreateEvent(
|
||||||
|
$data["title"],
|
||||||
|
$data["parent"],
|
||||||
|
$data["locale"]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::CATEGORY_CREATE, $createEvent);
|
||||||
|
|
||||||
|
if (! $createEvent->hasCategory()) throw new \LogicException($this->getTranslator()->trans("No category was created."));
|
||||||
|
|
||||||
|
$createdObject = $createEvent->getCategory();
|
||||||
|
|
||||||
|
// Log category creation
|
||||||
|
$this->adminLogAppend(sprintf("Category %s (ID %s) created", $createdObject->getTitle(), $createdObject->getId()));
|
||||||
|
|
||||||
|
// Substitute _ID_ in the URL with the ID of the created object
|
||||||
|
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||||
|
|
||||||
|
// Redirect to the success URL
|
||||||
|
$this->redirect($successUrl);
|
||||||
|
}
|
||||||
|
catch (FormValidationException $ex) {
|
||||||
|
// Form cannot be validated
|
||||||
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
// Any other error
|
||||||
|
$error_msg = $ex->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setupFormErrorContext("category creation", $error_msg, $creationForm, $ex);
|
||||||
|
|
||||||
|
// At this point, the form has error, and should be redisplayed.
|
||||||
|
return $this->renderList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a category object for modification, and display the edit template.
|
||||||
|
*
|
||||||
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
public function changeAction() {
|
||||||
|
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
|
// Load the category object
|
||||||
|
$category = CategoryQuery::create()
|
||||||
|
->joinWithI18n($this->getCurrentEditionLocale())
|
||||||
|
->findOneById($this->getRequest()->get('category_id'));
|
||||||
|
|
||||||
|
if ($category != null) {
|
||||||
|
|
||||||
|
// Prepare the data that will hydrate the form
|
||||||
|
$data = array(
|
||||||
|
'id' => $category->getId(),
|
||||||
|
'locale' => $category->getLocale(),
|
||||||
|
'title' => $category->getTitle(),
|
||||||
|
'chapo' => $category->getChapo(),
|
||||||
|
'description' => $category->getDescription(),
|
||||||
|
'postscriptum' => $category->getPostscriptum(),
|
||||||
|
'parent' => $category->getParent(),
|
||||||
|
'visible' => $category->getVisible() ? true : false,
|
||||||
|
'url' => $category->getUrl($this->getCurrentEditionLocale())
|
||||||
|
// tbc !!!
|
||||||
|
);
|
||||||
|
|
||||||
|
// Setup the object form
|
||||||
|
$changeForm = new CategoryModificationForm($this->getRequest(), "form", $data);
|
||||||
|
|
||||||
|
// Pass it to the parser
|
||||||
|
$this->getParserContext()->addForm($changeForm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the edition template.
|
||||||
|
return $this->render('category-edit', $this->getTemplateArgs());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save changes on a modified category object, and either go back to the category list, or stay on the edition page.
|
||||||
|
*
|
||||||
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
public function saveChangeAction() {
|
||||||
|
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
|
$error_msg = false;
|
||||||
|
|
||||||
|
// Create the form from the request
|
||||||
|
$changeForm = new CategoryModificationForm($this->getRequest());
|
||||||
|
|
||||||
|
// Get the category ID
|
||||||
|
$category_id = $this->getRequest()->get('category_id');
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Check the form against constraints violations
|
||||||
|
$form = $this->validateForm($changeForm, "POST");
|
||||||
|
|
||||||
|
// Get the form field values
|
||||||
|
$data = $form->getData();
|
||||||
|
|
||||||
|
$changeEvent = new CategoryUpdateEvent($data['id']);
|
||||||
|
|
||||||
|
// Create and dispatch the change event
|
||||||
|
$changeEvent
|
||||||
|
->setCategoryName($data['name'])
|
||||||
|
->setLocale($data["locale"])
|
||||||
|
->setSymbol($data['symbol'])
|
||||||
|
->setCode($data['code'])
|
||||||
|
->setRate($data['rate'])
|
||||||
|
;
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::CATEGORY_UPDATE, $changeEvent);
|
||||||
|
|
||||||
|
if (! $createEvent->hasCategory()) throw new \LogicException($this->getTranslator()->trans("No category was updated."));
|
||||||
|
|
||||||
|
// Log category modification
|
||||||
|
$changedObject = $changeEvent->getCategory();
|
||||||
|
|
||||||
|
$this->adminLogAppend(sprintf("Category %s (ID %s) modified", $changedObject->getTitle(), $changedObject->getId()));
|
||||||
|
|
||||||
|
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||||
|
// just redirect to the edit page again.
|
||||||
|
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||||
|
$this->redirectToRoute(
|
||||||
|
"admin.categories.update",
|
||||||
|
array('category_id' => $category_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirect to the success URL
|
||||||
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
|
}
|
||||||
|
catch (FormValidationException $ex) {
|
||||||
|
// Form cannot be validated
|
||||||
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
// Any other error
|
||||||
|
$error_msg = $ex->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setupFormErrorContext("category modification", $error_msg, $changeForm, $ex);
|
||||||
|
|
||||||
|
// At this point, the form has errors, and should be redisplayed.
|
||||||
|
return $this->render('category-edit', array('category_id' => $category_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Online status toggle category
|
||||||
|
*/
|
||||||
|
public function setToggleVisibilityAction() {
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
|
$changeEvent = new CategoryUpdateEvent($this->getRequest()->get('category_id', 0));
|
||||||
|
|
||||||
|
// Create and dispatch the change event
|
||||||
|
$changeEvent->setIsDefault(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->dispatch(TheliaEvents::CATEGORY_SET_DEFAULT, $changeEvent);
|
||||||
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
// Any error
|
||||||
|
return $this->errorPage($ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->redirectToRoute('admin.categories.default');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update categoryposition
|
||||||
|
*/
|
||||||
|
public function updatePositionAction() {
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.categories.update")) return $response;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$mode = $this->getRequest()->get('mode', null);
|
||||||
|
|
||||||
|
if ($mode == 'up')
|
||||||
|
$mode = CategoryUpdatePositionEvent::POSITION_UP;
|
||||||
|
else if ($mode == 'down')
|
||||||
|
$mode = CategoryUpdatePositionEvent::POSITION_DOWN;
|
||||||
|
else
|
||||||
|
$mode = CategoryUpdatePositionEvent::POSITION_ABSOLUTE;
|
||||||
|
|
||||||
|
$position = $this->getRequest()->get('position', null);
|
||||||
|
|
||||||
|
$event = new CategoryUpdatePositionEvent(
|
||||||
|
$this->getRequest()->get('category_id', null),
|
||||||
|
$mode,
|
||||||
|
$this->getRequest()->get('position', null)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::CATEGORY_UPDATE_POSITION, $event);
|
||||||
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
// Any error
|
||||||
|
return $this->errorPage($ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->redirectToRoute('admin.categories.default');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a category object
|
||||||
|
*
|
||||||
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
public function deleteAction() {
|
||||||
|
|
||||||
|
// Check current user authorization
|
||||||
|
if (null !== $response = $this->checkAuth("admin.categories.delete")) return $response;
|
||||||
|
|
||||||
|
// Get the category id, and dispatch the deleted request
|
||||||
|
$event = new CategoryDeleteEvent($this->getRequest()->get('category_id'));
|
||||||
|
|
||||||
|
$this->dispatch(TheliaEvents::CATEGORY_DELETE, $event);
|
||||||
|
|
||||||
|
if ($event->hasCategory())
|
||||||
|
$this->adminLogAppend(sprintf("Category %s (ID %s) deleted", $event->getCategory()->getTitle(), $event->getCategory()->getId()));
|
||||||
|
|
||||||
|
$this->redirectToRoute('admin.categories.default');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -108,6 +108,8 @@ class ConfigController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::CONFIG_CREATE, $createEvent);
|
$this->dispatch(TheliaEvents::CONFIG_CREATE, $createEvent);
|
||||||
|
|
||||||
|
if (! $createEvent->hasConfig()) throw new \LogicException($this->getTranslator()->trans("No variable was created."));
|
||||||
|
|
||||||
$createdObject = $createEvent->getConfig();
|
$createdObject = $createEvent->getConfig();
|
||||||
|
|
||||||
// Log config creation
|
// Log config creation
|
||||||
@@ -121,26 +123,14 @@ class ConfigController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
catch (FormValidationException $ex) {
|
catch (FormValidationException $ex) {
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($message !== false) {
|
$this->setupFormErrorContext("variable creation", $message, $creationForm, $ex);
|
||||||
// An error has been detected: log it
|
|
||||||
Tlog::getInstance()->error(sprintf("Error during variable creation process : %s. Exception was %s", $message, $ex->getMessage()));
|
|
||||||
|
|
||||||
// Mark the form as errored
|
|
||||||
$creationForm->setErrorMessage($message);
|
|
||||||
|
|
||||||
// Pass it to the parser, along with the error message
|
|
||||||
$this->getParserContext()
|
|
||||||
->addForm($creationForm)
|
|
||||||
->setGeneralError($message)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has error, and should be redisplayed.
|
// At this point, the form has error, and should be redisplayed.
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
@@ -231,6 +221,8 @@ class ConfigController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent);
|
$this->dispatch(TheliaEvents::CONFIG_UPDATE, $changeEvent);
|
||||||
|
|
||||||
|
if (! $changeEvent->hasConfig()) throw new \LogicException($this->getTranslator()->trans("No variable was updated."));
|
||||||
|
|
||||||
// Log config modification
|
// Log config modification
|
||||||
$changedObject = $changeEvent->getConfig();
|
$changedObject = $changeEvent->getConfig();
|
||||||
|
|
||||||
@@ -241,7 +233,7 @@ class ConfigController extends BaseAdminController
|
|||||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||||
|
|
||||||
$this->redirectToRoute(
|
$this->redirectToRoute(
|
||||||
"admin.configuration.variables.change",
|
"admin.configuration.variables.update",
|
||||||
array('variable_id' => $variable_id)
|
array('variable_id' => $variable_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -250,27 +242,15 @@ class ConfigController extends BaseAdminController
|
|||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
}
|
||||||
catch (FormValidationException $ex) {
|
catch (FormValidationException $ex) {
|
||||||
// Invalid data entered
|
// Form cannot be validated
|
||||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($message !== false) {
|
$this->setupFormErrorContext("variable edition", $message, $changeForm, $ex);
|
||||||
// Log error message
|
|
||||||
Tlog::getInstance()->error(sprintf("Error during variable modification process : %s. Exception was %s", $message, $ex->getMessage()));
|
|
||||||
|
|
||||||
// Mark the form as errored
|
|
||||||
$changeForm->setErrorMessage($message);
|
|
||||||
|
|
||||||
// Pas the form and the error to the parser
|
|
||||||
$this->getParserContext()
|
|
||||||
->addForm($changeForm)
|
|
||||||
->setGeneralError($message)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has errors, and should be redisplayed.
|
// At this point, the form has errors, and should be redisplayed.
|
||||||
return $this->render('variable-edit', array('variable_id' => $variable_id));
|
return $this->render('variable-edit', array('variable_id' => $variable_id));
|
||||||
@@ -314,6 +294,9 @@ class ConfigController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::CONFIG_DELETE, $event);
|
$this->dispatch(TheliaEvents::CONFIG_DELETE, $event);
|
||||||
|
|
||||||
|
if ($event->hasConfig())
|
||||||
|
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $event->getConfig()->getName(), $event->getConfig()->getId()));
|
||||||
|
|
||||||
$this->redirectToRoute('admin.configuration.variables.default');
|
$this->redirectToRoute('admin.configuration.variables.default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,10 +108,12 @@ class CurrencyController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent);
|
$this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent);
|
||||||
|
|
||||||
|
if (! $createEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was created."));
|
||||||
|
|
||||||
$createdObject = $createEvent->getCurrency();
|
$createdObject = $createEvent->getCurrency();
|
||||||
|
|
||||||
// Log currency creation
|
// Log currency creation
|
||||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
$this->adminLogAppend(sprintf("Currency %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
||||||
|
|
||||||
// Substitute _ID_ in the URL with the ID of the created object
|
// Substitute _ID_ in the URL with the ID of the created object
|
||||||
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||||
@@ -121,26 +123,14 @@ class CurrencyController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
catch (FormValidationException $ex) {
|
catch (FormValidationException $ex) {
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$error_msg = sprintf("Please check your input: %s", $ex->getMessage());
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
// Any other error
|
// Any other error
|
||||||
$error_msg = $ex;
|
$error_msg = $ex->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error_msg !== false) {
|
$this->setupFormErrorContext("currency creation", $error_msg, $creationForm, $ex);
|
||||||
// An error has been detected: log it
|
|
||||||
Tlog::getInstance()->error(sprintf("Error during currency creation process : %s. Exception was %s", $error_msg, $ex->getMessage()));
|
|
||||||
|
|
||||||
// Mark the form as errored
|
|
||||||
$creationForm->setErrorMessage($error_msg);
|
|
||||||
|
|
||||||
// Pass it to the parser, along with the error currency
|
|
||||||
$this->getParserContext()
|
|
||||||
->addForm($creationForm)
|
|
||||||
->setGeneralError($error_msg)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has error, and should be redisplayed.
|
// At this point, the form has error, and should be redisplayed.
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
@@ -223,10 +213,12 @@ class CurrencyController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent);
|
$this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent);
|
||||||
|
|
||||||
|
if (! $changeEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was updated."));
|
||||||
|
|
||||||
// Log currency modification
|
// Log currency modification
|
||||||
$changedObject = $changeEvent->getCurrency();
|
$changedObject = $changeEvent->getCurrency();
|
||||||
|
|
||||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
$this->adminLogAppend(sprintf("Currency %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
||||||
|
|
||||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||||
// just redirect to the edit page again.
|
// just redirect to the edit page again.
|
||||||
@@ -241,27 +233,15 @@ class CurrencyController extends BaseAdminController
|
|||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
}
|
||||||
catch (FormValidationException $ex) {
|
catch (FormValidationException $ex) {
|
||||||
// Invalid data entered
|
// Form cannot be validated
|
||||||
$error_msg = sprintf("Please check your input: %s", $ex->getMessage());
|
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
// Any other error
|
// Any other error
|
||||||
$error_msg = $ex;
|
$error_msg = $ex->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error_msg !== false) {
|
$this->setupFormErrorContext("currency modification", $error_msg, $changeForm, $ex);
|
||||||
// Log error currency
|
|
||||||
Tlog::getInstance()->error(sprintf("Error during currency modification process : %s. Exception was %s", $error_msg, $ex->getMessage()));
|
|
||||||
|
|
||||||
// Mark the form as errored
|
|
||||||
$changeForm->setErrorMessage($error_msg);
|
|
||||||
|
|
||||||
// Pas the form and the error to the parser
|
|
||||||
$this->getParserContext()
|
|
||||||
->addForm($changeForm)
|
|
||||||
->setGeneralError($error_msg)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has errors, and should be redisplayed.
|
// At this point, the form has errors, and should be redisplayed.
|
||||||
return $this->render('currency-edit', array('currency_id' => $currency_id));
|
return $this->render('currency-edit', array('currency_id' => $currency_id));
|
||||||
@@ -359,6 +339,9 @@ class CurrencyController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::CURRENCY_DELETE, $event);
|
$this->dispatch(TheliaEvents::CURRENCY_DELETE, $event);
|
||||||
|
|
||||||
|
if ($event->hasCurrency())
|
||||||
|
$this->adminLogAppend(sprintf("Currency %s (ID %s) modified", $event->getCurrency()->getName(), $event->getCurrency()->getId()));
|
||||||
|
|
||||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,15 @@ use Thelia\Form\MessageCreationForm;
|
|||||||
*/
|
*/
|
||||||
class MessageController extends BaseAdminController
|
class MessageController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Render the messages list
|
||||||
|
*
|
||||||
|
* @return Symfony\Component\HttpFoundation\Response the response
|
||||||
|
*/
|
||||||
|
protected function renderList() {
|
||||||
|
return $this->render('messages');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default action is displaying the messages list.
|
* The default action is displaying the messages list.
|
||||||
*
|
*
|
||||||
@@ -51,7 +60,7 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
|
if (null !== $response = $this->checkAuth("admin.configuration.messages.view")) return $response;
|
||||||
|
|
||||||
return $this->render('messages');
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +75,7 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
$message = false;
|
$message = false;
|
||||||
|
|
||||||
// Create the Creation Form
|
// Create the creation Form
|
||||||
$creationForm = new MessageCreationForm($this->getRequest());
|
$creationForm = new MessageCreationForm($this->getRequest());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -87,10 +96,11 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::MESSAGE_CREATE, $createEvent);
|
$this->dispatch(TheliaEvents::MESSAGE_CREATE, $createEvent);
|
||||||
|
|
||||||
|
if (! $createEvent->hasMessage()) throw new \LogicException($this->getTranslator()->trans("No message was created."));
|
||||||
|
|
||||||
$createdObject = $createEvent->getMessage();
|
$createdObject = $createEvent->getMessage();
|
||||||
|
|
||||||
// Log message creation
|
$this->adminLogAppend(sprintf("Message %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
||||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
|
||||||
|
|
||||||
// Substitute _ID_ in the URL with the ID of the created object
|
// Substitute _ID_ in the URL with the ID of the created object
|
||||||
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||||
@@ -100,26 +110,14 @@ class MessageController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
catch (FormValidationException $ex) {
|
catch (FormValidationException $ex) {
|
||||||
// Form cannot be validated
|
// Form cannot be validated
|
||||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($message !== false) {
|
$this->setupFormErrorContext("message modification", $message, $creationForm, $ex);
|
||||||
// An error has been detected: log it
|
|
||||||
Tlog::getInstance()->error(sprintf("Error during message creation process : %s. Exception was %s", $message, $ex->getMessage()));
|
|
||||||
|
|
||||||
// Mark the form as errored
|
|
||||||
$creationForm->setErrorMessage($message);
|
|
||||||
|
|
||||||
// Pass it to the parser, along with the error message
|
|
||||||
$this->getParserContext()
|
|
||||||
->addForm($creationForm)
|
|
||||||
->setGeneralError($message)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has error, and should be redisplayed.
|
// At this point, the form has error, and should be redisplayed.
|
||||||
return $this->render('messages');
|
return $this->render('messages');
|
||||||
@@ -206,7 +204,8 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent);
|
$this->dispatch(TheliaEvents::MESSAGE_UPDATE, $changeEvent);
|
||||||
|
|
||||||
// Log message modification
|
if (! $changeEvent->hasMessage()) throw new \LogicException($this->getTranslator()->trans("No message was updated."));
|
||||||
|
|
||||||
$changedObject = $changeEvent->getMessage();
|
$changedObject = $changeEvent->getMessage();
|
||||||
|
|
||||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
||||||
@@ -224,27 +223,15 @@ class MessageController extends BaseAdminController
|
|||||||
$this->redirect($changeForm->getSuccessUrl());
|
$this->redirect($changeForm->getSuccessUrl());
|
||||||
}
|
}
|
||||||
catch (FormValidationException $ex) {
|
catch (FormValidationException $ex) {
|
||||||
// Invalid data entered
|
// Form cannot be validated
|
||||||
$message = sprintf("Please check your input: %s", $ex->getMessage());
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
// Any other error
|
// Any other error
|
||||||
$message = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
$message = $ex->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($message !== false) {
|
$this->setupFormErrorContext("message modification", $message, $changeForm, $ex);
|
||||||
// Log error message
|
|
||||||
Tlog::getInstance()->error(sprintf("Error during message modification process : %s. Exception was %s", $message, $ex->getMessage()));
|
|
||||||
|
|
||||||
// Mark the form as errored
|
|
||||||
$changeForm->setErrorMessage($message);
|
|
||||||
|
|
||||||
// Pas the form and the error to the parser
|
|
||||||
$this->getParserContext()
|
|
||||||
->addForm($changeForm)
|
|
||||||
->setGeneralError($message)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point, the form has errors, and should be redisplayed.
|
// At this point, the form has errors, and should be redisplayed.
|
||||||
return $this->render('message-edit', array('message_id' => $message_id));
|
return $this->render('message-edit', array('message_id' => $message_id));
|
||||||
@@ -265,6 +252,9 @@ class MessageController extends BaseAdminController
|
|||||||
|
|
||||||
$this->dispatch(TheliaEvents::MESSAGE_DELETE, $event);
|
$this->dispatch(TheliaEvents::MESSAGE_DELETE, $event);
|
||||||
|
|
||||||
$this->redirect(URL::getInstance()->adminViewUrl('messages'));
|
if ($event->hasMessage())
|
||||||
|
$this->adminLogAppend(sprintf("Message %s (ID %s) modified", $event->getMessage()->getName(), $event->getMessage()->getId()));
|
||||||
|
|
||||||
|
$this->redirectToRoute('admin.configuration.messages.default');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,32 +73,34 @@ class SessionController extends BaseAdminController
|
|||||||
|
|
||||||
// Redirect to the success URL
|
// Redirect to the success URL
|
||||||
return Redirect::exec($adminLoginForm->getSuccessUrl());
|
return Redirect::exec($adminLoginForm->getSuccessUrl());
|
||||||
} catch (ValidatorException $ex) {
|
|
||||||
|
}
|
||||||
|
catch (FormValidationException $ex) {
|
||||||
|
|
||||||
// Validation problem
|
// Validation problem
|
||||||
$message = "Missing or invalid information. Please check your input.";
|
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
} catch (AuthenticationException $ex) {
|
}
|
||||||
|
catch (AuthenticationException $ex) {
|
||||||
|
|
||||||
// Log authentication failure
|
// Log authentication failure
|
||||||
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
||||||
|
|
||||||
$message = "Login failed. Please check your username and password.";
|
$message = $this->getTranslator()->trans("Login failed. Please check your username and password.");
|
||||||
} catch (\Exception $ex) {
|
}
|
||||||
|
catch (\Exception $ex) {
|
||||||
|
|
||||||
// Log authentication failure
|
// Log authentication failure
|
||||||
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
||||||
|
|
||||||
$message = "Unable to process your request. Please try again.".$ex->getMessage();
|
$message = $this->getTranslator()->trans(
|
||||||
|
"Unable to process your request. Please try again (%err).",
|
||||||
|
array("%err" => $ex->getMessage())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store error information in the form
|
$this->setupFormErrorContext("Login process", $message, $adminLoginForm, $ex);
|
||||||
$adminLoginForm->setError(true);
|
|
||||||
$adminLoginForm->setErrorMessage($message);
|
|
||||||
|
|
||||||
// Store the form name in session (see Form Smarty plugin to find usage of this parameter)
|
|
||||||
$this->getParserContext()->addForm($adminLoginForm);
|
|
||||||
|
|
||||||
// Display the login form again
|
// Display the login form again
|
||||||
return $this->render("login");
|
return $this->render("login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,6 +81,17 @@ class BaseController extends ContainerAware
|
|||||||
return $this->container->get('event_dispatcher');
|
return $this->container->get('event_dispatcher');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* return the Translator
|
||||||
|
*
|
||||||
|
* @return mixed \Thelia\Core\Translation\Translator
|
||||||
|
*/
|
||||||
|
public function getTranslator()
|
||||||
|
{
|
||||||
|
return $this->container->get('thelia.translator');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the parser context,
|
* Return the parser context,
|
||||||
*
|
*
|
||||||
@@ -215,7 +226,7 @@ class BaseController extends ContainerAware
|
|||||||
$route = $this->container->get($routerName)->getRouteCollection()->get($routeId);
|
$route = $this->container->get($routerName)->getRouteCollection()->get($routeId);
|
||||||
|
|
||||||
if ($route == null) {
|
if ($route == null) {
|
||||||
throw new InvalidArgumentException(sprintf("Route ID '%s' does not exists.", $routeId));
|
throw new \InvalidArgumentException(sprintf("Route ID '%s' does not exists.", $routeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $route->getPath();
|
return $route->getPath();
|
||||||
|
|||||||
56
core/lib/Thelia/Controller/Front/DeliveryController.php
Normal file
56
core/lib/Thelia/Controller/Front/DeliveryController.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?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\Controller\Front;
|
||||||
|
use Thelia\Model\ModuleQuery;
|
||||||
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DeliveryController
|
||||||
|
* @package Thelia\Controller\Front
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class DeliveryController extends BaseFrontController
|
||||||
|
{
|
||||||
|
public function select($delivery_id)
|
||||||
|
{
|
||||||
|
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||||
|
$this->redirect(URL::getInstance()->getIndexPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
|
||||||
|
$deliveryModule = ModuleQuery::create()
|
||||||
|
->filterById($delivery_id)
|
||||||
|
->filterByActivate(1)
|
||||||
|
->findOne()
|
||||||
|
;
|
||||||
|
|
||||||
|
if ($deliveryModule) {
|
||||||
|
$request->getSession()->setDelivery($delivery_id);
|
||||||
|
} else {
|
||||||
|
$this->pageNotFound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php
Normal file
48
core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
class BaseToggleVisibilityEvent extends ActionEvent
|
||||||
|
{
|
||||||
|
protected $object_id;
|
||||||
|
|
||||||
|
protected $object;
|
||||||
|
|
||||||
|
public function __construct($object_id)
|
||||||
|
{
|
||||||
|
$this->object_id = $object_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getObjectId()
|
||||||
|
{
|
||||||
|
return $this->object_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setObjectId($object_id)
|
||||||
|
{
|
||||||
|
$this->object_id = $object_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,12 +25,11 @@ namespace Thelia\Core\Event;
|
|||||||
|
|
||||||
use Thelia\Model\Category;
|
use Thelia\Model\Category;
|
||||||
|
|
||||||
class CategoryCreateEvent extends ActionEvent
|
class CategoryCreateEvent extends CategoryEvent
|
||||||
{
|
{
|
||||||
protected $title;
|
protected $title;
|
||||||
protected $parent;
|
protected $parent;
|
||||||
protected $locale;
|
protected $locale;
|
||||||
protected $created_category;
|
|
||||||
|
|
||||||
public function __construct($title, $parent, $locale)
|
public function __construct($title, $parent, $locale)
|
||||||
{
|
{
|
||||||
@@ -47,6 +46,7 @@ class CategoryCreateEvent extends ActionEvent
|
|||||||
public function setTitle($title)
|
public function setTitle($title)
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent()
|
public function getParent()
|
||||||
@@ -57,6 +57,7 @@ class CategoryCreateEvent extends ActionEvent
|
|||||||
public function setParent($parent)
|
public function setParent($parent)
|
||||||
{
|
{
|
||||||
$this->parent = $parent;
|
$this->parent = $parent;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocale()
|
public function getLocale()
|
||||||
@@ -67,15 +68,6 @@ class CategoryCreateEvent extends ActionEvent
|
|||||||
public function setLocale($locale)
|
public function setLocale($locale)
|
||||||
{
|
{
|
||||||
$this->locale = $locale;
|
$this->locale = $locale;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public function getCreatedCategory()
|
|
||||||
{
|
|
||||||
return $this->created_category;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCreatedCategory(Category $created_category)
|
|
||||||
{
|
|
||||||
$this->created_category = $created_category;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,13 +22,11 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Category;
|
use Thelia\Model\Category;
|
||||||
|
|
||||||
class CategoryDeleteEvent extends ActionEvent
|
class CategoryDeleteEvent extends CategoryEvent
|
||||||
{
|
{
|
||||||
protected $category_id;
|
|
||||||
protected $deleted_category;
|
|
||||||
|
|
||||||
public function __construct($category_id)
|
public function __construct($category_id)
|
||||||
{
|
{
|
||||||
$this->category_id = $category_id;
|
$this->category_id = $category_id;
|
||||||
@@ -42,15 +40,6 @@ class CategoryDeleteEvent extends ActionEvent
|
|||||||
public function setCategoryId($category_id)
|
public function setCategoryId($category_id)
|
||||||
{
|
{
|
||||||
$this->category_id = $category_id;
|
$this->category_id = $category_id;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public function getDeletedCategory()
|
|
||||||
{
|
|
||||||
return $this->deleted_category;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDeletedCategory(Category $deleted_category)
|
|
||||||
{
|
|
||||||
$this->deleted_category = $deleted_category;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,20 +28,26 @@ use Thelia\Core\Event\ActionEvent;
|
|||||||
|
|
||||||
class CategoryEvent extends ActionEvent
|
class CategoryEvent extends ActionEvent
|
||||||
{
|
{
|
||||||
public $category;
|
public $category = null;
|
||||||
|
|
||||||
public function __construct(Category $category)
|
public function __construct(Category $category = null)
|
||||||
{
|
{
|
||||||
$this->category = $category;
|
$this->category = $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function hasCategory() {
|
||||||
* @return \Thelia\Model\Category
|
return ! is_null($this->category);
|
||||||
*/
|
}
|
||||||
|
|
||||||
public function getCategory()
|
public function getCategory()
|
||||||
{
|
{
|
||||||
return $this->category;
|
return $this->category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCategory(Category $category)
|
||||||
|
{
|
||||||
|
$this->category = $category;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,35 +22,7 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
use Thelia\Model\Category;
|
|
||||||
|
|
||||||
class CategoryToggleVisibilityEvent extends ActionEvent
|
class CategoryToggleVisibilityEvent extends BaseToggleVisibilityEvent
|
||||||
{
|
{
|
||||||
protected $category_id;
|
|
||||||
protected $category;
|
|
||||||
|
|
||||||
public function __construct($category_id)
|
|
||||||
{
|
|
||||||
$this->category_id = $category_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCategoryId()
|
|
||||||
{
|
|
||||||
return $this->category_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCategoryId($category_id)
|
|
||||||
{
|
|
||||||
$this->category_id = $category_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCategory()
|
|
||||||
{
|
|
||||||
return $this->category;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCategory(Category $category)
|
|
||||||
{
|
|
||||||
$this->category = $category;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -22,17 +22,16 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
use Thelia\Model\Category;
|
use Thelia\Model\Category;
|
||||||
|
|
||||||
class CategoryUpdateEvent extends ActionEvent
|
class CategoryUpdateEvent extends CategoryCreateEvent
|
||||||
{
|
{
|
||||||
protected $category_id;
|
protected $category_id;
|
||||||
protected $locale;
|
|
||||||
protected $title;
|
|
||||||
protected $chapo;
|
protected $chapo;
|
||||||
protected $description;
|
protected $description;
|
||||||
protected $postscriptum;
|
protected $postscriptum;
|
||||||
|
|
||||||
protected $url;
|
protected $url;
|
||||||
protected $visibility;
|
protected $visibility;
|
||||||
protected $parent;
|
protected $parent;
|
||||||
@@ -41,4 +40,81 @@ class CategoryUpdateEvent extends ActionEvent
|
|||||||
{
|
{
|
||||||
$this->category_id = $category_id;
|
$this->category_id = $category_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCategoryId()
|
||||||
|
{
|
||||||
|
return $this->category_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCategoryId($category_id)
|
||||||
|
{
|
||||||
|
$this->category_id = $category_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getChapo()
|
||||||
|
{
|
||||||
|
return $this->chapo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setChapo($chapo)
|
||||||
|
{
|
||||||
|
$this->chapo = $chapo;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription()
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription($description)
|
||||||
|
{
|
||||||
|
$this->description = $description;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostscriptum()
|
||||||
|
{
|
||||||
|
return $this->postscriptum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPostscriptum($postscriptum)
|
||||||
|
{
|
||||||
|
$this->postscriptum = $postscriptum;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUrl()
|
||||||
|
{
|
||||||
|
return $this->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUrl($url)
|
||||||
|
{
|
||||||
|
$this->url = $url;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVisibility()
|
||||||
|
{
|
||||||
|
return $this->visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVisibility($visibility)
|
||||||
|
{
|
||||||
|
$this->visibility = $visibility;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getParent()
|
||||||
|
{
|
||||||
|
return $this->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setParent($parent)
|
||||||
|
{
|
||||||
|
$this->parent = $parent;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Event;
|
namespace Thelia\Core\Event;
|
||||||
|
|
||||||
class CurrencyUpdatePositionEvent extends BaseUpdatePositionEvent
|
class CategoryUpdatePositionEvent extends BaseUpdatePositionEvent
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -26,13 +26,17 @@ use Thelia\Model\Config;
|
|||||||
|
|
||||||
class ConfigEvent extends ActionEvent
|
class ConfigEvent extends ActionEvent
|
||||||
{
|
{
|
||||||
protected $config;
|
protected $config = null;
|
||||||
|
|
||||||
public function __construct(Config $config = null)
|
public function __construct(Config $config = null)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasConfig() {
|
||||||
|
return ! is_null($this->config);
|
||||||
|
}
|
||||||
|
|
||||||
public function getConfig()
|
public function getConfig()
|
||||||
{
|
{
|
||||||
return $this->config;
|
return $this->config;
|
||||||
|
|||||||
@@ -26,13 +26,17 @@ use Thelia\Model\Currency;
|
|||||||
|
|
||||||
class CurrencyEvent extends ActionEvent
|
class CurrencyEvent extends ActionEvent
|
||||||
{
|
{
|
||||||
protected $currency;
|
protected $currency = null;
|
||||||
|
|
||||||
public function __construct(Currency $currency = null)
|
public function __construct(Currency $currency = null)
|
||||||
{
|
{
|
||||||
$this->currency = $currency;
|
$this->currency = $currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasCurrency() {
|
||||||
|
return ! is_null($this->currency);
|
||||||
|
}
|
||||||
|
|
||||||
public function getCurrency()
|
public function getCurrency()
|
||||||
{
|
{
|
||||||
return $this->currency;
|
return $this->currency;
|
||||||
|
|||||||
@@ -26,13 +26,17 @@ use Thelia\Model\Message;
|
|||||||
|
|
||||||
class MessageEvent extends ActionEvent
|
class MessageEvent extends ActionEvent
|
||||||
{
|
{
|
||||||
protected $message;
|
protected $message = null;
|
||||||
|
|
||||||
public function __construct(Message $message = null)
|
public function __construct(Message $message = null)
|
||||||
{
|
{
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasMessage() {
|
||||||
|
return ! is_null($this->message);
|
||||||
|
}
|
||||||
|
|
||||||
public function getMessage()
|
public function getMessage()
|
||||||
{
|
{
|
||||||
return $this->message;
|
return $this->message;
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ namespace Thelia\Core\Event;
|
|||||||
final class TheliaEvents
|
final class TheliaEvents
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sent at the beginning
|
||||||
|
*/
|
||||||
|
const BOOT = "thelia.boot";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACTION event
|
* ACTION event
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -164,10 +164,28 @@ class Session extends BaseSession
|
|||||||
* assign cart id in session
|
* assign cart id in session
|
||||||
*
|
*
|
||||||
* @param $cart_id
|
* @param $cart_id
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCart($cart_id)
|
public function setCart($cart_id)
|
||||||
{
|
{
|
||||||
$this->set("thelia.cart_id", $cart_id);
|
$this->set("thelia.cart_id", $cart_id);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* assign delivery id in session
|
||||||
|
*
|
||||||
|
* @param $delivery_id
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setDelivery($delivery_id)
|
||||||
|
{
|
||||||
|
$this->set("thelia.delivery_id", $delivery_id);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDelivery()
|
||||||
|
{
|
||||||
|
return $this->get("thelia.delivery_id");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -243,23 +243,9 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* this function have to be implement in your own loop class.
|
* this function have to be implement in your own loop class.
|
||||||
*
|
*
|
||||||
* All your parameters are defined in defineArgs() and can be accessible like a class property.
|
* All loops parameters can be accessible via getter.
|
||||||
*
|
*
|
||||||
* example :
|
* for example, ref parameter is accessible through getRef method
|
||||||
*
|
|
||||||
* public function defineArgs()
|
|
||||||
* {
|
|
||||||
* return array (
|
|
||||||
* "ref",
|
|
||||||
* "id" => "optional",
|
|
||||||
* "stock" => array(
|
|
||||||
* "optional",
|
|
||||||
* "default" => 10
|
|
||||||
* )
|
|
||||||
* );
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* you can retrieve ref value using $this->ref
|
|
||||||
*
|
*
|
||||||
* @param $pagination
|
* @param $pagination
|
||||||
*
|
*
|
||||||
@@ -271,18 +257,31 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* define all args used in your loop
|
* define all args used in your loop
|
||||||
*
|
*
|
||||||
* array key is your arg name.
|
|
||||||
*
|
*
|
||||||
* example :
|
* example :
|
||||||
*
|
*
|
||||||
* return array (
|
* public function getArgDefinitions()
|
||||||
* "ref",
|
* {
|
||||||
* "id" => "optional",
|
* return new ArgumentCollection(
|
||||||
* "stock" => array(
|
* Argument::createIntListTypeArgument('id'),
|
||||||
* "optional",
|
* new Argument(
|
||||||
* "default" => 10
|
* 'ref',
|
||||||
* )
|
* new TypeCollection(
|
||||||
* );
|
* new Type\AlphaNumStringListType()
|
||||||
|
* )
|
||||||
|
* ),
|
||||||
|
* Argument::createIntListTypeArgument('category'),
|
||||||
|
* Argument::createBooleanTypeArgument('new'),
|
||||||
|
* Argument::createBooleanTypeArgument('promo'),
|
||||||
|
* Argument::createFloatTypeArgument('min_price'),
|
||||||
|
* Argument::createFloatTypeArgument('max_price'),
|
||||||
|
* Argument::createIntTypeArgument('min_stock'),
|
||||||
|
* Argument::createFloatTypeArgument('min_weight'),
|
||||||
|
* Argument::createFloatTypeArgument('max_weight'),
|
||||||
|
* Argument::createBooleanTypeArgument('current'),
|
||||||
|
*
|
||||||
|
* );
|
||||||
|
* }
|
||||||
*
|
*
|
||||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ class Attribute extends BaseI18nLoop
|
|||||||
->set("TITLE",$attribute->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE",$attribute->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO'))
|
->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO'))
|
||||||
->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
->set("POSTSCRIPTUM", $attribute->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
->set("POSTSCRIPTUM", $attribute->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
|
->set("POSITION", $attribute->getPosition());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ class AttributeAvailability extends BaseI18nLoop
|
|||||||
->set("TITLE",$attributeAv->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE",$attributeAv->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("CHAPO", $attributeAv->getVirtualColumn('i18n_CHAPO'))
|
->set("CHAPO", $attributeAv->getVirtualColumn('i18n_CHAPO'))
|
||||||
->set("DESCRIPTION", $attributeAv->getVirtualColumn('i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $attributeAv->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
->set("POSTSCRIPTUM", $attributeAv->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
->set("POSTSCRIPTUM", $attributeAv->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
|
->set("POSITION", $attributeAv->getPosition());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
109
core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
Normal file
109
core/lib/Thelia/Core/Template/Loop/BaseSpecificModule.php
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<?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\Template\Loop;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
use Thelia\Model\ModuleQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Delivery
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class BaseSpecificModule extends BaseI18nLoop {
|
||||||
|
public $timestampable = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* define all args used in your loop
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* example :
|
||||||
|
*
|
||||||
|
* public function getArgDefinitions()
|
||||||
|
* {
|
||||||
|
* return new ArgumentCollection(
|
||||||
|
* Argument::createIntListTypeArgument('id'),
|
||||||
|
* new Argument(
|
||||||
|
* 'ref',
|
||||||
|
* new TypeCollection(
|
||||||
|
* new Type\AlphaNumStringListType()
|
||||||
|
* )
|
||||||
|
* ),
|
||||||
|
* Argument::createIntListTypeArgument('category'),
|
||||||
|
* Argument::createBooleanTypeArgument('new'),
|
||||||
|
* Argument::createBooleanTypeArgument('promo'),
|
||||||
|
* Argument::createFloatTypeArgument('min_price'),
|
||||||
|
* Argument::createFloatTypeArgument('max_price'),
|
||||||
|
* Argument::createIntTypeArgument('min_stock'),
|
||||||
|
* Argument::createFloatTypeArgument('min_weight'),
|
||||||
|
* Argument::createFloatTypeArgument('max_weight'),
|
||||||
|
* Argument::createBooleanTypeArgument('current'),
|
||||||
|
*
|
||||||
|
* );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntTypeArgument('id'),
|
||||||
|
Argument::createIntListTypeArgument('exclude')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* this function have to be implement in your own loop class.
|
||||||
|
*
|
||||||
|
* All loops parameters can be accesible via getter.
|
||||||
|
*
|
||||||
|
* for example, ref parameter is accessible through getRef method
|
||||||
|
*
|
||||||
|
* @param $pagination
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ModuleQuery
|
||||||
|
*/
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = ModuleQuery::create();
|
||||||
|
|
||||||
|
if(null !== $id = $this->getId())
|
||||||
|
{
|
||||||
|
$search->filterById($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (null !== $exclude = $this->getExclude()) {
|
||||||
|
$search->filterById($exclude, Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $search;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -113,10 +113,10 @@ class Country extends BaseI18nLoop
|
|||||||
->set("TITLE",$country->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE",$country->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("CHAPO", $country->getVirtualColumn('i18n_CHAPO'))
|
->set("CHAPO", $country->getVirtualColumn('i18n_CHAPO'))
|
||||||
->set("DESCRIPTION", $country->getVirtualColumn('i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $country->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
->set("POSTSCRIPTUM", $country->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
->set("POSTSCRIPTUM", $country->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
$loopResultRow->set("ISOCODE", $country->getIsocode());
|
->set("ISOCODE", $country->getIsocode())
|
||||||
$loopResultRow->set("ISOALPHA2", $country->getIsoalpha2());
|
->set("ISOALPHA2", $country->getIsoalpha2())
|
||||||
$loopResultRow->set("ISOALPHA3", $country->getIsoalpha3());
|
->set("ISOALPHA3", $country->getIsoalpha3());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
85
core/lib/Thelia/Core/Template/Loop/Delivery.php
Normal file
85
core/lib/Thelia/Core/Template/Loop/Delivery.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?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\Template\Loop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Delivery
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class Delivery extends BaseSpecificModule
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getArgDefinitions()
|
||||||
|
{
|
||||||
|
$collection = parent::getArgDefinitions();
|
||||||
|
|
||||||
|
$collection->addArgument(
|
||||||
|
Argument::createIntTypeArgument("country")
|
||||||
|
);
|
||||||
|
|
||||||
|
return $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = parent::exec($pagination);
|
||||||
|
/* manage translations */
|
||||||
|
$locale = $this->configureI18nProcessing($search);
|
||||||
|
/* perform search */
|
||||||
|
$deliveryModules = $this->search($search, $pagination);
|
||||||
|
|
||||||
|
$loopResult = new LoopResult($deliveryModules);
|
||||||
|
|
||||||
|
foreach ($deliveryModules as $deliveryModule) {
|
||||||
|
$loopResultRow = new LoopResultRow($loopResult, $deliveryModule, $this->versionable, $this->timestampable, $this->countable);
|
||||||
|
|
||||||
|
$moduleReflection = new \ReflectionClass($deliveryModule->getFullNamespace());
|
||||||
|
if($moduleReflection->isSubclassOf("Thelia\Module\DeliveryModuleInterface") === false) {
|
||||||
|
throw new \RuntimeException(sprintf("delivery module %s is not a Thelia\Module\DeliveryModuleInterface", $deliveryModule->getCode()));
|
||||||
|
}
|
||||||
|
$moduleInstance = $moduleReflection->newInstance();
|
||||||
|
|
||||||
|
$moduleInstance->setRequest($this->request);
|
||||||
|
$moduleInstance->setDispatcher($this->dispatcher);
|
||||||
|
|
||||||
|
$loopResultRow
|
||||||
|
->set('ID', $deliveryModule->getId())
|
||||||
|
->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE'))
|
||||||
|
->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))
|
||||||
|
->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
|
->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
|
->set('PRICE', $moduleInstance->calculate($this->getCountry()))
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -154,7 +154,8 @@ class Feature extends BaseI18nLoop
|
|||||||
->set("TITLE",$feature->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE",$feature->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO'))
|
->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO'))
|
||||||
->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
->set("POSTSCRIPTUM", $feature->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
|
->set("POSITION", $feature->getPosition());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,8 @@ class FeatureAvailability extends BaseI18nLoop
|
|||||||
->set("TITLE",$featureAv->getVirtualColumn('i18n_TITLE'))
|
->set("TITLE",$featureAv->getVirtualColumn('i18n_TITLE'))
|
||||||
->set("CHAPO", $featureAv->getVirtualColumn('i18n_CHAPO'))
|
->set("CHAPO", $featureAv->getVirtualColumn('i18n_CHAPO'))
|
||||||
->set("DESCRIPTION", $featureAv->getVirtualColumn('i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $featureAv->getVirtualColumn('i18n_DESCRIPTION'))
|
||||||
->set("POSTSCRIPTUM", $featureAv->getVirtualColumn('i18n_POSTSCRIPTUM'));
|
->set("POSTSCRIPTUM", $featureAv->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||||
|
->set("POSITION", $featureAv->getPosition());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ class FeatureValue extends BaseI18nLoop
|
|||||||
->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE'))
|
->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE'))
|
||||||
->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO'))
|
->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO'))
|
||||||
->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION'))
|
->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION'))
|
||||||
->set("POSTSCRIPTUM", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM'));
|
->set("POSTSCRIPTUM", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_POSTSCRIPTUM'))
|
||||||
|
->set("POSITION", $featureValue->getPosition());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ class Title extends BaseI18nLoop
|
|||||||
->set("LOCALE",$locale)
|
->set("LOCALE",$locale)
|
||||||
->set("DEFAULT", $title->getByDefault())
|
->set("DEFAULT", $title->getByDefault())
|
||||||
->set("SHORT", $title->getVirtualColumn('i18n_SHORT'))
|
->set("SHORT", $title->getVirtualColumn('i18n_SHORT'))
|
||||||
->set("LONG", $title->getVirtualColumn('i18n_LONG'));
|
->set("LONG", $title->getVirtualColumn('i18n_LONG'))
|
||||||
|
->set("POSITION", $title->getPosition());
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,20 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||||
use Thelia\Core\Security\SecurityContext;
|
use Thelia\Core\Security\SecurityContext;
|
||||||
use Thelia\Core\Template\ParserContext;
|
use Thelia\Core\Template\ParserContext;
|
||||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||||
|
use Thelia\Model\CategoryQuery;
|
||||||
|
use Thelia\Model\ContentQuery;
|
||||||
|
use Thelia\Model\FolderQuery;
|
||||||
|
use Thelia\Model\Product;
|
||||||
|
use Thelia\Model\ProductQuery;
|
||||||
|
use Thelia\Model\Tools\ModelCriteriaTools;
|
||||||
|
use Thelia\Tools\DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of data access to main Thelia objects (users, cart, etc.)
|
* Implementation of data access to main Thelia objects (users, cart, etc.)
|
||||||
*
|
*
|
||||||
@@ -37,10 +47,13 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
{
|
{
|
||||||
private $securityContext;
|
private $securityContext;
|
||||||
protected $parserContext;
|
protected $parserContext;
|
||||||
|
protected $request;
|
||||||
|
|
||||||
public function __construct(SecurityContext $securityContext, ParserContext $parserContext)
|
public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext)
|
||||||
{
|
{
|
||||||
$this->securityContext = $securityContext;
|
$this->securityContext = $securityContext;
|
||||||
|
$this->parserContext = $parserContext;
|
||||||
|
$this->request = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +65,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
*/
|
*/
|
||||||
public function adminDataAccess($params, &$smarty)
|
public function adminDataAccess($params, &$smarty)
|
||||||
{
|
{
|
||||||
return $this->userDataAccess("Admin User", $this->securityContext->getAdminUser(), $params);
|
return $this->dataAccess("Admin User", $params, $this->securityContext->getAdminUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,37 +77,146 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
*/
|
*/
|
||||||
public function customerDataAccess($params, &$smarty)
|
public function customerDataAccess($params, &$smarty)
|
||||||
{
|
{
|
||||||
return $this->userDataAccess("Customer User", $this->securityContext->getCustomerUser(), $params);
|
return $this->dataAccess("Customer User", $params, $this->securityContext->getCustomerUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function productDataAccess($params, &$smarty)
|
||||||
|
{
|
||||||
|
$productId = $this->request->get('product_id');
|
||||||
|
|
||||||
|
if($productId !== null) {
|
||||||
|
|
||||||
|
$search = ProductQuery::create()
|
||||||
|
->filterById($productId);
|
||||||
|
|
||||||
|
return $this->dataAccessWithI18n("Product", $params, $search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function categoryDataAccess($params, &$smarty)
|
||||||
|
{
|
||||||
|
$categoryId = $this->request->get('category_id');
|
||||||
|
|
||||||
|
if($categoryId !== null) {
|
||||||
|
|
||||||
|
$search = CategoryQuery::create()
|
||||||
|
->filterById($categoryId);
|
||||||
|
|
||||||
|
return $this->dataAccessWithI18n("Category", $params, $search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function contentDataAccess($params, &$smarty)
|
||||||
|
{
|
||||||
|
$contentId = $this->request->get('content_id');
|
||||||
|
|
||||||
|
if($contentId !== null) {
|
||||||
|
|
||||||
|
$search = ContentQuery::create()
|
||||||
|
->filterById($contentId);
|
||||||
|
|
||||||
|
return $this->dataAccessWithI18n("Content", $params, $search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function folderDataAccess($params, &$smarty)
|
||||||
|
{
|
||||||
|
$folderId = $this->request->get('folder_id');
|
||||||
|
|
||||||
|
if($folderId !== null) {
|
||||||
|
|
||||||
|
$search = FolderQuery::create()
|
||||||
|
->filterById($folderId);
|
||||||
|
|
||||||
|
return $this->dataAccessWithI18n("Folder", $params, $search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $objectLabel
|
* @param $objectLabel
|
||||||
* @param $user
|
* @param $params
|
||||||
* @param $params
|
* @param ModelCriteria $search
|
||||||
|
* @param array $columns
|
||||||
|
* @param null $foreignTable
|
||||||
|
* @param string $foreignKey
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function dataAccessWithI18n($objectLabel, $params, ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID')
|
||||||
|
{
|
||||||
|
$lang = $this->getNormalizedParam($params, array('lang'));
|
||||||
|
if($lang === null) {
|
||||||
|
$lang = $this->request->getSession()->getLang()->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelCriteriaTools::getI18n(
|
||||||
|
false,
|
||||||
|
$lang,
|
||||||
|
$search,
|
||||||
|
$this->request->getSession()->getLang()->getLocale(),
|
||||||
|
$columns,
|
||||||
|
$foreignTable,
|
||||||
|
$foreignKey,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = $search->findOne();
|
||||||
|
|
||||||
|
$noGetterData = array();
|
||||||
|
foreach($columns as $column) {
|
||||||
|
$noGetterData[$column] = $data->getVirtualColumn('i18n_' . $column);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->dataAccess($objectLabel, $params, $data, $noGetterData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $objectLabel
|
||||||
|
* @param $params
|
||||||
|
* @param $data
|
||||||
|
* @param array $noGetterData
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function userDataAccess($objectLabel, $user, $params)
|
protected function dataAccess($objectLabel, $params, $data, $noGetterData = array())
|
||||||
{
|
{
|
||||||
$attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr'));
|
$attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr'));
|
||||||
|
|
||||||
if (! empty($attribute)) {
|
if (! empty($attribute)) {
|
||||||
|
|
||||||
if (null != $user) {
|
if (null != $data) {
|
||||||
$getter = sprintf("get%s", ucfirst($attribute));
|
|
||||||
|
|
||||||
if (method_exists($user, $getter)) {
|
$keyAttribute = strtoupper($attribute);
|
||||||
return $user->$getter();
|
if(array_key_exists($keyAttribute, $noGetterData)) {
|
||||||
}
|
return $noGetterData[$keyAttribute];
|
||||||
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", $objectLabel, $attribute));
|
$getter = sprintf("get%s", ucfirst($attribute));
|
||||||
|
if (method_exists($data, $getter)) {
|
||||||
|
$return = $data->$getter();
|
||||||
|
|
||||||
}
|
if($return instanceof \DateTime) {
|
||||||
}
|
if (array_key_exists("format", $params)) {
|
||||||
|
$format = $params["format"];
|
||||||
|
} else {
|
||||||
|
$format = DateTimeFormat::getInstance($this->request)->getFormat(array_key_exists("output", $params) ? $params["output"] : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = $return->format($format);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", $objectLabel, $attribute));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Define the various smarty plugins hendled by this class
|
* Define the various smarty plugins hendled by this class
|
||||||
*
|
*
|
||||||
@@ -104,7 +226,11 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'),
|
new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'),
|
||||||
new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess')
|
new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'),
|
||||||
|
new SmartyPluginDescriptor('function', 'product', $this, 'productDataAccess'),
|
||||||
|
new SmartyPluginDescriptor('function', 'category', $this, 'categoryDataAccess'),
|
||||||
|
new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'),
|
||||||
|
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use Thelia\Core\HttpFoundation\Request;
|
|||||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||||
use Thelia\Core\Template\Smarty\Exception\SmartyPluginException;
|
use Thelia\Core\Template\Smarty\Exception\SmartyPluginException;
|
||||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||||
|
use Thelia\Tools\DateTimeFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -79,29 +80,10 @@ class Format extends AbstractSmartyPlugin
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$format = null;
|
|
||||||
$output = array_key_exists("output", $params) ? $params["output"] : null;
|
|
||||||
|
|
||||||
if (array_key_exists("format", $params)) {
|
if (array_key_exists("format", $params)) {
|
||||||
$format = $params["format"];
|
$format = $params["format"];
|
||||||
} else {
|
} else {
|
||||||
$session = $this->request->getSession();
|
$format = DateTimeFormat::getInstance($this->request)->getFormat(array_key_exists("output", $params) ? $params["output"] : null);
|
||||||
$lang = $session->getLang();
|
|
||||||
|
|
||||||
if($lang) {
|
|
||||||
switch ($output) {
|
|
||||||
case "date" :
|
|
||||||
$format = $lang->getDateFormat();
|
|
||||||
break;
|
|
||||||
case "time" :
|
|
||||||
$format = $lang->getTimeFormat();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case "datetime" :
|
|
||||||
$format = $lang->getDateTimeFormat();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $date->format($format);
|
return $date->format($format);
|
||||||
|
|||||||
@@ -33,12 +33,15 @@ namespace Thelia\Core;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\Validator\Tests\Fixtures\Reference;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
|
|
||||||
use Thelia\Core\Bundle;
|
use Thelia\Core\Bundle;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Log\Tlog;
|
use Thelia\Log\Tlog;
|
||||||
use Thelia\Config\DatabaseConfiguration;
|
use Thelia\Config\DatabaseConfiguration;
|
||||||
use Thelia\Config\DefinePropel;
|
use Thelia\Config\DefinePropel;
|
||||||
@@ -81,13 +84,22 @@ class Thelia extends Kernel
|
|||||||
$serviceContainer->setConnectionManager('thelia', $manager);
|
$serviceContainer->setConnectionManager('thelia', $manager);
|
||||||
|
|
||||||
if ($this->isDebug()) {
|
if ($this->isDebug()) {
|
||||||
$serviceContainer->setLogger('defaultLogger', Tlog::getInstance());
|
//$serviceContainer->setLogger('defaultLogger', Tlog::getInstance());
|
||||||
|
|
||||||
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||||
$con->useDebug(true);
|
$con->useDebug(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dispatch an event when application is boot
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
$this->getContainer()->get("event_dispatcher")->dispatch(TheliaEvents::BOOT);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Load some configuration
|
* Load some configuration
|
||||||
@@ -107,6 +119,16 @@ class Thelia extends Kernel
|
|||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$defintion = new Definition();
|
||||||
|
$defintion->setClass($module->getFullNamespace());
|
||||||
|
$defintion->addMethodCall("setContainer", array('service_container'));
|
||||||
|
|
||||||
|
$container->setDefinition(
|
||||||
|
"module.".$module->getCode(),
|
||||||
|
$defintion
|
||||||
|
);
|
||||||
|
|
||||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
||||||
$loader->load("config.xml");
|
$loader->load("config.xml");
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ class TheliaHttpKernel extends HttpKernel
|
|||||||
// See Thelia\Tools\URL class.
|
// See Thelia\Tools\URL class.
|
||||||
$this->container->get('thelia.url.manager');
|
$this->container->get('thelia.url.manager');
|
||||||
|
|
||||||
|
// Same thing for the Translator service.
|
||||||
|
$this->container->get('thelia.translator');
|
||||||
|
|
||||||
$lang = $this->detectLang($request);
|
$lang = $this->detectLang($request);
|
||||||
|
|
||||||
if ($lang) {
|
if ($lang) {
|
||||||
|
|||||||
@@ -5,6 +5,29 @@ use Symfony\Component\Translation\Translator as BaseTranslator;
|
|||||||
|
|
||||||
class Translator extends BaseTranslator
|
class Translator extends BaseTranslator
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected static $instance = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// Allow singleton style calls once intanciated.
|
||||||
|
// For this to work, the Translator service has to be instanciated very early. This is done manually
|
||||||
|
// in TheliaHttpKernel, by calling $this->container->get('thelia.translator');
|
||||||
|
self::$instance = $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return this class instance, only once instanciated.
|
||||||
|
*
|
||||||
|
* @throws \RuntimeException if the class has not been instanciated.
|
||||||
|
* @return Thelia\Core\Translation\Translator the instance.
|
||||||
|
*/
|
||||||
|
public static function getInstance() {
|
||||||
|
if (self::$instance == null) throw new \RuntimeException("Translator instance is not initialized.");
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
@@ -21,7 +44,7 @@ class Translator extends BaseTranslator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->catalogues[$locale]->has((string) $id, $domain))
|
if ($this->catalogues[$locale]->has((string) $id, $domain))
|
||||||
return parent::trans($id, $parameters, $domain = 'messages', $locale = null);
|
return parent::trans($id, $parameters, $domain, $locale);
|
||||||
else
|
else
|
||||||
return strtr($id, $parameters);
|
return strtr($id, $parameters);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ abstract class BaseForm
|
|||||||
public function createView()
|
public function createView()
|
||||||
{
|
{
|
||||||
$this->view = $this->form->createView();
|
$this->view = $this->form->createView();
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getView()
|
public function getView()
|
||||||
@@ -159,6 +161,8 @@ abstract class BaseForm
|
|||||||
public function setError($has_error = true)
|
public function setError($has_error = true)
|
||||||
{
|
{
|
||||||
$this->has_error = $has_error;
|
$this->has_error = $has_error;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,6 +184,8 @@ abstract class BaseForm
|
|||||||
{
|
{
|
||||||
$this->setError(true);
|
$this->setError(true);
|
||||||
$this->error_message = $message;
|
$this->error_message = $message;
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
class CategoryCreationForm extends BaseForm
|
class CategoryCreationForm extends BaseForm
|
||||||
{
|
{
|
||||||
@@ -33,7 +34,7 @@ class CategoryCreationForm extends BaseForm
|
|||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new NotBlank()
|
||||||
),
|
),
|
||||||
"label" => "Category title *",
|
"label" => Translator::getInstance()->trans("Category title *"),
|
||||||
"label_attr" => array(
|
"label_attr" => array(
|
||||||
"for" => "title"
|
"for" => "title"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,32 +23,33 @@
|
|||||||
namespace Thelia\Form;
|
namespace Thelia\Form;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Thelia\Model\LangQuery;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
/**
|
class CategoryModificationForm extends CategoryCreationForm
|
||||||
* A base form for all objects with standard contents.
|
|
||||||
*
|
|
||||||
* @author Franck Allimant <franck@cqfdev.fr>
|
|
||||||
*/
|
|
||||||
abstract class BaseDescForm extends BaseForm
|
|
||||||
{
|
{
|
||||||
|
use StandardDescriptionFieldsTrait;
|
||||||
|
|
||||||
protected function buildForm()
|
protected function buildForm()
|
||||||
{
|
{
|
||||||
|
parent::buildForm(true);
|
||||||
|
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->add("locale", "hidden", array(
|
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
->add("visible", "checkbox", array(
|
||||||
)
|
"label" => Translator::getInstance()->trans("This category is online on the front office.")
|
||||||
)
|
))
|
||||||
)
|
|
||||||
->add("title", "text", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add("chapo", "text", array())
|
|
||||||
->add("description", "text", array())
|
|
||||||
->add("postscriptum", "text", array())
|
|
||||||
;
|
;
|
||||||
}
|
|
||||||
|
// Add standard description fields
|
||||||
|
$this->addStandardDescFields(array('title', 'locale'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return "thelia_category_modification";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -40,11 +40,19 @@ class ConfigCreationForm extends BaseForm
|
|||||||
|
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->add("name", "text", array(
|
->add("name", "text", array(
|
||||||
"constraints" => $name_constraints
|
"constraints" => $name_constraints,
|
||||||
|
"label" => "Name *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "name"
|
||||||
|
)
|
||||||
))
|
))
|
||||||
->add("title", "text", array(
|
->add("title", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new Constraints\NotBlank()
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => "Purpose *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "purpose"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("locale", "hidden", array(
|
->add("locale", "hidden", array(
|
||||||
@@ -52,9 +60,16 @@ class ConfigCreationForm extends BaseForm
|
|||||||
new Constraints\NotBlank()
|
new Constraints\NotBlank()
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("value", "text", array())
|
->add("value", "text", array(
|
||||||
|
"label" => "Value *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "value"
|
||||||
|
)
|
||||||
|
))
|
||||||
->add("hidden", "hidden", array())
|
->add("hidden", "hidden", array())
|
||||||
->add("secured", "hidden", array())
|
->add("secured", "hidden", array(
|
||||||
|
"label" => "Prevent variable modification or deletion, except for super-admin"
|
||||||
|
))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ use Thelia\Model\LangQuery;
|
|||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||||
|
|
||||||
class ConfigModificationForm extends BaseDescForm
|
class ConfigModificationForm extends BaseForm
|
||||||
{
|
{
|
||||||
|
use StandardDescriptionFieldsTrait;
|
||||||
|
|
||||||
protected function buildForm()
|
protected function buildForm()
|
||||||
{
|
{
|
||||||
parent::buildForm(true);
|
|
||||||
|
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->add("id", "hidden", array(
|
->add("id", "hidden", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
@@ -44,12 +44,26 @@ class ConfigModificationForm extends BaseDescForm
|
|||||||
->add("name", "text", array(
|
->add("name", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new NotBlank()
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label" => "Name",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "name"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("value", "text", array(
|
||||||
|
"label" => "Value",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "value"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("value", "text", array())
|
|
||||||
->add("hidden", "hidden", array())
|
->add("hidden", "hidden", array())
|
||||||
->add("secured", "hidden", array())
|
->add("secured", "hidden", array(
|
||||||
|
"label" => "Prevent variable modification or deletion, except for super-admin"
|
||||||
|
))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
// Add standard description fields
|
||||||
|
$this->addStandardDescFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
|
|||||||
@@ -40,11 +40,19 @@ class MessageCreationForm extends BaseForm
|
|||||||
|
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->add("name", "text", array(
|
->add("name", "text", array(
|
||||||
"constraints" => $name_constraints
|
"constraints" => $name_constraints,
|
||||||
|
"label" => "Name *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "name"
|
||||||
|
)
|
||||||
))
|
))
|
||||||
->add("title", "text", array(
|
->add("title", "text", array(
|
||||||
"constraints" => array(
|
"constraints" => array(
|
||||||
new Constraints\NotBlank()
|
new Constraints\NotBlank()
|
||||||
|
),
|
||||||
|
"label" => "Purpose *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "purpose"
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
->add("locale", "hidden", array(
|
->add("locale", "hidden", array(
|
||||||
|
|||||||
@@ -33,13 +33,43 @@ class MessageModificationForm extends BaseForm
|
|||||||
{
|
{
|
||||||
$this->formBuilder
|
$this->formBuilder
|
||||||
->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||||
->add("name" , "text" , array("constraints" => array(new NotBlank())))
|
->add("name" , "text" , array(
|
||||||
->add("secured" , "text" , array())
|
"constraints" => array(new NotBlank()),
|
||||||
|
"label" => "Name *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "name"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("secured" , "text" , array(
|
||||||
|
"label" => "Prevent mailing template modification or deletion, except for super-admin"
|
||||||
|
))
|
||||||
->add("locale" , "text" , array())
|
->add("locale" , "text" , array())
|
||||||
->add("title" , "text" , array("constraints" => array(new NotBlank())))
|
->add("title" , "text" , array(
|
||||||
->add("subject" , "text" , array("constraints" => array(new NotBlank())))
|
"constraints" => array(new NotBlank()),
|
||||||
->add("html_message" , "text" , array())
|
"label" => "Title *",
|
||||||
->add("text_message" , "text" , array())
|
"label_attr" => array(
|
||||||
|
"for" => "title"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("subject" , "text" , array(
|
||||||
|
"constraints" => array(new NotBlank()),
|
||||||
|
"label" => "Message subject *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "subject"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("html_message" , "text" , array(
|
||||||
|
"label" => "HTML Message",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "html_message"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("text_message" , "text" , array(
|
||||||
|
"label" => "Text Message",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "text_message"
|
||||||
|
)
|
||||||
|
))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
67
core/lib/Thelia/Form/ProductCreationForm.php
Normal file
67
core/lib/Thelia/Form/ProductCreationForm.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?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\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
|
class ProductCreationForm extends BaseForm
|
||||||
|
{
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$this->formBuilder
|
||||||
|
->add("ref", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label" => "Product reference *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "ref"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("title", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label" => "Product title *",
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "title"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("parent", "integer", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("locale", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
)
|
||||||
|
))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return "thelia_product_creation";
|
||||||
|
}
|
||||||
|
}
|
||||||
92
core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
Normal file
92
core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?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\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A trait to add standard localized description fields to a form.
|
||||||
|
*
|
||||||
|
* @author Franck Allimant <franck@cqfdev.fr>
|
||||||
|
*/
|
||||||
|
trait StandardDescriptionFieldsTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Add standard description fields + locale tot the form
|
||||||
|
*
|
||||||
|
* @param array $exclude name of the fields that should not be added to the form
|
||||||
|
*/
|
||||||
|
protected function addStandardDescFields($exclude = array())
|
||||||
|
{
|
||||||
|
if (! in_array('locale', $exclude))
|
||||||
|
$this->formBuilder
|
||||||
|
->add("locale", "hidden", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! in_array('title', $exclude))
|
||||||
|
$this->formBuilder
|
||||||
|
->add("title", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Title"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "title"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! in_array('chapo', $exclude))
|
||||||
|
$this->formBuilder
|
||||||
|
->add("chapo", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Summary"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "summary"
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
if (! in_array('description', $exclude))
|
||||||
|
$this->formBuilder
|
||||||
|
->add("description", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Detailed description"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "detailed_description"
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
if (! in_array('postscriptum', $exclude))
|
||||||
|
$this->formBuilder
|
||||||
|
->add("postscriptum", "text", array(
|
||||||
|
"label" => Translator::getInstance()->trans("Conclusion"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "conclusion"
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -89,6 +89,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
*/
|
*/
|
||||||
protected $position;
|
protected $position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the full_namespace field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $full_namespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the created_at field.
|
* The value for the created_at field.
|
||||||
* @var string
|
* @var string
|
||||||
@@ -456,6 +462,17 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this->position;
|
return $this->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [full_namespace] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFullNamespace()
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->full_namespace;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [optionally formatted] temporal [created_at] column value.
|
* Get the [optionally formatted] temporal [created_at] column value.
|
||||||
*
|
*
|
||||||
@@ -601,6 +618,27 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this;
|
return $this;
|
||||||
} // setPosition()
|
} // setPosition()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [full_namespace] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return \Thelia\Model\Module The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setFullNamespace($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->full_namespace !== $v) {
|
||||||
|
$this->full_namespace = $v;
|
||||||
|
$this->modifiedColumns[] = ModuleTableMap::FULL_NAMESPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setFullNamespace()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||||
*
|
*
|
||||||
@@ -695,13 +733,16 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ModuleTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ModuleTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
$this->position = (null !== $col) ? (int) $col : null;
|
$this->position = (null !== $col) ? (int) $col : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ModuleTableMap::translateFieldName('FullNamespace', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
|
$this->full_namespace = (null !== $col) ? (string) $col : null;
|
||||||
|
|
||||||
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
if ($col === '0000-00-00 00:00:00') {
|
if ($col === '0000-00-00 00:00:00') {
|
||||||
$col = null;
|
$col = null;
|
||||||
}
|
}
|
||||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||||
|
|
||||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ModuleTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||||
if ($col === '0000-00-00 00:00:00') {
|
if ($col === '0000-00-00 00:00:00') {
|
||||||
$col = null;
|
$col = null;
|
||||||
}
|
}
|
||||||
@@ -714,7 +755,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 7; // 7 = ModuleTableMap::NUM_HYDRATE_COLUMNS.
|
return $startcol + 8; // 8 = ModuleTableMap::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating \Thelia\Model\Module object", 0, $e);
|
throw new PropelException("Error populating \Thelia\Model\Module object", 0, $e);
|
||||||
@@ -987,6 +1028,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(ModuleTableMap::POSITION)) {
|
if ($this->isColumnModified(ModuleTableMap::POSITION)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'POSITION';
|
$modifiedColumns[':p' . $index++] = 'POSITION';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = 'FULL_NAMESPACE';
|
||||||
|
}
|
||||||
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) {
|
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||||
}
|
}
|
||||||
@@ -1019,6 +1063,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
case 'POSITION':
|
case 'POSITION':
|
||||||
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
$stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
|
||||||
break;
|
break;
|
||||||
|
case 'FULL_NAMESPACE':
|
||||||
|
$stmt->bindValue($identifier, $this->full_namespace, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
case 'CREATED_AT':
|
case 'CREATED_AT':
|
||||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
@@ -1103,9 +1150,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
return $this->getPosition();
|
return $this->getPosition();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return $this->getCreatedAt();
|
return $this->getFullNamespace();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
return $this->getCreatedAt();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1142,8 +1192,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$keys[2] => $this->getType(),
|
$keys[2] => $this->getType(),
|
||||||
$keys[3] => $this->getActivate(),
|
$keys[3] => $this->getActivate(),
|
||||||
$keys[4] => $this->getPosition(),
|
$keys[4] => $this->getPosition(),
|
||||||
$keys[5] => $this->getCreatedAt(),
|
$keys[5] => $this->getFullNamespace(),
|
||||||
$keys[6] => $this->getUpdatedAt(),
|
$keys[6] => $this->getCreatedAt(),
|
||||||
|
$keys[7] => $this->getUpdatedAt(),
|
||||||
);
|
);
|
||||||
$virtualColumns = $this->virtualColumns;
|
$virtualColumns = $this->virtualColumns;
|
||||||
foreach($virtualColumns as $key => $virtualColumn)
|
foreach($virtualColumns as $key => $virtualColumn)
|
||||||
@@ -1208,9 +1259,12 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->setPosition($value);
|
$this->setPosition($value);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
$this->setCreatedAt($value);
|
$this->setFullNamespace($value);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
$this->setCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
@@ -1242,8 +1296,9 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
|
||||||
if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]);
|
if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]);
|
||||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setFullNamespace($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
if (array_key_exists($keys[6], $arr)) $this->setCreatedAt($arr[$keys[6]]);
|
||||||
|
if (array_key_exists($keys[7], $arr)) $this->setUpdatedAt($arr[$keys[7]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1260,6 +1315,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
if ($this->isColumnModified(ModuleTableMap::TYPE)) $criteria->add(ModuleTableMap::TYPE, $this->type);
|
if ($this->isColumnModified(ModuleTableMap::TYPE)) $criteria->add(ModuleTableMap::TYPE, $this->type);
|
||||||
if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) $criteria->add(ModuleTableMap::ACTIVATE, $this->activate);
|
if ($this->isColumnModified(ModuleTableMap::ACTIVATE)) $criteria->add(ModuleTableMap::ACTIVATE, $this->activate);
|
||||||
if ($this->isColumnModified(ModuleTableMap::POSITION)) $criteria->add(ModuleTableMap::POSITION, $this->position);
|
if ($this->isColumnModified(ModuleTableMap::POSITION)) $criteria->add(ModuleTableMap::POSITION, $this->position);
|
||||||
|
if ($this->isColumnModified(ModuleTableMap::FULL_NAMESPACE)) $criteria->add(ModuleTableMap::FULL_NAMESPACE, $this->full_namespace);
|
||||||
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) $criteria->add(ModuleTableMap::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(ModuleTableMap::CREATED_AT)) $criteria->add(ModuleTableMap::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) $criteria->add(ModuleTableMap::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(ModuleTableMap::UPDATED_AT)) $criteria->add(ModuleTableMap::UPDATED_AT, $this->updated_at);
|
||||||
|
|
||||||
@@ -1329,6 +1385,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$copyObj->setType($this->getType());
|
$copyObj->setType($this->getType());
|
||||||
$copyObj->setActivate($this->getActivate());
|
$copyObj->setActivate($this->getActivate());
|
||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
|
$copyObj->setFullNamespace($this->getFullNamespace());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
|
||||||
@@ -1876,6 +1933,7 @@ abstract class Module implements ActiveRecordInterface
|
|||||||
$this->type = null;
|
$this->type = null;
|
||||||
$this->activate = null;
|
$this->activate = null;
|
||||||
$this->position = null;
|
$this->position = null;
|
||||||
|
$this->full_namespace = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModuleQuery orderByType($order = Criteria::ASC) Order by the type column
|
* @method ChildModuleQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||||
* @method ChildModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column
|
* @method ChildModuleQuery orderByActivate($order = Criteria::ASC) Order by the activate column
|
||||||
* @method ChildModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
* @method ChildModuleQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method ChildModuleQuery orderByFullNamespace($order = Criteria::ASC) Order by the full_namespace column
|
||||||
* @method ChildModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method ChildModuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method ChildModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method ChildModuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -35,6 +36,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModuleQuery groupByType() Group by the type column
|
* @method ChildModuleQuery groupByType() Group by the type column
|
||||||
* @method ChildModuleQuery groupByActivate() Group by the activate column
|
* @method ChildModuleQuery groupByActivate() Group by the activate column
|
||||||
* @method ChildModuleQuery groupByPosition() Group by the position column
|
* @method ChildModuleQuery groupByPosition() Group by the position column
|
||||||
|
* @method ChildModuleQuery groupByFullNamespace() Group by the full_namespace column
|
||||||
* @method ChildModuleQuery groupByCreatedAt() Group by the created_at column
|
* @method ChildModuleQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method ChildModuleQuery groupByUpdatedAt() Group by the updated_at column
|
* @method ChildModuleQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -58,6 +60,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method ChildModule findOneByType(int $type) Return the first ChildModule filtered by the type column
|
* @method ChildModule findOneByType(int $type) Return the first ChildModule filtered by the type column
|
||||||
* @method ChildModule findOneByActivate(int $activate) Return the first ChildModule filtered by the activate column
|
* @method ChildModule findOneByActivate(int $activate) Return the first ChildModule filtered by the activate column
|
||||||
* @method ChildModule findOneByPosition(int $position) Return the first ChildModule filtered by the position column
|
* @method ChildModule findOneByPosition(int $position) Return the first ChildModule filtered by the position column
|
||||||
|
* @method ChildModule findOneByFullNamespace(string $full_namespace) Return the first ChildModule filtered by the full_namespace column
|
||||||
* @method ChildModule findOneByCreatedAt(string $created_at) Return the first ChildModule filtered by the created_at column
|
* @method ChildModule findOneByCreatedAt(string $created_at) Return the first ChildModule filtered by the created_at column
|
||||||
* @method ChildModule findOneByUpdatedAt(string $updated_at) Return the first ChildModule filtered by the updated_at column
|
* @method ChildModule findOneByUpdatedAt(string $updated_at) Return the first ChildModule filtered by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -66,6 +69,7 @@ use Thelia\Model\Map\ModuleTableMap;
|
|||||||
* @method array findByType(int $type) Return ChildModule objects filtered by the type column
|
* @method array findByType(int $type) Return ChildModule objects filtered by the type column
|
||||||
* @method array findByActivate(int $activate) Return ChildModule objects filtered by the activate column
|
* @method array findByActivate(int $activate) Return ChildModule objects filtered by the activate column
|
||||||
* @method array findByPosition(int $position) Return ChildModule objects filtered by the position column
|
* @method array findByPosition(int $position) Return ChildModule objects filtered by the position column
|
||||||
|
* @method array findByFullNamespace(string $full_namespace) Return ChildModule objects filtered by the full_namespace column
|
||||||
* @method array findByCreatedAt(string $created_at) Return ChildModule objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return ChildModule objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return ChildModule objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return ChildModule objects filtered by the updated_at column
|
||||||
*
|
*
|
||||||
@@ -156,7 +160,7 @@ abstract class ModuleQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0';
|
$sql = 'SELECT ID, CODE, TYPE, ACTIVATE, POSITION, FULL_NAMESPACE, CREATED_AT, UPDATED_AT FROM module WHERE ID = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -438,6 +442,35 @@ abstract class ModuleQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(ModuleTableMap::POSITION, $position, $comparison);
|
return $this->addUsingAlias(ModuleTableMap::POSITION, $position, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the full_namespace column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByFullNamespace('fooValue'); // WHERE full_namespace = 'fooValue'
|
||||||
|
* $query->filterByFullNamespace('%fooValue%'); // WHERE full_namespace LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $fullNamespace The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ChildModuleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByFullNamespace($fullNamespace = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($fullNamespace)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $fullNamespace)) {
|
||||||
|
$fullNamespace = str_replace('*', '%', $fullNamespace);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ModuleTableMap::FULL_NAMESPACE, $fullNamespace, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query on the created_at column
|
* Filter the query on the created_at column
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class ModuleTableMap extends TableMap
|
|||||||
/**
|
/**
|
||||||
* The total number of columns
|
* The total number of columns
|
||||||
*/
|
*/
|
||||||
const NUM_COLUMNS = 7;
|
const NUM_COLUMNS = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of lazy-loaded columns
|
* The number of lazy-loaded columns
|
||||||
@@ -67,7 +67,7 @@ class ModuleTableMap extends TableMap
|
|||||||
/**
|
/**
|
||||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||||
*/
|
*/
|
||||||
const NUM_HYDRATE_COLUMNS = 7;
|
const NUM_HYDRATE_COLUMNS = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the ID field
|
* the column name for the ID field
|
||||||
@@ -94,6 +94,11 @@ class ModuleTableMap extends TableMap
|
|||||||
*/
|
*/
|
||||||
const POSITION = 'module.POSITION';
|
const POSITION = 'module.POSITION';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the column name for the FULL_NAMESPACE field
|
||||||
|
*/
|
||||||
|
const FULL_NAMESPACE = 'module.FULL_NAMESPACE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the column name for the CREATED_AT field
|
* the column name for the CREATED_AT field
|
||||||
*/
|
*/
|
||||||
@@ -125,12 +130,12 @@ class ModuleTableMap extends TableMap
|
|||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
self::TYPE_PHPNAME => array('Id', 'Code', 'Type', 'Activate', 'Position', 'FullNamespace', 'CreatedAt', 'UpdatedAt', ),
|
||||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'createdAt', 'updatedAt', ),
|
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', 'activate', 'position', 'fullNamespace', 'createdAt', 'updatedAt', ),
|
||||||
self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
|
self::TYPE_COLNAME => array(ModuleTableMap::ID, ModuleTableMap::CODE, ModuleTableMap::TYPE, ModuleTableMap::ACTIVATE, ModuleTableMap::POSITION, ModuleTableMap::FULL_NAMESPACE, ModuleTableMap::CREATED_AT, ModuleTableMap::UPDATED_AT, ),
|
||||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', 'ACTIVATE', 'POSITION', 'FULL_NAMESPACE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'created_at', 'updated_at', ),
|
self::TYPE_FIELDNAME => array('id', 'code', 'type', 'activate', 'position', 'full_namespace', 'created_at', 'updated_at', ),
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,12 +145,12 @@ class ModuleTableMap extends TableMap
|
|||||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
self::TYPE_PHPNAME => array('Id' => 0, 'Code' => 1, 'Type' => 2, 'Activate' => 3, 'Position' => 4, 'FullNamespace' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
|
||||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'fullNamespace' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
|
||||||
self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::CREATED_AT => 5, ModuleTableMap::UPDATED_AT => 6, ),
|
self::TYPE_COLNAME => array(ModuleTableMap::ID => 0, ModuleTableMap::CODE => 1, ModuleTableMap::TYPE => 2, ModuleTableMap::ACTIVATE => 3, ModuleTableMap::POSITION => 4, ModuleTableMap::FULL_NAMESPACE => 5, ModuleTableMap::CREATED_AT => 6, ModuleTableMap::UPDATED_AT => 7, ),
|
||||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, 'ACTIVATE' => 3, 'POSITION' => 4, 'FULL_NAMESPACE' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
|
||||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 2, 'activate' => 3, 'position' => 4, 'full_namespace' => 5, 'created_at' => 6, 'updated_at' => 7, ),
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,6 +174,7 @@ class ModuleTableMap extends TableMap
|
|||||||
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
|
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
|
||||||
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
|
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
|
||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||||
|
$this->addColumn('FULL_NAMESPACE', 'FullNamespace', 'VARCHAR', false, 255, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
} // initialize()
|
} // initialize()
|
||||||
@@ -349,6 +355,7 @@ class ModuleTableMap extends TableMap
|
|||||||
$criteria->addSelectColumn(ModuleTableMap::TYPE);
|
$criteria->addSelectColumn(ModuleTableMap::TYPE);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
|
$criteria->addSelectColumn(ModuleTableMap::ACTIVATE);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::POSITION);
|
$criteria->addSelectColumn(ModuleTableMap::POSITION);
|
||||||
|
$criteria->addSelectColumn(ModuleTableMap::FULL_NAMESPACE);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
|
$criteria->addSelectColumn(ModuleTableMap::CREATED_AT);
|
||||||
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
|
$criteria->addSelectColumn(ModuleTableMap::UPDATED_AT);
|
||||||
} else {
|
} else {
|
||||||
@@ -357,6 +364,7 @@ class ModuleTableMap extends TableMap
|
|||||||
$criteria->addSelectColumn($alias . '.TYPE');
|
$criteria->addSelectColumn($alias . '.TYPE');
|
||||||
$criteria->addSelectColumn($alias . '.ACTIVATE');
|
$criteria->addSelectColumn($alias . '.ACTIVATE');
|
||||||
$criteria->addSelectColumn($alias . '.POSITION');
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
|
$criteria->addSelectColumn($alias . '.FULL_NAMESPACE');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class ModelCriteriaTools
|
|||||||
$localeSearch = LangQuery::create()->findOneById($requestedLangId);
|
$localeSearch = LangQuery::create()->findOneById($requestedLangId);
|
||||||
|
|
||||||
if ($localeSearch === null) {
|
if ($localeSearch === null) {
|
||||||
throw new \InvalidArgumentException(sprintf('Incorrect lang argument given in attribute loop: lang ID %d not found', $requestedLangId));
|
throw new \InvalidArgumentException(sprintf('Incorrect lang argument given : lang ID %d not found', $requestedLangId));
|
||||||
}
|
}
|
||||||
|
|
||||||
$locale = $localeSearch->getLocale();
|
$locale = $localeSearch->getLocale();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ trait PositionManagementTrait {
|
|||||||
->orderByPosition(Criteria::DESC)
|
->orderByPosition(Criteria::DESC)
|
||||||
->limit(1);
|
->limit(1);
|
||||||
|
|
||||||
if ($parent !== null) $last->filterByParent($parent);
|
if ($parent !== null) $query->filterByParent($parent);
|
||||||
|
|
||||||
$last = $query->findOne()
|
$last = $query->findOne()
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
namespace Thelia\Module;
|
namespace Thelia\Module;
|
||||||
|
|
||||||
abstract class BaseModule
|
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||||
|
|
||||||
|
abstract class BaseModule extends ContainerAware
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -37,6 +39,19 @@ abstract class BaseModule
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasContainer()
|
||||||
|
{
|
||||||
|
return null === $this->container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContainer()
|
||||||
|
{
|
||||||
|
if($this->hasContainer() === false) {
|
||||||
|
throw new \RuntimeException("Sorry, container his not available in this context");
|
||||||
|
}
|
||||||
|
return $this->container;
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function install();
|
abstract public function install();
|
||||||
abstract public function destroy();
|
abstract public function destroy();
|
||||||
|
|
||||||
|
|||||||
37
core/lib/Thelia/Module/BaseModuleInterface.php
Normal file
37
core/lib/Thelia/Module/BaseModuleInterface.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?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\Module;
|
||||||
|
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
interface BaseModuleInterface {
|
||||||
|
|
||||||
|
public function setRequest(Request $request);
|
||||||
|
public function getRequest();
|
||||||
|
|
||||||
|
public function setDispatcher(EventDispatcherInterface $dispatcher);
|
||||||
|
public function getDispatcher();
|
||||||
|
}
|
||||||
36
core/lib/Thelia/Module/DeliveryModuleInterface.php
Normal file
36
core/lib/Thelia/Module/DeliveryModuleInterface.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?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\Module;
|
||||||
|
|
||||||
|
|
||||||
|
interface DeliveryModuleInterface extends BaseModuleInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* calculate and return delivery price
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function calculate($country = null);
|
||||||
|
}
|
||||||
66
core/lib/Thelia/Tools/DateTimeFormat.php
Executable file
66
core/lib/Thelia/Tools/DateTimeFormat.php
Executable file
@@ -0,0 +1,66 @@
|
|||||||
|
<?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\Tools;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
|
class DateTimeFormat
|
||||||
|
{
|
||||||
|
protected $request;
|
||||||
|
|
||||||
|
public function __construct(Request $request)
|
||||||
|
{
|
||||||
|
$this->request = $request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance(Request $request)
|
||||||
|
{
|
||||||
|
return new DateTimeFormat($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormat($output = null)
|
||||||
|
{
|
||||||
|
$lang = $this->request->getSession()->getLang();
|
||||||
|
|
||||||
|
$format = null;
|
||||||
|
|
||||||
|
if($lang) {
|
||||||
|
switch ($output) {
|
||||||
|
case "date" :
|
||||||
|
$format = $lang->getDateFormat();
|
||||||
|
break;
|
||||||
|
case "time" :
|
||||||
|
$format = $lang->getTimeFormat();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case "datetime" :
|
||||||
|
$format = $lang->getDateTimeFormat();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $format;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,9 @@ INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updat
|
|||||||
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
|
('currency_rate_update_url', 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml', 0, 0, NOW(), NOW()),
|
||||||
('page_not_found_view', '404.html', 0, 0, NOW(), NOW());
|
('page_not_found_view', '404.html', 0, 0, NOW(), NOW());
|
||||||
|
|
||||||
INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
|
|
||||||
|
INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
|
||||||
|
(1, 'DebugBar', 1, 1, 1, 'DebugBar\\DebugBar', NOW(), NOW());
|
||||||
|
|
||||||
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
|
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES
|
||||||
(1, 1, 1, NOW(), NOW()),
|
(1, 1, 1, NOW(), NOW()),
|
||||||
|
|||||||
@@ -803,6 +803,7 @@ CREATE TABLE `module`
|
|||||||
`type` TINYINT NOT NULL,
|
`type` TINYINT NOT NULL,
|
||||||
`activate` TINYINT,
|
`activate` TINYINT,
|
||||||
`position` INTEGER,
|
`position` INTEGER,
|
||||||
|
`full_namespace` VARCHAR(255),
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
|||||||
@@ -605,6 +605,7 @@
|
|||||||
<column name="description" type="CLOB" />
|
<column name="description" type="CLOB" />
|
||||||
<column name="chapo" type="LONGVARCHAR" />
|
<column name="chapo" type="LONGVARCHAR" />
|
||||||
<column name="postscriptum" type="LONGVARCHAR" />
|
<column name="postscriptum" type="LONGVARCHAR" />
|
||||||
|
<column name="full_namespace" size="255" type="VARCHAR" />
|
||||||
<unique name="code_UNIQUE">
|
<unique name="code_UNIQUE">
|
||||||
<unique-column name="code" />
|
<unique-column name="code" />
|
||||||
</unique>
|
</unique>
|
||||||
|
|||||||
83
local/modules/Colissimo/Colissimo.php
Normal file
83
local/modules/Colissimo/Colissimo.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?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 Colissimo;
|
||||||
|
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Thelia\Module\BaseModule;
|
||||||
|
use Thelia\Module\DeliveryModuleInterface;
|
||||||
|
|
||||||
|
class Colissimo extends BaseModule implements DeliveryModuleInterface
|
||||||
|
{
|
||||||
|
protected $request;
|
||||||
|
protected $dispatcher;
|
||||||
|
|
||||||
|
public function setRequest(Request $request)
|
||||||
|
{
|
||||||
|
$this->request = $request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequest()
|
||||||
|
{
|
||||||
|
return $this->request;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||||
|
{
|
||||||
|
$this->dispatcher = $dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDispatcher()
|
||||||
|
{
|
||||||
|
return $this->dispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* calculate and return delivery price
|
||||||
|
*
|
||||||
|
* @param null $country
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function calculate($country = null)
|
||||||
|
{
|
||||||
|
// TODO: Implement calculate() method.
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
||||||
|
* Like install and destroy
|
||||||
|
*/
|
||||||
|
public function install()
|
||||||
|
{
|
||||||
|
// TODO: Implement install() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy()
|
||||||
|
{
|
||||||
|
// TODO: Implement destroy() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
36
local/modules/Colissimo/Config/config.xml
Normal file
36
local/modules/Colissimo/Config/config.xml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<config xmlns="http://thelia.net/schema/dic/config"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||||
|
|
||||||
|
<loops>
|
||||||
|
<!-- sample definition
|
||||||
|
<loop name="MySuperLoop" class="MyModule\Loop\MySuperLoop" />
|
||||||
|
-->
|
||||||
|
</loops>
|
||||||
|
|
||||||
|
<forms>
|
||||||
|
<!--
|
||||||
|
<form name="MyFormName" class="MyModule\Form\MySuperForm" />
|
||||||
|
-->
|
||||||
|
</forms>
|
||||||
|
|
||||||
|
<commands>
|
||||||
|
<!--
|
||||||
|
<command class="MyModule\Command\MySuperCommand" />
|
||||||
|
-->
|
||||||
|
</commands>
|
||||||
|
|
||||||
|
<templateDirectives>
|
||||||
|
<!-- Sample definition
|
||||||
|
<templateDirectives class="MyModule\Directive\MyTemplateDirective" name="my_filter"/>
|
||||||
|
-->
|
||||||
|
</templateDirectives>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<services>
|
||||||
|
|
||||||
|
</services>
|
||||||
|
-->
|
||||||
|
</config>
|
||||||
0
local/modules/Colissimo/Config/plugin.xml
Normal file
0
local/modules/Colissimo/Config/plugin.xml
Normal file
7
local/modules/Colissimo/Config/schema.xml
Normal file
7
local/modules/Colissimo/Config/schema.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<database defaultIdMethod="native" name="thelia" namespace="Colissimo\Model">
|
||||||
|
<!--
|
||||||
|
See propel documentation on http://propelorm.org for all information about schema file
|
||||||
|
-->
|
||||||
|
<external-schema filename="/home/manu/dev/www/thelia/local/config/schema.xml" referenceOnly="true" />
|
||||||
|
</database>
|
||||||
48
local/modules/DebugBar/Config/config.xml
Normal file
48
local/modules/DebugBar/Config/config.xml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<config xmlns="http://thelia.net/schema/dic/config"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||||
|
|
||||||
|
<loops>
|
||||||
|
<!-- sample definition
|
||||||
|
<loop name="MySuperLoop" class="MyModule\Loop\MySuperLoop" />
|
||||||
|
-->
|
||||||
|
</loops>
|
||||||
|
|
||||||
|
<forms>
|
||||||
|
<!--
|
||||||
|
<form name="MyFormName" class="MyModule\Form\MySuperForm" />
|
||||||
|
-->
|
||||||
|
</forms>
|
||||||
|
|
||||||
|
<commands>
|
||||||
|
<!--
|
||||||
|
<command class="MyModule\Command\MySuperCommand" />
|
||||||
|
-->
|
||||||
|
</commands>
|
||||||
|
|
||||||
|
<templateDirectives>
|
||||||
|
<!-- Sample definition
|
||||||
|
<templateDirectives class="MyModule\Directive\MyTemplateDirective" name="my_filter"/>
|
||||||
|
-->
|
||||||
|
</templateDirectives>
|
||||||
|
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service id="debugBar" class="DebugBar\StandardDebugBar"/>
|
||||||
|
|
||||||
|
<service id="smarty.debugbar" class="DebugBar\Smarty\Plugin\DebugBar">
|
||||||
|
<argument type="service" id="debugBar"/>
|
||||||
|
<argument >%kernel.debug%</argument>
|
||||||
|
<tag name="thelia.parser.register_plugin"/>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service id="debugBar.listener" class="DebugBar\Listeners\DebugBarListeners">
|
||||||
|
<argument type="service" id="service_container"/>
|
||||||
|
<tag name="kernel.event_subscriber"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
|
||||||
|
</config>
|
||||||
0
local/modules/DebugBar/Config/plugin.xml
Normal file
0
local/modules/DebugBar/Config/plugin.xml
Normal file
7
local/modules/DebugBar/Config/schema.xml
Normal file
7
local/modules/DebugBar/Config/schema.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<database defaultIdMethod="native" name="thelia" namespace="DebugBar\Model">
|
||||||
|
<!--
|
||||||
|
See propel documentation on http://propelorm.org for all information about schema file
|
||||||
|
-->
|
||||||
|
<external-schema filename="/home/manu/dev/www/thelia/local/config/schema.xml" referenceOnly="true" />
|
||||||
|
</database>
|
||||||
236
local/modules/DebugBar/DataCollector/PropelCollector.php
Normal file
236
local/modules/DebugBar/DataCollector/PropelCollector.php
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
<?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 DebugBar\DataCollector;
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PropelCollector
|
||||||
|
* @package DebugBar\DataCollector
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class PropelCollector extends DataCollector implements Renderable, LoggerInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $statements = array();
|
||||||
|
|
||||||
|
protected $accumulatedTime = 0;
|
||||||
|
|
||||||
|
protected $peakMemory = 0;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$serviceContainer = Propel::getServiceContainer();
|
||||||
|
$serviceContainer->setLogger('defaultLogger', $this);
|
||||||
|
|
||||||
|
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||||
|
$con->setLogMethods(array(
|
||||||
|
'exec',
|
||||||
|
'query',
|
||||||
|
'execute', // these first three are the default
|
||||||
|
'beginTransaction',
|
||||||
|
'commit',
|
||||||
|
'rollBack',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the DebugBar when data needs to be collected
|
||||||
|
*
|
||||||
|
* @return array Collected data
|
||||||
|
*/
|
||||||
|
function collect()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'nb_statements' => count($this->statements),
|
||||||
|
'nb_failed_statements' => 0,
|
||||||
|
'accumulated_duration' => '10',
|
||||||
|
'accumulated_duration_str' => $this->formatDuration(1),
|
||||||
|
'peak_memory_usage' => $this->peakMemory,
|
||||||
|
'peak_memory_usage_str' => $this->formatBytes($this->peakMemory),
|
||||||
|
'statements' => $this->statements
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the unique name of the collector
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return 'propel';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a hash where keys are control names and their values
|
||||||
|
* an array of options as defined in {@see DebugBar\JavascriptRenderer::addControl()}
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getWidgets()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
"propel" => array(
|
||||||
|
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
|
||||||
|
"map" => "propel",
|
||||||
|
"default" => "[]"
|
||||||
|
),
|
||||||
|
"propel:badge" => array(
|
||||||
|
"map" => "propel.nb_statements",
|
||||||
|
"default" => 0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function log($level, $message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->statements[] = array(
|
||||||
|
'sql' => $message,
|
||||||
|
'is_success' => true,
|
||||||
|
'duration' => 0,
|
||||||
|
'duration_str' => $this->formatDuration(1),
|
||||||
|
'memory' => 1,
|
||||||
|
'memory_str' => $this->formatBytes(1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System is unusable.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function emergency($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action must be taken immediately.
|
||||||
|
*
|
||||||
|
* Example: Entire website down, database unavailable, etc. This should
|
||||||
|
* trigger the SMS alerts and wake you up.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function alert($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Critical conditions.
|
||||||
|
*
|
||||||
|
* Example: Application component unavailable, unexpected exception.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function critical($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime errors that do not require immediate action but should typically
|
||||||
|
* be logged and monitored.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function error($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional occurrences that are not errors.
|
||||||
|
*
|
||||||
|
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||||
|
* that are not necessarily wrong.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function warning($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normal but significant events.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function notice($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interesting events.
|
||||||
|
*
|
||||||
|
* Example: User logs in, SQL logs.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function info($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detailed debug information.
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function debug($message, array $context = array())
|
||||||
|
{
|
||||||
|
$this->log(null, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
26
core/lib/Thelia/Form/CategoryDeletionForm.php → local/modules/DebugBar/DebugBar.php
Executable file → Normal file
26
core/lib/Thelia/Form/CategoryDeletionForm.php → local/modules/DebugBar/DebugBar.php
Executable file → Normal file
@@ -20,25 +20,25 @@
|
|||||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
/* */
|
/* */
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
namespace Thelia\Form;
|
|
||||||
|
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
namespace DebugBar;
|
||||||
|
|
||||||
class CategoryDeletionForm extends BaseForm
|
use Thelia\Module\BaseModule;
|
||||||
|
|
||||||
|
class DebugBar extends BaseModule
|
||||||
{
|
{
|
||||||
protected function buildForm()
|
/**
|
||||||
|
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
|
||||||
|
* Like install and destroy
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function install()
|
||||||
{
|
{
|
||||||
$this->formBuilder
|
// TODO: Implement install() method.
|
||||||
->add("category_id", "integer", array(
|
|
||||||
"constraints" => array(
|
|
||||||
new NotBlank()
|
|
||||||
)
|
|
||||||
))
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function destroy()
|
||||||
{
|
{
|
||||||
return "thelia_category_deletion";
|
// TODO: Implement destroy() method.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
72
local/modules/DebugBar/Listeners/DebugBarListeners.php
Normal file
72
local/modules/DebugBar/Listeners/DebugBarListeners.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?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 DebugBar\Listeners;
|
||||||
|
use DebugBar\DataCollector\PropelCollector;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
|
use Thelia\Action\BaseAction;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DebugBarListeners
|
||||||
|
* @package DebugBar\Listeners
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class DebugBarListeners extends BaseAction implements EventSubscriberInterface {
|
||||||
|
|
||||||
|
public function initDebugBar()
|
||||||
|
{
|
||||||
|
$debugBar = $this->container->get("debugBar");
|
||||||
|
|
||||||
|
$debugBar->addCollector(new PropelCollector());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of event names this subscriber wants to listen to.
|
||||||
|
*
|
||||||
|
* The array keys are event names and the value can be:
|
||||||
|
*
|
||||||
|
* * The method name to call (priority defaults to 0)
|
||||||
|
* * An array composed of the method name to call and the priority
|
||||||
|
* * An array of arrays composed of the method names to call and respective
|
||||||
|
* priorities, or 0 if unset
|
||||||
|
*
|
||||||
|
* For instance:
|
||||||
|
*
|
||||||
|
* * array('eventName' => 'methodName')
|
||||||
|
* * array('eventName' => array('methodName', $priority))
|
||||||
|
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||||
|
*
|
||||||
|
* @return array The event names to listen to
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
TheliaEvents::BOOT => array("initDebugBar", 128)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
82
local/modules/DebugBar/Smarty/Plugin/DebugBar.php
Normal file
82
local/modules/DebugBar/Smarty/Plugin/DebugBar.php
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
<?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 DebugBar\Smarty\Plugin;
|
||||||
|
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||||
|
use Thelia\Core\Template\Smarty\an;
|
||||||
|
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||||
|
use DebugBar\DebugBar as BaseDebugBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DebugBar
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class DebugBar extends AbstractSmartyPlugin
|
||||||
|
{
|
||||||
|
protected $debugBar;
|
||||||
|
protected $debugMode;
|
||||||
|
|
||||||
|
public function __construct(BaseDebugBar $debugbar, $debugMode)
|
||||||
|
{
|
||||||
|
$this->debugBar = $debugbar;
|
||||||
|
$this->debugMode = $debugMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render($params, \Smarty_Internal_Template $template)
|
||||||
|
{
|
||||||
|
$render = "";
|
||||||
|
if ($this->debugMode) {
|
||||||
|
$render = $this->debugBar->getJavascriptRenderer()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $render;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderHead($params, \Smarty_Internal_Template $template)
|
||||||
|
{
|
||||||
|
$render = "";
|
||||||
|
if ($this->debugMode) {
|
||||||
|
$javascriptRenderer = $this->debugBar->getJavascriptRenderer();
|
||||||
|
$assets = $javascriptRenderer->getAsseticCollection();
|
||||||
|
|
||||||
|
$cssCollection = $assets[0];
|
||||||
|
$jsCollection = $assets[1];
|
||||||
|
|
||||||
|
$render .= sprintf('<style media="screen" type="text/css">%s</style>', $cssCollection->dump());
|
||||||
|
$render .= sprintf('<script>%s</script>', $jsCollection->dump());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $render;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return an array of SmartyPluginDescriptor
|
||||||
|
*/
|
||||||
|
public function getPluginDescriptors()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
new SmartyPluginDescriptor("function", "debugbar_renderHead", $this, "renderHead"),
|
||||||
|
new SmartyPluginDescriptor("function", "debugbar_render", $this, "render")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,11 +18,13 @@
|
|||||||
{* -- Bootstrap CSS section --------------------------------------------- *}
|
{* -- Bootstrap CSS section --------------------------------------------- *}
|
||||||
|
|
||||||
{block name="before-bootstrap-css"}{/block}
|
{block name="before-bootstrap-css"}{/block}
|
||||||
|
|
||||||
{stylesheets file='assets/less/*' filters='less,cssembed'}
|
{stylesheets file='assets/less/*' filters='less,cssembed'}
|
||||||
<link rel="stylesheet" href="{$asset_url}">
|
<link rel="stylesheet" href="{$asset_url}">
|
||||||
{/stylesheets}
|
{/stylesheets}
|
||||||
|
|
||||||
|
{debugbar_renderHead}
|
||||||
|
|
||||||
{block name="after-bootstrap-css"}{/block}
|
{block name="after-bootstrap-css"}{/block}
|
||||||
|
|
||||||
{* -- Admin CSS section ------------------------------------------------- *}
|
{* -- Admin CSS section ------------------------------------------------- *}
|
||||||
@@ -47,15 +49,15 @@
|
|||||||
|
|
||||||
<div class="topbar">
|
<div class="topbar">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="version-info">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
|
<div class="version-info">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{module_include location='inside_topbar'}
|
{module_include location='inside_topbar'}
|
||||||
|
|
||||||
<div class="col-md-6 clearfix">
|
<div class="col-md-6 clearfix">
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<a href="{navigate to="index"}" title="{intl l='View site'}" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> {intl l="View shop"}</a>
|
<a href="{navigate to="index"}" title="{intl l='View site'}" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> {intl l="View shop"}</a>
|
||||||
@@ -64,14 +66,14 @@
|
|||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="profile" href="{url path='admin/edit_profile'}"><span class="glyphicon glyphicon-edit"></span> {intl l="Profil"}</a></li>
|
<li><a class="profile" href="{url path='admin/edit_profile'}"><span class="glyphicon glyphicon-edit"></span> {intl l="Profil"}</a></li>
|
||||||
<li><a class="logout" href="{url path='admin/logout'}" title="{intl l='Close administation session'}"><span class="glyphicon glyphicon-off"></span> {intl l="Logout"}</a></li>
|
<li><a class="logout" href="{url path='admin/logout'}" title="{intl l='Close administation session'}"><span class="glyphicon glyphicon-off"></span> {intl l="Logout"}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -82,7 +84,7 @@
|
|||||||
{module_include location='before_top_menu'}
|
{module_include location='before_top_menu'}
|
||||||
|
|
||||||
<nav class="navbar navbar-default" role="navigation">
|
<nav class="navbar navbar-default" role="navigation">
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
@@ -91,7 +93,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="collapse navbar-collapse navbar-collapse">
|
<div class="collapse navbar-collapse navbar-collapse">
|
||||||
@@ -164,6 +166,15 @@
|
|||||||
{/loop}
|
{/loop}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
{loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"}
|
||||||
|
<form class="navbar-form pull-right" action="{url path='/admin/search'}">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" id="search_term" name="search_term" placeholder="{intl l='Search'}">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
|
||||||
|
</form>
|
||||||
|
{/loop}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -215,7 +226,7 @@
|
|||||||
{block name="after-javascript-include"}{/block}
|
{block name="after-javascript-include"}{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}{/block}
|
{block name="javascript-initialization"}{/block}
|
||||||
|
{debugbar_render}
|
||||||
{* Modules scripts are included now *}
|
{* Modules scripts are included now *}
|
||||||
{module_include location='footer_js'}
|
{module_include location='footer_js'}
|
||||||
|
|
||||||
|
|||||||
@@ -49,4 +49,5 @@
|
|||||||
// Forms
|
// Forms
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
@input-border-focus: @brand-primary;
|
|
||||||
|
@input-border-focus: @link-color;
|
||||||
@@ -8,9 +8,7 @@
|
|||||||
<div class="catalog">
|
<div class="catalog">
|
||||||
<div id="wrapper" class="container">
|
<div id="wrapper" class="container">
|
||||||
|
|
||||||
<ul class="breadcrumb">
|
{include file="includes/catalog-breadcrumb.html"}
|
||||||
{include file="includes/category_breadcrumb.html"}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{module_include location='catalog_top'}
|
{module_include location='catalog_top'}
|
||||||
|
|
||||||
@@ -20,7 +18,7 @@
|
|||||||
<table class="table table-striped table-condensed" id="category_list">
|
<table class="table table-striped table-condensed" id="category_list">
|
||||||
<caption>
|
<caption>
|
||||||
{* display parent category name, and get current cat ID *}
|
{* display parent category name, and get current cat ID *}
|
||||||
{loop name="category_title" type="category" visible="*" id="{$current_category_id}"}
|
{loop name="category_title" type="category" visible="*" id=$current_category_id}
|
||||||
{intl l="Categories in %cat" cat=$TITLE}
|
{intl l="Categories in %cat" cat=$TITLE}
|
||||||
{$cat_id = $ID}
|
{$cat_id = $ID}
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -30,7 +28,7 @@
|
|||||||
|
|
||||||
{module_include location='category_list_caption'}
|
{module_include location='category_list_caption'}
|
||||||
|
|
||||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.category.create"}
|
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.categories.create"}
|
||||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new category'}" href="#add_category_dialog" data-toggle="modal">
|
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new category'}" href="#add_category_dialog" data-toggle="modal">
|
||||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||||
</a>
|
</a>
|
||||||
@@ -40,6 +38,16 @@
|
|||||||
{ifloop rel="category_list"}
|
{ifloop rel="category_list"}
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th class="object-title">
|
||||||
|
{admin_sortable_header
|
||||||
|
current_order=$category_order
|
||||||
|
order='id'
|
||||||
|
reverse_order='id_reverse'
|
||||||
|
path={url path='/admin/catalog' id_category=$current_category_id}
|
||||||
|
label="{intl l='ID'}"
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
|
||||||
<th class="object-image"> </th>
|
<th class="object-image"> </th>
|
||||||
|
|
||||||
<th class="object-title">
|
<th class="object-title">
|
||||||
@@ -47,8 +55,8 @@
|
|||||||
current_order=$category_order
|
current_order=$category_order
|
||||||
order='alpha'
|
order='alpha'
|
||||||
reverse_order='alpha_reverse'
|
reverse_order='alpha_reverse'
|
||||||
path={url path='/admin/catalog/category' id="{$current_category_id}"}
|
path={url path='/admin/catalog' id_category=$current_category_id}
|
||||||
label={intl l='Category title'}
|
label="{intl l='Category title'}"
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@@ -59,8 +67,8 @@
|
|||||||
current_order=$category_order
|
current_order=$category_order
|
||||||
order='visible'
|
order='visible'
|
||||||
reverse_order='visible_reverse'
|
reverse_order='visible_reverse'
|
||||||
path={url path='/admin/catalog/category' id="{$current_category_id}"}
|
path={url path='/admin/catalog' id_category=$current_category_id}
|
||||||
label={intl l='Online'}
|
label="{intl l='Online'}"
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@@ -69,8 +77,8 @@
|
|||||||
current_order=$category_order
|
current_order=$category_order
|
||||||
order='manual'
|
order='manual'
|
||||||
reverse_order='manual_reverse'
|
reverse_order='manual_reverse'
|
||||||
path={url path='/admin/catalog/category' id="{$current_category_id}"}
|
path={url path='/admin/catalog' id_category=$current_category_id}
|
||||||
label={intl l='Position'}
|
label="{intl l='Position'}"
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@@ -81,22 +89,24 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{loop name="category_list" type="category" visible="*" parent=$current_category_id order=$category_order backend_context="1" lang=$lang_id}
|
{loop name="category_list" type="category" visible="*" parent=$current_category_id order=$category_order backend_context="1" lang=$lang_id}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{$ID}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
i={$ID} {loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
|
{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 class="img-thumbnail" src="#IMAGE_URL" alt="#TITLE" /></a>
|
<a href="{url path='admin/catalog' category_id=$ID}" title="{intl l='Browse this category'}"><img class="img-thumbnail" src="#IMAGE_URL" alt="#TITLE" /></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="object-title">
|
<td class="object-title">
|
||||||
<a href="{url path='admin/catalog/category' id="$ID" action='browse'}" title="{intl l='Browse this category'}">
|
<a href="{url path='admin/catalog' category_id=$ID}" title="{intl l='Browse this category'}">
|
||||||
{$ID} p={$POSITION} {$TITLE}
|
{$TITLE}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{module_include location='category_list_row'}
|
{module_include location='category_list_row'}
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
|
||||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||||
<input type="checkbox" data-id="{$ID}" class="categoryVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
<input type="checkbox" data-id="{$ID}" class="categoryVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||||
</div>
|
</div>
|
||||||
@@ -111,24 +121,24 @@
|
|||||||
|
|
||||||
<td>
|
<td>
|
||||||
{admin_position_block
|
{admin_position_block
|
||||||
permission="admin.category.edit"
|
permission="admin.categories.edit"
|
||||||
path={url path='admin/catalog/category' category_id="{$ID}"}
|
path={url path='admin/category/update-position' category_id=$ID}
|
||||||
url_parameter="category_id"
|
url_parameter="category_id"
|
||||||
in_place_edit_class="categoryPositionChange"
|
in_place_edit_class="categoryPositionChange"
|
||||||
position="$POSITION"
|
position=$POSITION
|
||||||
id="$ID"
|
id=$ID
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Browse this category'}" href="{url path='admin/catalog/category' id="$ID" action='browse'}"><i class="glyphicon glyphicon-folder-open"></i></a>
|
<a class="btn btn-default btn-xs" title="{intl l='Browse this category'}" href="{url path='admin/category' category_id=$ID}"><i class="glyphicon glyphicon-folder-open"></i></a>
|
||||||
|
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this category'}" href="{url path='admin/catalog/category' id="$ID" action='edit'}"><i class="glyphicon glyphicon-edit"></i></a>
|
<a class="btn btn-default btn-xs" title="{intl l='Edit this category'}" href="{url path='/admin/categories/update' category_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.category.delete"}
|
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.categories.delete"}
|
||||||
<a class="btn btn-default btn-xs category-delete" title="{intl l='Delete this category and all its contents'}" href="#delete_category_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
<a class="btn btn-default btn-xs category-delete" title="{intl l='Delete this category and all its contents'}" href="#delete_category_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
</div>
|
</div>
|
||||||
@@ -143,7 +153,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="message">
|
<td class="message">
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.category.create"}
|
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.categories.create"}
|
||||||
{intl l="This category has no sub-categories. To create a new one, click the + button above."}
|
{intl l="This category has no sub-categories. To create a new one, click the + button above."}
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
@@ -166,9 +176,10 @@
|
|||||||
<table class="table table-striped table-condensed">
|
<table class="table table-striped table-condensed">
|
||||||
<caption>
|
<caption>
|
||||||
{* display parent category name *}
|
{* display parent category name *}
|
||||||
{loop name="category_title" type="category" visible="*" id="{$current_category_id}"}
|
{loop name="category_title" type="category" visible="*" id=$current_category_id}
|
||||||
{intl l="Products in %cat" cat=$TITLE}
|
{intl l="Products in %cat" cat=$TITLE}
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{elseloop rel="category_title"}
|
{elseloop rel="category_title"}
|
||||||
{intl l="Top level Products"}
|
{intl l="Top level Products"}
|
||||||
{/elseloop}
|
{/elseloop}
|
||||||
@@ -183,15 +194,34 @@
|
|||||||
{ifloop rel="product_list"}
|
{ifloop rel="product_list"}
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th class="object-title">
|
||||||
|
{admin_sortable_header
|
||||||
|
current_order=$product_order
|
||||||
|
order='id'
|
||||||
|
reverse_order='id_reverse'
|
||||||
|
path={url path='/admin/product' category_id=$current_category_id}
|
||||||
|
label="{intl l='ID'}"
|
||||||
|
}
|
||||||
|
|
||||||
<th> </th>
|
<th> </th>
|
||||||
|
|
||||||
|
<th class="object-title">
|
||||||
|
{admin_sortable_header
|
||||||
|
current_order=$product_order
|
||||||
|
order='ref'
|
||||||
|
reverse_order='ref_reverse'
|
||||||
|
path={url path='/admin/product' category_id=$current_category_id}
|
||||||
|
label="{intl l='Reference'}"
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
|
||||||
<th class="object-title">
|
<th class="object-title">
|
||||||
{admin_sortable_header
|
{admin_sortable_header
|
||||||
current_order=$product_order
|
current_order=$product_order
|
||||||
order='alpha'
|
order='alpha'
|
||||||
reverse_order='alpha_reverse'
|
reverse_order='alpha_reverse'
|
||||||
path={url path='/admin/catalog/product' id="{$current_category_id}"}
|
path={url path='/admin/product' category_id=$current_category_id}
|
||||||
label={intl l='Product title'}
|
label="{intl l='Product title'}"
|
||||||
}
|
}
|
||||||
|
|
||||||
{module_include location='product_list_header'}
|
{module_include location='product_list_header'}
|
||||||
@@ -201,8 +231,8 @@
|
|||||||
current_order=$product_order
|
current_order=$product_order
|
||||||
order='visible'
|
order='visible'
|
||||||
reverse_order='visible_reverse'
|
reverse_order='visible_reverse'
|
||||||
path={url path='/admin/catalog/product' id="{$current_category_id}"}
|
path={url path='/admin/product' category_id=$current_category_id}
|
||||||
label={intl l='Online'}
|
label="{intl l='Online'}"
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@@ -211,8 +241,8 @@
|
|||||||
current_order=$product_order
|
current_order=$product_order
|
||||||
order='manual'
|
order='manual'
|
||||||
reverse_order='manual_reverse'
|
reverse_order='manual_reverse'
|
||||||
path={url path='/admin/catalog/product' id="{$current_category_id}"}
|
path={url path='/admin/product' category_id=$current_category_id}
|
||||||
label={intl l='Position'}
|
label="{intl l='Position'}"
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
@@ -221,39 +251,58 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{loop name="product_list" type="product" category="{$current_category_id}" order="manual"}
|
{loop name="product_list" type="product" category=$current_category_id order="manual"}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{$ID}</td>
|
||||||
|
|
||||||
<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"}
|
{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'}">
|
<a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">
|
||||||
<img src="#IMAGE_URL" alt="#TITLE" />
|
<img src="#IMAGE_URL" alt="#TITLE" />
|
||||||
</a>
|
</a>
|
||||||
{/loop}
|
{/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>
|
<td class="object-title"><a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">{$REF}</a></td>
|
||||||
|
|
||||||
|
<td class="object-title"><a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
|
||||||
|
|
||||||
{module_include location='product_list_row'}
|
{module_include location='product_list_row'}
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.products.edit"}
|
||||||
|
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||||
|
<input type="checkbox" data-id="{$ID}" class="productVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
|
||||||
|
{elseloop rel="can_change"}
|
||||||
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
|
||||||
<input type="checkbox" data-id="{$ID}" class="displayToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
<input type="checkbox" data-id="{$ID}" class="displayToggle" {if $VISIBLE == 1}checked="checked"{/if}>
|
||||||
</div>
|
</div>
|
||||||
|
{/elseloop}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{admin_position_block
|
{admin_position_block
|
||||||
permission="admin.product.edit"
|
permission="admin.product.edit"
|
||||||
path={url path='admin/catalog/product' category_id="{$ID}"}
|
path={url path='admin/product' category_id=$ID}
|
||||||
url_parameter="product_id"
|
url_parameter="product_id"
|
||||||
in_place_edit_class="productPositionChange"
|
in_place_edit_class="productPositionChange"
|
||||||
position="$POSITION"
|
position=$POSITION
|
||||||
id="$ID"
|
id=$ID
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='admin/catalog/product' id="$ID" action='edit'}"><i class="glyphicon glyphicon-edit"></i></a>
|
<div class="btn-group">
|
||||||
<a class="btn btn-default btn-xs product-delete" title="{intl l='Delete this product'}" href="{url path='admin/catalog/product' id="$ID" action='delete'}"><i class="glyphicon glyphicon-trash"></i></a>
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.edit"}
|
||||||
|
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='admin/product/edit' product_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||||
|
{/loop}
|
||||||
|
|
||||||
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.delete"}
|
||||||
|
<a class="btn btn-default btn-xs product-delete" title="{intl l='Delete this product'}" href="{url path='admin/product/delete' id=$ID}"><i class="glyphicon glyphicon-trash"></i></a>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -276,8 +325,82 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{include file="includes/add-category-dialog.html"}
|
{* Adding a new Category *}
|
||||||
{include file="includes/delete-category-dialog.html"}
|
|
||||||
|
|
||||||
|
{form name="thelia.admin.category.creation"}
|
||||||
|
|
||||||
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
|
{capture "category_creation_dialog"}
|
||||||
|
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
|
{form_field form=$form field='success_url'}
|
||||||
|
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||||
|
<input type="hidden" name="{$name}" value="{url path='/admin/categories/update' category_id='_ID_'}" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='parent'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$current_category_id}" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='title'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||||
|
|
||||||
|
{loop type="lang" name="default-lang" default_only="1"}
|
||||||
|
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
|
||||||
|
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="$TITLE" /></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="help-block">{intl l='Enter here the category name in the default language (%title)' title="$TITLE"}</div>
|
||||||
|
|
||||||
|
{* Switch edition to the current locale *}
|
||||||
|
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||||
|
|
||||||
|
{form_field form=$form field='locale'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||||
|
{/form_field}
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{include
|
||||||
|
file = "includes/generic-create-dialog.html"
|
||||||
|
|
||||||
|
dialog_id = "add_category_dialog"
|
||||||
|
dialog_title = {intl l="Create a new category"}
|
||||||
|
dialog_body = {$smarty.capture.category_creation_dialog nofilter}
|
||||||
|
|
||||||
|
dialog_ok_label = {intl l="Create this category"}
|
||||||
|
dialog_cancel_label = {intl l="Cancel"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/categories/create'}
|
||||||
|
form_enctype = {form_enctype form=$form}
|
||||||
|
form_error_message = $form_error_message
|
||||||
|
}
|
||||||
|
{/form}
|
||||||
|
|
||||||
|
{* Delete category confirmation dialog *}
|
||||||
|
|
||||||
|
{capture "category_delete_dialog"}
|
||||||
|
<input type="hidden" name="current_category_id" value="{$current_category_id}" />
|
||||||
|
<input type="hidden" name="category_id" id="delete_category_id" value"" />
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{include
|
||||||
|
file = "includes/generic-confirm-dialog.html"
|
||||||
|
|
||||||
|
dialog_id = "delete_category_dialog"
|
||||||
|
dialog_title = {intl l="Delete a category"}
|
||||||
|
dialog_message = {intl l="Do you really want to delete this category, and <strong>all</strong> its contents ?"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/categories/delete'}
|
||||||
|
form_content = {$smarty.capture.category_delete_dialog nofilter}
|
||||||
|
}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
@@ -290,68 +413,100 @@
|
|||||||
<script src="{$asset_url}"></script>
|
<script src="{$asset_url}"></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
{* display the form creation dialog if it contains errors *}
|
// JS stuff for category creation form
|
||||||
|
{include
|
||||||
|
file = "includes/generic-js-dialog.html"
|
||||||
|
|
||||||
{form name="thelia.admin.category.creation"}
|
dialog_id = "add_category_dialog"
|
||||||
{if #form_error}
|
form_name = "thelia.admin.category.creation"
|
||||||
$('#add_category_dialog').modal();
|
}
|
||||||
{/if}
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
{* Always reset create dialog on close *}
|
// JS stuff for product creation form
|
||||||
|
{include
|
||||||
|
file = "includes/generic-js-dialog.html"
|
||||||
|
|
||||||
$('#add_category_dialog').on('hidden',function() {
|
dialog_id = "add_product_dialog"
|
||||||
// Hide error message
|
form_name = "thelia.admin.product.creation"
|
||||||
$('#add_category_dialog_error').remove();
|
}
|
||||||
|
|
||||||
// Clear error status
|
|
||||||
$("#add_category_dialog .error").removeClass('error');
|
|
||||||
|
|
||||||
// Empty field values
|
{* Set the proper ID in the delete confirmation dialog *}
|
||||||
$("#add_category_dialog input[type=text]").val('');
|
|
||||||
});
|
|
||||||
|
|
||||||
{* Set the proper category ID in the delete confirmation dialog *}
|
$('a.category-delete').click(function(ev) {
|
||||||
|
$('#delete_category_id').val($(this).data('id'));
|
||||||
|
});
|
||||||
|
|
||||||
$(document).on("click", ".category-delete", function () {
|
$('a.product-delete').click(function(ev) {
|
||||||
$('#'+'delete-category-id').val($(this).data('id'));
|
$('#delete_product_id').val($(this).data('id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle category visibility
|
|
||||||
$(".categoryVisibleToggle").change(function() {
|
|
||||||
$.ajax({
|
|
||||||
url : "{url path='admin/catalog/category'}",
|
|
||||||
data : {
|
|
||||||
category_id : $(this).data('id'),
|
|
||||||
action : 'visibilityToggle'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
{* Inline editing of object position using bootstrap-editable *}
|
{* Toggle object visibility *}
|
||||||
|
|
||||||
$('.categoryPositionChange').editable({
|
$(".categoryVisibleToggle").click(function() {
|
||||||
type : 'text',
|
$.ajax({
|
||||||
title : '{intl l="Enter new category position"}',
|
url : "{url path='admin/categories/toggle-online'}",
|
||||||
mode : 'popup',
|
data : {
|
||||||
inputclass : 'input-mini',
|
category_id : $(this).data('id'),
|
||||||
placement : 'left',
|
action : 'visibilityToggle'
|
||||||
success : function(response, newValue) {
|
}
|
||||||
// The URL template
|
});
|
||||||
var url = "{url path='admin/catalog/category' action='changePosition' category_id='__ID__' position='__POS__'}";
|
});
|
||||||
|
|
||||||
// Perform subtitutions
|
$(".productVisibleToggle").click(function() {
|
||||||
url = url.replace('__ID__', $(this).data('id'))
|
$.ajax({
|
||||||
.replace('__POS__', newValue);
|
url : "{url path='admin/products/toggle-online'}",
|
||||||
|
data : {
|
||||||
|
category_id : $(this).data('id'),
|
||||||
|
action : 'visibilityToggle'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Reload the page
|
|
||||||
location.href = url;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
{* Inline editing of object position using bootstrap-editable *}
|
||||||
</script>
|
|
||||||
|
$('.categoryPositionChange').editable({
|
||||||
|
type : 'text',
|
||||||
|
title : '{intl l="Enter new category position"}',
|
||||||
|
mode : 'popup',
|
||||||
|
inputclass : 'input-mini',
|
||||||
|
placement : 'left',
|
||||||
|
success : function(response, newValue) {
|
||||||
|
// The URL template
|
||||||
|
var url = "{url path='/admin/categories/update-position' category_id='__ID__' position='__POS__'}";
|
||||||
|
|
||||||
|
// Perform subtitutions
|
||||||
|
url = url.replace('__ID__', $(this).data('id'))
|
||||||
|
.replace('__POS__', newValue);
|
||||||
|
|
||||||
|
// Reload the page
|
||||||
|
location.href = url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.productPositionChange').editable({
|
||||||
|
type : 'text',
|
||||||
|
title : '{intl l="Enter new product position"}',
|
||||||
|
mode : 'popup',
|
||||||
|
inputclass : 'input-mini',
|
||||||
|
placement : 'left',
|
||||||
|
success : function(response, newValue) {
|
||||||
|
// The URL template
|
||||||
|
var url = "{url path='/admin/products/update-position' product_id='__ID__' position='__POS__'}";
|
||||||
|
|
||||||
|
// Perform subtitutions
|
||||||
|
url = url.replace('__ID__', $(this).data('id'))
|
||||||
|
.replace('__POS__', newValue);
|
||||||
|
|
||||||
|
// Reload the page
|
||||||
|
location.href = url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
@@ -7,9 +7,8 @@
|
|||||||
{block name="main-content"}
|
{block name="main-content"}
|
||||||
<div class="catalog edit-category">
|
<div class="catalog edit-category">
|
||||||
<div id="wrapper" class="container">
|
<div id="wrapper" class="container">
|
||||||
<ul class="breadcrumb">
|
|
||||||
{include file="includes/category_breadcrumb.html"}
|
{include file="includes/catalog-breadcrumb.html"}
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edit_language_id"}
|
{loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edit_language_id"}
|
||||||
@@ -27,6 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
|
||||||
<div class="tabbable">
|
<div class="tabbable">
|
||||||
<ul class="nav nav-tabs admin-tabs" id="tabbed_menu">
|
<ul class="nav nav-tabs admin-tabs" id="tabbed_menu">
|
||||||
<li class="active">
|
<li class="active">
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.currencies.create"}
|
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.currencies.create"}
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
<button class="btn btn-default btn-info" title="{intl l='Update rates'}">{intl l='Update rates'} <span class="glyphicon glyphicon-globe"></span></button>
|
<button class="btn btn-default btn-info" title="{intl l='Update rates'}">{intl l='Update rates'} <span class="glyphicon glyphicon-globe"></span></button>
|
||||||
<a class="btn btn-default btn-primary" title="{intl l='Add a new currency'}" href="#add_currency_dialog" data-toggle="modal">
|
<a class="btn btn-default btn-primary" title="{intl l='Add a new currency'}" href="#creation_dialog" data-toggle="modal">
|
||||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
<td>
|
<td>
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
|
||||||
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id="$ID"}">{$NAME}</a>
|
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id=$ID}">{$NAME}</a>
|
||||||
{/loop}
|
{/loop}
|
||||||
{elseloop rel="can_change"}
|
{elseloop rel="can_change"}
|
||||||
{$NAME}
|
{$NAME}
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
|
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
|
||||||
<a class="btn btn-default btn-xs currency-delete" title="{intl l='Delete this currency'}" href="#delete_currency_dialog" data-id="{$ID}" data-toggle="modal">
|
<a class="btn btn-default btn-xs currency-delete" title="{intl l='Delete this currency'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||||
<span class="glyphicon glyphicon-trash"></span>
|
<span class="glyphicon glyphicon-trash"></span>
|
||||||
</a>
|
</a>
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -199,116 +199,96 @@
|
|||||||
|
|
||||||
{* Adding a new currency *}
|
{* Adding a new currency *}
|
||||||
|
|
||||||
<div class="modal fade" id="add_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
{form name="thelia.admin.currency.creation"}
|
||||||
|
|
||||||
<div class="modal-dialog">
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
<div class="modal-content">
|
{capture "creation_dialog"}
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
<div class="modal-header">
|
{form_field form=$form field='success_url'}
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
|
||||||
<h3>{intl l="Create a new currency"}</h3>
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
|
||||||
</div>
|
{/form_field}
|
||||||
|
|
||||||
{form name="thelia.admin.currency.creation"}
|
{form_field form=$form field='name'}
|
||||||
<form method="POST" action="{url path='/admin/configuration/currencies/create'}" {form_enctype form=$form}>
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{loop type="lang" name="default-lang" default_only="1"}
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
|
||||||
|
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
|
||||||
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
|
|
||||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="modal-body">
|
{* Switch edition to the current locale *}
|
||||||
|
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||||
|
|
||||||
{if $form_error}<div class="alert alert-block alert-error" id="add_currency_dialog_error">{$form_error_message}</div>{/if}
|
{form_field form=$form field='locale'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||||
|
{/form_field}
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='name'}
|
{form_field form=$form field='code'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
|
||||||
|
<span class="help-block"><a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a></span>
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{loop type="lang" name="default-lang" default_only="1"}
|
{form_field form=$form field='symbol'}
|
||||||
<div class="input-group">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
|
||||||
</div>
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
|
{form_field form=$form field='rate'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
|
||||||
|
<span class="help-block">{intl l="The rate from Euro (Price in Euro * rate = Price in this currency)"}</span>
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{* Switch edition to the current locale *}
|
{/capture}
|
||||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
|
||||||
|
|
||||||
{form_field form=$form field='locale'}
|
{include
|
||||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
file = "includes/generic-create-dialog.html"
|
||||||
{/form_field}
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='code'}
|
dialog_id = "creation_dialog"
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
dialog_title = {intl l="Create a new currency"}
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
|
|
||||||
<span class="help-block"><a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a></span>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='symbol'}
|
dialog_ok_label = {intl l="Create this currency"}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
|
||||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='rate'}
|
form_action = {url path='/admin/configuration/currencies/create'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
form_enctype = {form_enctype form=$form}
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
form_error_message = $form_error_message
|
||||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
|
}
|
||||||
<span class="help-block">{intl l="The rate from Euro (Price in Euro * rate = Price in this currency)"}</span>
|
{/form}
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this currency"}</button>
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="Cancel"}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{* Delete confirmation dialog *}
|
{* Delete confirmation dialog *}
|
||||||
|
|
||||||
<div class="modal fade" id="delete_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
{capture "delete_dialog"}
|
||||||
<div class="modal-dialog">
|
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
|
||||||
<div class="modal-content">
|
{/capture}
|
||||||
|
|
||||||
<div class="modal-header">
|
{include
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
file = "includes/generic-confirm-dialog.html"
|
||||||
<h3>{intl l="Delete a currency"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-body">
|
dialog_id = "delete_dialog"
|
||||||
<p>{intl l="Do you really want to delete this currency ?"}</p>
|
dialog_title = {intl l="Delete currency"}
|
||||||
</div>
|
dialog_message = {intl l="Do you really want to delete this currency ?"}
|
||||||
|
|
||||||
<form method="post" action="{url path='/admin/configuration/currencies/delete'}">
|
form_action = {url path='/admin/configuration/currencies/delete'}
|
||||||
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
|
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||||
|
}
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</button>
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
@@ -329,27 +309,12 @@
|
|||||||
$('#currency_delete_id').val($(this).data('id'));
|
$('#currency_delete_id').val($(this).data('id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
{* display the form creation dialog if it contains errors *}
|
// JS stuff for creation form
|
||||||
|
{include
|
||||||
{form name="thelia.admin.currency.creation"}
|
file = "includes/generic-js-dialog.html"
|
||||||
{if #form_error}
|
dialog_id = "creation_dialog"
|
||||||
$('#add_currency_dialog').modal();
|
form_name = "thelia.admin.currency.creation"
|
||||||
{/if}
|
}
|
||||||
{/form}
|
|
||||||
|
|
||||||
{* Always reset create dialog on close *}
|
|
||||||
|
|
||||||
$('#add_currency_dialog').on('hidden',function() {
|
|
||||||
|
|
||||||
// Hide error currency
|
|
||||||
$('#add_currency_dialog_error').remove();
|
|
||||||
|
|
||||||
// Clear error status
|
|
||||||
$("#add_currency_dialog .error").removeClass('error');
|
|
||||||
|
|
||||||
// Empty field values
|
|
||||||
$("#add_currency_dialog input[type=text]").val('');
|
|
||||||
});
|
|
||||||
|
|
||||||
{* Inline editing of object position using bootstrap-editable *}
|
{* Inline editing of object position using bootstrap-editable *}
|
||||||
|
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
|
|
||||||
{* Adding a new Category *}
|
|
||||||
|
|
||||||
<div class="modal fade" id="add_category_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
|
||||||
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3>{intl l="Create a new category"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form name="thelia.admin.category.creation"}
|
|
||||||
<form method="POST" action="{url path='/admin/catalog/category'}" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{* the action processed by the controller *}
|
|
||||||
<input type="hidden" name="action" value="create" />
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{form_field form=$form field='parent'}
|
|
||||||
<input type="hidden" name="{$name}" value="{$current_category_id}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
|
||||||
{* on success, redirect to category change page. _ID_ is replaced with the ID of the created category (see Thelia\Action\Category.php) *}
|
|
||||||
<input type="hidden" name="{$name}" value="{url path='admin/catalog/category' id="_ID_" action='edit'}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
{if #form_error}<div class="alert alert-error" id="add_category_dialog_error">#form_error_message</div>{/if}
|
|
||||||
|
|
||||||
{form_field form=$form field='title'}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
|
||||||
|
|
||||||
{loop type="lang" name="default-lang" default_only="1"}
|
|
||||||
|
|
||||||
<div class="input-group">
|
|
||||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Category title'}" placeholder="{intl l='Category title'}" class="form-control">
|
|
||||||
<span class="input-group-addon"><img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="help-block">{intl l="Enter here the category title in the default language ($TITLE)"}</div>
|
|
||||||
|
|
||||||
{form_field form=$form field='locale'}
|
|
||||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="Cancel"}</button>
|
|
||||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this category"}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
26
templates/admin/default/includes/catalog-breadcrumb.html
Normal file
26
templates/admin/default/includes/catalog-breadcrumb.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{* Breadcrumb for categories browsing and editing *}
|
||||||
|
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="{url path='admin/home'}">Home</a></li>
|
||||||
|
<li><a href="{url path='admin/catalog'}">Catalog</a>
|
||||||
|
|
||||||
|
{ifloop rel="category_path"}</li>
|
||||||
|
{loop name="category_path" type="category-path" visible="*" category=$current_category_id}
|
||||||
|
{if $ID == $current_category_id}
|
||||||
|
<li class="active">
|
||||||
|
{if $action == 'edit'}
|
||||||
|
{intl l='Editing %cat' cat="{$TITLE}"}
|
||||||
|
{else}
|
||||||
|
{$TITLE} <a href="{url path='admin/catalog/category/edit' category_id=$ID}" title="{intl l='Edit this category'}">{intl l="(edit)"}</a>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
{else}
|
||||||
|
<li><a href="{url path='admin/catalog/category' id=" $ID" action='browse'}">{$TITLE}</a></li>
|
||||||
|
{/if}
|
||||||
|
{/loop}
|
||||||
|
{/ifloop}
|
||||||
|
|
||||||
|
{elseloop rel="category_path"}
|
||||||
|
</li>
|
||||||
|
{/elseloop}
|
||||||
|
</ul>
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{* Breadcrumb for categories browsing and editing *}
|
|
||||||
|
|
||||||
<li><a href="{url path='admin/home'}">Home</a></li>
|
|
||||||
<li><a href="{url path='admin/catalog'}">Catalog</a> {ifloop rel="category_path"}</li>
|
|
||||||
|
|
||||||
{loop name="category_path" type="category-path" visible="*" category="{$current_category_id}"} {if $ID == $current_category_id}
|
|
||||||
<li class="active">{if $action == 'edit'} {intl l='Editing %cat' cat="{$TITLE}"} {else} {$TITLE} <a href="{url path='admin/catalog/category' id=" $ID" action='edit' }" title="{intl l='Edit this category'}">{intl l="(edit)"}</a> {/if}
|
|
||||||
</li>
|
|
||||||
{else}
|
|
||||||
<li><a href="{url path='admin/catalog/category' id=" $ID" action='browse'}">{$TITLE}</a></li>
|
|
||||||
{/if} {/loop} {/ifloop} {elseloop rel="category_path"}
|
|
||||||
</li>
|
|
||||||
{/elseloop}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
|
|
||||||
{* Adding a new Category *}
|
|
||||||
|
|
||||||
<div class="modal fade" id="delete_category_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
|
||||||
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3>{intl l="Delete a category"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form name="thelia.admin.category.deletion"}
|
|
||||||
<form method="POST" action="{url path='/admin/catalog/category'}" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{* the action processed by the controller *}
|
|
||||||
<input type="hidden" name="action" value="delete" />
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{form_field form=$form field='category_id'}
|
|
||||||
<input type="hidden" name="{$name}" id="delete-category-id" value="" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
|
||||||
{* on success, redirect to catalog. _ID_ is replaced with the ID of the deleted category parent id (see Thelia\Action\Category.php) *}
|
|
||||||
<input type="hidden" name="{$name}" value="{url path='admin/catalog/category' id="_ID_" action='browse'}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
{if #form_error}<div class="alert alert-block alert-error" id="add_category_dialog_error">#form_error_message</div>{/if}
|
|
||||||
|
|
||||||
<p>{intl l="Delete this category and all its contents ?"}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</button>
|
|
||||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
43
templates/admin/default/includes/generic-confirm-dialog.html
Normal file
43
templates/admin/default/includes/generic-confirm-dialog.html
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{*
|
||||||
|
|
||||||
|
A generic modal confirmation dialog template.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
|
||||||
|
dialog_id = the dialog id attribute
|
||||||
|
dialog_title = the dialog title
|
||||||
|
dialog_message = the dialog confirmation message
|
||||||
|
|
||||||
|
dialog_ok_label = The OK button label (default: yes)
|
||||||
|
dialog_cancel_label = The Cancel button label (default: no)
|
||||||
|
|
||||||
|
form_action = the form action URL, subtitted by a click on OK button
|
||||||
|
form_method = the form method, default "POST"
|
||||||
|
form_content = the form content
|
||||||
|
|
||||||
|
*}
|
||||||
|
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>{$dialog_title}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
{$dialog_message nofilter}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="{$form_method|default:POST}" action="{$form_action}">
|
||||||
|
|
||||||
|
{$form_content nofilter}
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {$dialog_cancel_label|default:{intl l="No"}}</button>
|
||||||
|
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l="Yes"}}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
43
templates/admin/default/includes/generic-create-dialog.html
Executable file
43
templates/admin/default/includes/generic-create-dialog.html
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
{*
|
||||||
|
|
||||||
|
A generic modal creation dialog template. Parameters
|
||||||
|
|
||||||
|
dialog_id = the dialog id attribute
|
||||||
|
dialog_title = the dialog title
|
||||||
|
dialog_body = the dialog body. In most cases, this is a creation form
|
||||||
|
|
||||||
|
dialog_ok_label = The OK button label. Default create
|
||||||
|
dialog_cancel_label = The cancel button label. Default create
|
||||||
|
|
||||||
|
form_action = The form action URL. Form is submitted when OK button is clicked
|
||||||
|
form_enctype = The form encoding
|
||||||
|
form_error_message = The form error message (optional)
|
||||||
|
*}
|
||||||
|
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>{$dialog_title nofilter}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action="{$form_action nofilter}" {$form_enctype nofilter}>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
{if ! empty($form_error_message)}<div class="alert alert-block alert-error" id="{$dialog_id}_error">{$form_error_message nofilter}</div>{/if}
|
||||||
|
|
||||||
|
{$dialog_body nofilter}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {$dialog_cancel_label|default:{intl l='Cancel'}}</button>
|
||||||
|
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l='OK'}}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
35
templates/admin/default/includes/generic-js-dialog.html
Normal file
35
templates/admin/default/includes/generic-js-dialog.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{*
|
||||||
|
Javascript code to manage create dialog. Insert it in your template, in the javascript
|
||||||
|
initialisation:
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
<insert me here>
|
||||||
|
}
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
$dialog_id = the dialog ID
|
||||||
|
$form_name = the form name
|
||||||
|
|
||||||
|
*}
|
||||||
|
|
||||||
|
{* re-display the form creation dialog if it contains errors *}
|
||||||
|
|
||||||
|
{form name="{$form_name}"}
|
||||||
|
{if #form_error}
|
||||||
|
$('#{$dialog_id}').modal();
|
||||||
|
{/if}
|
||||||
|
{/form}
|
||||||
|
|
||||||
|
{* Always reset create dialog on close *}
|
||||||
|
|
||||||
|
$('#{$dialog_id}').on('hidden', function() {
|
||||||
|
|
||||||
|
// Hide error message
|
||||||
|
$('#{$dialog_id}_error').remove();
|
||||||
|
|
||||||
|
// Clear error status
|
||||||
|
$("#{$dialog_id} .error").removeClass('error');
|
||||||
|
|
||||||
|
// Empty field values
|
||||||
|
$("#{$dialog_id} input[type=text]").val('');
|
||||||
|
});
|
||||||
@@ -1,60 +1,41 @@
|
|||||||
{* The standard description fields, used by many Thelia objects *}
|
{* The standard description fields, used by many Thelia objects *}
|
||||||
|
|
||||||
{form_field form=$form field='title'}
|
{form_field form=$form field='title'}
|
||||||
<div class="control-group">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label class="control-label">
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
{intl l='Title *'}
|
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value|htmlspecialchars}">
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="input-block-level" value="{$value|htmlspecialchars}">
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='chapo'}
|
{form_field form=$form field='chapo'}
|
||||||
<div class="control-group">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label class="control-label">
|
<label for="{$label_attr.for}" class="control-label">
|
||||||
{intl l='Summary'}
|
{intl l="{$label}"} :
|
||||||
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
|
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="controls">
|
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control">{$value|htmlspecialchars}</textarea>
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<textarea name="{$name}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="input-block-level">{$value|htmlspecialchars}</textarea>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='description'}
|
{form_field form=$form field='description'}
|
||||||
<div class="control-group">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label class="control-label">
|
<label for="{$label_attr.for}" class="control-label">
|
||||||
{intl l='Detailed description'}
|
{intl l="{$label}"} :
|
||||||
<span class="label-help-block">{intl l="The détailed description."}</span>
|
<span class="label-help-block">{intl l="The détailed description."}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="controls">
|
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<textarea name="{$name}" rows="10" class="input-block-level">{$value|htmlspecialchars}</textarea>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='postscriptum'}
|
{form_field form=$form field='postscriptum'}
|
||||||
<div class="control-group">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label class="control-label">
|
<label for="{$label_attr.for}" class="control-label">
|
||||||
{intl l='Conclusion'}
|
{intl l="{$label}"} :
|
||||||
<span class="label-help-block">{intl l="A short post-description information"}</span>
|
<span class="label-help-block">{intl l="A short post-description information"}</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="controls">
|
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="form-control">{$value|htmlspecialchars}</textarea>
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<textarea name="{$name}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="input-block-level">{$value|htmlspecialchars}</textarea>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
@@ -27,127 +27,85 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<div class="form-horizontal col-md-12">
|
<div class="col-md-12">
|
||||||
{form name="thelia.admin.message.modification"}
|
{form name="thelia.admin.message.modification"}
|
||||||
<form method="POST" action="{url path='/admin/configuration/messages/save'}" {form_enctype form=$form}>
|
<form method="POST" action="{url path='/admin/configuration/messages/save'}" {form_enctype form=$form}>
|
||||||
<fieldset>
|
|
||||||
{* Be sure to get the message ID, even if the form could not be validated *}
|
{* Be sure to get the message ID, even if the form could not be validated *}
|
||||||
<input type="hidden" name="message_id" value="{$message_id}" />
|
<input type="hidden" name="message_id" value="{$message_id}" />
|
||||||
|
|
||||||
{include file="includes/inner-form-toolbar.html"}
|
{include file="includes/inner-form-toolbar.html"}
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages'}" />
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages'}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='id'}
|
{form_field form=$form field='id'}
|
||||||
<input type="hidden" name="{$name}" value="{$value|htmlspecialchars}" />
|
<input type="hidden" name="{$name}" value="{$value|htmlspecialchars}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='locale'}
|
{form_field form=$form field='locale'}
|
||||||
<input type="hidden" name="{$name}" value="{{$edit_language_locale}}" />
|
<input type="hidden" name="{$name}" value="{{$edit_language_locale}}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{if #form_error}<div class="alert alert-block alert-error">#form_error_message</div>{/if}
|
{if #form_error}<div class="alert alert-danger">#form_error_message</div>{/if}
|
||||||
|
|
||||||
|
{form_field form=$form field='name'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="form-control">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='secured'}
|
||||||
|
<div class="checkbox {if $error}has-error{/if}">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
|
||||||
|
{intl l="{$label}"}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<div class="control-group">
|
{form_field form=$form field='title'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value|htmlspecialchars}">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<label class="control-label">
|
{form_field form=$form field='subject'}
|
||||||
{intl l='Name *'}
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
</label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Subject'}" placeholder="{intl l='Subject'}" class="form-control" value="{$value|htmlspecialchars}">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<div class="controls">
|
{form_field form=$form field='html_message'}
|
||||||
{form_field form=$form field='name'}
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<span {if $error}class="error"{/if}>
|
<label for="{$label_attr.for}" class="control-label">
|
||||||
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="input-block-level">
|
{intl l="{$label}"} :
|
||||||
</span>
|
<span class="label-help-block">{intl l="The mailing template in HTML format."}</span>
|
||||||
{/form_field}
|
</label>
|
||||||
</div>
|
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<div class="control-group">
|
{form_field form=$form field='text_message'}
|
||||||
<label class="control-label">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
{intl l='Secured'}
|
<label for="{$label_attr.for}" class="control-label">
|
||||||
</label>
|
{intl l="{$label}"} :
|
||||||
|
<span class="label-help-block">{intl l="The mailing template in text-only format."}</span>
|
||||||
|
</label>
|
||||||
|
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<div class="controls">
|
<div class="form-group">
|
||||||
{form_field form=$form field='secured'}
|
<p>{intl l='Message created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}}</p>
|
||||||
<span {if $error}class="error"{/if}>
|
</div>
|
||||||
<label class="checkbox">
|
|
||||||
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
|
|
||||||
{intl l="Prevent mailing template modification or deletion, except for super-admin"}
|
|
||||||
</label>
|
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form_field form=$form field='title'}
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
|
||||||
{intl l='Title *'}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="input-block-level" value="{$value|htmlspecialchars}">
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='subject'}
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
|
||||||
{intl l='Message subject *'}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" name="{$name}" required="required" title="{intl l='Subject'}" placeholder="{intl l='Subject'}" class="input-block-level" value="{$value|htmlspecialchars}">
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='html_message'}
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
|
||||||
{intl l='HTML Message'}
|
|
||||||
<span class="label-help-block">{intl l="The mailing template in HTML format."}</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<textarea name="{$name}" rows="10" class="input-block-level">{$value|htmlspecialchars}</textarea>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='text_message'}
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
|
||||||
{intl l='Text Message'}
|
|
||||||
<span class="label-help-block">{intl l="The mailing template in text-only format."}</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<textarea name="{$name}" rows="10" class="input-block-level">{$value|htmlspecialchars}</textarea>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
|
||||||
<p>{intl l='Message created on %date_create. Last modification: %date_change' date_create="{format_date date=$CREATE_DATE}" date_change="{format_date date=$UPDATE_DATE}"}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
</form>
|
||||||
{/form}
|
{/form}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,68 +25,71 @@
|
|||||||
<caption>
|
<caption>
|
||||||
{intl l='Thelia mailing templates'}
|
{intl l='Thelia mailing templates'}
|
||||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.messages.create"}
|
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.messages.create"}
|
||||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new mailing template'}" href="#add_message_dialog" data-toggle="modal">
|
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new mailing template'}" href="#creation_dialog" data-toggle="modal">
|
||||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||||
</a>
|
</a>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
</caption>
|
</caption>
|
||||||
<tr>
|
<thead>
|
||||||
<th>{intl l="Purpose"}</th>
|
<tr>
|
||||||
<th>{intl l="Name"}</th>
|
<th>{intl l="Purpose"}</th>
|
||||||
|
<th>{intl l="Name"}</th>
|
||||||
|
|
||||||
{module_include location='messages_table_header'}
|
{module_include location='messages_table_header'}
|
||||||
|
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
{loop name="mailing-templates" type="message" secured="*" backend_context="1" lang="$lang_id"}
|
<tbody>
|
||||||
<tr>
|
{loop name="mailing-templates" type="message" secured="*" backend_context="1" lang="$lang_id"}
|
||||||
|
<tr>
|
||||||
|
|
||||||
<td>{$TITLE}</td>
|
<td>{$TITLE}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{if ! $SECURED}
|
{if ! $SECURED}
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"}
|
||||||
<a title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/update' message_id="$ID"}">{$NAME}</a>
|
<a title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/update' message_id="$ID"}">{$NAME}</a>
|
||||||
{/loop}
|
{/loop}
|
||||||
{elseloop rel="can_change"}
|
{elseloop rel="can_change"}
|
||||||
|
{$NAME}
|
||||||
|
{/elseloop}
|
||||||
|
{else}
|
||||||
{$NAME}
|
{$NAME}
|
||||||
{/elseloop}
|
{/if}
|
||||||
{else}
|
</td>
|
||||||
{$NAME}
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
{module_include location='messages_table_row'}
|
{module_include location='messages_table_row'}
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{if ! $SECURED}
|
{if ! $SECURED}
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"}
|
||||||
<a class="btn btn-default btn-xs message-change" title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/update' message_id="$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
<a class="btn btn-default btn-xs message-change" title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/update' message_id="$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.messages.delete"}
|
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.messages.delete"}
|
||||||
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_message_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
</div>
|
</div>
|
||||||
{else}
|
{else}
|
||||||
<i title="{intl l='This mailing template could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
<i title="{intl l='This mailing template could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
{elseloop rel="mailing-templates"}
|
||||||
{elseloop rel="mailing-templates"}
|
<tr>
|
||||||
<tr>
|
<td colspan="3">
|
||||||
<td colspan="3">
|
<div class="alert alert-info">
|
||||||
<div class="alert alert-info">
|
{intl l="No mailing template has been created yet. Click the + button to create one."}
|
||||||
{intl l="No mailing template has been created yet. Click the + button to create one."}
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
{/elseloop}
|
||||||
{/elseloop}
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -99,113 +102,89 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{* Adding a new message *}
|
{* Adding a new message *}
|
||||||
|
|
||||||
<div class="modal hide fade" id="add_message_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3>{intl l="Create a new mailing template"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form name="thelia.admin.message.creation"}
|
{form name="thelia.admin.message.creation"}
|
||||||
<form method="POST" action="{url path='/admin/configuration/messages/create'}" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
|
{capture "creation_dialog"}
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
{form_field form=$form field='success_url'}
|
||||||
{* on success, redirect to the edition page, _ID_ is replaced with the created message ID, see controller *}
|
{* on success, redirect to the edition page, _ID_ is replaced with the created message ID, see controller *}
|
||||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages/update' message_id='_ID_'}" />
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages/update' message_id='_ID_'}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{* We do not allow users to create secured messages from here *}
|
{* We do not allow users to create secured messages from here *}
|
||||||
|
|
||||||
{form_field form=$form field='secured'}
|
{form_field form=$form field='secured'}
|
||||||
<input type="hidden" name="{$name}" value="0" />
|
<input type="hidden" name="{$name}" value="0" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
<div class="modal-body">
|
{form_field form=$form field='name'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template name'}" placeholder="{intl l='Mailing template name'}" class="form-control">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{if #form_error}<div class="alert alert-block alert-error" id="add_message_dialog_error">#form_error_message</div>{/if}
|
{form_field form=$form field='title'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
|
||||||
<div class="control-group">
|
{loop type="lang" name="default-lang" default_only="1"}
|
||||||
|
|
||||||
<label class="control-label">
|
{* Switch edition to the current locale *}
|
||||||
{intl l='Name *'}
|
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
<div class="input-group">
|
||||||
{form_field form=$form field='name'}
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template purpose'}" placeholder="{intl l='Mailing template purpose'}" class="form-control">
|
||||||
<span {if $error}class="error"{/if}>
|
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||||
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template name'}" placeholder="{intl l='Mailing template name'}" class="input-block-level">
|
</div>
|
||||||
</span>
|
|
||||||
|
<div class="help-block">{intl l="Enter here the mailing template purpose in the default language ($TITLE)"}</div>
|
||||||
|
|
||||||
|
{form_field form=$form field='locale'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
</div>
|
{/loop}
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group">
|
</div>
|
||||||
<label class="control-label">
|
{/form_field}
|
||||||
{intl l='Purpose *'}
|
{/capture}
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
{include
|
||||||
{loop type="lang" name="default-lang" default_only="1"}
|
file = "includes/generic-create-dialog.html"
|
||||||
|
|
||||||
{* Switch edition to the current locale *}
|
dialog_id = "creation_dialog"
|
||||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
dialog_title = {intl l="Create a new mailing template"}
|
||||||
|
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||||
|
|
||||||
{form_field form=$form field='locale'}
|
dialog_ok_label = {intl l="Create this mailing template"}
|
||||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="input-group input-block-level">
|
form_action = {url path='/admin/configuration/messages/create'}
|
||||||
{form_field form=$form field='title'}
|
form_enctype = {form_enctype form=$form}
|
||||||
<span {if $error}class="error"{/if}>
|
form_error_message = $form_error_message
|
||||||
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template purpose'}" placeholder="{intl l='Mailing template purpose'}" class="input-block-level">
|
}
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="help-block">{intl l="Enter here the mailing template purpose in the default language ($TITLE)"}</div>
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="submit" class="btn btn-default btn-primary">{intl l="Create this mailing template"}</button>
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{/form}
|
{/form}
|
||||||
</div>
|
|
||||||
|
|
||||||
|
{* Delete confirmation dialog *}
|
||||||
|
|
||||||
{* Delete confirmation dialog *}
|
{capture "delete_dialog"}
|
||||||
|
|
||||||
<div class="modal hide fade" id="delete_message_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3>{intl l="Delete a mailing template"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>{intl l="Do you really want to delete this mailing template ?"}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="post" action="{url path='/admin/configuration/messages/delete'}">
|
|
||||||
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
||||||
|
{/capture}
|
||||||
|
|
||||||
<div class="modal-footer">
|
{include
|
||||||
<button type="submit" class="btn btn-default btn-primary">{intl l="Yes"}</button>
|
file = "includes/generic-confirm-dialog.html"
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="No"}</button>
|
|
||||||
</div>
|
dialog_id = "delete_dialog"
|
||||||
</form>
|
dialog_title = {intl l="Delete mailing template"}
|
||||||
</div>
|
dialog_message = {intl l="Do you really want to delete this mailing template ?"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/configuration/messages/delete'}
|
||||||
|
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||||
|
}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
@@ -217,26 +196,12 @@
|
|||||||
$('#message_delete_id').val($(this).data('id'));
|
$('#message_delete_id').val($(this).data('id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
{* display the form creation dialog if it contains errors *}
|
// JS stuff for creation form
|
||||||
|
{include
|
||||||
{form name="thelia.admin.message.creation"}
|
file = "includes/generic-js-dialog.html"
|
||||||
{if #form_error}
|
dialog_id = "creation_dialog"
|
||||||
$('#add_message_dialog').modal();
|
form_name = "thelia.admin.message.creation"
|
||||||
{/if}
|
}
|
||||||
{/form}
|
|
||||||
|
|
||||||
{* Always reset create dialog on close *}
|
|
||||||
|
|
||||||
$('#add_message_dialog').on('hidden',function() {
|
|
||||||
// Hide error message
|
|
||||||
$('#add_message_dialog_error').remove();
|
|
||||||
|
|
||||||
// Clear error status
|
|
||||||
$("#add_message_dialog .error").removeClass('error');
|
|
||||||
|
|
||||||
// Empty field values
|
|
||||||
$("#add_message_dialog input[type=text]").val('');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
1
templates/admin/default/product-attributes-edit.html
Normal file
1
templates/admin/default/product-attributes-edit.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
142
templates/admin/default/product-attributes.html
Normal file
142
templates/admin/default/product-attributes.html
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
{extends file="admin-layout.tpl"}
|
||||||
|
|
||||||
|
{block name="page-title"}{intl l='Thelia Product Attributes'}{/block}
|
||||||
|
|
||||||
|
{block name="check-permissions"}admin.configuration.product_attributes.view{/block}
|
||||||
|
|
||||||
|
{block name="main-content"}
|
||||||
|
<div class="attributes">
|
||||||
|
|
||||||
|
<div id="wrapper" class="container">
|
||||||
|
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||||
|
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
|
||||||
|
<li><a href="{url path='/admin/configuration/product_attributes'}">{intl l="Product attributes"}</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<form action="#" method="post">
|
||||||
|
<div class="general-block-decorator">
|
||||||
|
<table class="table table-striped table-condensed table-left-aligned">
|
||||||
|
<caption>
|
||||||
|
{intl l='Thelia product attributes'}
|
||||||
|
|
||||||
|
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product attribute'}" href="#add_product_attribute_dialog" data-toggle="modal">
|
||||||
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||||
|
</a>
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{intl l="Title"}</th>
|
||||||
|
<th>{intl l="Position"}</th>
|
||||||
|
<th>{intl l="Actions"}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Title here</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td class="actions">
|
||||||
|
<div class="btn-group">
|
||||||
|
<a class="btn btn-default btn-xs message-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/product_attributes/update' product_attribute_id="$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||||
|
|
||||||
|
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_product_attribute_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!-- <tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="alert alert-info">
|
||||||
|
{intl l="No product attribute has been created yet. Click the + button to create one."}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr> -->
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{* Adding a new message *}
|
||||||
|
|
||||||
|
<div class="modal fade" id="add_product_attribute_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>{intl l="Create a new product attribute"}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<form method="POST" action="">
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="alert alert-danger" id="add_procut_attribute_dialog_error">Error message</div>
|
||||||
|
|
||||||
|
<div class="form-group has-error">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="Title"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template name'}" placeholder="{intl l='Mailing template name'}" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox">
|
||||||
|
Add this attribute to all sections
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="Cancel"}</button>
|
||||||
|
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this product attribute"}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{* Delete confirmation dialog *}
|
||||||
|
|
||||||
|
<div class="modal fade" id="delete_product_attribute_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3>{intl l="Delete a product attribute"}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>{intl l="Do you really want to delete this product attribute ?"}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<!-- <input type="hidden" name="message_id" id="message_delete_id" value="" /> -->
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</button>
|
||||||
|
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<div class="form-horizontal col-md-12">
|
<div class="col-md-12">
|
||||||
{form name="thelia.admin.config.modification"}
|
{form name="thelia.admin.config.modification"}
|
||||||
<form method="POST" action="{url path='/admin/configuration/variables/save'}" {form_enctype form=$form}>
|
<form method="POST" action="{url path='/admin/configuration/variables/save'}" {form_enctype form=$form}>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -56,53 +56,30 @@
|
|||||||
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{if #form_error}<div class="alert alert-block alert-error">#form_error_message</div>{/if}
|
{if #form_error}<div class="alert alert-danger">#form_error_message</div>{/if}
|
||||||
|
|
||||||
<div class="control-group">
|
{form_field form=$form field='name'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label class="control-label">
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
{intl l='Name *'}
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="form-control">
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="controls">
|
|
||||||
{form_field form=$form field='name'}
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" required="required" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="input-block-level">
|
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
{/form_field}
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
{form_field form=$form field='value'}
|
||||||
{intl l='Value'}
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
</label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="form-control">
|
||||||
<div class="controls">
|
|
||||||
{form_field form=$form field='value'}
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" name="{$name}" value="{$value|htmlspecialchars}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="input-block-level">
|
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
{/form_field}
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">
|
{form_field form=$form field='secured'}
|
||||||
{intl l='Secured'}
|
<div class="checkbox {if $error}has-error{/if}">
|
||||||
</label>
|
<label>
|
||||||
|
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
|
||||||
<div class="controls">
|
{intl l="{$label}"}
|
||||||
{form_field form=$form field='secured'}
|
</label>
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<label class="checkbox">
|
|
||||||
<input type="checkbox" name="{$name}" value="1" {if $value == 1}checked="checked"{/if}>
|
|
||||||
{intl l="Prevent variable modification or deletion, except for super-admin"}
|
|
||||||
</label>
|
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{include file="includes/standard-description-form-fields.html"}
|
{include file="includes/standard-description-form-fields.html"}
|
||||||
|
|
||||||
|
|||||||
@@ -22,99 +22,105 @@
|
|||||||
<form action="{url path='/admin/configuration/variables/update-values'}" method="post">
|
<form action="{url path='/admin/configuration/variables/update-values'}" method="post">
|
||||||
<div class="general-block-decorator">
|
<div class="general-block-decorator">
|
||||||
<table class="table table-striped table-condensed table-left-aligned">
|
<table class="table table-striped table-condensed table-left-aligned">
|
||||||
<caption>
|
<caption class="clearfix">
|
||||||
{intl l='Thelia system variables'}
|
{intl l='Thelia system variables'}
|
||||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.variables.create"}
|
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.variables.create"}
|
||||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new variable'}" href="#add_variable_dialog" data-toggle="modal">
|
<div class="pull-right">
|
||||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new variable'}" href="#creation_dialog" data-toggle="modal">
|
||||||
</a>
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||||
<button class="btn btn-default btn-primary action-btn" title="{intl l='Save chages'}">{intl l='Save changes'} <span class="glyphicon glyphicon-ok"></span></button>
|
</a>
|
||||||
|
<button class="btn btn-default btn-primary" title="{intl l='Save chages'}"><span class="glyphicon glyphicon-ok"></span> {intl l='Save changes'}</button>
|
||||||
|
</div>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
</caption>
|
</caption>
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
{admin_sortable_header
|
|
||||||
current_order=$order
|
|
||||||
order='title'
|
|
||||||
reverse_order='title_reverse'
|
|
||||||
path={url path='/admin/configuration/variables'}
|
|
||||||
label={intl l='Purpose'}
|
|
||||||
}
|
|
||||||
</th>
|
|
||||||
|
|
||||||
<th>
|
<thead>
|
||||||
{admin_sortable_header
|
<tr>
|
||||||
current_order=$order
|
<th>
|
||||||
order='name'
|
{admin_sortable_header
|
||||||
reverse_order='name_reverse'
|
current_order=$order
|
||||||
path={url path='/admin/configuration/variables'}
|
order='title'
|
||||||
label={intl l='Name'}
|
reverse_order='title_reverse'
|
||||||
}
|
path={url path='/admin/configuration/variables'}
|
||||||
</th>
|
label={intl l='Purpose'}
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
|
||||||
<th>
|
<th>
|
||||||
{admin_sortable_header
|
{admin_sortable_header
|
||||||
current_order=$order
|
current_order=$order
|
||||||
order='value'
|
order='name'
|
||||||
reverse_order='value_reverse'
|
reverse_order='name_reverse'
|
||||||
path={url path='/admin/configuration/variables'}
|
path={url path='/admin/configuration/variables'}
|
||||||
label={intl l='Value'}
|
label={intl l='Name'}
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
{module_include location='variables_table_header'}
|
<th>
|
||||||
|
{admin_sortable_header
|
||||||
|
current_order=$order
|
||||||
|
order='value'
|
||||||
|
reverse_order='value_reverse'
|
||||||
|
path={url path='/admin/configuration/variables'}
|
||||||
|
label={intl l='Value'}
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
|
||||||
<th> </th>
|
{module_include location='variables_table_header'}
|
||||||
</tr>
|
|
||||||
|
|
||||||
{loop name="config" type="config" hidden="0" secured="*" backend_context="1" lang="$lang_id" order="$order"}
|
<th>{intl l='Action'}</th>
|
||||||
<tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{loop name="config" type="config" hidden="0" secured="*" backend_context="1" lang="$lang_id" order="$order"}
|
||||||
|
<tr>
|
||||||
|
|
||||||
<td>{$TITLE}</td>
|
<td>{$TITLE}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{if ! $SECURED}
|
{if ! $SECURED}
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
||||||
<a title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/update' variable_id="$ID"}">{$NAME}</a>
|
<a title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/update' variable_id="$ID"}">{$NAME}</a>
|
||||||
{/loop}
|
{/loop}
|
||||||
{elseloop rel="can_change"}
|
{elseloop rel="can_change"}
|
||||||
{$NAME}
|
{$NAME}
|
||||||
{/elseloop}
|
{/elseloop}
|
||||||
{else}
|
{else}
|
||||||
{$NAME}
|
{$NAME}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{if $SECURED}
|
{if $SECURED}
|
||||||
{$VALUE}
|
{$VALUE}
|
||||||
{else}
|
{else}
|
||||||
<input id="cancelable_edit_{$ID}" class="js-edit" data-id="{$ID}" type="text" name="variable[{$ID}]" value="{$VALUE|htmlspecialchars}" />
|
<input id="cancelable_edit_{$ID}" class="js-edit form-control" data-id="{$ID}" type="text" name="variable[{$ID}]" value="{$VALUE|htmlspecialchars}" />
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{module_include location='variables_table_row'}
|
{module_include location='variables_table_row'}
|
||||||
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{if ! $SECURED}
|
{if ! $SECURED}
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn btn-default btn-xs cancel-edit" id="cancel_edit_btn_{$ID}" data-id="{$ID}" title="{intl l='Cancel changes and revert to original value'}" href="#"><i class="glyphicon glyphicon-remove"></i></a>
|
<a class="btn btn-default btn-xs cancel-edit" id="cancel_edit_btn_{$ID}" data-id="{$ID}" title="{intl l='Cancel changes and revert to original value'}" href="#"><i class="glyphicon glyphicon-remove"></i></a>
|
||||||
|
|
||||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
||||||
<a class="btn btn-default btn-xs config-change" title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/update' variable_id="$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
<a class="btn btn-default btn-xs config-change" title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/update' variable_id="$ID"}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
|
||||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.variables.delete"}
|
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.variables.delete"}
|
||||||
<a class="btn btn-default btn-xs config-delete" title="{intl l='Delete this variable'}" href="#delete_variable_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
<a class="btn btn-default btn-xs config-delete" title="{intl l='Delete this variable'}" href="#delete_variable_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||||
{/loop}
|
{/loop}
|
||||||
</div>
|
</div>
|
||||||
{else}
|
{else}
|
||||||
<i title="{intl l='This variable could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
<i title="{intl l='This variable could not be changed.'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/loop}
|
{/loop}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -129,162 +135,116 @@
|
|||||||
|
|
||||||
{* Adding a new variable *}
|
{* Adding a new variable *}
|
||||||
|
|
||||||
<div class="modal hide fade" id="add_variable_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3>{intl l="Create a new variable"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form name="thelia.admin.config.creation"}
|
{form name="thelia.admin.config.creation"}
|
||||||
<form method="POST" action="{url path='/admin/configuration/variables/create'}" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
|
{capture "creation_dialog"}
|
||||||
|
|
||||||
{form_field form=$form field='success_url'}
|
{form_hidden_fields form=$form}
|
||||||
{* on success, redirect to the edition page, _ID_ is replaced with the created variable ID, see controller *}
|
|
||||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/update' variable_id='_ID_'}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{* We do not allow users to create hidden or secured variables from here *}
|
{form_field form=$form field='success_url'}
|
||||||
|
{* on success, redirect to the edition page, _ID_ is replaced with the created variable ID, see controller *}
|
||||||
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/update' variable_id='_ID_'}" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='hidden'}
|
{* We do not allow users to create hidden or secured variables from here *}
|
||||||
<input type="hidden" name="{$name}" value="0" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='secured'}
|
{form_field form=$form field='hidden'}
|
||||||
<input type="hidden" name="{$name}" value="0" />
|
<input type="hidden" name="{$name}" value="0" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
<div class="modal-body">
|
{form_field form=$form field='secured'}
|
||||||
|
<input type="hidden" name="{$name}" value="0" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{if #form_error}<div class="alert alert-block alert-error" id="add_variable_dialog_error">#form_error_message</div>{/if}
|
{form_field form=$form field='name'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="form-control">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<div class="control-group">
|
{form_field form=$form field='value'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="form-control">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
<label class="control-label">
|
{form_field form=$form field='title'}
|
||||||
{intl l='Name *'}
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
</label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
|
||||||
<div class="controls">
|
{loop type="lang" name="default-lang" default_only="1"}
|
||||||
{form_field form=$form field='name'}
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Variable name'}" placeholder="{intl l='Variable name'}" class="input-block-level">
|
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group">
|
{* Switch edition to the current locale *}
|
||||||
|
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||||
|
|
||||||
<label class="control-label">
|
<div class="input-group">
|
||||||
{intl l='Value'}
|
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Variable purpose'}" placeholder="{intl l='Variable purpose'}" class="form-control">
|
||||||
</label>
|
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="controls">
|
<div class="help-block">{intl l='Enter here the category name in the default language (%title)' title="$TITLE"}</div>
|
||||||
{form_field form=$form field='value'}
|
|
||||||
<span {if $error}class="error"{/if}>
|
|
||||||
<input type="text" name="{$name}" value="{$value}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="input-block-level">
|
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="control-group">
|
{form_field form=$form field='locale'}
|
||||||
<label class="control-label">
|
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||||
{intl l='Purpose *'}
|
{/form_field}
|
||||||
</label>
|
{/loop}
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
{/capture}
|
||||||
|
|
||||||
<div class="controls">
|
{include
|
||||||
{loop type="lang" name="default-lang" default_only="1"}
|
file = "includes/generic-create-dialog.html"
|
||||||
|
|
||||||
{* Switch edition to the current locale *}
|
dialog_id = "creation_dialog"
|
||||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
dialog_title = {intl l="Create a new variable"}
|
||||||
|
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||||
|
|
||||||
{form_field form=$form field='locale'}
|
dialog_ok_label = {intl l="Create this variable"}
|
||||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="input-group input-block-level">
|
form_action = {url path='/admin/configuration/variables/create'}
|
||||||
{form_field form=$form field='title'}
|
form_enctype = {form_enctype form=$form}
|
||||||
<span {if $error}class="error"{/if}>
|
form_error_message = $form_error_message
|
||||||
<input type="text" required="required" name="{$name}" value="{$value}" title="{intl l='Variable purpose'}" placeholder="{intl l='Variable purpose'}" class="input-block-level">
|
}
|
||||||
</span>
|
|
||||||
{/form_field}
|
|
||||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="help-block">{intl l="Enter here the variable purpose in the default language ($TITLE)"}</div>
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="submit" class="btn btn-default btn-primary">{intl l="Create this variable"}</button>
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="Cancel"}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{/form}
|
{/form}
|
||||||
</div>
|
|
||||||
|
|
||||||
|
{* Delete category confirmation dialog *}
|
||||||
|
|
||||||
{* Delete confirmation dialog *}
|
{capture "delete_dialog"}
|
||||||
|
|
||||||
<div class="modal hide fade" id="delete_variable_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3>{intl l="Delete a variable"}</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>{intl l="Do you really want to delete this variable ?"}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="post" action="{url path='/admin/configuration/variables/delete'}">
|
|
||||||
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
|
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
|
||||||
|
{/capture}
|
||||||
|
|
||||||
<div class="modal-footer">
|
{include
|
||||||
<button type="submit" class="btn btn-default btn-primary">{intl l="Yes"}</button>
|
file = "includes/generic-confirm-dialog.html"
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{intl l="No"}</button>
|
|
||||||
</div>
|
dialog_id = "delete_variable_dialog"
|
||||||
</form>
|
dialog_title = {intl l="Delete a variable"}
|
||||||
</div>
|
dialog_message = {intl l="Do you really want to delete this variable ?"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/configuration/variables/delete'}
|
||||||
|
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||||
|
}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
// JS stuff for creation form
|
||||||
|
{include
|
||||||
|
file = "includes/generic-js-dialog.html"
|
||||||
|
dialog_id = "creation_dialog"
|
||||||
|
form_name = "thelia.admin.config.creation"
|
||||||
|
}
|
||||||
|
|
||||||
// Set proper variable ID in delete from
|
// Set proper variable ID in delete from
|
||||||
$('a.config-delete').click(function(ev) {
|
$('a.config-delete').click(function(ev) {
|
||||||
$('#variable_delete_id').val($(this).data('id'));
|
$('#variable_delete_id').val($(this).data('id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
{* display the form creation dialog if it contains errors *}
|
|
||||||
|
|
||||||
{form name="thelia.admin.config.creation"}
|
|
||||||
{if #form_error}
|
|
||||||
$('#add_variable_dialog').modal();
|
|
||||||
{/if}
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
{* Always reset create dialog on close *}
|
|
||||||
|
|
||||||
$('#add_variable_dialog').on('hidden',function() {
|
|
||||||
// Hide error message
|
|
||||||
$('#add_variable_dialog_error').remove();
|
|
||||||
|
|
||||||
// Clear error status
|
|
||||||
$("#add_variable_dialog .error").removeClass('error');
|
|
||||||
|
|
||||||
// Empty field values
|
|
||||||
$("#add_variable_dialog input[type=text]").val('');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Edition canceling management
|
// Edition canceling management
|
||||||
$('.cancel-edit').each(function() {
|
$('.cancel-edit').each(function() {
|
||||||
var zis = $(this);
|
var zis = $(this);
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
::{customer attr="firstname"};;
|
{*loop type="product" name="fsdq"}
|
||||||
::{customer attr="titleId"};;
|
{format_date date=$CREATE_DATE}
|
||||||
|
{/loop*}
|
||||||
|
|
||||||
|
::{product attr="createdAt" output="time" format='i'};;<br />
|
||||||
15
templates/default/delivery_list.html
Normal file
15
templates/default/delivery_list.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{include file="includes/header.html"}
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{loop type="delivery" name="delivery.list"}
|
||||||
|
<li>
|
||||||
|
<ul>
|
||||||
|
<li>id : {#ID}</li>
|
||||||
|
<li>prix : {#PRICE}</li>
|
||||||
|
<li>Choisir : <a href="{url path="/delivery/choose/{#ID}"}">Choisir</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{/loop}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{include file="includes/footer.html"}
|
||||||
@@ -13,6 +13,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{debugbar_render}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
{stylesheets file='../assets/css/*' filters='less,cssembed'}
|
{stylesheets file='../assets/css/*' filters='less,cssembed'}
|
||||||
<link rel="stylesheet" href="{$asset_url}">
|
<link rel="stylesheet" href="{$asset_url}">
|
||||||
{/stylesheets}
|
{/stylesheets}
|
||||||
|
{debugbar_renderHead}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
0
web/test_to_remove/datas_coupon_edit.json
Normal file → Executable file
0
web/test_to_remove/datas_coupon_edit.json
Normal file → Executable file
Reference in New Issue
Block a user