ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/DBReporter/IscreamLayout.java
(Generate patch)

Comparing projects/cms/source/reports/DBReporter/IscreamLayout.java (file contents):
Revision 1.1 by pjm2, Mon Dec 11 16:34:16 2000 UTC vs.
Revision 1.16 by pjm2, Sun Jan 7 17:12:43 2001 UTC

# Line 33 | Line 33 | public class IscreamLayout {
33          bw.write("<html>");
34          bw.write("<head>");
35          bw.write("<title>"+title+"</title>");
36 +        bw.write("<meta http-equiv=\"pragma\" content=\"no-cache\">");
37 +        bw.write("<meta http-equiv=\"cache-control\" content=\"no-cache\">");
38          bw.write("<meta name=\"description\" content=\""+metaDescription+"\">");
39          bw.write("<meta name=\"keywords\" content=\""+metaKeywords+"\">");
40          bw.write("<meta name=\"generator\" content=\"pjm2's DBReporterMain\">");
# Line 48 | Line 50 | public class IscreamLayout {
50      
51      public static void printLeftMenu(BufferedWriter bw) throws IOException{
52          bw.newLine();
53 <        bw.write("<!--#include virtual=\"left.inc\" -->");
53 >        bw.write("<!--#include virtual=\"../left.inc\" -->");
54          bw.newLine();
55          bw.write("</td><td valign=\"top\">");
56          bw.newLine();
# Line 57 | Line 59 | public class IscreamLayout {
59      
60      public static void printTitle(BufferedWriter bw, String title) throws IOException{
61          bw.newLine();
62 <        bw.write("<!--#include virtual=\"title.inc\" -->");
62 >        bw.write("<!--#include virtual=\"../title.inc\" -->");
63          bw.newLine();
64          bw.newLine();
65          bw.write("<h3>"+title+"</h3>");
# Line 65 | Line 67 | public class IscreamLayout {
67          bw.flush();
68      }
69      
70 <    public static void printGraph(BufferedWriter bw, String filename, int width, int height) throws IOException{
70 >    public static void printGraph(BufferedWriter bw, String filename, int width, int height, int type, long startDate, long endDate) throws IOException{
71 >        
72 >        String graphTitle = "Unknown time period";
73 >        String xAxisTitle = "Time";
74 >        String yAxisTitle = "Value";
75 >        String scaleRow = " <tr><td>&nbsp;</td><td align=\"left\">"+DateUtils.dateString(startDate)+"</td><td align=\"right\">"+DateUtils.dateString(endDate)+"</td></tr>";
76 >        int colspan = 2;
77 >        
78 >        switch (type) {
79 >            case ReportPage.HOUR:
80 >                graphTitle = "Hourly report from "+DateUtils.dateString(startDate)+" to "+DateUtils.dateString(endDate);
81 >                scaleRow = " <tr><td>&nbsp;</td>";
82 >                for (long i = startDate; i < endDate; i+=DateUtils.secsPerHour/6){
83 >                    scaleRow += "<td align=\"center\" width=\""+(100/colspan)+"%\"><font size=\"2\">"+DateUtils.timeString(i)+"</font></td>";
84 >                }
85 >                scaleRow += "</tr>";
86 >                colspan = 6;
87 >                break;
88 >            case ReportPage.DAY:
89 >                graphTitle = "24 hour report from "+DateUtils.dateString(startDate)+" to "+DateUtils.dateString(endDate);
90 >                scaleRow = " <tr><td>&nbsp;</td>";
91 >                for (int i = 0; i < 24; i++){
92 >                    scaleRow += "<td align=\"center\" width=\""+(100/colspan)+"%\"><font size=\"2\">"+i+"</font></td>";
93 >                }
94 >                scaleRow += "</tr>";
95 >                colspan = 24;
96 >                break;
97 >            case ReportPage.WEEK:
98 >                graphTitle = "7 day report from "+DateUtils.shortDateString(startDate)+" to "+DateUtils.shortDateString(endDate);
99 >                colspan = 7;
100 >                scaleRow = " <tr><td>&nbsp;</td>";
101 >                for (long i = startDate; i < endDate; i+=DateUtils.secsPerDay){
102 >                    scaleRow += "<td align=\"center\" width=\""+(100/colspan)+"%\">"+DateUtils.dayName(i)+"</td>";
103 >                }
104 >                scaleRow += "</tr>";
105 >                break;
106 >            case ReportPage.MONTH:
107 >                graphTitle = "30 day report from "+DateUtils.shortDateString(startDate)+" to "+DateUtils.shortDateString(endDate);
108 >                scaleRow = " <tr><td>&nbsp;</td><td align=\"left\">"+DateUtils.shortDateString(startDate)+"</td><td align=\"right\">"+DateUtils.shortDateString(endDate)+"</td></tr>";
109 >                colspan = 2;
110 >                break;
111 >            default:
112 >                // Do nothing, leave values as they are.
113 >        }
114 >        
115          bw.write("<table border=\"0\">");
116 <        bw.write(" <tr><td>&nbsp;</td><td colspan=\"2\"><b>Visual representation of the last 7 days</b></td></tr>");
117 <        bw.write(" <tr><td>y axis</td><td colspan=\"2\"><img src=\""+filename+"\" width=\""+width+"\" height=\""+height+"\"></td></tr>");
118 <        bw.write(" <tr><td>&nbsp;</td><td align=\"left\">7 days ago</td><td align=\"right\">now</td>");
116 >        bw.write(" <tr><td>&nbsp;</td><td colspan=\""+colspan+"\"><b>"+graphTitle+"</b></td></tr>");
117 >        bw.write(" <tr><td valign=\"top\" align=\"right\">max</td><td colspan=\""+colspan+"\" rowspan=\"3\"><img src=\""+filename+"\" width=\""+width+"\" height=\""+height+"\"></td></tr><tr><td valign=\"middle\" align=\"right\">"+yAxisTitle+"</td></tr><tr><td valign=\"bottom\" align=\"right\">min</td></tr>");
118 >        bw.write(scaleRow);
119          bw.write("</table>");
120          bw.newLine();
121          bw.flush();
122      }
123      
124      public static void printTable(BufferedWriter bw, PlotData pd) throws IOException{
125 +
126          bw.write("<table border=\"0\"  align=\"center\">");
127          
128          bw.write("<tr bgcolor=\"black\"><td><font color=\"white\">Date</font></td><td><font color=\"white\">Value</font></td></tr>");
129          
130 +        // Alternating row colours.
131          String rowColour1 = "#ccccff";
132          String rowColour2 = "#ffffff";
133          
# Line 107 | Line 155 | public class IscreamLayout {
155      
156      public static void printBottom(BufferedWriter bw) throws IOException{
157          bw.newLine();
158 <        bw.write("<!--#include virtual=\"bottom.inc\" -->");
158 >        bw.write("<!--#include virtual=\"../bottom.inc\" -->");
159          bw.newLine();
160          bw.newLine();
161          bw.flush();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines