aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-04-20 19:04:01 -0400
committerRalph Amissah <ralph@amissah.com>2010-04-20 19:04:01 -0400
commit7d5cf5f325a7cb9de869a769d97138f2be308657 (patch)
treeedb37cc541f9a9a3d0e76725e40d1860fcf6509a
parentdb name, tables, columns, indexes changes, review (need another version bump ... (diff)
cgi take account of db name prefix change SiSUv2b_ and changed column names
-rw-r--r--lib/sisu/v2/cgi_pgsql.rb4
-rw-r--r--lib/sisu/v2/cgi_sql_common.rb18
-rw-r--r--lib/sisu/v2/cgi_sqlite.rb4
3 files changed, 13 insertions, 13 deletions
diff --git a/lib/sisu/v2/cgi_pgsql.rb b/lib/sisu/v2/cgi_pgsql.rb
index 493c39d4..071e63e4 100644
--- a/lib/sisu/v2/cgi_pgsql.rb
+++ b/lib/sisu/v2/cgi_pgsql.rb
@@ -189,7 +189,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.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.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.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[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
select=@sql_statement[:body] + ' ' + @sql_statement[:range]
select
@@ -197,7 +197,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.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.filename, endnotes.nr}
+ @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[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
select
diff --git a/lib/sisu/v2/cgi_sql_common.rb b/lib/sisu/v2/cgi_sql_common.rb
index 65bb01a9..56f6cb37 100644
--- a/lib/sisu/v2/cgi_sql_common.rb
+++ b/lib/sisu/v2/cgi_sql_common.rb
@@ -435,7 +435,7 @@ module SiSU_CGI_sql
search[:text] << st[:search]
search[:endnotes] << st[:search]
end
- st=Dbi_search_string.new('metadata_and_text.filename',search_for.filename,q['fns'],cse).string
+ st=Dbi_search_string.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string
if st[:flag]
search[:text] << st[:search]
search[:endnotes] << st[:search]
@@ -820,8 +820,8 @@ module SiSU_CGI_sql
end
#text_objects_body
s_contents.each do |c| #% text body
- location=c['filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
- file_suffix=c['filename'][/.+?\.(_?sst|ssm)$/,1]
+ location=c['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
+ file_suffix=c['src_filename'][/.+?\.(_?sst|ssm)$/,1]
lang=if location =~ /\S+?~(\S\S\S?)$/
l=location[/\S+?~(\S\S\S?)$/,1]
location.gsub!(/(\S+?)~\S\S\S?/,'\1')
@@ -832,8 +832,8 @@ 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['filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;} \
- : %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
+ ? %{<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>&nbsp;} \
+ : %{<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>&nbsp;}
title=%{<span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> by #{c['creator_author']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/epub/#{location}#{lang}.epub"><img border="0" width="15" height="15" src="#{@image_src}/b_epub.png" alt="epub"></a>&nbsp;<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>&nbsp;<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>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><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 \
@@ -912,8 +912,8 @@ module SiSU_CGI_sql
#text_objects_endnote
oldtid = 0
s_endnotes.each do |e| #% endnotes
- location=e['filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
- file_suffix=e['filename'][/.+?\.(_?sst|ssm)$/,1]
+ location=e['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1]
+ file_suffix=e['src_filename'][/.+?\.(_?sst|ssm)$/,1]
lang=if location =~ /\S+?~(\S\S\S?)$/
l=location[/\S+?~(\S\S\S?)$/,1]
location.gsub!(/(\S+?)~\S\S\S?/,'\1')
@@ -925,8 +925,8 @@ 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['filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;} \
- : %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a>&nbsp;}
+ ? %{<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>&nbsp;} \
+ : %{<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>&nbsp;}
title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html">&nbsp;#{ti}</a></span> by #{e['creator_author']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/epub/#{location}#{lang}.epub"><img border="0" width="15" height="15" src="#{@image_src}/b_epub.png" alt="epub"></a>&nbsp;<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>&nbsp;<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>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a>&nbsp;<a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><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
diff --git a/lib/sisu/v2/cgi_sqlite.rb b/lib/sisu/v2/cgi_sqlite.rb
index 947cc80a..860d7bed 100644
--- a/lib/sisu/v2/cgi_sqlite.rb
+++ b/lib/sisu/v2/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.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.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.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[: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.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.filename, endnotes.nr}
+ @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[:range]=%{LIMIT #{limit} OFFSET #{offset} ;}
select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range]
select