support new titlebar

This commit is contained in:
Roland Gruber 2010-12-14 21:16:21 +00:00
parent 1e26497e78
commit c629d185c0
7 changed files with 241 additions and 4 deletions

View File

@ -4,6 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2009 Pozdnyak Pavel
2010 Roland Gruber
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
@ -94,6 +95,24 @@ class asteriskExt extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New extension");
}
// check if a common name is set
if (isset($attributes['cn'][0])) {
return htmlspecialchars($attributes['cn'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
}

View File

@ -97,6 +97,45 @@ class dhcp extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New DHCP");
}
// check if a common name is set
if (isset($attributes['cn'][0])) {
return htmlspecialchars($attributes['cn'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarSubtitle($attributes) {
if ($attributes == null) {
return null;
}
$subtitle = '';
// check if an description can be shown
if (isset($attributes['dhcpComments'][0])) {
$subtitle .= htmlspecialchars($attributes['dhcpComments'][0]);
}
if ($subtitle == '') {
return null;
}
return $subtitle;
}
}
/**

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2009 Roland Gruber
Copyright (C) 2005 - 2010 Roland Gruber
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
@ -97,6 +97,49 @@ class group extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New group");
}
// check if a group name is set
if (isset($attributes['gid'][0])) {
return htmlspecialchars($attributes['gid'][0]);
}
// check if a common name is set
if (isset($attributes['cn'][0])) {
return htmlspecialchars($attributes['cn'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarSubtitle($attributes) {
if ($attributes == null) {
return null;
}
$subtitle = '';
// check if an description can be shown
if (isset($attributes['description'][0])) {
$subtitle .= htmlspecialchars($attributes['description'][0]);
}
if ($subtitle == '') {
return null;
}
return $subtitle;
}
}
/**

View File

@ -97,6 +97,46 @@ class host extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New host");
}
// check if a user name is set
if (isset($attributes['uid'][0])) {
return htmlspecialchars($attributes['uid'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarSubtitle($attributes) {
if ($attributes == null) {
return null;
}
// check if a common name is set
if (isset($attributes['cn'][0])) {
return htmlspecialchars($attributes['cn'][0]);
}
// check if a display name is set
if (isset($attributes['displayName'][0])) {
return htmlspecialchars($attributes['displayName'][0]);
}
// fall back to default
return parent::getTitleBarSubtitle($attributes);
}
}

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2009 Roland Gruber
Copyright (C) 2005 - 2010 Roland Gruber
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
@ -93,6 +93,24 @@ class mailAlias extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New alias");
}
// check if a common name is set
if (isset($attributes['cn'][0])) {
return htmlspecialchars($attributes['cn'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
}

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 Roland Gruber
Copyright (C) 2009 - 2010 Roland Gruber
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
@ -95,6 +95,45 @@ class netgroup extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New group");
}
// check if a common name is set
if (isset($attributes['cn'][0])) {
return htmlspecialchars($attributes['cn'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarSubtitle($attributes) {
if ($attributes == null) {
return null;
}
$subtitle = '';
// check if an description can be shown
if (isset($attributes['description'][0])) {
$subtitle .= htmlspecialchars($attributes['description'][0]);
}
if ($subtitle == '') {
return null;
}
return $subtitle;
}
}

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2009 Roland Gruber
Copyright (C) 2005 - 2010 Roland Gruber
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
@ -93,6 +93,45 @@ class smbDomain extends baseType {
);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarTitle($attributes) {
if ($attributes == null) {
return _("New domain");
}
// check if a domain name is set
if (isset($attributes['sambaDomainName'][0])) {
return htmlspecialchars($attributes['sambaDomainName'][0]);
}
// fall back to default
return parent::getTitleBarTitle($attributes);
}
/**
* 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)
* @return String title text
*/
public function getTitleBarSubtitle($attributes) {
if ($attributes == null) {
return null;
}
$subtitle = '';
// check if a SID can be shown
if (isset($attributes['sambaSID'][0])) {
$subtitle .= htmlspecialchars($attributes['sambaSID'][0]);
}
if ($subtitle == '') {
return null;
}
return $subtitle;
}
}