mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
added reverse button to tables, by default on now (to see latest entries
first)
This commit is contained in:
parent
fceac5d2d4
commit
a2b5cfb3cf
|
@ -43,30 +43,24 @@ document.write("<div id=\"api\"><a href=\"/Tables_p.xml" + window.location.searc
|
||||||
<form action="Tables_p.html" method="get" accept-charset="UTF-8">
|
<form action="Tables_p.html" method="get" accept-charset="UTF-8">
|
||||||
<fieldset><legend>Table Selection</legend>
|
<fieldset><legend>Table Selection</legend>
|
||||||
<dl>
|
<dl>
|
||||||
<dt class="TableCellDark">Select Table:
|
<dt class="TableCellDark">Select Table:</dt>
|
||||||
<select name="table" onchange='this.form.submit()'>
|
<dd><select name="table" onchange='this.form.submit()'>
|
||||||
#{tables}#
|
#{tables}#
|
||||||
<option value="#[name]#" #(selected)#::selected="selected"#(/selected)#>#[name]#</option>
|
<option value="#[name]#" #(selected)#::selected="selected"#(/selected)#>#[name]#</option>
|
||||||
#{/tables}#
|
#{/tables}#
|
||||||
</select>
|
</select>
|
||||||
</dt>
|
</dd>
|
||||||
<dd> </dd>
|
<dt>show max. </dt>
|
||||||
<dt>
|
<dd><select name="count" onchange='this.form.submit()'>
|
||||||
show max.
|
|
||||||
<select name="count" onchange='this.form.submit()'>
|
|
||||||
<option value="10">10</option>
|
<option value="10">10</option>
|
||||||
<option value="100" selected="selected">100</option>
|
<option value="100" selected="selected">100</option>
|
||||||
<option value="1000">1000</option>
|
<option value="1000">1000</option>
|
||||||
<option value="all">all</option>
|
<option value="all">all</option>
|
||||||
</select>
|
</select>entries,</dd>
|
||||||
entries,
|
<dt>reverse:</dt>
|
||||||
</dt>
|
<dd><input type="checkbox" name="reverse" #(reverse)#::checked="check"#(/reverse)# onchange='this.form.submit()'</dd>
|
||||||
<dd> </dd>
|
<dt>search rows for</dt>
|
||||||
<dt>
|
<dd><input type="text" name="search" value="#[pattern]#" /><input type="submit" name="edittable" value="Search" /></dd>
|
||||||
search rows for
|
|
||||||
<input type="text" name="search" value="#[pattern]#" />
|
|
||||||
</dt>
|
|
||||||
<dd><input type="submit" name="edittable" value="Search" /></dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class Tables_p {
|
||||||
final serverObjects prop = new serverObjects();
|
final serverObjects prop = new serverObjects();
|
||||||
|
|
||||||
final String ext = header.get("EXT", "");
|
final String ext = header.get("EXT", "");
|
||||||
final boolean json = ext.equals("json");
|
//final boolean json = ext.equals("json");
|
||||||
final boolean xml = ext.equals("xml");
|
final boolean xml = ext.equals("xml");
|
||||||
|
|
||||||
prop.put("showtable", 0);
|
prop.put("showtable", 0);
|
||||||
|
@ -64,11 +64,14 @@ public class Tables_p {
|
||||||
}
|
}
|
||||||
prop.put("showselection_tables", count);
|
prop.put("showselection_tables", count);
|
||||||
prop.put("showselection_pattern", "");
|
prop.put("showselection_pattern", "");
|
||||||
|
prop.put("showselection_reverse", 1);
|
||||||
|
|
||||||
if (post == null) return prop; // return rewrite properties
|
if (post == null) return prop; // return rewrite properties
|
||||||
|
|
||||||
final String counts = post.get("count", null);
|
final String counts = post.get("count", null);
|
||||||
int maxcount = (counts == null || counts.equals("all")) ? Integer.MAX_VALUE : post.getInt("count", 10);
|
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 String pattern = post.get("search", "");
|
||||||
final Pattern matcher = (pattern.isEmpty() || pattern.equals(".*")) ? null : Pattern.compile(".*" + pattern + ".*");
|
final Pattern matcher = (pattern.isEmpty() || pattern.equals(".*")) ? null : Pattern.compile(".*" + pattern + ".*");
|
||||||
prop.put("pattern", pattern);
|
prop.put("pattern", pattern);
|
||||||
|
@ -164,7 +167,7 @@ public class Tables_p {
|
||||||
count = 0;
|
count = 0;
|
||||||
try {
|
try {
|
||||||
final Iterator<Tables.Row> plainIterator = sb.tables.iterator(table, matcher);
|
final Iterator<Tables.Row> plainIterator = sb.tables.iterator(table, matcher);
|
||||||
final Iterator<Tables.Row> mapIterator = Tables.orderByPK(plainIterator, maxcount, false).iterator();
|
final Iterator<Tables.Row> mapIterator = Tables.orderByPK(plainIterator, maxcount, reverse).iterator();
|
||||||
Tables.Row row;
|
Tables.Row row;
|
||||||
boolean dark = true;
|
boolean dark = true;
|
||||||
byte[] cell;
|
byte[] cell;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user