]> git.decadent.org.uk Git - maypole.git/blobdiff - templates/factory/pager
Templates should be valid XHTML now...
[maypole.git] / templates / factory / pager
index 0eaa0cb58a89dd8ee1a2e292e4207da18e2b5c97..c10fdeed685a8f4025bc005dcb94b18e87a2e313 100644 (file)
@@ -10,18 +10,32 @@ to the L<Data::Page> interface.
 [%
 IF pager AND pager.first_page != pager.last_page;
 %]
-
-<P ALIGN="center">Pages: 
+<p align=center>Pages: 
 [%
-     FOREACH num = [pager.first_page .. pager.last_page];
+    SET begin_page = pager.current_page - 10;
+    IF begin_page < 1;
+        SET begin_page = pager.first_page;
+    END;
+    SET end_page = pager.current_page + 10;
+    IF pager.last_page < end_page;
+        SET end_page = pager.last_page;
+    END;
+     FOREACH num = [begin_page .. end_page];
           IF num == pager.current_page;
             "["; num; "] ";
           ELSE;
-            SET args = "?page=" _ num; # Order?
             SET label = "[" _ num _ "]";
-          link(classmetadata.table, "list", args, label);
+            SET args = "?page=" _ num;
+            SET action = "list";
+            FOR col = classmetadata.columns.list;
+              IF request.query.$col;
+                SET args = args _ "&" _ col _ "=" _ request.query.$col;
+                SET action = "search";
+              END;
+            END;
+            link(classmetadata.table, action, args, label);
           END;
      END;
 %]
-</P>
+</p>
 [% END %]