batch_topic_m.jsp

来自「一个用java编写的功能强大的OA系统」· JSP 代码 · 共 956 行 · 第 1/3 页

JSP
956
字号
				condition += "id in (select id from sq_message where replyid = -1 and recount>" + recountMore + ")";
			}
			
			if(StrUtil.isNumeric(sReDate)){
				if(!condition.equals(""))
					condition += " and ";
			    java.util.Date today = DateUtil.parse(DateUtil.format(new java.util.Date(), "yyyy-MM-dd"), "yyyy-MM-dd");
			    long lReDate = today.getTime() - Long.parseLong(sReDate)*24*60*60*1000;
				out.print(today.getTime());
				
				condition += "redate<" + lReDate;	
			}
			
			if(msgLevel.equals("1")){
				if(!condition.equals(""))
					condition += " and ";
				condition += "msg_level <> 0 and iselite = 0 and id not in (select msgId from sq_message_attach)";
			}else{
			    if(msgLevel.equals("2")){
					if(!condition.equals(""))
						condition += " and ";
					condition += "msg_level = 0";
				}
			}
			
			if(isElite.equals("1")){
				if(!condition.equals(""))
					condition += " and ";
				condition += "msg_level = 0 and iselite = 1 and id not in (select msgId from sq_message_attach)";
			}else{
			    if(isElite.equals("2")){
					if(!condition.equals(""))
						condition += " and ";
					condition += "iselite = 0";
				}
			}
			
			if(attach.equals("1")){
				if(!condition.equals(""))
					condition += " and ";
				condition += "msg_level = 0 and iselite = 0 and id in (select msgId from sq_message_attach)";
			}else{
			    if(attach.equals("2")){
					if(!condition.equals(""))
						condition += " and ";
					condition += "id in (select msgId from sq_message_attach)";
				}
			}
			
			if(!condition.equals("")){
				condition = " where " + condition;
				sql = sql + condition;
			}

			String orderby = "";
			if (selboard.equals("allboard"))
				orderby = " ORDER BY lydate desc";
			else
				orderby = " ORDER BY msg_level desc,lydate desc";
			sql = sql + orderby;

			int pagesize = 10;
			Paginator paginator = new Paginator(request);
			int curpage = paginator.getCurPage();
			PageConn pageconn = new PageConn(Global.defaultDB, curpage, pagesize);
			ResultIterator ri = pageconn.getResultIterator(sql);
			paginator.init(pageconn.getTotal(), pagesize);
			
			ResultRecord rr = null;
			
			//设置当前页数和总页数
			int totalpages = paginator.getTotalPages();
			if (totalpages==0)
			{
				curpage = 1;
				totalpages = 1;
			}
%>
		<TABLE cellSpacing=0 cellPadding=1 width="98%" align=center>
		  <TBODY>
		  <TR height=25 class="td_title">
			<TD height="26" colSpan=3 align=middle noWrap bgcolor="#EFEBDE"><lt:Label res="res.label.forum.listtopic" key="topis_list"/></TD>
			<TD width=91 height="26" align=middle noWrap  bgcolor="#EFEBDE"><lt:Label res="res.label.forum.listtopic" key="author"/></TD>
			<TD width=55 height="26" align=middle noWrap bgcolor="#EFEBDE"><lt:Label res="res.label.forum.listtopic" key="reply"/></TD>
			<TD width=55 height="26" align=middle noWrap bgcolor="#EFEBDE"><lt:Label res="res.label.forum.listtopic" key="hit"/></TD>
			<TD width=80 height="26" align=middle noWrap bgcolor="#EFEBDE"><lt:Label res="res.label.forum.listtopic" key="reply_date"/></TD>
			<TD width=91 height="26" align=middle noWrap bgcolor="#EFEBDE"><lt:Label res="res.label.forum.mytopic" key="board"/></TD>
		  </TR>
		  </TBODY>
		</TABLE>
