diff options
Diffstat (limited to 'lib/Table.cc')
-rw-r--r-- | lib/Table.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/Table.cc b/lib/Table.cc new file mode 100644 index 0000000..776caae --- /dev/null +++ b/lib/Table.cc @@ -0,0 +1,41 @@ +#include "Table.h" +#include "HttpServ.h" + +Table::Table(const String & titre, const String & url, String * heads, String * cells, int nbc, int nbl, Action * na) : + Action(url), tit(titre), hds(heads), cls(cells), nc(nbc), nl(nbl), Next(na) { } + +String Table::GetTitle(void) { + return tit; +} + +void Table::Do(Variables * v, Handle * h) { + SendHead(h); + + (*h) << "<center><TABLE BORDER=0>" << endnl; + + if (hds) { + (*h) << "<TR>" << endnl; + for (int i = 0; i < nc; i++) { + (*h) << "<TH BGCOLOR=\"#bbbbbb\">" << hds[i] << "</TH>" << endnl; + } + (*h) << "</TR>" << endnl; + } + + for (int l = 0; l < nl; l++) { + (*h) << "<TR>" << endnl; + for (int c = 0; c < nc; c++) { + (*h) << "<TD BGCOLOR=\"#" << (l % 2 ? "cccccc" : "dddddd") << "\">" << cls[l * nc + c] << "</TD>" << endnl; + } + (*h) << "</TR>" << endnl; + } + + (*h) << "</TABLE>" + +"<FORM METHOD=\"POST\" ACTION=\"/bin/" << (Next ? Next->GetURL() : "start") << "\">" << endnl << +"<INPUT TYPE=\"SUBMIT\" VALUE=\" Ok \">" << endnl; +(*h) << "</FORM></CENTER>" << endnl; + + + SendFoot(h); + Accessed(); +} |