Index: openacs-4/packages/acs-templating/tcl/paginator-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/paginator-procs.tcl,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/acs-templating/tcl/paginator-procs.tcl 27 Nov 2012 10:28:39 -0000 1.19
+++ openacs-4/packages/acs-templating/tcl/paginator-procs.tcl 27 Oct 2014 16:40:11 -0000 1.20
@@ -35,7 +35,7 @@
@see template::paginator::get_row_last
@see template::paginator::reset
} {
- eval paginator::$command $args
+ paginator::$command {*}$args
}
ad_proc -public template::paginator::create { statement_name name query args } {
@@ -110,26 +110,31 @@
# recommended. Unfortunately, several places in OpenACS have this
# problem.
#
- if { ($row_ids eq {} && ![::cache exists $cache_key]) || ([info exists opts(flush_p)] && $opts(flush_p) eq "t") } {
+ if { ($row_ids eq {} && ![::cache exists $cache_key]) || ([info exists opts(flush_p)] && $opts(flush_p) == "t") } {
if { [info exists opts(printing_prefs)] && $opts(printing_prefs) ne "" } {
- ReturnHeaders "text/html"
- ns_write "
-
-
"
set title [lindex $opts(printing_prefs) 0]
- ns_write "$title
- "
set stylesheet [lindex $opts(printing_prefs) 1]
if { $stylesheet ne "" } {
- ns_write ""
+ set css_link ""
+ } else {
+ set css_link ""
}
- ns_write ""
- ns_write ""
+
+ ad_return_top_of_page [subst {
+
+
+$title
+
+$css_link
+
+
+ }]
set header_file [lindex $opts(printing_prefs) 3]
if { $header_file ne "" } {
ns_write [ns_adp_parse -file $header_file]
@@ -157,7 +162,6 @@
Click here to Continue
"
}
- ns_write [ad_footer]
ad_script_abort
} else {
init $statement_name $name $query
@@ -224,12 +228,13 @@
set i 0
set page_size $properties(pagesize)
set context_ids [list]
-
+ set row_ids ""
+
foreach row $ids {
lappend row_ids [lindex $row 0]
- if { [expr {$i % $page_size}] == 0 } {
+ if { $i % $page_size == 0 } {
lappend context_ids [lindex $row 1]
}
incr i
@@ -238,11 +243,6 @@
set properties(context_ids) $context_ids
cache set $name:$query:context_ids $context_ids $properties(timeout)
-
- if { [template::util::is_nil row_ids] } {
- set row_ids ""
- }
-
set properties(row_ids) $row_ids
cache set $name:$query:row_ids $row_ids $properties(timeout)
@@ -509,7 +509,7 @@
set row(rownum) $rowcount
set row(page) $page
- set row(context) [lindex $context_ids [expr {$page - 1}]]
+ set row(context) [lindex $context_ids $page-1]
}
}
@@ -663,8 +663,8 @@
# If the paginator is contextual, set the context
if { [info exists properties(context_ids)] } {
foreach elm { next_page previous_page next_group previous_group } {
- if { [exists_and_not_null info($elm)] } {
- set info(${elm}_context) [lindex $properties(context_ids) [expr {$info($elm) -1}]]
+ if { ([info exists info($elm)] && $info($elm) ne "") } {
+ set info(${elm}_context) [lindex $properties(context_ids) $info($elm)-1]
}
}
}