diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/cgi_sql_common.rb | 66 |
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=" >>" /> - </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="<< " /> - </a> - pg. #{page.to_s} - <a href="#{can.next}"> - <img border="0" width="22" height="22" src="#@image_src/arrow_next_red.png" alt=" >>" /> - </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=" >>" /> + </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="<< " /> + </a> + pg. #{page.to_s} + <a href="#{can.next}"> + <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" /> + </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="|< " /> + <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " /> </a> <a href="#{can.previous}"> - <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="<< " /> + <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> </a> pg. #{page.to_s} <a href="#{can.next}"> - <img border="0" width="22" height="22" src="#@image_src/arrow_next_red.png" alt=" >>" /> + <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" /> + </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="<< " /> </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="|< " /> + <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " /> </a> <a href="#{can.previous}"> - <img border="0" width="22" height="22" src="#@image_src/arrow_prev_red.png" alt="<< " /> + <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> </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 |