// Added addlashes for some js messages

This commit is contained in:
Damien Metzger
2013-06-26 15:52:40 +02:00
parent 19ee2c953f
commit 7427efdb6f
6 changed files with 50 additions and 54 deletions

View File

@@ -106,63 +106,61 @@
if ($(this).attr('name') == 'category_reduction['+$('[name="id_category"]:checked').val()+']')
{
exist = true;
jAlert('{l s='This category already exists for this group.'}');
jAlert('{l s='This category already exists for this group.' js='1'}');
return false;
}
});
if (exist)
return;
$.ajax({
type:"POST",
url: "ajax-tab.php",
async: true,
dataType: "json",
data : {
ajax: "1",
token: "{getAdminToken tab='AdminGroups'}",
controller: "AdminGroups",
action: "addCategoryReduction",
category_reduction: $('#category_reduction_fancybox').val() ,
id_category: $('[name="id_category"]:checked').val()
},
success : function(jsonData)
type:"POST",
url: "ajax-tab.php",
async: true,
dataType: "json",
data : {
ajax: "1",
token: "{getAdminToken tab='AdminGroups'}",
controller: "AdminGroups",
action: "addCategoryReduction",
category_reduction: $('#category_reduction_fancybox').val() ,
id_category: $('[name="id_category"]:checked').val()
},
success : function(jsonData) {
if (jsonData.hasError)
{
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
jAlert(errors);
}
else
{
$('#group_discount_category_table').append('<tr class="alt_row" id="'+jsonData.id_category+'"><td>'+jsonData.catPath+'</td><td>{l s='Discount:'}'+jsonData.discount+'{l s='%'}</td><td><a href="#" onclick="deleteCategoryReduction('+jsonData.id_category+');"><img src="../img/admin/delete.gif"></a></td></tr>');
var input_hidden = document.createElement("input");
input_hidden.setAttribute('type', 'hidden');
input_hidden.setAttribute('value', jsonData.discount);
input_hidden.setAttribute('name', 'category_reduction['+jsonData.id_category+']');
input_hidden.setAttribute('class', 'category_reduction');
$('#group_discount_category_table tr#'+jsonData.id_category+' > td:last').append(input_hidden);
$.fancybox.close();
}
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
jAlert(errors);
}
});
else
{
$('#group_discount_category_table').append('<tr class="alt_row" id="'+jsonData.id_category+'"><td>'+jsonData.catPath+'</td><td>{l s='Discount:'}'+jsonData.discount+'{l s='%'}</td><td><a href="#" onclick="deleteCategoryReduction('+jsonData.id_category+');"><img src="../img/admin/delete.gif"></a></td></tr>');
var input_hidden = document.createElement("input");
input_hidden.setAttribute('type', 'hidden');
input_hidden.setAttribute('value', jsonData.discount);
input_hidden.setAttribute('name', 'category_reduction['+jsonData.id_category+']');
input_hidden.setAttribute('class', 'category_reduction');
$('#group_discount_category_table tr#'+jsonData.id_category+' > td:last').append(input_hidden);
$.fancybox.close();
}
}
});
return false;
}
function initFancyBox()
{
$('[name="id_category"]:checked').removeAttr('checked');
collapseAllCategories();
$('#category_reduction_fancybox').val('0.00');
}
function initFancyBox()
{
$('[name="id_category"]:checked').removeAttr('checked');
collapseAllCategories();
$('#category_reduction_fancybox').val('0.00');
}
</script>
<div class="margin-form">
<a class="button" href="#group_discount_category_fancybox" id="group_discount_category">{l s='Add a category discount'}</a>

View File

@@ -50,14 +50,14 @@
console.log(truncateAuthorized);
if (truncateAuthorized)
{
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '{l s='?' js=1}'))
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
{
e.preventDefault();
}
}
else
{
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.'}');
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js='1'}');
return false;
}
}

View File

@@ -90,7 +90,7 @@
var table = $('#selectTables select').val();
if (!table)
jAlert("{l s='Please choose a table.'}");
jAlert("{l s='Please choose a table.' js='1'}");
else
AddRequestSql(table);
});

View File

@@ -24,9 +24,9 @@
*}
<a href="{$href}" class="delete"
{if in_array($id_shop, $shops_having_dependencies)}
onclick="jAlert('{l s='You cannot delete this shop\'s (customer and/or order dependency)'}'); return false;"
onclick="jAlert('{l s='You cannot delete this shop\'s (customer and/or order dependency)' js='1'}'); return false;"
{elseif isset($confirm)}
onclick="if (confirm('{$confirm}')){ return true; }else{ event.stopPropagation(); event.preventDefault();};"
onclick="if (confirm('{$confirm}')){ return true; } else { event.stopPropagation(); event.preventDefault();};"
{/if} title="{$action}">
<img src="../img/admin/delete.gif" alt="{$action}" />
</a>

View File

@@ -138,7 +138,7 @@
// check if it's possible to add the product
if (product_infos == null || $('#cur_product_name').val() == '')
{
jAlert('{l s='Please select at least one product.'}');
jAlert('{l s='Please select at least one product.' js='1'}');
return false;
}