diff --git a/admin-dev/themes/template/generator/options.tpl b/admin-dev/themes/template/generator/options.tpl index 5b6ce2dfb..f3f302fca 100644 --- a/admin-dev/themes/template/generator/options.tpl +++ b/admin-dev/themes/template/generator/options.tpl @@ -59,7 +59,7 @@ {else}

{l s='Before being able to use this tool, you need to:'}

-

{l s='- create a'} '. $this->l('.htaccess').' {l s='blank file in directory'} '.__PS_BASE_URI__.' +

{l s='- create a'} {l s='.htaccess'} {l s='blank file in directory'} {$smarty.const.__PS_BASE_URI__}
{l s='- give it write permissions (CHMOD 666 on Unix system)'}

{/if}

@@ -77,7 +77,7 @@

{l s='This will erase your'} {l s='old'} {l s='robots.txt file!'}

{else}

{l s='Before being able to use this tool, you need to:'}

-

{l s='- create a'} '. $this->l('robots.txt').' {l s='blank file in dir:'} {$smarty.const.__PS_BASE_URI__} +

{l s='- create a'} {l s='robots.txt'} {l s='blank file in dir:'} {$smarty.const.__PS_BASE_URI__}
{l s='- give it write permissions (CHMOD 666 on Unix system)'}

{/if}

diff --git a/admin-dev/themes/template/helper/form/form.tpl b/admin-dev/themes/template/helper/form/form.tpl index b21209dfb..e996489f5 100644 --- a/admin-dev/themes/template/helper/form/form.tpl +++ b/admin-dev/themes/template/helper/form/form.tpl @@ -24,7 +24,6 @@ * International Registered Trademark & Property of PrestaShop SA *} - {if $show_toolbar}
diff --git a/admin-dev/themes/template/helper/options/options.tpl b/admin-dev/themes/template/helper/options/options.tpl index bcecf567f..0502d5058 100644 --- a/admin-dev/themes/template/helper/options/options.tpl +++ b/admin-dev/themes/template/helper/options/options.tpl @@ -23,14 +23,35 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} + +{if $show_toolbar} +
+
+ {include file="toolbar.tpl" toolbar_btn=$toolbar_btn} +
+

+ {block name=pageTitle} + + {$title|default:' '} + + {/block} +

