📄 reports.jsp
字号:
<%-- - - $RCSfile: reports.jsp,v $ - $Revision: 1.9.2.2 $ - $Date: 2003/07/24 19:03:15 $ - - Copyright (C) 1999-2002 Jive Software. All rights reserved. - - This software is the proprietary information of Jive Software. Use is subject to license terms. ---%><%@ 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, java.util.List" errorPage="error.jsp"%><%@ include file="global.jsp" %> <% // Permission check if (!isSystemAdmin) { throw new UnauthorizedException("You don't have admin privileges to perform this operation."); } // get actions boolean save = ParamUtils.getBooleanParameter(request,"save"); boolean test = ParamUtils.getBooleanParameter(request,"testGraphics"); boolean useDefaultOutputDir = ParamUtils.getBooleanParameter(request,"useDefaultOutputDir"); String outputDir = ParamUtils.getParameter(request,"outputDir",true); 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; boolean useTimestampDir = ParamUtils.getBooleanParameter(request,"useTimestampDir"); // Get the report manager ReportManager reportManager = ReportManager.getInstance(); // Set the default output directory String defaultOutputDir = (reportManager.getOutputDir()).toString(); 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 (test) { // 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 (useTimestampDir) { JiveGlobals.setJiveProperty("stats.useTimestampDir", "true"); } else { JiveGlobals.deleteJiveProperty("stats.useTimestampDir"); } if (outputDir != null) { reportManager.setOutputDir(new File(outputDir.trim())); response.sendRedirect("reports.jsp"); return; } // indicate if we should use a } 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; } useTimestampDir = "true".equals(JiveGlobals.getJiveProperty("stats.useTimestampDir"));%><%@ include file="header.jsp" %><% // 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()) {%> <p> A report is currently running. Once the report is finished you will be able to change the report settings. </p> <p> To view the stats of the report, please see the <a href="runReports.jsp">report status</a> page. </p><% } // 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"> <b>Test Server-Side Graphics Capability</b> <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> <p> 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> or the use of JDK 1.4's "headless mode." Use the button below to test whether your server environment is properly configured to support image generation. </p> <% if (test && testSuccess) { %> <p style="color:#090;"> <b>Test Successful</b> <br> Your server-side environment is correctly configured to run the Jive Forums reporting tools. </p> <% } else if (test && !testSuccess) { %> <p style="color:#f00;"> <b>Test Failed</b> <br> 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. </p> <% } %> <input type="submit" value="Run Test"> </ul> </form> <form action="reports.jsp" method="post" name="reportsForm"> <input type="hidden" name="save" value="true"> <b>Reports Output Directory</b> <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> <p> Report information is saved to the directory listed below. By default, reports are written to your jiveHome directory so you will need to browse your filesystem in order to view them. You may wish to enter an alternative directory that is in the path of your webserver documents directory so that the reports are publicly viewable. </p> <% if (save && outputDirErrors) { %> <p class="jive-error-text"> <b>Error:</b>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -