Merge pull request #55 from LDAPAccountManager/feature/responsiveList
Feature/responsive list
This commit is contained in:
commit
a97e489ba7
Binary file not shown.
After Width: | Height: | Size: 719 B |
Binary file not shown.
After Width: | Height: | Size: 801 B |
Binary file not shown.
After Width: | Height: | Size: 686 B |
Binary file not shown.
After Width: | Height: | Size: 764 B |
|
@ -2040,6 +2040,8 @@ class htmlInputCheckbox extends htmlElement {
|
|||
protected $elementsToEnable = array();
|
||||
/** list of input elements to disable when checked */
|
||||
protected $elementsToDisable = array();
|
||||
/** onclick event code */
|
||||
private $onClick;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -2167,7 +2169,11 @@ class htmlInputCheckbox extends htmlElement {
|
|||
if (!empty($onChange)) {
|
||||
$onChange = ' onChange="' . $onChange . '"';
|
||||
}
|
||||
echo '<input type="checkbox" id="' . $this->name . '" name="' . $this->name . '"' . $classes . $tabindexValue . $onChange . $checked . $disabled . '>';
|
||||
$onClick = '';
|
||||
if (!empty($this->onClick)) {
|
||||
$onClick = ' onclick="' . $this->onClick . '"';
|
||||
}
|
||||
echo '<input type="checkbox" id="' . $this->name . '" name="' . $this->name . '"' . $classes . $tabindexValue . $onChange . $onClick . $checked . $disabled . '>';
|
||||
echo $script;
|
||||
if ($this->transient) {
|
||||
return array();
|
||||
|
@ -2250,6 +2256,15 @@ class htmlInputCheckbox extends htmlElement {
|
|||
return 'tr';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the onclick code.
|
||||
*
|
||||
* @param string $code JS code
|
||||
*/
|
||||
public function setOnClick($code) {
|
||||
$this->onClick = $code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4663,6 +4678,14 @@ class htmlResponsiveTable extends htmlElement {
|
|||
|
||||
/** highlighted rows */
|
||||
private $highlighted = array();
|
||||
/** CSS class for odd row numbers */
|
||||
private $cssOddRow;
|
||||
/** CSS class for even row numbers */
|
||||
private $cssEvenRow;
|
||||
/** onclick code (row number => code) */
|
||||
private $onClick = array();
|
||||
/** ondoubleclick code (row number => code) */
|
||||
private $onDoubleClick = array();
|
||||
|
||||
/**
|
||||
* Creates the table.
|
||||
|
@ -4689,7 +4712,8 @@ class htmlResponsiveTable extends htmlElement {
|
|||
$classes[] = 'responsive-table';
|
||||
echo '<table class="' . implode(' ', $classes) . '">';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
$headClass = empty($this->cssOddRow) ? '' : ' class="' . $this->cssOddRow . '"';
|
||||
echo '<tr ' . $headClass . '>';
|
||||
$counter = 0;
|
||||
foreach ($this->titles as $title) {
|
||||
$width = '';
|
||||
|
@ -4706,10 +4730,28 @@ class htmlResponsiveTable extends htmlElement {
|
|||
$counter = 0;
|
||||
foreach ($this->data as $row) {
|
||||
$cssClass = '';
|
||||
$cssClasses = array();
|
||||
if (in_array($counter, $this->highlighted)) {
|
||||
$cssClass = ' class="bold"';
|
||||
$cssClasses[] = 'bold';
|
||||
}
|
||||
echo '<tr ' . $cssClass . '>';
|
||||
if (!empty($this->cssEvenRow) && ($counter % 2 === 0)) {
|
||||
$cssClasses[] = $this->cssEvenRow;
|
||||
}
|
||||
if (!empty($this->cssOddRow) && ($counter % 2 === 1)) {
|
||||
$cssClasses[] = $this->cssOddRow;
|
||||
}
|
||||
if (!empty($cssClasses)) {
|
||||
$cssClass = ' class="' . implode(' ', $cssClasses) . '"';
|
||||
}
|
||||
$onClick = '';
|
||||
if (!empty($this->onClick[$counter])) {
|
||||
$onClick = ' onclick="' . $this->onClick[$counter] . '"';
|
||||
}
|
||||
$onDoubleClick = '';
|
||||
if (!empty($this->onDoubleClick[$counter])) {
|
||||
$onDoubleClick = ' ondblclick="' . $this->onDoubleClick[$counter] . '"';
|
||||
}
|
||||
echo '<tr ' . $cssClass . $onClick . $onDoubleClick . '>';
|
||||
for ($i = 0; $i < $titleCount; $i++) {
|
||||
echo '<td data-label="' . $this->titles[$i] . '">';
|
||||
$ids = parseHtml($module, $row[$i], $values, $restricted, $tabindex, $scope);
|
||||
|
@ -4728,6 +4770,36 @@ class htmlResponsiveTable extends htmlElement {
|
|||
$this->widths = $widths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS classes for odd and even rows.
|
||||
* The title row counts as row number -1.
|
||||
*
|
||||
* @param string $oddClass class for odd rows
|
||||
* @param string $evenClass class for even rows
|
||||
*/
|
||||
public function setRowClasses($oddClass, $evenClass) {
|
||||
$this->cssOddRow = $oddClass;
|
||||
$this->cssEvenRow = $evenClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the onclick code for the rows.
|
||||
*
|
||||
* @param array $calls row number => code
|
||||
*/
|
||||
public function setOnClickEvents($calls) {
|
||||
$this->onClick = $calls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ondoubleclick code for the rows.
|
||||
*
|
||||
* @param array $calls row number => code
|
||||
*/
|
||||
public function setOnDoubleClickEvents($calls) {
|
||||
$this->onDoubleClick = $calls;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
use LAM\TYPES\ConfiguredType;
|
||||
use phpseclib\Net\SFTP\Stream;
|
||||
|
||||
/*
|
||||
|
||||
|
@ -173,7 +172,7 @@ class lamList {
|
|||
// get some parameters
|
||||
$this->listGetParams();
|
||||
// print HTML head
|
||||
$this->listPrintHeader();
|
||||
$this->printHeader();
|
||||
// print messages when redirected from other pages
|
||||
$this->listPrintRedirectMessages();
|
||||
// refresh data if needed
|
||||
|
@ -202,12 +201,7 @@ class lamList {
|
|||
// navigation bar
|
||||
$this->listDrawNavigationBar(sizeof($this->entries));
|
||||
echo ("<br>\n");
|
||||
echo "<div id=\"listScrollArea\" style=\"overflow: auto; padding: 1px;\">";
|
||||
// account table head
|
||||
$this->listPrintTableHeader();
|
||||
// account table body
|
||||
$this->listPrintTableBody($this->entries);
|
||||
echo "</div>";
|
||||
$this->printAccountTable($this->entries);
|
||||
}
|
||||
else {
|
||||
// buttons
|
||||
|
@ -216,11 +210,11 @@ class lamList {
|
|||
// navigation bar
|
||||
$this->listDrawNavigationBar(sizeof($this->entries));
|
||||
echo ("<br>\n");
|
||||
// account table head
|
||||
$this->listPrintTableHeader();
|
||||
$accounts = array();
|
||||
$this->printAccountTable($accounts);
|
||||
echo "</table><br>\n";
|
||||
}
|
||||
$this->listPrintFooter();
|
||||
$this->printFooter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,23 +307,27 @@ class lamList {
|
|||
*/
|
||||
protected function listDrawNavigationBar($count) {
|
||||
$filter = $this->getFilterAsTextForURL();
|
||||
echo("<table width=\"100%\" border=\"0\">\n");
|
||||
echo("<tr>\n");
|
||||
echo("<td align=\"left\">");
|
||||
printf($this->labels['nav'], $count);
|
||||
echo("</td>");
|
||||
|
||||
$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("<td class=\"activepage\" align=\"right\">");
|
||||
if ($this->page != 1) {
|
||||
echo("<a title=\"" . _('Jump to first page') . "\" href=\"list.php?type=" . $this->type->getId() . "&norefresh=true&page=1" .
|
||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-first.png\"></a>\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("<a title=\"" . _('Jump 10 pages backward') . "\" href=\"list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . ($this->page - 10) .
|
||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-previous.png\"></a>\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++) {
|
||||
|
@ -340,30 +338,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 '<input type="number" class="listPageInput" id="listNavPage" name="listNavPage"'
|
||||
. ' value="' . ($i + 1) . '" min="1" max="' . $pageCount . '"'
|
||||
. ' onkeypress="listPageNumberKeyPress(\'' . $url . '\', event);">';
|
||||
$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 " <a href=\"list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . ($i + 1) .
|
||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" . ($i + 1) . "</a>\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("<a title=\"" . _('Jump 10 pages forward') . "\" href=\"list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . ($this->page + 10) .
|
||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-next.png\"></a>\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("<a title=\"" . _('Jump to last page') . "\" href=\"list.php?type=" . $this->type->getId() . "&norefresh=true&page=" . $pageCount .
|
||||
"&sort=" . $this->sortColumn . "&sortdirection=" . $this->sortDirection . $filter . "\">" .
|
||||
"<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-last.png\"></a>\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 "</td>";
|
||||
}
|
||||
echo "</tr></table>\n";
|
||||
$row->add($navGroup, 12, 6, 6, 'responsiveLabel');
|
||||
parseHtml(null, $row, array(), false, $this->tabindex, $this->type->getScope());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -374,106 +383,119 @@ class lamList {
|
|||
protected function getFilterAsTextForURL() {
|
||||
$text = '';
|
||||
foreach ($this->filters as $attr => $filter) {
|
||||
$text .= "&filter" . strtolower($attr) . '=' . $filter;
|
||||
$text .= "&filter" . strtolower($attr) . '=' . $filter;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the attribute and filter row at the account table head
|
||||
*/
|
||||
protected function listPrintTableHeader() {
|
||||
$filter = $this->getFilterAsTextForURL();
|
||||
// print table header
|
||||
echo "<table id=\"accountTable\" frame=\"box\" rules=\"none\" class=\"" . $this->type->getScope() . "-border collapse accountlist ui-corner-all\" width=\"100%\"><thead>\n";
|
||||
echo "<tr class=\"" . $this->type->getScope() . "-dark\">\n";
|
||||
echo "<th width=22 height=34><a href=\"#\" onClick=\"list_switchAccountSelection();\"><img height=16 width=16 src=\"../../graphics/selectDown.png\" alt=\"select all\"></a></th>\n";
|
||||
echo "<td> <a href=\"#\" onClick=\"list_switchAccountSelection();\">" .
|
||||
"<font color=\"black\"><small>" . _("Select all") . "</small></font></a></td>\n";
|
||||
// table header
|
||||
for ($k = 0; $k < sizeof($this->descArray); $k++) {
|
||||
if (strtolower($this->attrArray[$k]) == $this->sortColumn) {
|
||||
$sortImage = "sort_asc.png";
|
||||
if ($this->sortDirection < 0) {
|
||||
$sortImage = "sort_desc.png";
|
||||
}
|
||||
echo "<th align=\"left\"><a href=\"list.php?type=" . $this->type->getId() . "&".
|
||||
"sort=" . strtolower($this->attrArray[$k]) . $filter . "&norefresh=y" . "\">" . $this->descArray[$k] .
|
||||
" <img height=16 width=16 style=\"vertical-align: middle;\" src=\"../../graphics/$sortImage\" alt=\"sort direction\"></a></th>\n";
|
||||
}
|
||||
else echo "<th align=\"left\"><a href=\"list.php?type=" . $this->type->getId() . "&".
|
||||
"sort=" . strtolower($this->attrArray[$k]) . $filter . "&norefresh=y" . "\">" . $this->descArray[$k] . "</a></th>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
// print filter row
|
||||
echo "<tr align=\"center\" class=\"" . $this->type->getScope() . "-bright\">\n";
|
||||
echo "<td width=22 height=34>";
|
||||
printHelpLink(getHelp('', '250'), '250');
|
||||
echo "</td>\n";
|
||||
echo "<td>";
|
||||
$filterGroup = new htmlGroup();
|
||||
$filterButton = new htmlButton('apply_filter', 'filter.png', true);
|
||||
$filterButton->setTitle(_("Filter"));
|
||||
$filterGroup->addElement($filterButton);
|
||||
if (sizeof($this->filters) > 0) {
|
||||
$filterGroup->addElement(new htmlSpacer('1px', null));
|
||||
$clearFilterButton = new htmlButton('clear_filter', 'clearFilter.png', true);
|
||||
$clearFilterButton->setTitle(_('Clear filter'));
|
||||
$filterGroup->addElement($clearFilterButton);
|
||||
}
|
||||
parseHtml(null, $filterGroup, array(), false, $this->tabindex, $this->type->getScope());
|
||||
echo "</td>\n";
|
||||
// print input boxes for filters
|
||||
for ($k = 0; $k < sizeof($this->descArray); $k++) {
|
||||
echo "<td align=\"left\">";
|
||||
if ($this->canBeFiltered($this->attrArray[$k])) {
|
||||
$this->printFilterArea($this->attrArray[$k], isset($_POST['clear_filter']));
|
||||
}
|
||||
echo "</td>\n";
|
||||
}
|
||||
echo "</tr></thead>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the content of a single attribute filter area.
|
||||
*
|
||||
* @param String $attrName attribute name
|
||||
* @param boolean $clearFilter true if filter value should be cleared
|
||||
*/
|
||||
protected function printFilterArea($attrName, $clearFilter) {
|
||||
$value = "";
|
||||
if (!$clearFilter) {
|
||||
if (isset($this->filters[strtolower($attrName)])) {
|
||||
$value = $this->filters[strtolower($attrName)];
|
||||
}
|
||||
}
|
||||
$filterInput = new htmlInputField('filter' . strtolower($attrName), $value);
|
||||
$filterInput->setCSSClasses(array($this->type->getScope() . '-dark'));
|
||||
$filterInput->setFieldSize('15');
|
||||
$filterInput->setOnKeyPress("SubmitForm('apply_filter', event);");
|
||||
parseHtml(null, $filterInput, array(), false, $this->tabindex, $this->type->getScope());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the given attribute can be filtered.
|
||||
* If filtering is not possible then no filter box will be displayed.
|
||||
* By default all attributes can be filtered.
|
||||
*
|
||||
* @param String $attr attribute name
|
||||
* @return boolean filtering possible
|
||||
*/
|
||||
protected function canBeFiltered($attr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the entry list
|
||||
*
|
||||
* @param array $info entries
|
||||
*/
|
||||
protected function listPrintTableBody(&$info) {
|
||||
echo "<tbody>\n";
|
||||
private function printAccountTable(&$info) {
|
||||
$scope = $this->type->getScope();
|
||||
$titles = $this->descArray;
|
||||
array_unshift($titles, _('Actions'));
|
||||
$data = array();
|
||||
$data[] = $this->getSortingElements();
|
||||
$data[] = $this->getFilterElements();
|
||||
$onClickEvents = array();
|
||||
$onDoubleClickEvents = array();
|
||||
$this->addDataElements($data, $info, $onClickEvents, $onDoubleClickEvents);
|
||||
|
||||
$table = new htmlResponsiveTable($titles, $data);
|
||||
$table->setRowClasses($scope . '-dark', $scope . '-bright');
|
||||
$table->setCSSClasses(array($scope . '-border accountlist'));
|
||||
$table->setOnClickEvents($onClickEvents);
|
||||
$table->setOnDoubleClickEvents($onDoubleClickEvents);
|
||||
|
||||
parseHtml(null, $table, array(), false, $this->tabindex, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elements to show in sorting row.
|
||||
*
|
||||
* @return htmlElement[] elements
|
||||
*/
|
||||
private function getSortingElements() {
|
||||
$filter = $this->getFilterAsTextForURL();
|
||||
$sortElements = array(new htmlOutputText(_('Sort sequence')));
|
||||
foreach ($this->attrArray as $attributeName) {
|
||||
$link = "list.php?type=" . $this->type->getId() . "&".
|
||||
"sort=" . strtolower($attributeName) . $filter . "&norefresh=y";
|
||||
$buttons = new htmlGroup();
|
||||
if (strtolower($attributeName) == $this->sortColumn) {
|
||||
if ($this->sortDirection < 0) {
|
||||
$buttons->addElement(new htmlLink(null, $link . '&sortdirection=1', '../../graphics/downarrows.png'));
|
||||
$buttons->addElement(new htmlLink(null, $link . '&sortdirection=-1', '../../graphics/uparrows-black.png'));
|
||||
}
|
||||
else {
|
||||
$buttons->addElement(new htmlLink(null, $link . '&sortdirection=1', '../../graphics/downarrows-black.png'));
|
||||
$buttons->addElement(new htmlLink(null, $link . '&sortdirection=-1', '../../graphics/uparrows.png'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$buttons->addElement(new htmlLink(null, $link . '&sortdirection=1', '../../graphics/downarrows.png'));
|
||||
$buttons->addElement(new htmlLink(null, $link . '&sortdirection=-1', '../../graphics/uparrows.png'));
|
||||
}
|
||||
$sortElements[] = $buttons;
|
||||
}
|
||||
return $sortElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elements to show in filter row.
|
||||
*
|
||||
* @return htmlElement[] elements
|
||||
*/
|
||||
private function getFilterElements() {
|
||||
$actionElement = new htmlGroup();
|
||||
$selectAll = new htmlInputCheckbox('tableSelectAll', false);
|
||||
$selectAll->setCSSClasses(array('align-middle'));
|
||||
$selectAll->setOnClick('list_switchAccountSelection();');
|
||||
$actionElement->addElement($selectAll);
|
||||
$actionElement->addElement(new htmlSpacer('1rem', null));
|
||||
$actionElement->addElement(new htmlOutputText(_('Filter')));
|
||||
$filterButton = new htmlButton('apply_filter', 'filter.png', true);
|
||||
$filterButton->setTitle(_("Here you can input simple filter expressions (e.g. 'value' or 'v*'). The filter is case-insensitive."));
|
||||
$actionElement->addElement($filterButton);
|
||||
if (sizeof($this->filters) > 0) {
|
||||
$clearFilterButton = new htmlButton('clear_filter', 'clearFilter.png', true);
|
||||
$clearFilterButton->setTitle(_('Clear filter'));
|
||||
$actionElement->addElement($clearFilterButton);
|
||||
}
|
||||
|
||||
$filterElements = array(new htmlDiv(null, $actionElement, array('nowrap')));
|
||||
$clearFilter = isset($_POST['clear_filter']);
|
||||
foreach ($this->attrArray as $attributeName) {
|
||||
$attributeName = strtolower($attributeName);
|
||||
if ($this->canBeFiltered($attributeName)) {
|
||||
$value = "";
|
||||
if (!$clearFilter && isset($this->filters[$attributeName])) {
|
||||
$value = $this->filters[$attributeName];
|
||||
}
|
||||
$filterInput = new htmlInputField('filter' . $attributeName, $value, null);
|
||||
$filterInput->setCSSClasses(array($this->type->getScope() . '-bright'));
|
||||
$filterInput->setOnKeyPress("SubmitForm('apply_filter', event);");
|
||||
$filterElements[] = $filterInput;
|
||||
}
|
||||
else {
|
||||
$filterElements[] = new htmlOutputText('');
|
||||
}
|
||||
}
|
||||
return $filterElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the LDAP data elements to the given array.
|
||||
*
|
||||
* @param array $data data for responsible table
|
||||
* @param array $info entries
|
||||
* @param array $onClickEvents row number => code
|
||||
* @param array $onDoubleClickEvents row number => code
|
||||
*/
|
||||
private function addDataElements(&$data, &$info, &$onClickEvents, &$onDoubleClickEvents) {
|
||||
// calculate which rows to show
|
||||
$table_begin = ($this->page - 1) * $this->maxPageEntries;
|
||||
if (($this->page * $this->maxPageEntries) > sizeof($info)) $table_end = sizeof($info);
|
||||
|
@ -489,100 +511,97 @@ class lamList {
|
|||
}
|
||||
// print account list
|
||||
for ($i = $table_begin; $i < $table_end; $i++) {
|
||||
$row = array();
|
||||
$index = $sortMapping[$i];
|
||||
$rowID = base64_encode($info[$index]['dn']);
|
||||
if ((($i - $table_begin) % 2) == 1) {
|
||||
$classes = ' ' . $this->type->getScope() . '-bright';
|
||||
$actionElement = new htmlGroup();
|
||||
$checkbox = new htmlInputCheckbox($rowID, false);
|
||||
$checkbox->setOnClick("list_click('" . $rowID . "');");
|
||||
$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']) . "';";
|
||||
$this->addToolLinks($info[$index], $rowID, $actionElement);
|
||||
$row[] = new htmlDiv(null, $actionElement, array('nowrap'));
|
||||
foreach ($this->attrArray as $attributeName) {
|
||||
$attributeName = strtolower($attributeName);
|
||||
$row[] = $this->getTableCellContent($info[$index], $attributeName);
|
||||
}
|
||||
else {
|
||||
$classes = ' ' . $this->type->getScope() . '-dark';
|
||||
}
|
||||
echo("<tr class=\"$classes\"" .
|
||||
" onClick=\"list_click('" . $rowID . "')\"\n" .
|
||||
" onDblClick=\"top.location.href='../account/edit.php?type=" . $this->type->getId() . "&DN=" . rawurlencode($info[$index]['dn']) . "'\">\n");
|
||||
echo " <td align=\"center\"><input class=\"accountBoxUnchecked\" onClick=\"list_click('" . $rowID . "')\"" .
|
||||
" type=\"checkbox\" name=\"" . $rowID . "\"></td>\n";
|
||||
$this->listPrintToolLinks($info[$index], $rowID);
|
||||
for ($k = 0; $k < sizeof($this->attrArray); $k++) {
|
||||
echo ("<td>");
|
||||
$attrName = strtolower($this->attrArray[$k]);
|
||||
$this->listPrintTableCellContent($info[$index], $attrName);
|
||||
echo ("</td>\n");
|
||||
}
|
||||
echo("</tr>\n");
|
||||
$data[] = $row;
|
||||
}
|
||||
// display select all link
|
||||
$colspan = sizeof($this->attrArray) + 1;
|
||||
echo "<tr class=\"" . $this->type->getScope() . "-bright\">\n";
|
||||
echo "<td align=\"center\"><a href=\"#\" onClick=\"list_switchAccountSelection();\"><img height=16 width=16 src=\"../../graphics/select.png\" alt=\"select all\"></a></td>\n";
|
||||
echo "<td colspan=$colspan> <a href=\"#\" onClick=\"list_switchAccountSelection();\">" .
|
||||
"<font color=\"black\"><small>" . _("Select all") . "</small></font></a></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</tbody>\n";
|
||||
echo "</table>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the tool image links (e.g. edit and delete) for each account.
|
||||
* Adds the tool image links (e.g. edit and delete) for each account.
|
||||
*
|
||||
* @param array $account LDAP attributes
|
||||
* @param String $id account ID
|
||||
* @param htmlGroup $element location where to add tools
|
||||
*/
|
||||
private function listPrintToolLinks($account, $id) {
|
||||
private function addToolLinks($account, $id, &$element) {
|
||||
$toolCount = 0;
|
||||
$group = new htmlGroup();
|
||||
// edit link
|
||||
$editLink = new htmlLink('', "../account/edit.php?type=" . $this->type->getId() . "&DN='" . rawurlencode($account['dn']) . "'", '../../graphics/edit.png');
|
||||
$editLink->setTitle(_("Edit"));
|
||||
$group->addElement($editLink);
|
||||
$element->addElement($editLink);
|
||||
$toolCount++;
|
||||
// delete link
|
||||
if (checkIfWriteAccessIsAllowed($this->type->getId()) && checkIfDeleteEntriesIsAllowed($this->type->getId())) {
|
||||
$deleteLink = new htmlLink('', "deletelink.php?type=" . $this->type->getId() . "&DN='" . rawurlencode($account['dn']) . "'", '../../graphics/delete.png');
|
||||
$deleteLink->setTitle(_("Delete"));
|
||||
$group->addElement($deleteLink);
|
||||
$element->addElement($deleteLink);
|
||||
$toolCount++;
|
||||
}
|
||||
// PDF button
|
||||
$pdfButton = new htmlButton("createPDF_" . $id, 'pdf.png', true);
|
||||
$pdfButton->setTitle(_('Create PDF file'));
|
||||
$group->addElement($pdfButton);
|
||||
$element->addElement($pdfButton);
|
||||
$toolCount++;
|
||||
// additional tools
|
||||
$tools = $this->getAdditionalTools();
|
||||
for ($i = 0; $i < sizeof($tools); $i++) {
|
||||
$toolLink = new htmlLink('', $tools[$i]->getLinkTarget() . "?type=" . $this->type->getId() . "&DN='" . rawurlencode($account['dn']) . "'", '../../graphics/' . $tools[$i]->getImage());
|
||||
$toolLink->setTitle($tools[$i]->getName());
|
||||
$group->addElement($toolLink);
|
||||
$element->addElement($toolLink);
|
||||
$toolCount++;
|
||||
}
|
||||
$width = ($toolCount * 20) + 20;
|
||||
echo "<td align='center' style=\"white-space: nowrap; width: ${width}px;\">";
|
||||
parseHtml(null, $group, array(), false, $this->tabindex, $this->type->getScope());
|
||||
echo "</td>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the content of a cell in the account list for a given LDAP entry and attribute.
|
||||
* Returns if the given attribute can be filtered.
|
||||
* If filtering is not possible then no filter box will be displayed.
|
||||
* By default all attributes can be filtered.
|
||||
*
|
||||
* @param String $attr attribute name
|
||||
* @return boolean filtering possible
|
||||
*/
|
||||
protected function canBeFiltered($attr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content of a cell in the account list for a given LDAP entry and attribute.
|
||||
*
|
||||
* @param array $entry LDAP attributes
|
||||
* @param string $attribute attribute name
|
||||
* @return htmlElement content
|
||||
*/
|
||||
protected function listPrintTableCellContent(&$entry, &$attribute) {
|
||||
protected function getTableCellContent(&$entry, &$attribute) {
|
||||
// print all attribute entries seperated by "; "
|
||||
if (isset($entry[$attribute]) && sizeof($entry[$attribute]) > 0) {
|
||||
if (is_array($entry[$attribute])) {
|
||||
if (($attribute == 'entryexpiretimestamp') && !empty($entry[$attribute][0])) {
|
||||
echo formatLDAPTimestamp($entry[$attribute][0]);
|
||||
return new htmlOutputText(formatLDAPTimestamp($entry[$attribute][0]));
|
||||
}
|
||||
else {
|
||||
// sort array
|
||||
sort($entry[$attribute]);
|
||||
echo htmlspecialchars(implode("; ", $entry[$attribute]), ENT_QUOTES, "UTF-8");
|
||||
return new htmlOutputText(implode("; ", $entry[$attribute]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo htmlspecialchars($entry[$attribute], ENT_QUOTES, "UTF-8");
|
||||
return new htmlOutputText($entry[$attribute]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -816,51 +835,52 @@ class lamList {
|
|||
* @param int $tabindex HTML tabindex counter
|
||||
*/
|
||||
protected function listPrintButtons($createOnly) {
|
||||
$table = new htmlTable('100%');
|
||||
$row = new htmlResponsiveRow();
|
||||
$row->setCSSClasses(array('maxrow'));
|
||||
$left = new htmlGroup();
|
||||
// button part
|
||||
$left->alignment = htmlElement::ALIGN_LEFT;
|
||||
if (checkIfWriteAccessIsAllowed($this->type->getId())) {
|
||||
// add button
|
||||
if (checkIfNewEntriesAreAllowed($this->type->getId())) {
|
||||
$newButton = new htmlButton('new', $this->labels['newEntry']);
|
||||
$newButton->setIconClass('createButton');
|
||||
$newButton->setCSSClasses(array('fullwidth-mobile-only'));
|
||||
$left->addElement($newButton);
|
||||
}
|
||||
// delete button
|
||||
if (!$createOnly && checkIfDeleteEntriesIsAllowed($this->type->getId())) {
|
||||
$left->addElement(new htmlSpacer('1px', null));
|
||||
$delButton = new htmlButton('del', $this->labels['deleteEntry']);
|
||||
$delButton->setIconClass('deleteButton');
|
||||
$delButton->setCSSClasses(array('fullwidth-mobile-only'));
|
||||
$left->addElement($delButton);
|
||||
}
|
||||
$toolSettings = $_SESSION['config']->getToolSettings();
|
||||
if ($this->type->getBaseType()->supportsFileUpload() && checkIfNewEntriesAreAllowed($this->type->getId())
|
||||
&& !(isset($toolSettings['tool_hide_toolFileUpload']) && ($toolSettings['tool_hide_toolFileUpload'] == 'true'))) {
|
||||
$left->addElement(new htmlSpacer('20px', null));
|
||||
$uploadButton = new htmlButton('fileUpload', _('File upload'));
|
||||
$uploadButton->setIconClass('upButton');
|
||||
$uploadButton->setCSSClasses(array('fullwidth-mobile-only'));
|
||||
$left->addElement($uploadButton);
|
||||
}
|
||||
}
|
||||
|
||||
// OU selection and settings
|
||||
$right = new htmlGroup();
|
||||
$right->alignment = htmlElement::ALIGN_RIGHT;
|
||||
$right->addElement($this->listShowOUSelection());
|
||||
$right = new htmlResponsiveRow();
|
||||
$right->add($this->listShowOUSelection(), 12, 12, 10);
|
||||
$rightButtonGroup = new htmlGroup();
|
||||
$refreshButton = new htmlButton('refresh', 'refresh.png', true);
|
||||
$refreshButton->setTitle(_("Refresh"));
|
||||
$right->addElement($refreshButton);
|
||||
$right->addElement(new htmlSpacer('1px', null));
|
||||
$rightButtonGroup->addElement($refreshButton);
|
||||
$settingsLink = new htmlLink('', '#', '../../graphics/tools.png');
|
||||
$settingsLink->setOnClick('listShowSettingsDialog(\'' . _('Change list settings') . '\', \'' . _('Ok') . '\', \'' . _('Cancel') . '\');');
|
||||
$settingsLink->setTitle(_('Change settings'));
|
||||
$right->addElement($settingsLink);
|
||||
$rightButtonGroup->addElement($settingsLink);
|
||||
$right->add($rightButtonGroup, 12, 12, 2);
|
||||
|
||||
$this->addExtraInputElementsToTopArea($left, $right);
|
||||
$table->addElement($left);
|
||||
$table->addElement($right);
|
||||
parseHtml(null, $table, array(), false, $this->tabindex, $this->type->getScope());
|
||||
$row->add($left, 12, 6, 6, 'text-left');
|
||||
$row->add($right, 12, 6, 6, 'text-right');
|
||||
parseHtml(null, $row, array(), false, $this->tabindex, $this->type->getScope());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -873,16 +893,6 @@ class lamList {
|
|||
// only used by subclasses
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the HTML header.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
protected function listPrintHeader() {
|
||||
include '../main_header.php';
|
||||
$this->printHeaderContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the header part of the page.
|
||||
*/
|
||||
|
@ -898,16 +908,6 @@ class lamList {
|
|||
// implemented by child classes if needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the HTML footer.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
protected function listPrintFooter() {
|
||||
$this->printFooterContent();
|
||||
include '../main_footer.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the footer area of the page.
|
||||
*/
|
||||
|
@ -927,9 +927,6 @@ class lamList {
|
|||
jQuery(document).ready(function() {
|
||||
jQuery('#tab_<?php echo $this->type->getId(); ?>').addClass('ui-tabs-active');
|
||||
jQuery('#tab_<?php echo $this->type->getId(); ?>').addClass('ui-state-active');
|
||||
window.onload = listResizeITabContentDiv;
|
||||
window.onresize = listResizeITabContentDiv;
|
||||
jQuery('#filterButton').button();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
@ -986,7 +983,7 @@ class lamList {
|
|||
}
|
||||
// get sort order
|
||||
if (isset($_GET['sortdirection'])) {
|
||||
$this->sortDirection = $_GET['sortdirection'];
|
||||
$this->sortDirection = htmlspecialchars($_GET['sortdirection']);
|
||||
}
|
||||
// check search suffix
|
||||
if (isset($_POST['suffix'])) {
|
||||
|
@ -1176,20 +1173,18 @@ class lamList {
|
|||
* Prints the list configuration page.
|
||||
*/
|
||||
protected function listPrintConfigurationPage() {
|
||||
echo "<div id=\"settingsDialog\" class=\"hidden\">\n";
|
||||
echo "<div id=\"settingsDialog\" class=\"hidden dialog-content\">\n";
|
||||
echo "<form id=\"settingsDialogForm\" action=\"list.php?type=" . $this->type->getId() . "&norefresh=true\" method=\"post\">\n";
|
||||
echo '<table width="100%"><tr><td>';
|
||||
|
||||
$configContainer = new htmlTable();
|
||||
$configContainer = new htmlResponsiveRow();
|
||||
for ($i = 0; $i < sizeof($this->configOptions); $i++) {
|
||||
$configContainer->mergeTableElements($this->configOptions[$i]->getMetaHTML());
|
||||
$configContainer->add($this->configOptions[$i]->getMetaHTML(), 12);
|
||||
}
|
||||
$configContainer->addElement(new htmlHiddenInput('saveConfigOptions', 'ok'));
|
||||
$configContainer->add(new htmlHiddenInput('saveConfigOptions', 'ok'), 12);
|
||||
addSecurityTokenToMetaHTML($configContainer);
|
||||
|
||||
parseHtml('', $configContainer, array(), false, $this->tabindex, $this->type->getScope());
|
||||
|
||||
echo "</td></tr></table>\n";
|
||||
echo '</form>';
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
@ -1369,7 +1364,7 @@ abstract class lamListOption {
|
|||
/**
|
||||
* Returns the meta HTML data to display this option.
|
||||
*
|
||||
* @return htmlTable meta HTML
|
||||
* @return htmlResponsiveRow meta HTML
|
||||
*/
|
||||
public abstract function getMetaHTML();
|
||||
|
||||
|
@ -1422,13 +1417,12 @@ class lamBooleanListOption extends lamListOption {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the meta HTML data to display this option.
|
||||
*
|
||||
* @return htmlTable meta HTML
|
||||
* {@inheritDoc}
|
||||
* @see lamListOption::getMetaHTML()
|
||||
*/
|
||||
public function getMetaHTML() {
|
||||
$return = new htmlTable();
|
||||
$return->addElement(new htmlTableExtendedInputCheckbox($this->getID(), $this->isSelected(), $this->name));
|
||||
$return = new htmlResponsiveRow();
|
||||
$return->add(new htmlResponsiveInputCheckbox($this->getID(), $this->isSelected(), $this->name), 12);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -1487,13 +1481,12 @@ class lamSelectListOption extends lamListOption {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the meta HTML data to display this option.
|
||||
*
|
||||
* @return htmlTable meta HTML
|
||||
* {@inheritDoc}
|
||||
* @see lamListOption::getMetaHTML()
|
||||
*/
|
||||
public function getMetaHTML() {
|
||||
$return = new htmlTable();
|
||||
$return->addElement(new htmlTableExtendedSelect($this->getID(), $this->options, array($this->getValue()), $this->name, $this->helpID));
|
||||
$return = new htmlResponsiveRow();
|
||||
$return->add(new htmlResponsiveSelect($this->getID(), $this->options, array($this->getValue()), $this->name, $this->helpID), 12);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,12 +178,10 @@ class lamDHCPList extends lamList {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints the content of a cell in the account list for a given LDAP entry and attribute.
|
||||
*
|
||||
* @param array $entry LDAP attributes
|
||||
* @param string $attribute attribute name
|
||||
* {@inheritDoc}
|
||||
* @see lamList::getTableCellContent()
|
||||
*/
|
||||
public function listPrintTableCellContent(&$entry, &$attribute) {
|
||||
public function getTableCellContent(&$entry, &$attribute) {
|
||||
// Fixed IPs
|
||||
if ($attribute=="fixed_ips") {
|
||||
// find all fixed addresses:
|
||||
|
@ -197,48 +195,59 @@ class lamDHCPList extends lamList {
|
|||
$order[$i] = fixed_ip::extractIP($entries[$i]['dhcpstatements']);
|
||||
}
|
||||
}
|
||||
$group = new htmlGroup();
|
||||
natcasesort($order);
|
||||
echo "<table border=\"0\" width=\"100%\">";
|
||||
foreach ($order as $i => $sortval) {
|
||||
for ($i = 0; $i < sizeof($order); $i++) {
|
||||
$dhcpstatements = array();
|
||||
if (isset($entries[$i]['dhcpstatements'][0])) {
|
||||
$dhcpstatements = $entries[$i]['dhcpstatements'];
|
||||
}
|
||||
$style = '';
|
||||
$cssClasses = array('nowrap');
|
||||
if (!fixed_ip::isActive($dhcpstatements)) {
|
||||
$style = 'style="text-decoration: line-through;"';
|
||||
$cssClasses[] = 'strike-through';
|
||||
}
|
||||
echo "<tr " . $style . ">";
|
||||
echo "<td width=\"25%\">" . fixed_ip::extractIP($dhcpstatements) . "</td>";
|
||||
$dhcphwaddress = explode(" ",$entries[$i]['dhcphwaddress'][0]);
|
||||
echo "<td width=\"35%\">".array_pop($dhcphwaddress)."</td>";
|
||||
echo "<td width=\"40%\">".$entries[$i]['cn'][0]."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
}
|
||||
}
|
||||
// fixed ip address
|
||||
elseif ($attribute=="dhcpstatements") {
|
||||
// Search after the fixed ip entry
|
||||
if (is_array($entry['dhcpstatements'])) {
|
||||
foreach($entry['dhcpstatements'] AS $id => $value) {
|
||||
|
||||
if (!is_array($value) && array_shift( explode(" ", $value) ) == "fixed-address") {
|
||||
$ip = explode(" ", $value);
|
||||
echo $ip['1'];
|
||||
$ipAddress = fixed_ip::extractIP($dhcpstatements);
|
||||
$ip = new htmlOutputText($ipAddress);
|
||||
$ip->setCSSClasses($cssClasses);
|
||||
$group->addElement($ip);
|
||||
if (!empty($ipAddress)) {
|
||||
$group->addElement(new htmlOutputText('<br>', false));
|
||||
}
|
||||
$macAddress = array_pop($dhcphwaddress);
|
||||
$mac = new htmlOutputText($macAddress);
|
||||
$mac->setCSSClasses($cssClasses);
|
||||
$group->addElement($mac);
|
||||
if (!empty($macAddress)) {
|
||||
$group->addElement(new htmlOutputText('<br>', false));
|
||||
}
|
||||
$name = new htmlOutputText($entries[$i]['cn'][0]);
|
||||
$name->setCSSClasses($cssClasses);
|
||||
$group->addElement($name);
|
||||
$group->addElement(new htmlOutputText('<br>', false));
|
||||
if ($i < (sizeof($order) - 1)) {
|
||||
$group->addElement(new htmlOutputText('<br>', false));
|
||||
}
|
||||
}
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
elseif ($attribute=="dhcprange") { // DHCP Range
|
||||
if (isset($entry['dhcprange'])) {
|
||||
echo"<table cellspacing=\"0\">";
|
||||
$table = new htmlTable();
|
||||
$table->setCSSClasses(array('nowrap'));
|
||||
$ranges = array();
|
||||
foreach($entry['dhcprange'] AS $id => $value) {
|
||||
if (!empty($value) && !is_numeric($value)) {
|
||||
$ex = explode(" ", $value);
|
||||
$ranges[] = "<tr><td>".$ex[0]."</td><td width=\"20\"><center>-</center></td><td>".$ex[1]."</td></tr>";
|
||||
$row = new htmlTableRow(
|
||||
array(
|
||||
new htmlOutputText($ex[0]),
|
||||
new htmlOutputText(' - '),
|
||||
new htmlOutputText($ex[1])
|
||||
)
|
||||
);
|
||||
$ranges[$ex[0] . ' - ' . $ex[1]] = $row;
|
||||
}
|
||||
}
|
||||
$pooledRanges = searchLDAP($entry['dn'], '(objectclass=dhcpPool)', array('dhcprange'));
|
||||
|
@ -249,18 +258,26 @@ class lamDHCPList extends lamList {
|
|||
foreach($pool['dhcprange'] AS $id => $value) {
|
||||
if (!empty($value) && !is_numeric($value)) {
|
||||
$ex = explode(" ", $value);
|
||||
$ranges[] = "<tr><td>".$ex[0]."</td><td width=\"20\"><center>-</center></td><td>".$ex[1]."</td></tr>";
|
||||
$row = new htmlTableRow(
|
||||
array(
|
||||
new htmlOutputText($ex[0]),
|
||||
new htmlOutputText(' - '),
|
||||
new htmlOutputText($ex[1])
|
||||
)
|
||||
);
|
||||
$ranges[$ex[0] . ' - ' . $ex[1]] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
natcasesort($ranges);
|
||||
echo implode('', $ranges);
|
||||
echo"</table>";
|
||||
uksort($ranges, 'strnatcasecmp');
|
||||
foreach ($ranges as $text => $row) {
|
||||
$table->addElement($row);
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parent::listPrintTableCellContent($entry, $attribute);
|
||||
else {
|
||||
return parent::getTableCellContent($entry, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,9 +289,9 @@ class lamDHCPList extends lamList {
|
|||
*/
|
||||
protected function addExtraInputElementsToTopArea(&$left, &$right) {
|
||||
if (checkIfWriteAccessIsAllowed($this->type->getId())) {
|
||||
$left->addElement(new htmlSpacer('20px', null));
|
||||
$dhcpButton = new htmlButton('dhcpDefaults', $this->labels['dhcpDefaults']);
|
||||
$dhcpButton->setIconClass('settingsButton');
|
||||
$dhcpButton->setCSSClasses(array('fullwidth-mobile-only'));
|
||||
$left->addElement($dhcpButton);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,12 +284,10 @@ class lamGroupList extends lamList {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints the content of a cell in the account list for a given LDAP entry and attribute.
|
||||
*
|
||||
* @param array $entry LDAP attributes
|
||||
* @param string $attribute attribute name
|
||||
* {@inheritDoc}
|
||||
* @see lamList::getTableCellContent()
|
||||
*/
|
||||
function listPrintTableCellContent(&$entry, &$attribute) {
|
||||
protected function getTableCellContent(&$entry, &$attribute) {
|
||||
if ($attribute == "memberuid") {
|
||||
// $gid is used for linking primary group memebers
|
||||
$gid = -1;
|
||||
|
@ -350,11 +348,10 @@ class lamGroupList extends lamList {
|
|||
}
|
||||
}
|
||||
}
|
||||
echo implode("; ", $linklist);
|
||||
return new htmlOutputText(implode("; ", $linklist), false);
|
||||
}
|
||||
// pretty print member DNs
|
||||
elseif (in_array_ignore_case($attribute, array('member', 'uniqueMember', 'owner', 'roleOccupant')) && !empty($entry[$attribute])) {
|
||||
echo '<div class="rightToLeftText">';
|
||||
$values = $entry[$attribute];
|
||||
if (!empty($values)) {
|
||||
usort($values, 'compareDN');
|
||||
|
@ -375,12 +372,11 @@ class lamGroupList extends lamList {
|
|||
$values[$i] = getAbstractDN($values[$i]);
|
||||
}
|
||||
}
|
||||
echo implode('<br>', $values);
|
||||
echo '</div>';
|
||||
return new htmlDiv(null, new htmlOutputText(implode('<br>', $values), false), array('rightToLeftText'));
|
||||
}
|
||||
// print all other attributes
|
||||
else {
|
||||
parent::listPrintTableCellContent($entry, $attribute);
|
||||
return parent::getTableCellContent($entry, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -717,24 +717,21 @@ class lamUserList extends lamList {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints the content of a cell in the account list for a given LDAP entry and attribute.
|
||||
*
|
||||
* @param array $entry LDAP attributes
|
||||
* @param string $attribute attribute name
|
||||
* {@inheritDoc}
|
||||
* @see lamList::getTableCellContent()
|
||||
*/
|
||||
protected function listPrintTableCellContent(&$entry, &$attribute) {
|
||||
protected function getTableCellContent(&$entry, &$attribute) {
|
||||
// check if there is something to display at all
|
||||
if (($attribute != self::ATTR_ACCOUNT_STATUS) && (!isset($entry[$attribute]) || !is_array($entry[$attribute]) || (sizeof($entry[$attribute]) < 1))) {
|
||||
parent::listPrintTableCellContent($entry, $attribute);
|
||||
return;
|
||||
return parent::getTableCellContent($entry, $attribute);
|
||||
}
|
||||
// translate GID to group name
|
||||
if (($attribute == "gidnumber") && ($this->trans_primary == "on")) {
|
||||
if (isset($this->trans_primary_hash[$entry[$attribute][0]])) {
|
||||
echo $this->trans_primary_hash[$entry[$attribute][0]];
|
||||
return new htmlOutputText($this->trans_primary_hash[$entry[$attribute][0]]);
|
||||
}
|
||||
else {
|
||||
parent::listPrintTableCellContent($entry, $attribute);
|
||||
return parent::getTableCellContent($entry, $attribute);
|
||||
}
|
||||
}
|
||||
// show user photos
|
||||
|
@ -764,47 +761,45 @@ class lamUserList extends lamList {
|
|||
if ($imgHeight < 64) {
|
||||
$minSize = $imgHeight;
|
||||
}
|
||||
$imgTitle = _('Click to switch between thumbnail and original size.');
|
||||
echo "<img id=\"img$imgNumber\" title=\"$imgTitle\" height=$minSize src=\"" . $photoFile . "\" alt=\"" . _('Photo') . "\">";
|
||||
echo '<script type="text/javascript">';
|
||||
echo "addResizeHandler(document.getElementById(\"img$imgNumber\"), $minSize, " . $imgHeight . ")";
|
||||
echo '</script>';
|
||||
return new htmlImage($photoFile, null, $minSize, _('Photo'));
|
||||
}
|
||||
elseif (($attribute == 'mail') || ($attribute == 'rfc822Mailbox')) {
|
||||
$group = new htmlGroup();
|
||||
if (isset($entry[$attribute][0]) && ($entry[$attribute][0] != '')) {
|
||||
for ($i = 0; $i < sizeof($entry[$attribute]); $i++) {
|
||||
if ($i > 0) {
|
||||
echo ", ";
|
||||
$group->addElement(new htmlOutputText(", "));
|
||||
}
|
||||
echo "<a href=\"mailto:" . $entry[$attribute][$i] . "\">" . $entry[$attribute][$i] . "</a>\n";
|
||||
$group->addElement(new htmlLink($entry[$attribute][$i], "mailto:" . $entry[$attribute][$i]));
|
||||
}
|
||||
}
|
||||
return $group;
|
||||
}
|
||||
// expire dates
|
||||
elseif ($attribute == 'shadowexpire') {
|
||||
if (!empty($entry[$attribute][0])) {
|
||||
$time = new DateTime('@' . $entry[$attribute][0] * 24 * 3600, getTimeZone());
|
||||
echo $time->format('d.m.Y');
|
||||
return new htmlOutputText($time->format('d.m.Y'));
|
||||
}
|
||||
}
|
||||
elseif ($attribute == 'sambakickofftime') {
|
||||
if (!empty($entry[$attribute][0])) {
|
||||
if ($entry[$attribute][0] > 2147483648) {
|
||||
echo "∞";
|
||||
return new htmlOutputText("∞");
|
||||
}
|
||||
else {
|
||||
$date = new DateTime('@' . $entry[$attribute][0], new DateTimeZone('UTC'));
|
||||
echo $date->format('d.m.Y');
|
||||
return new htmlOutputText($date->format('d.m.Y'));
|
||||
}
|
||||
}
|
||||
}
|
||||
// account status
|
||||
elseif ($attribute == self::ATTR_ACCOUNT_STATUS) {
|
||||
$this->printAccountStatus($entry);
|
||||
return $this->getAccountStatus($entry);
|
||||
}
|
||||
// print all other attributes
|
||||
else {
|
||||
parent::listPrintTableCellContent($entry, $attribute);
|
||||
return parent::getTableCellContent($entry, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1040,11 +1035,12 @@ class lamUserList extends lamList {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prints the account status.
|
||||
* Returns the account status.
|
||||
*
|
||||
* @param array $attrs LDAP attributes
|
||||
* @return htmlElement content
|
||||
*/
|
||||
private function printAccountStatus(&$attrs) {
|
||||
private function getAccountStatus(&$attrs) {
|
||||
// check status
|
||||
$unixAvailable = self::isUnixAvailable($attrs);
|
||||
$sambaAvailable = self::isSambaAvailable($attrs);
|
||||
|
@ -1144,10 +1140,10 @@ class lamUserList extends lamList {
|
|||
$tipContent .= '<tr><td>' . _('Password expired') . ' </td><td><img height=16 width=16 src="../../graphics/lock.png"></td></tr>';
|
||||
}
|
||||
$tipContent .= '</table>';
|
||||
echo '<img helptitle="' . _('Account status') . '" helpdata="' . $tipContent . '" alt="status" height=16 width=16 src="../../graphics/' . $icon . '">';
|
||||
return new htmlOutputText('<img helptitle="' . _('Account status') . '" helpdata="' . $tipContent . '" alt="status" height=16 width=16 src="../../graphics/' . $icon . '">', false);
|
||||
}
|
||||
else {
|
||||
echo '<img alt="status" height=16 width=16 src="../../graphics/' . $icon . '">';
|
||||
return new htmlImage('../../graphics/' . $icon, 16, 16, 'status');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -507,6 +507,10 @@ input.markOk {
|
|||
.sortableList li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; }
|
||||
.sortableList li span { position: absolute; margin-left: -1.3em; }
|
||||
|
||||
.strike-through {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* table style for delete.php
|
||||
|
|
|
@ -61,6 +61,11 @@ div.lam-dialog-msg {
|
|||
margin: 10px;
|
||||
}
|
||||
|
||||
div.dialog-content {
|
||||
overflow: visible !important;
|
||||
margin: 2rem;
|
||||
}
|
||||
|
||||
table.padding5 td {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
@ -73,11 +78,15 @@ table.responsive-table {
|
|||
margin-top: 1rem;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.responsive-table th {
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
padding-bottom: 0.5rem;
|
||||
padding-top: 0.5rem;
|
||||
padding-right: 0.3rem;
|
||||
padding-left: 0.3rem;
|
||||
}
|
||||
|
||||
table.responsive-table td {
|
||||
|
@ -85,8 +94,8 @@ table.responsive-table td {
|
|||
vertical-align: top;
|
||||
padding-bottom: 0.5rem;
|
||||
padding-top: 0.5rem;
|
||||
padding-right: 0.1rem;
|
||||
padding-left: 0.1rem;
|
||||
padding-right: 0.3rem;
|
||||
padding-left: 0.3rem;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
@ -145,6 +154,10 @@ table.responsive-table td {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fullwidth-mobile-only {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* tablet */
|
||||
|
|
|
@ -62,23 +62,6 @@ function listPageNumberKeyPress(url, e) {
|
|||
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.
|
||||
*/
|
||||
function listResizeITabContentDiv() {
|
||||
var myDiv = document.getElementById("listTabContentArea");
|
||||
var height = document.documentElement.clientHeight;
|
||||
height -= myDiv.offsetTop;
|
||||
height -= 105;
|
||||
myDiv.style.height = height +"px";
|
||||
|
||||
var myDivScroll = document.getElementById("listScrollArea");
|
||||
var top = myDivScroll.offsetTop;
|
||||
var scrollHeight = height - (top - myDiv.offsetTop);
|
||||
myDivScroll.style.height = scrollHeight + "px";
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows the dialog to change the list settings.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue