[+] BO : Change action link for button

This commit is contained in:
Jerome Nadaud
2013-08-09 16:07:07 +02:00
parent 6ae222e720
commit ecfe61972b
7 changed files with 218 additions and 11 deletions
+2 -2
View File
@@ -103,14 +103,14 @@
<link type="text/css" rel="stylesheet" href="{$base_url}css/admin-ie.css" />
<![endif]-->
{*if isset($brightness)*}
{if isset($brightness)}
<!--
/// multishop
<style type="text/css">
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {ldelim}color:{$brightness}{rdelim}
</style>
-->
{*/if*}
{/if}
<link href='http://fonts.googleapis.com/css?family=Ubuntu:300|Open+Sans' rel='stylesheet' type='text/css'>
@@ -0,0 +1,27 @@
{*
* 2007-2013 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 <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" class="btn btn-default btn-small" onclick="{if isset($confirm)}if (confirm('{$confirm}')){/if}location.href='{$href}';">
<i class="icon-trash"></i>&nbsp;{$action}
</button>
@@ -0,0 +1,27 @@
{*
* 2007-2013 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 <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" onclick="if (confirm('{$confirm}')) location.href = '{$location_ok}'; else location.href = '{$location_ko}';">
<i class="icon-copy"></i>&nbsp;{$action}
</button>
@@ -0,0 +1,27 @@
{*
* 2007-2013 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 <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" class="btn btn-default btn-small" onclick="location.href='{$href}'">
<i class="icon-pencil"></i>&nbsp;{$action}
</button>
@@ -0,0 +1,27 @@
{*
* 2007-2013 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 <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" class="btn btn-default btn-small" onclick="location.href='{$href}'">
<i class="icon-eye-open"></i>&nbsp;{$action}
</button>
@@ -136,13 +136,11 @@
{/if}
{if $has_actions}
<td>
<div class="btn-group{if count($actions) > 1} btn-group-action{/if}">
<span class="btn btn-default btn-small">
{assign var='action' value=$actions[0]}
{if isset($tr.$action)}
{$tr.$action}
{/if}
</span>
<div class="btn-group{if count($actions) > 1} btn-group-action{/if}">
{assign var='action' value=$actions[0]|cat:"_button"}
{if isset($tr.$action)}
{$tr.$action}
{/if}
{if count($actions) > 1}
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>&nbsp;
+103 -2
View File
@@ -209,6 +209,13 @@ class HelperListCore extends Helper
$this->_list[$index][$action] = $this->context->controller->$method_name($this->token, $id, $name);
elseif (method_exists($this, $method_name))
$this->_list[$index][$action] = $this->$method_name($this->token, $id, $name);
$method_name = 'display'.ucfirst($action).'Button';
if (method_exists($this->context->controller, $method_name))
$this->_list[$index][$action.'_button'] = $this->context->controller->$method_name($this->token, $id, $name);
elseif (method_exists($this, $method_name))
$this->_list[$index][$action.'_button'] = $this->$method_name($this->token, $id, $name);
}
}
@@ -328,6 +335,31 @@ class HelperListCore extends Helper
return $this->content_tpl->fetch();
}
/**
* Display duplicate action button
*/
public function displayDuplicateButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_duplicate.tpl');
if (!array_key_exists('Bad SQL query', self::$cache_lang))
self::$cache_lang['Duplicate'] = $this->l('Duplicate', 'Helper');
if (!array_key_exists('Copy images too?', self::$cache_lang))
self::$cache_lang['Copy images too?'] = $this->l('Copy images too?', 'Helper');
$duplicate = $this->currentIndex.'&'.$this->identifier.'='.$id.'&duplicate'.$this->table;
$tpl->assign(array(
'href' => Tools::safeOutput($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' => Tools::safeOutput($duplicate.'&token='.($token != null ? $token : $this->token)),
'location_ko' => Tools::safeOutput($duplicate.'&noimage=1&token='.($token ? $token : $this->token)),
));
return $tpl->fetch();
}
/**
* Display duplicate action link
*/
@@ -394,6 +426,24 @@ class HelperListCore extends Helper
return $tpl->fetch();
}
/**
* Display view action button
*/
public function displayViewButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_view.tpl');
if (!array_key_exists('View', self::$cache_lang))
self::$cache_lang['View'] = $this->l('View', 'Helper');
$tpl->assign(array(
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['View'],
));
return $tpl->fetch();
}
/**
* Display view action link
*/
@@ -412,6 +462,24 @@ class HelperListCore extends Helper
}
/**
* Display edit action button
*/
public function displayEditButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_edit.tpl');
if (!array_key_exists('Edit', self::$cache_lang))
self::$cache_lang['Edit'] = $this->l('Edit', 'Helper');
$tpl->assign(array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&update'.$this->table.'&token='.($token != null ? $token : $this->token),
'action' => self::$cache_lang['Edit'],
'id' => $id
));
return $tpl->fetch();
}
/**
* Display edit action link
*/
@@ -430,6 +498,39 @@ class HelperListCore extends Helper
return $tpl->fetch();
}
/**
* Display delete action button
*/
public function displayDeleteButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_delete.tpl');
if (!array_key_exists('Delete', self::$cache_lang))
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
if (!array_key_exists('DeleteItem', self::$cache_lang))
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper');
if (!array_key_exists('Name', self::$cache_lang))
self::$cache_lang['Name'] = $this->l('Name:', 'Helper');
if (!is_null($name))
$name = '\n\n'.self::$cache_lang['Name'].' '.$name;
$data = array(
$this->identifier => $id,
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['Delete'],
);
if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\'');
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
return $tpl->fetch();
}
/**
* Display delete action link
*/
@@ -454,10 +555,10 @@ class HelperListCore extends Helper
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['Delete'],
);
if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\'');
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
return $tpl->fetch();