RSS Git Download  Clone
Raw View History
Blames found: 1 Mode: text/x-c++src Binary: false


Hang on, we reloading big blames...
/******************************************************************************* * BHtmlPage HTML Pages * T.Barnaby, BEAM Ltd, 2006-09-04 ******************************************************************************* */ #include <BHtmlPage.h> BHtmlPage::BHtmlPage(){ } BHtmlPage::~BHtmlPage(){ } void BHtmlPage::setTitle(BString title){ otitle = title; } void BHtmlPage::setLeftSide(BString leftSide){ oleftSide = leftSide; } void BHtmlPage::setContent(BString content){ ocontent = content; } BString BHtmlPage::render(){ BHtml html("html"); BHtml* h; BHtml* b; BHtml* t; BHtml* r; BHtml* c; BHtml* left; BHtml* right; BHtml* top; BHtml* topMenu; BHtml leftSide; BHtml centre; BHtml* bottom; // Header h = html.append("head"); h->append("meta", "content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\""); h->append("link", "href=\"css/main.css\" rel=\"stylesheet\" type=\"text/css\""); h->append("title", "", otitle); b = html.append("body"); // Top top = b->append("div", "class='top'"); t = top->append("table", "class=\"beam_title\""); r = t->append("tr"); left = r->append("td"); left->append("img", "src='images/bmain_header.gif'"); right = r->append("td"); right->append("center")->append("h2", "", otitle); // Top Menu topMenu = b->append("div", "class='topMenu'"); t = topMenu->append("div", "class='tabs'"); t->append("a", "class='plain' href='/'", "Home"); t->append("a", "class='plain' href='/config.cgi'", "Config"); t->append("a", "class='plain' href='/status.cgi'", "Status"); t->append("a", "class='plain' href='/statistics.cgi'", "Statistics"); t->append("a", "class='plain' href='/data.html'", "Data Access"); t->append("a", "class='plain' href='/help.cgi'", "Help"); // Left side leftSide = BHtml("div", "class='leftSide'"); t = leftSide.append("table", "width='100%'"); r = t->append("tr"); c = r->append("th", "colspan='1' style='background: #DEE7EC; border: 1px solid #8CACBB; text-align: center;'"); c->append("p", "style='color: red;'", "Local"); r = t->append("tr"); c = r->append("td"); c->appendText(oleftSide); // Centre centre = BHtml("div", "class='centre'"); centre.appendText(ocontent); // Middle t = b->append("table", "width='100%' cols='150px,*' cellspacing='0px'"); r = t->append("tr"); r->append("td", "class='leftSide'")->append(leftSide); r->append("td", "class='centre'")->append(centre); // Bottom bottom = b->append("div", "class='footer'"); bottom->append("p", "", "&copy;&nbsp;Beam Ltd 2007"); return html.render(); } #ifdef ZAP void t1(){ BHtml b("body"); BHtml* t; BHtml* r; b.append(BHtml("h1", "", "Hi There")); t = b.append(BHtml("table")); r = t->append(BHtml("tr")); r->append(BHtml("td", "", "Col0")); r->append(BHtml("td", "", "Col1")); r->append(BHtml("td", "", "Col2")); r->append("td", "", "Col3"); r = t->append(BHtml("tr")); r->append(BHtml("td", "", "Col0")); r->append(BHtml("td", "", "Col1")); r->append(BHtml("td", "", "Col2")); r->append("td", "", "Col3"); printf("%s\n", b.render().retStr()); } void t2(){ BHtmlPage page; BHtml t; BHtml* r; page.setTitle("Test Page"); t = BHtml("table", "border=1"); r = t.append(BHtml("tr")); r->append(BHtml("td", "", "Col0")); r->append(BHtml("td", "", "Col1")); r->append(BHtml("td", "", "Col2")); r->append("td", "", "Col3"); r = t.append(BHtml("tr")); r->append(BHtml("td", "", "Col0")); r->append(BHtml("td", "", "Col1")); r->append(BHtml("td", "", "Col2")); r->append("td", "", "Col3"); page.setContent(t.render()); printf("%s\n", page.render().retStr()); } int main(int argc, char **argv){ return 0; } #endif