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="currentBlacklist" value="#[currentBlacklist]#" />
<input type="hidden" name="action" value="selectRange" /> <input type="hidden" name="action" value="selectRange" />
<p>Show entries: <p>Show entries:
<select name="offset" size="1" onchange="document.selectRange.submit();"> <table><tr>
#{subListOffset}# #{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}# #{/subListOffset}#
</select> </tr></table>
&nbsp; &nbsp;
Entries per page: Entries per page:
<select name="size" size="1" onchange="document.selectRange.submit();"> <select name="size" size="1" onchange="document.selectRange.submit();">
@ -140,7 +140,7 @@
#{/subListSize}# #{/subListSize}#
</select> </select>
&nbsp; &nbsp;
<input type="submit" value="Go" /> <input type="submit" value="set" />
</p> </p>
</fieldset></form> </fieldset></form>

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

Loading…
Cancel
Save