diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-05-28 13:40:48 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-05-28 13:40:48 +0000 |
commit | 7956db275a13d70a6b9fb672cf085b78e70f124c (patch) | |
tree | b04cdd4244e09b0b53a2a5ba0ab3bbc57068370b /cgi.c | |
parent | 4d8a52d4066027eb5dd03bbb35164ec6cf9906db (diff) | |
download | mandoc-7956db275a13d70a6b9fb672cf085b78e70f124c.tar.gz |
Simplify search form: minus two visible control elements, minus
one table, minus twenty lines of code, no loss of functionality.
No idea why i didn't do this earlier...
Diffstat (limited to 'cgi.c')
-rw-r--r-- | cgi.c | 35 |
1 files changed, 8 insertions, 27 deletions
@@ -385,8 +385,7 @@ resp_searchform(const struct req *req, enum focus focus) /* Write query input box. */ - printf( "<table><tr><td>\n" - "<input type=\"text\" name=\"query\" value=\""); + printf("<input type=\"text\" name=\"query\" value=\""); if (req->q.query != NULL) html_print(req->q.query); printf( "\" size=\"40\""); @@ -394,24 +393,16 @@ resp_searchform(const struct req *req, enum focus focus) printf(" autofocus"); puts(">"); - /* Write submission and reset buttons. */ + /* Write submission buttons. */ - printf( "<input type=\"submit\" value=\"Submit\">\n" - "<input type=\"reset\" value=\"Reset\">\n"); - - /* Write show radio button */ - - printf( "</td><td>\n" - "<input type=\"radio\" "); - if (req->q.equal) - printf("checked=\"checked\" "); - printf( "name=\"apropos\" id=\"show\" value=\"0\">\n" - "<label for=\"show\">Show named manual page</label>\n"); + printf( "<button type=\"submit\" name=\"apropos\" value=\"0\">" + "man</button>\n" + "<button type=\"submit\" name=\"apropos\" value=\"1\">" + "apropos</button>\n<br/>\n"); /* Write section selector. */ - puts( "</td></tr><tr><td>\n" - "<select name=\"sec\">"); + puts("<select name=\"sec\">"); for (i = 0; i < sec_MAX; i++) { printf("<option value=\"%s\"", sec_numbers[i]); if (NULL != req->q.sec && @@ -454,17 +445,7 @@ resp_searchform(const struct req *req, enum focus focus) puts("</select>"); } - /* Write search radio button */ - - printf( "</td><td>\n" - "<input type=\"radio\" "); - if (0 == req->q.equal) - printf("checked=\"checked\" "); - printf( "name=\"apropos\" id=\"search\" value=\"1\">\n" - "<label for=\"search\">Search with apropos query</label>\n"); - - puts("</td></tr></table>\n" - "</fieldset>\n" + puts("</fieldset>\n" "</form>\n" "</div>"); puts("<!-- End search form. //-->"); |