From 28184982b9413fff5271d0023eb891bdd184f55e Mon Sep 17 00:00:00 2001 From: duergner Date: Tue, 17 Aug 2004 15:16:17 +0000 Subject: [PATCH] PHPDoc coments added; refactored some things by using the meta array; --- lam/lib/baseModule.inc | 28 +++++++++++++++++++++ lam/lib/modules/account.inc | 10 +++++--- lam/lib/modules/inetOrgPerson.inc | 35 +++++++++++++++------------ lam/lib/modules/posixAccount.inc | 27 ++++++++++++--------- lam/lib/modules/posixGroup.inc | 16 ++++++------ lam/lib/modules/quota.inc | 10 +++++--- lam/lib/modules/sambaAccount.inc | 26 +++++++++++--------- lam/lib/modules/sambaGroupMapping.inc | 18 ++++++++------ lam/lib/modules/sambaSamAccount.inc | 28 +++++++++++---------- lam/lib/modules/shadowAccount.inc | 20 ++++++++------- 10 files changed, 133 insertions(+), 85 deletions(-) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index 68977ce1..ea49fff5 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -307,6 +307,34 @@ class baseModule { } return $messages; } + + /** + * Returns an array with all fields available for this account type on the PDF + * output. This method may be overwritten by subclasses or it may be used + * by using entries in the $this->meta['PDF_fields'] array of the specific sub- + * class. + * + * @param string $scope account type + * @return array list of available fields for PDF output + */ + function get_pdfFields($scope = 'user') { + return ((isset($this>meta['PDF_fields'])) ? $this->meta['PDF_fields'] : array()); + } + + /** + * Returns a hastable with all entries that may be printed out in the PDF. The + * syntax of the hashtable is specified by the module specification and the + * corresponding DTD. This method must be overwritten in case that there + * are non static things to be returned. The $this->meta['PDF_entries'] array + * may be used when there is only static content. + * + * @param string $scope account type + * @return array hastable of entries for the PDF. Each entry is an array where + * each entry is treated as a new line in the PDF. + */ + function get_pdf_entries($scope = 'user') { + return ((isset($this->meta['PDF_entries'])) ? $this->meta['PDF_entries'] : array()); + } // TODO implement missing interface } diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index 5328c867..ff99774f 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -52,6 +52,8 @@ class account extends baseModule { $return["alias"] = _('Account'); // module dependencies $return['dependencies'] = array('depends' => array(), 'conflicts' => array('inetOrgPerson')); + // available PDF fields + $return['PDF_fields'] = array('description'); return $return; } @@ -195,11 +197,11 @@ class account extends baseModule { function display_html_delete($post, $profile=false) { return 0; } - - function get_pdfFields($account_type="user") { - return array( 'description'); - } + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array('account_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); } diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 0afc33c3..298963ba 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -87,6 +87,21 @@ class inetOrgPerson extends baseModule { 'error_message' => $this->messages['title']); $return['profile_checks']['inetOrgPerson_employeeType'] = array('type' => 'regex_i', 'regex' => $this->regex_employeeType, 'error_message' => $this->messages['employeeType']); + // available PDF fields + $return['PDF_fields'] = array( 'description', + 'host', + 'title', + 'givenName', + 'sn', + 'employeeType', + 'street', + 'postalCode', + 'postalAddress', + 'telephoneNumber', + 'mobileTelephoneNumber', + 'facimilieTelefonNumber', + 'mail'); + return $return; } @@ -363,22 +378,10 @@ class inetOrgPerson extends baseModule { return 0; } - function get_pdfFields($account_type = "user") { - return array( 'description', - 'host', - 'title', - 'givenName', - 'sn', - 'employeeType', - 'street', - 'postalCode', - 'postalAddress', - 'telephoneNumber', - 'mobileTelephoneNumber', - 'facimilieTelefonNumber', - 'mail'); - } - + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array( 'inetOrgPerson_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''), 'inetOrgPerson_host' => array('' . _('Unix workstations') . '' . $this->attributes['host'][0] . ''), diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index f5648b8a..ed0ee7b5 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -138,6 +138,17 @@ class posixAccount extends baseModule { 'posixAccount_pwdHash' => _("Password hash type"), ) ); + // available PDF fields + $return['PDF_fields'] = array( 'uid', + 'uidNumber', + 'gidNumber', + 'gecos', + 'primaryGroup', + 'additionalGroups', + 'homeDirectory', + 'userPassword', + 'loginShell'); + return $return; } @@ -769,18 +780,10 @@ class posixAccount extends baseModule { return $return; } - function get_pdfFields($account_type="user") { - return array( 'uid', - 'uidNumber', - 'gidNumber', - 'gecos', - 'primaryGroup', - 'additionalGroups', - 'homeDirectory', - 'userPassword', - 'loginShell'); - } - + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array( 'posixAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), 'posixAccount_uidNumber' => array('' . _('UID number') . '' . $this->attributes['uidNumber'][0] . ''), diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index d3d80b99..ae4cfa22 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -121,6 +121,11 @@ class posixGroup extends baseModule { 'required' => true, 'required_message' => $this->messages['maxGID'], 'error_message' => $this->messages['maxGID']); $return['config_checks']['group']['cmpGID'] = array('type' => 'int_greater', 'cmp_name1' => 'posixGroup_maxGID', 'cmp_name2' => 'posixGroup_minGID', 'error_message' => $this->messages['cmpGID']); + // available PDF fields + $return['PDF_fields'] = array( 'cn', + 'gidNumber', + 'memberUid', + 'description'); return $return; } @@ -631,13 +636,10 @@ class posixGroup extends baseModule { return $return; } - function get_pdfFields($account_type="user") { - return array( 'cn', - 'gidNumber', - 'memberUid', - 'description'); - } - + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "group") { return array( 'posixGroup_cn' => array('' . _('Groupname') . '' . $this->attributes['cn'][0] . ''), 'posixGroup_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''), diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index 062f6ebb..f6796d48 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -57,6 +57,8 @@ class quota extends baseModule { // module dependencies $return['dependencies'] = array('depends' => array('posixAccount'), 'conflicts' => array()); } + // available PDF fields + $return['PDF_fields'] = array( 'quotas'); return $return; } @@ -371,10 +373,10 @@ class quota extends baseModule { return $return; } - function get_pdfFields($account_type="user") { - return array( 'quotas'); - } - + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array( 'quota_quotas' => array('' . _('User quota') . '' . _('Mountpoint') . '' . _('Soft block') . '' . _('Soft inode') . '' . _('Hard block') . '' . _('Hard inode') . '')); } diff --git a/lam/lib/modules/sambaAccount.inc b/lam/lib/modules/sambaAccount.inc index c316888f..2394dc95 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -165,6 +165,16 @@ class sambaAccount extends baseModule { 'error_message' => $this->messages['workstations']); $return['profile_checks']['sambaAccount_domain'] = array('type' => 'regex_i', 'regex' => $this->regex_domain, 'error_message' => $this->messages['domain']); + // available PDF fields + $return['PDF_fields'] = array( 'displayName', + 'uid', + 'smbHome', + 'homeDrive', + 'scriptPath', + 'profilePath', + 'userWorkstations', + 'domain', + 'description'); return $return; } @@ -710,19 +720,11 @@ class sambaAccount extends baseModule { return $return; } - - function get_pdfFields($account_type="user") { - return array( 'displayName', - 'uid', - 'smbHome', - 'homeDrive', - 'scriptPath', - 'profilePath', - 'userWorkstations', - 'domain', - 'description'); - } + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array( 'sambaAccount_displayName' => array('' . _('Display name') . 'attributes['displayName'][0] . ''), 'sambaAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index e7fc1ddf..5ff45d24 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -67,6 +67,12 @@ class sambaGroupMapping extends baseModule { $return["alias"] = _('Samba 3'); // module dependencies $return['dependencies'] = array('depends' => array('posixGroup'), 'conflicts' => array()); + // available PDF fields + $return['PDF_fields'] = array( 'gidNumber', + 'sambaSID', + 'displayName', + 'sambaGroupType', + 'description'); return $return; } @@ -319,15 +325,11 @@ class sambaGroupMapping extends baseModule { 2 => array('kind' => 'help', 'value' => 'sambaDomainName' )); return $return; } - - function get_pdfFields($account_type="user") { - return array( 'gidNumber', - 'sambaSID', - 'displayName', - 'sambaGroupType', - 'description'); - } + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "User") { return array( 'sambaGroupMapping_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''), 'sambaGroupMapping_sambaSID' => array('' . _('Windows group') . '' . $this->attributes['sambaSID'][0] . ''), diff --git a/lam/lib/modules/sambaSamAccount.inc b/lam/lib/modules/sambaSamAccount.inc index 1cb13e63..29d25ee1 100644 --- a/lam/lib/modules/sambaSamAccount.inc +++ b/lam/lib/modules/sambaSamAccount.inc @@ -97,6 +97,17 @@ class sambaSamAccount extends baseModule { 'error_message' => $this->messages['logonScript']); $return['profile_checks']['sambaSamAccount_userWorkstations'] = array('type' => 'regex_i', 'regex' => $this->regex_workstations, 'error_message' => $this->messages['workstations']); + // available PDF fields + $return['PDF_fields'] = array( 'displayName', + 'uid', + 'sambaHomePath', + 'sambaHomeDrive', + 'sambaLogonScript', + 'sambaProfilePath', + 'sambaUserWorkstations', + 'sambaDomainName', + 'description', + 'sambaPrimaryGroupSID'); return $return; } @@ -743,20 +754,11 @@ class sambaSamAccount extends baseModule { } return $return; } - - function get_pdfFields($account_type="user") { - return array( 'displayName', - 'uid', - 'sambaHomePath', - 'sambaHomeDrive', - 'sambaLogonScript', - 'sambaProfilePath', - 'sambaUserWorkstations', - 'sambaDomainName', - 'description', - 'sambaPrimaryGroupSID'); - } + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array( 'sambaSamAccount_displayName' => array('' . _('Display name') . 'attributes['displayName'][0] . ''), 'sambaSamAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index 42cb4772..8323a9e0 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -135,6 +135,13 @@ class shadowAccount extends baseModule { 'error_message' => $this->messages['inactive']); $return['profile_checks']['shadowAccount_shadowWarning'] = array('type' => 'regex', 'regex' => $this->regex_number, 'error_message' => $this->messages['shadowWarning']); + // available PDF fields + $return['PDF_fields'] = array( 'shadowLastChange', + 'shadowWarning', + 'shadowInactive', + 'shadowExpire', + 'shadowFlag', + 'description'); return $return; } @@ -328,15 +335,10 @@ class shadowAccount extends baseModule { return 0; } - function get_pdfFields($account_type="user") { - return array( 'shadowLastChange', - 'shadowWarning', - 'shadowInactive', - 'shadowExpire', - 'shadowFlag', - 'description'); - } - + /* + * (non-PHPDoc) + * @see baseModule#get_pdfEntries + */ function get_pdfEntries($account_type = "user") { return array( 'shadowAccount_shadowLastChange' => array('' . _('Last shadow password change') . '' . $this->attributes['shadowLastChange'][0] . ''), 'shadowAccount_shadowWarning' => array('' . _('Password warn') . '' . $this->attributes['shadowWarn'][0] . ''),