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" |
186 |
|
<< "<h1 id=\"title\" class=\"center\">Host Status</h1>\n" |
187 |
|
<< "<form action=\"hoststatus.cgi\" method=\"POST\">\n" |
188 |
|
<< "<table class=\"center\">\n" |
189 |
+ |
<< "<tr>\n" |
190 |
+ |
<< "<td><select name=\"host\" multiple>\n"; |
191 |
+ |
|
192 |
+ |
if (method != "POST") sputenv("QUERY_STRING=mode=h"); |
193 |
+ |
|
194 |
+ |
pstream hostupdate("./hostupdate.cgi"); |
195 |
+ |
|
196 |
+ |
if (method == "POST") hostupdate << "mode=h\n" << flush; |
197 |
+ |
|
198 |
+ |
hostupdate.ignore(26); |
199 |
+ |
|
200 |
+ |
list<Host> hosts; |
201 |
+ |
bool done = false; |
202 |
+ |
|
203 |
+ |
do |
204 |
+ |
{ |
205 |
+ |
Host host; |
206 |
+ |
|
207 |
+ |
hostupdate >> host; |
208 |
+ |
|
209 |
+ |
hosts.push_back(host); |
210 |
+ |
|
211 |
+ |
switch (hostupdate.peek()) |
212 |
+ |
{ |
213 |
+ |
case 'h': |
214 |
+ |
break; |
215 |
+ |
default: |
216 |
+ |
done = true; |
217 |
+ |
break; |
218 |
+ |
} |
219 |
+ |
} |
220 |
+ |
while (!done && hostupdate.good()); |
221 |
+ |
|
222 |
+ |
for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end(); |
223 |
+ |
itor++) |
224 |
+ |
{ |
225 |
+ |
Host host = *itor; |
226 |
+ |
|
227 |
+ |
cout << "<option>" << host.getHost() << "</option>\n"; |
228 |
+ |
} |
229 |
+ |
|
230 |
+ |
cout << "</select></td>\n" |
231 |
+ |
<< "<td><input type=\"checkbox\" name=\"mode\" value=\"h\"> Host" |
232 |
+ |
<< "\n<input type=\"checkbox\" name=\"mode\" value=\"n\"> Name\n" |
233 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"a\"> Address\n" |
234 |
+ |
<< "<input type=\"checkbox\" name=\"mode\" value=\"p\"> Platform" |
235 |
+ |
<< "\n<input type=\"checkbox\" name=\"mode\" value=\"s\"> Since\n" |
236 |
+ |
<< "</td>\n" |
237 |
+ |
<< "<td><input type=\"submit\" value=\"Status\"></td>\n" |
238 |
+ |
<< "</tr>\n" |
239 |
+ |
<< "</table>\n" |
240 |
+ |
<< "</form>\n" |
241 |
+ |
<< "<table class=\"center\">\n" |
242 |
|
<< "<tr>\n"; |
243 |
|
|
244 |
|
if (host) cout << "<th>Host</th>\n"; |
253 |
|
void HostStatus::footer() |
254 |
|
{ |
255 |
|
cout << "</table>\n" |
202 |
– |
<< "</form>\n" |
256 |
|
<< "</html>\n"; |
257 |
|
} |