moved list size setting to new list configuration page

This commit is contained in:
Roland Gruber 2007-12-09 10:45:04 +00:00
parent fb8d08fbf8
commit e6a5a5ad28
10 changed files with 110 additions and 99 deletions

View File

@ -1,7 +1,9 @@
??? 2.2.0
- account lists: allow to switch sorting
- account lists: added separate configuration page and store settings in cookies
- account lists: new PDF buttons
- account lists:
-> allow to switch sorting
-> added separate configuration page and store settings in cookies
-> list size can now be set individually for each account type on the list configuration page
-> new PDF buttons
- use suffix from account list as default for new accounts (patch 1823583)
- Security: passwords in configuration files are now saved as hash values
- improved design

View File

@ -15,9 +15,6 @@ passwd: {SSHA}RjBruJcTxZEdcBjPQdRBkDaSQeY= iueleA==
# e.g. dc=yourdomain,dc=org
treesuffix: dc=yourdomain,dc=org
# maximum number of rows to show in user/group/host lists
maxlistentries: 30
# default language (a line from config/language)
defaultLanguage: en_GB.utf8:UTF-8:English (Great Britain)
@ -27,6 +24,9 @@ scriptPath:
# Server of external Script
scriptServer:
# Access rights for home directories
scriptRights: 750
# Number of minutes LAM caches LDAP searches.
cachetimeout: 5

View File

