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

View File

@ -209,8 +209,10 @@ class account {
return array();
}
function get_pdfEntries($account_type = "User") {
return array('description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'));
function get_pdfEntries($account_type = "user") {
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();
}
function get_pdfEntries($account_type = "User") {
return array( 'description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'),
'host' => array('<block><key>' . _('Unix workstations') . '</key><value>' . $this->attributes['host'][0] . '</value></block>'),
'title' => array('<block><key>' . _('Title') . '</key><value>' . $this->attributes['title'][0] . '</value></block>'),
'givenName' => array('<block><key>' . _('First name') . '</key><value>' . $this->attributes['givenName'][0] . '</value></block>'),
'sn' => array('<block><key>' . -_('Last name') . '</key><value>' . $this->attributes['sn'][0] . '</value></block>'),
'employeeType' => array('<block><key>' . _('Employee type') . '</key><value>' . $this->attributes['employeeType'][0]),
'street' => array('<block><key>' . _('Street') . '</key><value>' . $this->attributes['street'] . '</value></block>'),
'postalCode' => array('<block><key>' . _('Postal code') . '</key><value>' . $this->attributes['postalCode'][0] . '</value></block>'),
'postalAddress' => array('<block><key>' . _('Postal address') . '</key><value>' . $this->attributes['postalAddress'][0] . '</value></block>'),
'telephoneNumber' => array('<block><key>' . _('Telephone number') . '</key><value>' . $this->attributes['telephoneNumber'][0] . '</value></block>'),
'mobileTelephoneNumber' => array('<block><key>' . _('Mobile number') . '</key><value>' . $this->attributes['mobileTelephoneNumber'][0] . '</value></block>'),
'facimileTelefonNumber' => array('<block><key>' . _('Fax number') . '</key><value>' . $this->attributes['facsimileTelephoneNumber'][0] . '</value></block>'),
'mail' => array('<block><key>' . _('eMail address') . '</key><value>' . $this->attributes['mail'][0] . '</value></block>'));
function get_pdfEntries($account_type = "user") {
echo "inetOrgPerson:\n";
print_r($this->attributes);
return array( 'inetOrgPerson_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>'),
'inetOrgPerson_host' => array('<block><key>' . _('Unix workstations') . '</key><value>' . $this->attributes['host'][0] . '</value></block>'),
'inetOrgPerson_title' => array('<block><key>' . _('Title') . '</key><value>' . $this->attributes['title'][0] . '</value></block>'),
'inetOrgPerson_givenName' => array('<block><key>' . _('First name') . '</key><value>' . $this->attributes['givenName'][0] . '</value></block>'),
'inetOrgPerson_sn' => array('<block><key>' . _('Last name') . '</key><value>' . $this->attributes['sn'][0] . '</value></block>'),
'inetOrgPerson_employeeType' => array('<block><key>' . _('Employee type') . '</key><value>' . $this->attributes['employeeType'][0]),
'inetOrgPerson_street' => array('<block><key>' . _('Street') . '</key><value>' . $this->attributes['street'] . '</value></block>'),
'inetOrgPerson_postalCode' => array('<block><key>' . _('Postal code') . '</key><value>' . $this->attributes['postalCode'][0] . '</value></block>'),
'inetOrgPerson_postalAddress' => array('<block><key>' . _('Postal address') . '</key><value>' . $this->attributes['postalAddress'][0] . '</value></block>'),
'inetOrgPerson_telephoneNumber' => array('<block><key>' . _('Telephone number') . '</key><value>' . $this->attributes['telephoneNumber'][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;
}
function get_pdfEntries($account_type = "User") {
return array();
function get_pdfEntries($account_type = "user") {
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();
}
function get_pdfEntries($account_type = "User") {
return array( 'uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
'uidNumber' => array('<block><key>' . _('UID number') . '</key><value>' . $this->attributes['uidNumber'][0] . '</value></block>'),
'gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
'gecos' => array('<block><key>' . _('Gecos') . '</key><value>' . $this->attributes['gecos'][0] . '</value></block>'),
'primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) . '</value></block>'),
'additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . '</value></block>'),
'homeDirectory' => array('<block><key>' . _('Home directory') . '</key><value>' . $this->attributes['homeDirectory'][0] . '</value></block>'),
'userPassword' => array('<block><key>' . _('Password') . '</key><value>' . $this->attributes['userPassword'][0] . '</value></block>'),
'loginShell' => array('<block><key>' . _('Login Shell') . '</key><value>' . $this->attributes['loginShell'][0] . '</value></block>'),
function get_pdfEntries($account_type = "user") {
echo "posixAccount:\n";
print_r($this->attributes);
return array( 'posixAccount_uid' => array('<block><key>' . _('Username') . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
'posixAccount_uidNumber' => array('<block><key>' . _('UID number') . '</key><value>' . $this->attributes['uidNumber'][0] . '</value></block>'),
'posixAccount_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
'posixAccount_gecos' => array('<block><key>' . _('Gecos') . '</key><value>' . $this->attributes['gecos'][0] . '</value></block>'),
'posixAccount_primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $_SESSION[$_SESSION[$this->base]->cache]->getgrnam($this->attributes['gidNumber'][0]) . '</value></block>'),
'posixAccount_additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . '</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();
}
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('<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") {
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();
}
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('<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") {
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();
}
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('<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('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 . "<br>\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 <u> tag
$u_pattern = '/(.*)<u>(.+)<\/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";