put list quick navigator buttons belowon BlackList_p editor

replacing the dropdown -> go navigation
pull/1/head
reger 11 years ago
parent 6ada0daae9
commit 9a96a7d73f

@ -127,11 +127,11 @@
<input type="hidden" name="currentBlacklist" value="#[currentBlacklist]#" />
<input type="hidden" name="action" value="selectRange" />
<p>Show entries:
<select name="offset" size="1" onchange="document.selectRange.submit();">
<table><tr>
#{subListOffset}#
<option value="#[value]#" #(selected)#::selected="selected"#(/selected)#>#[fvalue]# - #[tvalue]#</option>
<td style="padding: 5px;"><button type="submit" name="offset" style="padding:3px" value="#[fvalue]#" #(selected)#:: disabled="true"#(/selected)# />#[fvalue]# - #[tvalue]#</button></td>
#{/subListOffset}#
</select>
</tr></table>
&nbsp;
Entries per page:
<select name="size" size="1" onchange="document.selectRange.submit();">
@ -140,7 +140,7 @@
#{/subListSize}#
</select>
&nbsp;
<input type="submit" value="Go" />
<input type="submit" value="set" />
</p>
</fieldset></form>

@ -373,33 +373,49 @@ public class Blacklist_p {
prop.put(DISABLED + EDIT + "Itemlist", entryCount);
// create selection of sublist
entryCount = 0;
int end = -1;
int start = -1;
if (sortedlist.length > 0) {
while (end < sortedlist.length) {
if (size > 0) {
start = entryCount * size;
end = (entryCount + 1) * size;
} else {
int[] navbar = new int[7];
// generate array of start index for navbar ( -1 = early endmark)
// [0] [-2*size] [-1*size] [offset] [+1*size] [+2*size] [end]
if (size > 0 && sortedlist.length > 0) {
int start = offset - 3 * size; // start item (max 3 buttons to the left)
if (start < 0) {
start = 0;
end = sortedlist.length;
}
prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_value", start);
prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_fvalue", start + 1);
for (entryCount = 0; entryCount < 7; entryCount++) {
if (start > sortedlist.length) {
navbar[entryCount] = -1; // terminate display mark
} else {
navbar[entryCount] = start;
}
start += size;
}
navbar[0] = 0; // first button: always go back to start
if (navbar[6] < sortedlist.length - size) { // last button: alway eof list
navbar[6] = (sortedlist.length / size) * size;
}
} else {
navbar[0] = 0;
navbar[1] = -1; // display terminate mark
}
// output the navarray values
entryCount = 0;
if (sortedlist.length > size && size > 0) {
while (entryCount < 7 && navbar[entryCount] >= 0) {
prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_fvalue", navbar[entryCount]);
int end = navbar[entryCount] + size - 1;
if (end > sortedlist.length) {
end = sortedlist.length;
}
prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_tvalue", end);
if (start == offset) {
if (navbar[entryCount] == offset) {
prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_selected", 1);
}
entryCount++;
}
} else {
prop.put(DISABLED + EDIT + "subListOffset_0_value", 0);
prop.put(DISABLED + EDIT + "subListOffset_0_fvalue", 0);
prop.put(DISABLED + EDIT + "subListOffset_0_tvalue", 0);
prop.put(DISABLED + EDIT + "subListOffset_0_fvalue", 1);
prop.put(DISABLED + EDIT + "subListOffset_0_tvalue", sortedlist.length);
prop.put(DISABLED + EDIT + "subListOffset_" + entryCount + "_selected", 1);
entryCount++;
}
prop.put(DISABLED + EDIT + "subListOffset", entryCount);

Loading…
Cancel
Save