aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/util_cgi_rb_fcgi_sqlite_search.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/util_cgi_rb_fcgi_sqlite_search.org')
-rw-r--r--org/util_cgi_rb_fcgi_sqlite_search.org52
1 files changed, 36 insertions, 16 deletions
diff --git a/org/util_cgi_rb_fcgi_sqlite_search.org b/org/util_cgi_rb_fcgi_sqlite_search.org
index 60baaa0..4bfdf5f 100644
--- a/org/util_cgi_rb_fcgi_sqlite_search.org
+++ b/org/util_cgi_rb_fcgi_sqlite_search.org
@@ -14,6 +14,8 @@
#+PROPERTY: header-args+ :results no
#+PROPERTY: header-args+ :cache no
#+PROPERTY: header-args+ :padline no
+#+PROPERTY: header-args+ :mkdirp yes
+
- [[./spine.org][spine]] [[./][org/]]
- [[./output_hub.org][output_hub]]
@@ -32,7 +34,10 @@ document home currently at /var/www/html (better placed at /var/www or srv/proje
*** sqlite cgi search TODO
**** head
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi" :tangle-mode (identity #o755) :shebang #!/usr/bin/env ruby
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle-mode (identity #o755)
+#+HEADER: :shebang #!/usr/bin/env ruby
+#+BEGIN_SRC ruby
=begin
* Name: SiSU information Structuring Universe
* Author: Ralph Amissah
@@ -90,7 +95,8 @@ document home currently at /var/www/html (better placed at /var/www or srv/proje
**** initialize
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
begin
require 'cgi'
require 'fcgi'
@@ -116,7 +122,8 @@ end
**** form
***** initialize form
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
class Form
def initialize(base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can='')
search_note = '' if checked_searched !~ /\S/
@@ -132,7 +139,8 @@ class Form
***** submission form
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
def submission_form
search_form =<<-WOK
<!DOCTYPE html>
@@ -217,7 +225,8 @@ end
**** search request
***** initialize request
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
class SearchRequest #% search_for
attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:editor,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:src_filename_base
def initialize(search_field='',q='')
@@ -292,7 +301,8 @@ class SearchRequest #% sea
***** text to match
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
def text_to_match(identifier='')
m={
string: /#{identifier}\s*(.+?)/,
@@ -317,7 +327,8 @@ end
**** search string
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
class DBI_SearchString
def initialize(l,t,q,cse=false)
@l,@t,@q=l,t,q
@@ -345,7 +356,8 @@ end
**** search statement
***** init
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
class DBI_SearchStatement
attr_reader :text_search_flag,:sql_select_body_format,:sql_offset,:sql_limit
def initialize(conn,search_for,q,c)
@@ -452,7 +464,8 @@ class DBI_SearchStatement
***** misc
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
def sql_offset
@@offset
end
@@ -539,7 +552,8 @@ class DBI_SearchStatement
***** select statement
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
def sql_select_body
limit ||= @@limit
offset ||= @@offset
@@ -564,7 +578,8 @@ end
**** tail
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
def tail
<<-'WOK'
<br /><hr /><br />
@@ -668,7 +683,8 @@ end
**** fcgi each
***** init & start loop
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
@tail=tail
@counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0
@counters_txt,@counters_endn,@sql_select_body='','',''
@@ -743,7 +759,8 @@ FCGI.each_cgi do |cgi|
***** canned search
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
#Canned_search.new(@base,@search_for.text1,cgi)
if @search_for.text1=~/\S+/ or @search_for.fulltext=~/\S+/ or @search_for.author=~/\S+/ or @search_for.topic_register=~/\S+/ #and search_field =~/\S/
s1 = 's1=' + CGI.escape(@search_for.text1) if @search_for.text1 =~ /\S/
@@ -844,7 +861,8 @@ FCGI.each_cgi do |cgi|
***** submission form
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
@header = Form.new(@base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form
unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/
print "Content-type: text/html\n\n"
@@ -939,7 +957,8 @@ FCGI.each_cgi do |cgi|
***** contents each, text body
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
#% text_objects_body
s_contents.each do |c| #% text body
location=c['src_filename_base'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
@@ -1035,7 +1054,8 @@ FCGI.each_cgi do |cgi|
***** after
-#+BEGIN_SRC ruby :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+HEADER: :tangle "../misc/util/rb/cgi/spine.search.cgi"
+#+BEGIN_SRC ruby
olduid = ""
offset=dbi_statement.sql_offset.to_s
limit=dbi_statement.sql_match_limit.to_s