source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Simplify search form: minus two visible control elements, minus
Date: Sat, 28 May 2016 08:41:19 -0500 (EST)	[thread overview]
Message-ID: <7549292111906864476.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
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...

Modified Files:
--------------
    mdocml:
        cgi.c
        man.cgi.8

Revision Data
-------------
Index: cgi.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/cgi.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -Lcgi.c -Lcgi.c -u -p -r1.131 -r1.132
--- cgi.c
+++ cgi.c
@@ -385,8 +385,7 @@ resp_searchform(const struct req *req, e
 
 	/* 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, e
 		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, e
 		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. //-->");
Index: man.cgi.8
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man.cgi.8,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lman.cgi.8 -Lman.cgi.8 -u -p -r1.16 -r1.17
--- man.cgi.8
+++ man.cgi.8
@@ -26,9 +26,9 @@ The
 CGI program searches for manual pages on a WWW server
 and displays them to HTTP clients,
 providing functionality equivalent to the
-.Xr apropos 1
-and
 .Xr man 1
+and
+.Xr apropos 1
 utilities.
 It can use multiple manual trees in parallel.
 .Ss HTML search interface
@@ -51,20 +51,15 @@ The effect of prepending a backslash to 
 in the current implementation, it has no effect.
 .It
 A
-.Dq Submit
-button to send a search request from the client to the server.
-.It
-A
-.Dq Reset
-button to undo any changes to the input boxes and the dropdown menus
-and reset them to the values contained in the
-.Ev QUERY_STRING .
-.It
-Radio buttons to select pages either by name like in
 .Xr man 1
-or using
+submit button.
+The string in the input box is interpreted as the name of a manual page.
+.It
+An
 .Xr apropos 1
-queries.
+submit button.
+The string in the input box is interpreted as a search
+.Ar expression .
 .It
 A dropdown menu to optionally select a manual section.
 If one is provided, it has the same effect as the
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2016-05-28 13:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7549292111906864476.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).