refresh edit page titles on each request
This commit is contained in:
parent
bf512fe0d0
commit
0d1e3e89dc
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title>
|
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title>
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +27,17 @@ This is a list of API changes for all LAM releases.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<h2>3.6 -> 3.7</h2>Module interface:<br>
|
<h2>3.7 -> 3.8<br>
|
||||||
|
</h2>Type interface:<br>
|
||||||
|
<ul>
|
||||||
|
<li><span style="font-weight: bold;">getTitleBarTitle()/getTitleBarSubtitle(): </span>changed
|
||||||
|
parameter from attribute array to accountContainer object.
|
||||||
|
Additionally, the functions are now called on each page refresh.<br>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
<h2>3.6 -> 3.7</h2>
|
||||||
|
Module interface:<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><span style="font-weight: bold;">postModifyActions()</span>: Must return an array containing any messages to display</li>
|
<li><span style="font-weight: bold;">postModifyActions()</span>: Must return an array containing any messages to display</li>
|
||||||
<li><span style="font-weight: bold;">preModifyActions():</span> Changed return value from boolean to array of message arrays</li>
|
<li><span style="font-weight: bold;">preModifyActions():</span> Changed return value from boolean to array of message arrays</li>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2005 - 2011 Roland Gruber
|
Copyright (C) 2005 - 2012 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
|
||||||
|
@ -107,26 +107,23 @@ class baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
if ($container->dn_orig == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isset($attributes['entryDN'][0])) {
|
return htmlspecialchars(getAbstractDN($container->dn_orig));
|
||||||
return $attributes['entryDN'][0];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -876,6 +876,10 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// update titles
|
||||||
|
$typeObject = new $this->type();
|
||||||
|
$this->titleBarTitle = $typeObject->getTitleBarTitle($this);
|
||||||
|
$this->titleBarSubtitle = $typeObject->getTitleBarSubtitle($this);
|
||||||
// prints a module content page
|
// prints a module content page
|
||||||
$this->printModuleContent($result, $stopProcessing);
|
$this->printModuleContent($result, $stopProcessing);
|
||||||
}
|
}
|
||||||
|
@ -1458,8 +1462,8 @@ class accountContainer {
|
||||||
$this->sortModules();
|
$this->sortModules();
|
||||||
// get titles
|
// get titles
|
||||||
$typeObject = new $this->type();
|
$typeObject = new $this->type();
|
||||||
$this->titleBarTitle = $typeObject->getTitleBarTitle($this->attributes_orig);
|
$this->titleBarTitle = $typeObject->getTitleBarTitle($this);
|
||||||
$this->titleBarSubtitle = $typeObject->getTitleBarSubtitle($this->attributes_orig);
|
$this->titleBarSubtitle = $typeObject->getTitleBarSubtitle($this);
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1568,8 +1572,8 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
// get titles
|
// get titles
|
||||||
$typeObject = new $this->type();
|
$typeObject = new $this->type();
|
||||||
$this->titleBarTitle = $typeObject->getTitleBarTitle(null);
|
$this->titleBarTitle = $typeObject->getTitleBarTitle($this);
|
||||||
$this->titleBarSubtitle = $typeObject->getTitleBarSubtitle(null);
|
$this->titleBarSubtitle = $typeObject->getTitleBarSubtitle($this);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,22 +97,27 @@ class asteriskExt extends baseType {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
$attributes = null;
|
||||||
return _("New extension");
|
if ($container->getAccountModule('asteriskExtension') != null) {
|
||||||
}
|
$attributes = $container->getAccountModule('asteriskExtension')->getAttributes();
|
||||||
|
}
|
||||||
// check if a common name is set
|
// check if a common name is set
|
||||||
if (isset($attributes['AstExtension'][0])) {
|
if (isset($attributes['AstExtension'][0])) {
|
||||||
return htmlspecialchars($attributes['AstExtension'][0]);
|
return htmlspecialchars($attributes['AstExtension'][0]);
|
||||||
}
|
}
|
||||||
// fall back to default
|
// new account
|
||||||
return parent::getTitleBarTitle($attributes);
|
if ($container->isNewAccount) {
|
||||||
|
return _("New extension");
|
||||||
|
}
|
||||||
|
// fall back to default
|
||||||
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,28 +100,39 @@ class dhcp extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New DHCP");
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('dhcp_settings') != null) {
|
||||||
|
$attributes = $container->getAccountModule('dhcp_settings')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a common name is set
|
// check if a common name is set
|
||||||
if (isset($attributes['cn'][0])) {
|
if (isset($attributes['cn'][0])) {
|
||||||
return htmlspecialchars($attributes['cn'][0]);
|
return htmlspecialchars($attributes['cn'][0]);
|
||||||
}
|
}
|
||||||
|
// new entry
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New DHCP");
|
||||||
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
|
// get attributes
|
||||||
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('dhcp_settings') != null) {
|
||||||
|
$attributes = $container->getAccountModule('dhcp_settings')->getAttributes();
|
||||||
|
}
|
||||||
if ($attributes == null) {
|
if ($attributes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,24 @@ class group extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New group");
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('posixGroup') != null) {
|
||||||
|
$attributes = $container->getAccountModule('posixGroup')->getAttributes();
|
||||||
|
}
|
||||||
|
elseif ($container->getAccountModule('rfc2307bisPosixGroup') != null) {
|
||||||
|
$attributes = $container->getAccountModule('rfc2307bisPosixGroup')->getAttributes();
|
||||||
|
}
|
||||||
|
$gonAttributes = null;
|
||||||
|
if ($container->getAccountModule('groupOfNames') != null) {
|
||||||
|
$gonAttributes = $container->getAccountModule('groupOfNames')->getAttributes();
|
||||||
|
}
|
||||||
|
elseif ($container->getAccountModule('groupOfUniqueNames') != null) {
|
||||||
|
$gonAttributes = $container->getAccountModule('groupOfUniqueNames')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a group name is set
|
// check if a group name is set
|
||||||
if (isset($attributes['gid'][0])) {
|
if (isset($attributes['gid'][0])) {
|
||||||
|
@ -115,29 +127,47 @@ class group extends baseType {
|
||||||
if (isset($attributes['cn'][0])) {
|
if (isset($attributes['cn'][0])) {
|
||||||
return htmlspecialchars($attributes['cn'][0]);
|
return htmlspecialchars($attributes['cn'][0]);
|
||||||
}
|
}
|
||||||
|
if (isset($gonAttributes['cn'][0])) {
|
||||||
|
return htmlspecialchars($gonAttributes['cn'][0]);
|
||||||
|
}
|
||||||
|
// new entry
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New group");
|
||||||
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return null;
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('posixGroup') != null) {
|
||||||
|
$attributes = $container->getAccountModule('posixGroup')->getAttributes();
|
||||||
|
}
|
||||||
|
elseif ($container->getAccountModule('rfc2307bisPosixGroup') != null) {
|
||||||
|
$attributes = $container->getAccountModule('rfc2307bisPosixGroup')->getAttributes();
|
||||||
|
}
|
||||||
|
$gonAttributes = null;
|
||||||
|
if ($container->getAccountModule('groupOfNames') != null) {
|
||||||
|
$gonAttributes = $container->getAccountModule('groupOfNames')->getAttributes();
|
||||||
|
}
|
||||||
|
elseif ($container->getAccountModule('groupOfUniqueNames') != null) {
|
||||||
|
$gonAttributes = $container->getAccountModule('groupOfUniqueNames')->getAttributes();
|
||||||
}
|
}
|
||||||
$subtitle = '';
|
|
||||||
// check if an description can be shown
|
// check if an description can be shown
|
||||||
if (isset($attributes['description'][0])) {
|
if (($attributes != null) && isset($attributes['description'][0])) {
|
||||||
$subtitle .= htmlspecialchars($attributes['description'][0]);
|
return htmlspecialchars($attributes['description'][0]);
|
||||||
}
|
}
|
||||||
if ($subtitle == '') {
|
if (($gonAttributes != null) && isset($gonAttributes['description'][0])) {
|
||||||
return null;
|
return htmlspecialchars($gonAttributes['description'][0]);
|
||||||
}
|
}
|
||||||
return $subtitle;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,41 +100,66 @@ class host extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New host");
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('account') != null) {
|
||||||
|
$attributes = $container->getAccountModule('account')->getAttributes();
|
||||||
|
}
|
||||||
|
elseif ($container->getAccountModule('device') != null) {
|
||||||
|
$attributes = $container->getAccountModule('device')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a user name is set
|
// check if a user name is set
|
||||||
if (isset($attributes['uid'][0])) {
|
if (isset($attributes['uid'][0])) {
|
||||||
return htmlspecialchars($attributes['uid'][0]);
|
return htmlspecialchars($attributes['uid'][0]);
|
||||||
}
|
}
|
||||||
|
// check if a common name is set
|
||||||
|
if (isset($attributes['cn'][0])) {
|
||||||
|
return htmlspecialchars($attributes['cn'][0]);
|
||||||
|
}
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New host");
|
||||||
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return null;
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('account') != null) {
|
||||||
|
$attributes = $container->getAccountModule('account')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a common name is set
|
elseif ($container->getAccountModule('device') != null) {
|
||||||
if (isset($attributes['cn'][0])) {
|
$attributes = $container->getAccountModule('device')->getAttributes();
|
||||||
return htmlspecialchars($attributes['cn'][0]);
|
}
|
||||||
|
$sambaAttributes = null;
|
||||||
|
if ($container->getAccountModule('sambaSamAccount') != null) {
|
||||||
|
$sambaAttributes = $container->getAccountModule('sambaSamAccount')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a display name is set
|
// check if a display name is set
|
||||||
if (isset($attributes['displayName'][0])) {
|
if (($sambaAttributes != null) && isset($sambaAttributes['displayName'][0]) && ($sambaAttributes['displayName'][0] != '')) {
|
||||||
return htmlspecialchars($attributes['displayName'][0]);
|
return htmlspecialchars($sambaAttributes['displayName'][0]);
|
||||||
|
}
|
||||||
|
// check if a serial number is set
|
||||||
|
if (($attributes != null) && isset($attributes['serialNumber'][0]) && ($attributes['serialNumber'][0] != '')) {
|
||||||
|
return htmlspecialchars($attributes['serialNumber'][0]);
|
||||||
|
}
|
||||||
|
// check if a description is set
|
||||||
|
if (($attributes != null) && isset($attributes['description'][0])) {
|
||||||
|
return htmlspecialchars($attributes['description'][0]);
|
||||||
}
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarSubtitle($attributes);
|
return parent::getTitleBarSubtitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,19 +96,25 @@ class mailAlias extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New alias");
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('nisMailAlias') != null) {
|
||||||
|
$attributes = $container->getAccountModule('nisMailAlias')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a common name is set
|
// check if a common name is set
|
||||||
if (isset($attributes['cn'][0])) {
|
if (isset($attributes['cn'][0])) {
|
||||||
return htmlspecialchars($attributes['cn'][0]);
|
return htmlspecialchars($attributes['cn'][0]);
|
||||||
}
|
}
|
||||||
|
// new entry
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New alias");
|
||||||
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,28 +98,39 @@ class netgroup extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New group");
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('nisnetgroup') != null) {
|
||||||
|
$attributes = $container->getAccountModule('nisnetgroup')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a common name is set
|
// check if a common name is set
|
||||||
if (isset($attributes['cn'][0])) {
|
if (isset($attributes['cn'][0])) {
|
||||||
return htmlspecialchars($attributes['cn'][0]);
|
return htmlspecialchars($attributes['cn'][0]);
|
||||||
}
|
}
|
||||||
|
// new entry
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New group");
|
||||||
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
|
// get attributes
|
||||||
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('nisnetgroup') != null) {
|
||||||
|
$attributes = $container->getAccountModule('nisnetgroup')->getAttributes();
|
||||||
|
}
|
||||||
if ($attributes == null) {
|
if ($attributes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,28 +96,39 @@ class smbDomain extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New domain");
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('sambaDomain') != null) {
|
||||||
|
$attributes = $container->getAccountModule('sambaDomain')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if a domain name is set
|
// check if a domain name is set
|
||||||
if (isset($attributes['sambaDomainName'][0])) {
|
if (isset($attributes['sambaDomainName'][0])) {
|
||||||
return htmlspecialchars($attributes['sambaDomainName'][0]);
|
return htmlspecialchars($attributes['sambaDomainName'][0]);
|
||||||
}
|
}
|
||||||
|
// new entry
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New domain");
|
||||||
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
|
// get attributes
|
||||||
|
$attributes = null;
|
||||||
|
if ($container->getAccountModule('sambaDomain') != null) {
|
||||||
|
$attributes = $container->getAccountModule('sambaDomain')->getAttributes();
|
||||||
|
}
|
||||||
if ($attributes == null) {
|
if ($attributes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,56 +108,86 @@ class user extends baseType {
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarTitle($attributes) {
|
public function getTitleBarTitle($container) {
|
||||||
if ($attributes == null) {
|
// get attributes
|
||||||
return _("New user");
|
$personalAttributes = null;
|
||||||
|
if ($container->getAccountModule('inetOrgPerson') != null) {
|
||||||
|
$personalAttributes = $container->getAccountModule('inetOrgPerson')->getAttributes();
|
||||||
|
}
|
||||||
|
$accountAttributes = null;
|
||||||
|
if ($container->getAccountModule('account') != null) {
|
||||||
|
$accountAttributes = $container->getAccountModule('account')->getAttributes();
|
||||||
|
}
|
||||||
|
$sambaAttributes = null;
|
||||||
|
if ($container->getAccountModule('sambaSamAccount') != null) {
|
||||||
|
$sambaAttributes = $container->getAccountModule('sambaSamAccount')->getAttributes();
|
||||||
|
}
|
||||||
|
$unixAttributes = null;
|
||||||
|
if ($container->getAccountModule('posixAccount') != null) {
|
||||||
|
$unixAttributes = $container->getAccountModule('posixAccount')->getAttributes();
|
||||||
}
|
}
|
||||||
// check if first and last name can be shown
|
// check if first and last name can be shown
|
||||||
if (isset($attributes['sn'][0]) && isset($attributes['givenName'][0])) {
|
if (($personalAttributes != null) && isset($personalAttributes['sn'][0]) && isset($personalAttributes['givenName'][0])) {
|
||||||
return htmlspecialchars($attributes['givenName'][0] . ' ' . $attributes['sn'][0]);
|
return htmlspecialchars($personalAttributes['givenName'][0] . ' ' . $personalAttributes['sn'][0]);
|
||||||
}
|
}
|
||||||
// check if a display name is set
|
// check if a display name is set
|
||||||
if (isset($attributes['displayName'][0])) {
|
if (($sambaAttributes != null) && isset($sambaAttributes['displayName'][0])) {
|
||||||
return htmlspecialchars($attributes['displayName'][0]);
|
return htmlspecialchars($sambaAttributes['displayName'][0]);
|
||||||
}
|
}
|
||||||
// check if a common name is set
|
// check if a common name is set
|
||||||
if (isset($attributes['cn'][0])) {
|
if (($personalAttributes != null) && isset($personalAttributes['cn'][0])) {
|
||||||
return htmlspecialchars($attributes['cn'][0]);
|
return htmlspecialchars($personalAttributes['cn'][0]);
|
||||||
|
}
|
||||||
|
if (($unixAttributes != null) && isset($unixAttributes['cn'][0])) {
|
||||||
|
return htmlspecialchars($unixAttributes['cn'][0]);
|
||||||
}
|
}
|
||||||
// check if a user name is set
|
// check if a user name is set
|
||||||
if (isset($attributes['uid'][0])) {
|
if (($unixAttributes != null) && isset($unixAttributes['uid'][0])) {
|
||||||
return htmlspecialchars($attributes['uid'][0]);
|
return htmlspecialchars($unixAttributes['uid'][0]);
|
||||||
|
}
|
||||||
|
if (($personalAttributes != null) && isset($personalAttributes['uid'][0])) {
|
||||||
|
return htmlspecialchars($personalAttributes['uid'][0]);
|
||||||
|
}
|
||||||
|
if (($accountAttributes != null) && isset($accountAttributes['uid'][0])) {
|
||||||
|
return htmlspecialchars($accountAttributes['uid'][0]);
|
||||||
|
}
|
||||||
|
if ($container->isNewAccount) {
|
||||||
|
return _("New user");
|
||||||
}
|
}
|
||||||
// fall back to default
|
// fall back to default
|
||||||
return parent::getTitleBarTitle($attributes);
|
return parent::getTitleBarTitle($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the title text for the title bar on the new/edit page.
|
* Returns the the title text for the title bar on the new/edit page.
|
||||||
*
|
*
|
||||||
* @param array $attributes list of LDAP attributes for the displayed account (null, if new account)
|
* @param accountContainer $container account container
|
||||||
* @return String title text
|
* @return String title text
|
||||||
*/
|
*/
|
||||||
public function getTitleBarSubtitle($attributes) {
|
public function getTitleBarSubtitle($container) {
|
||||||
if ($attributes == null) {
|
$personalAttributes = null;
|
||||||
|
if ($container->getAccountModule('inetOrgPerson') != null) {
|
||||||
|
$personalAttributes = $container->getAccountModule('inetOrgPerson')->getAttributes();
|
||||||
|
}
|
||||||
|
if ($personalAttributes == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$subtitle = '';
|
$subtitle = '';
|
||||||
$spacer = ' ';
|
$spacer = ' ';
|
||||||
// check if an email address can be shown
|
// check if an email address can be shown
|
||||||
if (isset($attributes['mail'][0])) {
|
if (isset($personalAttributes['mail'][0])) {
|
||||||
$subtitle .= '<a href="mailto:' . htmlspecialchars($attributes['mail'][0]) . '">' . htmlspecialchars($attributes['mail'][0]) . '</a>' . $spacer;
|
$subtitle .= '<a href="mailto:' . htmlspecialchars($personalAttributes['mail'][0]) . '">' . htmlspecialchars($personalAttributes['mail'][0]) . '</a>' . $spacer;
|
||||||
}
|
}
|
||||||
// check if an telephone number can be shown
|
// check if an telephone number can be shown
|
||||||
if (isset($attributes['telephoneNumber'][0])) {
|
if (isset($personalAttributes['telephoneNumber'][0])) {
|
||||||
$subtitle .= _('Telephone number') . ' ' . htmlspecialchars($attributes['telephoneNumber'][0]) . $spacer;
|
$subtitle .= _('Telephone number') . ' ' . htmlspecialchars($personalAttributes['telephoneNumber'][0]) . $spacer;
|
||||||
}
|
}
|
||||||
// check if an mobile number can be shown
|
// check if an mobile number can be shown
|
||||||
if (isset($attributes['mobile'][0])) {
|
if (isset($personalAttributes['mobile'][0])) {
|
||||||
$subtitle .= _('Mobile number') . ' ' . htmlspecialchars($attributes['mobile'][0]);
|
$subtitle .= _('Mobile number') . ' ' . htmlspecialchars($personalAttributes['mobile'][0]);
|
||||||
}
|
}
|
||||||
if ($subtitle == '') {
|
if ($subtitle == '') {
|
||||||
return null;
|
return null;
|
||||||
|
@ -165,6 +195,20 @@ class user extends baseType {
|
||||||
return $subtitle;
|
return $subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the HTML code for the icon that shows the account status (locked/unlocked).
|
||||||
|
*
|
||||||
|
* @param array $attributes LDAP attributes
|
||||||
|
* @return String HTML code for icon
|
||||||
|
*/
|
||||||
|
private function buildAccountStatusIcon($attributes) {
|
||||||
|
$lowerAttributes = array_change_key_case($attributes, CASE_LOWER);
|
||||||
|
if (!lamUserList::isUnixAvailable($lowerAttributes) && !lamUserList::isUnixAvailable($lowerAttributes) && !lamUserList::isPPolicyAvailable($lowerAttributes)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return '<img src="../../graphics/lock.png"> ';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -449,12 +493,12 @@ class lamUserList extends lamList {
|
||||||
*/
|
*/
|
||||||
private function printAccountStatus(&$attrs) {
|
private function printAccountStatus(&$attrs) {
|
||||||
// check status
|
// check status
|
||||||
$unixAvailable = $this->isUnixAvailable($attrs);
|
$unixAvailable = self::isUnixAvailable($attrs);
|
||||||
$unixLocked = $this->isUnixLocked($attrs);
|
$unixLocked = self::isUnixLocked($attrs);
|
||||||
$sambaAvailable = $this->isSambaAvailable($attrs);
|
$sambaAvailable = self::isSambaAvailable($attrs);
|
||||||
$sambaLocked = $this->isSambaLocked($attrs);
|
$sambaLocked = self::isSambaLocked($attrs);
|
||||||
$ppolicyAvailable = $this->isPPolicyAvailable($attrs);
|
$ppolicyAvailable = self::isPPolicyAvailable($attrs);
|
||||||
$ppolicyLocked = $this->isPPolicyLocked($attrs);
|
$ppolicyLocked = self::isPPolicyLocked($attrs);
|
||||||
$partiallyLocked = $unixLocked || $sambaLocked || $ppolicyLocked;
|
$partiallyLocked = $unixLocked || $sambaLocked || $ppolicyLocked;
|
||||||
$fullyLocked = ($unixAvailable || $sambaAvailable || $ppolicyAvailable)
|
$fullyLocked = ($unixAvailable || $sambaAvailable || $ppolicyAvailable)
|
||||||
&& (!$unixAvailable || $unixLocked)
|
&& (!$unixAvailable || $unixLocked)
|
||||||
|
@ -509,7 +553,7 @@ class lamUserList extends lamList {
|
||||||
* @param array $attrs LDAP attributes
|
* @param array $attrs LDAP attributes
|
||||||
* @return boolean Unix part exists
|
* @return boolean Unix part exists
|
||||||
*/
|
*/
|
||||||
private function isUnixAvailable(&$attrs) {
|
private static function isUnixAvailable(&$attrs) {
|
||||||
return (isset($attrs['objectclass']) && in_array_ignore_case('posixAccount', $attrs['objectclass']));
|
return (isset($attrs['objectclass']) && in_array_ignore_case('posixAccount', $attrs['objectclass']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +563,7 @@ class lamUserList extends lamList {
|
||||||
* @param array $attrs LDAP attributes
|
* @param array $attrs LDAP attributes
|
||||||
* @return boolean Unix part locked
|
* @return boolean Unix part locked
|
||||||
*/
|
*/
|
||||||
private function isUnixLocked(&$attrs) {
|
private static function isUnixLocked(&$attrs) {
|
||||||
return (isset($attrs['userpassword'][0]) && !pwd_is_enabled($attrs['userpassword'][0]));
|
return (isset($attrs['userpassword'][0]) && !pwd_is_enabled($attrs['userpassword'][0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +573,7 @@ class lamUserList extends lamList {
|
||||||
* @param array $attrs LDAP attributes
|
* @param array $attrs LDAP attributes
|
||||||
* @return boolean Samba part exists
|
* @return boolean Samba part exists
|
||||||
*/
|
*/
|
||||||
private function isSambaAvailable(&$attrs) {
|
private static function isSambaAvailable(&$attrs) {
|
||||||
return (isset($attrs['objectclass']) && in_array_ignore_case('sambaSamAccount', $attrs['objectclass']));
|
return (isset($attrs['objectclass']) && in_array_ignore_case('sambaSamAccount', $attrs['objectclass']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +583,7 @@ class lamUserList extends lamList {
|
||||||
* @param array $attrs LDAP attributes
|
* @param array $attrs LDAP attributes
|
||||||
* @return boolean Samba part is locked
|
* @return boolean Samba part is locked
|
||||||
*/
|
*/
|
||||||
private function isSambaLocked(&$attrs) {
|
private static function isSambaLocked(&$attrs) {
|
||||||
return (isset($attrs['sambaacctflags'][0]) && strpos($attrs['sambaacctflags'][0], "D"));
|
return (isset($attrs['sambaacctflags'][0]) && strpos($attrs['sambaacctflags'][0], "D"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +593,7 @@ class lamUserList extends lamList {
|
||||||
* @param array $attrs LDAP attributes
|
* @param array $attrs LDAP attributes
|
||||||
* @return boolean PPolicy part exists
|
* @return boolean PPolicy part exists
|
||||||
*/
|
*/
|
||||||
private function isPPolicyAvailable(&$attrs) {
|
private static function isPPolicyAvailable(&$attrs) {
|
||||||
return in_array('ppolicyUser', $_SESSION['config']->get_AccountModules('user'));
|
return in_array('ppolicyUser', $_SESSION['config']->get_AccountModules('user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +603,7 @@ class lamUserList extends lamList {
|
||||||
* @param array $attrs LDAP attributes
|
* @param array $attrs LDAP attributes
|
||||||
* @return boolean PPolicy part is locked
|
* @return boolean PPolicy part is locked
|
||||||
*/
|
*/
|
||||||
private function isPPolicyLocked(&$attrs) {
|
private static function isPPolicyLocked(&$attrs) {
|
||||||
return (isset($attrs['pwdaccountlockedtime'][0]) && ($attrs['pwdaccountlockedtime'][0] != ''));
|
return (isset($attrs['pwdaccountlockedtime'][0]) && ($attrs['pwdaccountlockedtime'][0] != ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue