modules pdf ready (except sambaSamAccount); direkt pdf output is disabled for debug reasons at the moment.

This commit is contained in:
duergner 2004-05-29 19:20:28 +00:00
parent cb5c71b23a
commit 4eda1e4044
11 changed files with 117 additions and 82 deletions

View File

@ -2,58 +2,57 @@
<pdf type="user"> <pdf type="user">
<text name="User" /> <text name="User" />
<section name="Personal User Infos"> <section name="Personal User Infos">
<entry name="title" /> <entry name="inetOrgPerson_title" />
<entry name="givenName" /> <entry name="inetOrgPerson_givenName" />
<entry name="sn" /> <entry name="inetOrgPerson_sn" />
<entry name="street" /> <entry name="inetOrgPerson_street" />
<entry name="postalCode" /> <entry name="inetOrgPerson_postalCode" />
<entry name="postalAddress" /> <entry name="inetOrgPerson_postalAddress" />
<entry name="mail" /> <entry name="inetOrgPerson_mail" />
<entry name="telephoneNumber" /> <entry name="inetOrgPerson_telephoneNumber" />
<entry name="mobileTelephoneNumber" /> <entry name="inetOrgPerson_mobileTelephoneNumber" />
<entry name="facsimileTelephoneNumber" /> <entry name="inetOrgPerson_facsimileTelephoneNumber" />
</section> </section>
<section name="Unix User Settings"> <section name="Unix User Settings">
<entry name="uid" /> <entry name="posixAccount_uid" />
<entry name="userPassword" /> <entry name="posixAccount_userPassword" />
<entry name="primaryGroup" /> <entry name="posixAccount_primaryGroup" />
<entry name="additionalGroups" /> <entry name="posixAccount_additionalGroups" />
<entry name="homeDirectory" /> <entry name="posixAccount_homeDirectory" />
<entry name="loginShell" /> <entry name="posixAccount_loginShell" />
<entry name="Password expire" /> <entry name="shadowAccount_shadowExpire" />
<entry name="host" /> <entry name="inetOrgPerson_host" />
</section> </section>
<section name="Windows User Settings"> <section name="Windows User Settings">
<entry name="uid" /> <entry name="sambaAccount_uid" />
<entry name="Windows password" /> <entry name="sambaAccount_password" />
<entry name="sambaHomeDrive" /> <entry name="sambaAccount_homeDrive" />
<entry name="sambaLogonScript" /> <entry name="sambaAccount_scriptPath" />
<entry name="sambaProfilePath" /> <entry name="sambaAccount_smbHome" />
<entry name="sambaUserWorkstations" /> <entry name="sambaAccount_userWorkstations" />
<entry name="sambaHomePath" /> <entry name="sambaAccount_homePath" />
<entry name="sambaDomainName" /> <entry name="sambaAccount_domain" />
</section> </section>
<section name="Quota Settings"> <section name="Quota Settings">
<entry name="User quotas" /> <entry name="quota_quotas" />
</section> </section>
</pdf> </pdf>
<pdf type="group"> <pdf type="group">
<section name="_name"> <section name="_posixGroup_cn">
<entry name="description" /> <entry name="posixGroup_description" />
<entry name="Display name" /> <entry name="posixGroup_gidNumber" />
<entry name="GID" />
<entry name="Domain" /> <entry name="Domain" />
<entry name="DN" /> <entry name="main_dn" />
<entry name="Members" /> <entry name="posixGroup_memberUid" />
</section> </section>
</pdf> </pdf>
<pdf type="host"> <pdf type="host">
<section name="_name"> <section name="_posixAccount_uid">
<entry name="description" /> <entry name="posixAccount_description" />
<entry name="UID" /> <entry name="posixAccount_uidNumber" />
<entry name="Primary group" /> <entry name="posixAccount_primaryGroup" />
<entry name="Domain" /> <entry name="sambaAccount_domain" />
<entry name="DN" /> <entry name="main_dn" />
</section> </section>
</pdf> </pdf>
</settings> </settings>

View File

@ -209,8 +209,10 @@ class account {
return array(); return array();
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "user") {
return array('description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>')); echo "account:\n";
print_r($this->attributes);
return array('account_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
} }
} }

View File

