📄 reports.jsp
字号:
<%/** * $RCSfile: reports.jsp,v $ * $Revision: 1.6 $ * $Date: 2002/11/23 02:50:11 $ */%><%@ page import="java.awt.*, java.awt.image.*, java.io.*, java.util.*, java.text.*, com.jivesoftware.util.*, com.jivesoftware.forum.*, com.jivesoftware.forum.database.*, com.jivesoftware.forum.stats.*, com.jivesoftware.forum.util.*, com.jivesoftware.base.stats.util.*, com.jivesoftware.util.DateRange, com.jivesoftware.util.RelativeDateRange"%><%@ include file="global.jsp" %> <% // Permission check if (!isSystemAdmin) { throw new UnauthorizedException("You don't have admin privileges to perform this operation."); } ReportManager reportManager = ReportManager.getInstance(); // get parameters boolean save = ParamUtils.getBooleanParameter(request,"save"); boolean useDefaultOutputDir = ParamUtils.getBooleanParameter(request,"useDefaultOutputDir"); String outputDir = ParamUtils.getParameter(request,"outputDir",true); String defaultOutputDir = (reportManager.getOutputDir()).toString(); boolean testGraphics = ParamUtils.getBooleanParameter(request,"testGraphics"); boolean createDir = ParamUtils.getBooleanParameter(request,"createDir"); long[] forumIDs = ParamUtils.getLongParameters(request,"forum",-1L); long[] excludedForumIDs = ParamUtils.getLongParameters(request,"excludedForum",-1L); boolean addExcludedForumID = request.getParameter("addExcludedForumID") != null; boolean removeExcludedForumID = request.getParameter("removeExcludedForumID") != null; String datePresetValue = ParamUtils.getParameter(request,"datePresetValue"); boolean setDatePresetValue = request.getParameter("setDatePresetValue") != null; boolean enableUserGroupReports = ParamUtils.getBooleanParameter(request,"enableUserGroupReports"); boolean saveUserGroupReportPref = request.getParameter("saveUserGroupReportPref") != null; if (saveUserGroupReportPref) { reportManager.setEnableUserReports(enableUserGroupReports); response.sendRedirect("reports.jsp"); return; } enableUserGroupReports = reportManager.isEnableUserReports(); if (setDatePresetValue) { RelativeDateRange dateRange = new RelativeDateRange("", datePresetValue); reportManager.setGlobalDateRange(dateRange); response.sendRedirect("reports.jsp"); return; } DateRange datePreset = reportManager.getGlobalDateRange(); if (addExcludedForumID) { for (int i=0; i<forumIDs.length; i++) { if (forumIDs[i] != -1L) { try { Forum f = forumFactory.getForum(forumIDs[i]); reportManager.addExcludedForumID(forumIDs[i]); } catch (ForumNotFoundException fnfe) {} } } response.sendRedirect("reports.jsp"); return; } if (removeExcludedForumID) { for (int i=0; i<excludedForumIDs.length; i++) { if (excludedForumIDs[i] != -1L) { try { Forum f = forumFactory.getForum(excludedForumIDs[i]); reportManager.removeExcludeForumID(excludedForumIDs[i]); } catch (ForumNotFoundException fnfe) {} } } response.sendRedirect("reports.jsp"); return; } // Get the list of excluded forums: java.util.List excludedForums = reportManager.getExcludedForumIDs(); boolean testSuccess = false; if (testGraphics) { // try to create a BufferedImage, get a graphics context try { BufferedImage image = new BufferedImage(10,10,BufferedImage.TYPE_INT_RGB); Graphics2D g2d = (Graphics2D)image.getGraphics(); testSuccess = true; } catch (Throwable t) { //t.printStackTrace(); } } boolean outputDirErrors = false; boolean createDirErrors = false; if (save) { if (useDefaultOutputDir) { outputDir = JiveGlobals.getJiveHome() + File.separator + "stats" + File.separator + "reports"; } try { File dir = new File(outputDir); if (!dir.exists()) { if (createDir) { if (!dir.mkdir()) { createDirErrors = true; } } else { outputDirErrors = true; } } if (!dir.canRead()) { outputDirErrors = true; } } catch (Exception e) { outputDirErrors = true; } } if (save && !outputDirErrors && !createDirErrors) { // save the report output dir JiveGlobals.setJiveProperty("stats.useDefaultOutputDir", ""+useDefaultOutputDir); if (outputDir != null) { reportManager.setOutputDir(new File(outputDir.trim())); response.sendRedirect("reports.jsp"); return; } } String currentUseDefaultOutputDir = JiveGlobals.getJiveProperty("stats.useDefaultOutputDir"); if (currentUseDefaultOutputDir == null || "".equals(currentUseDefaultOutputDir)) { useDefaultOutputDir = true; } else { useDefaultOutputDir = "true".equals(JiveGlobals.getJiveProperty("stats.useDefaultOutputDir")); } String currentOutputDir = JiveGlobals.getJiveProperty("stats.outputDir"); if (currentOutputDir == null || "".equals(currentOutputDir)) { if (!defaultOutputDir.equals(currentOutputDir)) { outputDir = ""; } else { outputDir = defaultOutputDir; } } else { outputDir = currentOutputDir; }%><%@ include file="header.jsp" %><p><% // Title of this page and breadcrumbs String title = "Configure Reports"; String[][] breadcrumbs = { {"Main", "main.jsp"}, {title, "reports.jsp"} };%><%@ include file="title.jsp" %><% // Check to see if there is a report running - if so, don't display // any of the options below if (reportManager.isReportRunning()) {%> <font size="-1"> A report is currently running. Once the report is finished you will be able to change the report settings. </font><p> <font size="-1"> To view the stats of the report, please see the <a href="runReports.jsp">report status</a> page.<% } // No report is running so show the report options else {%> <form action="reports.jsp" method="post" name="reportsForm"> <input type="hidden" name="testGraphics" value="true"> <font size="-1"><b>Test Server-Side Graphics Capability</b></font> <a href="#" onclick="helpwin('reports','server_side_graphics');return false;" title="Click for help" ><img src="images/help-16x16.gif" width="16" height="16" border="0"></a> <ul> <font size="-1"> The reporting package requires that your server environment support creating images. By default, many Unix-based servers are not configured for this support and require installation of the <a href="pja-install.html" target="_new">PJA Toolkit</a>. Use the button below to test whether your server environment is properly configured to support image generation.<p> <font color="#ff0000">Warning:</font> If you're using the IBM JDK running this test might crash your VM.<p> </font> <% if (testGraphics && testSuccess) { %> <font size="-1" color="#009900"><b>Test Successful</b></font><br> <font size="-1">Your server-side environment is correctly configured to run the Jive Forums reporting tools.</font> <p> <% } else if (testGraphics && !testSuccess) { %> <font size="-1" color="#ff0000"><b>Test Failed</b></font><br> <font size="-1">Your appserver is not properly configured to run the Jive Forums reporting tools. Please follow the <a href="pja-install.html" target="_new">PJA Toolkit</a> documentation, restart your appserver and attempt this test again.</font> <p> <% } %> <input type="submit" value="Run Test"> </ul> </form> <form action="reports.jsp" method="post" name="reportsForm"> <input type="hidden" name="save" value="true"> <font size="-1"><b>Reports Output Directory</b></font> <a href="#" onclick="helpwin('reports','output_directory');return false;" title="Click for help" ><img src="images/help-16x16.gif" width="16" height="16" border="0"></a> <ul> <font size="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -