分页相关

$(function() {
var grid = mini.get('datagrid');
grid.on("drawcell", celldraw);
});


function celldraw(e) {
var record = e.record, field = e.field,rowIndex = e.rowIndex,columnIndex=e.columnIndex;
var topicId = record.topicId;
var topicTitle = record.topicTitle;
if(!topicTitle) {
return;
}
if (field == 'topicTitle') {
e.cellHtml = "<a href='javascript:void(0)' οnclick='openReplyView(\""+topicId+"\")'><font color='blue'>" + e.cellHtml + "</font></a>";
}

if(rowIndex == 0 && columnIndex == 2) {
e.cellHtml = "<font color='red'>[置顶]</font>" + e.cellHtml;
}
}


function openReplyView(topicId) {
var actionPath = mf.action.getActionPath();
var url = actionPath + "?method=getAllTopic&retrieve=true&topicId="+topicId+"&pageNum="+1;
window.open(url);
}


function doTop() {
var rows = mf.list.getSelectedRows();
var length = rows.length;

if(length == 0) {
mini.alert("请先勾选数据进行置顶的操作");
}else if(length > 1) {
mini.alert("请勾选一条数据进行置顶的操作");
}else {
for(var i = 0;i < length;i++) {
var topicNum = rows[i].topicNum;
var topicId = rows[i].topicId;
//获取最小的主题编号
mf.data.invoke("forumTopicManager.getMinTopicNum", {
success : function(minTopicNum) {
//最小的主题编号等于当前选中的主题编号就提示
if(topicNum == minTopicNum) {
mini.alert("勾选的主题已经是置顶的主题请勾选其它数据");
}else {//不小于的话就更换二者的主题编号
mf.data.invoke("forumTopicManager.updateTopicNum", {
data : {
"topicId" : topicId,
"minTopicNum" : minTopicNum
},
success : function() {
doRequery();
}
  })
}
}
})
}
 }
}


//删除主题前做判断的操作
mf.list.beforeDelete = function() {

var rows = mf.list.getSelectedRows();
var length = rows.length;
var loginUserId = mf.loginUserId;
var isSuperAdmin = mf.isSuperAdmin;

if(isSuperAdmin) {
return true;
}

for(var i = 0;i < length;i++) {
var userId = rows[i].createUserId;
//登录人和创建人不一致的操作
if(loginUserId != userId) {
mini.alert("选择的数据中包含不是自己创建的数据,不能删除");
return false;
}
}

for(var i = 0;i < length;i++) {
var userId = rows[i].createUserId;
//登录人和创建人一致的操作
if(userId == loginUserId) {
return true;
}
}
}


//重写框架的doView函数,重写方法要先定义变量,然后再调用变量对应的方法
var view = mf.list.doView;
mf.list.doView = function(e) {//双击某条数据的时候e是有值的,所以做出下面的操作
var loginUserId = mf.loginUserId;
var isSuperAdmin = mf.isSuperAdmin;

if(isSuperAdmin) {
view();
return true;
}

if(e) {
var createUserId = e.createUserId;

if(createUserId != loginUserId) {
mini.alert("当前数据不是您创建的,不能修改");
}else {
view();
}
}else {//单击查看按钮的时候e是undefined,所以做出下面的操作
var row = mf.list.getSelectedRow();
var userId = row.createUserId;

if(userId != loginUserId) {
mini.alert("当前数据不是您创建的,不能修改");
}else {
view();
}
}

}

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<%@page import="cn.com.jtv.mf.core.beanutil.SpringBeanUtils"%>
<%@page import="cn.com.jtv.mf.core.web.LoginUserHolder"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/mf/include/manager.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
pageContext.setAttribute("ctx", request.getContextPath());
String userName = LoginUserHolder.getUserName();
/* AuthorityManager authorityManager = SpringBeanUtils.getBean("authorityManager");
pageContext.setAttribute("isSuperAdmin", authorityManager.isSuperAdmin()); */
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查看主题:${topic.topicTitle }</title>
<link type="text/css" rel="stylesheet" href="${ctx}/project/css/forum.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/project/css/page.css" />
<script type="text/javascript" src="${ctx}/thirdparty/jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="${ctx}/mf/script/core.js"></script>
<script type="text/javascript" src="${ctx}/mf/script/action.js"></script>
<script type="text/javascript" src="${ctx}/thirdparty/ckeditor/ckeditor.js"></script>
<script>
mf.request={ctxPath:"${ctx}", actionPath:"${ctx}${actionPath}","isSuperAdmin":${isSuperAdmin}};
</script>


<script type="text/javascript">
$(function() {
//当没有回复数据的时候pageCount为0时显示第一页
var pageCount = ${page.pageCount == 0 ? 1 : page.pageCount};
//总条数是10的倍数并且不是第一页的时候代表最后一页也是10条,让pageCount加1
if(${page.recordCount % 10 == 0} && ${page.currentPage != 1}) {
pageCount = pageCount + 1;
}

document.forms[0].action = "${ctx}/oaquery/forumtopic.do?method=saveForumReply&pageNum="+ pageCount;
})
</script>


</head>
<body>
<div id="MainArea">

<center>

<div class="ForumPageTableBorder dataContainer">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="bottom">
<td width="3" class="ForumPageTableTitleLeft">&nbsp;</td>
<td class="ForumPageTableTitle"><b>本帖主题:${topic.topicTitle}</b></td>
</tr>
<tr height="1" class="ForumPageTableTitleLine"><td colspan="4"></td></tr>
</table>

<!-- ~~~~~~~~~~~~~~~ 显示主帖(主帖只在第1页显示) ~~~~~~~~~~~~~~~ -->
<c:if test="${page.currentPage == 1}">
<div class="ListArea">
<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr>
<td rowspan="3" width="130" class="PhotoArea" align="center" valign="top">
<!--作者头像-->
<div class="AuthorPhoto">
<img border="0" width="110" height="110" src="${ctx}/project/images/default.gif" 
οnerrοr="this.οnerrοr=null; this.src='${ctx}/project/images/default.gif';" />
</div>
<!--作者名称-->
<div class="AuthorName">${topicUser.userName}</div>
</td>

<td align="center">
<ul class="TopicFunc">
<!-- 文章表情与标题 -->
<li class="TopicSubject">
主题:${topic.topicTitle}
</li>
</ul>
</td>
</tr>

<tr>
<td valign="top" align="center">
<div class="Content">${topic.topicContent}</div>
</td>
</tr>

<tr><!--显示楼层等信息-->
<td class="Footer" height="28" align="center" valign="bottom">
<ul style="margin: 0px; width: 98%;">
<li style="float: left; line-height:18px;"><font color=#C30000>[楼主]</font>
<fmt:formatDate value="${topic.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
</li>
</ul>
</td>
</tr>
</table>
</div>
</c:if>
<!-- ~~~~~~~~~~~~~~~ 主贴结束 ~~~~~~~~~~~~~~~ -->

<!---------显示回复列表 ----------->
<c:forEach items="${page.recordList}" var="reply" varStatus="status">

<div class="ListArea template">
<input type="hidden" id="userName" value="<%=userName %>"/>

<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr>
<td rowspan="3" width="130" class="PhotoArea" align="center" valign="top">
<!--回复人头像-->
<div class="AuthorPhoto">
<img border="0" width="110" height="110" src="${ctx}/project/images/default.gif" 
οnerrοr="this.οnerrοr=null; this.src='${ctx}/project/images/default.gif';" />
</div>

<!--回复人名称-->
<div class="AuthorName">${reply.replyUserName}</div>
</td>


<td align="center">
<ul class="TopicFunc">
<!--操作列表-->
<li class="TopicFuncLi">
<a class="detail${status.count}" href="javascript:updateForumReply('${reply.replyId}','${topic.topicId }','${page.currentPage}')"><img border="0" src="${ctx}/project/images/edit.gif" />修改</a>
<a class="detail${status.count}" href="javascript:deleteForumReply('${reply.replyId}','${topic.topicId }','${page.currentPage}')"><img border="0" src="${ctx}/project/images/delete.gif" />删除</a>
</li>
<li class="TopicSubject">
回复:${topic.topicTitle}
</li>
</ul>

<!-- 根据当前的回复是谁创建的来动态的显示修改和删除的超链接 -->
<script type="text/javascript">

$(function() {
var userName = $("#userName").val();
var replyAuthor = '${reply.replyUserName}';

if(${isSuperAdmin}) {
return true;
}

if(userName != replyAuthor) {
//当前页面上有多个人回复的时候为了让对应登录人的显示,所以写了下列的选择器
$(".detail${status.count}").hide();
}
})

</script>

</td>

</tr>
<tr><!-- 文章内容 -->
<td valign="top" align="center">
<div class="Content">${reply.replyContent}</div>
</td>
</tr>
<tr><!--显示楼层等信息-->
<td class="Footer" height="28" align="center" valign="bottom">
<ul style="margin: 0px; width: 98%;">
<li style="float: left; line-height:18px;"><font color=#C30000>[${(page.currentPage - 1) * (page.pageSize) + status.count}楼]</font>
   <fmt:formatDate value="${reply.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
