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

142 lines
4.6 KiB
PHTML
Raw Permalink 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->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.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(' > ');
?>
<div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if(isset($this->title)) {
echo "元数据《".$this->title."》的所有评论";
}?>
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?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="datalist">
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item): ?>
<li>
<p>用户名:<?php ($item['url'])?print '<a href="'.$item['url'].'">'.$item['author'].'</a>':print $item['author']; ?>
EMAIL<?= $item['email']; ?>
[类型:<?= $item['type']; ?>,创建时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
。操作: <a href="/admin/data/comment/delete/<?= $item['id']; ?>">删除</a> <a href="javascript:;" onclick="showreply(<?= $item['id']; ?>)">回复
<?php if($item['reply_count']>0){echo "(".$item['reply_count'].")";}?></a></p>
<p style="display:none;vertical-align:bottom" id="comment_reply_<?= $item['id']; ?>"><textarea id="reply_<?= $item['id']; ?>" class="middle half"></textarea>
<button type="button" onclick="reply(<?= $item['id']; ?>,'<?= $item['uuid']; ?>')" class="btn btn-green" style="vertical-align:bottom">提交</button>
<div style="width:90%; margin:0 auto;">
<ul id="replyList_<?= $item['id']; ?>">
</ul>
</div>
</p>
<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>
<?= $this->paginator; ?>
<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('<li id="subReplyList_'+data[i].id+'">'+data[i].body+
' ['+data[i].username+' | <a href="javascript:void(0);" onClick="delreply('+data[i].id+')">删除</a>]</li>');
}
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>