// Refactoring of admin options

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7922 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-08-05 15:52:45 +00:00
parent 4d2740eb35
commit 0811404de8
20 changed files with 338 additions and 234 deletions
+13 -7
View File
@@ -50,14 +50,20 @@ class AdminBackup extends AdminTab
'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'),
'age' => array('title' => $this->l('Age')),
'filename' => array('title' => $this->l('File name'), 'width' => 200),
'filesize' => array('title' => $this->l('File size')));
$this->optionTitle = $this->l('Backup options');
$this->_fieldsOptions = array(
'PS_BACKUP_ALL' => array('title' => $this->l('Ignore statistics tables:'),
'desc' => $this->l('The following tables will NOT be backed up if you enable this option:').'<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch', 'cast' => 'intval', 'type' => 'bool'),
'PS_BACKUP_DROP_TABLE' => array('title' => $this->l('Drop existing tables during import:'),
'desc' => $this->l('Select this option to instruct the backup file to drop your tables prior to restoring the backed up data').'<br />(ie. "DROP TABLE IF EXISTS")', 'cast' => 'intval', 'type' => 'bool'));
'filesize' => array('title' => $this->l('File size'))
);
$this->optionsList = array(
'general' => array(
'title' => $this->l('Backup options'),
'fields' => array(
'PS_BACKUP_ALL' => array('title' => $this->l('Ignore statistics tables:'),
'desc' => $this->l('The following tables will NOT be backed up if you enable this option:').'<br />'._DB_PREFIX_.'connections, '._DB_PREFIX_.'connections_page, '._DB_PREFIX_.'connections_source, '._DB_PREFIX_.'guest, '._DB_PREFIX_.'statssearch', 'cast' => 'intval', 'type' => 'bool'),
'PS_BACKUP_DROP_TABLE' => array('title' => $this->l('Drop existing tables during import:'),
'desc' => $this->l('Select this option to instruct the backup file to drop your tables prior to restoring the backed up data').'<br />(ie. "DROP TABLE IF EXISTS")', 'cast' => 'intval', 'type' => 'bool'),
),
),
);
$this->identifier = 'filename';
}
+7 -3
View File
@@ -50,9 +50,13 @@ class AdminCarriers extends AdminTab
'is_free' => array('title' => $this->l('Is Free'), 'align' => 'center', 'icon' => array(0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false)
);
$this->optionTitle = $this->l('Carrier options');
$this->_fieldsOptions = array(
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, Carrier::ALL_CARRIERS)),
$this->optionsList = array(
'general' => array(
'title' => $this->l('Carrier options'),
'fields' => array(
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, Carrier::ALL_CARRIERS)),
),
),
);
parent::__construct();
+13 -10
View File
@@ -43,16 +43,19 @@ class AdminContacts extends AdminTab
'email' => array('title' => $this->l('E-mail address'), 'width' => 130),
'description' => array('title' => $this->l('Description'), 'width' => 150),
);
$this->optionTitle = $this->l('Contact options');
$this->_fieldsOptions = array(
'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
'0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
)),
'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Pre-defined message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'cast' => 'pSQL', 'type' => 'textareaLang', 'identifier' => 'value',
'cols' => 40, 'rows' => 8
));
$this->optionsList = array(
'general' => array(
'title' => $this->l('Contact options'),
'fields' => array(
'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
'0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
)),
'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Pre-defined message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'cast' => 'pSQL', 'type' => 'textareaLang', 'identifier' => 'value', 'cols' => 40, 'rows' => 8),
),
),
);
parent::__construct();
}
+15 -10
View File
@@ -40,17 +40,22 @@ class AdminCountries extends AdminTab
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
$this->fieldsDisplay = array(
'id_country' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Country'), 'width' => 130, 'filter_key' => 'b!name'),
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
'call_prefix' => array('title' => $this->l('Call prefix'), 'width' => 40, 'align' => 'center', 'callback' => 'displayCallPrefix'),
'zone' => array('title' => $this->l('Zone'), 'width' => 100, 'filter_key' => 'z!name'),
'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'));
'id_country' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Country'), 'width' => 130, 'filter_key' => 'b!name'),
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
'call_prefix' => array('title' => $this->l('Call prefix'), 'width' => 40, 'align' => 'center', 'callback' => 'displayCallPrefix'),
'zone' => array('title' => $this->l('Zone'), 'width' => 100, 'filter_key' => 'z!name'),
'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'),
);
$this->optionTitle = $this->l('Countries options');
$this->_fieldsOptions = array(
'PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries(Context::getContext()->language->id)),
'PS_RESTRICT_DELIVERED_COUNTRIES' => array('title' => $this->l('Restrict countries in FO by those delivered by active carriers'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0')
$this->optionsList = array(
'general' => array(
'title' => $this->l('Countries options'),
'fields' => array(
'PS_COUNTRY_DEFAULT' => array('title' => $this->l('Default country:'), 'desc' => $this->l('The default country used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_country', 'list' => Country::getCountries(Context::getContext()->language->id)),
'PS_RESTRICT_DELIVERED_COUNTRIES' => array('title' => $this->l('Restrict countries in FO by those delivered by active carriers'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0')
),
),
);
parent::__construct();
+24 -23
View File
@@ -46,21 +46,25 @@ class AdminCurrencies extends AdminTab
'conversion_rate' => array('title' => $this->l('Conversion rate'), 'float' => true, 'align' => 'center', 'width' => 50, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
);
$this->optionTitle = $this->l('Currencies options');
$this->_fieldsOptions = array(
'PS_CURRENCY_DEFAULT' => array(
'title' => $this->l('Default currency:'),
'desc' => $this->l('The default currency used in shop')
.'<div class=warn"><img src="../img/admin/warn2.png" />'.$this->l('If you change default currency, you will have to manually edit every product price.').'</div>',
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_currency',
'list' => Currency::getCurrencies()
),
);
$this->_where = 'AND a.`deleted` = 0';
$this->optionsList = array(
'general' => array(
'title' => $this->l('Currencies options'),
'fields' => array(
'PS_CURRENCY_DEFAULT' => array(
'title' => $this->l('Default currency:'),
'desc' => $this->l('The default currency used in shop')
.'<div class=warn"><img src="../img/admin/warn2.png" />'.$this->l('If you change default currency, you will have to manually edit every product price.').'</div>',
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_currency',
'list' => Currency::getCurrencies()
),
),
),
);
parent::__construct();
}
@@ -104,16 +108,6 @@ class AdminCurrencies extends AdminTab
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
elseif (Tools::getValue('submitOptions'.$this->table))
{
foreach ($this->_fieldsOptions as $key => $field)
{
Configuration::updateValue($key, $field['cast'](Tools::getValue($key)));
if ($key == 'PS_CURRENCY_DEFAULT')
Currency::refreshCurrencies();
}
Tools::redirectAdmin(self::$currentIndex.'&conf=6'.'&token='.$this->token);
}
elseif (Tools::isSubmit('submitExchangesRates'))
{
if (!$this->_errors[] = Currency::refreshCurrencies())
@@ -122,10 +116,17 @@ class AdminCurrencies extends AdminTab
else
parent::postProcess();
}
public function updateOptionPsCurrencyDefault($value)
{
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
Currency::refreshCurrencies();
}
public function displayOptionsList()
{
parent::displayOptionsList();
echo '<br /><br />
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post">
<fieldset>
+20 -14
View File
@@ -47,23 +47,29 @@ class AdminCustomers extends AdminTab
) as connect';
$genders = array(1 => $this->l('M'), 2 => $this->l('F'), 9 => $this->l('?'));
$this->fieldsDisplay = array(
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'),
'lastname' => array('title' => $this->l('Last Name'), 'width' => 80),
'firstname' => array('title' => $this->l('First name'), 'width' => 60),
'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19),
'age' => array('title' => $this->l('Age'), 'width' => 30, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'newsletter' => array('title' => $this->l('News.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printNewsIcon', 'orderby' => false),
'optin' => array('title' => $this->l('Opt.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printOptinIcon', 'orderby' => false),
'date_add' => array('title' => $this->l('Registration'), 'width' => 30, 'type' => 'date', 'align' => 'right'),
'connect' => array('title' => $this->l('Connection'), 'width' => 60, 'type' => 'datetime', 'search' => false));
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'),
'lastname' => array('title' => $this->l('Last Name'), 'width' => 80),
'firstname' => array('title' => $this->l('First name'), 'width' => 60),
'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19),
'age' => array('title' => $this->l('Age'), 'width' => 30, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'newsletter' => array('title' => $this->l('News.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printNewsIcon', 'orderby' => false),
'optin' => array('title' => $this->l('Opt.'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'callback' => 'printOptinIcon', 'orderby' => false),
'date_add' => array('title' => $this->l('Registration'), 'width' => 30, 'type' => 'date', 'align' => 'right'),
'connect' => array('title' => $this->l('Connection'), 'width' => 60, 'type' => 'datetime', 'search' => false),
);
$this->shopLinkType = 'shop';
$this->shopShareDatas = true;
$this->optionTitle = $this->l('Customers options');
$this->_fieldsOptions = array(
'PS_PASSWD_TIME_FRONT' => array('title' => $this->l('Regenerate password:'), 'desc' => $this->l('Security minimum time to wait to regenerate the password'),'validation' => 'isUnsignedInt', 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'))
$this->optionsList = array(
'general' => array(
'title' => $this->l('Customers options'),
'fields' => array(
'PS_PASSWD_TIME_FRONT' => array('title' => $this->l('Regenerate password:'), 'desc' => $this->l('Security minimum time to wait to regenerate the password'),'validation' => 'isUnsignedInt', 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'))
),
),
);
parent::__construct();
+10 -5
View File
@@ -30,11 +30,15 @@ class AdminDeliverySlip extends AdminTab
public function __construct()
{
$this->table = 'delivery';
$this->optionTitle = $this->l('Delivery slips options');
$this->_fieldsOptions = array(
'PS_DELIVERY_PREFIX' => array('title' => $this->l('Delivery prefix:'), 'desc' => $this->l('Prefix used for delivery slips'), 'size' => 6, 'type' => 'textLang'),
'PS_DELIVERY_NUMBER' => array('title' => $this->l('Delivery number:'), 'desc' => $this->l('The next delivery slip will begin with this number, and then increase with each additional slip'), 'size' => 6, 'type' => 'text'),
$this->optionsList = array(
'general' => array(
'title' => $this->l('Delivery slips options'),
'fields' => array(
'PS_DELIVERY_PREFIX' => array('title' => $this->l('Delivery prefix:'), 'desc' => $this->l('Prefix used for delivery slips'), 'size' => 6, 'type' => 'textLang'),
'PS_DELIVERY_NUMBER' => array('title' => $this->l('Delivery number:'), 'desc' => $this->l('The next delivery slip will begin with this number, and then increase with each additional slip'), 'size' => 6, 'type' => 'text'),
),
),
);
parent::__construct();
@@ -71,6 +75,7 @@ class AdminDeliverySlip extends AdminTab
public function display()
{
$this->displayForm();
echo '<br />';
$this->displayOptionsList();
}
+9 -4
View File
@@ -59,11 +59,16 @@ class AdminDiscounts extends AdminTab
'date_to' => array('title' => $this->l('To'), 'width' => 60, 'type' => 'date', 'align' => 'right'),
'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
);
$this->optionTitle = $this->l('Discounts options');
$this->_fieldsOptions = array(
'PS_VOUCHERS' => array('title' => $this->l('Enable vouchers:'), 'desc' => $this->l('Allow the use of vouchers in shop'), 'cast' => 'intval', 'type' => 'bool'),
$this->optionsList = array(
'general' => array(
'title' => $this->l('Discounts options'),
'fields' => array(
'PS_VOUCHERS' => array('title' => $this->l('Enable vouchers:'), 'desc' => $this->l('Allow the use of vouchers in shop'), 'cast' => 'intval', 'type' => 'bool'),
),
),
);
parent::__construct();
}
+18 -13
View File
@@ -50,20 +50,25 @@ class AdminEmployees extends AdminTab
$this->profilesArray[$profile['name']] = $profile['name'];
$this->fieldsDisplay = array(
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
'firstname' => array('title' => $this->l('First name'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'),
'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'));
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
'firstname' => array('title' => $this->l('First name'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 180),
'profile' => array('title' => $this->l('Profile'), 'width' => 90, 'type' => 'select', 'select' => $this->profilesArray, 'filter_key' => 'pl!name'),
'active' => array('title' => $this->l('Can log in'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
);
$this->optionTitle = $this->l('Employees options');
$this->_fieldsOptions = array(
'PS_PASSWD_TIME_BACK' => array('title' => $this->l('Password regenerate:'), 'desc' => $this->l('Security minimum time to wait to regenerate a new password'), 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL),
'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array('title' => $this->l('Memorize form language:'), 'desc' => $this->l('Allow employees to save their own default form language'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
'0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
), 'visibility' => Shop::CONTEXT_ALL)
$this->optionsList = array(
'general' => array(
'title' => $this->l('Employees options'),
'fields' => array(
'PS_PASSWD_TIME_BACK' => array('title' => $this->l('Password regenerate:'), 'desc' => $this->l('Security minimum time to wait to regenerate a new password'), 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL),
'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array('title' => $this->l('Memorize form language:'), 'desc' => $this->l('Allow employees to save their own default form language'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
'0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
), 'visibility' => Shop::CONTEXT_ALL)
),
),
);
parent::__construct();
+15 -13
View File
@@ -31,11 +31,15 @@ class AdminInvoices extends AdminTab
{
$this->table = 'invoice';
$this->optionTitle = $this->l('Invoice options');
$this->_fieldsOptions = array(
'PS_INVOICE' => array('title' => $this->l('Enable invoices:'), 'desc' => $this->l('Select whether or not to activate invoices for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_INVOICE_PREFIX' => array('title' => $this->l('Invoice prefix:'), 'desc' => $this->l('Prefix used for invoices'), 'size' => 6, 'type' => 'textLang'),
'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval')
$this->optionsList = array(
'general' => array(
'title' => $this->l('Invoice options'),
'fields' => array(
'PS_INVOICE' => array('title' => $this->l('Enable invoices:'), 'desc' => $this->l('Select whether or not to activate invoices for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_INVOICE_PREFIX' => array('title' => $this->l('Invoice prefix:'), 'desc' => $this->l('Prefix used for invoices'), 'size' => 6, 'type' => 'textLang'),
'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval')
),
),
);
parent::__construct();
@@ -139,15 +143,13 @@ class AdminInvoices extends AdminTab
$this->_errors[] = $this->l('No invoice found for this status');
}
}
elseif (Tools::isSubmit('submitOptionsinvoice'))
{
if ((int)(Tools::getValue('PS_INVOICE_START_NUMBER')) != 0 AND (int)(Tools::getValue('PS_INVOICE_START_NUMBER')) <= Order::getLastInvoiceNumber())
$this->_errors[] = $this->l('Invalid invoice number (must be > ').Order::getLastInvoiceNumber() .')';
else
parent::postProcess();
}
else
parent::postProcess();
}
public function beforeUpdateOptions()
{
if ((int)Tools::getValue('PS_INVOICE_START_NUMBER') != 0 AND (int)Tools::getValue('PS_INVOICE_START_NUMBER') <= Order::getLastInvoiceNumber())
$this->_errors[] = $this->l('Invalid invoice number (must be > ').Order::getLastInvoiceNumber() .')';
}
}
+16 -13
View File
@@ -45,12 +45,16 @@ class AdminLanguages extends AdminTab
'language_code' => array('title' => $this->l('Language code'), 'width' => 70, 'align' => 'center'),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
);
$this->optionTitle = $this->l('Languages options');
$this->_fieldsOptions = array(
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
);
$this->optionsList = array(
'general' => array(
'title' => $this->l('Languages options'),
'fields' => array(
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
),
),
);
parent::__construct();
}
@@ -229,18 +233,17 @@ class AdminLanguages extends AdminTab
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
elseif (Tools::isSubmit('submitOptions'.$this->table))
{
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!$lang->active)
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
else
return parent::postProcess();
}
else
return parent::postProcess();
}
public function beforeUpdateOptions()
{
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!$lang->active)
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
}
public function displayList()
{
$this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.'));
+27 -23
View File
@@ -47,16 +47,20 @@ class AdminLogs extends AdminTab
'object_id' => array('title' => $this->l('Object ID'), 'width' => 50),
'error_code' => array('title' => $this->l('Error code'), 'width' => 75, 'prefix' => '0x'),
'date_add' => array('title' => $this->l('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime'));
$this->optionTitle = $this->l('Logs by e-mail');
$this->_fieldsOptions = array(
'PS_LOGS_BY_EMAIL' => array(
'title' => $this->l('Minimum severity level:'),
'desc' => $this->l('Put "5" if you don\'t want to receive any emails.').'<br />'.$this->l('Emails will be sent to the shop owner.'),
'cast' => 'intval',
'type' => 'text',
'size' => 5
)
$this->optionsList = array(
'general' => array(
'title' => $this->l('Logs by e-mail'),
'fields' => array(
'PS_LOGS_BY_EMAIL' => array(
'title' => $this->l('Minimum severity level:'),
'desc' => $this->l('Put "5" if you don\'t want to receive any emails.').'<br />'.$this->l('Emails will be sent to the shop owner.'),
'cast' => 'intval',
'type' => 'text',
'size' => 5
),
),
),
);
parent::__construct();
@@ -64,19 +68,19 @@ class AdminLogs extends AdminTab
public function displayListHeader($token = NULL)
{
echo '
<fieldset>
<legend>'.$this->l('Severity levels').'</legend>
<p>'.$this->l('Here\'s the meaning of severity levels:').'</p>
<ol>
<li style="color: green;">'.$this->l('Informative only').'</li>
<li style="color: orange;">'.$this->l('Warning').'</li>
<li style="color: orange;">'.$this->l('Error').'</li>
<li style="color: red;">'.$this->l('Major issue (crash)').'</li>
</ol>
</fieldset>';
parent::displayListHeader();
echo '
<fieldset>
<legend>'.$this->l('Severity levels').'</legend>
<p>'.$this->l('Here\'s the meaning of severity levels:').'</p>
<ol>
<li style="color: green;">'.$this->l('Informative only').'</li>
<li style="color: orange;">'.$this->l('Warning').'</li>
<li style="color: orange;">'.$this->l('Error').'</li>
<li style="color: red;">'.$this->l('Major issue (crash)').'</li>
</ol>
</fieldset>';
parent::displayListHeader();
}
}
+18 -36
View File
@@ -44,15 +44,23 @@ class AdminMeta extends AdminTab
'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120)
);
$this->_group = 'GROUP BY a.id_meta';
$this->optionTitle = $this->l('URLs Setup');
$this->_fieldsOptions = array(
'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'<p class="hint clear" style="display: block;">'.$this->l('If you turn on this feature, you must').' <a href="?tab=AdminGenerator&token='.Tools::getAdminToken('AdminGenerator'.(int)(Tab::getIdFromClassName('AdminGenerator')).(int)$this->context->employee->id).'">'.$this->l('generate a .htaccess file').'</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
$this->optionsList = array(
'general' => array(
'title' => $this->l('URLs Setup'),
'fields' => array(
'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)').'<p class="hint clear" style="display: block;">'.$this->l('If you turn on this feature, you must').' <a href="?tab=AdminGenerator&token='.Tools::getAdminToken('AdminGenerator'.(int)(Tab::getIdFromClassName('AdminGenerator')).(int)$this->context->employee->id).'">'.$this->l('generate a .htaccess file').'</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
),
),
'routes' => array(
'title' => $this->l('Schema of URLs'),
'description' => $this->l('You can change here the pattern of your links. There are some available keywords for each route listed below, keywords with * are required. To add a keyword in URL use {keyword} syntax. You can add some text before or after the keyword IF the keyword is not empty with syntax {prepend:keyword:append}, for example {-hey-:meta_title} will add "-hey-my-title" in URL if meta title is set, or nothing. Friendly URL and rewriting Apache option must be activated on your web server to use this functionality.'),
'fields' => array(),
),
);
// Display route options only if friendly URL is activated
$this->_fieldsRoutes = array();
if (Configuration::get('PS_REWRITING_SETTINGS'))
{
$this->addFieldRoute('product_rule', $this->l('Route to products'));
@@ -70,7 +78,7 @@ class AdminMeta extends AdminTab
foreach (Dispatcher::getInstance()->defaultRoutes[$routeID]['keywords'] as $keyword => $data)
$keywords[] = ((isset($data['param'])) ? '<span class="red">'.$keyword.'*</span>' : $keyword);
$this->_fieldsRoutes['PS_ROUTE_'.$routeID] = array(
$this->optionsList['routes']['fields']['PS_ROUTE_'.$routeID] = array(
'title' => $title,
'desc' => sprintf($this->l('Keywords: %s'), implode(', ', $keywords)),
'validation' => 'isString',
@@ -79,34 +87,7 @@ class AdminMeta extends AdminTab
'defaultValue' => Dispatcher::getInstance()->defaultRoutes[$routeID]['rule'],
);
}
protected function updateOptions($token)
{
if ($this->tabAccess['edit'] === '1')
{
$this->submitConfiguration($this->_fieldsRoutes);
parent::updateOptions($token);
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
public function displayOptionsList($fieldsOptions = null, $optionTitle = null, $optionDescription = null)
{
// Desactivate <form>, we want to add our own tags
$this->formOptions = false;
$tab = Tab::getTab($this->context->language->id, $this->id);
echo '<form action="'.self::$currentIndex.'" id="'.$tab['name'].'" name="'.$tab['name'].'" method="post">';
parent::displayOptionsList();
if ($this->_fieldsRoutes)
{
$desc = $this->l('You can change here the pattern of your links. There are some available keywords for each route listed below, keywords with * are required. To add a keyword in URL use {keyword} syntax. You can add some text before or after the keyword IF the keyword is not empty with syntax {prepend:keyword:append}, for example {-hey-:meta_title} will add "-hey-my-title" in URL if meta title is set, or nothing. Friendly URL and rewriting Apache option must be activated on your web server to use this functionality.');
parent::displayOptionsList($this->_fieldsRoutes, $this->l('Schema of URLs'), $desc);
}
echo '</form>';
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
@@ -210,11 +191,13 @@ class AdminMeta extends AdminTab
$defaultLangIsValidated = !Tools::getValue('url_rewrite_'.$default_language) OR Validate::isLinkRewrite(Tools::getValue('url_rewrite_'.$default_language));
$englishLangIsValidated = !Tools::getValue('url_rewrite_1') OR Validate::isLinkRewrite(Tools::getValue('url_rewrite_1'));
}
if (!$defaultLangIsValidated AND !$englishLangIsValidated)
{
$this->_errors[] = Tools::displayError('Url rewrite field must be filled at least in default or english language.');
return false;
}
foreach ($langs as $lang)
{
$current = Tools::getValue('url_rewrite_'.$lang['id_lang']);
@@ -225,9 +208,8 @@ class AdminMeta extends AdminTab
else
$_POST['url_rewrite_'.$lang['id_lang']] = Tools::getValue('url_rewrite_1');
}
}
if (Tools::isSubmit('submitOptions'.$this->table) OR Tools::isSubmit('submitAddmeta'))
Module::hookExec('afterSaveAdminMeta');
}
return parent::postProcess();
}
+13 -10
View File
@@ -37,15 +37,20 @@ class AdminReturn extends AdminTab
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = '.(int)$this->context->language->id.')';
$this->fieldsDisplay = array(
'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_order' => array('title' => $this->l('Order ID'), 'width' => 75, 'align' => 'center'),
'name' => array('title' => $this->l('Status'), 'width' => 150, 'align' => 'center'),
'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right'));
'id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_order' => array('title' => $this->l('Order ID'), 'width' => 75, 'align' => 'center'),
'name' => array('title' => $this->l('Status'), 'width' => 150, 'align' => 'center'),
'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right'),
);
$this->optionTitle = $this->l('Merchandise return (RMA) options');
$this->_fieldsOptions = array(
'PS_ORDER_RETURN' => array('title' => $this->l('Enable returns:'), 'desc' => $this->l('Select whether or not to activate merchandise return for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_ORDER_RETURN_NB_DAYS' => array('title' => $this->l('Time limit of validity:'), 'desc' => $this->l('Number of days the customer can make a return after the delivery date'), 'cast' => 'intval', 'type' => 'text', 'size' => '2'),
$this->optionsList = array(
'general' => array(
'title' => $this->l('Merchandise return (RMA) options'),
'fields' => array(
'PS_ORDER_RETURN' => array('title' => $this->l('Enable returns:'), 'desc' => $this->l('Select whether or not to activate merchandise return for your shop'), 'cast' => 'intval', 'type' => 'bool'),
'PS_ORDER_RETURN_NB_DAYS' => array('title' => $this->l('Time limit of validity:'), 'desc' => $this->l('Number of days the customer can make a return after the delivery date'), 'cast' => 'intval', 'type' => 'text', 'size' => '2'),
),
),
);
parent::__construct();
@@ -281,5 +286,3 @@ class AdminReturn extends AdminTab
</form>';
}
}
+9 -4
View File
@@ -49,10 +49,15 @@ class AdminShop extends AdminTab
'category_name' => array('title' => $this->l('Category Root'), 'width' => 70),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'),
);
$this->optionTitle = $this->l('Shops options');
$this->_fieldsOptions = array('PS_SHOP_DEFAULT' => array('title' => $this->l('Default shop:'), 'desc' => $this->l('The default shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_shop', 'list' => Shop::getShops(), 'visibility' => Shop::CONTEXT_ALL));
$this->optionsList = array(
'general' => array(
'title' => $this->l('Shops options'),
'fields' => array(
'PS_SHOP_DEFAULT' => array('title' => $this->l('Default shop:'), 'desc' => $this->l('The default shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_shop', 'list' => Shop::getShops(), 'visibility' => Shop::CONTEXT_ALL)
),
),
);
parent::__construct();
}
+21 -12
View File
@@ -37,12 +37,12 @@ class AdminStockMvt extends AdminTab
$this->view = true;
$this->fieldsDisplay = array(
'id_stock_mvt' => array('title' => $this->l('ID'), 'width' => 40),
'product_name' => array('title' => $this->l('Product Name'), 'width' => 250, 'havingFilter' => true),
'quantity' => array('title' => $this->l('Quantity'), 'width' => 40),
'reason' => array('title' => $this->l('Reason'), 'width' => 250),
'id_order' => array('title' => $this->l('ID Order'), 'width' => 40),
'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'havingFilter' => true),
'id_stock_mvt' => array('title' => $this->l('ID'), 'width' => 40),
'product_name' => array('title' => $this->l('Product Name'), 'width' => 250, 'havingFilter' => true),
'quantity' => array('title' => $this->l('Quantity'), 'width' => 40),
'reason' => array('title' => $this->l('Reason'), 'width' => 250),
'id_order' => array('title' => $this->l('ID Order'), 'width' => 40),
'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'havingFilter' => true),
);
@@ -177,12 +177,21 @@ class AdminStockMvt extends AdminTab
'name' => array('title' => $this->l('Name'), 'width' => 500));
$reasons = StockMvtReason::getStockMvtReasons($this->context->language->id);
$this->_fieldsOptions = array('PS_STOCK_MVT_REASON_DEFAULT' => array('title' => $this->l('Default Stock Movement reason:'),
'cast' => 'intval',
'type' => 'select',
'list' => $reasons,
'identifier' => 'id_stock_mvt_reason'));
$this->optionsList = array(
'general' => array(
'title' => $this->l('Options'),
'fields' => array(
'PS_STOCK_MVT_REASON_DEFAULT' => array(
'title' => $this->l('Default Stock Movement reason:'),
'cast' => 'intval',
'type' => 'select',
'list' => $reasons,
'identifier' => 'id_stock_mvt_reason'
),
),
),
);
unset($this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
echo '<h2>'.$this->l('Stock movement reason').'</h2>';
+13 -9
View File
@@ -63,15 +63,19 @@ class AdminStores extends AdminTab
'fax' => array('title' => $this->l('Fax'), 'width' => 70),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
);
$this->optionTitle = $this->l('Parameters');
$this->_fieldsOptions = array(
'PS_STORES_DISPLAY_FOOTER' => array('title' => $this->l('Display in the footer:'), 'desc' => $this->l('Display a link to the store locator in the footer'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_DISPLAY_SITEMAP' => array('title' => $this->l('Display in the sitemap page:'), 'desc' => $this->l('Display a link to the store locator in the sitemap page'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_SIMPLIFIED' => array('title' => $this->l('Show a simplified store locator:'), 'desc' => $this->l('No map, no search, only a store directory'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_CENTER_LAT' => array('title' => $this->l('Latitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'float', 'size' => '10'),
'PS_STORES_CENTER_LONG' => array('title' => $this->l('Longitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'float', 'size' => '10'));
$this->optionsList = array(
'general' => array(
'title' => $this->l('Parameters'),
'fields' => array(
'PS_STORES_DISPLAY_FOOTER' => array('title' => $this->l('Display in the footer:'), 'desc' => $this->l('Display a link to the store locator in the footer'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_DISPLAY_SITEMAP' => array('title' => $this->l('Display in the sitemap page:'), 'desc' => $this->l('Display a link to the store locator in the sitemap page'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_SIMPLIFIED' => array('title' => $this->l('Show a simplified store locator:'), 'desc' => $this->l('No map, no search, only a store directory'), 'cast' => 'intval', 'type' => 'bool'),
'PS_STORES_CENTER_LAT' => array('title' => $this->l('Latitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'text', 'size' => '10'),
'PS_STORES_CENTER_LONG' => array('title' => $this->l('Longitude by default:'), 'desc' => $this->l('Used for the position by default of the map'), 'cast' => 'floatval', 'type' => 'text', 'size' => '10')
),
),
);
parent::__construct();
}
+14 -11
View File
@@ -45,17 +45,21 @@ class AdminTaxes extends AdminTab
if (Configuration::get('PS_USE_ECOTAX'))
$ecotax_desc = $this->l('If you disable the ecotax, the ecotax for all your products will be set to 0');
$this->optionTitle = $this->l('Tax options');
$this->_fieldsOptions = array(
'PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'),
'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
$this->optionsList = array(
'general' => array(
'title' => $this->l('Tax options'),
'fields' => array(
'PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'),
'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
),
),
);
if (Configuration::get('PS_USE_ECOTAX'))
$this->_fieldsOptions['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g., French ecotax: 19.6%).'),
'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions());
$this->optionsList['general']['fields']['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g., French ecotax: 19.6%).'),
'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions());
parent::__construct();
}
@@ -106,7 +110,7 @@ class AdminTaxes extends AdminTab
public function postProcess()
{
if(Tools::getValue('submitAdd'.$this->table))
if (Tools::getValue('submitAdd'.$this->table))
{
/* Checking fields validity */
$this->validateRules();
@@ -196,7 +200,6 @@ class AdminTaxes extends AdminTab
Product::resetEcoTax();
Configuration::updateValue('PS_USE_ECOTAX', (int)$value);
}
}
}
}
+23 -13
View File
@@ -40,28 +40,37 @@ class AdminWebservice extends AdminTab
$this->id_lang_default = Configuration::get('PS_LANG_DEFAULT');
$this->fieldsDisplay = array(
'key' => array('title' => $this->l('Key'), 'align' => 'center', 'width' => 32),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'description' => array('title' => $this->l('Key description'), 'align' => 'center', 'orderby' => false)
'key' => array('title' => $this->l('Key'), 'align' => 'center', 'width' => 32),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'description' => array('title' => $this->l('Key description'), 'align' => 'center', 'orderby' => false)
);
$this->optionTitle = $this->l('Configuration');
if (file_exists(_PS_ROOT_DIR_.'/.htaccess'))
$this->_fieldsOptions = array('PS_WEBSERVICE' => array('title' => $this->l('Enable PrestaShop Webservice:'),
'desc' => $this->l('Before activating the webservice, you must be sure to: ').
'<ol><li>'.$this->l('be certain URL rewrite is available on this server').
'</li><li>'.$this->l('be certain that the 5 methods GET, POST, PUT, DELETE and HEAD are supported by this server').
'</li></ol>',
'cast' => 'intval',
'type' => 'bool'));
$this->optionsList = array(
'general' => array(
'title' => $this->l('Configuration'),
'fields' => array(
'PS_WEBSERVICE' => array('title' => $this->l('Enable PrestaShop Webservice:'),
'desc' => $this->l('Before activating the webservice, you must be sure to: ').
'<ol><li>'.$this->l('be certain URL rewrite is available on this server').
'</li><li>'.$this->l('be certain that the 5 methods GET, POST, PUT, DELETE and HEAD are supported by this server').
'</li></ol>',
'cast' => 'intval',
'type' => 'bool'),
),
),
);
parent::__construct();
}
protected function afterAdd($object) {
protected function afterAdd($object)
{
WebserviceKey::setPermissionForAccount($object->id, Tools::getValue('resources', array()));
}
protected function afterUpdate($object) {
protected function afterUpdate($object)
{
WebserviceKey::setPermissionForAccount($object->id, Tools::getValue('resources', array()));
}
@@ -223,6 +232,7 @@ echo '
</fieldset>
</form>';
}
public function postProcess()
{
if (Tools::getValue('key') && strlen(Tools::getValue('key')) < 32)
+40 -1
View File
@@ -156,6 +156,12 @@ abstract class AdminTabCore
protected $formOptions = true;
public $_fieldsOptions = array();
/**
* @since 1.5.0
* @var array
*/
public $optionsList = array();
protected $_languages = NULL;
protected $_defaultFormLanguage = NULL;
@@ -285,6 +291,7 @@ abstract class AdminTabCore
{
$this->getList($this->context->language->id);
$this->displayList();
echo '<br />';
$this->displayOptionsList();
$this->displayRequiredFields();
$this->includeSubTab('display');
@@ -1773,10 +1780,25 @@ abstract class AdminTabCore
{
$tab = Tab::getTab($this->context->language->id, $this->id);
// Retrocompatibility < 1.5.0
if (!$this->optionsList && $this->_fieldsOptions)
{
$this->optionsList = array(
'options' => array(
'title' => ($this->optionTitle) ? $this->optionTitle : $this->l('Options'),
'fields' => $this->_fieldsOptions,
),
);
}
if (!$this->optionsList)
return ;
echo '<br />';
echo '<script type="text/javascript">
id_language = Number('.$this->context->language->id.');
</script>';
echo '<form action="'.self::$currentIndex.'&submitOptions'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">';
foreach ($this->optionsList as $category => $categoryData)
{
@@ -2013,6 +2035,23 @@ abstract class AdminTabCore
$this->displayFlags($languages, $this->context->language->id, $key, $key);
}
/**
* Type = TextareaLang
*/
public function displayOptionTypeTextareaLang($key, $field, $value)
{
$languages = Language::getLanguages(false);
foreach ($languages as $language)
{
$value = Configuration::get($key, $language['id_lang']);
echo '<div id="'.$key.'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->context->language->id ? 'block' : 'none').'; float: left;">';
echo '<textarea rows="'.(int)($field['rows']).'" cols="'.(int)($field['cols']).'" name="'.$key.'_'.$language['id_lang'].'">'.str_replace('\r\n', "\n", $value).'</textarea>';
echo '</div>';
}
$this->displayFlags($languages, $this->context->language->id, $key, $key);
echo '<br style="clear:both">';
}
/**
* Type = selectLang
*/