+
+
+
+
{block name="leadin"}{/block}
+{/if} + + {block name="defaultOptions"} -
{foreach $option_list AS $category => $categoryData} {if isset($categoryData['top'])}{$categoryData['top']}{/if} @@ -195,9 +216,10 @@ {if isset($categoryData['submit'])}
{/if} diff --git a/classes/AdminController.php b/classes/AdminController.php index 7858efe69..b259687b6 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -61,7 +61,7 @@ class AdminControllerCore extends Controller /** @var integer Tab id */ public $id = -1; - /** @var array noTabLink array of admintabs with no content */ + /** @var array noTabLink array of admintab names witch have no content */ public $noTabLink = array('AdminCatalog', 'AdminTools', 'AdminStock', 'AdminAccounting'); /** @var string Security token */ @@ -90,9 +90,6 @@ class AdminControllerCore extends Controller /** @var define if the header of the list contains filter and sorting links or not */ protected $list_simple_header; - /** @var define if the header of the list contains filter and sorting links or not */ - protected $toolbar_title; - /** @var array list to be generated */ protected $fieldsDisplay; @@ -107,6 +104,9 @@ class AdminControllerCore extends Controller /** @var array Cache for query results */ protected $_list = array(); + /** @var define if the header of the list contains filter and sorting links or not */ + protected $toolbar_title; + /** @var array list of toolbar buttons */ protected $toolbar_btn = null; @@ -116,6 +116,9 @@ class AdminControllerCore extends Controller /** @var boolean set to false to hide toolbar and page title */ protected $show_toolbar = true; + /** @var boolean set to true to show toolbar and page title for options */ + protected $show_toolbar_options = false; + /** @var integer Number of results in list */ protected $_listTotal = 0; @@ -748,6 +751,7 @@ class AdminControllerCore extends Controller if ($this->tabAccess['edit'] === '1') { $this->beforeUpdateOptions(); + $languages = Language::getLanguages(false); foreach ($this->options as $category => $category_data) @@ -851,7 +855,7 @@ class AdminControllerCore extends Controller } else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); - + // todo : return value ? } @@ -889,6 +893,10 @@ class AdminControllerCore extends Controller } break; case 'options': + $this->toolbar_btn['save'] = array( + 'href' => '#', + 'desc' => $this->l('Save') + ); break; default: // list $this->toolbar_btn['new'] = array( @@ -995,7 +1003,7 @@ class AdminControllerCore extends Controller // new smarty : template_dir is an array. // @todo : add override path to the smarty config, and checking all array item - if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl_action) && $this->display != 'view') + if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl_action) && $this->display != 'view' && $this->display != 'options') { if (method_exists($this, $this->display.Tools::toCamelCase($this->className))) $this->{$this->display.Tools::toCamelCase($this->className)}(); @@ -1301,6 +1309,9 @@ class AdminControllerCore extends Controller return false; $helper = new HelperList(); + $this->setHelperDisplay($helper); + $helper->tpl_vars = $this->tpl_list_vars; + $helper->tpl_delete_link_vars = $this->tpl_delete_link_vars; // Check if list templates have been overriden // For compatibility reasons, we have to check standard actions in class attributes @@ -1310,11 +1321,9 @@ class AdminControllerCore extends Controller $this->actions[] = $action; } - $helper->tpl_vars = $this->tpl_list_vars; - $helper->tpl_delete_link_vars = $this->tpl_delete_link_vars; - $this->setHelperDisplay($helper); $list = $helper->generateList($this->_list, $this->fieldsDisplay); $this->toolbar_fix = false; + return $list; } @@ -1327,61 +1336,14 @@ class AdminControllerCore extends Controller $this->initToolbarTitle(); $helper = new HelperView($this); - $helper->override_folder = $this->tpl_folder; - $helper->tpl_vars = $this->tpl_view_vars; $this->setHelperDisplay($helper); + $helper->tpl_vars = $this->tpl_view_vars; $view = $helper->generateView(); $this->toolbar_fix = false; return $view; } - /** - * this function set various display option for helper list - * - * @param Helper $helper - * @return void - */ - public function setHelperDisplay(Helper $helper) - { - if (empty($this->toolbar_title)) - $this->initToolbarTitle(); - // tocheck - if ($this->object && $this->object->id) - $helper->id = $this->object->id; - - // @todo : move that in Helper - $helper->actions = $this->actions; - $helper->simple_header = $this->list_simple_header; - $helper->title = $this->toolbar_title; - $helper->toolbar_btn = $this->toolbar_btn; - $helper->show_toolbar = $this->show_toolbar; - $helper->toolbar_fix = $this->toolbar_fix; - $helper->bulk_actions = $this->bulk_actions; - $helper->currentIndex = self::$currentIndex; - $helper->className = $this->className; - $helper->table = $this->table; - $helper->orderBy = $this->_orderBy; - $helper->orderWay = $this->_orderWay; - $helper->listTotal = $this->_listTotal; - $helper->shopLink = $this->shopLink; - $helper->shopLinkType = $this->shopLinkType; - $helper->identifier = $this->identifier; - $helper->override_folder = $this->tpl_folder; - $helper->token = $this->token; - $helper->languages = $this->_languages; - $helper->specificConfirmDelete = $this->specificConfirmDelete; - $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); - - // For each action, try to add the corresponding skip elements list - $helper->list_skip_actions = $this->list_skip_actions; - - } - /** * Function used to initialise the form to display for this controller */ @@ -1399,13 +1361,9 @@ class AdminControllerCore extends Controller $this->getlanguages(); $helper = new HelperForm($this); - $helper->override_folder = $this->tpl_folder; $this->setHelperDisplay($helper); - $helper->default_form_language = $this->default_form_language; - $helper->allow_employee_form_lang = $this->allow_employee_form_lang; $helper->fields_value = $this->getFieldsValue($this->object); $helper->tpl_vars = $this->tpl_form_vars; - $helper->multiple_fieldsets = $this->multiple_fieldsets; if ($this->tabAccess['view']) { if (Tools::getValue('back')) @@ -1415,6 +1373,7 @@ class AdminControllerCore extends Controller } $form = $helper->generateForm($this->fields_form); $this->toolbar_fix = false; + return $form; } } @@ -1426,18 +1385,71 @@ class AdminControllerCore extends Controller { if ($this->options && is_array($this->options)) { - $helper = new HelperOptions(); - $helper->override_folder = $this->tpl_folder; + if (empty($this->toolbar_title)) + $this->initToolbarTitle(); + + if ($this->display != 'options') + $this->show_toolbar = false; + + $helper = new HelperOptions($this); + $this->setHelperDisplay($helper); $helper->id = $this->id; - $helper->token = $this->token; $helper->tpl_vars = $this->tpl_option_vars; - $helper->shopLinkType = $this->shopLinkType; - $helper->table = $this->table; - $helper->currentIndex = self::$currentIndex; - return $helper->generateOptions($this->options); + $options = $helper->generateOptions($this->options); + $this->toolbar_fix = false; + + return $options; } } + /** + * this function set various display option for helper list + * + * @param Helper $helper + * @return void + */ + public function setHelperDisplay(Helper $helper) + { + if (empty($this->toolbar_title)) + $this->initToolbarTitle(); + // tocheck + if ($this->object && $this->object->id) + $helper->id = $this->object->id; + + // @todo : move that in Helper + $helper->title = $this->toolbar_title; + $helper->toolbar_btn = $this->toolbar_btn; + $helper->show_toolbar = $this->show_toolbar; + $helper->toolbar_fix = $this->toolbar_fix; + $helper->override_folder = $this->tpl_folder; + $helper->actions = $this->actions; + $helper->simple_header = $this->list_simple_header; + $helper->bulk_actions = $this->bulk_actions; + $helper->currentIndex = self::$currentIndex; + $helper->className = $this->className; + $helper->table = $this->table; + $helper->orderBy = $this->_orderBy; + $helper->orderWay = $this->_orderWay; + $helper->listTotal = $this->_listTotal; + $helper->shopLink = $this->shopLink; + $helper->shopLinkType = $this->shopLinkType; + $helper->identifier = $this->identifier; + $helper->token = $this->token; + $helper->languages = $this->_languages; + $helper->specificConfirmDelete = $this->specificConfirmDelete; + $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; + $helper->multiple_fieldsets = $this->multiple_fieldsets; + + // For each action, try to add the corresponding skip elements list + $helper->list_skip_actions = $this->list_skip_actions; + } + public function setMedia() { $this->addCSS(_PS_CSS_DIR_.'admin.css', 'all'); @@ -1678,7 +1690,7 @@ class AdminControllerCore extends Controller else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } - if (isset($_GET['view'.$this->table])) + else if (isset($_GET['view'.$this->table])) { if ($this->tabAccess['view'] === '1') { @@ -1706,13 +1718,17 @@ class AdminControllerCore extends Controller break; } } - if ($this->ajax && method_exists($this, 'ajaxPreprocess')) - $this->ajaxPreProcess(); - $this->context->smarty->assign(array( - 'table' => $this->table, - 'current' => self::$currentIndex, - 'token' => $this->token, - )); + else if (!empty($this->options) && empty($this->fieldsDisplay)) + $this->display = 'options'; + + if ($this->ajax && method_exists($this, 'ajaxPreprocess')) + $this->ajaxPreProcess(); + + $this->context->smarty->assign(array( + 'table' => $this->table, + 'current' => self::$currentIndex, + 'token' => $this->token, + )); } /** diff --git a/classes/HelperForm.php b/classes/HelperForm.php index f6e4deead..6c253f835 100644 --- a/classes/HelperForm.php +++ b/classes/HelperForm.php @@ -29,7 +29,6 @@ class HelperFormCore extends Helper { public $id; public $first_call = true; - public $toolbar = true; /** @var array of forms fields */ protected $fields_form = array(); @@ -137,11 +136,11 @@ class HelperFormCore extends Helper } $this->tpl->assign(array( - 'submit_action' => $this->submit_action, + 'title' => $this->title, 'toolbar_btn' => $this->toolbar_btn, 'show_toolbar' => $this->show_toolbar, 'toolbar_fix' => $this->toolbar_fix, - 'title' => $this->title, + 'submit_action' => $this->submit_action, 'firstCall' => $this->first_call, 'current' => $this->currentIndex, 'token' => $this->token, diff --git a/classes/HelperList.php b/classes/HelperList.php index c4cdd654b..dcf0b5d38 100644 --- a/classes/HelperList.php +++ b/classes/HelperList.php @@ -65,8 +65,6 @@ class HelperListCore extends Helper protected $is_dnd_identifier = false; - public $toolbar = true; - /* Customize list display * * align : determine value alignment @@ -562,12 +560,15 @@ class HelperListCore extends Helper } $this->header_tpl->assign(array_merge($this->tpl_vars, array( + 'title' => $this->title, + 'show_toolbar' => $this->show_toolbar, + 'toolbar_fix' => $this->toolbar_fix, + 'toolbar_btn' => $this->toolbar_btn, 'table' => $this->table, 'currentIndex' => $this->currentIndex, 'action' => $action, 'page' => $page, 'simple_header' => $this->simple_header, - 'title' => $this->title, 'total_pages' => $total_pages, 'selected_pagination' => $selected_pagination, 'pagination' => $this->_pagination, @@ -583,16 +584,12 @@ class HelperListCore extends Helper 'shop_link_type' => $this->shopLinkType, 'has_actions' => !empty($this->actions), 'has_bulk_actions' => !empty($this->bulk_actions), - 'toolbar_btn' => $this->toolbar_btn, 'table_id' => isset($table_id) ? $table_id : null, 'table_dnd' => isset($table_dnd) ? $table_dnd : null, 'name' => isset($name) ? $name : null, 'name_id' => isset($name_id) ? $name_id : null, - 'show_toolbar' => $this->show_toolbar, - 'toolbar_fix' => $this->toolbar_fix, - - 'back' => Tools::getValue('back'), - 'no_back' => $this->no_back, + /*'back' => Tools::getValue('back'), + 'no_back' => $this->no_back,*/ ))); return $this->header_tpl->fetch(); diff --git a/classes/HelperOptions.php b/classes/HelperOptions.php index 0ec80a1be..2869b66fb 100644 --- a/classes/HelperOptions.php +++ b/classes/HelperOptions.php @@ -30,18 +30,8 @@ */ class HelperOptionsCore extends Helper { - public $first_call = true; public $required = false; - /** - * @var array of forms fields - * Usage : - * - */ - protected $fields_form = array(); - - public $fields_value = array(); - public function __construct() { $this->base_folder = 'helper/options/'; @@ -155,6 +145,10 @@ class HelperOptionsCore extends Helper } $this->tpl->assign(array( + 'title' => $this->title, + 'toolbar_btn' => $this->toolbar_btn, + 'show_toolbar' => $this->show_toolbar, + 'toolbar_fix' => $this->toolbar_fix, 'current' => $this->currentIndex, 'table' => $this->table, 'token' => $this->token, @@ -163,6 +157,7 @@ class HelperOptionsCore extends Helper 'required_fields' => isset($required_fields) ? $required_fields : false, 'languages' => isset($languages) ? $languages : null )); + return parent::generate(); } @@ -225,14 +220,4 @@ class HelperOptionsCore extends Helper $value = $field['defaultValue']; return $value; } - - public function getFieldsRequired() - { - if (isset($this->fields_form['input'])) - foreach ($this->fields_form['input'] as $input) - if (array_key_exists('required', $input) && $input['required']) - return true; - - return false; - } } diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 02a1bcac7..c356eb9be 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -85,6 +85,7 @@ class AdminAccessController extends AdminController // toolbar (save, cancel, new, ..) $this->initToolbar(); unset($this->toolbar_btn['save']); + unset($this->toolbar_btn['cancel']); if (!$this->loadObject(true)) return;