diff --git a/admin-dev/themes/template/adminShopUrl.tpl b/admin-dev/themes/template/adminShopUrl.tpl deleted file mode 100644 index bbe05ff5c..000000000 --- a/admin-dev/themes/template/adminShopUrl.tpl +++ /dev/null @@ -1,142 +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 -* @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)} - - - -
- {if $tab_form['id']}{/if} -
- {l s ='Shop Url'} - -
- -
- -
- -
- -
- -

{l s ='Physical folder of your store on your server. Leave this field empty if your store is installed on root path.'}

-
- -
- -

{l s ='This virtual folder must not exist on your server and is used to associate an URI to a shop.'}
{l s ='URL rewriting must be activated on your server to use this feature.'}

-
- -
- -
- -
- -
- -
- - - - -

{l s ='If you set this url as main url for selected shop, all urls set to this shop will be redirected to this url (you can only have one main url per shop).'}

-

{l s ='Since the selected shop has no main url, you have to set this url as main'}

-

{l s ='The selected shop has already a main url, if you set this one as main url, the older one will be set as normal url'}

-
- -
- - - - -

{l s ='Enable or disable URL'}

-
-
- -
-
* {l s ='Required field'}
-
-
- -{/if} - -{$content} \ No newline at end of file diff --git a/admin-dev/themes/template/form.tpl b/admin-dev/themes/template/form.tpl index 5b74d9903..589389234 100644 --- a/admin-dev/themes/template/form.tpl +++ b/admin-dev/themes/template/form.tpl @@ -51,9 +51,6 @@ } {/literal} {rdelim}); - {if isset($script)} - {$script} - {/if} {/if} diff --git a/admin-dev/themes/template/shop_url/form.tpl b/admin-dev/themes/template/shop_url/form.tpl new file mode 100644 index 000000000..bc1bb603b --- /dev/null +++ b/admin-dev/themes/template/shop_url/form.tpl @@ -0,0 +1,223 @@ +{* +* 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: 8897 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{* +* 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: 8971 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{if $firstCall} + + +{/if} + +
+ {if $form_id} + + {/if} +
+ {foreach $fields as $key => $field} + {if $key == 'legend'} + + {if isset($field.image)}{$field.title}{/if} + {$field.title} + + {elseif $key == 'input'} + {foreach $field as $input} + {if $input.name == 'id_state'} +
+ {/if} + +
+ {if $input.type == 'text'} + + {elseif $input.type == 'select'} + + {elseif $input.type == 'radio'} + {foreach $input.values as $value} + + + {/foreach} + {elseif $input.type == 'textarea'} + + {elseif $input.type == 'checkbox'} + + {/if} + {if isset($input.required) && $input.required} *{/if} + {if isset($input.p)} +

+ {if is_array($input.p)} + {foreach $input.p as $p} + {if is_array($p)} + {$p.text}
+ {else} + {$p}
+ {/if} + {/foreach} + {else} + {$input.p} + {/if} +

+ {/if} +
+ {if $input.name == 'id_state'} +
+ {/if} + {/foreach} + {elseif $key == 'submit'} +
+ +
+ {/if} + {/foreach} + {if $requiredFields} +
* {l s ='Required field'}
+ {/if} +
+
+ +

+{if $firstCall} + {if $back} + {l s='Back'} + {else} + {l s='Back to list'} + {/if} +
+{/if} \ No newline at end of file diff --git a/classes/HelperForm.php b/classes/HelperForm.php index 72246de73..76405339c 100644 --- a/classes/HelperForm.php +++ b/classes/HelperForm.php @@ -58,28 +58,29 @@ class HelperFormCore extends Helper public function displayForm() { - $allowEmployeeFormLang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; - if ($allowEmployeeFormLang && !$this->context->cookie->employee_form_lang) - $this->context->cookie->employee_form_lang = (int)(Configuration::get('PS_LANG_DEFAULT')); - $useLangFromCookie = false; + $cookie = $this->context->cookie; + $allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + if ($allow_employee_form_lang && !$cookie->employee_form_lang) + $cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT'); + $use_lang_from_cookie = false; $languages = Language::getLanguages(false); - if ($allowEmployeeFormLang) + if ($allow_employee_form_lang) foreach ($languages as $lang) - if ($this->context->cookie->employee_form_lang == $lang['id_lang']) - $useLangFromCookie = true; - if (!$useLangFromCookie) - $defaultFormLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); + if ($cookie->employee_form_lang == $lang['id_lang']) + $use_lang_from_cookie = true; + if (!$use_lang_from_cookie) + $default_form_language = (int)Configuration::get('PS_LANG_DEFAULT'); else - $defaultFormLanguage = (int)($this->context->cookie->employee_form_lang); + $default_form_language = (int)$cookie->employee_form_lang; $this->context->smarty->assign(array( 'firstCall' => $this->first_call, 'current' => self::$currentIndex, 'token' => $this->token, 'table' => $this->table, - 'defaultFormLanguage' => $defaultFormLanguage, + 'defaultFormLanguage' => $default_form_language, 'languages' => $languages, - 'allowEmployeeFormLang' => $allowEmployeeFormLang, + 'allowEmployeeFormLang' => $allow_employee_form_lang, 'form_id' => $this->id, 'back' => Tools::getValue('back'), 'fields' => $this->fields_form, @@ -95,9 +96,10 @@ class HelperFormCore extends Helper public function getFieldsRequired() { - foreach ($this->fields_form['input'] as $input) - if (array_key_exists('required', $input) && $input['required']) - return true; + if (isset($this->fields_form['input'])) + foreach ($this->fields_form['input'] as $input) + if (array_key_exists('required', $input) && $input['required']) + return true; return false; } diff --git a/controllers/admin/AdminShopUrlController.php b/controllers/admin/AdminShopUrlController.php index 491f0ea92..0a5e76d21 100644 --- a/controllers/admin/AdminShopUrlController.php +++ b/controllers/admin/AdminShopUrlController.php @@ -234,9 +234,7 @@ class AdminShopUrlControllerCore extends AdminController foreach (Shop::getShops(false, null, true) as $id) $list_shop_with_url[$id] = (bool)count(ShopUrl::getShopUrls($id)); - $smarty = $this->context->smarty; - $smarty->assign('jsShopUrl', Tools::jsonEncode($list_shop_with_url)); - $smarty->assign('script', $smarty->fetch($smarty->template_dir.'/'.$this->tpl_folder.'script.tpl')); + $this->context->smarty->assign('jsShopUrl', Tools::jsonEncode($list_shop_with_url)); $this->fields_value = array( 'domain' => Validate::isLoadedObject($obj) ? $this->getFieldValue($obj, 'domain') : $current_shop->domain,