westdc-zf1/application/admin/views/scripts/data/comment.phtml

152 lines
5.5 KiB
PHTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('数据反馈管理</a>');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/lib/colorbox/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/js/lib/colorbox/colorbox.css');
?>
<div class="row">
<div class="hidden-sm hidden-xs col-md-2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="col-md-10 col-sm-12">
<?php if(isset($this->title)) {
echo "元数据《".$this->title."》的所有评论";
}?>
<?php if ($this->msg or $this->messages) :?>
<div id="message" class="alert alert-info">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div id="datalistZ">
<?php if (count($this->paginator)): ?>
<ul class=list-unstyled>
<?php foreach ($this->paginator as $item): ?>
<li class="well well-sm">
<h5 class="text-muted">
<span class="glyphicon glyphicon-user"></span>
<?php ($item['url'])?print '<a href="'.$item['url'].'">'.$item['author'].'</a>':print $item['author']; ?>
<span class="glyphicon glyphicon-envelope"></span> EMAIL<?= $item['email']; ?>
[类型:<?= $item['type']; ?>
创建时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
操作: <a href="/admin/data/comment/delete/<?= $item['id']; ?>">
<span class="glyphicon glyphicon-trash"></span>
删除&nbsp;&nbsp;</a> <a href="javascript:;" onclick="showreply(<?= $item['id']; ?>)">
<span class="glyphicon glyphicon-pencil"></span>
回复 <?php if($item['reply_count']>0){echo "(".$item['reply_count'].")";}?></a>
</h5>
<div style="display:none;vertical-align:bottom" id="comment_reply_<?= $item['id']; ?>" class="form-inline h4" >
<textarea id="reply_<?= $item['id']; ?>" class="form-control" style="width: 688px; height: 100px; margin-bottom:9px;"></textarea>
<button type="button" onclick="reply(<?= $item['id']; ?>,'<?= $item['uuid']; ?>')" class="btn btn-primary" >提交</button>
<div style="h4">
<ul class="list-unstyled" id="replyList_<?= $item['id']; ?>"></ul>
</div>
</div>
<p>元数据:<a href="/data/<?= $item['uuid']; ?>"><?= $item['title']; ?></a></p>
<p><?= $item['content']; ?></p>
<p>IP:<?= $item['ip']; ?>AGENT:<?= $item['agent']; ?></p>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<div class="pagenavi"><?= $this->paginator;?></div>
</div>
</div>
<script>
function reply(id,uuid)
{
$.ajax({
'type':"POST",
'url':'/admin/data/comment/reply/'+id,
'data':'content='+$('#reply_'+id).val()+'&uuid='+uuid,
'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.status)!='undefined')
{$('#comment_reply_'+id).slideToggle();}
}
else{
Alert('服务器响应出错,请重试');
}
},
'timeout': 30000,
'error': function(){
Alert('出现错误,请稍后再试');
}
});
}
function showreply(id){
$('#comment_reply_'+id).slideToggle("slow", function () {
if($('#comment_reply_'+id).css('display')!='none')
{
$.ajax({
'type':"POST",
'url':'/admin/data/comment/replylist/'+id,
'data':'',
'success':function(data){
if (typeof(data)=='object')
{
var html=new Array();
for(i in data)
{
html.push('<blockquote><li class="h5" id="subReplyList_'+data[i].id+'"><span class="text-success"> '+data[i].body+
'</span>&nbsp;&nbsp; [ <span class="glyphicon glyphicon-user text-primary"></span> <span class="text-primary">'
+data[i].username+' </span>| <span class="glyphicon glyphicon-trash text-primary"></span> <a href="javascript:void(0);" onClick="delreply('+data[i].id+')">删除</a> ]</li></blockquote>');
}
html = html.join('');
$('#replyList_'+id).html(html);
}
},
'timeout': 30000,
});
}else{
$('#replyList_'+id).html('');
}
});
}
function delreply(id){
$.ajax({
'type':"POST",
'url':'/admin/data/comment/delreply/'+id,
'data':'',
'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.deleted)!='undefined')
{$('#subReplyList_'+id).fadeOut('slow',function(){$(this).remove();})}
}
else{
Alert('服务器响应出错,请重试');
}
},
'timeout': 30000,
'error': function(){
Alert('出现错误,请稍后再试');
}
});
}
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
}
</script>