added PDFTable

This commit is contained in:
Roland Gruber 2015-07-11 09:50:00 +00:00
parent cf9c5c9f70
commit 25ff82f545
11 changed files with 339 additions and 276 deletions

View File

@ -988,7 +988,7 @@ function extractRDNAttribute($dn) {
* @return String RDN attribute value * @return String RDN attribute value
*/ */
function extractRDNValue($dn) { function extractRDNValue($dn) {
if ($dn == null) return null; if (empty($dn)) return null;
$parts = explode("=", substr($dn, 0, strpos($dn, ','))); $parts = explode("=", substr($dn, 0, strpos($dn, ',')));
return $parts[1]; return $parts[1];
} }

View File

@ -42,25 +42,25 @@ class fixed_ip extends baseModule {
/** fixed ips */ /** fixed ips */
public $fixed_ip = array(); public $fixed_ip = array();
/** already processed? */ /** already processed? */
public $processed = false; public $processed = false;
/** for check if IPs overlap */ /** for check if IPs overlap */
public $overlapd; public $overlapd;
/** original IPs */ /** original IPs */
public $orig_ips = array(); public $orig_ips = array();
/** LDAP attributes */ /** LDAP attributes */
public $attributes; public $attributes;
/** cached host entries (list of array('cn' => ..., 'iphostnumber' => ..., 'macaddress' => ...)) */ /** cached host entries (list of array('cn' => ..., 'iphostnumber' => ..., 'macaddress' => ...)) */
private $hostCache = null; private $hostCache = null;
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -71,7 +71,7 @@ class fixed_ip extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_metaData() { public function get_metaData() {
@ -119,14 +119,14 @@ class fixed_ip extends baseModule {
$return['PDF_fields'] = array('IPlist' => _('IP list')); $return['PDF_fields'] = array('IPlist' => _('IP list'));
return $return; return $return;
} }
/** /**
* This function fills the error message array with messages. * This function fills the error message array with messages.
*/ */
public function load_Messages() { public function load_Messages() {
$this->messages['errors'][0] = array('ERROR', _('One or more errors occured. The invalid fields are marked.'), ''); $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. * 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() { public function reset_overlapd_ip() {
$this->overlapd = array(); $this->overlapd = array();
} }
/** /**
* *
* Check, if a mac address is invalid * Check, if a mac address is invalid
@ -189,7 +189,7 @@ class fixed_ip extends baseModule {
} }
return $invalid; return $invalid;
} }
/** /**
* *
* Adapt the fixed ip with the subnet. * Adapt the fixed ip with the subnet.
@ -217,7 +217,7 @@ class fixed_ip extends baseModule {
} }
return $ip_edit; return $ip_edit;
} }
/** /**
* This function loads all needed LDAP attributes. * This function loads all needed LDAP attributes.
* *
@ -244,7 +244,7 @@ class fixed_ip extends baseModule {
$description = $entries[$i]['dhcpcomments'][0]; $description = $entries[$i]['dhcpcomments'][0];
} }
$this->fixed_ip[$i]['description'] = $description; $this->fixed_ip[$i]['description'] = $description;
$this->orig_ips[$i]['cn'] = $entries[$i]['cn'][0]; $this->orig_ips[$i]['cn'] = $entries[$i]['cn'][0];
$this->orig_ips[$i]['mac'] = $dhcphwaddress; $this->orig_ips[$i]['mac'] = $dhcphwaddress;
$this->orig_ips[$i]['ip'] = self::extractIP($dhcpstatements); $this->orig_ips[$i]['ip'] = self::extractIP($dhcpstatements);
@ -275,7 +275,7 @@ class fixed_ip extends baseModule {
} }
$this->fixed_ip = $newVal; $this->fixed_ip = $newVal;
} }
/** /**
* Processes user input of the primary module page. * Processes user input of the primary module page.
* It checks if all input values are correct and updates the associated LDAP attributes. * 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; $error = true;
} }
$this->fixed_ip[$id]['description'] = $_POST['description_'.$id]; $this->fixed_ip[$id]['description'] = $_POST['description_'.$id];
// active // active
$this->fixed_ip[$id]['active'] = (isset($_POST['active_' . $id]) && ($_POST['active_' . $id] == 'on')); $this->fixed_ip[$id]['active'] = (isset($_POST['active_' . $id]) && ($_POST['active_' . $id] == 'on'));
@ -389,13 +389,13 @@ class fixed_ip extends baseModule {
$this->orderByIP(); $this->orderByIP();
} }
} }
return $errors; return $errors;
} }
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
@ -474,7 +474,7 @@ class fixed_ip extends baseModule {
elseif ($this->check_mac($this->fixed_ip[$id]['mac'])) { elseif ($this->check_mac($this->fixed_ip[$id]['mac'])) {
$macError = _("Invalid MAC address."); $macError = _("Invalid MAC address.");
} }
// descripton // descripton
$descriptionError = ""; $descriptionError = "";
if (!$this->processed) { if (!$this->processed) {
@ -483,7 +483,7 @@ class fixed_ip extends baseModule {
elseif (!get_preg($this->fixed_ip[$id]['description'], 'ascii')) { elseif (!get_preg($this->fixed_ip[$id]['description'], 'ascii')) {
$descriptionError = _("Invalid description."); $descriptionError = _("Invalid description.");
} }
// fixed ip // fixed ip
$ipError = ""; $ipError = "";
if (!$this->processed || ($this->fixed_ip[$id]['ip'] == '')) { 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'])) { elseif (!check_ip($this->fixed_ip[$id]['ip'])) {
$ipError = _("The IP address is invalid."); $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')->attributes['cn'][0],
$this->getAccountContainer()->getAccountModule('dhcp_settings')->getDHCPOption('subnet-mask'))) { $this->getAccountContainer()->getAccountModule('dhcp_settings')->getDHCPOption('subnet-mask'))) {
$ipError = _("The IP address does not match the subnet."); $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 htmlInputField('description_add', '', 20));
$return->addElement(new htmlInputCheckbox('active_add', true)); $return->addElement(new htmlInputCheckbox('active_add', true));
$return->addElement(new htmlButton('add_ip', 'add.png', true), true); $return->addElement(new htmlButton('add_ip', 'add.png', true), true);
// add existing host entry // add existing host entry
if (!empty($this->hostCache)) { if (!empty($this->hostCache)) {
$return->addVerticalSpace('20px'); $return->addVerticalSpace('20px');
@ -548,10 +548,10 @@ class fixed_ip extends baseModule {
} }
return $return; return $return;
} }
/** /**
* Returns the HTML meta data for the add host page. * Returns the HTML meta data for the add host page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_addHost() { public function display_html_addHost() {
@ -614,7 +614,7 @@ class fixed_ip extends baseModule {
} }
return $errors; return $errors;
} }
/** /**
* Returns a list of modifications which have to be made to the LDAP account. * 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() { public function save_attributes() {
} }
/** /**
* This function is overwritten because the fixed IPs are set after the ldap_add command. * This function is overwritten because the fixed IPs are set after the ldap_add command.
* *
* @see baseModule::postModifyActions() * @see baseModule::postModifyActions()
* *
* @param boolean $newAccount * @param boolean $newAccount
@ -736,14 +736,14 @@ class fixed_ip extends baseModule {
function get_pdfEntries($pdfKeys) { function get_pdfEntries($pdfKeys) {
$return = array(); $return = array();
if (is_array($this->fixed_ip) && (sizeof($this->fixed_ip) > 0)) { if (is_array($this->fixed_ip) && (sizeof($this->fixed_ip) > 0)) {
$return[get_class($this) . '_IPlist'] = array( $pdfTable = new PDFTable();
'<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%" align=\"L\"><b>' . _('PC name') . "</b></td>" . $pdfRow->cells[] = new PDFTableCell(_('PC name'), '20%', null, true);
"<td width=\"20%\" align=\"L\"><b>" . _('IP address') . "</b></td>" . $pdfRow->cells[] = new PDFTableCell(_('IP address'), '20%', null, true);
"<td width=\"20%\" align=\"L\"><b>" . _('MAC address') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('MAC address'), '20%', null, true);
"<td width=\"10%\" align=\"L\"><b>" . _('Active') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Active'), '10%', null, true);
"<td width=\"30%\" align=\"L\"><b>" . _('Description') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Description'), '30%', null, true);
'</tr></block>'); $pdfTable->rows[] = $pdfRow;
for ($i = 0; $i < sizeof($this->fixed_ip); $i++) { for ($i = 0; $i < sizeof($this->fixed_ip); $i++) {
$name = $this->fixed_ip[$i]['cn']; $name = $this->fixed_ip[$i]['cn'];
$mac = $this->fixed_ip[$i]['mac']; $mac = $this->fixed_ip[$i]['mac'];
@ -753,21 +753,22 @@ class fixed_ip extends baseModule {
$active = _('no'); $active = _('no');
} }
$description = $this->fixed_ip[$i]['description']; $description = $this->fixed_ip[$i]['description'];
$return[get_class($this) . '_IPlist'][] = '<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%" align=\"L\">' . $name . "</td>" . $pdfRow->cells[] = new PDFTableCell($name, '20%');
"<td width=\"20%\" align=\"L\">" . $ip . " </td>" . $pdfRow->cells[] = new PDFTableCell($ip, '20%');
"<td width=\"20%\" align=\"L\">" . $mac . '</td>'. $pdfRow->cells[] = new PDFTableCell($mac, '20%');
"<td width=\"10%\" align=\"L\">" . $active . '</td>'. $pdfRow->cells[] = new PDFTableCell($active, '10%');
"<td width=\"30%\" align=\"L\">" . $description . ' </td>'. $pdfRow->cells[] = new PDFTableCell($description, '30%');
'</tr></block>'; $pdfTable->rows[] = $pdfRow;
} }
$this->addPDFTable($return, 'IPlist', $pdfTable);
} }
return $return; return $return;
} }
/** /**
* Extracts the IP from a list of DHCP statements. * Extracts the IP from a list of DHCP statements.
* *
* @param array $dhcpStatements values of dhcpStatements attribute * @param array $dhcpStatements values of dhcpStatements attribute
*/ */
public static function extractIP($dhcpStatements) { public static function extractIP($dhcpStatements) {
@ -782,10 +783,10 @@ class fixed_ip extends baseModule {
} }
return $return; return $return;
} }
/** /**
* Sets the IP in a list of DHCP statements. * Sets the IP in a list of DHCP statements.
* *
* @param array $dhcpStatements values of dhcpStatements attribute * @param array $dhcpStatements values of dhcpStatements attribute
* @param String $ip new IP * @param String $ip new IP
*/ */
@ -800,10 +801,10 @@ class fixed_ip extends baseModule {
$dhcpStatements[] = 'fixed-address ' . $ip; $dhcpStatements[] = 'fixed-address ' . $ip;
} }
} }
/** /**
* Returns if this host is active. * Returns if this host is active.
* *
* @param array $dhcpStatements values of dhcpStatements attribute * @param array $dhcpStatements values of dhcpStatements attribute
*/ */
public static function isActive($dhcpStatements) { public static function isActive($dhcpStatements) {
@ -820,10 +821,10 @@ class fixed_ip extends baseModule {
} }
return true; return true;
} }
/** /**
* Sets if this host is active. * Sets if this host is active.
* *
* @param array $dhcpStatements values of dhcpStatements attribute * @param array $dhcpStatements values of dhcpStatements attribute
* @param boolean $active is active * @param boolean $active is active
*/ */
@ -841,7 +842,7 @@ class fixed_ip extends baseModule {
$dhcpStatements[] = 'deny booting'; $dhcpStatements[] = 'deny booting';
} }
} }
/** /**
* Loads cached host data from LDAP. * Loads cached host data from LDAP.
*/ */
@ -856,7 +857,7 @@ class fixed_ip extends baseModule {
$this->hostCache[] = $attributes; $this->hostCache[] = $attributes;
} }
} }
} }
?> ?>

