new configuration system for the account lists

This commit is contained in:
Roland Gruber 2007-11-11 14:01:16 +00:00
parent 19c08dc374
commit ce214c9885
5 changed files with 351 additions and 133 deletions

View File

@ -1,5 +1,6 @@
??? 2.2.0
- allow to switch sorting in the account lists
- account lists: allow to switch sorting
- account lists: added separate configuration page and store settings in cookies
- use suffix from account list as default for new accounts (patch 1823583)
- Security: passwords in configuration files are now saved as hash values
- Unix: allow to set host passwords (RFE 1754069)

View File

@ -1,19 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>Upgrade nores</title>
<html><head><title>Upgrade nores</title>
<link rel="stylesheet" type="text/css" href="style/layout.css">
</head>
<link rel="stylesheet" type="text/css" href="style/layout.css"></head>
<body>
<div style="text-align: center;">
<h1>Upgrade notes</h1></div>
<h2>2.1.0 -&gt; 2.2.0</h2>
Account lists now support to define tools. These are displayed as linked images like the edit and delete links in the list.<br>
Overwrite <span style="font-weight: bold;">lamList::getAdditionalTools()</span> to use this feature.<br>
<br>
The definition of account list options changed. The function <span style="font-weight: bold;">lamList::getAdditionalTools()</span> is no longer available. Use these functions instead: <span style="font-weight: bold;">lamList::listGetAllConfigOptions()</span> and <span style="font-weight: bold;">lamList::listConfigurationChanged()</span>.<br>
All options are now saved in cookies for one year.<br>
<br>
<h2>2.0.0 -&gt; 2.1.0</h2>
<span style="font-weight: bold;">Style changes:</span><br>
@ -34,8 +35,13 @@ LAM is now PHP5 only. Several variables are now private and need to be accessed
<h2>1.2.0 -&gt; 1.3.0</h2>
<span style="font-weight: bold;">New lamList function:</span><br>
<ul>
<li><span style="font-weight: bold;">listPrintTableCellContent():</span> This function allows you to control how the LDAP attributes are displayed in the table. This can be used to display links or binary data.</li>
<li><span style="font-weight: bold;">listPrintAdditionalOptions():</span> If you want to display additional conrols for a list please use this function. The controls will be placed under the account table.<br>
<li><span style="font-weight: bold;">listPrintTableCellContent():</span>
This function allows you to control how the LDAP attributes are
displayed in the table. This can be used to display links or binary
data.</li>
<li><span style="font-weight: bold;">listPrintAdditionalOptions():</span>
If you want to display additional conrols for a list please use this
function. The controls will be placed under the account table.<br>
</li>
</ul>
No more lamdaemon commands via delete_attributes() and save_attributes() in account modules.<br>
@ -57,7 +63,10 @@ Please use these new functions to call lamdaemon directly:<br>
<span style="font-weight: bold;">API changes:</span><br>
<ul>
<li>removed $post parameters from module functions (delete_attributes(), process_...(), display_html_...()). Use $_POST instead.</li>
<li>process_...() functions: returned messages are no longer grouped (e.g. return: array(array('INFO', 'headline', 'text'), array('INFO', 'headline2', 'text2')))</li>
<li>process_...()
functions: returned messages are no longer grouped (e.g. return:
array(array('INFO', 'headline', 'text'), array('INFO', 'headline2',
'text2')))</li>
</ul>
<br>
<h2>1.0.0 -&gt; 1.0.2</h2>

View File

