Merge remote-tracking branch 'origin/develop' into 6_2_1

Conflicts:
	lam-packaging/debian/changelog
	lam/HISTORY
	lam/VERSION
This commit is contained in:
Roland Gruber 2018-02-06 18:57:46 +01:00
commit f0b68d2b1a
65 changed files with 1534 additions and 1105 deletions

View File

@ -26,28 +26,28 @@ fi
function minify { function minify {
local dir="$1" local dir="$1"
echo "Minify JS files in $dir" echo "Minify JS files in $dir"
local outFile=$dir/100_lam.${VERSION}.min.js
local files=`ls $dir/*.js` local files=`ls $dir/*.js`
local jsFiles=""
for file in $files; do for file in $files; do
closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN jsFiles="$jsFiles --js $file"
rm $file
mv ${file}-MIN $file
# add final new line to supress Debian warnings
echo "" >> $file
done done
closure-compiler --charset UTF-8 $jsFiles --js_output_file $outFile
rm $files
# add final new line to supress Debian warnings
echo "" >> $outFile
} }
# minifies the CSS files # minifies the CSS files
function minifyCSS { function minifyCSS {
local dir="$1" local dir="$1"
echo "Minify CSS files in $dir" echo "Minify CSS files in $dir"
local outFile=$dir/100_lam.${VERSION}.min.css
local files=`ls $dir/*.css` local files=`ls $dir/*.css`
for file in $files; do cat $files | cleancss -o $outFile
cleancss -o ${file}-MIN $file rm $files
rm $file # add final new line to supress Debian warnings
mv ${file}-MIN $file echo "" >> $outFile
# add final new line to supress Debian warnings
echo "" >> $file
done
} }
echo "Getting files..." echo "Getting files..."

View File

@ -1,3 +1,9 @@
ldap-account-manager (6.3.DEV-1) unstable; urgency=medium
* new upstream release
-- Roland Gruber <post@rolandgruber.de> Wed, 13 Dec 2017 16:47:31 +0200
ldap-account-manager (6.2.1-1) unstable; urgency=medium ldap-account-manager (6.2.1-1) unstable; urgency=medium
* new upstream release * new upstream release

View File

@ -1,22 +1,24 @@
#!/bin/bash #!/bin/bash
set -e set -e
outFile=templates/lib/100_lam.${SOURCE_DATE_EPOCH}.min.js
files=`ls templates/lib/*.js` if [ ! -e $outFile ]; then
for file in $files; do files=`ls templates/lib/*.js`
closure-compiler --charset UTF-8 --js $file --js_output_file ${file}-MIN jsFiles=""
rm $file for file in $files; do
mv ${file}-MIN $file jsFiles="$jsFiles --js $file"
done
closure-compiler --charset UTF-8 $jsFiles --js_output_file $outFile
rm $files
# add final new line to supress Debian warnings # add final new line to supress Debian warnings
echo "" >> $file echo "" >> $outFile
done fi
files=`ls style/*.css` files=`ls style/*.css`
for file in $files; do outFile=style/100_lam.${SOURCE_DATE_EPOCH}.min.css
cleancss -o ${file}-MIN $file if [ ! -e $outFile ]; then
rm $file cat $files | cleancss -o ${outFile}
mv ${file}-MIN $file rm $files
# add final new line to supress Debian warnings # add final new line to supress Debian warnings
echo "" >> $file echo "" >> $outFile
done fi

View File

@ -1,3 +1,10 @@
March 2018 6.3
- Server profile: added option if referential integrity overlay is active to sip cleanup actions
- LAM Pro:
-> Support custom structural object classes with new custom type
-> Support dynamic lists
04.02.2018 6.2.1 04.02.2018 6.2.1
- Fixed bugs: - Fixed bugs:
-> Login page not working when no server profile exists (44) -> Login page not working when no server profile exists (44)

View File

@ -1 +1 @@
6.2.1 6.3.DEV

View File

@ -0,0 +1,4 @@
<pdf type="bind" filename="printLogo.jpg" headline="Custom entry" foldingmarks="no">
<section name="_main_dn">
</section>
</pdf>

View File

@ -0,0 +1 @@

View File

@ -15,9 +15,11 @@ time.
* lib/modules/aliasEntry.inc * lib/modules/aliasEntry.inc
* lib/modules/automount.inc * lib/modules/automount.inc
* lib/modules/bindDLZ.inc * lib/modules/bindDLZ.inc
* lib/modules/customBaseType.inc
* lib/modules/customFields.inc * lib/modules/customFields.inc
* lib/modules/customScripts.inc * lib/modules/customScripts.inc
* lib/modules/device.inc * lib/modules/device.inc
* lib/modules/dynamicList.inc
* lib/modules/groupOfNames.inc * lib/modules/groupOfNames.inc
* lib/modules/groupOfNamesUser.inc * lib/modules/groupOfNamesUser.inc
* lib/modules/groupOfUniqueNames.inc * lib/modules/groupOfUniqueNames.inc
@ -48,8 +50,9 @@ time.
* lib/modules/zarafaServer.inc * lib/modules/zarafaServer.inc
* lib/modules/zarafaUser.inc * lib/modules/zarafaUser.inc
* lib/types/alias.inc * lib/types/alias.inc
* lib/types/bind.inc
* lib/types/automountType.inc * lib/types/automountType.inc
* lib/types/bind.inc
* lib/types/customType.inc
* lib/types/gon.inc * lib/types/gon.inc
* lib/types/nisObjectType.inc * lib/types/nisObjectType.inc
* lib/types/nsview.inc * lib/types/nsview.inc

View File

@ -60,6 +60,19 @@ This is a list of API changes for all LAM releases.
<br> <br>
<h2>6.2 -&gt; 6.3</h2>
<ul>
<li>Module API
<ul>
<li>get_configOptions(): $allScopes contains type ids instead of account types</li>
<li>check_configOptions(): first parameter contains type ids instead of account types</li>
</ul>
</li>
</ul>
<h2>6.1 -&gt; 6.2</h2>
<ul>
<li>No major API changes</li>
</ul>
<h2>6.0 -&gt; 6.1</h2> <h2>6.0 -&gt; 6.1</h2>
<ul> <ul>
<li>module API</li> <li>module API</li>
@ -616,4 +629,4 @@ The class variable "triggered_messages" in baseModule was removed.<br>
<br> <br>
</body></html> </body></html>

View File

@ -368,24 +368,49 @@
<para><emphasis role="bold">Advanced options</emphasis></para> <para><emphasis role="bold">Advanced options</emphasis></para>
<para>Sometimes, you may not want to display the server address on the <para>Display name: Sometimes, you may not want to display the server
login page. In this case you can setup a display name here (e.g. address on the login page. In this case you can setup a display name
"Production").</para> here (e.g. "Production").</para>
<para>By default LAM will not follow LDAP referrals. This is ok for <para>Follow referrals: By default LAM will not follow LDAP referrals.
most installations. If you use LDAP referrals please activate the This is ok for most installations. If you use LDAP referrals please
referral option in advanced settings.</para> activate the referral option in advanced settings.</para>
<para>Paged results should be activated only if you encounter any <para>Paged results: Paged results should be activated only if you
problems regarding size limits on Active Directory. LAM will then encounter any problems regarding size limits on Active Directory. LAM
query LDAP to return results in chunks of 999 entries.</para> will then query LDAP to return results in chunks of 999
entries.</para>
<para>Referential integrity overlay: Activate this checkbox if you
have any server side extension for referential integrity in place. In
this case the server will cleanup references to LDAP entries that are
deleted.</para>
<para>The following actions are skipped in this case:</para>
<itemizedlist>
<listitem>
<para>Users: group of (unique) names: memberships are not deleted
when user is deleted</para>
</listitem>
<listitem>
<para>Users: organizational roles: role assignments are not
deleted when user is deleted</para>
</listitem>
<listitem>
<para>Groups: groupOf(Unique)Names: memberships are not deleted
when group is deleted</para>
</listitem>
</itemizedlist>
<literallayout> <literallayout>
</literallayout> </literallayout>
<para>LAM is translated to many different languages. Here you can <para>LAM is translated to many different languages. Here you can
select the default language for this server profile. The language select the default language for this server profile. The language
setting may be overriden at the LAM login page.</para> setting may be overridden at the LAM login page.</para>
<para>Please also set your time zone here.</para> <para>Please also set your time zone here.</para>

View File

@ -2519,6 +2519,82 @@
</screenshot> </screenshot>
</section> </section>
<section>
<title>Dynamic lists (LAM Pro)</title>
<para><ulink
url="http://www.openldap.org/doc/admin24/overlays.html#Dynamic%20Lists">Dynamic
lists</ulink> allow you to create LDAP entries that populate the value
of an attribute via LDAP query. This is e.g. used to create groups that
contain all users in a certain DN.</para>
<para>Please note that this functionality requires configuration on your
LDAP server. E.g. on OpenLDAP you need to activate the "dynlist" overlay
and need to specify attribute mappings.</para>
<para><emphasis role="bold">Configuration</emphasis></para>
<para>Add a new group account type and set a unique label for it.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_dynamicList1.png"/>
</imageobject>
</inlinemediaobject></para>
<para>Do not forget to set proper "List attributes" to be shown on the
overview page of all dynamic lists.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_dynamicList2.png"/>
</imageobject>
</inlinemediaobject></para>
<para>On tab "Modules" please add the dynamic lists module.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_dynamicList4.png"/>
</imageobject>
</inlinemediaobject></para>
<para>On tab "Module settings" you can now configure your dynamic lists.
Here you setup the used object class, RDN attribute, query attribute and
list attribute (the one that is populated via query).</para>
<para>In case you have different types of dynamic lists you can simply
redo the steps above to create more group types.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_dynamicList3.png"/>
</imageobject>
</inlinemediaobject></para>
<para/>
<para><emphasis role="bold">Usage</emphasis></para>
<para>When you login to LAM you will see your new dynamic lists
tab.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_dynamicList5.png"/>
</imageobject>
</inlinemediaobject></para>
<para>For each list you can manage the name and query string. LAM also
displays which entries are auto-populated to the list.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_dynamicList6.png"/>
</imageobject>
</inlinemediaobject></para>
</section>
<section> <section>
<title>PyKota</title> <title>PyKota</title>
@ -4733,7 +4809,72 @@ OK (10 msec)</programlisting>
</screenshot> </screenshot>
</section> </section>
<section> <section id="mod_customTypes">
<title>Custom types (LAM Pro)</title>
<para>This account type allows you to manage any type of LDAP entries.
This is e.g. needed if you define your own structural object classes or
LAM does not yet provide a module for a structural object class.</para>
<para>Always use this together with <link
linkend="mod_customFields">Custom fields</link> to specify the LDAP
attributes.</para>
<para><emphasis role="bold">Configuration</emphasis></para>
<para>Add a custom account type in your server profile (you can also add
multiple if needed).</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_customBaseType1.png"/>
</imageobject>
</inlinemediaobject></para>
<para>Then specify the root DN where the entries should be stored. Also
provide the attributes to show in list view and a unique label for your
entries.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_customBaseType2.png"/>
</imageobject>
</inlinemediaobject></para>
<para>On tab modules add the custom type module. You will also need the
<link linkend="mod_customFields">Custom fields</link> module to manage the
attributes.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_customBaseType3.png"/>
</imageobject>
</inlinemediaobject></para>
<para>Finally, switch to tab Module settings. Here you need to specify the
structural object class. Also configure the <link
linkend="mod_customFields">Custom fields</link> module to manage all your
attributes.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_customBaseType4.png"/>
</imageobject>
</inlinemediaobject></para>
<para><emphasis role="bold">Manage your entries</emphasis></para>
<para>You can now login to LAM and will see one tab for each configured
custom type.</para>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/mod_customBaseType5.png"/>
</imageobject>
</inlinemediaobject></para>
</section>
<section id="mod_customFields">
<title>Custom fields (LAM Pro)</title> <title>Custom fields (LAM Pro)</title>
<para>This module allows you to manage LDAP attributes that are not <para>This module allows you to manage LDAP attributes that are not
@ -4781,7 +4922,8 @@ OK (10 msec)</programlisting>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>structural object classes</para> <para>structural object classes (supported by <link
linkend="mod_customTypes">Custom types</link>)</para>
</listitem> </listitem>
<listitem> <listitem>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -194,6 +194,8 @@ $helpArray = array (
"Text" => _('Please select the template for the new server profile. You can either select an existing server profile or use one of the built-in templates.')), "Text" => _('Please select the template for the new server profile. You can either select an existing server profile or use one of the built-in templates.')),
"268" => array ("Headline" => _('Display name'), "268" => array ("Headline" => _('Display name'),
"Text" => _('This name is shown on the login page as server name. Defaults to server address if empty.')), "Text" => _('This name is shown on the login page as server name. Defaults to server address if empty.')),
"269" => array ("Headline" => _('Referential integrity overlay'),
"Text" => _('Activate this checkbox if you have any server side extension for referential integrity in place. LAM will then skip cleanup tasks like deletion of group memberships on account deletion.')),
"270" => array ("Headline" => _('Bind user and password'), "270" => array ("Headline" => _('Bind user and password'),
"Text" => _('Please enter the DN and password to use for all jobs.')), "Text" => _('Please enter the DN and password to use for all jobs.')),
"271" => array ("Headline" => _('Database type'), "271" => array ("Headline" => _('Database type'),

View File

@ -4,7 +4,7 @@ $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 - 2006 Tilo Lutz Copyright (C) 2003 - 2006 Tilo Lutz
2009 - 2017 Roland Gruber 2009 - 2018 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
@ -1094,7 +1094,14 @@ function extractRDNAttribute($dn) {
*/ */
function extractRDNValue($dn) { function extractRDNValue($dn) {
if (empty($dn)) return null; if (empty($dn)) return null;
$parts = explode("=", substr($dn, 0, strpos($dn, ','))); if (strpos($dn, '=') === false) {
return $dn;
}
$dnWork = $dn;
if (strpos($dnWork, ',') !== false) {
$dnWork = substr($dn, 0, strpos($dnWork, ','));
}
$parts = explode("=", $dnWork);
return $parts[1]; return $parts[1];
} }
@ -1567,7 +1574,7 @@ function printJsIncludes($prefix) {
$jsFiles = array(); $jsFiles = array();
$jsEntry = $jsDir->read(); $jsEntry = $jsDir->read();
while ($jsEntry !== false) { while ($jsEntry !== false) {
if (substr($jsEntry, strlen($jsEntry) - 3, 3) == '.js') { if ((substr($jsEntry, strlen($jsEntry) - 3, 3) == '.js') || (substr($jsEntry, strlen($jsEntry) - 4, 4) == '.php')) {
$jsFiles[] = $jsEntry; $jsFiles[] = $jsEntry;
} }
$jsEntry = $jsDir->read(); $jsEntry = $jsDir->read();
@ -1578,6 +1585,11 @@ function printJsIncludes($prefix) {
} }
} }
/**
* LAM exception with title and message.
*
* @author Roland Gruber
*/
class LAMException extends Exception { class LAMException extends Exception {
private $title; private $title;

35
lam/lib/adminFooter.inc Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace LAM\FOOTER;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2018 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
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
*/
/**
* Footer part of page which closes the tab content area etc.
*
* @package main
* @author Roland Gruber
*/
?>
</div>
<br>
</body>
</html>

206
lam/lib/adminHeader.inc Normal file
View File

@ -0,0 +1,206 @@
<?php
namespace LAM\HEADER;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2018 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
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
*/
/**
* Head part of page which includes links to lists etc.
*
* @package main
* @author Roland Gruber
*/
$headerPrefix = "";
if (is_file("login.php")) {
$headerPrefix = "..";
}
elseif (is_file("../../templates/login.php")) {
$headerPrefix = "../..";
}
elseif (is_file("../../../templates/login.php")) {
$headerPrefix = "../../..";
}
/** tool definitions */
include_once($headerPrefix . "/lib/tools.inc");
$pro = '';
if (isLAMProVersion()) {
$pro = ' Pro';
}
// HTML header and title
echo $_SESSION['header'];
$title = "LDAP Account Manager" . $pro . " (" . str_replace(array('ldap://', 'ldaps://'), array('', ''), $_SESSION['config']->get_ServerURL()) . ")";
printHeaderContents($title, $headerPrefix);
echo "</head><body class=\"admin\">\n";
// include all JavaScript files
printJsIncludes($headerPrefix);
// get tool list
$availableTools = getTools();
$toolSettings = $_SESSION['config']->getToolSettings();
// sort tools
$toSort = array();
foreach ($availableTools as $toolClass) {
$myTool = new $toolClass();
if ($myTool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) {
continue;
}
if ($myTool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) {
continue;
}
// check visibility
if (!$myTool->isVisible()) {
continue;
}
// check if hidden by config
$toolName = substr($toolClass, strrpos($toolClass, '\\') + 1);
if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) {
continue;
}
$toSort[$toolClass] = $myTool->getPosition();
}
asort($toSort);
$tools = array();
foreach ($toSort as $key => $value) {
$tools[] = new $key();
}
?>
<table border=0 width="100%" class="lamHeader ui-corner-all">
<tr>
<td align="left" height="30" class="nowrap">
<a class="lamLogo" href="https://www.ldap-account-manager.org/" target="new_window">
<span class="hide-on-tablet">&nbsp;</span>
<span class="hide-on-mobile">
LDAP Account Manager
<?php
echo $pro . " - " . LAMVersion();
?>
</span>
</a>
</td>
<td align="left" height="30" class="nowrap">
<span class="hide-on-mobile">
<?php
$userData = $_SESSION['ldap']->decrypt_login();
echo '&nbsp;&nbsp;<small title="' . $userData[0] . '">';
printf('(' . _('Logged in as: %s') . ')', extractRDNValue($userData[0]));
$userData = null;
echo '</small>';
?>
</span>
</td>
<td align="right" height=30 width="100%">
<ul id="dropmenu" class="dropmenu">
<li><a href="<?php echo $headerPrefix; ?>/templates/logout.php" target="_top"><img class="align-middle" height="16" width="16" alt="logout" src="<?php echo $headerPrefix; ?>/graphics/exit.png"><span class="hide-on-mobile padding0">&nbsp;<?php echo _("Logout") ?></span></a></li>
<?php
if (is_dir(dirname(__FILE__) . '/../docs/manual')) {
?>
<li>
<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"><span class="hide-on-mobile padding0">&nbsp;<?php echo _("Help") ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></a>
</li>
<?php
}
if (sizeof($tools) > 0) {
?>
<li>
<a href="<?php echo $headerPrefix; ?>/templates/tools.php"><img class="align-middle" height="16" width="16" alt="tools" src="<?php echo $headerPrefix; ?>/graphics/tools.png"><span class="hide-on-mobile padding0">&nbsp;<?php echo _("Tools") ?></span></a>
<ul>
<?php
foreach ($tools as $tool) {
$subTools = $tool->getSubTools();
echo '<li title="' . $tool->getDescription() . '">';
$link = $headerPrefix . '/templates/' . $tool->getLink();
echo '<a href="' . $link . "\">\n";
echo '<img class="max16" height="16px" width="16px" alt="" src="' . $headerPrefix . '/graphics/' . $tool->getImageLink() . '"> ' . $tool->getName();
echo "</a>\n";
if (sizeof($subTools) > 0) {
echo "<ul>\n";
foreach ($subTools as $subTool) {
echo "<li title=\"" . $subTool->description . "\">\n";
echo "<a href=\"" . $headerPrefix . '/templates/' . $subTool->link . "\">\n";
echo '<img class="max16" width="16px" height="16px" alt="" src="' . $headerPrefix . '/graphics/' . $subTool->image . '"> ' . $subTool->name;
echo "</a>\n";
echo "</li>\n";
}
echo "</ul>\n";
}
echo "</li>\n";
}
?>
</ul>
</li>
<?php
}
if ($_SESSION['config']->get_Suffix('tree') != "") {
?>
<li>
<a href="<?php echo $headerPrefix; ?>/templates/tree/treeViewContainer.php"><img class="align-middle" height="16" width="16" alt="tree" src="<?php echo $headerPrefix; ?>/graphics/process.png"><span class="hide-on-mobile padding0">&nbsp;<?php echo _("Tree view") ?></span></a>
</li>
<?php
}
?>
</ul>
</td>
</tr>
</table>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#dropmenu').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">
<?php
printTypeTabs($headerPrefix);
?>
</ul>
<?php
function printTypeTabs($headerPrefix) {
$typeManager = new \LAM\TYPES\TypeManager();
$types = $typeManager->getConfiguredTypes();
foreach ($types as $type) {
if ($type->isHidden()) {
continue;
}
$link = '<a href="' . $headerPrefix . '/templates/lists/list.php?type=' . $type->getId() .
'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' .
'<img height="16" width="16" alt="' . $type->getId() . '" src="' . $headerPrefix . '/graphics/' . $type->getIcon() . '">&nbsp;' .
$type->getAlias() . '</a>';
echo '<li id="tab_' . $type->getId() . '" class="ui-state-default ui-corner-top">';
echo $link;
echo "</li>\n";
}
}

View File

@ -2,11 +2,11 @@
use \LAM\PDF\PDFLabelValue; use \LAM\PDF\PDFLabelValue;
use \LAM\PDF\PDFTable; use \LAM\PDF\PDFTable;
use LAM\TYPES\ConfiguredType; use LAM\TYPES\ConfiguredType;
use function LAM\TYPES\getScopeFromTypeId;
/* /*
$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 - 2017 Roland Gruber Copyright (C) 2003 - 2018 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
@ -168,7 +168,9 @@ abstract class baseModule {
} }
} }
// load attributes // load attributes
$attributeNames = $this->getManagedAttributes($typeId); $attributeNames = array_merge($this->getManagedAttributes($typeId), $this->getManagedHiddenAttributes($typeId));
$attributeNames = array_unique($attributeNames);
$attributeNames = array_values($attributeNames);
for ($i = 0; $i < sizeof($attributeNames); $i++) { for ($i = 0; $i < sizeof($attributeNames); $i++) {
if (isset($attributes[$attributeNames[$i]])) { if (isset($attributes[$attributeNames[$i]])) {
$this->attributes[$attributeNames[$i]] = $attributes[$attributeNames[$i]]; $this->attributes[$attributeNames[$i]] = $attributes[$attributeNames[$i]];
@ -424,11 +426,12 @@ abstract class baseModule {
* <br> * <br>
* <b>Example:</b> return array('or' => '(objectClass=posixAccount)', 'and' => '(!(uid=*$))') * <b>Example:</b> return array('or' => '(objectClass=posixAccount)', 'and' => '(!(uid=*$))')
* *
* @param string $typeId account type id
* @return string LDAP filter * @return string LDAP filter
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function get_ldap_filter() { public function get_ldap_filter($typeId) {
if (isset($this->meta['ldap_filter'])) return $this->meta['ldap_filter']; if (isset($this->meta['ldap_filter'])) return $this->meta['ldap_filter'];
else return ""; else return "";
} }
@ -638,7 +641,7 @@ abstract class baseModule {
* We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts. * We recommend to use the module name as prefix for them (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
* *
* @param array $scopes account types (user, group, host) * @param array $scopes account types (user, group, host)
* @param array $allScopes list of all active account modules and their scopes (module => array(scopes)) * @param array $allScopes list of all active account modules and their account type id (module => array(type id))
* @return mixed htmlElement or array of htmlElement * @return mixed htmlElement or array of htmlElement
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
@ -681,15 +684,20 @@ abstract class baseModule {
* If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text'). * If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text').
* <br>If no errors occured the function returns an empty array. * <br>If no errors occured the function returns an empty array.
* *
* @param array $scopes list of account types which are used * @param array $typeIds list of account type ids which are used
* @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements. * @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements.
* @return array list of error messages * @return array list of error messages
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function check_configOptions($scopes, &$options) { public function check_configOptions($typeIds, &$options) {
$messages = array(); $messages = array();
$scopes[] = 'all'; // add checks that are independent of scope // add checks that are independent of scope
$scopes = array('all');
foreach ($typeIds as $typeId) {
$scopes[] = getScopeFromTypeId($typeId);
}
$scopes = array_unique($scopes);
for ($s = 0; $s < sizeof($scopes); $s++) { for ($s = 0; $s < sizeof($scopes); $s++) {
if (isset($this->meta['config_checks'][$scopes[$s]]) && is_array($this->meta['config_checks'][$scopes[$s]])) { if (isset($this->meta['config_checks'][$scopes[$s]]) && is_array($this->meta['config_checks'][$scopes[$s]])) {
$identifiers = array_keys($this->meta['config_checks'][$scopes[$s]]); $identifiers = array_keys($this->meta['config_checks'][$scopes[$s]]);
@ -1586,11 +1594,12 @@ abstract class baseModule {
/** /**
* Returns a list of operational LDAP attributes which are managed by this module and need to be explicitly set for LDAP search. * Returns a list of operational LDAP attributes which are managed by this module and need to be explicitly set for LDAP search.
* *
* @param string $typeId account type id
* @return array list of hidden attributes * @return array list of hidden attributes
* *
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
public function getManagedHiddenAttributes() { public function getManagedHiddenAttributes($typeId) {
if (isset($this->meta['hiddenAttributes']) && is_array($this->meta['hiddenAttributes'])) return $this->meta['hiddenAttributes']; if (isset($this->meta['hiddenAttributes']) && is_array($this->meta['hiddenAttributes'])) return $this->meta['hiddenAttributes'];
else return array(); else return array();
} }

View File

@ -435,6 +435,9 @@ class LAMConfig {
/** use paged results */ /** use paged results */
private $pagedResults = 'false'; private $pagedResults = 'false';
/** overlay for referential integrity is activated */
private $referentialIntegrityOverlay = 'false';
/** Array of string: users with admin rights */ /** Array of string: users with admin rights */
private $Admins; private $Admins;
@ -589,7 +592,7 @@ class LAMConfig {
'pwdResetAllowScreenPassword', 'pwdResetForcePasswordChange', 'pwdResetDefaultPasswordOutput', 'pwdResetAllowScreenPassword', 'pwdResetForcePasswordChange', 'pwdResetDefaultPasswordOutput',
'scriptUserName', 'scriptSSHKey', 'scriptSSHKeyPassword', 'twoFactorAuthentication', 'twoFactorAuthenticationURL', 'scriptUserName', 'scriptSSHKey', 'scriptSSHKeyPassword', 'twoFactorAuthentication', 'twoFactorAuthenticationURL',
'twoFactorAuthenticationInsecure', 'twoFactorAuthenticationLabel', 'twoFactorAuthenticationOptional', 'twoFactorAuthenticationInsecure', 'twoFactorAuthenticationLabel', 'twoFactorAuthenticationOptional',
'twoFactorAuthenticationCaption' 'twoFactorAuthenticationCaption', 'referentialIntegrityOverlay'
); );
@ -799,6 +802,7 @@ class LAMConfig {
if (!in_array("useTLS", $saved)) array_push($file_array, "\n\n# enable TLS encryption\n" . "useTLS: " . $this->useTLS . "\n"); if (!in_array("useTLS", $saved)) array_push($file_array, "\n\n# enable TLS encryption\n" . "useTLS: " . $this->useTLS . "\n");
if (!in_array("followReferrals", $saved)) array_push($file_array, "\n\n# follow referrals\n" . "followReferrals: " . $this->followReferrals . "\n"); if (!in_array("followReferrals", $saved)) array_push($file_array, "\n\n# follow referrals\n" . "followReferrals: " . $this->followReferrals . "\n");
if (!in_array("pagedResults", $saved)) array_push($file_array, "\n\n# paged results\n" . "pagedResults: " . $this->pagedResults . "\n"); if (!in_array("pagedResults", $saved)) array_push($file_array, "\n\n# paged results\n" . "pagedResults: " . $this->pagedResults . "\n");
if (!in_array("referentialIntegrityOverlay", $saved)) array_push($file_array, "\n" . "referentialIntegrityOverlay: " . $this->referentialIntegrityOverlay . "\n");
if (!in_array("Passwd", $saved)) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "Passwd: " . $this->Passwd . "\n"); if (!in_array("Passwd", $saved)) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "Passwd: " . $this->Passwd . "\n");
if (!in_array("Admins", $saved)) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" . if (!in_array("Admins", $saved)) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" .
"# names have to be seperated by semicolons\n" . "# names have to be seperated by semicolons\n" .
@ -1034,6 +1038,33 @@ class LAMConfig {
$this->pagedResults = $pagedResults; $this->pagedResults = $pagedResults;
} }
/**
* Returns if referential integrity overlay is in place.
*
* @return String true or false
*/
public function getReferentialIntegrityOverlay() {
return $this->referentialIntegrityOverlay;
}
/**
* Sets if referential integrity overlay is in place.
*
* @param String $referentialIntegrityOverlay true or false
*/
public function setReferentialIntegrityOverlay($referentialIntegrityOverlay) {
$this->referentialIntegrityOverlay = $referentialIntegrityOverlay;
}
/**
* Returns if referential integrity overlay is in place.
*
* @return bool overlay in place
*/
public function isReferentialIntegrityOverlayActive() {
return $this->referentialIntegrityOverlay === 'true';
}
/** /**
* Returns an array of string with all admin names * Returns an array of string with all admin names
* *

View File

@ -2,7 +2,7 @@
/* /*
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) 2010 - 2017 Roland Gruber Copyright (C) 2010 - 2018 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
@ -61,6 +61,8 @@ abstract class htmlElement {
protected $cssClasses = array(); protected $cssClasses = array();
/** table cell CSS classes */ /** table cell CSS classes */
protected $tableCellCssClasses = array(); protected $tableCellCssClasses = array();
/** data attributes */
private $dataAttributes = array();
/** /**
* Prints the HTML code for this element. * Prints the HTML code for this element.
@ -155,6 +157,29 @@ abstract class htmlElement {
return $this->tableCellCssClasses; return $this->tableCellCssClasses;
} }
/**
* Adds a data attribute.
*
* @param string $key attribute name (without "data-")
* @param string $value attribute value
*/
public function addDataAttribute($key, $value) {
$this->dataAttributes[$key] = $value;
}
/**
* Returns the data attributes as rendered string.
*
* @return string data attributes
*/
protected function getDataAttributesAsString() {
$result = '';
foreach ($this->dataAttributes as $key => $value) {
$result .= ' data-' . htmlspecialchars($key) . '="' . htmlspecialchars($value) . '"';
}
return $result;
}
} }
/** /**
@ -1254,7 +1279,9 @@ class htmlSelect extends htmlElement {
echo '<div class="hidden">'; echo '<div class="hidden">';
} }
// print select box // print select box
echo '<select' . $class . $style . $name . $size . $multi . $disabled . $onchange . ' tabindex="' . $tabindex . "\">\n"; echo '<select' . $this->getDataAttributesAsString() . $class . $style
. $name . $size . $multi . $disabled . $onchange
. ' tabindex="' . $tabindex . "\">\n";
$tabindex++; $tabindex++;
if ($this->containsOptgroups) { if ($this->containsOptgroups) {
foreach ($this->elements as $label => $elements) { foreach ($this->elements as $label => $elements) {
@ -1926,22 +1953,23 @@ class htmlInputCheckbox extends htmlElement {
// build Java script to show/hide depending fields // build Java script to show/hide depending fields
$onChange = ''; $onChange = '';
$script = ''; $script = '';
$selector = $this->getShowHideSelector();
if ((sizeof($this->tableRowsToShow) > 0) || (sizeof($this->tableRowsToHide) > 0)) { if ((sizeof($this->tableRowsToShow) > 0) || (sizeof($this->tableRowsToHide) > 0)) {
// build onChange listener // build onChange listener
$onChange .= 'if (jQuery(\'#' . $this->name . ':checked\').val() !== undefined) {'; $onChange .= 'if (jQuery(\'#' . $this->name . ':checked\').val() !== undefined) {';
for ($i = 0; $i < sizeof($this->tableRowsToShow); $i++) { for ($i = 0; $i < sizeof($this->tableRowsToShow); $i++) {
$onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'tr\').removeClass(\'hidden\');'; $onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'' . $selector . '\').removeClass(\'hidden\');';
} }
for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) { for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) {
$onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'tr\').addClass(\'hidden\');'; $onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'' . $selector . '\').addClass(\'hidden\');';
} }
$onChange .= '}'; $onChange .= '}';
$onChange .= 'else {'; $onChange .= 'else {';
for ($i = 0; $i < sizeof($this->tableRowsToShow); $i++) { for ($i = 0; $i < sizeof($this->tableRowsToShow); $i++) {
$onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'tr\').addClass(\'hidden\');'; $onChange .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'' . $selector . '\').addClass(\'hidden\');';
} }
for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) { for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) {
$onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'tr\').removeClass(\'hidden\');'; $onChange .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'' . $selector . '\').removeClass(\'hidden\');';
} }
$onChange .= '};'; $onChange .= '};';
// build script to set initial state // build script to set initial state
@ -1951,14 +1979,14 @@ class htmlInputCheckbox extends htmlElement {
if ($this->checked) { if ($this->checked) {
$classType = 'removeClass'; $classType = 'removeClass';
} }
$script .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'tr\').' . $classType . '(\'hidden\');'; $script .= 'jQuery(\'#' . $this->tableRowsToShow[$i] . '\').closest(\'' . $selector . '\').' . $classType . '(\'hidden\');';
} }
for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) { for ($i = 0; $i < sizeof($this->tableRowsToHide); $i++) {
$classType = 'removeClass'; $classType = 'removeClass';
if ($this->checked) { if ($this->checked) {
$classType = 'addClass'; $classType = 'addClass';
} }
$script .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'tr\').' . $classType . '(\'hidden\');'; $script .= 'jQuery(\'#' . $this->tableRowsToHide[$i] . '\').closest(\'' . $selector . '\').' . $classType . '(\'hidden\');';
} }
$script .= '});</script>'; $script .= '});</script>';
} }
@ -2078,6 +2106,13 @@ class htmlInputCheckbox extends htmlElement {
$this->elementsToEnable = $elements; $this->elementsToEnable = $elements;
} }
/**
* Returns the CSS selector to use to find show/hide elements.
*/
protected function getShowHideSelector() {
return '.tr';
}
} }
/** /**
@ -2273,7 +2308,7 @@ class htmlInputTextarea extends htmlElement {
/** enabled or disabled */ /** enabled or disabled */
private $isEnabled = true; private $isEnabled = true;
/** specifies if LAM should display this field whith a WYSIWYG editor */ /** specifies if LAM should display this field whith a WYSIWYG editor */
private $richEdit = false; protected $richEdit = false;
/** /**
* Constructor. * Constructor.
@ -3574,6 +3609,8 @@ class htmlResponsiveRow extends htmlElement {
/** @var htmlResponsiveCell[] cells */ /** @var htmlResponsiveCell[] cells */
private $cells = array(); private $cells = array();
/** HTML ID */
private $id = null;
/** /**
* Creates a new responsive row. * Creates a new responsive row.
@ -3591,6 +3628,15 @@ class htmlResponsiveRow extends htmlElement {
} }
} }
/**
* Sets the HTML id.
*
* @param string $id ID
*/
public function setId($id) {
$this->id = $id;
}
/** /**
* Adds a responsive cell to the row. * Adds a responsive cell to the row.
* *
@ -3619,16 +3665,17 @@ class htmlResponsiveRow extends htmlElement {
* Adds the content as a typical label with 12/6/6 columns and CSS class "responsiveLabel". * Adds the content as a typical label with 12/6/6 columns and CSS class "responsiveLabel".
* *
* @param htmlElement $content label * @param htmlElement $content label
* @param string $cssClasses additional CSS classes
*/ */
public function addLabel($content) { public function addLabel($content, $cssClasses = '') {
$this->add($content, 12, 6, 6, 'responsiveLabel nowrap'); $this->add($content, 12, 6, 6, 'responsiveLabel nowrap ' . $cssClasses);
} }
/** /**
* Adds the content as a typical field with 12/6/6 columns and CSS class "responsiveField". * Adds the content as a typical field with 12/6/6 columns and CSS class "responsiveField".
* *
* @param htmlElement $content field * @param htmlElement $content field
* @param $cssClasses CSS class names separated by space * @param string $cssClasses CSS class names separated by space
*/ */
public function addField($content, $cssClasses = '') { public function addField($content, $cssClasses = '') {
$this->add($content, 12, 6, 6, 'responsiveField ' . $cssClasses); $this->add($content, 12, 6, 6, 'responsiveField ' . $cssClasses);
@ -3648,7 +3695,11 @@ class htmlResponsiveRow extends htmlElement {
public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) {
$return = array(); $return = array();
$cssClasses = implode(' ', $this->cssClasses); $cssClasses = implode(' ', $this->cssClasses);
echo '<div class="row ' . $cssClasses . '">'; $idParam = '';
if ($this->id !== null) {
$idParam = ' id="' . $this->id . '"';
}
echo '<div class="row ' . $cssClasses . '"' . $idParam . '>';
foreach ($this->cells as $cell) { foreach ($this->cells as $cell) {
$return = array_merge($return, $cell->generateHTML($module, $input, $values, $restricted, $tabindex, $scope)); $return = array_merge($return, $cell->generateHTML($module, $input, $values, $restricted, $tabindex, $scope));
} }
@ -3808,6 +3859,8 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea {
private $label; private $label;
/** help ID */ /** help ID */
private $helpID; private $helpID;
/** help module */
private $helpModule = null;
/** required field */ /** required field */
private $required = false; private $required = false;
/** render HTML of parent class */ /** render HTML of parent class */
@ -3821,12 +3874,18 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea {
* @param int $colCount number of characters per line * @param int $colCount number of characters per line
* @param int $rowCount number of rows * @param int $rowCount number of rows
* @param String $label descriptive label * @param String $label descriptive label
* @param String $helpID help ID * @param String|array $helpID help ID
*/ */
function __construct($name, $value, $colCount, $rowCount, $label, $helpID = null) { function __construct($name, $value, $colCount, $rowCount, $label, $helpID = null) {
parent::__construct($name, $value, $colCount, $rowCount); parent::__construct($name, $value, $colCount, $rowCount);
$this->label = htmlspecialchars($label); $this->label = htmlspecialchars($label);
$this->helpID = $helpID; if (is_string($helpID)) {
$this->helpID = $helpID;
}
elseif (is_array($helpID)) {
$this->helpID = $helpID[0];
$this->helpModule = $helpID[1];
}
$this->alignment = htmlElement::ALIGN_TOP; $this->alignment = htmlElement::ALIGN_TOP;
} }
@ -3850,16 +3909,20 @@ class htmlResponsiveInputTextarea extends htmlInputTextarea {
$labelGroup->addElement(new htmlImage($graphicsPath . '/required.png', 16, 16, _('required'), _('required'))); $labelGroup->addElement(new htmlImage($graphicsPath . '/required.png', 16, 16, _('required'), _('required')));
} }
if (!empty($this->helpID)) { if (!empty($this->helpID)) {
$helpLinkLabel = new htmlHelpLink($this->helpID); $helpLinkLabel = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLinkLabel->setCSSClasses(array('hide-on-tablet', 'margin-left5')); $helpCssClasses = array('margin-left5');
if (!$this->richEdit) {
$helpCssClasses[] = 'hide-on-tablet';
}
$helpLinkLabel->setCSSClasses($helpCssClasses);
$labelGroup->addElement($helpLinkLabel); $labelGroup->addElement($helpLinkLabel);
} }
$row->add($labelGroup, 12, 6, 6, 'responsiveLabel'); $row->add($labelGroup, 12, 6, 6, 'responsiveLabel');
// input field // input field
$fieldGroup = new htmlGroup(); $fieldGroup = new htmlGroup();
$fieldGroup->addElement($this); $fieldGroup->addElement($this);
if (!empty($this->helpID)) { if (!empty($this->helpID) && !$this->richEdit) {
$helpLink = new htmlHelpLink($this->helpID); $helpLink = new htmlHelpLink($this->helpID, $this->helpModule);
$helpLink->setCSSClasses(array('align-top', 'hide-on-mobile')); $helpLink->setCSSClasses(array('align-top', 'hide-on-mobile'));
$fieldGroup->addElement($helpLink); $fieldGroup->addElement($helpLink);
} }
@ -4095,6 +4158,14 @@ class htmlResponsiveInputCheckbox extends htmlInputCheckbox {
return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope); return $row->generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
} }
/**
* {@inheritDoc}
* @see htmlInputCheckbox::getShowHideSelector()
*/
protected function getShowHideSelector() {
return '.row';
}
} }
/** /**
@ -4113,15 +4184,22 @@ class htmlResponsiveTable extends htmlElement {
/** widthes of the columns */ /** widthes of the columns */
private $widths = array(); private $widths = array();
/** highlighted rows */
private $highlighted = array();
/** /**
* Creates the table. * Creates the table.
* *
* @param string[] $titles row titles * @param string[] $titles row titles
* @param htmlElement[][] $data data rows * @param htmlElement[][] $data data rows
* @param int[] $highlighted list of row numbers that should be highlighted (starting at 0)
*/ */
public function __construct($titles, $data) { public function __construct($titles, $data, $highlighted = null) {
$this->titles = $titles; $this->titles = $titles;
$this->data = $data; $this->data = $data;
if (!empty($highlighted) && is_array($highlighted)) {
$this->highlighted = $highlighted;
}
} }
/** /**
@ -4146,8 +4224,13 @@ class htmlResponsiveTable extends htmlElement {
echo '</thead>'; echo '</thead>';
echo '<tbody>'; echo '<tbody>';
$titleCount = sizeof($this->titles); $titleCount = sizeof($this->titles);
$counter = 0;
foreach ($this->data as $row) { foreach ($this->data as $row) {
echo '<tr>'; $cssClass = '';
if (in_array($counter, $this->highlighted)) {
$cssClass = ' class="bold"';
}
echo '<tr ' . $cssClass . '>';
for ($i = 0; $i < $titleCount; $i++) { for ($i = 0; $i < $titleCount; $i++) {
echo '<td data-label="' . $this->titles[$i] . '">'; echo '<td data-label="' . $this->titles[$i] . '">';
$ids = parseHtml($module, $row[$i], $values, $restricted, $tabindex, $scope); $ids = parseHtml($module, $row[$i], $values, $restricted, $tabindex, $scope);
@ -4155,6 +4238,7 @@ class htmlResponsiveTable extends htmlElement {
echo '</td>'; echo '</td>';
} }
echo '</tr>'; echo '</tr>';
$counter++;
} }
echo '</tbody>'; echo '</tbody>';
echo '</table>'; echo '</table>';

View File

@ -101,7 +101,7 @@ function get_ldap_filter($typeId) {
$orFilter = ''; $orFilter = '';
for ($i = 0; $i < sizeof($mods); $i++) { for ($i = 0; $i < sizeof($mods); $i++) {
$module = moduleCache::getModule($mods[$i], $type->getScope()); $module = moduleCache::getModule($mods[$i], $type->getScope());
$modinfo = $module->get_ldap_filter(); $modinfo = $module->get_ldap_filter($typeId);
if (isset($modinfo['or'])) { if (isset($modinfo['or'])) {
$filters['or'][] = $modinfo['or']; $filters['or'][] = $modinfo['or'];
} }
@ -360,7 +360,7 @@ function getConfigOptions($scopes) {
/** /**
* Checks if the configuration options are valid * Checks if the configuration options are valid
* *
* @param array $scopes hash array (module name => array(account types)) * @param array $scopes hash array (module name => array(account type ids))
* @param array $options hash array containing all options (name => array(...)) * @param array $options hash array containing all options (name => array(...))
* @return array list of error messages * @return array list of error messages
*/ */
@ -1581,7 +1581,7 @@ class accountContainer {
$searchAttrs = array('*', '+'); $searchAttrs = array('*', '+');
foreach ($modules as $module) { foreach ($modules as $module) {
$modTmp = new $module($this->type->getScope()); $modTmp = new $module($this->type->getScope());
$searchAttrs = array_merge($searchAttrs, $modTmp->getManagedHiddenAttributes()); $searchAttrs = array_merge($searchAttrs, $modTmp->getManagedHiddenAttributes($this->type->getId()));
} }
$result = @ldap_read($_SESSION['ldap']->server(), escapeDN($dn), escapeDN($search), $searchAttrs, 0, 0, 0, LDAP_DEREF_NEVER); $result = @ldap_read($_SESSION['ldap']->server(), escapeDN($dn), escapeDN($search), $searchAttrs, 0, 0, 0, LDAP_DEREF_NEVER);
if (!$result) { if (!$result) {

View File

@ -36,3 +36,5 @@
/zarafaUser.inc /zarafaUser.inc
/locking389ds.inc /locking389ds.inc
/kopano*.inc /kopano*.inc
/dynamicList.inc
/customBaseType.inc

View File

@ -245,9 +245,8 @@ class asteriskAccount extends baseModule implements passwordService {
), ),
); );
// self service options // self service options
$selfServiceContainer = new htmlTable(); $selfServiceContainer = new htmlResponsiveRow();
$selfServiceContainer->addElement(new htmlTableExtendedInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null)); $selfServiceContainer->add(new htmlResponsiveInputField(_('Asterisk realm'), 'asteriskAccount_AsteriskRealm', null, array('AsteriskRealm', get_class($this))), 12);
$selfServiceContainer->addElement(new htmlHelpLink('AsteriskRealm', get_class($this)));
$return['selfServiceSettings'] = $selfServiceContainer; $return['selfServiceSettings'] = $selfServiceContainer;
// profile options // profile options
$profileContainer = new htmlTable(); $profileContainer = new htmlTable();

View File