View File

@ -58,7 +58,7 @@ class kolabUser extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -69,7 +69,7 @@ class kolabUser extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -260,7 +260,7 @@ class kolabUser extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { 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. * This function will create the meta HTML code to show a page to mark an account for deletion.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_deleteUser() { function display_html_deleteUser() {
@ -754,13 +754,19 @@ class kolabUser extends baseModule {
break; break;
} }
} }
$return['kolabUser_invPol'][0] = '<block><key>' . _('Invitation policy') . '</key><tr><td align=\"L\">' . _('Anyone') . ": " . $this->invitationPolicies[$default] . '</td></tr></block>'; $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++) { for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) {
$parts = explode(':', $this->attributes['kolabInvitationPolicy'][$i]); $parts = explode(':', $this->attributes['kolabInvitationPolicy'][$i]);
if (sizeof($parts) == 2) { if (sizeof($parts) == 2) {
$return['kolabUser_invPol'][] = '<block><tr><td align=\"L\">' . $parts[0] . ": " . $this->invitationPolicies[$parts[1]] . '</td></tr></block>'; $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, 'aliases', _('Email aliases'), 'alias');
$this->addSimplePDFField($return, 'delegate', _('Delegates'), 'kolabDelegate'); $this->addSimplePDFField($return, 'delegate', _('Delegates'), 'kolabDelegate');
@ -900,7 +906,7 @@ class kolabUser extends baseModule {
* <br>del: array of attributes to remove * <br>del: array of attributes to remove
* <br>mod: array of attributes to modify * <br>mod: array of attributes to modify
* <br>info: array of values with informational value (e.g. to be used later by pre/postModify actions) * <br>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}. * Calling this method does not require the existence of an enclosing {@link accountContainer}.
* *
* @param string $fields input fields * @param string $fields input fields
@ -1013,10 +1019,10 @@ class kolabUser extends baseModule {
} }
return $return; return $return;
} }
/** /**
* Returns if the object class "mailrecipient" is managed by this module. * Returns if the object class "mailrecipient" is managed by this module.
* *
* @return boolean manage mailrecipient object class * @return boolean manage mailrecipient object class
*/ */
private function manageMailrecipient() { private function manageMailrecipient() {
@ -1028,7 +1034,7 @@ class kolabUser extends baseModule {
return false; return false;
} }
return true; return true;
} }
} }

View File