</li> 
</ul>
</td>
</tr>
</table>
</div>
</c:forEach>
</div>

<!--处理分页信息 -->
<div id="PageSelectorBar">
<div id="PageSelectorMemo">
页次:${page.currentPage}/${page.pageCount == 0 ? 1 : page.pageCount } 页 &nbsp;
每页显示:${page.pageSize}条&nbsp;
回复总记录数:${page.recordCount}条
</div>
<div id="PageSelectorSelectorArea">
<a href="javascript:gotoPage('${topic.topicId}',1)" title="首页" style="cursor:pointer;">
<img src="${ctx}/project/images/firstPage.png">
</a>

<!-- 遍历显示页码的操作,${num}获取当前页 -->
<c:forEach begin="${page.beginPageIndex}" end="${page.endPageIndex}" var="num">
<c:choose>
<c:when test="${page.currentPage == num }">
<span class="PageSelectorNum PageSelectorSelected">${num}</span>
</c:when>

<c:otherwise>
<span class="PageSelectorNum" style="cursor:pointer;" οnclick="gotoPage('${topic.topicId}','${num}')">${num}</span>
</c:otherwise>
</c:choose>
</c:forEach>

<a href="javascript:gotoPage('${topic.topicId}','${page.pageCount}')" title="尾页" style="cursor:pointer;">
<img src="${ctx}/project/images/lastPage.png">
</a>

转到:
<select id="pn" οnchange="gotoPage('${topic.topicId}',this.value)">
<c:forEach begin="1" end="${page.pageCount == 0 ? 1 : page.pageCount}" var="num">
<option value="${num}">${num}</option>
</c:forEach>
</select>

<script type="text/javascript">
$("#pn").val(${page.currentPage});
</script>

</div>
</div>

<script type="text/javascript">

//跳转到页码的操作
function gotoPage(topicId,pageNum) {
window.location.href = "${ctx}/oaquery/forumtopic.do?method=getAllTopic&topicId="+topicId+"&pageNum="+pageNum;
}

//删除回复的操作
function deleteForumReply(replyId,topicId,pageNum) {
var flag = confirm("确定要删除此回复吗?");

if(flag) {
//当页面上面只有一条记录的时候这个时候点击删除,会跳转到当前页面的前面的一页
if(${page.currentPage} == ${page.endPageIndex} &&  ${page.recordList.size() == 1} && ${page.currentPage != 1}) {
var pageNum = ${page.currentPage - 1 };
window.location.href = "${ctx}/oaquery/forumtopic.do?method=deleteForumReply&replyId="+replyId+"&topicId="+topicId+"&pageNum="+pageNum;
}else{
window.location.href = "${ctx}/oaquery/forumtopic.do?method=deleteForumReply&replyId="+replyId+"&topicId="+topicId+"&pageNum="+pageNum;
}
}
}

//修改回复的操作
function updateForumReply(replyId,topicId,pageNum) {
window.location.href = "${ctx}/oaquery/forumtopic.do?method=updateForumReply&replyId="+replyId+"&topicId="+topicId+"&pageNum="+pageNum;

}

</script>

<div class="ForumPageTableBorder" style="margin-top: 25px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="bottom">
<td width="3" class="ForumPageTableTitleLeft">&nbsp;</td>
<td class="ForumPageTableTitle"><b>回复</b></td>
<td width="3" class="ForumPageTableTitleRight">&nbsp;</td>
</tr>
<tr height="1" class="ForumPageTableTitleLine">
<td colspan="3"></td>
</tr>
</table>
</div>

</center>

<div class="QuictReply">

<form method="post">
<input type="hidden" name="topicId" value="${topic.topicId }"/>

<div style="padding-left: 3px;">
<table border="0" cellspacing="1" width="98%" cellpadding="5" class="TableStyle">
<tr height="30" class="Tint">
<td width="50px" class="Deep"><b>标题:</b></td>
<td class="no_color_bg">
<input type="text" name="title" class="InputStyle" value="回复:${topic.topicTitle}" style="width:100%" disabled="true"/>
</td>
</tr>
<tr class="Tint" height="200">
<td valign="top" rowspan="2" class="Deep"><b>内容:</b></td>
<td valign="top" class="no_color_bg">
<textarea name="replyContent" style="width: 95%; height: 200px"></textarea>
<script type="text/javascript">
CKEDITOR.replace('replyContent');
</script>
</td>
</tr>
<tr height="30" class="Tint">
<td class="no_color_bg" colspan="2" align="center">
<input type="image" src="${ctx}/project/images/submit.png" style="margin-right:15px;"/>
</td>
</tr>
</table>
</div>
</form>
</div>
</div>
</div>
</body>
</html>







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值