添加评论管理

2024-06-07 09:51 更新

1.登录系统后台》应用市场》评论》编辑

2.在权限管理中修改下图参数

3.创建文件dzz\comment\index.php

<?php /* * @copyright Leyun internet Technology(Shanghai)Co.,Ltd * @license http://www.dzzoffice.com/licenses/license.txt * @package DzzOffice * @link http://www.dzzoffice.com * @author zyx(zyx@dzz.cc) */ if (!defined('IN_DZZ')) { exit('Access Denied'); } $uid=$_G['uid']; $navtitle='评论管理'; Hook::listen('check_login'); //获取通知包含类型 $searchappid = array(); foreach(DB::fetch_all("select distinct(module) from %t where authorid = %d",array('comment',$_G['uid'])) as $v){ $searchappid[] = $v['module']; } $searchcats = array(); if($searchappid){ foreach(DB::fetch_all("select appname,identifier,appico from %t where identifier in(%n)",array('app_market',$searchappid)) as $v){ $searchcats[] = array('identifier'=>$v['identifier'],'appname'=>$v['appname'],'appico'=>$_G['setting']['attachurl'].$v['appico']); } } if ($_GET['do'] == 'delete') { $icoid = isset($_GET['cid']) ? trim($_GET['cid']) : ''; $icoids = explode(',', $icoid); foreach ($icoids as $icoid) { $return = C::t('comment') -> delete_by_cid($icoid); } }else { $perpage = 20; $type = isset($_GET['type']) ? trim($_GET['type']) : ''; $keyword = isset($_GET['keyword']) ? trim($_GET['keyword']) : ''; $page = (isset($_GET['page'])) ? intval($_GET['page']) : 1; $start = ($page - 1) * $perpage; $gets = array( 'mod' => 'comment', 'keyword' => $keyword, 'dateline' => $_GET['dateline'], 'type' => $_GET['type'] ); $theurl = BASESCRIPT . "?" . url_implode($gets); $refer = $theurl . '&page=' . $page; if ($_GET['dateline'] == 'desc') { $order = 'ORDER BY dateline DESC'; }else { $_GET['dateline'] = 'asc'; $order = 'ORDER BY dateline ASC'; } $sql = "cid!='app'"; $foldername = array(); $param = array(); if ($keyword) { $sql .= 'and (message LIKE %s or author LIKE %s)'; $param[] = '%' . $keyword . '%'; $param[] = $keyword; } if ($type) { $sql .= ' and module=%s'; $param[] = $type; if($type){ $appidxu=C::t('app_market')->fetch_by_identifier($type); $navtitle=$appidxu['appname'].' - '.$navtitle; } } $limitsql = 'limit ' . $start . ',' . $perpage; if ($_G['adminid']) { if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('comment') . " WHERE $sql", $param)) { $data = DB::fetch_all("SELECT * FROM " . DB::table('comment') . " WHERE $sql $order $limitsql", $param); } }else{ if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('comment') . " WHERE authorid =$uid and $sql", $param)) { $data = DB::fetch_all("SELECT * FROM " . DB::table('comment') . " WHERE authorid =$uid and $sql $order $limitsql", $param); } } $multi = multi($count, $perpage, $page, $theurl); $list = array(); foreach ($data as $value) { $list[] = $value; } include template('list'); } ?>

4.创建dzz\comment\template\list.htm

