fixed problems with non-available modules in profile

This commit is contained in:
Roland Gruber 2004-02-10 22:04:18 +00:00
parent 29a5fe1d30
commit bf42eaa53c
2 changed files with 44 additions and 11 deletions

View File

@ -710,7 +710,14 @@ class Config {
// returns an array of all selected user modules // returns an array of all selected user modules
function get_UserModules() { function get_UserModules() {
return explode(",", $this->usermodules); $modules = explode(",", $this->usermodules);
$available = getAvailableModules('user');
// only return available modules
$ret = array();
for ($i = 0; $i < sizeof($modules); $i++) {
if (in_array($modules[$i], $available)) $ret[] = $modules[$i];
}
return $ret;
} }
// sets the selected user modules // sets the selected user modules
@ -730,7 +737,14 @@ class Config {
// returns an array of all selected group modules // returns an array of all selected group modules
function get_GroupModules() { function get_GroupModules() {
return explode(",", $this->groupmodules); $modules = explode(",", $this->groupmodules);
$available = getAvailableModules('group');
// only return available modules
$ret = array();
for ($i = 0; $i < sizeof($modules); $i++) {
if (in_array($modules[$i], $available)) $ret[] = $modules[$i];
}
return $ret;
} }
// sets the selected group modules // sets the selected group modules
@ -750,7 +764,14 @@ class Config {
// returns an array of all selected host modules // returns an array of all selected host modules
function get_HostModules() { function get_HostModules() {
return explode(",", $this->hostmodules); $modules = explode(",", $this->hostmodules);
$available = getAvailableModules('host');
// only return available modules
$ret = array();
for ($i = 0; $i < sizeof($modules); $i++) {
if (in_array($modules[$i], $available)) $ret[] = $modules[$i];
}
return $ret;
} }
// sets the selected host modules // sets the selected host modules

View File

@ -68,10 +68,14 @@ $group_deps = getModulesDependencies('group');
$host_deps = getModulesDependencies('host'); $host_deps = getModulesDependencies('host');
// user modules // user modules
$selected_users = array(); $selected_users_temp = $_SESSION['conf_usermodules'];
$selected_users = $_SESSION['conf_usermodules'];
$available_users = array(); $available_users = array();
$available_users = getAvailableModules('user'); $available_users = getAvailableModules('user');
$selected_users = array();
// only use available modules
for ($i = 0; $i < sizeof($selected_users_temp); $i++) {
if (in_array($selected_users_temp[$i], $available_users)) $selected_users[] = $selected_users_temp[$i];
}
$no_conflicts_user = true; $no_conflicts_user = true;
$no_depends_user = true; $no_depends_user = true;
@ -95,10 +99,14 @@ elseif ($_POST['user_available'] && ($_POST['user_add'])) {
} }
// group modules // group modules
$selected_groups = array(); $selected_groups_temp = $_SESSION['conf_groupmodules'];
$selected_groups = $_SESSION['conf_groupmodules'];
$available_groups = array(); $available_groups = array();
$available_groups = getAvailableModules('group'); $available_groups = getAvailableModules('group');
$selected_groups = array();
// only use available modules
for ($i = 0; $i < sizeof($selected_groups_temp); $i++) {
if (in_array($selected_groups_temp[$i], $available_groups)) $selected_groups[] = $selected_groups_temp[$i];
}
$no_conflicts_group = true; $no_conflicts_group = true;
$no_depends_group = true; $no_depends_group = true;
@ -122,10 +130,14 @@ elseif ($_POST['group_available'] && ($_POST['group_add'])) {
} }
// host modules // host modules
$selected_hosts = array(); $selected_hosts_temp = $_SESSION['conf_hostmodules'];
$selected_hosts = $_SESSION['conf_hostmodules'];
$available_hosts = array(); $available_hosts = array();
$available_hosts = getAvailableModules('host'); $available_hosts = getAvailableModules('host');
$selected_hosts = array();
// only use available modules
for ($i = 0; $i < sizeof($selected_hosts_temp); $i++) {
if (in_array($selected_hosts_temp[$i], $available_hosts)) $selected_hosts[] = $selected_hosts_temp[$i];
}
$no_conflicts_host = true; $no_conflicts_host = true;
$no_depends_host = true; $no_depends_host = true;
@ -339,10 +351,10 @@ echo "<p>\n";
echo "<input type=\"submit\" value=\"Submit\" name=\"submit\">\n"; echo "<input type=\"submit\" value=\"Submit\" name=\"submit\">\n";
} }
else { else {
echo "<input type=\"submit\" value=\"Submit\" name=\"submit\" disabled>\n"; echo "<input type=\"submit\" value=\"" . _("Submit") . "\" name=\"submit\" disabled>\n";
} }
echo "&nbsp;"; echo "&nbsp;";
echo "<input type=\"submit\" value=\"Abort\" name=\"abort\">\n"; echo "<input type=\"submit\" value=\"" . _("Abort") . "\" name=\"abort\">\n";
echo "</p>\n"; echo "</p>\n";
echo "</form>\n"; echo "</form>\n";