update error display function

This commit is contained in:
jack 2018-05-02 12:13:27 +08:00
parent 26a0e8775e
commit 5ed06ccc78
2 changed files with 17 additions and 7 deletions

View File

@ -3492,12 +3492,12 @@ group by m.uuid,m.title,m.description) md ON md.uuid=v.uuid
}catch(Exception $e) { }catch(Exception $e) {
$sql="delete from mdstatus where uuid in (select uuid from geonetworkmetadata where id=?)"; $sql="delete from mdstatus where uuid in (select uuid from geonetworkmetadata where id=?)";
$this->db->query($sql,array($id)); $this->db->query($sql,array($id));
$msg = "提交失败,请确认权限后重试"; $msg = "提交失败,请确认权限后重试";
if($this->debug>0) if($this->debug>0)
{$msg .= $e->getMessage();} {$msg .= $e->getMessage();}
$data = array("error"=>$msg); $data = array("error"=>$msg, "detail"=>$e->getMessage());
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
} }

View File

@ -59,6 +59,16 @@
<script> <script>
$('#wapper').width($('body').width()-300); $('#wapper').width($('body').width()-300);
function errorContentHtml(err){
var html = "";
if(err && err.error)
html += "<h4>" + err.error + "</h4>";
if(err && err.detail)
html += "<p>" + err.detail + "</p>";
return html;
}
function action(ac,id){ function action(ac,id){
$.ajax({ $.ajax({
'type':"POST", 'type':"POST",
@ -68,7 +78,7 @@ function action(ac,id){
if (typeof(data)=='object') if (typeof(data)=='object')
{ {
if(typeof(data.error)!='undefined') if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});} {$.colorbox({'innerWidth':'50%','html': errorContentHtml(data)});}
if(typeof(data.deleted)!='undefined') if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});} {$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined') if(typeof(data.commited)!='undefined')