// Fixed bug position in HelperList

This commit is contained in:
lLefevre
2011-10-19 08:40:47 +00:00
parent 3e46ac3358
commit 17ec57e135
3 changed files with 17 additions and 13 deletions
+9 -9
View File
@@ -38,7 +38,7 @@
{foreach $fields_display AS $key => $params}
<td
{if isset($params.position)}
id="td_{if $id_category}$id_category{else}0{/if}_{$tr.$identifier}"
id="td_{if $id_category}{$id_category}{else}0{/if}_{$tr.$identifier}"
{/if}
class="{if !$no_link}pointer{/if}
{if isset($params.position) && $order_by == 'position'} dragHandle{/if}
@@ -55,16 +55,16 @@
<img src="../img/admin/{if $tr.$key}enabled.gif{else}disabled.gif{/if}"
alt="{if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if}" title="{if $tr.$key}{l s='Enabled'}{else}{l s='Disabled'}{/if}" />
{elseif isset($params.position)}
{if $orderBy == 'position' && $orderWay != 'DESC'}
<a {if !($tr.$key.position != $positions[sizeof($positions) - 1])}style="display: none;"{/if} href="{$tr.$key.position_url_down}">
<img src="../img/admin/{if $orderWay == 'ASC'}down{else}up{/if}.gif"
alt="{l s='Down'}" title="{l s='Down'}" /></a>
{if $order_by == 'position' && $order_way != 'DESC'}
<a href="{$tr.$key.position_url_down}" {if !($tr.$key.position != $positions[count($positions) - 1])}style="display: none;"{/if}>
<img src="../img/admin/{if $order_way == 'ASC'}down{else}up{/if}.gif" alt="{l s='Down'}" title="{l s='Down'}" />
</a>
<a {if !($tr.$key.position != $positions.0)}style="display: none;"{/if} href="{$tr.$key.position_url_up}">
<img src="../img/admin/{if $orderWay == 'ASC'}up{else}down{/if}.gif"
alt="{l s='Up'}" title="{l s='Up'}" /></a>';
<a href="{$tr.$key.position_url_up}" {if !($tr.$key.position != $positions.0)}style="display: none;"{/if}>
<img src="../img/admin/{if $order_way == 'ASC'}up{else}down{/if}.gif" alt="{l s='Up'}" title="{l s='Up'}" />
</a>
{else}
{$tr.$key.position} + 1
{$tr.$key.position + 1}
{/if}
{elseif isset($params.image)}
{$tr.$key}
+2
View File
@@ -1068,6 +1068,8 @@ class AdminControllerCore extends Controller
$helper->currentIndex = self::$currentIndex;
$helper->className = $this->className;
$helper->table = $this->table;
$helper->_orderBy = $this->_orderBy;
$helper->_orderWay = $this->_orderWay;
$helper->shopLink = $this->shopLink;
$helper->shopLinkType = $this->shopLinkType;
$helper->identifier = $this->identifier;
+6 -4
View File
@@ -43,13 +43,13 @@ class HelperListCore extends Helper
protected $_pagination = array(20, 50, 100, 300);
/** @var string ORDER BY clause determined by field/arrows in list header */
protected $_orderBy;
public $_orderBy;
/** @var string Default ORDER BY clause when $_orderBy is not defined */
protected $_defaultOrderBy = false;
/** @var string Order way (ASC, DESC) determined by arrows in list header */
protected $_orderWay;
public $_orderWay;
public $identifier;
@@ -95,7 +95,8 @@ class HelperListCore extends Helper
'id_category' => 'id_category_to_move',
'id_cms_category' => 'id_cms_category_to_move',
'id_cms' => 'id_cms',
'id_attribute' => 'id_attribute'
'id_attribute' => 'id_attribute',
'id_carrier' => 'id_carrier'
);
// @var boolean ask for simple header : no filters, no paginations and no sorting
@@ -217,7 +218,7 @@ class HelperListCore extends Helper
else if (isset($params['position']))
{
$this->_list[$index][$key] = array(
'position' => $tr[$key],
'position' => (int)$tr[$key],
'position_url_down' => $this->currentIndex.
'&'.$key_to_get.'='.(int)$id_category.'&'.$this->identifiersDnd[$this->identifier].'='.$id.
'&way=1&position='.((int)$tr['position'] + 1).'&token='.$this->token,
@@ -281,6 +282,7 @@ class HelperListCore extends Helper
'id_category' => $id_category,
'bulk_actions' => $this->bulk_actions,
'key_to_get' => $key_to_get,
'order_by' => $this->_orderBy,
'positions' => isset($positions) ? $positions : null,
'is_cms' => $this->is_cms,
'fields_display' => $this->fieldsDisplay,