This commit is contained in:
Franck Allimant
2014-01-27 22:12:29 +01:00
parent 0e5fcbd0d4
commit 7043a9e388
2 changed files with 21 additions and 9 deletions

View File

@@ -38,6 +38,7 @@ use Thelia\Form\Lang\LangDefaultBehaviorForm;
use Thelia\Form\Lang\LangUpdateForm;
use Thelia\Form\Lang\LangUrlEvent;
use Thelia\Form\Lang\LangUrlForm;
use Thelia\Log\Tlog;
use Thelia\Model\ConfigQuery;
use Thelia\Model\LangQuery;
@@ -118,11 +119,13 @@ class LangController extends BaseAdminController
$changedObject = $event->getLang();
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
$this->redirectToRoute('admin.configuration.languages');
} catch (\Exception $e) {
$error_msg = $e->getMessage();
} catch (\Exception $ex) {
$error_msg = $this->getTranslator()->trans("Failed to update language definition: %ex", array("%ex" => $ex->getMessage()));
Tlog::getInstance()->addError("Failed to update language definition", $ex->getMessage());
}
echo "err=".$error_msg;
return $this->renderDefault();
return $this->renderDefault(array('error_message' => $error_msg));
}
protected function hydrateEvent($event,Form $form)
@@ -156,7 +159,7 @@ class LangController extends BaseAdminController
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
} catch (\Exception $e) {
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error on changing default languages with message : %s", $e->getMessage()));
Tlog::getInstance()->error(sprintf("Error on changing default languages with message : %s", $e->getMessage()));
$error = $e->getMessage();
}
@@ -223,7 +226,7 @@ class LangController extends BaseAdminController
$this->redirectToRoute('admin.configuration.languages');
} catch (\Exception $ex) {
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during language removal with message : %s", $ex->getMessage()));
Tlog::getInstance()->error(sprintf("error during language removal with message : %s", $ex->getMessage()));
$error_msg = $ex->getMessage();
}

View File

@@ -18,12 +18,20 @@
{module_include location='languages_top'}
{if $error_message}
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger">
{$error_message}
</div>
</div>
</div>
{/if}
<div class="row">
<div class="col-md-12">
<div class="general-block-decorator">
<form action="" method="">
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l="Languages management"}
@@ -36,7 +44,7 @@
</caption>
<thead>
<tr>
<th>{intl l="Language name"}</th>
<th colspan="2">{intl l="Language name"}</th>
<th>{intl l="ISO 639 Code"}</th>
<th>{intl l="Locale"}</th>
<th>{intl l="date form"}</th>
@@ -48,6 +56,7 @@
<tbody>
{loop type="lang" name="lang.list" backend_context="1"}
<tr>
<td class="text-center"><img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$CODE}" /></td>
<td>{$TITLE}</td>
<td>{$CODE}</td>
<td>{$LOCALE}</td>
@@ -98,7 +107,7 @@
<div class="form-group {if $error}has-error{/if}" >
<label for="{$label_attr.for}" class="label-control">{intl l="If a translation is missing or incomplete :"}</label>
<div class="input-group">
<select name="{$name}" id="{$label_attr.for}" data-toggle="selectpicker" class="form-control">
<select name="{$name}" id="{$label_attr.for}" data-toggle="selectpicker">
{foreach $choices as $choice}
<option value="{$choice->value}" {if $lang_without_translation == $choice->value}selected="selected"{/if}>{$choice->label}</option>
{/foreach}