From b5210686ca0910fcc5077384217eeb51116416c1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 8 Aug 2021 16:26:07 -0400 Subject: spine_search (work on) --- sundry/spine_search_cgi/src/spine_search.d | 1734 +++++++++---------- sundry/spine_search_cgi/src/spine_search.d_ | 1738 ++++++++++---------- sundry/spine_search_cgi/views/configuration.txt | 15 +- .../views/configuration_suggested.txt | 15 +- 4 files changed, 1813 insertions(+), 1689 deletions(-) mode change 100644 => 100755 sundry/spine_search_cgi/src/spine_search.d_ (limited to 'sundry/spine_search_cgi') diff --git a/sundry/spine_search_cgi/src/spine_search.d b/sundry/spine_search_cgi/src/spine_search.d index 5b40cc8..2ddc11b 100644 --- a/sundry/spine_search_cgi/src/spine_search.d +++ b/sundry/spine_search_cgi/src/spine_search.d @@ -1,3 +1,54 @@ +#!/usr/bin/env rdmd +/+ +- Name: Spine, Doc Reform + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2021 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Hompages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ /+ dub.sdl name "spine search" description "spine cgi search" @@ -26,19 +77,20 @@ void cgi_function_intro(Cgi cgi) { string query_string; string http_url; string request_method; + string query_base; } auto conf = Config(); - conf.http_request_type = environment.get("REQUEST_SCHEME", "http"); - conf.http_host = environment.get("HTTP_HOST", "localhost"); - // conf.server_name = environment.get("SERVER_NAME", "localhost"); + conf.http_request_type = environment.get("REQUEST_SCHEME", _cfg.http_request_type); + conf.http_host = environment.get("HTTP_HOST", _cfg.http_host); conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.doc_root_www); - conf.doc_collection_sub_root = _cfg.doc_root_www; // (output_path - web_doc_root_path) - conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.doc_root_cgi); - // conf.cgi_script = environment.get("SCRIPT_NAME", "/cgi-bin/spine-search"); + conf.doc_collection_sub_root = "/spine/static"; // (output_path - web_doc_root_path) + conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.host_cgi_subpath); + conf.cgi_script = environment.get("SCRIPT_NAME", _cfg.filename_cgi); conf.query_string = environment.get("QUERY_STRING", ""); - conf.http_url = environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string); - conf.db_path = _cfg.doc_root_db; // (output_path + /sqlite) + conf.db_path = _cfg.doc_root_db; conf.request_method = environment.get("REQUEST_METHOD", "POST"); + conf.query_base = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?"; + conf.http_url = environment.get("HTTP_REFERER", conf.query_base ~ conf.query_string); struct CGI_val { string db_selected = ""; string sql_match_limit = ""; // radio: ( 1000 | 2500 ) @@ -100,6 +152,7 @@ void cgi_function_intro(Cgi cgi) { // static abstract_ = ctRegex!(`(?:^|\s~\s*)abstract:\s+(?P.+)$`, "m"); static src_filename_base = ctRegex!(`^src_filename_base:\s+(?P.+)$`, "m"); } + auto rgx = Rgx(); struct searchFields { string canned_query = ""; // GET canned_query == cq string search_text_area = ""; // POST search_text_area == tsa @@ -134,7 +187,6 @@ void cgi_function_intro(Cgi cgi) { string searched = ""; // searched == se checked string sql = ""; // sql == sql checked } - auto rgx = Rgx(); auto got = searchFields(); if (environment.get("REQUEST_METHOD", "POST") == "POST") { if ("sf" in cgi.post) { @@ -392,9 +444,9 @@ void cgi_function_intro(Cgi cgi) { string canned_url () { string _url = ""; if (environment.get("REQUEST_METHOD", "POST") == "POST") { - _url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query; + _url = conf.query_base ~ tf.canned_query; } else if (environment.get("REQUEST_METHOD", "POST") == "GET") { - _url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", ""); + _url = conf.query_base ~ environment.get("QUERY_STRING", ""); } return _url; } @@ -438,10 +490,10 @@ void cgi_function_intro(Cgi cgi) { ~ ""; return _matched_objects_text; } - string base ; // = ""; - string tip ; // = ""; - string search_note ; // = ""; - uint sql_match_offset_count = 0; + string base; // = ""; + string tip; // = ""; + string search_note; // = ""; + uint sql_match_offset_count = 0; string previous_next () { auto rgx = regex_canned_search; string _previous_next = ""; @@ -499,823 +551,824 @@ void cgi_function_intro(Cgi cgi) { - + + *{ + padding : 0px; + margin : 2px; + } + body { + height : 100vh; + background-color : #FFFFFF; + } + body { + color : #000000; + background : #FFFFFF; + background-color : #FFFFFF; + } + a:link { + color : #003399; + text-decoration : none; + } + a:visited { + color : #003399; + text-decoration : none; + } + a:hover { + color : #000000; + background-color : #F9F9AA; + } + a.lnkocn:link { + color : #777777; + text-decoration : none; + } + a.lnkocn:visited { + color : #32CD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #777777; + font-size : 15px; + } + a:hover img { + background-color : #FFFFFF; + } + a:active { + color : #003399; + text-decoration : underline; + } + .flex-container { + display : flex; + } + div.publication { + margin-top : 2px; + margin-bottom : 4px; + margin-left : 0%%; + margin-right : 0%%; + } + div.textview_ocn { + margin-left : 0%%; + margin-right : 1%%; + } + div.textview_found { + margin-left : 1%%; + margin-right : 1%%; + } + textarea { + color : #000000; + background-color : #FFFFFF; + } + span.match { + color : #000000; + background-color : #FFFF48; + } + p.norm { } + p.center { text-align : center; } + 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.publication { + font-size : 100%%; + margin-left : 0em; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + p.ocn_is { + font-size : 100%%; + display : inline-block; + } + p.matched_ocn { + font-size : 90%%; + margin-left : 2em; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + 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; + } + p.spaced { white-space : pre; } + p.block { + white-space : pre; + } + p.group { } + p.alt { } + p.verse { + white-space : pre; + margin-bottom : 6px; + } + p.caption { + text-align : left; + font-size : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + padding-left : 1em; + text-indent : -1em; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #EEEEEE; + margin-right : 6px; + text-align : left; + } + p.tiny { } + p.tiny_left { + margin-left : 0px; + margin-right : 0px; + text-align : left; + } + p.tiny_right { + margin-right : 1em; + text-align : right; + } + p.tiny_center { + margin-left : 0px; + margin-right : 0px; + text-align : center; + } + p.book_index_lev1 { + line-height : 100%%; + margin-top : 4px; + margin-bottom : 1px; + } + p.book_index_lev2 { + line-height : 100%%; + text-align : left; + margin-left : 3em; + margin-top : 1px; + margin-bottom : 3px; + } + tt { + font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; + background-color : #555555; + color : #DDDDDD; + } + pre { + width : auto; + display : block; + clear : both; + color : #555555; + } + pre.codeline { + display : table; + clear : both; + table-layout : fixed; + margin-left : 5%%; + margin-right : 5%%; + width : 90%%; + white-space : pre-wrap; + border-style : none; + border-radius : 5px 5px 5px 5px; + box-shadow : 0 2px 5px #AAAAAA inset; + margin-bottom : 1em; + padding : 0.5em 1em; + page-break-inside : avoid; + word-wrap : break-word; + font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; + white-space : pre; + white-space : pre-wrap; + white-space : -moz-pre-wrap; + white-space : -o-pre-wrap; + background-color : #555555; + color : #DDDDDD; + font-size : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + } + pre.codeline span.th::before { + content : counter(linenum) "."; + color : #999999; + text-align : right; + display : block; + } + pre.codeline span.th { + width : 4em; + } + pre.codeline code { + display : table-cell; + } + p.code { + border-style : none; + } + note { white-space : pre; } + em { + font-weight : bold; + font-style : italic; + } + p.left,th.left,td.left { + text-align : left; + } + p.small_left,th.small_left,td.small_left { + text-align : left; + font-size : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : (../image_sys/bullet_09.png) no-repeat 0px 6px; + } + ul { } + h0, h1, h2, h3, h4, h5, h6, h7 { + font-weight : bold; + line-height : 120%%; + text-align : left; + margin-top : 20px; + margin-bottom : 10px; + } + h4.norm, h5.norm, h6.norm, h7.norm { + margin-top : 10px; + margin-bottom : 0px; + } + h0 { font-size : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #999999; + } + h1.i { margin-left : 2em; } + h2.i { margin-left : 3em; } + h3.i { margin-left : 4em; } + h4.i { margin-left : 5em; } + h5.i { margin-left : 6em; } + h6.i { margin-left : 7em; } + h7.i { margin-left : 8em; } + h8.i { margin-left : 9em; } + h9.i { margin-left : 10em; } + .toc { + font-weight : normal; + margin-top : 6px; + margin-bottom : 6px; + } + h0.toc { + margin-left : 1em; + font-size : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + hr { + display : block; + height : 1px; + width : 100%%; + border : 0; + border-top : 1px solid #AAAAAA; + border-color : #AAAAAA + background-color : #AAAAAA + margin-left : 0%%; + margin-right : 0em; + margin-top : 0.5em; + margin-bottom : 0.5em; + padding : 0; + } + ┃", + conf.http_request_type, conf.http_host, ); } { table = format(q"┃ - -
- - - -
- ≅ SiSU spine search form + + +
+ + +
+ ≅ SiSU spine search form +
+
-
-
- ┃"); + ┃"); } { string post_value(string field_name, string type="box", string set="on") { @@ -1359,9 +1412,9 @@ void cgi_function_intro(Cgi cgi) { string _the_can = ""; if (show_the_can == "checked") { tf = text_fields; - string method_get_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", ""); - string method_post_url_construct = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query; - // assert(method_get_url == environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string)); + string method_get_url = conf.query_base ~ environment.get("QUERY_STRING", ""); + string method_post_url_construct = conf.query_base ~ tf.canned_query; + // assert(method_get_url == environment.get("HTTP_REFERER", conf.query_base ~ conf.query_string)); if (conf.request_method == "POST") { _the_can = "" @@ -1393,12 +1446,12 @@ void cgi_function_intro(Cgi cgi) { string search_field = post_value("sf", "field"); tf = text_fields; tip = format(q"┃ - -database: %s; selected view: index -search string: %s %s %s %s %s %s
-%s %s %s %s %s %s -
-┃", + + database: %s; selected view: index + search string: %s %s %s %s %s %s
+ %s %s %s %s %s %s +
+ ┃", cv.db_selected, (tf.text.empty ? "" : "\"text: " ~ tf.text ~ "; "), (tf.title.empty ? "" : "\"title: " ~ tf.title ~ "; "), @@ -1508,7 +1561,7 @@ void cgi_function_intro(Cgi cgi) { // cgi.write(k ~ ": " ~ d ~ "
"); // } } - { // debug cgi info + { // debug cgi info: // cgi.write("db_selected: " ~ cv.db_selected ~ "
\n"); // cgi.write("search_text: " ~ cv.search_text ~ "
\n"); // cgi.write("sql_match_limit: " ~ cv.sql_match_limit ~ ";\n"); @@ -1578,8 +1631,8 @@ void cgi_function_intro(Cgi cgi) { } _sf = "( " ~ db_field ~ " LIKE\n '%" ~ _sf ~ "%' )"; where_ ~= format(q"┃ - %s -┃", + %s + ┃", _sf ); } @@ -1665,7 +1718,8 @@ LIMIT %s OFFSET %s _close_para ~ "
" ~ "

" ~ "

" ~ "

" ~ "

" ~ "

" @@ -1723,7 +1779,8 @@ LIMIT %s OFFSET %s cgi.write( _matched_ocn_open ~ "" diff --git a/sundry/spine_search_cgi/src/spine_search.d_ b/sundry/spine_search_cgi/src/spine_search.d_ old mode 100644 new mode 100755 index 6bc8c67..5907b73 --- a/sundry/spine_search_cgi/src/spine_search.d_ +++ b/sundry/spine_search_cgi/src/spine_search.d_ @@ -1,3 +1,54 @@ +#!/usr/bin/env rdmd +/+ +- Name: Spine, Doc Reform + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2021 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Hompages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ /+ dub.sdl name "spine search" description "spine cgi search" @@ -27,20 +78,20 @@ void cgi_function_intro(Cgi cgi) { string query_string; string http_url; string request_method; + string query_base; } - auto conf = Config(); // SET - conf.http_request_type = environment.get("REQUEST_SCHEME", "http"); - conf.http_host = environment.get("HTTP_HOST", "localhost"); - // conf.server_name = environment.get("SERVER_NAME", "localhost"); + auto conf = Config(); + conf.http_request_type = environment.get("REQUEST_SCHEME", _cfg.http_request_type); + conf.http_host = environment.get("HTTP_HOST", _cfg.http_host); conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.doc_root_www); - conf.doc_collection_sub_root = _cfg.doc_root_www; // (output_path - web_doc_root_path) - // conf.doc_collection_sub_root = "/srv/www/spine/static"; // (output_path - web_doc_root_path) // problem FIX - conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.doc_root_cgi); - // conf.cgi_script = environment.get("SCRIPT_NAME", "/cgi-bin/spine-search"); + conf.doc_collection_sub_root = "/spine/static"; // (output_path - web_doc_root_path) + conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.host_cgi_subpath); + conf.cgi_script = environment.get("SCRIPT_NAME", _cfg.filename_cgi); conf.query_string = environment.get("QUERY_STRING", ""); - conf.http_url = environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string); - conf.db_path = _cfg.doc_root_db; // (output_path + /sqlite) + conf.db_path = _cfg.doc_root_db; conf.request_method = environment.get("REQUEST_METHOD", "POST"); + conf.query_base = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?"; + conf.http_url = environment.get("HTTP_REFERER", conf.query_base ~ conf.query_string); struct CGI_val { string db_selected = ""; string sql_match_limit = ""; // radio: ( 1000 | 2500 ) @@ -56,7 +107,6 @@ void cgi_function_intro(Cgi cgi) { } auto cv = CGI_val(); cv.db_selected = _cfg.filename_db; - // cv.db_selected = "spine.search.db"; auto text_fields() { string canned_query_str = environment.get("QUERY_STRING", ""); if ("query_string" in cgi.post) { @@ -103,6 +153,7 @@ void cgi_function_intro(Cgi cgi) { // static abstract_ = ctRegex!(`(?:^|\s~\s*)abstract:\s+(?P.+)$`, "m"); static src_filename_base = ctRegex!(`^src_filename_base:\s+(?P.+)$`, "m"); } + auto rgx = Rgx(); struct searchFields { string canned_query = ""; // GET canned_query == cq string search_text_area = ""; // POST search_text_area == tsa @@ -137,7 +188,6 @@ void cgi_function_intro(Cgi cgi) { string searched = ""; // searched == se checked string sql = ""; // sql == sql checked } - auto rgx = Rgx(); auto got = searchFields(); if (environment.get("REQUEST_METHOD", "POST") == "POST") { if ("sf" in cgi.post) { @@ -395,9 +445,9 @@ void cgi_function_intro(Cgi cgi) { string canned_url () { string _url = ""; if (environment.get("REQUEST_METHOD", "POST") == "POST") { - _url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query; + _url = conf.query_base ~ tf.canned_query; } else if (environment.get("REQUEST_METHOD", "POST") == "GET") { - _url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", ""); + _url = conf.query_base ~ environment.get("QUERY_STRING", ""); } return _url; } @@ -441,10 +491,10 @@ void cgi_function_intro(Cgi cgi) { ~ ""; return _matched_objects_text; } - string base ; // = ""; - string tip ; // = ""; - string search_note ; // = ""; - uint sql_match_offset_count = 0; + string base; // = ""; + string tip; // = ""; + string search_note; // = ""; + uint sql_match_offset_count = 0; string previous_next () { auto rgx = regex_canned_search; string _previous_next = ""; @@ -502,823 +552,824 @@ void cgi_function_intro(Cgi cgi) { - + + *{ + padding : 0px; + margin : 2px; + } + body { + height : 100vh; + background-color : #FFFFFF; + } + body { + color : #000000; + background : #FFFFFF; + background-color : #FFFFFF; + } + a:link { + color : #003399; + text-decoration : none; + } + a:visited { + color : #003399; + text-decoration : none; + } + a:hover { + color : #000000; + background-color : #F9F9AA; + } + a.lnkocn:link { + color : #777777; + text-decoration : none; + } + a.lnkocn:visited { + color : #32CD32; + text-decoration : none; + } + a.lnkocn:hover { + color : #777777; + font-size : 15px; + } + a:hover img { + background-color : #FFFFFF; + } + a:active { + color : #003399; + text-decoration : underline; + } + .flex-container { + display : flex; + } + div.publication { + margin-top : 2px; + margin-bottom : 4px; + margin-left : 0%%; + margin-right : 0%%; + } + div.textview_ocn { + margin-left : 0%%; + margin-right : 1%%; + } + div.textview_found { + margin-left : 1%%; + margin-right : 1%%; + } + textarea { + color : #000000; + background-color : #FFFFFF; + } + span.match { + color : #000000; + background-color : #FFFF48; + } + p.norm { } + p.center { text-align : center; } + 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.publication { + font-size : 100%%; + margin-left : 0em; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + p.ocn_is { + font-size : 100%%; + display : inline-block; + } + p.matched_ocn { + font-size : 90%%; + margin-left : 2em; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + 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; + } + p.spaced { white-space : pre; } + p.block { + white-space : pre; + } + p.group { } + p.alt { } + p.verse { + white-space : pre; + margin-bottom : 6px; + } + p.caption { + text-align : left; + font-size : 80%%; + display : inline; + } + p.endnote { + font-size : 96%%; + line-height : 120%%; + text-align : left; + margin-right : 15mm; + padding-left : 1em; + text-indent : -1em; + } + p.center { + text-align : center; + } + p.bold { + font-weight : bold; + } + p.bold_left { + font-weight : bold; + text-align : left; + } + p.centerbold { + text-align : center; + font-weight : bold; + } + p.em { + font-weight : bold; + font-style : normal; + background : #FFF3B6; + } + p.small { + font-size : 80%%; + margin-top : 0px; + margin-bottom : 0px; + margin-right : 6px; + text-align : left; + } + .tiny, .tiny_left, .tiny_right, .tiny_center { + font-size : 10px; + margin-top : 0px; + margin-bottom : 0px; + color : #EEEEEE; + margin-right : 6px; + text-align : left; + } + p.tiny { } + p.tiny_left { + margin-left : 0px; + margin-right : 0px; + text-align : left; + } + p.tiny_right { + margin-right : 1em; + text-align : right; + } + p.tiny_center { + margin-left : 0px; + margin-right : 0px; + text-align : center; + } + p.book_index_lev1 { + line-height : 100%%; + margin-top : 4px; + margin-bottom : 1px; + } + p.book_index_lev2 { + line-height : 100%%; + text-align : left; + margin-left : 3em; + margin-top : 1px; + margin-bottom : 3px; + } + tt { + font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; + background-color : #555555; + color : #DDDDDD; + } + pre { + width : auto; + display : block; + clear : both; + color : #555555; + } + pre.codeline { + display : table; + clear : both; + table-layout : fixed; + margin-left : 5%%; + margin-right : 5%%; + width : 90%%; + white-space : pre-wrap; + border-style : none; + border-radius : 5px 5px 5px 5px; + box-shadow : 0 2px 5px #AAAAAA inset; + margin-bottom : 1em; + padding : 0.5em 1em; + page-break-inside : avoid; + word-wrap : break-word; + font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace; + white-space : pre; + white-space : pre-wrap; + white-space : -moz-pre-wrap; + white-space : -o-pre-wrap; + background-color : #555555; + color : #DDDDDD; + font-size : 95%%; + line-height : 100%%; + } + pre.codeline::before { + counter-reset : linenum; + } + pre.codeline span.tr { + display : table-row; + counter-increment : linenum; + } + pre.codeline span.th { + display : table-cell; + user-select : none; + -moz-user-select : none; + -webkit-user-select : none; + padding : 0.5em 0.5em; + } + pre.codeline span.th::before { + content : counter(linenum) "."; + color : #999999; + text-align : right; + display : block; + } + pre.codeline span.th { + width : 4em; + } + pre.codeline code { + display : table-cell; + } + p.code { + border-style : none; + } + note { white-space : pre; } + em { + font-weight : bold; + font-style : italic; + } + p.left,th.left,td.left { + text-align : left; + } + p.small_left,th.small_left,td.small_left { + text-align : left; + font-size : 80%%; + } + p.right,th.right,td.right { + text-align : right; + } + ul, li { + list-style-type : none; + list-style : none; + padding-left : 20px; + font-weight : normal; + line-height : 150%%; + text-align : left; + text-indent : 0mm; + margin-left : 1em; + margin-right : 2em; + margin-top : 3px; + margin-bottom : 3px; + } + li { + background : (../image_sys/bullet_09.png) no-repeat 0px 6px; + } + ul { } + h0, h1, h2, h3, h4, h5, h6, h7 { + font-weight : bold; + line-height : 120%%; + text-align : left; + margin-top : 20px; + margin-bottom : 10px; + } + h4.norm, h5.norm, h6.norm, h7.norm { + margin-top : 10px; + margin-bottom : 0px; + } + h0 { font-size : 125%%; } + h1 { font-size : 120%%; } + h2 { font-size : 115%%; } + h3 { font-size : 110%%; } + h4 { font-size : 105%%; } + h5 { font-size : 100%%; } + h6 { font-size : 100%%; } + h7 { font-size : 100%%; } + h0, h1, h2, h3, h4, h5, h6, h7 { + text-shadow : .2em .2em .3em #999999; + } + h1.i { margin-left : 2em; } + h2.i { margin-left : 3em; } + h3.i { margin-left : 4em; } + h4.i { margin-left : 5em; } + h5.i { margin-left : 6em; } + h6.i { margin-left : 7em; } + h7.i { margin-left : 8em; } + h8.i { margin-left : 9em; } + h9.i { margin-left : 10em; } + .toc { + font-weight : normal; + margin-top : 6px; + margin-bottom : 6px; + } + h0.toc { + margin-left : 1em; + font-size : 120%%; + line-height : 150%%; + } + h1.toc { + margin-left : 1em; + font-size : 115%%; + line-height : 150%%; + } + h2.toc { + margin-left : 2em; + font-size : 110%%; + line-height : 140%%; + } + h3.toc { + margin-left : 3em; + font-size : 105%%; + line-height : 120%%; + } + h4.toc { + margin-left : 4em; + font-size : 100%%; + line-height : 120%%; + } + h5.toc { + margin-left : 5em; + font-size : 95%%; + line-height : 110%%; + } + h6.toc { + margin-left : 6em; + font-size : 90%%; + line-height : 110%%; + } + h7.toc { + margin-left : 7em; + font-size : 85%%; + line-height : 100%%; + } + .subtoc { + margin-right : 34%%; + font-weight : normal; + } + h5.subtoc { + margin-left : 2em; + font-size : 80%%; + margin-top : 2px; + margin-bottom : 2px; + } + h6.subtoc { + margin-left : 3em; + font-size : 75%%; + margin-top : 0px; + margin-bottom : 0px; + } + h7.subtoc { + margin-left : 4em; + font-size : 70%%; + margin-top : 0px; + margin-bottom : 0px; + } + hr { + display : block; + height : 1px; + width : 100%%; + border : 0; + border-top : 1px solid #AAAAAA; + border-color : #AAAAAA + background-color : #AAAAAA + margin-left : 0%%; + margin-right : 0em; + margin-top : 0.5em; + margin-bottom : 0.5em; + padding : 0; + } + ┃", + conf.http_request_type, conf.http_host, ); } { table = format(q"┃ - -
- - - -
- ≅ SiSU spine search form + + +
+ + +
+ ≅ SiSU spine search form +
+
-
-
- ┃"); + ┃"); } { string post_value(string field_name, string type="box", string set="on") { @@ -1362,9 +1413,9 @@ void cgi_function_intro(Cgi cgi) { string _the_can = ""; if (show_the_can == "checked") { tf = text_fields; - string method_get_url = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ environment.get("QUERY_STRING", ""); - string method_post_url_construct = conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ tf.canned_query; - // assert(method_get_url == environment.get("HTTP_REFERER", conf.http_request_type ~ "://" ~ conf.http_host ~ conf.cgi_script ~ "?" ~ conf.query_string)); + string method_get_url = conf.query_base ~ environment.get("QUERY_STRING", ""); + string method_post_url_construct = conf.query_base ~ tf.canned_query; + // assert(method_get_url == environment.get("HTTP_REFERER", conf.query_base ~ conf.query_string)); if (conf.request_method == "POST") { _the_can = "" @@ -1396,12 +1447,12 @@ void cgi_function_intro(Cgi cgi) { string search_field = post_value("sf", "field"); tf = text_fields; tip = format(q"┃ - -database: %s; selected view: index -search string: %s %s %s %s %s %s
-%s %s %s %s %s %s -
-┃", + + database: %s; selected view: index + search string: %s %s %s %s %s %s
+ %s %s %s %s %s %s +
+ ┃", cv.db_selected, (tf.text.empty ? "" : "\"text: " ~ tf.text ~ "; "), (tf.title.empty ? "" : "\"title: " ~ tf.title ~ "; "), @@ -1511,7 +1562,7 @@ void cgi_function_intro(Cgi cgi) { // cgi.write(k ~ ": " ~ d ~ "
"); // } } - { // debug cgi info + { // debug cgi info: // cgi.write("db_selected: " ~ cv.db_selected ~ "
\n"); // cgi.write("search_text: " ~ cv.search_text ~ "
\n"); // cgi.write("sql_match_limit: " ~ cv.sql_match_limit ~ ";\n"); @@ -1581,8 +1632,8 @@ void cgi_function_intro(Cgi cgi) { } _sf = "( " ~ db_field ~ " LIKE\n '%" ~ _sf ~ "%' )"; where_ ~= format(q"┃ - %s -┃", + %s + ┃", _sf ); } @@ -1668,7 +1719,8 @@ LIMIT %s OFFSET %s _close_para ~ "
" ~ "

" ~ "

" ~ "

" ~ "

" ~ "

" @@ -1726,7 +1780,8 @@ LIMIT %s OFFSET %s cgi.write( _matched_ocn_open ~ "" diff --git a/sundry/spine_search_cgi/views/configuration.txt b/sundry/spine_search_cgi/views/configuration.txt index 36470d1..bd3c7ad 100644 --- a/sundry/spine_search_cgi/views/configuration.txt +++ b/sundry/spine_search_cgi/views/configuration.txt @@ -1,8 +1,13 @@ struct Cfg { - string doc_root_www = "/srv/www/spine/static"; - string doc_root_cgi = "/var/www/cgi/cgi-bin/"; - string doc_root_db = "/srv/www/spine/static/sqlite/"; - string filename_cgi = "spine_search"; - string filename_db = "spine.search.db"; + string http_request_type = "http"; + string http_host = "localhost"; + string doc_root_www = "/srv/www/spine/static"; + string doc_root_cgi = "/var/www/cgi/cgi-bin/"; + string doc_root_db = "/srv/www/spine/static/sqlite/"; + string host_cgi_subpath = "/cgi-bin"; + // string subpath_cgi = "/cgi-bin/"; + string filename_cgi = "spine_search"; + string cgi_script_filename_with_any_subpath = "/cgi-bin/spine_search"; + string filename_db = "spine.search.db"; } enum _cfg = Cfg(); diff --git a/sundry/spine_search_cgi/views/configuration_suggested.txt b/sundry/spine_search_cgi/views/configuration_suggested.txt index b737bf0..028cfc9 100644 --- a/sundry/spine_search_cgi/views/configuration_suggested.txt +++ b/sundry/spine_search_cgi/views/configuration_suggested.txt @@ -1,9 +1,14 @@ /+ obt - org-mode generated file +/ struct Cfg { - string doc_root_www = "/srv/www/spine/static"; - string doc_root_cgi = "/var/www/cgi/cgi-bin/"; - string doc_root_db = "/srv/www/spine/static/sqlite/"; - string filename_cgi = "spine_search"; - string filename_db = "spine.search.db"; + string http_request_type = "http"; + string http_host = "localhost"; + string doc_root_www = "/srv/www/spine/static"; + string doc_root_cgi = "/var/www/cgi/cgi-bin/"; + string doc_root_db = "/srv/www/spine/static/sqlite/"; + string host_cgi_subpath = "/cgi-bin"; + // string subpath_cgi = "/cgi-bin/"; + string filename_cgi = "spine_search"; + string cgi_script_filename_with_any_subpath = "/cgi-bin/spine_search"; + string filename_db = "spine.search.db"; } enum _cfg = Cfg(); -- cgit v1.2.3