diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc
index ac5002e8..621392dd 100644
--- a/lam/lib/lists.inc
+++ b/lam/lib/lists.inc
@@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
- Copyright (C) 2003 - 2013 Roland Gruber
+ Copyright (C) 2003 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -293,33 +293,38 @@ class lamList {
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
"\n");
}
- if ($this->page > 10) {
+ if ($this->page > 11) {
echo("type . "&norefresh=true&page=" . ($this->page - 10) .
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
"\n");
}
+ $pageCount = ceil($count / $this->maxPageEntries);
for ($i = $this->page - 6; $i < ($this->page + 5); $i++) {
- if ($i >= ($count / $this->maxPageEntries)) {
+ if ($i >= $pageCount) {
break;
}
elseif ($i < 0) {
continue;
}
if ($i == $this->page - 1) {
- echo ' ' . ($i + 1) . ' ';
+ $url = "list.php?type=" . $this->type . "&norefresh=true" .
+ "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter;
+ echo '';
}
else {
echo " type . "&norefresh=true&page=" . ($i + 1) .
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . ($i + 1) . "\n";
}
}
- if ($this->page < (($count / $this->maxPageEntries) - 10)) {
+ if ($this->page < ($pageCount - 10)) {
echo("type . "&norefresh=true&page=" . ($this->page + 10) .
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
"\n");
}
- if ($this->page < ($count / $this->maxPageEntries)) {
- echo("type . "&norefresh=true&page=" . ceil(($count / $this->maxPageEntries)) .
+ if ($this->page < $pageCount) {
+ echo("type . "&norefresh=true&page=" . $pageCount .
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
"\n");
}
@@ -887,7 +892,7 @@ class lamList {
exit();
}
// get current page
- if (isset($_GET["page"])) $this->page = $_GET["page"];
+ if (!empty($_GET["page"])) $this->page = $_GET["page"];
else $this->page = 1;
// generate attribute-description table
$temp_array = $this->listGetAttributeDescriptionList();
diff --git a/lam/style/500_layout.css b/lam/style/500_layout.css
index 1a0f4846..8bc168f2 100644
--- a/lam/style/500_layout.css
+++ b/lam/style/500_layout.css
@@ -95,9 +95,9 @@ legend {
color:black;
}
-/* color for active page digit */
-td.activepage {
- color:red;
+input.listPageInput {
+ width: 3em;
+ text-align: center;
}
select {
diff --git a/lam/templates/lib/500_lam.js b/lam/templates/lib/500_lam.js
index 5fd8b2a9..0dee7223 100644
--- a/lam/templates/lib/500_lam.js
+++ b/lam/templates/lib/500_lam.js
@@ -46,6 +46,24 @@ function listOUchanged(type, element) {
location.href='list.php?type=' + type + '&suffix=' + element.options[element.selectedIndex].value;
}
+/**
+ * The user pressed a key in the page number box. On enter this will reload the list view with the new page.
+ *
+ * @param url target URL
+ * @param e event
+ */
+function listPageNumberKeyPress(url, e) {
+ var pageNumber = jQuery('#listNavPage').val();
+ if (e.keyCode == 13) {
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ location.href = url + '&page=' + pageNumber;
+ return false;
+ }
+ return true;
+}
+
/**
* Resizes the content area of the account lists to fit the window size.
* This prevents that the whole page is scrolled in the browser. Only the account table has scroll bars.