summaryrefslogtreecommitdiff
path: root/lib/Table.cc
blob: 776caae62afb0489fb8a064f77fd1e74a37ff607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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();
}