@ -43,10 +43,10 @@ class nisNetGroupUser extends baseModule {
private $groupCache = null; private $groupCache = null;
/** original uid */ /** original uid */
private $uidOrig = null; private $uidOrig = null;
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -57,7 +57,7 @@ class nisNetGroupUser extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_metaData() { public function get_metaData() {
@ -86,7 +86,7 @@ class nisNetGroupUser extends baseModule {
); );
return $return; return $return;
} }
/** /**
* This function fills the $messages variable with output messages from this module. * 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->addElement($delButton, true);
} }
$return->addVerticalSpace('40px'); $return->addVerticalSpace('40px');
// new entry // new entry
$groupList = array(); $groupList = array();
$groupData = $this->findGroups(); $groupData = $this->findGroups();
@ -188,7 +188,7 @@ class nisNetGroupUser extends baseModule {
$filter->setOnKeyUp('filterSelect(\'group_filter\', \'group_add\', event);'); $filter->setOnKeyUp('filterSelect(\'group_filter\', \'group_add\', event);');
$filterGroup->addElement($filter); $filterGroup->addElement($filter);
$return->addElement($filterGroup, true); $return->addElement($filterGroup, true);
foreach ($groupData as $group) { foreach ($groupData as $group) {
$groupList[$group['cn'][0]] = $group['cn'][0] . '#+#' . $group['dn']; $groupList[$group['cn'][0]] = $group['cn'][0] . '#+#' . $group['dn'];
} }
@ -258,10 +258,10 @@ class nisNetGroupUser extends baseModule {
usort($this->groups, array($this, 'sortTriple')); usort($this->groups, array($this, 'sortTriple'));
return $errors; return $errors;
} }
/** /**
* Returns the user ID for this user. * Returns the user ID for this user.
* *
* @return String user ID * @return String user ID
*/ */
private function getUid() { private function getUid() {
@ -280,7 +280,7 @@ class nisNetGroupUser extends baseModule {
/** /**
* Runs the postmodify actions. * Runs the postmodify actions.
* *
* @see baseModule::postModifyActions() * @see baseModule::postModifyActions()
* *
* @param boolean $newAccount * @param boolean $newAccount
@ -356,7 +356,7 @@ class nisNetGroupUser extends baseModule {
} }
return $messages; return $messages;
} }
/** /**
* Additional LDAP operations on delete. * Additional LDAP operations on delete.
* *
@ -449,15 +449,20 @@ class nisNetGroupUser extends baseModule {
*/ */
function get_pdfEntries($pdfKeys) { function get_pdfEntries($pdfKeys) {
$return = array(); $return = array();
$return[get_class($this) . '_memberships'][0] = '<block>' $pdfTable = new PDFTable();
. '<tr><td width="25%" align=\"L\"><b>' . _('Group') . '</b></td>' $pdfRow = new PDFTableRow();
. '<td width="25%" align=\"L\"><b>' . _('Host name') . '</b></td>' $pdfRow->cells[] = new PDFTableCell(_('Group'), '25%', null, true);
. '<td width="25%" align=\"L\"><b>' . _('Domain name') . '</b></td></tr></block>'; $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) { foreach ($this->groups as $group) {
$return[get_class($this) . '_memberships'][] = '<block><tr><td width="25%" align=\"L\">' . $group['name'] . '</td>' $pdfRow = new PDFTableRow();
. '<td width="25%" align=\"L\">' . $group['host'] . ' </td>' $pdfRow->cells[] = new PDFTableCell($group['name'], '25%');
. '<td width="25%" align=\"L\">' . $group['domain'] . ' </td></tr></block>'; $pdfRow->cells[] = new PDFTableCell($group['host'], '25%');
$pdfRow->cells[] = new PDFTableCell($group['domain'], '25%');
$pdfTable->rows[] = $pdfRow;
} }
$this->addPDFTable($return, 'memberships', $pdfTable);
return $return; return $return;
} }
@ -609,7 +614,7 @@ class nisNetGroupUser extends baseModule {
$typeFilter = '(' . $typeFilter . ')'; $typeFilter = '(' . $typeFilter . ')';
} }
$filter = '(&' . $filter . $typeFilter . ')'; $filter = '(&' . $filter . $typeFilter . ')';
} }
$results = searchLDAPByFilter($filter, array('cn', 'dn', 'nisnetgrouptriple'), array($type)); $results = searchLDAPByFilter($filter, array('cn', 'dn', 'nisnetgrouptriple'), array($type));
for ($i = 0; $i < sizeof($results); $i++) { for ($i = 0; $i < sizeof($results); $i++) {
if (isset($results[$i]['cn'][0]) && isset($results[$i]['dn'])) { if (isset($results[$i]['cn'][0]) && isset($results[$i]['dn'])) {
@ -621,10 +626,10 @@ class nisNetGroupUser extends baseModule {
$this->groupCache = $return; $this->groupCache = $return;
return $return; return $return;
} }
/** /**
* Sorts NIS netgroup triples by group, host and domain. * Sorts NIS netgroup triples by group, host and domain.
* *
* @param array $first first array * @param array $first first array
* @param array $second second array * @param array $second second array
*/ */
@ -637,7 +642,7 @@ class nisNetGroupUser extends baseModule {
} }
return strnatcasecmp($first['domain'], $second['domain']); return strnatcasecmp($first['domain'], $second['domain']);
} }
} }
?> ?>

View File