<%		
			String topic = "",name="",lydate="",expression="", myboardname = "", myboardcode = "";
			int id = -1;
			int k = 0,recount=0,hit=0,type=0;
			MsgDb md = new MsgDb();
			Leaf myleaf = new Leaf();
			Directory dir = new Directory();
			com.redmoon.forum.person.UserMgr um = new com.redmoon.forum.person.UserMgr();
			while (ri.hasNext()) {
				rr = (ResultRecord)ri.next(); 
				k++;
				id = rr.getInt("id");
				md = md.getMsgDb(id);
				topic = md.getTitle();
				name = md.getName();
				lydate = com.redmoon.forum.ForumSkin.formatDate(request, md.getAddDate());
				recount = md.getRecount();
				hit = md.getHit();
				expression = "" + md.getExpression();
				type = md.getType();
				myboardcode = md.getboardcode();
				myleaf = dir.getLeaf(myboardcode);
				myboardname = "";
				if (myleaf!=null)
					myboardname = myleaf.getName();
	%>
	  <table cellspacing=0 cellpadding=1 width="98%" align=center>
		<tbody> 
		 <tr>
		  <td width=30 height="22" align=middle noWrap bgcolor=#f8f8f8><input name="ids" value="<%=id%>" type="checkbox"></td>
		  <td noWrap align=left width=50 bgcolor=#f8f8f8><%=md.getId()%></td> 
		  <td noWrap align=middle width=30 bgcolor=#f8f8f8> 
		    <%if (recount>20){ %>
			  <img alt="<lt:Label res="res.label.forum.listtopic" key="open_topic_hot"/>" src="<%=skinPath%>/images/f_hot.gif"> 
			<%}else if (recount>0) {%>
			  <img alt="<lt:Label res="res.label.forum.listtopic" key="open_topic_reply"/>" src="<%=skinPath%>/images/f_new.gif"> 
			<%}else {%>
			  <img alt="<lt:Label res="res.label.forum.listtopic" key="open_topic_no_reply"/>" src="<%=skinPath%>/images/f_norm.gif"> 
			<%}%>	   
		  </td>
		  <td align=middle width=17 bgcolor=#ffffff> 
			  <% String urlboardname = StrUtil.UrlEncode(myboardname,"utf-8"); %>
			   <a href="showtopic_tree.jsp?boardcode=<%=myboardcode%>&hit=<%=(hit+1)%>&rootid=<%=id%>" target=_blank> 
			  <% if (type==1) { %>
			  <IMG height=15 alt="" src="images/f_poll.gif" width=17 border=0>
			  <%}else { %>
			  <img src="images/brow/<%=expression%>.gif" border=0>
			  <%}%>
			  </a>
		   </td>
		   <td onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor=''" align=left bgcolor=#f8f8f8> 
			<%
			if (recount==0) {
			%>
			  <img id=followImg<%=id%> title="<lt:Label res="res.label.forum.listtopic" key="no_reply"/>" src="<%=skinPath%>/images/minus.gif" loaded="no"> 
			  <% }else { %>
			  <img id=followImg<%=id%> title=<lt:Label res="res.label.forum.listtopic" key="extend_reply"/> style="CURSOR: hand" onClick=loadThreadFollow(<%=id%>,<%=id%>,"&boardcode=<%=myboardcode%>&hit=<%=hit+1%>&boardname=<%=urlboardname%>") src="<%=skinPath%>/images/plus.gif" loaded="no"> 
			  <% } %>
			  <a target="_blank" href="showtopic_tree.jsp?boardcode=<%=myboardcode%>&hit=<%=(hit+1)%>&rootid=<%=id%>"><%=StrUtil.toHtml(topic)%></a>
			  <%
			// 计算共有多少页回贴
			int allpages = (int)Math.ceil((double)recount/pagesize);
			if (allpages>1)
			{
				out.print("[");
				for (int m=1; m<=allpages; m++)
				{ %>
			  <a target="_blank" href="showtopic.jsp?boardcode=<%=myboardcode%>&hit=<%=(hit+1)%>&boardname=<%=urlboardname%>&rootid=<%=id%>&CPages=<%=m%>"><%=m%></a> 
			  <% }
				out.print("]");
			 }%>        
		  </td>
		  <td align=middle width=91 bgcolor=#ffffff> 
		  <%if (privilege.getUser(request).equals(name)) { %>
			  <IMG height=14 src="<%=skinPath%>/images/my.gif" width=14>
		  <%}%>
		  <a href="../userinfo.jsp?username=<%=name%>"><%=um.getUser(name).getNick()%></a>      </td>
		  <td align=middle width=55 bgcolor=#f8f8f8><font color=red>[<%=recount%>]</font></td>
		  <td align=middle width=55 bgcolor=#ffffff><%=hit%></td>
		  <td align=left width=80 bgcolor=#f8f8f8> 
			<table cellspacing=0 cellpadding=2 width="100%" align=center border=0>
			  <tbody> 
			  <tr> 
				<td width="10%">&nbsp;</td>
				<td><%=lydate%></td>
			  </tr>
			  </tbody> 
			</table>      
		  </td>
		  <td align=middle width=91 bgcolor=#ffffff>&nbsp;&nbsp;
			<%if (!myboardcode.equals(Leaf.CODE_BLOG)) {%>
			<a target=_blank href="listtopic.jsp?boardcode=<%=StrUtil.UrlEncode(myboardcode)%>"><%=myboardname%></a>&nbsp;
			<%}else{%>
			<a target=_blank href="blog/myblog.jsp?userName=<%=StrUtil.UrlEncode(md.getName())%>"><%=myboardname%></a>
			<%}%></td>
		</tr>
		<tr id=follow<%=id%> style="DISPLAY: none">
		  <td noWrap align=middle width=30 bgcolor=#f8f8f8>&nbsp;</td>
		  <td noWrap align=middle width=30 bgcolor=#f8f8f8>&nbsp;</td> 
		  <td noWrap align=middle width=30 bgcolor=#f8f8f8>&nbsp;</td>
		  <td align=middle width=17 bgcolor=#ffffff>&nbsp;</td>
		  <td onMouseOver="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor=''" align=left bgcolor=#f8f8f8 colspan="6">
		  <div id=followDIV<%=id%> style="WIDTH: 100%;BACKGROUND-COLOR: lightyellow" onClick=loadThreadFollow(<%=id%>,<%=id%>,"&hit=<%=hit+1%>&boardname=<%=urlboardname%>")><span style="WIDTH: 100%;">
		   <lt:Label res="res.label.forum.listtopic" key="wait"/>
		 </span></div></td>
		</tr>
		<tr> 
		  <td style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px" colspan=7>      </td>
		</tr>
		</tbody> 
	  </table>
<%
				}