<!--{template common/header_simple_start}--> <link rel="stylesheet" href="static/css/checkbox.css"> <link href="static/css/common.css?{VERHASH}" rel="stylesheet" media="all"> <link href="{MOD_PATH}/images/folder.css?{VERHASH}" rel="stylesheet" media="all"> <link href="{MOD_PATH}/images/comment.css?Xqd" rel="stylesheet" media="all"> <link href="static/dzzthumb/jquery.dzzthumb.css?{VERHASH}" rel="stylesheet" media="all"> <link href="dzz/styles/icoblock/default/style.css?{VERHASH}" rel="stylesheet" media="all"> <script type="text/javascript" src="static/js/jquery.leftDrager.js?{VERHASH}"></script> <script type="text/javascript" src="static/dzzthumb/jquery.dzzthumb.js?{VERHASH}"></script> <style type="text/css"> @media (max-width: 670px) { html,body{ min-width: 670px; overflow-x: auto; } } #orgid__Menu{ border: 1px solid #4c89fb; background: #fff; border-radius: 2px; color: #4c89fb; height: 34px; padding: 6px 12px; font-size: 14px; font-weight: normal; } .module-list-view .item-block.item{ border-bottom:1px solid #eee; } .module-list-view .item-block{ background:none; } .module-list-view .item-block .col{ color:#333; } #filem_search .iconFirstWord{ width: 18px; height: 18px; border-radius: 50%; display: inline-block; line-height: 16px; font-size: 14px; margin-left: 0; } </style> <!--{template common/header_simple_end}--> <!--{template common/commer_header}--> <div class="bs-container clearfix"> <div class="left-notice bs-left-container affix-top clearfix"> <!--{template left}--> </div> <div class="bs-main-container"> <!--{if !$list}--> <div node-type="module" class="module-share-empty text-center clearfix"> <div style="padding-top:40px;"> <p class="no-result-title">暂无评论</p> </div> </div> <!--{else}--> <div class="main-header" style="border-top:1px solid #FFF;"> <form name="search" action="{BASESCRIPT}" method="get" id="filem_search"> <input type="hidden" name="mod" value="comment" /> <ul class="nav nav-pills clearfix" style="padding: 5px 0 5px 0;"> <li class="pull-left btn-secetlt" style="display: none;"> <button class="btn btn-danger " type="submit" value="{lang delete}" onclick="delete_file();" style="height:34px;">{lang delete}</button> </li> </ul> </form> </div> <div node-type="module" class="module-list-view" style="display:block"> <form id="appform" name="appform" class="form-horizontal " action="{BASESCRIPT}?mod=comment" method="post" > <input type="hidden" name="delsubmit" value="true" /> <input type="hidden" name="formhash" value="{FORMHASH}" /> <input type="hidden" name="refer" value="$refer" /> <div node-type="wrapper" class="list-view-home"> <div node-type="title" class="title" > <div class="item clearfix"> <div class="col1 cid" style="width: 3%;text-indent: 0;padding-left: 5px;"> <div class="checkbox-custom checkbox-primary"> <input type="checkbox" name="del[]" id="chkall"> <label></label> </div> </div> <!--选中后的效果--> <div class="col sharepame-selected" style="display: none;width:27%"><span>已选择<span class="ex-number"></span>项</span></div> <!-- 第一列 --> <div class="col1 c1 show_first" style="width: 47%"> <div class="name"> <span>内容</span></div> </div> <!-- 其他列 --> <div class="col1" style="width: 10%;">IP地址</div> <div class="col" node-type="title-col" data-key="dateline" style="width: 20%;border-right: none;">发布时间<span class="asc $_GET[dateline]" style="visibility: <!--{if $_GET[dateline]}-->visible<!--{else}-->hidden<!--{/if}-->;"></span> </div> <div class="col1" style="width: 10%;border-right: none;">发布人</div> <div class="col1" style="width: 60px;">操作</div> </div> </div> <div class="list list-share"> <div class="list-wrapper clearfix"> <!--{loop $list $value}--> <div node-type="item" id="comment_$value[cid]" data-cid="$value[cid]" class="item shareblock clearfix"> <!-- 第一列 --> <div class="col cid" style="width: 3%;text-indent: 0;padding-left: 5px;" > <div class="checkbox-custom checkbox-primary"> <input type="checkbox" name="del[]" value="$value[cid]" data-cid="$value[cid]"> <label></label> </div> </div> <div class="col c1 name" style="width: 47%;"> <div class="name"> <span class="enabled">$value[message]</span> </div> </div> <!-- 其他列 --> <div class="col" style="width: 10%">$value[ip]</div> <div class="col dateline" style="width:20%" data-dateline="$value[dateline]">{eval echo dgmdate($value[dateline])}</div> <div class="col" style="width:10%">$value[author]</div> <div class="col" style="width:60px"> <a title="{lang delete}" hidefocus="true" href="javascript:void(0);" style="color:rgb(85, 85, 85);font-size:20px;" onclick="feed_delete('$value[cid]','comment_$value[cid]','$value[cid]')"><i class="dzz dzz-delete"></i></a> <a title="编辑" hidefocus="true" href="javascript:void(0);" style="color:rgb(85, 85, 85);font-size:20px;" onclick="feed_edit('$value[cid]','$_GET[allowattach]','$_GET[allowat]','$_GET[allowsmiley]');"><i class="dzz dzz-create"></i></a> </div> </div> <!--{/loop}--> </div> </div> </form> </div> <div class="clearfix" style="padding:10px;text-align:center">$multi</div> <!--{/if}--> </div> </div> <script type="text/javascript"> function feed_edit(cid,allowattach,allowat,allowsmiley){ showWindow('publish_edit_'+cid,DZZSCRIPT+'?mod=comment&op=ajax&do=edit&cid='+cid+'&allowattach='+allowattach+'&allowat='+allowat+'&allowsmiley='+allowsmiley); } function feed_delete(cid,domid,tid){ var msg=''; if(tid){ msg=__lang.sure_want_delete_comment; }else{ msg=__lang.sure_want_delete_all_comment; } if(confirm(msg)){ jQuery.getJSON(DZZSCRIPT+'?mod=comment&op=ajax&do=delete&cid='+cid,function(json){ jQuery('#'+domid).slideUp(500,function(){ jQuery(this).remove(); if(tid ){ var replysum=parseInt(jQuery('#comment_reply_'+tid+'.item').html()); if(replysum>0) jQuery('#comment_reply_'+tid+'.item').html(replysum-1); } }); try{ callback_by_comment(domid,'delete'); }catch(e){} }); } } var page_loading = false; jQuery('.left-drager').leftDrager_layout(); function setLoadedNum() { jQuery('.loaded-num').html(jQuery('.list-share .item').length); if(!jQuery('.list-share .more').length) { jQuery('.total-num').html('{lang loading_all}'); } else { jQuery('.total-num').html(''); } } var cids=[]; var theurl='$theurl'; jQuery(document).ready(function(e) { jQuery(document).on('mouseenter', 'div[node-type=item]', function() { jQuery(this).addClass('item-hover'); }); jQuery(document).on('mouseleave', 'div[node-type=item]', function() { jQuery(this).removeClass('item-hover'); }); jQuery('.title .item .col[node-type=title-col][data-key=dateline]').on('click', function() { var el = jQuery(this); el.find('.asc').css('visibility', 'visible').toggleClass('desc'); el.siblings().find('.asc').css('visibility', 'hidden'); var param=el.data('key')+'='+ (el.find('.asc').hasClass('desc') ? 'desc' : 'asc'); var regx=new RegExp('&(dateline)=(asc)','i'); var url=theurl.replace(regx,'')+'&'+param; location.href=correcturl(url); }); }); //复选框选中问题 jQuery(document).off('click.shareclick').on('click.shareclick',".shareblock",function(){ var checkinput = jQuery(this).find("input[name='del[]']"); if(checkinput.prop('checked')){ checkinput.prop('checked',false); jQuery(this).removeClass('item-active'); var cid=jQuery(this).find('input[name="del[]"]').data('cid'); var index = jQuery.inArray(cid,cids); if(index != -1){ cids.splice(index,1); } }else{ checkinput.prop('checked',true); jQuery(this).addClass('item-active'); var cid=jQuery(this).data('cid'); if(jQuery.inArray(cid,cids) == -1){ cids.push(cid); } } sharelength(); }); jQuery(document).off('click.inputclick').on('click.inputclick',".shareblock input[name='del[]']",function(){ if($(this).prop('checked')){ jQuery(this).prop('checked',false); jQuery(this).removeClass('item-active'); }else{ jQuery(this).prop('checked',true); jQuery(this).addClass('item-active'); } }); //复选框全选 jQuery(document).off('click.allclick').on('click.allclick','#chkall',function(){ var allchecked=jQuery(this).prop('checked'); jQuery(this).closest('.title').next('.list-share').find('input[name="del[]"]').each(function(){ if(allchecked){ jQuery(this).prop('checked',true); jQuery(this).closest('.item').addClass('item-block'); var cid=jQuery(this).data('cid'); if(jQuery.inArray(cid,cids) == -1){ cids.push(cid); } }else{ jQuery(this).prop('checked',false); jQuery(this).closest('.item').removeClass('item-block'); var cid=jQuery(this).data('cid'); var index = jQuery.inArray(cid,cids); if(index != -1){ cids.splice(index,1); } } }); sharelength(); }) function sharelength(){ if(cids.length>0){ jQuery('.sharepame-selected').show().next('.show_first').hide(); jQuery('#chkall').prop('checked',true); jQuery('.btn-secetlt').show(); }else{ jQuery('.sharepame-selected').hide().next('.show_first').show(); jQuery('#chkall').prop('checked',false); jQuery('.btn-secetlt').hide(); } jQuery('.ex-number').html(cids.length); } function delete_file(){ var delnums = cids.length; var icoids = cids.join(','); if(confirm('你确定要删除'+delnums+'条评论吗(如果有回复评论也将一同删除)?')){ jQuery.post('{MOD_URL}&do=delete',{'cid':icoids},function(data){ if(data['success']){ window.location.reload(); }else{ } }) } } </script> <script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script> <!--{template common/footer_simple}-->

