⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispbbs.jsp

📁 一个用jsp写的完整的论坛源代码
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import="com.bcxy.bbs.util.*,com.bcxy.bbs.forum.*,java.util.Vector"%>
<%@ include file="INC/const.jsp"%>
<%
	int perPage = ParamUtil.getInt(request,"perPage",10);
	int Page = ParamUtil.getInt(request,"Page",1);
	int LPage = ParamUtil.getInt(request,"LPage",1);
	int startPage = ((Page-1)/10)*10+1;
	int start = (Page-1)*perPage+1;
    try{
	    ForumMSGPacker fp = new ForumMSGPacker(request, forumID);
	    int rootID = fp.getRootID();
	    int announceID = fp.getAnnounceID();
		Forum  theForum = new Forum(forumID);
		Vector forumMSGs = theForum.getForumMSGs(forumID,rootID,announceID,start,perPage);
		ForumMSG topicMSG = fp.getTopicMSG();
		String msgTopic = topicMSG.getTopic();
		int msgRootID = topicMSG.getRootID();
		int msgAnnounceID = topicMSG.getAnnounceID();
		stats = theForum.getForumType()+" 浏览:"+msgTopic;
		SkinUtil.checkUserStats(request,response,stats);
%>
<%@ include file="INC/theme.jsp"%>
<%
		if(forumMSGs.isEmpty()){
			throw new Exception("无效帖子或者该帖子已经被删除!");
		}
	    int totalMSGNum = theForum.getForumMSGsNum();
	 	stats=" 浏览:"+msgTopic;
		out.println(headLine(theForum.getForumID(),forumName,forumLogo,theForum.getForumType(),2,stats,LPage,tableWidth));
%>
<script>
function callColorDlg(obj,tt){
  var sColor = dlgColor.ChooseColorDlg();
  if(sColor==0)	return ;
  sColor = sColor.toString(16);
  if (sColor.length < 6) {
   var sTempString = "000000".substring(0,6-sColor.length);
   sColor = sTempString.concat(sColor);
  }
  if(tt==0){
  	document.getElementById(obj).style.backgroundColor  = sColor;
  }else{
    document.getElementById(obj).style.color = sColor;
  }
}
var curfontsize=10;
var curlineheight=18;
function fontZoomA(obj){
  if(curfontsize>8){
    document.getElementById(obj).style.fontSize=(--curfontsize)+'pt';
 	document.getElementById(obj).style.lineHeight=(--curlineheight)+'pt';
  }
}
function fontZoomB(obj){
  if(curfontsize<64){
    document.getElementById(obj).style.fontSize=(++curfontsize)+'pt';
 	document.getElementById(obj).style.lineHeight=(++curlineheight)+'pt';
  }
}
function wheel(o){
  var zoom = parseInt(o.style.zoom, 10) || 100;
  zoom -= event.wheelDelta / 12;
  if(zoom > 0) {
	o.style.zoom = zoom + '%';
  }
  return false;
}
function checkPic(){
  var imgs = document.getElementsByTagName('IMG');
  for(var i=0; i<imgs.length; i++){
	var img = imgs[i];
	if(img.width>300){
	  img.alt = '按此在新窗口浏览图片';
	  img.style.cursor = 'hand';
	  img.onclick = function testopen(){window.open(this.src);};
	  img.onmousewheel = function testWheel(){return wheel(this);};
	}
    var w = screen.availWidth;
    if(img.width>w*0.76){
      img.width = w*0.5;
    }
  }
}
onload=checkPic;
</script>
<object id="dlgColor" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px">
  <embed width="0px" height="0px">
  </embed> 
</object>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tableWidth%>" align=center>
	<tr>
		<td align=left width=* valign=middle>
			&nbsp; <a href=announce.jsp?forumID=<%=forumID%> alt=发表一个新主题> 
			<img src=pic/post.gif border=0></a>&nbsp; <a href=vote.jsp?forumID=<%=forumID%> alt=发表一个新投票>
			<img src=pic/newpoll.gif border=0></a>&nbsp;
			<a href=reannounce.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&parentID=<%=msgRootID%> alt=回复主题><img src=pic/newreply1.gif border=0></a>&nbsp; 
			
		</td>
		<td align=right width=""50%"" valign=middle>
				您是本帖的第 <B><%=fp.getHits()%></B> 个阅读者
				&nbsp;<a href="dispbbs.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>&action=priv&LPage=<%=LPage%>" alt="查看上一主题"><img src=pic/prethread.gif border=0></a>          
        &nbsp;<a href="dispbbs.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>&action=next&LPage=<%=LPage%>" alt="查看下一主题"><img src=pic/nextthread.gif border=0></a>
            &nbsp;
		</td>			
	</tr>
</table>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tableWidth%>" bgcolor=#FFFFFF align=center>
	<tr><td height=1></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tableWidth%>" bgcolor="<%=tableBackColor%>" align=center>
	<tr><td height=1> </td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tableWidth%>" align=center>
  <tr>
		<td bgcolor="<%=tableBackColor%>" valign=middle width=1 height=24> </td>
		<td bgcolor="<%=tableTitleColor%>" align=left valign=middle width=*> 
			<table cellpadding=0 cellspacing=1 border=0 width="100%">
			  <tr>
				  <td bgcolor="<%=tableTitleColor%>" align=left valign=middle width="55%">
					  <font color="<%=tableFontColor%>">&nbsp;<b>* 贴子主题</B>: <%=msgTopic%></font>
				  </td>
          <td align=right>
			     <a href=# onclick="javascript:WebBrowser.ExecWB(4,1)">
			       <img src=pic/saveas.gif border=0 width=16 height=16 alt=保存该页为文件 align=absmiddle></a>
			       &nbsp;<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
			     <a href=report.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>><img src=pic/report.gif alt=报告本帖给版主 border=0></a>&nbsp;
					 <a href="printpage.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>" target="_blank"><img src=pic/printpage.gif alt=显示可打印的版本 border=0></a>&nbsp; 
			     <a href="pag.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>">
			     <img src=pic/pag.gif border=0 alt=把本贴打包邮递></a>&nbsp;
			    <a href="favadd.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>"><IMG SRC=pic/fav_add.gif BORDER=0 alt=把本贴加入论坛收藏夹></a>&nbsp; 
			    <a href="sendpage.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=announceID%>">
			    <img src=pic/emailtofriend.gif border=0 alt=发送本页面给朋友></a>&nbsp;
			    <a href="javascript:window.external.AddFavorite('<%=StringUtil.substring(forumURL,forumURL.lastIndexOf("/"))+"/"%>dispbbs.jsp?forumID=<%=forumID%>&rootID=<%=rootID%>&announceID=<%=msgAnnounceID%>', ' <%=forumName%>- <%=msgTopic%>')"><IMG SRC=pic/fav_add1.gif BORDER=0 width=15 height=15 alt=把本贴加入IE收藏夹></a>
			   &nbsp;</td>
			  </tr>
	    </table>
	  </td>
	  <td bgcolor="<%=tableBackColor%>" valign=middle width=1 height=24> </td>
	</tr>
</table>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tableWidth%>" bgcolor="<%=tableBackColor%>" align=center>
	<tr><td height=1 bgcolor="<%=tableBackColor%>" width="100%"> </td></tr>
</table>
<%
	String bgcolor = tableBodyColor;	
	for (i=0;i<forumMSGs.size();i++)
	{
		ForumMSG theMSG = (ForumMSG)forumMSGs.get(i);
		User theUser = theMSG.getUser();
		String nameStyle="";
		String tUserName = theUser.getUserName();
		int tAnnounceID = theMSG.getAnnounceID();
		//
		bgcolor = tableBodyColor.equals(bgcolor)? aTableBodyColor:tableBodyColor;
%>
<table cellpadding=0 cellspacing=0 border=0 width="<%=tableWidth%>" align=center>
	<tr>
		<td bgcolor="<%=tableBackColor%>" valign=middle width=1 height=24> </td>
		<td bgcolor="<%=bgcolor%>">
		  <table width="100%" cellpadding=4 cellspacing=0>
		    <tr>
          <td bgcolor="<%=bgcolor%>" valign=top width="20%" rowspan=2>
            <img src="" width=0 height=4><BR>
              <table width="100%" cellpadding=4 cellspacing=0 style="<%=nameStyle%>">
                <tr>
                	<td>
        					  &nbsp;<img src=<%=theUser.getFace()%> width=<%=theUser.getWidth()%> height=<%=theUser.getHeight()%> border=0><br>
        					  &nbsp;<a name="<%=tAnnounceID%>"><B><%=tUserName%></B></a>&nbsp;&nbsp;
        					  <%if(SkinUtil.checkUserOnline(tUserName)){//用户在线%>
        					  		<img src="images/online2.gif" alt="该用户在线">
        					  <%}else{//用户不在线%>
        					  		<img src="images/offline2.gif" alt="该用户不在线">
        					  <%}%>&nbsp;&nbsp;
        					  <%if("0".equals(theUser.getSex())){//%>
        					  		<img src="images/fem.gif" alt="美女">
        					  <%}else{%>
        					  		<img src="images/mal.gif" alt="帅哥">
        					  <%}%>
        					</td>
        				</tr>
        			</table>
<%
	String comeFrom = "保密";
	if(fromFlag.equals("1")){
		String[] addr = com.bcxy.ip.IPLocalizer.search(theMSG.getUserIP());
		comeFrom = addr[0] + addr[1];
	}
	if ("1".equals(titleFlag)&&theUser.getTitle()!=null&&!"".equals(theUser.getTitle())){
		out.println(" 头衔:"+theUser.getTitle()+"<br>");
	}
  out.println("<br>&nbsp;&nbsp;等级:"+theUser.getUserClassStr()+"<BR>");
	out.println(" 财产:<img src=pic/bar1.gif width=\""+(theUser.getUserWealth()*0.005+3)+"\" height=8 alt="+theUser.getUserWealth()+"><br>"+
							" 经验:<img src=pic/bar4.gif width="+(theUser.getUserEP()*0.005+3)+" height=8 alt="+theUser.getUserEP()+"><br>"+
							" 魅力:<img src=pic/bar5.gif width="+(theUser.getUserCP()*0.005)+3+" height=8 alt="+theUser.getUserCP()+"><br>");
	out.println("&nbsp;&nbsp;注册:"+Format.getStrDate(theUser.getAddDate()));
	out.println("<BR> &nbsp;&nbsp;文章:"+theUser.getArticle()+"  <br>&nbsp;&nbsp;鉴定:"+comeFrom+" <img src=\"\" width=0 height=4><BR>"+
			        "</td><td bgcolor="+bgcolor+" width=1 height=100% rowspan=2>"+ 
              "<table width=1 height=\"100%\" cellpadding=0 cellspacing=0 bgcolor="+tableTitleColor+">"+
              "<tr><td width=1></td></tr></table></td>"+
			        "<td bgcolor="+bgcolor+" valign=top width=* height=\"" + tableWidth + "\"><img src=\"\" width=0 height=4><BR>"+
              "&nbsp; <a href=javascript:openScript('usersms.jsp?action=new&touser="+tUserName+"',420,320)>"+
			        "<img src=pic/message.gif border=0 alt=给"+tUserName+"发送一个短消息></a>&nbsp;"+
              "<a href=javascript:openScript('dispuser.jsp?name="+tUserName+"',350,300)>"+
			        "<img src=pic/profile.gif border=0 alt=查看"+tUserName+"的个人资料></a>&nbsp;"+
              "<a href=queryResult.jsp?sType=1&nSearch=3&keyword="+tUserName+"&forumID="+forumID
              +"&SearchDate=ALL target=_blank><img src=pic/find.gif border=0 alt=\"搜索"+tUserName+"在"
              +response.encodeURL(theForum.getForumType())+"的所有贴子\"></a>&nbsp; ");
	if (theUser.getUserEmail()!=null&&!"".equals(theUser.getUserEmail())){
		out.println("<A href='mailto:"+theUser.getUserEmail()+"'><IMG alt='点击这里发送电邮给"+tUserName
		+"' border=0 src='pic/email.gif'></A>&nbsp;"); 
	}
  if (!"".equals(theUser.getOicq())){
	  out.println("<a href=http://search.tencent.com/cgi-bin/friend/user_show_info?ln="+theUser.getOicq()+" target=_blank alt=\""+tUserName+"["+theUser.getOicq()+"]的QQ情况\"><img src=pic/oicq.gif width=16 height=16 border=0>OICQ</a>&nbsp;");
	}
	if (theUser.getHomePage()!=null&&!"".equals(theUser.getHomePage())){
		out.println("<A href='"+theUser.getHomePage()+"' target=_blank><IMG alt='访问"+tUserName+"的主页'  border=0 src='pic/homepage.gif'></A>&nbsp; ");
  }
	out.println("<a href=reannounce.jsp?forumID="+forumID+"&rootID="+rootID+"&parentID="+tAnnounceID+"&reply=true>"+
			    "<img src=pic/reply.gif border=0 alt=引用回复这个贴子></a>&nbsp; "+
			    "<a href=reannounce.jsp?forumID="+forumID+"&rootID="+rootID+"&parentID="+tAnnounceID+">"+
			    "<img src=pic/reply_a.gif border=0 alt=回复这个贴子></a>"+
                "&nbsp;&nbsp;【字体:<a href=\"javascript:fontZoomA('fontzoom"+tAnnounceID+"');\" >小</a> <a href=\"javascript:fontZoomB('fontzoom"+tAnnounceID+"');\">大</a>&nbsp;"+
                "<a href=\"javascript:callColorDlg('fontzoom"+tAnnounceID+"',1);\">颜色</a>&nbsp;<a href=\"javascript:callColorDlg('fontzoom"+tAnnounceID+"',0);\">背景色</a>】" + 
                "&nbsp; <a href=#bottom><img src=pic/down.gif border=0 alt=返回页面底端></a>"+
                "<BR><hr width=\"100%\" size=1 color=#777777>"+
                "<table cellpadding=0 cellspacing=0 width=\"" + tableWidth + "\" style=\"TABLE-LAYOUT: fixed; WORD-WRAP: break-word\">"+
                "<tr><td width=32 align=left valign=top>");
	if (theMSG.getExpression()!=null&&!"".equals(theMSG.getExpression())){
		out.println("<img src='images/post/topicface/"+theMSG.getExpression()+"' border=0 alt=发贴心情>");
	}
	out.println("&nbsp;</td><td id=\"fontzoom"+tAnnounceID+"\">"+"<font face=宋体>" );
	//
	String body = "";
	//除帖子作者
	if(!(foundUser && userName.equals(tUserName)) && rootID == tAnnounceID){
		body = fp.checkViewMode(request, rootID, theMSG.getViewMode(),theMSG.getViewNumber());
	}
	if("".equals(body)){
    	if(theForum.getStrAllowHTML()){
    		body = theMSG.getHTMLBody();
    	}else{
    		body = theMSG.getBody();
    	}
  }
	out.println("<b>"+theMSG.getTopic()+"</b><br><br>"+(body)); 

if (theMSG.getIsVote()&& tAnnounceID==theMSG.getRootID()){
	try{
  		ForumVote theVote=theForum.getForumVote(tAnnounceID);
  		//
  		String [] votes=theVote.getVoteS();
  		int [] voteNum=theVote.getVoteNumS();
	  	out.println("<table border=0 cellpadding=0 cellspacing=3 width=\"" + tableWidth + "\" align=center><tr>");
	  	out.println("<td colSpan=2>以下为投票内容:</td></tr>");
	  	out.println("<form action=postvote.jsp?forumID="+forumID+"&announceID="+rootID+"&action="+theVote.getVoteType()+" method=POST>");
	  	String voteString="";
	  	int voteSign=0;
	  	for(int voteI=0;voteI<votes.length;voteI++){
  			if(!votes[voteI].trim().equals("")){
		  		if (theVote.getVoteType()==0){
	  				voteString+=(voteSign+1)+".  <input type=radio name=postVote value=\""+(voteSign)+"\">"+(votes[voteI].trim())+"<br>";
  				}else{

⌨️ 快捷键说明

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