// fix bug : delete submit button and toolbar not fix in AdminLocalizationController

This commit is contained in:
lLefevre
2011-11-21 09:33:37 +00:00
parent 5eedee4129
commit cc30219155
2 changed files with 102 additions and 48 deletions
@@ -1,37 +0,0 @@
{extends file="helper/options/options.tpl"}
{block name="after"}
<br />
{if $localizations_pack}
<form method="post" action="{$current}&amp;token={$token}" class="width2" enctype="multipart/form-data">
<fieldset>
<legend><img src="../img/admin/localization.gif" />{l s='Localization pack import'}</legend>
<div style="clear: both; padding-top: 15px;">
<label>{l s='Localization pack you want to import:'}</label>
<div class="margin-form">
<select id="iso_localization_pack" name="iso_localization_pack">
{foreach from=$localizations_pack key=iso item=name}
<option value="{$iso}">{$name}</option>
{/foreach}
</select>
</div>
<br />
<label>{l s='Content to import:'}</label>
<div class="margin-form" style="padding-top: 5px;">
<input type="checkbox" name="selection[]" value="states" checked="checked" /> {l s='States'}<br />
<input type="checkbox" name="selection[]" value="taxes" checked="checked" /> {l s='Taxes'}<br />
<input type="checkbox" name="selection[]" value="currencies" checked="checked" /> {l s='Currencies'}<br />
<input type="checkbox" name="selection[]" value="languages" checked="checked" /> {l s='Languages'}<br />
<input type="checkbox" name="selection[]" value="units" checked="checked" /> {l s='Units (e.g., weight, volume, distance)'}
</div>
<div align="center" style="margin-top: 20px;">
<input type="submit" class="button" name="submitLocalizationPack" value="{l s=' Import '}" />
</div>
</div>
</fieldset>
</form>
<br />
{else}
<p class="warn">{l s='Cannot connect to prestashop.com'}</p>
{/if}
{/block}
+102 -11
View File
@@ -32,8 +32,6 @@ class AdminLocalizationControllerCore extends AdminController
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
$this->options = array(
'localization' => array(
'title' => $this->l('Localization'),
@@ -90,10 +88,11 @@ class AdminLocalizationControllerCore extends AdminController
'type' => 'text',
'visibility' => Shop::CONTEXT_ALL
)
),
'submit' => array('title' => $this->l(' Save '), 'class' => 'button')
),
)
)
);
parent::__construct();
}
public function postProcess()
@@ -124,7 +123,7 @@ class AdminLocalizationControllerCore extends AdminController
parent::postProcess();
}
public function initContent()
public function initForm()
{
$localizations_pack = false;
$this->tpl_option_vars['options_content'] = $this->initOptions();
@@ -137,11 +136,103 @@ class AdminLocalizationControllerCore extends AdminController
$xml_localization = simplexml_load_file($localization_file);
}
if ($xml_localization)
foreach ($xml_localization->pack as $pack)
$localizations_pack[(string)$pack->iso] = (string)$pack->name;
$i = 0;
if ($xml_localization)
foreach ($xml_localization->pack as $key => $pack)
{
$localizations_pack[$i]['iso_localization_pack'] = (string)$pack->iso;
$localizations_pack[$i]['name'] = (string)$pack->name;
$i++;
}
$this->tpl_option_vars['localizations_pack'] = $localizations_pack;
parent::initContent();
if (!$localizations_pack)
return $this->displayWarning($this->l('Cannot connect to prestashop.com'));
$selection_import = array(
array(
'id' => 'states',
'name' => $this->l('States')
),
array(
'id' => 'taxes',
'name' => $this->l('Taxes')
),
array(
'id' => 'currencies',
'name' => $this->l('Currencies')
),
array(
'id' => 'languages',
'name' => $this->l('Languages')
),
array(
'id' => 'units',
'name' => $this->l('Units (e.g., weight, volume, distance)')
)
);
$this->fields_form = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Localization pack import'),
'image' => '../img/admin/localization.gif'
),
'input' => array(
array(
'type' => 'select',
'label' => $this->l('Localization pack you want to import:'),
'name' => 'iso_localization_pack',
'options' => array(
'query' => $localizations_pack,
'id' => 'iso_localization_pack',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'label' => $this->l('Content to import:'),
'name' => 'selection[]',
'lang' => true,
'values' => array(
'query' => $selection_import,
'id' => 'id',
'name' => 'name'
)
)
),
'submit' => array(
'title' => $this->l(' Import '),
'class' => 'button',
'name' => 'submitLocalizationPack'
)
);
$this->fields_value = array(
'selection[]_states' => true,
'selection[]_taxes' => true,
'selection[]_currencies' => true,
'selection[]_languages' => true,
'selection[]_units' => true
);
$this->show_toolbar = false;
return parent::initForm();
}
public function initContent()
{
// toolbar (save, cancel, new, ..)
$this->initToolbar();
$this->content .= $this->initOptions();
if (!$this->loadObject(true))
return;
$this->content .= $this->initForm();
$this->context->smarty->assign(array(
'content' => $this->content,
'url_post' => self::$currentIndex.'&token='.$this->token,
));
}
}