%>
		<table width="98%" border="0" cellspacing="1" cellpadding="3" align="center">
			<tr> 
			  <td width="51%" height="23" align="left">
			  <input value="<lt:Label res="res.label.forum.topic_m" key="sel_all"/>" type="button" onClick="selAllCheckBox('ids')">&nbsp;&nbsp;
			  <input value="<lt:Label res="res.label.forum.topic_m" key="clear_all"/>" type="button" onClick="clearAllCheckBox('ids')">&nbsp;&nbsp; 
			  </td>
			  <td width="49%" align="right"><%   	
			  querystr = "op="+op+"&selboard="+selboard+"&title="+title+"&nick="+nick+"&sBeginDate="+sBeginDate+"&sEndDate="+sEndDate;
			  querystr += "&threadType="+threadType+"&hitLess="+hitLess+"&hitMore="+hitMore+"&recountLess="+recountLess+"&recountMore="+recountMore;
			  querystr += "&sReDate="+sReDate+"&msgLevel="+msgLevel+"&isElite="+isElite+"&attach="+attach;
			  out.print(paginator.getCurPageBlock(request, "?"+querystr));
			  %></td>
			</tr>
		</table> 		
<%		
		}
%>
	    <br>
	</td>
  </tr>
</table>
<iframe width=0 height=0 src="" id="hiddenframe"></iframe>
<br>
<br>
<table width="86%"  border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	  <td align="center"><input type="button" value="提交" onclick="doOperation()"></td>
	</tr>
</table>
</body>
<script>
function doOperation() {
	var ids = getCheckboxValue("ids");
	if (ids=="") {
		alert("<lt:Label res="res.label.forum.topic_m" key="need_id"/>");
		return;
	}
	var operation = getRadioValue("operation");
	if (operation == "") {
		alert("请选择操作项目!");
		return;
	}

	var msgLevel = setMsgLevel.value;
	if(operation == "moveBoard"){
		var toBoard = selToBoard.value;
		window.location.href = "batch_topic_m.jsp?operation=" + operation + "&selToBoard=" + toBoard + "&ids=" + ids + "&<%=querystr%>";
	}else{
		if(operation == "moveThreadType"){
			var toThreadType = selToThreadType.value;
			toBoardCode = hToBoardCode.value;
			window.location.href = "batch_topic_m.jsp?operation=" + operation + "&toThreadType=" + toThreadType + "&toBoardCode=" + toBoardCode + "&ids=" + ids + "&<%=querystr%>";
		}else{
			window.location.href = "batch_topic_m.jsp?operation=" + operation + "&ids=" + ids + "&<%=querystr%>";
		}
	}
}

function threadTypeChange(){
  for(var i = 0; i < threadTypeArr.length; i++){
    if(form1.threadType.value == threadTypeArr[i][0]){
	   form1.txtBoardName.value = threadTypeArr[i][1]; 
	   form1.hBoardCode.value = toThreadTypeArr[i][2];  
	   return;
	}   
  }
  form1.txtBoardName.value = "";
  form1.hBoardCode.value = "";
}

function toThreadTypeChange(){
  for(var i = 0; i < toThreadTypeArr.length; i++){
    if(selToThreadType.value == toThreadTypeArr[i][0]){
	   txtToBoardName.value = toThreadTypeArr[i][1];  
	   hToBoardCode.value = toThreadTypeArr[i][2]; 
	   return;
	}   
  }
  txtToBoardName.value = "";
  hToBoardCode.value = "";
}

function selAllCheckBox(checkboxname){
	var checkboxboxs = document.all.item(checkboxname);
	if (checkboxboxs!=null)
	{
		// 如果只有一个元素
		if (checkboxboxs.length==null) {
			checkboxboxs.checked = true;
		}
		for (i=0; i<checkboxboxs.length; i++)
		{
			checkboxboxs[i].checked = true;
		}
	}
}

function clearAllCheckBox(checkboxname) {
	var checkboxboxs = document.all.item(checkboxname);
	if (checkboxboxs!=null)
	{
		// 如果只有一个元素
		if (checkboxboxs.length==null) {
			checkboxboxs.checked = false;
		}
		for (i=0; i<checkboxboxs.length; i++)
		{
			checkboxboxs[i].checked = false;
		}
	}
}
</script>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?