@ -1,17 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-15"
http-equiv="content-type">
<title>LAM - Account lists</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<body>
<html><head>
<meta content="text/html; charset=ISO-8859-15" http-equiv="content-type"><title>LAM - Account lists</title>
<link rel="stylesheet" type="text/css" href="style/layout.css"></head><body>
<h1 style="text-align: center;">Account lists</h1>
<br>
<div style="text-align: center;"><img
style="width: 496px; height: 177px;" alt="Account lists"
src="images/lam_lists.png"><br>
<div style="text-align: center;"><img style="width: 496px; height: 177px;" alt="Account lists" src="images/lam_lists.png"><br>
</div>
<br>
<br>
@ -21,17 +17,14 @@ list of found accounts which can be restricted by LDAP filters and the
LDAP OU (Organizational Unit).<br>
<br>
The list of LDAP attributes and thus table columns is taken from the
configuration profile (<span
style="font-weight: bold; font-style: italic;">get_...listAttributes()</span>
configuration profile (<span style="font-weight: bold; font-style: italic;">get_...listAttributes()</span>
in config.inc). Each account list has a separate list of attributes.<br>
Only these attributes are given the LDAP search as attribute parameter.<br>
There is also a predefined description list for the attributes in
lists.inc. The user may use other values by setting them in the
configuration profile.<br>
<br>
The number of accounts per page is limited in the configuration profile
(<span style="font-weight: bold; font-style: italic;">get_MaxListEntries()</span>
in config.inc). There will be links at the beginning and end of the
The number of accounts per page is limited by a list option. There will be links at the beginning and end of the
list if more accounts were found.<br>
<br>
Several common helper functions for sorting and some page elements
@ -40,8 +33,7 @@ reside in lists.inc.<br>
<h2>1. Getting accounts from LDAP</h2>
Each account list has its own LDAP suffix which is saved in the
configuration profile. This is used as search base.<br>
The account modules provide an LDAP filter (<span
style="font-weight: bold; font-style: italic;">get_ldap_filter()</span>
The account modules provide an LDAP filter (<span style="font-weight: bold; font-style: italic;">get_ldap_filter()</span>
in modules.inc) to get only accounts of a special type.<br>
<br>
This list can be further reduced if the user provides an additional
@ -78,8 +70,7 @@ clicking the row if Java Script is enabled.<br>
<br>
<br>
<h2>4. Export to PDF</h2>
The user can generate PDF files for the accounts. This is done by the <span
style="font-style: italic; font-weight: bold;">createModulePDF()</span>
The user can generate PDF files for the accounts. This is done by the <span style="font-style: italic; font-weight: bold;">createModulePDF()</span>
function from pdf.inc.<br>
<br>
<br>
@ -99,5 +90,4 @@ and redirects to account/edit.php for account modifying.<br>
<br>
<br>
<br>
</body>
</html>
</body></html>

View File

@ -90,8 +90,8 @@ $helpArray = array (
"<br><br><b>" .
_("Example") .
": </b>cn=admin,dc=yourdomain,dc=org;cn=manager,dc=yourdomain,dc=org"),
"208" => array ("ext" => "FALSE", "Headline" => _("Configuration wizard") . " - " . _("Maximum list entries"),
"Text" => _("This is the number of rows to show in the user/group/host list. If more entries are found the list will be split into several pages.")),
"208" => array ("ext" => "FALSE", "Headline" => _("Maximum list entries"),
"Text" => _("This is the number of rows to show in the account list. If more entries are found the list will be split into several pages.")),
"209" => array ("ext" => "FALSE", "Headline" => _("Configuration wizard") . " - " . _("Default language"),
"Text" => _("This defines the language of the login window and sets this language as the default language. Users can change the language at login.")),
"210" => array ("ext" => "FALSE", "Headline" => _("Configuration wizard") . " - " . _("Script path"),

View File

@ -175,9 +175,6 @@ class LAMConfig {
/** LDAP suffix for tree view */
var $treesuffix;
/** Maximum number of rows shown in user/group/host lists */
var $maxlistentries;
/** Default language */
var $defaultLanguage;
@ -218,7 +215,7 @@ class LAMConfig {
var $file;
/** List of all settings in config file */
private $settings = array("ServerURL", "Passwd", "Admins", "treesuffix", "maxlistentries",
private $settings = array("ServerURL", "Passwd", "Admins", "treesuffix",
"defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout",
"modules", "activeTypes", "types");
@ -357,7 +354,6 @@ class LAMConfig {
"# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Admins . "\n");
if (!in_array("treesuffix", $saved)) array_push($file_array, "\n\n# suffix of tree view\n" .
"# e.g. dc=yourdomain,dc=org\n" . "treesuffix: " . $this->treesuffix . "\n");
if (!in_array("maxlistentries", $saved)) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries . "\n");
if (!in_array("defaultLanguage", $saved)) array_push($file_array, "\n\n# default language (a line from config/language)\n" . "defaultLanguage: " . $this->defaultLanguage . "\n");
if (!in_array("scriptPath", $saved)) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\n");
if (!in_array("scriptServer", $saved)) array_push($file_array, "\n\n# Servers of external script\n" . "scriptServer: " . $this->scriptServer . "\n");
@ -580,27 +576,6 @@ class LAMConfig {
}
}
/**
* Returns the maximum number of rows in user/group/host lists
*
* @return integer maximum number
*/
public function get_MaxListEntries() {
return $this->maxlistentries;
}
/**
* Sets the maximum number of rows in user/group/host lists
*
* @param integer $value new maximum value
* @return boolean true if $value has correct format
*/
public function set_MaxListEntries ($value) {
if (is_numeric($value)) $this->maxlistentries = $value;
else return false;
return true;
}
/**
* Returns the default language string
*

View File

@ -59,7 +59,7 @@ class lamList {
protected $descArray = array();
/** maximum count of entries per page */
protected $maxPageEntries = 10;
protected $maxPageEntries = 30;
/** sort column name */
protected $sortColumn;
@ -88,6 +88,9 @@ class lamList {
/** configuration options */
private $configOptions;
/** ID for list size config option */
const LIST_SIZE_OPTION_NAME = "L_SIZE";
/**
* Constructor
*
@ -786,11 +789,6 @@ class lamList {
$temp_array = $this->listGetAttributeDescriptionList();
$this->attrArray = array_keys($temp_array); // list of LDAP attributes to show
$this->descArray = array_values($temp_array); // list of descriptions for the attributes
// get maximum count of entries shown on one page
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$this->maxPageEntries = 10; // default setting, if not yet set
else
$this->maxPageEntries = $_SESSION["config"]->get_MaxListEntries();
// get sorting column
if (isset($_GET["sort"])) {
if ($_GET["sort"] == $this->sortColumn) {
@ -867,7 +865,8 @@ class lamList {
* @return array list of lamListOption objects
*/
protected function listGetAllConfigOptions() {
return array();
$listSizeOption = new lamSelectListOption(_("Maximum list entries"), array(10, 20, 30, 50, 75, 100), self::LIST_SIZE_OPTION_NAME);
return array($listSizeOption);
}
/**
@ -886,7 +885,7 @@ class lamList {
$tabindex = 0;
$tabindexLink = 0;
for ($i = 0; $i < sizeof($this->configOptions); $i++) {
parseHtml('none', $this->configOptions[$i]->getMetaHTML(), array(), true, $tabindex, $tabindexLink, $this->type);
parseHtml('main', $this->configOptions[$i]->getMetaHTML(), array(), true, $tabindex, $tabindexLink, $this->type);
}
echo "<br>";
@ -916,6 +915,10 @@ class lamList {
* Called when the configuration options changed.
*/
protected function listConfigurationChanged() {
$sizeOption = $this->listGetConfigOptionByID(self::LIST_SIZE_OPTION_NAME);
if ($sizeOption->getValue() != null) {
$this->maxPageEntries = $sizeOption->getValue();
}
return;
}
@ -994,7 +997,7 @@ abstract class lamListOption {
/**
* Creates a new config option.
*
* @param String $ID
* @param String $ID unique ID
* @return lamConfigOption config option
*/
public function lamConfigOption($ID) {
@ -1061,6 +1064,7 @@ class lamBooleanListOption extends lamListOption {
* Creates a new boolean option.
*
* @param String $name name to show on config page
* @param String $ID unique ID
* @return lamBooleanListOption config option
*/
public function lamBooleanListOption($name, $ID) {
@ -1107,4 +1111,70 @@ class lamBooleanListOption extends lamListOption {
}
/**
* Boolean option for list configuration.
*
* @package lists
* @author Roland Gruber
*/
class lamSelectListOption extends lamListOption {
private $name;
private $options;
private $helpID;
/**
* Creates a new selection list option.
*
* @param String $name name to show on config page
* @param array $options list of possible values
* @param String $ID unique ID
* @return lamBooleanListOption config option
*/
public function lamSelectListOption($name, $options, $ID) {
parent::lamConfigOption($ID);
$this->name = $name;
$this->options = $options;
}
/**
* Sets the help ID.
*
* @param Strign $id help ID
*/
public function setHelpID($id) {
$this->helpID = $id;
}
/**
* Fills the config option from POST data.
*
* @return array list of StatusMessages (array(<type>, <head line>, <body>))
*/
public function fillFromPostData() {
if (isset($_POST[$this->getID()])) {
$this->setValue($_POST[$this->getID()]);
}
else {
$this->setValue(null);
}
}
/**
* Returns the meta HTML data to display this option.
*
* @return array meta HTML
*/
public function getMetaHTML() {
$return = array();
$return[] = array(
array('kind' => 'text', 'text' => $this->name),
array('kind' => 'select', 'name' => $this->getID(), 'options' => $this->options, 'options_selected' => array($this->getValue())),
array('kind' => 'help', 'value' => '208')
);
return $return;
}
}
?>

View File

@ -257,13 +257,16 @@ class lamGroupList extends lamList {
* @return array list of lamListOption objects
*/
protected function listGetAllConfigOptions() {
return array(new lamBooleanListOption(_('Show primary group members as normal group members'), self::TRANS_PRIMARY_OPTION_NAME));
$options = parent::listGetAllConfigOptions();
$options[] = new lamBooleanListOption(_('Show primary group members as normal group members'), self::TRANS_PRIMARY_OPTION_NAME);
return $options;
}
/**
* Called when the configuration options changed.
*/
protected function listConfigurationChanged() {
parent::listConfigurationChanged();
$tpOption = $this->listGetConfigOptionByID(self::TRANS_PRIMARY_OPTION_NAME);
$use_primary = $this->include_primary;
$this->include_primary = $tpOption->isSelected();

View File

@ -237,13 +237,16 @@ class lamUserList extends lamList {
* @return array list of lamListOption objects
*/
protected function listGetAllConfigOptions() {
return array(new lamBooleanListOption(_('Translate GID number to group name'), self::TRANS_PRIMARY_OPTION_NAME));
$options = parent::listGetAllConfigOptions();
$options[] = new lamBooleanListOption(_('Translate GID number to group name'), self::TRANS_PRIMARY_OPTION_NAME);
return $options;
}
/**
* Called when the configuration options changed.
*/
protected function listConfigurationChanged() {
parent::listConfigurationChanged();
$tpOption = $this->listGetConfigOptionByID(self::TRANS_PRIMARY_OPTION_NAME);
$this->trans_primary = $tpOption->isSelected();
}

View File

@ -253,31 +253,6 @@ for ($i = 0; $i < sizeof($modules); $i++) {
}
echo ("<fieldset><legend><b>" . _("List settings") . "</b></legend>\n");
echo ("<table border=0>\n");
// maximum list entries
echo ("<tr><td align=\"right\"><b>".
_("Maximum list entries") . ": </b></td>".
"<td><select tabindex=\"$tabindex\" name=\"maxlistentries\">\n<option selected>".$conf->get_MaxListEntries()."</option>\n");
if ($conf->get_MaxListEntries() != 10) echo("<option>10</option>\n");
if ($conf->get_MaxListEntries() != 20) echo("<option>20</option>\n");
if ($conf->get_MaxListEntries() != 30) echo("<option>30</option>\n");
if ($conf->get_MaxListEntries() != 50) echo("<option>50</option>\n");
if ($conf->get_MaxListEntries() != 75) echo("<option>75</option>\n");
if ($conf->get_MaxListEntries() != 100) echo("<option>100</option>\n");
echo ("</select></td>\n");
$tabindex++;
echo "<td>";
echo "<a href=\"../help.php?HelpNumber=208\" target=\"lamhelp\">";
echo "<img src=\"../../graphics/help.png\" alt=\"" . _('Help') . "\" title=\"" . _('Help') . "\">";
echo "</a>\n";
echo "</td></tr>\n";
echo ("</table>\n");
echo ("</fieldset>\n");
echo ("<p></p>\n");
echo ("<fieldset><legend><b>" . _("Language settings") . "</b></legend>\n");
echo ("<table border=0>\n");
@ -498,9 +473,6 @@ function saveSettings() {
if (!$conf->set_Suffix("tree", $_POST['sufftree'])) {
$errors[] = array("ERROR", _("TreeSuffix is invalid!"));
}
if (!$conf->set_MaxListEntries($_POST['maxlistentries'])) {
$errors[] = array("ERROR", _("Max list entries is invalid!"));
}
if (!$conf->set_defaultLanguage($_POST['lang'])) {
$errors[] = array("ERROR", _("Language is not defined!"));
}

View File

@ -47,7 +47,6 @@ $Suff_domains = $conf->get_Suffix('smbDomain');
$userlistAttributes = $conf->get_listAttributes('user');
$grouplistAttributes = $conf->get_listAttributes('group');
$hostlistAttributes = $conf->get_listAttributes('host');
$maxlistentries = $conf->get_maxlistentries();
$defaultlanguage = $conf->get_defaultlanguage();
$scriptpath = $conf->get_scriptPath();
$scriptServer = $conf->get_scriptServers();
@ -67,7 +66,6 @@ $conf->set_Suffix('smbDomain', "ou=testdom,o=test,c=de");
$conf->set_listAttributes("#uid;#cn", 'user');
$conf->set_listAttributes("#gidNumber;#cn;#memberUID", 'group');
$conf->set_listAttributes("#cn;#uid;#description", 'host');
$conf->set_maxlistentries("54");
$conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)");
$conf->set_scriptPath("/var/www/lam/lib/script");
$conf->set_scriptServers("127.0.0.1");
@ -89,7 +87,6 @@ if ($conf2->get_Suffix('smbDomain') != "ou=testdom,o=test,c=de") echo ("<br><fon
if ($conf2->get_listAttributes('user') != "#uid;#cn") echo ("<br><font color=\"#FF0000\">Saving userlistAttributes failed!</font><br>");
if ($conf2->get_listAttributes('group') != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>");
if ($conf2->get_listAttributes('host') != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>");
if ($conf2->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>");
if ($conf2->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("<br><font color=\"#FF0000\">Saving default language failed!</font><br>");
if ($conf2->get_scriptPath() != "/var/www/lam/lib/script") echo ("<br><font color=\"#FF0000\">Saving script path failed!</font><br>");
if ($conf2->get_scriptServers() != "127.0.0.1") echo ("<br><font color=\"#FF0000\">Saving script server failed!</font><br>");
@ -110,7 +107,6 @@ $conf2->set_Suffix('smbDomain', $Suff_domains);
$conf2->set_listAttributes($userlistAttributes, 'user');
$conf2->set_listAttributes($grouplistAttributes, 'group');
$conf2->set_listAttributes($hostlistAttributes, 'host');
$conf2->set_maxlistentries($maxlistentries);
$conf2->set_defaultLanguage($defaultlanguage);
$conf2->set_scriptPath($scriptpath);
$conf2->set_scriptServers($scriptServer);