allow to enter page number in list view (#114)
This commit is contained in:
parent
7ad3ff978f
commit
8561e62fde
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
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
|
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
|
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 . "\">" .
|
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-first.png\"></a>\n");
|
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-first.png\"></a>\n");
|
||||||
}
|
}
|
||||||
if ($this->page > 10) {
|
if ($this->page > 11) {
|
||||||
echo("<a title=\"" . _('Jump 10 pages backward') . "\" href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ($this->page - 10) .
|
echo("<a title=\"" . _('Jump 10 pages backward') . "\" href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ($this->page - 10) .
|
||||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-previous.png\"></a>\n");
|
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-previous.png\"></a>\n");
|
||||||
}
|
}
|
||||||
|
$pageCount = ceil($count / $this->maxPageEntries);
|
||||||
for ($i = $this->page - 6; $i < ($this->page + 5); $i++) {
|
for ($i = $this->page - 6; $i < ($this->page + 5); $i++) {
|
||||||
if ($i >= ($count / $this->maxPageEntries)) {
|
if ($i >= $pageCount) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
elseif ($i < 0) {
|
elseif ($i < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($i == $this->page - 1) {
|
if ($i == $this->page - 1) {
|
||||||
echo ' ' . ($i + 1) . ' ';
|
$url = "list.php?type=" . $this->type . "&norefresh=true" .
|
||||||
|
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter;
|
||||||
|
echo '<input type="number" class="listPageInput" id="listNavPage" name="listNavPage"'
|
||||||
|
. ' value="' . ($i + 1) . '" min="1" max="' . $pageCount . '"'
|
||||||
|
. ' onkeypress="listPageNumberKeyPress(\'' . $url . '\', event);">';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo " <a href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ($i + 1) .
|
echo " <a href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ($i + 1) .
|
||||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . ($i + 1) . "</a>\n";
|
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . ($i + 1) . "</a>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->page < (($count / $this->maxPageEntries) - 10)) {
|
if ($this->page < ($pageCount - 10)) {
|
||||||
echo("<a title=\"" . _('Jump 10 pages forward') . "\" href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ($this->page + 10) .
|
echo("<a title=\"" . _('Jump 10 pages forward') . "\" href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ($this->page + 10) .
|
||||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-next.png\"></a>\n");
|
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-next.png\"></a>\n");
|
||||||
}
|
}
|
||||||
if ($this->page < ($count / $this->maxPageEntries)) {
|
if ($this->page < $pageCount) {
|
||||||
echo("<a title=\"" . _('Jump to last page') . "\" href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . ceil(($count / $this->maxPageEntries)) .
|
echo("<a title=\"" . _('Jump to last page') . "\" href=\"list.php?type=" . $this->type . "&norefresh=true&page=" . $pageCount .
|
||||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-last.png\"></a>\n");
|
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-last.png\"></a>\n");
|
||||||
}
|
}
|
||||||
|
@ -887,7 +892,7 @@ class lamList {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
// get current page
|
// get current page
|
||||||
if (isset($_GET["page"])) $this->page = $_GET["page"];
|
if (!empty($_GET["page"])) $this->page = $_GET["page"];
|
||||||
else $this->page = 1;
|
else $this->page = 1;
|
||||||
// generate attribute-description table
|
// generate attribute-description table
|
||||||
$temp_array = $this->listGetAttributeDescriptionList();
|
$temp_array = $this->listGetAttributeDescriptionList();
|
||||||
|
|
|
@ -95,9 +95,9 @@ legend {
|
||||||
color:black;
|
color:black;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* color for active page digit */
|
input.listPageInput {
|
||||||
td.activepage {
|
width: 3em;
|
||||||
color:red;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
|
@ -46,6 +46,24 @@ function listOUchanged(type, element) {
|
||||||
location.href='list.php?type=' + type + '&suffix=' + element.options[element.selectedIndex].value;
|
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.
|
* 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.
|
* This prevents that the whole page is scrolled in the browser. Only the account table has scroll bars.
|
||||||
|
|
Loading…
Reference in New Issue