5.创建dzz\comment\images\folder.css

@charset "utf-8"; /* CSS Document */ html, body { height:100%; moz-user-select: -moz-none; -moz-user-select: none; -o-user-select:none; -khtml-user-select:none; /* you could also put this in a class */ -webkit-user-select:none;/* and add the CSS class here instead */ -ms-user-select:none; user-select:none;/**禁止选中文字*/ } .bs-main-container{ margin-left:0; border-top:0; } .no-result-title { font-size: large; color: #999; font-weight: 700; text-align: center; padding: 10px 0; } .list-share{ overflow-y:auto; overflow-x:hidden; } .loaded-num{ padding:0 5px; font-weight:700; } .module-list-view { margin: 0; font-size:13px; } .module-list-view .title { border: 1px solid #ebeef5; background: #F7F7F7; border-radius: var(--radius); margin-top: 5px; } .modal-title{ text-align: center } .module-list-view .title .asc { background: url(sort_asc.gif) no-repeat; display: inline-block; width: 13px; height: 6px; position: relative; top: 1px; visibility: hidden; _vertical-align: middle; _margin: 15px 0; } .module-list-view .title .desc { background: url(sort_desc.gif) no-repeat; } .module-list-view .item { border-bottom: 1px solid #EEEEEE; display: flex; align-items: center; justify-content: center; /* border-top:1px solid #FFF;*/ } .module-list-view .item:first{ border-top:0; } .module-list-view .item .chk { width: 32px; height: 38px; position: absolute; cursor: default; top: 0; left: 3px; } .module-list-view .title .item { /*border-bottom: 1px solid transparent;*/ } .module-list-view .item-hover { background-color: #F2F2F2; } .module-list-view .item .icon { max-width:24px; max-height:24px; margin-top:-2px; } .module-list-view .title .c1 { border-left: 0; } .module-list-view .title .item .chk { top: 2px; left: 2px; } .module-list-view .item .chk-ico { background: transparent url(checkbox.png) no-repeat; width: 16px; height: 16px; position: absolute; top: 12px; left: 12px; } .module-list-view .item .chked .chk-ico { background: transparent url(selected.png) no-repeat; } .module-list-view .item .name { width: 100%; overflow: hidden; } .module-list-view .list-share .item .name-text { cursor: pointer; } .module-list-view .list-share .item .name-text:hover { text-decoration:underline; } .module-list-view .title .col { /*border-left: 1px solid #fff; border-right: 1px solid #e5e5e5;*/ cursor: pointer; _overflow: hidden; } .module-list-view .title .col:hover { background-color: #F2F2F2; } .module-list-view .col{ float: left; width: 10%; } .module-list-view .col1{ float: left; height: 51px; line-height: 51px; text-indent: 10px; width: 10%; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .module-list-view .title .col { /*border-left: 1px solid #fff; border-right: 1px solid #e5e5e5;*/ cursor: pointer; _overflow: hidden; } .module-list-view .c1 { position: relative; text-align: left; top: 0; overflow: visible; } .module-list-view .item .btns { position: absolute; top: 0; right: 4px; height: 38px; display: none; } .module-list-view .item .btns a.dzz,.select-toperate-center .btns a.dzz{ font-size: 18px; } .select-toperate-center .btns{ border-right: 1px solid rgba(0, 0, 0, 0.25); padding-right: 20px; } .select-toperate-center .btns a.dzz{ color: #666666; opacity: 0.65; } .select-toperate-center .btns a.dzz{ color: #666666; opacity: 1; } .module-list-view .item-hover .btns{ display:inline-block; } .module-list-view .item .btns .btn { display: inline-block; height: 20px; width: 20px; margin: 10px 0 0 5px; } .module-grid-view .wrapper { margin: 0 0 0 10px; position: relative; } .module-grid-view .wrapper .item { float: left; margin: 5px 10px; border: 1px solid #DDDDDD; cursor: pointer; position: relative; z-index: 100; border-radius: 2px; } .module-grid-view .item .backgound_radius { display:none; /*filter: Alpha(opacity=40); opacity: 0.4; border: 1px solid transparent;*/ } .module-grid-view .item-hover .backgound_radius { display:block; background: #f2f2f2; opacity: 1; filter: Alpha(opacity=100); transition: all 0.2s ease-in 0s; border-radius: 2px; } .module-grid-view .item .sharepame-checked{ display: none; } .module-grid-view .item-hover .sharepame-checked{ display: block; } .module-grid-view .item-hover .icoblank_rightbottom{ top:3px; right:3px; display:block; } .module-grid-view .wrapper .thumb-large { width: 90px; height: 92px; overflow: hidden; margin: 0 auto; border: 2px solid #fff; position: relative; } .module-grid-view .wrapper .icoimgContainer *{ -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } .module-grid-view .wrapper .icoimgContainer{ width:100px; height:100px; position:relative; } .module-grid-view .wrapper .icoimgContainer .imageclass{ display:block; } .module-grid-view .wrapper .icoimgContainer img{ max-width:100px; max-height:100px; } .module-grid-view .more{ cursor:pointer; border:1px solid transparent; width:150px; height:120px; } .module-grid-view .more:hover{ background:#F7F7F7;border:1px solid #DDD; } .module-grid-view .wrapper .file-name { line-height: 28px; height: 28px; } .module-grid-view .wrapper .file-name a { color: #333; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block; width: 100%; cursor: default; } .module-grid-view .wrapper .enabled .thumb-large, .module-grid-view .wrapper .enabled .file-name a { cursor: pointer; } .module-grid-view .wrapper .item-block.item{ border: 1px solid #4C89FB; } .module-grid-view .wrapper .item-hover .IcoFont_text{ background-color:#F2F2F2; } .module-grid-view .wrapper .item-block .IcoFont_text{ background-color:#4C89FB; } .module-grid-view .wrapper .Icoblock .IcoFont_text .IcoText_div{ overflow: hidden; text-overflow: ellipsis; word-break: break-all; white-space: nowrap; } .module-grid-view .wrapper .item-block .IcoFont_text .IcoText_div .ico_item_name{ color: #FFFFFF; } .module-grid-view .wrapper .item-block .IcoFont_text td{ color: #FFFFFF; } /*文件分享单页开始*/ .sharepame-title{ line-height: 64px; color: #fff; font-size: 22px; font-family: "微软雅黑"; } .sharepame-images{ width:54px; height: 54px; float: left; } .sharepame-right{ float: left; padding-left: 10px; } .sharepame-name{ font-size: 14px; color: #666666; margin-bottom: 12px; } .sharepame-detailed{ font-size: 12px; color: #999; } .sharepame-detailed .sharepame-time{ padding-right:5px ; } .sharepame-selected{ display: inline-block; } .sharepame-checked{ position: absolute; top: 5px; left: 5px; } .window .icoblank_rightbottom{ background-color: transparent!important; } .sharepame-pictitle{ padding-top: 1.42rem; border-bottom: 1px solid #DCDCDC; padding-bottom: 1.42rem; } .button-share-group .btn,.btn-group .btn{ padding: 0px; font-size: 14px; background: none; border: 0; box-shadow: none; color: #FFFFFF; line-height: 64px; } .select-toperate-right .btn-group .btn{ padding: 0px; font-size: 14px; background: none; border: 0; box-shadow: none; color: #666; line-height: 64px; } .select-toperate-right .btn-group{ padding-right: 1.42rem; } .button-share-group .btn span{ font-size: 18px; padding:5px 20px; border-right: 1px solid #FFFFFF; } .btn-group .btn.btn-group-list i{ font-size: 18px; padding: 0px 0.71rem 0px 1.42rem; } .btn-group .btn.btn-group-thumbnail i{ font-size: 18px; padding: 0px 0px 0px 0.71rem; } .nav-pills li{ padding-right: 5px; } .main-header{ border: none; }

创建dzz\comment\template\left.htm

class="active">{lang all} class="active"> $val[appname]

6.创建dzz\comment\template\header_left.htm

<ul class="nav navbar-nav navbar-nav-left"> <li> <a href="javascript:;" class="leftTopmenu left-drager-op" onclick="_header.leftTopmenu(this)" style="padding: 8px;"> <div class="gb_fc"><span class="dzz dzz-menu" style="display: block;"></span></div> </a> </li> <li> <a href="{MOD_URL}" class="navbar-nav-left-title">评论管理</a> </li> </ul>

7.创建dzz\comment\template\header_search.htm

<!--{if empty($_GET['op'])}--> <div class="input-search"> <form name="search" action="{BASESCRIPT}" method="get"> <input type="hidden" name="mod" value="{MOD_NAME}" /> <i class="input-search-icon glyphicon glyphicon-search" aria-hidden="true" onclick="this.parentNode.submit()"></i> <input type="text" class="form-control search form-search" name="keyword" value="$_GET[keyword]" placeholder="可按内容或用户名查询,按回车键确认" id="searchval"> </form> </div> <!--{/if}--> <script type="text/javascript"> jQuery('#searchval').focus(function (e) {//头部搜索框变颜色 jQuery(this).parent().parent().addClass('focus'); }); jQuery('#searchval').blur(function (e) {//失去焦点时 jQuery(this).parent().parent().removeClass('focus'); }) </script>

8.添加https://gitee.com/xh2002/dzzoffice/raw/master/dzz/comment/images/sort_asc.gifhttps://gitee.com/xh2002/dzzoffice/raw/master/dzz/comment/images/sort_desc.gif至dzz\comment\images

9.最后清理缓存即可

效果图



以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号