@ -497,21 +497,11 @@ class imapAccess extends baseModule {
} }
/** /**
* Checks input values of module settings. * {@inheritDoc}
* * @see baseModule::check_configOptions()
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> */
* <br> public function check_configOptions($typeIds, &$options) {
* If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text'). $errors = parent::check_configOptions($typeIds, $options);
* <br>If no errors occured the function returns an empty array.
*
* @param array $scopes list of account types which are used
* @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements.
* @return array list of error messages
*
* @see baseModule::get_metaData()
*/
public function check_configOptions($scopes, &$options) {
$errors = parent::check_configOptions($scopes, $options);
if ($options['ImapAccess_ImapAdminPasswordSelect'][0] == 'config') { if ($options['ImapAccess_ImapAdminPasswordSelect'][0] == 'config') {
if (empty($options['ImapAccess_ImapAdminPassword'][0])) { if (empty($options['ImapAccess_ImapAdminPassword'][0])) {
$errors[] = $this->messages['config'][2]; $errors[] = $this->messages['config'][2];

View File

@ -2433,18 +2433,13 @@ class inetOrgPerson extends baseModule implements passwordService {
* @return htmlElement meta HTML object * @return htmlElement meta HTML object
*/ */
public function getSelfServiceSettings($profile) { public function getSelfServiceSettings($profile) {
$container = new htmlTable(); $container = new htmlResponsiveRow();
$container->addElement(new htmlSubTitle(_('Photo')), true); $container->add(new htmlSubTitle(_('Photo')), 12);
$photoTable = new htmlTable();
$photoTable->colspan = 2;
if (extension_loaded('imagick')) { if (extension_loaded('imagick')) {
$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum width (px)'), 'inetOrgPerson_jpegPhoto_maxWidth')); $container->add(new htmlResponsiveInputField(_('Maximum width (px)'), 'inetOrgPerson_jpegPhoto_maxWidth', null, array('crop', get_class($this))), 12);
$photoTable->addElement(new htmlHelpLink('crop', get_class($this)), true); $container->add(new htmlResponsiveInputField(_('Maximum height (px)'), 'inetOrgPerson_jpegPhoto_maxHeight', null, array('crop', get_class($this))), 12);
$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum height (px)'), 'inetOrgPerson_jpegPhoto_maxHeight'));
$photoTable->addElement(new htmlHelpLink('crop', get_class($this)), true);
} }
$photoTable->addElement(new htmlTableExtendedInputField(_('Maximum file size (kB)'), 'inetOrgPerson_jpegPhoto_maxSize'), true); $container->add(new htmlResponsiveInputField(_('Maximum file size (kB)'), 'inetOrgPerson_jpegPhoto_maxSize'), 12);
$container->addElement($photoTable, true);
return $container; return $container;
} }

View File

@ -1,5 +1,6 @@
<?php <?php
use \LAM\TYPES\TypeManager; use \LAM\TYPES\TypeManager;
use function LAM\TYPES\getScopeFromTypeId;
/* /*
$Id$ $Id$
@ -178,16 +179,11 @@ class posixAccount extends baseModule implements passwordService {
// possible self service read-only fields // possible self service read-only fields
$return['selfServiceReadOnlyFields'] = array('cn', 'loginShell'); $return['selfServiceReadOnlyFields'] = array('cn', 'loginShell');
// self service configuration settings // self service configuration settings
$selfServiceContainer = new htmlTable(); $selfServiceContainer = new htmlResponsiveRow();
$selfServiceContainer->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', getSupportedHashTypes(), $selfServiceContainer->add(new htmlResponsiveSelect('posixAccount_pwdHash', getSupportedHashTypes(),
array('SSHA'), _("Password hash type"))); array('SSHA'), _("Password hash type"), array('pwdHash', get_class($this))), 12);
$selfServiceContainer->addElement(new htmlHelpLink('pwdHash', get_class($this)), true); $selfServiceContainer->add(new htmlResponsiveInputTextarea('posixAccount_shells', implode("\r\n", $this->getShells()), 30, 4, _('Login shells'), array('loginShells', get_class($this))), 12);
$selfServiceContainer->addElement(new htmlTableExtendedInputTextarea('posixAccount_shells', implode("\r\n", $this->getShells()), 30, 4, _('Login shells'))); $selfServiceContainer->add(new htmlResponsiveInputCheckbox('posixAccount_useOldPwd', false, _('Password change with old password'), array('useOldPwd', get_class($this))), 12);
$loginShellsHelp = new htmlHelpLink('loginShells', get_class($this));
$loginShellsHelp->alignment = htmlElement::ALIGN_TOP;
$selfServiceContainer->addElement($loginShellsHelp, true);
$selfServiceContainer->addElement(new htmlTableExtendedInputCheckbox('posixAccount_useOldPwd', false, _('Password change with old password')));
$selfServiceContainer->addElement(new htmlHelpLink('useOldPwd', get_class($this)), true);
$return['selfServiceSettings'] = $selfServiceContainer; $return['selfServiceSettings'] = $selfServiceContainer;
} }
// profile checks // profile checks
@ -908,6 +904,11 @@ class posixAccount extends baseModule implements passwordService {
for ($i = 0; $i < sizeof($groups); $i++) { for ($i = 0; $i < sizeof($groups); $i++) {
$return[$groups[$i]['dn']]['remove']['memberUid'][] = $this->attributes['uid'][0]; $return[$groups[$i]['dn']]['remove']['memberUid'][] = $this->attributes['uid'][0];
} }
// stop here if referential integrity overlay is active
$config = $this->getAccountContainer()->get_type()->getTypeManager()->getConfig();
if ($config->isReferentialIntegrityOverlayActive()) {
return $return;
}
// remove from group of names // remove from group of names
$dn = $this->getAccountContainer()->dn_orig; $dn = $this->getAccountContainer()->dn_orig;
$gons = searchLDAPByFilter('(|(member=' . $dn . ')(uniqueMember=' . $dn . '))', array('member', 'uniqueMember'), array('group', 'gon')); $gons = searchLDAPByFilter('(|(member=' . $dn . ')(uniqueMember=' . $dn . '))', array('member', 'uniqueMember'), array('group', 'gon'));
@ -2031,15 +2032,15 @@ class posixAccount extends baseModule implements passwordService {
} }
/** /**
* Checks input values of module settings. * {@inheritDoc}
* * @see baseModule::check_configOptions()
* @param array $scopes list of account types which are used */
* @param array $options hash array containing the settings (array('option' => array('value'))) function check_configOptions($typeIds, &$options) {
* @return array list of error messages
*/
function check_configOptions($scopes, &$options) {
$return = array(); $return = array();
// user settings $scopes = array();
foreach ($typeIds as $typeId) {
$scopes[] = getScopeFromTypeId($typeId);
} // user settings
if (in_array('user', $scopes)) { if (in_array('user', $scopes)) {
if ($options['posixAccount_uidGeneratorUsers'][0] == 'range') { if ($options['posixAccount_uidGeneratorUsers'][0] == 'range') {
// min/maxUID are required, check if they are numeric // min/maxUID are required, check if they are numeric
@ -3244,7 +3245,7 @@ class posixAccount extends baseModule implements passwordService {
$wc = substr($wildcards[0][$i], 1, strlen($wildcards[0][$i]) - 2); $wc = substr($wildcards[0][$i], 1, strlen($wildcards[0][$i]) - 2);
$value = ''; $value = '';
if (isset($attributes[$wc][0]) && !empty($attributes[$wc][0])) { if (isset($attributes[$wc][0]) && !empty($attributes[$wc][0])) {
$value = $attributes[$wc][0][0]; $value = $this->cleanSuggestionPart($attributes[$wc][0][0]);
} }
$format = str_replace('@' . $wc . '@', $value, $format); $format = str_replace('@' . $wc . '@', $value, $format);
} }
@ -3256,16 +3257,26 @@ class posixAccount extends baseModule implements passwordService {
$wc = substr($wildcards[0][$i], 1, strlen($wildcards[0][$i]) - 2); $wc = substr($wildcards[0][$i], 1, strlen($wildcards[0][$i]) - 2);
$value = ''; $value = '';
if (isset($attributes[$wc][0])) { if (isset($attributes[$wc][0])) {
$value = $attributes[$wc][0]; $value = $this->cleanSuggestionPart($attributes[$wc][0]);
} }
$format = str_replace('%' . $wc . '%', $value, $format); $format = str_replace('%' . $wc . '%', $value, $format);
} }
} }
$format = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($format));
$format = str_replace(array(' ', '_', '-'), array('', '', ''), $format);
return $format; return $format;
} }
/**
* Cleans a string that is injected in user name suggestion.
*
* @param string $part injected part
* @return string cleaned by removing umlauts, spaces, dashes and underscores
*/
private function cleanSuggestionPart($part) {
$result = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($part));
$result = str_replace(array(' ', '_', '-'), array('', '', ''), $result);
return $result;
}
/** /**
* Returns if this account can be locked. * Returns if this account can be locked.
* This is the case if a hashed password is set ("{" at the beginning). * This is the case if a hashed password is set ("{" at the beginning).

View File

@ -1,11 +1,12 @@
<?php <?php
use \LAM\TYPES\TypeManager; use \LAM\TYPES\TypeManager;
use function LAM\TYPES\getScopeFromTypeId;
use LAM\TYPES\ConfiguredType;
/* /*
$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 - 2006 Tilo Lutz Copyright (C) 2003 - 2006 Tilo Lutz
2007 - 2017 Roland Gruber 2007 - 2018 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
@ -139,7 +140,7 @@ class posixGroup extends baseModule implements passwordService {
// fill in autoGIDs // fill in autoGIDs
if (sizeof($needAutoGID) > 0) { if (sizeof($needAutoGID) > 0) {
$errorsTemp = array(); $errorsTemp = array();
$gids = $this->getNextGIDs(sizeof($needAutoGID), $errorsTemp); $gids = $this->getNextGIDs(sizeof($needAutoGID), $errorsTemp, $type);
if (is_array($gids)) { if (is_array($gids)) {
for ($i = 0; $i < sizeof($needAutoGID); $i++) { for ($i = 0; $i < sizeof($needAutoGID); $i++) {
$partialAccounts[$i]['gidNumber'] = $gids[$i]; $partialAccounts[$i]['gidNumber'] = $gids[$i];
@ -586,8 +587,18 @@ class posixGroup extends baseModule implements passwordService {
$configContainer->add($magicNumber, 12); $configContainer->add($magicNumber, 12);
$configContainer->add(new htmlResponsiveInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), 12); $configContainer->add(new htmlResponsiveInputField(_('Suffix for GID/group name check'), 'posixGroup_gidCheckSuffix', '', 'gidCheckSuffix'), 12);
$configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), 12); $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_hidememberUid', false, _('Disable membership management'), 'hidememberUid'), 12);
if ((!empty($allScopes['groupOfNames']) && in_array('group', $allScopes['groupOfNames'])) $gonModules = array('groupOfNames', 'groupOfUniqueNames');
|| (!empty($allScopes['groupOfUniqueNames']) && in_array('group', $allScopes['groupOfUniqueNames']))) { $gonFound = false;
foreach ($gonModules as $gonModule) {
if (!empty($allScopes[$gonModule])) {
foreach ($allScopes[$gonModule] as $gonTypeId) {
if (getScopeFromTypeId($gonTypeId) === 'group') {
$gonFound = true;
}
}
}
}
if ($gonFound) {
$configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_autoSyncGon', false, _('Force sync with group of names'), 'autoSyncGon'), 12); $configContainer->add(new htmlResponsiveInputCheckbox('posixGroup_autoSyncGon', false, _('Force sync with group of names'), 'autoSyncGon'), 12);
} }
// display password hash option only if posixAccount module is not used // display password hash option only if posixAccount module is not used
@ -705,7 +716,7 @@ class posixGroup extends baseModule implements passwordService {
if ($this->manageCnAndDescription($modules) && ($this->attributes['cn'][0] == '')) { if ($this->manageCnAndDescription($modules) && ($this->attributes['cn'][0] == '')) {
return false; return false;
} }
if ($this->attributes['gidNumber'][0] == '') { if ((!isset($this->attributes['gidNumber'][0])) || $this->attributes['gidNumber'][0] === '') {
return false; return false;
} }
return true; return true;
@ -784,7 +795,7 @@ class posixGroup extends baseModule implements passwordService {
if ($this->attributes['gidNumber'][0]=='') { if ($this->attributes['gidNumber'][0]=='') {
// No id-number given, find free GID // No id-number given, find free GID
if (!isset($this->orig['gidNumber'][0])) { if (!isset($this->orig['gidNumber'][0])) {
$newGID = $this->getNextGIDs(1, $errors); $newGID = $this->getNextGIDs(1, $errors, $this->getAccountContainer()->get_type());
if (is_array($newGID)) { if (is_array($newGID)) {
$this->attributes['gidNumber'][0] = $newGID[0]; $this->attributes['gidNumber'][0] = $newGID[0];
} }
@ -796,7 +807,7 @@ class posixGroup extends baseModule implements passwordService {
// old account -> return id-number which has been used // old account -> return id-number which has been used
} }
else { else {
$gids = $this->getGIDs(); $gids = $this->getGIDs($this->getAccountContainer()->get_type());
// Check manual ID // Check manual ID
if ($this->getAccountContainer()->isNewAccount || !isset($this->orig['gidNumber'][0]) || ($this->orig['gidNumber'][0] != $this->attributes['gidNumber'][0])) { if ($this->getAccountContainer()->isNewAccount || !isset($this->orig['gidNumber'][0]) || ($this->orig['gidNumber'][0] != $this->attributes['gidNumber'][0])) {
// check range // check range
@ -1005,20 +1016,10 @@ class posixGroup extends baseModule implements passwordService {
} }
/** /**
* Checks input values of module settings. * {@inheritDoc}
* * @see baseModule::check_configOptions()
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br> */
* <br> public function check_configOptions($typeIds, &$options) {
* If the input data is invalid the return value is an array that contains subarrays to build StatusMessages ('message type', 'message head', 'message text').
* <br>If no errors occured the function returns an empty array.
*
* @param array $scopes list of account types which are used
* @param array $options hash array (option name => value) that contains the input. The option values are all arrays containing one or more elements.
* @return array list of error messages
*
* @see baseModule::get_metaData()
*/
public function check_configOptions($scopes, &$options) {
if ($options['posixGroup_gidGenerator'][0] == 'range') { if ($options['posixGroup_gidGenerator'][0] == 'range') {
$this->meta['config_checks']['group']['posixGroup_minGID'] = array ( $this->meta['config_checks']['group']['posixGroup_minGID'] = array (
'type' => 'ext_preg', 'type' => 'ext_preg',
@ -1054,7 +1055,7 @@ class posixGroup extends baseModule implements passwordService {
'required_message' => $this->messages['windowsIDPoolDN'][0], 'required_message' => $this->messages['windowsIDPoolDN'][0],
'error_message' => $this->messages['windowsIDPoolDN'][0]); 'error_message' => $this->messages['windowsIDPoolDN'][0]);
} }
return parent::check_configOptions($scopes, $options); return parent::check_configOptions($typeIds, $options);
} }
/** /**
@ -1062,9 +1063,10 @@ class posixGroup extends baseModule implements passwordService {
* *
* @param integer $count Number of needed free GIDs. * @param integer $count Number of needed free GIDs.
* @param array $errors list of error messages where errors can be added * @param array $errors list of error messages where errors can be added
* @param ConfiguredType $type account type
* @return mixed Null if no GIDs are free else an array of free GIDs. * @return mixed Null if no GIDs are free else an array of free GIDs.
*/ */
function getNextGIDs($count, &$errors) { function getNextGIDs($count, &$errors, $type) {
// check if UIDs should be taken from Samba pool entry // check if UIDs should be taken from Samba pool entry
if (isset($this->moduleSettings['posixGroup_gidGenerator']) && ($this->moduleSettings['posixGroup_gidGenerator'][0] == 'sambaPool')) { if (isset($this->moduleSettings['posixGroup_gidGenerator']) && ($this->moduleSettings['posixGroup_gidGenerator'][0] == 'sambaPool')) {
return $this->getNextSambaPoolGIDs($count, $errors); return $this->getNextSambaPoolGIDs($count, $errors);
@ -1084,7 +1086,7 @@ class posixGroup extends baseModule implements passwordService {
$ret = array(); $ret = array();
$minID = intval($this->moduleSettings['posixGroup_minGID'][0]); $minID = intval($this->moduleSettings['posixGroup_minGID'][0]);
$maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]); $maxID = intval($this->moduleSettings['posixGroup_maxGID'][0]);
$gidList = $this->getGIDs(); $gidList = $this->getGIDs($type);
$gids = array(); $gids = array();
foreach ($gidList as $gid) { foreach ($gidList as $gid) {
if (($gid <= $maxID) && ($gid >= $minID)) $gids[] = $gid; // ignore GIDs > maxID and GIDs < minID if (($gid <= $maxID) && ($gid >= $minID)) $gids[] = $gid; // ignore GIDs > maxID and GIDs < minID
@ -1224,16 +1226,17 @@ class posixGroup extends baseModule implements passwordService {
/** /**
* Returns a list of existing GID numbers. * Returns a list of existing GID numbers.
* *
* @param ConfiguredType $type account type
* @return array list of GID numbers * @return array list of GID numbers
*/ */
private function getGIDs() { private function getGIDs($type) {
if ($this->cachedGIDList != null) { if ($this->cachedGIDList != null) {
return $this->cachedGIDList; return $this->cachedGIDList;
} }
$this->cachedGIDList = array(); $this->cachedGIDList = array();
$attrs = array('gidNumber'); $attrs = array('gidNumber');
$filter = '(&(objectClass=posixGroup)(gidNumber=*))'; $filter = '(&(objectClass=posixGroup)(gidNumber=*))';
$suffix = $this->getAccountContainer()->get_type()->getSuffix(); $suffix = $type->getSuffix();
if (isset($this->moduleSettings['posixGroup_gidCheckSuffix'][0]) && ($this->moduleSettings['posixGroup_gidCheckSuffix'][0] != '')) { if (isset($this->moduleSettings['posixGroup_gidCheckSuffix'][0]) && ($this->moduleSettings['posixGroup_gidCheckSuffix'][0] != '')) {
$suffix = $this->moduleSettings['posixGroup_gidCheckSuffix'][0]; $suffix = $this->moduleSettings['posixGroup_gidCheckSuffix'][0];
} }

View File

@ -254,9 +254,8 @@ class pykotaUser extends baseModule {
); );
// self service settings // self service settings
if (get_class($this) == 'pykotaUser') { if (get_class($this) == 'pykotaUser') {
$selfServiceContainer = new htmlTable(); $selfServiceContainer = new htmlResponsiveRow();
$selfServiceContainer->addElement(new htmlTableExtendedInputField(_('Job suffix'), 'pykotaUser_jobSuffix', null)); $selfServiceContainer->add(new htmlResponsiveInputField(_('Job suffix'), 'pykotaUser_jobSuffix', null, array('jobSuffix', get_class($this))), 12);
$selfServiceContainer->addElement(new htmlHelpLink('jobSuffix', get_class($this)), true);
$return['selfServiceSettings'] = $selfServiceContainer; $return['selfServiceSettings'] = $selfServiceContainer;
} }
// configuration checks // configuration checks

View File

@ -103,6 +103,8 @@ class quota extends baseModule {
'quotas' => _('Quota') 'quotas' => _('Quota')
); );
// help entries // help entries
$numbersHelp = _('Symbols K, M, G, and T can be appended to numeric value to express kibibytes, mebibytes, gibibytes, and tebibytes for blocks.')
. _(' Symbols k, m, g, and t can be appended to numeric value to express multiples of 10^3, 10^6, 10^9, and 10^12 inodes.');
$return['help'] = array( $return['help'] = array(
"Mountpoint" => array( "Mountpoint" => array(
"Headline" => _("Mountpoint"), "Headline" => _("Mountpoint"),
@ -114,13 +116,13 @@ class quota extends baseModule {
), ),
"SoftBlockLimit" => array( "SoftBlockLimit" => array(
"Headline" => _("Soft block limit"), "Headline" => _("Soft block limit"),
"Text" => _("Soft block limit."), "SeeAlso" => array( "Text" => _("Soft block limit.") . '<br>' . $numbersHelp, "SeeAlso" => array(
'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4', 'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4',
'text' => 'Quota How-To') 'text' => 'Quota How-To')
), ),
"HardBlockLimit" => array( "HardBlockLimit" => array(
"Headline" => _("Hard block limit"), "Headline" => _("Hard block limit"),
"Text" => _("Hard block limit"), "SeeAlso" => array( "Text" => _("Hard block limit") . '<br>' . $numbersHelp, "SeeAlso" => array(
'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5', 'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5',
'text' => 'Quota How-To') 'text' => 'Quota How-To')
), ),
@ -136,13 +138,13 @@ class quota extends baseModule {
), ),
"SoftInodeLimit" => array( "SoftInodeLimit" => array(
"Headline" => _("Soft inode limit"), "Headline" => _("Soft inode limit"),
"Text" => _("Soft inode (files) limit."), "SeeAlso" => array( "Text" => _("Soft inode (files) limit.") . '<br>' . $numbersHelp, "SeeAlso" => array(
'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4', 'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.4',
'text' => 'Quota How-To') 'text' => 'Quota How-To')
), ),
"HardInodeLimit" => array( "HardInodeLimit" => array(
"Headline" => _("Hard inode limit"), "Headline" => _("Hard inode limit"),
"Text" => _("Hard inode (files) limit"), "SeeAlso" => array( "Text" => _("Hard inode (files) limit") . '<br>' . $numbersHelp, "SeeAlso" => array(
'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5', 'link' => 'http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Quota.html#ss4.5',
'text' => 'Quota How-To') 'text' => 'Quota How-To')
), ),
@ -304,13 +306,13 @@ class quota extends baseModule {
return $quotaInput; return $quotaInput;
} }
if (substr($quotaInput, -1, 1) === 'K') { if (substr($quotaInput, -1, 1) === 'K') {
return 1024 * substr($quotaInput, 0, -1); return substr($quotaInput, 0, -1);
} }
if (substr($quotaInput, -1, 1) === 'M') { if (substr($quotaInput, -1, 1) === 'M') {
return 1024 * 1024 * substr($quotaInput, 0, -1); return 1024 * substr($quotaInput, 0, -1);
} }
if (substr($quotaInput, -1, 1) === 'G') { if (substr($quotaInput, -1, 1) === 'G') {
return 1024 * 1024 * 1024 * substr($quotaInput, 0, -1); return 1024 * 1024 * substr($quotaInput, 0, -1);
} }
if (substr($quotaInput, -1, 1) === 'T') { if (substr($quotaInput, -1, 1) === 'T') {
return 1024 * 1024 * 1024 * 1024 * substr($quotaInput, 0, -1); return 1024 * 1024 * 1024 * 1024 * substr($quotaInput, 0, -1);

View File

@ -2251,36 +2251,23 @@ class sambaSamAccount extends baseModule implements passwordService {
} }
/** /**
* Returns a list of self service configuration settings. * {@inheritDoc}
* * @see baseModule::getSelfServiceSettings()
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br>
* <br>
* The name attributes are used as keywords to load
* and save settings. We recommend to use the module name as prefix for them
* (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
*
* @param selfServiceProfile $profile currently edited profile
* @return htmlElement meta HTML object
*
* @see baseModule::get_metaData()
* @see htmlElement
*/ */
public function getSelfServiceSettings($profile) { public function getSelfServiceSettings($profile) {
$selfServiceContainer = new htmlTable(); $selfServiceContainer = new htmlResponsiveRow();
// domain suffix // domain suffix
$selfServiceDomainSuffix = new htmlTableExtendedInputField(_('Domain suffix'), 'sambaSamAccount_domainSuffix'); $selfServiceDomainSuffix = new htmlResponsiveInputField(_('Domain suffix'), 'sambaSamAccount_domainSuffix', null, array('domainSuffix', get_class($this)));
$selfServiceContainer->addElement($selfServiceDomainSuffix); $selfServiceContainer->add($selfServiceDomainSuffix, 12);
$selfServiceContainer->addElement(new htmlHelpLink('domainSuffix', get_class($this)), true);
// password history // password history
$historyOptions = array( $historyOptions = array(
_('yes - ordered ascending') => 'yes_deleteLast', _('yes - ordered ascending') => 'yes_deleteLast',
_('yes - ordered descending') => 'yes_deleteFirst', _('yes - ordered descending') => 'yes_deleteFirst',
_('no') => 'no' _('no') => 'no'
); );
$historySelect = new htmlTableExtendedSelect('sambaSamAccount_history', $historyOptions, array('yes_deleteLast'), _("Password history")); $historySelect = new htmlResponsiveSelect('sambaSamAccount_history', $historyOptions, array('yes_deleteLast'), _("Password history"), array('history', get_class($this)));
$historySelect->setHasDescriptiveElements(true); $historySelect->setHasDescriptiveElements(true);
$selfServiceContainer->addElement($historySelect); $selfServiceContainer->add($historySelect, 12);
$selfServiceContainer->addElement(new htmlHelpLink('history', get_class($this)), true);
return $selfServiceContainer; return $selfServiceContainer;
} }

View File

@ -209,6 +209,7 @@ function printTable(&$pdf, $table, $fontName) {
if (!empty($headline)) { if (!empty($headline)) {
$pdf->SetFont($fontName, 'B', LAMPDF_FONT_SIZE); $pdf->SetFont($fontName, 'B', LAMPDF_FONT_SIZE);
$pdf->Cell(LAMPDF_LABELWIDTH, LAMPDF_LINEHEIGHT, $headline . ':', 0 , 0, 'L', 0); $pdf->Cell(LAMPDF_LABELWIDTH, LAMPDF_LINEHEIGHT, $headline . ':', 0 , 0, 'L', 0);
$pdf->SetFont($fontName, '', LAMPDF_FONT_SIZE);
$pdf->Ln(LAMPDF_LINEHEIGHT); $pdf->Ln(LAMPDF_LINEHEIGHT);
} }
foreach ($table->rows as $row) { foreach ($table->rows as $row) {

View File

@ -1,9 +1,10 @@
<?php <?php
namespace LAM\SCHEMA;
/* /*
$Id$ $Id$
Copyright (C) 2004 David Smith Copyright (C) 2004 David Smith
modified to fit for LDAP Account Manager 2005 - 2016 Roland Gruber modified to fit for LDAP Account Manager 2005 - 2018 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
@ -2028,18 +2029,10 @@ function set_cached_schema($schema_type, $schema_items )
if( ! SCHEMA_SESSION_CACHE_ENABLED ) if( ! SCHEMA_SESSION_CACHE_ENABLED )
return false; return false;
//echo "Setting cached schema for \"$schema_type\"...<br />\n";
// Sanity check. The schema must be in the form of an array // Sanity check. The schema must be in the form of an array
if( ! is_array( $schema_items ) ) { if( ! is_array( $schema_items ) ) {
die( "While attempting to cache schema, passed a non-array for \$schema_items!" ); die( "While attempting to cache schema, passed a non-array for \$schema_items!" );
} }
// Make sure we are being passed a valid array of schema_items
foreach( $schema_items as $schema_item ) {
if( ! is_subclass_of( $schema_item, 'SchemaItem' ) &&
! 0 == strcasecmp( 'SchemaItem', get_class( $schema_item ) ) ) {
die( "While attempting to cache schema, one of the schema items passed is not a true SchemaItem instance!" );
}
}
$schema_type = strtolower( $schema_type ); $schema_type = strtolower( $schema_type );
$_SESSION[ 'schema' ][ $schema_type ] = $schema_items; $_SESSION[ 'schema' ][ $schema_type ] = $schema_items;

View File

@ -556,10 +556,14 @@ function validateSecurityToken($post = true) {
* Adds a hidden input field to the given meta HTML table. * Adds a hidden input field to the given meta HTML table.
* Should be used to add token at the end of table. * Should be used to add token at the end of table.
* *
* @param htmlTable|htmlGroup $container table * @param htmlTable|htmlGroup|htmlResponsiveRow $container table
*/ */
function addSecurityTokenToMetaHTML(&$container) { function addSecurityTokenToMetaHTML(&$container) {
$token = new htmlHiddenInput(getSecurityTokenName(), $_SESSION[getSecurityTokenName()]); $token = new htmlHiddenInput(getSecurityTokenName(), $_SESSION[getSecurityTokenName()]);
if ($container instanceof htmlResponsiveRow) {
$container->add($token, 12);
return;
}
$container->addElement($token, true); $container->addElement($token, true);
} }

View File

@ -10,3 +10,4 @@
/zarafaAddressListType.inc /zarafaAddressListType.inc
/zarafaDynamicGroupType.inc /zarafaDynamicGroupType.inc
/kopano*.inc /kopano*.inc
/customType.inc

View File

@ -113,6 +113,7 @@ class group extends baseType {
"memberuid" => _("Group members"), "memberuid" => _("Group members"),
"roleOccupant" => _("Role member DNs"), "roleOccupant" => _("Role member DNs"),
"uniqueMember" => _("Group member DNs"), "uniqueMember" => _("Group member DNs"),
"memberUrl" => _("Entries"),
); );
if ($this->getType() != null) { if ($this->getType() != null) {
$modules = $this->getType()->getModules(); $modules = $this->getType()->getModules();

View File

@ -2,4 +2,4 @@
rm -rf docs/phpdoc rm -rf docs/phpdoc
mkdir docs/phpdoc mkdir docs/phpdoc
phpdoc -d ./ -t docs/phpdoc --title "LDAP Account Manager" --template clean --defaultpackagename main -e php,inc --ignore lib/en*,lib/env.inc phpdoc -d ./ -t docs/phpdoc --title "LDAP Account Manager" --template clean --defaultpackagename main -e php,inc --ignore lib/en*,lib/env.inc,lib/3rdParty*,templates/3rdParty*

View File

@ -2,7 +2,7 @@
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 Leonhard Walchshaeusl Copyright (C) 2003 Leonhard Walchshaeusl
Copyright (C) 2005 - 2017 Roland Gruber Copyright (C) 2005 - 2018 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
@ -154,6 +154,10 @@ textarea {
margin-top: 0px; margin-top: 0px;
} }
.padding0 {
padding: 0em !important;
}
.padding05 { .padding05 {
padding: 0.5em; padding: 0.5em;
} }
@ -354,6 +358,7 @@ table.collapse {
.smallPaddingContent { .smallPaddingContent {
padding: 0.5em; padding: 0.5em;
padding-bottom: 1rem;
} }
/** titles */ /** titles */
@ -398,6 +403,12 @@ div.jobList {
max-height: 50rem; max-height: 50rem;
} }
div.smallScroll {
overflow: scroll;
max-height: 10rem;
overflow-x: hidden;
}
.fullwidth { .fullwidth {
width: 100%; width: 100%;
} }
@ -610,96 +621,10 @@ div.confModList {
overflow-y: auto; overflow-y: auto;
} }
/* schema browser */ .font-big {
font-size: 130%;
table.schema_oclasses {
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
border-top: 0;
margin-bottom: 10px;
background-color: #eee;
} }
table.schema_oclasses td {
vertical-align: top;
text-align: left;
padding-left: 5px;
}
table.schema_attr {
border: 1px solid black;
}
table.schema_attr th {
background-color: #F3F3F3;
padding: 5px;
color: black;
font-weight: bold;
font-size: 125%;
}
table.schema_attr td {
padding: 5px;
vertical-align: top;
}
table.schema_attr tr.even {
background-color: #eee;
}
table.schema_attr tr.odd {
background-color: #ccc;
}
table.schema_attr tr.highlight{
background-color: #bcd;
font-weight: Bold;
}
ul.schema {
margin: 5px;
margin-left: 0px;
padding-left: 20px;
}
ul.schema li {
margin-left: 0px;
padding-left: 0px;
}
ul.schema li small {
font-size: 75%;
color: #777;
}
ul.schema li small a {
color: #77c;
}
h4.schema_oclass {
background: #F3F3F3;
padding: 5px;
margin: 0px;
margin-top: 8px;
font-weight: normal;
border: 1px solid black;
font-size: 140%;
color: black;
}
h4.schema_oclass_sub {
background: #dde;
border: 1px solid black;
border-top: 0px;
font-weight: normal;
margin: 0px;
padding: 2px;
padding-left: 5px;
font-size: 80%;
}
/** colors for account types */ /** colors for account types */
.alias-border { border-color:#af8800; } .alias-border { border-color:#af8800; }
@ -798,3 +723,7 @@ h4.schema_oclass_sub {
.nsviewType-bright { background:#fff3c8 !important; } .nsviewType-bright { background:#fff3c8 !important; }
.nsviewType-dark { background-color:#ffe27f !important; } .nsviewType-dark { background-color:#ffe27f !important; }
.customType-border { border-color:#b87500; }
.customType-bright { background:#ffe3b1 !important; }
.customType-dark { background-color:#e1b974 !important; }

View File

@ -1,7 +1,7 @@
/* /*
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) 2017 Roland Gruber Copyright (C) 2017 - 2018 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
@ -49,6 +49,10 @@
width: auto; width: auto;
} }
img.max16 {
max-width: 16px;
}
div.dialog-page { div.dialog-page {
float: left; float: left;
} }
@ -79,6 +83,8 @@ table.responsive-table th {
table.responsive-table td { table.responsive-table td {
overflow: hidden; overflow: hidden;
vertical-align: top; vertical-align: top;
padding-bottom: 0.5rem;
padding-top: 0.5rem;
} }
/* mobile */ /* mobile */
@ -132,6 +138,10 @@ table.responsive-table td {
margin-right: 5px; margin-right: 5px;
} }
.bold-mobile-only {
font-weight: bold;
}
} }
/* tablet */ /* tablet */

View File

@ -227,6 +227,9 @@ $advancedOptionsContent->add(new htmlResponsiveInputCheckbox('followReferrals',
// paged results // paged results
$pagedResults = ($conf->getPagedResults() === 'true'); $pagedResults = ($conf->getPagedResults() === 'true');
$advancedOptionsContent->add(new htmlResponsiveInputCheckbox('pagedResults', $pagedResults , _('Paged results'), '266'), 12); $advancedOptionsContent->add(new htmlResponsiveInputCheckbox('pagedResults', $pagedResults , _('Paged results'), '266'), 12);
// referential integrity overlay
$referentialIntegrity = ($conf->isReferentialIntegrityOverlayActive());
$advancedOptionsContent->add(new htmlResponsiveInputCheckbox('referentialIntegrityOverlay', $referentialIntegrity , _('Referential integrity overlay'), '269'), 12);
// build advanced options box // build advanced options box
$advancedOptions = new htmlAccordion('advancedOptions_server', array(_('Advanced options') => $advancedOptionsContent), false); $advancedOptions = new htmlAccordion('advancedOptions_server', array(_('Advanced options') => $advancedOptionsContent), false);
@ -545,6 +548,12 @@ function checkInput() {
else { else {
$conf->setPagedResults('false'); $conf->setPagedResults('false');
} }
if (isset($_POST['referentialIntegrityOverlay']) && ($_POST['referentialIntegrityOverlay'] == 'on')) {
$conf->setReferentialIntegrityOverlay('true');
}
else {
$conf->setReferentialIntegrityOverlay('false');
}
/* if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) { /* if (!$conf->set_cacheTimeout($_POST['cachetimeout'])) {
$errors[] = array("ERROR", _("Cache timeout is invalid!")); $errors[] = array("ERROR", _("Cache timeout is invalid!"));
}*/ }*/

View File

@ -134,7 +134,7 @@ $scopes = array();
foreach ($types as $type) { foreach ($types as $type) {
$mods = $conf->get_AccountModules($type->getId()); $mods = $conf->get_AccountModules($type->getId());
for ($i = 0; $i < sizeof($mods); $i++) { for ($i = 0; $i < sizeof($mods); $i++) {
$scopes[$mods[$i]][] = $type->getScope(); $scopes[$mods[$i]][] = $type->getId();
} }
} }
@ -224,7 +224,7 @@ function checkInput() {
foreach ($types as $type) { foreach ($types as $type) {
$mods = $conf->get_AccountModules($type->getId()); $mods = $conf->get_AccountModules($type->getId());
for ($i = 0; $i < sizeof($mods); $i++) { for ($i = 0; $i < sizeof($mods); $i++) {
$scopes[$mods[$i]][] = $type->getScope(); $scopes[$mods[$i]][] = $type->getId();
} }
} }
// check options // check options

View File

@ -873,6 +873,20 @@ window.lam.tools.setInitialFocus = function() {
jQuery('.lam-initial-focus').focus(); jQuery('.lam-initial-focus').focus();
}; };
window.lam.tools.schema = window.lam.tools.schema || {};
/**
* Adds the onChange listener to schema selections.
*/
window.lam.tools.schema.select = function() {
var select = jQuery('#lam-schema-select');
var display = select.data('display');
select.change(function() {
var value = this.value;
document.location = 'schema.php?display=' + display + '&sel=' + value;
});
};
jQuery(document).ready(function() { jQuery(document).ready(function() {
window.lam.gui.equalHeight(); window.lam.gui.equalHeight();
window.lam.form.autoTrim(); window.lam.form.autoTrim();
@ -880,4 +894,5 @@ jQuery(document).ready(function() {
window.lam.tools.addSavedSelectListener(); window.lam.tools.addSavedSelectListener();
window.lam.tools.activateTab(); window.lam.tools.activateTab();
window.lam.tools.setInitialFocus(); window.lam.tools.setInitialFocus();
window.lam.tools.schema.select();
}); });

View File

@ -220,7 +220,7 @@ function display_LoginPage($licenseValidator, $error_message) {
<tr> <tr>
<td align="left" height="30" width="34%"> <td align="left" height="30" width="34%">
<a class="lamLogo" href="http://www.ldap-account-manager.org/" target="new_window"> <a class="lamLogo" href="http://www.ldap-account-manager.org/" target="new_window">
LDAP Account Manager LAM
<?php <?php
if (isLAMProVersion()) { if (isLAMProVersion()) {
echo 'Pro '; echo 'Pro ';

View File

@ -1,20 +1,20 @@
<?php <?php
namespace LAM\TOOLS\OU_EDIT; namespace LAM\TOOLS\OU_EDIT;
use \htmlTable;
use \htmlSpacer; use \htmlSpacer;
use \htmlOutputText; use \htmlOutputText;
use \htmlButton; use \htmlButton;
use \htmlHiddenInput; use \htmlHiddenInput;
use \htmlTitle;
use \htmlSubTitle; use \htmlSubTitle;
use \htmlStatusMessage; use \htmlStatusMessage;
use \htmlSelect; use \htmlResponsiveRow;
use \htmlHelpLink; use \htmlResponsiveSelect;
use \htmlInputField; use \htmlResponsiveInputField;
use \htmlGroup;
/* /*
$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 - 2017 Roland Gruber Copyright (C) 2003 - 2018 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
@ -122,19 +122,22 @@ if (isset($_POST['createOU']) || isset($_POST['deleteOU'])) {
echo '<div class="user-bright smallPaddingContent">'; echo '<div class="user-bright smallPaddingContent">';
echo "<form action=\"ou_edit.php\" method=\"post\">\n"; echo "<form action=\"ou_edit.php\" method=\"post\">\n";
$tabindex = 1; $tabindex = 1;
$container = new htmlTable(); $container = new htmlResponsiveRow();
$label = new htmlOutputText(_("Do you really want to delete this OU?")); $label = new htmlOutputText(_("Do you really want to delete this OU?"));
$label->colspan = 5; $label->colspan = 5;
$container->addElement($label, true); $container->add($label, 12);
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
$dnLabel = new htmlOutputText(getAbstractDN($_POST['deleteableOU'])); $dnLabel = new htmlOutputText(getAbstractDN($_POST['deleteableOU']));
$dnLabel->colspan = 5; $dnLabel->colspan = 5;
$container->addElement($dnLabel, true); $container->add($dnLabel, 12);
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
$container->addElement(new htmlButton('sure', _("Delete"))); $buttonGroup = new htmlGroup();
$container->addElement(new htmlButton('abort', _("Cancel"))); $buttonGroup->addElement(new htmlButton('sure', _("Delete")));
$container->addElement(new htmlHiddenInput('deleteOU', 'submit')); $buttonGroup->addElement(new htmlSpacer('0.5rem', null));
$container->addElement(new htmlHiddenInput('deletename', $_POST['deleteableOU'])); $buttonGroup->addElement(new htmlButton('abort', _("Cancel")));
$container->add($buttonGroup, 12);
$container->add(new htmlHiddenInput('deleteOU', 'submit'), 12);
$container->add(new htmlHiddenInput('deletename', $_POST['deleteableOU']), 12);
addSecurityTokenToMetaHTML($container); addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user'); parseHtml(null, $container, array(), false, $tabindex, 'user');
echo "</form>"; echo "</form>";
@ -158,22 +161,22 @@ display_main($message, $error);
*/ */
function display_main($message, $error) { function display_main($message, $error) {
// display main page // display main page
include 'main_header.php'; include '../lib/adminHeader.inc';
echo '<div class="user-bright smallPaddingContent">'; echo '<div class="user-bright smallPaddingContent">';
echo "<form action=\"ou_edit.php\" method=\"post\">\n"; echo "<form action=\"ou_edit.php\" method=\"post\">\n";
$tabindex = 1; $tabindex = 1;
$container = new htmlTable(); $container = new htmlResponsiveRow();
$container->addElement(new htmlSubTitle(_("OU editor")), true); $container->add(new htmlTitle(_("OU editor")), 12);
if (isset($error)) { if (isset($error)) {
$msg = new htmlStatusMessage("ERROR", "", $error); $msg = new htmlStatusMessage("ERROR", "", $error);
$msg->colspan = 5; $msg->colspan = 5;
$container->addElement($msg, true); $container->add($msg, 12);
} }
elseif (isset($message)) { elseif (isset($message)) {
$msg = new htmlStatusMessage("INFO", "", $message); $msg = new htmlStatusMessage("INFO", "", $message);
$msg->colspan = 5; $msg->colspan = 5;
$container->addElement($msg, true); $container->add($msg, 12);
} }
$typeManager = new \LAM\TYPES\TypeManager(); $typeManager = new \LAM\TYPES\TypeManager();
@ -199,35 +202,33 @@ function display_main($message, $error) {
if (!empty($options)) { if (!empty($options)) {
// new OU // new OU
$container->addElement(new htmlOutputText(_("New organisational unit"))); $container->add(new htmlSubTitle(_("New organisational unit")), 12);
$parentOUSelect = new htmlSelect('parentOU', $options, array()); $parentOUSelect = new htmlResponsiveSelect('parentOU', $options, array(), _('Parent DN'), '601');
$parentOUSelect->setContainsOptgroups(true); $parentOUSelect->setContainsOptgroups(true);
$parentOUSelect->setHasDescriptiveElements(true); $parentOUSelect->setHasDescriptiveElements(true);
$parentOUSelect->setRightToLeftTextDirection(true); $parentOUSelect->setRightToLeftTextDirection(true);
$parentOUSelect->setSortElements(false); $parentOUSelect->setSortElements(false);
$container->addElement($parentOUSelect); $container->add($parentOUSelect, 12);
$container->addElement(new htmlInputField('newOU')); $container->add(new htmlResponsiveInputField(_('Name'), 'newOU'), 12);
$container->addElement(new htmlButton('createOU', _("Ok"))); $container->addLabel(new htmlOutputText('&nbsp;', false));
$container->addElement(new htmlHelpLink('601'), true); $container->addField(new htmlButton('createOU', _("Ok")));
$container->addVerticalSpacer('2rem');
$container->addElement(new htmlSpacer(null, '10px'), true);
// delete OU // delete OU
$container->addElement(new htmlOutputText(_("Delete organisational unit"))); $container->add(new htmlSubTitle(_("Delete organisational unit")), 12);
$deleteableOUSelect = new htmlSelect('deleteableOU', $options, array()); $deleteableOUSelect = new htmlResponsiveSelect('deleteableOU', $options, array(), _('Organisational unit'), '602');
$deleteableOUSelect->setContainsOptgroups(true); $deleteableOUSelect->setContainsOptgroups(true);
$deleteableOUSelect->setHasDescriptiveElements(true); $deleteableOUSelect->setHasDescriptiveElements(true);
$deleteableOUSelect->setRightToLeftTextDirection(true); $deleteableOUSelect->setRightToLeftTextDirection(true);
$deleteableOUSelect->setSortElements(false); $deleteableOUSelect->setSortElements(false);
$container->addElement($deleteableOUSelect); $container->add($deleteableOUSelect, 12);
$container->addElement(new htmlOutputText('')); $container->addLabel(new htmlOutputText('&nbsp;', false));
$container->addElement(new htmlButton('deleteOU', _("Ok"))); $container->addField(new htmlButton('deleteOU', _("Ok")));
$container->addElement(new htmlHelpLink('602'), true);
} }
addSecurityTokenToMetaHTML($container); addSecurityTokenToMetaHTML($container);
parseHtml(null, $container, array(), false, $tabindex, 'user'); parseHtml(null, $container, array(), false, $tabindex, 'user');
echo ("</form>\n"); echo ("</form>\n");
echo '</div>'; echo '</div>';
include 'main_footer.php'; include '../lib/adminFooter.inc';
} }

View File

@ -12,7 +12,7 @@ use \htmlHiddenInput;
$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 - 2017 Roland Gruber Copyright (C) 2003 - 2018 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
@ -145,8 +145,8 @@ include '../main_header.php';
// print error messages if any // print error messages if any
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
echo "<br>\n"; echo "<br>\n";
for ($i = 0; $i < sizeof($errors); $i++) { foreach ($errors as $error) {
call_user_func_array('StatusMessage', $errors[$i]); call_user_func_array('StatusMessage', $error);
} }
} }
@ -159,13 +159,12 @@ $options = getProfileOptions($type->getId());
// load old profile or POST values if needed // load old profile or POST values if needed
$old_options = array(); $old_options = array();
if (isset($_POST['save'])) { if (isset($_POST['save'])) {
$postKeys = array_keys($_POST); foreach ($_POST as $key => $value) {
for ($i = 0; $i < sizeof($postKeys); $i++) { if (!is_array($value)) {
if (!is_array($_POST[$postKeys[$i]])) { $old_options[$key] = array($value);
$old_options[$postKeys[$i]] = array($_POST[$postKeys[$i]]);
} }
else { else {
$old_options[$postKeys[$i]] = $_POST[$postKeys[$i]]; $old_options[$key] = $value;
} }
} }
} }
@ -223,19 +222,20 @@ $container->addElement(new htmlSpacer(null, '15px'), true);
$_SESSION['profile_types'] = parseHtml(null, $container, $old_options, false, $tabindex, $type->getScope()); $_SESSION['profile_types'] = parseHtml(null, $container, $old_options, false, $tabindex, $type->getScope());
// display module options // display module options
$modules = array_keys($options); foreach ($options as $moduleName => $moduleOptions) {
for ($m = 0; $m < sizeof($modules); $m++) {
// ignore modules without options // ignore modules without options
if (sizeof($options[$modules[$m]]) < 1) continue; if (sizeof($moduleOptions) < 1) {
$module = new $modules[$m]($type->getScope()); continue;
}
$module = new $moduleName($type->getScope());
$icon = $module->getIcon(); $icon = $module->getIcon();
if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
$icon = '../../graphics/' . $icon; $icon = '../../graphics/' . $icon;
} }
$container = new htmlTable(); $container = new htmlTable();
$container->addElement(new htmlFieldset($options[$modules[$m]], getModuleAlias($modules[$m], $type->getScope()), $icon), true); $container->addElement(new htmlFieldset($moduleOptions, getModuleAlias($moduleName, $type->getScope()), $icon), true);
$container->addElement(new htmlSpacer(null, '15px'), true); $container->addElement(new htmlSpacer(null, '15px'), true);
$_SESSION['profile_types'] = array_merge($_SESSION['profile_types'], parseHtml($modules[$m], $container, $old_options, false, $tabindex, $type->getScope())); $_SESSION['profile_types'] = array_merge($_SESSION['profile_types'], parseHtml($moduleName, $container, $old_options, false, $tabindex, $type->getScope()));
} }
// profile name and submit/abort buttons // profile name and submit/abort buttons

View File

@ -1,9 +1,18 @@
<?php <?php
namespace LAM\SCHEMA;
use \htmlResponsiveRow;
use \htmlSpacer;
use \htmlLink;
use \htmlStatusMessage;
use \htmlResponsiveTable;
use \htmlOutputText;
use \htmlGroup;
use \htmlSelect;
use \htmlDiv;
use \htmlSubTitle;
/* /*
$Id$
Copyright (C) 2004 David Smith Copyright (C) 2018 Roland Gruber
modified to fit for LDAP Account Manager 2005 - 2017 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
@ -26,7 +35,6 @@ $Id$
* Displays the LDAP schema of the server * Displays the LDAP schema of the server
* *
* @package tools * @package tools
* @author David Smith
* @author Roland Gruber * @author Roland Gruber
*/ */
@ -48,396 +56,317 @@ checkIfToolIsActive('toolSchemaBrowser');
setlanguage(); setlanguage();
include '../main_header.php'; include '../../lib/adminHeader.inc';
echo "<div class=\"user-bright smallPaddingContent\">\n";
$availableViews = array('objectClass', 'attribute', 'syntax', 'rule');
$view = isset( $_GET['view'] ) ? $_GET['view'] : 'objectClasses'; $selectedView = 'objectClass';
$viewvalue = isset( $_GET['viewvalue'] ) ? $_GET['viewvalue'] : null; if (!empty($_GET['display']) && in_array($_GET['display'], $availableViews)) {
if( trim( $viewvalue ) == "" ) $selectedView = $_GET['display'];
$viewvalue = null; }
if( ! is_null( $viewvalue ) )
$viewed = false; $tabindex = 1;
?> $row = new htmlResponsiveRow();
$row->addVerticalSpacer('2rem');
<br /> $row->add(new htmlSpacer('1rem', '1px'), 0, 2);
<center><big> $row->add(new htmlLink(_('Object classes'), 'schema.php'), 12, 2, 2, 'font-big text-center');
<?php echo ( $view=='objectClasses' ? $row->add(new htmlLink(_('Attribute types'), 'schema.php?display=attribute'), 12, 2, 2, 'font-big text-center');
_('Object classes') : $row->add(new htmlLink(_('Syntaxes'), 'schema.php?display=syntax'), 12, 2, 2, 'font-big text-center');
'<a href="?view=objectClasses">' . _('Object classes').'</a>' ); ?> $row->add(new htmlLink(_('Matching rules'), 'schema.php?display=rule'), 12, 2, 2, 'font-big text-center');
| $row->add(new htmlSpacer('1rem', '1px'), 0, 2);
<?php echo ( $view=='attributes' ? $row->addVerticalSpacer('2rem');
_('Attribute types'):
'<a href="?view=attributes">' . _('Attribute types').'</a>' ); ?> if ($selectedView === 'syntax') {
| displaySyntaxList($row);
<?php echo ( $view=='syntaxes' ? }
_('Syntaxes') : elseif( $selectedView == 'attribute' ) {
'<a href="?view=syntaxes">' . _('Syntaxes').'</a>' ); ?> displayAttributeList($row);
| }
<?php echo ( $view=='matching_rules' ? elseif ($selectedView === 'rule') {
_('Matching rules') : displayRuleList($row);
'<a href="?view=matching_rules">' . _('Matching rules').'</a>' ); ?> }
</big></center> elseif( $selectedView == 'objectClass' ) {
<br /> displayObjectClassList($row);
}
<?php flush(); ?>
parseHtml(null, $row, array(), false, $tabindex, 'user');
<?php
echo '</div>';
if( $view == 'syntaxes' ) { include '../../lib/adminFooter.inc';
$highlight_oid = isset( $_GET['highlight_oid'] ) ? $_GET['highlight_oid'] : false;
echo "\n\n<table class=\"schema_attr\" width=\"100%\">\n"; /**
echo "<tr><th>" . _('Syntax OID') . "</th><th>" . _('Description') . "</th></tr>\n"; * Displays the syntax list.
flush(); *
$counter=1; * @param htmlResponsiveRow $row row
$schema_syntaxes = get_schema_syntaxes(null); */
if( ! $schema_syntaxes ) StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); function displaySyntaxList(htmlResponsiveRow &$row) {
foreach( $schema_syntaxes as $syntax ) { $schema_syntaxes = get_schema_syntaxes(null);
$counter++; if (!$schema_syntaxes) {
$oid = htmlspecialchars( $syntax->getOID() ); $row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12);
$desc = htmlspecialchars( $syntax->getDescription() ); return;
if( $highlight_oid && $highlight_oid == $oid ) }
echo "<tr class=\"highlight\">"; $data = array();
else $labels = array(_('Syntax OID'), _('Description'));
echo "<tr class=\"" . ($counter%2==0?'even':'odd'). "\">"; $pos = 0;
echo "<td><a name=\"$oid\">$oid</a></td><td>$desc</td></tr>\n\n"; $highlighted = array();
} foreach( $schema_syntaxes as $syntax ) {
echo "</table>\n"; $oid = new htmlOutputText($syntax->getOID());
$description = new htmlOutputText($syntax->getDescription());
} elseif( $view == 'attributes' ) { $data[] = array($oid, $description);
flush(); if (!empty($_GET['sel']) && ($syntax->getOID() === $_GET['sel'])) {
$schema_attrs = get_schema_attributes(null); $highlighted[] = $pos;
$schema_object_classes = get_schema_objectclasses(null); }
if( ! $schema_attrs || ! $schema_object_classes ) $pos++;
StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); }
$row->add(new htmlResponsiveTable($labels, $data, $highlighted), 12);
?> }
<small><?php echo _('Jump to an attribute type'); ?>:</small>
<form action="schema.php" method="get"><input type="hidden" name="view" value="<?php echo $view; ?>" /> /**
<select name="viewvalue" onChange="submit()"> * Displays the matching rule list.
<option value=""> - all -</option> *
* @param htmlResponsiveRow $row row
<?php foreach( $schema_attrs as $attr ) { */
echo( '<option value="' function displayRuleList(htmlResponsiveRow &$row) {
.$attr->getName() $rules = get_schema_matching_rules(null);
.'" ' if (!$rules) {
.( 0 == strcasecmp( $attr->getName(), $viewvalue ) ? ' selected ' : '' ) $row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12);
.'>' return;
. $attr->getName() }
.'</option>' . "\n" ); $row->addLabel(new htmlOutputText(_('Jump to a matching rule')));
} ?> $availableRules = array('');
</select><input type="submit" value="<?php echo _('Go'); ?>" /></form> foreach ($rules as $rule) {
$availableRules[] = $rule->getName();
<br /> }
<table class="schema_attr" width="100%"> $selectedRule = array();
if (!empty($_GET['sel']) && in_array($_GET['sel'], $availableRules)) {
<?php $selectedRule[] = $_GET['sel'];
foreach( $schema_attrs as $attr ) { }
if ( is_null( $viewvalue ) || 0 == strcasecmp( $viewvalue, $attr->getName() ) ) { $ruleSelect = new htmlSelect('lam-schema-select', $availableRules, $selectedRule);
if( ! is_null( $viewvalue ) ) $ruleSelect->addDataAttribute('display', 'rule');
$viewed = true; $row->addField($ruleSelect);
flush(); $row->addVerticalSpacer('1rem');
echo "<tr><th colspan=\"2\">" . $attr->getName() . "</th></tr>\n\n";
$counter = 0; $labels = array(_('Matching rule OID'), _('Name'), _('Used by attributes'));
$data = array();
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; foreach ($rules as $rule) {
echo "<td>"._('Description')."</td>\n"; if (!empty($selectedRule) && !in_array($rule->getName(), $selectedRule)) {
echo "<td>" . ( $attr->getDescription() === null ? '('._('No description').')' : $attr->getDescription() ). "</td>\n"; continue;
echo "</tr>\n\n"; }
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; $oid = new htmlOutputText($rule->getOID());
echo "<td><acronym title=\"Object Identier\">"._('OID')."</acronym></td>\n"; $name = $rule->getName();
echo "<td>" . $attr->getOID() . "</td>\n"; if (!empty($rule->getDescription())) {
echo "</tr>\n\n"; $name .= ' (' . $rule->getDescription() . ')';
}
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; if ($rule->getIsObsolete()) {
echo '<td>'._('Obsolete')."?</td>\n"; $name .= ' (' . _('Obsolete') . ')';
echo "<td>" . ( $attr->getIsObsolete() ? '<b>' . _('Yes') . '</b>' : _('No') ) . "</td>\n"; }
echo "</tr>\n\n"; $nameText = new htmlOutputText($name);
$attributes = new htmlGroup();
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; foreach ($rule->getUsedByAttrs() as $attr) {
echo "<td>"._('Inherits from')."</td>\n"; $attributes->addElement(new htmlDiv(null, new htmlLink($attr, 'schema.php?display=attribute&sel=' . $attr)));
echo "<td>"; }
if( $attr->getSupAttribute() === null ) $data[] = array($oid, $nameText, new htmlDiv(null, $attributes, array('smallScroll')));
echo '('._('none').')'; }
else
echo "<a href=\"?view=$view&amp;viewvalue=" . strtolower( $attr->getSupAttribute() ) . "\">" . $attr->getSupAttribute() . "</a></td>\n"; $row->add(new htmlResponsiveTable($labels, $data), 12);
echo "</tr>\n\n"; }
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; /**
echo "<td>"._('Equality')."</td>\n"; * Displays the object class list.
echo "<td>" . ( $attr->getEquality() === null ? '('._('not specified').')' : "<a href=\"?view=matching_rules&amp;viewvalue=".$attr->getEquality()."\">".$attr->getEquality()."</a>" ) . "</td>\n"; *
echo "</tr>\n\n"; * @param htmlResponsiveRow $row row
*/
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; function displayObjectClassList(htmlResponsiveRow &$row) {
echo "<td>"._('Ordering')."</td>\n"; $objectClasses = get_schema_objectclasses(null);
echo "<td>" . ( $attr->getOrdering() === null? '('._('not specified').')' : $attr->getOrdering() ) . "</td>\n"; if (!$objectClasses) {
echo "</tr>\n\n"; $row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12);
return;
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; }
echo "<td>"._('Substring Rule')."</td>\n"; $row->addLabel(new htmlOutputText(_('Jump to an object class')));
echo "<td>" . ( $attr->getSubstr() === null? '('._('not specified').')' : $attr->getSubstr() ) . "</td>\n"; $availableClasses = array(_('all') => '');
echo "</tr>\n\n"; foreach ($objectClasses as $objectClass) {
$availableClasses[$objectClass->getName()] = $objectClass->getName();
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; }
echo "<td>"._('Syntax')."</td>\n"; $selectedClass = array();
echo "<td>"; if (isset($_GET['sel']) && (empty($_GET['sel']) || array_key_exists(strtolower($_GET['sel']), $objectClasses))) {
if( null !== $attr->getType() ) { $selectedClass[0] = $_GET['sel'];
echo "<a href=\"?view=syntaxes&amp;highlight_oid="; }
echo $attr->getSyntaxOID() . "#" . $attr->getSyntaxOID(); if (empty($selectedClass) && (sizeof($objectClasses) > 0)) {
echo "\">" . $attr->getType() . " (" . $attr->getSyntaxOID() . ")</a>"; // select first class by default
} else { $selectedClassNames = array_keys($objectClasses);
echo $attr->getSyntaxOID(); $selectedClass[0] = $selectedClassNames[0];
} }
echo "</td>\n"; $classSelect = new htmlSelect('lam-schema-select', $availableClasses, $selectedClass);
echo "</tr>\n\n"; $classSelect->addDataAttribute('display', 'objectClass');
$classSelect->setHasDescriptiveElements(true);
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; $classSelect->setSortElements(false);
echo "<td>"._('Single valued')."</td>\n"; $row->addField($classSelect);
echo "<td>" . ( $attr->getIsSingleValue() ? _('Yes') : _('No') ) . "</td>\n"; $row->addVerticalSpacer('1rem');
echo "</tr>\n\n";
// fill child object classes
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; foreach ($objectClasses as $name => $objectClass) {
echo "<td>"._('Collective')."?</td>\n"; if (!empty($objectClass->getSupClasses())) {
echo "<td>" . ( $attr->getIsCollective() ? _('Yes') : _('No') ) . "</td>\n"; foreach ($objectClass->getSupClasses() as $subClass) {
echo "</tr>\n\n"; if (!isset($objectClasses[strtolower($subClass)])) {
continue;
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; }
echo "<td>"._('User modification')."</td>\n"; $objectClasses[strtolower($subClass)]->addChildObjectClass($name);
echo "<td>" . ( $attr->getIsNoUserModification() ? _('No') : _('Yes') ) . "</td>\n"; }
echo "</tr>\n\n"; }
}
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n";
echo "<td>"._('Usage')."</td>\n"; foreach ($objectClasses as $name => $objectClass) {
echo "<td>" . ( $attr->getUsage() ? $attr->getUsage() : '('._('not specified').')' ) . "</td>\n"; if (!empty($selectedClass[0]) && ($name !== strtolower($selectedClass[0]))) {
echo "</tr>\n\n"; continue;
}
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; $row->add(new htmlSubTitle($name), 12);
echo "<td>"._('Maximum length')."</td>\n"; $row->addLabel(new htmlOutputText(_('OID')), 'bold-mobile-only');
echo "<td>"; $row->addField(new htmlOutputText($objectClass->getOID()));
if ( $attr->getMaxLength() === null ) { echo '('._('not applicable').')';} if (!empty($objectClass->getDescription())) {
else { $row->addLabel(new htmlOutputText(_('Description')), 'bold-mobile-only');
echo number_format( $attr->getMaxLength() ) ." "; $row->addField(new htmlOutputText($objectClass->getDescription()));
if ( $attr->getMaxLength()>1) {echo _('characters');} }
else { echo _('character') ;} $row->addLabel(new htmlOutputText(_('Type')), 'bold-mobile-only');
} $row->addField(new htmlOutputText($objectClass->getType()));
echo "</td>\n"; if ($objectClass->getIsObsolete()) {
echo "</tr>\n\n"; $row->addLabel(new htmlOutputText(_('Obsolete')));
$row->addField(new htmlOutputText(_('yes')));
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; }
echo "<td>"._('Aliases')."</td>\n"; if (!empty($objectClass->getSupClasses())) {
echo "<td>"; $row->addLabel(new htmlOutputText(_('Inherits from')), 'bold-mobile-only');
if( count( $attr->getAliases() ) == 0 ) $subClasses = new htmlGroup();
echo '('._('none').')'; foreach ($objectClass->getSupClasses() as $subClass) {
else $subClasses->addElement(new htmlDiv(null, new htmlLink($subClass, 'schema.php?display=objectClass&sel=' . rawurlencode($subClass))));
foreach( $attr->getAliases() as $alias_attr_name ) }
echo "<a href=\"?view=attributes&amp;viewvalue=" . $alias_attr_name. "\">$alias_attr_name</a> "; $row->addField($subClasses);
echo "</td>"; }
echo "</tr>\n\n"; if (!empty($objectClass->getChildObjectClasses())) {
$row->addLabel(new htmlOutputText(_('Parent to')), 'bold-mobile-only');
echo "<tr class=\"" . (++$counter%2==0?'even':'odd') . "\">\n"; $subClasses = new htmlGroup();
echo "<td>"._('Used by object classes')."</td>\n"; foreach ($objectClass->getChildObjectClasses() as $subClass) {
echo "<td>"; $subClasses->addElement(new htmlDiv(null, new htmlLink($subClass, 'schema.php?display=objectClass&sel=' . rawurlencode($subClass))));
if( count( $attr->getUsedInObjectClasses() ) == 0 ) }
echo '('._('none').')'; $row->addField($subClasses);
else }
foreach( $attr->getUsedInObjectClasses() as $used_in_oclass) if (!empty($objectClass->getMustAttrs())) {
echo "<a href=\"?view=objectClasses&amp;viewvalue=" . $row->addLabel(new htmlOutputText(_('Required attributes')), 'bold-mobile-only');
$used_in_oclass. "\">$used_in_oclass</a> "; $attributes = new htmlGroup();
echo "</td>"; foreach ($objectClass->getMustAttrs() as $attribute) {
echo "</tr>\n\n"; $attributes->addElement(new htmlDiv(null, new htmlLink($attribute->getName(), 'schema.php?display=attribute&sel=' . rawurlencode($attribute->getName()))));
}
flush(); $row->addField($attributes);
} }
} if (!empty($objectClass->getMayAttrs())) {
echo "</table>\n"; $row->addLabel(new htmlOutputText(_('Optional attributes')), 'bold-mobile-only');
$attributes = new htmlGroup();
} elseif( $view == 'matching_rules' ) { foreach ($objectClass->getMayAttrs() as $attribute) {
$schema_matching_rules = get_schema_matching_rules(null); $attributes->addElement(new htmlDiv(null, new htmlLink($attribute->getName(), 'schema.php?display=attribute&sel=' . rawurlencode($attribute->getName()))));
echo '<small>' . _('Jump to a matching rule').'</small><br />'; }
echo '<form action="schema.php" method="get">'; $row->addField($attributes);
echo '<input type="hidden" name="view" value="matching_rules" />'; }
echo '<select name="viewvalue" onChange="submit()">'; }
echo '<option value=""> - all -</option>'; }
foreach( $schema_matching_rules as $rule ) {
echo '<option value="'.$rule->getName().'"'.($rule->getName()==$viewvalue? ' selected ': '').'>'.$rule->getName().'</option>'; /**
} * Displays the attributes list.
*
echo '</select>'; * @param htmlResponsiveRow $row row
echo '<input type="submit" value="'._('Go').'" />'; */
echo '</form>'; function displayAttributeList(htmlResponsiveRow $row) {
echo "\n\n<table class=\"schema_attr\" width=\"100%\">\n"; $attributes = get_schema_attributes(null);
echo "<tr><th>" . _('Matching rule OID') . "</th><th>" . _('Name') . "</th><th>"._('Used by attributes')."</th></tr>\n"; if (!$attributes) {
flush(); $row->add(new htmlStatusMessage("ERROR", _("Unable to retrieve schema!")), 12);
$counter=1; return;
$schema_matching_rules = get_schema_matching_rules(null); }
if( ! $schema_matching_rules ) StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); $row->addLabel(new htmlOutputText(_('Jump to an attribute type')));
foreach( $schema_matching_rules as $rule ) { $availableAttributes = array(_('all') => '');
$counter++; foreach ($attributes as $attribute) {
$oid = htmlspecialchars( $rule->getOID() ); $availableAttributes[$attribute->getName()] = $attribute->getName();
$desc = htmlspecialchars( $rule->getName() ); }
if ( $viewvalue === null || $viewvalue==($rule->getName() )) { $selectedAttribute = array();
if( ! is_null( $viewvalue ) ) if (isset($_GET['sel']) && (empty($_GET['sel']) || array_key_exists(strtolower($_GET['sel']), $attributes))) {
$viewed = true; $selectedAttribute[0] = $_GET['sel'];
if( null !== $rule->getDescription() ) }
$desc .= ' (' . $rule->getDescription() . ')'; if (empty($selectedAttribute) && (sizeof($availableAttributes) > 0)) {
if( true === $rule->getIsObsolete() ) // select first attribute by default
$desc .= ' <span style="color:red">' . _('Obsolete') . '</span>'; $attributeNames = array_keys($availableAttributes);
echo "<tr class=\"" . ($counter%2==0?'even':'odd'). "\">"; $selectedAttribute[0] = $attributeNames[1];
echo "<td>$oid</td>"; }
echo "<td>$desc</td>"; $attributeSelect = new htmlSelect('lam-schema-select', $availableAttributes, $selectedAttribute);
echo "<td>"; $attributeSelect->addDataAttribute('display', 'attribute');
if( count( $rule->getUsedByAttrs() ) == 0 ) { $attributeSelect->setHasDescriptiveElements(true);
echo "<center>(" . _('none') . ")</center><br /><br />\n"; $attributeSelect->setSortElements(false);
} else { $row->addField($attributeSelect);
echo "<table><tr><td style=\"text-align: right\"><form action=\"schema.php\" method=\"get\">"; $row->addVerticalSpacer('1rem');
echo "<input type=\"hidden\" name=\"view\" value=\"attributes\" />";
echo "<select style=\"width: 150px; color:black; background-color: #eee\" size=\"4\" name=\"viewvalue\">\n"; foreach ($attributes as $name => $attribute) {
foreach( $rule->getUsedByAttrs() as $attr ) if (!empty($selectedAttribute[0]) && ($name !== strtolower($selectedAttribute[0]))) {
echo "<option>$attr</option>\n"; continue;
echo "</select><br /><input type=\"submit\" value=\""._('Go')."\" /></form></td></tr></table>\n"; }
} $row->add(new htmlSubTitle($name), 12);
echo "</td></tr>\n"; if (!empty($attribute->getDescription())) {
} $row->addLabel(new htmlOutputText(_('Description')), 'bold-mobile-only');
} $row->addField(new htmlOutputText($attribute->getDescription()));
echo "</table>\n"; }
$row->addLabel(new htmlOutputText(_('OID')), 'bold-mobile-only');
} elseif( $view == 'objectClasses' ) { $row->addField(new htmlOutputText($attribute->getOID()));
flush(); if ($attribute->getIsObsolete()) {
$schema_oclasses = get_schema_objectclasses(null); $row->addLabel(new htmlOutputText(_('Obsolete')), 'bold-mobile-only');
if( ! $schema_oclasses ) StatusMessage("ERROR", _("Unable to retrieve schema!"), ""); $row->addField(new htmlOutputText(_('yes')));
?> }
<small><?php echo _('Jump to an object class'); ?>:</small> if (!empty($attribute->getSupAttribute())) {
<form action="schema.php" method="get"><input type="hidden" name="view" value="<?php echo $view; ?>" /> $row->addLabel(new htmlOutputText(_('Inherits from')), 'bold-mobile-only');
<select name="viewvalue" $row->addField(new htmlOutputText($attribute->getSupAttribute()));
onChange="submit()"> }
<option value=""> - all - </option> if (!empty($attribute->getEquality())) {
<?php foreach( $schema_oclasses as $name => $oclass ) { $row->addLabel(new htmlOutputText(_('Equality')), 'bold-mobile-only');
echo '<option value="' $row->addField(new htmlLink($attribute->getEquality(), 'schema.php?display=rule&sel=' . rawurldecode($attribute->getEquality())));
.$oclass->getName() }
.'"' if (!empty($attribute->getOrdering())) {
. ( 0 == strcasecmp( $oclass->getName(), $viewvalue ) ? ' selected ':'') $row->addLabel(new htmlOutputText(_('Ordering')), 'bold-mobile-only');
.'>'.$oclass->getName() $row->addField(new htmlLink($attribute->getOrdering(), 'schema.php?display=rule&sel=' . rawurldecode($attribute->getOrdering())));
.'</option>'; }
} ?> if (!empty($attribute->getSubstr())) {
</select><input type="submit" value="<?php echo _('Go'); ?>" /> $row->addLabel(new htmlOutputText(_('Substring Rule')), 'bold-mobile-only');
</form> $row->addField(new htmlLink($attribute->getSubstr(), 'schema.php?display=rule&sel=' . rawurldecode($attribute->getSubstr())));
}
<?php flush(); ?> if (!empty($attribute->getSyntaxOID())) {
$row->addLabel(new htmlOutputText(_('Syntax')), 'bold-mobile-only');
<?php foreach( $schema_oclasses as $name => $oclass ) { $row->addField(new htmlLink($attribute->getSyntaxOID(), 'schema.php?display=syntax&sel=' . rawurldecode($attribute->getSyntaxOID())));
foreach( $oclass->getSupClasses() as $parent_name ) { }
$parent_name = $parent_name; $row->addLabel(new htmlOutputText(_('Single valued')), 'bold-mobile-only');
if( isset( $schema_oclasses[ $parent_name ] ) ) { $row->addField(new htmlOutputText($attribute->getIsSingleValue() ? _('yes') : _('no')));
$schema_oclasses[ $parent_name ]->addChildObjectClass( $oclass->getName() ); $row->addLabel(new htmlOutputText(_('Collective')), 'bold-mobile-only');
} $row->addField(new htmlOutputText($attribute->getIsCollective() ? _('yes') : _('no')));
} $row->addLabel(new htmlOutputText(_('User modification')), 'bold-mobile-only');
$row->addField(new htmlOutputText($attribute->getIsNoUserModification() ? _('no') : _('yes')));
} ?> if (!empty($attribute->getUsage())) {
$row->addLabel(new htmlOutputText(_('Usage')), 'bold-mobile-only');
<br /> $row->addField(new htmlOutputText($attribute->getUsage()));
<?php foreach( $schema_oclasses as $name => $oclass ) { }
if ( $viewvalue === null || 0 == strcasecmp( $viewvalue, $oclass->getName() ) ){ if (!empty($attribute->getMaxLength())) {
if( ! is_null( $viewvalue ) ) $row->addLabel(new htmlOutputText(_('Maximum length')), 'bold-mobile-only');
$viewed = true; $row->addField(new htmlOutputText($attribute->getMaxLength()));
?> }
if (!empty($attribute->getAliases())) {
<h4 class="schema_oclass"><?php echo $oclass->getName(); ?></h4> $row->addLabel(new htmlOutputText(_('Aliases')), 'bold-mobile-only');
<h4 class="schema_oclass_sub"><?php echo _('OID'); ?>: <b><?php echo $oclass->getOID(); ?></b></h4> $aliases = new htmlGroup();
<?php if( $oclass->getDescription() ) { ?> foreach ($attribute->getAliases() as $alias) {
<h4 class="schema_oclass_sub"><?php echo _('Description'); ?>: <b><?php echo $oclass->getDescription(); ?></b></h4> $aliases->addElement(new htmlDiv(null, new htmlLink($alias, 'schema.php?display=attribute&sel=' . rawurlencode($alias))));
<?php } ?> }
<h4 class="schema_oclass_sub"><?php echo _('Type'); ?>: <b><?php echo $oclass->getType(); ?></b></h4> $row->addField($aliases);
<?php if( $oclass->getIsObsolete() === true ) { ?> }
<h4 class="schema_oclass_sub"><?php echo _('This object class is obsolete.'); ?></h4> if (!empty($attribute->getUsedInObjectClasses())) {
<?php } ?> $row->addLabel(new htmlOutputText(_('Used by object classes')), 'bold-mobile-only');
$objectClasses = new htmlGroup();
<h4 class="schema_oclass_sub"><?php echo _('Inherits from'); ?>: <b><?php foreach ($attribute->getUsedInObjectClasses() as $objectClass) {
if( count( $oclass->getSupClasses() ) == 0 ) $objectClasses->addElement(new htmlDiv(null, new htmlLink($objectClass, 'schema.php?display=objectClass&sel=' . rawurlencode($objectClass))));
echo "(" . _('none') . ")"; }
else $row->addField($objectClasses);
foreach( $oclass->getSupClasses() as $i => $object_class ) { }
echo '<a title="' . _('Jump to an object class') . ' "
href="?view='.$view.'&amp;viewvalue='.htmlspecialchars( $object_class ) ; }
echo '">' . htmlspecialchars( $object_class ) . '</a>';
if( $i < count( $oclass->getSupClasses() ) - 1 )
echo ', ';
}
?></b></h4>
<h4 class="schema_oclass_sub"><?php echo _('Parent to'); ?>: <b><?php
if( 0 == strcasecmp( $oclass->getName(), 'top' ) )
echo "(<a href=\"schema.php?view=objectClasses\">all</a>)";
elseif( count( $oclass->getChildObjectClasses() ) == 0 )
echo "(" . _('none') . ")";
else
foreach( $oclass->getChildObjectClasses() as $i => $object_class ) {
echo '<a title="' . _('Jump to an object class') . ' "
href="?view='.$view.'&amp;viewvalue='.htmlspecialchars( $object_class ) ;
echo '">' . htmlspecialchars( $object_class ) . '</a>';
if( $i < count( $oclass->getChildObjectClasses() ) - 1 )
echo ', ';
}
?></b></h4>
<table width="100%" class="schema_oclasses">
<tr>
<th width="50%"><b><?php echo _('Required attributes'); ?></b></th>
<th width="50%"><b><?php echo _('Optional attributes'); ?></b></th>
</tr>
<tr>
<td>
<?php if( count( $oclass->getMustAttrs($schema_oclasses) ) > 0 ) {
echo '<ul class="schema">';
foreach( $oclass->getMustAttrs($schema_oclasses) as $attr ) {
echo "<li><a href=\"?view=attributes&amp;viewvalue=";
echo rawurlencode( $attr->getName() ). "\">" . htmlspecialchars($attr->getName());
echo "</a>";
if( $attr->getSource() != $oclass->getName() )
{
echo "<br /><small>&nbsp;&nbsp;("._('Inherited from')." ";
echo "<a href=\"?view=objectClasses&amp;viewvalue=" . $attr->getSource() . "\">" . $attr->getSource() . "</a>";
echo ")</small>";
}
echo "</li>\n";
}
echo "</ul>";
} else
echo "<center>(" . _('none') . ")</center>\n";
?>
</td>
<td width="50%">
<?php
if( count( $oclass->getMayAttrs($schema_oclasses) ) > 0 ) {
echo '<ul class="schema">';
foreach( $oclass->getMayAttrs($schema_oclasses) as $attr ) {
echo "<li><a href=\"?view=attributes&amp;viewvalue=";
echo rawurlencode( $attr->getName() ) . "\">" . htmlspecialchars($attr->getName() );
echo "</a>\n";
if( $attr->getSource() != $oclass->getName() )
{
echo "<br /><small>&nbsp;&nbsp; ("._('Inherited from')." ";
echo "<a href=\"?view=objectClasses&amp;viewvalue=" . $attr->getSource() . "\">" . $attr->getSource() . "</a>";
echo ")</small>";
}
echo "</li>";
}
echo "</ul>";
}
else
echo "<center>(" . _('none') . ")</center>\n";
?>
</td>
</tr>
</table>
<?php } } /* End foreach objectClass */ ?>
<?php } /* End else (displaying objectClasses */ ?>
<?php
if( ! is_null( $viewvalue ) && ! $viewed ) {
StatusMessage("ERROR", sprintf( _('No such schema item: "%s"'), htmlspecialchars( $viewvalue ) ) );
} }
include '../main_footer.php';
?> ?>

View File

@ -1,9 +1,8 @@
<?php <?php
/* /*
$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 - 2017 Roland Gruber Copyright (C) 2009 - 2018 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
@ -88,130 +87,116 @@ if ($result) {
} }
// get additional information if monitoring is enabled // get additional information if monitoring is enabled
$monitorResult = searchLDAP('cn=monitor', 'objectClass=*', array('*', '+')); $monitorResults = searchLDAP('cn=monitor', 'objectClass=*', array('*', '+'));
$monitorEntries = array(); $monitorEntries = array();
for ($i = 0; $i < sizeof($monitorResult); $i++) { foreach ($monitorResults as $monitorResult) {
$monitorEntries[$monitorResult[$i]['dn']] = array_change_key_case($monitorResult[$i], CASE_LOWER); $monitorEntries[$monitorResult['dn']] = array_change_key_case($monitorResult, CASE_LOWER);
} }
$monitorEntries = array_change_key_case($monitorEntries, CASE_LOWER); $monitorEntries = array_change_key_case($monitorEntries, CASE_LOWER);
include 'main_header.php'; include '../lib/adminHeader.inc';
echo '<div class="user-bright smallPaddingContent">'; echo '<div class="user-bright smallPaddingContent">';
$tabindex = 1; $tabindex = 1;
$container = new htmlTable(); $container = new htmlResponsiveRow();
$spacer = new htmlSpacer('20px', null);
$container->addElement(new htmlTitle(_("Server information")), true); $container->add(new htmlTitle(_("Server information")), 12);
$container->addElement(new htmlOutputText('<b>' . _("Managed suffixes") . '</b>', false)); if (!empty($namingContexts)) {
$container->addElement($spacer); $container->addLabel(new htmlOutputText('<b>' . _("Managed suffixes") . '</b>', false));
$container->addElement(new htmlOutputText($namingContexts), true); $container->addField(new htmlOutputText($namingContexts));
}
$container->addElement(new htmlOutputText('<b>' . _("LDAP version") . '</b>', false)); if (!empty($supportedldapversion)) {
$container->addElement($spacer); $container->addLabel(new htmlOutputText('<b>' . _("LDAP version") . '</b>', false));
$container->addElement(new htmlOutputText($supportedldapversion), true); $container->addField(new htmlOutputText($supportedldapversion));
}
if ($configcontext != '') { if ($configcontext != '') {
$container->addElement(new htmlOutputText('<b>' . _("Config suffix") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Config suffix") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($configcontext));
$container->addElement(new htmlOutputText($configcontext), true);
} }
$container->addElement(new htmlOutputText('<b>' . _("Schema suffix") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Schema suffix") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($subschemasubentry));
$container->addElement(new htmlOutputText($subschemasubentry), true);
if ($dynamicSubtrees != '') { if ($dynamicSubtrees != '') {
$container->addElement(new htmlOutputText('<b>' . _("Dynamic subtrees") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Dynamic subtrees") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($dynamicSubtrees));
$container->addElement(new htmlOutputText($dynamicSubtrees), true);
} }
$container->addElement(new htmlOutputText('<b>' . _("SASL mechanisms") . '</b>', false)); if (!empty($supportedsaslmechanisms)) {
$container->addElement($spacer); $container->addLabel(new htmlOutputText('<b>' . _("SASL mechanisms") . '</b>', false));
$container->addElement(new htmlOutputText($supportedsaslmechanisms), true); $container->addField(new htmlOutputText($supportedsaslmechanisms));
}
if ($vendorname != '') { if ($vendorname != '') {
$container->addElement(new htmlOutputText('<b>' . _("Vendor name") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Vendor name") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($vendorname));
$container->addElement(new htmlOutputText($vendorname), true);
} }
if ($vendorversion != '') { if ($vendorversion != '') {
$container->addElement(new htmlOutputText('<b>' . _("Vendor version") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Vendor version") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($vendorversion));
$container->addElement(new htmlOutputText($vendorversion), true);
} }
// monitoring information // monitoring information
if (isset($monitorEntries['cn=monitor']['monitoredinfo'])) { if (isset($monitorEntries['cn=monitor']['monitoredinfo'])) {
$container->addElement(new htmlOutputText('<b>' . _("Name") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Name") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['monitoredinfo'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['monitoredinfo'])), true);
} }
if (isset($monitorEntries['cn=listeners,cn=monitor'])) { if (isset($monitorEntries['cn=listeners,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Listeners") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Listeners") . '</b>', false));
$container->addElement($spacer);
$listeners = array(); $listeners = array();
$l = 0; $l = 0;
while (isset($monitorEntries['cn=listener ' . $l . ',cn=listeners,cn=monitor'])) { while (isset($monitorEntries['cn=listener ' . $l . ',cn=listeners,cn=monitor'])) {
$listeners[] = $monitorEntries['cn=listener ' . $l . ',cn=listeners,cn=monitor']['monitorconnectionlocaladdress'][0]; $listeners[] = $monitorEntries['cn=listener ' . $l . ',cn=listeners,cn=monitor']['monitorconnectionlocaladdress'][0];
$l++; $l++;
} }
$container->addElement(new htmlOutputText(implode(', ', $listeners)), true); $container->addField(new htmlOutputText(implode(', ', $listeners)));
} }
if (isset($monitorEntries['cn=backends,cn=monitor'])) { if (isset($monitorEntries['cn=backends,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Backends") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Backends") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=backends,cn=monitor']['monitoredinfo'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=backends,cn=monitor']['monitoredinfo'])), true);
} }
if (isset($monitorEntries['cn=overlays,cn=monitor'])) { if (isset($monitorEntries['cn=overlays,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Overlays") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Overlays") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=overlays,cn=monitor']['monitoredinfo'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=overlays,cn=monitor']['monitoredinfo'])), true);
} }
if (isset($monitorEntries['cn=max file descriptors,cn=connections,cn=monitor'])) { if (isset($monitorEntries['cn=max file descriptors,cn=connections,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Max. file descriptors") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Max. file descriptors") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=max file descriptors,cn=connections,cn=monitor']['monitorcounter'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=max file descriptors,cn=connections,cn=monitor']['monitorcounter'])), true);
} }
// server statistics // server statistics
if (isset($monitorEntries['cn=time,cn=monitor']) || isset($monitorEntries['cn=statistics,cn=monitor']) || isset($monitorEntries['cn=monitor']['currenttime'])) { if (isset($monitorEntries['cn=time,cn=monitor']) || isset($monitorEntries['cn=statistics,cn=monitor']) || isset($monitorEntries['cn=monitor']['currenttime'])) {
$container->addElement(new htmlSubTitle(_('Server statistics')), true); $container->add(new htmlSubTitle(_('Server statistics')), 12);
if (isset($monitorEntries['cn=entries,cn=statistics,cn=monitor'])) { if (isset($monitorEntries['cn=entries,cn=statistics,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("LDAP entries") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("LDAP entries") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=entries,cn=statistics,cn=monitor']['monitorcounter'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=entries,cn=statistics,cn=monitor']['monitorcounter'])), true);
} }
if (isset($monitorEntries['cn=referrals,cn=statistics,cn=monitor'])) { if (isset($monitorEntries['cn=referrals,cn=statistics,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Referrals") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Referrals") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=referrals,cn=statistics,cn=monitor']['monitorcounter'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=referrals,cn=statistics,cn=monitor']['monitorcounter'])), true);
} }
if (isset($monitorEntries['cn=start,cn=time,cn=monitor'])) { if (isset($monitorEntries['cn=start,cn=time,cn=monitor'])) {
$time = formatLDAPTimestamp($monitorEntries['cn=start,cn=time,cn=monitor']['monitortimestamp'][0]); $time = formatLDAPTimestamp($monitorEntries['cn=start,cn=time,cn=monitor']['monitortimestamp'][0]);
$container->addElement(new htmlOutputText('<b>' . _("Start time") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Start time") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($time), 12);
$container->addElement(new htmlOutputText($time), true);
} }
elseif (isset($monitorEntries['cn=monitor']['starttime'])) { // Fedora 389 elseif (isset($monitorEntries['cn=monitor']['starttime'])) { // Fedora 389
$time = formatLDAPTimestamp($monitorEntries['cn=monitor']['starttime'][0]); $time = formatLDAPTimestamp($monitorEntries['cn=monitor']['starttime'][0]);
$container->addElement(new htmlOutputText('<b>' . _("Start time") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Start time") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($time));
$container->addElement(new htmlOutputText($time), true);
} }
if (isset($monitorEntries['cn=current,cn=time,cn=monitor'])) { if (isset($monitorEntries['cn=current,cn=time,cn=monitor'])) {
$time = formatLDAPTimestamp($monitorEntries['cn=current,cn=time,cn=monitor']['monitortimestamp'][0]); $time = formatLDAPTimestamp($monitorEntries['cn=current,cn=time,cn=monitor']['monitortimestamp'][0]);
$container->addElement(new htmlOutputText('<b>' . _("Server time") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Server time") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($time));
$container->addElement(new htmlOutputText($time), true);
} }
elseif (isset($monitorEntries['cn=monitor']['currenttime'])) { // Fedora 389 elseif (isset($monitorEntries['cn=monitor']['currenttime'])) { // Fedora 389
$time = formatLDAPTimestamp($monitorEntries['cn=monitor']['currenttime'][0]); $time = formatLDAPTimestamp($monitorEntries['cn=monitor']['currenttime'][0]);
$container->addElement(new htmlOutputText('<b>' . _("Server time") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Server time") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($time));
$container->addElement(new htmlOutputText($time), true);
} }
if (isset($monitorEntries['cn=uptime,cn=time,cn=monitor'])) { if (isset($monitorEntries['cn=uptime,cn=time,cn=monitor'])) {
$uptime = $monitorEntries['cn=uptime,cn=time,cn=monitor']['monitoredinfo'][0]; $uptime = $monitorEntries['cn=uptime,cn=time,cn=monitor']['monitoredinfo'][0];
@ -220,189 +205,165 @@ if (isset($monitorEntries['cn=time,cn=monitor']) || isset($monitorEntries['cn=st
$hours = floor($daysRest / 3600); $hours = floor($daysRest / 3600);
$hoursRest = $daysRest - ($hours * 3600); $hoursRest = $daysRest - ($hours * 3600);
$minutes = floor($hoursRest / 60); $minutes = floor($hoursRest / 60);
$container->addElement(new htmlOutputText('<b>' . _("Uptime") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Uptime") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($days . ':' . $hours . ':' . $minutes));
$container->addElement(new htmlOutputText($days . ':' . $hours . ':' . $minutes), true);
} }
} }
// connection statistics // connection statistics
if (isset($monitorEntries['cn=connections,cn=monitor']) || isset($monitorEntries['cn=statistics,cn=monitor']) || isset($monitorEntries['cn=monitor']['currentconnections'])) { if (isset($monitorEntries['cn=connections,cn=monitor']) || isset($monitorEntries['cn=statistics,cn=monitor']) || isset($monitorEntries['cn=monitor']['currentconnections'])) {
$container->addElement(new htmlSubTitle(_('Connection statistics')), true); $container->add(new htmlSubTitle(_('Connection statistics')), 12);
if (isset($monitorEntries['cn=current,cn=connections,cn=monitor'])) { if (isset($monitorEntries['cn=current,cn=connections,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Current connections") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Current connections") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=current,cn=connections,cn=monitor']['monitorcounter'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=current,cn=connections,cn=monitor']['monitorcounter'])), true);
} }
elseif (isset($monitorEntries['cn=monitor']['currentconnections'])) { // Fedora 389 elseif (isset($monitorEntries['cn=monitor']['currentconnections'])) { // Fedora 389
$container->addElement(new htmlOutputText('<b>' . _("Current connections") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Current connections") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['currentconnections'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['currentconnections'])), true);
} }
if (isset($monitorEntries['cn=total,cn=connections,cn=monitor'])) { if (isset($monitorEntries['cn=total,cn=connections,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("Total connections") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Total connections") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=total,cn=connections,cn=monitor']['monitorcounter'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=total,cn=connections,cn=monitor']['monitorcounter'])), true);
} }
elseif (isset($monitorEntries['cn=monitor']['totalconnections'])) { // Fedora 389 elseif (isset($monitorEntries['cn=monitor']['totalconnections'])) { // Fedora 389
$container->addElement(new htmlOutputText('<b>' . _("Total connections") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Total connections") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['totalconnections'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['totalconnections'])), true);
} }
if (isset($monitorEntries['cn=bytes,cn=statistics,cn=monitor'])) { if (isset($monitorEntries['cn=bytes,cn=statistics,cn=monitor'])) {
$bytes = round($monitorEntries['cn=bytes,cn=statistics,cn=monitor']['monitorcounter'][0] / 1000000, 2) . 'MB'; $bytes = round($monitorEntries['cn=bytes,cn=statistics,cn=monitor']['monitorcounter'][0] / 1000000, 2) . 'MB';
$container->addElement(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($bytes));
$container->addElement(new htmlOutputText($bytes), true);
} }
elseif (isset($monitorEntries['cn=monitor']['bytessent'])) { // Fedora 389 elseif (isset($monitorEntries['cn=monitor']['bytessent'])) { // Fedora 389
$bytes = round($monitorEntries['cn=monitor']['bytessent'][0] / 1000000, 2) . 'MB'; $bytes = round($monitorEntries['cn=monitor']['bytessent'][0] / 1000000, 2) . 'MB';
$container->addElement(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Bytes sent") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($bytes));
$container->addElement(new htmlOutputText($bytes), true);
} }
if (isset($monitorEntries['cn=pdu,cn=statistics,cn=monitor'])) { if (isset($monitorEntries['cn=pdu,cn=statistics,cn=monitor'])) {
$container->addElement(new htmlOutputText('<b>' . _("PDUs sent") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("PDUs sent") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($monitorEntries['cn=pdu,cn=statistics,cn=monitor']['monitorcounter'][0]));
$container->addElement(new htmlOutputText($monitorEntries['cn=pdu,cn=statistics,cn=monitor']['monitorcounter'][0]), true);
} }
if (isset($monitorEntries['cn=monitor']['entriessent'])) { // Fedora 389 if (isset($monitorEntries['cn=monitor']['entriessent'])) { // Fedora 389
$container->addElement(new htmlOutputText('<b>' . _("Entries sent") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Entries sent") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText($monitorEntries['cn=monitor']['entriessent'][0]));
$container->addElement(new htmlOutputText($monitorEntries['cn=monitor']['entriessent'][0]), true);
} }
} }
// operation statistics (OpenLDAP) // operation statistics (OpenLDAP)
if (isset($monitorEntries['cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=operations,cn=monitor'])) {
$container->addElement(new htmlSubTitle(_('Operation statistics')), true); $container->add(new htmlSubTitle(_('Operation statistics')), 12);
$opStats = new htmlTable(); $data = array();
$opStats->colspan = 10;
$opStats->addElement(new htmlOutputText(''));
$opStats->addElement($spacer);
$opStats->addElement(new htmlOutputText('<b>' . _("Initiated") . '</b>', false));
$opStats->addElement($spacer);
$opStats->addElement(new htmlOutputText('<b>' . _("Completed") . '</b>', false), true);
if (isset($monitorEntries['cn=bind,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=bind,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Bind") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Bind") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=bind,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=unbind,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=unbind,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Unbind") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Unbind") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=unbind,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=search,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=search,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Search") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Search") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=search,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=add,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=add,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Add") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Add") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=add,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=modify,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=modify,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Modify") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Modify") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modify,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=delete,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=delete,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Delete") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Delete") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=delete,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=modrdn,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=modrdn,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=modrdn,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=compare,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=compare,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Compare") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Compare") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=compare,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=abandon,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=abandon,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Abandon") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Abandon") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=abandon,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=extended,cn=operations,cn=monitor'])) { if (isset($monitorEntries['cn=extended,cn=operations,cn=monitor'])) {
$opStats->addElement(new htmlOutputText('<b>' . _("Extended") . '</b>', false)); $data[] = array(
$opStats->addElement($spacer); new htmlOutputText('<b>' . _("Extended") . '</b>', false),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=extended,cn=operations,cn=monitor']['monitoropcompleted'])), true); );
} }
if (isset($monitorEntries['cn=operations,cn=monitor']['monitoropinitiated'])) { if (isset($monitorEntries['cn=operations,cn=monitor']['monitoropinitiated'])) {
$opStats->addElement(new htmlSpacer(null, '10px'), true); $data[] = array(
$opStats->addElement(new htmlOutputText('<b>' . _("Total") . '</b>', false)); new htmlOutputText('<b>' . _("Total") . '</b>', false),
$opStats->addElement($spacer); new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropinitiated'])),
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropinitiated']))); new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropcompleted'])),
$opStats->addElement($spacer); );
$opStats->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=operations,cn=monitor']['monitoropcompleted'])), true);
} }
$container->addElement($opStats); $opStats = new htmlResponsiveTable(array('', _("Initiated"), _("Completed")), $data);
$container->add($opStats, 12);
} }
// operation statistics (389 server) // operation statistics (389 server)
elseif (isset($monitorEntries['cn=monitor']['opsinitiated'])) { elseif (isset($monitorEntries['cn=monitor']['opsinitiated'])) {
$container->addElement(new htmlSubTitle(_('Operation statistics')), true); $container->add(new htmlSubTitle(_('Operation statistics')), 12);
$container->addElement(new htmlOutputText('<b>' . _("Initiated") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Initiated") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opsinitiated'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opsinitiated'])), true); $container->addLabel(new htmlOutputText('<b>' . _("Completed") . '</b>', false));
$container->addElement(new htmlOutputText('<b>' . _("Completed") . '</b>', false)); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opscompleted'])));
$container->addElement($spacer);
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=monitor']['opscompleted'])), true);
if (isset($monitorEntries['cn=snmp,cn=monitor']['addentryops'])) { if (isset($monitorEntries['cn=snmp,cn=monitor']['addentryops'])) {
$container->addElement(new htmlOutputText('<b>' . _("Bind") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Bind") . '</b>', false));
$container->addElement($spacer);
$binds = $monitorEntries['cn=snmp,cn=monitor']['anonymousbinds'][0] + $monitorEntries['cn=snmp,cn=monitor']['unauthbinds'][0] $binds = $monitorEntries['cn=snmp,cn=monitor']['anonymousbinds'][0] + $monitorEntries['cn=snmp,cn=monitor']['unauthbinds'][0]
+ $monitorEntries['cn=snmp,cn=monitor']['simpleauthbinds'][0] + $monitorEntries['cn=snmp,cn=monitor']['strongauthbinds'][0]; + $monitorEntries['cn=snmp,cn=monitor']['simpleauthbinds'][0] + $monitorEntries['cn=snmp,cn=monitor']['strongauthbinds'][0];
$container->addElement(new htmlOutputText($binds), true); $container->addField(new htmlOutputText($binds));
$container->addElement(new htmlOutputText('<b>' . _("Search") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Search") . '</b>', false));
$container->addElement($spacer);
$searches = $monitorEntries['cn=snmp,cn=monitor']['searchops'][0]; $searches = $monitorEntries['cn=snmp,cn=monitor']['searchops'][0];
$container->addElement(new htmlOutputText($searches), true); $container->addField(new htmlOutputText($searches));
$container->addElement(new htmlOutputText('<b>' . _("Add") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Add") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['addentryops'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['addentryops'])), true); $container->addLabel(new htmlOutputText('<b>' . _("Modify") . '</b>', false));
$container->addElement(new htmlOutputText('<b>' . _("Modify") . '</b>', false)); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyentryops'])));
$container->addElement($spacer); $container->addLabel(new htmlOutputText('<b>' . _("Delete") . '</b>', false));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyentryops'])), true); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['removeentryops'])));
$container->addElement(new htmlOutputText('<b>' . _("Delete") . '</b>', false)); $container->addLabel(new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false));
$container->addElement($spacer); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyrdnops'])));
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['removeentryops'])), true); $container->addLabel(new htmlOutputText('<b>' . _("Compare") . '</b>', false));
$container->addElement(new htmlOutputText('<b>' . _("Modify RDN") . '</b>', false)); $container->addField(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['compareops'])));
$container->addElement($spacer);
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['modifyrdnops'])), true);
$container->addElement(new htmlOutputText('<b>' . _("Compare") . '</b>', false));
$container->addElement($spacer);
$container->addElement(new htmlOutputText(implode(', ', $monitorEntries['cn=snmp,cn=monitor']['compareops'])), true);
} }
} }
parseHtml(null, $container, array(), true, $tabindex, 'user'); parseHtml(null, $container, array(), true, $tabindex, 'user');
echo '</div>'; echo '</div>';
include 'main_footer.php'; include '../lib/adminFooter.inc';
?> ?>

View File

@ -1,9 +1,13 @@
<?php <?php
namespace LAM\TOOLS\TESTS;
use \htmlResponsiveRow;
use \htmlOutputText;
use \htmlLink;
use \htmlTitle;
/* /*
$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) 2006 - 2017 Roland Gruber Copyright (C) 2006 - 2018 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
@ -44,26 +48,24 @@ checkIfToolIsActive('toolTests');
setlanguage(); setlanguage();
include '../main_header.php'; include '../../lib/adminHeader.inc';
echo "<div class=\"user-bright smallPaddingContent\">\n"; echo "<div class=\"user-bright smallPaddingContent\">\n";
$container = new htmlTable(); $container = new htmlResponsiveRow();
$container->addElement(new htmlSubTitle(_("LAM tests")), true); $container->add(new htmlTitle(_("LAM tests")), 12);
$container->addElement(new htmlLink(_("Lamdaemon test"), 'lamdaemonTest.php', '../../graphics/lamdaemonSmall.png')); $container->add(new htmlLink(_("Lamdaemon test"), 'lamdaemonTest.php', '../../graphics/lamdaemonSmall.png'), 12, 4);
$container->addElement(new htmlSpacer('20px', null)); $container->add(new htmlOutputText(_("Check if quotas and homedirectories can be managed.")), 12, 8);
$container->addElement(new htmlOutputText(_("Check if quotas and homedirectories can be managed.")), true);
$container->addElement(new htmlSpacer(null, '20px'), true); $container->addVerticalSpacer('2rem');
$container->addElement(new htmlLink(_("Schema test"), 'schemaTest.php', '../../graphics/schemaTest.png')); $container->add(new htmlLink(_("Schema test"), 'schemaTest.php', '../../graphics/schemaTest.png'), 12, 4);
$container->addElement(new htmlSpacer('20px', null)); $container->add(new htmlOutputText(_("Check if the LDAP schema fits the requirements of the selected account modules.")), 12, 8);
$container->addElement(new htmlOutputText(_("Check if the LDAP schema fits the requirements of the selected account modules.")), true);
$tabindex = 1; $tabindex = 1;
parseHtml(null, $container, array(), true, $tabindex, 'user'); parseHtml(null, $container, array(), true, $tabindex, 'user');
echo "</div>\n"; echo "</div>\n";
include '../main_footer.php'; include '../../lib/adminFooter.inc';
?> ?>

View File

@ -1,23 +1,21 @@
<?php <?php
namespace LAM\TOOLS\TESTS; namespace LAM\TOOLS\TESTS;
use \LAM\REMOTE\Remote; use \LAM\REMOTE\Remote;
use \htmlTable;
use \htmlTitle; use \htmlTitle;
use \htmlOutputText; use \htmlOutputText;
use \htmlSelect; use \htmlResponsiveSelect;
use \htmlInputCheckbox; use \htmlResponsiveInputCheckbox;
use \htmlSpacer;
use \htmlButton; use \htmlButton;
use \htmlStatusMessage; use \htmlStatusMessage;
use \htmlImage; use \htmlImage;
use \htmlSubTitle; use \htmlSubTitle;
use \Exception; use \Exception;
use \htmlResponsiveRow;
/* /*
$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) 2006 - 2017 Roland Gruber Copyright (C) 2006 - 2018 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
@ -59,12 +57,12 @@ checkIfToolIsActive('toolTests');
setlanguage(); setlanguage();
include '../main_header.php'; include '../../lib/adminHeader.inc';
echo "<div class=\"user-bright smallPaddingContent\">\n"; echo "<div class=\"user-bright smallPaddingContent\">\n";
echo "<form action=\"lamdaemonTest.php\" method=\"post\">\n"; echo "<form action=\"lamdaemonTest.php\" method=\"post\">\n";
$container = new htmlTable(); $container = new htmlResponsiveRow();
$container->addElement(new htmlTitle(_("Lamdaemon test")), true); $container->add(new htmlTitle(_("Lamdaemon test")), 12);
$servers = explode(";", $_SESSION['config']->get_scriptServers()); $servers = explode(";", $_SESSION['config']->get_scriptServers());
$serverIDs = array(); $serverIDs = array();
@ -84,7 +82,6 @@ if (isset($_POST['runTest'])) {
lamRunTestSuite($_POST['server'], $serverTitles[$_POST['server']] , isset($_POST['checkQuotas']), $container); lamRunTestSuite($_POST['server'], $serverTitles[$_POST['server']] , isset($_POST['checkQuotas']), $container);
} }
else if ((sizeof($servers) > 0) && isset($servers[0]) && ($servers[0] != '')) { else if ((sizeof($servers) > 0) && isset($servers[0]) && ($servers[0] != '')) {
$container->addElement(new htmlOutputText(_("Server")));
$serverOptions = array(); $serverOptions = array();
for ($i = 0; $i < sizeof($servers); $i++) { for ($i = 0; $i < sizeof($servers); $i++) {
$servers[$i] = explode(":", $servers[$i]); $servers[$i] = explode(":", $servers[$i]);
@ -95,21 +92,21 @@ else if ((sizeof($servers) > 0) && isset($servers[0]) && ($servers[0] != '')) {
} }
$serverOptions[$title] = $serverName; $serverOptions[$title] = $serverName;
} }
$serverSelect = new htmlSelect('server', $serverOptions); $serverSelect = new htmlResponsiveSelect('server', $serverOptions, array(), _("Server"));
$serverSelect->setHasDescriptiveElements(true); $serverSelect->setHasDescriptiveElements(true);
$container->addElement($serverSelect, true); $container->add($serverSelect, 12);
$container->addElement(new htmlOutputText(_("Check quotas"))); $container->add(new htmlResponsiveInputCheckbox('checkQuotas', false, _("Check quotas")), 12);
$container->addElement(new htmlInputCheckbox('checkQuotas', false), true);
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
$okButton = new htmlButton('runTest', _("Ok")); $okButton = new htmlButton('runTest', _("Ok"));
$okButton->colspan = 2; $okButton->colspan = 2;
$container->addElement($okButton); $container->addLabel($okButton);
$container->addField(new htmlOutputText('&nbsp;', false));
} }
else { else {
$container->addElement(new htmlStatusMessage("ERROR", _('No lamdaemon server set, please update your LAM configuration settings.'))); $container->add(new htmlStatusMessage("ERROR", _('No lamdaemon server set, please update your LAM configuration settings.')), 12);
} }
$tabindex = 1; $tabindex = 1;
@ -117,7 +114,7 @@ parseHtml(null, $container, array(), false, $tabindex, 'user');
echo "</form>\n"; echo "</form>\n";
echo "</div>\n"; echo "</div>\n";
include '../main_footer.php'; include '../../lib/adminFooter.inc';
/** /**
@ -127,17 +124,15 @@ include '../main_footer.php';
* @param boolean $stopTest specifies if test should be run * @param boolean $stopTest specifies if test should be run
* @param Remote $remote SSH connection * @param Remote $remote SSH connection
* @param string $testText describing text * @param string $testText describing text
* @param htmlTable $container container for HTML output * @param htmlResponsiveRow $container container for HTML output
* @return boolean true, if errors occured * @return boolean true, if errors occured
*/ */
function testRemoteCommand($command, $stopTest, $remote, $testText, $container) { function testRemoteCommand($command, $stopTest, $remote, $testText, $container) {
$okImage = "../../graphics/pass.png"; $okImage = "../../graphics/pass.png";
$failImage = "../../graphics/fail.png"; $failImage = "../../graphics/fail.png";
$spacer = new htmlSpacer('10px', null);
// run remote command // run remote command
if (!$stopTest) { if (!$stopTest) {
$container->addElement(new htmlOutputText($testText)); $container->add(new htmlOutputText($testText), 10, 4);
$container->addElement($spacer);
flush(); flush();
$lamdaemonOk = false; $lamdaemonOk = false;
$output = $remote->execute($command); $output = $remote->execute($command);
@ -145,34 +140,32 @@ function testRemoteCommand($command, $stopTest, $remote, $testText, $container)
$lamdaemonOk = true; $lamdaemonOk = true;
} }
if ($lamdaemonOk) { if ($lamdaemonOk) {
$container->addElement(new htmlImage($okImage)); $container->add(new htmlImage($okImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(_("Lamdaemon successfully run.")), 12, 6);
$container->addElement(new htmlOutputText(_("Lamdaemon successfully run.")), true);
} }
else { else {
$container->addElement(new htmlImage($failImage)); $container->add(new htmlImage($failImage), 2);
$container->addElement($spacer);
if (!(strpos($output, 'ERROR,') === 0) && !(strpos($output, 'WARN,') === 0)) { if (!(strpos($output, 'ERROR,') === 0) && !(strpos($output, 'WARN,') === 0)) {
// error messages from console (e.g. sudo) // error messages from console (e.g. sudo)
$container->addElement(new htmlStatusMessage('ERROR', $output), true); $container->add(new htmlStatusMessage('ERROR', $output), 12, 6);
} }
else { else {
// error messages from lamdaemon // error messages from lamdaemon
$parts = explode(",", $output); $parts = explode(",", $output);
if (sizeof($parts) == 2) { if (sizeof($parts) == 2) {
$container->addElement(new htmlStatusMessage($parts[0], $parts[1]), true); $container->add(new htmlStatusMessage($parts[0], $parts[1]), 12, 6);
} }
elseif (sizeof($parts) == 3) { elseif (sizeof($parts) == 3) {
$container->addElement(new htmlStatusMessage($parts[0], $parts[1], $parts[2]), true); $container->add(new htmlStatusMessage($parts[0], $parts[1], $parts[2]), 12, 6);
} }
else { else {
$container->addElement(new htmlOutputText($output), true); $container->add(new htmlOutputText($output), 12, 6);
} }
} }
$stopTest = true; $stopTest = true;
} }
} }
flush(); $container->addVerticalSpacer('0.5rem');
return $stopTest; return $stopTest;
} }
@ -182,7 +175,7 @@ function testRemoteCommand($command, $stopTest, $remote, $testText, $container)
* @param String $serverName server ID * @param String $serverName server ID
* @param String $serverTitle server name * @param String $serverTitle server name
* @param boolean $testQuota true, if Quotas should be checked * @param boolean $testQuota true, if Quotas should be checked
* @param htmlTable $container container for HTML output * @param htmlResponsiveRow $container container for HTML output
*/ */
function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) { function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) {
$SPLIT_DELIMITER = "###x##y##x###"; $SPLIT_DELIMITER = "###x##y##x###";
@ -190,47 +183,38 @@ function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) {
$okImage = "../../graphics/pass.png"; $okImage = "../../graphics/pass.png";
$failImage = "../../graphics/fail.png"; $failImage = "../../graphics/fail.png";
flush();
$stopTest = false; $stopTest = false;
$spacer = new htmlSpacer('10px', null);
$container->addElement(new htmlSubTitle($serverTitle), true); $container->add(new htmlSubTitle($serverTitle), 12);
// check script server and path // check script server and path
$container->addElement(new htmlOutputText(_("Lamdaemon server and path"))); $container->add(new htmlOutputText(_("Lamdaemon server and path")), 10, 4);
$container->addElement(new htmlSpacer('10px', null));
if (!isset($serverName) || (strlen($serverName) < 3)) { if (!isset($serverName) || (strlen($serverName) < 3)) {
$container->addElement(new htmlImage($failImage)); $container->add(new htmlImage($failImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(_("No lamdaemon server set, please update your LAM configuration settings.")), 12, 6);
$container->addElement(new htmlOutputText(_("No lamdaemon server set, please update your LAM configuration settings.")), true);
} }
elseif (($_SESSION['config']->get_scriptPath() == null) || (strlen($_SESSION['config']->get_scriptPath()) < 10)) { elseif (($_SESSION['config']->get_scriptPath() == null) || (strlen($_SESSION['config']->get_scriptPath()) < 10)) {
$container->addElement(new htmlImage($failImage)); $container->add(new htmlImage($failImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(_("No lamdaemon path set, please update your LAM configuration settings.")), 12, 6);
$container->addElement(new htmlOutputText(_("No lamdaemon path set, please update your LAM configuration settings.")), true);
$stopTest = true; $stopTest = true;
} }
elseif (substr($_SESSION['config']->get_scriptPath(), -3) != '.pl') { elseif (substr($_SESSION['config']->get_scriptPath(), -3) != '.pl') {
$container->addElement(new htmlImage($failImage)); $container->add(new htmlImage($failImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(_("Lamdaemon path does not end with \".pl\". Did you enter the full path to the script?")), 12, 6);
$container->addElement(new htmlOutputText(_("Lamdaemon path does not end with \".pl\". Did you enter the full path to the script?")), true);
$stopTest = true; $stopTest = true;
} }
else { else {
$container->addElement(new htmlImage($okImage)); $container->add(new htmlImage($okImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(sprintf(_("Using %s as lamdaemon remote server."), $serverName)), 12, 6);
$container->addElement(new htmlOutputText(sprintf(_("Using %s as lamdaemon remote server."), $serverName)), true);
} }
$container->addVerticalSpacer('0.5rem');
flush();
// check Unix account of LAM admin // check Unix account of LAM admin
$credentials = $_SESSION['ldap']->decrypt_login(); $credentials = $_SESSION['ldap']->decrypt_login();
if (!$stopTest) { if (!$stopTest) {
$scriptUserName = $_SESSION['config']->getScriptUserName(); $scriptUserName = $_SESSION['config']->getScriptUserName();
if (empty($scriptUserName)) { if (empty($scriptUserName)) {
$container->addElement(new htmlOutputText(_("Unix account"))); $container->add(new htmlOutputText(_("Unix account")), 10, 4);
$container->addElement($spacer);
$unixOk = false; $unixOk = false;
$sr = @ldap_read($_SESSION['ldap']->server(), $credentials[0], "objectClass=posixAccount", array('uid'), 0, 0, 0, LDAP_DEREF_NEVER); $sr = @ldap_read($_SESSION['ldap']->server(), $credentials[0], "objectClass=posixAccount", array('uid'), 0, 0, 0, LDAP_DEREF_NEVER);
if ($sr) { if ($sr) {
@ -241,46 +225,39 @@ function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) {
} }
} }
if ($unixOk) { if ($unixOk) {
$container->addElement(new htmlImage($okImage)); $container->add(new htmlImage($okImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(sprintf(_("Using %s to connect to remote server."), $userName)), 12, 6);
$container->addElement(new htmlOutputText(sprintf(_("Using %s to connect to remote server."), $userName)), true);
} }
else { else {
$container->addElement(new htmlImage($failImage)); $container->add(new htmlImage($failImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(sprintf(_("Your LAM admin user (%s) must be a valid Unix account to work with lamdaemon!"), $credentials[0])), 12, 6);
$container->addElement(new htmlOutputText(sprintf(_("Your LAM admin user (%s) must be a valid Unix account to work with lamdaemon!"), $credentials[0])), true);
$stopTest = true; $stopTest = true;
} }
$container->addVerticalSpacer('0.5rem');
} }
else { else {
$userName = $_SESSION['config']->getScriptUserName(); $userName = $_SESSION['config']->getScriptUserName();
} }
} }
flush();
// check SSH login // check SSH login
$remote = new Remote(); $remote = new Remote();
if (!$stopTest) { if (!$stopTest) {
$container->addElement(new htmlOutputText(_("SSH connection"))); $container->add(new htmlOutputText(_("SSH connection")), 10, 4);
$container->addElement($spacer);
flush(); flush();
$sshOk = false; $sshOk = false;
try { try {
$remote->connect($serverName); $remote->connect($serverName);
$container->addElement(new htmlImage($okImage)); $container->add(new htmlImage($okImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText(_("SSH connection established.")), 12, 6);
$container->addElement(new htmlOutputText(_("SSH connection established.")), true);
} }
catch (Exception $e) { catch (Exception $e) {
$container->addElement(new htmlImage($failImage)); $container->add(new htmlImage($failImage), 2);
$container->addElement($spacer); $container->add(new htmlOutputText($e->getMessage()), 12, 6);
$container->addElement(new htmlOutputText($e->getMessage()), true);
$stopTest = true; $stopTest = true;
} }
} }
$container->addVerticalSpacer('0.5rem');
flush();
if (!$stopTest) { if (!$stopTest) {
$stopTest = testRemoteCommand("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "basic", $stopTest, $remote, _("Execute lamdaemon"), $container); $stopTest = testRemoteCommand("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "basic", $stopTest, $remote, _("Execute lamdaemon"), $container);
@ -299,10 +276,10 @@ function lamRunTestSuite($serverName, $serverTitle, $testQuota, $container) {
} }
$remote->disconnect(); $remote->disconnect();
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
$endMessage = new htmlOutputText(_("Lamdaemon test finished.")); $endMessage = new htmlOutputText(_("Lamdaemon test finished."));
$endMessage->colspan = 5; $endMessage->colspan = 5;
$container->addElement($endMessage); $container->add($endMessage, 12);
} }
?> ?>

View File

@ -1,9 +1,15 @@
<?php <?php
namespace LAM\TOOLS\TESTS;
use \htmlResponsiveRow;
use \htmlTitle;
use \htmlStatusMessage;
use \htmlSubTitle;
use \htmlOutputText;
use \htmlImage;
/* /*
$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) 2007 - 2017 Roland Gruber Copyright (C) 2007 - 2018 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
@ -48,18 +54,18 @@ checkIfToolIsActive('toolTests');
setlanguage(); setlanguage();
include '../main_header.php'; include '../../lib/adminHeader.inc';
echo "<div class=\"user-bright smallPaddingContent\">\n"; echo "<div class=\"user-bright smallPaddingContent\">\n";
$container = new htmlTable(); $container = new htmlResponsiveRow();
$container->addElement(new htmlTitle(_("Schema test")), true); $container->add(new htmlTitle(_("Schema test")), 12);
get_schema_objectclasses(); get_schema_objectclasses();
$classes = get_cached_schema('objectclasses'); $classes = get_cached_schema('objectclasses');
if (!is_array($classes)) { if (!is_array($classes)) {
$container->addElement(new htmlStatusMessage('ERROR', _('Unable to retrieve schema!'), _('You do not have the required access rights or the LDAP schema is not published by your server.'))); $container->add(new htmlStatusMessage('ERROR', _('Unable to retrieve schema!'), _('You do not have the required access rights or the LDAP schema is not published by your server.')), 12);
} }
else { else {
// loop for active account types // loop for active account types
@ -67,7 +73,7 @@ else {
$types = $typeManager->getConfiguredTypes(); $types = $typeManager->getConfiguredTypes();
foreach ($types as $type) { foreach ($types as $type) {
$modules = $_SESSION['config']->get_AccountModules($type->getId()); $modules = $_SESSION['config']->get_AccountModules($type->getId());
$container->addElement(new htmlSubTitle($type->getAlias()), true); $container->add(new htmlSubTitle($type->getAlias()), 12);
for ($m = 0; $m < sizeof($modules); $m++) { for ($m = 0; $m < sizeof($modules); $m++) {
$error = checkSchemaForModule($modules[$m], $type->getScope(), $type->getId()); $error = checkSchemaForModule($modules[$m], $type->getScope(), $type->getId());
$message = _("No problems found."); $message = _("No problems found.");
@ -77,13 +83,12 @@ else {
$message = $error; $message = $error;
} }
// module name // module name
$container->addElement(new htmlOutputText(getModuleAlias($modules[$m], $type->getScope()))); $container->add(new htmlOutputText(getModuleAlias($modules[$m], $type->getScope())), 10, 3);
$container->addElement(new htmlSpacer('10px', null));
// icon // icon
$container->addElement(new htmlImage($icon)); $container->add(new htmlImage($icon), 2);
$container->addElement(new htmlSpacer('10px', null));
// text // text
$container->addElement(new htmlOutputText($message), true); $container->add(new htmlOutputText($message), 12, 7);
$container->addVerticalSpacer('0.5rem');
} }
} }
} }
@ -92,7 +97,7 @@ $tabindex = 1;
parseHtml(null, $container, array(), true, $tabindex, 'user'); parseHtml(null, $container, array(), true, $tabindex, 'user');
echo "</div>\n"; echo "</div>\n";
include '../main_footer.php'; include '../../lib/adminFooter.inc';
/** /**
* Checks if the object classes and attributes for this module are available. * Checks if the object classes and attributes for this module are available.

View File

@ -1,9 +1,14 @@
<?php <?php
namespace LAM\TOOLS\TESTS;
use \htmlResponsiveRow;
use \htmlTitle;
use \htmlOutputText;
use \htmlLink;
/* /*
$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 - 2017 Roland Gruber Copyright (C) 2003 - 2018 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
@ -41,15 +46,15 @@ enforceUserIsLoggedIn();
setlanguage(); setlanguage();
include 'main_header.php'; include '../lib/adminHeader.inc';
// get tool list // get tool list
$availableTools = getTools(); $availableTools = getTools();
// sort tools // sort tools
$toSort = array(); $toSort = array();
for ($i = 0; $i < sizeof($availableTools); $i++) { foreach ($availableTools as $availableTool) {
$myTool = new $availableTools[$i](); $myTool = new $availableTool();
$toSort[$availableTools[$i]] = $myTool->getPosition(); $toSort[$availableTool] = $myTool->getPosition();
} }
asort($toSort); asort($toSort);
$tools = array(); $tools = array();
@ -60,33 +65,32 @@ foreach ($toSort as $key => $value) {
echo "<div class=\"user-bright smallPaddingContent\">\n"; echo "<div class=\"user-bright smallPaddingContent\">\n";
// print tools table // print tools table
$container = new htmlTable(); $container = new htmlResponsiveRow();
$container->addElement(new htmlTitle(_('Tools')), true); $container->add(new htmlTitle(_('Tools')), 12);
$toolSettings = $_SESSION['config']->getToolSettings(); $toolSettings = $_SESSION['config']->getToolSettings();
for ($i = 0; $i < sizeof($tools); $i++) { foreach ($tools as $tool) {
// check access level // check access level
if ($tools[$i]->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) { if ($tool->getRequiresWriteAccess() && !checkIfWriteAccessIsAllowed()) {
continue; continue;
} }
if ($tools[$i]->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) { if ($tool->getRequiresPasswordChangeRights() && !checkIfPasswordChangeIsAllowed()) {
continue; continue;
} }
// check visibility // check visibility
if (!$tools[$i]->isVisible()) { if (!$tool->isVisible()) {
continue; continue;
} }
// check if hidden by config // check if hidden by config
$className = get_class($tools[$i]); $className = get_class($tool);
$toolName = substr($className, strrpos($className, '\\') + 1); $toolName = substr($className, strrpos($className, '\\') + 1);
if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) { if (isset($toolSettings['tool_hide_' . $toolName]) && ($toolSettings['tool_hide_' . $toolName] == 'true')) {
continue; continue;
} }
// add tool // add tool
$container->addElement(new htmlLink($tools[$i]->getName(), $tools[$i]->getLink(), '../graphics/' . $tools[$i]->getImageLink())); $container->add(new htmlLink($tool->getName(), $tool->getLink(), '../graphics/' . $tool->getImageLink()), 12, 4);
$container->addElement(new htmlSpacer('10px', null)); $container->add(new htmlOutputText($tool->getDescription()), 12, 8);
$container->addElement(new htmlOutputText($tools[$i]->getDescription()), true); $container->addVerticalSpacer('2rem');
$container->addElement(new htmlSpacer(null, '20px'), true);
} }
$tabindex = 1; $tabindex = 1;
@ -94,6 +98,6 @@ parseHtml(null, $container, array(), true, $tabindex, 'user');
echo "</div>"; echo "</div>";
include 'main_footer.php'; include '../lib/adminFooter.inc';
?> ?>

View File

@ -11,7 +11,7 @@ use \htmlHiddenInput;
$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) 2004 - 2017 Roland Gruber Copyright (C) 2004 - 2018 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
@ -75,21 +75,21 @@ if (isset($_GET['showldif'])) {
header('Content-Type: text/plain'); header('Content-Type: text/plain');
header('Content-disposition: attachment; filename=lam.ldif'); header('Content-disposition: attachment; filename=lam.ldif');
$accounts = unserialize(lamDecrypt($_SESSION['mass_accounts'])); $accounts = unserialize(lamDecrypt($_SESSION['mass_accounts']));
for ($i = 0; $i < sizeof($accounts); $i++) { foreach ($accounts as $account) {
echo "DN: " . $accounts[$i]['dn'] . "\n"; echo "DN: " . $account['dn'] . "\n";
unset($accounts[$i]['dn']); unset($account['dn']);
$keys = array_keys($accounts[$i]); $keys = array_keys($account);
for ($k = 0; $k < sizeof($keys); $k++) { foreach ($keys as $key) {
if (strpos($keys[$k], 'INFO.') === 0) { if (strpos($key, 'INFO.') === 0) {
continue; continue;
} }
if (is_array($accounts[$i][$keys[$k]])) { if (is_array($account[$key])) {
for ($x = 0; $x < sizeof($accounts[$i][$keys[$k]]); $x++) { foreach ($account[$key] as $value) {
echo $keys[$k] . ": " . $accounts[$i][$keys[$k]][$x] . "\n"; echo $key . ": " . $value . "\n";
} }
} }
else { else {
echo $keys[$k] . ": " . $accounts[$i][$keys[$k]] . "\n"; echo $key . ": " . $account[$key] . "\n";
} }
} }
echo "\n"; echo "\n";
@ -126,8 +126,8 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
// read input file // read input file
$handle = fopen ($_FILES['inputfile']['tmp_name'], "r"); $handle = fopen ($_FILES['inputfile']['tmp_name'], "r");
if (($head = fgetcsv($handle, 2000)) !== false ) { // head row if (($head = fgetcsv($handle, 2000)) !== false ) { // head row
for ($i = 0; $i < sizeof($head); $i++) { foreach ($head as $i => $headItem) {
$ids[$head[$i]] = $i; $ids[$headItem] = $i;
} }
} }
while (($line = fgetcsv($handle, 2000)) !== false ) { // account rows while (($line = fgetcsv($handle, 2000)) !== false ) { // account rows
@ -139,10 +139,10 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
// check if all required columns are present // check if all required columns are present
$checkcolumns = array(); $checkcolumns = array();
$columns = call_user_func_array('array_merge', $columns); $columns = call_user_func_array('array_merge', $columns);
for ($i = 0; $i < sizeof($columns); $i++) { foreach ($columns as $column) {
if (isset($columns[$i]['required']) && ($columns[$i]['required'] === true)) { if (isset($column['required']) && ($column['required'] === true)) {
if (isset($ids[$columns[$i]['name']])) $checkcolumns[] = $ids[$columns[$i]['name']]; if (isset($ids[$column['name']])) $checkcolumns[] = $ids[$column['name']];
else $errors[] = array(_("A required column is missing in your CSV file."), $columns[$i]['name']); else $errors[] = array(_("A required column is missing in your CSV file."), $column['name']);
} }
} }
@ -163,14 +163,14 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
break; break;
} }
} }
for ($i = 0; $i < sizeof($invalidColumns); $i++) { foreach ($invalidColumns as $invalidColumn) {
$errors[] = array(_("One or more values of the required column \"$invalidColumns[$i]\" are missing."), ""); $errors[] = array(_("One or more values of the required column \"$invalidColumn\" are missing."), "");
} }
// check if values in unique columns are correct // check if values in unique columns are correct
for ($i = 0; $i < sizeof($columns); $i++) { foreach ($columns as $column) {
if (isset($columns[$i]['unique']) && ($columns[$i]['unique'] === true) && isset($ids[$columns[$i]['name']])) { if (isset($column['unique']) && ($column['unique'] === true) && isset($ids[$column['name']])) {
$colNumber = $ids[$columns[$i]['name']]; $colNumber = $ids[$column['name']];
$values_given = array(); $values_given = array();
foreach ($data as $dataRow) { foreach ($data as $dataRow) {
$values_given[] = $dataRow[$colNumber]; $values_given[] = $dataRow[$colNumber];
@ -184,15 +184,15 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
} }
} }
$duplicates = array_values(array_unique($duplicates)); $duplicates = array_values(array_unique($duplicates));
$errors[] = array(_("This column is defined to include unique entries but duplicates were found:") . ' ' . $columns[$i]['name'], implode(', ', $duplicates)); $errors[] = array(_("This column is defined to include unique entries but duplicates were found:") . ' ' . $column['name'], implode(', ', $duplicates));
} }
} }
} }
// if input data is invalid just display error messages (max 50) // if input data is invalid just display error messages (max 50)
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) { foreach ($errors as $error) {
$container->addElement(new htmlStatusMessage("ERROR", $errors[$i][0], $errors[$i][1]), true); $container->addElement(new htmlStatusMessage("ERROR", $error[0], $error[1]), true);
} }
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addElement(new htmlSpacer(null, '10px'), true);
massPrintBackButton($type->getId(), $selectedModules, $container); massPrintBackButton($type->getId(), $selectedModules, $container);
@ -219,8 +219,8 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
} }
// print errors if DN could not be built // print errors if DN could not be built
if (sizeof($errors) > 0) { if (sizeof($errors) > 0) {
for ($i = 0; $i < sizeof($errors); $i++) { foreach ($errors as $error) {
$container->addElement(new htmlStatusMessage("ERROR", $errors[$i][0], $errors[$i][1], $errors[$i][2]), true); $container->addElement(new htmlStatusMessage("ERROR", $error[0], $error[1], $error[2]), true);
} }
} }
else { else {
@ -294,8 +294,8 @@ function massPrintBackButton($typeId, $selectedModules, htmlTable &$container) {
} }
$container->addElement(new htmlHiddenInput('createPDF', $createPDF)); $container->addElement(new htmlHiddenInput('createPDF', $createPDF));
$container->addElement(new htmlHiddenInput('pdfStructure', $_POST['pdfStructure'])); $container->addElement(new htmlHiddenInput('pdfStructure', $_POST['pdfStructure']));
for ($i = 0; $i < sizeof($selectedModules); $i++) { foreach ($selectedModules as $selectedModule) {
$container->addElement(new htmlHiddenInput($typeId . '___' . $selectedModules[$i], 'on')); $container->addElement(new htmlHiddenInput($typeId . '___' . $selectedModule, 'on'));
} }
} }

View File

@ -22,7 +22,7 @@ use \moduleCache;
$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) 2004 - 2017 Roland Gruber Copyright (C) 2004 - 2018 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
@ -119,18 +119,18 @@ if (isset($_POST['type'])) {
// get selected modules // get selected modules
$selectedModules = array(); $selectedModules = array();
$checkedBoxes = array_keys($_POST, 'on'); $checkedBoxes = array_keys($_POST, 'on');
for ($i = 0; $i < sizeof($checkedBoxes); $i++) { foreach ($checkedBoxes as $checkedBox) {
if (strpos($checkedBoxes[$i], $typeId . '___') === 0) { if (strpos($checkedBox, $typeId . '___') === 0) {
$selectedModules[] = substr($checkedBoxes[$i], strlen($typeId) + strlen('___')); $selectedModules[] = substr($checkedBox, strlen($typeId) + strlen('___'));
} }
} }
$deps = getModulesDependencies($type->getScope()); $deps = getModulesDependencies($type->getScope());
$depErrors = check_module_depends($selectedModules, $deps); $depErrors = check_module_depends($selectedModules, $deps);
if (is_array($depErrors) && (sizeof($depErrors) > 0)) { if (is_array($depErrors) && (sizeof($depErrors) > 0)) {
for ($i = 0; $i < sizeof($depErrors); $i++) { foreach ($depErrors as $depError) {
StatusMessage('ERROR', _("Unsolved dependency:") . ' ' . StatusMessage('ERROR', _("Unsolved dependency:") . ' ' .
getModuleAlias($depErrors[$i][0], $type->getScope()) . " (" . getModuleAlias($depError[0], $type->getScope()) . " (" .
getModuleAlias($depErrors[$i][1], $type->getScope()) . ")"); getModuleAlias($depError[1], $type->getScope()) . ")");
} }
} }
else { else {
@ -191,25 +191,25 @@ foreach ($types as $type) {
} }
$innerTable = new htmlTable(); $innerTable = new htmlTable();
$modules = $_SESSION['config']->get_AccountModules($type->getId()); $modules = $_SESSION['config']->get_AccountModules($type->getId());
for ($m = 0; $m < sizeof($modules); $m++) { foreach ($modules as $m => $moduleName) {
if (($m != 0) && ($m%3 == 0)) { if (($m != 0) && ($m%3 == 0)) {
echo $innerTable->addNewLine(); echo $innerTable->addNewLine();
} }
$module = moduleCache::getModule($modules[$m], $type->getScope()); $module = moduleCache::getModule($moduleName, $type->getScope());
$iconImage = $module->getIcon(); $iconImage = $module->getIcon();
if (!is_null($iconImage) && !(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) { if (!is_null($iconImage) && !(strpos($iconImage, 'http') === 0) && !(strpos($iconImage, '/') === 0)) {
$iconImage = '../../graphics/' . $iconImage; $iconImage = '../../graphics/' . $iconImage;
} }
$innerTable->addElement(new htmlImage($iconImage)); $innerTable->addElement(new htmlImage($iconImage));
$enabled = true; $enabled = true;
if (is_base_module($modules[$m], $type->getScope())) { if (is_base_module($moduleName, $type->getScope())) {
$enabled = false; $enabled = false;
} }
$checked = true; $checked = true;
if (isset($_POST['submit']) && !isset($_POST[$type->getId() . '___' . $modules[$m]])) { if (isset($_POST['submit']) && !isset($_POST[$type->getId() . '___' . $moduleName])) {
$checked = false; $checked = false;
} }
$checkbox = new htmlTableExtendedInputCheckbox($type->getId() . '___' . $modules[$m], $checked, getModuleAlias($modules[$m], $type->getScope()), null, false); $checkbox = new htmlTableExtendedInputCheckbox($type->getId() . '___' . $moduleName, $checked, getModuleAlias($moduleName, $type->getScope()), null, false);
$checkbox->setIsEnabled($enabled); $checkbox->setIsEnabled($enabled);
if ($enabled) { if ($enabled) {
$innerTable->addElement($checkbox); $innerTable->addElement($checkbox);
@ -218,7 +218,7 @@ foreach ($types as $type) {
$boxGroup = new htmlGroup(); $boxGroup = new htmlGroup();
$boxGroup->addElement($checkbox); $boxGroup->addElement($checkbox);
// add hidden field to fake disabled checkbox value // add hidden field to fake disabled checkbox value
$boxGroup->addElement(new htmlHiddenInput($type->getId() . '___' . $modules[$m], 'on')); $boxGroup->addElement(new htmlHiddenInput($type->getId() . '___' . $moduleName, 'on'));
$innerTable->addElement($boxGroup); $innerTable->addElement($boxGroup);
} }
$innerTable->addElement(new htmlSpacer('10px', null)); $innerTable->addElement(new htmlSpacer('10px', null));
@ -380,18 +380,18 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$dnRDNRow->setCSSClasses(array($scope . '-bright')); $dnRDNRow->setCSSClasses(array($scope . '-bright'));
$columnContainer->addElement($dnRDNRow); $columnContainer->addElement($dnRDNRow);
// module options // module options
for ($m = 0; $m < sizeof($modules); $m++) { foreach ($modules as $moduleName) {
// skip modules without upload columns // skip modules without upload columns
if (sizeof($columns[$modules[$m]]) < 1) { if (sizeof($columns[$moduleName]) < 1) {
continue; continue;
} }
$columnContainer->addElement(new htmlSpacer(null, '10px'), true); $columnContainer->addElement(new htmlSpacer(null, '10px'), true);
$module = moduleCache::getModule($modules[$m], $scope); $module = moduleCache::getModule($moduleName, $scope);
$icon = $module->getIcon(); $icon = $module->getIcon();
if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) { if (!empty($icon) && !(strpos($icon, 'http') === 0) && !(strpos($icon, '/') === 0)) {
$icon = '../../graphics/' . $icon; $icon = '../../graphics/' . $icon;
} }
$moduleTitle = new htmlSubTitle(getModuleAlias($modules[$m], $scope), $icon); $moduleTitle = new htmlSubTitle(getModuleAlias($moduleName, $scope), $icon);
$moduleTitle->colspan = 20; $moduleTitle->colspan = 20;
$columnContainer->addElement($moduleTitle, true); $columnContainer->addElement($moduleTitle, true);
$columnContainer->addElement(new htmlOutputText('')); $columnContainer->addElement(new htmlOutputText(''));
@ -417,37 +417,37 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$possibleOut->alignment = htmlElement::ALIGN_LEFT; $possibleOut->alignment = htmlElement::ALIGN_LEFT;
$columnContainer->addElement($possibleOut, false, true); $columnContainer->addElement($possibleOut, false, true);
$odd = true; $odd = true;
for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { foreach ($columns[$moduleName] as $column) {
$required = false; $required = false;
if (isset($columns[$modules[$m]][$i]['required']) && ($columns[$modules[$m]][$i]['required'] === true)) { if (isset($column['required']) && ($column['required'] === true)) {
$required = true; $required = true;
} }
$rowCells = array(); $rowCells = array();
$rowCells[] = $columnSpacer; $rowCells[] = $columnSpacer;
$rowCells[] = new htmlHelpLink($columns[$modules[$m]][$i]['help'], $modules[$m], $scope); $rowCells[] = new htmlHelpLink($column['help'], $moduleName, $scope);
$rowCells[] = $columnSpacer; $rowCells[] = $columnSpacer;
$descriptionText = new htmlOutputText($columns[$modules[$m]][$i]['description']); $descriptionText = new htmlOutputText($column['description']);
$descriptionText->setMarkAsRequired($required); $descriptionText->setMarkAsRequired($required);
$descriptionText->setNoWrap(true); $descriptionText->setNoWrap(true);
$rowCells[] = $descriptionText; $rowCells[] = $descriptionText;
$rowCells[] = $columnSpacer; $rowCells[] = $columnSpacer;
$rowCells[] = new htmlOutputText($columns[$modules[$m]][$i]['name']); $rowCells[] = new htmlOutputText($column['name']);
$rowCells[] = $columnSpacer; $rowCells[] = $columnSpacer;
$example = ''; $example = '';
if (isset($columns[$modules[$m]][$i]['example'])) { if (isset($column['example'])) {
$example = $columns[$modules[$m]][$i]['example']; $example = $column['example'];
} }
$rowCells[] = new htmlOutputText($example); $rowCells[] = new htmlOutputText($example);
$rowCells[] = $columnSpacer; $rowCells[] = $columnSpacer;
if (isset($columns[$modules[$m]][$i]['default'])) { if (isset($column['default'])) {
$rowCells[] = new htmlOutputText($columns[$modules[$m]][$i]['default']); $rowCells[] = new htmlOutputText($column['default']);
} }
else { else {
$rowCells[] = new htmlOutputText(''); $rowCells[] = new htmlOutputText('');
} }
$rowCells[] = $columnSpacer; $rowCells[] = $columnSpacer;
if (isset($columns[$modules[$m]][$i]['values'])) { if (isset($column['values'])) {
$rowCells[] = new htmlOutputText($columns[$modules[$m]][$i]['values']); $rowCells[] = new htmlOutputText($column['values']);
} }
else { else {
$rowCells[] = new htmlOutputText(''); $rowCells[] = new htmlOutputText('');
@ -479,10 +479,12 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$sampleCSV_head[] = "\"dn_suffix\""; $sampleCSV_head[] = "\"dn_suffix\"";
$sampleCSV_head[] = "\"dn_rdn\""; $sampleCSV_head[] = "\"dn_rdn\"";
// module attributes // module attributes
for ($m = 0; $m < sizeof($modules); $m++) { foreach ($modules as $moduleName) {
if (sizeof($columns[$modules[$m]]) < 1) continue; if (sizeof($columns[$moduleName]) < 1) {
for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { continue;
$sampleCSV_head[] = "\"" . $columns[$modules[$m]][$i]['name'] . "\""; }
foreach ($columns[$moduleName] as $column) {
$sampleCSV_head[] = "\"" . $column['name'] . "\"";
} }
} }
$RDNs = getRDNAttributes($type->getId(), $selectedModules); $RDNs = getRDNAttributes($type->getId(), $selectedModules);
@ -490,11 +492,13 @@ function showMainPage(\LAM\TYPES\ConfiguredType $type, $selectedModules) {
$sampleCSV_row[] = "\"" . $type->getSuffix() . "\""; $sampleCSV_row[] = "\"" . $type->getSuffix() . "\"";
$sampleCSV_row[] = "\"" . $RDNs[0] . "\""; $sampleCSV_row[] = "\"" . $RDNs[0] . "\"";
// module attributes // module attributes
for ($m = 0; $m < sizeof($modules); $m++) { foreach ($modules as $moduleName) {
if (sizeof($columns[$modules[$m]]) < 1) continue; if (sizeof($columns[$moduleName]) < 1) {
for ($i = 0; $i < sizeof($columns[$modules[$m]]); $i++) { continue;
if (isset($columns[$modules[$m]][$i]['example'])) { }
$sampleCSV_row[] = '"' . $columns[$modules[$m]][$i]['example'] . '"'; foreach ($columns[$moduleName] as $column) {
if (isset($column['example'])) {
$sampleCSV_row[] = '"' . $column['example'] . '"';
} }
else { else {
$sampleCSV_row[] = '""'; $sampleCSV_row[] = '""';

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) 2016 Roland Gruber Copyright (C) 2016 - 2017 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
@ -154,6 +154,19 @@ class LAMConfigTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($val, $this->lAMConfig->getPagedResults()); $this->assertEquals($val, $this->lAMConfig->getPagedResults());
} }
/**
* Tests LAMConfig->getReferentialIntegrityOverlay() and LAMConfig->setReferentialIntegrityOverlay()
*/
public function testReferentialIntegrityOverlay() {
$val = 'true';
$this->lAMConfig->setReferentialIntegrityOverlay($val);
$this->assertEquals($val, $this->lAMConfig->getReferentialIntegrityOverlay());
$this->assertTrue($this->lAMConfig->isReferentialIntegrityOverlayActive());
$this->doSave();
$this->assertEquals($val, $this->lAMConfig->getReferentialIntegrityOverlay());
$this->assertTrue($this->lAMConfig->isReferentialIntegrityOverlayActive());
}
/** /**
* Tests LAMConfig->get_Admins() * Tests LAMConfig->get_Admins()
*/ */