[*] BO #PSFV-94 : update of the displayform method by helperForm in AdminStatesController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9251 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-10-11 16:26:27 +00:00
parent 867c38f43b
commit b9692f7515
3 changed files with 83 additions and 103 deletions
-78
View File
@@ -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 <contact@prestashop.com>
* @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)}
<form action="{$tab_form['current']}&submitAdd{$tab_form['table']}=1&token={$tab_form['token']}" method="post">
{if $tab_form['id']}<input type="hidden" name="id_{$tab_form['table']}" value="{$tab_form['id']}" />{/if}
<fieldset>
<legend><img src="../img/admin/world.gif" />{l s ='States'}</legend>
<label>{l s ='Name:'} </label>
<div class="margin-form">
<input type="text" size="30" maxlength="32" name="name" value="{$tab_form['name']}" /> <sup>*</sup>
<p class="clear">{l s ='State name to display in addresses and on invoices'}</p>
</div>
<label>{l s ='ISO code:'} </label>
<div class="margin-form">
<input type="text" size="5" maxlength="4" name="iso_code" value="{$tab_form['iso_code']}" style="text-transform:uppercase;" /> <sup>*</sup>
<p>{l s ='1 to 4 letter ISO code (search on Wikipedia if you don\'t know)'}</p>
</div>
<label>{l s ='Country:'} </label>
<div class="margin-form">
<select name="id_country">
{foreach $tab_form['countries'] AS $country}
<option value="{$country['id_country']}" {if $tab_form['id_country'] == $country['id_country']}selected="selected"{/if}>{$country['name']}</option>
{/foreach}
</select>
<p>{l s ='Country where state, region or city is located'}</p>
</div>
<label>{l s ='Zone:'} </label>
<div class="margin-form">
<select name="id_zone">
{foreach $tab_form['zones'] AS $zone}
<option value="{$zone['id_zone']}"' {if $tab_form['id_zone'] == $zone['id_zone']}selected="selected"{/if}>{$zone['name']}</option>
{/foreach}
</select>
<p>{l s ='Geographical zone where this state is located'}<br />{l s ='Used for shipping'}</p>
</div>
<label>{l s ='Status:'} </label>
<div class="margin-form">
<input type="radio" name="active" id="active_on" value="1" {if $tab_form['active']}checked="checked"{/if}/>
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="{l s ='Enabled'}" title="{l s ='Enabled'}" /></label>
<input type="radio" name="active" id="active_off" value="0" {if !$tab_form['active']}checked="checked"{/if}/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="{l s ='Disabled'}" title="{l s ='Disabled'}" /></label>
<p>{l s ='Enabled or disabled'}</p>
</div>
<div class="margin-form">
<input type="submit" value="{l s =' Save '}" name="submitAdd$tab_form['table']}" class="button" />
</div>
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
</fieldset>
</form>
{/if}
{$content}
+79 -25
View File
@@ -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' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" />'
),
array(
'id' => 'active_off',
'value' => 0,
'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$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')
+4
View File
@@ -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;
}