aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-03-27 21:17:17 -0400
committerRalph Amissah <ralph@amissah.com>2010-03-31 16:08:10 -0400
commite4cc70919c928b92807ce83ade1b1c87f460cd11 (patch)
treef0780a401f0def6daa6ee21ef81dc5d21019d571
parentsysenv, search_widget, small adjustments (diff)
cgi sql search form: comparison bug fix; clearer information when results exceed match limit set
v2 and ino on limit set backported to v1
-rw-r--r--lib/sisu/v1/cgi_sql_common.rb26
-rw-r--r--lib/sisu/v2/cgi_pgsql.rb10
-rw-r--r--lib/sisu/v2/cgi_sql_common.rb27
3 files changed, 35 insertions, 28 deletions
diff --git a/lib/sisu/v1/cgi_sql_common.rb b/lib/sisu/v1/cgi_sql_common.rb
index 9900ff43..5b2ef9b2 100644
--- a/lib/sisu/v1/cgi_sql_common.rb
+++ b/lib/sisu/v1/cgi_sql_common.rb
@@ -285,8 +285,8 @@ module SiSU_CGI_sql
@date_available=q['dta'] if q['dta']=~/\S/
@date_valid=q['dtv'] if q['dtv']=~/\S/
@filename=if q['doc'] and q['search'] !~/search db/; q['doc']
- elsif q['fns']=~/\S/; q['fns']ยท
- end
+ elsif q['fns']=~/\S/; q['fns']
+ end
@@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000
@@offset=q['off'] if q['off']=~/\d+/ # 0
end
@@ -448,7 +448,9 @@ module SiSU_CGI_sql
@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_next.to_s
end
def previous
- @offset_previous >= 0 ? (@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) : ''
+ @offset_previous >= 0 \
+ ? (@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) \
+ : ''
end
def start
@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + 0.to_s
@@ -877,14 +879,15 @@ module SiSU_CGI_sql
end
@counters_txt=if @counter_txt_doc > 0
if checked_stats =~/\S/
- @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i
- over='over'
+ @@lt_t=if @counter_txt_ocn==dbi_statement.sql_limit.to_i
+ over_limit='over the limit set of'
+ over_this_number='more than'
true
else
- over=''
+ over_limit,over_this_number='',''
false
end
- %{<hr /><font size="2" color="#666666">Found in the main body of #{@counter_txt_doc} documents, and at #{over} #{@counter_txt_ocn} locations within.</font><br />}
+ %{<hr /><font size="2" color="#666666">Found in the main body of #{over_this_number} #{@counter_txt_doc} documents, and at #{over_limit} #{@counter_txt_ocn} locations within.</font><br />}
else ''
end
else ''
@@ -930,14 +933,15 @@ module SiSU_CGI_sql
end
@counters_endn=if @counter_endn_doc > 0
if checked_stats =~/\S/
- @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i
- over='over'
+ @@lt_e=if @counter_endn_ocn==dbi_statement.sql_limit.to_i
+ over_limit='over the limit set of'
+ over_this_number='more than'
true
else
- over=''
+ over_limit,over_this_number='',''
false
end
- %{<font size="2" color="#666666">Found in the endnotes of #{@counter_endn_doc} documents, and at #{over} #{@counter_endn_ocn} locations within.</font><br />}
+ %{<font size="2" color="#666666">Found in the endnotes of #{over_this_number} #{@counter_endn_doc} documents, and at #{over_limit} #{@counter_endn_ocn} locations within.</font><br />}
else ''
end
end
diff --git a/lib/sisu/v2/cgi_pgsql.rb b/lib/sisu/v2/cgi_pgsql.rb
index bc47b0bc..db2d8267 100644
--- a/lib/sisu/v2/cgi_pgsql.rb
+++ b/lib/sisu/v2/cgi_pgsql.rb
@@ -68,6 +68,7 @@ module SiSU_CGI_pgsql
@image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
@common=SiSU_CGI_sql::SiSU_CGI_common.new(@webserv,@opt.cmd,@image_src,@env)
@db=SiSU_Env::Info_db.new
+ @cgi_file_name="sisu_#{SiSU_version_dir}_pgsql.cgi"
end
def pgsql
serve=[]
@@ -93,7 +94,7 @@ module SiSU_CGI_pgsql
end
f2 << " end\n"
if FileTest.writable?('.')
- output=File.open('sisu_pgsql.cgi','w')
+ output=File.open(@cgi_file_name,'w')
output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2
a=%{ generated sisu_pgsql.cgi,
BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D)
@@ -103,9 +104,10 @@ module SiSU_CGI_pgsql
c=case @webserv
when /pwd/; ''
else "if necessary make the directory /usr/lib/cgi-bin :
- sudo cp -vi #{Dir.pwd}/sisu_pgsql.cgi /usr/lib/cgi-bin/.
- sudo chmod -v 755 /usr/lib/cgi-bin/sisu_pgsql.cgi
- (copy sisu_pgsql.cgi to your cgi directory) and set file permissions to 755"
+ sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.
+ sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name}
+ sudo ln -s /usr/lib/cgi-bin/#{@cgi_file_name} /usr/lib/cgi-bin/sisu_pgsql.cgi
+ (copy #{@cgi_file_name} to your cgi directory) set file permissions to 755, and make symbolic link to sisu_pgsql.cgi"
end
a=%{#{c}
#{@env.webserv_base_cgi}/cgi-bin/sisu_pgsql.cgi
diff --git a/lib/sisu/v2/cgi_sql_common.rb b/lib/sisu/v2/cgi_sql_common.rb
index f7b035db..0c3977c4 100644
--- a/lib/sisu/v2/cgi_sql_common.rb
+++ b/lib/sisu/v2/cgi_sql_common.rb
@@ -282,7 +282,7 @@ 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=if q['doc'] and q['search'] !~/search db/; q['doc'] #if q['doc']; q['doc']
+ @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
@@ -446,7 +446,9 @@ module SiSU_CGI_sql
@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_next.to_s
end
def previous
- @offset_previous >= (0 ? (@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) : '')
+ @offset_previous >= 0 \
+ ? (@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + @offset_previous.to_s) \
+ : ''
end
def start
@@canned_search_url.to_s + '&ltd=' + sql_limit.to_s + '&off=' + 0.to_s
@@ -851,9 +853,6 @@ module SiSU_CGI_sql
end
@counter_txt_ocn+=1
output=title+text
- #output=if c['seg'] =~/\S+/; title+text
- #else text #check
- #end
else #elsif cgi['view']=~/index/ #% idx body
if c['suffix'] !~/1/ #seg
index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag
@@ -876,14 +875,15 @@ module SiSU_CGI_sql
end
@counters_txt=if @counter_txt_doc > 0
if checked_stats =~/\S/
- @@lt_t=if @counter_txt_ocn== dbi_statement.sql_limit.to_i
- over='over'
+ @@lt_t=if @counter_txt_ocn==dbi_statement.sql_limit.to_i
+ over_limit='over the limit set of'
+ over_this_number='more than'
true
else
- over=''
+ over_limit,over_this_number='',''
false
end
- %{<hr /><font size="2" color="#666666">Found in the main body of #{@counter_txt_doc} documents, and at #{over} #{@counter_txt_ocn} locations within.</font><br />}
+ %{<hr /><font size="2" color="#666666">Found in the main body of #{over_this_number} #{@counter_txt_doc} documents, and at #{over_limit} #{@counter_txt_ocn} locations within.</font><br />}
else ''
end
else ''
@@ -929,14 +929,15 @@ module SiSU_CGI_sql
end
@counters_endn=if @counter_endn_doc > 0
if checked_stats =~/\S/
- @@lt_e=if @counter_endn_ocn== dbi_statement.sql_limit.to_i
- over='over'
+ @@lt_e=if @counter_endn_ocn==dbi_statement.sql_limit.to_i
+ over_limit='over the limit set of'
+ over_this_number='more than'
true
else
- over=''
+ over_limit,over_this_number='',''
false
end
- %{<font size="2" color="#666666">Found in the endnotes of #{@counter_endn_doc} documents, and at #{over} #{@counter_endn_ocn} locations within.</font><br />}
+ %{<font size="2" color="#666666">Found in the endnotes of #{over_this_number} #{@counter_endn_doc} documents, and at #{over_limit} #{@counter_endn_ocn} locations within.</font><br />}
else ''
end
end