LDAPAccountManager/lam/templates/main_header.php

206 lines
6.9 KiB
PHP
Raw Normal View History

<?php
2003-03-14 21:59:04 +00:00
/*
$Id$
2009-10-27 18:47:12 +00:00
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
2011-01-06 17:38:16 +00:00
Copyright (C) 2003 - 2011 Roland Gruber
2003-03-14 21:59:04 +00:00
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2004-06-10 19:01:18 +00:00
*/
2003-06-01 16:35:02 +00:00
2004-06-10 19:01:18 +00:00
/**
2010-01-01 17:21:46 +00:00
* Head part of page which includes links to lists etc.
2004-06-10 19:01:18 +00:00
*
* @package main
* @author Roland Gruber
2003-03-14 21:59:04 +00:00
*/
2004-06-10 19:01:18 +00:00
2010-01-01 17:21:46 +00:00
// number of list views (users, groups, ...)
$types = $_SESSION['config']->get_ActiveTypes();
2003-07-26 11:11:25 +00:00
2010-01-01 17:21:46 +00:00
$headerPrefix = "";
if (is_file("../login.php")) $headerPrefix = "../";
elseif (is_file("../../login.php")) $headerPrefix = "../../";
2003-03-14 21:59:04 +00:00
2010-12-03 21:06:36 +00:00
/** tool definitions */
include_once($headerPrefix . "../lib/tools.inc");
2011-12-14 16:12:43 +00:00
$pro = '';
if (isLAMProVersion()) {
$pro = ' Pro';
}
2010-01-01 17:21:46 +00:00
// HTML header and title
2003-07-29 11:52:26 +00:00
echo $_SESSION['header'];
2011-10-31 18:43:32 +00:00
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"" . $headerPrefix . "../graphics/favicon.ico\">\n";
2011-12-14 16:12:43 +00:00
echo "<title>LDAP Account Manager" . $pro . " (" . str_replace(array('ldap://', 'ldaps://'), array('', ''), $_SESSION['config']->get_ServerURL()) . ")</title>\n";
2004-01-27 18:05:35 +00:00
2010-01-01 17:21:46 +00:00
// include all CSS files
$cssDirName = dirname(__FILE__) . '/../style';
$cssDir = dir($cssDirName);
while ($cssEntry = $cssDir->read()) {
if (substr($cssEntry, strlen($cssEntry) - 4, 4) != '.css') continue;
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $headerPrefix . "../style/" . $cssEntry . "\">\n";
}
2004-01-27 18:05:35 +00:00
2010-01-01 17:21:46 +00:00
echo "</head><body>\n";
2003-03-14 21:59:04 +00:00
2010-01-01 17:21:46 +00:00
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/lib';
$jsDir = dir($jsDirName);
2010-08-28 12:27:06 +00:00
$jsFiles = array();
2010-01-01 17:21:46 +00:00
while ($jsEntry = $jsDir->read()) {
2011-10-16 12:06:00 +00:00
if ((substr($jsEntry, strlen($jsEntry) - 3, 3) != '.js') && (substr($jsEntry, strlen($jsEntry) - 4, 4) != '.php')) {
continue;
}
2010-08-28 12:27:06 +00:00
$jsFiles[] = $jsEntry;
}
sort($jsFiles);
foreach ($jsFiles as $jsEntry) {
2010-01-01 17:21:46 +00:00
echo "<script type=\"text/javascript\" src=\"" . $headerPrefix . "lib/" . $jsEntry . "\"></script>\n";
}
2010-12-03 21:06:36 +00:00
// get tool list
$availableTools = getTools();
2012-05-26 20:05:56 +00:00
$toolSettings = $_SESSION['config']->getToolSettings();
2010-12-03 21:06:36 +00:00
// 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;
}
2011-05-19 16:25:07 +00:00
// check visibility
if (!$myTool->isVisible()) {
continue;
}
2012-05-26 20:05:56 +00:00
// check if hidden by config
if (isset($toolSettings['tool_hide_' . get_class($myTool)]) && ($toolSettings['tool_hide_' . get_class($myTool)] == 'true')) {
continue;
}
2010-12-03 21:06:36 +00:00
$toSort[$availableTools[$i]] = $myTool->getPosition();
}
asort($toSort);
$tools = array();
foreach ($toSort as $key => $value) {
$tools[] = new $key();
}
2010-01-01 17:21:46 +00:00
?>
2003-06-01 16:35:02 +00:00
2010-08-31 17:34:16 +00:00
<table border=0 width="100%" class="lamHeader ui-corner-all">
2003-06-01 13:59:13 +00:00
<tr>
2010-07-30 16:08:20 +00:00
<td align="left" height="30">
2011-02-17 18:38:53 +00:00
<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
<?php
2011-12-14 16:12:43 +00:00
echo $pro . " - " . LAMVersion();
2011-02-17 18:38:53 +00:00
?>
</a>
2011-08-21 17:55:58 +00:00
<?php
echo '&nbsp;&nbsp;<small>';
$userData = $_SESSION['ldap']->decrypt_login();
printf('(' . _('Logged in as: %s') . ')', getAbstractDN($userData[0]));
$userData = null;
echo '</small>';
?>
</td>
2010-12-03 21:06:36 +00:00
<td align="right" height=30>
2011-01-06 17:38:16 +00:00
<ul id="dropmenu" class="dropmenu">
2012-08-18 15:53:52 +00:00
<li><a href="<?php echo $headerPrefix; ?>logout.php" target="_top"><img class="align-middle" height="16" width="16" alt="logout" src="<?php echo $headerPrefix; ?>../graphics/exit.png">&nbsp;<?php echo _("Logout") ?></a></li>
2011-02-17 20:47:23 +00:00
<?php
if (is_dir(dirname(__FILE__) . '/../docs/manual')) {
?>
<li>
2012-08-18 15:53:52 +00:00
<a target="_blank" href="<?php echo $headerPrefix; ?>../docs/manual/index.html"><img class="align-middle" width="16" height="16" alt="help" src="<?php echo $headerPrefix; ?>../graphics/help.png">&nbsp;<?php echo _("Help") ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
2011-02-17 20:47:23 +00:00
</li>
<?php
}
2012-08-13 17:43:48 +00:00
if (sizeof($tools) > 0) {
2011-02-17 20:47:23 +00:00
?>
2010-12-03 21:06:36 +00:00
<li>
2012-08-18 15:53:52 +00:00
<a href="<?php echo $headerPrefix; ?>tools.php"><img class="align-middle" height="16" width="16" alt="tools" src="<?php echo $headerPrefix; ?>../graphics/tools.png">&nbsp;<?php echo _("Tools") ?></a>
2010-12-03 21:06:36 +00:00
<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 height="16" width="16" alt="" src="' . $headerPrefix . '../graphics/' . $tools[$i]->getImageLink() . '"> ' . $tools[$i]->getName();
2010-12-03 21:06:36 +00:00
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>
2010-11-28 15:45:29 +00:00
<?php
2012-08-13 17:43:48 +00:00
}
2010-11-28 15:45:29 +00:00
if ($_SESSION['config']->get_Suffix('tree') != "") {
?>
2010-12-03 21:06:36 +00:00
<li>
2012-08-18 15:53:52 +00:00
<a href="<?php echo $headerPrefix; ?>tree/treeViewContainer.php"><img class="align-middle" height="16" width="16" alt="tree" src="<?php echo $headerPrefix; ?>../graphics/process.png">&nbsp;<?php echo _("Tree view") ?></a>
2011-02-17 20:41:42 +00:00
</li>
<?php
}
2010-11-28 15:45:29 +00:00
?>
2010-12-03 21:06:36 +00:00
</ul>
2010-07-30 16:08:20 +00:00
</td>
</tr>
2006-05-19 11:13:20 +00:00
</table>
2010-07-30 16:08:20 +00:00
2010-12-03 21:06:36 +00:00
<script type="text/javascript">
2011-01-06 17:38:16 +00:00
jQuery(document).ready(function() {
jQuery('#dropmenu').dropmenu({
effect : 'slide',
nbsp : true,
timeout : 350,
speed : 'fast'
});
});
2010-12-03 21:06:36 +00:00
</script>
2010-06-13 15:11:01 +00:00
<br>
2010-08-21 09:43:52 +00:00
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all">
2010-08-21 08:30:11 +00:00
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
2010-06-13 15:11:01 +00:00
<?php
$linkList = array();
for ($i = 0; $i < sizeof($types); $i++) {
2011-01-06 17:38:16 +00:00
$link = '<a href="' . $headerPrefix . 'lists/list.php?type=' . $types[$i] .
'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' .
'<img height="16" width="16" alt="' . $types[$i] . '" src="' . $headerPrefix . '../graphics/' . $types[$i] . '.png">&nbsp;' .
2010-06-13 15:11:01 +00:00
getTypeAlias($types[$i]) . '</a>';
echo '<li id="tab_' . $types[$i] . '" class="ui-state-default ui-corner-top">';
echo $link;
echo "</li>\n";
}
?>
</ul>
2010-07-30 16:08:20 +00:00