diff --git a/admin-dev/themes/template/preferences/options.tpl b/admin-dev/themes/template/preferences/options.tpl new file mode 100644 index 000000000..9611cf79f --- /dev/null +++ b/admin-dev/themes/template/preferences/options.tpl @@ -0,0 +1,53 @@ +{* +* 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: 9540 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="../options.tpl"} +{block name="start_field_block"} + {if $field['type'] == 'price'} +
+ {$field['currency_left']} + + {if isset($field['next'])}   {$field['next']|strval}{/if} + {$field['currency_right']} + {elseif $field['type'] == 'disabled'} +
+ {$field['disabled']} + {elseif $field['type'] == 'maintenance_ip'} +
+ {$field['script_ip']} + + {$field['link_remove_ip']} + {else} +
+ {/if} +{/block} + +{block name="end_field_block"} + {if $field['type'] == 'checkbox_table'} +
+
+ {/if} +{/block} \ No newline at end of file diff --git a/classes/HelperOptions.php b/classes/HelperOptions.php index 4f643943c..1756db45b 100644 --- a/classes/HelperOptions.php +++ b/classes/HelperOptions.php @@ -122,6 +122,8 @@ class HelperOptionsCore extends Helper } '; $field['link_remove_ip'] = '  '.$this->l('Add my IP').''; + if (!isset($category_data['bottom'])) + $category_data['bottom'] = ''; } else if ($field['type'] == 'price') { $field['currency_left'] = $this->context->currency->getSign('left'); diff --git a/admin-dev/tabs/AdminPreferences.php b/controllers/admin/AdminPreferencesController.php similarity index 87% rename from admin-dev/tabs/AdminPreferences.php rename to controllers/admin/AdminPreferencesController.php index dca3c3db5..c55d9d182 100644 --- a/admin-dev/tabs/AdminPreferences.php +++ b/controllers/admin/AdminPreferencesController.php @@ -25,8 +25,9 @@ * International Registered Trademark & Property of PrestaShop SA */ -class AdminPreferences extends AdminTab +class AdminPreferencesControllerCore extends AdminController { + public function __construct() { $this->context = Context::getContext(); @@ -34,7 +35,7 @@ class AdminPreferences extends AdminTab $this->table = 'configuration'; // Prevent classes which extend AdminPreferences to load useless data - if (get_class($this) == 'AdminPreferences') + if (get_class($this) == 'AdminPreferencesController') { $timezones = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT name FROM '._DB_PREFIX_.'timezone'); $taxes[] = array('id' => 0, 'name' => $this->l('None')); @@ -97,6 +98,7 @@ class AdminPreferences extends AdminTab 'PS_COOKIE_LIFETIME_FO' => array('title' => $this->l('Lifetime of the Front Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480', 'visibility' => Shop::CONTEXT_ALL), 'PS_COOKIE_LIFETIME_BO' => array('title' => $this->l('Lifetime of the Back Office cookie'), 'desc' => $this->l('Indicate the number of hours'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'default' => '480', 'visibility' => Shop::CONTEXT_ALL), 'PS_ORDER_PROCESS_TYPE' => array('title' => $this->l('Order process type'), 'desc' => $this->l('You can choose the order process type as either standard (5 steps) or One Page Checkout'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $order_process_type, 'identifier' => 'value'), + 'PS_REGISTRATION_PROCESS_TYPE' => array('title' => $this->l('Registration process type'), 'desc' => $this->l('The 2 steps register process allows the customer to register faster, and create his address later.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $registration_process_type, 'identifier' => 'value'), 'PS_GUEST_CHECKOUT_ENABLED' => array('title' => $this->l('Enable guest checkout'), 'desc' => $this->l('Your guest can make an order without registering'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'js' => array('on' => 'onchange="changeCMSActivationAuthorization()"', 'off' => 'onchange="changeCMSActivationAuthorization()"')), 'PS_CONDITIONS_CMS_ID' => array('title' => $this->l('Conditions of use CMS page'), 'desc' => $this->l('Choose the Conditions of use CMS page'), 'validation' => 'isInt', 'type' => 'select', 'list' => $cms_tab, 'identifier' => 'id', 'cast' => 'intval'), @@ -113,7 +115,6 @@ class AdminPreferences extends AdminTab 'PS_SHOW_NEW_ORDERS' => array('title' => $this->l('Show notifications for new orders'), 'desc' => $this->l('This will display notifications when new orders will be made on 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 when new customers will register on 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 will be posted on your shop'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), - 'PS_REGISTRATION_PROCESS_TYPE' => array('title' => $this->l('Registration process type'), 'desc' => $this->l('The 2 steps register process allows the customer to register faster, and create his address later.'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $registration_process_type, 'identifier' => 'value'), ); if (function_exists('date_default_timezone_set')) @@ -126,11 +127,12 @@ class AdminPreferences extends AdminTab $fields['PS_SSL_ENABLED']['disabled'] = ''.$this->l('Please click here to use HTTPS protocol before enabling SSL.').''; } - $this->optionsList = array( + $this->options = array( 'general' => array( 'title' => $this->l('General'), 'icon' => 'tab-preferences', 'fields' => $fields, + 'submit' => array('title' => $this->l(' Save '), 'class' => 'button') ), ); } @@ -138,11 +140,6 @@ class AdminPreferences extends AdminTab parent::__construct(); } - public function display() - { - $this->displayOptionsList(); - } - public function postProcess() { Tools::clearCache($this->context->smarty); @@ -164,11 +161,11 @@ class AdminPreferences extends AdminTab public function beforeUpdateOptions() { if (get_class($this) != 'AdminPreferences') - return ; + return; $sql = 'SELECT `id_cms` FROM `'._DB_PREFIX_.'cms` WHERE id_cms = '.(int)Tools::getValue('PS_CONDITIONS_CMS_ID'); - if (Tools::getValue('PS_CONDITIONS') && (Tools::getValue('PS_CONDITIONS_CMS_ID') == 0 OR !Db::getInstance()->getValue($sql))) + if (Tools::getValue('PS_CONDITIONS') && (Tools::getValue('PS_CONDITIONS_CMS_ID') == 0 || !Db::getInstance()->getValue($sql))) $this->_errors[] = Tools::displayError('Assign a valid CMS page if you want it to be read.'); } @@ -178,39 +175,12 @@ class AdminPreferences extends AdminTab public function updateOptionPsAttachementMaximumSize($value) { if (!$value) - return ; + return; - $uploadMaxSize = (int)str_replace('M', '',ini_get('upload_max_filesize')); - $postMaxSize = (int)str_replace('M', '', ini_get('post_max_size')); - $maxSize = $uploadMaxSize < $postMaxSize ? $uploadMaxSize : $postMaxSize; - - Configuration::update('PS_ATTACHMENT_MAXIMUM_SIZE', ($maxSize < Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE')) ? $maxSize : Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE')); - } - - /** - * Display option IP maintenance - */ - public function displayOptionTypeMaintenanceIp($key, $field, $value) - { - echo ''; - - $this->displayOptionTypeText($key, $field, $value); - echo (isset($field['next']) ? ' '.strval($field['next']) : ''); - echo '  '.$this->l('Add my IP').''; - } - - public function displayBottomOptionCategory($category, $categoryData) - { - if (get_class($this) == 'AdminPreferences') - echo ''; + $upload_max_size = (int)str_replace('M', '', ini_get('upload_max_filesize')); + $post_max_size = (int)str_replace('M', '', ini_get('post_max_size')); + $max_size = $upload_max_size < $post_max_size ? $upload_max_size : $post_max_size; + $value = ($max_size < Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE')) ? $max_size : Tools::getValue('PS_ATTACHMENT_MAXIMUM_SIZE'); + Configuration::update('PS_ATTACHMENT_MAXIMUM_SIZE', $value); } }