propmigration.jsp

来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 197 行

JSP
197
字号
<%/** *	$RCSfile: propMigration.jsp,v $ *	$Revision: 1.1 $ *	$Date: 2002/03/05 21:57:01 $ */%><%@ 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("jive.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 Forums Admin Tool - User Property Migration</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 = "User Property Migration";%><table cellpadding="0" cellspacing="0" border="0" width="100%"><td><b><%= title %></b></td></table><hr size="0"><font size="-1">Some of the names of extended user properties have changed from Jive Forums 2.0 and Jive Forums 2.1. This tool will allow you to updateyour extended user properties to the new format.</font><p><%  if (success) { %>    <font size="-1" color="#009900">    User properties migrated successfully!    </font>    <p><%  } %><form action="propMigration.jsp"><input type="hidden" name="migrate" value="true"><center><font size="-1"><input type="submit" value="Migrate User Properties"></font><br><font size="-1">(Note: This might take a few minutes)</font></center></form></body></html>

⌨️ 快捷键说明

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