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 40 by Douglas Thrift, 2003-11-16T19:43:17-08:00 vs.
Revision 65 by Douglas Thrift, 2004-01-01T17:55:25-08:00

# Line 16 | Line 16 | int main(int argc, char* argv[])
16  
17   HostStatus::HostStatus()
18   {
19 #ifndef __CYGWIN__
20        sputenv("TZ=:America/Los_Angeles");
21 #else
22        sputenv("TZ= PST8PDT");
23 #endif
24        tzset();
25
19          string method = sgetenv("REQUEST_METHOD");
20  
21          parse(method);
# Line 183 | Line 176 | void HostStatus::header(const string& me
176                  << "<title>Host Status</title>\n"
177                  << "</head>\n"
178                  << "<body>\n"
179 +                << "<div>\n"
180                  << "<h1 id=\"title\" class=\"center\">Host Status</h1>\n"
181 +                << "</div>\n"
182 +                << "<div class=\"hr\">\n"
183 +                << "<p class=\"floatleft\"><a href=\"./\"><img src=\"/icons/back.gif\""
184 +                << " alt=\"\"></a></p><p/>\n"
185                  << "<form action=\"hoststatus.cgi\" method=\"POST\">\n"
186 <                << "<p class=\"center\">\n"
187 <                << "<select name=\"host\" multiple>\n";
186 >                << "<table class=\"center\">\n"
187 >                << "<tr>\n"
188 >                << "<td>\n"
189 >                << "<select name=\"host\" size=\"2\" multiple>\n";
190  
191          if (method != "POST") sputenv("QUERY_STRING=mode=h");
192  
# Line 218 | Line 218 | void HostStatus::header(const string& me
218          }
219          while (!done && hostupdate.good());
220  
221 +        set<string> selected;
222 +
223 +        for (multimap<string, string>::iterator itor = cgi.find("host"); itor !=
224 +                cgi.upper_bound("host") && itor != cgi.end(); itor++)
225 +        {
226 +                string host = itor->second;
227 +
228 +                if (host != "") selected.insert(host);
229 +        }
230 +
231          for (list<Host>::iterator itor = hosts.begin(); itor != hosts.end();
232                  itor++)
233          {
234                  Host host = *itor;
235  
236 <                cout << "<option>" << host.getHost() << "</option>\n";
236 >                cout << "<option" << (selected.find(host.getHost()) != selected.end() ?
237 >                        " selected>" : ">") << host.getHost() << "</option>\n";
238          }
239  
240 +        bool all = host && name && address && platform && since;
241 +
242          cout << "</select>\n"
243 <                << "<input type=\"checkbox\" name=\"mode\" value=\"h\">&nbsp;Host\n"
244 <                << "<input type=\"checkbox\" name=\"mode\" value=\"n\">&nbsp;Name\n"
245 <                << "<input type=\"checkbox\" name=\"mode\" value=\"a\">&nbsp;Address\n"
246 <                << "<input type=\"checkbox\" name=\"mode\" value=\"p\">&nbsp;Platform"
247 <                << '\n'
248 <                << "<input type=\"checkbox\" name=\"mode\" value=\"s\">&nbsp;Since\n"
249 <                << "</p>\n"
243 >                << "</td>\n"
244 >                << "<td>\n"
245 >                << "<input type=\"checkbox\" name=\"mode\" value=\"h\""
246 >                << (host && !all ? " checked" : "") << ">&nbsp;Host\n"
247 >                << "<input type=\"checkbox\" name=\"mode\" value=\"n\""
248 >                << (name && !all ? " checked" : "") << ">&nbsp;Name\n"
249 >                << "<input type=\"checkbox\" name=\"mode\" value=\"a\""
250 >                << (address && !all ? " checked" : "") << ">&nbsp;Address\n"
251 >                << "<input type=\"checkbox\" name=\"mode\" value=\"p\""
252 >                << (platform && !all ? " checked" : "") << ">&nbsp;Platform\n"
253 >                << "<input type=\"checkbox\" name=\"mode\" value=\"s\""
254 >                << (since && !all ? " checked" : "") << ">&nbsp;Since\n"
255 >                << "</td>\n"
256 >                << "<td><input type=\"submit\" value=\"Status\"></td>\n"
257 >                << "</tr>\n"
258 >                << "</table>\n"
259                  << "</form>\n"
260                  << "<table class=\"center\">\n"
261                  << "<tr>\n";
# Line 250 | Line 272 | void HostStatus::header(const string& me
272   void HostStatus::footer()
273   {
274          cout << "</table>\n"
275 +                << "</div>\n"
276                  << "</html>\n";
277   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines