From ced2e2f229149a23199c8ed65d5bc9e3f7323cc8 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Fri, 4 Nov 2011 21:49:02 +0000 Subject: [PATCH] // fix update form.tpl in AdminCountriesController git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9907 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/countries/form.tpl | 405 ++++-------------- .../themes/template/helper/form/form.tpl | 27 +- 2 files changed, 100 insertions(+), 332 deletions(-) diff --git a/admin-dev/themes/template/countries/form.tpl b/admin-dev/themes/template/countries/form.tpl index 50fa21b4c..b57d017d4 100644 --- a/admin-dev/themes/template/countries/form.tpl +++ b/admin-dev/themes/template/countries/form.tpl @@ -23,326 +23,91 @@ * @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 isset($input.label)} - - {/if} -
- {if $input.type == 'text'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- - {if isset($input.hint)}{$input.hint} {/if} -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} - {else} - - {if isset($input.hint)}{$input.hint} {/if} - {/if} - {elseif $input.type == 'hidden'} - - {elseif $input.type == 'select'} - - {if isset($input.hint)}{$input.hint} {/if} - {elseif $input.type == 'radio'} - {foreach $input.values as $value} - - - {if isset($input.br) && $input.br}
{/if} - {/foreach} - {elseif $input.type == 'textarea'} - {if isset($input.lang) && isset($input.attributeLang)} - {foreach $languages as $language} -
- -
- {/foreach} - {if count($languages) > 1} -
- -
-
- {l s='Choose language:'}

- {foreach $languages as $language} - {$language.name} - {/foreach} -
- {/if} - {else} - - {/if} - {elseif $input.type == 'checkbox'} - {foreach $input.values.query as $value} - {assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]} - -
- {/foreach} - {elseif $input.type == 'file'} - - - {elseif $input.type == 'group'} - {assign var=groups value=$input.values} - {include file='helper/form/form_group.tpl'} - {elseif $input.type == 'shop' OR $input.type == 'group_shop'} - {include file='helper/form/form_shop.tpl'} - {elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop} - -
- {$asso_shop} -
- {elseif $input.type == 'address_layout'} -
- -
-
- {l s='Liable fields for the address information (click to have more details):'} {$input.display_valid_fields} -
-
- - {/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 isset($languages)}
{/if} -
- {if $input.name == 'id_state'} -
- {/if} - {/foreach} - {elseif $key == 'submit'} -
- -
- {/if} - {/foreach} - {if $required_fields} -
* {l s ='Required field'}
+{block name="start_field_block"} +
+ {if $input.type == 'address_layout'} +
+ +
+
+ {l s='Liable fields for the address information (click to have more details):'} {$input.display_valid_fields} +
+
+
+ + {l s='Use the last registered layout'} + + {l s='Use a default layout'} + + {l s='Use my current modified layout'} + + {l s='Clean layout'} +
+
{/if} -
-
- +{/block} -

-{if $firstCall} - {if $back} - {l s='Back'} - {else} - {l s='Back to list'} - {/if} -
-{/if} +{block name=script} + + $(document).ready(function() { + + $('.availableFieldsList').css("display", "none"); + + $('.addPattern').click(function() { + addFieldsToCursorPosition($(this).attr("id")) + lastLayoutModified = $("#ordered_fields").val(); + }); + + $('#ordered_fields').keyup(function() { + lastLayoutModified = $(this).val(); + }); + + $('#useLastDefaultLayout').mouseover(function() { + switchExplanationText("{l s='Will display back your last registered layout'}"); + }); + + $('#useDefaultLayoutSystem').mouseover(function() { + switchExplanationText("{l s='Will display a default layout for this country'}"); + }); + + $('#useCurrentLastModifiedLayout').mouseover(function() { + switchExplanationText("{l s='Will display back you\'re current editing layout'}"); + }); + + $('#eraseCurrentLayout').mouseover(function() { + switchExplanationText("{l s='Will delete the current layout'}"); + }); + + $('#need_zip_code_on, #need_zip_code_off').change(function() { + disableZipFormat(); + }); + + }); + + function switchExplanationText(text) { + $("#explanationText").fadeOut("fast", function() { + $(this).html(text); + $(this).fadeIn("fast"); + }); + } + + function addFieldsToCursorPosition(pattern) { + $("#ordered_fields").replaceSelection(pattern + " "); + } + + function displayAvailableFields(containerName) { + $(".availableFieldsList").each( function () { + if ($(this).attr('id') != 'availableListFieldsFor_'+containerName) + $(this).slideUp(); + }); + $("#availableListFieldsFor_" + containerName).slideToggle(); + } + + function resetLayout(defaultLayout, type) { + if (confirm("{l s='Are you sure to apply this selection ?'}")) + $("#ordered_fields").val(unescape(defaultLayout.replace(/\+/g, " "))); + } + +{/block} diff --git a/admin-dev/themes/template/helper/form/form.tpl b/admin-dev/themes/template/helper/form/form.tpl index bd2d1caa3..e665fbf4a 100644 --- a/admin-dev/themes/template/helper/form/form.tpl +++ b/admin-dev/themes/template/helper/form/form.tpl @@ -59,24 +59,27 @@ }); }); - {block name="script"} - {/block} + {block name="script"}{/block} {/if} +
-
-{if $show_toolbar} - {include file="toolbar.tpl" toolbar_btn=$toolbar_btn} -
-

{block name=pageTitle} - {$title|default:' '} - {/block}

+
+ {if $show_toolbar} + {include file="toolbar.tpl" toolbar_btn=$toolbar_btn} +
+

+ {block name=pageTitle} + {$title|default:' '} + {/block} +

+
+ {/if} +
{block name="leadin"}{/block}
-{/if} -
{block name="leadin"}{/block}
-
+ {if isset($fields.title)}

{$fields.title}

{/if}
{if $form_id}