📄 messagelist.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="com.tiandinet.HiMessage.Conf" %>
<%@ page import="com.tiandinet.HiMessage.Msg" %>
<%@ page import="com.tiandinet.HiMessage.Pic" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.text.DateFormat" %>
<%
Hashtable messages = (Hashtable)request.getAttribute("HiMessageMessages");
Hashtable replyMsgs = (Hashtable)request.getAttribute("replyMsgs");
Conf conf = (Conf)request.getAttribute("HiMessageConf");
String pageLink = (String)request.getAttribute("pageLink");
Integer messageTotal = (Integer)(request.getAttribute("messageTotal"));
Integer pageTotal = (Integer)(request.getAttribute("pageTotal"));
int i = 0;
int currentPageMessageTotal = messages.size();
// administrator
boolean showAdmin = false;
String adminLogin = (String)request.getAttribute("adminLogin");
if (adminLogin != null && adminLogin.equals("OK")) {
showAdmin = true;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=conf.getTitle()%></title>
<link href="css_js/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function doAdminLogin()
{
var goURL = "AdminServlet";
window.location.href = goURL;
return;
}
<%
// delete msg form
String adminLoginLink = "";
if (showAdmin) {
adminLoginLink = "<a href=\"#\" onclick=\"JavaScript:doAdminSetting();\">Setting</a> <a href=\"#\" onclick=\"JavaScript:doAdminLogoff();\">Logoff</a>";
String adminServletLogoffURL = response.encodeURL("AdminServlet?action=logoff");
String adminServletSettingURL = response.encodeURL("AdminServlet?action=setting");
%>
function doAdminDelete(msgId)
{
if (msgId == null || msgId == 'undefined' || msgId == '') {
alert('Invalid parameter!');
return false;
}
else {
document.adminDeleteMsgForm.deleteMsgId.value = msgId;
document.adminDeleteMsgForm.submit();
return true;
}
}
function doAdminSetting()
{
var goURL = "<%=adminServletSettingURL%>";
window.location.href = goURL;
return;
}
function doAdminLogoff()
{
var goURL = "<%=adminServletLogoffURL%>";
window.location.href = goURL;
return;
}
<%
String delMsgInfo = (String)request.getAttribute("delMsgInfo");
if (delMsgInfo != null && !delMsgInfo.equals("")) {
out.println("alert(\"" + delMsgInfo + "\");");
String indexServletURL = response.encodeURL("IndexServlet");
out.println("window.location.href = \"" + indexServletURL + "\";");
}
}
else {
adminLoginLink = "<a href=\"#\" onclick=\"JavaScript:doAdminLogin();\">Admin Login</a>";
}
%>
</script>
</head>
<body>
<a name="top" />
<div id="mainDiv">
<div id="titleDiv">
<div id="titleImageDiv">
<img src="images/title.gif" border="0" width="234" height="88" />
</div>
<div id="poweredByDiv"><br /><img src="images/tiandinet.com.gif" border="0" width="140" height="65" /></div>
</div>
<div id="navBarDiv"><%=adminLoginLink%> <a href="WriteServlet">Write</a> </div>
<div id="messagesDiv">
<!-- Begin Iterator -->
<%
String ipAddr = "";
String picLink = "";
int picIndex = 0;
Msg message = null;
Pic pic = null;
String replyLink = "";
String replyMsg = "";
for (; i < currentPageMessageTotal; i++) {
message = (Msg)messages.get(new Integer(i));
if (conf.getShowIp().equals(new Integer(1))) {
ipAddr = " <strong>IP:</strong> " + message.getIp();
}
Set pics = message.getPics();
if (pics != null && pics.size() > 0) {
picLink = "<br /><br />";
picLink += "<table width=\"80%\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\" bgcolor=\"#F1F1F1\">";
picLink += " <tr>";
picLink += " <td align=\"left\"> <strong>上传的图片(" + pics.size() + ")</strong></td>";
picLink += " </tr>";
picLink += " <tr>";
picLink += " <td>";
Iterator picIterator = pics.iterator();
while (picIterator.hasNext()) {
picIndex++;
if (picIndex > 4) {
picLink += "<br />";
}
pic = (Pic)picIterator.next();
picLink += "<img src=\"uploadImages/" + pic.getFilename() + "\" border=\"0\" />";
}
picLink += " </td>";
picLink += " </tr>";
picLink += "</table>";
}
else {
picLink = "";
}
String adminDeleteLink = "";
if (showAdmin) {
adminDeleteLink = "<a href=\"#\" onclick=\"doAdminDelete('" + message.getMsgId() + "'); return false;\"><font color=\"#FF0000\">Delete</font></a>";
}
else {
adminDeleteLink = "";
}
replyLink = "<a href=\"WriteServlet?replyId=" + message.getMsgId() + "\"><font color=\"#000000\"><em>Reply</em></font></a>";
replyMsg = "";
if (replyMsgs.size() > 0) {
Msg tmpMsg = (Msg)replyMsgs.get(new String(message.getMsgId()));
if (tmpMsg != null && !tmpMsg.getMsgId().equals("Deleted")) {
replyMsg += "<table width=\"94%\" border=\"0\" cellspacing=\"5\" cellpadding=\"5\" align=\"center\">";
replyMsg += " <tr>";
replyMsg += " <tr>";
replyMsg += " <td bgcolor=\"#F1F1F1\" align=\"left\">";
replyMsg += "<strong>回复:</strong> 最初由 <strong>" + tmpMsg.getName() + "</strong> 发表于 <strong>" + DateFormat.getDateTimeInstance().format(tmpMsg.getPostTime()) + "</strong><br /><br />";
replyMsg += tmpMsg.getContent();
replyMsg += " </td>";
replyMsg += "</table><br />";
}
else {
replyMsg += "<table width=\"94%\" border=\"0\" cellspacing=\"5\" cellpadding=\"5\" align=\"center\">";
replyMsg += " <tr>";
replyMsg += " <tr>";
replyMsg += " <td bgcolor=\"#F1F1F1\" align=\"left\">";
replyMsg += "<strong>回复:</strong> <font color=\"#FF0000\">原留言已经被删除!</font>";
replyMsg += " </td>";
replyMsg += "</table><br />";
}
if (message.getReId().equals("NONE")) {
replyMsg = "";
}
}
String headima = message.getHeadima();
if (headima == null || headima.equals("")) {
headima = "no.gif";
}
headima = "<img src=\"images/headimas/" + headima + "\" border=\"0\" />";
%>
<div class="messageDiv">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100" align="center" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="personalInfoTable">
<tr align="left">
<td height="20" colspan="3"> <%=message.getName()%></td>
</tr>
<tr align="center" valign="middle">
<td height="36" colspan="3"><%=headima%></td>
</tr>
<tr align="center" valign="middle">
<td width="33%" height="20"><img src="images/qq.gif" border="0" title="<%=message.getQq()%>" /></td>
<td width="33%" height="20"><img src="images/msn.gif" border="0" title="<%=message.getMsn()%>" /></td>
<td width="33%" height="20"><img src="images/email.gif" border="0" title="<%=message.getEmail()%>" /></td>
</tr>
</table></td>
<td align="center" valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td height="20" align="left" valign="middle">
<strong><%=DateFormat.getDateTimeInstance().format(message.getPostTime())%></strong><%=ipAddr%>
</td>
<td align="right" valign="middle"><%=adminDeleteLink%> <%=replyLink%></td>
</tr>
<tr>
<td colspan="2" bgcolor="#59666C" height="1"></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="left" valign="top"><%=replyMsg%><%=message.getContent()%><%=picLink%></td>
</tr>
</table></td>
</tr>
</table>
</div>
<br />
<%
}
%>
<!-- End Iterator -->
</div>
<div id="msgInfoPageLinkDiv">
<div id="msgInfoDiv"> 总共有留言 <strong><%=messageTotal%></strong> 条,共 <strong><%=pageTotal%></strong> 页</div>
<div id="pageLinkDiv"><%=pageLink%> </div>
</div>
<div id="bottomNavBarDiv"><a href="#top">TOP</a> </div>
<div id="copyrightDiv">
<div id="copyrightFontDiv"> © Since 2003 <a href="http://www.tiandinet.com" target="_blank">天地网络</a> All Rights Reserved <strong>Powered</strong> by <a href="mailto:tiandinet_support@hotmail.com">Tiandi</a></div>
<div id="hibernateLog"><a href="http://www.hibernate.org" target="_blank"><img src="images/hibernate.gif" border="0" width="226" height="40" /></a></div>
</div>
</div>
<%
// delete msg form
if (showAdmin) {
String actionURL = response.encodeURL("AdminServlet");
%>
<form style="margin: 0px" method="post" action="<%=actionURL%>" name="adminDeleteMsgForm">
<input type="hidden" name="deleteMsgId" />
<input type="hidden" name="action" value="delMsg" />
</form>
<%
}
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -