diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-05-24 21:41:43 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-05-24 21:44:12 -0400 |
commit | 4d509289ed031930d2b10964d981a608392b6b58 (patch) | |
tree | f9081080f3987033dbddaa452185864205e3b36d | |
parent | v3: sysenv, url webserver link (manifest) fix (diff) |
v3: cgi search form, fixes related to language code
* filename with language code being required as unique document identifier
-rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 3 | ||||
-rw-r--r-- | lib/sisu/v3/cgi_pgsql.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v3/cgi_sql_common.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v3/cgi_sqlite.rb | 4 |
4 files changed, 16 insertions, 13 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 73275cb5..a2529761 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -22,6 +22,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz * sysenv, url webserver link (manifest) fix + * cgi search form, fixes related to language code + (filename with language code being required as unique document identifier) + %% 3.0.10.orig.tar.gz (2011-05-23:21/1) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.10-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.10.orig.tar.gz diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb index 4afda106..aa4a02e8 100644 --- a/lib/sisu/v3/cgi_pgsql.rb +++ b/lib/sisu/v3/cgi_pgsql.rb @@ -186,7 +186,7 @@ module SiSU_CGI_pgsql def sql_select_body limit ||=@@limit offset ||=@@offset - @sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.notes_suffix, doc_objects.body, doc_objects.seg, doc_objects.ocn, metadata_and_text.tid FROM doc_objects, metadata_and_text WHERE (#{@search_text}) AND doc_objects.metadata_tid = metadata_and_text.tid ORDER BY metadata_and_text.title, metadata_and_text.src_filename, doc_objects.ocn} + @sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, metadata_and_text.notes_suffix, doc_objects.body, doc_objects.seg, doc_objects.ocn, metadata_and_text.tid FROM doc_objects, metadata_and_text WHERE (#{@search_text}) AND doc_objects.metadata_tid = metadata_and_text.tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, doc_objects.ocn} @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} select=@sql_statement[:body] + ' ' + @sql_statement[:range] select @@ -194,7 +194,7 @@ module SiSU_CGI_pgsql def sql_select_endnotes limit ||=@@limit offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} + @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] select diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 0f56f77f..c782d48f 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -406,7 +406,7 @@ module SiSU_CGI_sql search[:text] << st[:search] search[:endnotes] << st[:search] end - st=Dbi_search_string.new('metadata_and_text.title_language',search_for.language,q['lang'],cse).string + st=Dbi_search_string.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] @@ -837,7 +837,7 @@ module SiSU_CGI_sql when /language/ <<-'WOK_SQL' def path_manifest(fn,ln=nil) - "#{@hostpath}/#{ln}/manifest/#{fn}.manifest.html" + "#{@hostpath}/#{ln}/manifest/#{fn}.html" end def path_html_seg(fn,ln=nil) "#{@hostpath}/#{ln}/html/#{fn}" @@ -849,7 +849,7 @@ module SiSU_CGI_sql when /filetype/ <<-'WOK_SQL' def path_manifest(fn,ln=nil) - "#{@hostpath}/manifest/#{fn}.manifest.html" + "#{@hostpath}/manifest/#{fn}.html" end def path_html_seg(fn,ln=nil) "#{@hostpath}/html/#{fn}" @@ -888,9 +888,9 @@ 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']}&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']}&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_html_seg(location,@ln)}/toc.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator_author']} #{can_txt_srch}<a href="#{path_html_seg(location,@ln)}/toc.html"><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/ #hmm watch file_suffix + ? %{<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_html_seg(location,c['language_document_char'])}/toc.html"><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_html_seg(location,c['language_document_char'])}/toc.html"><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 />'+title @@ -981,9 +981,9 @@ 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']}&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']}&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_html_seg(location,@ln)}/toc.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator_author']} #{can_txt_srch}<a href="#{path_html_seg(location,@ln)}/toc.html"><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/ + ? %{<a href="#{@canned_base_url}&fns=#{e['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=#{e['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=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_html_seg(location,@ln)}/toc.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_html_seg(location,@ln)}/toc.html"><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 oldtid=e['metadata_tid'].to_i else title = '' diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb index 92178b4e..c0ecaeb5 100644 --- a/lib/sisu/v3/cgi_sqlite.rb +++ b/lib/sisu/v3/cgi_sqlite.rb @@ -179,7 +179,7 @@ module SiSU_CGI_sqlite def sql_select_body limit ||=@@limit offset ||=@@offset - @sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.notes_suffix, doc_objects.body, doc_objects.seg, doc_objects.ocn, metadata_and_text.tid FROM doc_objects, metadata_and_text WHERE #{@search_text} AND doc_objects.metadata_tid = metadata_and_text.tid ORDER BY metadata_and_text.title, metadata_and_text.src_filename, doc_objects.ocn} + @sql_statement[:body]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, metadata_and_text.notes_suffix, doc_objects.body, doc_objects.seg, doc_objects.ocn, metadata_and_text.tid FROM doc_objects, metadata_and_text WHERE #{@search_text} AND doc_objects.metadata_tid = metadata_and_text.tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, doc_objects.ocn} @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} select=@sql_statement[:body] + ' ' + @sql_statement[:range] select @@ -187,7 +187,7 @@ module SiSU_CGI_sqlite def sql_select_endnotes limit ||=@@limit offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} + @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] select |