diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2007-06-15 12:05:07 +0100 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2007-06-15 12:05:07 +0100 |
commit | 6be61200c529f7f61a89aac6158eb63026d7a44b (patch) | |
tree | fe4bcad72eb273e07ac0429fd5c1977ed0efa682 /lib/sisu/v0/cgi_sql_common.rb | |
parent | sisu-0.54.0 (minor additions to syntax, indent range extended) (diff) |
cgi search script fix, related to highlighting matches, changelog update, rest removal of hanging whitespacesisu_0.54.1
Diffstat (limited to 'lib/sisu/v0/cgi_sql_common.rb')
-rw-r--r-- | lib/sisu/v0/cgi_sql_common.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index 13f9c2a3..a71d5412 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -111,6 +111,8 @@ module SiSU_CGI_sql @@limit,@@offset=1000,0 @base="#@hosturl_db/cgi-bin/#@version.cgi" @@canned_search_url=@base + @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_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can='') search_note='' if checked_searched !~/\S/ @@ -658,7 +660,7 @@ module SiSU_CGI_sql end #metadata_found_body if c['tid'].to_i != oldtid.to_i - title=%{<span style="background-color: #DDFFAA"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html">#{c['title']}</a></span> by #{c['creator']} <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="manifest"><font size="2"> ?</font></a><br />} if file_suffix=~/s/ #hmm watch file_suffix + title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html">#{c['title']}</a></span> by #{c['creator']} <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="manifest"><font size="2"> ?</font></a><br />} if file_suffix=~/s/ #hmm watch file_suffix if @text_search_flag; title='<br /><hr>'+title else title='<br />'+title end @@ -689,7 +691,13 @@ module SiSU_CGI_sql end else nil end - matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) ? (c['body'].gsub(/(#@search_regx)/,'<span style="background-color: #ffff48">\1</span>')) : c['body'] #check + matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=if c['body'] =~/<a href="https?:\/\//mi; c['body'] + else (c['body'].gsub(/(#@search_regx)/,%{<span style="background-color: #@color_match">\\1</span>})) + end + matched + else c['body'] + end %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} elsif c['suffix'] =~/1/ #doc %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} @@ -738,14 +746,21 @@ module SiSU_CGI_sql #metadata_found_endnotes if @text_search_flag if e['metadata_tid'].to_i != oldtid.to_i - title=%{<br /><hr><span style="background-color: #DDFFAA"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html">#{e['title']}</a></span> by #{e['creator']} <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="manifest"><font size="2"> ?</font></a><br />} if file_suffix=~/s/ + title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html">#{e['title']}</a></span> by #{e['creator']} <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="manifest"><font size="2"> ?</font></a><br />} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' end if cgi['view']=~/text/ #% txt endnotes @counter_endn_ocn+=1 - matched_endnote=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) ? (e['body'].to_s.gsub(/(#@search_regx)/,'<span style="background-color: #ffff48">\1</span>')) : e['body'] #check + matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=if e['body'] =~/<a href="https?:\/\//mi; e['body'] + else e['body'].gsub(/(#@search_regx)/,%{<span style="background-color: #@color_match">\\1</span>}) + #e['body'] + end + matched + else e['body'] + end output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html##{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} elsif cgi['view']=~/index/ #% idx endnotes @counter_endn_ocn+=1 |