From d15cde2507831645fdf198099d43e5a4da4f43fa Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 28 Jan 2019 21:14:49 +0100 Subject: [PATCH] fixed click events on page 2 and later --- lam/lib/lists.inc | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index 918e10ed..91551283 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -4,7 +4,7 @@ use LAM\TYPES\ConfiguredType; /* This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2003 - 2018 Roland Gruber + Copyright (C) 2003 - 2019 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 @@ -505,18 +505,17 @@ class lamList { $table_end = ($this->page * $this->maxPageEntries); } // get sort mapping - $sortMapping = &$this->sortMapping; - if (empty($sortMapping)) { - $sortMapping = array(); + if (empty($this->sortMapping)) { + $this->sortMapping = array(); $infoSize = sizeof($info); for ($i = 0; $i < $infoSize; $i++) { - $sortMapping[$i] = $i; + $this->sortMapping[$i] = $i; } } // print account list for ($i = $table_begin; $i < $table_end; $i++) { $row = array(); - $index = $sortMapping[$i]; + $index = $this->sortMapping[$i]; $rowID = base64_encode($info[$index]['dn']); $actionElement = new htmlGroup(); $checkbox = new htmlInputCheckbox($rowID, false); @@ -524,8 +523,9 @@ class lamList { $checkbox->setCSSClasses(array('accountBoxUnchecked align-middle')); $actionElement->addElement($checkbox); $actionElement->addElement(new htmlSpacer('0.5rem', null)); - $onClickEvents[$i + 2] = "list_click('" . $rowID . "');"; - $onDoubleClickEvents[$i + 2] = "top.location.href='../account/edit.php?type=" . $this->type->getId() . "&DN=" . rawurlencode($info[$index]['dn']) . "';"; + $rowNumber = $i - $table_begin + 2; + $onClickEvents[$rowNumber] = "list_click('" . $rowID . "');"; + $onDoubleClickEvents[$rowNumber] = "top.location.href='../account/edit.php?type=" . $this->type->getId() . "&DN=" . rawurlencode($info[$index]['dn']) . "';"; $this->addToolLinks($info[$index], $rowID, $actionElement); $row[] = new htmlDiv(null, $actionElement, array('nowrap')); foreach ($this->attrArray as $attributeName) { @@ -719,18 +719,16 @@ class lamList { } } // check if back from configuration page - if (sizeof($this->configOptions) > 0) { - if (isset($_POST['saveConfigOptions'])) { - $cookieValue = ''; - for ($i = 0; $i < sizeof($this->configOptions); $i++) { - $this->configOptions[$i]->fillFromPostData(); - $cookieValue .= $this->configOptions[$i]->getID() . "=" . $this->configOptions[$i]->getValue() . ';'; - } - // save options as cookie for one year - setcookie("ListOptions_" . $this->type->getId(), $cookieValue, time()+60*60*24*365, "/", null, null, true); - // notify subclasses - $this->listConfigurationChanged(); + if ((sizeof($this->configOptions) > 0) && isset($_POST['saveConfigOptions'])) { + $cookieValue = ''; + for ($i = 0; $i < sizeof($this->configOptions); $i++) { + $this->configOptions[$i]->fillFromPostData(); + $cookieValue .= $this->configOptions[$i]->getID() . "=" . $this->configOptions[$i]->getValue() . ';'; } + // save options as cookie for one year + setcookie("ListOptions_" . $this->type->getId(), $cookieValue, time()+60*60*24*365, "/", null, null, true); + // notify subclasses + $this->listConfigurationChanged(); } return ''; } @@ -759,11 +757,11 @@ class lamList { echo "
type->getScope() . "-bright\">"; echo "
\n"; - $refresh = '&norefresh=true'; + $refreshParam = '&norefresh=true'; if (isset($_GET['refresh']) && ($_GET['refresh'] == 'true')) { - $refresh = '&refresh=true'; + $refreshParam = '&refresh=true'; } - echo "
type->getId() . $refresh . "\" method=\"post\">\n"; + echo "type->getId() . $refreshParam . "\" method=\"post\">\n"; $container = new htmlResponsiveRow(); $container->add(new htmlSubTitle(_('Create PDF file')), 12);