diff options
Diffstat (limited to 'lib/Form.cc')
-rw-r--r-- | lib/Form.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/Form.cc b/lib/Form.cc index 5fb885a..e26cf72 100644 --- a/lib/Form.cc +++ b/lib/Form.cc @@ -1,5 +1,8 @@ #include "Form.h" #include "HttpServ.h" +#include "Buffer.h" +#include "CopyJob.h" +#include "config.h" Form::Form(const String & titre, const String & url, const String & inv, String * names, String * invs, String * defaults, String ** lists, String ** descs, int nb, Action * na) : @@ -9,16 +12,18 @@ String Form::GetTitle(void) { return tit; } -void Form::Do(Variables * v, Handle * h) { - SendHead(h); +Task * Form::Do(Variables * v, Handle * h) { + Handle * b = new Buffer(); + Task * t = new CopyJob(b, h, -1, true); + SendHead(b); - (*h) << + (*b) << "<center>" << endnl << "<form ACTION=\"/bin/" << (Next ? Next->GetURL() : "start") << "\" METHOD=POST>" << endnl; - v->Dump(h); + v->Dump(b); - (*h) << + (*b) << "<table BORDER=0 CELLSPACING=0 BGCOLOR=\"#000000\"><tr><td>" << endnl << "<table BORDER=0 CELLSPACING=0 CELLPADDING=3 WIDTH=\"300\" BGCOLOR=\"#FFFFCC\">" << endnl << "<tr><td ALIGN=CENTER WIDTH=\"100%\" BGCOLOR=\"#000000\"><b><font FACE=\"arial,helvetica\" COLOR=\"#FFFFFF\">" << endnl << @@ -26,31 +31,33 @@ iv << endnl << "</font></b></td></tr>" << endnl; for (int i = 0; i < n; i++) { - (*h) << + (*b) << "<tr><td>" << ivs[i] << "</td></tr>" << endnl; if (lsts[i]) { String * s, * t; - (*h) << + (*b) << "<tr><td><select NAME=\"" << nms[i] << "\">" << endnl; for (s = lsts[i], t = dscs[i]; s->strlen(); s++, t++) { - (*h) << + (*b) << "<option VALUE=\"" << *s << "\">" << *t << "</option>" << endnl; } - (*h) << + (*b) << "</select></td></tr>" << endnl; } else { - (*h) << + (*b) << "<tr><td><input TYPE=\"text\" NAME=\"" << nms[i] << "\" VALUE=\"" << defs[i] << "\" size=40></tr></td>" << endnl; } } - (*h) << + (*b) << "<tr><td ALIGN=\"center\"><input TYPE=\"submit\" VALUE=\" Ok \"></td></tr>" << endnl << "</table></td></tr></table></form></center>" << endnl; - SendFoot(h); + SendFoot(b); Accessed(); + + return t; } |