diff --git a/core/lib/Thelia/Action/Currency.php b/core/lib/Thelia/Action/Currency.php new file mode 100644 index 000000000..4e3bb45d4 --- /dev/null +++ b/core/lib/Thelia/Action/Currency.php @@ -0,0 +1,120 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +use Thelia\Model\CurrencyQuery; +use Thelia\Model\Currency as CurrencyModel; + +use Thelia\Core\Event\TheliaEvents; + +use Thelia\Core\Event\CurrencyChangeEvent; +use Thelia\Core\Event\CurrencyCreateEvent; +use Thelia\Core\Event\CurrencyDeleteEvent; + +class Currency extends BaseAction implements EventSubscriberInterface +{ + /** + * Create a new currencyuration entry + * + * @param CurrencyCreateEvent $event + */ + public function create(CurrencyCreateEvent $event) + { + $currency = new CurrencyModel(); + + $currency + ->setDispatcher($this->getDispatcher()) + + ->setLocale($event->getLocale()) + ->setName($event->getCurrencyName()) + ->setSymbol($event->getSymbol()) + ->setRate($event->getRate()) + ->setCode($event->getCode()) + + ->save() + ; + + $event->setCurrency($currency); + } + + /** + * Change a currency + * + * @param CurrencyChangeEvent $event + */ + public function modify(CurrencyChangeEvent $event) + { + $search = CurrencyQuery::create(); + + if (null !== $currency = CurrencyQuery::create()->findOneById($event->getCurrencyId())) { + + $currency + ->setDispatcher($this->getDispatcher()) + + ->setLocale($event->getLocale()) + ->setName($event->getCurrencyName()) + ->setSymbol($event->getSymbol()) + ->setRate($event->getRate()) + ->setCode($event->getCode()) + + ->save(); + + $event->setCurrency($currency); + } + } + + /** + * Delete a currencyuration entry + * + * @param CurrencyDeleteEvent $event + */ + public function delete(CurrencyDeleteEvent $event) + { + + if (null !== ($currency = CurrencyQuery::create()->findOneById($event->getCurrencyId()))) { + + $currency + ->setDispatcher($this->getDispatcher()) + ->delete() + ; + + $event->setCurrency($currency); + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::CURRENCY_CREATE => array("create", 128), + TheliaEvents::CURRENCY_MODIFY => array("modify", 128), + TheliaEvents::CURRENCY_DELETE => array("delete", 128), + ); + } +} diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index a9638fe04..bcc162e24 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -32,12 +32,17 @@ - + - + + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 733e4303a..1210c9949 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -53,6 +53,9 @@
+ + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index d57eb8f95..627fa9bf3 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -83,6 +83,28 @@ Thelia\Controller\Admin\MessageController::deleteAction + + + + Thelia\Controller\Admin\CurrencyController::defaultAction + + + + Thelia\Controller\Admin\CurrencyController::createAction + + + + Thelia\Controller\Admin\CurrencyController::changeAction + + + + Thelia\Controller\Admin\CurrencyController::saveChangeAction + + + + Thelia\Controller\Admin\CurrencyController::deleteAction + + diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index c4b4c44b0..8160033fe 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -199,12 +199,21 @@ class BaseAdminController extends BaseController // Find the current edit language ID $edition_language = $this->getCurrentEditionLangId(); + // Current back-office (not edition) language + $current_lang = LangQuery::create()->findOneById($session->getLangId()); + // Prepare common template variables $args = array_merge($args, array( 'locale' => $session->getLocale(), 'lang_code' => $session->getLang(), 'lang_id' => $session->getLangId(), + + 'datetime_format' => $current_lang->getDateTimeFormat(), + 'date_format' => $current_lang->getDateFormat(), + 'time_format' => $current_lang->getTimeFormat(), + 'edition_language' => $edition_language, + 'current_url' => htmlspecialchars($this->getRequest()->getUri()) )); diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php new file mode 100644 index 000000000..69cc60117 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -0,0 +1,284 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\CurrencyDeleteEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Tools\URL; +use Thelia\Core\Event\CurrencyChangeEvent; +use Thelia\Core\Event\CurrencyCreateEvent; +use Thelia\Log\Tlog; +use Thelia\Form\Exception\FormValidationException; +use Thelia\Core\Security\Exception\AuthorizationException; +use Thelia\Model\CurrencyQuery; +use Thelia\Form\CurrencyModificationForm; +use Thelia\Form\CurrencyCreationForm; + +/** + * Manages currencies sent by mail + * + * @author Franck Allimant + */ +class CurrencyController extends BaseAdminController +{ + /** + * 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') + ); + + // Store the current sort order in session + $this->getSession()->set('admin.currency_order', $order); + + return $this->render('currencies', array('order' => $order)); + } + + /** + * 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(); + } + + /** + * 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; + + $currency = 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']) + ; + + $this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent); + + $createdObject = $createEvent->getCurrency(); + + // Log currency creation + $this->adminLogAppend(sprintf("Variable %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 + $currency = sprintf("Please check your input: %s", $ex->getCurrency()); + } + catch (\Exception $ex) { + // Any other error + $currency = sprintf("Sorry, an error occured: %s", $ex->getCurrency()); + } + + if ($currency !== false) { + // An error has been detected: log it + Tlog::getInstance()->error(sprintf("Error during currency creation process : %s. Exception was %s", $currency, $ex->getCurrency())); + + // Mark the form as errored + $creationForm->setErrorCurrency($currency); + + // Pass it to the parser, along with the error currency + $this->getParserContext() + ->addForm($creationForm) + ->setGeneralError($currency) + ; + } + + // At this point, the form has error, and should be redisplayed. + return $this->renderList(); + } + + /** + * 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.change")) return $response; + + // Load the currency object + $currency = CurrencyQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('currency_id')); + + if ($currency != null) { + + // 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->getSubject() + ); + + // Setup the object form + $changeForm = new CurrencyModificationForm($this->getRequest(), "form", $data); + + // Pass it to the parser + $this->getParserContext()->addForm($changeForm); + } + + // Render the edition template. + return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id'))); + } + + /** + * 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 + */ + public function saveChangeAction() { + + // Check current user authorization + if (null !== $response = $this->checkAuth("admin.configuration.currencies.change")) return $response; + + $currency = 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 CurrencyChangeEvent($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_MODIFY, $changeEvent); + + // Log currency modification + $changedObject = $changeEvent->getCurrency(); + + $this->adminLogAppend(sprintf("Variable %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->redirect(URL::absoluteUrl( + "admin/configuration/currencies/change", + array('currency_id' => $currency_id) + )); + } + + // Redirect to the success URL + $this->redirect($changeForm->getSuccessUrl()); + } + catch (FormValidationException $ex) { + // Invalid data entered + $currency = sprintf("Please check your input: %s", $ex->getCurrency()); + } + catch (\Exception $ex) { + // Any other error + $currency = sprintf("Sorry, an error occured: %s", $ex->getCurrency()); + } + + if ($currency !== false) { + // Log error currency + Tlog::getInstance()->error(sprintf("Error during currency modification process : %s. Exception was %s", $currency, $ex->getCurrency())); + + // Mark the form as errored + $changeForm->setErrorCurrency($currency); + + // Pas the form and the error to the parser + $this->getParserContext() + ->addForm($changeForm) + ->setGeneralError($currency) + ; + } + + // At this point, the form has errors, and should be redisplayed. + return $this->render('currency-edit', array('currency_id' => $currency_id)); + } + + /** + * 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); + + $this->redirect(URL::adminViewUrl('currencies')); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyChangeEvent.php b/core/lib/Thelia/Core/Event/CurrencyChangeEvent.php new file mode 100644 index 000000000..f94d71b88 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyChangeEvent.php @@ -0,0 +1,47 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Currency; + +class CurrencyChangeEvent extends CurrencyCreateEvent +{ + protected $currency_id; + + public function __construct($currency_id) + { + $this->setCurrencyId($currency_id); + } + + public function getCurrencyId() + { + return $this->currency_id; + } + + public function setCurrencyId($currency_id) + { + $this->currency_id = $currency_id; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php b/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php new file mode 100644 index 000000000..fba23a09b --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyCreateEvent.php @@ -0,0 +1,93 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Currency; + +class CurrencyCreateEvent extends CurrencyEvent +{ + protected $currency_name; + protected $locale; + protected $symbol; + protected $code; + protected $rate; + + // Use currency_name to prevent conflict with Event::name property. + public function getCurrencyName() + { + return $this->currency_name; + } + + public function setCurrencyName($currency_name) + { + $this->currency_name = $currency_name; + + return $this; + } + + public function getLocale() + { + return $this->locale; + } + + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } + + public function getSymbol() + { + return $this->symbol; + } + + public function setSymbol($symbol) + { + $this->symbol = $symbol; + } + + public function getCode() + { + return $this->code; + } + + public function setCode($code) + { + $this->code = $code; + + return $this; + } + + public function getRate() + { + return $this->rate; + } + + public function setRate($rate) + { + $this->rate = $rate; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php b/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php new file mode 100644 index 000000000..5b9714b47 --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyDeleteEvent.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; + +use Thelia\Model\Currency; + +class CurrencyDeleteEvent extends CurrencyEvent +{ + protected $currency_id; + + public function __construct($currency_id) + { + $this->setCurrencyId($currency_id); + } + + public function getCurrencyId() + { + return $this->currency_id; + } + + public function setCurrencyId($currency_id) + { + $this->currency_id = $currency_id; + + return $this; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/CurrencyEvent.php b/core/lib/Thelia/Core/Event/CurrencyEvent.php new file mode 100644 index 000000000..e0716da0c --- /dev/null +++ b/core/lib/Thelia/Core/Event/CurrencyEvent.php @@ -0,0 +1,47 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event; +use Thelia\Model\Currency; + +class CurrencyEvent extends ActionEvent +{ + protected $currency; + + public function __construct(Currency $currency = null) + { + $this->currency = $currency; + } + + public function getCurrency() + { + return $this->currency; + } + + public function setCurrency($currency) + { + $this->currency = $currency; + + return $this; + } +} diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index ed0a96cdf..8bca60bb4 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -194,7 +194,6 @@ final class TheliaEvents const BEFORE_DELETECONFIG = "action.before_deleteConfig"; const AFTER_DELETECONFIG = "action.after_deleteConfig"; - // -- Messages management --------------------------------------------- const MESSAGE_CREATE = "action.createMessage"; @@ -210,4 +209,18 @@ final class TheliaEvents const BEFORE_DELETEMESSAGE = "action.before_deleteMessage"; const AFTER_DELETEMESSAGE = "action.after_deleteMessage"; + // -- Currencies management --------------------------------------------- + + const CURRENCY_CREATE = "action.createCurrency"; + const CURRENCY_MODIFY = "action.changeCurrency"; + const CURRENCY_DELETE = "action.deleteCurrency"; + + const BEFORE_CREATECURRENCY = "action.before_createCurrency"; + const AFTER_CREATECURRENCY = "action.after_createCurrency"; + + const BEFORE_CHANGECURRENCY = "action.before_changeCurrency"; + const AFTER_CHANGECURRENCY = "action.after_changeCurrency"; + + const BEFORE_DELETECURRENCY = "action.before_deleteCurrency"; + const AFTER_DELETECURRENCY = "action.after_deleteCurrency"; } diff --git a/core/lib/Thelia/Core/Template/Loop/Config.php b/core/lib/Thelia/Core/Template/Loop/Config.php index 02f39510d..5cc1b2b44 100644 --- a/core/lib/Thelia/Core/Template/Loop/Config.php +++ b/core/lib/Thelia/Core/Template/Loop/Config.php @@ -109,13 +109,13 @@ class Config extends BaseI18nLoop ->set("NAME" , $result->getName()) ->set("VALUE" , $result->getValue()) ->set("IS_TRANSLATED", $result->getVirtualColumn('IS_TRANSLATED')) - ->set("LOCALE",$locale) + ->set("LOCALE" , $locale) ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) ->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO')) ->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("HIDDEN" , $result->getHidden()) - ->set("SECURED" , $result->getSecured()) + ->set("SECURED" , $result->getSecured()) ->set("CREATE_DATE" , $result->getCreatedAt()) ->set("UPDATE_DATE" , $result->getUpdatedAt()) ; diff --git a/core/lib/Thelia/Core/Template/Loop/Currency.php b/core/lib/Thelia/Core/Template/Loop/Currency.php index 8076e2276..2fb296070 100755 --- a/core/lib/Thelia/Core/Template/Loop/Currency.php +++ b/core/lib/Thelia/Core/Template/Loop/Currency.php @@ -33,6 +33,8 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\CurrencyQuery; use Thelia\Model\ConfigQuery; +use Thelia\Type\TypeCollection; +use Thelia\Type\EnumListType; /** * @@ -53,7 +55,22 @@ class Currency extends BaseI18nLoop return new ArgumentCollection( Argument::createIntListTypeArgument('id'), Argument::createIntListTypeArgument('exclude'), - Argument::createBooleanTypeArgument('default_only', false) + Argument::createBooleanTypeArgument('default_only', false), + new Argument( + 'order', + new TypeCollection( + new EnumListType( + array( + 'id', 'id_reverse', + 'name', 'name_reverse', + 'code', 'code_reverse', + 'symbol', 'symbol_reverse', + 'rate', 'rate_reverse', + 'manual', 'manual_reverse') + ) + ), + 'manual' + ) ); } @@ -87,7 +104,53 @@ class Currency extends BaseI18nLoop $search->filterByByDefault(true); } - $search->orderByPosition(); + $orders = $this->getOrder(); + + foreach($orders as $order) { + switch ($order) { + case 'id': + $search->orderById(Criteria::ASC); + break; + case 'id_reverse': + $search->orderById(Criteria::DESC); + break; + + case 'name': + $search->addAscendingOrderByColumn('i18n_NAME'); + break; + case 'name_reverse': + $search->addDescendingOrderByColumn('i18n_NAME'); + break; + + case 'code': + $search->orderByCode(Criteria::ASC); + break; + case 'code_reverse': + $search->orderByCode(Criteria::DESC); + break; + + case 'symbol': + $search->orderBySymbol(Criteria::ASC); + break; + case 'symbol_reverse': + $search->orderBySymbol(Criteria::DESC); + break; + + case 'rate': + $search->orderByRate(Criteria::ASC); + break; + case 'rate_reverse': + $search->orderByRate(Criteria::DESC); + break; + + case 'manual': + $search->orderByPosition(Criteria::ASC); + break; + case 'manual_reverse': + $search->orderByPosition(Criteria::DESC); + break; + } + } /* perform search */ $currencies = $this->search($search, $pagination); @@ -95,15 +158,18 @@ class Currency extends BaseI18nLoop $loopResult = new LoopResult(); foreach ($currencies as $currency) { + $loopResultRow = new LoopResultRow(); - $loopResultRow->set("ID", $currency->getId()) - ->set("IS_TRANSLATED",$currency->getVirtualColumn('IS_TRANSLATED')) - ->set("LOCALE",$locale) - ->set("NAME",$currency->getVirtualColumn('i18n_NAME')) - ->set("ISOCODE", $currency->getCode()) - ->set("SYMBOL", $currency->getSymbol()) - ->set("RATE", $currency->getRate()) - ->set("IS_DEFAULT", $currency->getByDefault()); + $loopResultRow + ->set("ID" , $currency->getId()) + ->set("IS_TRANSLATED" , $currency->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $locale) + ->set("NAME" , $currency->getVirtualColumn('i18n_NAME')) + ->set("ISOCODE" , $currency->getCode()) + ->set("SYMBOL" , $currency->getSymbol()) + ->set("RATE" , $currency->getRate()) + ->set("POSITION" , $currency->getPosition()) + ->set("IS_DEFAULT" , $currency->getByDefault()); $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php index fc34a40b6..697ce5d73 100755 --- a/core/lib/Thelia/Core/Template/Loop/Image.php +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -50,6 +50,60 @@ class Image extends BaseI18nLoop */ protected $possible_sources = array('category', 'product', 'folder', 'content'); + /** + * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection + */ + protected function getArgDefinitions() + { + $collection = new ArgumentCollection( + + Argument::createIntListTypeArgument('id'), + Argument::createIntListTypeArgument('exclude'), + new Argument( + 'order', + new TypeCollection( + new EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random')) + ), + 'manual' + ), + Argument::createIntTypeArgument('lang'), + + Argument::createIntTypeArgument('width'), + Argument::createIntTypeArgument('height'), + Argument::createIntTypeArgument('rotation', 0), + Argument::createAnyTypeArgument('background_color'), + Argument::createIntTypeArgument('quality'), + new Argument( + 'resize_mode', + new TypeCollection( + new EnumType(array('crop', 'borders', 'none')) + ), + 'none' + ), + Argument::createAnyTypeArgument('effects'), + + Argument::createIntTypeArgument('category'), + Argument::createIntTypeArgument('product'), + Argument::createIntTypeArgument('folder'), + Argument::createIntTypeArgument('content'), + + new Argument( + 'source', + new TypeCollection( + new EnumType($this->possible_sources) + ) + ), + Argument::createIntTypeArgument('source_id') + ); + + // Add possible image sources + foreach($this->possible_sources as $source) { + $collection->addArgument(Argument::createIntTypeArgument($source)); + } + + return $collection; + } + /** * Dynamically create the search query, and set the proper filter and order * @@ -244,19 +298,19 @@ class Image extends BaseI18nLoop $loopResultRow = new LoopResultRow(); $loopResultRow - ->set("ID", $result->getId()) - ->set("LOCALE",$locale) - ->set("IMAGE_URL", $event->getFileUrl()) - ->set("ORIGINAL_IMAGE_URL", $event->getOriginalFileUrl()) - ->set("IMAGE_PATH", $event->getCacheFilepath()) - ->set("ORIGINAL_IMAGE_PATH", $source_filepath) - ->set("TITLE",$folder->getVirtualColumn('i18n_TITLE')) - ->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO')) - ->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION')) - ->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM')) - ->set("POSITION", $result->getPosition()) - ->set("OBJECT_TYPE", $object_type) - ->set("OBJECT_ID", $object_id) + ->set("ID" , $result->getId()) + ->set("LOCALE" ,$locale) + ->set("IMAGE_URL" , $event->getFileUrl()) + ->set("ORIGINAL_IMAGE_URL" , $event->getOriginalFileUrl()) + ->set("IMAGE_PATH" , $event->getCacheFilepath()) + ->set("ORIGINAL_IMAGE_PATH" , $source_filepath) + ->set("TITLE" , $result->getVirtualColumn('i18n_TITLE')) + ->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO')) + ->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION')) + ->set("POSTSCRIPTUM" , $result->getVirtualColumn('i18n_POSTSCRIPTUM')) + ->set("POSITION" , $result->getPosition()) + ->set("OBJECT_TYPE" , $object_type) + ->set("OBJECT_ID" , $object_id) ; $loopResult->addRow($loopResultRow); @@ -269,58 +323,4 @@ class Image extends BaseI18nLoop return $loopResult; } - - /** - * @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection - */ - protected function getArgDefinitions() - { - $collection = new ArgumentCollection( - - Argument::createIntListTypeArgument('id'), - Argument::createIntListTypeArgument('exclude'), - new Argument( - 'order', - new TypeCollection( - new EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random')) - ), - 'manual' - ), - Argument::createIntTypeArgument('lang'), - - Argument::createIntTypeArgument('width'), - Argument::createIntTypeArgument('height'), - Argument::createIntTypeArgument('rotation', 0), - Argument::createAnyTypeArgument('background_color'), - Argument::createIntTypeArgument('quality'), - new Argument( - 'resize_mode', - new TypeCollection( - new EnumType(array('crop', 'borders', 'none')) - ), - 'none' - ), - Argument::createAnyTypeArgument('effects'), - - Argument::createIntTypeArgument('category'), - Argument::createIntTypeArgument('product'), - Argument::createIntTypeArgument('folder'), - Argument::createIntTypeArgument('content'), - - new Argument( - 'source', - new TypeCollection( - new EnumType($this->possible_sources) - ) - ), - Argument::createIntTypeArgument('source_id') - ); - - // Add possible image sources - foreach($this->possible_sources as $source) { - $collection->addArgument(Argument::createIntTypeArgument($source)); - } - - return $collection; - } } \ No newline at end of file diff --git a/core/lib/Thelia/Form/CurrencyCreationForm.php b/core/lib/Thelia/Form/CurrencyCreationForm.php new file mode 100644 index 000000000..11a496582 --- /dev/null +++ b/core/lib/Thelia/Form/CurrencyCreationForm.php @@ -0,0 +1,65 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\CurrencyQuery; +use Symfony\Component\Validator\ExecutionContextInterface; +use Symfony\Component\Validator\Constraints\NotBlank; + +class CurrencyCreationForm extends BaseForm +{ + protected function buildForm($change_mode = false) + { + $name_constraints = array(new Constraints\NotBlank()); + + if (!$change_mode) { + $name_constraints[] = new Constraints\Callback(array( + "methods" => array(array($this, "checkDuplicateName")) + )); + } + + $this->formBuilder + ->add("name" , "text" , array("constraints" => array($name_constraints))) + ->add("locale" , "text" , array()) + ->add("symbol" , "text" , array("constraints" => array(new NotBlank()))) + ->add("rate" , "text" , array("constraints" => array(new NotBlank()))) + ->add("code" , "text" , array("constraints" => array(new NotBlank()))) + ; + } + + public function getName() + { + return "thelia_currency_creation"; + } + + public function checkDuplicateName($value, ExecutionContextInterface $context) + { + $currency = CurrencyQuery::create()->findOneByName($value); + + if ($currency) { + $context->addViolation(sprintf("A currency with name \"%s\" already exists.", $value)); + } + } + +} diff --git a/core/lib/Thelia/Form/CurrencyModificationForm.php b/core/lib/Thelia/Form/CurrencyModificationForm.php new file mode 100644 index 000000000..6a4279d1b --- /dev/null +++ b/core/lib/Thelia/Form/CurrencyModificationForm.php @@ -0,0 +1,45 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Model\LangQuery; +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\Validator\Constraints\GreaterThan; + +class CurrencyModificationForm extends CurrencyCreationForm +{ + protected function buildForm() + { + parent::buildForm(true); + + $this->formBuilder + ->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) + ; + } + + public function getName() + { + return "thelia_currency_modification"; + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Model/Currency.php b/core/lib/Thelia/Model/Currency.php index e9aec3ea0..f2f1175c6 100755 --- a/core/lib/Thelia/Model/Currency.php +++ b/core/lib/Thelia/Model/Currency.php @@ -3,7 +3,65 @@ namespace Thelia\Model; use Thelia\Model\Base\Currency as BaseCurrency; +use Thelia\Core\Event\TheliaEvents; +use Propel\Runtime\Connection\ConnectionInterface; +use Thelia\Core\Event\CurrencyEvent; class Currency extends BaseCurrency { -} + use \Thelia\Model\Tools\ModelEventDispatcherTrait; + + /** + * {@inheritDoc} + */ + public function preInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CREATECURRENCY, new CurrencyEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postInsert(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CREATECURRENCY, new CurrencyEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_CHANGECURRENCY, new CurrencyEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postUpdate(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_CHANGECURRENCY, new CurrencyEvent($this)); + } + + /** + * {@inheritDoc} + */ + public function preDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::BEFORE_DELETECURRENCY, new CurrencyEvent($this)); + + return true; + } + + /** + * {@inheritDoc} + */ + public function postDelete(ConnectionInterface $con = null) + { + $this->dispatchEvent(TheliaEvents::AFTER_DELETECURRENCY, new CurrencyEvent($this)); + } +} \ No newline at end of file diff --git a/templates/admin/default/404.html b/templates/admin/default/404.html index 48caf7a12..c72b43b01 100755 --- a/templates/admin/default/404.html +++ b/templates/admin/default/404.html @@ -1,11 +1,9 @@ -{$page_title={intl l='Page not found'}} +{extends file="general_error.html"} -{include file='includes/header.inc.html'} +{block name="page-title"}{intl l='Page not found'}{/block} +{block name="content-title"}{intl l='Page not found'}{/block} -
-

