new type API

This commit is contained in:
Roland Gruber 2016-12-26 19:11:05 +01:00
parent 0bf8702763
commit cbdd69f7f6
6 changed files with 133 additions and 106 deletions

View File

@ -1,9 +1,10 @@
<?php
namespace LAM\TOOLS\UPLOAD;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2011 Roland Gruber
Copyright (C) 2009 - 2016 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
@ -33,7 +34,7 @@ $Id$
*
* @package tools
*/
class toolFileUpload implements LAMTool {
class toolFileUpload implements \LAMTool {
/**
* Returns the name of the tool.

View File

@ -1,20 +1,21 @@
<?php
namespace LAM\TOOLS\MULTI_EDIT;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 Roland Gruber
Copyright (C) 2013 - 2016 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
@ -30,56 +31,56 @@ $Id$
/**
* Multi edit tool that allows LDAP operations on multiple entries.
*
*
* @package tools
*/
class toolMultiEdit implements LAMTool {
*/
class toolMultiEdit implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("Multi edit");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("Performs modifications on multiple LDAP entries.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "multiEdit.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return true;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return true;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolMultiEdit implements LAMTool {
function getImageLink() {
return 'edit.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,16 +99,16 @@ class toolMultiEdit implements LAMTool {
function getPosition() {
return 400;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
return array();
}
/**
* Returns if the tool is visible in the menu.
*
@ -116,16 +117,16 @@ class toolMultiEdit implements LAMTool {
function isVisible() {
return true;
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,4 +1,5 @@
<?php
namespace LAM\TOOLS\SCHEMA;
/*
$Id$
@ -9,12 +10,12 @@ $Id$
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
@ -30,56 +31,56 @@ $Id$
/**
* Schema browser
*
*
* @package tools
*/
class toolSchemaBrowser implements LAMTool {
*/
class toolSchemaBrowser implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("Schema browser");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("Here you can browse LDAP object classes and attributes.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "schema/schema.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return false;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return false;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolSchemaBrowser implements LAMTool {
function getImageLink() {
return 'schemaBrowser.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,16 +99,16 @@ class toolSchemaBrowser implements LAMTool {
function getPosition() {
return 600;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
return array();
}
/**
* Returns if the tool is visible in the menu.
*
@ -116,16 +117,16 @@ class toolSchemaBrowser implements LAMTool {
function isVisible() {
return true;
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,20 +1,21 @@
<?php
namespace LAM\TOOLS\SERVER_INFO;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2011 Roland Gruber
Copyright (C) 2009 - 2016 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
@ -30,56 +31,56 @@ $Id$
/**
* Server information
*
*
* @package tools
*/
class toolServerInformation implements LAMTool {
*/
class toolServerInformation implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("Server information");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("Information about the LDAP server.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "serverInfo.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return false;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return true;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolServerInformation implements LAMTool {
function getImageLink() {
return 'tree_info.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,16 +99,16 @@ class toolServerInformation implements LAMTool {
function getPosition() {
return 700;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
return array();
}
/**
* Returns if the tool is visible in the menu.
*
@ -116,16 +117,16 @@ class toolServerInformation implements LAMTool {
function isVisible() {
return true;
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,20 +1,21 @@
<?php
namespace LAM\TOOLS\TESTS;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2011 Roland Gruber
Copyright (C) 2009 - 2016 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
@ -30,56 +31,56 @@ $Id$
/**
* Tests page
*
*
* @package tools
*/
class toolTests implements LAMTool {
*/
class toolTests implements \LAMTool {
/**
* Returns the name of the tool.
*
*
* @return string name
*/
function getName() {
return _("Tests");
}
/**
* returns a description text for the tool.
*
*
* @return string description
*/
function getDescription() {
return _("Here you can test if certain LAM features work on your installation.");
}
/**
* Returns a link to the tool page (relative to templates/).
*
*
* @return string link
*/
function getLink() {
return "tests/index.php";
}
/**
/**
* Returns if the tool requires write access to LDAP.
*
*
* @return boolean true if write access is needed
*/
function getRequiresWriteAccess() {
return true;
}
/**
* Returns if the tool requires password change rights.
*
*
* @return boolean true if password change rights are needed
*/
function getRequiresPasswordChangeRights() {
return true;
}
/**
* Returns the link to the tool image (relative to graphics/)
*
@ -88,7 +89,7 @@ class toolTests implements LAMTool {
function getImageLink() {
return 'tests.png';
}
/**
* Returns the prefered position of this tool on the tools page.
* The position may be between 0 and 1000. 0 is the top position.
@ -98,21 +99,21 @@ class toolTests implements LAMTool {
function getPosition() {
return 1000;
}
/**
* Returns a list of sub tools or an empty array.
*
*
* @return array list of subtools (LAMTool)
*/
function getSubTools() {
$return = array();
$lamdaemonTest = new LAMSubTool();
$lamdaemonTest = new \LAMSubTool();
$lamdaemonTest->name = _("Lamdaemon test");
$lamdaemonTest->link = 'tests/lamdaemonTest.php';
$lamdaemonTest->description = _("Check if quotas and homedirectories can be managed.");
$lamdaemonTest->image = 'lamdaemonSmall.png';
$return[] = $lamdaemonTest;
$schemaTest = new LAMSubTool();
$schemaTest = new \LAMSubTool();
$schemaTest->name = _("Schema test");
$schemaTest->link = 'tests/schemaTest.php';
$schemaTest->description = _("Check if the LDAP schema fits the requirements of the selected account modules.");
@ -120,7 +121,7 @@ class toolTests implements LAMTool {
$return[] = $schemaTest;
return $return;
}
/**
* Returns if the tool is visible in the menu.
*
@ -129,16 +130,16 @@ class toolTests implements LAMTool {
function isVisible() {
return (sizeof($_SESSION['config']->get_ActiveTypes()) > 0);
}
/**
* Returns if a tool may be hidden by configuration in the LAM server profile.
*
*
* @return boolean hideable
*/
function isHideable() {
return true;
}
}
?>

View File

@ -1,4 +1,22 @@
<?php
namespace LAM\TOOLS\MULTI_EDIT;
use \htmlTable;
use \htmlTitle;
use \htmlSelect;
use \htmlOutputText;
use \htmlHelpLink;
use \htmlInputField;
use \htmlSubTitle;
use \htmlTableExtendedInputField;
use \htmlButton;
use \htmlStatusMessage;
use \htmlSpacer;
use \htmlHiddenInput;
use \htmlGroup;
use \htmlDiv;
use \htmlJavaScript;
use \htmlLink;
use \htmlInputTextarea;
/*
$Id$
@ -85,11 +103,15 @@ function displayStartPage() {
$hideRules = array();
$container->addElement(new htmlOutputText(_('LDAP suffix')));
$suffixGroup = new htmlTable();
$types = $_SESSION['config']->get_ActiveTypes();
$typeManager = new \LAM\TYPES\TypeManager();
$types = $typeManager->getConfiguredTypes();
$suffixes = array();
foreach ($types as $type) {
$suffixes[LAM\TYPES\getTypeAlias($type)] = $_SESSION['config']->get_Suffix($type);
$hideRules[$_SESSION['config']->get_Suffix($type)] = array('otherSuffix');
if ($type->isHidden()) {
continue;
}
$suffixes[$type->getAlias()] = $type->getSuffix();
$hideRules[$type->getSuffix()] = array('otherSuffix');
}
$treeSuffix = $_SESSION['config']->get_Suffix('tree');
if (!empty($treeSuffix)) {