diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php index 619374902..b73dd0184 100644 --- a/core/lib/Thelia/Action/Currency.php +++ b/core/lib/Thelia/Action/Currency.php @@ -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; } /** diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index dd43bbb91..07e4637ee 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -57,6 +57,11 @@ + + + + + diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php index 50e32955d..0e1633210 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeController.php @@ -1,7 +1,7 @@ . */ +/* along with this program. If not, see . */ /* */ /*************************************************************************************/ 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 */ 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'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index 397266677..785920562 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -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'); } diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php index ff2db0ab2..ae1005432 100644 --- a/core/lib/Thelia/Controller/Admin/CurrencyController.php +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -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 */ -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'); - } } diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index b5316efdd..d2d319255 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -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'); } diff --git a/core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php b/core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php deleted file mode 100644 index 701fd4c8a..000000000 --- a/core/lib/Thelia/Core/Event/CategoryUpdatePositionEvent.php +++ /dev/null @@ -1,28 +0,0 @@ -. */ -/* */ -/*************************************************************************************/ - -namespace Thelia\Core\Event; - -class CategoryUpdatePositionEvent extends BaseUpdatePositionEvent -{ -} diff --git a/core/lib/Thelia/Core/Event/CurrencyUpdatePositionEvent.php b/core/lib/Thelia/Core/Event/CurrencyUpdatePositionEvent.php deleted file mode 100644 index fad51f2c7..000000000 --- a/core/lib/Thelia/Core/Event/CurrencyUpdatePositionEvent.php +++ /dev/null @@ -1,28 +0,0 @@ -. */ -/* */ -/*************************************************************************************/ - -namespace Thelia\Core\Event; - -class CurrencyUpdatePositionEvent extends BaseUpdatePositionEvent -{ -} diff --git a/core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php similarity index 97% rename from core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php rename to core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php index 65be75292..996292c8e 100644 --- a/core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/ToggleVisibilityEvent.php @@ -23,7 +23,7 @@ namespace Thelia\Core\Event; -class BaseToggleVisibilityEvent extends ActionEvent +class ToggleVisibilityEvent extends ActionEvent { protected $object_id; diff --git a/core/lib/Thelia/Core/Event/BaseUpdatePositionEvent.php b/core/lib/Thelia/Core/Event/UpdatePositionEvent.php similarity index 98% rename from core/lib/Thelia/Core/Event/BaseUpdatePositionEvent.php rename to core/lib/Thelia/Core/Event/UpdatePositionEvent.php index 9b58ecfeb..e75e30b98 100644 --- a/core/lib/Thelia/Core/Event/BaseUpdatePositionEvent.php +++ b/core/lib/Thelia/Core/Event/UpdatePositionEvent.php @@ -23,7 +23,7 @@ namespace Thelia\Core\Event; -class BaseUpdatePositionEvent extends ActionEvent +class UpdatePositionEvent extends ActionEvent { const POSITION_UP = 1; const POSITION_DOWN = 2; diff --git a/core/lib/Thelia/Core/Template/Loop/Attribute.php b/core/lib/Thelia/Core/Template/Loop/Attribute.php index 5ab4a2b4e..cb3a25e17 100755 --- a/core/lib/Thelia/Core/Template/Loop/Attribute.php +++ b/core/lib/Thelia/Core/Template/Loop/Attribute.php @@ -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; diff --git a/core/lib/Thelia/Core/Template/Loop/Category.php b/core/lib/Thelia/Core/Template/Loop/Category.php index 91cb90b0a..2b1156b98 100755 --- a/core/lib/Thelia/Core/Template/Loop/Category.php +++ b/core/lib/Thelia/Core/Template/Loop/Category.php @@ -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; diff --git a/core/lib/Thelia/Model/Attribute.php b/core/lib/Thelia/Model/Attribute.php index 34512b33b..b4101da8c 100755 --- a/core/lib/Thelia/Model/Attribute.php +++ b/core/lib/Thelia/Model/Attribute.php @@ -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)); + } } diff --git a/core/lib/Thelia/Model/AttributeAv.php b/core/lib/Thelia/Model/AttributeAv.php index a09db787c..2b70881d7 100755 --- a/core/lib/Thelia/Model/AttributeAv.php +++ b/core/lib/Thelia/Model/AttributeAv.php @@ -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)); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php index eb71564eb..d5cc4ea63 100644 --- a/core/lib/Thelia/Model/Tools/PositionManagementTrait.php +++ b/core/lib/Thelia/Model/Tools/PositionManagementTrait.php @@ -67,6 +67,7 @@ trait PositionManagementTrait { * Move up a object */ public function movePositionUp() { + echo "move up !"; $this->movePositionUpOrDown(true); } diff --git a/install/INSTALL-TODO.txt b/install/INSTALL-TODO.txt index 0b8001fe9..df1e39a8d 100755 --- a/install/INSTALL-TODO.txt +++ b/install/INSTALL-TODO.txt @@ -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 !) diff --git a/templates/admin/default/attributes.html b/templates/admin/default/attributes.html new file mode 100644 index 000000000..eab4996ac --- /dev/null +++ b/templates/admin/default/attributes.html @@ -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"} +
+ +
+ + + + {module_include location='attributes_top'} + +
+
+
+
+ + + + + + + + + + + {module_include location='attributes_table_header'} + + + + + + + {loop name="list" type="attribute" backend_context="1" lang=$lang_id order=$order} + + + + + + + + {module_include location='attributes_table_row'} + + + + {/loop} + + {elseloop rel="list"} + + + + {/elseloop} + +
+ {intl l='Thelia product attributes'} + + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.attributes.create"} + + + + {/loop} +
+ {admin_sortable_header + current_order=$order + order='id' + reverse_order='id_reverse' + path='/admin/configuration/attributes' + label="{intl l='ID'}" + } + + {admin_sortable_header + current_order=$order + order='alpha' + reverse_order='alpha_reverse' + path='/admin/configuration/attributes' + label="{intl l='Title'}" + } + + {admin_sortable_header + current_order=$order + order='manual' + reverse_order='manual_reverse' + path='/admin/configuration/attributes' + label="{intl l="Position"}" + } + {intl l="Actions"}
{$ID} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"} + {$TITLE} + {/loop} + {elseloop rel="can_change"} + {$TITLE} + {/elseloop} + + {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" + } + +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"} + + {/loop} + + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.delete"} + + {/loop} +
+
+
+ {intl l="No product attribute has been created yet. Click the + button to create one."} +
+
+
+
+
+
+ + {module_include location='attributes_bottom'} + +
+
+ +{* 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 *} + + {/form_field} + + {form_field form=$form field='title'} +
+ + + {loop type="lang" name="default-lang" default_only="1"} +
+ + {intl l=$TITLE} +
+ +
{intl l="Enter here the attribute name in the default language ($TITLE)"}
+ + {* Switch edition to the current locale *} + + + {form_field form=$form field='locale'} + + {/form_field} + {/loop} +
+ {/form_field} + + {form_field form=$form field='add_to_all'} +
+
+ + {intl l='Check this box if you want to add this attributes to all product templates'} +
+
+ {/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"} + + + {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'} + + {/javascripts} + + +{/block} \ No newline at end of file diff --git a/templates/admin/default/categories.html b/templates/admin/default/categories.html index 1d1cf53c2..0423bcc66 100755 --- a/templates/admin/default/categories.html +++ b/templates/admin/default/categories.html @@ -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} {/form_field} + + {module_include location='category_create_form'} + {/capture} {include @@ -389,6 +391,9 @@ {capture "category_delete_dialog"} + + {module_include location='category_delete_form'} + {/capture} {include diff --git a/templates/admin/default/category-edit.html b/templates/admin/default/category-edit.html index 7f59fd38e..e01849475 100755 --- a/templates/admin/default/category-edit.html +++ b/templates/admin/default/category-edit.html @@ -53,7 +53,7 @@
- {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}"}
@@ -136,7 +136,7 @@
- {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}"}
diff --git a/templates/admin/default/configuration.html b/templates/admin/default/configuration.html index 70b7cffb8..0bf0e9bed 100644 --- a/templates/admin/default/configuration.html +++ b/templates/admin/default/configuration.html @@ -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"} - {intl l='Product templates'} - + {intl l='Product templates'} + {/loop} - {loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.product_attributes"} + {loop type="auth" name="pcc2" roles="ADMIN" permissions="admin.configuration.attributes"} - {intl l='Product attributes'} - + {intl l='Product attributes'} + {/loop} - {loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.product_features"} + {loop type="auth" name="pcc3" roles="ADMIN" permissions="admin.configuration.features"} - {intl l='Product features'} - + {intl l='Product features'} + {/loop} diff --git a/templates/admin/default/coupon-list.html b/templates/admin/default/coupon-list.html index 331b97231..e4a1d5e36 100755 --- a/templates/admin/default/coupon-list.html +++ b/templates/admin/default/coupon-list.html @@ -10,7 +10,7 @@ {include file="includes/coupon_breadcrumb.html"} - + @@ -28,7 +28,7 @@ Expiration date Usage left Actions - + @@ -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'} {/javascripts} diff --git a/templates/admin/default/currencies.html b/templates/admin/default/currencies.html index 5854b2f49..72bf01e75 100644 --- a/templates/admin/default/currencies.html +++ b/templates/admin/default/currencies.html @@ -255,6 +255,8 @@
{/form_field} + {module_include location='currency_create_form'} + {/capture} {include @@ -277,6 +279,9 @@ {capture "delete_dialog"} + + {module_include location='currency_delete_form'} + {/capture} {include diff --git a/templates/admin/default/currency-edit.html b/templates/admin/default/currency-edit.html index 6c85d604a..cc7ac16ac 100644 --- a/templates/admin/default/currency-edit.html +++ b/templates/admin/default/currency-edit.html @@ -35,7 +35,7 @@ {* Be sure to get the currency ID, even if the form could not be validated *} - {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} diff --git a/templates/admin/default/customer-edit.html b/templates/admin/default/customer-edit.html index c512bb056..d14e0056a 100644 --- a/templates/admin/default/customer-edit.html +++ b/templates/admin/default/customer-edit.html @@ -10,9 +10,9 @@
{loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" lang="$edit_language_id"} - + @@ -34,7 +34,7 @@ {* Be sure to get the customer ID, even if the form could not be validated *} - {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}
{$form_error_message}
{/if} -
+

{intl l="Customer informations"}

- {form_field form=$form field='title'} + {form_field form=$form field='title'}
- + +
{/form_field} @@ -74,7 +74,7 @@ {/form_field} {loop name="address" type="address" customer="$customer_id" backend_context="1" default="true"} - +

{intl l="Default address"}

{form_field form=$form field='address1'} @@ -85,16 +85,16 @@ {/form_field} {form_field form=$form field='address2'} -
- +
+
- {/form_field} + {/form_field} {form_field form=$form field='address3'} -
- +
+
- {/form_field} + {/form_field} {form_field form=$form field='zipcode'}
@@ -119,16 +119,16 @@ {/loop}
- {/form_field} + {/form_field} - {/loop} + {/loop}

{intl l="Other addresses"} - + @@ -154,11 +154,11 @@

- + - + @@ -166,7 +166,7 @@ - +
@@ -181,11 +181,11 @@
- + - + @@ -193,7 +193,7 @@ - +
@@ -208,11 +208,11 @@
- + - + @@ -220,7 +220,7 @@ - +
@@ -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'}
@@ -277,16 +277,16 @@
{/form_field} - - {form_field form=$form field='title'} + + {form_field form=$form field='title'}
- + +
{/form_field} @@ -307,13 +307,13 @@ {form_field form=$form field='address1'}
- +
{form_field form=$form field='address2'} - {/form_field} + {/form_field}
@@ -346,10 +346,10 @@ {/loop}
- {/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'}
@@ -389,16 +389,16 @@
{/form_field} - - {form_field form=$form field='title'} + + {form_field form=$form field='title'}
- + +
{/form_field} @@ -419,13 +419,13 @@ {form_field form=$form field='address1'}
- +
{form_field form=$form field='address2'} - {/form_field} + {/form_field}
@@ -458,10 +458,10 @@ {/loop}
- {/form_field} + {/form_field} {/capture} - + {include file = "includes/generic-create-dialog.html" @@ -478,8 +478,8 @@ } {/form} - - + + {* Default confirmation dialog *} {capture "use_address_dialog"} diff --git a/templates/admin/default/includes/generic-js-dialog.html b/templates/admin/default/includes/generic-js-dialog.html index 051aefd29..aca78e1bc 100644 --- a/templates/admin/default/includes/generic-js-dialog.html +++ b/templates/admin/default/includes/generic-js-dialog.html @@ -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(); diff --git a/templates/admin/default/includes/inner-form-toolbar.html b/templates/admin/default/includes/inner-form-toolbar.html index 0b37d7bd8..518c204e3 100755 --- a/templates/admin/default/includes/inner-form-toolbar.html +++ b/templates/admin/default/includes/inner-form-toolbar.html @@ -12,7 +12,7 @@
- + + {if ! empty($close_url)} + {intl l='Close'} + {/if}
diff --git a/templates/admin/default/message-edit.html b/templates/admin/default/message-edit.html index 4014940a5..db6118c05 100644 --- a/templates/admin/default/message-edit.html +++ b/templates/admin/default/message-edit.html @@ -30,11 +30,11 @@
{form name="thelia.admin.message.modification"}
- + {* Be sure to get the message ID, even if the form could not be validated *} - {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}
{$form_error_message}
{/if} - + {form_field form=$form field='name'}
- +
{/form_field} - + {form_field form=$form field='secured'}
+
{/form_field} {form_field form=$form field='title'}
- +
{/form_field} {form_field form=$form field='subject'}
- +
{/form_field} @@ -85,7 +85,7 @@ {form_field form=$form field='html_message'}
@@ -95,17 +95,17 @@ {form_field form=$form field='text_message'}
{/form_field} -
+

{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}"}}

- + {/form}
diff --git a/templates/admin/default/messages.html b/templates/admin/default/messages.html index 755388fcf..afa7764af 100644 --- a/templates/admin/default/messages.html +++ b/templates/admin/default/messages.html @@ -152,6 +152,9 @@
{/form_field} + + {module_include location='message_create_form'} + {/capture} {include @@ -173,6 +176,9 @@ {capture "delete_dialog"} + + {module_include location='message_delete_form'} + {/capture} {include diff --git a/templates/admin/default/product-attributes.html b/templates/admin/default/product-attributes.html deleted file mode 100644 index 921674b03..000000000 --- a/templates/admin/default/product-attributes.html +++ /dev/null @@ -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"} -
- -
- - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - -
- {intl l='Thelia product attributes'} - - - - -
{intl l="Title"}{intl l="Position"}{intl l="Actions"}
Title here1 -
- - - -
-
-
-
-
-
- -
-
- - -{* Adding a new message *} - - - - -{* Delete confirmation dialog *} - - -{/block} \ No newline at end of file diff --git a/templates/admin/default/variable-edit.html b/templates/admin/default/variable-edit.html index ea2701f66..7e634b92a 100644 --- a/templates/admin/default/variable-edit.html +++ b/templates/admin/default/variable-edit.html @@ -34,7 +34,7 @@ {* Be sure to get the variable ID, even if the form could not be validated *} - {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}
{$form_error_message}
{/if} - + {form_field form=$form field='name'}
- - + +
{/form_field} - + {form_field form=$form field='value'}
- - + +
{/form_field} - + {form_field form=$form field='secured'}
+
{/form_field} diff --git a/templates/admin/default/variables.html b/templates/admin/default/variables.html index 0d1c948a0..3f1e90a09 100644 --- a/templates/admin/default/variables.html +++ b/templates/admin/default/variables.html @@ -194,6 +194,9 @@ {/loop}
{/form_field} + + + {module_include location='variable_create_form'} {/capture} {include @@ -215,6 +218,9 @@ {capture "delete_dialog"} + + {module_include location='variable_delete_form'} + {/capture} {include