From 5799e224de88c81767cf6c40f5a255ff2114e8e7 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Tue, 11 Oct 2011 16:26:27 +0000 Subject: [PATCH] [*] BO #PSFV-94 : update of the displayform method by helperForm in AdminStatesController --- admin-dev/themes/template/adminStates.tpl | 78 --------------- controllers/admin/AdminStatesController.php | 104 +++++++++++++++----- css/admin.css | 4 + 3 files changed, 83 insertions(+), 103 deletions(-) delete mode 100644 admin-dev/themes/template/adminStates.tpl diff --git a/admin-dev/themes/template/adminStates.tpl b/admin-dev/themes/template/adminStates.tpl deleted file mode 100644 index 6bf8a080d..000000000 --- a/admin-dev/themes/template/adminStates.tpl +++ /dev/null @@ -1,78 +0,0 @@ -{* -* 2007-2011 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 8897 $ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{if isset($tab_form)} - -
- {if $tab_form['id']}{/if} -
- {l s ='States'} - -
- * -

{l s ='State name to display in addresses and on invoices'}

-
- -
- * -

{l s ='1 to 4 letter ISO code (search on Wikipedia if you don\'t know)'}

-
- -
- -

{l s ='Country where state, region or city is located'}

-
- -
- -

{l s ='Geographical zone where this state is located'}
{l s ='Used for shipping'}

-
- -
- - - - -

{l s ='Enabled or disabled'}

-
-
- -
-
* {l s ='Required field'}
-
-
- -{/if} - -{$content} \ No newline at end of file diff --git a/controllers/admin/AdminStatesController.php b/controllers/admin/AdminStatesController.php index 210561ccd..c27161256 100644 --- a/controllers/admin/AdminStatesController.php +++ b/controllers/admin/AdminStatesController.php @@ -30,7 +30,7 @@ class AdminStatesControllerCore extends AdminController public function __construct() { $this->table = 'state'; - $this->className = 'State'; + $this->className = 'State'; $this->lang = false; $this->edit = true; $this->delete = true; @@ -53,7 +53,84 @@ class AdminStatesControllerCore extends AdminController 'zone' => array('title' => $this->l('Zone'), 'width' => 100, 'filter_key' => 'z!name') ); - $this->template = 'adminStates.tpl'; + $this->fields_form = array( + 'legend' => array( + 'title' => $this->l('States'), + 'image' => '../img/admin/world.gif' + ), + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Name:'), + 'name' => 'name', + 'size' => 30, + 'maxlength' => 32, + 'required' => true, + 'p' => $this->l('State name to display in addresses and on invoices') + ), + array( + 'type' => 'text', + 'label' => $this->l('ISO code:'), + 'name' => 'iso_code', + 'size' => 5, + 'maxlength' => 4, + 'required' => true, + 'class' => 'uppercase', + 'p' => $this->l('1 to 4 letter ISO code (search on Wikipedia if you don\'t know)') + ), + array( + 'type' => 'select', + 'label' => $this->l('Country:'), + 'name' => 'id_country', + 'required' => false, + 'options' => array( + 'query' => Country::getCountries($this->context->language->id, false, true), + 'id' => 'id_country', + 'name' => 'name' + ), + 'p' => $this->l('Country where state, region or city is located') + ), + array( + 'type' => 'select', + 'label' => $this->l('Zone:'), + 'name' => 'id_zone', + 'required' => false, + 'options' => array( + 'query' => Zone::getZones(), + 'id' => 'id_zone', + 'name' => 'name' + ), + 'p' => array( + $this->l('Geographical zone where this state is located'), + $this->l('Used for shipping') + ) + ), + array( + 'type' => 'radio', + 'label' => $this->l('Status:'), + 'name' => 'active', + 'required' => false, + 'class' => 't', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => ''.$this->l('Enabled').'' + ), + array( + 'id' => 'active_off', + 'value' => 0, + 'label' => ''.$this->l('Disabled').'' + ) + ), + 'p' => $this->l('Enabled or disabled') + ) + ), + 'submit' => array( + 'title' => $this->l(' Save '), + 'class' => 'button' + ) + ); parent::__construct(); } @@ -108,29 +185,6 @@ class AdminStatesControllerCore extends AdminController parent::postProcess(); } - public function displayForm($is_main_tab = true) - { - $this->content = parent::displayForm($is_main_tab); - - if (!($obj = $this->loadObject(true))) - return; - $current_shop = Shop::initialize(); - - $this->context->smarty->assign('tab_form', array( - 'current' => self::$currentIndex, - 'table' => $this->table, - 'token' => $this->token, - 'id' => $obj->id, - 'name' => $this->getFieldValue($obj, 'name'), - 'iso_code' => $this->getFieldValue($obj, 'iso_code'), - 'countries' => Country::getCountries($this->context->language->id, false, true), - 'id_country' => $this->getFieldValue($obj, 'id_country'), - 'zones' => Zone::getZones(), - 'id_zone' => $this->getFieldValue($obj, 'id_zone'), - 'active' => $this->getFieldValue($obj, 'active') ? true : false - )); - } - public function initContent() { if ($this->display != 'edit') diff --git a/css/admin.css b/css/admin.css index 66df89b0e..9a14ff70f 100644 --- a/css/admin.css +++ b/css/admin.css @@ -692,6 +692,10 @@ tr.deleted td { background: #F4E6C9 url(../img/admin/news-bg.gif) repeat-x top left; } +.uppercase { + text-transform: uppercase; +} + .noborder { border: none; }