| 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\">"); |
| 41 |
|
bw.write("</head>"); |
| 42 |
|
bw.write("<body bgcolor=\"#ffffff\" link=\"#0000ff\" alink=\"#3333cc\" vlink=\"#3333cc\" text=\"#000066\">"); |
| 43 |
< |
bw.write("<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">"); |
| 43 |
> |
bw.write("<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\">"); |
| 44 |
|
bw.write(" <tr>"); |
| 45 |
|
bw.write(" <td valign=\"top\">"); |
| 46 |
|
bw.write(""); |
| 52 |
|
bw.newLine(); |
| 53 |
|
bw.write("<!--#include virtual=\"../left.inc\" -->"); |
| 54 |
|
bw.newLine(); |
| 53 |
– |
bw.write("</td><td valign=\"top\">"); |
| 54 |
– |
bw.newLine(); |
| 55 |
|
bw.flush(); |
| 56 |
|
} |
| 57 |
|
|
| 65 |
|
bw.flush(); |
| 66 |
|
} |
| 67 |
|
|
| 68 |
+ |
public static void printMachines(BufferedWriter bw, LinkedList list) throws IOException{ |
| 69 |
+ |
bw.write("<table border=\"0\" align=\"center\">"); |
| 70 |
+ |
|
| 71 |
+ |
Iterator it = list.iterator(); |
| 72 |
+ |
while (it.hasNext()){ |
| 73 |
+ |
ReportPage rp = (ReportPage)it.next(); |
| 74 |
+ |
bw.write("<tr><td><font size=\"4\"><a href=\"../"+rp.getWhen()+rp.getMachineName()+"."+rp.getReport()+".shtml\">"+rp.getMachineName()+"</a></font></td></tr>"); |
| 75 |
+ |
} |
| 76 |
+ |
|
| 77 |
+ |
bw.write("</table>"); |
| 78 |
+ |
bw.flush(); |
| 79 |
+ |
} |
| 80 |
+ |
|
| 81 |
|
public static void printGraph(BufferedWriter bw, String filename, int width, int height, int type, long startDate, long endDate) throws IOException{ |
| 82 |
|
|
| 83 |
|
String graphTitle = "Unknown time period"; |
| 84 |
|
String xAxisTitle = "Time"; |
| 85 |
|
String yAxisTitle = "Value"; |
| 86 |
|
String scaleRow = " <tr><td> </td><td align=\"left\">"+DateUtils.dateString(startDate)+"</td><td align=\"right\">"+DateUtils.dateString(endDate)+"</td></tr>"; |
| 87 |
+ |
int colspan = 2; |
| 88 |
|
|
| 89 |
|
switch (type) { |
| 90 |
|
case ReportPage.HOUR: |
| 91 |
|
graphTitle = "Hourly report from "+DateUtils.dateString(startDate)+" to "+DateUtils.dateString(endDate); |
| 92 |
+ |
scaleRow = " <tr><td> </td>"; |
| 93 |
+ |
for (long i = startDate; i < endDate; i+=DateUtils.secsPerHour/6){ |
| 94 |
+ |
scaleRow += "<td align=\"left\" width=\""+(100/colspan)+"%\"><font size=\"2\">>"+DateUtils.timeString(i)+"</font></td>"; |
| 95 |
+ |
} |
| 96 |
+ |
scaleRow += "</tr>"; |
| 97 |
+ |
colspan = 6; |
| 98 |
|
break; |
| 99 |
|
case ReportPage.DAY: |
| 100 |
|
graphTitle = "24 hour report from "+DateUtils.dateString(startDate)+" to "+DateUtils.dateString(endDate); |
| 101 |
+ |
scaleRow = " <tr><td> </td>"; |
| 102 |
+ |
for (int i = 0; i < 24; i++){ |
| 103 |
+ |
scaleRow += "<td align=\"center\" width=\""+(100/colspan)+"%\"><font size=\"2\">"+i+"</font></td>"; |
| 104 |
+ |
} |
| 105 |
+ |
scaleRow += "</tr>"; |
| 106 |
+ |
colspan = 24; |
| 107 |
|
break; |
| 108 |
|
case ReportPage.WEEK: |
| 109 |
|
graphTitle = "7 day report from "+DateUtils.shortDateString(startDate)+" to "+DateUtils.shortDateString(endDate); |
| 110 |
+ |
colspan = 7; |
| 111 |
+ |
scaleRow = " <tr><td> </td>"; |
| 112 |
+ |
for (long i = startDate; i < endDate; i+=DateUtils.secsPerDay){ |
| 113 |
+ |
scaleRow += "<td align=\"center\" width=\""+(100/colspan)+"%\">"+DateUtils.dayName(i)+"</td>"; |
| 114 |
+ |
} |
| 115 |
+ |
scaleRow += "</tr>"; |
| 116 |
|
break; |
| 117 |
|
case ReportPage.MONTH: |
| 118 |
|
graphTitle = "30 day report from "+DateUtils.shortDateString(startDate)+" to "+DateUtils.shortDateString(endDate); |
| 119 |
+ |
scaleRow = " <tr><td> </td><td align=\"left\">"+DateUtils.shortDateString(startDate)+"</td><td align=\"right\">"+DateUtils.shortDateString(endDate)+"</td></tr>"; |
| 120 |
+ |
colspan = 2; |
| 121 |
|
break; |
| 122 |
|
default: |
| 123 |
|
// Do nothing, leave values as they are. |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
bw.write("<table border=\"0\">"); |
| 127 |
< |
bw.write(" <tr><td> </td><td colspan=\"2\"><b>"+graphTitle+"</b></td></tr>"); |
| 128 |
< |
bw.write(" <tr><td>"+yAxisTitle+"</td><td colspan=\"2\"><img src=\""+filename+"\" width=\""+width+"\" height=\""+height+"\"></td></tr>"); |
| 127 |
> |
bw.write(" <tr><td> </td><td colspan=\""+colspan+"\"><b>"+graphTitle+"</b></td></tr>"); |
| 128 |
> |
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>"); |
| 129 |
|
bw.write(scaleRow); |
| 130 |
|
bw.write("</table>"); |
| 131 |
|
bw.newLine(); |