hide tools that are not usable

This commit is contained in:
Roland Gruber 2011-05-19 16:25:07 +00:00
parent f580d700c5
commit 55e4ba8634
10 changed files with 87 additions and 9 deletions

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -126,6 +126,13 @@ interface LAMTool {
*/ */
function getSubTools(); function getSubTools();
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible();
} }
/** /**

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -108,6 +108,15 @@ class toolFileUpload implements LAMTool {
return array(); return array();
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
} }
?> ?>

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -108,6 +108,15 @@ class toolOUEditor implements LAMTool {
return array(); return array();
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
} }
?> ?>

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -108,6 +108,15 @@ class toolPDFEditor implements LAMTool {
return array(); return array();
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
} }
?> ?>

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -108,6 +108,15 @@ class toolProfileEditor implements LAMTool {
return array(); return array();
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
} }
?> ?>

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -108,6 +108,15 @@ class toolSchemaBrowser implements LAMTool {
return array(); return array();
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return true;
}
} }
?> ?>

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -108,6 +108,15 @@ class toolServerInformation implements LAMTool {
return array(); return array();
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return true;
}
} }
?> ?>

View File

@ -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) 2009 - 2010 Roland Gruber Copyright (C) 2009 - 2011 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
@ -121,6 +121,15 @@ class toolTests implements LAMTool {
return $return; return $return;
} }
/**
* Returns if the tool is visible in the menu.
*
* @return boolean visible
*/
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
} }
?> ?>

View File

@ -77,6 +77,10 @@ for ($i = 0; $i < sizeof($availableTools); $i++) {
if ($myTool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { if ($myTool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) {
continue; continue;
} }
// check visibility
if (!$myTool->isVisible()) {
continue;
}
$toSort[$availableTools[$i]] = $myTool->getPosition(); $toSort[$availableTools[$i]] = $myTool->getPosition();
} }
asort($toSort); asort($toSort);

View File

@ -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) 2003 - 2010 Roland Gruber Copyright (C) 2003 - 2011 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
@ -70,6 +70,10 @@ for ($i = 0; $i < sizeof($tools); $i++) {
if ($tools[$i]->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { if ($tools[$i]->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) {
continue; continue;
} }
// check visibility
if (!$tools[$i]->isVisible()) {
continue;
}
// add tool // add tool
$container->addElement(new htmlLink($tools[$i]->getName(), $tools[$i]->getLink(), '../graphics/' . $tools[$i]->getImageLink())); $container->addElement(new htmlLink($tools[$i]->getName(), $tools[$i]->getLink(), '../graphics/' . $tools[$i]->getImageLink()));
$container->addElement(new htmlSpacer('10px', null)); $container->addElement(new htmlSpacer('10px', null));