Commit f4e3cf3d authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4253 Fixed PHP errors when using mainInc with a tabclass

Conflicts:
	include/simpleplugin/class_simplePlugin.inc
parent d617df5d
......@@ -737,10 +737,10 @@ class simplePlugin extends plugin
*
* \param boolean $edit_mode wether or not this plugin can be edited
*
* \param string $tabclass The tabclass to use (will be taken in the plInfo if FALSE)
* \param string $objectType The objectType to use (will be taken in the plInfo if FALSE)
*
*/
static function mainInc ($classname, $entry_dn, $tabs = FALSE, $edit_mode = TRUE, $tabclass = FALSE)
static function mainInc ($classname, $entry_dn, $tabs = FALSE, $edit_mode = TRUE, $objectType = FALSE)
{
global $remove_lock, $cleanup, $display, $config, $plug, $ui;
if ($tabs === TRUE) {
......@@ -748,16 +748,16 @@ class simplePlugin extends plugin
}
$plInfo = pluglist::pluginInfos($classname);
$plIcon = (isset($plInfo['plIcon'])?$plInfo['plIcon']:"plugin.png");
$plIcon = (isset($plInfo['plIcon'])?$plInfo['plIcon']:'plugin.png');
$plHeadline = $plInfo['plShortName'];
if (($tabs !== FALSE) && ($tabclass === FALSE)) {
if (($tabs !== FALSE) && ($objectType === FALSE)) {
$key = key($plInfo['plObjectType']);
if (is_numeric($key)) {
$key = $plInfo['plObjectType'][$key];
}
$tabclass = strtoupper($key)."TABS";
$objectType = $key;
}
$plCategory = (isset($plInfo['plCategory'])?$plInfo['plCategory']:array("user"));
$plCategory = (isset($plInfo['plCategory'])?$plInfo['plCategory']:array('user'));
$key = key($plCategory);
if (is_numeric($key)) {
$plCategory = $plCategory[$key];
......@@ -789,7 +789,7 @@ class simplePlugin extends plugin
/* Create account object on demand */
if (!session::is_set($classname) || (isset($_GET['reset']) && $_GET['reset'] == 1)) {
if ($tabs) {
$account = new $tabs($config, $config->data['TABS'][$tabclass], $entry_dn, $plCategory);
$account = new $tabs($objectType, $entry_dn);
if ($edit_mode) {
foreach ($account->by_object as &$obj) {
$obj->setNeedEditMode(TRUE);
......
......@@ -27,7 +27,12 @@ class dashboard extends simplePlugin
'plShortName' => _('Dashboard'),
'plDescription' => _('Statistics and various informations'),
'plIcon' => 'geticon.php?context=applications&icon=utilities-system-monitor&size=48',
'plObjectType' => array('dashboard' => array('name' => _('Dashboard'))),
'plObjectType' => array(
'dashboard' => array(
'name' => _('Dashboard'),
'mainAttr' => FALSE
)
),
'plSection' => array('reporting' => array('name' => _('Reporting'), 'priority' => 30)),
'plPriority' => 0,
......
......@@ -59,10 +59,11 @@ class configInLdap extends simplePlugin
'plIcon' => 'geticon.php?context=categories&icon=settings&size=48',
'plObjectType' => array(
'configuration' => array(
'name' => _('FusionDirectory configuration'),
'filter' => 'objectClass=fusionDirectoryConf',
'icon' => 'geticon.php?context=categories&icon=settings&size=16',
'ou' => preg_replace('/^[^,]+,/', '', CONFIGRDN)
'name' => _('FusionDirectory configuration'),
'filter' => 'objectClass=fusionDirectoryConf',
'icon' => 'geticon.php?context=categories&icon=settings&size=16',
'mainAttr' => FALSE,
'ou' => preg_replace('/^[^,]+,/', '', CONFIGRDN)
)
),
'plSection' => array('conf' => array('name' => _('Configuration'), 'priority' => 20)),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment