Fixed customer front controller, events, addec admion config.

This commit is contained in:
franck
2013-08-30 19:46:12 +02:00
parent cce270fdcc
commit 6867eae9b7
35 changed files with 810 additions and 284 deletions

View File

@@ -52,11 +52,13 @@ class BaseAdminController extends BaseController
if (! empty($template)) {
// If we have a view in the URL, render this view
return $this->render($template);
} elseif (null != $view = $this->getRequest()->get('view')) {
}
elseif (null != $view = $this->getRequest()->get('view')) {
return $this->render($view);
}
} catch (\Exception $ex) {
// Nothing special
}
catch (\Exception $ex) {
return new Response($this->errorPage($ex->getMessage()));
}
return $this->pageNotFound();

View File

@@ -33,6 +33,7 @@ use Thelia\Core\Event\CategoryDeleteEvent;
use Thelia\Core\Event\CategoryToggleVisibilityEvent;
use Thelia\Core\Event\CategoryChangePositionEvent;
use Thelia\Form\CategoryDeletionForm;
use Thelia\Model\Lang;
class CategoryController extends BaseAdminController
{
@@ -99,7 +100,7 @@ class CategoryController extends BaseAdminController
$this->adminLogAppend(sprintf("Category %s (ID %s) deleted", $category->getTitle(), $category->getId()));
// Substitute _ID_ in the URL with the ID of the created category
$successUrl = str_replace('_ID_', $categoryDeleteEvent->getDeletedCategory()->getId(), $categoryDeletionForm->getSuccessUrl());
$successUrl = str_replace('_ID_', $categoryDeleteEvent->getDeletedCategory()->getParent(), $categoryDeletionForm->getSuccessUrl());
// Redirect to the success URL
$this->redirect($successUrl);
@@ -185,11 +186,34 @@ class CategoryController extends BaseAdminController
// Get the category ID
$id = $this->getRequest()->get('id', 0);
// Find the current order
$category_order = $this->getRequest()->get(
'category_order',
$this->getSession()->get('admin.category_order', 'manual')
);
// Find the current edit language ID
$edition_language = $this->getRequest()->get(
'edition_language',
$this->getSession()->get('admin.edition_language', Lang::getDefaultLanguage()->getId())
);
$args = array(
'action' => $action,
'current_category_id' => $id
'current_category_id' => $id,
'category_order' => $category_order,
'edition_language' => $edition_language,
'date_format' => Lang::getDefaultLanguage()->getDateFormat(),
'time_format' => Lang::getDefaultLanguage()->getTimeFormat(),
'datetime_format' => Lang::getDefaultLanguage()->getDateTimeFormat(),
);
// Store the current sort order in session
$this->getSession()->set('admin.category_order', $category_order);
// Store the current edition language in session
$this->getSession()->set('admin.edition_language', $edition_language);
try {
switch ($action) {
case 'browse' : // Browse categories

View File

@@ -51,13 +51,16 @@ class SessionController extends BaseAdminController
public function checkLoginAction()
{
$adminLoginForm = new AdminLogin($this->getRequest());
$request = $this->getRequest();
$authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm);
$adminLoginForm = new AdminLogin($request);
try {
$form = $this->validateForm($adminLoginForm, "post");
$authenticator = new AdminUsernamePasswordFormAuthenticator($request, $adminLoginForm);
$user = $authenticator->getAuthentifiedUser();
// Success -> store user in security context
@@ -85,7 +88,7 @@ class SessionController extends BaseAdminController
// Log authentication failure
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
$message = "Unable to process your request. Please try again.";
$message = "Unable to process your request. Please try again.".$ex->getMessage();
}
// Store error information in the form