diff --git a/classes/AdminController.php b/classes/AdminController.php index 5a27caf4e..ad1ee4bfd 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -880,17 +880,14 @@ class AdminControllerCore extends Controller //no break 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; + $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') - ); - } + $this->toolbar_btn['cancel'] = array( + 'href' => $back, + 'desc' => $this->l('Cancel') + ); break; case 'options': $this->toolbar_btn['save'] = array( @@ -1327,9 +1324,6 @@ class AdminControllerCore extends Controller */ public function initView() { - if (empty($this->toolbar_title)) - $this->initToolbarTitle(); - $helper = new HelperView($this); $this->setHelperDisplay($helper); $helper->tpl_vars = $this->tpl_view_vars; @@ -1351,9 +1345,6 @@ class AdminControllerCore extends Controller if (!$this->multiple_fieldsets) $this->fields_form = array(array('form' => $this->fields_form)); - if (empty($this->toolbar_title)) - $this->initToolbarTitle(); - $this->getlanguages(); $helper = new HelperForm($this); $this->setHelperDisplay($helper); @@ -1380,9 +1371,6 @@ class AdminControllerCore extends Controller { if ($this->options && is_array($this->options)) { - if (empty($this->toolbar_title)) - $this->initToolbarTitle(); - if ($this->display != 'options') $this->show_toolbar = false; @@ -1435,7 +1423,6 @@ class AdminControllerCore extends Controller $helper->imageType = $this->imageType; $helper->no_link = $this->list_no_link; $helper->colorOnBackground = $this->colorOnBackground; - $helper->no_back = isset($this->no_back) ? $this->no_back : true; $helper->ajax_params = (isset($this->ajax_params) ? $this->ajax_params : null); $helper->default_form_language = $this->default_form_language; $helper->allow_employee_form_lang = $this->allow_employee_form_lang; diff --git a/classes/Helper.php b/classes/Helper.php index 7855dc19d..451fda01d 100755 --- a/classes/Helper.php +++ b/classes/Helper.php @@ -39,7 +39,6 @@ class HelperCore public $toolbar_btn; public $title; public $show_toolbar = true; - public $no_back = false; public $context; public $toolbar_fix = false; diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index ce4c3fe2f..daa018927 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -367,6 +367,9 @@ class AdminAttributesGroupsControllerCore extends AdminController return; } + + // toolbar (save, cancel, new, ..) + $this->initToolbar(); if ($this->display == 'edit' || $this->display == 'add') { if (!($this->object = $this->loadObject(true))) @@ -382,14 +385,6 @@ class AdminAttributesGroupsControllerCore extends AdminController } else if ($this->display != 'view' && !$this->ajax) { - $this->toolbar_btn['newAttributes'] = array( - 'href' => self::$currentIndex.'&updateattribute&token='.$this->token, - 'desc' => $this->l('Add new Attributes') - ); - - // toolbar (save, cancel, new, ..) - $this->initToolbar(); - $this->content .= $this->initList(); $this->content .= $this->initOptions(); } @@ -403,6 +398,38 @@ class AdminAttributesGroupsControllerCore extends AdminController )); } + public function initToolbar() + { + switch ($this->display) + { + // @todo defining default buttons + case 'add': + case 'edit': + case 'editAttributes': + // Default save button - action dynamically handled in javascript + $this->toolbar_btn['save'] = array( + 'href' => '#', + 'desc' => $this->l('Save') + ); + + $back = self::$currentIndex.'&token='.$this->token; + $this->toolbar_btn['cancel'] = array( + 'href' => $back, + 'desc' => $this->l('Cancel') + ); + break; + default: // list + $this->toolbar_btn['new'] = array( + 'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token, + 'desc' => $this->l('Add new Group') + ); + $this->toolbar_btn['newAttributes'] = array( + 'href' => self::$currentIndex.'&updateattribute&token='.$this->token, + 'desc' => $this->l('Add new Attributes') + ); + } + } + public function postProcess() { if (!Combination::isFeatureActive()) diff --git a/controllers/admin/AdminFeaturesController.php b/controllers/admin/AdminFeaturesController.php index 54c47287d..d345da0db 100644 --- a/controllers/admin/AdminFeaturesController.php +++ b/controllers/admin/AdminFeaturesController.php @@ -222,17 +222,14 @@ class AdminFeaturesControllerCore extends AdminController ); // 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; + $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') - ); - } + $this->toolbar_btn['cancel'] = array( + 'href' => $back, + 'desc' => $this->l('Cancel') + ); break; default: diff --git a/controllers/admin/AdminStockManagementController.php b/controllers/admin/AdminStockManagementController.php index da9c00837..089bef57a 100644 --- a/controllers/admin/AdminStockManagementController.php +++ b/controllers/admin/AdminStockManagementController.php @@ -708,17 +708,14 @@ class AdminStockManagementControllerCore extends AdminController ); // 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; + $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') - ); - } + $this->toolbar_btn['cancel'] = array( + 'href' => $back, + 'desc' => $this->l('Cancel') + ); break; default: