// Removing first confirm message on deleting a category

This commit is contained in:
mDeflotte
2012-01-24 09:05:31 +00:00
parent 44aa7f8ee5
commit e7e75b112c
4 changed files with 30 additions and 13 deletions
@@ -46,7 +46,14 @@
{if isset($delete_category) && $delete_category} {if isset($delete_category) && $delete_category}
<form action="{$REQUEST_URI}" method="post"> <form action="{$REQUEST_URI}" method="post">
<div class="warn"> <div class="warn">
<h2>{l s='Do you want to delete products too?'}</h2> <h2>
{if $need_delete_mode}
{l s='Do you want to delete products too?'}
{else}
{l s='Deleting this category will remove products linked with this category and without any others. Are you sure you want to continue?'}
{/if}
</h2>
{if $need_delete_mode}
<ul class="listForm"> <ul class="listForm">
<li> <li>
<input type="radio" name="deleteMode" value="linkanddisable" id="deleteMode_linkanddisable" /> <input type="radio" name="deleteMode" value="linkanddisable" id="deleteMode_linkanddisable" />
@@ -61,6 +68,9 @@
<label for="deleteMode_delete" style="float:none">{l s='Yes, I want to remove products linked with this category and without any others categories.'}</label> <label for="deleteMode_delete" style="float:none">{l s='Yes, I want to remove products linked with this category and without any others categories.'}</label>
</li> </li>
</ul> </ul>
{else}
<input type="hidden" name="deleteMode" value="delete" id="deleteMode_delete" />
{/if}
{foreach $POST as $key => $value} {foreach $POST as $key => $value}
{if $key != 'deleteMode'} {if $key != 'deleteMode'}
{if is_array($value)} {if is_array($value)}
@@ -72,7 +82,9 @@
{/if} {/if}
{/if} {/if}
{/foreach} {/foreach}
<br /><input type="submit" class="button" value="{l s=' Validate '}" /> <br />
<input type="submit" name="cancel" class="button" value="{l s=' Cancel '}" />
<input type="submit" class="button" value="{l s=' Validate '}" />
</div> </div>
</form> </form>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
+2 -2
View File
@@ -224,7 +224,7 @@ class AdminControllerCore extends Controller
*/ */
protected $filter; protected $filter;
protected $noLink; protected $noLink;
protected $specificConfirmDelete; protected $specificConfirmDelete = null;
protected $colorOnBackground; protected $colorOnBackground;
/** @var bool If true, activates color on hover */ /** @var bool If true, activates color on hover */
protected $row_hover = true; protected $row_hover = true;
@@ -1343,7 +1343,7 @@ class AdminControllerCore extends Controller
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'), 'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
'is_multishop' => $is_multishop, 'is_multishop' => $is_multishop,
'pic_dir' => _THEME_PROD_PIC_DIR_, 'pic_dir' => _THEME_PROD_PIC_DIR_,
'controller_name' => Tools::getValue('controller'), 'controller_name' => Tools::getValue('controller'),
)); ));
} }
+9 -5
View File
@@ -94,7 +94,7 @@ class HelperListCore extends Helper
public $list_skip_actions = array(); public $list_skip_actions = array();
public $bulk_actions = false; public $bulk_actions = false;
public $specificConfirmDelete; public $specificConfirmDelete = null;
public $colorOnBackground; public $colorOnBackground;
/** @var bool If true, activates color on hover */ /** @var bool If true, activates color on hover */
@@ -464,12 +464,16 @@ class HelperListCore extends Helper
if (!is_null($name)) if (!is_null($name))
$name = '\n\n'.self::$cache_lang['Name'].' '.$name; $name = '\n\n'.self::$cache_lang['Name'].' '.$name;
$tpl->assign(array_merge($this->tpl_delete_link_vars, array( $data = array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token), 'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token),
'confirm' => (!is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : self::$cache_lang['DeleteItem'].$name),
'action' => self::$cache_lang['Delete'], 'action' => self::$cache_lang['Delete'],
'id' => $id, 'id' => $id
))); );
if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : self::$cache_lang['DeleteItem'].$name;
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
return $tpl->fetch(); return $tpl->fetch();
} }
@@ -34,9 +34,9 @@ class AdminCategoriesControllerCore extends AdminController
public function __construct() public function __construct()
{ {
$this->table = 'category'; $this->table = 'category';
$this->className = 'Category'; $this->className = 'Category';
$this->lang = true; $this->lang = true;
$this->deleted = false; $this->deleted = false;
$this->context = Context::getContext(); $this->context = Context::getContext();
@@ -80,8 +80,9 @@ class AdminCategoriesControllerCore extends AdminController
) )
); );
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected')));
$this->specificConfirmDelete = false;
parent::__construct(); parent::__construct();
} }