{intl l="Oops! An Error Occurred"}

-

{intl l='The server returned a "404 Not Found"'}

-

{intl l='The page you\'ve requested was not found. Please check the page address, and try again.'}

-
- -{include file='includes/footer.inc.html'} \ No newline at end of file +{block name="error-message"} +

{intl l='The server returned a "404 Not Found"'}

+

{intl l='The page you\'ve requested was not found. Please check the page address, and try again.'}

+{/block} \ No newline at end of file diff --git a/templates/admin/default/admin-layout.tpl b/templates/admin/default/admin-layout.tpl new file mode 100644 index 000000000..93143d0e6 --- /dev/null +++ b/templates/admin/default/admin-layout.tpl @@ -0,0 +1,223 @@ +{* -- By default, check admin login ----------------------------------------- *} + +{block name="check-auth"} + {check_auth roles="ADMIN" permissions="{block name="check-permissions"}{/block}" login_tpl="/admin/login"} +{/block} + + + + + {block name="page-title"}Default Page Title{/block} - {intl l='Thelia Back Office'} + + {images file='assets/img/favicon.ico'}{/images} + + + + {block name="meta"}{/block} + + {* -- Bootstrap CSS section --------------------------------------------- *} + + {block name="before-bootstrap-css"}{/block} + + {stylesheets file='assets/bootstrap/css/bootstrap.css' filters='cssembed'} + + {/stylesheets} + + {stylesheets file='assets/bootstrap/css/bootstrap-responsive.css' filters='cssembed'} + + {/stylesheets} + + {block name="after-bootstrap-css"}{/block} + + {* -- Admin CSS section ------------------------------------------------- *} + + {block name="before-admin-css"}{/block} + + {stylesheets file='assets/css/*' filters='less,cssembed'} + + {/stylesheets} + + {block name="after-admin-css"}{/block} + + {* Modules css are included here *} + + {module_include location='head_css'} + + + + {* display top bar only if admin is connected *} + + {loop name="top-bar-auth" type="auth" roles="ADMIN"} + + {* -- Brand bar section ------------------------------------------------- *} + + {module_include location='before_topbar'} + +
+
+ +
{intl l='Version %ver' ver="{$THELIA_VERSION}"}
+ + {module_include location='inside_topbar'} + + + + {loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"} + +
+
+ + +
+
+ + {/loop} + + +
+
+ + {module_include location='after_topbar'} + + {* -- Top menu section -------------------------------------------------- *} + + {module_include location='before_top_menu'} + + + + {module_include location='after_top_menu'} + + {/loop} + + {* A basic brandbar is displayed if user is not connected *} + + {elseloop rel="top-bar-auth"} + + {/elseloop} + + {* -- Main page content section ----------------------------------------- *} + + {block name="main-content"}Put here the content of the template{/block} + + {* -- Footer section ---------------------------------------------------- *} + + {module_include location='before_footer'} + +
+ + + {module_include location='after_footer'} + + + {* -- Javascript section ------------------------------------------------ *} + + {block name="before-javascript-include"}{/block} + + {javascripts file='assets/js/jquery.min.js'} + + {/javascripts} + + {javascripts file='assets/bootstrap/js/bootstrap.min.js'} + + {/javascripts} + + {block name="after-javascript-include"}{/block} + + {block name="javascript-initialization"}{/block} + + {* Modules scripts are included now *} + {module_include location='footer_js'} + + \ No newline at end of file diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less index 6c5c76a8d..85cef27da 100755 --- a/templates/admin/default/assets/css/admin.less +++ b/templates/admin/default/assets/css/admin.less @@ -584,6 +584,10 @@ form .info .input-append .add-on { .actions { text-align: right; } + + .form { + margin-bottom: 0; + } } // Reduce bottom margin of admin tabs. diff --git a/templates/admin/default/categories.html b/templates/admin/default/categories.html index 2cc6b633c..1548140bf 100755 --- a/templates/admin/default/categories.html +++ b/templates/admin/default/categories.html @@ -1,11 +1,16 @@ -{check_auth roles="ADMIN" permissions="admin.catalog.view" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Catalog'}} +{block name="page-title"}{intl l='Catalog'}{/block} -{$thelia_page_css_file = "assets/bootstrap-editable/css/bootstrap-editable.css"} +{block name="check-permissions"}admin.catalog.view{/block} -{include file='includes/header.inc.html'} +{block name="after-admin-css"} + {stylesheets file='assets/bootstrap-editable/css/bootstrap-editable.css' filters='cssembed'} + + {/stylesheets} +{/block} +{block name="main-content"}
@@ -256,13 +261,15 @@ {include file="includes/add-category-dialog.html"} {include file="includes/delete-category-dialog.html"} +{/block} -{include file='includes/js.inc.html'} - -{javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'} - -{/javascripts} +{block name="after-javascript-include"} + {javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'} + + {/javascripts} +{/block} +{block name="javascript-initialization"} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/configuration.html b/templates/admin/default/configuration.html index 259a0f3d7..848283b5e 100644 --- a/templates/admin/default/configuration.html +++ b/templates/admin/default/configuration.html @@ -1,9 +1,10 @@ -{check_auth roles="ADMIN" permissions="admin.configuration.view" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Configuration'}} +{block name="page-title"}{intl l='Configuration'}{/block} -{include file='includes/header.inc.html'} +{block name="check-permissions"}admin.configuration.view{/block} +{block name="main-content"}
@@ -168,7 +169,4 @@
- -{include file='includes/js.inc.html'} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/currencies.html b/templates/admin/default/currencies.html new file mode 100644 index 000000000..762bb47ee --- /dev/null +++ b/templates/admin/default/currencies.html @@ -0,0 +1,401 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Currencies'}{/block} + +{block name="check-permissions"}admin.configuration.currencies.view{/block} + +{block name="after-admin-css"} + {stylesheets file='assets/bootstrap-editable/css/bootstrap-editable.css' filters='cssembed'} + + {/stylesheets} +{/block} + +{block name="main-content"} +
+ +
+ + + + {module_include location='currencies_top'} + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + {module_include location='currencies_table_header'} + + + + + {loop name="currencies" type="currency" backend_context="1" lang=$lang_id order=$order} + + + + + + + + + + + + + + + + + {module_include location='currencies_table_row'} + + + + {/loop} + + {elseloop rel="currencies"} + + + + {/elseloop} +
+ {intl l='Currencies'} + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.currencies.create"} + + + + {/loop} + +
+ {if $order == 'id'} + + {$order_change = 'id_reverse'} + {elseif $order == 'id_reverse'} + + {$order_change = 'id'} + {else} + {$order_change = 'id'} + {/if} + + {intl l="ID"} + + + {if $order == 'alpha'} + + {$order_change = 'alpha_reverse'} + {elseif $order == 'alpha_reverse'} + + {$order_change = 'alpha'} + {else} + {$order_change = 'alpha'} + {/if} + + {intl l="Name"} + + + {if $order == 'code'} + + {$order_change = 'code_reverse'} + {elseif $order == 'code_reverse'} + + {$order_change = 'code'} + {else} + {$order_change = 'code'} + {/if} + {intl l="ISO 4217 Code"} + + + {if $order == 'symbol'} + + {$order_change = 'symbol_reverse'} + {elseif $order == 'symbol_reverse'} + + {$order_change = 'symbol'} + {else} + {$order_change = 'symbol'} + {/if} + + {intl l="Symbol"} + + + {if $order == 'rate'} + + {$order_change = 'rate_reverse'} + {elseif $order == 'rate_reverse'} + + {$order_change = 'rate'} + {else} + {$order_change = 'rate'} + {/if} + + {intl l="Rate in €"} + + + {if $order == 'manual'} + + {$order_change = 'manual_reverse'} + {elseif $order == 'manual_reverse'} + + {$order_change = 'manual'} + {else} + {$order_change = 'manual'} + {/if} + + {intl l="Position"} + {intl l="Default"} 
{$ID} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"} + {$NAME} + {/loop} + {elseloop rel="can_change"} + {$NAME} + {/elseloop} + {$ISOCODE}{$SYMBOL}{$RATE|string_format:"%.4f"} + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"} + + {$POSITION} + + {/loop} + + {elseloop rel="can_change"} + {$POSITION} + {/elseloop} + +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"} + + {/loop} + + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"} + + {/loop} +
+
+
+ {intl l="No currency has been created yet. Click the + button to create one."} +
+
+
+
+
+
+ + {module_include location='currencies_bottom'} + +
+
+ + +{* Adding a new currency *} + + + + +{* Delete confirmation dialog *} + + +{/block} + +{block name="after-javascript-include"} + {javascripts file='assets/bootstrap-editable/js/bootstrap-editable.js'} + + {/javascripts} +{/block} + +{block name="javascript-initialization"} + +{/block} \ No newline at end of file diff --git a/templates/admin/default/edit_category.html b/templates/admin/default/edit_category.html index d58c251fd..65c5f9c56 100755 --- a/templates/admin/default/edit_category.html +++ b/templates/admin/default/edit_category.html @@ -1,9 +1,10 @@ -{check_auth roles="ADMIN" permissions="admin.catalog.view" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Edit category'}} +{block name="check-permissions"}admin.catalog.view{/block} -{include file='includes/header.inc.html'} +{block name="page-title"}{intl l='Edit category'}{/block} +{block name="main-content"}
+{/block} -{include file='includes/js.inc.html'} - +{block name="javascript-initialization"} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/general_error.html b/templates/admin/default/general_error.html index b8f9e8661..dcbcc80ab 100755 --- a/templates/admin/default/general_error.html +++ b/templates/admin/default/general_error.html @@ -1,10 +1,22 @@ -{$page_title={intl l='An error occured'}} +{extends file="admin-layout.tpl"} -{include file='includes/header.inc.html'} +{* -- We do not check admin login on this page *} +{block name="check-auth"}{/block} +{block name="page-title"}{intl l='An error occured'}{/block} + +{block name="main-content"}
-

{intl l="Oops! An Error Occurred"}

-

{$error_message}

-
-{include file='includes/footer.inc.html'} \ No newline at end of file +
+
+

{intl l="Oops! An Error Occurred"}

+ + {block name="error-message"}
{$error_message}
{/block} + +

{intl l="Go to administration home"}

+
+
+ + +{/block} \ No newline at end of file diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html index a48e30ec6..e4897eda6 100755 --- a/templates/admin/default/home.html +++ b/templates/admin/default/home.html @@ -1,18 +1,18 @@ -{check_auth roles="ADMIN" login_tpl="/admin/login"} -{$page_title={intl l='Home'}} -{include file='includes/header.inc.html'} +{extends file="admin-layout.tpl"} -
-
+{block name="page-title"}{intl l='Back-office home'}{/block} - {module_include location='home_top'} +{block name="main-content"} +
+
-
- This is the administration home page. Put some interesting statistics here, and display useful information :) + {module_include location='home_top'} + +
+ This is the administration home page. Put some interesting statistics here, and display useful information :) +
+ + {module_include location='home_bottom'}
- - {module_include location='home_bottom'}
-
- -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/includes/footer.inc.html b/templates/admin/default/includes/footer.inc.html deleted file mode 100755 index c69b253ad..000000000 --- a/templates/admin/default/includes/footer.inc.html +++ /dev/null @@ -1,20 +0,0 @@ - {module_include location='before_footer'} - -
- - - {module_include location='after_footer'} - - \ No newline at end of file diff --git a/templates/admin/default/includes/header.inc.html b/templates/admin/default/includes/header.inc.html deleted file mode 100755 index 2ee435b4b..000000000 --- a/templates/admin/default/includes/header.inc.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - {intl l='Thelia Back Office'}{if ! empty($page_title)} - {$page_title}{/if} - - {images file='../assets/img/favicon.ico'}{/images} - - - - {stylesheets file='../assets/bootstrap/css/bootstrap.css' filters='cssembed'} - - {/stylesheets} - - {stylesheets file='../assets/bootstrap/css/bootstrap-responsive.css' filters='cssembed'} - - {/stylesheets} - - {* Include here page specifc CSS file, if any *} - - {if ! empty($thelia_page_css_file)} - {stylesheets file="../$thelia_page_css_file" filters='less,cssembed'} - - {/stylesheets} - {/if} - - {stylesheets file='../assets/css/*' filters='less,cssembed'} - - {/stylesheets} - - {* Include here page specifc CSS file, if any *} - - {if ! empty($thelia_page_css_file)} - {stylesheets file="../$thelia_page_css_file" filters='less,cssembed'} - - {/stylesheets} - {/if} - - {* Modules css are included here *} - - {module_include location='head_css'} - - - -{* display top bar once admin is connected *} - -{loop name="top-bar-auth" type="auth" roles="ADMIN"} - -{module_include location='before_topbar'} - -
-
- -
{intl l='Version %ver' ver="{$THELIA_VERSION}"}
- - {module_include location='inside_topbar'} - - - - {loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"} - - {/loop} - - -
-
- -{module_include location='after_topbar'} - - -{module_include location='before_top_menu'} - - - -{module_include location='after_top_menu'} - -{/loop} - -{elseloop rel="top-bar-auth"} - -{/elseloop} diff --git a/templates/admin/default/includes/js.inc.html b/templates/admin/default/includes/js.inc.html deleted file mode 100755 index 367d966ff..000000000 --- a/templates/admin/default/includes/js.inc.html +++ /dev/null @@ -1,13 +0,0 @@ - -{* Include required JS files *} - -{javascripts file='../assets/js/jquery.min.js'} - -{/javascripts} - -{javascripts file='../assets/bootstrap/js/bootstrap.min.js'} - -{/javascripts} - -{* Modules scripts are included now *} -{module_include location='footer_js'} diff --git a/templates/admin/default/login.html b/templates/admin/default/login.html index 0fa6852a5..13e57a8eb 100755 --- a/templates/admin/default/login.html +++ b/templates/admin/default/login.html @@ -1,66 +1,70 @@ -{$page_title={intl l='Welcome'}} -{include file='includes/header.inc.html'} +{extends file="admin-layout.tpl"} -
+{* -- We do not check admin login on this page *} +{block name="check-auth"}{/block} -
+{block name="page-title"}{intl l='Welcome'}{/block} - {module_include location='index_top'} +{block name="main-content"} +
-
-

{intl l='Thelia Back Office'}

+
- {form name="thelia.admin.login"} -
+ {module_include location='index_top'} - {if #form_error}
#form_error_message
{/if} +
+

{intl l='Thelia Back Office'}

- {form_hidden_fields form=$form} + {form name="thelia.admin.login"} + - {form_field form=$form field='success_url'} - {* on success, redirect to /admin *} - {/form_field} + {if #form_error}
#form_error_message
{/if} - {form_field form=$form field='username'} - - - - {/form_field} + {form_hidden_fields form=$form} - {form_field form=$form field='password'} - - - - {/form_field} + {form_field form=$form field='success_url'} + {* on success, redirect to /admin *} + {/form_field} - {form_field form=$form field='remember_me'} - - {/form_field} + {form_field form=$form field='username'} + + + + {/form_field} - - - {/form} -
+ {form_field form=$form field='password'} + + + + {/form_field} - {module_include location='index_middle'} + {form_field form=$form field='remember_me'} + + {/form_field} -
-
-
{intl l="Loading Thelia lastest news..."}
+ + + {/form} +
+ + {module_include location='index_middle'} + +
+
+
{intl l="Loading Thelia lastest news..."}
+
+ + {module_include location='index_bottom'} +
+{/block} - {module_include location='index_bottom'} - -
- -{include file='includes/js.inc.html'} - - - -{include file='includes/footer.inc.html'} \ No newline at end of file +{block name="javascript-initialization"} + +{/block} \ No newline at end of file diff --git a/templates/admin/default/message-edit.html b/templates/admin/default/message-edit.html index 1c4dfe159..3639a8e20 100644 --- a/templates/admin/default/message-edit.html +++ b/templates/admin/default/message-edit.html @@ -1,9 +1,10 @@ -{check_auth roles="ADMIN" permissions="admin.configuration.messages.edit" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Edit a mailing template'}} +{block name="page-title"}{intl l='Edit a mailing template'}{/block} -{include file='includes/header.inc.html'} +{block name="check-permissions"}admin.configuration.messages.edit{/block} +{block name="main-content"}
@@ -27,11 +28,9 @@
-
- - {form name="thelia.admin.message.modification"} -
- + {form name="thelia.admin.message.modification"} + +
{* Be sure to get the message ID, even if the form could not be validated *} @@ -142,9 +141,15 @@
{/form_field} - - {/form} - + +
+
+

{intl l='Message created on %date_create. Last modification: %date_change' df=$datetime_format date_create=$CREATE_DATE->format($datetime_format) date_change=$UPDATE_DATE->format($datetime_format)}

+
+
+ + + {/form}
@@ -165,7 +170,4 @@
- -{include file='includes/js.inc.html'} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/messages.html b/templates/admin/default/messages.html index e75cbe8da..3c7a35e86 100644 --- a/templates/admin/default/messages.html +++ b/templates/admin/default/messages.html @@ -1,9 +1,10 @@ -{check_auth roles="ADMIN" permissions="admin.configuration.messages.view" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Thelia Mailing Templates'}} +{block name="page-title"}{intl l='Thelia Mailing Templates'}{/block} -{include file='includes/header.inc.html'} +{block name="check-permissions"}admin.configuration.messages.view{/block} +{block name="main-content"}
@@ -202,9 +203,9 @@
+{/block} -{include file='includes/js.inc.html'} - +{block name="javascript-initialization"} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/variable-edit.html b/templates/admin/default/variable-edit.html index 86d13060a..40a70c077 100644 --- a/templates/admin/default/variable-edit.html +++ b/templates/admin/default/variable-edit.html @@ -1,9 +1,10 @@ -{check_auth roles="ADMIN" permissions="admin.configuration.variables.edit" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Edit a system variable'}} +{block name="page-title"}{intl l='Edit a system variable'}{/block} -{include file='includes/header.inc.html'} +{block name="check-permissions"}admin.configuration.variables.edit{/block} +{block name="main-content"}
@@ -27,11 +28,9 @@
-
- - {form name="thelia.admin.config.modification"} -
- + {form name="thelia.admin.config.modification"} + +
{* Be sure to get the variable ID, even if the form could not be validated *} @@ -107,15 +106,22 @@ {include file="includes/standard-description-form-fields.html"} - - {/form} -
+
+
+

{intl l='Variable created on %date_create. Last modification: %date_change' df=$datetime_format date_create=$CREATE_DATE->format($datetime_format) date_change=$UPDATE_DATE->format($datetime_format)}

+
+
+ +
+ + {/form}
+ {/loop} {elseloop rel="config_edit"} @@ -130,7 +136,4 @@
- -{include file='includes/js.inc.html'} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/templates/admin/default/variables.html b/templates/admin/default/variables.html index f47ec53dd..37c8ef4b2 100644 --- a/templates/admin/default/variables.html +++ b/templates/admin/default/variables.html @@ -1,9 +1,10 @@ -{check_auth roles="ADMIN" permissions="admin.configuration.variables.view" login_tpl="/admin/login"} +{extends file="admin-layout.tpl"} -{$page_title={intl l='Thelia System Variables'}} +{block name="page-title"}{intl l='Thelia System Variables'}{/block} -{include file='includes/header.inc.html'} +{block name="check-permissions"}admin.configuration.variables.view{/block} +{block name="main-content"}
@@ -223,9 +224,9 @@
+{/block} -{include file='includes/js.inc.html'} - +{block name="javascript-initialization"} - -{include file='includes/footer.inc.html'} \ No newline at end of file +{/block} \ No newline at end of file