// fix bug : delete submit button and change css for box info in AdminGeolocationController

This commit is contained in:
lLefevre
2011-11-21 14:18:35 +00:00
parent 1fd8d9ede3
commit 8bf528e8cc
2 changed files with 11 additions and 15 deletions
@@ -35,7 +35,6 @@ class AdminGeolocationControllerCore extends AdminController
'geolocationConfiguration' => array( 'geolocationConfiguration' => array(
'title' => $this->l('Geolocation by IP:'), 'title' => $this->l('Geolocation by IP:'),
'icon' => 'world', 'icon' => 'world',
'class' => 'width3',
'fields' => array( 'fields' => array(
'PS_GEOLOCATION_ENABLED' => array( 'PS_GEOLOCATION_ENABLED' => array(
'title' => $this->l('Geolocation by IP:'), 'title' => $this->l('Geolocation by IP:'),
@@ -45,12 +44,10 @@ class AdminGeolocationControllerCore extends AdminController
'type' => 'bool' 'type' => 'bool'
), ),
), ),
'submit' => array(),
), ),
'geolocationCountries' => array( 'geolocationCountries' => array(
'title' => $this->l('Options'), 'title' => $this->l('Options'),
'icon' => 'world', 'icon' => 'world',
'class' => 'width4',
'description' => $this->l('The following features are only available if you enable the Geolocation by IP feature.'), 'description' => $this->l('The following features are only available if you enable the Geolocation by IP feature.'),
'fields' => array( 'fields' => array(
'PS_GEOLOCATION_BEHAVIOR' => array( 'PS_GEOLOCATION_BEHAVIOR' => array(
@@ -75,12 +72,10 @@ class AdminGeolocationControllerCore extends AdminController
'list' => Country::getCountries($this->context->language->id) 'list' => Country::getCountries($this->context->language->id)
), ),
), ),
'submit' => array(),
), ),
'geolocationWhitelist' => array( 'geolocationWhitelist' => array(
'title' => $this->l('Whitelist of IP addresses'), 'title' => $this->l('Whitelist of IP addresses'),
'icon' => 'world', 'icon' => 'world',
'class' => 'width3',
'description' => $this->l('You can add many IP addresses, these addresses will always be allowed to access your shop (e.g. Google bots IP).'), 'description' => $this->l('You can add many IP addresses, these addresses will always be allowed to access your shop (e.g. Google bots IP).'),
'fields' => array( 'fields' => array(
'PS_GEOLOCATION_WHITELIST' => array('title' => $this->l('Allowed IP addresses:'), 'type' => 'textarea_newlines', 'cols' => 80, 'rows' => 30), 'PS_GEOLOCATION_WHITELIST' => array('title' => $this->l('Allowed IP addresses:'), 'type' => 'textarea_newlines', 'cols' => 80, 'rows' => 30),
@@ -92,19 +87,17 @@ class AdminGeolocationControllerCore extends AdminController
public function postProcess() public function postProcess()
{ {
if (Tools::isSubmit('submitGeolocationConfiguration')) if (Tools::isSubmit('submitGeolocationWhitelist'))
{ {
$redirectAdmin = false;
if ($this->isGeoLiteCityAvailable()) if ($this->isGeoLiteCityAvailable())
{ {
Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED'))); Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED')));
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); $redirectAdmin = true;
} }
else else
$this->_errors[] = Tools::displayError('Geolocation database is unavailable.'); $this->_errors[] = Tools::displayError('Geolocation database is unavailable.');
}
if (Tools::isSubmit('submitGeolocationCountries'))
{
if (!is_array(Tools::getValue('countries')) || !count(Tools::getValue('countries'))) if (!is_array(Tools::getValue('countries')) || !count(Tools::getValue('countries')))
$this->_errors[] = Tools::displayError('Country selection is invalid'); $this->_errors[] = Tools::displayError('Country selection is invalid');
else else
@@ -115,12 +108,9 @@ class AdminGeolocationControllerCore extends AdminController
); );
Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR')); Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR'));
Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries'))); Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries')));
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); $redirectAdmin = true;
} }
}
if (Tools::isSubmit('submitGeolocationWhitelist'))
{
if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST'))) if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST')))
$this->_errors[] = Tools::displayError('Invalid whitelist'); $this->_errors[] = Tools::displayError('Invalid whitelist');
else else
@@ -129,8 +119,11 @@ class AdminGeolocationControllerCore extends AdminController
'PS_GEOLOCATION_WHITELIST', 'PS_GEOLOCATION_WHITELIST',
str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST'))) str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST')))
); );
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); $redirectAdmin = true;
} }
if ($redirectAdmin)
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4');
} }
return parent::postProcess(); return parent::postProcess();
@@ -145,6 +138,7 @@ class AdminGeolocationControllerCore extends AdminController
public function initContent() public function initContent()
{ {
$this->display = 'options';
if (!$this->isGeoLiteCityAvailable()) if (!$this->isGeoLiteCityAvailable())
$this->displayWarning($this->l('In order to use Geolocation, please download').' $this->displayWarning($this->l('In order to use Geolocation, please download').'
<a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">'.$this->l('this file').'</a> '. <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">'.$this->l('this file').'</a> '.
+2
View File
@@ -1695,6 +1695,8 @@ fieldset .optionsDescription{
margin-bottom: 15px; margin-bottom: 15px;
padding: 5px 5px 5px 40px; padding: 5px 5px 5px 40px;
border-radius:3px; border-radius:3px;
min-height:32px;
line-height:32px;
} }
p.preference_description{ p.preference_description{