set_typeSettings($_SESSION['conf_typeSettings']); //selection ok, back to other settings metarefresh('confmain.php?modulesback=true'); exit; } elseif (isset($_POST['abort'])) { // no changes $_SESSION['conf_accountTypes'] = $_SESSION['conf_accountTypesOld']; metarefresh('confmain.php?modulesback=true'); exit; } $types = $conf->get_ActiveTypes(); echo $_SESSION['header']; echo "" . _("LDAP Account Manager Configuration") . "\n"; echo "\n"; for ($i = 0; $i < sizeof($types); $i++){ echo "\n"; } echo "\n"; echo ("

". "\"LDAP



\n"); echo ("
\n"); echo "

" . _("Module selection") . "

"; $account_list = array(); for ($i = 0; $i < sizeof($types); $i++) { $account_list[] = array($types[$i], getTypeAlias($types[$i])); } $allDependenciesOk = true; for ($i = 0; $i < sizeof($account_list); $i++) { $ret = config_showAccountModules($account_list[$i][0], $account_list[$i][1]); if (!$ret) { $allDependenciesOk = false; } } // submit buttons echo "

\n"; // disable button if there are conflicts/depends if ($allDependenciesOk) { echo "\n"; } else { echo "\n"; } echo " "; echo "\n"; echo "

\n"; echo "



\n"; echo "(*) " . _("Base module"); // help link echo " "; echo "\"""; echo "\n"; echo "

\n"; echo "
\n"; echo "\n"; echo "\n"; /** * Displays the module selection boxes and checks if dependencies are fulfilled. * * @param string $scope account type * @param string $title title for module selection (e.g. "User modules") * @return boolean true if all dependencies are ok */ function config_showAccountModules($scope, $title) { // account modules $selected_temp = $_SESSION['conf_typeSettings']['modules_' . $scope]; if (isset($selected_temp)) $selected_temp = explode(',', $selected_temp); $available = array(); $available = getAvailableModules($scope); $selected = array(); // only use available modules as selected for ($i = 0; $i < sizeof($selected_temp); $i++) { if (in_array($selected_temp[$i], $available)) $selected[] = $selected_temp[$i]; } $no_conflicts = true; $no_depends = true; $no_missing_basemodule = true; // remove modules from selection if (isset($_POST[$scope . '_selected']) && isset($_POST[$scope . '_remove'])) { $new_selected = array(); for ($i = 0; $i < sizeof($selected); $i++) { if (! in_array($selected[$i], $_POST[$scope . '_selected'])) $new_selected[] = $selected[$i]; } $selected = $new_selected; $_SESSION['conf_typeSettings']['modules_' . $scope] = implode(',', $selected); } // add modules to selection elseif (isset($_POST[$scope . '_available']) && isset($_POST[$scope . '_add'])) { $new_selected = $selected; for ($i = 0; $i < sizeof($_POST[$scope . '_available']); $i++) { if (! in_array($_POST[$scope . '_available'][$i], $selected)) $new_selected[] = $_POST[$scope . '_available'][$i]; } $selected = $new_selected; $_SESSION['conf_typeSettings']['modules_' . $scope] = implode(',', $selected); } // show account modules $icon = '' . $scope . ' '; echo "
$icon" . $title . "\n"; echo "\n"; // select boxes echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
\n"; echo "" . _("Selected modules") . "\n"; echo "\n"; echo "
\n"; echo "
\n"; echo "

"; echo ""; echo "
"; echo ""; echo "

\n"; echo "
\n"; echo "
\n"; echo "" . _("Available modules") . "\n"; echo "\n"; echo "
\n"; echo "
\n"; // check dependencies $depends = check_module_depends($selected, getModulesDependencies($scope)); if ($depends != false) { $no_depends = false; echo "

\n"; for ($i = 0; $i < sizeof($depends); $i++) { echo "" . _("Unsolved dependency:") . " " . $depends[$i][0] . " (" . $depends[$i][1] . ")" . "
\n"; } echo "

\n"; } // check conflicts $conflicts = check_module_conflicts($selected, getModulesDependencies($scope)); if ($conflicts != false) { $no_conflicts = false; echo "

\n"; for ($i = 0; $i < sizeof($conflicts); $i++) { echo "" . _("Conflicting module:") . " " . $conflicts[$i][0] . " (" . $conflicts[$i][1] . ")" . "
\n"; } echo "

\n"; } // check for base module $baseCount = 0; for ($i = 0; $i < sizeof($selected); $i++) { if (is_base_module($selected[$i], $scope)) { $baseCount++; } } if ($baseCount != 1) { $no_missing_basemodule = false; echo "

\n"; echo "" . _("No or more than one base module selected!") . "
\n"; echo "

\n"; } echo "

\n"; echo "

\n"; return ($no_conflicts & $no_depends & $no_missing_basemodule); } ?>