From 64e62fa3382dee269d4a4b4085ab02271c7204a7 Mon Sep 17 00:00:00 2001 From: dSevere Date: Fri, 4 Nov 2011 10:21:23 +0000 Subject: [PATCH] // #PSFV-94 : replace back link with cancel button in the toolbar on all admin controllers git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9876 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/helper/form/form.tpl | 12 +----------- .../themes/template/helper/list/list_footer.tpl | 12 +----------- classes/AdminController.php | 15 +++++++++++++++ classes/HelperForm.php | 8 -------- classes/HelperList.php | 10 ---------- 5 files changed, 17 insertions(+), 40 deletions(-) diff --git a/admin-dev/themes/template/helper/form/form.tpl b/admin-dev/themes/template/helper/form/form.tpl index 81effb159..779638375 100644 --- a/admin-dev/themes/template/helper/form/form.tpl +++ b/admin-dev/themes/template/helper/form/form.tpl @@ -322,14 +322,4 @@ {/if} {block name="other_fieldsets"}{/block} - - -

-{if $firstCall && !$no_back} - {if $back} - {l s='Back'} - {else} - {l s='Back to list'} - {/if} -
-{/if} + \ No newline at end of file diff --git a/admin-dev/themes/template/helper/list/list_footer.tpl b/admin-dev/themes/template/helper/list/list_footer.tpl index e49811289..858109471 100644 --- a/admin-dev/themes/template/helper/list/list_footer.tpl +++ b/admin-dev/themes/template/helper/list/list_footer.tpl @@ -41,14 +41,4 @@ {* if (isset($this->_includeTab) AND sizeof($this->_includeTab)) echo '

'; -*} - -{if !$no_back} -
- {if $back} - {l s='Back'} - {else} - {l s='Back to list'} - {/if} -
-{/if} \ No newline at end of file +*} \ No newline at end of file diff --git a/classes/AdminController.php b/classes/AdminController.php index c0d1314f6..8fbd9340f 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -738,10 +738,25 @@ class AdminControllerCore extends Controller // @todo defining default buttons case 'add': case 'edit': + // Default save button - action dynamically handled in javascript $this->toolbar_btn['save'] = array( 'href' => '#', 'desc' => $this->l('Save') ); + + case 'view': + // Default cancel button - like old back link + if (!isset($this->no_back) || $this->no_back == false) + { + $back = Tools::safeOutput(Tools::getValue('back', '')); + if (empty($back)) + $back = self::$currentIndex.'&token='.$this->token; + + $this->toolbar_btn['cancel'] = array( + 'href' => $back, + 'desc' => $this->l('Cancel') + ); + } break; case 'options': break; diff --git a/classes/HelperForm.php b/classes/HelperForm.php index 381260281..6c0b905ec 100644 --- a/classes/HelperForm.php +++ b/classes/HelperForm.php @@ -50,12 +50,6 @@ class HelperFormCore extends Helper */ public $submit_action = ''; - /** - * @var bool - * Usage : Set the value to true if you want to simply remove the back button - */ - public $no_back = false; - public $token; public $languages = null; @@ -93,8 +87,6 @@ class HelperFormCore extends Helper 'defaultFormLanguage' => $this->default_form_language, 'allowEmployeeFormLang' => $this->allow_employee_form_lang, 'form_id' => $this->id, - 'back' => Tools::getValue('back'), - 'no_back' => $this->no_back, 'fields' => $this->fields_form, 'fields_value' => $this->fields_value, 'required_fields' => $this->getFieldsRequired(), diff --git a/classes/HelperList.php b/classes/HelperList.php index b45426411..d7c49cdee 100644 --- a/classes/HelperList.php +++ b/classes/HelperList.php @@ -134,12 +134,6 @@ class HelperListCore extends Helper $this->footer_tpl = $this->context->smarty->createTemplate($this->footer_tpl); } - /** - * @var bool - * Usage : Set the value to false if you want to simply display the back button - */ - public $no_back = true; - /** * Return an html list given the data to fill it up * @@ -599,8 +593,6 @@ class HelperListCore extends Helper 'name' => isset($name) ? $name : null, 'name_id' => isset($name_id) ? $name_id : null, 'show_toolbar' => $this->show_toolbar, - 'back' => Tools::getValue('back'), - 'no_back' => $this->no_back )); return $this->header_tpl->fetch(); @@ -617,8 +609,6 @@ class HelperListCore extends Helper 'current' => $this->currentIndex, 'simple_header' => $this->simple_header, 'bulk_actions' => $this->bulk_actions, - 'back' => Tools::getValue('back'), - 'no_back' => $this->no_back )); return $this->footer_tpl->fetch(); }