From e0354c367e309248d7c2bf613750417ce915f9b9 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph.amissah@gmail.com>
Date: Tue, 31 Mar 2020 11:19:24 -0400
Subject: search, simplify & remove un-implemented features

---
 src/doc_reform/io_out/cgi_sqlite_search_form.d | 457 +++++++++++++++++++++++--
 src/doc_reform/io_out/xmls.d                   |  15 +-
 2 files changed, 439 insertions(+), 33 deletions(-)

(limited to 'src')

diff --git a/src/doc_reform/io_out/cgi_sqlite_search_form.d b/src/doc_reform/io_out/cgi_sqlite_search_form.d
index a694042..155a544 100644
--- a/src/doc_reform/io_out/cgi_sqlite_search_form.d
+++ b/src/doc_reform/io_out/cgi_sqlite_search_form.d
@@ -182,6 +182,8 @@ void cgi_function_intro(Cgi cgi) {
         if (auto m = got.search_text_area.matchFirst(rgx.fn)) {
           got.fn = m["matched"];
           got.canned_query ~= "&fn=" ~ m["matched"];
+        } else if ("fn" in cgi.post) {
+          got.search_text_area ~= "\nfn: " ~ cgi.post["fn"] ~ "\n";
         }
         if (auto m = got.search_text_area.matchFirst(rgx.keywords)) {
           got.keywords = m["matched"];
@@ -474,13 +476,13 @@ void cgi_function_intro(Cgi cgi) {
 <!DOCTYPE html>
 <html>
 <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>
   ≅ SiSU spine search form
   </title>
-  <meta name="sourcefile" content="SiSU.sst" />
-  <link rel="generator" href="sisudoc.org" />
-  <link rel="shortcut icon" href="http://%%s/image_sys/spine.ico" />
+  <meta name="sourcefile" content="SiSU.sst">
+  <link rel="generator" href="sisudoc.org">
+  <link rel="shortcut icon" href="http://%%s/image_sys/spine.ico">
   <style media = "all">
    *{
     padding                  : 0px;
@@ -526,6 +528,417 @@ void cgi_function_intro(Cgi cgi) {
     color                    : #003399;
     text-decoration          : underline;
   }
+  p.norm { }
+  p.i1 { padding-left        : 1em; }
+  p.i2 { padding-left        : 2em; }
+  p.i3 { padding-left        : 3em; }
+  p.i4 { padding-left        : 4em; }
+  p.i5 { padding-left        : 5em; }
+  p.i6 { padding-left        : 6em; }
+  p.i7 { padding-left        : 7em; }
+  p.i8 { padding-left        : 8em; }
+  p.i9 { padding-left        : 9em; }
+  /* hanging indent */
+  p[indent="h0i0"] {
+    padding-left             : 0em;
+    text-indent              : 0em;
+  }
+  p[indent="h0i1"] {
+    padding-left             : 1em;
+    text-indent              : -1em;
+  }
+  p[indent="h0i2"] {
+    padding-left             : 2em;
+    text-indent              : -2em;
+  }
+  p[indent="h0i3"] {
+    padding-left             : 3em;
+    text-indent              : -3em;
+  }
+  p[indent="h0i4"] {
+    padding-left             : 4em;
+    text-indent              : -4em;
+  }
+  p[indent="h0i5"] {
+    padding-left             : 5em;
+    text-indent              : -5em;
+  }
+  p[indent="h0i6"] {
+    padding-left             : 6em;
+    text-indent              : -6em;
+  }
+  p[indent="h0i7"] {
+    padding-left             : 7em;
+    text-indent              : -7em;
+  }
+  p[indent="h0i8"] {
+    padding-left             : 8em;
+    text-indent              : -8em;
+  }
+  p[indent="h0i9"] {
+    padding-left             : 9em;
+    text-indent              : -9em;
+  }
+  p[indent="h1i0"] {
+    padding-left             : 0em;
+    text-indent              : 1em;
+  }
+  p[indent="h1i1"] {
+    padding-left             : 1em;
+    text-indent              : 0em;
+  }
+  p[indent="h1i2"] {
+    padding-left             : 2em;
+    text-indent              : -1em;
+  }
+  p[indent="h1i3"] {
+    padding-left             : 3em;
+    text-indent              : -2em;
+  }
+  p[indent="h1i4"] {
+    padding-left             : 4em;
+    text-indent              : -3em;
+  }
+  p[indent="h1i5"] {
+    padding-left             : 5em;
+    text-indent              : -4em;
+  }
+  p[indent="h1i6"] {
+    padding-left             : 6em;
+    text-indent              : -5em;
+  }
+  p[indent="h1i7"] {
+    padding-left             : 7em;
+    text-indent              : -6em;
+  }
+  p[indent="h1i8"] {
+    padding-left             : 8em;
+    text-indent              : -7em;
+  }
+  p[indent="h1i9"] {
+    padding-left             : 9em;
+    text-indent              : -8em;
+  }
+  p[indent="h2i0"] {
+    padding-left             : 0em;
+    text-indent              : 2em;
+  }
+  p[indent="h2i1"] {
+    padding-left             : 1em;
+    text-indent              : 1em;
+  }
+  p[indent="h2i2"] {
+    padding-left             : 2em;
+    text-indent              : 0em;
+  }
+  p[indent="h2i3"] {
+    padding-left             : 3em;
+    text-indent              : -1em;
+  }
+  p[indent="h2i4"] {
+    padding-left             : 4em;
+    text-indent              : -2em;
+  }
+  p[indent="h2i5"] {
+    padding-left             : 5em;
+    text-indent              : -3em;
+  }
+  p[indent="h2i6"] {
+    padding-left             : 6em;
+    text-indent              : -4em;
+  }
+  p[indent="h2i7"] {
+    padding-left             : 7em;
+    text-indent              : -5em;
+  }
+  p[indent="h2i8"] {
+    padding-left             : 8em;
+    text-indent              : -6em;
+  }
+  p[indent="h2i9"] {
+    padding-left             : 9em;
+    text-indent              : -7em;
+  }
+  p[indent="h3i0"] {
+    padding-left             : 0em;
+    text-indent              : 3em;
+  }
+  p[indent="h3i1"] {
+    padding-left             : 1em;
+    text-indent              : 2em;
+  }
+  p[indent="h3i2"] {
+    padding-left             : 2em;
+    text-indent              : 1em;
+  }
+  p[indent="h3i3"] {
+    padding-left             : 3em;
+    text-indent              : 0em;
+  }
+  p[indent="h3i4"] {
+    padding-left             : 4em;
+    text-indent              : -1em;
+  }
+  p[indent="h3i5"] {
+    padding-left             : 5em;
+    text-indent              : -2em;
+  }
+  p[indent="h3i6"] {
+    padding-left             : 6em;
+    text-indent              : -3em;
+  }
+  p[indent="h3i7"] {
+    padding-left             : 7em;
+    text-indent              : -4em;
+  }
+  p[indent="h3i8"] {
+    padding-left             : 8em;
+    text-indent              : -5em;
+  }
+  p[indent="h3i9"] {
+    padding-left             : 9em;
+    text-indent              : -6em;
+  }
+  p[indent="h4i0"] {
+    padding-left             : 0em;
+    text-indent              : 4em;
+  }
+  p[indent="h4i1"] {
+    padding-left             : 1em;
+    text-indent              : 3em;
+  }
+  p[indent="h4i2"] {
+    padding-left             : 2em;
+    text-indent              : 2em;
+  }
+  p[indent="h4i3"] {
+    padding-left             : 3em;
+    text-indent              : 1em;
+  }
+  p[indent="h4i4"] {
+    padding-left             : 4em;
+    text-indent              : 0em;
+  }
+  p[indent="h4i5"] {
+    padding-left             : 5em;
+    text-indent              : -1em;
+  }
+  p[indent="h4i6"] {
+    padding-left             : 6em;
+    text-indent              : -2em;
+  }
+  p[indent="h4i7"] {
+    padding-left             : 7em;
+    text-indent              : -3em;
+  }
+  p[indent="h4i8"] {
+    padding-left             : 8em;
+    text-indent              : -4em;
+  }
+  p[indent="h4i9"] {
+    padding-left             : 9em;
+    text-indent              : -5em;
+  }
+  p[indent="h5i0"] {
+    padding-left             : 0em;
+    text-indent              : 5em;
+  }
+  p[indent="h5i1"] {
+    padding-left             : 1em;
+    text-indent              : 4em;
+  }
+  p[indent="h5i2"] {
+    padding-left             : 2em;
+    text-indent              : 3em;
+  }
+  p[indent="h5i3"] {
+    padding-left             : 3em;
+    text-indent              : 2em;
+  }
+  p[indent="h5i4"] {
+    padding-left             : 4em;
+    text-indent              : 1em;
+  }
+  p[indent="h5i5"] {
+    padding-left             : 5em;
+    text-indent              : 0em;
+  }
+  p[indent="h5i6"] {
+    padding-left             : 6em;
+    text-indent              : -1em;
+  }
+  p[indent="h5i7"] {
+    padding-left             : 7em;
+    text-indent              : -2em;
+  }
+  p[indent="h5i8"] {
+    padding-left             : 8em;
+    text-indent              : -3em;
+  }
+  p[indent="h5i9"] {
+    padding-left             : 9em;
+    text-indent              : -4em;
+  }
+  p[indent="h6i0"] {
+    padding-left             : 0em;
+    text-indent              : 6em;
+  }
+  p[indent="h6i1"] {
+    padding-left             : 1em;
+    text-indent              : 5em;
+  }
+  p[indent="h6i2"] {
+    padding-left             : 2em;
+    text-indent              : 4em;
+  }
+  p[indent="h6i3"] {
+    padding-left             : 3em;
+    text-indent              : 3em;
+  }
+  p[indent="h6i4"] {
+    padding-left             : 4em;
+    text-indent              : 2em;
+  }
+  p[indent="h6i5"] {
+    padding-left             : 5em;
+    text-indent              : 1em;
+  }
+  p[indent="h6i6"] {
+    padding-left             : 6em;
+    text-indent              : 0em;
+  }
+  p[indent="h6i7"] {
+    padding-left             : 7em;
+    text-indent              : -1em;
+  }
+  p[indent="h6i8"] {
+    padding-left             : 8em;
+    text-indent              : -2em;
+  }
+  p[indent="h6i9"] {
+    padding-left             : 9em;
+    text-indent              : -3em;
+  }
+  p[indent="h7i0"] {
+    padding-left             : 0em;
+    text-indent              : 7em;
+  }
+  p[indent="h7i1"] {
+    padding-left             : 1em;
+    text-indent              : 6em;
+  }
+  p[indent="h7i2"] {
+    padding-left             : 2em;
+    text-indent              : 5em;
+  }
+  p[indent="h7i3"] {
+    padding-left             : 3em;
+    text-indent              : 4em;
+  }
+  p[indent="h7i4"] {
+    padding-left             : 4em;
+    text-indent              : 3em;
+  }
+  p[indent="h7i5"] {
+    padding-left             : 5em;
+    text-indent              : 2em;
+  }
+  p[indent="h7i6"] {
+    padding-left             : 6em;
+    text-indent              : 1em;
+  }
+  p[indent="h7i7"] {
+    padding-left             : 7em;
+    text-indent              : 0em;
+  }
+  p[indent="h7i8"] {
+    padding-left             : 8em;
+    text-indent              : -1em;
+  }
+  p[indent="h7i9"] {
+    padding-left             : 9em;
+    text-indent              : -2em;
+  }
+  p[indent="h8i0"] {
+    padding-left             : 0em;
+    text-indent              : 8em;
+  }
+  p[indent="h8i1"] {
+    padding-left             : 1em;
+    text-indent              : 7em;
+  }
+  p[indent="h8i2"] {
+    padding-left             : 2em;
+    text-indent              : 6em;
+  }
+  p[indent="h8i3"] {
+    padding-left             : 3em;
+    text-indent              : 5em;
+  }
+  p[indent="h8i4"] {
+    padding-left             : 4em;
+    text-indent              : 4em;
+  }
+  p[indent="h8i5"] {
+    padding-left             : 5em;
+    text-indent              : 3em;
+  }
+  p[indent="h8i6"] {
+    padding-left             : 6em;
+    text-indent              : 2em;
+  }
+  p[indent="h8i7"] {
+    padding-left             : 7em;
+    text-indent              : 1em;
+  }
+  p[indent="h8i8"] {
+    padding-left             : 8em;
+    text-indent              : 0em;
+  }
+  p[indent="h8i9"] {
+    padding-left             : 9em;
+    text-indent              : -1em;
+  }
+  p[indent="h9i0"] {
+    padding-left             : 0em;
+    text-indent              : 9em;
+  }
+  p[indent="h9i1"] {
+    padding-left             : 1em;
+    text-indent              : 8em;
+  }
+  p[indent="h9i2"] {
+    padding-left             : 2em;
+    text-indent              : 7em;
+  }
+  p[indent="h9i3"] {
+    padding-left             : 3em;
+    text-indent              : 6em;
+  }
+  p[indent="h9i4"] {
+    padding-left             : 4em;
+    text-indent              : 5em;
+  }
+  p[indent="h9i5"] {
+    padding-left             : 5em;
+    text-indent              : 4em;
+  }
+  p[indent="h9i6"] {
+    padding-left             : 6em;
+    text-indent              : 3em;
+  }
+  p[indent="h9i7"] {
+    padding-left             : 7em;
+    text-indent              : 2em;
+  }
+  p[indent="h9i8"] {
+    padding-left             : 8em;
+    text-indent              : 1em;
+  }
+  p[indent="h9i9"] {
+    padding-left             : 9em;
+    text-indent              : 0em;
+  }
   hr {
     width                    : 100%%%%;
     margin-left              : 0%%%%;
@@ -546,10 +959,10 @@ void cgi_function_intro(Cgi cgi) {
  <tr><td width="20%%%%">
   <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0">
   <tr><td align="left">
-   <br /><a href="http://sisudoc.org/" target="_top">
+   <br><a href="http://sisudoc.org/" target="_top">
      <b>SiSU</b>
    </a>
-   <br /><a href="http://git.sisudoc.org/" target="_top">
+   <br><a href="http://git.sisudoc.org/" target="_top">
      git
    </a>
   </td></tr>
@@ -639,7 +1052,7 @@ void cgi_function_intro(Cgi cgi) {
         tip = format(q"┃
 <font size="2" color="#666666">
 <b>database:</b> <font size="2" color="#004000">%%s</font>; <b>selected view:</b> <font size="2" color="#004000">index</font>
-<b>search string:</b> %%s %%s %%s %%s %%s %%s<br />
+<b>search string:</b> %%s %%s %%s %%s %%s %%s<br>
 %%s %%s %%s %%s %%s %%s
 </font>
 ┃",
@@ -650,10 +1063,10 @@ void cgi_function_intro(Cgi cgi) {
           (tf.date.empty   ? "" : "\"date    <font size=\"2\" color=\"#004000\">" ~ tf.date   ~ "</font>; "),
           (tf.uid.empty    ? "" : "\"uid:    <font size=\"2\" color=\"#004000\">" ~ tf.uid    ~ "</font>; "),
           (tf.fn.empty     ? "" : "\"fn:     <font size=\"2\" color=\"#004000\">" ~ tf.fn     ~ "</font>; "),
-          (tf.text.empty   ? "" :  "text:    <font size=\"2\" color=\"#004000\">" ~ tf.text   ~ "</font><br />"),
-          (tf.title.empty  ? "" : "title:    <font size=\"2\" color=\"#004000\">" ~ tf.title  ~ "</font><br />"),
-          (tf.author.empty ? "" :  "author:  <font size=\"2\" color=\"#004000\">" ~ tf.author ~ "</font><br />"),
-          (tf.date.empty   ? "" :  "date:    <font size=\"2\" color=\"#004000\">" ~ tf.date   ~ "</font><br />"),
+          (tf.text.empty   ? "" :  "text:    <font size=\"2\" color=\"#004000\">" ~ tf.text   ~ "</font><br>"),
+          (tf.title.empty  ? "" : "title:    <font size=\"2\" color=\"#004000\">" ~ tf.title  ~ "</font><br>"),
+          (tf.author.empty ? "" :  "author:  <font size=\"2\" color=\"#004000\">" ~ tf.author ~ "</font><br>"),
+          (tf.date.empty   ? "" :  "date:    <font size=\"2\" color=\"#004000\">" ~ tf.date   ~ "</font><br>"),
           (tf.uid.empty    ? "" : "\"uid:    <font size=\"2\" color=\"#004000\">" ~ tf.uid    ~ "</font>; "),
           (tf.fn.empty     ? "" : "\"fn:     <font size=\"2\" color=\"#004000\">" ~ tf.fn     ~ "</font>; "),
         );
@@ -673,27 +1086,20 @@ void cgi_function_intro(Cgi cgi) {
   </td></tr></table>
   <td valign=\"top\"><tr><td>
     <font size="2" color="#222222">
-    <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below)
-    <br />
-    <select name="db" size="1">
-      %%s
-      <option value="%%s">spine</option>
-    </select>
-    <input type="submit" value="SiSU search" />
+    <input type="hidden" name="db" value="%%s">
+    <input type="submit" value="SiSU search">
     <input type="radio" name="rt" id="results_type_index" value="idx" %%s> index
     <input type="radio" name="rt" id="results_type_text" value="txt" %%s> text / grep;
     match limit:
     <input type="radio" name="sml" id="sql_match_limit_1000" value="1000" %%s> 1,000
     <input type="radio" name="sml" id="sql_match_limit_2500" value="2500" %%s> 2,500
-    <br />
+    <br>
       <input type="checkbox" name="ec" %%s> echo query
-      <input type="checkbox" name="sts" %%s> result stats
       <input type="checkbox" name="url" %%s> search url
       <input type="checkbox" name="se" %%s> searched
-      <input type="checkbox" name="tip" %%s> available fields
       <input type="checkbox" name="sql" %%s> sql statement
       <input type="hidden" name="smo" value="0">
-    <br />
+    <br>
     </font>
   </td></tr>
   </table>
@@ -705,16 +1111,13 @@ void cgi_function_intro(Cgi cgi) {
       search_note,
       the_can(post_value("sf", "field")),
       cv.db_selected,
-      cv.db_selected,
       post_value("rt",  "box", "idx"),
       post_value("rt",  "box", "txt"),
       post_value("sml", "box", "1000"),
       post_value("sml", "box", "2500"),
       post_value("ec"),
-      post_value("sts"),
       post_value("url"),
       post_value("se"),
-      post_value("tip"),
       post_value("sql"),
     );
     {
@@ -856,7 +1259,7 @@ LIMIT %%s OFFSET %%s
         cv.sql_match_offset,
       );
       (cv.checked_sql)
-      ? cgi.write(previous_next ~ "<hr><font size=\"2\" color=\"#666666\">" ~ sql_select.the_body.split("\n  ").join(" ").split("\n").join("<br>") ~ "</font>\n")
+      ? cgi.write(previous_next ~ "<hr><font size=\"2\" color=\"#666666\">" ~ sql_select.the_body.strip.split("\n  ").join(" ").split("\n").join("<br>") ~ "</font>\n")
       : "";
       cgi.write(previous_next);
       auto select_query_results = db.execute(sql_select.the_body).cached;
@@ -881,7 +1284,7 @@ LIMIT %%s OFFSET %%s
               ~ row["language_document_char"].as!string
               ~ "] "
               ~ row["creator_author_last_first"].as!string
-              ~ ":<br>\n"
+              ~ "<br>\n"
             );
           }
           if (cv.results_type == "txt") {
diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d
index fb33fd0..7649d40 100644
--- a/src/doc_reform/io_out/xmls.d
+++ b/src/doc_reform/io_out/xmls.d
@@ -161,18 +161,21 @@ template outputXHTMLs() {
     <a name="search"></a>
     <form action="%s" target="_top" method="POST" accept-charset="UTF-8" id="search">
     <font size="2">
-    <input type="text" name="sf" size="24" maxlength="255" />
-    <input type="hidden" name="db" value="%s" />
-    <input type="hidden" name="sml" value="1000" />
-    <input type="hidden" name="ec" value="on" />
-    <input type="hidden" name="url" value="on" />
+    <input type="text" name="sf" size="24" maxlength="255">%s
+    <input type="hidden" name="sml" value="1000">
+    <input type="hidden" name="ec" value="on">
+    <input type="hidden" name="url" value="on">
     <button type="submit" form="search" name="fn" value="%s">doc</button>
     <button type="submit" form="search">db</button>
     </font></form>
     <!-- SiSU Spine Search -->
     </div>┃",
         doc_matters.conf_make_meta.conf.w_srv_cgi_action,
-        doc_matters.conf_make_meta.conf.w_srv_db_sqlite,
+        (doc_matters.conf_make_meta.conf.w_srv_db_sqlite.empty)
+          ? ""
+          : "\n    <input type=\"hidden\" name=\"db\" value=\""
+            ~ doc_matters.conf_make_meta.conf.w_srv_db_sqlite
+            ~ "\">",
         doc_matters.src.filename_base,
         );
       } else {
-- 
cgit v1.2.3