@ -34,7 +34,7 @@ $Id$
* @package modules * @package modules
*/ */
class nisnetgroup extends baseModule { class nisnetgroup extends baseModule {
/* caches to reduce LDAP queries */ /* caches to reduce LDAP queries */
/** user cache */ /** user cache */
private $cachedUserList = null; private $cachedUserList = null;
@ -42,10 +42,10 @@ class nisnetgroup extends baseModule {
private $cachedHostList = null; private $cachedHostList = null;
/** group cache */ /** group cache */
private $cachedGroupList = null; private $cachedGroupList = null;
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -56,7 +56,7 @@ class nisnetgroup extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -182,7 +182,7 @@ class nisnetgroup extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -282,7 +282,7 @@ class nisnetgroup extends baseModule {
$addButton->setTitle(_('Add')); $addButton->setTitle(_('Add'));
$memberTable->addElement($addButton); $memberTable->addElement($addButton);
$memberTable->colspan = 2; $memberTable->colspan = 2;
$membersLabel = new htmlOutputText(_('Members')); $membersLabel = new htmlOutputText(_('Members'));
$membersLabel->alignment = htmlElement::ALIGN_TOP; $membersLabel->alignment = htmlElement::ALIGN_TOP;
$return->addElement($membersLabel); $return->addElement($membersLabel);
@ -361,7 +361,7 @@ class nisnetgroup extends baseModule {
} }
return $errors; return $errors;
} }
/** /**
* Displays the group selection. * Displays the group selection.
* *
@ -497,7 +497,7 @@ class nisnetgroup extends baseModule {
$return->addElement(new htmlHiddenInput('position', $position)); $return->addElement(new htmlHiddenInput('position', $position));
return $return; return $return;
} }
/** /**
* Processes user input of the host/user selection page. * Processes user input of the host/user selection page.
* It checks if all input values are correct and updates the associated LDAP attributes. * It checks if all input values are correct and updates the associated LDAP attributes.
@ -513,7 +513,7 @@ class nisnetgroup extends baseModule {
} }
return array(); return array();
} }
/** /**
* In this function the LDAP account is built up. * In this function the LDAP account is built up.
* *
@ -556,7 +556,7 @@ class nisnetgroup extends baseModule {
} }
return $messages; return $messages;
} }
/** /**
* This functions is used to check if all settings for this module have been made. * 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, 'description', _('Description'));
$this->addSimplePDFField($return, 'subgroups', _('Subgroups'), 'memberNisNetgroup'); $this->addSimplePDFField($return, 'subgroups', _('Subgroups'), 'memberNisNetgroup');
if (sizeof($this->attributes['nisNetgroupTriple']) > 0) { if (sizeof($this->attributes['nisNetgroupTriple']) > 0) {
$return[get_class($this) . '_members'] = array('<block><tr><td width="80%"><b>' . _('Members') . '</b></td></tr></block>'); $pdfTable = new PDFTable(_('Members'));
$return[get_class($this) . '_members'][] = '<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%"><b>' . _('Host') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Host'), '20%', null, true);
'<td width="20%"><b>' . _('User') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('User'), '20%', null, true);
'<td width="30%"><b>' . _('Domain') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Domain'), '20%', null, true);
'</tr></block>'; $pdfTable->rows[] = $pdfRow;
for ($i = 0; $i < sizeof($this->attributes['nisNetgroupTriple']); $i++) { for ($i = 0; $i < sizeof($this->attributes['nisNetgroupTriple']); $i++) {
$triple = substr($this->attributes['nisNetgroupTriple'][$i], 1, strlen($this->attributes['nisNetgroupTriple'][$i]) - 2); $triple = substr($this->attributes['nisNetgroupTriple'][$i], 1, strlen($this->attributes['nisNetgroupTriple'][$i]) - 2);
$triple = explode(',', $triple); $triple = explode(',', $triple);
$return[get_class($this) . '_members'][] = '<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%" align=\"L\">' . $triple[0] . ' </td>' . $pdfRow->cells[] = new PDFTableCell($triple[0], '20%');
'<td width="20%" align=\"L\">' . $triple[1] . ' </td>' . $pdfRow->cells[] = new PDFTableCell($triple[1], '20%');
'<td width="30%" align=\"L\">' . $triple[2] . ' </td>' . $pdfRow->cells[] = new PDFTableCell($triple[2], '30%');
'</tr></block>'; $pdfTable->rows[] = $pdfRow;
} }
$return[get_class($this) . '_members'][] = '<block><tr><td width="80%"> </td></tr></block>'; $this->addPDFTable($return, 'members', $pdfTable);
} }
return $return; return $return;
} }
/** /**
* Returns a list of existing NIS net groups. * Returns a list of existing NIS net groups.
* *

View File

@ -50,7 +50,7 @@ class puppetClient extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -121,7 +121,7 @@ class puppetClient extends baseModule {
$configContainer = new htmlTable(); $configContainer = new htmlTable();
$configContainer->addElement(new htmlTableExtendedInputTextarea('puppetClient_environments', "production\r\ntesting", 30, 5, _('Predefined environments'), 'predefinedEnvironments'), true); $configContainer->addElement(new htmlTableExtendedInputTextarea('puppetClient_environments', "production\r\ntesting", 30, 5, _('Predefined environments'), 'predefinedEnvironments'), true);
$return['config_options']['all'] = $configContainer; $return['config_options']['all'] = $configContainer;
// upload fields // upload fields
$return['upload_columns'] = array( $return['upload_columns'] = array(
array( array(
'name' => 'puppetClient_environment', 'name' => 'puppetClient_environment',
@ -212,7 +212,7 @@ class puppetClient extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -275,7 +275,7 @@ class puppetClient extends baseModule {
$puppetvar = implode("\r\n", $this->attributes['puppetvar']); $puppetvar = implode("\r\n", $this->attributes['puppetvar']);
} }
$return->addElement(new htmlTableExtendedInputTextarea('puppetvar', $puppetvar, 60, 5, _('Variables'), 'puppetvar'), true); $return->addElement(new htmlTableExtendedInputTextarea('puppetvar', $puppetvar, 60, 5, _('Variables'), 'puppetvar'), true);
$return->addElement(new htmlSpacer(null, '10px'),true); $return->addElement(new htmlSpacer(null, '10px'),true);
$remButton = new htmlAccountPageButton('puppetClient', 'attributes', 'remObjectClass', _('Remove Puppet extension')); $remButton = new htmlAccountPageButton('puppetClient', 'attributes', 'remObjectClass', _('Remove Puppet extension'));
$remButton->colspan = 4; $remButton->colspan = 4;
@ -353,7 +353,7 @@ class puppetClient extends baseModule {
} }
} }
$this->attributes['puppetvar'] = array_values(array_unique($puppetvar)); $this->attributes['puppetvar'] = array_values(array_unique($puppetvar));
return $errors; return $errors;
} }
@ -431,20 +431,26 @@ class puppetClient extends baseModule {
$this->addSimplePDFField($return, 'environment', _('Environment')); $this->addSimplePDFField($return, 'environment', _('Environment'));
$this->addSimplePDFField($return, 'parentnode', _('Parent node')); $this->addSimplePDFField($return, 'parentnode', _('Parent node'));
if (isset($this->attributes['puppetclass'][0])) { if (isset($this->attributes['puppetclass'][0])) {
$return['puppetClient_puppetclass'][0] = '<block><key>' . _('Classes') . '</key><tr><td align=\"L\">' . $this->attributes['puppetclass'][0] . '</td></tr></block>'; $pdfTable = new PDFTable(_('Classes'));
for ($i = 1; $i < sizeof($this->attributes['puppetclass']); $i++) { for ($i = 0; $i < sizeof($this->attributes['puppetclass']); $i++) {
$return['puppetClient_puppetclass'][] = '<block><tr><td align=\"L\">' . $this->attributes['puppetclass'][$i] . '</td></tr></block>'; $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])) { if (isset($this->attributes['puppetvar'][0])) {
$return['puppetClient_puppetvar'][0] = '<block><key>' . _('Variables') . '</key><tr><td align=\"L\">' . $this->attributes['puppetvar'][0] . '</td></tr></block>'; $pdfTable = new PDFTable(_('Variables'));
for ($i = 1; $i < sizeof($this->attributes['puppetvar']); $i++) { for ($i = 0; $i < sizeof($this->attributes['puppetvar']); $i++) {
$return['puppetClient_puppetvar'][] = '<block><tr><td align=\"L\">' . $this->attributes['puppetvar'][$i] . '</td></tr></block>'; $pdfRow = new PDFTableRow();
$pdfRow->cells[] = new PDFTableCell($this->attributes['puppetvar'][$i]);
$pdfTable->rows[] = $pdfRow;
} }
$this->addPDFTable($return, 'puppetvar', $pdfTable);
} }
return $return; return $return;
} }
/** /**
* This function defines what attributes will be used in the account profiles and their appearance in the profile editor. * 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 * The field name are used as keywords to load
* and save profiles. We recommend to use the module name as prefix for them * and save profiles. We recommend to use the module name as prefix for them
* (e.g. posixAccount_homeDirectory) to avoid naming conflicts. * (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
* *
* @return htmlElement meta HTML object * @return htmlElement meta HTML object
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
* @see htmlElement * @see htmlElement
*/ */
@ -496,10 +502,10 @@ class puppetClient extends baseModule {
$this->attributes['puppetvar'] = $profile['puppetClient_puppetvar']; $this->attributes['puppetvar'] = $profile['puppetClient_puppetvar'];
} }
} }
/** /**
* Reurns a list of valid parent nodes for this node. * Reurns a list of valid parent nodes for this node.
* *
* @return array parent nodes (e.g. array('node1', 'node2')) * @return array parent nodes (e.g. array('node1', 'node2'))
*/ */
private function getPossibleParentNodes() { private function getPossibleParentNodes() {

View File

@ -33,18 +33,18 @@ $Id$
* @package modules * @package modules
*/ */
class pykotaUser extends baseModule { class pykotaUser extends baseModule {
/** cache for uid attribute */ /** cache for uid attribute */
private $uidCache = null; private $uidCache = null;
/** cache for pykotaUserName attribute */ /** cache for pykotaUserName attribute */
private $pykotaUserNameCache = null; private $pykotaUserNameCache = null;
/** list of limit options label => value */ /** list of limit options label => value */
private $limitOptions; private $limitOptions;
/** /**
* Returns if this module also manages the structural object class pykotaObject. * Returns if this module also manages the structural object class pykotaObject.
* This is overridden by a submodule that must provide the structural object class. * This is overridden by a submodule that must provide the structural object class.
* *
* @return boolean structural usage * @return boolean structural usage
*/ */
public function isStructural() { 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. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -82,7 +82,7 @@ class pykotaUser extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -329,7 +329,7 @@ class pykotaUser extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { 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 = new htmlStatusMessage('INFO', sprintf(_("Please enter an user name on this page: %s"), $page));
$msg->colspan = 5; $msg->colspan = 5;
$container->addElement($msg, true); $container->addElement($msg, true);
} }
} }
// pykotaUserName // pykotaUserName
$this->addSimpleInputTextField($container, 'pykotaUserName', _('Pykota user name')); $this->addSimpleInputTextField($container, 'pykotaUserName', _('Pykota user name'));
@ -573,7 +573,7 @@ class pykotaUser extends baseModule {
/** /**
* Returns the HTML meta data for the payments page. * Returns the HTML meta data for the payments page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_payments() { function display_html_payments() {
@ -621,7 +621,7 @@ class pykotaUser extends baseModule {
$container->addElement($backButton, true); $container->addElement($backButton, true);
return $container; return $container;
} }
/** /**
* Processes user input of the payments module page. * Processes user input of the payments module page.
* It checks if all input values are correct and updates the associated LDAP attributes. * 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. * Returns the HTML meta data for the jobs page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_jobs() { 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. * 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}.<br> * Calling this method requires the existence of an enclosing {@link accountContainer}.<br>
* <br> * <br>
* This function tells LAM if it can create/modify the LDAP account. If your module needs any * 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 . ' # '; $this->attributes['pykotaPayments'][] = date('Y-m-d H:i:s,00', time()) . ' # ' . $amount . ' # ';
} }
} }
/** /**
* In this function the LDAP account is built up. * In this function the LDAP account is built up.
* *
@ -879,7 +879,7 @@ class pykotaUser extends baseModule {
} }
return $messages; return $messages;
} }
/** /**
* Returns a list of possible PDF entries for this account. * Returns a list of possible PDF entries for this account.
* *
@ -904,22 +904,25 @@ class pykotaUser extends baseModule {
$this->addSimplePDFField($return, 'pykotaLifeTimePaid', _('Total paid')); $this->addSimplePDFField($return, 'pykotaLifeTimePaid', _('Total paid'));
// payment history // payment history
if (!empty($this->attributes['pykotaPayments'][0])) { if (!empty($this->attributes['pykotaPayments'][0])) {
$history[] = '<block><tr>' . $pdfTable = new PDFTable();
'<td width="20%"><b>' . _('Date') . '</b></td>' . $pdfRow = new PDFTableRow();
'<td width="10%"><b>' . _('Amount') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Date'), '20%', null, true);
'<td width="70%"><b>' . _('Comment') . '</b></td></tr></block>'; $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++) { for ($i = 0; $i < sizeof($this->attributes['pykotaPayments']); $i++) {
$parts = explode(' # ', $this->attributes['pykotaPayments'][$i]); $parts = explode(' # ', $this->attributes['pykotaPayments'][$i]);
$comment = ' '; $comment = ' ';
if (!empty($parts[2])) { if (!empty($parts[2])) {
$comment = base64_decode($parts[2]); $comment = base64_decode($parts[2]);
} }
$history[] = '<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%" align=\"L\">' . $parts[0] . '</td>' . $pdfRow->cells[] = new PDFTableCell($parts[0], '20%');
'<td width="10%" align=\"R\">' . $parts[1] . '</td>' . $pdfRow->cells[] = new PDFTableCell($parts[1], '10%', PDFTableCell::ALIGN_RIGHT);
'<td width="70%" align=\"L\">' . $comment . '</td></tr></block>'; $pdfRow->cells[] = new PDFTableCell($comment, '70%');
$pdfTable->rows[] = $pdfRow;
} }
$return[get_class($this) . '_pykotaPayments'] = $history; $this->addPDFTable($return, 'pykotaPayments', $pdfTable);
} }
return $return; return $return;
} }
@ -1032,7 +1035,7 @@ class pykotaUser extends baseModule {
/** /**
* Checks if the self service settings are valid. * Checks if the self service settings are valid.
* *
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> * Calling this method does not require the existence of an enclosing {@link accountContainer}.<br>
* <br> * <br>
* If the input data is invalid the return value is an array that contains arrays * 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; return $errors;
} }
/** /**
* Returns if the uid attribute should be managed. * Returns if the uid attribute should be managed.
* *
* @return boolean manage uid attribute * @return boolean manage uid attribute
*/ */
private function manageUid() { private function manageUid() {
@ -1074,7 +1077,7 @@ class pykotaUser extends baseModule {
/** /**
* Returns if the mail attribute should be managed. * Returns if the mail attribute should be managed.
* *
* @return boolean manage mail attribute * @return boolean manage mail attribute
*/ */
private function manageMail() { private function manageMail() {
@ -1092,7 +1095,7 @@ class pykotaUser extends baseModule {
/** /**
* Returns if the description attribute should be managed. * Returns if the description attribute should be managed.
* *
* @return boolean manage description attribute * @return boolean manage description attribute
*/ */
private function manageDescription() { private function manageDescription() {
@ -1107,10 +1110,10 @@ class pykotaUser extends baseModule {
} }
return false; return false;
} }
/** /**
* Returns if the given uid already exists. * Returns if the given uid already exists.
* *
* @param String $uid uid attribute value * @param String $uid uid attribute value
* @return boolean uid exists * @return boolean uid exists
*/ */
@ -1123,7 +1126,7 @@ class pykotaUser extends baseModule {
/** /**
* Returns if the given pykotaUserName already exists. * Returns if the given pykotaUserName already exists.
* *
* @param String $pykotaUserName pykotaUserName attribute value * @param String $pykotaUserName pykotaUserName attribute value
* @return boolean pykotaUserName exists * @return boolean pykotaUserName exists
*/ */
@ -1133,7 +1136,7 @@ class pykotaUser extends baseModule {
} }
return in_array($pykotaUserName, $this->pykotaUserNameCache); return in_array($pykotaUserName, $this->pykotaUserNameCache);
} }
/** /**
* Loads the list of user names into the cache. * 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. * Returns the current user name (uid) of this account.
* *
* @return String user name * @return String user name
*/ */
private function getCurrentUserName() { private function getCurrentUserName() {
@ -1176,11 +1179,11 @@ class pykotaUser extends baseModule {
} }
return ''; return '';
} }
/** /**
* Returns a list of jobs for the given user reverse-sorted by date. * Returns a list of jobs for the given user reverse-sorted by date.
* The number of jobs is limited to 100. * The number of jobs is limited to 100.
* *
* @param String $user user name * @param String $user user name
* @param String $suffix LDAP suffix for job objects * @param String $suffix LDAP suffix for job objects
*/ */

View File

@ -38,7 +38,7 @@ $Id$
* @package modules * @package modules
*/ */
class quota extends baseModule { class quota extends baseModule {
/** delimiter for lamdaemon commands */ /** delimiter for lamdaemon commands */
private static $SPLIT_DELIMITER = "###x##y##x###"; private static $SPLIT_DELIMITER = "###x##y##x###";
/** prefix for lamdaemon results */ /** 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. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -76,7 +76,7 @@ class quota extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function get_metaData() { function get_metaData() {
@ -159,7 +159,7 @@ class quota extends baseModule {
/** Saves the quota settings */ /** Saves the quota settings */
private $quota; private $quota;
/** /**
* Initializes the quota values. * Initializes the quota values.
* *
@ -219,7 +219,7 @@ class quota extends baseModule {
} }
return null; return null;
} }
/** /**
* This function is used to check if this module page can be displayed. * 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. * 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. * Quotas are set in postmodify.
* *
* @see baseModule::postModifyActions() * @see baseModule::postModifyActions()
* *
* @param boolean $newAccount is new account * @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. * 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. * @return array Array which contains status messages. Each entry is an array containing the status message parameters.
*/ */
function preDeleteActions() { function preDeleteActions() {
@ -371,7 +371,7 @@ class quota extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
@ -416,7 +416,7 @@ class quota extends baseModule {
$return->addElement(new htmlHelpLink('HardInodeLimit')); $return->addElement(new htmlHelpLink('HardInodeLimit'));
$return->addElement(new htmlHelpLink('GraceInodePeriod')); $return->addElement(new htmlHelpLink('GraceInodePeriod'));
$return->addNewLine(); $return->addNewLine();
$i=0; $i=0;
// loop for every mointpoint with enabled quotas // loop for every mointpoint with enabled quotas
while (isset($this->quota[$server][$i][0])) { while (isset($this->quota[$server][$i][0])) {
@ -451,7 +451,7 @@ class quota extends baseModule {
} }
return $return; return $return;
} }
/** /**
* Replaces special characters in HTML name values. * Replaces special characters in HTML name values.
* *
@ -515,7 +515,7 @@ class quota extends baseModule {
$return->addElement(new htmlHelpLink('SoftInodeLimit')); $return->addElement(new htmlHelpLink('SoftInodeLimit'));
$return->addElement(new htmlHelpLink('HardInodeLimit')); $return->addElement(new htmlHelpLink('HardInodeLimit'));
$return->addNewLine(); $return->addNewLine();
for ($i = 0; $i < sizeof($dirs); $i++) { for ($i = 0; $i < sizeof($dirs); $i++) {
$return->addElement(new htmlOutputText($dirs[$i])); $return->addElement(new htmlOutputText($dirs[$i]));
$sbLimit = new htmlInputField("quota_softblock_" . $id . "_" . $dirs[$i]); $sbLimit = new htmlInputField("quota_softblock_" . $id . "_" . $dirs[$i]);
@ -617,7 +617,7 @@ class quota extends baseModule {
$this->initQuotas(); $this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return array(); if (!isset($this->quota) || !is_array($this->quota)) return array();
if (sizeof($this->quota) > 0) { if (sizeof($this->quota) > 0) {
$quotas = array(); $pdfTable = new PDFTable();
// get list of lamdaemon servers // get list of lamdaemon servers
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
for ($s = 0; $s < sizeof($lamdaemonServers); $s++) { for ($s = 0; $s < sizeof($lamdaemonServers); $s++) {
@ -626,27 +626,32 @@ class quota extends baseModule {
$description = $server; $description = $server;
if (isset($temp[1])) $description = $temp[1] . " (" . $server . ")"; if (isset($temp[1])) $description = $temp[1] . " (" . $server . ")";
if (!isset($this->quota[$server]) || (sizeof($this->quota[$server]) < 1)) continue; if (!isset($this->quota[$server]) || (sizeof($this->quota[$server]) < 1)) continue;
$pdfRow = new PDFTableRow();
$quotas[] = '<block><tr>' . $pdfRow->cells[] = new PDFTableCell($description, null, null, true);
'<td width="80%"><b>' . $description . '</b></td>' . $pdfTable->rows[] = $pdfRow;
'</tr></block>'; $pdfRow = new PDFTableRow();
$quotas[] = '<block><tr>' . $pdfRow->cells[] = new PDFTableCell(_('Mountpoint'), '28%', null, true);
'<td width="20%"><b>' . _('Mountpoint') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Soft block'), '18%', null, true);
'<td width="20%"><b>' . _('Soft block') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Hard block'), '18%', null, true);
'<td width="20%"><b>' . _('Hard block') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Soft inode'), '18%', null, true);
'<td width="20%"><b>' . _('Soft inode') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Hard inode'), '18%', null, true);
'<td width="20%"><b>' . _('Hard inode') . '</b></td></tr></block>'; $pdfTable->rows[] = $pdfRow;
for ($i = 0; $i < sizeof($this->quota[$server]); $i++) { for ($i = 0; $i < sizeof($this->quota[$server]); $i++) {
$quotas[] = '<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%" align=\"L\">' . $this->quota[$server][$i][0] . '</td>' . $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][0], '28%');
'<td width="20%" align=\"L\">' . $this->quota[$server][$i][2] . '</td>' . $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][2], '18%');
'<td width="20%" align=\"L\">' . $this->quota[$server][$i][3] . '</td>' . $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][3], '18%');
'<td width="20%" align=\"L\">' . $this->quota[$server][$i][6] . '</td>' . $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][6], '18%');
'<td width="20%" align=\"L\">' . $this->quota[$server][$i][7] . '</td></tr></block>'; $pdfRow->cells[] = new PDFTableCell($this->quota[$server][$i][7], '18%');
$pdfTable->rows[] = $pdfRow;
} }
$quotas[] = '<block><tr><td width="80%"> </td></tr></block>'; $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 { else {
return array(); return array();
@ -826,10 +831,10 @@ class quota extends baseModule {
} }
return array('status' => 'finished'); return array('status' => 'finished');
} }
/** /**
* Returns a list of modifications which have to be made to the LDAP account. * 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}.<br> * Calling this method requires the existence of an enclosing {@link accountContainer}.<br>
* <br> * <br>
* *
@ -844,7 +849,7 @@ class quota extends baseModule {
* <br><b>"info"</b> values with informational value (e.g. to be used later by pre/postModify actions) * <br><b>"info"</b> values with informational value (e.g. to be used later by pre/postModify actions)
* <br> * <br>
* <br>This builds the required comands from $this-attributes and $this->orig. * <br>This builds the required comands from $this-attributes and $this->orig.
* *
* @return array list of modifications * @return array list of modifications
*/ */
public function save_attributes() { public function save_attributes() {

View File

@ -42,16 +42,16 @@ class range extends baseModule {
/** subnet */ /** subnet */
public $subnet; public $subnet;
/** ranges */ /** ranges */
public $ranges; public $ranges;
/** Range -> Function attibute_processed already running? */ /** Range -> Function attibute_processed already running? */
public $processed; public $processed;
/** For check, if IPs overlaped. */ /** For check, if IPs overlaped. */
public $overlaped; public $overlaped;
/** list of pools that currently exist in LDAP */ /** list of pools that currently exist in LDAP */
private $poolsOrig = array(); private $poolsOrig = array();
/** list of pools that need to be updated in LDAP */ /** 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. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -70,7 +70,7 @@ class range extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_metaData() { public function get_metaData() {
@ -122,12 +122,12 @@ class range extends baseModule {
"Text" => _("The pool's failover peer.") "Text" => _("The pool's failover peer.")
), ),
); );
// available PDF fields // available PDF fields
$return['PDF_fields'] = array('ranges' => _('Ranges')); $return['PDF_fields'] = array('ranges' => _('Ranges'));
return $return; return $return;
} }
/** /**
* This function fills the error message array with messages. * 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_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); $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. * Calculates the subnet for a given IP and netmask.
* *
@ -148,7 +148,7 @@ class range extends baseModule {
private static function calculateSubnet($ip, $mask) { private static function calculateSubnet($ip, $mask) {
return long2ip(ip2long($ip) & ip2long($mask)); return long2ip(ip2long($ip) & ip2long($mask));
} }
/** /**
* Checks if the first IP is smaller than the second IP. * 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; * @return true, if it's a valid Range, else false;
**/ **/
public function check_range($first_ip, $second_ip) { public function check_range($first_ip, $second_ip) {
$ex_first = explode(".", $first_ip); $ex_first = explode(".", $first_ip);
$ex_second = explode(".", $second_ip); $ex_second = explode(".", $second_ip);
@ -172,7 +172,7 @@ class range extends baseModule {
} }
return false; return false;
} }
/** /**
* Check if an IP address is in the correct subnet. * Check if an IP address is in the correct subnet.
* *
@ -185,7 +185,7 @@ class range extends baseModule {
$ipSubnet = range::calculateSubnet($ip, $mask); $ipSubnet = range::calculateSubnet($ip, $mask);
return ($subnet == $ipSubnet); return ($subnet == $ipSubnet);
} }
/** /**
* *
* Checked, if Ranges are overlaped. * Checked, if Ranges are overlaped.
@ -199,7 +199,7 @@ class range extends baseModule {
function overlaped_range($ip,$ipB) { function overlaped_range($ip,$ipB) {
$ex = explode(".", $ip); $ex = explode(".", $ip);
$exB = explode(".", $ipB); $exB = explode(".", $ipB);
if(!is_array($this->overlaped)) { if(!is_array($this->overlaped)) {
$this->overlaped = array(); $this->overlaped = array();
} }
@ -213,7 +213,7 @@ class range extends baseModule {
} }
return true; return true;
} }
/** /**
* *
* Reset the overlaped_range() function * Reset the overlaped_range() function
@ -222,7 +222,7 @@ class range extends baseModule {
function reset_overlaped_range() { function reset_overlaped_range() {
$this->overlaped = array(); $this->overlaped = array();
} }
/** /**
* Controls if the module button the account page is visible and activated. * Controls if the module button the account page is visible and activated.
* *
@ -262,7 +262,7 @@ class range extends baseModule {
$this->loadPools(); $this->loadPools();
} }
} }
/** /**
* *
* Adapt the Ranges with the subnet. * Adapt the Ranges with the subnet.
@ -304,7 +304,7 @@ class range extends baseModule {
} }
return $range_edit; return $range_edit;
} }
/** /**
* Processes user input of the primary module page. * Processes user input of the primary module page.
* It checks if all input values are correct and updates the associated LDAP attributes. * 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'=>''); $this->ranges[] = array('range_start'=>'','range_end'=>'');
} }
} }
// update pool data // update pool data
foreach ($this->poolsNew as $index => $pool) { foreach ($this->poolsNew as $index => $pool) {
// delete pool // delete pool
@ -468,7 +468,7 @@ class range extends baseModule {
'dhcprange' => array('') 'dhcprange' => array('')
); );
} }
// Check if there was a error: // Check if there was a error:
if ($errorOccured) { if ($errorOccured) {
$errors[] = $this->messages['range_errors'][0]; $errors[] = $this->messages['range_errors'][0];
@ -477,10 +477,10 @@ class range extends baseModule {
$this->processed = true; $this->processed = true;
return $errors; return $errors;
} }
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { 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->addElement(new htmlStatusMessage('INFO', _("Please fill out the DHCP settings first.")));
return $return; return $return;
} }
// If $ranges is not a array, then create it // If $ranges is not a array, then create it
if (!is_array($this->ranges)) { if (!is_array($this->ranges)) {
$this->ranges = array(); $this->ranges = array();
@ -537,14 +537,14 @@ class range extends baseModule {
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addElement(new htmlSpacer(null, '10px'), true);
} }
// add new range // add new range
$addButton = new htmlButton('add_range', _('New range')); $addButton = new htmlButton('add_range', _('New range'));
$addButton->setIconClass('createButton'); $addButton->setIconClass('createButton');
$addButton->colspan = 2; $addButton->colspan = 2;
$return->addElement($addButton); $return->addElement($addButton);
$return->addElement(new htmlHelpLink('add_range'), true); $return->addElement(new htmlHelpLink('add_range'), true);
// pools // pools
if (!empty($this->poolsNew)) { if (!empty($this->poolsNew)) {
$return->addElement(new htmlSubTitle(_('Pools')), true); $return->addElement(new htmlSubTitle(_('Pools')), true);
@ -622,20 +622,20 @@ class range extends baseModule {
} }
$return->addVerticalSpace('20px'); $return->addVerticalSpace('20px');
} }
// add new range pool // add new range pool
$addButton = new htmlButton('add_pool', _('New pool')); $addButton = new htmlButton('add_pool', _('New pool'));
$addButton->setIconClass('createButton'); $addButton->setIconClass('createButton');
$addButton->colspan = 2; $addButton->colspan = 2;
$return->addElement($addButton); $return->addElement($addButton);
$return->addElement(new htmlHelpLink('add_pool'), true); $return->addElement(new htmlHelpLink('add_pool'), true);
return $return; return $return;
} }
/** /**
* Allows the module to run commands after the LDAP entry is changed or created. * 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}. * Calling this method requires the existence of an enclosing {@link accountContainer}.
* *
* @param boolean $newAccount new account * @param boolean $newAccount new account
@ -759,7 +759,7 @@ class range extends baseModule {
// Return attributes // Return attributes
return $return; return $return;
} }
/** /**
* Returns a list of possible PDF entries for this account. * Returns a list of possible PDF entries for this account.
* *
@ -769,18 +769,46 @@ class range extends baseModule {
function get_pdfEntries($pdfKeys) { function get_pdfEntries($pdfKeys) {
$return = array(); $return = array();
if (is_array($this->ranges) && (sizeof($this->ranges) > 0)) { if (is_array($this->ranges) && (sizeof($this->ranges) > 0)) {
$start = $this->ranges[0]['range_start']; $pdfTable = new PDFTable(_('Ranges'));
$end = $this->ranges[0]['range_end']; for ($i = 0; $i < sizeof($this->ranges); $i++) {
$return[get_class($this) . '_ranges'] = array('<block><key>' . _('Ranges') . '</key><tr><td align=\"L\">' . $start . " - " . $end . '</td></tr></block>');
for ($i = 1; $i < sizeof($this->ranges); $i++) {
$start = $this->ranges[$i]['range_start']; $start = $this->ranges[$i]['range_start'];
$end = $this->ranges[$i]['range_end']; $end = $this->ranges[$i]['range_end'];
$return[get_class($this) . '_ranges'][] = '<block><tr><td align=\"L\">' . $start . " - " . $end . '</td></tr></block>'; $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; return $return;
} }
/** /**
* Loads the list of pools from LDAP. * Loads the list of pools from LDAP.
*/ */
@ -794,7 +822,7 @@ class range extends baseModule {
} }
$this->poolsNew = $this->poolsOrig; $this->poolsNew = $this->poolsOrig;
} }
} }
?> ?>

View File

@ -33,10 +33,10 @@ $Id$
* @package modules * @package modules
*/ */
class systemQuotas extends baseModule { class systemQuotas extends baseModule {
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -47,7 +47,7 @@ class systemQuotas extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_metaData() { public function get_metaData() {
@ -112,7 +112,7 @@ class systemQuotas extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
@ -226,7 +226,7 @@ class systemQuotas extends baseModule {
$this->attributes['quota'] = array_unique($this->attributes['quota']); $this->attributes['quota'] = array_unique($this->attributes['quota']);
return $return; return $return;
} }
/** /**
* Checks if the quota parameters are valid. * Checks if the quota parameters are valid.
* *
@ -331,7 +331,7 @@ class systemQuotas extends baseModule {
} }
return $messages; return $messages;
} }
/** /**
* Loads the values of an account profile into internal variables. * 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]); $this->attributes['quota'] = explode(';', $profile['systemQuotas_quota'][0]);
} }
} }
/** /**
* In this function the LDAP account is built up. * In this function the LDAP account is built up.
* *
@ -371,7 +371,7 @@ class systemQuotas extends baseModule {
} }
return $messages; return $messages;
} }
/** /**
* Returns a list of possible PDF entries for this account. * Returns a list of possible PDF entries for this account.
* *
@ -381,22 +381,25 @@ class systemQuotas extends baseModule {
public function get_pdfEntries($pdfKeys) { public function get_pdfEntries($pdfKeys) {
$return = array(); $return = array();
if (isset($this->attributes['quota'][0])) { if (isset($this->attributes['quota'][0])) {
$quotas[] = '<block><tr>' . $pdfTable = new PDFTable();
'<td width="20%"><b>' . _('Mountpoint') . '</b></td>' . $pdfRow = new PDFTableRow();
'<td width="20%"><b>' . _('Soft block') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Mountpoint'), '28%', null, true);
'<td width="20%"><b>' . _('Hard block') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Soft block'), '18%', null, true);
'<td width="20%"><b>' . _('Soft inode') . '</b></td>' . $pdfRow->cells[] = new PDFTableCell(_('Hard block'), '18%', null, true);
'<td width="20%"><b>' . _('Hard inode') . '</b></td></tr></block>'; $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++) { for ($i = 0; $i < sizeof($this->attributes['quota']); $i++) {
$parts = explode(',', $this->attributes['quota'][$i]); $parts = explode(',', $this->attributes['quota'][$i]);
$quotas[] = '<block><tr>' . $pdfRow = new PDFTableRow();
'<td width="20%" align=\"L\">' . $parts[0] . '</td>' . $pdfRow->cells[] = new PDFTableCell($parts[0], '28%');
'<td width="20%" align=\"L\">' . $parts[1] . '</td>' . $pdfRow->cells[] = new PDFTableCell($parts[1], '18%');
'<td width="20%" align=\"L\">' . $parts[2] . '</td>' . $pdfRow->cells[] = new PDFTableCell($parts[2], '18%');
'<td width="20%" align=\"L\">' . $parts[3] . '</td>' . $pdfRow->cells[] = new PDFTableCell($parts[3], '18%');
'<td width="20%" align=\"L\">' . $parts[4] . '</td></tr></block>'; $pdfRow->cells[] = new PDFTableCell($parts[4], '18%');
$pdfTable->rows[] = $pdfRow;
} }
$return['systemQuotas_quota'] = $quotas; $this->addPDFTable($return, 'quota', $pdfTable);
} }
return $return; return $return;
} }

View File

@ -33,14 +33,14 @@ $Id$
* @package modules * @package modules
*/ */
class windowsGroup extends baseModule { class windowsGroup extends baseModule {
/** possible group types (e.g. distribution) */ /** possible group types (e.g. distribution) */
private $groupTypes; private $groupTypes;
/** possible group scopes (e.g. universal) */ /** possible group scopes (e.g. universal) */
private $groupScopes; private $groupScopes;
/** group cache */ /** group cache */
private $groupCache; private $groupCache;
/** security group */ /** security group */
const TYPE_SECURITY = 'security'; const TYPE_SECURITY = 'security';
/** email list */ /** email list */
@ -51,7 +51,7 @@ class windowsGroup extends baseModule {
const SCOPE_GLOBAL = 'global'; const SCOPE_GLOBAL = 'global';
/** universal group */ /** universal group */
const SCOPE_UNIVERSAL = 'universal'; const SCOPE_UNIVERSAL = 'universal';
/** /**
* Creates a new module for Samba 3 groups. * Creates a new module for Samba 3 groups.
* *
@ -70,10 +70,10 @@ class windowsGroup extends baseModule {
// call parent constructor // call parent constructor
parent::__construct($scope); parent::__construct($scope);
} }
/** /**
* Returns true if this module can manage accounts of the current type, otherwise false. * Returns true if this module can manage accounts of the current type, otherwise false.
* *
* @return boolean true if module fits * @return boolean true if module fits
*/ */
public function can_manage() { public function can_manage() {
@ -84,7 +84,7 @@ class windowsGroup extends baseModule {
* Returns meta data that is interpreted by parent class * Returns meta data that is interpreted by parent class
* *
* @return array array with meta data * @return array array with meta data
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_metaData() { public function get_metaData() {
@ -299,7 +299,7 @@ class windowsGroup extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
@ -427,7 +427,7 @@ class windowsGroup extends baseModule {
} }
$container->addElement(new htmlOutputText('')); $container->addElement(new htmlOutputText(''));
$container->addElement($memberOf, true); $container->addElement($memberOf, true);
$container->addElement(new htmlEqualWidth(array('groupType', 'groupScope'))); $container->addElement(new htmlEqualWidth(array('groupType', 'groupScope')));
return $container; return $container;
} }
@ -497,7 +497,7 @@ class windowsGroup extends baseModule {
} }
return $return; return $return;
} }
/** /**
* Displays the memberof selection. * Displays the memberof selection.
* *
@ -516,7 +516,7 @@ class windowsGroup extends baseModule {
$groupContainer->addElement(new htmlOutputText('')); $groupContainer->addElement(new htmlOutputText(''));
$groupContainer->addElement(new htmlOutputText(_("Available groups"))); $groupContainer->addElement(new htmlOutputText(_("Available groups")));
$groupContainer->addNewLine(); $groupContainer->addNewLine();
$selectedGroups = array(); $selectedGroups = array();
if (empty($this->attributes['memberOf'])) { if (empty($this->attributes['memberOf'])) {
$this->attributes['memberOf'] = array(); $this->attributes['memberOf'] = array();
@ -534,7 +534,7 @@ class windowsGroup extends baseModule {
$availableGroups[getAbstractDN($dn)] = $dn; $availableGroups[getAbstractDN($dn)] = $dn;
} }
} }
$remGroupSelect = new htmlSelect('removegroups', $selectedGroups, null, 15); $remGroupSelect = new htmlSelect('removegroups', $selectedGroups, null, 15);
$remGroupSelect->setMultiSelect(true); $remGroupSelect->setMultiSelect(true);
$remGroupSelect->setTransformSingleSelect(false); $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. * This function will create the meta HTML code to show a page to change the member attribute.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_managedBy() { function display_html_managedBy() {
@ -621,7 +621,7 @@ class windowsGroup extends baseModule {
$return->addElement($buttonTable); $return->addElement($buttonTable);
return $return; return $return;
} }
/** /**
* Processes user input of the members page. * Processes user input of the members page.
* It checks if all input values are correct and updates the associated LDAP attributes. * 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. * This function will create the meta HTML code to show a page to change the member attribute.
* *
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_user() { function display_html_user() {
@ -652,7 +652,7 @@ class windowsGroup extends baseModule {
$filter->setOnKeyUp('filterSelect(\'windows_filter\', \'members\', event);'); $filter->setOnKeyUp('filterSelect(\'windows_filter\', \'members\', event);');
$filterGroup->addElement($filter); $filterGroup->addElement($filter);
$return->addElement($filterGroup, true); $return->addElement($filterGroup, true);
$options = array(); $options = array();
$filter = get_ldap_filter($_POST['type']); $filter = get_ldap_filter($_POST['type']);
$entries = searchLDAPByFilter($filter, array('dn'), array($_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->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'membersBack', _('Back')));
return $return; return $return;
} }
/** /**
* Processes user input of the members page. * Processes user input of the members page.
* It checks if all input values are correct and updates the associated LDAP attributes. * It checks if all input values are correct and updates the associated LDAP attributes.
@ -860,7 +860,7 @@ class windowsGroup extends baseModule {
} }
return $errors; return $errors;
} }
/** /**
* Returns a list of possible PDF entries for this account. * Returns a list of possible PDF entries for this account.
* *
@ -914,10 +914,13 @@ class windowsGroup extends baseModule {
$memberList = $this->attributes['member']; $memberList = $this->attributes['member'];
} }
usort($memberList, 'compareDN'); usort($memberList, 'compareDN');
$return[get_class($this) . '_member'][0] = '<block><key>' . _('Members') . '</key><tr><td align=\"L\">' . $memberList[0] . '</td></tr></block>'; $pdfTable = new PDFTable(_('Members'));
for ($i = 1; $i < sizeof($memberList); $i++) { for ($i = 0; $i < sizeof($memberList); $i++) {
$return[get_class($this) . '_member'][] = '<block><tr><td align=\"L\">' . $memberList[$i] . '</td></tr></block>'; $pdfRow = new PDFTableRow();
$pdfRow->cells[] = new PDFTableCell($memberList[$i]);
$pdfTable->rows[] = $pdfRow;
} }
$this->addPDFTable($return, 'member', $pdfTable);
} }
// member of // member of
if (!empty($this->attributes['memberOf'])) { if (!empty($this->attributes['memberOf'])) {
@ -926,10 +929,13 @@ class windowsGroup extends baseModule {
$memberOfList = $this->attributes['memberOf']; $memberOfList = $this->attributes['memberOf'];
} }
usort($memberOfList, 'compareDN'); usort($memberOfList, 'compareDN');
$return[get_class($this) . '_memberOf'][0] = '<block><key>' . _('Member of') . '</key><tr><td align=\"L\">' . $memberOfList[0] . '</td></tr></block>'; $pdfTable = new PDFTable(_('Member of'));
for ($i = 1; $i < sizeof($memberOfList); $i++) { for ($i = 0; $i < sizeof($memberOfList); $i++) {
$return[get_class($this) . '_memberOf'][] = '<block><tr><td align=\"L\">' . $memberOfList[$i] . '</td></tr></block>'; $pdfRow = new PDFTableRow();
$pdfRow->cells[] = new PDFTableCell($memberOfList[$i]);
$pdfTable->rows[] = $pdfRow;
} }
$this->addPDFTable($return, 'memberOf', $pdfTable);
} }
return $return; return $return;
} }
@ -955,10 +961,10 @@ class windowsGroup extends baseModule {
$this->groupCache = $return; $this->groupCache = $return;
return $return; return $return;
} }
/** /**
* Returns a list of modifications which have to be made to the LDAP account. * 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}.<br> * Calling this method requires the existence of an enclosing {@link accountContainer}.<br>
* <br> * <br>
* *
@ -973,7 +979,7 @@ class windowsGroup extends baseModule {
* <br><b>"info"</b> values with informational value (e.g. to be used later by pre/postModify actions) * <br><b>"info"</b> values with informational value (e.g. to be used later by pre/postModify actions)
* <br> * <br>
* <br>This builds the required comands from $this-attributes and $this->orig. * <br>This builds the required comands from $this-attributes and $this->orig.
* *
* @return array list of modifications * @return array list of modifications
*/ */
public function save_attributes() { public function save_attributes() {
@ -983,10 +989,10 @@ class windowsGroup extends baseModule {
$orig['memberOf'] = array(); $orig['memberOf'] = array();
return $this->getAccountContainer()->save_module_attributes($attrs, $orig); return $this->getAccountContainer()->save_module_attributes($attrs, $orig);
} }
/** /**
* Runs the postmodify actions. * Runs the postmodify actions.
* *
* @see baseModule::postModifyActions() * @see baseModule::postModifyActions()
* *
* @param boolean $newAccount * @param boolean $newAccount
@ -1036,7 +1042,7 @@ class windowsGroup extends baseModule {
} }
return $messages; return $messages;
} }
} }