From a2b5cfb3cfb30f0c9332120e041fddacd3cb8931 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sun, 2 Nov 2014 20:30:49 +0100 Subject: [PATCH] added reverse button to tables, by default on now (to see latest entries first) --- htroot/Tables_p.html | 26 ++++++++++---------------- htroot/Tables_p.java | 7 +++++-- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/htroot/Tables_p.html b/htroot/Tables_p.html index efbeb3530..ea3bf8ae3 100644 --- a/htroot/Tables_p.html +++ b/htroot/Tables_p.html @@ -43,30 +43,24 @@ document.write("
Table Selection
-
Select Table: - #{tables}# #{/tables}# -
-
 
-
- show max. - - - entries, -
-
 
-
- search rows for - -
-
+ entries, +
reverse:
+
+
search rows for
+
diff --git a/htroot/Tables_p.java b/htroot/Tables_p.java index 4cf3025fe..6673f03ea 100644 --- a/htroot/Tables_p.java +++ b/htroot/Tables_p.java @@ -41,7 +41,7 @@ public class Tables_p { final serverObjects prop = new serverObjects(); final String ext = header.get("EXT", ""); - final boolean json = ext.equals("json"); + //final boolean json = ext.equals("json"); final boolean xml = ext.equals("xml"); prop.put("showtable", 0); @@ -64,11 +64,14 @@ public class Tables_p { } prop.put("showselection_tables", count); prop.put("showselection_pattern", ""); + prop.put("showselection_reverse", 1); if (post == null) return prop; // return rewrite properties final String counts = post.get("count", null); int maxcount = (counts == null || counts.equals("all")) ? Integer.MAX_VALUE : post.getInt("count", 10); + final boolean reverse = post.containsKey("reverse") ? post.getBoolean("reverse") : false; + prop.put("showselection_reverse", reverse ? 1 : 0); final String pattern = post.get("search", ""); final Pattern matcher = (pattern.isEmpty() || pattern.equals(".*")) ? null : Pattern.compile(".*" + pattern + ".*"); prop.put("pattern", pattern); @@ -164,7 +167,7 @@ public class Tables_p { count = 0; try { final Iterator plainIterator = sb.tables.iterator(table, matcher); - final Iterator mapIterator = Tables.orderByPK(plainIterator, maxcount, false).iterator(); + final Iterator mapIterator = Tables.orderByPK(plainIterator, maxcount, reverse).iterator(); Tables.Row row; boolean dark = true; byte[] cell;