From 4eda1e4044e9f29bd52c7d16a5ba86d2ffddb6bc Mon Sep 17 00:00:00 2001 From: duergner Date: Sat, 29 May 2004 19:20:28 +0000 Subject: [PATCH] modules pdf ready (except sambaSamAccount); direkt pdf output is disabled for debug reasons at the moment. --- lam/config/pdf-structure.xml | 77 +++++++++++++-------------- lam/lib/modules/account.inc | 6 ++- lam/lib/modules/inetOrgPerson.inc | 30 ++++++----- lam/lib/modules/main.inc | 4 +- lam/lib/modules/posixAccount.inc | 22 ++++---- lam/lib/modules/posixGroup.inc | 10 +++- lam/lib/modules/quota.inc | 2 +- lam/lib/modules/sambaAccount.inc | 14 ++++- lam/lib/modules/sambaGroupMapping.inc | 8 ++- lam/lib/modules/shadowAccount.inc | 11 +++- lam/lib/pdf.inc | 15 +++--- 11 files changed, 117 insertions(+), 82 deletions(-) diff --git a/lam/config/pdf-structure.xml b/lam/config/pdf-structure.xml index 8d71e638..4de08ffd 100644 --- a/lam/config/pdf-structure.xml +++ b/lam/config/pdf-structure.xml @@ -2,58 +2,57 @@
- - - - - - - - - - + + + + + + + + + +
- - - - - - - - + + + + + + + +
- - - - - - - - + + + + + + + +
- +
-
- - - +
+ + - - + +
-
- - - - - +
+ + + + +
\ No newline at end of file diff --git a/lam/lib/modules/account.inc b/lam/lib/modules/account.inc index da7ad6b6..cd633687 100644 --- a/lam/lib/modules/account.inc +++ b/lam/lib/modules/account.inc @@ -209,8 +209,10 @@ class account { return array(); } - function get_pdfEntries($account_type = "User") { - return array('description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); + function get_pdfEntries($account_type = "user") { + echo "account:\n"; + print_r($this->attributes); + 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 1da4ae9c..4c54f80d 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -314,20 +314,22 @@ class inetOrgPerson { return array(); } - function get_pdfEntries($account_type = "User") { - return array( 'description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''), - 'host' => array('' . _('Unix workstations') . '' . $this->attributes['host'][0] . ''), - 'title' => array('' . _('Title') . '' . $this->attributes['title'][0] . ''), - 'givenName' => array('' . _('First name') . '' . $this->attributes['givenName'][0] . ''), - 'sn' => array('' . -_('Last name') . '' . $this->attributes['sn'][0] . ''), - 'employeeType' => array('' . _('Employee type') . '' . $this->attributes['employeeType'][0]), - 'street' => array('' . _('Street') . '' . $this->attributes['street'] . ''), - 'postalCode' => array('' . _('Postal code') . '' . $this->attributes['postalCode'][0] . ''), - 'postalAddress' => array('' . _('Postal address') . '' . $this->attributes['postalAddress'][0] . ''), - 'telephoneNumber' => array('' . _('Telephone number') . '' . $this->attributes['telephoneNumber'][0] . ''), - 'mobileTelephoneNumber' => array('' . _('Mobile number') . '' . $this->attributes['mobileTelephoneNumber'][0] . ''), - 'facimileTelefonNumber' => array('' . _('Fax number') . '' . $this->attributes['facsimileTelephoneNumber'][0] . ''), - 'mail' => array('' . _('eMail address') . '' . $this->attributes['mail'][0] . '')); + function get_pdfEntries($account_type = "user") { + echo "inetOrgPerson:\n"; + print_r($this->attributes); + return array( 'inetOrgPerson_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . ''), + 'inetOrgPerson_host' => array('' . _('Unix workstations') . '' . $this->attributes['host'][0] . ''), + 'inetOrgPerson_title' => array('' . _('Title') . '' . $this->attributes['title'][0] . ''), + 'inetOrgPerson_givenName' => array('' . _('First name') . '' . $this->attributes['givenName'][0] . ''), + 'inetOrgPerson_sn' => array('' . _('Last name') . '' . $this->attributes['sn'][0] . ''), + 'inetOrgPerson_employeeType' => array('' . _('Employee type') . '' . $this->attributes['employeeType'][0]), + 'inetOrgPerson_street' => array('' . _('Street') . '' . $this->attributes['street'] . ''), + 'inetOrgPerson_postalCode' => array('' . _('Postal code') . '' . $this->attributes['postalCode'][0] . ''), + 'inetOrgPerson_postalAddress' => array('' . _('Postal address') . '' . $this->attributes['postalAddress'][0] . ''), + 'inetOrgPerson_telephoneNumber' => array('' . _('Telephone number') . '' . $this->attributes['telephoneNumber'][0] . ''), + 'inetOrgPerson_mobileTelephoneNumber' => array('' . _('Mobile number') . '' . $this->attributes['mobileTelephoneNumber'][0] . ''), + 'inetOrgPerson_facimileTelefonNumber' => array('' . _('Fax number') . '' . $this->attributes['facsimileTelephoneNumber'][0] . ''), + 'inetOrgPerson_mail' => array('' . _('eMail address') . '' . $this->attributes['mail'][0] . '')); } } diff --git a/lam/lib/modules/main.inc b/lam/lib/modules/main.inc index f110bd59..40b3ccbc 100644 --- a/lam/lib/modules/main.inc +++ b/lam/lib/modules/main.inc @@ -302,8 +302,8 @@ class main { return $return; } - function get_pdfEntries($account_type = "User") { - return array(); + function get_pdfEntries($account_type = "user") { + return array( 'main_dn' => array('' . _('DN') . '' . $_SESSION[$this->base]->dn . '')); } } diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 9b54c4ec..5562d7e4 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -710,16 +710,18 @@ class posixAccount { return array(); } - function get_pdfEntries($account_type = "User") { - return array( 'uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), - 'uidNumber' => array('' . _('UID number') . '' . $this->attributes['uidNumber'][0] . ''), - 'gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''), - 'gecos' => array('' . _('Gecos') . '' . $this->attributes['gecos'][0] . ''), - 'primaryGroup' => array('' . _('Primary group') . '' . $_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) . ''), - 'additionalGroups' => array('' . _('Additional groups') . '' . ''), - 'homeDirectory' => array('' . _('Home directory') . '' . $this->attributes['homeDirectory'][0] . ''), - 'userPassword' => array('' . _('Password') . '' . $this->attributes['userPassword'][0] . ''), - 'loginShell' => array('' . _('Login Shell') . '' . $this->attributes['loginShell'][0] . ''), + function get_pdfEntries($account_type = "user") { + echo "posixAccount:\n"; + print_r($this->attributes); + return array( 'posixAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), + 'posixAccount_uidNumber' => array('' . _('UID number') . '' . $this->attributes['uidNumber'][0] . ''), + 'posixAccount_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''), + 'posixAccount_gecos' => array('' . _('Gecos') . '' . $this->attributes['gecos'][0] . ''), + 'posixAccount_primaryGroup' => array('' . _('Primary group') . '' . $_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) . ''), + 'posixAccount_additionalGroups' => array('' . _('Additional groups') . '' . ''), + 'posixAccount_homeDirectory' => array('' . _('Home directory') . '' . $this->attributes['homeDirectory'][0] . ''), + 'posixAccount_userPassword' => array('' . _('Password') . '' . $this->attributes['userPassword'][0] . ''), + 'posixAccount_loginShell' => array('' . _('Login Shell') . '' . $this->attributes['loginShell'][0] . ''), ); } diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index ee24c1f1..f663e30e 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -597,8 +597,14 @@ class posixGroup { return array(); } - function get_pdfEntries($account_type = "User") { - return array(); + function get_pdfEntries($account_type = "group") { + echo "posixGroup:\n"; + print_r($this->attributes); + return array( '_posixGroup_cn' => array($this->attributes['cn'][0]), + 'posixGroup_cn' => array('' . _('Groupname') . '' . $this->attributes['cn'][0] . ''), + 'posixGroup_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''), + 'posixGroup_memberUid' => array('' . _('Group members') . '' . $this->attributes['memberUid'][0] . ''), + 'posixGroup_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); } } diff --git a/lam/lib/modules/quota.inc b/lam/lib/modules/quota.inc index fe63e39e..fa620cdf 100644 --- a/lam/lib/modules/quota.inc +++ b/lam/lib/modules/quota.inc @@ -306,7 +306,7 @@ class quota { } function get_pdfEntries($account_type = "User") { - return array(); + 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 cfeaa107..ae05fe3f 100644 --- a/lam/lib/modules/sambaAccount.inc +++ b/lam/lib/modules/sambaAccount.inc @@ -690,8 +690,18 @@ class sambaAccount { return array(); } - function get_pdfEntries($account_type = "User") { - return array(); + function get_pdfEntries($account_type = "user") { + echo "sambaAccount:\n"; + print_r($this->attributes); + return array( 'sambaAccount_displayName' => array('' . _('Display name') . 'attributes['displayName'][0] . ''), + 'sambaAccount_uid' => array('' . _('Username') . '' . $this->attributes['uid'][0] . ''), + 'sambaAccount_smbHome' => array('' . _('Home path') . '' . $this->attributes['smbHome'][0] . ''), + 'sambaAccount_homeDrive' => array('' . _('Home drive') . '' . $this->attributes['homePath'][0] . ''), + 'sambaAccount_scriptPath' => array('' . _('Logon script') . '' . $this->attributes['scriptPath'][0] . ''), + 'sambaAccount_profilePath' => array('' . _('Profile path') . '' . $this->attributes['profilePath'][0] . ''), + 'sambaAccount_userWorkstations' => array('' . _('Samba workstations') . '' . $this->attributes['userWorkstations'][0] . ''), + 'sambaAccount_domain' => array('' . _('Domain') . '' . $this->attributes['domain'][0] . ''), + 'sambaAccount_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); } } diff --git a/lam/lib/modules/sambaGroupMapping.inc b/lam/lib/modules/sambaGroupMapping.inc index 74a3ca88..8270906d 100644 --- a/lam/lib/modules/sambaGroupMapping.inc +++ b/lam/lib/modules/sambaGroupMapping.inc @@ -330,7 +330,13 @@ class sambaGroupMapping { } function get_pdfEntries($account_type = "User") { - return array(); + echo "sambaGroupMapping:\n"; + print_r($this->attributes); + return array( 'sambaGroupMapping_gidNumber' => array('' . _('GID number') . '' . $this->attributes['gidNumber'][0] . ''), + 'sambaGroupMapping_sambaSID' => array('' . _('Windows group') . '' . $this->attributes['sambaSID'][0] . ''), + 'sambaGroupMapping_displayName' => array('' . _('Display name') . '' . $this->attributes['displayName'][0] . ''), + 'sambaGroupMapping_sambaGroupType' => array('' . _('Samba group type') . '' . $this->attributes['sambaGroupType'][0] . ''), + 'sambaGroupMapping_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); } } diff --git a/lam/lib/modules/shadowAccount.inc b/lam/lib/modules/shadowAccount.inc index fd9a10e8..a9070c51 100644 --- a/lam/lib/modules/shadowAccount.inc +++ b/lam/lib/modules/shadowAccount.inc @@ -302,8 +302,15 @@ class shadowAccount { return array(); } - function get_pdfEntries($account_type = "User") { - return array(); + function get_pdfEntries($account_type = "user") { + echo "shadowAccount:\n"; + print_r($this->attributes); + return array( 'shadowAccount_shadowLastChange' => array('' . _('Last shadow password change') . '' . $this->attributes['shadowLastChange'][0] . ''), + 'shadowAccount_shadowWarning' => array('' . _('Password warn') . '' . $this->attributes['shadowWarn'][0] . ''), + 'shadowAccount_shadowInactive' => array('' . _('Account inactive') . '' . $this->attributes['shadowInactive'][0] . ''), + 'shadowAccount_shadowExpire' => array('' . _('Password expire') . '' . date('d. m. Y',$this->attributes['shadowExpire'][0]) . ''), + 'shadowAccount_shadowFlag' => array('' . _('Shadow flag') . '' . $this->attributes['shadowFlag'][0] . ''), + 'shadowAccount_description' => array('' . _('Description') . '' . $this->attributes['description'][0] . '')); } } diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc index f7eeb75d..de430831 100644 --- a/lam/lib/pdf.inc +++ b/lam/lib/pdf.inc @@ -24,7 +24,7 @@ $Id$ */ define('FPDF_FONTPATH','font/'); -define('LAMPDF_LINEWIDTH',149); +define('LAMPDF_LINEWIDTH',190); include_once("fpdf.php"); //include_once('include.inc'); include_once('xml_parser.inc'); @@ -69,14 +69,14 @@ function createModulePDF($accounts,$account_type="") { // We have a new section to start if($entry['tag'] == "SECTION" && $entry['type'] == "open") { $name = $entry['attributes']['NAME']; - if(preg_match("/^\_[a-z]+/",$name)) { - $section_headline = $entries[ucwords(substr($name,1))][0]; + if(preg_match("/^\_[a-zA-Z\_]+/",$name)) { + $section_headline = $entries[$name][0]; } else { - $section_headline = $name; + $section_headline = '- ' . _($name); } $pdf->setFont("arial","B",12); - $pdf->Write(5,"- " . _($section_headline) . ":"); + $pdf->Write(5,$section_headline . ":"); $pdf->Ln(6); } // We have a section to end @@ -143,6 +143,7 @@ function createModulePDF($accounts,$account_type="") { if(is_array($value_entry)) { // Loop over all rows of this entry (most of the time this will be just one) foreach($value_entry as $line) { + echo "line: " . $line . "
\n"; // Substitue XML syntax with valid FPDF methods $methods = processLine($line); // Call every method @@ -167,7 +168,7 @@ function createModulePDF($accounts,$account_type="") { // Save PDF $pdf->Output($filename); // Output meta refresh to pdf-file - metaRefresh($filename); + //metaRefresh($filename); // Return relative path of pdf-file return $filename; } @@ -268,7 +269,7 @@ function processFormatTags($line,$style) { // PCRE matching a tag $u_pattern = '/(.*)(.+)<\/u>(.*)/'; // Replacement pattern when one of the above pattern matched - $replace = "\${1}\${2}\${3}"; + $replace = "\$1\$2\$3"; if(preg_match($i_pattern,$line,$matches)) { $style .= "I";