From 25ff82f5456f18c1932e89127a2f73ad60d487e6 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 11 Jul 2015 09:50:00 +0000 Subject: [PATCH] added PDFTable --- lam/lib/account.inc | 2 +- lam/lib/modules/fixed_ip.inc | 103 ++++++++++++++-------------- lam/lib/modules/kolabUser.inc | 26 ++++--- lam/lib/modules/nisNetGroupUser.inc | 47 +++++++------ lam/lib/modules/nisnetgroup.inc | 46 ++++++------- lam/lib/modules/puppetClient.inc | 38 +++++----- lam/lib/modules/pykotaUser.inc | 73 ++++++++++---------- lam/lib/modules/quota.inc | 71 ++++++++++--------- lam/lib/modules/range.inc | 100 +++++++++++++++++---------- lam/lib/modules/systemQuotas.inc | 45 ++++++------ lam/lib/modules/windowsGroup.inc | 64 +++++++++-------- 11 files changed, 339 insertions(+), 276 deletions(-) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 022b4140..56097a9e 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -988,7 +988,7 @@ function extractRDNAttribute($dn) { * @return String RDN attribute value */ function extractRDNValue($dn) { - if ($dn == null) return null; + if (empty($dn)) return null; $parts = explode("=", substr($dn, 0, strpos($dn, ','))); return $parts[1]; } diff --git a/lam/lib/modules/fixed_ip.inc b/lam/lib/modules/fixed_ip.inc index f5837acb..56685f35 100644 --- a/lam/lib/modules/fixed_ip.inc +++ b/lam/lib/modules/fixed_ip.inc @@ -42,25 +42,25 @@ class fixed_ip extends baseModule { /** fixed ips */ public $fixed_ip = array(); - + /** already processed? */ public $processed = false; /** for check if IPs overlap */ public $overlapd; - + /** original IPs */ public $orig_ips = array(); - + /** LDAP attributes */ public $attributes; - + /** cached host entries (list of array('cn' => ..., 'iphostnumber' => ..., 'macaddress' => ...)) */ private $hostCache = null; /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -71,7 +71,7 @@ class fixed_ip extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ public function get_metaData() { @@ -119,14 +119,14 @@ class fixed_ip extends baseModule { $return['PDF_fields'] = array('IPlist' => _('IP list')); return $return; } - + /** * This function fills the error message array with messages. */ public function load_Messages() { $this->messages['errors'][0] = array('ERROR', _('One or more errors occured. The invalid fields are marked.'), ''); } - + /** * Controls if the module button the account page is visible and activated. * @@ -167,7 +167,7 @@ class fixed_ip extends baseModule { public function reset_overlapd_ip() { $this->overlapd = array(); } - + /** * * Check, if a mac address is invalid @@ -189,7 +189,7 @@ class fixed_ip extends baseModule { } return $invalid; } - + /** * * Adapt the fixed ip with the subnet. @@ -217,7 +217,7 @@ class fixed_ip extends baseModule { } return $ip_edit; } - + /** * This function loads all needed LDAP attributes. * @@ -244,7 +244,7 @@ class fixed_ip extends baseModule { $description = $entries[$i]['dhcpcomments'][0]; } $this->fixed_ip[$i]['description'] = $description; - + $this->orig_ips[$i]['cn'] = $entries[$i]['cn'][0]; $this->orig_ips[$i]['mac'] = $dhcphwaddress; $this->orig_ips[$i]['ip'] = self::extractIP($dhcpstatements); @@ -275,7 +275,7 @@ class fixed_ip extends baseModule { } $this->fixed_ip = $newVal; } - + /** * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. @@ -316,7 +316,7 @@ class fixed_ip extends baseModule { $error = true; } $this->fixed_ip[$id]['description'] = $_POST['description_'.$id]; - + // active $this->fixed_ip[$id]['active'] = (isset($_POST['active_' . $id]) && ($_POST['active_' . $id] == 'on')); @@ -389,13 +389,13 @@ class fixed_ip extends baseModule { $this->orderByIP(); } } - + return $errors; } - + /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ public function display_html_attributes() { @@ -474,7 +474,7 @@ class fixed_ip extends baseModule { elseif ($this->check_mac($this->fixed_ip[$id]['mac'])) { $macError = _("Invalid MAC address."); } - + // descripton $descriptionError = ""; if (!$this->processed) { @@ -483,7 +483,7 @@ class fixed_ip extends baseModule { elseif (!get_preg($this->fixed_ip[$id]['description'], 'ascii')) { $descriptionError = _("Invalid description."); } - + // fixed ip $ipError = ""; if (!$this->processed || ($this->fixed_ip[$id]['ip'] == '')) { @@ -492,7 +492,7 @@ class fixed_ip extends baseModule { elseif (!check_ip($this->fixed_ip[$id]['ip'])) { $ipError = _("The IP address is invalid."); } - elseif (!range::check_subnet_range($this->fixed_ip[$id]['ip'], + elseif (!range::check_subnet_range($this->fixed_ip[$id]['ip'], $this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes['cn'][0], $this->getAccountContainer()->getAccountModule('dhcp_settings')->getDHCPOption('subnet-mask'))) { $ipError = _("The IP address does not match the subnet."); @@ -537,7 +537,7 @@ class fixed_ip extends baseModule { $return->addElement(new htmlInputField('description_add', '', 20)); $return->addElement(new htmlInputCheckbox('active_add', true)); $return->addElement(new htmlButton('add_ip', 'add.png', true), true); - + // add existing host entry if (!empty($this->hostCache)) { $return->addVerticalSpace('20px'); @@ -548,10 +548,10 @@ class fixed_ip extends baseModule { } return $return; } - + /** * Returns the HTML meta data for the add host page. - * + * * @return htmlElement HTML meta data */ public function display_html_addHost() { @@ -614,7 +614,7 @@ class fixed_ip extends baseModule { } return $errors; } - + /** * Returns a list of modifications which have to be made to the LDAP account. * @@ -630,10 +630,10 @@ class fixed_ip extends baseModule { public function save_attributes() { } - + /** * This function is overwritten because the fixed IPs are set after the ldap_add command. - * + * * @see baseModule::postModifyActions() * * @param boolean $newAccount @@ -736,14 +736,14 @@ class fixed_ip extends baseModule { function get_pdfEntries($pdfKeys) { $return = array(); if (is_array($this->fixed_ip) && (sizeof($this->fixed_ip) > 0)) { - $return[get_class($this) . '_IPlist'] = array( - '' . - '' . _('PC name') . "" . - "" . _('IP address') . "" . - "" . _('MAC address') . '' . - "" . _('Active') . '' . - "" . _('Description') . '' . - ''); + $pdfTable = new PDFTable(); + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('PC name'), '20%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('IP address'), '20%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('MAC address'), '20%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Active'), '10%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Description'), '30%', null, true); + $pdfTable->rows[] = $pdfRow; for ($i = 0; $i < sizeof($this->fixed_ip); $i++) { $name = $this->fixed_ip[$i]['cn']; $mac = $this->fixed_ip[$i]['mac']; @@ -753,21 +753,22 @@ class fixed_ip extends baseModule { $active = _('no'); } $description = $this->fixed_ip[$i]['description']; - $return[get_class($this) . '_IPlist'][] = '' . - '' . $name . "" . - "" . $ip . " " . - "" . $mac . ''. - "" . $active . ''. - "" . $description . ' '. - ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($name, '20%'); + $pdfRow->cells[] = new PDFTableCell($ip, '20%'); + $pdfRow->cells[] = new PDFTableCell($mac, '20%'); + $pdfRow->cells[] = new PDFTableCell($active, '10%'); + $pdfRow->cells[] = new PDFTableCell($description, '30%'); + $pdfTable->rows[] = $pdfRow; } + $this->addPDFTable($return, 'IPlist', $pdfTable); } return $return; } - + /** * Extracts the IP from a list of DHCP statements. - * + * * @param array $dhcpStatements values of dhcpStatements attribute */ public static function extractIP($dhcpStatements) { @@ -782,10 +783,10 @@ class fixed_ip extends baseModule { } return $return; } - + /** * Sets the IP in a list of DHCP statements. - * + * * @param array $dhcpStatements values of dhcpStatements attribute * @param String $ip new IP */ @@ -800,10 +801,10 @@ class fixed_ip extends baseModule { $dhcpStatements[] = 'fixed-address ' . $ip; } } - + /** * Returns if this host is active. - * + * * @param array $dhcpStatements values of dhcpStatements attribute */ public static function isActive($dhcpStatements) { @@ -820,10 +821,10 @@ class fixed_ip extends baseModule { } return true; } - + /** * Sets if this host is active. - * + * * @param array $dhcpStatements values of dhcpStatements attribute * @param boolean $active is active */ @@ -841,7 +842,7 @@ class fixed_ip extends baseModule { $dhcpStatements[] = 'deny booting'; } } - + /** * Loads cached host data from LDAP. */ @@ -856,7 +857,7 @@ class fixed_ip extends baseModule { $this->hostCache[] = $attributes; } } - + } ?> diff --git a/lam/lib/modules/kolabUser.inc b/lam/lib/modules/kolabUser.inc index 12aadd2d..965921db 100644 --- a/lam/lib/modules/kolabUser.inc +++ b/lam/lib/modules/kolabUser.inc @@ -58,7 +58,7 @@ class kolabUser extends baseModule { /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -69,7 +69,7 @@ class kolabUser extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ function get_metaData() { @@ -260,7 +260,7 @@ class kolabUser extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ function display_html_attributes() { @@ -507,7 +507,7 @@ class kolabUser extends baseModule { /** * This function will create the meta HTML code to show a page to mark an account for deletion. - * + * * @return htmlElement HTML meta data */ function display_html_deleteUser() { @@ -754,13 +754,19 @@ class kolabUser extends baseModule { break; } } - $return['kolabUser_invPol'][0] = '' . _('Invitation policy') . '' . _('Anyone') . ": " . $this->invitationPolicies[$default] . ''; + $pdfTable = new PDFTable(_('Invitation policy')); + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('Anyone') . ": " . $this->invitationPolicies[$default]); + $pdfTable->rows[] = $pdfRow; for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) { $parts = explode(':', $this->attributes['kolabInvitationPolicy'][$i]); if (sizeof($parts) == 2) { - $return['kolabUser_invPol'][] = '' . $parts[0] . ": " . $this->invitationPolicies[$parts[1]] . ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($parts[0] . ": " . $this->invitationPolicies[$parts[1]]); + $pdfTable->rows[] = $pdfRow; } } + $this->addPDFTable($return, 'invPol', $pdfTable); } $this->addSimplePDFField($return, 'aliases', _('Email aliases'), 'alias'); $this->addSimplePDFField($return, 'delegate', _('Delegates'), 'kolabDelegate'); @@ -900,7 +906,7 @@ class kolabUser extends baseModule { *
del: array of attributes to remove *
mod: array of attributes to modify *
info: array of values with informational value (e.g. to be used later by pre/postModify actions) - * + * * Calling this method does not require the existence of an enclosing {@link accountContainer}. * * @param string $fields input fields @@ -1013,10 +1019,10 @@ class kolabUser extends baseModule { } return $return; } - + /** * Returns if the object class "mailrecipient" is managed by this module. - * + * * @return boolean manage mailrecipient object class */ private function manageMailrecipient() { @@ -1028,7 +1034,7 @@ class kolabUser extends baseModule { return false; } return true; - + } } diff --git a/lam/lib/modules/nisNetGroupUser.inc b/lam/lib/modules/nisNetGroupUser.inc index 40c218c6..6ce53396 100644 --- a/lam/lib/modules/nisNetGroupUser.inc +++ b/lam/lib/modules/nisNetGroupUser.inc @@ -43,10 +43,10 @@ class nisNetGroupUser extends baseModule { private $groupCache = null; /** original uid */ private $uidOrig = null; - + /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -57,7 +57,7 @@ class nisNetGroupUser extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ public function get_metaData() { @@ -86,7 +86,7 @@ class nisNetGroupUser extends baseModule { ); return $return; } - + /** * This function fills the $messages variable with output messages from this module. */ @@ -176,7 +176,7 @@ class nisNetGroupUser extends baseModule { $return->addElement($delButton, true); } $return->addVerticalSpace('40px'); - + // new entry $groupList = array(); $groupData = $this->findGroups(); @@ -188,7 +188,7 @@ class nisNetGroupUser extends baseModule { $filter->setOnKeyUp('filterSelect(\'group_filter\', \'group_add\', event);'); $filterGroup->addElement($filter); $return->addElement($filterGroup, true); - + foreach ($groupData as $group) { $groupList[$group['cn'][0]] = $group['cn'][0] . '#+#' . $group['dn']; } @@ -258,10 +258,10 @@ class nisNetGroupUser extends baseModule { usort($this->groups, array($this, 'sortTriple')); return $errors; } - + /** * Returns the user ID for this user. - * + * * @return String user ID */ private function getUid() { @@ -280,7 +280,7 @@ class nisNetGroupUser extends baseModule { /** * Runs the postmodify actions. - * + * * @see baseModule::postModifyActions() * * @param boolean $newAccount @@ -356,7 +356,7 @@ class nisNetGroupUser extends baseModule { } return $messages; } - + /** * Additional LDAP operations on delete. * @@ -449,15 +449,20 @@ class nisNetGroupUser extends baseModule { */ function get_pdfEntries($pdfKeys) { $return = array(); - $return[get_class($this) . '_memberships'][0] = '' - . '' . _('Group') . '' - . '' . _('Host name') . '' - . '' . _('Domain name') . ''; + $pdfTable = new PDFTable(); + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('Group'), '25%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Host name'), '25%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Domain name'), '25%', null, true); + $pdfTable->rows[] = $pdfRow; foreach ($this->groups as $group) { - $return[get_class($this) . '_memberships'][] = '' . $group['name'] . '' - . '' . $group['host'] . ' ' - . '' . $group['domain'] . ' '; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($group['name'], '25%'); + $pdfRow->cells[] = new PDFTableCell($group['host'], '25%'); + $pdfRow->cells[] = new PDFTableCell($group['domain'], '25%'); + $pdfTable->rows[] = $pdfRow; } + $this->addPDFTable($return, 'memberships', $pdfTable); return $return; } @@ -609,7 +614,7 @@ class nisNetGroupUser extends baseModule { $typeFilter = '(' . $typeFilter . ')'; } $filter = '(&' . $filter . $typeFilter . ')'; - } + } $results = searchLDAPByFilter($filter, array('cn', 'dn', 'nisnetgrouptriple'), array($type)); for ($i = 0; $i < sizeof($results); $i++) { if (isset($results[$i]['cn'][0]) && isset($results[$i]['dn'])) { @@ -621,10 +626,10 @@ class nisNetGroupUser extends baseModule { $this->groupCache = $return; return $return; } - + /** * Sorts NIS netgroup triples by group, host and domain. - * + * * @param array $first first array * @param array $second second array */ @@ -637,7 +642,7 @@ class nisNetGroupUser extends baseModule { } return strnatcasecmp($first['domain'], $second['domain']); } - + } ?> diff --git a/lam/lib/modules/nisnetgroup.inc b/lam/lib/modules/nisnetgroup.inc index c1baefb5..160c424f 100644 --- a/lam/lib/modules/nisnetgroup.inc +++ b/lam/lib/modules/nisnetgroup.inc @@ -34,7 +34,7 @@ $Id$ * @package modules */ class nisnetgroup extends baseModule { - + /* caches to reduce LDAP queries */ /** user cache */ private $cachedUserList = null; @@ -42,10 +42,10 @@ class nisnetgroup extends baseModule { private $cachedHostList = null; /** group cache */ private $cachedGroupList = null; - + /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -56,7 +56,7 @@ class nisnetgroup extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ function get_metaData() { @@ -182,7 +182,7 @@ class nisnetgroup extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ function display_html_attributes() { @@ -282,7 +282,7 @@ class nisnetgroup extends baseModule { $addButton->setTitle(_('Add')); $memberTable->addElement($addButton); $memberTable->colspan = 2; - + $membersLabel = new htmlOutputText(_('Members')); $membersLabel->alignment = htmlElement::ALIGN_TOP; $return->addElement($membersLabel); @@ -361,7 +361,7 @@ class nisnetgroup extends baseModule { } return $errors; } - + /** * Displays the group selection. * @@ -497,7 +497,7 @@ class nisnetgroup extends baseModule { $return->addElement(new htmlHiddenInput('position', $position)); return $return; } - + /** * Processes user input of the host/user selection page. * It checks if all input values are correct and updates the associated LDAP attributes. @@ -513,7 +513,7 @@ class nisnetgroup extends baseModule { } return array(); } - + /** * In this function the LDAP account is built up. * @@ -556,7 +556,7 @@ class nisnetgroup extends baseModule { } return $messages; } - + /** * This functions is used to check if all settings for this module have been made. * @@ -583,26 +583,26 @@ class nisnetgroup extends baseModule { $this->addSimplePDFField($return, 'description', _('Description')); $this->addSimplePDFField($return, 'subgroups', _('Subgroups'), 'memberNisNetgroup'); if (sizeof($this->attributes['nisNetgroupTriple']) > 0) { - $return[get_class($this) . '_members'] = array('' . _('Members') . ''); - $return[get_class($this) . '_members'][] = '' . - '' . _('Host') . '' . - '' . _('User') . '' . - '' . _('Domain') . '' . - ''; + $pdfTable = new PDFTable(_('Members')); + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('Host'), '20%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('User'), '20%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Domain'), '20%', null, true); + $pdfTable->rows[] = $pdfRow; for ($i = 0; $i < sizeof($this->attributes['nisNetgroupTriple']); $i++) { $triple = substr($this->attributes['nisNetgroupTriple'][$i], 1, strlen($this->attributes['nisNetgroupTriple'][$i]) - 2); $triple = explode(',', $triple); - $return[get_class($this) . '_members'][] = '' . - '' . $triple[0] . ' ' . - '' . $triple[1] . ' ' . - '' . $triple[2] . ' ' . - ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($triple[0], '20%'); + $pdfRow->cells[] = new PDFTableCell($triple[1], '20%'); + $pdfRow->cells[] = new PDFTableCell($triple[2], '30%'); + $pdfTable->rows[] = $pdfRow; } - $return[get_class($this) . '_members'][] = ' '; + $this->addPDFTable($return, 'members', $pdfTable); } return $return; } - + /** * Returns a list of existing NIS net groups. * diff --git a/lam/lib/modules/puppetClient.inc b/lam/lib/modules/puppetClient.inc index 8ac7ff77..6af91040 100644 --- a/lam/lib/modules/puppetClient.inc +++ b/lam/lib/modules/puppetClient.inc @@ -50,7 +50,7 @@ class puppetClient extends baseModule { /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -121,7 +121,7 @@ class puppetClient extends baseModule { $configContainer = new htmlTable(); $configContainer->addElement(new htmlTableExtendedInputTextarea('puppetClient_environments', "production\r\ntesting", 30, 5, _('Predefined environments'), 'predefinedEnvironments'), true); $return['config_options']['all'] = $configContainer; - // upload fields + // upload fields $return['upload_columns'] = array( array( 'name' => 'puppetClient_environment', @@ -212,7 +212,7 @@ class puppetClient extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ function display_html_attributes() { @@ -275,7 +275,7 @@ class puppetClient extends baseModule { $puppetvar = implode("\r\n", $this->attributes['puppetvar']); } $return->addElement(new htmlTableExtendedInputTextarea('puppetvar', $puppetvar, 60, 5, _('Variables'), 'puppetvar'), true); - + $return->addElement(new htmlSpacer(null, '10px'),true); $remButton = new htmlAccountPageButton('puppetClient', 'attributes', 'remObjectClass', _('Remove Puppet extension')); $remButton->colspan = 4; @@ -353,7 +353,7 @@ class puppetClient extends baseModule { } } $this->attributes['puppetvar'] = array_values(array_unique($puppetvar)); - + return $errors; } @@ -431,20 +431,26 @@ class puppetClient extends baseModule { $this->addSimplePDFField($return, 'environment', _('Environment')); $this->addSimplePDFField($return, 'parentnode', _('Parent node')); if (isset($this->attributes['puppetclass'][0])) { - $return['puppetClient_puppetclass'][0] = '' . _('Classes') . '' . $this->attributes['puppetclass'][0] . ''; - for ($i = 1; $i < sizeof($this->attributes['puppetclass']); $i++) { - $return['puppetClient_puppetclass'][] = '' . $this->attributes['puppetclass'][$i] . ''; + $pdfTable = new PDFTable(_('Classes')); + for ($i = 0; $i < sizeof($this->attributes['puppetclass']); $i++) { + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($this->attributes['puppetclass'][$i]); + $pdfTable->rows[] = $pdfRow; } + $this->addPDFTable($return, 'puppetclass', $pdfTable); } if (isset($this->attributes['puppetvar'][0])) { - $return['puppetClient_puppetvar'][0] = '' . _('Variables') . '' . $this->attributes['puppetvar'][0] . ''; - for ($i = 1; $i < sizeof($this->attributes['puppetvar']); $i++) { - $return['puppetClient_puppetvar'][] = '' . $this->attributes['puppetvar'][$i] . ''; + $pdfTable = new PDFTable(_('Variables')); + for ($i = 0; $i < sizeof($this->attributes['puppetvar']); $i++) { + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($this->attributes['puppetvar'][$i]); + $pdfTable->rows[] = $pdfRow; } + $this->addPDFTable($return, 'puppetvar', $pdfTable); } return $return; } - + /** * This function defines what attributes will be used in the account profiles and their appearance in the profile editor. * @@ -454,9 +460,9 @@ class puppetClient extends baseModule { * The field name are used as keywords to load * and save profiles. We recommend to use the module name as prefix for them * (e.g. posixAccount_homeDirectory) to avoid naming conflicts. - * + * * @return htmlElement meta HTML object - * + * * @see baseModule::get_metaData() * @see htmlElement */ @@ -496,10 +502,10 @@ class puppetClient extends baseModule { $this->attributes['puppetvar'] = $profile['puppetClient_puppetvar']; } } - + /** * Reurns a list of valid parent nodes for this node. - * + * * @return array parent nodes (e.g. array('node1', 'node2')) */ private function getPossibleParentNodes() { diff --git a/lam/lib/modules/pykotaUser.inc b/lam/lib/modules/pykotaUser.inc index 2699d26c..3087b0cc 100644 --- a/lam/lib/modules/pykotaUser.inc +++ b/lam/lib/modules/pykotaUser.inc @@ -33,18 +33,18 @@ $Id$ * @package modules */ class pykotaUser extends baseModule { - + /** cache for uid attribute */ private $uidCache = null; /** cache for pykotaUserName attribute */ private $pykotaUserNameCache = null; /** list of limit options label => value */ private $limitOptions; - + /** * Returns if this module also manages the structural object class pykotaObject. * This is overridden by a submodule that must provide the structural object class. - * + * * @return boolean structural usage */ public function isStructural() { @@ -71,7 +71,7 @@ class pykotaUser extends baseModule { /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -82,7 +82,7 @@ class pykotaUser extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ function get_metaData() { @@ -329,7 +329,7 @@ class pykotaUser extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ function display_html_attributes() { @@ -353,7 +353,7 @@ class pykotaUser extends baseModule { $msg = new htmlStatusMessage('INFO', sprintf(_("Please enter an user name on this page: %s"), $page)); $msg->colspan = 5; $container->addElement($msg, true); - } + } } // pykotaUserName $this->addSimpleInputTextField($container, 'pykotaUserName', _('Pykota user name')); @@ -573,7 +573,7 @@ class pykotaUser extends baseModule { /** * Returns the HTML meta data for the payments page. - * + * * @return htmlElement HTML meta data */ function display_html_payments() { @@ -621,7 +621,7 @@ class pykotaUser extends baseModule { $container->addElement($backButton, true); return $container; } - + /** * Processes user input of the payments module page. * It checks if all input values are correct and updates the associated LDAP attributes. @@ -634,7 +634,7 @@ class pykotaUser extends baseModule { /** * Returns the HTML meta data for the jobs page. - * + * * @return htmlElement HTML meta data */ function display_html_jobs() { @@ -711,7 +711,7 @@ class pykotaUser extends baseModule { /** * This function is used to check if all settings for this module have been made. - * + * * Calling this method requires the existence of an enclosing {@link accountContainer}.
*
* This function tells LAM if it can create/modify the LDAP account. If your module needs any @@ -757,7 +757,7 @@ class pykotaUser extends baseModule { $this->attributes['pykotaPayments'][] = date('Y-m-d H:i:s,00', time()) . ' # ' . $amount . ' # '; } } - + /** * In this function the LDAP account is built up. * @@ -879,7 +879,7 @@ class pykotaUser extends baseModule { } return $messages; } - + /** * Returns a list of possible PDF entries for this account. * @@ -904,22 +904,25 @@ class pykotaUser extends baseModule { $this->addSimplePDFField($return, 'pykotaLifeTimePaid', _('Total paid')); // payment history if (!empty($this->attributes['pykotaPayments'][0])) { - $history[] = '' . - '' . _('Date') . '' . - '' . _('Amount') . '' . - '' . _('Comment') . ''; + $pdfTable = new PDFTable(); + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('Date'), '20%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Amount'), '10%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Comment'), '70%', null, true); + $pdfTable->rows[] = $pdfRow; for ($i = 0; $i < sizeof($this->attributes['pykotaPayments']); $i++) { $parts = explode(' # ', $this->attributes['pykotaPayments'][$i]); $comment = ' '; if (!empty($parts[2])) { $comment = base64_decode($parts[2]); } - $history[] = '' . - '' . $parts[0] . '' . - '' . $parts[1] . '' . - '' . $comment . ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($parts[0], '20%'); + $pdfRow->cells[] = new PDFTableCell($parts[1], '10%', PDFTableCell::ALIGN_RIGHT); + $pdfRow->cells[] = new PDFTableCell($comment, '70%'); + $pdfTable->rows[] = $pdfRow; } - $return[get_class($this) . '_pykotaPayments'] = $history; + $this->addPDFTable($return, 'pykotaPayments', $pdfTable); } return $return; } @@ -1032,7 +1035,7 @@ class pykotaUser extends baseModule { /** * Checks if the self service settings are valid. - * + * * Calling this method does not require the existence of an enclosing {@link accountContainer}.
*
* If the input data is invalid the return value is an array that contains arrays @@ -1052,10 +1055,10 @@ class pykotaUser extends baseModule { } return $errors; } - + /** * Returns if the uid attribute should be managed. - * + * * @return boolean manage uid attribute */ private function manageUid() { @@ -1074,7 +1077,7 @@ class pykotaUser extends baseModule { /** * Returns if the mail attribute should be managed. - * + * * @return boolean manage mail attribute */ private function manageMail() { @@ -1092,7 +1095,7 @@ class pykotaUser extends baseModule { /** * Returns if the description attribute should be managed. - * + * * @return boolean manage description attribute */ private function manageDescription() { @@ -1107,10 +1110,10 @@ class pykotaUser extends baseModule { } return false; } - + /** * Returns if the given uid already exists. - * + * * @param String $uid uid attribute value * @return boolean uid exists */ @@ -1123,7 +1126,7 @@ class pykotaUser extends baseModule { /** * Returns if the given pykotaUserName already exists. - * + * * @param String $pykotaUserName pykotaUserName attribute value * @return boolean pykotaUserName exists */ @@ -1133,7 +1136,7 @@ class pykotaUser extends baseModule { } return in_array($pykotaUserName, $this->pykotaUserNameCache); } - + /** * Loads the list of user names into the cache. */ @@ -1150,10 +1153,10 @@ class pykotaUser extends baseModule { } } } - + /** * Returns the current user name (uid) of this account. - * + * * @return String user name */ private function getCurrentUserName() { @@ -1176,11 +1179,11 @@ class pykotaUser extends baseModule { } return ''; } - + /** * Returns a list of jobs for the given user reverse-sorted by date. * The number of jobs is limited to 100. - * + * * @param String $user user name * @param String $suffix LDAP suffix for job objects */ diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index adaf7b1a..d7145fde 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -38,7 +38,7 @@ $Id$ * @package modules */ class quota extends baseModule { - + /** delimiter for lamdaemon commands */ private static $SPLIT_DELIMITER = "###x##y##x###"; /** prefix for lamdaemon results */ @@ -65,7 +65,7 @@ class quota extends baseModule { /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -76,7 +76,7 @@ class quota extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ function get_metaData() { @@ -159,7 +159,7 @@ class quota extends baseModule { /** Saves the quota settings */ private $quota; - + /** * Initializes the quota values. * @@ -219,7 +219,7 @@ class quota extends baseModule { } return null; } - + /** * This function is used to check if this module page can be displayed. * It returns false if a module depends on data from other modules which was not yet entered. @@ -241,7 +241,7 @@ class quota extends baseModule { /** * Quotas are set in postmodify. - * + * * @see baseModule::postModifyActions() * * @param boolean $newAccount is new account @@ -284,7 +284,7 @@ class quota extends baseModule { /** * Allows the module to run commands before the LDAP entry is deleted. - * + * * @return array Array which contains status messages. Each entry is an array containing the status message parameters. */ function preDeleteActions() { @@ -371,7 +371,7 @@ class quota extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ function display_html_attributes() { @@ -416,7 +416,7 @@ class quota extends baseModule { $return->addElement(new htmlHelpLink('HardInodeLimit')); $return->addElement(new htmlHelpLink('GraceInodePeriod')); $return->addNewLine(); - + $i=0; // loop for every mointpoint with enabled quotas while (isset($this->quota[$server][$i][0])) { @@ -451,7 +451,7 @@ class quota extends baseModule { } return $return; } - + /** * Replaces special characters in HTML name values. * @@ -515,7 +515,7 @@ class quota extends baseModule { $return->addElement(new htmlHelpLink('SoftInodeLimit')); $return->addElement(new htmlHelpLink('HardInodeLimit')); $return->addNewLine(); - + for ($i = 0; $i < sizeof($dirs); $i++) { $return->addElement(new htmlOutputText($dirs[$i])); $sbLimit = new htmlInputField("quota_softblock_" . $id . "_" . $dirs[$i]); @@ -617,7 +617,7 @@ class quota extends baseModule { $this->initQuotas(); if (!isset($this->quota) || !is_array($this->quota)) return array(); if (sizeof($this->quota) > 0) { - $quotas = array(); + $pdfTable = new PDFTable(); // get list of lamdaemon servers $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); for ($s = 0; $s < sizeof($lamdaemonServers); $s++) { @@ -626,27 +626,32 @@ class quota extends baseModule { $description = $server; if (isset($temp[1])) $description = $temp[1] . " (" . $server . ")"; if (!isset($this->quota[$server]) || (sizeof($this->quota[$server]) < 1)) continue; - - $quotas[] = '' . - '' . $description . '' . - ''; - $quotas[] = '' . - '' . _('Mountpoint') . '' . - '' . _('Soft block') . '' . - '' . _('Hard block') . '' . - '' . _('Soft inode') . '' . - '' . _('Hard inode') . ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($description, null, null, true); + $pdfTable->rows[] = $pdfRow; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('Mountpoint'), '28%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Soft block'), '18%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Hard block'), '18%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Soft inode'), '18%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Hard inode'), '18%', null, true); + $pdfTable->rows[] = $pdfRow; for ($i = 0; $i < sizeof($this->quota[$server]); $i++) { - $quotas[] = '' . - '' . $this->quota[$server][$i][0] . '' . - '' . $this->quota[$server][$i][2] . '' . - '' . $this->quota[$server][$i][3] . '' . - '' . $this->quota[$server][$i][6] . '' . - '' . $this->quota[$server][$i][7] . ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][0], '28%'); + $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][2], '18%'); + $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][3], '18%'); + $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][6], '18%'); + $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][7], '18%'); + $pdfTable->rows[] = $pdfRow; } - $quotas[] = ' '; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(' '); + $pdfTable->rows[] = $pdfRow; } - return array('quota_quotas' => $quotas); + $return = array(); + $this->addPDFTable($return, 'quotas', $pdfTable); + return $return; } else { return array(); @@ -826,10 +831,10 @@ class quota extends baseModule { } return array('status' => 'finished'); } - + /** * Returns a list of modifications which have to be made to the LDAP account. - * + * * Calling this method requires the existence of an enclosing {@link accountContainer}.
*
* @@ -844,7 +849,7 @@ class quota extends baseModule { *
"info" values with informational value (e.g. to be used later by pre/postModify actions) *
*
This builds the required comands from $this-attributes and $this->orig. - * + * * @return array list of modifications */ public function save_attributes() { diff --git a/lam/lib/modules/range.inc b/lam/lib/modules/range.inc index fcbbfa66..959b7453 100644 --- a/lam/lib/modules/range.inc +++ b/lam/lib/modules/range.inc @@ -42,16 +42,16 @@ class range extends baseModule { /** subnet */ public $subnet; - + /** ranges */ public $ranges; - + /** Range -> Function attibute_processed already running? */ public $processed; - + /** For check, if IPs overlaped. */ public $overlaped; - + /** list of pools that currently exist in LDAP */ private $poolsOrig = array(); /** list of pools that need to be updated in LDAP */ @@ -59,7 +59,7 @@ class range extends baseModule { /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -70,7 +70,7 @@ class range extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ public function get_metaData() { @@ -122,12 +122,12 @@ class range extends baseModule { "Text" => _("The pool's failover peer.") ), ); - + // available PDF fields $return['PDF_fields'] = array('ranges' => _('Ranges')); return $return; } - + /** * This function fills the error message array with messages. */ @@ -138,7 +138,7 @@ class range extends baseModule { $this->messages['pool_cn'][0] = array('ERROR', _('Name'), _('Please enter a pool name.')); $this->messages['pool_range'][0] = array('ERROR', _('Please enter at least one range for pool "%s".'), null); } - + /** * Calculates the subnet for a given IP and netmask. * @@ -148,7 +148,7 @@ class range extends baseModule { private static function calculateSubnet($ip, $mask) { return long2ip(ip2long($ip) & ip2long($mask)); } - + /** * Checks if the first IP is smaller than the second IP. * @@ -157,7 +157,7 @@ class range extends baseModule { * * @return true, if it's a valid Range, else false; **/ - + public function check_range($first_ip, $second_ip) { $ex_first = explode(".", $first_ip); $ex_second = explode(".", $second_ip); @@ -172,7 +172,7 @@ class range extends baseModule { } return false; } - + /** * Check if an IP address is in the correct subnet. * @@ -185,7 +185,7 @@ class range extends baseModule { $ipSubnet = range::calculateSubnet($ip, $mask); return ($subnet == $ipSubnet); } - + /** * * Checked, if Ranges are overlaped. @@ -199,7 +199,7 @@ class range extends baseModule { function overlaped_range($ip,$ipB) { $ex = explode(".", $ip); $exB = explode(".", $ipB); - + if(!is_array($this->overlaped)) { $this->overlaped = array(); } @@ -213,7 +213,7 @@ class range extends baseModule { } return true; } - + /** * * Reset the overlaped_range() function @@ -222,7 +222,7 @@ class range extends baseModule { function reset_overlaped_range() { $this->overlaped = array(); } - + /** * Controls if the module button the account page is visible and activated. * @@ -262,7 +262,7 @@ class range extends baseModule { $this->loadPools(); } } - + /** * * Adapt the Ranges with the subnet. @@ -304,7 +304,7 @@ class range extends baseModule { } return $range_edit; } - + /** * Processes user input of the primary module page. * It checks if all input values are correct and updates the associated LDAP attributes. @@ -393,7 +393,7 @@ class range extends baseModule { $this->ranges[] = array('range_start'=>'','range_end'=>''); } } - + // update pool data foreach ($this->poolsNew as $index => $pool) { // delete pool @@ -468,7 +468,7 @@ class range extends baseModule { 'dhcprange' => array('') ); } - + // Check if there was a error: if ($errorOccured) { $errors[] = $this->messages['range_errors'][0]; @@ -477,10 +477,10 @@ class range extends baseModule { $this->processed = true; return $errors; } - + /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ public function display_html_attributes() { @@ -489,7 +489,7 @@ class range extends baseModule { $return->addElement(new htmlStatusMessage('INFO', _("Please fill out the DHCP settings first."))); return $return; } - + // If $ranges is not a array, then create it if (!is_array($this->ranges)) { $this->ranges = array(); @@ -537,14 +537,14 @@ class range extends baseModule { $return->addElement(new htmlSpacer(null, '10px'), true); } - + // add new range $addButton = new htmlButton('add_range', _('New range')); $addButton->setIconClass('createButton'); $addButton->colspan = 2; $return->addElement($addButton); $return->addElement(new htmlHelpLink('add_range'), true); - + // pools if (!empty($this->poolsNew)) { $return->addElement(new htmlSubTitle(_('Pools')), true); @@ -622,20 +622,20 @@ class range extends baseModule { } $return->addVerticalSpace('20px'); } - + // add new range pool $addButton = new htmlButton('add_pool', _('New pool')); $addButton->setIconClass('createButton'); $addButton->colspan = 2; $return->addElement($addButton); $return->addElement(new htmlHelpLink('add_pool'), true); - + return $return; } /** * Allows the module to run commands after the LDAP entry is changed or created. - * + * * Calling this method requires the existence of an enclosing {@link accountContainer}. * * @param boolean $newAccount new account @@ -759,7 +759,7 @@ class range extends baseModule { // Return attributes return $return; } - + /** * Returns a list of possible PDF entries for this account. * @@ -769,18 +769,46 @@ class range extends baseModule { function get_pdfEntries($pdfKeys) { $return = array(); if (is_array($this->ranges) && (sizeof($this->ranges) > 0)) { - $start = $this->ranges[0]['range_start']; - $end = $this->ranges[0]['range_end']; - $return[get_class($this) . '_ranges'] = array('' . _('Ranges') . '' . $start . " - " . $end . ''); - for ($i = 1; $i < sizeof($this->ranges); $i++) { + $pdfTable = new PDFTable(_('Ranges')); + for ($i = 0; $i < sizeof($this->ranges); $i++) { $start = $this->ranges[$i]['range_start']; $end = $this->ranges[$i]['range_end']; - $return[get_class($this) . '_ranges'][] = '' . $start . " - " . $end . ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($start . " - " . $end); + $pdfTable->rows[] = $pdfRow; } + + + if (!empty($this->poolsNew)) { + foreach ($this->poolsNew as $index => $poolAttrs) { + $cn = !empty($poolAttrs['cn'][0]) ? $poolAttrs['cn'][0] : ''; + $peer = ''; + if (!empty($poolAttrs['dhcpstatements'])) { + foreach ($poolAttrs['dhcpstatements'] as $statement) { + if (strpos($statement, 'failover peer "') === 0) { + $peer = ' (' . substr($statement, strlen('failover peer "'), -1) . ')'; + } + } + } + if (!empty($poolAttrs['dhcprange'])) { + foreach ($poolAttrs['dhcprange'] as $rIndex => $range) { + $range = explode(' ', $range); + $from = !empty($range[0]) ? $range[0] : ''; + $to = !empty($range[1]) ? $range[1] : ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($cn . $peer . ': ' . $from . " - " . $to); + $pdfTable->rows[] = $pdfRow; + } + } + } + } + + + $this->addPDFTable($return, 'ranges', $pdfTable); } return $return; } - + /** * Loads the list of pools from LDAP. */ @@ -794,7 +822,7 @@ class range extends baseModule { } $this->poolsNew = $this->poolsOrig; } - + } ?> diff --git a/lam/lib/modules/systemQuotas.inc b/lam/lib/modules/systemQuotas.inc index f33a86fe..e9379644 100644 --- a/lam/lib/modules/systemQuotas.inc +++ b/lam/lib/modules/systemQuotas.inc @@ -33,10 +33,10 @@ $Id$ * @package modules */ class systemQuotas extends baseModule { - + /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -47,7 +47,7 @@ class systemQuotas extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ public function get_metaData() { @@ -112,7 +112,7 @@ class systemQuotas extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ public function display_html_attributes() { @@ -226,7 +226,7 @@ class systemQuotas extends baseModule { $this->attributes['quota'] = array_unique($this->attributes['quota']); return $return; } - + /** * Checks if the quota parameters are valid. * @@ -331,7 +331,7 @@ class systemQuotas extends baseModule { } return $messages; } - + /** * Loads the values of an account profile into internal variables. * @@ -344,7 +344,7 @@ class systemQuotas extends baseModule { $this->attributes['quota'] = explode(';', $profile['systemQuotas_quota'][0]); } } - + /** * In this function the LDAP account is built up. * @@ -371,7 +371,7 @@ class systemQuotas extends baseModule { } return $messages; } - + /** * Returns a list of possible PDF entries for this account. * @@ -381,22 +381,25 @@ class systemQuotas extends baseModule { public function get_pdfEntries($pdfKeys) { $return = array(); if (isset($this->attributes['quota'][0])) { - $quotas[] = '' . - '' . _('Mountpoint') . '' . - '' . _('Soft block') . '' . - '' . _('Hard block') . '' . - '' . _('Soft inode') . '' . - '' . _('Hard inode') . ''; + $pdfTable = new PDFTable(); + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell(_('Mountpoint'), '28%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Soft block'), '18%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Hard block'), '18%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Soft inode'), '18%', null, true); + $pdfRow->cells[] = new PDFTableCell(_('Hard inode'), '18%', null, true); + $pdfTable->rows[] = $pdfRow; for ($i = 0; $i < sizeof($this->attributes['quota']); $i++) { $parts = explode(',', $this->attributes['quota'][$i]); - $quotas[] = '' . - '' . $parts[0] . '' . - '' . $parts[1] . '' . - '' . $parts[2] . '' . - '' . $parts[3] . '' . - '' . $parts[4] . ''; + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($parts[0], '28%'); + $pdfRow->cells[] = new PDFTableCell($parts[1], '18%'); + $pdfRow->cells[] = new PDFTableCell($parts[2], '18%'); + $pdfRow->cells[] = new PDFTableCell($parts[3], '18%'); + $pdfRow->cells[] = new PDFTableCell($parts[4], '18%'); + $pdfTable->rows[] = $pdfRow; } - $return['systemQuotas_quota'] = $quotas; + $this->addPDFTable($return, 'quota', $pdfTable); } return $return; } diff --git a/lam/lib/modules/windowsGroup.inc b/lam/lib/modules/windowsGroup.inc index b54985bb..ec23697a 100644 --- a/lam/lib/modules/windowsGroup.inc +++ b/lam/lib/modules/windowsGroup.inc @@ -33,14 +33,14 @@ $Id$ * @package modules */ class windowsGroup extends baseModule { - + /** possible group types (e.g. distribution) */ private $groupTypes; /** possible group scopes (e.g. universal) */ private $groupScopes; /** group cache */ private $groupCache; - + /** security group */ const TYPE_SECURITY = 'security'; /** email list */ @@ -51,7 +51,7 @@ class windowsGroup extends baseModule { const SCOPE_GLOBAL = 'global'; /** universal group */ const SCOPE_UNIVERSAL = 'universal'; - + /** * Creates a new module for Samba 3 groups. * @@ -70,10 +70,10 @@ class windowsGroup extends baseModule { // call parent constructor parent::__construct($scope); } - + /** * Returns true if this module can manage accounts of the current type, otherwise false. - * + * * @return boolean true if module fits */ public function can_manage() { @@ -84,7 +84,7 @@ class windowsGroup extends baseModule { * Returns meta data that is interpreted by parent class * * @return array array with meta data - * + * * @see baseModule::get_metaData() */ public function get_metaData() { @@ -299,7 +299,7 @@ class windowsGroup extends baseModule { /** * Returns the HTML meta data for the main account page. - * + * * @return htmlElement HTML meta data */ public function display_html_attributes() { @@ -427,7 +427,7 @@ class windowsGroup extends baseModule { } $container->addElement(new htmlOutputText('')); $container->addElement($memberOf, true); - + $container->addElement(new htmlEqualWidth(array('groupType', 'groupScope'))); return $container; } @@ -497,7 +497,7 @@ class windowsGroup extends baseModule { } return $return; } - + /** * Displays the memberof selection. * @@ -516,7 +516,7 @@ class windowsGroup extends baseModule { $groupContainer->addElement(new htmlOutputText('')); $groupContainer->addElement(new htmlOutputText(_("Available groups"))); $groupContainer->addNewLine(); - + $selectedGroups = array(); if (empty($this->attributes['memberOf'])) { $this->attributes['memberOf'] = array(); @@ -534,7 +534,7 @@ class windowsGroup extends baseModule { $availableGroups[getAbstractDN($dn)] = $dn; } } - + $remGroupSelect = new htmlSelect('removegroups', $selectedGroups, null, 15); $remGroupSelect->setMultiSelect(true); $remGroupSelect->setTransformSingleSelect(false); @@ -585,7 +585,7 @@ class windowsGroup extends baseModule { /** * This function will create the meta HTML code to show a page to change the member attribute. - * + * * @return htmlElement HTML meta data */ function display_html_managedBy() { @@ -621,7 +621,7 @@ class windowsGroup extends baseModule { $return->addElement($buttonTable); return $return; } - + /** * Processes user input of the members page. * It checks if all input values are correct and updates the associated LDAP attributes. @@ -638,7 +638,7 @@ class windowsGroup extends baseModule { /** * This function will create the meta HTML code to show a page to change the member attribute. - * + * * @return htmlElement HTML meta data */ function display_html_user() { @@ -652,7 +652,7 @@ class windowsGroup extends baseModule { $filter->setOnKeyUp('filterSelect(\'windows_filter\', \'members\', event);'); $filterGroup->addElement($filter); $return->addElement($filterGroup, true); - + $options = array(); $filter = get_ldap_filter($_POST['type']); $entries = searchLDAPByFilter($filter, array('dn'), array($_POST['type'])); @@ -730,7 +730,7 @@ class windowsGroup extends baseModule { $return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'membersBack', _('Back'))); return $return; } - + /** * Processes user input of the members page. * It checks if all input values are correct and updates the associated LDAP attributes. @@ -860,7 +860,7 @@ class windowsGroup extends baseModule { } return $errors; } - + /** * Returns a list of possible PDF entries for this account. * @@ -914,10 +914,13 @@ class windowsGroup extends baseModule { $memberList = $this->attributes['member']; } usort($memberList, 'compareDN'); - $return[get_class($this) . '_member'][0] = '' . _('Members') . '' . $memberList[0] . ''; - for ($i = 1; $i < sizeof($memberList); $i++) { - $return[get_class($this) . '_member'][] = '' . $memberList[$i] . ''; + $pdfTable = new PDFTable(_('Members')); + for ($i = 0; $i < sizeof($memberList); $i++) { + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($memberList[$i]); + $pdfTable->rows[] = $pdfRow; } + $this->addPDFTable($return, 'member', $pdfTable); } // member of if (!empty($this->attributes['memberOf'])) { @@ -926,10 +929,13 @@ class windowsGroup extends baseModule { $memberOfList = $this->attributes['memberOf']; } usort($memberOfList, 'compareDN'); - $return[get_class($this) . '_memberOf'][0] = '' . _('Member of') . '' . $memberOfList[0] . ''; - for ($i = 1; $i < sizeof($memberOfList); $i++) { - $return[get_class($this) . '_memberOf'][] = '' . $memberOfList[$i] . ''; + $pdfTable = new PDFTable(_('Member of')); + for ($i = 0; $i < sizeof($memberOfList); $i++) { + $pdfRow = new PDFTableRow(); + $pdfRow->cells[] = new PDFTableCell($memberOfList[$i]); + $pdfTable->rows[] = $pdfRow; } + $this->addPDFTable($return, 'memberOf', $pdfTable); } return $return; } @@ -955,10 +961,10 @@ class windowsGroup extends baseModule { $this->groupCache = $return; return $return; } - + /** * Returns a list of modifications which have to be made to the LDAP account. - * + * * Calling this method requires the existence of an enclosing {@link accountContainer}.
*
* @@ -973,7 +979,7 @@ class windowsGroup extends baseModule { *
"info" values with informational value (e.g. to be used later by pre/postModify actions) *
*
This builds the required comands from $this-attributes and $this->orig. - * + * * @return array list of modifications */ public function save_attributes() { @@ -983,10 +989,10 @@ class windowsGroup extends baseModule { $orig['memberOf'] = array(); return $this->getAccountContainer()->save_module_attributes($attrs, $orig); } - + /** * Runs the postmodify actions. - * + * * @see baseModule::postModifyActions() * * @param boolean $newAccount @@ -1036,7 +1042,7 @@ class windowsGroup extends baseModule { } return $messages; } - + }