@ -314,20 +314,22 @@ class inetOrgPerson {
return array(); return array();
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "user") {
return array( 'description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'), echo "inetOrgPerson:\n";
'host' => array('<block><key>' . _('Unix workstations') . '</key><value>' . $this->attributes['host'][0] . '</value></block>'), print_r($this->attributes);
'title' => array('<block><key>' . _('Title') . '</key><value>' . $this->attributes['title'][0] . '</value></block>'), return array( 'inetOrgPerson_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'),
'givenName' => array('<block><key>' . _('First name') . '</key><value>' . $this->attributes['givenName'][0] . '</value></block>'), 'inetOrgPerson_host' => array('<block><key>' . _('Unix workstations') . '</key><value>' . $this->attributes['host'][0] . '</value></block>'),
'sn' => array('<block><key>' . -_('Last name') . '</key><value>' . $this->attributes['sn'][0] . '</value></block>'), 'inetOrgPerson_title' => array('<block><key>' . _('Title') . '</key><value>' . $this->attributes['title'][0] . '</value></block>'),
'employeeType' => array('<block><key>' . _('Employee type') . '</key><value>' . $this->attributes['employeeType'][0]), 'inetOrgPerson_givenName' => array('<block><key>' . _('First name') . '</key><value>' . $this->attributes['givenName'][0] . '</value></block>'),
'street' => array('<block><key>' . _('Street') . '</key><value>' . $this->attributes['street'] . '</value></block>'), 'inetOrgPerson_sn' => array('<block><key>' . _('Last name') . '</key><value>' . $this->attributes['sn'][0] . '</value></block>'),
'postalCode' => array('<block><key>' . _('Postal code') . '</key><value>' . $this->attributes['postalCode'][0] . '</value></block>'), 'inetOrgPerson_employeeType' => array('<block><key>' . _('Employee type') . '</key><value>' . $this->attributes['employeeType'][0]),
'postalAddress' => array('<block><key>' . _('Postal address') . '</key><value>' . $this->attributes['postalAddress'][0] . '</value></block>'), 'inetOrgPerson_street' => array('<block><key>' . _('Street') . '</key><value>' . $this->attributes['street'] . '</value></block>'),
'telephoneNumber' => array('<block><key>' . _('Telephone number') . '</key><value>' . $this->attributes['telephoneNumber'][0] . '</value></block>'), 'inetOrgPerson_postalCode' => array('<block><key>' . _('Postal code') . '</key><value>' . $this->attributes['postalCode'][0] . '</value></block>'),
'mobileTelephoneNumber' => array('<block><key>' . _('Mobile number') . '</key><value>' . $this->attributes['mobileTelephoneNumber'][0] . '</value></block>'), 'inetOrgPerson_postalAddress' => array('<block><key>' . _('Postal address') . '</key><value>' . $this->attributes['postalAddress'][0] . '</value></block>'),
'facimileTelefonNumber' => array('<block><key>' . _('Fax number') . '</key><value>' . $this->attributes['facsimileTelephoneNumber'][0] . '</value></block>'), 'inetOrgPerson_telephoneNumber' => array('<block><key>' . _('Telephone number') . '</key><value>' . $this->attributes['telephoneNumber'][0] . '</value></block>'),
'mail' => array('<block><key>' . _('eMail address') . '</key><value>' . $this->attributes['mail'][0] . '</value></block>')); 'inetOrgPerson_mobileTelephoneNumber' => array('<block><key>' . _('Mobile number') . '</key><value>' . $this->attributes['mobileTelephoneNumber'][0] . '</value></block>'),
'inetOrgPerson_facimileTelefonNumber' => array('<block><key>' . _('Fax number') . '</key><value>' . $this->attributes['facsimileTelephoneNumber'][0] . '</value></block>'),
'inetOrgPerson_mail' => array('<block><key>' . _('eMail address') . '</key><value>' . $this->attributes['mail'][0] . '</value></block>'));
} }
} }

View File

@ -302,8 +302,8 @@ class main {
return $return; return $return;
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "user") {
return array(); return array( 'main_dn' => array('<block><key>' . _('DN') . '</key><value>' . $_SESSION[$this->base]->dn . '</value></block>'));
} }
} }

View File

