From 94a43f299102eb38798d466671cf1e6852e2e27a Mon Sep 17 00:00:00 2001 From: Sarah Lorenzini Date: Fri, 2 Aug 2013 17:44:26 +0200 Subject: [PATCH] // update advanced parameters and administration tabs --- .../controllers/access/helpers/form/form.tpl | 470 +++++++++--------- controllers/admin/AdminAccessController.php | 1 + .../admin/AdminAdminPreferencesController.php | 28 +- .../admin/AdminEmployeesController.php | 38 +- controllers/admin/AdminProfilesController.php | 9 +- .../admin/AdminQuickAccessesController.php | 22 +- controllers/admin/AdminTabsController.php | 23 +- 7 files changed, 290 insertions(+), 301 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl index d6f3299d4..421037a1f 100644 --- a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl @@ -172,246 +172,250 @@
{block name="leadin"}{/block}
{/if} -
- +
-
- {if $form_id} - - {/if} - - {assign var=tabsize value=count($tabs)} - {foreach $tabs AS $tab} - {if $tab.id_tab > $tabsize} - {assign var=tabsize value=$tab.id_tab} + +
+ {if $form_id} + {/if} - {/foreach} - {foreach $profiles as $profile} - -
- - {if $profile.id_profile != $admin_profile} - - - - - - - - - - {if !count($tabs)} - - - - {else} - {foreach $tabs AS $tab} - - {assign var=access value=$accesses[$profile.id_profile]} - - {if !$tab.id_parent OR $tab.id_parent == -1} - {assign var=is_child value=false} - {assign var=result_accesses value=0} - - {if $is_child} » {/if}{$tab.name} - {foreach $perms as $perm} - {if $access_edit == 1} - - {else} - - {/if} - {assign var=result_accesses value=$result_accesses + $access[$tab.id_tab][$perm]} - {/foreach} - - - - {foreach $tabs AS $child} - {if $child.id_parent === $tab.id_tab} - {if isset($access[$child.id_tab])} - {assign var=is_child value=true} - {assign var=result_accesses value=0} - - {if $is_child} » {/if}{$child.name} - {foreach $perms as $perm} - {if $access_edit == 1} - - {else} - - {/if} - {assign var=result_accesses value=$result_accesses + $access[$child.id_tab][$perm]} - {/foreach} - - - {/if} - {/if} - {/foreach} - - {/if} - - {/foreach} - {/if} -
- {l s='Menus'} - - - {l s='View'} - - - {l s='Add'} - - - {l s='Edit'} - - - {l s='Delete'} - - - {l s='All'} -
{l s='No menu'}
- - - - - -
- - - - - -
- - - - - - - - - {if !count($modules)} - - - - {else} - {foreach $modules[$profile.id_profile] AS $module} - - - - - - {/foreach} - {/if} -
{l s='Modules'} - {l s='View'} - - {l s='Configure'}
{l s='No modules are installed'}
» {$module.name} - - - -
- -
 
