Created AbstractCrudController, and refactored existing controllers
This commit is contained in:
@@ -34,7 +34,7 @@ use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Core\Event\CurrencyDeleteEvent;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\CurrencyUpdatePositionEvent;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
class Currency extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -164,21 +164,25 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
*
|
||||
* @param CategoryChangePositionEvent $event
|
||||
*/
|
||||
public function updatePosition(CurrencyUpdatePositionEvent $event)
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if (null !== $currency = CurrencyQuery::create()->findOneById($event->getObjectId())) {
|
||||
echo "update =".$event->getObjectId();
|
||||
|
||||
if (null !== $currency = CurrencyQuery::create()->findPk($event->getObjectId())) {
|
||||
|
||||
$currency->setDispatcher($this->getDispatcher());
|
||||
|
||||
$mode = $event->getMode();
|
||||
echo "loaded $mode !";
|
||||
|
||||
if ($mode == CurrencyUpdatePositionEvent::POSITION_ABSOLUTE)
|
||||
if ($mode == UpdatePositionEvent::POSITION_ABSOLUTE)
|
||||
return $currency->changeAbsolutePosition($event->getPosition());
|
||||
else if ($mode == CurrencyUpdatePositionEvent::POSITION_UP)
|
||||
else if ($mode == UpdatePositionEvent::POSITION_UP)
|
||||
return $currency->movePositionUp();
|
||||
else if ($mode == CurrencyUpdatePositionEvent::POSITION_DOWN)
|
||||
else if ($mode == UpdatePositionEvent::POSITION_DOWN)
|
||||
return $currency->movePositionDown();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,11 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.attribute" class="Thelia\Action\Attribute">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.pageNotFound" class="Thelia\Action\PageNotFound">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
@@ -17,33 +17,369 @@
|
||||
/* 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/>. */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\AttributeDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\AttributeUpdateEvent;
|
||||
use Thelia\Core\Event\AttributeCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\AttributeQuery;
|
||||
use Thelia\Form\AttributeModificationForm;
|
||||
use Thelia\Form\AttributeCreationForm;
|
||||
use Thelia\Core\Event\AttributeUpdatePositionEvent;
|
||||
use Thelia\Form\AttributeValueCreationForm;
|
||||
use Thelia\Core\Event\AttributeValueCreateEvent;
|
||||
use Thelia\Core\Event\AttributeValueDeleteEvent;
|
||||
|
||||
/**
|
||||
* Manages messages sent by mail
|
||||
* Manages product attributes
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class AttributeController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* The default action is displaying the attributes list.
|
||||
* Render the attributes list, ensuring the sort order is set.
|
||||
*
|
||||
* @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');
|
||||
protected function renderList() {
|
||||
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
$this->getSession()->get('admin.attribute_order', 'manual')
|
||||
);
|
||||
|
||||
// Store the current sort order in session
|
||||
$this->getSession()->set('admin.attribute_order', $order);
|
||||
|
||||
return $this->render('attributes', array('order' => $order));
|
||||
}
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||
return $this->render('product-attributes-edit');
|
||||
/**
|
||||
* The default action is displaying the product 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->renderList();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new product attribute object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.create")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the Creation Form
|
||||
$creationForm = new AttributeCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the AttributeCreation event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new AttributeCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setTitle($data['title'])
|
||||
->setLocale($data["locale"])
|
||||
->setAddToAllTemplates($data['add_to_all'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_CREATE, $createEvent);
|
||||
|
||||
if (! $createEvent->hasAttribute()) throw new \LogicException($this->getTranslator()->trans("No product attribute was created."));
|
||||
|
||||
$createdObject = $createEvent->getAttribute();
|
||||
|
||||
// Log product attribute creation
|
||||
$this->adminLogAppend(sprintf("Attribute %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("product attribute creation", $error_msg, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed.
|
||||
return $this->renderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new product attribute value object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createValueAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attribute-values.create")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the Creation Form
|
||||
$creationForm = new AttributeValueCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the AttributeCreation event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new AttributeValueCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setTitle($data['title'])
|
||||
->setLocale($data["locale"])
|
||||
->setAttributeId($data["attribute_id"])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_VALUE_CREATE, $createEvent);
|
||||
|
||||
if (! $createEvent->hasAttribute()) throw new \LogicException($this->getTranslator()->trans("No product attribute value was created."));
|
||||
|
||||
$createdObject = $createEvent->getAttributeValue();
|
||||
|
||||
// Log product attribute creation
|
||||
$this->adminLogAppend(sprintf("Attribute value %s (ID %s) created", $createdObject->getTitle(), $createdObject->getId()));
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($creationForm->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("product attribute value creation", $error_msg, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed on the edition page
|
||||
return $this->render('attribute-edit', array('attribute_id' => $this->getRequest()->get('attribute_id')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a product attribute 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.configuration.attributes.update")) return $response;
|
||||
|
||||
// Load the product attribute object
|
||||
$attribute = AttributeQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('attribute_id'));
|
||||
|
||||
if ($attribute != null) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $attribute->getId(),
|
||||
'locale' => $attribute->getLocale(),
|
||||
'title' => $attribute->getTitle(),
|
||||
'chapo' => $attribute->getChapo(),
|
||||
'description' => $attribute->getDescription(),
|
||||
'postscriptum' => $attribute->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
$changeForm = new AttributeModificationForm($this->getRequest(), "form", $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('attribute-edit', array('attribute_id' => $this->getRequest()->get('attribute_id')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save changes on a modified product attribute object, and either go back to the product attribute 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.configuration.attributes.update")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the form from the request
|
||||
$changeForm = new AttributeModificationForm($this->getRequest());
|
||||
|
||||
// Get the attribute ID
|
||||
$attribute_id = $this->getRequest()->get('attribute_id');
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new AttributeUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setLocale($data["locale"])
|
||||
->setTitle($data['title'])
|
||||
->setChapo($data['chapo'])
|
||||
->setDescription($data['description'])
|
||||
->setPostscriptum($data['postscriptum'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_UPDATE, $changeEvent);
|
||||
|
||||
if (! $changeEvent->hasAttribute()) throw new \LogicException($this->getTranslator()->trans("No product attribute was updated."));
|
||||
|
||||
// Log product attribute modification
|
||||
$changedObject = $changeEvent->getAttribute();
|
||||
|
||||
$this->adminLogAppend(sprintf("Attribute %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.configuration.attributes.update",
|
||||
array('attribute_id' => $attribute_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("product attribute modification", $error_msg, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->render('attribute-edit', array('attribute_id' => $attribute_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update product attribute position
|
||||
*/
|
||||
public function updatePositionAction() {
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.attributes.update")) return $response;
|
||||
|
||||
try {
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
|
||||
if ($mode == 'up')
|
||||
$mode = AttributeUpdatePositionEvent::POSITION_UP;
|
||||
else if ($mode == 'down')
|
||||
$mode = AttributeUpdatePositionEvent::POSITION_DOWN;
|
||||
else
|
||||
$mode = AttributeUpdatePositionEvent::POSITION_ABSOLUTE;
|
||||
|
||||
$position = $this->getRequest()->get('position', null);
|
||||
|
||||
$event = new AttributeUpdatePositionEvent(
|
||||
$this->getRequest()->get('attribute_id', null),
|
||||
$mode,
|
||||
$this->getRequest()->get('position', null)
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_UPDATE_POSITION, $event);
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.attributes.default');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a product attribute object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.product attributes.delete")) return $response;
|
||||
|
||||
// Get the product attribute id, and dispatch the delet request
|
||||
$event = new AttributeDeleteEvent($this->getRequest()->get('attribute_id'));
|
||||
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_DELETE, $event);
|
||||
|
||||
if ($event->hasAttribute())
|
||||
$this->adminLogAppend(sprintf("Attribute %s (ID %s) deleted", $event->getAttribute()->getTitle(), $event->getAttribute()->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.attributes.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a product attribute value object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteValueAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.product attribute-values.delete")) return $response;
|
||||
|
||||
// Get the product attribute id, and dispatch the delet request
|
||||
$event = new AttributeValueDeleteEvent($this->getRequest()->get('value_id'));
|
||||
|
||||
$this->dispatch(TheliaEvents::ATTRIBUTE_VALUE_DELETE, $event);
|
||||
|
||||
if ($event->hasAttributeValue())
|
||||
$this->adminLogAppend(sprintf("Attribute value %s (ID %s) deleted", $event->getAttributeValue()->getTitle(), $event->getAttributeValue()->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.attributes.default');
|
||||
}
|
||||
}
|
||||
@@ -288,7 +288,7 @@ class ConfigController extends BaseAdminController
|
||||
$this->dispatch(TheliaEvents::CONFIG_DELETE, $event);
|
||||
|
||||
if ($event->hasConfig())
|
||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) modified", $event->getConfig()->getName(), $event->getConfig()->getId()));
|
||||
$this->adminLogAppend(sprintf("Variable %s (ID %s) deleted", $event->getConfig()->getName(), $event->getConfig()->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.variables.default');
|
||||
}
|
||||
|
||||
@@ -25,219 +25,167 @@ namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Event\CurrencyDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Form\CurrencyModificationForm;
|
||||
use Thelia\Form\CurrencyCreationForm;
|
||||
use Thelia\Core\Event\CurrencyUpdatePositionEvent;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages currencies sent by mail
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class CurrencyController extends BaseAdminController
|
||||
class CurrencyController extends AbstractCrudController
|
||||
{
|
||||
/**
|
||||
* Render the currencies list, ensuring the sort order is set.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList()
|
||||
{
|
||||
// Find the current order
|
||||
$order = $this->getRequest()->get(
|
||||
'order',
|
||||
$this->getSession()->get('admin.currency_order', 'manual')
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'currency',
|
||||
'manual',
|
||||
|
||||
'admin.configuration.currencies.view',
|
||||
'admin.configuration.currencies.create',
|
||||
'admin.configuration.currencies.update',
|
||||
'admin.configuration.currencies.delete',
|
||||
|
||||
TheliaEvents::CURRENCY_CREATE,
|
||||
TheliaEvents::CURRENCY_UPDATE,
|
||||
TheliaEvents::CURRENCY_DELETE,
|
||||
null, // No visibility toggle
|
||||
TheliaEvents::CURRENCY_UPDATE_POSITION
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCreationForm() {
|
||||
return new CurrencyCreationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getUpdateForm() {
|
||||
return new CurrencyModificationForm($this->getRequest());
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData) {
|
||||
$createEvent = new CurrencyCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setCurrencyName($formData['name'])
|
||||
->setLocale($formData["locale"])
|
||||
->setSymbol($formData['symbol'])
|
||||
->setCode($formData['code'])
|
||||
->setRate($formData['rate'])
|
||||
;
|
||||
|
||||
return $createEvent;
|
||||
}
|
||||
|
||||
protected function getUpdateEvent($formData) {
|
||||
$changeEvent = new CurrencyUpdateEvent($formData['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setCurrencyName($formData['name'])
|
||||
->setLocale($formData["locale"])
|
||||
->setSymbol($formData['symbol'])
|
||||
->setCode($formData['code'])
|
||||
->setRate($formData['rate'])
|
||||
;
|
||||
|
||||
return $changeEvent;
|
||||
}
|
||||
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue) {
|
||||
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('currency_id', null),
|
||||
$positionChangeMode,
|
||||
$positionValue
|
||||
);
|
||||
}
|
||||
|
||||
protected function createToggleVisibilityEvent() {
|
||||
|
||||
return new ToggleVisibilityEvent($this->getRequest()->get('currency_id', null));
|
||||
}
|
||||
|
||||
protected function getDeleteEvent() {
|
||||
return new CurrencyDeleteEvent($this->getRequest()->get('currency_id'));
|
||||
}
|
||||
|
||||
protected function eventContainsObject($event) {
|
||||
return $event->hasCurrency();
|
||||
}
|
||||
|
||||
protected function hydrateObjectForm($object) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'name' => $object->getName(),
|
||||
'locale' => $object->getLocale(),
|
||||
'code' => $object->getCode(),
|
||||
'symbol' => $object->getSymbol(),
|
||||
'rate' => $object->getRate()
|
||||
);
|
||||
|
||||
// Store the current sort order in session
|
||||
$this->getSession()->set('admin.currency_order', $order);
|
||||
|
||||
return $this->render('currencies', array('order' => $order));
|
||||
// Setup the object form
|
||||
return new CurrencyModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The default action is displaying the currencies list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.view")) return $response;
|
||||
return $this->renderList();
|
||||
protected function getObjectFromEvent($event) {
|
||||
return $event->hasCurrency() ? $event->getCurrency() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new currency object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.create")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the Creation Form
|
||||
$creationForm = new CurrencyCreationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Validate the form, create the CurrencyCreation event and dispatch it.
|
||||
$form = $this->validateForm($creationForm, "POST");
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new CurrencyCreateEvent();
|
||||
|
||||
$createEvent
|
||||
->setCurrencyName($data['name'])
|
||||
->setLocale($data["locale"])
|
||||
->setSymbol($data['symbol'])
|
||||
->setCode($data['code'])
|
||||
->setRate($data['rate'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent);
|
||||
|
||||
if (! $createEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was created."));
|
||||
|
||||
$createdObject = $createEvent->getCurrency();
|
||||
|
||||
// Log currency creation
|
||||
$this->adminLogAppend(sprintf("Currency %s (ID %s) created", $createdObject->getName(), $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("currency creation", $error_msg, $creationForm, $ex);
|
||||
|
||||
// At this point, the form has error, and should be redisplayed.
|
||||
return $this->renderList();
|
||||
protected function getExistingObject() {
|
||||
return CurrencyQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('currency_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a currency 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.configuration.currencies.update")) return $response;
|
||||
protected function getObjectLabel($object) {
|
||||
return $object->getName();
|
||||
}
|
||||
|
||||
// Load the currency object
|
||||
$currency = CurrencyQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('currency_id'));
|
||||
protected function getObjectId($object) {
|
||||
return $object->getId();
|
||||
}
|
||||
|
||||
if ($currency != null) {
|
||||
protected function renderListTemplate($currentOrder) {
|
||||
return $this->render('currencies', array('order' => $currentOrder));
|
||||
}
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $currency->getId(),
|
||||
'name' => $currency->getName(),
|
||||
'locale' => $currency->getLocale(),
|
||||
'code' => $currency->getCode(),
|
||||
'symbol' => $currency->getSymbol(),
|
||||
'rate' => $currency->getRate()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
$changeForm = new CurrencyModificationForm($this->getRequest(), "form", $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($changeForm);
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
protected function renderEditionTemplate() {
|
||||
return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id')));
|
||||
}
|
||||
|
||||
protected function redirectToEditionTemplate() {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.currencies.update",
|
||||
array('currency_id' => $this->getRequest()->get('currency_id'))
|
||||
);
|
||||
}
|
||||
|
||||
protected function redirectToListTemplate() {
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save changes on a modified currency object, and either go back to the currency list, or stay on the edition page.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* Update currencies rates
|
||||
*/
|
||||
public function saveChangeAction()
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the form from the request
|
||||
$changeForm = new CurrencyModificationForm($this->getRequest());
|
||||
|
||||
// Get the currency ID
|
||||
$currency_id = $this->getRequest()->get('currency_id');
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new CurrencyUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
->setCurrencyName($data['name'])
|
||||
->setLocale($data["locale"])
|
||||
->setSymbol($data['symbol'])
|
||||
->setCode($data['code'])
|
||||
->setRate($data['rate'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE, $changeEvent);
|
||||
|
||||
if (! $changeEvent->hasCurrency()) throw new \LogicException($this->getTranslator()->trans("No currency was updated."));
|
||||
|
||||
// Log currency modification
|
||||
$changedObject = $changeEvent->getCurrency();
|
||||
|
||||
$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,
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.currencies.update",
|
||||
array('currency_id' => $currency_id)
|
||||
);
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext("currency modification", $error_msg, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->render('currency-edit', array('currency_id' => $currency_id));
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,80 +208,7 @@ class CurrencyController extends BaseAdminController
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
$this->redirectToListTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update currencies rates
|
||||
*/
|
||||
public function updateRatesAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
try {
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_RATES);
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update currencyposition
|
||||
*/
|
||||
public function updatePositionAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
try {
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
|
||||
if ($mode == 'up')
|
||||
$mode = CurrencyUpdatePositionEvent::POSITION_UP;
|
||||
else if ($mode == 'down')
|
||||
$mode = CurrencyUpdatePositionEvent::POSITION_DOWN;
|
||||
else
|
||||
$mode = CurrencyUpdatePositionEvent::POSITION_ABSOLUTE;
|
||||
|
||||
$position = $this->getRequest()->get('position', null);
|
||||
|
||||
$event = new CurrencyUpdatePositionEvent(
|
||||
$this->getRequest()->get('currency_id', null),
|
||||
$mode,
|
||||
$this->getRequest()->get('position', null)
|
||||
);
|
||||
|
||||
$this->dispatch(TheliaEvents::CURRENCY_UPDATE_POSITION, $event);
|
||||
} catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a currency object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.delete")) return $response;
|
||||
|
||||
// Get the currency id, and dispatch the delet request
|
||||
$event = new CurrencyDeleteEvent($this->getRequest()->get('currency_id'));
|
||||
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ class MessageController extends BaseAdminController
|
||||
$this->dispatch(TheliaEvents::MESSAGE_DELETE, $event);
|
||||
|
||||
if ($event->hasMessage())
|
||||
$this->adminLogAppend(sprintf("Message %s (ID %s) modified", $event->getMessage()->getName(), $event->getMessage()->getId()));
|
||||
$this->adminLogAppend(sprintf("Message %s (ID %s) deleted", $event->getMessage()->getName(), $event->getMessage()->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.messages.default');
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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 CategoryUpdatePositionEvent extends BaseUpdatePositionEvent
|
||||
{
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?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 CurrencyUpdatePositionEvent extends BaseUpdatePositionEvent
|
||||
{
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class BaseToggleVisibilityEvent extends ActionEvent
|
||||
class ToggleVisibilityEvent extends ActionEvent
|
||||
{
|
||||
protected $object_id;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
class BaseUpdatePositionEvent extends ActionEvent
|
||||
class UpdatePositionEvent extends ActionEvent
|
||||
{
|
||||
const POSITION_UP = 1;
|
||||
const POSITION_DOWN = 2;
|
||||
@@ -66,7 +66,7 @@ class Attribute extends BaseI18nLoop
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
||||
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
||||
),
|
||||
'manual'
|
||||
)
|
||||
@@ -129,6 +129,12 @@ class Attribute extends BaseI18nLoop
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "id":
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case "id_reverse":
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
case "alpha":
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
|
||||
@@ -79,7 +79,7 @@ class Category extends BaseI18nLoop
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random'))
|
||||
new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'visible', 'visible_reverse', 'random'))
|
||||
),
|
||||
'manual'
|
||||
),
|
||||
@@ -132,6 +132,12 @@ class Category extends BaseI18nLoop
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "id":
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case "id_reverse":
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
case "alpha":
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
|
||||
@@ -3,7 +3,69 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\Attribute as BaseAttribute;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\AttributeEvent;
|
||||
|
||||
class Attribute extends BaseAttribute {
|
||||
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEATTRIBUTE, new AttributeEvent($this));
|
||||
|
||||
// Set the current position for the new object
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATEATTRIBUTE, new AttributeEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEATTRIBUTE, new AttributeEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEATTRIBUTE, new AttributeEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEATTRIBUTE, new AttributeEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETEATTRIBUTE, new AttributeEvent($this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,85 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\AttributeAv as BaseAttributeAv;
|
||||
use Thelia\Core\Event\AttributeValueEvent;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
|
||||
class AttributeAv extends BaseAttributeAv {
|
||||
|
||||
}
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* Get the position of the next inserted object
|
||||
*/
|
||||
public function getNextPosition($parent = null) {
|
||||
|
||||
$last = $this->createQuery()
|
||||
->filterByAttributeId($this->getAttributeId())
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->limit(1)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
return $last != null ? $last->getPosition() + 1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEATTRIBUTE_VALUE, new AttributeValueEvent($this));
|
||||
|
||||
// Set the current position for the new object
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATEATTRIBUTE_VALUE, new AttributeValueEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATEATTRIBUTE_VALUE, new AttributeValueEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postUpdate(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_UPDATEATTRIBUTE_VALUE, new AttributeValueEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function preDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_DELETEATTRIBUTE_VALUE, new AttributeValueEvent($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function postDelete(ConnectionInterface $con = null)
|
||||
{
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETEATTRIBUTE_VALUE, new AttributeValueEvent($this));
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@ trait PositionManagementTrait {
|
||||
* Move up a object
|
||||
*/
|
||||
public function movePositionUp() {
|
||||
echo "move up !";
|
||||
$this->movePositionUpOrDown(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,3 +23,4 @@ Variables Config à initialiser:
|
||||
- images_library_path : chemin vers le répertoire où sont stockés les images source (defaut: local/media/images)
|
||||
- image_cache_dir_from_web_root : le repértoire de base où sont cachées les images, relatif à /web (cache/images)
|
||||
- imagine_graphic_driver : le drivers utilisé par Imagine (gd, imagik, gmagick), defaut: 'gd'
|
||||
- process_assets : ne pas processer les assets pour de meilleurs perfs (attention, les modifs sur les fichiers ne seront plus reportées !)
|
||||
|
||||
266
templates/admin/default/attributes.html
Normal file
266
templates/admin/default/attributes.html
Normal file
@@ -0,0 +1,266 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Thelia Product Attributes'}{/block}
|
||||
|
||||
{block name="check-permissions"}admin.configuration.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/attributes'}">{intl l="Product attributes"}</a></li>
|
||||
</ul>
|
||||
|
||||
{module_include location='attributes_top'}
|
||||
|
||||
<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'}
|
||||
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attributes.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product attribute'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='id'
|
||||
reverse_order='id_reverse'
|
||||
path='/admin/configuration/attributes'
|
||||
label="{intl l='ID'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='alpha'
|
||||
reverse_order='alpha_reverse'
|
||||
path='/admin/configuration/attributes'
|
||||
label="{intl l='Title'}"
|
||||
}
|
||||
</th>
|
||||
|
||||
<th class="text-center">
|
||||
{admin_sortable_header
|
||||
current_order=$order
|
||||
order='manual'
|
||||
reverse_order='manual_reverse'
|
||||
path='/admin/configuration/attributes'
|
||||
label="{intl l="Position"}"
|
||||
}
|
||||
</th>
|
||||
|
||||
{module_include location='attributes_table_header'}
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="list" type="attribute" backend_context="1" lang=$lang_id order=$order}
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
<a title="{intl l='Change this attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}">{$TITLE}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$TITLE}
|
||||
{/elseloop}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{admin_position_block
|
||||
permission="admin.attributes.edit"
|
||||
path="/admin/configuration/attributes/update-position"
|
||||
url_parameter="attribute_id"
|
||||
in_place_edit_class="positionChange"
|
||||
position="$POSITION"
|
||||
id="$ID"
|
||||
}
|
||||
</td>
|
||||
|
||||
{module_include location='attributes_table_row'}
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
|
||||
<a class="btn btn-default btn-xs attribute-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.delete"}
|
||||
<a class="btn btn-default btn-xs attribute-delete" title="{intl l='Delete this product attribute'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="list"}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div class="alert alert-info">
|
||||
{intl l="No product attribute has been created yet. Click the + button to create one."}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/elseloop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='attributes_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* Adding a new attribute *}
|
||||
|
||||
{form name="thelia.admin.attribute.creation"}
|
||||
|
||||
{* 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'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created attribute ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/attributes/update' attribute_id='_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">{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}" class="form-control" value="{$value}" title="{intl l='Attribute title'}" placeholder="{intl l='Title'}">
|
||||
<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 attribute name in the default language ($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}
|
||||
|
||||
{form_field form=$form field='add_to_all'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<div class="checkbox {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
<input type="checkbox" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
|
||||
{$label}
|
||||
</label>
|
||||
<span class="help-block">{intl l='Check this box if you want to add this attributes to all product templates'}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='attribute_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new attribute"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this attribute"}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="attribute_id" id="attribute_delete_id" value="" />
|
||||
|
||||
{module_include location='attribute_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete attribute"}
|
||||
dialog_message = {intl l="Do you really want to delete this attribute ? It will be removed from all product templates."}
|
||||
|
||||
form_action = {url path='/admin/configuration/attributes/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Set proper attribute ID in delete from
|
||||
$('a.attribute-delete').click(function(ev) {
|
||||
$('#attribute_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.attribute.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
$('.positionChange').editable({
|
||||
type : 'text',
|
||||
title : '{intl l="Enter new attribute position"}',
|
||||
mode : 'popup',
|
||||
inputclass : 'input-mini',
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url path='/admin/configuration/attributes/update-position' attribute_id='__ID__' position='__POS__'}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id'))
|
||||
.replace('__POS__', newValue);
|
||||
|
||||
// Reload the page
|
||||
location.href = url;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -327,7 +327,6 @@
|
||||
|
||||
{* Adding a new Category *}
|
||||
|
||||
|
||||
{form name="thelia.admin.category.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
@@ -366,6 +365,9 @@
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='category_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -389,6 +391,9 @@
|
||||
{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"" />
|
||||
|
||||
{module_include location='category_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<div class="form-horizontal col-md-12">
|
||||
<fieldset>
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='admin/catalog/category/edit' category_id=$current_category_id}"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -136,7 +136,7 @@
|
||||
<div class="tab-pane form-container" id="details">
|
||||
<div class="form-horizontal col-md-12">
|
||||
<fieldset>
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='admin/catalog/category/edit' category_id=$current_category_id}"}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
@@ -22,24 +22,24 @@
|
||||
|
||||
{module_include location='catalog_configuration_top'}
|
||||
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.product_templates"}
|
||||
{loop type="auth" name="pcc1" roles="ADMIN" permissions="admin.configuration.templates"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/product_templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/product-templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
<td><a href="{url path='/admin/configuration/templates'}">{intl l='Product templates'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/templates'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.product_attributes"}
|
||||
{loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.attributes"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/product_attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/product-attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
<td><a href="{url path='/admin/configuration/attributes'}">{intl l='Product attributes'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/attributes'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.product_features"}
|
||||
{loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.features"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/product_features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/product-features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
<td><a href="{url path='/admin/configuration/features'}">{intl l='Product features'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/features'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{include file="includes/coupon_breadcrumb.html"}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Coupons : <small>List of coupons</small></h1>
|
||||
</div>
|
||||
@@ -28,7 +28,7 @@
|
||||
<th>Expiration date</th>
|
||||
<th>Usage left</th>
|
||||
<th class="sorter-false filter-false">Actions</th>
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -146,8 +146,8 @@
|
||||
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'}
|
||||
|
||||
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
|
||||
@@ -255,6 +255,8 @@
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='currency_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -277,6 +279,9 @@
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
|
||||
|
||||
{module_include location='currency_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
{* Be sure to get the currency ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="currency_id" value="{$currency_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/currencies'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" lang="$edit_language_id"}
|
||||
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="{url path='/admin/customers'}">{intl l="Customers"}</a></li>
|
||||
<li>{intl l='Editing customer "%name"' name="{$FIRSTNAME} {$LASTNAME}"}</li>
|
||||
</ul>
|
||||
@@ -34,7 +34,7 @@
|
||||
{* Be sure to get the customer ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/customers'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
@@ -44,18 +44,18 @@
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<p class="title title-without-tabs">{intl l="Customer informations"}</p>
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
{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>
|
||||
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}">{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
{/form_field}
|
||||
|
||||
{loop name="address" type="address" customer="$customer_id" backend_context="1" default="true"}
|
||||
|
||||
|
||||
<p class="title title-without-tabs">{intl l="Default address"}</p>
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
@@ -85,16 +85,16 @@
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address2'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS2}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS2}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address3'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS3}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS3}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
@@ -119,16 +119,16 @@
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
{/loop}
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<p class="title title-without-tabs clearfix">
|
||||
{intl l="Other addresses"}
|
||||
<span class="pull-right">
|
||||
<span class="pull-right">
|
||||
<a class="btn btn-default btn-primary" title="{intl l='Add a new address'}" href="#address_creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
@@ -154,11 +154,11 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
|
||||
<span class="glyphicon glyphicon-pushpin"></span>
|
||||
</a>
|
||||
@@ -166,7 +166,7 @@
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -181,11 +181,11 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
|
||||
<span class="glyphicon glyphicon-pushpin"></span>
|
||||
</a>
|
||||
@@ -193,7 +193,7 @@
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -208,11 +208,11 @@
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit"></span>
|
||||
</a>
|
||||
|
||||
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Use this address by default'}" href="#use_address_dialog" data-toggle="modal" rel="tooltip">
|
||||
<span class="glyphicon glyphicon-pushpin"></span>
|
||||
</a>
|
||||
@@ -220,7 +220,7 @@
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_address_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -258,12 +258,12 @@
|
||||
{* Add an Address *}
|
||||
|
||||
{form name="thelia.address.create"}
|
||||
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "address_creation_dialog"}
|
||||
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
|
||||
{form_field form=$form field='label'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
@@ -277,16 +277,16 @@
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
|
||||
{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>
|
||||
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}">{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -307,13 +307,13 @@
|
||||
{form_field form=$form field='address1'}
|
||||
<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}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address2'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -346,10 +346,10 @@
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
@@ -370,12 +370,12 @@
|
||||
{* Update an Address *}
|
||||
|
||||
{form name="thelia.address.update"}
|
||||
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "edit_address_dialog"}
|
||||
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
|
||||
{form_field form=$form field='label'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
@@ -389,16 +389,16 @@
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
|
||||
{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>
|
||||
|
||||
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="title" name="title1"}
|
||||
<option value="{$ID}">{$LONG}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
@@ -419,13 +419,13 @@
|
||||
{form_field form=$form field='address1'}
|
||||
<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}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{form_field form=$form field='address2'}
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -458,10 +458,10 @@
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form_field}
|
||||
|
||||
{/capture}
|
||||
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
@@ -478,8 +478,8 @@
|
||||
}
|
||||
|
||||
{/form}
|
||||
|
||||
|
||||
|
||||
|
||||
{* Default confirmation dialog *}
|
||||
|
||||
{capture "use_address_dialog"}
|
||||
|
||||
@@ -22,7 +22,7 @@ Parameters:
|
||||
|
||||
{* Always reset create dialog on close *}
|
||||
|
||||
$('#{$dialog_id}').on('hidden', function() {
|
||||
$('#{$dialog_id}').on('hidden.bs.modal', function() {
|
||||
|
||||
// Hide error message
|
||||
$('#{$dialog_id}_error').remove();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<ul class="nav nav-pills">
|
||||
{loop name="lang_list" type="lang" default_only={$default_only}}
|
||||
<li {if $ID == $edit_language_id}class="active"{/if}>
|
||||
<a href="{$current_url}&edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
|
||||
<a href="{$current_url nofilter}&edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
|
||||
<img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" />
|
||||
</a>
|
||||
</li>
|
||||
@@ -21,7 +21,10 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 inner-actions">
|
||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-success" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
<button type="submit" name="save_mode" value="close" class="btn btn-default btn-info" title="{intl l='Save and close'}">{intl l='Save and close'} <span class="glyphicon glyphicon-remove"></span></button>
|
||||
{if ! empty($close_url)}
|
||||
<a href="{$close_url}" class="btn btn-default">{intl l='Close'} <span class="glyphicon glyphicon-remove"></span></a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
<div class="col-md-12">
|
||||
{form name="thelia.admin.message.modification"}
|
||||
<form method="POST" action="{url path='/admin/configuration/messages/save'}" {form_enctype form=$form}>
|
||||
|
||||
|
||||
{* Be sure to get the message ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="message_id" value="{$message_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/messages'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
@@ -51,33 +51,33 @@
|
||||
{/form_field}
|
||||
|
||||
{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>
|
||||
<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>
|
||||
</label>
|
||||
</div>
|
||||
{/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">{intl l="{$label}"} : </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='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value|htmlspecialchars}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='subject'}
|
||||
<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}" name="{$name}" required="required" title="{intl l='Subject'}" placeholder="{intl l='Subject'}" class="form-control" value="{$value|htmlspecialchars}">
|
||||
</div>
|
||||
{/form_field}
|
||||
@@ -85,7 +85,7 @@
|
||||
{form_field form=$form field='html_message'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l="{$label}"} :
|
||||
{intl l="{$label}"} :
|
||||
<span class="label-help-block">{intl l="The mailing template in HTML format."}</span>
|
||||
</label>
|
||||
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
|
||||
@@ -95,17 +95,17 @@
|
||||
{form_field form=$form field='text_message'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{intl l="{$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="form-group">
|
||||
<div class="form-group">
|
||||
<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>
|
||||
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
@@ -152,6 +152,9 @@
|
||||
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{module_include location='message_create_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -173,6 +176,9 @@
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
||||
|
||||
{module_include location='message_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
{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}
|
||||
@@ -34,7 +34,7 @@
|
||||
{* Be sure to get the variable ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="variable_id" value="{$variable_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/variables'}"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
@@ -57,27 +57,27 @@
|
||||
{/form_field}
|
||||
|
||||
{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">
|
||||
<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='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|htmlspecialchars}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="form-control">
|
||||
<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>
|
||||
{/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>
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
|
||||
@@ -194,6 +194,9 @@
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
|
||||
{module_include location='variable_create_form'}
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
@@ -215,6 +218,9 @@
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
|
||||
|
||||
{module_include location='variable_delete_form'}
|
||||
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
|
||||
Reference in New Issue
Block a user