@ -710,16 +710,18 @@ class posixAccount {
return array(); return array();
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "user") {
return array( 'uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'), echo "posixAccount:\n";
'uidNumber' => array('<block><key>' . _('UID number') . '</key><value>' . $this->attributes['uidNumber'][0] . '</value></block>'), print_r($this->attributes);
'gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'), return array( 'posixAccount_uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
'gecos' => array('<block><key>' . _('Gecos') . '</key><value>' . $this->attributes['gecos'][0] . '</value></block>'), 'posixAccount_uidNumber' => array('<block><key>' . _('UID number') . '</key><value>' . $this->attributes['uidNumber'][0] . '</value></block>'),
'primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) . '</value></block>'), 'posixAccount_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
'additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . '</value></block>'), 'posixAccount_gecos' => array('<block><key>' . _('Gecos') . '</key><value>' . $this->attributes['gecos'][0] . '</value></block>'),
'homeDirectory' => array('<block><key>' . _('Home directory') . '</key><value>' . $this->attributes['homeDirectory'][0] . '</value></block>'), 'posixAccount_primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) . '</value></block>'),
'userPassword' => array('<block><key>' . _('Password') . '</key><value>' . $this->attributes['userPassword'][0] . '</value></block>'), 'posixAccount_additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . '</value></block>'),
'loginShell' => array('<block><key>' . _('Login Shell') . '</key><value>' . $this->attributes['loginShell'][0] . '</value></block>'), 'posixAccount_homeDirectory' => array('<block><key>' . _('Home directory') . '</key><value>' . $this->attributes['homeDirectory'][0] . '</value></block>'),
'posixAccount_userPassword' => array('<block><key>' . _('Password') . '</key><value>' . $this->attributes['userPassword'][0] . '</value></block>'),
'posixAccount_loginShell' => array('<block><key>' . _('Login Shell') . '</key><value>' . $this->attributes['loginShell'][0] . '</value></block>'),
); );
} }

View File

@ -597,8 +597,14 @@ class posixGroup {
return array(); return array();
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "group") {
return array(); echo "posixGroup:\n";
print_r($this->attributes);
return array( '_posixGroup_cn' => array($this->attributes['cn'][0]),
'posixGroup_cn' => array('<block><key>' . _('Groupname') . '</key><value>' . $this->attributes['cn'][0] . '</value></block>'),
'posixGroup_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
'posixGroup_memberUid' => array('<block><key>' . _('Group members') . '</key><value>' . $this->attributes['memberUid'][0] . '</value></block>'),
'posixGroup_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
} }
} }

View File

@ -306,7 +306,7 @@ class quota {
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "User") {
return array(); return array( 'quota_quotas' => array('<block><key>' . _('User quota') . '</key><td width="20%"><b>' . _('Mountpoint') . '</b></td><td width="20%"><b>' . _('Soft block') . '</b></td><td width="20%"><b>' . _('Soft inode') . '</b></td><td width="20%"><b>' . _('Hard block') . '</b></td><td width="20%"><b>' . _('Hard inode') . '</b></td></block>'));
} }
} }

View File

@ -690,8 +690,18 @@ class sambaAccount {
return array(); return array();
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "user") {
return array(); echo "sambaAccount:\n";
print_r($this->attributes);
return array( 'sambaAccount_displayName' => array('<block><key>' . _('Display name') . '</key><value' . $this->attributes['displayName'][0] . '</value></block>'),
'sambaAccount_uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
'sambaAccount_smbHome' => array('<block><key>' . _('Home path') . '</key><value>' . $this->attributes['smbHome'][0] . '</value></block>'),
'sambaAccount_homeDrive' => array('<block><key>' . _('Home drive') . '</key><value>' . $this->attributes['homePath'][0] . '</value></block>'),
'sambaAccount_scriptPath' => array('<block><key>' . _('Logon script') . '</key><value>' . $this->attributes['scriptPath'][0] . '</value></block>'),
'sambaAccount_profilePath' => array('<block><key>' . _('Profile path') . '</key><value>' . $this->attributes['profilePath'][0] . '</value></block>'),
'sambaAccount_userWorkstations' => array('<block><key>' . _('Samba workstations') . '</key><value>' . $this->attributes['userWorkstations'][0] . '</value></block>'),
'sambaAccount_domain' => array('<block><key>' . _('Domain') . '</key><value>' . $this->attributes['domain'][0] . '</value></block>'),
'sambaAccount_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
} }
} }

View File

@ -330,7 +330,13 @@ class sambaGroupMapping {
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "User") {
return array(); echo "sambaGroupMapping:\n";
print_r($this->attributes);
return array( 'sambaGroupMapping_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
'sambaGroupMapping_sambaSID' => array('<block><key>' . _('Windows group') . '</key><value>' . $this->attributes['sambaSID'][0] . '</value></block>'),
'sambaGroupMapping_displayName' => array('<block><key>' . _('Display name') . '</key><value>' . $this->attributes['displayName'][0] . '</value></block>'),
'sambaGroupMapping_sambaGroupType' => array('<block><key>' . _('Samba group type') . '</key><value>' . $this->attributes['sambaGroupType'][0] . '</value></block>'),
'sambaGroupMapping_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
} }
} }

