diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-08-12 13:14:49 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-08-20 12:03:17 -0400 |
commit | 24269204508d8cf8f963eb9c7d149d18840e4dad (patch) | |
tree | c94ac0fdab5496fa4969098604ffcfaa87c18678 /org/cgi_spine_search.org | |
parent | configuration reorganized into config files (diff) |
config, clean up and make a bit more consistent
- check version settings with:
rg -A2 _version_set$ org
Diffstat (limited to 'org/cgi_spine_search.org')
-rw-r--r-- | org/cgi_spine_search.org | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/org/cgi_spine_search.org b/org/cgi_spine_search.org index b695783..0a1b244 100644 --- a/org/cgi_spine_search.org +++ b/org/cgi_spine_search.org @@ -35,7 +35,7 @@ struct Version { ** set program version VERSION :version:set:project: -#+NAME: spine_version_current_set +#+NAME: spine_version_set #+BEGIN_SRC d enum _ver = Version(0, 11, 3); #+END_SRC @@ -78,7 +78,8 @@ version (Posix) { void cgi_function_intro(Cgi cgi) { mixin(import("configuration.txt")); <<spine_search_init_1>> - <<spine_search_config>> + <<spine_search_config_struct_init>> + <<spine_search_config_struct_set>> <<spine_search_cgi_val>> cv.db_selected = _cfg.db_sqlite_filename; auto text_fields() { @@ -240,29 +241,13 @@ string search_note; // = ""; uint sql_match_offset_count = 0; #+END_SRC -**** config +**** config struct see: cfte_configuation.org -#+NAME: spine_search_config -#+BEGIN_SRC d -<<spine_search_config_struct>> -auto conf = Config(); -conf.http_request_type = environment.get("REQUEST_SCHEME", _cfg.http_request_type); -conf.http_host = environment.get("SERVER_NAME", _cfg.http_host); -// conf.http_host = environment.get("HTTP_HOST", _cfg.http_host); -conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.www_doc_root); -conf.doc_collection_sub_root = "<<doc_subroot_path>>"; // (output_path - web_doc_root_path) -conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.cgi_bin_subpath); -conf.cgi_script_name = environment.get("SCRIPT_NAME", _cfg.cgi_filename); -conf.query_base_url = conf.http_request_type ~ "://" ~ conf.http_host ~ "/" ~ conf.cgi_script_name ~ "?"; -conf.query_string = environment.get("QUERY_STRING", ""); -conf.http_url = environment.get("HTTP_REFERER", conf.query_base_url ~ conf.query_string); -conf.request_method = environment.get("REQUEST_METHOD", "POST"); -conf.db_path = _cfg.db_sqlite_path; -#+END_SRC +***** init config struct -#+NAME: spine_search_config_struct +#+NAME: spine_search_config_struct_init #+BEGIN_SRC d struct Config { string http_request_type; @@ -272,6 +257,8 @@ struct Config { string doc_collection_sub_root; string cgi_root; string cgi_script_name; + string cgi_search_form_title; + string cgi_search_form_html_title; string data_path_html; string http_url; string query_base_url; @@ -281,6 +268,32 @@ struct Config { } #+END_SRC +***** SET config struct + +#+NAME: spine_search_config_struct_set +#+BEGIN_SRC d +auto conf = Config(); +conf.http_request_type = environment.get("REQUEST_SCHEME", _cfg.http_request_type); +conf.http_host = environment.get("SERVER_NAME", _cfg.http_host); +// conf.http_host = environment.get("HTTP_HOST", _cfg.http_host); +conf.web_doc_root_path = environment.get("DOCUMENT_ROOT", _cfg.www_doc_root); +conf.doc_collection_sub_root = "<<doc_subroot_path>>"; // (output_path - web_doc_root_path) +conf.cgi_root = environment.get("CONTEXT_DOCUMENT_ROOT", _cfg.cgi_bin_subpath); +conf.cgi_script_name = environment.get("SCRIPT_NAME", _cfg.cgi_filename); +conf.cgi_search_form_title = _cfg.cgi_search_form_title; // ≅ SiSU spine search form +conf.cgi_search_form_html_title = "<a href=\"" + ~ conf.http_request_type ~ "://" + ~ conf.http_host + ~ "\">" + ~ _cfg.cgi_search_form_title + ~ "</a>"; +conf.query_base_url = conf.http_request_type ~ "://" ~ conf.http_host ~ "/" ~ conf.cgi_script_name ~ "?"; +conf.query_string = environment.get("QUERY_STRING", ""); +conf.http_url = environment.get("HTTP_REFERER", conf.query_base_url ~ conf.query_string); +conf.request_method = environment.get("REQUEST_METHOD", "POST"); +conf.db_path = _cfg.db_sqlite_path; +#+END_SRC + **** cgi val #+NAME: spine_search_cgi_val @@ -723,7 +736,7 @@ return _previous_next; <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> - ≅ SiSU spine search form + %s </title> <meta name="sourcefile" content="SiSU.sst"> <link rel="generator" href="sisudoc.org"> @@ -734,6 +747,7 @@ return _previous_next; </head> <body lang="en" xml:lang="en"> ┃", + conf.cgi_search_form_title, conf.http_request_type, conf.http_host, ); @@ -748,14 +762,16 @@ return _previous_next; <tr><td width="20%%"> <table summary="home button / home information" border="0" cellpadding="2" cellspacing="0"> <tr><td align="left"> - ≅ SiSU spine search form + %s </td></tr> </table> </td> <td> </td></tr> </table> - ┃"); + ┃", + conf.cgi_search_form_html_title, + ); #+END_SRC **** post_value(string field_name, string type="box", string set="on") {} |