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

📄 forumdata.jsp

📁 Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统
💻 JSP
字号:
<%@ page contentType="text/html;charset=UTF-8" %>

<%
/**
 *	$RCSfile: forumData.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:12 $
 */
%>

<%@ page import="java.util.*,
                 java.text.SimpleDateFormat,
                 com.jivesoftware.forum.*,
                 com.jivesoftware.forum.util.*"
	errorPage="error.jsp"
%>

<%@ include file="global.jsp" %>

<%	////////////////////
	// Security check

	// make sure the user is authorized to administer users:

%>

<%	////////////////////
	// get parameters

	long sourceID = ParamUtils.getLongParameter(request, "source", -1L);
	long targetID = ParamUtils.getLongParameter(request, "target", -1L);
	String newName = ParamUtils.getParameter(request, "forumName");
	boolean merge = ParamUtils.getBooleanParameter(request, "merge");
	boolean confirm = ParamUtils.getBooleanParameter(request, "confirmed");

	boolean equalsError = (sourceID == targetID);
	boolean noForumSpecified = (sourceID == -1 || targetID == -1);
	boolean noNameSpecified = (newName == null);
	boolean errors = (equalsError || noForumSpecified || noNameSpecified);
%>

<%	////////////////
	// Merge forums, if we've chosen a source and target, have confirmed, and there are no errors
	if(merge && confirm && !errors) {

		// Get Forum objects for the source and target forums.
		Forum sourceForum = forumFactory.getForum(sourceID);
		Forum targetForum = forumFactory.getForum(targetID);
        forumFactory.mergeForums(targetForum, sourceForum);
        if (newName != null) {
            targetForum.setName(newName);
        }
		// merge the forums
		// while(sourceForum.getMessageCount() > 0)  // merge the forums until the sourceforum has 0 messages.
		// {
		//	forumFactory.mergeForums(sourceForum, targetForum);
		// }

		// now, the forum is empty, delete sourceForum
		// forumFactory.deleteForum(sourceForum);

		// change the name of the merged forum.
		// targetForum.setName(newName);
	}
%>

<html>
<head>
	<title></title>
	<link rel="stylesheet" href="style/global.css">

	<script language="JavaScript">

	function changeName() {

		document.mergeForums.forumName.value = document.mergeForums.source.options[document.mergeForums.source.selectedIndex].text;
	}

	</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" onLoad=changeName()>

<%	///////////////////////
	// pageTitleInfo variable (used by include/pageTitle.jsp)
	String[] pageTitleInfo = { "论坛 : 合并论坛数据" };
%>
<%	///////////////////
	// pageTitle include
%>

<p>

<%
///////////
// if we haven't chosen the two forums to merge.

if(!merge || (merge && errors)) {
%>
	<form name="mergeForums" action="forumData.jsp" method="post">
	<input type=hidden name="merge" value="true">

	<%	if(merge && equalsError) {
	%>	<span class="errorText">
		你必须选择两个不同的论坛。<p>
		</span>
	<%	} %>

	<%	if(merge && noForumSpecified) {
	%>	<span class="errorText">
		你必须选择一个源论坛和一个目的论坛<p>
		</span>
	<%	} %>

	<%	if(merge && noNameSpecified) {
	%>	<span class="errorText">
		你必须为合并的论坛输入一个名字。<p>
		</span>
	<%	} %>

	选择两个论坛合并:<p>

	<table border=0 cellpadding=2 cellspacing=2>
	<tr>
		<td><select name="source" onClick=changeName()>
		    <%
			Iterator forumIterator = forumFactory.forums();
			while(forumIterator.hasNext()) {
				Forum tempForum = (Forum)forumIterator.next();
		    %>
		    <option value="<%= tempForum.getID() %>"><%= tempForum.getName() %>
	            <%
			}
	            %>
		    </select>
                </td>
		<td> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td>
		<td><select name="target">
		    <%
			forumIterator = forumFactory.forums();
			while(forumIterator.hasNext()) {
				Forum tempForum = (Forum)forumIterator.next();
		    %>
		    <option value="<%= tempForum.getID() %>"><%= tempForum.getName() %>
		    <%
			}
		    %>
		    </select>
		</td>
	</tr>
	</table>

	<p>
	合并后的论坛的名字:<p>
	<input type=text name="forumName"><p>

	<input type=submit value="Merge Forums">

	</form>
<% } %>

<%	//////////////////
	// We have a valid input, confirm the merge.
	if(merge && !confirm && !errors) {
%>
	<ul><table border=0 cellpadding=0 cellspacing=0 width=500>
	    <tr>
		<td>警告: 此操作将合并论坛
            	    <u><%= forumFactory.getForum(sourceID).getName() %></u> 和
	    	    <u><%= forumFactory.getForum(targetID).getName() %></u> 的数据并创建一个新的论 <u><%= newName %></u>。这是一个不可撤消的操作,你确定要这样做?
		</td>
	    </tr>
	    </table>
	</ul><p>

	<form action="forumData.jsp" method="post">
	<input type=hidden name="confirmed" value="true">
	<input type=hidden name="merge" value="true">
	<input type=hidden name="source" value="<%= sourceID %>">
	<input type=hidden name="target" value="<%= targetID %>">
    <input type=hidden name="forumName" value="<%= newName %>">

	<input type=submit value="确定">
	<input type=submit name="cancel" value="取消" style="font-weight:bold;" onclick="location.href='forumData.jsp';return false;">
	</form>

<%	} %>

<%	/////////////
	// Completion message
	if(merge && confirm && !errors) {
%>

	<u><%= forumFactory.getForum(sourceID).getName() %></u> 和
	<u><%= forumFactory.getForum(targetID).getName() %></u> 合并成功。
<%
	}
%>

<body>
</html>

⌨️ 快捷键说明

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