Pagination controls truncated for events with lots of attributes

pull/304/merge
iglocska 2014-09-01 10:03:46 +02:00
parent 1d9881b2db
commit ae059c2f5a
2 changed files with 69 additions and 5 deletions

View File

@ -14,7 +14,7 @@
}
?>
<div class="pagination">
<ul style="margin-right:20px;">
<ul>
<?php if ($page == 1) : ?>
<li class="prev"><span>« previous</span></li>
<?php else: ?>
@ -27,7 +27,7 @@
<?php
else:
?>
<li><span id = "apageCurrent"><?php echo $i; ?></span></li>
<li><span id = "apageCurrent" class = "red bold"><?php echo $i; ?></span></li>
<?php
endif;
endfor;
@ -37,7 +37,7 @@
<li class="next"><a href="" id = "anext">next »</a></li>
<?php endif;
if ($page == 'all'): ?>
<li class="all"><span>View All</span></li>
<li class="all red bold"><span>View All</span></li>
<?php else: ?>
<li class="all"><a href="" id = "aall">View All</a></li>
<?php endif; ?>
@ -111,7 +111,7 @@
<?php
else:
?>
<li><span id = "bpageCurrent"><?php echo $i; ?></span></li>
<li><span id = "bpageCurrent" class = "red bold"><?php echo $i; ?></span></li>
<?php
endif;
endfor;
@ -121,7 +121,7 @@
<li class="next"><a href="" id = "bnext">next »</a></li>
<?php endif;
if ($page == 'all'): ?>
<li class="all"><span>View All</span></li>
<li class="all red bold"><span>View All</span></li>
<?php else: ?>
<li class="all"><a href="" id = "ball">View All</a></li>
<?php endif; ?>
@ -185,12 +185,16 @@
endif;
?>
<script type="text/javascript">
var all = 1;
var page = <?php echo $page; ?>;
var count = <?php echo $pageCount; ?>;
$(document).ready(function(){
$('input:checkbox').removeAttr('checked');
$('.mass-select').hide();
$('input[type="checkbox"]').click(function(){
attributeListAnyCheckBoxesChecked();
});
if (<?php echo $pageCount; ?> > 10) restrictEventViewPagination();
});
</script>
<?php

View File

@ -1116,3 +1116,63 @@ function indexFilterClearRow(field) {
indexSetTableVisibility();
indexEvaluateFiltering();
}
function restrictEventViewPagination() {
var showPages = new Array();
var start;
var end;
var i;
if (page < 6) {
start = 1;
if (count - page < 6) {
end = count;
} else {
end = page + (9 - (page - start));
}
} else if (count - page < 6) {
end = count;
start = count - 10;
} else {
start = page-5;
end = page+5;
}
if (start > 2) {
$("#apage" + start).parent().before("<li><a href id='aExpandLeft'>...</a></li>");
$("#aExpandLeft").click(function() {expandPagination(0, 0); return false;});
$("#bpage" + start).parent().before("<li><a href id='bExpandLeft'>...</a></li>");
$("#bExpandLeft").click(function() {expandPagination(1, 0); return false;})
}
if (end < (count - 1)) {
$("#apage" + end).parent().after("<li><a href id='aExpandRight'>...</a></li>");
$("#aExpandRight").click(function() {expandPagination(0, 1); return false;});
$("#bpage" + end).parent().after("<li><a href id='bExpandRight'>...</a></li>");
$("#bExpandRight").click(function() {expandPagination(1, 1); return false;})
}
for (i = 1; i < (count+1); i++) {
if (i != 1 && i != count && (i < start || i > end)) {
$("#apage" + i).hide();
$("#bpage" + i).hide();
}
}
}
function expandPagination(bottom, right) {
var i;
var prefix = "a";
if (bottom == 1) prefix = "b";
var start = 1;
var end = page;
if (right == 1) {
start = page;
end = count;
$("#" + prefix + "ExpandRight").remove();
} else $("#" + prefix + "ExpandLeft").remove();
for (i = start; i < end; i++) {
$("#" + prefix + "page" + i).show();
}
}