// fix update form.tpl in AdminGroupShopController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9910 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-06 12:28:54 +00:00
parent f0fe2c860a
commit b9c0cebc09
4 changed files with 113 additions and 266 deletions
+1 -1
View File
@@ -170,4 +170,4 @@ form.defaultForm{ background-color:#ebedf4; border:1px solid #ccced7; min-heig
/*FOOTER*/
#footer {height:40px;background:#ECEADE url(footer-bg.png) repeat-x scroll left bottom;border:1px solid #999999;font-size:12px;clear:both;font-size:0.9em;color:#666666}
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;}
div.fix-toolbar {border-bottom: 1px solid #E0E0E0;position:fixed;top:0;opacity:0.9;z-index:1;}
+103 -162
View File
@@ -1,162 +1,103 @@
{*
* 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 <contact@prestashop.com>
* @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}
<script type="text/javascript">
var vat_number = {$vat_number};
var module_dir = '{$module_dir}';
$(document).ready(function() {ldelim}
var id_language = {$defaultFormLanguage};
var languages = new Array();
{foreach $languages as $k => $language}
languages[{$k}] = {ldelim}
id_lang: {$language.id_lang},
iso_code: '{$language.iso_code}',
name: '{$language.name}'
{rdelim};
{/foreach}
displayFlags(languages, id_language, {$allowEmployeeFormLang});
$('input[name=share_order]').attr('disabled', true);
$('input[name=share_customer]').click(function()
{
var disabled = ($('input[name=share_customer]').attr('checked')) ? false : true;
$('input[name=share_order]').attr('disabled', disabled);
if (disabled)
$('#share_order_off').attr('checked', true);
});
$('#useImportData').click(function() {
$('#importList').slideToggle('slow');
});
{rdelim});
</script>
<script type="text/javascript" src="../js/form.js"></script>
{/if}
<form action="{$current}&submitAdd{$table}=1&token={$token}" method="post">
{if $form_id}
<input type="hidden" name="id_{$table}" value="{$form_id}" />
{/if}
<fieldset>
{foreach $fields as $key => $field}
{if $key == 'legend'}
<legend>
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
{$field.title}
</legend>
<div class="hint" name="help_box" style="display:block;">{l s ='You can\'t edit GroupShop when you have more than one Shop'}</div><br />
{elseif $key == 'input'}
{foreach $field as $input}
{if $input.name == 'id_state'}
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
{/if}
<label>{$input.label} </label>
<div class="margin-form">
{if $input.type == 'text'}
<input type="text"
name="{$input.name}"
id="{$input.name}"
value="{$fields_value[$input.name]}"
{if isset($input.size)}size="{$input.size}"{/if}
{if isset($input.maxlength)}maxlength="{$input.maxlength}"{/if}
{if isset($input.class)}class="{$input.class}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if} />
{elseif $input.type == 'select'}
<select name="{$input.name}" id="{$input.name}" {if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
{if isset($input.options.optiongroup)}
{foreach $input.options.optiongroup.query AS $optiongroup}
<optgroup label="{$optiongroup[$input.options.optiongroup.label]}">
{foreach $optiongroup[$input.options.options.query] as $option}
<option value="{$option[$input.options.options.id]}"
{if $fields_value[$input.name] == $option[$input.options.options.id]}selected="selected"{/if}>{$option[$input.options.options.name]}</option>
{/foreach}
</optgroup>
{/foreach}
{else}
{foreach $input.options.query AS $option}
<option value="{$option[$input.options.id]}"
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}>{$option[$input.options.name]}</option>
{/foreach}
{/if}
</select>
{elseif $input.type == 'radio'}
{foreach $input.values as $value}
<input type="radio"
name="{$input.name}"
id="{$value.id}"
value="{$value.value}"
{if $disabled[$input.name]}disabled="disabled"{/if}
{if $fields_value[$input.name] == $value.value}checked="checked"{/if} />
<label {if isset($input.class)}class="{$input.class}"{/if} for="{$value.id}">
{if isset($input.is_bool) && $input.is_bool == true}
{if $value.value == 1}
<img src="../img/admin/enabled.gif" alt="{$value.label}" title="{$value.label}" />
{else}
<img src="../img/admin/disabled.gif" alt="{$value.label}" title="{$value.label}" />
{/if}
{else}
{$value.label}
{/if}
</label>
{/foreach}
{elseif $input.type == 'textarea'}
<textarea name="{$input.name}" id="{$input.name}" cols="{$input.cols}" rows="{$input.rows}">{$fields_value[$input.name]}</textarea>
{elseif $input.type == 'checkbox'}
{/if}
{if isset($input.required) && $input.required} <sup>*</sup>{/if}
{if isset($input.p)}
<p class="clear">
{if is_array($input.p)}
{foreach $input.p as $p}
{if is_array($p)}
<span id="{$p.id}">{$p.text}</span><br />
{else}
{$p}<br />
{/if}
{/foreach}
{else}
{$input.p}
{/if}
</p>
{/if}
</div>
{if $input.name == 'id_state'}
</div>
{/if}
{/foreach}
{elseif $key == 'submit'}
<div class="margin-form">
<input type="submit" value="{$field.title}" name="submitAdd{$table}" {if isset($field.class)}class="{$field.class}"{/if} />
</div>
{/if}
{/foreach}
{if $required_fields}
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
{/if}
</fieldset>
{*
* 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 <contact@prestashop.com>
* @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
*}
{extends file="helper/form/form.tpl"}
{block name=script}
$(document).ready(function() {
$('input[name=share_order]').attr('disabled', true);
$('input[name=share_customer]').click(function()
{
var disabled = ($('input[name=share_customer]').attr('checked')) ? false : true;
$('input[name=share_order]').attr('disabled', disabled);
if (disabled)
$('#share_order_off').attr('checked', true);
});
$('#useImportData').click(function() {
$('#importList').slideToggle('slow');
});
});
{/block}
{block name="label"}
{if $input.type == 'text' && $input.name == 'name'}
<div class="hint" name="help_box" style="display:block;">{l s ='You can\'t edit GroupShop when you have more than one Shop'}</div><br />
{/if}
{if isset($input.label)}
<label>{$input.label} </label>
{/if}
{/block}
{block name="other_fieldsets"}
{if isset($form_import)}
<br /><br />
<fieldset>
{foreach $form_import as $key => $field}
{if $key == 'legend'}
<legend>
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
{$field.title}
</legend>
{elseif $key == 'label'}
<label>{$field}</label>
{/if}
<div class="clear"></div>
{if $key == 'checkbox'}
<div class="margin-form">
<label><input type="{$field.type}" value="{$field.value}" name="{$field.name}" id="{$field.name}" {if $checked} checked="checked"{/if}/> {$field.label}</label>
{elseif $key == 'select'}
<select name="{$field.name}" id="{$field.name}">
{foreach $field.options.query AS $key => $option}
<option value="{$key}" {if $key == $defaultGroup}selected="selected"{/if}>
{$option.name}
</option>
{/foreach}
</select>
{elseif $key == 'allcheckbox'}
<div id="importList" {if !$checked}style="display:none"{/if}>
<ul>
{foreach $field.values as $key => $label}
<li><label><input type="checkbox" name="importData[{$key}]" checked="checked" /> {$label}</label></li>
{/foreach}
</ul>
</div>
{elseif $key == 'p'}
<p>{$field}</p>
</div>
{elseif $key == 'submit'}
<div class="margin-form">
<input type="submit" value="{$field.title}" name="submitAdd{$table}" {if isset($field.class)}class="{$field.class}"{/if} />
</div>
{/if}
{/foreach}
</fieldset>
{/if}
{/block}
@@ -1,80 +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 <contact@prestashop.com>
* @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
*}
<br />
<fieldset>
{foreach $fields as $key => $field}
{if $key == 'legend'}
<legend>
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title}" />{/if}
{$field.title}
</legend>
{elseif $key == 'label'}
<label>{$field}</label>
{/if}
{if $key == 'checkbox'}
<div class="margin-form">
<label><input type="{$field.type}" value="{$field.value}" name="{$field.name}" id="{$field.name}" {if $checked} checked="checked"{/if}/> {$field.label}</label>
{elseif $key == 'select'}
<select name="{$field.name}" id="{$field.name}">
{foreach $field.options.query AS $key => $option}
<option value="{$key}" {if $key == $defaultGroup}selected="selected"{/if}>
{$option.name}
</option>
{/foreach}
</select>
{elseif $key == 'allcheckbox'}
<div id="importList" {if !$checked}style="display:none"{/if}>
<ul>
{foreach $field.values as $key => $label}
<li><label><input type="checkbox" name="importData[{$key}]" checked="checked" /> {$label}</label></li>
{/foreach}
</ul>
</div>
{elseif $key == 'p'}
<p>{$field}</p>
</div>
{elseif $key == 'submit'}
<div class="margin-form">
<input type="submit" value="{$field.title}" name="submitAdd{$table}" {if isset($field.class)}class="{$field.class}"{/if} />
</div>
{/if}
{/foreach}
{if $required_fields}
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
{/if}
</fieldset>
</form>
<br /><br />
{if $firstCall}
{if $back}
<a href="{$back}"><img src="../img/admin/arrow2.gif" />{l s='Back'}</a>
{else}
<a href="{$current}&token={$token}"><img src="../img/admin/arrow2.gif" />{l s='Back to list'}</a>
{/if}
<br />
{/if}
+9 -23
View File
@@ -144,14 +144,6 @@ class AdminGroupShopControllerCore extends AdminController
else
$disabled = false;
$this->context->smarty->assign(array(
'disabled' => $disabled,
'checked' => (Tools::getValue('addgroup_shop') !== false) ? true : false,
'defaultGroup' => Shop::getInstance(Configuration::get('PS_SHOP_DEFAULT'))->getGroupID()
));
$this->content .= parent::initForm();
$import_data = array(
'attribute_group' => $this->l('Attribute groups'),
'attribute' => $this->l('Attributes'),
@@ -187,23 +179,17 @@ class AdminGroupShopControllerCore extends AdminController
'type' => 'checkbox',
'values' => $import_data
),
'p' => $this->l('Use this option to associate data (products, modules, etc.) the same way as the selected shop'),
'submit' => array(
'title' => $this->l(' Save '),
'class' => 'button'
)
'p' => $this->l('Use this option to associate data (products, modules, etc.) the same way as the selected shop')
);
$helper = new HelperForm();
// Check if form template has been overriden
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'form_import.tpl'))
$helper->tpl = $this->tpl_folder.'form_import.tpl';
$helper->currentIndex = self::$currentIndex;
$helper->token = $this->token;
$helper->table = $this->table;
$helper->id = $obj->id;
$helper->fields_value = $this->getFieldsValue($obj);
$this->content .= $helper->generateForm($this->fields_import_form);
$this->tpl_form_vars = array(
'disabled' => $disabled,
'checked' => (Tools::getValue('addgroup_shop') !== false) ? true : false,
'defaultGroup' => Shop::getInstance(Configuration::get('PS_SHOP_DEFAULT'))->getGroupID(),
'form_import' => $this->fields_import_form
);
return parent::initForm();
}
public function postProcess()