From 22fab950e51ba9fc551bea840925b3020ec381bc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 10 Jul 2007 15:35:44 +0100 Subject: cgi search form worked on and presentation, (an info button added and used) * cgi, generated sample search form, rearranged presentation * editor syntax highlighting, kate, kwrite visited --- lib/sisu/v0/cgi_pgsql.rb | 5 +- lib/sisu/v0/cgi_sql_common.rb | 166 ++++++++++++++++++------------------------ lib/sisu/v0/cgi_sqlite.rb | 2 +- lib/sisu/v0/defaults.rb | 5 +- lib/sisu/v0/help.rb | 2 +- lib/sisu/v0/sysenv.rb | 4 - lib/sisu/v0/xml_scaffold.rb | 2 +- 7 files changed, 79 insertions(+), 107 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index 0032a927..9a577337 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -92,7 +92,7 @@ module SiSU_CGI_pgsql f2 << " end\n" if FileTest.writable?('.') output=File.open('sisu_pgsql.cgi','w') - output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << buttons2_pgsql << buttons3 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 + output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 a=%{ generated sisu_pgsql.cgi, BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D) } @@ -213,9 +213,8 @@ module SiSU_CGI_pgsql end WOK_SQL end - def buttons2_pgsql + def buttons1_pgsql <<-'WOK_SQL' - case sensitive WOK_SQL end diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index 37ca67b8..fbb627db 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -131,13 +131,13 @@ module SiSU_CGI_sql @color_heading='#DDFFAA' @color_match='#ffff48' class Form - def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can='') + def initialize(base,search_field,selected_db,checked_index,checked_text,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/ the_can='' if checked_url !~/\S/ search_field='' if checked_echo !~/\S/ - @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_ignore,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can + @base,@search_field,@selected_db,@checked_index,@checked_text,@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=base,search_field,selected_db,checked_index,checked_text,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 @tip=if checked_tip =~/\S/ - 'text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;' + 'text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' else '' end end @@ -171,62 +171,53 @@ module SiSU_CGI_sql end def header2 <<-'WOK_SQL' - -
-
- - - - select which database to search - -
- - - index - text / grep - -
+
- -
- WOK_SQL - end - def buttons2 - <<-'WOK_SQL' +
#@tip #@search_note #@the_can
-
+
+ + + + to search: select which database to search (drop-down menu below); enter your search query (in the form above); and click on the search button (below) +
+ + + index + text / grep WOK_SQL end - def buttons3 + def buttons2 <<-'WOK_SQL' -
- echo previous search - search result stats - url for search - available search fields - sql statement -
- checks: - selected - all - none -
- +
+ echo query + result stats + search url + searched + available fields + sql statement +
+ checks: + default + selected + all + none +
- + WOK end end @@ -601,23 +592,34 @@ module SiSU_CGI_sql @stub='sisu' 'SiSU_sisu' end - checked_url,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,selected_db='','','','','','','','','' + checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' if cgi['view']=~/text/; checked_index,checked_text='','checked' else checked_index,checked_text='checked','' end + checked_echo='checked' if cgi['echo'] =~/\S/ + checked_stats='checked' if cgi['stats'] =~/\S/ checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 checked_searched='checked' if cgi['searched'] =~/\S/ checked_tip='checked' if cgi['tip'] =~/\S/ checked_case='checked' if cgi['casesense'] =~/\S/ - checked_echo='checked' if cgi['echo'] =~/\S/ checked_sql='checked' if cgi['sql'] =~/\S/ if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='checked' + checked_all='checked' + checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' checked_none='' - elsif cgi['checks'] =~/check_none/ #or cgi['a'].to_i==0 + elsif cgi['checks'] =~/check_none/ checked_none='checked' - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='' - else checked_ignore='checked' + checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' + elsif cgi['checks'] =~/check_selected/ + checked_selected='checked' + elsif cgi['checks'] =~/check_default/ + checked_default='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + else + checked_selected='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' end WOK_SQL end @@ -654,7 +656,7 @@ module SiSU_CGI_sql fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ @@canned_search_url=if checked_all =~/checked/ "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" - else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&u=1&e=1" + else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" end if checked_case=~/\S/ @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 @@ -663,7 +665,7 @@ module SiSU_CGI_sql @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1 @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 end - canned_note='previous search url:' + canned_note='search url:' else @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" canned_note='search url example:' @@ -684,7 +686,7 @@ module SiSU_CGI_sql end green=%{} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) - the_can=%{#{canned_note}
#{canned_search_url_txt}

} + the_can=%{#{canned_note} #{canned_search_url_txt}
} p_text=p_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject=p_filename='' p_text=%{text: #{green}#{@search_for.text1}

} if @search_for.text1 =~/\S+/ p_keywords=%{keywords: #{green}#{@search_for.keywords}

} if @search_for.keywords =~/\S+/ @@ -708,15 +710,14 @@ module SiSU_CGI_sql p_filename=%{filename: #{green}#{@search_for.filename}
} if @search_for.filename =~/\S+/ search_note=<<-WOK -
previous selection:
- database: #{green}#@db
; selected view: #{green}#{cgi['view']}
- search string: "#{green}#{analyze_format}"
+ database: #{green}#@db; selected view: #{green}#{cgi['view']} + search string: "#{green}#{analyze_format}"
#{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} WOK #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} #dbi_canning - @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can).submission_form #% form + @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,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" puts (@header+@tail) @@ -763,7 +764,7 @@ module SiSU_CGI_sql end #metadata_found_body if c['tid'].to_i != oldtid.to_i - title=%{#{c['title']} by #{c['creator']} pdf portraitpdf landscape manifest ?
} if file_suffix=~/s/ #hmm watch file_suffix + title=%{#{c['title']} by #{c['creator']} pdf portraitpdf landscape manifest
} if file_suffix=~/s/ #hmm watch file_suffix if @text_search_flag; title='

'+title else title='
'+title end @@ -796,7 +797,7 @@ module SiSU_CGI_sql end matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) matched=if c['body'] =~/\\1})) + else (c['body'].gsub(/(#@search_regx)/i,%{\\1})) end matched else c['body'] @@ -830,7 +831,10 @@ module SiSU_CGI_sql else output=title end @counters_txt=if @counter_txt_doc > 0 - %{Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.
} + if checked_stats =~/\S/ + %{
Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.
} + else '' + end else '' end @body_main << output #+ details @@ -849,7 +853,7 @@ module SiSU_CGI_sql #metadata_found_endnotes if @text_search_flag if e['metadata_tid'].to_i != oldtid.to_i - title=%{

#{e['title']} by #{e['creator']} pdf portraitpdf landscape manifest ?
} if file_suffix=~/s/ + title=%{

#{e['title']} by #{e['creator']} pdf portraitpdf landscape manifest
} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' @@ -858,7 +862,7 @@ module SiSU_CGI_sql @counter_endn_ocn+=1 matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) matched=if e['body'] =~/\\1}) + else e['body'].gsub(/(#@search_regx)/i,%{\\1}) #e['body'] end matched @@ -870,7 +874,10 @@ module SiSU_CGI_sql output=%{#{title}#{e['nr']}#{e['ocn']}], } end @counters_endn=if @counter_endn_doc > 0 - %{Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.
} + if checked_stats =~/\S/ + %{Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.
} + else '' + end end @endnotes << output #+ details else @endnotes=[] #does not take out yet @@ -896,32 +903,3 @@ module SiSU_CGI_sql end end __END__ -#@counter_txt_ocn -#@counter_endn_ocn - - - if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='checked' - checked_none='' - #elsif cgi['checks'] =~/check_fixed/ or cgi['check_fixed'] =~/\S/ - # #checked_ignore='checked' - # checked_fixed='checked' - # checked_url='checked' - # checked_searched='checked' - # checked_echo='checked' - # #checked_tip='checked' - # #checked_sql='checked' - # checked_tip=checked_sql=checked_none='' - #elsif cgi['checks'] =~/check_ignore/ or cgi['check_ignore'] =~/\S/ - # checked_ignore='checked' - # checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 - # checked_searched='checked' if cgi['searched'] =~/\S/ - # checked_tip='checked' if cgi['tip'] =~/\S/ - # checked_echo='checked' if cgi['echo'] =~/\S/ - # checked_sql='checked' if cgi['sql'] =~/\S/ - # checked_none='' - elsif cgi['checks'] =~/check_none/ or cgi['a'].to_i==0 - checked_none='checked' - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='' - else checked_ignore='checked' - end diff --git a/lib/sisu/v0/cgi_sqlite.rb b/lib/sisu/v0/cgi_sqlite.rb index 4565ebe2..56b1e588 100644 --- a/lib/sisu/v0/cgi_sqlite.rb +++ b/lib/sisu/v0/cgi_sqlite.rb @@ -92,7 +92,7 @@ module SiSU_CGI_sqlite f3 << " end\n" if FileTest.writable?('.') output=File.open('sisu_sqlite.cgi','w') - output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << buttons3 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 + output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 a=%{ generated sisu_sqlite.cgi, BASED ON ALREADY CREATED sisu_sqlite.db OUTPUT, (-d) } diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 66333528..694b2e83 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -377,7 +377,7 @@ module SiSU_Viz 'sisu.png' end def icon_manifest - 'bullet_red.png' + 'b_info.png' end def icon_doc 'b_doc.png' @@ -911,7 +911,7 @@ module SiSU_Viz end def nav_txt_manifest %{ - #{png_manifest}  ?  + #{png_manifest}  } end def nav_txt_concordance @@ -1528,7 +1528,6 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQ
- idx txt diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index 9c10c27e..768a52cf 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -1053,7 +1053,7 @@ WOK latex to pdf: #{program_found?(@env.program.pdflatex)} postgresql: #{program_found?(@env.program.postgresql)} sqlite: #{program_found?(@env.program.sqlite)} - (these can be turned off if unavailable in sisurc.yaml under program_set:) + (these can be turned off if unavailable in sisurc.yml under program_set:) #{@cX.green}processing shortcut defaults set to:#{@cX.off} color defaut set (on==true) #{@cX.blue}#{cf_defaults.color}#{@cX.off} sisu -0 #{@cX.blue}#{cf_defaults.cf_0}#{@cX.off} [default] diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index c2d694f2..ddd84aaa 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -881,7 +881,6 @@ module SiSU_Env
- idx @@ -917,7 +916,6 @@ module SiSU_Env
- idx @@ -995,7 +993,6 @@ module SiSU_Env
- idx txt @@ -1011,7 +1008,6 @@ module SiSU_Env
- idx txt diff --git a/lib/sisu/v0/xml_scaffold.rb b/lib/sisu/v0/xml_scaffold.rb index 93987840..21ce1231 100644 --- a/lib/sisu/v0/xml_scaffold.rb +++ b/lib/sisu/v0/xml_scaffold.rb @@ -68,7 +68,7 @@ module SiSU_XML_scaffold def read begin @md=SiSU_Param::Parameters.new(@opt).get - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here + @dal_array=SiSU_DAL::Source.new(@opt).get SiSU_XML_scaffold::Source::Scroll.new(@dal_array,@md).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure -- cgit v1.2.3