📄 archivesettings.jsp
字号:
<%/** * $RCSfile: archiveSettings.jsp,v $ * $Revision: 1.5 $ * $Date: 2003/04/30 16:32:28 $ */%><%@ page import="java.util.*, java.text.*, com.jivesoftware.forum.*, com.jivesoftware.forum.database.*, com.jivesoftware.forum.util.*, com.jivesoftware.util.ParamUtils" errorPage="error.jsp"%><%@ include file="global.jsp" %><%! final static int[] INTERVAL_HOURS = { 1, 2, 4, 8, 12, 24, 48 }; final static int DEFAULT_INTERVAL_HOUR = 12; final static int[] THREAD_DAYS = { 10, 20, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 365 }; final static int DEFAULT_THREAD_DAY = 180;%><% // Permission check if (!isSystemAdmin) { throw new UnauthorizedException("You don't have admin privileges to perform this operation."); } // Get parameters long forumID = ParamUtils.getLongParameter(request,"forum",-1L); long archiveForumID = ParamUtils.getLongParameter(request,"archiveForum",-1L); boolean doArchive = request.getParameter("doArchive") != null; boolean running = ParamUtils.getBooleanParameter(request,"running"); boolean saveGlobal = request.getParameter("saveGlobal") != null; boolean saveForum = ParamUtils.getBooleanParameter(request,"saveForum"); boolean saveEnable = request.getParameter("saveEnable") != null; boolean saveDays = request.getParameter("saveDays") != null; boolean saveMode = request.getParameter("saveMode") != null; boolean autoArchiveEnabled = ParamUtils.getBooleanParameter(request,"autoArchiveEnabled"); boolean archiveEnabled = ParamUtils.getBooleanParameter(request,"archiveEnabled"); int autoArchiveInterval = ParamUtils.getIntParameter(request,"autoArchiveInterval",DEFAULT_INTERVAL_HOUR); int threadInactInterval = ParamUtils.getIntParameter(request,"threadInactInterval",DEFAULT_THREAD_DAY); int archiveMode = ParamUtils.getIntParameter(request,"archiveMode",ArchiveManager.MARK_ONLY); // In global mode? boolean isGlobal = (forumID == -1L); // Load a forum, if specified Forum forum = null; if (!isGlobal) { forum = forumFactory.getForum(forumID); } // Load the archive forum if specified: Forum archiveForum = null; if (!isGlobal && archiveForumID != -1L) { try { archiveForum = forumFactory.getForum(archiveForumID); } catch (Exception ignored) {} } // Get the archive manager ArchiveManager archiveManager = forumFactory.getArchiveManager(); // If a request to start the archive task was received, do that: if (doArchive) { archiveManager.runArchiver(); // Done, so redirect response.sendRedirect("archiveSettings.jsp?running=true&forum=" + forumID); return; } // Save if (saveEnable && saveGlobal) { // set auto archiving archiveManager.setAutoArchiveEnabled(autoArchiveEnabled); } else if (saveGlobal) { // set auto-archive interval archiveManager.setAutoArchiveInterval(autoArchiveInterval); // done, so redirect response.sendRedirect("archiveSettings.jsp"); return; } else if (saveForum) { if (saveEnable) { // Enable/Disable archiving archiveManager.setArchivingEnabled(forum, archiveEnabled); } else if (saveDays) { // Number of inactive days b4 archiving: archiveManager.setArchiveDays(forum, threadInactInterval); } else if (saveMode) { // set the archiving mode archiveManager.setArchiveMode(forum, archiveMode); // if the mode is to move to another forum, set the forum: if (archiveForum != null && archiveMode == ArchiveManager.MOVE_THREADS) { archiveManager.setArchiveForum(forum, archiveForum); } } // done, so redirect: response.sendRedirect("archiveSettings.jsp?forum=" + forumID); return; } // Get properties as they are set in the system: if (isGlobal) { autoArchiveEnabled = archiveManager.isAutoArchiveEnabled(); autoArchiveInterval = archiveManager.getAutoArchiveInterval(); } else { archiveEnabled = archiveManager.isArchivingEnabled(forum); threadInactInterval = archiveManager.getArchiveDays(forum); archiveMode = archiveManager.getArchiveMode(forum); archiveForum = archiveManager.getArchiveForum(forum); } java.util.Date lastArchiveTime = archiveManager.getLastArchivedDate(); // Indicate if the archiver is currently running boolean isBusy = archiveManager.isBusy();%><% if (!isGlobal) { // Put the forum in the session (is needed by the sidebar) session.setAttribute("admin.sidebar.forums.currentForumID", ""+forumID); // special onload command to load the sidebar onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=forum';\""; }%><%@ include file="header.jsp" %><% // Title of this page and breadcrumbs String title = "Archive Settings"; String[][] breadcrumbs = null; if (isGlobal) { breadcrumbs = new String[][] { {"Main", "main.jsp"}, {title, "archiveSettings.jsp"} }; } else { breadcrumbs = new String[][] { {"Main", "main.jsp"}, {title, "archiveSettings.jsp?forum=" + forumID} }; }%><%@ include file="title.jsp" %><% if (isGlobal) { %> <% if (running) { %> <p> <font size="-1"> <i>An archiving task has been started in the background.</i> </font> </p> <% } %> <font size="-1"> <b>Auto-Archiving</b> </font> <ul> <font size="-1">Enable or disable automatic archiving. If auto-archiving is disabled your content will not be automatically moved or deleted.</font> <p> <form action="archiveSettings.jsp"> <input type="hidden" name="saveGlobal" value="true"> <input type="hidden" name="saveEnable" value="true"> <table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="300"> <td> <table bgcolor="<%= tblBorderColor %>" cellpadding="3" cellspacing="1" border="0" width="100%"> <tr bgcolor="#ffffff"> <td align="center"<%= (autoArchiveEnabled)?" bgcolor=\"#99cc99\"":"" %>> <input type="radio" name="autoArchiveEnabled" value="true" id="rb01" <%= (autoArchiveEnabled)?"checked":"" %>> <label for="rb01"><%= (autoArchiveEnabled)?"<b>On</b>":"On" %></label> </td> <td align="center"<%= (!autoArchiveEnabled)?" bgcolor=\"#cc6666\"":"" %>> <input type="radio" name="autoArchiveEnabled" value="false" id="rb02" <%= (!autoArchiveEnabled)?"checked":"" %>> <label for="rb02"><%= (!autoArchiveEnabled)?"<b>Off</b>":"Off" %></label> </td> <td align="center"> <input type="submit" name="submitButton" value="Update"> </td> </tr> </table> </td> </table> </form> </ul> <% if (autoArchiveEnabled) { %> <ul> <font size="-1"> <form action="archiveSettings.jsp"> <input type="hidden" name="saveGlobal" value="true"> <table cellpadding="2" cellspacing="0" border="0"> <tr> <td><font size="-1">Hours between archiving:</font></td> <td> <select size="1" name="autoArchiveInterval"> <% for (int i=0; i<INTERVAL_HOURS.length; i++) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -