From cbd35cfd8366f2fc9e854d2fca5654467974a547 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 19 Dec 2009 16:51:14 -0500 Subject: cgi_sql_common, minor style related, (mostly enclosing of used variables in curly braces) --- lib/sisu/v1/cgi_sql_common.rb | 93 ++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/lib/sisu/v1/cgi_sql_common.rb b/lib/sisu/v1/cgi_sql_common.rb index bd0b38a5..5138e311 100644 --- a/lib/sisu/v1/cgi_sql_common.rb +++ b/lib/sisu/v1/cgi_sql_common.rb @@ -129,7 +129,7 @@ module SiSU_CGI_sql <<-'WOK_SQL' #Common TOP @@limit,@@offset=1000,0 - @base="#@hosturl_db/cgi-bin/#@version.cgi" + @base="#{@hosturl_db}/cgi-bin/#{@version}.cgi" @@canned_search_url=@base @color_heading='#DDFFAA' @color_match='#ffff48' @@ -160,12 +160,12 @@ module SiSU_CGI_sql - + - @@ -174,49 +174,49 @@ module SiSU_CGI_sql end def header2 <<-'WOK_SQL' - +
SiSU --> +
SiSU -->
- + - #@tip - #@search_note - #@the_can + #{@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 + index + text / grep WOK_SQL end def buttons2 <<-'WOK_SQL'
- echo query - result stats - search url - searched - available fields - sql statement + echo query + result stats + search url + searched + available fields + sql statement
checks: - default - selected - all - none + default + selected + all + none
@@ -285,8 +285,9 @@ module SiSU_CGI_sql @date_modified=q['dtm'] if q['dtm']=~/\S/ @date_available=q['dta'] if q['dta']=~/\S/ @date_valid=q['dtv'] if q['dtv']=~/\S/ - @filename=q['fns'] if q['fns']=~/\S/ - @filename=q['doc'] if q['search'] !~/search db/ + @filename=if q['doc'] and q['search'] !~/search db/; q['doc'] + elsif q['fns']=~/\S/; q['fns']ยท + end @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 @@offset=q['off'] if q['off']=~/\d+/ # 0 end @@ -525,7 +526,7 @@ module SiSU_CGI_sql

- SiSU + SiSU

@@ -572,7 +573,7 @@ module SiSU_CGI_sql

- GPLv3 + GPLv3

@@ -692,10 +693,10 @@ module SiSU_CGI_sql dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ 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']}" + "#{@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']}" end - @canned_base_url="#@base?#{s1}&db=#{cgi['db']}" + @canned_base_url="#{@base}?#{s1}&db=#{cgi['db']}" if checked_case=~/\S/ @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 @@ -705,7 +706,7 @@ module SiSU_CGI_sql end canned_note='search url:' else - @@canned_search_url="#@base?db=#{@db}&view=index" + @@canned_search_url="#{@base}?db=#{@db}&view=index" canned_note='search url example:' end if search_field =~/\S+/ @@ -748,7 +749,7 @@ module SiSU_CGI_sql p_filename=%{filename: #{green}#{@search_for.filename}
} if @search_for.filename =~/\S+/ search_note=<<-WOK - database: #{green}#@db; selected view: #{green}#{cgi['view']} + 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} @@ -805,10 +806,10 @@ module SiSU_CGI_sql ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" else c['title'] end - can_txt_srch=if cgi['view']=~/index/; %{red bullet } - else %{red bullet } + can_txt_srch=if cgi['view']=~/index/; %{search } + else %{search } end - title=%{toc html #{ti} by #{c['creator']} #{can_txt_srch}toc html pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ #hmm watch file_suffix + title=%{toc html #{ti} by #{c['creator']} #{can_txt_srch}toc html pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ #hmm watch file_suffix if @text_search_flag; title='

'+title else title='
'+title end @@ -844,10 +845,10 @@ module SiSU_CGI_sql else nil end matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) - matched=c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1}) + matched=c['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1}) else c['body'] end - %{

ocn #{c['ocn']}:

#{matched_para}} + %{

ocn #{c['ocn']}:

#{matched_para}} elsif c['suffix'] =~/1/ #doc %{#{title}

ocn #{c['ocn']}:#{c['body']}} end @@ -857,9 +858,9 @@ module SiSU_CGI_sql end else #elsif cgi['view']=~/index/ #% idx body if c['suffix'] !~/1/ #seg - index=%{#{c['ocn']}, } if @text_search_flag + index=%{#{c['ocn']}, } if @text_search_flag elsif c['suffix'] =~/1/ #doc - index=%{#{c['ocn']}, } + index=%{#{c['ocn']}, } end if c['seg'] =~/\S+/ if @text_search_flag @@ -884,7 +885,7 @@ module SiSU_CGI_sql over='' false end - %{


Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.
} + %{
Found in the main body of #{@counter_txt_doc} documents, and at #{over} #{@counter_txt_ocn} locations within.
} else '' end else '' @@ -908,10 +909,10 @@ module SiSU_CGI_sql ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" else e['title'] end - can_txt_srch=if cgi['view']=~/index/; %{red bullet } - else %{red bullet } + can_txt_srch=if cgi['view']=~/index/; %{search } + else %{search } end - title=%{

toc html #{ti} by #{e['creator']} #{can_txt_srch}toc html pdf portrait pdf landscape odf manifest
} if file_suffix=~/s/ + title=%{

toc html #{ti} by #{e['creator']} #{can_txt_srch}toc html pdf portrait pdf landscape  odf manifest
} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' @@ -920,13 +921,13 @@ module SiSU_CGI_sql or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes @counter_endn_ocn+=1 matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) - matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{\\1}) + matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1}) else e['body'] end - output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} + output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} else #elsif cgi['view']=~/index/ #% idx endnotes @counter_endn_ocn+=1 - output=%{#{title}#{e['nr']}#{e['ocn']}], } + output=%{#{title}#{e['nr']}#{e['ocn']}], } end @counters_endn=if @counter_endn_doc > 0 if checked_stats =~/\S/ @@ -937,7 +938,7 @@ module SiSU_CGI_sql over='' false end - %{Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.
} + %{Found in the endnotes of #{@counter_endn_doc} documents, and at #{over} #{@counter_endn_ocn} locations within.
} else '' end end -- cgit v1.2.3