增加了数据作者管理功能
This commit is contained in:
parent
60c5de530a
commit
77d114725d
|
@ -2291,14 +2291,73 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer('author-edit');
|
||||
|
||||
$uuid = $this->_getParam('uuid');
|
||||
|
||||
$sql = "SELECT a.*,md.title,u.realname,u.username FROM mdauthor a
|
||||
LEFT JOIN metadata md ON a.uuid=md.uuid
|
||||
LEFT JOIN users u ON a.userid=u.id
|
||||
WHERE md.uuid=?
|
||||
ORDER BY a.id DESC
|
||||
";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$this->view->authors = $rows;
|
||||
|
||||
}// 作者管理弹窗
|
||||
|
||||
if($ac == "del")
|
||||
{
|
||||
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
$sql = "DELETE FROM mdauthor WHERE id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$ds = $sth->execute(array($id));
|
||||
if($ds)
|
||||
{
|
||||
$data = array("deleted"=>$id);
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}else{
|
||||
$data = array("error"=>"处理中出现错误");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}//移除作者
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($ac == 'update')
|
||||
{
|
||||
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
$sql = "UPDATE mdauthor SET status=1 WHERE id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$ds = $sth->execute(array($id));
|
||||
if($ds)
|
||||
{
|
||||
$data = array("updated"=>$id,'msg'=>'认证成功!');
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}else{
|
||||
$data = array("error"=>"处理中出现错误");
|
||||
$this->jsonexit($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}//认证作者
|
||||
|
||||
}//authorAction() 数据作者管理
|
||||
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>作者管理</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/default.css" />
|
||||
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></script>
|
||||
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
|
||||
<link href="/css/author.css" media="screen" rel="stylesheet" type="text/css"/>
|
||||
<link href="/static/js/uploadify/uploadify.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link href="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<style>
|
||||
#loading{margin:0px;border:none;height:50px;width:98%;background:url(/static/img/colorbox-images/loading.gif) center center no-repeat;display:none;position:absolute;left:0px;top:0px;overflow:hidden;background:#ccc;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- 页面内容 -->
|
||||
<div id="warpper">
|
||||
<div id="loading" class="info info-box"></div>
|
||||
<div id="datalist">
|
||||
<ul>
|
||||
<?php
|
||||
if(isset($this->authors))
|
||||
{
|
||||
foreach($this->authors as $v)
|
||||
{
|
||||
?>
|
||||
<li id="author_<?php echo $v['id'] ;?>">
|
||||
<p><?php echo $v['realname']; ?> [ <?php echo $v['username']; ?> ]</p>
|
||||
<p><span id="status_<?php echo $v['id'] ;?>"><?php if($v['status']==1) {echo "已认证";} if($v['status']==0) {echo "已申请";} if($v['status']==-1) {echo "已拒绝";} ?></span> |
|
||||
<a href="javascript:;" onclick="remove(<?php echo $v['id'] ;?>)">移除该作者</a>
|
||||
<span id="statusChange_<?php echo $v['id'] ;?>"><?php if($v['status']<1) {?> <a href="javascript:;" onclick="update(<?php echo $v['id'] ;?>)">认证该用户</a> <?php }?></span>
|
||||
</p>
|
||||
</li>
|
||||
<?php } } ?>
|
||||
</ul></div>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
function update(id){
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/admin/data/author/',
|
||||
'data':'ac=update&id='+id,
|
||||
'success':function(data){
|
||||
if (data!=null)
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(data.msg!=null)
|
||||
{Alert(data.msg);}
|
||||
if(typeof(data.updated)!='undefined')
|
||||
{$('#status_'+data.updated).html('已认证');$('#statusChange_'+data.updated).html('');}
|
||||
}else{
|
||||
Alert('处理中出现错误');
|
||||
}
|
||||
},
|
||||
'timeout': 30000
|
||||
});
|
||||
}
|
||||
function remove(id){
|
||||
if(confirm('确实要删除吗?')==false)
|
||||
{return false;}
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:'/admin/data/author',
|
||||
data:'ac=del&id='+id,
|
||||
success:function(data){
|
||||
if (data!=null)
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(typeof(data.deleted)!='undefined')
|
||||
{$('#author_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
|
||||
}else{
|
||||
Alert('处理中出现错误');
|
||||
}
|
||||
},
|
||||
'timeout': 30000
|
||||
});
|
||||
}
|
||||
|
||||
$('#loading').css("opacity","0.2");
|
||||
$('#loading').ajaxComplete(function() {
|
||||
$(this).css('display','none');
|
||||
});
|
||||
$('#loading').ajaxSend(function() {
|
||||
$(this).css('display','block');
|
||||
});
|
||||
$("#loading").ajaxError(function() {
|
||||
$(this).css('display','none');
|
||||
Alert('请求超时或服务器开小差了,请刷新页面后重试');
|
||||
});
|
||||
function Alert(html){
|
||||
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue