display tools as menu

This commit is contained in:
Roland Gruber 2010-12-03 21:06:36 +00:00
parent b7b9dd3494
commit 537c01a47d
13 changed files with 184 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

BIN
lam/graphics/schemaTest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

View File

@ -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);

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
@ -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;
}
?>

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
@ -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();
}
}
?>

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
@ -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();
}
}
?>

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
@ -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();
}
}
?>

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
@ -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();
}
}
?>

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
@ -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();
}
}
?>

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
@ -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();
}
}
?>

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
@ -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;
}
}
?>

View File

@ -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 "<title>LDAP Account Manager</title>\n";
@ -62,6 +65,25 @@ foreach ($jsFiles as $jsEntry) {
echo "<script type=\"text/javascript\" src=\"" . $headerPrefix . "lib/" . $jsEntry . "\"></script>\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();
}
?>
<table border=0 width="100%" class="lamHeader ui-corner-all">
@ -69,23 +91,63 @@ foreach ($jsFiles as $jsEntry) {
<td align="left" height="30">
<a class="lamHeader" href="http://www.ldap-account-manager.org/" target="new_window">&nbsp;<img src="<?php echo $headerPrefix; ?>../graphics/logo32.png" width=24 height=24 class="align-middle" alt="LDAP Account Manager">&nbsp;&nbsp;LDAP Account Manager</a>
</td>
<td align="right" height=20>
<td align="right" height=30>
<ul id="foo" class="dropmenu">
<li><a href="<?php echo $headerPrefix; ?>logout.php" target="_top"><img alt="logout" src="<?php echo $headerPrefix; ?>../graphics/exit.png">&nbsp;<?php echo _("Logout") ?></a></li>
<li>
<a href="<?php echo $headerPrefix; ?>tools.php"><img alt="tools" src="<?php echo $headerPrefix; ?>../graphics/tools.png">&nbsp;<?php echo _("Tools") ?></a>
<ul>
<?php
for ($i = 0; $i < sizeof($tools); $i++) {
$subTools = $tools[$i]->getSubTools();
echo '<li title="' . $tools[$i]->getDescription() . '">';
$link = $headerPrefix . $tools[$i]->getLink();
echo '<a href="' . $link . "\">\n";
echo '<img alt="" src="' . $headerPrefix . '../graphics/' . $tools[$i]->getImageLink() . '"> ' . $tools[$i]->getName();
echo "</a>\n";
if (sizeof($subTools) > 0) {
echo "<ul>\n";
for ($s = 0; $s < sizeof($subTools); $s++) {
echo "<li title=\"" . $subTools[$s]->description . "\">\n";
echo "<a href=\"" . $headerPrefix . $subTools[$s]->link . "\">\n";
echo '<img width=16 height=16 alt="" src="' . $headerPrefix . '../graphics/' . $subTools[$s]->image . '"> ' . $subTools[$s]->name;
echo "</a>\n";
echo "</li>\n";
}
echo "</ul>\n";
}
echo "</li>\n";
}
?>
</ul>
</li>
<?php
if ($_SESSION['config']->get_Suffix('tree') != "") {
?>
<a href="<?php echo $headerPrefix; ?>tree/treeViewContainer.php"><img alt="tools" src="<?php echo $headerPrefix; ?>../graphics/process.png">&nbsp;<?php echo _("Tree view") ?></a>
&nbsp;&nbsp;&nbsp;
<li>
<a href="<?php echo $headerPrefix; ?>tree/treeViewContainer.php"><img alt="tools" src="<?php echo $headerPrefix; ?>../graphics/process.png">&nbsp;<?php echo _("Tree view") ?></a>
</li>
<?php
}
?>
<a href="<?php echo $headerPrefix; ?>tools.php"><img alt="tools" src="<?php echo $headerPrefix; ?>../graphics/tools.png">&nbsp;<?php echo _("Tools") ?></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?php echo $headerPrefix; ?>logout.php" target="_top"><img alt="logout" src="<?php echo $headerPrefix; ?>../graphics/exit.png">&nbsp;<?php echo _("Logout") ?></a>
&nbsp;
</ul>
</td>
</tr>
</table>
<script type="text/javascript">
$(document).ready(function() {
$('#foo').dropmenu(
{
effect : 'slide',
nbsp : true,
timeout : 350,
speed : 'fast'
}
);
});
</script>
<br>
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">

View File

@ -47,13 +47,13 @@ echo "<div class=\"userlist-bright smallPaddingContent\">\n";
$container = new htmlTable();
$container->addElement(new htmlSubTitle(_("LAM tests")), true);
$container->addElement(new htmlLink(_("Lamdaemon test"), 'lamdaemonTest.php'));
$container->addElement(new htmlLink(_("Lamdaemon test"), 'lamdaemonTest.php', '../../graphics/lamdaemonSmall.png'));
$container->addElement(new htmlSpacer('20px', null));
$container->addElement(new htmlOutputText(_("Check if quotas and homedirectories can be managed.")), true);
$container->addElement(new htmlSpacer(null, '20px'), true);
$container->addElement(new htmlLink(_("Schema test"), 'schemaTest.php'));
$container->addElement(new htmlLink(_("Schema test"), 'schemaTest.php', '../../graphics/schemaTest.png'));
$container->addElement(new htmlSpacer('20px', null));
$container->addElement(new htmlOutputText(_("Check if the LDAP schema fits the requirements of the selected account modules.")), true);