reduced PDF code

This commit is contained in:
Roland Gruber 2013-05-07 19:18:21 +00:00
parent 6c25d73608
commit 103ee7fc0c
3 changed files with 27 additions and 31 deletions

View File

@ -1616,18 +1616,16 @@ class posixAccount extends baseModule implements passwordService {
$uidLabel = _('Host name'); $uidLabel = _('Host name');
} }
$return = array( $return = array(
'posixAccount_uid' => array('<block><key>' . $uidLabel . '</key><value>' . $this->attributes['uid'][0] . '</value></block>'),
'posixAccount_cn' => array('<block><key>' . _('Common name') . '</key><value>' . $this->attributes['cn'][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_primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $this->getGroupName($this->attributes['gidNumber'][0]) . '</value></block>'), 'posixAccount_primaryGroup' => array('<block><key>' . _('Primary group') . '</key><value>' . $this->getGroupName($this->attributes['gidNumber'][0]) . '</value></block>'),
'posixAccount_additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . implode(", ", $this->groups) . '</value></block>'), 'posixAccount_additionalGroups' => array('<block><key>' . _('Additional groups') . '</key><value>' . implode(", ", $this->groups) . '</value></block>'),
'posixAccount_homeDirectory' => array('<block><key>' . _('Home directory') . '</key><value>' . $this->attributes['homeDirectory'][0] . '</value></block>'),
'posixAccount_loginShell' => array('<block><key>' . _('Login shell') . '</key><value>' . $this->attributes['loginShell'][0] . '</value></block>'),
); );
if (isset($this->attributes['gecos'][0])) { $this->addSimplePDFField($return, 'uid', $uidLabel);
$return['posixAccount_gecos'] = array('<block><key>' . _('Gecos') . '</key><value>' . $this->attributes['gecos'][0] . '</value></block>'); $this->addSimplePDFField($return, 'cn', _('Common name'));
} $this->addSimplePDFField($return, 'uidNumber', _('UID number'));
$this->addSimplePDFField($return, 'gidNumber', _('GID number'));
$this->addSimplePDFField($return, 'homeDirectory', _('Home directory'));
$this->addSimplePDFField($return, 'loginShell', _('Login shell'));
$this->addSimplePDFField($return, 'gecos', _('Gecos'));
if (self::areGroupOfNamesActive()) { if (self::areGroupOfNamesActive()) {
$allGons = $this->findGroupOfNames(); $allGons = $this->findGroupOfNames();
$gons = array(); $gons = array();

View File

@ -500,12 +500,13 @@ class posixGroup extends baseModule implements passwordService {
if (isset($this->attributes['memberUid'][0])) { if (isset($this->attributes['memberUid'][0])) {
$members = implode(', ', $this->attributes['memberUid']); $members = implode(', ', $this->attributes['memberUid']);
} }
return array( $return = array(
get_class($this) . '_cn' => array('<block><key>' . _('Group name') . '</key><value>' . $this->attributes['cn'][0] . '</value></block>'),
get_class($this) . '_gidNumber' => array('<block><key>' . _('GID number') . '</key><value>' . $this->attributes['gidNumber'][0] . '</value></block>'),
get_class($this) . '_memberUid' => array('<block><key>' . _('Group members') . '</key><value>' . $members . '</value></block>'), get_class($this) . '_memberUid' => array('<block><key>' . _('Group members') . '</key><value>' . $members . '</value></block>'),
get_class($this) . '_description' => array('<block><key>' . _('Description') . '</key><value>' . $this->attributes['description'][0] . '</value></block>')
); );
$this->addSimplePDFField($return, 'cn', _('Group name'));
$this->addSimplePDFField($return, 'gidNumber', _('GID number'));
$this->addSimplePDFField($return, 'description', _('Description'));
return $return;
} }

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2012 Roland Gruber Copyright (C) 2012 - 2013 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -417,24 +417,21 @@ class puppetClient extends baseModule {
*/ */
function get_pdfEntries() { function get_pdfEntries() {
$return = array(); $return = array();
if (in_array('puppetClient', $this->attributes['objectClass'])) { if (!in_array('puppetClient', $this->attributes['objectClass'])) {
if (isset($this->attributes['environment'][0])) { return $return;
$return['puppetClient_environment'][0] = '<block><key>' . _('Environment') . '</key><value>' . implode(', ', $this->attributes['environment']) . '</value></block>'; }
$this->addSimplePDFField($return, 'environment', _('Environment'));
$this->addSimplePDFField($return, 'parentnode', _('Parent node'));
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>';
for ($i = 1; $i < sizeof($this->attributes['puppetclass']); $i++) {
$return['puppetClient_puppetclass'][] = '<block><tr><td align=\"L\">' . $this->attributes['puppetclass'][$i] . '</td></tr></block>';
} }
if (isset($this->attributes['parentnode'][0])) { }
$return['puppetClient_parentnode'][0] = '<block><key>' . _('Parent node') . '</key><value>' . $this->attributes['parentnode'][0] . '</value></block>'; 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>';
if (isset($this->attributes['puppetclass'][0])) { for ($i = 1; $i < sizeof($this->attributes['puppetvar']); $i++) {
$return['puppetClient_puppetclass'][0] = '<block><key>' . _('Classes') . '</key><tr><td align=\"L\">' . $this->attributes['puppetclass'][0] . '</td></tr></block>'; $return['puppetClient_puppetvar'][] = '<block><tr><td align=\"L\">' . $this->attributes['puppetvar'][$i] . '</td></tr></block>';
for ($i = 1; $i < sizeof($this->attributes['puppetclass']); $i++) {
$return['puppetClient_puppetclass'][] = '<block><tr><td align=\"L\">' . $this->attributes['puppetclass'][$i] . '</td></tr></block>';
}
}
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>';
for ($i = 1; $i < sizeof($this->attributes['puppetvar']); $i++) {
$return['puppetClient_puppetvar'][] = '<block><tr><td align=\"L\">' . $this->attributes['puppetvar'][$i] . '</td></tr></block>';
}
} }
} }
return $return; return $return;