Added AdminUtilities Smarty plugin, optimized templates

This commit is contained in:
franck
2013-09-03 15:43:05 +02:00
parent 69f88db090
commit fce528c41f
17 changed files with 452 additions and 177 deletions

View File

@@ -166,17 +166,23 @@
<argument type="service" id="request"/>
</service>
<service id="smarty.plugin.security" class="Thelia\Core\Template\Smarty\Plugins\Security" scope="request">
<service id="smarty.plugin.security" class="Thelia\Core\Template\Smarty\Plugins\Security" scope="request">
<tag name="thelia.parser.register_plugin"/>
<argument type="service" id="thelia.securityContext" />
</service>
<service id="smarty.plugin.dataAccess" class="Thelia\Core\Template\Smarty\Plugins\DataAccessFunctions" scope="request">
<service id="smarty.plugin.dataAccess" class="Thelia\Core\Template\Smarty\Plugins\DataAccessFunctions" scope="request">
<tag name="thelia.parser.register_plugin"/>
<argument type="service" id="thelia.securityContext" />
<argument type="service" id="thelia.parser.context"/>
</service>
<service id="smarty.plugin.adminUtilities" class="Thelia\Core\Template\Smarty\Plugins\AdminUtilities" scope="request">
<tag name="thelia.parser.register_plugin"/>
<argument type="service" id="thelia.securityContext" />
</service>
<service id="http_kernel" class="Thelia\Core\TheliaHttpKernel">
<argument type="service" id="event_dispatcher" />
<argument type="service" id="service_container" />

View File

@@ -155,7 +155,7 @@ class BaseAdminController extends BaseController
*/
protected function getCurrentEditionLangId() {
return $this->getRequest()->get(
'edition_language',
'edit_language_id',
$this->getSession()->getAdminEditionLangId()
);
}
@@ -196,29 +196,32 @@ class BaseAdminController extends BaseController
$session = $this->getSession();
// Find the current edit language ID
$edition_language = $this->getCurrentEditionLangId();
// Current back-office (not edition) language
$current_lang = LangQuery::create()->findOneById($session->getLangId());
$current_lang = LangQuery::create()->findOneById($session->getLangId());
// Find the current edit language ID
$edition_language = LangQuery::create()->findOneById($this->getCurrentEditionLangId());
// Prepare common template variables
$args = array_merge($args, array(
'locale' => $session->getLocale(),
'lang_code' => $session->getLang(),
'lang_id' => $session->getLangId(),
'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(),
'datetime_format' => $current_lang->getDateTimeFormat(),
'date_format' => $current_lang->getDateFormat(),
'time_format' => $current_lang->getTimeFormat(),
'edition_language' => $edition_language,
'edit_language_id' => $edition_language->getId(),
'edit_language_locale' => $edition_language->getLocale(),
'current_url' => htmlspecialchars($this->getRequest()->getUri())
'current_url' => htmlspecialchars($this->getRequest()->getUri())
));
// Update the current edition language in session
$this->getSession()->setAdminEditionLangId($edition_language);
$this->getSession()->setAdminEditionLangId($edition_language->getId());
// Render the template.
try {

View File

@@ -188,7 +188,7 @@ class CategoryController extends BaseAdminController
// Find the current order
$category_order = $this->getRequest()->get(
'category_order',
'order',
$this->getSession()->get('admin.category_order', 'manual')
);

View File

@@ -42,6 +42,25 @@ use Thelia\Form\ConfigCreationForm;
*/
class ConfigController 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.variables_order', 'name')
);
// Store the current sort order in session
$this->getSession()->set('admin.variables_order', $order);
return $this->render('variables', array('order' => $order));
}
/**
* The default action is displaying the variables list.
*
@@ -51,7 +70,7 @@ class ConfigController extends BaseAdminController
if (null !== $response = $this->checkAuth("admin.configuration.variables.view")) return $response;
return $this->render('variables');
return $this->renderList();
}
/**
@@ -124,7 +143,7 @@ class ConfigController extends BaseAdminController
}
// At this point, the form has error, and should be redisplayed.
return $this->render('variables');
return $this->renderList();
}
/**
@@ -276,7 +295,7 @@ class ConfigController extends BaseAdminController
$this->dispatch(TheliaEvents::CONFIG_SETVALUE, $event);
}
$this->redirect(URL::adminViewUrl('variables'));
$this->redirect(URL::absoluteUrl('/admin/configuration/variables'));
}
/**
@@ -294,6 +313,6 @@ class ConfigController extends BaseAdminController
$this->dispatch(TheliaEvents::CONFIG_DELETE, $event);
$this->redirect(URL::adminViewUrl('variables'));
$this->redirect(URL::absoluteUrl('/admin/configuration/variables'));
}
}

View File

@@ -101,7 +101,9 @@ class CurrencyController extends BaseAdminController
->setCurrencyName($data['name'])
->setLocale($data["locale"])
->setSymbol($data['symbol'])
;
->setCode($data['code'])
->setRate($data['rate'])
;
$this->dispatch(TheliaEvents::CURRENCY_CREATE, $createEvent);

View File

@@ -34,6 +34,8 @@ use Thelia\Model\LangQuery;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\ConfigQuery;
use Thelia\Type\BooleanOrBothType;
use Thelia\Type\TypeCollection;
use Thelia\Type\EnumListType;
/**
* Config loop, to access configuration variables
@@ -59,7 +61,21 @@ class Config extends BaseI18nLoop
Argument::createIntListTypeArgument('exclude'),
Argument::createAnyTypeArgument('variable'),
Argument::createBooleanOrBothTypeArgument('hidden'),
Argument::createBooleanOrBothTypeArgument('secured')
Argument::createBooleanOrBothTypeArgument('secured'),
new Argument(
'order',
new TypeCollection(
new EnumListType(
array(
'id', 'id_reverse',
'name', 'name_reverse',
'title', 'title_reverse',
'value', 'value_reverse',
)
)
),
'name'
)
);
}
@@ -94,7 +110,39 @@ class Config extends BaseI18nLoop
if (! is_null($secured) && $secured != BooleanOrBothType::ANY)
$search->filterBySecured($secured ? 1 : 0);
$search->orderByName(Criteria::ASC);
$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->orderByName(Criteria::ASC);
break;
case 'name_reverse':
$search->orderByName(Criteria::DESC);
break;
case 'title':
$search->addAscendingOrderByColumn('i18n_TITLE');
break;
case 'title_reverse':
$search->addDescendingOrderByColumn('i18n_TITLE');
break;
case 'value':
$search->orderByValue(Criteria::ASC);
break;
case 'value_reverse':
$search->orderByValue(Criteria::DESC);
break;
}
}
$results = $this->search($search, $pagination);

View File

@@ -66,8 +66,9 @@ class Currency extends BaseI18nLoop
'code', 'code_reverse',
'symbol', 'symbol_reverse',
'rate', 'rate_reverse',
'is_default', 'is_default_reverse',
'manual', 'manual_reverse')
)
)
),
'manual'
)
@@ -143,6 +144,13 @@ class Currency extends BaseI18nLoop
$search->orderByRate(Criteria::DESC);
break;
case 'is_default':
$search->orderByByDefault(Criteria::ASC);
break;
case 'is_default_reverse':
$search->orderByByDefault(Criteria::DESC);
break;
case 'manual':
$search->orderByPosition(Criteria::ASC);
break;

View File

@@ -0,0 +1,144 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\Smarty\Plugins;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Tools\URL;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Security\SecurityContext;
/**
* This class implements variour admin template utilities
*
* @author Franck Allimant <franck@cqfdev.fr>
*/
class AdminUtilities extends AbstractSmartyPlugin
{
private $securityContext;
public function __construct(SecurityContext $securityContext)
{
$this->securityContext = $securityContext;
}
public function generatePositionChangeBlock($params, &$smarty) {
// The required permissions
$permission = $this->getParam($params, 'permission');
// The base position change path
$path = $this->getParam($params, 'path');
// The URL parameter the object ID is assigned
$url_parameter = $this->getParam($params, 'url_parameter');
// The current object position
$position = $this->getParam($params, 'position');
// The object ID
$id = $this->getParam($params, 'id');
// The in place dition class
$in_place_edit_class = $this->getParam($params, 'in_place_edit_class');
/*
<a href="{url path='/admin/configuration/currencies/positionUp' currency_id=$ID}"><i class="icon-arrow-up"></i></a>
<span class="currencyPositionChange" data-id="{$ID}">{$POSITION}</span>
<a href="{url path='/admin/configuration/currencies/positionDown' currency_id=$ID}"><i class="icon-arrow-down"></i></a>
*/
if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($permission))) {
return sprintf(
'<a href="%s"><i class="icon-arrow-up"></i></a><span class="%s" data-id="%s">%s</span><a href="%s"><i class="icon-arrow-down"></i></a>',
URL::absoluteUrl("$path/positionUp", array($url_parameter => $id)),
$in_place_edit_class,
$id,
$position,
URL::absoluteUrl("$path/positionDown", array($url_parameter => $id))
);
}
else {
return $position;
}
}
/**
* Generates the link of a sortable column header
*
* @param array $params
* @param unknown $smarty
* @return string no text is returned.
*/
public function generateSortableColumnHeader($params, &$smarty)
{
// The current order of the table
$current_order = $this->getParam($params, 'current_order');
// The column ascending order
$order = $this->getParam($params, 'order');
// The column descending order label
$reverse_order = $this->getParam($params, 'reverse_order');
// The order change path
$path = $this->getParam($params, 'path');
// The column label
$label = $this->getParam($params, 'label');
if ($current_order == $order) {
$icon = 'up';
$order_change = $reverse_order;
}
else if ($current_order == $reverse_order) {
$icon = 'down';
$order_change = $order;
}
else {
$order_change = $order;
}
if (! empty($icon))
$output = sprintf('<i class="icon icon-chevron-%s"></i> ', $icon);
else
$output = '';
return sprintf('%s<a href="%s">%s</a>', $output, URL::absoluteUrl($path, array('order' => $order_change)), $label);
}
/**
* Define the various smarty plugins handled by this class
*
* @return an array of smarty plugin descriptors
*/
public function getPluginDescriptors()
{
return array(
new SmartyPluginDescriptor('function', 'admin_sortable_header', $this, 'generateSortableColumnHeader'),
new SmartyPluginDescriptor('function', 'admin_position_block' , $this, 'generatePositionChangeBlock'),
);
}
}

