diff --git a/lam/graphics/lamdaemonSmall.png b/lam/graphics/lamdaemonSmall.png new file mode 100644 index 00000000..896498a8 Binary files /dev/null and b/lam/graphics/lamdaemonSmall.png differ diff --git a/lam/graphics/schemaTest.png b/lam/graphics/schemaTest.png new file mode 100644 index 00000000..457b2d28 Binary files /dev/null and b/lam/graphics/schemaTest.png differ diff --git a/lam/lib/html.inc b/lam/lib/html.inc index da957bc3..a5b1c1bc 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -1896,7 +1896,9 @@ class htmlLink extends htmlElement { /** * Constructor. * - * @param String $label label + * @param String $text label + * @param String $target target URL + * @param String $image URL of optional image */ function __construct($text, $target, $image = null) { $this->text = htmlspecialchars($text); diff --git a/lam/lib/tools.inc b/lam/lib/tools.inc index e789a917..ada048fc 100644 --- a/lam/lib/tools.inc +++ b/lam/lib/tools.inc @@ -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 @@ -119,6 +119,32 @@ interface LAMTool { */ function getPosition(); + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools(); + +} + +/** + * Represents a subtool. + * + * @author Roland Gruber + * @package tools + */ +class LAMSubTool { + + /** visible tool name */ + public $name; + /** tool description */ + public $description; + /** tool link (relative to templates/) */ + public $link; + /** image URL (relative to graphics/) */ + public $image; + } ?> \ No newline at end of file diff --git a/lam/lib/tools/fileUpload.inc b/lam/lib/tools/fileUpload.inc index f2b8f8b9..801933f2 100644 --- a/lam/lib/tools/fileUpload.inc +++ b/lam/lib/tools/fileUpload.inc @@ -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 @@ -99,6 +99,15 @@ class toolFileUpload implements LAMTool { return 200; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + return array(); + } + } ?> \ No newline at end of file diff --git a/lam/lib/tools/ouEditor.inc b/lam/lib/tools/ouEditor.inc index 7edcfe72..cf6480cf 100644 --- a/lam/lib/tools/ouEditor.inc +++ b/lam/lib/tools/ouEditor.inc @@ -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 @@ -99,6 +99,15 @@ class toolOUEditor implements LAMTool { return 300; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + return array(); + } + } ?> \ No newline at end of file diff --git a/lam/lib/tools/pdfEdit.inc b/lam/lib/tools/pdfEdit.inc index 7df41336..93c641b7 100644 --- a/lam/lib/tools/pdfEdit.inc +++ b/lam/lib/tools/pdfEdit.inc @@ -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 @@ -99,6 +99,15 @@ class toolPDFEditor implements LAMTool { return 400; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + return array(); + } + } ?> \ No newline at end of file diff --git a/lam/lib/tools/profileEditor.inc b/lam/lib/tools/profileEditor.inc index 008a7630..aad3c6e5 100644 --- a/lam/lib/tools/profileEditor.inc +++ b/lam/lib/tools/profileEditor.inc @@ -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 @@ -99,6 +99,15 @@ class toolProfileEditor implements LAMTool { return 100; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + return array(); + } + } ?> \ No newline at end of file diff --git a/lam/lib/tools/schemaBrowser.inc b/lam/lib/tools/schemaBrowser.inc index da26f017..25e31fd1 100644 --- a/lam/lib/tools/schemaBrowser.inc +++ b/lam/lib/tools/schemaBrowser.inc @@ -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 @@ -99,6 +99,15 @@ class toolSchemaBrowser implements LAMTool { return 500; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + return array(); + } + } ?> \ No newline at end of file diff --git a/lam/lib/tools/serverInfo.inc b/lam/lib/tools/serverInfo.inc index d2fabc69..bcc5acc1 100644 --- a/lam/lib/tools/serverInfo.inc +++ b/lam/lib/tools/serverInfo.inc @@ -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 @@ -99,6 +99,15 @@ class toolServerInformation implements LAMTool { return 600; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + return array(); + } + } ?> \ No newline at end of file diff --git a/lam/lib/tools/tests.inc b/lam/lib/tools/tests.inc index 5ca74501..b96d9615 100644 --- a/lam/lib/tools/tests.inc +++ b/lam/lib/tools/tests.inc @@ -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 @@ -99,6 +99,28 @@ class toolTests implements LAMTool { return 1000; } + /** + * Returns a list of sub tools or an empty array. + * + * @return array list of subtools (LAMTool) + */ + function getSubTools() { + $return = array(); + $lamdaemonTest = new LAMSubTool(); + $lamdaemonTest->name = _("Lamdaemon test"); + $lamdaemonTest->link = 'tests/lamdaemonTest.php'; + $lamdaemonTest->description = _("Check if quotas and homedirectories can be managed."); + $lamdaemonTest->image = 'lamdaemonSmall.png'; + $return[] = $lamdaemonTest; + $schemaTest = new LAMSubTool(); + $schemaTest->name = _("Schema test"); + $schemaTest->link = 'tests/schemaTest.php'; + $schemaTest->description = _("Check if the LDAP schema fits the requirements of the selected account modules."); + $schemaTest->image = 'schemaTest.png'; + $return[] = $schemaTest; + return $return; + } + } ?> \ No newline at end of file diff --git a/lam/templates/main_header.php b/lam/templates/main_header.php index db6842b6..d6fd7b09 100644 --- a/lam/templates/main_header.php +++ b/lam/templates/main_header.php @@ -35,6 +35,9 @@ $headerPrefix = ""; if (is_file("../login.php")) $headerPrefix = "../"; elseif (is_file("../../login.php")) $headerPrefix = "../../"; +/** tool definitions */ +include_once($headerPrefix . "../lib/tools.inc"); + // HTML header and title echo $_SESSION['header']; echo "LDAP Account Manager\n"; @@ -62,6 +65,25 @@ foreach ($jsFiles as $jsEntry) { echo "\n"; } +// get tool list +$availableTools = getTools(); +// sort tools +$toSort = array(); +for ($i = 0; $i < sizeof($availableTools); $i++) { + $myTool = new $availableTools[$i](); + if ($myTool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) { + continue; + } + if ($myTool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { + continue; + } + $toSort[$availableTools[$i]] = $myTool->getPosition(); +} +asort($toSort); +$tools = array(); +foreach ($toSort as $key => $value) { + $tools[] = new $key(); +} ?> @@ -69,23 +91,63 @@ foreach ($jsFiles as $jsEntry) { -
 LDAP Account Manager  LDAP Account Manager + +
+ +