diff --git a/api/domains.php b/api/domains.php index 15c8601..1b47ee7 100644 --- a/api/domains.php +++ b/api/domains.php @@ -75,8 +75,8 @@ if(isset($input->action) && $input->action == "getDomains") { // Initialize the return value $retval = Array(); - $retval['pages']['current'] = 1; - $retval['pages']['total'] = $obj->anzahl / $config['domain_rows']; + $retval['pages']['current'] = 4000; + $retval['pages']['total'] = ceil($obj->anzahl / $config['domain_rows']); // Now the real search is done on the database diff --git a/domains.php b/domains.php index 0525482..4824a17 100644 --- a/domains.php +++ b/domains.php @@ -83,26 +83,11 @@ limitations under the License. - - + 1) { + $('
  • ').appendTo('#pagination').data("page", data.current - 1).click(paginationClicked); + } + + $('
  • 1
  • ').appendTo('#pagination').data("page", 1).click(paginationClicked); + + if(data.current > 4) { + $('
  • ').appendTo('#pagination'); + } + + for(var i = data.current - 2; i <= data.current + 2; i++) { + if(i > 1 && i < data.total) { + if(data.current === i) { + $('
  • ' + i + '
  • ').appendTo('#pagination'); + } else { + $('
  • ' + i + '
  • ').appendTo('#pagination').data("page", i).click(paginationClicked); + } + } + } + + if(data.current < data.total - 3) { + $('
  • ').appendTo('#pagination'); + } + + $('
  • ' + data.total + '
  • ').appendTo('#pagination').data("page", data.total).click(paginationClicked); + + if(data.current < data.total) { + $('
  • ').appendTo('#pagination').data("page", data.current + 1).click(paginationClicked); + } + + $('#pagination-wrapper').show(); +} + function recreateTable(data) { $('#table-domains>tbody').empty(); - $('#pagination').empty(); $.each(data, function(index,item) { $('').appendTo('#table-domains>tbody') @@ -146,3 +187,7 @@ function deleteDomainWithId(id, callback) { "json" ); } + +function paginationClicked() { + alert($(this).data("page")); +} \ No newline at end of file