fix nested paging. all seems well at last. tpac-holdings-tree
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 7 Mar 2012 21:53:40 +0000 (16:53 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 7 Mar 2012 21:57:12 +0000 (16:57 -0500)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/opac/parts/record/issues-db.tt2
Open-ILS/web/css/skin/default/opac/style.css

index a110b56..6e9179c 100644 (file)
@@ -1,6 +1,10 @@
 [%-
 expand_path = CGI.param('sepath') || [];
+expand_path = expand_path.list; # sic
+
 seoffset_list = CGI.param('seoffset') || [];
+seoffset_list = seoffset_list.list; # sic
+
 IF expand_path.size == 0 AND seoffset_list.size == 0;
     seoffset_list = [0,0]; # compensate for $auto_expand_first; see ML
 END;
@@ -12,8 +16,8 @@ ght_depth = 0;
 VIEW grouped_holding_tree;
     BLOCK list;
         '<div class="rdetail-holding-group">';
-        prev_seoffset_list = seoffset_list.slice(0, ght_depth + 1);
-        next_seoffset_list = seoffset_list.slice(0, ght_depth + 1);
+        prev_seoffset_list = seoffset_list.slice(0, ght_depth);
+        next_seoffset_list = seoffset_list.slice(0, ght_depth);
 
         prev_seoffset_list.$ght_depth = prev_seoffset_list.$ght_depth - selimit;
         IF prev_seoffset_list.$ght_depth < 0;
@@ -34,13 +38,11 @@ VIEW grouped_holding_tree;
 
                 IF node.value;
                     ght_sepath.push(node.value);
-                    all_balls = [];
-                    FOREACH i IN [-1 .. ght_depth];     # aka [0 .. ght_depth+1]
-                        all_balls.push(0);
-                    END;
+                    new_seoffsets = seoffset_list.slice(0, ght_depth);
+                    new_seoffsets.push(0);
 
                     expand_link = mkurl(
-                        '', {'sepath' => ght_sepath, 'seoffset' => all_balls},
+                        '', {'sepath' => ght_sepath, 'seoffset' => new_seoffsets},
                         0, 'issues'
                     );
 
@@ -54,7 +56,7 @@ VIEW grouped_holding_tree;
                     collapse_link = mkurl(
                         '', {
                             'sepath' => collapse_sepath,
-                            'seoffset' => all_balls.slice(0, -2)
+                            'seoffset' => new_seoffsets.slice(0, -2)
                         }, collapse_clear_params, 'issues'
                     );
 
@@ -81,15 +83,25 @@ VIEW grouped_holding_tree;
                     # XXX Hold placement link here? Maybe not if no units.
                 END;
             END;
-            IF seoffset_list.$ght_depth > 0;
-                '<a href="';
-                mkurl('', {seoffset => prev_seoffset_list}, 0, 'issues');
-                '">'; l('Previous'); '</a>';
+
+            to_clear = 0;
+            new_sepath_end = ght_depth - 1;
+            IF new_sepath_end < 0;
+                to_clear = ['sepath'];
+                new_sepath = [];
+            ELSE;
+                new_sepath = expand_path.slice(0, ght_depth - 1);
             END;
+
             IF has_more;
-                '<a href="';
-                mkurl('', {seoffset => next_seoffset_list}, 0, 'issues');
-                '">'; l('Next'); '</a>';
+                '<a class="paging" href="';
+                    mkurl('',{seoffset => next_seoffset_list, sepath => new_sepath},to_clear,'issues');
+                '">&laquo; '; l('Earlier holdings'); '</a>';
+            END;
+            IF seoffset_list.$ght_depth > 0;
+                '<a class="paging" href="';
+                    mkurl('',{seoffset => prev_seoffset_list, sepath => new_sepath},to_clear,'issues');
+                '">'; l('Later holdings'); ' &raquo;</a>&nbsp; ';
             END;
             '</div>';
         END;
index 4223e3c..51968e8 100644 (file)
@@ -1408,3 +1408,4 @@ table.result_holdings_table thead tr th {
 }
 .rdetail-holding-group { margin-left: 1.5em; }
 .rdetail-holding-group span { margin-left: 1.5em; }
+.rdetail-holding-group .paging { margin-left: 1.5em; }