159 |
|
} |
160 |
|
while (!done && hostupdate.good()); |
161 |
|
|
162 |
< |
if (page) header(); |
162 |
> |
if (page) header(method); |
163 |
|
|
164 |
< |
for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end(); itor++) |
164 |
> |
for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end(); |
165 |
> |
itor++) |
166 |
|
{ |
167 |
|
Host host = *itor; |
168 |
|
|
172 |
|
if (page) footer(); |
173 |
|
} |
174 |
|
|
175 |
< |
void HostStatus::header() |
175 |
> |
void HostStatus::header(const string& method) |
176 |
|
{ |
177 |
|
cout << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"\n" |
178 |
|
<< "\t\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" |
185 |
|
<< "<body>\n" |
186 |
|
<< "<h1 id=\"title\" class=\"center\">Host Status</h1>\n" |
187 |
|
<< "<form action=\"hoststatus.cgi\" method=\"POST\">\n" |
188 |
+ |
<< "<p class=\"center\">\n" |
189 |
+ |
<< "<select name=\"host\" multiple>\n"; |
190 |
+ |
|
191 |
+ |
if (method != "POST") sputenv("QUERY_STRING=mode=h"); |
192 |
+ |
|
193 |
+ |
pstream hostupdate("./hostupdate.cgi"); |
194 |
+ |
|
195 |
+ |
if (method == "POST") hostupdate << "mode=h\n" << flush; |
196 |
+ |
|
197 |
+ |
hostupdate.ignore(26); |
198 |
+ |
|
199 |
+ |
list<Host> hosts; |
200 |
+ |
bool done = false; |
201 |
+ |
|
202 |
+ |
do |
203 |
+ |
{ |
204 |
+ |
Host host; |
205 |
+ |
|
206 |
+ |
hostupdate >> host; |
207 |
+ |
|
208 |
+ |
hosts.push_back(host); |
209 |
+ |
|
210 |
+ |
switch (hostupdate.peek()) |
211 |
+ |
{ |
212 |
+ |
case 'h': |
213 |
+ |
break; |
214 |
+ |
default: |
215 |
+ |
done = true; |
216 |
+ |
break; |
217 |
+ |
} |
218 |
+ |
} |
219 |
+ |
while (!done && hostupdate.good()); |
220 |
+ |
|
221 |
+ |
for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end(); |
222 |
+ |
itor++) |
223 |
+ |
{ |
224 |
+ |
Host host = *itor; |
225 |
+ |
|
226 |
+ |
cout << "<option>" << host.getHost() << "</option>\n"; |
227 |
+ |
} |
228 |
+ |
|
229 |
+ |
cout << "</select>\n" |
230 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"h\"> Host\n" |
231 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"n\"> Name\n" |
232 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"a\"> Address\n" |
233 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"p\"> Platform" |
234 |
+ |
<< '\n' |
235 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"s\"> Since\n" |
236 |
+ |
<< "<input type=\"submit\" value=\"Status\">\n" |
237 |
+ |
<< "</p>\n" |
238 |
+ |
<< "</form>\n" |
239 |
|
<< "<table class=\"center\">\n" |
240 |
|
<< "<tr>\n"; |
241 |
|
|
251 |
|
void HostStatus::footer() |
252 |
|
{ |
253 |
|
cout << "</table>\n" |
202 |
– |
<< "</form>\n" |
254 |
|
<< "</html>\n"; |
255 |
|
} |