limit size of first column in account list

This commit is contained in:
Roland Gruber 2019-03-25 20:18:14 +01:00
parent 25539ee021
commit c253c67af5
2 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,7 @@
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2010 - 2018 Roland Gruber
Copyright (C) 2010 - 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
@ -4808,6 +4808,11 @@ class htmlResponsiveTable extends htmlElement {
return $return;
}
/**
* Sets the width of each column.
*
* @param string[] $widths widths
*/
public function setWidths($widths) {
$this->widths = $widths;
}

View File

@ -409,6 +409,15 @@ class lamList {
$table->setCSSClasses(array($scope . '-border accountlist'));
$table->setOnClickEvents($onClickEvents);
$table->setOnDoubleClickEvents($onDoubleClickEvents);
$columnCount = sizeof($titles);
if ((100 / $columnCount) > 12) {
$widths = array('12%');
for ($i = 1; $i < ($columnCount - 1); $i++) {
$widths[] = floor((100 - 12) / ($columnCount - 1)) . '%';
}
$widths[] = ceil((100 - 12) / ($columnCount - 1)) . '%';
$table->setWidths($widths);
}
parseHtml(null, $table, array(), false, $this->tabindex, $scope);
}