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

📄 propmigration.jsp

📁 一个jive论坛管理的源码 学习Jive源程序
💻 JSP
字号:
<%@ page contentType="text/html;charset=GB2312" %>
<%
/**
 *	$RCSfile: propMigration.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:17 $
 */
%>

<%@ page import="java.util.*,
				 java.text.*,
				 com.jivesoftware.util.*,
                 com.jivesoftware.forum.*,
				 com.jivesoftware.forum.database.*,
				 com.jivesoftware.forum.util.*"
%>

<%! // Global vars/methods for the entire skin

    static final String tblBorderColor = "#999999";
    static final String errorColor = "#ff0000";
    static final String messageColor = "#006600";

    private String getOneTimeMessage(HttpSession session, String name) {
        String message = (String)session.getAttribute("jive.admin."+name);
        if (message != null) {
            session.removeAttribute("jive.admin."+name);
            return message;
        }
        return null;
    }

    private void setOneTimeMessage(HttpSession session, String name, String value) {
        session.setAttribute("jive.admin."+name, value);
    }
%>

<%	// Security check
	Authorization authToken = (Authorization)session.getAttribute("jive.admin.authorization");
	if (authToken == null) {
		response.sendRedirect("login.jsp");
		return;
	} else {
        // check for an anonymous user token
        if (authToken.isAnonymous()) {
		    response.sendRedirect("login.jsp");
		    return;
        }
    }

    // Get the forum factory object.
    ForumFactory forumFactory = ForumFactory.getInstance(authToken);
    // Get the user of this page
    User pageUser = null;
    try {
        forumFactory.getUserManager().getUser(authToken.getUserID());
    }
    catch (Exception e) {
		response.sendRedirect("login.jsp");
		return;
    }

    String onload = "";
%>

<%	// get parameters
	boolean migrate = ParamUtils.getBooleanParameter(request,"migrate");
    boolean success = ParamUtils.getBooleanParameter(request,"success");

    if (migrate) {
        UserManager userManager = forumFactory.getUserManager();
        // Get an iterator of users, loop through and change prop names
        for (Iterator iter=userManager.users(); iter.hasNext();) {
            try {
                User user = (User)iter.next();
                // get old prop values
                String occupation = user.getProperty("occupation");
                String location = user.getProperty("location");
                String homepage = user.getProperty("homepage");
                String timeZoneID = user.getProperty("jive.timeZoneID");
                String jiveThreadRange = user.getProperty("jive.threadRange");
                String jiveMessageRange = user.getProperty("jive.messageRange");
                String alwaysEmailNotify = user.getProperty("alwaysEmailNotify");
                String autoAddMessageWatch = user.getProperty("autoAddMessageWatch");
                String autoAddThreadWatch = user.getProperty("autoAddThreadWatch");
                // insert new ones & delete old ones
                if (occupation != null) {
                    user.setProperty("jiveOccupation", occupation);
                    user.deleteProperty("occupation");
                }
                if (location != null) {
                    user.setProperty("jiveLocation", location);
                    user.deleteProperty("location");
                }
                if (homepage != null) {
                    user.setProperty("jiveHomepage", homepage);
                    user.deleteProperty("homepage");
                }
                if (timeZoneID != null) {
                    user.setProperty("jiveTimeZoneID", timeZoneID);
                    user.deleteProperty("timeZoneID");
                }
                if (jiveThreadRange != null) {
                    user.setProperty("jiveThreadRange", jiveThreadRange);
                    user.deleteProperty("jive.threadRange");
                }
                if (jiveMessageRange != null) {
                    user.setProperty("jiveMessageRange", jiveMessageRange);
                    user.deleteProperty("jive.messageRange");
                }
                if (alwaysEmailNotify  != null) {
                    user.setProperty("jiveAutoAddEmailWatch", alwaysEmailNotify);
                    user.deleteProperty("alwaysEmailNotify");
                }
                if (autoAddMessageWatch  != null) {
                    user.setProperty("jiveAutoWatchNewTopics", autoAddMessageWatch);
                    user.deleteProperty("autoAddMessageWatch");
                }
                if (autoAddThreadWatch  != null) {
                    user.setProperty("jiveAutoWatchReplies", autoAddThreadWatch);
                    user.deleteProperty("autoAddThreadWatch");
                }
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }
        response.sendRedirect("propMigration.jsp?success=true");
        return;
    }
%>

<html>
<head>
<title>Jive论坛管理工具 - 用户属性移植</title>
<style type="text/css">
P, DIV, TD, UL, LI, SPAN, BODY {
    font-family : arial,helvetica,sans-serif;
}
PRE {
    font-size : 9pt;
}
A {
    text-decoration : underline;
}
A:hover {
    text-decoration : none;
    color : #6699cc;
}
</style>

</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" alink="#6699cc">

<p>

<%  // Title of this page and breadcrumbs
    String title = "用户属性移植";
%>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<td>
<b><%= title %></b>
</td>
</table>
<hr size="0">

<font size="-1">
Jive论坛2.0和2.1版的某些用户属性已经改变。这个工具将运行你更新扩展的用户属性为新的格式。
</font>

<p>

<%  if (success) { %>
    <font size="-1" color="#009900">
    用户属性移植成功!
    </font>
    <p>
<%  } %>

<form action="propMigration.jsp">
<input type="hidden" name="migrate" value="true">
<center>
<font size="-1">
<input type="submit" value="移植用户属性">
</font>
<br>
<font size="-1">
(注意: 这可能需要花费几分钟)
</font>
</center>
</form>

</body>
</html>

⌨️ 快捷键说明

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