View File

@ -302,8 +302,15 @@ class shadowAccount {
return array(); return array();
} }
function get_pdfEntries($account_type = "User") { function get_pdfEntries($account_type = "user") {
return array(); echo "shadowAccount:\n";
print_r($this->attributes);
return array( 'shadowAccount_shadowLastChange' => array('<block><key>' . _('Last shadow password change') . '</key><value>' . $this->attributes['shadowLastChange'][0] . '</value></block>'),
'shadowAccount_shadowWarning' => array('<block><key>' . _('Password warn') . '</key><value>' . $this->attributes['shadowWarn'][0] . '</value><block>'),
'shadowAccount_shadowInactive' => array('<block><key>' . _('Account inactive') . '</key><value>' . $this->attributes['shadowInactive'][0] . '</value></block>'),
'shadowAccount_shadowExpire' => array('<block><key>' . _('Password expire') . '</key><value>' . date('d. m. Y',$this->attributes['shadowExpire'][0]) . '</value></block>'),
'shadowAccount_shadowFlag' => array('<block><key>' . _('Shadow flag') . '</key><value>' . $this->attributes['shadowFlag'][0] . '</value></bock>'),
'shadowAccount_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
} }
} }

View File

@ -24,7 +24,7 @@ $Id$
*/ */
define('FPDF_FONTPATH','font/'); define('FPDF_FONTPATH','font/');
define('LAMPDF_LINEWIDTH',149); define('LAMPDF_LINEWIDTH',190);
include_once("fpdf.php"); include_once("fpdf.php");
//include_once('include.inc'); //include_once('include.inc');
include_once('xml_parser.inc'); include_once('xml_parser.inc');
@ -69,14 +69,14 @@ function createModulePDF($accounts,$account_type="") {
// We have a new section to start // We have a new section to start
if($entry['tag'] == "SECTION" && $entry['type'] == "open") { if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
$name = $entry['attributes']['NAME']; $name = $entry['attributes']['NAME'];
if(preg_match("/^\_[a-z]+/",$name)) { if(preg_match("/^\_[a-zA-Z\_]+/",$name)) {
$section_headline = $entries[ucwords(substr($name,1))][0]; $section_headline = $entries[$name][0];
} }
else { else {
$section_headline = $name; $section_headline = '- ' . _($name);
} }
$pdf->setFont("arial","B",12); $pdf->setFont("arial","B",12);
$pdf->Write(5,"- " . _($section_headline) . ":"); $pdf->Write(5,$section_headline . ":");
$pdf->Ln(6); $pdf->Ln(6);
} }
// We have a section to end // We have a section to end
@ -143,6 +143,7 @@ function createModulePDF($accounts,$account_type="") {
if(is_array($value_entry)) { if(is_array($value_entry)) {
// Loop over all rows of this entry (most of the time this will be just one) // Loop over all rows of this entry (most of the time this will be just one)
foreach($value_entry as $line) { foreach($value_entry as $line) {
echo "line: " . $line . "<br>\n";
// Substitue XML syntax with valid FPDF methods // Substitue XML syntax with valid FPDF methods
$methods = processLine($line); $methods = processLine($line);
// Call every method // Call every method
@ -167,7 +168,7 @@ function createModulePDF($accounts,$account_type="") {
// Save PDF // Save PDF
$pdf->Output($filename); $pdf->Output($filename);
// Output meta refresh to pdf-file // Output meta refresh to pdf-file
metaRefresh($filename); //metaRefresh($filename);
// Return relative path of pdf-file // Return relative path of pdf-file
return $filename; return $filename;
} }
@ -268,7 +269,7 @@ function processFormatTags($line,$style) {
// PCRE matching a <u> tag // PCRE matching a <u> tag
$u_pattern = '/(.*)<u>(.+)<\/u>(.*)/'; $u_pattern = '/(.*)<u>(.+)<\/u>(.*)/';
// Replacement pattern when one of the above pattern matched // Replacement pattern when one of the above pattern matched
$replace = "\${1}\${2}\${3}"; $replace = "\$1\$2\$3";
if(preg_match($i_pattern,$line,$matches)) { if(preg_match($i_pattern,$line,$matches)) {
$style .= "I"; $style .= "I";