// fix Update the call of JavaScript and CSS files in the class of HelperForm and controller templates (PSFV-94)

This commit is contained in:
lLefevre
2011-11-14 14:21:26 +00:00
parent 74ef17ca79
commit 5bde977d1f
7 changed files with 87 additions and 47 deletions
+22 -30
View File
@@ -65,7 +65,6 @@
});
{block name="script"}{/block}
</script>
<script type="text/javascript" src="../js/form.js"></script>
{/if}
{if $show_toolbar}
@@ -244,7 +243,7 @@
</div><br />
{/if}
{/if}
<input type="file" name="{$input.name}" />
<input type="file" name="{$input.name}" {if isset($input.id)}id="{$input.id}"{/if} />
{elseif $input.type == 'password'}
<input type="password"
name="{$input.name}"
@@ -275,7 +274,6 @@
{elseif $input.type == 'asso_shop' && isset($asso_shop) && $asso_shop}
{$asso_shop}
{elseif $input.type == 'color'}
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<input type="color"
size="{$input.size}"
data-hex="true"
@@ -284,7 +282,6 @@
name="{$input.name}"
value="{$fields_value[$input.name]}" />
{elseif $input.type == 'date'}
<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
<input type="text"
size="{$input.size}"
data-hex="true"
@@ -347,15 +344,6 @@
{if $required_fields}
<div class="small"><sup>*</sup> {l s ='Required field'}</div>
{/if}
{if isset($fields.tinymce) && $fields.tinymce}
<script type="text/javascript">
var iso = '{$iso}';
var pathCSS = '{$path_css}';
var ad = '{$ad}';
</script>
<script type="text/javascript" src="../js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="../js/tinymce.inc.js"></script>
{/if}
</fieldset>
{block name="other_fieldsets"}{/block}
{if isset($fields[$f+1])}<br class="clear" />{/if}
@@ -364,23 +352,27 @@
{/block}
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function(){
tinySetup();
});
{block name="autoload_tinyMCE"}
$(".autoload_rte").click(function(e){
tinySetup({
mode :"exact",
editor_selector :"autoload_rte",
elements : $(this).attr("id"),
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull|cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo",
theme_advanced_buttons2 : "link,unlink,anchor,image,cleanup,code,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,charmap,media,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
});
})
{/block}
var iso = '{$iso}';
var pathCSS = '{$path_css}';
var ad = '{$ad}';
$(document).ready(function(){
tinySetup();
{block name="autoload_tinyMCE"}
$(".autoload_rte").click(function(e){
tinySetup({
mode :"exact",
editor_selector :"autoload_rte",
elements : $(this).attr("id"),
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull|cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo",
theme_advanced_buttons2 : "link,unlink,anchor,image,cleanup,code,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,charmap,media,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
});
})
{/block}
});
</script>
@@ -24,11 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA
*}
{if count($categories) && isset($categories)}
<script src="../js/jquery/plugins/treeview/jquery.treeview.js" type="text/javascript"></script>
<script src="../js/jquery/plugins/treeview/jquery.treeview.async.js" type="text/javascript"></script>
<script src="../js/jquery/plugins/treeview/jquery.treeview.edit.js" type="text/javascript"></script>
<script src="../js/admin-categories-tree.js" type="text/javascript"></script>
{if isset($categories.use_search) && $categories.use_search}<script src="../js/jquery/plugins/autocomplete/jquery.autocomplete.js" type="text/javascript"></script>{/if}
<script type="text/javascript">
var inputName = '{$categories.input_name}';
var use_radio = {if $categories.use_radio}1{else}0{/if};
@@ -37,7 +32,6 @@
var home = '{$categories.trads.Home}';
var use_radio = {if $categories.use_radio}1{else}0{/if};
</script>
<link type="text/css" rel="stylesheet" href="../css/jquery.treeview.css" />
<div style="background-color:#F4E6C9; width:99%;padding:5px 0 5px 5px;">
<a href="#" id="collapse_all" >{$categories.trads['Collapse All']}</a>
@@ -27,7 +27,6 @@
{extends file="helper/view/view.tpl"}
{block name="override_tpl"}
<script src="../js/adminImport.js"></script>
<script type="text/javascript">
var errorEmpty = "{l s='Please enter a name to save.'}"
</script>
+63 -3
View File
@@ -69,12 +69,72 @@ class HelperFormCore extends Helper
if ($this->submit_action == '')
$this->submit_action = 'submitAdd'.$this->table;
if (isset($this->fields_form['asso_shop']) && Shop::isFeatureActive())
if ($this->fields_form['asso_shop'] == 'group')
/* TODO : replace call method displayAssoShop() by form_shop.tpl */
if (isset($this->fields_form[0]['form']['asso_shop']) && Shop::isFeatureActive())
if ($this->fields_form[0]['asso_shop'] == 'group')
$asso_shop = $this->displayAssoShop('group_shop');
else if ($this->fields_form['asso_shop'] == 'shop')
else if ($this->fields_form[0]['form']['asso_shop'] == 'shop')
$asso_shop = $this->displayAssoShop();
$this->context->controller->addJS(_PS_JS_DIR_.'form.js');
$categories = true;
$color = true;
$date = true;
$tinymce = true;
foreach ($this->fields_form as $fieldset)
if (isset($fieldset['form']['input']))
foreach ($fieldset['form']['input'] as $key => $params)
{
switch ($params['type'])
{
case 'categories':
if ($categories)
{
// Added Jquery plugin treeview (css and js files)
$this->context->controller->addJqueryPlugin('treeview');
// Added JS files
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/treeview/jquery.treeview.async.js');
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/treeview/jquery.treeview.edit.js');
$this->context->controller->addJS(_PS_JS_DIR_.'admin-categories-tree.js');
if (isset($params['use_search']) && $params['use_search'])
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/autocomplete/jquery.autocomplete.js');
$categories = false;
}
break;
case 'color':
if ($color)
{
// Added JS file
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/jquery.colorpicker.js');
$color = false;
}
break;
case 'date':
if ($date)
{
$this->context->controller->addJqueryUI('ui.datepicker');
$date = false;
}
break;
case 'textarea':
if ($tinymce)
{
$iso = $this->context->language->iso_code;
$this->tpl_vars['iso'] = file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en';
$this->tpl_vars['theme_path_css'] = _THEME_CSS_DIR_;
$this->tpl_vars['ad'] = dirname($_SERVER['PHP_SELF']);
$this->context->controller->addJS(_PS_JS_DIR_.'tiny_mce/tiny_mce.js');
$this->context->controller->addJS(_PS_JS_DIR_.'tinymce.inc.js');
$tinymce = false;
}
break;
}
}
$iso = $this->context->language->iso_code;
$this->tpl->assign(array(
'submit_action' => $this->submit_action,
@@ -294,13 +294,6 @@ class AdminCategoriesControllerCore extends AdminController
'size' => $image ? filesize(_PS_CAT_IMG_DIR_.'/'.$obj->id.'.jpg') / 1000 : false
);
$iso = $this->context->language->iso_code;
$this->context->smarty->assign(array(
'iso' => file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en',
'theme_path_css' => _THEME_CSS_DIR_,
'ad' => dirname($_SERVER["PHP_SELF"])
));
// Added values of object Group
$carrier_groups = $obj->getGroups();
$carrier_groups_ids = array();
@@ -393,6 +393,8 @@ class AdminImportController extends AdminController
)
);
$this->addJS(_PS_JS_DIR_.'adminImport.js');
$glue = Tools::getValue('separator', ';');
$handle = $this->openCsvFile();
$nb_column = $this->getNbrColumn($handle, $glue);