Event harmonization with MRA
This commit is contained in:
@@ -143,7 +143,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
|
||||
return array(
|
||||
"action.addArticle" => array("addItem", 128),
|
||||
"action.deleteArticle" => array("deleteItem", 128),
|
||||
"action.changeArticle" => array("changeItem", 128),
|
||||
"action.updateArticle" => array("changeItem", 128),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -248,9 +248,9 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
|
||||
TheliaEvents::CATEGORY_CHANGE_POSITION => array("changePosition", 128),
|
||||
|
||||
"action.changeCategoryPositionU" => array("changePositionUp", 128),
|
||||
"action.changeCategoryPositionDown" => array("changePositionDown", 128),
|
||||
"action.changeCategoryPosition" => array("changePosition", 128),
|
||||
"action.updateCategoryPositionU" => array("changePositionUp", 128),
|
||||
"action.updateCategoryPositionDown" => array("changePositionDown", 128),
|
||||
"action.updateCategoryPosition" => array("changePosition", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ use Thelia\Model\Config as ConfigModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\ConfigChangeEvent;
|
||||
use Thelia\Core\Event\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\ConfigCreateEvent;
|
||||
use Thelia\Core\Event\ConfigDeleteEvent;
|
||||
|
||||
@@ -65,9 +65,9 @@ class Config extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Change a configuration entry value
|
||||
*
|
||||
* @param ConfigChangeEvent $event
|
||||
* @param ConfigUpdateEvent $event
|
||||
*/
|
||||
public function setValue(ConfigChangeEvent $event)
|
||||
public function setValue(ConfigUpdateEvent $event)
|
||||
{
|
||||
$search = ConfigQuery::create();
|
||||
|
||||
@@ -90,9 +90,9 @@ class Config extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Change a configuration entry
|
||||
*
|
||||
* @param ConfigChangeEvent $event
|
||||
* @param ConfigUpdateEvent $event
|
||||
*/
|
||||
public function modify(ConfigChangeEvent $event)
|
||||
public function modify(ConfigUpdateEvent $event)
|
||||
{
|
||||
$search = ConfigQuery::create();
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ use Thelia\Model\Currency as CurrencyModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\CurrencyChangeEvent;
|
||||
use Thelia\Core\Event\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Core\Event\CurrencyDeleteEvent;
|
||||
use Thelia\Model\Map\CurrencyTableMap;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Core\Event\CurrencyUpdatePositionEvent;
|
||||
|
||||
class Currency extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -67,9 +67,9 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Change a currency
|
||||
*
|
||||
* @param CurrencyChangeEvent $event
|
||||
* @param CurrencyUpdateEvent $event
|
||||
*/
|
||||
public function update(CurrencyChangeEvent $event)
|
||||
public function update(CurrencyUpdateEvent $event)
|
||||
{
|
||||
$search = CurrencyQuery::create();
|
||||
|
||||
@@ -93,9 +93,9 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Set the default currency
|
||||
*
|
||||
* @param CurrencyChangeEvent $event
|
||||
* @param CurrencyUpdateEvent $event
|
||||
*/
|
||||
public function setDefault(CurrencyChangeEvent $event)
|
||||
public function setDefault(CurrencyUpdateEvent $event)
|
||||
{
|
||||
$search = CurrencyQuery::create();
|
||||
|
||||
@@ -158,18 +158,34 @@ class Currency extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes position, selecting absolute ou relative change.
|
||||
*
|
||||
* @param CategoryChangePositionEvent $event
|
||||
*/
|
||||
public function updatePosition(CurrencyUpdatePositionEvent $event)
|
||||
{
|
||||
if (null !== $category = CurrencyQuery::create()->findOneById($event->getObjectId())) {
|
||||
|
||||
if ($event->getMode() == BaseChangePositionEvent::POSITION_ABSOLUTE)
|
||||
return $category->changeAbsolutePosition($event->getPosition());
|
||||
else
|
||||
return $this->exchangePosition($event->getMode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::CURRENCY_CREATE => array("create", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE => array("update", 128),
|
||||
TheliaEvents::CURRENCY_DELETE => array("delete", 128),
|
||||
TheliaEvents::CURRENCY_SET_DEFAULT => array("setDefault", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE_RATES => array("updateRates", 128),
|
||||
|
||||
TheliaEvents::CURRENCY_CREATE => array("create", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE => array("update", 128),
|
||||
TheliaEvents::CURRENCY_DELETE => array("delete", 128),
|
||||
TheliaEvents::CURRENCY_SET_DEFAULT => array("setDefault", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE_RATES => array("updateRates", 128),
|
||||
TheliaEvents::CURRENCY_UPDATE_POSITION => array("updatePosition", 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ use Thelia\Model\Message as MessageModel;
|
||||
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\Event\MessageChangeEvent;
|
||||
use Thelia\Core\Event\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\MessageCreateEvent;
|
||||
use Thelia\Core\Event\MessageDeleteEvent;
|
||||
|
||||
@@ -65,9 +65,9 @@ class Message extends BaseAction implements EventSubscriberInterface
|
||||
/**
|
||||
* Change a message
|
||||
*
|
||||
* @param MessageChangeEvent $event
|
||||
* @param MessageUpdateEvent $event
|
||||
*/
|
||||
public function modify(MessageChangeEvent $event)
|
||||
public function modify(MessageUpdateEvent $event)
|
||||
{
|
||||
$search = MessageQuery::create();
|
||||
|
||||
|
||||
@@ -85,6 +85,12 @@
|
||||
<argument type="service" id="service_container"/>
|
||||
</service>
|
||||
|
||||
<!-- URL maganement -->
|
||||
|
||||
<service id="thelia.url.manager" class="Thelia\Core\Tools\URL" scope="request">
|
||||
<argument type="service" id="request" />
|
||||
</service>
|
||||
|
||||
<!-- Translation and internationalisation -->
|
||||
|
||||
<service id="thelia.translator" class="Thelia\Core\Translation\Translator">
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.variables.change-values" path="/admin/configuration/variables/change-values">
|
||||
<route id="admin.configuration.variables.update-values" path="/admin/configuration/variables/update-values">
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::changeValuesAction</default>
|
||||
</route>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.variables.change" path="/admin/configuration/variables/change">
|
||||
<route id="admin.configuration.variables.update" path="/admin/configuration/variables/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::changeAction</default>
|
||||
</route>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\MessageController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.messages.change" path="/admin/configuration/messages/change">
|
||||
<route id="admin.configuration.messages.update" path="/admin/configuration/messages/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\MessageController::changeAction</default>
|
||||
</route>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.currencies.change" path="/admin/configuration/currencies/change">
|
||||
<route id="admin.configuration.currencies.update" path="/admin/configuration/currencies/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::changeAction</default>
|
||||
</route>
|
||||
|
||||
@@ -113,6 +113,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.currencies.delete" path="/admin/configuration/currencies/update-position">
|
||||
<default key="_controller">Thelia\Controller\Admin\CurrencyController::updatePositionAction</default>
|
||||
</route>
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
<route id="admin.processTemplate" path="/admin/{template}">
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<default key="_view">cart</default>
|
||||
</route>
|
||||
|
||||
<route id="cart.change.process" path="/cart/delete/{cart_item}">
|
||||
<route id="cart.update.process" path="/cart/delete/{cart_item}">
|
||||
<default key="_controller">Thelia\Controller\Front\CartController::deleteItem</default>
|
||||
<default key="_view">cart</default>
|
||||
</route>
|
||||
|
||||
@@ -85,10 +85,16 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Return a general error page
|
||||
*
|
||||
* @param mixed $message a message string, or an exception instance
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
protected function errorPage($message)
|
||||
{
|
||||
if ($message instanceof \Exception) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $message->getMessage());
|
||||
}
|
||||
|
||||
return $this->render('general_error', array(
|
||||
"error_message" => $message)
|
||||
);
|
||||
@@ -172,20 +178,27 @@ class BaseAdminController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current edition lang ID, checking if a change was requested in the current request
|
||||
* Get the current edition lang ID, checking if a change was requested in the current request.
|
||||
*/
|
||||
protected function getCurrentEditionLangId() {
|
||||
return $this->getRequest()->get(
|
||||
'edit_language_id',
|
||||
$this->getSession()->getAdminEditionLangId()
|
||||
);
|
||||
protected function getCurrentEditionLang() {
|
||||
|
||||
// Return the new language if a change is required.
|
||||
if (null !== $edit_language_id = $this->getRequest()->get('edit_language_id', null)) {
|
||||
|
||||
if (null !== $edit_language = LangQuery::create()->findOneById($edit_language_id)) {
|
||||
return $edit_language;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise return the lang stored in session.
|
||||
return $this->getSession()->getAdminEditionLang();
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple helper to get the current edition locale, from the session edition language ID
|
||||
* A simple helper to get the current edition locale.
|
||||
*/
|
||||
protected function getCurrentEditionLocale() {
|
||||
return LangQuery::create()->findOneById($this->getCurrentEditionLangId())->getLocale();
|
||||
return $this->getCurrentEditionLang()->getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,23 +230,14 @@ class BaseAdminController extends BaseController
|
||||
|
||||
$session = $this->getSession();
|
||||
|
||||
$edition_language = $this->getCurrentEditionLangId();
|
||||
|
||||
// Current back-office (not edition) language
|
||||
$current_lang = LangQuery::create()->findOneById($session->getLangId());
|
||||
|
||||
// Find the current edit language ID
|
||||
$edition_language = LangQuery::create()->findOneById($this->getCurrentEditionLangId());
|
||||
$edition_language = $this->getCurrentEditionLang();
|
||||
|
||||
// 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(),
|
||||
'locale' => $session->getLang()->getLocale(),
|
||||
'lang_code' => $session->getLang()->getCode(),
|
||||
'lang_id' => $session->getLang()->getId(),
|
||||
|
||||
'edit_language_id' => $edition_language->getId(),
|
||||
'edit_language_locale' => $edition_language->getLocale(),
|
||||
@@ -242,7 +246,7 @@ class BaseAdminController extends BaseController
|
||||
));
|
||||
|
||||
// Update the current edition language in session
|
||||
$this->getSession()->setAdminEditionLangId($edition_language->getId());
|
||||
$this->getSession()->setAdminEditionLang($edition_language);
|
||||
|
||||
// Render the template.
|
||||
try {
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\ConfigDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\ConfigChangeEvent;
|
||||
use Thelia\Core\Event\ConfigUpdateEvent;
|
||||
use Thelia\Core\Event\ConfigCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
@@ -154,7 +154,7 @@ class ConfigController extends BaseAdminController
|
||||
public function changeAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
|
||||
// Load the config object
|
||||
$config = ConfigQuery::create()
|
||||
@@ -196,7 +196,7 @@ class ConfigController extends BaseAdminController
|
||||
public function saveChangeAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
@@ -214,7 +214,7 @@ class ConfigController extends BaseAdminController
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new ConfigChangeEvent($data['id']);
|
||||
$changeEvent = new ConfigUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
@@ -241,7 +241,7 @@ class ConfigController extends BaseAdminController
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.variables.change",
|
||||
"admin.configuration.variables.update",
|
||||
array('variable_id' => $variable_id)
|
||||
);
|
||||
}
|
||||
@@ -284,13 +284,13 @@ class ConfigController extends BaseAdminController
|
||||
public function changeValuesAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.variables.update")) return $response;
|
||||
|
||||
$variables = $this->getRequest()->get('variable', array());
|
||||
|
||||
// Process all changed variables
|
||||
foreach($variables as $id => $value) {
|
||||
$event = new ConfigChangeEvent($id);
|
||||
$event = new ConfigUpdateEvent($id);
|
||||
$event->setValue($value);
|
||||
|
||||
$this->dispatch(TheliaEvents::CONFIG_SETVALUE, $event);
|
||||
|
||||
@@ -26,7 +26,7 @@ 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\CurrencyUpdateEvent;
|
||||
use Thelia\Core\Event\CurrencyCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
@@ -34,6 +34,7 @@ use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Form\CurrencyModificationForm;
|
||||
use Thelia\Form\CurrencyCreationForm;
|
||||
use Thelia\Core\Event\CurrencyUpdatePositionEvent;
|
||||
|
||||
/**
|
||||
* Manages currencies sent by mail
|
||||
@@ -124,7 +125,7 @@ class CurrencyController extends BaseAdminController
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
||||
$error_msg = $ex;
|
||||
}
|
||||
|
||||
if ($error_msg !== false) {
|
||||
@@ -153,7 +154,7 @@ class CurrencyController extends BaseAdminController
|
||||
public function changeAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
// Load the currency object
|
||||
$currency = CurrencyQuery::create()
|
||||
@@ -191,7 +192,7 @@ class CurrencyController extends BaseAdminController
|
||||
public function saveChangeAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
@@ -209,7 +210,7 @@ class CurrencyController extends BaseAdminController
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new CurrencyChangeEvent($data['id']);
|
||||
$changeEvent = new CurrencyUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
@@ -231,7 +232,7 @@ class CurrencyController extends BaseAdminController
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.currencies.change",
|
||||
"admin.configuration.currencies.update",
|
||||
array('currency_id' => $currency_id)
|
||||
);
|
||||
}
|
||||
@@ -245,7 +246,7 @@ class CurrencyController extends BaseAdminController
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = sprintf("Sorry, an error occured: %s", $ex->getMessage());
|
||||
$error_msg = $ex;
|
||||
}
|
||||
|
||||
if ($error_msg !== false) {
|
||||
@@ -271,9 +272,9 @@ class CurrencyController extends BaseAdminController
|
||||
*/
|
||||
public function setDefaultAction() {
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.update")) return $response;
|
||||
|
||||
$changeEvent = new CurrencyChangeEvent($this->getRequest()->get('currency_id', 0));
|
||||
$changeEvent = new CurrencyUpdateEvent($this->getRequest()->get('currency_id', 0));
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent->setIsDefault(true);
|
||||
@@ -283,7 +284,7 @@ class CurrencyController extends BaseAdminController
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
// Any error
|
||||
return $this->errorPage(sprintf("Sorry, an error occured: %s", $ex->getMessage()));
|
||||
return $this->errorPage($ex);
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.configuration.currencies.default');
|
||||
@@ -294,19 +295,50 @@ class CurrencyController extends BaseAdminController
|
||||
*/
|
||||
public function updateRatesAction() {
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.currencies.change")) return $response;
|
||||
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(sprintf("Sorry, an error occured: %s", $ex->getMessage()));
|
||||
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 {
|
||||
$id = $this->getRequest()->get('currency_id', 0);
|
||||
$mode = $this->getRequest()->get('mode', null);
|
||||
$position = $this->getRequest()->get('position', null);
|
||||
|
||||
$event = new CurrencyUpdatePositionEvent();
|
||||
|
||||
$event
|
||||
->setObjectId($this->getRequest()->get('currency_id', 0))
|
||||
->setPosition($this->getRequest()->get('position', 0))
|
||||
->setMode($mode)
|
||||
;
|
||||
|
||||
$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
|
||||
*
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\MessageDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Event\MessageChangeEvent;
|
||||
use Thelia\Core\Event\MessageUpdateEvent;
|
||||
use Thelia\Core\Event\MessageCreateEvent;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
@@ -133,7 +133,7 @@ class MessageController extends BaseAdminController
|
||||
public function changeAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||
|
||||
// Load the message object
|
||||
$message = MessageQuery::create()
|
||||
@@ -173,7 +173,7 @@ class MessageController extends BaseAdminController
|
||||
public function saveChangeAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.change")) return $response;
|
||||
if (null !== $response = $this->checkAuth("admin.configuration.messages.update")) return $response;
|
||||
|
||||
$message = false;
|
||||
|
||||
@@ -191,7 +191,7 @@ class MessageController extends BaseAdminController
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
$changeEvent = new MessageChangeEvent($data['id']);
|
||||
$changeEvent = new MessageUpdateEvent($data['id']);
|
||||
|
||||
// Create and dispatch the change event
|
||||
$changeEvent
|
||||
@@ -215,7 +215,7 @@ class MessageController extends BaseAdminController
|
||||
// just redirect to the edit page again.
|
||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
||||
$this->redirectToRoute(
|
||||
"admin.configuration.messages.change",
|
||||
"admin.configuration.messages.update",
|
||||
array('message_id' => $message_id)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,64 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Model\Category;
|
||||
|
||||
class CategoryChangePositionEvent extends ActionEvent
|
||||
class CurrencyUpdatePositionEvent extends BaseUpdatePositionEvent
|
||||
{
|
||||
const POSITION_UP = 1;
|
||||
const POSITION_DOWN = 2;
|
||||
const POSITION_ABSOLUTE = 3;
|
||||
|
||||
protected $category_id;
|
||||
protected $mode;
|
||||
protected $position;
|
||||
protected $category;
|
||||
|
||||
public function __construct($category_id, $mode, $position = null)
|
||||
{
|
||||
$this->category_id = $category_id;
|
||||
$this->mode = $mode;
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function getMode()
|
||||
{
|
||||
return $this->mode;
|
||||
}
|
||||
|
||||
public function setMode($mode)
|
||||
{
|
||||
$this->mode = $mode;
|
||||
}
|
||||
|
||||
public function getPosition()
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function setPosition($position)
|
||||
{
|
||||
$this->position = $position;
|
||||
}
|
||||
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
public function setCategory($category)
|
||||
{
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
public function getCategoryId()
|
||||
{
|
||||
return $this->category_id;
|
||||
}
|
||||
|
||||
public function setCategoryId($category_id)
|
||||
{
|
||||
$this->category_id = $category_id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Model\Category;
|
||||
|
||||
class CategoryCreateEvent extends ActionEvent
|
||||
class CategoryUpdateEvent extends ActionEvent
|
||||
{
|
||||
protected $category_id;
|
||||
protected $locale;
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Model\Config;
|
||||
|
||||
class ConfigChangeEvent extends ConfigCreateEvent
|
||||
class ConfigUpdateEvent extends ConfigCreateEvent
|
||||
{
|
||||
protected $config_id;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Model\Currency;
|
||||
|
||||
class CurrencyChangeEvent extends CurrencyCreateEvent
|
||||
class CurrencyUpdateEvent extends CurrencyCreateEvent
|
||||
{
|
||||
protected $currency_id;
|
||||
protected $is_default;
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Model\Message;
|
||||
|
||||
class MessageChangeEvent extends MessageCreateEvent
|
||||
class MessageUpdateEvent extends MessageCreateEvent
|
||||
{
|
||||
protected $message_id;
|
||||
|
||||
@@ -124,7 +124,7 @@ final class TheliaEvents
|
||||
/**
|
||||
* Change category position
|
||||
*/
|
||||
const CATEGORY_CHANGE_POSITION = "action.changeCategoryPosition";
|
||||
const CATEGORY_CHANGE_POSITION = "action.updateCategoryPosition";
|
||||
|
||||
/**
|
||||
* Sent just after a successful insert of a new category in the database.
|
||||
@@ -220,12 +220,12 @@ final class TheliaEvents
|
||||
|
||||
// -- Currencies management ---------------------------------------------
|
||||
|
||||
const CURRENCY_CREATE = "action.createCurrency";
|
||||
const CURRENCY_UPDATE = "action.updateCurrency";
|
||||
const CURRENCY_DELETE = "action.deleteCurrency";
|
||||
const CURRENCY_SET_DEFAULT = "action.setDefaultCurrency";
|
||||
const CURRENCY_UPDATE_RATES = "action.updateCurrencyRates";
|
||||
|
||||
const CURRENCY_CREATE = "action.createCurrency";
|
||||
const CURRENCY_UPDATE = "action.updateCurrency";
|
||||
const CURRENCY_DELETE = "action.deleteCurrency";
|
||||
const CURRENCY_SET_DEFAULT = "action.setDefaultCurrency";
|
||||
const CURRENCY_UPDATE_RATES = "action.updateCurrencyRates";
|
||||
const CURRENCY_UPDATE_POSITION = "action.updateCurrencyPosition";
|
||||
|
||||
const BEFORE_CREATECURRENCY = "action.before_createCurrency";
|
||||
const AFTER_CREATECURRENCY = "action.after_createCurrency";
|
||||
@@ -237,4 +237,4 @@ final class TheliaEvents
|
||||
const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -41,55 +41,29 @@ use Thelia\Model\Lang;
|
||||
*/
|
||||
class Session extends BaseSession
|
||||
{
|
||||
// -- Language ------------------------------------------------------------
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->get("locale", "en_US");
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->set("locale", $locale);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Lang|null
|
||||
*/
|
||||
public function getLang()
|
||||
{
|
||||
return $this->get("lang");
|
||||
return $this->get("thelia.current.lang", Lang::getDefaultLanguage());
|
||||
}
|
||||
|
||||
public function setLang(Lang $lang)
|
||||
{
|
||||
$this->set("lang", $lang);
|
||||
$this->set("thelia.current.lang", $lang);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLangId()
|
||||
public function getAdminEditionLang()
|
||||
{
|
||||
return $this->get("lang_id", Lang::getDefaultLanguage()->getId());
|
||||
return $this->get('thelia.admin.edition.lang', Lang::getDefaultLanguage());
|
||||
}
|
||||
|
||||
public function setLangId($langId)
|
||||
public function setAdminEditionLang($langId)
|
||||
{
|
||||
$this->set("lang_id", $langId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdminEditionLangId()
|
||||
{
|
||||
return $this->get('admin.edition_language', Lang::getDefaultLanguage()->getId());
|
||||
}
|
||||
|
||||
public function setAdminEditionLangId($langId)
|
||||
{
|
||||
$this->set('admin.edition_language', $langId);
|
||||
$this->set('thelia.admin.edition.lang', $langId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -98,43 +72,43 @@ class Session extends BaseSession
|
||||
|
||||
public function setCustomerUser(UserInterface $user)
|
||||
{
|
||||
$this->set('customer_user', $user);
|
||||
$this->set('thelia.customer_user', $user);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerUser()
|
||||
{
|
||||
return $this->get('customer_user');
|
||||
return $this->get('thelia.customer_user');
|
||||
}
|
||||
|
||||
public function clearCustomerUser()
|
||||
{
|
||||
return $this->remove('customer_user');
|
||||
return $this->remove('thelia.customer_user');
|
||||
}
|
||||
|
||||
// -- Admin user -----------------------------------------------------------
|
||||
|
||||
public function setAdminUser(UserInterface $user)
|
||||
{
|
||||
$this->set('admin_user', $user);
|
||||
$this->set('thelia.admin_user', $user);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdminUser()
|
||||
{
|
||||
return $this->get('admin_user');
|
||||
return $this->get('thelia.admin_user');
|
||||
}
|
||||
|
||||
public function clearAdminUser()
|
||||
{
|
||||
return $this->remove('admin_user');
|
||||
return $this->remove('thelia.admin_user');
|
||||
}
|
||||
|
||||
// -- Return page ----------------------------------------------------------
|
||||
|
||||
public function setReturnToUrl($url)
|
||||
{
|
||||
$this->set('return_to_url', $url);
|
||||
$this->set('thelia.return_to_url', $url);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -144,7 +118,7 @@ class Session extends BaseSession
|
||||
*/
|
||||
public function getReturnToUrl()
|
||||
{
|
||||
return $this->get('return_to_url', URL::getIndexPage());
|
||||
return $this->get('thelia.return_to_url', URL::getIndexPage());
|
||||
}
|
||||
|
||||
// -- Cart ------------------------------------------------------------------
|
||||
@@ -156,7 +130,7 @@ class Session extends BaseSession
|
||||
*/
|
||||
public function getCart()
|
||||
{
|
||||
$cart_id = $this->get("cart_id");
|
||||
$cart_id = $this->get("thelia.cart_id");
|
||||
$cart = null;
|
||||
if ($cart_id) {
|
||||
$cart = CartQuery::create()->findPk($cart_id);
|
||||
@@ -193,7 +167,7 @@ class Session extends BaseSession
|
||||
*/
|
||||
public function setCart($cart_id)
|
||||
{
|
||||
$this->set("cart_id", $cart_id);
|
||||
$this->set("thelia.cart_id", $cart_id);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ abstract class BaseI18nLoop extends BaseLoop
|
||||
$this->getBackend_context(),
|
||||
$this->getLang(),
|
||||
$search,
|
||||
$this->request->getSession()->getLocale(),
|
||||
$this->request->getSession()->getLang()->getLocale(),
|
||||
$columns,
|
||||
$foreignTable,
|
||||
$foreignKey,
|
||||
|
||||
@@ -235,31 +235,6 @@ abstract class BaseLoop
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup ModelCriteria for proper i18n processing
|
||||
*
|
||||
* @param ModelCriteria $search the Propel Criteria to configure
|
||||
* @param array $columns the i18n columns
|
||||
* @param string $foreignTable the specified table (default to criteria table)
|
||||
* @param string $foreignKey the foreign key in this table (default to criteria table)
|
||||
*
|
||||
* @return mixed the locale
|
||||
*/
|
||||
protected function configureI18nProcessing(ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID', $forceReturn = false) {
|
||||
|
||||
/* manage translations */
|
||||
return ModelCriteriaTools::getI18n(
|
||||
$this->getBackend_context(),
|
||||
$this->getLang(),
|
||||
$search,
|
||||
$this->request->getSession()->getLocale(),
|
||||
$columns,
|
||||
$foreignTable,
|
||||
$foreignKey,
|
||||
$forceReturn
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* this function have to be implement in your own loop class.
|
||||
|
||||
@@ -167,9 +167,6 @@ class Config extends BaseI18nLoop
|
||||
|
||||
->set("CREATE_DATE" , $result->getCreatedAt())
|
||||
->set("UPDATE_DATE" , $result->getUpdatedAt())
|
||||
->set("VERSION" , $result->getVersion())
|
||||
->set("VERSION_DATE" , $result->getVersionCreatedAt())
|
||||
->set("VERSION_AUTHOR" , $result->getVersionCreatedBy())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -13,6 +13,8 @@ class Category extends BaseCategory
|
||||
{
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* @return int number of child for the current category
|
||||
*/
|
||||
@@ -46,18 +48,6 @@ class Category extends BaseCategory
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function getNextPosition($parent) {
|
||||
|
||||
$last = CategoryQuery::create()
|
||||
->filterByParent($parent)
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->limit(1)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
return $last != null ? $last->getPosition() + 1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* count all products for current category and sub categories
|
||||
|
||||
@@ -11,6 +11,8 @@ class Currency extends BaseCurrency {
|
||||
|
||||
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
|
||||
|
||||
use \Thelia\Model\Tools\PositionManagementTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@@ -23,38 +23,100 @@
|
||||
|
||||
namespace Thelia\Tools;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Rewriting\RewritingResolver;
|
||||
use Thelia\Rewriting\RewritingRetriever;
|
||||
|
||||
class URL
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
|
||||
class URL extends ContainerAware
|
||||
{
|
||||
protected $container;
|
||||
protected $request;
|
||||
|
||||
protected $resolver = null;
|
||||
protected $retriever = null;
|
||||
|
||||
const PATH_TO_FILE = true;
|
||||
const WITH_INDEX_PAGE = false;
|
||||
|
||||
public function __construct()
|
||||
private static $instance = null;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
$this->retriever = new RewritingRetriever();
|
||||
$this->resolver = new RewritingResolver();
|
||||
|
||||
self::instance = $this;
|
||||
}
|
||||
|
||||
public static function getIndexPage()
|
||||
{
|
||||
return ConfigQuery::read('base_url', '/') . "index_dev.php"; // FIXME !
|
||||
/**
|
||||
* Give this class a singleton behavior
|
||||
*/
|
||||
public static getInstance() {
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public static function init()
|
||||
/**
|
||||
* Return the base URL, either the base_url defined in Config, or the URL
|
||||
* of the current language, if 'one_domain_foreach_lang' is enabled.
|
||||
*
|
||||
* @return string the base URL, with a trailing '/'
|
||||
*/
|
||||
public function getBaseUrl()
|
||||
{
|
||||
return new URL();
|
||||
// Check if we have a specific URL for each lang.
|
||||
$one_domain_foreach_lang = ConfigQuery::read("one_domain_foreach_lang", false);
|
||||
|
||||
if ($one_domain_foreach_lang == true) {
|
||||
// If it's the case, get the current lang URL
|
||||
$base_url = $this->request->getSession()->getLang()->getUrl();
|
||||
|
||||
$err_msg = 'base_url';
|
||||
}
|
||||
else {
|
||||
// Get the base URL
|
||||
$base_url = ConfigQuery::read('base_url', null);
|
||||
|
||||
$err_msg = sprintf('base_url for lang %s', $this->request->getSession()->getCode());
|
||||
}
|
||||
|
||||
// Be sure that base-url starts with http, give up if it's not the case.
|
||||
if (substr($base_url, 0, 4) != 'http') {
|
||||
throw new \InvalidArgumentException("The 'base_url' configuration parameter shoud contains the URL of your shop, starting with http or https.");
|
||||
}
|
||||
|
||||
// Normalize the base_url
|
||||
return rtrim($base_url, '/').'/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the index page, which is basically the base_url in prod environment.
|
||||
*/
|
||||
public function getIndexPage()
|
||||
{
|
||||
// Get the base URL
|
||||
$base_url = $this->getBaseUrl();
|
||||
|
||||
// Check if we're in dev or prod
|
||||
$env = $this->container->get(‘kernel’)->getEnvironment();
|
||||
|
||||
// For dev, add the proper page.
|
||||
if ($env == 'dev') {
|
||||
$base_url .= "index_dev.php";
|
||||
}
|
||||
|
||||
return $base_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Absolute URL for a given path relative to web root. By default,
|
||||
* the index.php (or index_dev.php) script name is added to the URL, use
|
||||
* the script name (index_dev.php) is added to the URL in dev_environment, use
|
||||
* $path_only = true to get a path without the index script.
|
||||
*
|
||||
* @param string $path the relative path
|
||||
@@ -63,7 +125,7 @@ class URL
|
||||
*
|
||||
* @return string The generated URL
|
||||
*/
|
||||
public static function absoluteUrl($path, array $parameters = null, $path_only = self::WITH_INDEX_PAGE)
|
||||
public function absoluteUrl($path, array $parameters = null, $path_only = self::WITH_INDEX_PAGE)
|
||||
{
|
||||
// Already absolute ?
|
||||
if (substr($path, 0, 4) != 'http') {
|
||||
@@ -72,9 +134,9 @@ class URL
|
||||
* @etienne : can't be done here for it's already done in ::viewUrl / ::adminViewUrl
|
||||
* @franck : should be done, as absoluteUrl() is sometimes called directly (see UrlGenerator::generateUrlFunction())
|
||||
*/
|
||||
$root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : self::getIndexPage();
|
||||
//$root = $path_only == self::PATH_TO_FILE ? ConfigQuery::read('base_url', '/') : '';
|
||||
$root = $path_only == self::PATH_TO_FILE ? $this->getBaseUrl() : $this->getIndexPage();
|
||||
|
||||
// Normalize root path
|
||||
$base = rtrim($root, '/') . '/' . ltrim($path, '/');
|
||||
} else
|
||||
$base = $path;
|
||||
@@ -90,6 +152,7 @@ class URL
|
||||
$sepChar = strstr($base, '?') === false ? '?' : '&';
|
||||
|
||||
if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString;
|
||||
|
||||
return $base . $queryString;
|
||||
}
|
||||
|
||||
@@ -101,11 +164,11 @@ class URL
|
||||
*
|
||||
* @return string The generated URL
|
||||
*/
|
||||
public static function adminViewUrl($viewName, array $parameters = array())
|
||||
public function adminViewUrl($viewName, array $parameters = array())
|
||||
{
|
||||
$path = sprintf("%s/admin/%s", self::getIndexPage(), $viewName); // FIXME ! view= should not be required, check routing parameters
|
||||
$path = sprintf("%s/admin/%s", $this->getIndexPage(), $viewName);
|
||||
|
||||
return self::absoluteUrl($path, $parameters);
|
||||
return $this->absoluteUrl($path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,11 +179,11 @@ class URL
|
||||
*
|
||||
* @return string The generated URL
|
||||
*/
|
||||
public static function viewUrl($viewName, array $parameters = array())
|
||||
public function viewUrl($viewName, array $parameters = array())
|
||||
{
|
||||
$path = sprintf("?view=%s", $viewName);
|
||||
|
||||
return self::absoluteUrl($path, $parameters);
|
||||
return $this>absoluteUrl($path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +200,7 @@ class URL
|
||||
$rewrittenUrl = $this->retriever->loadViewUrl($view, $viewLocale, $viewId);
|
||||
}
|
||||
|
||||
return $rewrittenUrl === null ? self::viewUrl($view, array($view . '_id' => $viewId, 'locale' => $viewLocale)) : $rewrittenUrl;
|
||||
return $rewrittenUrl === null ? $this->viewUrl($view, array($view . '_id' => $viewId, 'locale' => $viewLocale)) : $rewrittenUrl;
|
||||
}
|
||||
|
||||
public function retrieveCurrent(Request $request)
|
||||
|
||||
@@ -74,6 +74,10 @@ h4 {
|
||||
a {
|
||||
color: #e9720f;
|
||||
font-weight: bold;
|
||||
|
||||
&.btn {
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
// Bootstrap Adjustements ------------------------------------------------------
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
<td>
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
|
||||
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/change' currency_id="$ID"}">{$NAME}</a>
|
||||
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id="$ID"}">{$NAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$NAME}
|
||||
@@ -155,7 +155,7 @@
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
|
||||
<a class="btn btn-mini currency-change" title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/change' currency_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
<a class="btn btn-mini currency-change" title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
|
||||
@@ -203,7 +203,7 @@
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/change' currency_id='_ID_'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{* We do not allow users to create secured currencies from here *}
|
||||
@@ -371,7 +371,7 @@
|
||||
placement : 'left',
|
||||
success : function(response, newValue) {
|
||||
// The URL template
|
||||
var url = "{url path='/admin/configuration/currencies/changePosition' currency_id='__ID__' position='__POS__'}";
|
||||
var url = "{url path='/admin/configuration/currencies/updatePosition' currency_id='__ID__' position='__POS__'}";
|
||||
|
||||
// Perform subtitutions
|
||||
url = url.replace('__ID__', $(this).data('id'))
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
{block name="error-message"}<div class="alert alert-error">{$error_message}</div>{/block}
|
||||
|
||||
<p><i class="icon icon-backward"></i> <a href="{url path='/admin/home'}">{intl l="Go to administration home"}</a></p>
|
||||
<p><a class="btn" href="{url path='/admin/home'}"><i class="icon icon-backward icon-white"></i> {intl l="Go to administration home"}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span12">
|
||||
<form action="{url path='/admin/configuration/messages/change-values'}" method="post">
|
||||
<form action="{url path='/admin/configuration/messages/update-values'}" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
@@ -49,7 +49,7 @@
|
||||
<td>
|
||||
{if ! $SECURED}
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"}
|
||||
<a title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/change' message_id="$ID"}">{$NAME}</a>
|
||||
<a title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/update' message_id="$ID"}">{$NAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$NAME}
|
||||
@@ -65,7 +65,7 @@
|
||||
{if ! $SECURED}
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.messages.change"}
|
||||
<a class="btn btn-mini message-change" title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/change' message_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
<a class="btn btn-mini message-change" title="{intl l='Change this mailing template'}" href="{url path='/admin/configuration/messages/update' message_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.messages.delete"}
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created message ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages/change' message_id='_ID_'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages/update' message_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{* We do not allow users to create secured messages from here *}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="row-fluid">
|
||||
|
||||
<div class="span12">
|
||||
<form action="{url path='/admin/configuration/variables/change-values'}" method="post">
|
||||
<form action="{url path='/admin/configuration/variables/update-values'}" method="post">
|
||||
<div class="general-block-decorator">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption>
|
||||
@@ -77,7 +77,7 @@
|
||||
<td>
|
||||
{if ! $SECURED}
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
||||
<a title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/change' variable_id="$ID"}">{$NAME}</a>
|
||||
<a title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/update' variable_id="$ID"}">{$NAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel="can_change"}
|
||||
{$NAME}
|
||||
@@ -103,7 +103,7 @@
|
||||
<a class="btn btn-mini cancel-edit" id="cancel_edit_btn_{$ID}" data-id="{$ID}" title="{intl l='Cancel changes and revert to original value'}" href="#"><i class="icon-remove"></i></a>
|
||||
|
||||
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.variables.change"}
|
||||
<a class="btn btn-mini config-change" title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/change' variable_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
<a class="btn btn-mini config-change" title="{intl l='Change this variable'}" href="{url path='/admin/configuration/variables/update' variable_id="$ID"}"><i class="icon-edit"></i></a>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.variables.delete"}
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created variable ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/change' variable_id='_ID_'}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/update' variable_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{* We do not allow users to create hidden or secured variables from here *}
|
||||
|
||||
Reference in New Issue
Block a user