View File

@@ -621,6 +621,7 @@ form .info .input-append .add-on {
li.active a {
opacity: 1;
background-color: #E7E7E7;
border: 1px solid #E9720F;
}
}
}
@@ -725,6 +726,17 @@ label {
td, th {
text-align: center;
&.text-center {
text-align: center;
}
&.text-left {
text-align: left;
}
&.text-right {
text-align: right;
}
}
td.object-title, th.object-title {

View File

@@ -47,54 +47,40 @@
<thead>
<tr>
<th class="object-image">&nbsp;</th>
<th class="object-title">
{if $category_order == 'alpha'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'alpha_reverse'}
{elseif $category_order == 'alpha_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'alpha'}
{else}
{$order_change = 'alpha'}
{/if}
<a href="{url path='/admin/catalog/category' id="{$current_category_id}" category_order="$order_change"}">
{intl l="Category title"}
</a>
</th>
{admin_sortable_header
current_order=$category_order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/catalog/category' id="{$current_category_id}"}
label={intl l='Category title'}
}
</th>
{module_include location='category_list_header'}
<th>
{if $category_order == 'visible'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'visible_reverse'}
{elseif $category_order == 'visible_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'visible'}
{else}
{$order_change = 'visible'}
{/if}
<a href="{url path='admin/catalog/category' id="{$current_category_id}" category_order="$order_change"}">
{intl l="Online"}
</a>
{admin_sortable_header
current_order=$category_order
order='visible'
reverse_order='visible_reverse'
path={url path='/admin/catalog/category' id="{$current_category_id}"}
label={intl l='Online'}
}
</th>
<th>
{if $category_order == 'manual'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'manual_reverse'}
{elseif $category_order == 'manual_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'manual'}
{else}
{$order_change = 'manual'}
{/if}
<a href="{url path='admin/catalog/category' id="{$current_category_id}" category_order="$order_change"}">{intl l="Position"}</a>
{admin_sortable_header
current_order=$category_order
order='manual'
reverse_order='manual_reverse'
path={url path='/admin/catalog/category' id="{$current_category_id}"}
label={intl l='Position'}
}
</th>
<th>{intl l="Actions"}</th>
<th>&nbsp;</th>
</tr>
</thead>
@@ -126,15 +112,14 @@
</td>
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
<a href="{url path='admin/catalog/category' category_id="{$ID}" action='positionUp'}"><i class="icon-arrow-up"></i></a>
<span class="categoryPositionChange" data-id="{$ID}">{$POSITION}</span>
<a href="{url path='admin/catalog/category' category_id="{$ID}" action='positionDown'}"><i class="icon-arrow-down"></i></a>
{/loop}
{elseloop rel="can_change"}
{$POSITION}
{/elseloop}
{admin_position_block
permission="admin.category.edit"
path={url path='admin/catalog/category' category_id="{$ID}"}
url_parameter="category_id"
in_place_edit_class="categoryPositionChange"
position="$POSITION"
id="$ID"
}
</td>
<td>
@@ -200,13 +185,38 @@
<tr>
<th>&nbsp;</th>
<th class="object-title">{intl l="Product title"}</th>
<th class="object-title">
{admin_sortable_header
current_order=$product_order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/catalog/product' id="{$current_category_id}"}
label={intl l='Product title'}
}
{module_include location='product_list_header'}
<th>{intl l="Online"}</th>
<th>{intl l="Position"}</th>
<th>{intl l="Actions"}</th>
<th>
{admin_sortable_header
current_order=$product_order
order='visible'
reverse_order='visible_reverse'
path={url path='/admin/catalog/product' id="{$current_category_id}"}
label={intl l='Online'}
}
</th>
<th>
{admin_sortable_header
current_order=$product_order
order='manual'
reverse_order='manual_reverse'
path={url path='/admin/catalog/product' id="{$current_category_id}"}
label={intl l='Position'}
}
</th>
<th>&nbsp;</th>
</tr>
</thead>
@@ -229,13 +239,18 @@
</td>
<td>
<a href="{url path='admin/catalog/product' id="$ID" action='positionUn'}"><i class="icon-arrow-up"></i></a>
<span class="object_classement_editable" data-action="changeProductPosition" data-name="product_id" data-id="{$ID}">{$POSITION}</span>
<a href="{url path='admin/catalog/product' id="$ID" action='positionDown'}"><i class="icon-arrow-down"></i></a>
{admin_position_block
permission="admin.product.edit"
path={url path='admin/catalog/product' category_id="{$ID}"}
url_parameter="product_id"
in_place_edit_class="productPositionChange"
position="$POSITION"
id="$ID"
}
</td>
<td>
<a class="btn btn-mini" title="{intl l='Edit this category'}" href="{url path='admin/catalog/product' id="$ID" action='edit'}"><i class="icon-edit"></i></a>
<a class="btn btn-mini" title="{intl l='Edit this product'}" href="{url path='admin/catalog/product' id="$ID" action='edit'}"><i class="icon-edit"></i></a>
<a class="btn btn-mini product-delete" title="{intl l='Delete this product'}" href="{url path='admin/catalog/product' id="$ID" action='delete'}"><i class="icon-trash"></i></a>
</td>
</tr>

View File

@@ -40,94 +40,75 @@
</caption>
<tr>
<th>
{if $order == 'id'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'id_reverse'}
{elseif $order == 'id_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'id'}
{else}
{$order_change = 'id'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="ID"}
</a>
{admin_sortable_header
current_order=$order
order='id'
reverse_order='id_reverse'
path='/admin/configuration/currencies'
label="{intl l='ID'}"
}
</th>
<th>
{if $order == 'alpha'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'alpha_reverse'}
{elseif $order == 'alpha_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'alpha'}
{else}
{$order_change = 'alpha'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="Name"}
</a>
{admin_sortable_header
current_order=$order
order='alpha'
reverse_order='alpha_reverse'
path='/admin/configuration/currencies'
label="{intl l='Name'}"
}
</th>
<th>
{if $order == 'code'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'code_reverse'}
{elseif $order == 'code_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'code'}
{else}
{$order_change = 'code'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">{intl l="ISO 4217 Code"}</a>
<th class="text-center">
{admin_sortable_header
current_order=$order
order='code'
reverse_order='code_reverse'
path='/admin/configuration/currencies'
label="{intl l="ISO 4217 Code"}"
}
<a title="{intl l='More information about ISO 4217'}" href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank"><i class="icon icon-question-sign"></i></a>
</th>
<th>
{if $order == 'symbol'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'symbol_reverse'}
{elseif $order == 'symbol_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'symbol'}
{else}
{$order_change = 'symbol'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="Symbol"}
</a>
<th class="text-center">
{admin_sortable_header
current_order=$order
order='symbol'
reverse_order='symbol_reverse'
path='/admin/configuration/currencies'
label="{intl l="Symbol"}"
}
</th>
<th>
{if $order == 'rate'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'rate_reverse'}
{elseif $order == 'rate_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'rate'}
{else}
{$order_change = 'rate'}
{/if}
<a href="{url path='/admin/configuration/currencies' order=$order_change}">
{intl l="Rate in &euro;"}
</a>
<th class="text-right">
{admin_sortable_header
current_order=$order
order='rate'
reverse_order='rate_reverse'
path='/admin/configuration/currencies'
label="{intl l="Rate in &euro;"}"
}
</th>
<th>
{if $order == 'manual'}
<i class="icon icon-chevron-up"></i>
{$order_change = 'manual_reverse'}
{elseif $order == 'manual_reverse'}
<i class="icon icon-chevron-down"></i>
{$order_change = 'manual'}
{else}
{$order_change = 'manual'}
{/if}
<a href="{url path='/admin/configuration/currencies' order="$order_change"}">{intl l="Position"}</a>
<th class="text-center">
{admin_sortable_header
current_order=$order
order='manual'
reverse_order='manual_reverse'
path='/admin/configuration/currencies'
label="{intl l="Position"}"
}
</th>
<th>{intl l="Default"}</th>
<th class="text-center">
{admin_sortable_header
current_order=$order
order='is_default'
reverse_order='is_default_reverse'
path='/admin/configuration/currencies'
label="{intl l="Default"}"
}
</th>
{module_include location='currencies_table_header'}
@@ -148,25 +129,24 @@
{/elseloop}
</td>
<td>{$ISOCODE}</td>
<td class="text-center">{$ISOCODE}</td>
<td>{$SYMBOL}</td>
<td class="text-center">{$SYMBOL}</td>
<td>{$RATE|string_format:"%.4f"}</td>
<td class="text-right">{$RATE|string_format:"%.4f"}</td>
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
<a href="{url path='/admin/configuration/currencies/positionUp' currency_id=$ID}"><i class="icon-arrow-up"></i></a>
<span class="currencyPositionChange" data-id="{$ID}">{$POSITION}</span>
<a href="{url path='/admin/configuration/currencies/positionDown' currency_id=$ID}"><i class="icon-arrow-down"></i></a>
{/loop}
{elseloop rel="can_change"}
{$POSITION}
{/elseloop}
<td class="text-center">
{admin_position_block
permission="admin.currencies.edit"
path="/admin/configuration/currencies"
url_parameter="currency_id"
in_place_edit_class="currencyPositionChange"
position="$POSITION"
id="$ID"
}
</td>
<td><input type="radio" name="default[{$ID}]" value="1" {if $IS_DEFAULT}checked="checked"{/if}/></td>
<td class="text-center"><input type="radio" name="default[{$ID}]" value="1" {if $IS_DEFAULT}checked="checked"{/if}/></td>
{module_include location='currencies_table_row'}
@@ -238,6 +218,10 @@
<div class="controls">
{loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}

View File

@@ -12,7 +12,7 @@
</ul>
<div class="row-fluid">
{loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edition_language"}
{loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edit_language_id"}
<div class="span12 general-block-decorator">
<div class="row-fluid">
<div class="span7 title">

View File

@@ -11,8 +11,8 @@
<ul class="nav nav-pills">
{loop name="lang_list" type="lang" default_only={$default_only}}
<li {if $ID == $edition_language}class="active"{/if}>
<a href="{$current_url}&amp;edition_language={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
<li {if $ID == $edit_language_id}class="active"{/if}>
<a href="{$current_url}&amp;edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
<img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" />
</a>
</li>

View File

@@ -9,7 +9,7 @@
<div id="wrapper" class="container">
{loop name="message_edit" type="message" secured="*" id="$message_id" backend_context="1" lang="$edition_language"}
{loop name="message_edit" type="message" secured="*" id="$message_id" backend_context="1" lang="$edit_language_id"}
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
@@ -47,7 +47,7 @@
{/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$value|htmlspecialchars}" />
<input type="hidden" name="{$name}" value="{{$edit_language_locale}}" />
{/form_field}
{if #form_error}<div class="alert alert-block alert-error">#form_error_message</div>{/if}

View File

@@ -151,6 +151,10 @@
<div class="controls">
{loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}

View File

@@ -9,7 +9,7 @@
<div id="wrapper" class="container">
{loop name="config_edit" type="config" hidden="*" id="$variable_id" backend_context="1" lang="$edition_language"}
{loop name="config_edit" type="config" hidden="*" id="$variable_id" backend_context="1" lang="$edit_language_id"}
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a> <span class="divider">/</span></li>
@@ -53,7 +53,7 @@
{/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$value|htmlspecialchars}" />
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{if #form_error}<div class="alert alert-block alert-error">#form_error_message</div>{/if}

View File

@@ -34,16 +34,42 @@
</caption>
<tr>
<th>{intl l="Purpose"}</th>
<th>{intl l="Name"}</th>
<th>{intl l="Value"}</th>
<th>
{admin_sortable_header
current_order=$order
order='title'
reverse_order='title_reverse'
path={url path='/admin/configuration/variables'}
label={intl l='Purpose'}
}
</th>
<th>
{admin_sortable_header
current_order=$order
order='name'
reverse_order='name_reverse'
path={url path='/admin/configuration/variables'}
label={intl l='Name'}
}
</th>
<th>
{admin_sortable_header
current_order=$order
order='value'
reverse_order='value_reverse'
path={url path='/admin/configuration/variables'}
label={intl l='Value'}
}
</th>
{module_include location='variables_table_header'}
<th>&nbsp;</th>
</tr>
{loop name="config" type="config" hidden="0" secured="*" backend_context="1" lang="$lang_id"}
{loop name="config" type="config" hidden="0" secured="*" backend_context="1" lang="$lang_id" order="$order"}
<tr>
<td>{$TITLE}</td>
@@ -172,6 +198,10 @@
<div class="controls">
{loop type="lang" name="default-lang" default_only="1"}
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}