diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-09-05 10:36:28 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-09-05 10:41:45 -0400 |
commit | 7bc559f85cb0b6c6f4cdfe127a386573b4c5d8ce (patch) | |
tree | 4d7832a654779710edbf304437be8ee8ab0e6dc7 /lib/sisu/v3/cgi_sql_common.rb | |
parent | v3: 3.0.17 version & changelog "opened" (diff) |
v3: unix conditional tests (? :) remove line break markers before : cosmetic
Diffstat (limited to 'lib/sisu/v3/cgi_sql_common.rb')
-rw-r--r-- | lib/sisu/v3/cgi_sql_common.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 5a2b9fde..c377e002 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -471,7 +471,7 @@ module SiSU_CGI_sql end def previous @offset_previous >= 0 \ - ? (@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s) \ + ? (@@canned_search_url.to_s + '<d=' + sql_match_limit.to_s + '&off=' + @offset_previous.to_s) : '' end def start @@ -664,7 +664,7 @@ module SiSU_CGI_sql end checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' result_type=(cgi['view']=~/text/) \ - ? result_type={ :index => '', :text => 'checked'} \ + ? result_type={ :index => '', :text => 'checked'} : result_type={ :index => 'checked', :text => ''} @@limit=if cgi['sql_match_limit'].to_s=~/2500/ checked_sql_limit={ :l1000 => '', :l2500 => 'checked'} @@ -735,7 +735,7 @@ 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=(checked_all =~/checked/) \ - ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{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" \ + ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{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" : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1 @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" @@ -809,7 +809,7 @@ module SiSU_CGI_sql puts (@header+@tail) else #% searches s1=(@search_for.text1 =~/\S/) \ - ? @search_for.text1 \ + ? @search_for.text1 : 'Unavailable' if checked_case=~/\S/ @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'} @@ -924,11 +924,11 @@ module SiSU_CGI_sql if c['tid'].to_i != oldtid.to_i ti=c['title'] can_txt_srch=(cgi['view']=~/index/) \ - ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } \ + ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } : %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ - ? '<br /><hr>'+title \ + ? '<br /><hr>'+title : '<br />'+title @counter_txt_doc+=1 oldtid=c['tid'].to_i @@ -950,7 +950,7 @@ module SiSU_CGI_sql search_regex=[] build=unescaped_search.scan(/\S+/).each do |g| (g.to_s =~/(AND|OR)/) \ - ? (search_regex << '|') \ + ? (search_regex << '|') : (search_regex << %{#{g.to_s}}) end search_regex=search_regex.join(' ') @@ -961,7 +961,7 @@ module SiSU_CGI_sql else nil end matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ - ? (c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) \ + ? (c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) : c['body'] %{<hr><p><font size="2">ocn <b><a href="#{path_filename(location,c['seg'],@ln)}##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} elsif c['suffix'] =~/1/ #doc @@ -983,7 +983,7 @@ module SiSU_CGI_sql else @counter_txt_ocn+=1 output=c['suffix'] !~/1/ \ - ? title+index \ + ? title+index : %{#{title}#{c['ocn'].sort}, } end end @@ -1017,7 +1017,7 @@ module SiSU_CGI_sql if e['metadata_tid'].to_i != oldtid.to_i ti=e['title'] can_txt_srch=(cgi['view']=~/index/) \ - ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } \ + ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,@ln)}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,@ln)}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,@ln)}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ @counter_endn_doc+=1 @@ -1028,7 +1028,7 @@ module SiSU_CGI_sql or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes @counter_endn_ocn+=1 matched_endnote=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \ - ? matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}) \ + ? matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}) : e['body'] output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,@ln)}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,@ln)}##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes @@ -1038,7 +1038,7 @@ module SiSU_CGI_sql @counters_endn=if @counter_endn_doc > 0 if checked_stats =~/\S/ @@lt_e=@counter_endn_ocn==dbi_statement.sql_match_limit.to_i \ - ? true \ + ? true : false start=(@@offset.to_i+1).to_s range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s @@ -1054,7 +1054,7 @@ module SiSU_CGI_sql limit=dbi_statement.sql_match_limit.to_s @@lt_t ||=false; @@lt_e ||=false canned=(@@lt_t or @@lt_e) \ - ? dbi_statement.pre_next(true,@image_src).to_s \ + ? dbi_statement.pre_next(true,@image_src).to_s : dbi_statement.pre_next(false,@image_src).to_s limit=dbi_statement.sql_match_limit.to_s cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes |