2012-05-31 03:28:05 +00:00
|
|
|
<?php
|
|
|
|
$this->headTitle($this->config->title->site);
|
|
|
|
$this->headTitle($this->config->title->author);
|
|
|
|
$this->headTitle()->setSeparator(' - ');
|
|
|
|
$this->breadcrumb('<a href="/">首页</a>');
|
|
|
|
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
|
|
|
$this->breadcrumb('数据作者管理');
|
|
|
|
$this->breadcrumb()->setSeparator(' > ');
|
2013-05-10 08:53:24 +00:00
|
|
|
$this->theme->AppendPlus($this,"colorbox");
|
2012-05-31 03:28:05 +00:00
|
|
|
?>
|
2013-05-10 08:53:24 +00:00
|
|
|
<div class="row-fluid">
|
|
|
|
<div class="span3">
|
|
|
|
<?= $this->partial('data/left.phtml'); ?>
|
|
|
|
</div>
|
|
|
|
<div class="span9">
|
|
|
|
<div id="loading" class="info info-box"></div>
|
|
|
|
<div id="datalist">
|
|
|
|
<?php if(!empty($this->authors)) { ?>
|
|
|
|
<h2><?php echo $this->authors[0]['title']; ?></h2>
|
|
|
|
<span id="addauthor_<?php echo $this->authors[0]['id'];?>"><a href="javascript:;" onclick="AddAuthor(<?php echo $this->authors[0]['id']; ?>,'<?php echo $this->authors[0]['uuid']; ?>')">添加作者</a></span>
|
|
|
|
<?php } else {?>
|
|
|
|
<span id="addauthor_0"><a href="javascript:;" onclick="AddAuthor(0,'<?php echo $this->uuid; ?>')">添加作者</a></span>
|
|
|
|
<?php } ?>
|
|
|
|
<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>
|
2012-05-31 03:28:05 +00:00
|
|
|
</div>
|
2012-05-31 03:17:19 +00:00
|
|
|
<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
|
|
|
|
});
|
|
|
|
}
|
2012-05-31 14:58:18 +00:00
|
|
|
function AddAuthor(id,uuid){
|
|
|
|
$('#addauthor_'+id).html('用户名:<input type="text" id="authorInp_'+id+'"/><button class="btn btn-green" onclick="addAuthor('+id+',\''+uuid+'\')">添加</button>');
|
|
|
|
}
|
|
|
|
function addAuthor(id,uuid){
|
|
|
|
$.ajax({
|
|
|
|
'type':"POST",
|
|
|
|
'url':'/admin/data/author',
|
|
|
|
'data':'ac=add&uuid='+uuid+'&username='+$('#authorInp_'+id).val(),
|
|
|
|
'success':function(data){
|
|
|
|
if (typeof(data)=='object')
|
|
|
|
{
|
|
|
|
if(typeof(data.error)!='undefined')
|
|
|
|
{Alert(data.error);return false;}
|
|
|
|
if(typeof(data.msg)!='undefined')
|
|
|
|
{Alert(data.msg);}
|
|
|
|
if(typeof(data.added)!='undefined')
|
|
|
|
{$('#addauthor_'+id).html('<a href="javascript:;" onclick="AddAuthor('+id+',\''+uuid+'\')">添加作者</a>');}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
Alert('出现错误,请稍后再试');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'timeout': 30000,
|
|
|
|
'error': function(){
|
|
|
|
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2012-05-31 03:17:19 +00:00
|
|
|
$('#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>'});
|
|
|
|
}
|
2012-05-31 03:28:05 +00:00
|
|
|
</script>
|