// fix bug display message error or success in AdminAccessController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10326 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-21 10:11:38 +00:00
parent 792452c2e0
commit c47131aa9f
4 changed files with 33 additions and 12 deletions
+2 -2
View File
@@ -1022,7 +1022,7 @@ if (Tools::isSubmit('submitAddAccess'))
AND `id_profile` = '.(int)$id_profile AND `id_profile` = '.(int)$id_profile
); );
$res = $res?'ok':'error'; $res = $res?'ok':'error';
die(Tools::jsonEncode($res)); die($res);
} }
/* Update Access Modules */ /* Update Access Modules */
@@ -1056,6 +1056,6 @@ if (Tools::isSubmit('changeModuleAccess'))
} }
$res = $res?'ok':'error'; $res = $res?'ok':'error';
die(Tools::jsonEncode($res)); die($res);
} }
+6 -8
View File
@@ -65,11 +65,10 @@
{ {
try try
{ {
res = $.parseJSON(res); if (res == 'ok')
if (res.result == 'ok') showSuccessMessage("{l s='Update successful'}");
showSuccessMessage(res.msg);
else else
showErrorMessage(res.msg); showErrorMessage("{l s='Update error'}");
} }
catch(e) catch(e)
{ {
@@ -111,11 +110,10 @@
{ {
try try
{ {
res = $.parseJSON(res); if (res == 'ok')
if (res.result == "ok") showSuccessMessage("{l s='Update successful'}");
showSuccessMessage(res.msg);
else else
showErrorMessage(res.msg); showErrorMessage("{l s='Update error'}");
} }
catch(e) catch(e)
{ {
+22
View File
@@ -471,6 +471,28 @@ select optgroup option {
border-radius:3px; border-radius:3px;
} }
#ajax_confirmation .error {
background: #FFBABA url(../img/admin/icon-cancel.png) no-repeat scroll 6px 6px;
border: 1px solid #CC0000;
color:#D8000C;
padding:20px;
position:fixed;
bottom:0;
width:100%;
left:0;
}
#ajax_confirmation .conf {
background: #DFF2BF url(../img/admin/icon-valid.png) no-repeat scroll 6px 6px;
border: 1px solid #4F8A10;
color:#4F8A10;
padding:20px;
position:fixed;
bottom:0;
width:100%;
left:0;
}
#content .warn { #content .warn {
background: #FEEFB3 url(../img/admin/icon-attention.png) no-repeat scroll 6px 6px; background: #FEEFB3 url(../img/admin/icon-attention.png) no-repeat scroll 6px 6px;
border: 1px solid #9e6014; border: 1px solid #9e6014;
+3 -2
View File
@@ -948,7 +948,8 @@ function refreshImagePositions(imageTable)
*/ */
function showSuccessMessage(msg) function showSuccessMessage(msg)
{ {
$("#ajax_confirmation").show().html("<div style=\"background-color:green;color:white;padding:20px;position:fixed;bottom:0;width:100%;left:0;text-align:center;\">"+msg+"</div>").delay(3000).fadeOut("slow"); $("#ajax_confirmation").show()
.html("<div class=\"conf\">"+msg+"</div>").delay(3000).fadeOut("slow");
} }
/** display a warning message in a #ajax_confirmation container /** display a warning message in a #ajax_confirmation container
@@ -957,7 +958,7 @@ function showSuccessMessage(msg)
function showErrorMessage(msg) function showErrorMessage(msg)
{ {
$("#ajax_confirmation").show() $("#ajax_confirmation").show()
.html("<div class=\"error\"><img src=\"../img/admin/error.png\" alt=\"ERROR\" />"+msg+"</div>"); .html("<div class=\"error\">"+msg+"</div>").delay(3000).fadeOut("slow");
} }
$(document).ready(function(){ $(document).ready(function(){