aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-07-14 10:01:58 +0100
committerRalph Amissah <ralph@amissah.com>2007-07-14 10:01:58 +0100
commit59fe29af491b6324d792c2ff8a5ea5bd1907ae6f (patch)
treeac61783812569c49d83871ac23318cf90d89650f /lib
parentMerge branch 'upstream' into debian/sid (diff)
parentbetter name for method in sample search; nedit syntax does not work (diff)
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v0/cgi_sql_common.rb66
1 files changed, 37 insertions, 29 deletions
diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb
index 9f89913e..50fce2fc 100644
--- a/lib/sisu/v0/cgi_sql_common.rb
+++ b/lib/sisu/v0/cgi_sql_common.rb
@@ -451,49 +451,57 @@ module SiSU_CGI_sql
end
self
end
- def sql_canned_search_url(ok,img)
- @image_src=img
+ def pre_next(beyond_limit,img)
can=sql_canned_search
page=(sql_offset.to_i + sql_limit.to_i)/sql_limit.to_i
- case page.to_s
- when /^1$/
- %{<hr /><br /><center>
- pg. #{page.to_s}
- <a href="#{can.next}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
- </a>
- </center>}
- when /^2$/
- %{<hr /><br /><center>
- <a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
- </a>
- pg. #{page.to_s}
- <a href="#{can.next}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
- </a>
- </center>}
- else
- if ok
+ if beyond_limit
+ if page.to_s =~ /^1$/
+ %{<hr /><br /><center>
+ pg. #{page.to_s}
+ <a href="#{can.next}">
+ <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
+ </a>
+ </center>}
+ elsif page.to_s =~ /^2$/
+ %{<hr /><br /><center>
+ <a href="#{can.previous}">
+ <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
+ </a>
+ pg. #{page.to_s}
+ <a href="#{can.next}">
+ <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
+ </a>
+ </center>}
+ else
%{<hr /><br /><center>
<a href="#{can.start}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="|&lt;&nbsp;" />
+ <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|&lt;&nbsp;" />
</a>
<a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
+ <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
</a>
pg. #{page.to_s}
<a href="#{can.next}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
+ <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt="&nbsp;&gt;&gt;" />
+ </a>
+ </center>}
+ end
+ else
+ if page.to_s =~ /^1$/; ''
+ elsif /^[2]$/
+ %{<hr /><br /><center>
+ <a href="#{can.previous}">
+ <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
</a>
+ pg. #{page.to_s}
</center>}
else
%{<hr /><br /><center>
<a href="#{can.start}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="|&lt;&nbsp;" />
+ <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|&lt;&nbsp;" />
</a>
<a href="#{can.previous}">
- <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
+ <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="&lt;&lt;&nbsp;" />
</a>
pg. #{page.to_s}
</center>}
@@ -932,9 +940,9 @@ module SiSU_CGI_sql
limit=dbi_statement.sql_limit.to_s
@@lt_t ||=false; @@lt_e ||=false
canned=if (@@lt_t or @@lt_e)
- dbi_statement.sql_canned_search_url(true,@image_src).to_s
+ dbi_statement.pre_next(true,@image_src).to_s
else
- dbi_statement.sql_canned_search_url(false,@image_src).to_s
+ dbi_statement.pre_next(false,@image_src).to_s
end
limit=dbi_statement.sql_limit.to_s
cgi.out{@header + @counters_txt + @counters_endn + @body_main.join + @endnotes.join + canned + @tail} #% print cgi_output_header+counters+body+endnotes