ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostStatus/HostStatus.cpp
(Generate patch)

Comparing HostStatus/HostStatus.cpp (file contents):
Revision 39 by Douglas Thrift, 2003-11-15T20:46:26-08:00 vs.
Revision 43 by Douglas Thrift, 2003-11-16T20:17:51-08:00

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines