// 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
@@ -106,63 +106,61 @@
if ($(this).attr('name') == 'category_reduction['+$('[name="id_category"]:checked').val()+']') if ($(this).attr('name') == 'category_reduction['+$('[name="id_category"]:checked').val()+']')
{ {
exist = true; 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; return false;
} }
}); });
if (exist) if (exist)
return; return;
$.ajax({ $.ajax({
type:"POST", type:"POST",
url: "ajax-tab.php", url: "ajax-tab.php",
async: true, async: true,
dataType: "json", dataType: "json",
data : { data : {
ajax: "1", ajax: "1",
token: "{getAdminToken tab='AdminGroups'}", token: "{getAdminToken tab='AdminGroups'}",
controller: "AdminGroups", controller: "AdminGroups",
action: "addCategoryReduction", action: "addCategoryReduction",
category_reduction: $('#category_reduction_fancybox').val() , category_reduction: $('#category_reduction_fancybox').val() ,
id_category: $('[name="id_category"]:checked').val() id_category: $('[name="id_category"]:checked').val()
}, },
success : function(jsonData) success : function(jsonData) {
if (jsonData.hasError)
{ {
if (jsonData.hasError) var errors = '';
{ for(error in jsonData.errors)
var errors = ''; //IE6 bug fix
for(error in jsonData.errors) if(error != 'indexOf')
//IE6 bug fix errors += jsonData.errors[error] + "\n";
if(error != 'indexOf') jAlert(errors);
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();
}
} }
}); 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; return false;
} }
function initFancyBox() function initFancyBox()
{ {
$('[name="id_category"]:checked').removeAttr('checked'); $('[name="id_category"]:checked').removeAttr('checked');
collapseAllCategories(); collapseAllCategories();
$('#category_reduction_fancybox').val('0.00'); $('#category_reduction_fancybox').val('0.00');
} }
</script> </script>
<div class="margin-form"> <div class="margin-form">
<a class="button" href="#group_discount_category_fancybox" id="group_discount_category">{l s='Add a category discount'}</a> <a class="button" href="#group_discount_category_fancybox" id="group_discount_category">{l s='Add a category discount'}</a>
@@ -50,14 +50,14 @@
console.log(truncateAuthorized); console.log(truncateAuthorized);
if (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(); e.preventDefault();
} }
} }
else 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; return false;
} }
} }
@@ -90,7 +90,7 @@
var table = $('#selectTables select').val(); var table = $('#selectTables select').val();
if (!table) if (!table)
jAlert("{l s='Please choose a table.'}"); jAlert("{l s='Please choose a table.' js='1'}");
else else
AddRequestSql(table); AddRequestSql(table);
}); });
@@ -24,9 +24,9 @@
*} *}
<a href="{$href}" class="delete" <a href="{$href}" class="delete"
{if in_array($id_shop, $shops_having_dependencies)} {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)} {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}"> {/if} title="{$action}">
<img src="../img/admin/delete.gif" alt="{$action}" /> <img src="../img/admin/delete.gif" alt="{$action}" />
</a> </a>
@@ -138,7 +138,7 @@
// check if it's possible to add the product // check if it's possible to add the product
if (product_infos == null || $('#cur_product_name').val() == '') 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; return false;
} }
+2 -4
View File
@@ -470,8 +470,7 @@ function init()
cache: false, cache: false,
dataType: 'json', dataType: 'json',
data : query, data : query,
success : function(data) success : function(data) {
{
if (data.result) if (data.result)
{ {
go = false; go = false;
@@ -491,8 +490,7 @@ function init()
else else
jAlert(data.error); jAlert(data.error);
}, },
error : function(XMLHttpRequest, textStatus, errorThrown) error : function(XMLHttpRequest, textStatus, errorThrown) {
{
jAlert("Impossible to add the product to the cart.\n\ntextStatus: '" + textStatus + "'\nerrorThrown: '" + errorThrown + "'\nresponseText:\n" + XMLHttpRequest.responseText); jAlert("Impossible to add the product to the cart.\n\ntextStatus: '" + textStatus + "'\nerrorThrown: '" + errorThrown + "'\nresponseText:\n" + XMLHttpRequest.responseText);
} }
}); });