diff --git a/admin-dev/themes/template/list_action_details.tpl b/admin-dev/themes/template/list_action_details.tpl new file mode 100644 index 000000000..69eb578a1 --- /dev/null +++ b/admin-dev/themes/template/list_action_details.tpl @@ -0,0 +1,89 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + {$action} + \ No newline at end of file diff --git a/classes/HelperList.php b/classes/HelperList.php index 2bf1d34d6..22342503b 100644 --- a/classes/HelperList.php +++ b/classes/HelperList.php @@ -140,10 +140,10 @@ class HelperListCore extends Helper */ protected function _displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null) { - return ' - '.($value ? $this->l('Enabled') : $this->l('Disabled')).''; + return ' + '.($value ? $this->l('Enabled') : $this->l('Disabled')).''; } public function displayListContent($token = null) @@ -236,11 +236,11 @@ class HelperListCore extends Helper } else if (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default']))) $this->_list[$index][$key] = isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default']; - else if (isset($params['price'])) - { - $currency = isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency; - $this->_list[$index][$key] = Tools::displayPrice($tr[$key], ($currency), false); - } + else if (isset($params['price'])) + { + $currency = isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency; + $this->_list[$index][$key] = Tools::displayPrice($tr[$key], ($currency), false); + } else if (isset($params['float'])) $this->_list[$index][$key] = rtrim(rtrim($tr[$key], '0'), '.'); else if (isset($params['type']) && $params['type'] == 'date') @@ -295,26 +295,48 @@ class HelperListCore extends Helper /** * Display duplicate action link */ - protected function _displayDuplicateLink($token = null, $id) - { - if (!array_key_exists('Duplicate', self::$cache_lang)) - self::$cache_lang['Duplicate'] = $this->l('Duplicate'); + protected function _displayDuplicateLink($token = null, $id) + { + if (!array_key_exists('Duplicate', self::$cache_lang)) + self::$cache_lang['Duplicate'] = $this->l('Duplicate'); - if (!array_key_exists('Copy images too?', self::$cache_lang)) - self::$cache_lang['Copy images too?'] = $this->l('Copy images too?', __CLASS__, true, false); + if (!array_key_exists('Copy images too?', self::$cache_lang)) + self::$cache_lang['Copy images too?'] = $this->l('Copy images too?', __CLASS__, true, false); - $duplicate = $this->currentIndex.'&'.$this->identifier.'='.$id.'&duplicate'.$this->table; + $duplicate = $this->currentIndex.'&'.$this->identifier.'='.$id.'&duplicate'.$this->table; - $this->context->smarty->assign(array( + $this->context->smarty->assign(array( 'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token), 'action' => self::$cache_lang['Duplicate'], - 'confirm' => self::$cache_lang['Copy images too?'], - 'location_ok' => $duplicate.'&token='.($token != null ? $token : $this->token), - 'location_ko' => $duplicate.'&noimage=1&token='.($token ? $token : $this->token).'\\', + 'confirm' => self::$cache_lang['Copy images too?'], + 'location_ok' => $duplicate.'&token='.($token != null ? $token : $this->token), + 'location_ko' => $duplicate.'&noimage=1&token='.($token ? $token : $this->token).'\\', )); return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/list_action_duplicate.tpl'); - } + } + + + /** + * Display action to see details of a table row + * This action need an ajax request with a return like this: + * { + * data: + * [ + * {field_name: 'value'} + * ], + * fields_display: // attribute $fieldsDisplay of the admin controller + * } + */ + protected function _displayDetailsLink($token = null, $id) + { + $this->context->smarty->assign(array( + 'id' => $id, + 'controller' => str_replace('Controller', '', get_class($this->context->controller)), + 'token' => $this->token + )); + return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/list_action_details.tpl'); + } /** * Display view action link