@ -47,19 +47,19 @@ include_once("pdf.inc");
class lamList {
/** Account type */
var $type;
protected $type;
/** current page number */
var $page = 1;
protected $page = 1;
/** list of LDAP attributes */
var $attrArray = array();
protected $attrArray = array();
/** list of attribute descriptions */
var $descArray = array();
protected $descArray = array();
/** maximum count of entries per page */
var $maxPageEntries = 10;
protected $maxPageEntries = 10;
/** sort column name */
protected $sortColumn;
@ -68,22 +68,25 @@ class lamList {
protected $sortDirection = 1;
/** LDAP suffix */
var $suffix;
protected $suffix;
/** refresh page switch */
var $refresh = true;
protected $refresh = true;
/** LDAP entries */
var $entries;
protected $entries;
/** filter string to include in URL */
var $filterText;
protected $filterText;
/** list of possible LDAP suffixes(organizational units) */
var $possibleSuffixes;
protected $possibleSuffixes;
/** list of account specific labels */
var $labels;
protected $labels;
/** configuration options */
private $configOptions;
/**
* Constructor
@ -91,7 +94,7 @@ class lamList {
* @param string $type account type
* @return lamList list object
*/
function lamList($type) {
public function lamList($type) {
$this->type = $type;
$this->labels = array(
'nav' => _("%s object(s) found"),
@ -100,12 +103,44 @@ class lamList {
'deleteEntry' => _("Delete object"),
'createPDF' => _("Create PDF for selected object(s)"),
'createPDFAll' => _("Create PDF for all objects"));
$this->configOptions = $this->listGetAllConfigOptions();
$this->listReadOptionsFromCookie();
}
/**
* Reads the list options from the cookie value.
*/
private function listReadOptionsFromCookie() {
if (sizeof($this->configOptions) > 0) {
if (isset($_COOKIE["ListOptions_" . $this->type])) {
$cookieValue = $_COOKIE["ListOptions_" . $this->type];
$valueParts = explode(";", $cookieValue);
$values = array();
for ($i = 0; $i < sizeof($valueParts); $i++) {
$key_value = explode('=', $valueParts[$i]);
if (sizeof($key_value) == 2) {
$values[$key_value[0]] = $key_value[1];
}
}
for ($i = 0; $i < sizeof($this->configOptions); $i++) {
if (isset($values[$this->configOptions[$i]->getID()])) {
$this->configOptions[$i]->setValue($values[$this->configOptions[$i]->getID()]);
}
}
// notify subclasses
$this->listConfigurationChanged();
}
}
}
/**
* Prints the HTML code to display the list view.
*/
function showPage() {
public function showPage() {
if (isset($_GET['openConfig'])) {
$this->listPrintConfigurationPage();
return;
}
// do POST actions
$this->listDoPost();
// get some parameters
@ -142,8 +177,6 @@ class lamList {
// buttons
$this->listPrintButtons(false);
echo ("<br>\n");
// other options
$this->listPrintAdditionalOptions();
// PDF bar
$this->listPrintPDFButtons();
}
@ -157,11 +190,8 @@ class lamList {
// account table head
$this->listPrintTableHeader();
echo "</table><br>\n";
// other options
$this->listPrintAdditionalOptions();
}
echo ("</form>\n");
echo "</body></html>\n";
$this->listPrintFooter();
}
/**
@ -170,7 +200,7 @@ class lamList {
* @return array filter data array($attribute => array('regex' => $reg, 'original' => $orig))
* $reg is the regular expression to use, $orig the user's unmodified input string
*/
function listBuildFilter() {
protected function listBuildFilter() {
$filter = array();
// build filter array
for ($i = 0; $i < sizeof($this->attrArray); $i++) {
@ -214,7 +244,7 @@ class lamList {
*
* @return array filtered list of accounts
*/
function listFilterAccounts() {
protected function listFilterAccounts() {
$entries = array();
$filter = $this->listBuildFilter();
$attributes = array_keys($filter);
@ -249,7 +279,7 @@ class lamList {
* @param array $info the account list
* @return array sorted account list
*/
function listSort(&$info) {
protected function listSort(&$info) {
if (!is_array($this->attrArray)) return $info;
if (!is_string($this->sortColumn)) return $info;
// sort and return account list
@ -268,7 +298,7 @@ class lamList {
* @param array $b second row which is compared
* @return integer 0 if both are equal, 1 if $a is greater, -1 if $b is greater
*/
function cmp_array(&$a, &$b) {
protected function cmp_array(&$a, &$b) {
// sort specifies the sort column
$sort = $this->sortColumn;
// sort by first column if no attribute is given
@ -287,7 +317,7 @@ class lamList {
*
* @param integer $count number of account entries
*/
function listDrawNavigationBar($count) {
protected function listDrawNavigationBar($count) {
echo("<table class=\"" . $this->type . "nav\" width=\"100%\" border=\"0\">\n");
echo("<tr>\n");
@ -326,7 +356,7 @@ class lamList {
/**
* Prints the attribute and filter row at the account table head
*/
function listPrintTableHeader() {
protected function listPrintTableHeader() {
// print table header
echo "<table rules=\"all\" class=\"" . $this->type . "list\" width=\"100%\">\n";
echo "<tr class=\"" . $this->type . "list-head\">\n<th width=22 height=34></th>\n<th></th>\n";
@ -378,7 +408,7 @@ class lamList {
*
* @param array $info entries
*/
function listPrintTableBody(&$info) {
protected function listPrintTableBody(&$info) {
// calculate which rows to show
$table_begin = ($this->page - 1) * $this->maxPageEntries;
if (($this->page * $this->maxPageEntries) > sizeof($info)) $table_end = sizeof($info);
@ -448,7 +478,7 @@ class lamList {
* @param array $entry LDAP attributes
* @param string $attribute attribute name
*/
function listPrintTableCellContent(&$entry, &$attribute) {
protected function listPrintTableCellContent(&$entry, &$attribute) {
// print all attribute entries seperated by "; "
if (isset($entry[$attribute]) && sizeof($entry[$attribute]) > 0) {
// delete "count" entry
@ -467,7 +497,7 @@ class lamList {
/**
* Manages all POST actions (e.g. button pressed) for the account lists.
*/
function listDoPost() {
private function listDoPost() {
// check if button was pressed and if we have to add/delete an account
if (isset($_POST['new']) || isset($_POST['del']) || isset($_POST['pdf']) || isset($_POST['pdf_all'])){
// add new account
@ -532,12 +562,26 @@ 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, $cookieValue, time()+60*60*24*365, "/");
// notify subclasses
$this->listConfigurationChanged();
}
}
}
/**
* Prints a combobox with possible sub-DNs.
*/
function listShowOUSelection() {
protected function listShowOUSelection() {
if (sizeof($this->possibleSuffixes) > 1) {
echo ("<b>" . _("Suffix") . ": </b>");
echo ("<select class=\"" . $this->type . "\" size=1 name=\"suffix\" onchange=\"listOUchanged()\">\n");
@ -557,7 +601,7 @@ class lamList {
*
* @param boolean $createOnly true if only the create button should be displayed
*/
function listPrintButtons($createOnly) {
protected function listPrintButtons($createOnly) {
echo "<table border=0 width=\"100%\">\n";
echo "<tr>\n";
echo "<td align=\"left\">\n";
@ -566,9 +610,14 @@ class lamList {
if (!$createOnly) {
echo ("<input class=\"" . $this->type . "\" type=\"submit\" name=\"del\" value=\"" . $this->labels['deleteEntry'] . "\">\n");
}
echo "&nbsp;&nbsp;&nbsp;";
$this->listShowOUSelection();
echo "</td>\n";
echo "<td align=\"right\">\n";
$this->listShowOUSelection();
echo '<a href="list.php?type=' . $this->type . '&amp;openConfig=1">';
echo '<img src="../../graphics/tools.png" alt="' . _('Change settings') . '" title="' . _('Change settings') . '">';
echo '&nbsp;' . _('Change settings');
echo '</a>';
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
@ -577,7 +626,7 @@ class lamList {
/**
* Prints the PDF button bar.
*/
function listPrintPDFButtons() {
protected function listPrintPDFButtons() {
echo "<fieldset class=\"" . $this->type . "edit\"><legend><b>PDF</b></legend>\n";
echo ("<b>" . _('PDF structure') . ":</b>&nbsp;&nbsp;<select name=\"pdf_structure\">\n");
$pdf_structures = getPDFStructureDefinitions($this->type);
@ -592,9 +641,9 @@ class lamList {
}
/**
* Prints the HTML head.
* Prints the HTML header.
*/
function listPrintHeader() {
protected function listPrintHeader() {
echo $_SESSION['header'];
echo "<title>Account list</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
@ -602,11 +651,19 @@ class lamList {
echo "</head><body>\n";
$this->listPrintJavaScript();
}
/**
* Prints the HTML footer.
*/
protected function listPrintFooter() {
echo ("</form>\n");
echo "</body></html>\n";
}
/**
* Prints JavaScript code needed for mouse-over effects.
*/
function listPrintJavaScript() {
protected function listPrintJavaScript() {
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo "<!--\n";
@ -651,7 +708,7 @@ class lamList {
*
* @return array attribute list
*/
function listGetAttributeDescriptionList() {
private function listGetAttributeDescriptionList() {
$ret = array();
$attr_string = $_SESSION["config"]->get_listAttributes($this->type);
$temp_array = explode(";", $attr_string);
@ -685,7 +742,7 @@ class lamList {
/**
* Sets some internal parameters.
*/
function listGetParams() {
protected function listGetParams() {
// get current page
if (isset($_GET["page"])) $this->page = $_GET["page"];
else $this->page = 1;
@ -729,7 +786,7 @@ class lamList {
/**
* Rereads the entries from LDAP.
*/
function listRefreshData() {
protected function listRefreshData() {
// configure search filter
$module_filter = get_ldap_filter($this->type); // basic filter is provided by modules
$filter = "(&" . $module_filter . ")";
@ -759,13 +816,6 @@ class lamList {
$this->possibleSuffixes = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($this->type));
}
/**
* Prints additional option fields for specific object types.
*/
function listPrintAdditionalOptions() {
// may be used by subclasses
}
/**
* Returns a list of lamListTool objects to display next to the edit/delete buttons.
*
@ -774,6 +824,63 @@ class lamList {
protected function getAdditionalTools() {
return array();
}
/**
* Returns a list of possible configuration options.
*
* @return array list of lamListOption objects
*/
protected function listGetAllConfigOptions() {
return array();
}
/**
* Prints the list configuration page.
*/
protected function listPrintConfigurationPage() {
$this->listPrintHeader();
echo '<h1 align="center">' . _('Change list settings') . "</h1>\n";
echo "<form action=\"list.php?type=" . $this->type . "&amp;norefresh=true\" method=\"post\">\n";
echo "<table class=\"" . $this->type . "list\" width=\"100%\">\n";
echo "<tr class=\"" . $this->type . "list\"><td>\n";
$tabindex = 0;
$tabindexLink = 0;
for ($i = 0; $i < sizeof($this->configOptions); $i++) {
parseHtml('none', $this->configOptions[$i]->getMetaHTML(), array(), true, $tabindex, $tabindexLink, $this->type);
}
echo "<br>";
echo "<input type=\"submit\" name=\"saveConfigOptions\" value=\"" . _('Ok') . "\">\n";
echo "<input type=\"submit\" name=\"cancelConfigOptions\" value=\"" . _('Cancel') . "\">\n";
echo "</td></tr></table>\n";
echo "</form>\n";
$this->listPrintFooter();
}
/**
* Returns the configuration option with the given ID.
*
* @param String $ID ID
*/
protected function listGetConfigOptionByID($ID) {
for ($i = 0; $i < sizeof($this->configOptions); $i++) {
if ($this->configOptions[$i]->getID() === $ID) {
return $this->configOptions[$i];
}
}
return null;
}
/**
* Called when the configuration options changed.
*/
protected function listConfigurationChanged() {
return;
}
}
@ -797,7 +904,7 @@ class lamListTool {
* @param String $target target page
* @return lamListTool tool object
*/
function lamListTool($name, $image, $target) {
public function lamListTool($name, $image, $target) {
$this->name = $name;
$this->image = $image;
$this->target = $target;
@ -809,7 +916,7 @@ class lamListTool {
*
* @return String image name
*/
function getImage() {
public function getImage() {
return $this->image;
}
@ -819,7 +926,7 @@ class lamListTool {
*
* @return String name
*/
function getName() {
public function getName() {
return $this->name;
}
@ -829,10 +936,138 @@ class lamListTool {
*
* @return String page file (e.g. 'mytool.php')
*/
function getLinkTarget() {
public function getLinkTarget() {
return $this->target;
}
}
/**
* Represents a list configuration option.
*
* @package lists
* @author Roland Gruber
*/
abstract class lamListOption {
private $ID;
private $value;
/**
* Creates a new config option.
*
* @param String $ID
* @return lamConfigOption config option
*/
public function lamConfigOption($ID) {
$this->ID = $ID;
}
/**
* Returns the option ID.
*
* @return String ID
*/
public function getID() {
return $this->ID;
}
/**
* Fills the config option from POST data.
*
* @return array list of StatusMessages (array(<type>, <head line>, <body>))
*/
public abstract function fillFromPostData();
/**
* Returns the option value. The value must not contain "=" and ";".
*
* @return String value
*/
public function getValue() {
return $this->value;
}
/**
* Sets the config option value. The value must not contain "=" and ";".
*
* @param String $value
*/
public function setValue($value) {
if ((strpos($value, '=') > -1) || (strpos($value, ';') > -1)) {
user_error("Invalid value for list option: " . $value, E_ERROR);
}
$this->value = $value;
}
/**
* Returns the meta HTML data to display this option.
*
* @return array meta HTML
*/
public abstract function getMetaHTML();
}
/**
* Boolean option for list configuration.
*
* @package lists
* @author Roland Gruber
*/
class lamBooleanListOption extends lamListOption {
private $name;
/**
* Creates a new boolean option.
*
* @param String $name name to show on config page
* @return lamBooleanListOption config option
*/
public function lamBooleanListOption($name, $ID) {
parent::lamConfigOption($ID);
$this->name = $name;
}
/**
* Returns if this option is selected.
*
* @return boolean true, if selected
*/
public function isSelected() {
return ($this->getValue() === "1");
}
/**
* 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("1");
}
else {
$this->setValue("0");
}
}
/**
* Returns the meta HTML data to display this option.
*
* @return array meta HTML
*/
public function getMetaHTML() {
$return = array();
$return[] = array(
array('kind' => 'input', 'name' => $this->getID(), 'type' => 'checkbox', 'checked' => $this->isSelected()),
array('kind' => 'text', 'text' => $this->name)
);
return $return;
}
}
?>

View File

@ -100,14 +100,13 @@ class group extends baseType {
class lamGroupList extends lamList {
/** Controls if include primary group members into group memebers */
private $include_primary = "";
private $use_primary = false;
/** Primary group members hash */
private $primary_hash = array();
/** Controls if primary group members needs refresh */
private $refresh_primary = false;
/** Controls if primary group members are using */
// This is here for future use with primary group members listing
private $use_primary = false;
/** ID for config option */
const TRANS_PRIMARY_OPTION_NAME = "LG_TP";
/**
* Constructor
@ -126,21 +125,6 @@ class lamGroupList extends lamList {
'createPDFAll' => _("Create PDF for all groups"));
}
/**
* Manages all POST actions (e.g. button pressed) for the account lists.
*/
function listDoPost() {
parent::listDoPost();
// check if list primary group members
if (isset($_POST['apply_group_addopts'])) {
$use_primary = $this->use_primary;
$this->include_primary = $_POST['addopts_include_primary'];
$this->groupSetUsePrimary();
if (!$use_primary && $this->use_primary)
$this->refresh_primary = true;
}
}
/**
* Sets some internal parameters.
*/
@ -148,27 +132,10 @@ class lamGroupList extends lamList {
parent::listGetParams();
// generate list primary group memebers
// after parent::listGetParams is $this->refresh set to correct value
if ($this->use_primary && !$this->refresh && ($this->refresh_primary || (sizeof($this->primary_hash) == 0)))
if ($this->include_primary && !$this->refresh && ($this->refresh_primary || (sizeof($this->primary_hash) == 0)))
$this->groupRefreshPrimary();
}
/**
* Prints additional option field for primary member display.
*/
function listPrintAdditionalOptions() {
parent::listPrintAdditionalOptions();
// show primary group members option
if (in_array("memberuid", $this->attrArray)) {
echo "<b>" . _("Show primary group members as normal group members") . ": </b>";
echo "<input class=\"" . $this->type . "\" type=\"checkbox\" name=\"addopts_include_primary\"";
if ($this->include_primary == "on")
echo " checked";
echo ">";
echo ("&nbsp;&nbsp;<input class=\"" . $this->type . "\" type=\"submit\" name=\"apply_group_addopts\" value=\"" . _("Apply") . "\">");
echo "</p>\n";
}
}
/**
* Prints the content of a cell in the account list for a given LDAP entry and attribute.
*
@ -244,7 +211,7 @@ class lamGroupList extends lamList {
*/
function listRefreshData() {
parent::listRefreshData();
if ($this->use_primary) {
if ($this->include_primary) {
$this->groupRefreshPrimary();
}
}
@ -285,12 +252,26 @@ class lamGroupList extends lamList {
}
/**
* Checks if primary group members should be included.
* Returns a list of possible configuration options.
*
* @return array list of lamListOption objects
*/
function groupSetUsePrimary() {
$this->use_primary = ($this->include_primary == "on");
protected function listGetAllConfigOptions() {
return array(new lamBooleanListOption(_('Show primary group members as normal group members'), self::TRANS_PRIMARY_OPTION_NAME));
}
/**
* Called when the configuration options changed.
*/
protected function listConfigurationChanged() {
$tpOption = $this->listGetConfigOptionByID(self::TRANS_PRIMARY_OPTION_NAME);
$use_primary = $this->include_primary;
$this->include_primary = $tpOption->isSelected();
if (!$use_primary && $this->include_primary) {
$this->refresh_primary = true;
}
}
}

View File

@ -111,13 +111,16 @@ class lamUserList extends lamList {
/** translates GID to group name */
private $trans_primary_hash = array();
/** ID for config option */
const TRANS_PRIMARY_OPTION_NAME = "LU_TP";
/**
* Constructor
*
* @param string $type account type
* @return lamList list object
*/
function lamUserList($type) {
public function lamUserList($type) {
parent::lamList($type);
$this->labels = array(
'nav' => _("%s user(s) found"),
@ -128,21 +131,10 @@ class lamUserList extends lamList {
'createPDFAll' => _("Create PDF for all users"));
}
/**
* Manages all POST actions (e.g. button pressed) for the account lists.
*/
function listDoPost() {
parent::listDoPost();
// check if primary group should be translated
if (isset($_POST['apply_trans_primary'])) {
$this->trans_primary = $_POST['trans_primary'];
}
}
/**
* Sets some internal parameters.
*/
function listGetParams() {
protected function listGetParams() {
parent::listGetParams();
// generate hash table for group translation
if ($this->trans_primary == "on" && !$this->refresh && (sizeof($this->trans_primary_hash) == 0)) {
@ -153,7 +145,7 @@ class lamUserList extends lamList {
/**
* Rereads the entries from LDAP.
*/
function listRefreshData() {
protected function listRefreshData() {
parent::listRefreshData();
if ($this->trans_primary == "on") {
$this->refreshPrimaryGroupTranslation();
@ -163,7 +155,7 @@ class lamUserList extends lamList {
/**
* Refreshes the GID to group name cache.
*/
function refreshPrimaryGroupTranslation() {
protected function refreshPrimaryGroupTranslation() {
$this->trans_primary_hash = array();
$grp_suffix = $_SESSION['config']->get_Suffix('group');
$filter = "objectClass=posixGroup";
@ -184,7 +176,7 @@ class lamUserList extends lamList {
* @param array $entry LDAP attributes
* @param string $attribute attribute name
*/
function listPrintTableCellContent(&$entry, &$attribute) {
protected function listPrintTableCellContent(&$entry, &$attribute) {
// check if there is something to display at all
if (!isset($entry[$attribute]) || !is_array($entry[$attribute]) || (sizeof($entry[$attribute]) < 1)) return;
if (isset($entry[$attribute]['count'])) unset($entry[$attribute]['count']);
@ -224,23 +216,6 @@ class lamUserList extends lamList {
}
}
/**
* Prints additional option fields for specific object types.
*/
function listPrintAdditionalOptions() {
// show translate GID to group name box if there is a column with gidnumber
if (in_array("gidnumber", $this->attrArray)) {
echo "<p align=\"left\">\n";
echo "<b>" . _("Translate GID number to group name") . ": </b>";
if ($this->trans_primary == "on") {
echo "<input class=\"" . $this->type . "\" type=\"checkbox\" name=\"trans_primary\" checked>";
}
else echo "<input class=\"" . $this->type . "\" type=\"checkbox\" name=\"trans_primary\">";
echo ("&nbsp;&nbsp;<input class=\"" . $this->type . "\" type=\"submit\" name=\"apply_trans_primary\" value=\"" . _("Apply") . "\">");
echo "</p>\n";
}
}
/**
* Returns a list of lamListTool objects to display next to the edit/delete buttons.
*
@ -256,6 +231,23 @@ class lamUserList extends lamList {
}
}
/**
* Returns a list of possible configuration options.
*
* @return array list of lamListOption objects
*/
protected function listGetAllConfigOptions() {
return array(new lamBooleanListOption(_('Translate GID number to group name'), self::TRANS_PRIMARY_OPTION_NAME));
}
/**
* Called when the configuration options changed.
*/
protected function listConfigurationChanged() {
$tpOption = $this->listGetConfigOptionByID(self::TRANS_PRIMARY_OPTION_NAME);
$this->trans_primary = $tpOption->isSelected();
}
}
?>