📄 admin_html_gen.jsp
字号:
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import ="java.util.Vector,
com.bcxy.util.DateUtil,
com.bcxy.util.SysUtil,
com.bcxy.util.FileUtil"%>
<%@ include file="INC/const.jsp"%>
<html>
<head>
<title>页面生成中,请等待...</title>
</head>
<body>
<%
if(session.getAttribute("adminFlag")==null){
out.print("本页面为管理员专用,请<a href=elogin.jsp>登陆管理</a>后进入。");
return;
}
String path = SysUtil.getRealPath() + "/bbs/html";
String headStr = "<html><head><title>鲤鱼论坛文字版</title></head><link rel=stylesheet type=text/css href=\"../forum.css\"><style>TABLE {BORDER-TOP: 1px; BORDER-LEFT: 0px; BORDER-BOTTOM: 1px; } TD {BORDER-RIGHT: 0px; BORDER-TOP: 0px; color: #000000; }</style><script src=../js/x_alt.js></script><body>";
String listStr = "", dispbbsStr = "", indexStr = "";
String bottomStr = "<p><TABLE cellSpacing=0 cellPadding=0 width=\"" + tableWidth + "\" border=0 align=center><tr><td>"+
"<p align=center>"+copyRight+version+"</td></tr><tr valign=center><td align=center> </td></tr></table> </body> </html>";
headStr += "<TABLE border=0 width=" + tableWidth + " align=center><TBODY><TR><TD align=left>"
+ "<a href=\""+hostURL+"\" target=_blank><img border=0 src=../"+forumLogo+"></a></TD>"
+ "<TD Align=right>截止 "+DateUtil.getLocalDate()+"</b></font> 主题总数:<b>"+topicNum+"</b> | 帖子总数:<b>"+bbsNum+"</b><br>"
+ "</TD></TR></TBODY></TABLE><br>";
indexStr += headStr + "<table cellspacing=0 border=0 width=" + tableWidth + " bgcolor="+tableBackColor+" align=center><tr><td height=1></td></tr></table><table cellpadding=6 cellspacing=0 width=" + tableWidth + " align=center bordercolor="+tableBackColor+" border=1>"
+ "<TR bgColor=\""+tableTitleColor+"\">"
+ "<TD width=26><B><FONT COLOR=\""+tableFontColor+"\">状态</font></b></TD>"
+ "<TD vAlign=center ><B><FONT COLOR=\""+tableFontColor+"\">论坛名称</FONT></B></TD>"
+ "<TD vAlign=center align=middle width=80><B><FONT COLOR=\""+tableFontColor+"\">版主</FONT></B></TD>"
+ "<TD vAlign=center noWrap align=middle width=38><B><FONT COLOR=\""+tableFontColor+"\">主题</FONT></B> </TD>"
+ "<TD vAlign=center noWrap align=middle width=38><B><FONT COLOR=\""+tableFontColor+"\">贴子</FONT></B> </TD>"
+ "</TR></table>";
try{
Vector gateWayVector=GateWayFactory.getGateWays();
//System.out.println("gateWayVector="+gateWayVector.size());
for( i=0;i<gateWayVector.size();i++)
{
GateWay gateWay=(GateWay)gateWayVector.get(i);
int gateWayID=gateWay.getGateWayID();
String gateWayName=gateWay.getGateWayName();
//System.out.println("gateWayName="+gateWayName);
indexStr += "<table cellpadding=6 cellspacing=0 width=" + tableWidth + " align=center bordercolor=\""+tableBackColor+"\" border=1>"+
"<TR><TD bgColor=\""+tableBodyColor+"\" colSpan=5><B>"+gateWayName+"</B></TD></TR>";
//
Vector forumVector=ForumFactory.getForums(gateWayID);
//System.out.println("forumVector="+forumVector.size());
for(int j=0;j<forumVector.size();j++){
Forum theForum=(Forum)forumVector.get(j);
int forumId = theForum.getForumID();
indexStr += "<TR><TD vAlign=top align=middle width=26 bgColor=\""+aTableBodyColor+"\">正常"
+ "</TD><TD vAlign=top width=* bgColor=\""+tableBodyColor+"\"> "
+ " <a href=\"list_"+forumId+"_1.html\"><font color=#000066>"+theForum.getForumType()+"</font></a><br><br>"
+ theForum.getReadMe()
+ "</TD><TD vAlign=center align=middle bgColor=\""+aTableBodyColor+"\" width=80>";
String masterName=theForum.getForumMaster();
if(masterName==null||"".equals(masterName)){
indexStr += "暂缺";
}else{
String [] masterNames=theForum.getForumMaster().split("\\|");
masterName="";
for(int k=0;k<masterNames.length;k++)
{
masterName += masterNames[k]+"<br>" ;
if(k>2){
masterName=masterName + "<font color=#000066>More...</font>";
break;
}
}
indexStr += masterName;
}
indexStr += "</TD>"+
"<TD vAlign=center noWrap align=middle width=38 bgColor=\""+tableBodyColor+"\">"+theForum.getLastTopicNum()+"</TD>"+
"<TD vAlign=center noWrap align=middle width=38 bgColor=\""+tableBodyColor+"\">"+theForum.getLastBbsNum()+"</TD>";
indexStr += "</TR>";
//生成list_forumid_page.html
Forum forum = ForumFactory.getForum(forumId);
int perPage = ParamUtil.getInt(request,"perPage",20);
int Page = ParamUtil.getInt(request,"Page",1);
int forumTopicNum = forum.getForumTopicNum();
int totalPage = forumTopicNum/perPage+1;
String pageStr = "<table border=0 cellpadding=0 cellspacing=3 width=" + tableWidth + " align=center>"
+ "<td valign=middle><span class=smallFont >页次:<strong>"+Page+"</strong>/<strong>"+totalPage+"</strong>页 每页<strong>"+perPage+"</strong> 主题数<strong>"+forumTopicNum+"</strong></td><td valign=middle><div align=right ><p>分页:";
for(int l=1; l<=totalPage; l++){
pageStr += "<a href=list_" + forumId + "_" + l + ".html>[" + l + "]</a> ";
}
pageStr += "</td></tr></table>";
for(int l=1; l<=totalPage; l++)
{
Vector forumTopics=theForum.getForumTopics(forumId,l,perPage);
listStr = headStr;
listStr += "<table cellspacing=0 border=0 width=" + tableWidth + " bgcolor="+tableBackColor+" align=center><tr><td height=1></td></tr></table><TABLE border=1 cellPadding=0 cellSpacing=0 width=" + tableWidth + " align=center bordercolor=\""+tableBackColor+"\">"
+ "<tr><td bgColor=\""+tableTitleColor+"\" height=25><a href=index.html>论坛首页</a> -> " + theForum.getForumType() + "</td></tr></table><br>";
listStr += "<table cellspacing=0 border=0 width=" + tableWidth + " bgcolor="+tableBackColor+" align=center><tr><td height=1></td></tr></table><TABLE border=1 cellPadding=0 cellSpacing=0 width=" + tableWidth + " align=center bordercolor=\""+tableBackColor+"\">"
+ "<TBODY><TR align=middle><TD height=27 width=32 bgColor=\""+tableTitleColor+"\"><font color=\""+tableFontColor+"\">状态</TD>"
+ "<TD bgColor=\""+tableTitleColor+"\" width=*><font color=\""+tableFontColor+"\">主 题</TD>"
+ "<TD bgColor=\""+tableTitleColor+"\" width=80><font color=\""+tableFontColor+"\">作 者</TD>"
+ "</TR></TBODY></TABLE>";
for(int n=0;n<forumTopics.size();n++){
ForumTopic forumTopic=(ForumTopic)forumTopics.get(n);
//
int announceId = forumTopic.getAnnounceID();
listStr += "<TABLE border=1 cellPadding=0 cellSpacing=0 width=" + tableWidth + " align=center bordercolor=\""+tableBackColor+"\">"
+ "<TBODY><TR align=middle><TD bgColor=\""+aTableBodyColor+"\" width=32 height=27>正常</TD>"
+ "<TD align=left bgcolor=\""+tableBodyColor+"\" width=* onmouseover=javascript:this.bgColor='"+aTableBodyColor+"' onmouseout=javascript:this.bgColor='"+tableBodyColor+"'>"
+ "<a href=\"dispbbs_"+forumTopic.getAnnounceID()+".html\" alt=\"《"+ forumTopic.getNoFilterTopic()+"》<br>作者:"+forumTopic.getUserName()+"<br>发表于"+forumTopic.getDateAndTime()+"<br>\">"
+ forumTopic.getTopic()
+ "</a>"
+ "</TD><TD bgColor=\""+aTableBodyColor+"\" width=80>"+forumTopic.getUserName()+"</a></TD>"
+ "</tr></TBODY></TABLE>";
//显示论坛主题信息dispbbs(announceid).html
theForum = new Forum(forumId);
int totalMSGNum = 20;//theForum.getForumMSGsNum();
int start = 1;
Vector forumMSGs=theForum.getForumMSGs(forumId,announceId,announceId,start,totalMSGNum);
//取得前一帖子及下一帖子
ForumMSGPacker fp = new ForumMSGPacker(forumId, announceId);
int priID = fp.getPriID();
String priTopic = fp.getPriTopic();
int nextID = fp.getNextID();
String nextTopic = fp.getNextTopic();
String bgcolor=tableBodyColor;
String abgcolor=aTableBodyColor;
dispbbsStr = headStr;
dispbbsStr += "<table cellspacing=0 border=0 width=" + tableWidth + " bgcolor="+tableBackColor+" align=center><tr><td height=1></td></tr></table><TABLE border=1 cellPadding=0 cellSpacing=0 width=" + tableWidth + " align=center bordercolor=\""+tableBackColor+"\">"
+ "<tr><td bgcolor=\""+tableTitleColor+"\" height=25><a href=index.html>论坛首页</a> -> <a href=list_"+ forumId + "_"+l+".html>" + theForum.getForumType() + "</a></td></tr></table><br>";
dispbbsStr += "<table 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+"\" colspan=2 align=left valign=middle width=*>"
+ "<table cellpadding=0 cellspacing=1 border=0 width=\"100%\">"
+ "<tr> <td bgcolor=\""+tableTitleColor+"\" align=left valign=middle width=\"65%\">"
+ "<font color=\""+tableFontColor+"\"> <b>* 贴子主题</B>: "+fp.getTopic()+"</font></td>"
+ "<td width=\"35%\" align=right>"
+ "<a href=\"dispbbs_"+priID+".html\" alt="+priTopic+">上一主题</a>";
if(nextTopic!=null){
dispbbsStr += " "
+ "<a href=\"dispbbs_"+nextID+".html\" alt="+nextTopic+">下一主题</a>";
}
dispbbsStr += " <a href=# onclick=\"javascript:WebBrowser.ExecWB(4,1)\">保存该页为文件</a> "
+ "<object id=\"WebBrowser\" width=0 height=0 classid=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></object>"
+ "<a href=#><span style=\"CURSOR: hand\" onClick=\"window.external.AddFavorite('"+forumURL+"dispbbs_"+announceId+".html', ' "+forumName+"-"+fp.getTopic()+"')\">"
+ "把本贴加入IE收藏夹</span></a> </td></tr></table></td><td valign=middle bgcolor="+tableBackColor+" width=1 height=24> </td></tr></table>";
//
for (int m=0;m<forumMSGs.size();m++)
{
ForumMSG theMSG=(ForumMSG)forumMSGs.get(m);
User theUser=theMSG.getUser();
//
dispbbsStr += "<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+"\" valign=\"top\"><br>作者:" + theUser.getUserName() + "</td><td width=10 height=\"100%\" ></td>"
+ "<td>"
+ " </td><td style=\"LEFT: 0px; WIDTH: 90%; WORD-WRAP: break-word\">"+"<font face=宋体 color=#333333>"
+ "<br><b>"+theMSG.getTopic()+"</b><p>"+theMSG.getHTMLBody()+"</p><p> </p>";
if (theMSG.getIsVote()&& theMSG.getAnnounceID()==theMSG.getRootID()){
ForumVote theVote=theForum.getForumVote(theMSG.getAnnounceID());
//
String [] votes=theVote.getVoteS();
int [] voteNum=theVote.getVoteNumS();
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{
voteString+=(voteSign+1)+". <input type=checkbox name=postVote_"+voteSign+" value=\""+voteSign+"\">"+votes[voteI].trim()+"<br>";
voteSign++;
}
}
}
dispbbsStr += "<table border=0 cellpadding=0 cellspacing=3 width=\"" + tableWidth + "\" align=center><tr>"
+ "<td colSpan=2>以下为投票内容:</td></tr>"
+ "<tr><td width=\"60%\"><span style=\"LINE-HEIGHT: 200%;\">"+voteString+"</span></td>";
voteString="";
for(int voteI=0;voteI<voteNum.length;voteI++){
voteString+="票数:<font color=#990000><b>"+voteNum[voteI]+"</b></font><br>";
}
dispbbsStr += "<td width=\"40%\" valign=top><span style=\"LINE-HEIGHT: 200%;\">"+voteString+"</span></td></tr>"
+ "</tr></table>";
}
dispbbsStr += "</td><td bgcolor="+tableBackColor+" valign=middle width=1 height=24> </td></tr></table>";
dispbbsStr += "<table cellpadding=0 cellspacing=0 border=0 width=\"" + tableWidth + "\" bgcolor="+tableBackColor+" align=center>"
+ "<tr><td height=1> </td></tr></table>";
}
dispbbsStr += bottomStr;
FileUtil.writeFile(dispbbsStr, path+"/dispbbs_"+announceId+".html");
}
//
listStr += pageStr;
listStr += bottomStr;
FileUtil.writeFile(listStr, path+"/list_"+forumId+"_"+l+".html");
}
//生成list页面
}
indexStr += "</table></body></html>";
}
}
catch(Exception e){
e.printStackTrace();
}
indexStr += bottomStr;
FileUtil.writeFile(indexStr,path+"/index.html");
%>
<script type="text/javascript">
parent.tip.innerHTML = '鲤鱼论坛文字版生成完成!';
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -