From ec5fcebd7fcd99a05cbeaf37cdcfce53bfd5ea02 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 26 Oct 2018 20:13:13 +0200 Subject: [PATCH] responsive navigation --- lam/lib/lists.inc | 71 ++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index 2bb8d29b..01088254 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -312,23 +312,27 @@ class lamList { */ protected function listDrawNavigationBar($count) { $filter = $this->getFilterAsTextForURL(); - echo("\n"); - echo("\n"); - echo(""); - + $row = new htmlResponsiveRow(); + $row->setCSSClasses(array('maxrow')); + $countLabel = new htmlOutputText(sprintf($this->labels['nav'], $count)); + $row->add($countLabel, 12, 6, 6); + $navGroup = new htmlGroup(); if ($count > $this->maxPageEntries) { - echo(""; } - echo "
"); - printf($this->labels['nav'], $count); - echo(""); if ($this->page != 1) { - echo("type->getId() . "&norefresh=true&page=1" . - "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . - "\"\"\n"); + $linkHref = "list.php?type=" . $this->type->getId() . "&norefresh=true&page=1" . + "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; + $link = new htmlLink(null, $linkHref, '../../graphics/go-first.png'); + $link->setTitle(_('Jump to first page')); + $link->setCSSClasses(array('margin5')); + $navGroup->addElement($link); } if ($this->page > 11) { - echo("type->getId() . "&norefresh=true&page=" . ($this->page - 10) . - "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . - "\"\"\n"); + $linkHref = "list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . ($this->page - 10) . + "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; + $link = new htmlLink(null, $linkHref, '../../graphics/go-previous.png'); + $link->setTitle(_('Jump 10 pages backward')); + $link->setCSSClasses(array('margin5')); + $navGroup->addElement($link); } $pageCount = ceil($count / $this->maxPageEntries); for ($i = $this->page - 6; $i < ($this->page + 5); $i++) { @@ -339,30 +343,41 @@ class lamList { continue; } if ($i == $this->page - 1) { - $url = "list.php?type=" . $this->type->getId() . "&norefresh=true" . - "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; - echo ''; + $url = "list.php?type=" . $this->type->getId() . "&norefresh=true" . + "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; + $navInput = new htmlInputField('listNavPage', ($i + 1)); + $navInput->setMinimumAndMaximumNumber(1, $pageCount); + $navInput->setCSSClasses(array('listPageInput')); + $navInput->setOnKeyPress('listPageNumberKeyPress(\'' . $url . '\', event);'); + $navGroup->addElement($navInput); } else { - echo " type->getId() . "&norefresh=true&page=" . ($i + 1) . - "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . ($i + 1) . "\n"; + $linkHref = "list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . ($i + 1) . + "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; + $link = new htmlLink(($i + 1), $linkHref); + $link->setCSSClasses(array('margin5')); + $navGroup->addElement($link); } } if ($this->page < ($pageCount - 10)) { - echo("type->getId() . "&norefresh=true&page=" . ($this->page + 10) . - "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . - "\"\"\n"); + $linkHref = "list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . ($this->page + 10) . + "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; + $link = new htmlLink(null, $linkHref, '../../graphics/go-next.png'); + $link->setTitle(_('Jump 10 pages forward')); + $link->setCSSClasses(array('margin5')); + $navGroup->addElement($link); } if ($this->page < $pageCount) { - echo("type->getId() . "&norefresh=true&page=" . $pageCount . - "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . - "\"\"\n"); + $linkHref = "list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . $pageCount . + "&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter; + $link = new htmlLink(null, $linkHref, '../../graphics/go-last.png'); + $link->setTitle(_('Jump to last page')); + $link->setCSSClasses(array('margin5')); + $navGroup->addElement($link); } - echo "
\n"; + $row->add($navGroup, 12, 6, 6, 'responsiveLabel'); + parseHtml(null, $row, array(), false, $this->tabindex, $this->type->getScope()); } /**