- - {else} - {l s='Administrator permissions cannot be modified.'} + {assign var=tabsize value=count($tabs)} + {foreach $tabs AS $tab} + {if $tab.id_tab > $tabsize} + {assign var=tabsize value=$tab.id_tab} {/if} + {/foreach} -
+ {foreach $profiles as $profile} - {/foreach} +
+ + {if $profile.id_profile != $admin_profile} + + + + + + + + + + + + + {if !count($tabs)} + + + + {else} + {foreach $tabs AS $tab} + + {assign var=access value=$accesses[$profile.id_profile]} + + {if !$tab.id_parent OR $tab.id_parent == -1} + {assign var=is_child value=false} + {assign var=result_accesses value=0} + + {if $is_child} » {/if}{$tab.name} + {foreach $perms as $perm} + {if $access_edit == 1} + + {else} + + {/if} + {assign var=result_accesses value=$result_accesses + $access[$tab.id_tab][$perm]} + {/foreach} + + + + {foreach $tabs AS $child} + {if $child.id_parent === $tab.id_tab} + {if isset($access[$child.id_tab])} + {assign var=is_child value=true} + {assign var=result_accesses value=0} + + {if $is_child} » {/if}{$child.name} + {foreach $perms as $perm} + {if $access_edit == 1} + + {else} + + {/if} + {assign var=result_accesses value=$result_accesses + $access[$child.id_tab][$perm]} + {/foreach} + + + {/if} + {/if} + {/foreach} + + {/if} + + {/foreach} + {/if} + +
+ {l s='Menus'} + + + {l s='View'} + + + {l s='Add'} + + + {l s='Edit'} + + + {l s='Delete'} + + + {l s='All'} +
{l s='No menu'}
+ + + + + +
+ + + + + +
+ + + + + + + + + + {if !count($modules)} + + + + {else} + {foreach $modules[$profile.id_profile] AS $module} + + + + + + {/foreach} + {/if} + +
{l s='Modules'} + {l s='View'} + + {l s='Configure'}
{l s='No modules are installed'}
» {$module.name} + + + +
+ + {else} + {l s='Administrator permissions cannot be modified.'} + {/if} + +
+ + {/foreach} +
diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 543a3b5d2..ad30435dc 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -31,6 +31,7 @@ class AdminAccessControllerCore extends AdminController public function __construct() { + $this->bootstrap = true; $this->table = 'access'; $this->className = 'Profile'; $this->multishop_context = Shop::CONTEXT_ALL; diff --git a/controllers/admin/AdminAdminPreferencesController.php b/controllers/admin/AdminAdminPreferencesController.php index 1b2ad1322..cbd336a90 100644 --- a/controllers/admin/AdminAdminPreferencesController.php +++ b/controllers/admin/AdminAdminPreferencesController.php @@ -29,6 +29,7 @@ class AdminAdminPreferencesControllerCore extends AdminController public function __construct() { + $this->bootstrap = true; $this->className = 'Configuration'; $this->table = 'configuration'; @@ -47,7 +48,7 @@ class AdminAdminPreferencesControllerCore extends AdminController 'fields' => array( 'PRESTASTORE_LIVE' => array( 'title' => $this->l('Automatically check for module updates'), - 'desc' => $this->l('New modules and updates are displayed on the modules page.'), + 'hint' => $this->l('New modules and updates are displayed on the modules page.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', @@ -55,7 +56,7 @@ class AdminAdminPreferencesControllerCore extends AdminController ), 'PS_COOKIE_CHECKIP' => array( 'title' => $this->l('Check the IP address on the cookie'), - 'desc' => $this->l('Check the IP address of the cookie in order to prevent your cookie from being stolen.'), + 'hint' => $this->l('Check the IP address of the cookie in order to prevent your cookie from being stolen.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', @@ -64,7 +65,7 @@ class AdminAdminPreferencesControllerCore extends AdminController ), 'PS_COOKIE_LIFETIME_FO' => array( 'title' => $this->l('Lifetime of Front Office cookies'), - 'desc' => $this->l('Indicate the number of hours'), + 'hint' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', @@ -73,7 +74,7 @@ class AdminAdminPreferencesControllerCore extends AdminController ), 'PS_COOKIE_LIFETIME_BO' => array( 'title' => $this->l('Lifetime of Back Office cookies'), - 'desc' => $this->l('Indicate the number of hours'), + 'hint' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', @@ -89,8 +90,11 @@ class AdminAdminPreferencesControllerCore extends AdminController 'fields' => array( 'PS_ATTACHMENT_MAXIMUM_SIZE' => array( 'title' => $this->l('Maximum size for attachment'), - 'desc' => $this->l('Set the maximum size allowed for attachment files (in MegaBytes).').' '.$this->l('Maximum:').' '. + 'hint' => $this->l('Set the maximum size allowed for attachment files (in MegaBytes).'), + /***** TO DO - ajouter cette ligne dans le hint ? + .' '.$this->l('Maximum:').' '. ((int)str_replace('M', '', ini_get('post_max_size')) > (int)str_replace('M', '', ini_get('upload_max_filesize')) ? ini_get('upload_max_filesize') : ini_get('post_max_size')), + *****/ 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', @@ -99,7 +103,7 @@ class AdminAdminPreferencesControllerCore extends AdminController ), 'PS_LIMIT_UPLOAD_FILE_VALUE' => array( 'title' => $this->l('File value upload limit'), - 'desc' => $this->l('Define the limit upload for a downloadable product. This value has to be less than or equal to the maximum file upload allotted by your server. ').sprintf('(%s MB).', $upload_mb), + 'hint' => $this->l('Define the limit upload for a downloadable product. This value has to be less than or equal to the maximum file upload allotted by your server. ').sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', @@ -108,7 +112,7 @@ class AdminAdminPreferencesControllerCore extends AdminController ), 'PS_LIMIT_UPLOAD_IMAGE_VALUE' => array( 'title' => $this->l('Image value upload limit'), - 'desc' => $this->l('Define the limit upload for an image. This value has to be less than or equal to the maximum file upload allotted by your server. ').sprintf('(%s MB).', $upload_mb), + 'hint' => $this->l('Define the limit upload for an image. This value has to be less than or equal to the maximum file upload allotted by your server. ').sprintf('(%s MB).', $upload_mb), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', @@ -123,7 +127,7 @@ class AdminAdminPreferencesControllerCore extends AdminController 'fields' => array( 'PS_HELPBOX' => array( 'title' => $this->l('Back Office help boxes'), - 'desc' => $this->l('Allow yellow help boxes to be displayed under the form fields in the Back Office.'), + 'hint' => $this->l('Allow yellow help boxes to be displayed under the form fields in the Back Office.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', @@ -131,7 +135,7 @@ class AdminAdminPreferencesControllerCore extends AdminController ), 'PS_HIDE_OPTIMIZATION_TIPS' => array( 'title' => $this->l('Hide optimization tips'), - 'desc' => $this->l('Hide optimization tips on the Back Office homepage'), + 'hint' => $this->l('Hide optimization tips on the Back Office homepage'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool' @@ -144,21 +148,21 @@ class AdminAdminPreferencesControllerCore extends AdminController 'fields' => array( 'PS_SHOW_NEW_ORDERS' => array( 'title' => $this->l('Show notifications for new orders'), - 'desc' => $this->l('This will display notifications when new orders are made in your shop.'), + 'hint' => $this->l('This will display notifications when new orders are made in your shop.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool' ), 'PS_SHOW_NEW_CUSTOMERS' => array( 'title' => $this->l('Show notifications for new customers'), - 'desc' => $this->l('This will display notifications every time a new customer registers in your shop.'), + 'hint' => $this->l('This will display notifications every time a new customer registers in your shop.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool' ), 'PS_SHOW_NEW_MESSAGES' => array( 'title' => $this->l('Show notifications for new messages'), - 'desc' => $this->l('This will display notifications when new messages are posted in your shop.'), + 'hint' => $this->l('This will display notifications when new messages are posted in your shop.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool' diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index 3c09f4cf1..892bca213 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -39,6 +39,7 @@ class AdminEmployeesControllerCore extends AdminController public function __construct() { + $this->bootstrap = true; $this->table = 'employee'; $this->className = 'Employee'; $this->lang = false; @@ -85,16 +86,15 @@ class AdminEmployeesControllerCore extends AdminController 'fields' => array( 'PS_PASSWD_TIME_BACK' => array( 'title' => $this->l('Password regeneration'), - 'desc' => $this->l('Security: Minimum time to wait between two password changes.'), + 'hint' => $this->l('Security: Minimum time to wait between two password changes.'), 'cast' => 'intval', - 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL ), 'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array( 'title' => $this->l('Memorize the language used in Admin panel forms'), - 'desc' => $this->l('Allow employees to select a specific language for the Admin panel form.'), + 'hint' => $this->l('Allow employees to select a specific language for the Admin panel form.'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', @@ -165,21 +165,19 @@ class AdminEmployeesControllerCore extends AdminController $this->fields_form = array( 'legend' => array( 'title' => $this->l('Employees'), - 'image' => '../img/admin/nav-user.gif' + 'icon' => 'icon-user' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('First Name:'), 'name' => 'firstname', - 'size' => 33, 'required' => true ), array( 'type' => 'text', 'label' => $this->l('Last Name:'), 'name' => 'lastname', - 'size' => 33, 'required' => true ), array( @@ -187,8 +185,7 @@ class AdminEmployeesControllerCore extends AdminController 'label' => $this->l('Password:'), 'name' => 'passwd', 'required' => true, - 'size' => 33, - 'desc' => ($obj->id ? + 'hint' => ($obj->id ? $this->l('Leave this field blank if you do not want to change your password.') : $this->l('Minimum of eight characters (use only letters and numbers)').' -_') ), @@ -196,7 +193,6 @@ class AdminEmployeesControllerCore extends AdminController 'type' => 'text', 'label' => $this->l('Email address:'), 'name' => 'email', - 'size' => 33, 'required' => true ), array( @@ -204,22 +200,20 @@ class AdminEmployeesControllerCore extends AdminController 'label' => $this->l('Admin panel color:'), 'name' => 'bo_color', 'class' => 'color mColorPickerInput', - 'size' => 20, - 'desc' => $this->l('Admin panel background will be displayed in this color (HTML colors only).').' "lightblue", "#CC6600")' + 'hint' => $this->l('Admin panel background will be displayed in this color (HTML colors only).').' "lightblue", "#CC6600")' ), array( 'type' => 'default_tab', 'label' => $this->l('Default page:'), 'name' => 'default_tab', - 'desc' => $this->l('This page will be displayed just after login'), + 'hint' => $this->l('This page will be displayed just after login'), 'options' => $this->tabs_list ), array( 'type' => 'text', 'label' => $this->l('Back Office width'), 'name' => 'bo_width', - 'size' => 10, - 'desc' => $this->l('Back Office width, in pixels. The value "0" means that the Back Office width will be flexible.') + 'hint' => $this->l('Back Office width, in pixels. The value "0" means that the Back Office width will be flexible.') ), array( 'type' => 'select', @@ -237,15 +231,14 @@ class AdminEmployeesControllerCore extends AdminController 'label' => $this->l('Theme:'), 'name' => 'bo_theme', 'options' => array('query' => $this->themes), - 'desc' => $this->l('Back Office theme') + 'hint' => $this->l('Back Office theme') ), array( - 'type' => 'radio', + 'type' => 'switch', 'label' => $this->l('Show screencast at login:'), 'name' => 'bo_show_screencast', - 'desc' => $this->l('Display the welcome video in the Admin panel dashboard at log in.'), + 'hint' => $this->l('Display the welcome video in the Admin panel dashboard at log in.'), 'required' => false, - 'class' => 't', 'is_bool' => true, 'values' => array( array( @@ -266,11 +259,10 @@ class AdminEmployeesControllerCore extends AdminController if ((int)$this->tabAccess['edit'] && !$this->restrict_edition) { $this->fields_form['input'][] = array( - 'type' => 'radio', + 'type' => 'switch', 'label' => $this->l('Status:'), 'name' => 'active', 'required' => false, - 'class' => 't', 'is_bool' => true, 'values' => array( array( @@ -284,7 +276,7 @@ class AdminEmployeesControllerCore extends AdminController 'label' => $this->l('Disabled') ) ), - 'desc' => $this->l('Allow or disallow this employee to log into the Admin panel.') + 'hint' => $this->l('Allow or disallow this employee to log into the Admin panel.') ); // if employee is not SuperAdmin (id_profile = 1), don't make it possible to select the admin profile @@ -317,7 +309,7 @@ class AdminEmployeesControllerCore extends AdminController $this->fields_form['input'][] = array( 'type' => 'shop', 'label' => $this->l('Shop association:'), - 'desc' => $this->l('Select the shops the employee is allowed to access'), + 'hint' => $this->l('Select the shops the employee is allowed to access'), 'name' => 'checkBoxShopAsso', ); } @@ -325,7 +317,7 @@ class AdminEmployeesControllerCore extends AdminController $this->fields_form['submit'] = array( 'title' => $this->l('Save '), - 'class' => 'button' + 'class' => 'btn btn-default' ); $this->fields_value['passwd'] = false; diff --git a/controllers/admin/AdminProfilesController.php b/controllers/admin/AdminProfilesController.php index ac848d342..0980056dc 100644 --- a/controllers/admin/AdminProfilesController.php +++ b/controllers/admin/AdminProfilesController.php @@ -28,6 +28,7 @@ class AdminProfilesControllerCore extends AdminController { public function __construct() { + $this->bootstrap = true; $this->context = Context::getContext(); $this->table = 'profile'; $this->className = 'Profile'; @@ -45,8 +46,7 @@ class AdminProfilesControllerCore extends AdminController $this->fields_list = array( 'id_profile' => array( 'title' => $this->l('ID'), - 'align' => 'center', - 'width' => 25 + 'align' => 'center' ), 'name' => array('title' => $this->l('Name')) ); @@ -56,21 +56,20 @@ class AdminProfilesControllerCore extends AdminController $this->fields_form = array( 'legend' => array( 'title' => $this->l('Profile'), - 'image' => '../img/admin/profiles.png' + 'icon' => 'icon-group' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', - 'size' => 33, 'required' => true, 'lang' => true, ) ), 'submit' => array( 'title' => $this->l('Save '), - 'class' => 'button' + 'class' => 'btn btn-default' ) ); diff --git a/controllers/admin/AdminQuickAccessesController.php b/controllers/admin/AdminQuickAccessesController.php index e4cc3a8db..244173fe3 100644 --- a/controllers/admin/AdminQuickAccessesController.php +++ b/controllers/admin/AdminQuickAccessesController.php @@ -28,6 +28,7 @@ class AdminQuickAccessesControllerCore extends AdminController { public function __construct() { + $this->bootstrap = true; $this->table = 'quick_access'; $this->className = 'QuickAccess'; $this->lang = true; @@ -45,20 +46,16 @@ class AdminQuickAccessesControllerCore extends AdminController $this->fields_list = array( 'id_quick_access' => array( 'title' => $this->l('ID'), - 'align' => 'center', - 'width' => 25 + 'align' => 'center' ), 'name' => array( - 'title' => $this->l('Name'), - 'width' => 200 + 'title' => $this->l('Name') ), 'link' => array( - 'title' => $this->l('Link'), - 'width' => 300 + 'title' => $this->l('Link') ), 'new_window' => array( 'title' => $this->l('New window'), - 'width' => 70, 'align' => 'center', 'type' => 'bool', 'activeVisu' => 'new_window' @@ -68,7 +65,7 @@ class AdminQuickAccessesControllerCore extends AdminController $this->fields_form = array( 'legend' => array( 'title' => $this->l('Quick Access menu'), - 'image' => '../img/admin/quick.gif' + 'icon' => 'icon-align-justify' ), 'input' => array( array( @@ -76,26 +73,23 @@ class AdminQuickAccessesControllerCore extends AdminController 'label' => $this->l('Name:'), 'name' => 'name', 'lang' => true, - 'size' => 33, 'maxlength' => 32, 'required' => true, - 'hint' => $this->l('Forbidden characters:').' <>;=#{}' + 'hint' => $this->l('Forbidden characters:').' <>;=#{}' ), array( 'type' => 'text', 'label' => $this->l('URL:'), 'name' => 'link', - 'size' => 60, 'maxlength' => 128, 'required' => true, - 'desc' => $this->l('If it\'s a URL that comes from your Back Office, you must NOT use a security token.') + 'hint' => $this->l('If it\'s a URL that comes from your Back Office, you must NOT use a security token.') ), array( - 'type' => 'radio', + 'type' => 'switch', 'label' => $this->l('Open in new window:'), 'name' => 'new_window', 'required' => false, - 'class' => 't', 'values' => array( array( 'id' => 'new_window_on', diff --git a/controllers/admin/AdminTabsController.php b/controllers/admin/AdminTabsController.php index beb37e2f1..095eabee8 100644 --- a/controllers/admin/AdminTabsController.php +++ b/controllers/admin/AdminTabsController.php @@ -30,6 +30,7 @@ class AdminTabsControllerCore extends AdminController public function __construct() { + $this->bootstrap = true; $this->context = Context::getContext(); $this->multishop_context = Shop::CONTEXT_ALL; $this->table = 'tab'; @@ -45,12 +46,10 @@ class AdminTabsControllerCore extends AdminController $this->fields_list = array( 'id_tab' => array( - 'title' => $this->l('ID'), - 'width' => 25 + 'title' => $this->l('ID') ), 'name' => array( - 'title' => $this->l('Name'), - 'width' => 200 + 'title' => $this->l('Name') ), 'logo' => array( 'title' => $this->l('Icon'), @@ -64,7 +63,6 @@ class AdminTabsControllerCore extends AdminController ), 'active' => array( 'title' => $this->l('Enabled'), - 'width' => 70, 'align' => 'center', 'active' => 'status', 'type' => 'bool', @@ -72,7 +70,6 @@ class AdminTabsControllerCore extends AdminController ), 'position' => array( 'title' => $this->l('Position'), - 'width' => 40, 'filter_key' => 'a!position', 'position' => 'position' ) @@ -104,7 +101,7 @@ class AdminTabsControllerCore extends AdminController $this->fields_form = array( 'legend' => array( 'title' => $this->l('Menus'), - 'image' => '../img/admin/tab.gif' + 'icon' => 'icon-list-ul' ), 'input' => array( array( @@ -117,9 +114,8 @@ class AdminTabsControllerCore extends AdminController 'label' => $this->l('Name:'), 'name' => 'name', 'lang' => true, - 'size' => 33, 'required' => true, - 'hint' => $this->l('Invalid characters:').' <>;=#{}' + 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'text', @@ -136,14 +132,13 @@ class AdminTabsControllerCore extends AdminController 'type' => 'file', 'label' => $this->l('Icon:'), 'name' => 'icon', - 'desc' => $this->l('Upload a logo from your computer (.gif, .jpg, .jpeg or .png).') + 'hint' => $this->l('Upload a logo from your computer (.gif, .jpg, .jpeg or .png).') ), array( - 'type' => 'radio', + 'type' => 'switch', 'label' => $this->l('Status:'), 'name' => 'active', 'required' => false, - 'class' => 't', 'is_bool' => true, 'values' => array( array( @@ -157,12 +152,12 @@ class AdminTabsControllerCore extends AdminController 'label' => $this->l('Disabled') ) ), - 'desc' => $this->l('Show or hide menu.') + 'hint' => $this->l('Show or hide menu.') ), ), 'submit' => array( 'title' => $this->l(' Save '), - 'class' => 'button' + 'class' => 'btn btn-default' ) );