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; version 2 of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Exemplo n.º 1
0
/**
 * Newscoop list_users block plugin
 *
 * Type:     block
 * Name:     list_users
 *
 * @param array $params
 * @param mixed $content
 * @param object $smarty
 * @param bool $repeat
 * @return string
 */
function smarty_block_list_users($params, $content, &$smarty, &$repeat)
{
    $context = $smarty->getTemplateVars('gimme');
    if (!isset($content)) {
        // init
        $start = $context->next_list_start('UsersList');
        $list = new UsersList($start, $params);
        if ($list->isEmpty()) {
            $context->setCurrentList($list, array());
            $context->resetCurrentList();
            $repeat = false;
            return;
        }
        $context->setCurrentList($list, array('list_user'));
        $context->list_user = $context->current_users_list->current;
        $repeat = true;
    } else {
        // next
        $context->current_users_list->defaultIterator()->next();
        if (!is_null($context->current_users_list->current)) {
            $context->list_user = $context->current_users_list->current;
            $repeat = true;
        } else {
            $context->resetCurrentList();
            $repeat = false;
        }
    }
    return $content;
}
Exemplo n.º 2
0
function show_default()
{
    $usersList = new UsersList($_REQUEST);
    $us = $usersList->search();
    $searchDiv = $usersList->getForm();
    $users_info = array();
    foreach ($us as $user) {
        $user_info = $_SESSION['service']->session_simulate($user->getAttribute('login'));
        if (is_null($user_info)) {
            popup_error(sprintf(_('Unable to perform session simulation for user %s'), $user->getAttribute('login')));
            continue;
        }
        $user_info['user'] = $user;
        $users_info[] = $user_info;
    }
    page_header();
    echo '<h2>' . _('Users') . '</h2>';
    echo $searchDiv;
    if (count($users_info) == 0) {
        echo _('No available users') . '<br />';
    } else {
        echo '<table id="users_table" class="main_sub sortable" border="0" cellspacing="1" cellpadding="3">';
        echo '<thead>';
        echo '<tr class="title2">';
        echo '<th class="unsortable" colspan="3">' . _('Users') . '</th>';
        echo '<th colspan="2">' . _('Applications') . '</th>';
        echo '<th>' . _('Folders') . '</th>';
        echo '<th>' . _('Session') . '</th>';
        echo '</tr>';
        echo '<tr class="title">';
        echo '<th>' . _('Login') . '</th>';
        echo '<th>' . _('Name') . '</th>';
        echo '<th>' . _('In these User Groups') . '</th>';
        echo '<th>' . _('Published Application Groups') . '</th>';
        echo '<th>' . _('Access to these applications') . '</th>';
        echo '<th>' . _('Access to these folders') . '</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        $count = 0;
        foreach ($users_info as $user_info) {
            $u = $user_info['user'];
            echo '<tr class="content';
            if ($count % 2 == 0) {
                echo '1';
            } else {
                echo '2';
            }
            echo '">';
            echo '<td><a href="users.php?action=manage&id=' . $u->getAttribute('login') . '">' . $u->getAttribute('login') . '</a></td>';
            // login
            echo '<td><a href="users.php?action=manage&id=' . $u->getAttribute('login') . '">' . $u->getAttribute('displayname') . '</a></td>';
            //nam
            echo '<td>';
            if (count($user_info['user_grps']) == 0) {
                echo '<em>' . _('Not in any User Group') . '</em>';
            } else {
                echo '<table border="0" cellspacing="1" cellpadding="3">';
                foreach ($user_info['user_grps'] as $group_id => $group_name) {
                    echo '<tr>';
                    echo '<td><a href="usersgroup.php?action=manage&id=' . $group_id . '">' . $group_name . '</a></td>';
                    echo '</tr>';
                }
                if ($user_info['groups_partial_list'] === true) {
                    echo '<tr><td style="text-align: center;"><strong><a href="users.php?action=manage&id=' . $u->getAttribute('login') . '">...</a></strong></td></tr>';
                }
                echo '</table>';
            }
            echo '</td>';
            if (count($user_info['apps_grps']) == 0) {
                echo '<td colspan="2">';
                echo '<em>' . _('No publications') . '</em>';
                echo '</td>';
            } else {
                echo '<td>';
                echo '<table border="0" cellspacing="1" cellpadding="3">';
                foreach ($user_info['apps_grps'] as $group_id => $group_name) {
                    echo '<tr>';
                    echo '<td><a href="appsgroup.php?action=manage&id=' . $group_id . '">' . $group_name . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
                echo '</td>';
                echo '<td>';
                // in app
                if (count($user_info['apps']) == 0) {
                    echo '<em>' . _('No application in these groups') . '</em>';
                } else {
                    echo '<table border="0" cellspacing="1" cellpadding="3">';
                    foreach ($user_info['apps'] as $application_id => $aaa) {
                        echo '<tr>';
                        echo '<td><img class="icon32" src="media/image/cache.php?id=' . $aaa['id'] . '" alt="" title="" /></td>';
                        echo '<td><a href="applications.php?action=manage&id=' . $aaa['id'] . '">' . $aaa['name'] . '</a></td>';
                        echo '<td style="text-align: center;"><img src="media/image/server-' . $aaa['type'] . '.png" width="16" height="16" alt="' . $aaa['type'] . '" title="' . $aaa['type'] . '" /></td>';
                        echo '</tr>';
                    }
                    echo '</table>';
                }
                echo '</td>';
            }
            echo '<td>';
            if (count($user_info['profiles']) + count($user_info['shared_folders']) > 0) {
                echo '<table border="0" cellspacing="1" cellpadding="3">';
                foreach ($user_info['profiles'] as $profile_id => $profile_name) {
                    echo '<tr>';
                    echo '<td>' . _('Profile') . '</td>';
                    echo '<td>';
                    echo '<a href="profiles.php?action=manage&id=' . $profile_id . '">' . $profile_name . '</a></td>';
                    echo '</tr>';
                }
                foreach ($user_info['shared_folders'] as $share_id => $info) {
                    echo '<tr>';
                    echo '<td>' . _('Shared folder') . '</td>';
                    echo '<td>';
                    echo '<a href="sharedfolders.php?action=manage&id=' . $share_id . '">' . $info['share_name'] . '</a> (' . _('mode: ') . $info['mode'] . ')</td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            echo '</td>';
            echo '<td style="white-space: nowrap;">';
            echo '<div>';
            if ($user_info['can_start_session_desktop'] === true) {
                // add tooltip
                echo '<img src="media/image/ok.png" alt="" title="" />';
            } else {
                $reason = null;
                if (array_key_exists('cannot_start_session_reason', $user_info)) {
                    $reason = $user_info['cannot_start_session_reason'];
                }
                $reason = get_error_code_translation($reason);
                echo '<span onmouseover="showInfoBulle(\'' . str_replace("'", "&rsquo;", htmlspecialchars($reason)) . '\'); return false;" onmouseout="hideInfoBulle(); return false;">';
                echo '<img src="media/image/cancel.png" alt="" title="" />';
                echo '</span>';
            }
            echo ' ' . _('Desktop');
            echo '</div>';
            echo '<div>';
            if ($user_info['can_start_session_applications'] === true) {
                echo '<img src="media/image/ok.png" alt="" title="" />';
            } else {
                $reason = null;
                if (array_key_exists('cannot_start_session_reason', $user_info)) {
                    $reason = $user_info['cannot_start_session_reason'];
                }
                $reason = get_error_code_translation($reason);
                echo '<span onmouseover="showInfoBulle(\'' . str_replace("'", "&rsquo;", htmlspecialchars($reason)) . '\'); return false;" onmouseout="hideInfoBulle(); return false;">';
                echo '<img src="media/image/cancel.png" alt="" title="" />';
                echo '</span>';
            }
            echo ' ' . _('Applications');
            echo '</div>';
            echo '</td>';
            echo '</tr>';
            $count++;
        }
        echo '</tbody>';
        echo '</table>';
    }
    page_footer();
}
Exemplo n.º 3
0
    } else {
        $updateUser = new Users($newId, null, null, $newAddress, $newPhone, $newEmail);
        $updateUser->update();
    }
}
?>

<body>


<form method="post" accept-charset="utf8" >
	<h2>Control panel</h2>
	Name:  <br />
	<?php 
if ($_SESSION['rank'] == 2) {
    $listOfUsers = new UsersList();
    $usersArray = $listOfUsers->getUsersList();
    $length = count($usersArray);
    echo "<select name='id_update' id='id_update'>";
    echo "<option value=''>Please Select</option>";
    for ($i = 0; $i < $length; $i++) {
        echo "<option value='" . $usersArray[$i]->getId() . "' data-address='" . $usersArray[$i]->getAddress() . "' \n\t\t\tdata-phone='" . $usersArray[$i]->getPhone() . "' data-email='" . $usersArray[$i]->getMail() . "'>" . $usersArray[$i]->getName() . " " . $usersArray[$i]->getLastName() . "</option>";
    }
    echo "</select><br />";
} else {
    echo $name . " " . $lastname;
    echo "<input type='hidden' name='id_update' value='" . $id . "' /><br />";
}
?>
	
	
Exemplo n.º 4
0
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/includes/core.inc.php';
require_once dirname(__FILE__) . '/includes/page_template.php';
if (!checkAuthorization('viewSummary')) {
    redirect('index.php');
}
function my_own_callback($matches)
{
    return '<span class="' . strtolower($matches[1]) . '">' . trim($matches[0]) . '</span>';
}
$userDB = UserDB::getInstance();
$userGroupDB = UserGroupDB::getInstance();
$applicationsGroupDB = ApplicationsGroupDB::getInstance();
$usersList = new UsersList($_REQUEST);
$us = $usersList->search();
$searchDiv = $usersList->getForm();
page_header();
echo '<h2>' . _('List of users') . '</h2>';
echo $searchDiv;
if (is_null($us)) {
} else {
    if (count($us) > 0) {
        echo '<table id="users_table" class="main_sub sortable" border="0" cellspacing="1" cellpadding="3">';
        echo '<thead>';
        echo '<tr class="title">';
        echo '<th>' . _('login') . '</th><th>' . _('name') . '</th><th>' . _('in this user group') . '</th><th>' . _('in this application group') . '</th><th>' . _('access to these applications') . '</th><th>' . _('access to these network folders') . '</th>';
        // 		<th>'._('Desktop File').'</th>
        echo '<th>' . _('Available servers') . '</th>';
        echo '</tr>';
Exemplo n.º 5
0
function show_default()
{
    $userDB = UserDB::getInstance();
    $userGroupDB = UserGroupDB::getInstance();
    $applicationsGroupDB = ApplicationsGroupDB::getInstance();
    $sessionmanagement = SessionManagement::getInstance();
    $usersList = new UsersList($_REQUEST);
    $us = $usersList->search();
    $searchDiv = $usersList->getForm();
    page_header();
    echo '<h2>' . _('List of users') . '</h2>';
    echo $searchDiv;
    if (count($us) == 0) {
        echo _('No available user') . '<br />';
    } else {
        echo '<table id="users_table" class="main_sub sortable" border="0" cellspacing="1" cellpadding="3">';
        echo '<thead>';
        echo '<tr class="title2">';
        echo '<th class="unsortable" colspan="3">' . _('Users') . '</th>';
        echo '<th colspan="2">' . _('Applications') . '</th>';
        echo '<th>' . _('Folders') . '</th>';
        echo '<th>' . _('Session') . '</th>';
        echo '</tr>';
        echo '<tr class="title">';
        echo '<th>' . _('Login') . '</th>';
        echo '<th>' . _('Name') . '</th>';
        echo '<th>' . _('In these users groups') . '</th>';
        echo '<th>' . _('Published applications groups') . '</th>';
        echo '<th>' . _('Access to these applications') . '</th>';
        echo '<th>' . _('Access to these folders') . '</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        $count = 0;
        foreach ($us as $u) {
            $session_settings_defaults = $u->getSessionSettings('session_settings_defaults');
            echo '<tr class="content';
            if ($count % 2 == 0) {
                echo '1';
            } else {
                echo '2';
            }
            echo '">';
            echo '<td><a href="users.php?action=manage&id=' . $u->getAttribute('login') . '">' . $u->getAttribute('login') . '</a></td>';
            // login
            echo '<td><a href="users.php?action=manage&id=' . $u->getAttribute('login') . '">' . $u->getAttribute('displayname') . '</a></td>';
            //nam
            $users_grps = $u->usersGroups();
            // in user group
            echo '<td>';
            if (count($users_grps) == 0) {
                echo '<em>' . _('Not in any users group') . '</em>';
            } else {
                echo '<table border="0" cellspacing="1" cellpadding="3">';
                foreach ($users_grps as $ugrp) {
                    echo '<tr>';
                    echo '<td><a href="usersgroup.php?action=manage&id=' . $ugrp->getUniqueID() . '">' . $ugrp->name . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            echo '</td>';
            $apps_grps = $u->appsGroups();
            if (count($apps_grps) == 0) {
                echo '<td colspan="2">';
                echo '<em>' . _('No publication') . '</em>';
                echo '</td>';
            } else {
                echo '<td>';
                echo '<table border="0" cellspacing="1" cellpadding="3">';
                foreach ($apps_grps as $agrp_id) {
                    $agrp = $applicationsGroupDB->import($agrp_id);
                    if (is_object($agrp)) {
                        echo '<tr>';
                        echo '<td><a href="appsgroup.php?action=manage&id=' . $agrp->id . '">' . $agrp->name . '</a></td>';
                        echo '</tr>';
                    }
                }
                echo '</table>';
                echo '</td>';
                echo '<td>';
                // in app
                $apps_s = $u->applications();
                if (count($apps_s) == 0) {
                    echo '<em>' . _('No applications in these groups') . '</em>';
                } else {
                    echo '<table border="0" cellspacing="1" cellpadding="3">';
                    foreach ($apps_s as $aaa) {
                        echo '<tr>';
                        echo '<td><img src="media/image/cache.php?id=' . $aaa->getAttribute('id') . '" alt="" title="" /></td>';
                        echo '<td><a href="applications.php?action=manage&id=' . $aaa->getAttribute('id') . '">' . $aaa->getAttribute('name') . '</a></td>';
                        echo '<td style="text-align: center;"><img src="media/image/server-' . $aaa->getAttribute('type') . '.png" width="16" height="16" alt="' . $aaa->getAttribute('type') . '" title="' . $aaa->getAttribute('type') . '" /></td>';
                        echo '</tr>';
                    }
                    echo '</table>';
                }
                echo '</td>';
            }
            echo '<td>';
            $folders = array();
            if (array_key_exists('enable_sharedfolders', $session_settings_defaults) && $session_settings_defaults['enable_sharedfolders'] == 1) {
                $folders = $u->getSharedFolders();
            }
            $profiles = array();
            if (array_key_exists('enable_profiles', $session_settings_defaults) && $session_settings_defaults['enable_profiles'] == 1) {
                $profiles = $u->getProfiles();
            }
            $networkfolder_s = array_merge($folders, $profiles);
            if (count($networkfolder_s) > 0) {
                echo '<table border="0" cellspacing="1" cellpadding="3">';
                foreach ($networkfolder_s as $a_networkfolder) {
                    echo '<tr>';
                    echo '<td>' . $a_networkfolder->prettyName() . '</td>';
                    if (isset($a_networkfolder->name) && $a_networkfolder->name !== '') {
                        $name = $a_networkfolder->name;
                    } else {
                        $name = $a_networkfolder->id;
                    }
                    echo '<td>';
                    if (isset($a_networkfolder->name)) {
                        $page = 'sharedfolders';
                    } else {
                        $page = 'profiles';
                    }
                    echo '<a href="' . $page . '.php?action=manage&id=' . $a_networkfolder->id . '">' . $name . '</a></td>';
                    echo '</tr>';
                }
                echo '</table>';
            }
            echo '</td>';
            echo '<td style="text-align: center;">';
            // server
            $sessionmanagement2 = clone $sessionmanagement;
            $sessionmanagement2->user = $u;
            $can_start_session = $sessionmanagement2->buildServersList();
            if ($can_start_session === true) {
                echo '<img src="media/image/ok.png" alt="" title="" />';
            } else {
                echo '<img src="media/image/cancel.png" alt="" title="" />';
            }
            echo '</td>';
            echo '</tr>';
            $count++;
        }
        echo '</tbody>';
        echo '</table>';
    }
    page_footer();
}
Exemplo n.º 6
0
function show_manage($id)
{
    global $schedules;
    $group = $_SESSION['service']->users_group_info($id);
    if (!is_object($group)) {
        die_error(_('Failed to load User Group'));
    }
    $usergroupdb_rw = usergroupdb_is_writable();
    $policy = $group->getAttribute('policy');
    $policy_rule_enable = 0;
    $policy_rules_disable = 0;
    foreach ($policy as $key => $value) {
        if ($value === true) {
            $policy_rule_enable++;
        } else {
            $policy_rules_disable++;
        }
    }
    $default_policy = $group->getAttribute('default_policy');
    if ($group->published) {
        $status = '<span class="msg_ok">' . _('Enabled') . '</span>';
        $status_change = _('Block');
        $status_change_value = 0;
    } else {
        $status = '<span class="msg_error">' . _('Blocked') . '</span>';
        $status_change = _('Enable');
        $status_change_value = 1;
    }
    if ($group->isDefault() == false) {
        $users = array();
        if ($group->hasAttribute('users')) {
            $users = $group->getAttribute('users');
        }
        $users_partial_list = $group->getAttribute('users_partial_list');
        $usersList = new UsersList($_REQUEST);
        if ($users_partial_list) {
            if ($usersList->is_empty_filter()) {
                $usersList->set_external_result($users, true);
            } else {
                $users2 = $usersList->search($id);
                if (is_null($users2)) {
                    die_error(_('Error while requesting users'), __FILE__, __LINE__);
                }
                $users = array();
                foreach ($users2 as $user) {
                    $users[$user->getAttribute('login')] = $user->getAttribute('displayname');
                }
            }
        }
        asort($users);
        $has_users = count($users) > 0;
        if ($usergroupdb_rw) {
            $users_all = $usersList->search();
            if (is_null($users_all)) {
                $users_all = array();
            }
            $users_available = array();
            foreach ($users_all as $user) {
                if (!array_key_exists($user->getAttribute('login'), $users)) {
                    $users_available[] = $user->getAttribute('login');
                }
            }
        } else {
            $users_available = array();
            $users_all = $users;
            uasort($users_all, "user_cmp");
        }
        $search_form = $usersList->getForm();
    } else {
        $users = array();
        $users_available = array();
        $users_all = array();
        $search_form = null;
    }
    // Default usergroup
    $is_default_group = $group->isDefault();
    // Publications
    $groups_apps = array();
    if ($group->hasAttribute('applicationsgroups')) {
        $groups_apps = $group->getAttribute('applicationsgroups');
    }
    $groups_apps_all = $_SESSION['service']->applications_groups_list();
    $groups_apps_available = array();
    foreach ($groups_apps_all as $group_apps) {
        if (!array_key_exists($group_apps->id, $groups_apps)) {
            $groups_apps_available[] = $group_apps;
        }
    }
    // Scripts
    $groups_scripts_all = $_SESSION['service']->scripts_groups_list($id);
    $all_scripts = $_SESSION['service']->scripts_list();
    $scripts_available = array();
    foreach ($all_scripts as $script) {
        if (!array_key_exists($script->id, $groups_scripts_all)) {
            $scripts_available[] = $script;
        }
    }
    // Servers publications
    $servers_groups_list = $_SESSION['service']->servers_groups_list();
    $servers_groups_published = array();
    if ($group->hasAttribute('serversgroups')) {
        $servers_groups_published = $group->getAttribute('serversgroups');
    }
    $can_manage_scripts = isAuthorized('manageScripts');
    $can_manage_usersgroups = isAuthorized('manageUsersGroups');
    $can_manage_publications = isAuthorized('managePublications');
    $can_manage_sharedfolders = isAuthorized('manageServers');
    $prefs_of_a_group = array();
    $unuse_settings = array();
    $session_prefs = array();
    if ($group->hasAttribute('settings_default')) {
        $prefs = new Preferences_admin(null, false);
        $categs = $group->getAttribute('settings_default');
        $categs2 = array();
        if ($group->hasAttribute('settings')) {
            $categs2 = $group->getAttribute('settings');
        }
        foreach ($categs as $categ => $settings) {
            $session_prefs[$categ] = array();
            $prefs_of_a_group[$categ] = array();
            $unuse_settings[$categ] = array();
            foreach ($settings as $setting_id => $setting_attributes) {
                $p = $prefs->load_element($setting_attributes, 'general_' . $categ);
                $session_prefs[$categ][$setting_id] = $p;
                if (array_key_exists($categ, $categs2) && array_key_exists($setting_id, $categs2[$categ])) {
                    $p2 = clone $p;
                    $p2->content = $categs2[$categ][$setting_id];
                    $prefs_of_a_group[$categ][$setting_id] = $p2;
                } else {
                    $unuse_settings[$categ][$setting_id] = $p;
                }
            }
        }
    }
    page_header();
    echo '<div id="users_div">';
    echo '<h1><a href="?">' . _('User Group Management') . '</a> - ' . $group->name . '</h1>';
    echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="5">';
    echo '<tr class="title">';
    echo '<th>' . _('Description') . '</th>';
    echo '<th>' . _('Status') . '</th>';
    echo '</tr>';
    echo '<tr class="content1">';
    echo '<td>' . $group->description . '</td>';
    echo '<td>' . $status . '</td>';
    echo '</tr>';
    echo '</table>';
    if ($can_manage_usersgroups) {
        echo '<div>';
        echo '<h2>' . _('Settings') . '</h1>';
        if ($group->type == 'static' and $can_manage_usersgroups and $usergroupdb_rw) {
            echo '<form action="actions.php" method="post">';
            if ($is_default_group) {
                echo '<input type="submit" value="' . _('Remove from default') . '"/>';
                echo '<input type="hidden" name="action" value="unset_default" />';
            } else {
                echo '<input type="submit" value="' . _('Define as default') . '"/>';
                echo '<input type="hidden" name="action" value="set_default" />';
            }
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="id" value="' . $group->id . '" />';
            echo '</form>';
            echo '<br/>';
        }
        if ($usergroupdb_rw || $group->type != 'static') {
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this group?') . '\');">';
            echo '<input type="submit" value="' . _('Delete this group') . '"/>';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="checked_groups[]" value="' . $id . '" />';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="hidden" name="published" value="' . $status_change_value . '" />';
            echo '<input type="submit" value="' . $status_change . '"/>';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="text" name="name_group"  value="' . $group->name . '" size="50" /> ';
            echo '<input type="submit" value="' . _('Update the name') . '"/>';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="text" name="description"  value="' . $group->description . '" size="50" /> ';
            echo '<input type="submit" value="' . _('Update the description') . '"/>';
            echo '</form>';
        }
        if ($group->type == 'dynamiccached') {
            echo '<br />';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo ' <select name="schedule">';
            foreach ($schedules as $interval => $text) {
                echo '<option value="' . $interval . '"';
                if ($group->schedule == $interval) {
                    echo ' selected="selected"';
                }
                echo '>' . $text . '</option>';
            }
            echo '</select>';
            echo '<input type="submit" value="' . _('Update the schedule') . '"/>';
            echo '</form>';
        }
        echo '</div>';
        echo '<br/>';
    }
    if (str_startswith($group->type, 'dynamic')) {
        echo '<div>';
        echo '<h2>' . _('Rules') . '</h1>';
        if ($can_manage_usersgroups) {
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify_rules" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
        }
        echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3">';
        echo '<tr class="content1">';
        echo '<th>' . _('Validation type') . '</th>';
        echo '<td><input type="radio" name="validation_type" value="and"';
        if ($group->validation_type == 'and') {
            echo ' checked="checked"';
        }
        echo ' /> ' . _('All') . ' <input type="radio" name="validation_type" value="or"';
        if ($group->validation_type == 'or') {
            echo ' checked="checked"';
        }
        echo ' /> ' . _('At least one') . '</td>';
        echo '</tr>';
        echo '<tr class="content2">';
        echo '<th>' . _('Filters') . '</th>';
        echo '<td>';
        $i = 0;
        $filter_attributes = $userDB->getAttributesList();
        foreach ($filter_attributes as $key1 => $value1) {
            if ($value1 == 'password') {
                unset($filter_attributes[$key1]);
            }
        }
        $filter_types = UserGroup_Rule::$types;
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        $i = 0;
        foreach ($group->rules as $rule) {
            echo '<tr>';
            echo '<td><select name="rules[' . $i . '][attribute]">';
            foreach ($filter_attributes as $filter_attribute) {
                echo '<option value="' . $filter_attribute . '"';
                if ($rule->attribute == $filter_attribute) {
                    echo ' selected="selected"';
                }
                echo '>' . $filter_attribute . '</option>';
            }
            echo '</select></td>';
            echo '<td><select name="rules[' . $i . '][type]">';
            foreach ($filter_types as $filter_type) {
                echo '<option value="' . $filter_type . '"';
                if ($rule->type == $filter_type) {
                    echo ' selected="selected"';
                }
                echo '>' . $filter_type . '</option>';
            }
            echo '</select></td>';
            echo '<td><input type="text" name="rules[' . $i . '][value]" value="' . $rule->value . '" /></td>';
            if ($can_manage_usersgroups) {
                echo '<td>';
                echo '<input';
                if ($i == 0 && count($group->rules) == 1 || $i == count($group->rules)) {
                    echo ' style="display: none;"';
                }
                echo ' type="button" onclick="del_field(this.parentNode.parentNode); return false;" value="-" />';
                echo '<input';
                if ($i + 1 != count($group->rules)) {
                    echo ' style="display: none;"';
                }
                echo ' type="button" onclick="add_field(this.parentNode.parentNode); return false;" value="+" />';
                echo '</td>';
            }
            echo '</tr>';
            $i++;
        }
        echo '</table>';
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '<br />';
        if ($can_manage_usersgroups) {
            echo '<input type="submit" value="' . _('Update rules') . '" />';
            echo '</form>';
        }
        echo '</div>';
        echo '<br />';
    }
    // User list
    if ($group->isDefault() || (count($users_all) > 0 || !$usersList->is_empty_filter() || count($users) > 0)) {
        echo '<div>';
        echo '<h2>' . _('List of users in this group') . '</h2>';
        if (!is_null($search_form)) {
            echo $search_form;
        }
        if ($group->isDefault()) {
            echo _('All available users are in this group.');
        } else {
            echo '<table border="0" cellspacing="1" cellpadding="3">';
            if (count($users) > 0) {
                foreach ($users as $user_login => $user_displayname) {
                    echo '<tr>';
                    echo '<td><a href="users.php?action=manage&id=' . $user_login . '">' . $user_login . '</td>';
                    echo '<td>';
                    if ($usergroupdb_rw && $group->type == 'static' && !$group->isDefault() and $can_manage_usersgroups) {
                        echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this user?') . '\');">';
                        echo '<input type="hidden" name="action" value="del" />';
                        echo '<input type="hidden" name="name" value="User_UserGroup" />';
                        echo '<input type="hidden" name="group" value="' . $id . '" />';
                        echo '<input type="hidden" name="element" value="' . $user_login . '" />';
                        echo '<input type="submit" value="' . _('Delete from this group') . '" />';
                        echo '</form>';
                        echo '</td>';
                    }
                    echo '</tr>';
                }
            }
            if (count($users_available) > 0 && $usergroupdb_rw && $group->type == 'static' and $can_manage_usersgroups) {
                echo '<tr><form action="actions.php" method="post"><td>';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<input type="hidden" name="name" value="User_UserGroup" />';
                echo '<input type="hidden" name="group" value="' . $id . '" />';
                echo '<select name="element">';
                foreach ($users_available as $user) {
                    echo '<option value="' . $user . '" >' . $user . '</option>';
                }
                echo '</select>';
                echo '</td><td><input type="submit" value="' . _('Add to this group') . '" /></td>';
                echo '</form></tr>';
            }
            echo '</table>';
            echo '</div>';
            echo '<br/>';
        }
    }
    // Publications part
    if (count($groups_apps_all) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of publications for this group') . '</h1>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($groups_apps) > 0) {
            foreach ($groups_apps as $groups_app_id => $groups_app_name) {
                echo '<tr>';
                echo '<td><a href="appsgroup.php?action=manage&id=' . $groups_app_id . '">' . $groups_app_name . '</td>';
                if ($can_manage_publications) {
                    echo '<td>';
                    echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this publication?') . '\');">';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="name" value="Publication" />';
                    echo '<input type="hidden" name="group_u" value="' . $id . '" />';
                    echo '<input type="hidden" name="group_a" value="' . $groups_app_id . '" />';
                    echo '<input type="submit" value="' . _('Delete this publication') . '" />';
                    echo '</form>';
                    echo '</td>';
                }
                echo '</tr>';
            }
        }
        if (count($groups_apps_available) > 0 and $can_manage_publications) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="Publication" />';
            echo '<input type="hidden" name="group_u" value="' . $id . '" />';
            echo '<select name="group_a">';
            foreach ($groups_apps_available as $group_apps) {
                echo '<option value="' . $group_apps->id . '" >' . $group_apps->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this publication') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Scripts part
    if (count($groups_scripts_all) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of scripts for this group') . '</h2>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($groups_scripts_all) > 0) {
            foreach ($groups_scripts_all as $script) {
                echo '<tr>';
                echo '<td><a href="script.php?action=manage&amp;id=' . $script["id"] . '">' . $script["name"] . '</a></td>';
                if ($can_manage_scripts) {
                    echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this user from this group?') . '\');">';
                    echo '<input type="hidden" name="name" value="Script_UserGroup" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="group" value="' . $id . '" />';
                    echo '<input type="hidden" name="element" value="' . $script["id"] . '" />';
                    echo '<input type="submit" value="' . _('Delete from this group') . '" />';
                    echo '</form></td>';
                }
                echo '</tr>';
            }
        }
        if (count($scripts_available) > 0 and $can_manage_scripts) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="Script_UserGroup" />';
            echo '<input type="hidden" name="group" value="' . $id . '" />';
            echo '<select name="element">';
            foreach ($scripts_available as $script) {
                echo '<option value="' . $script->id . '" >' . $script->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this script') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Servers publications part
    if (count($servers_groups_list) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of published Server Groups for this group') . '</h1>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($servers_groups_published) > 0) {
            foreach ($servers_groups_published as $servers_group_id => $servers_group_name) {
                echo '<tr>';
                echo '<td><a href="serversgroup.php?action=manage&id=' . $servers_group_id . '">' . $servers_group_name . '</td>';
                if ($can_manage_publications) {
                    echo '<td>';
                    echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this publication?') . '\');">';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="name" value="UsersGroupServersGroup" />';
                    echo '<input type="hidden" name="users_group" value="' . $id . '" />';
                    echo '<input type="hidden" name="servers_group" value="' . $servers_group_id . '" />';
                    echo '<input type="submit" value="' . _('Delete this publication') . '" />';
                    echo '</form>';
                    echo '</td>';
                }
                echo '</tr>';
            }
        }
        if (count($servers_groups_list) > count($servers_groups_published) and $can_manage_publications) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="UsersGroupServersGroup" />';
            echo '<input type="hidden" name="users_group" value="' . $id . '" />';
            echo '<select name="servers_group">';
            foreach ($servers_groups_list as $servers_group) {
                if (array_key_exists($servers_group->id, $servers_groups_published)) {
                    continue;
                }
                echo '<option value="' . $servers_group->id . '" >' . $servers_group->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this publication') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Policy of this group
    echo '<div>';
    echo '<h2>' . _('Policy of this group') . '</h2>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($policy as $key => $value) {
        if ($value === false) {
            continue;
        }
        $extends_from_default = $default_policy[$key] === $value;
        $buffer = $extends_from_default === true ? ' (' . _('extend from default') . ')' : '';
        echo '<tr>';
        echo '<td>' . $key . ' ' . $buffer . '</td>';
        if ($can_manage_usersgroups && !$extends_from_default) {
            echo '<td>';
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this rule?') . '\');">';
            echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="id" value="' . $group->id . '" />';
            echo '<input type="hidden" name="element" value="' . $key . '" />';
            echo '<input type="submit" value="' . _('Delete this rule') . '" />';
            echo '</form>';
            echo '</td>';
        }
        echo '</tr>';
    }
    if ($can_manage_usersgroups && count($policy_rules_disable) > 0 && array_search(false, $policy) !== false) {
        echo '<tr><form action="actions.php" method="post"><td>';
        echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="id" value="' . $group->id . '" />';
        echo '<select name="element">';
        foreach ($policy as $key => $value) {
            if ($value === true) {
                continue;
            }
            echo '<option value="' . $key . '" >' . $key . '</option>';
        }
        echo '</select>';
        echo '</td><td><input type="submit" value="' . _('Add this rule') . '" /></td>';
        echo '</form></tr>';
    }
    echo '</table>';
    echo '</div>';
    echo '<br/>';
    if (is_module_enabled('SharedFolderDB')) {
        $all_sharedfolders = $_SESSION['service']->shared_folders_list();
        if (is_null($all_sharedfolders)) {
            $all_sharedfolders = array();
        }
        if (count($all_sharedfolders) > 0) {
            $available_sharedfolders = array();
            $used_sharedfolders = array();
            if ($group->hasAttribute('shared_folders')) {
                $data = $group->getAttribute('shared_folders');
                $mods_by_share = array();
                foreach ($data as $mode => $used_sharedfolders2) {
                    foreach ($used_sharedfolders2 as $share_id => $share_name) {
                        $used_sharedfolders[$share_id] = $share_name;
                        $mods_by_share[$share_id] = $mode;
                    }
                }
            }
            foreach ($all_sharedfolders as $sharedfolder) {
                if (array_key_exists($sharedfolder->id, $used_sharedfolders)) {
                    continue;
                }
                $available_sharedfolders[] = $sharedfolder;
            }
            echo '<br />';
            echo '<div>';
            echo '<h2>' . _('Shared Folders') . '</h1>';
            echo '<table border="0" cellspacing="1" cellpadding="3">';
            foreach ($used_sharedfolders as $sharedfolder_id => $sharedfolder_name) {
                echo '<tr>';
                echo '<td><a href="sharedfolders.php?action=manage&amp;id=' . $sharedfolder_id . '">' . $sharedfolder_name . '</a></td>';
                echo '<td>' . $mods_by_share[$sharedfolder_id] . '</td>';
                if ($can_manage_sharedfolders) {
                    echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this shared folder access?') . '\');">';
                    echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="sharedfolder_id" value="' . $sharedfolder_id . '" />';
                    echo '<input type="hidden" name="usergroup_id" value="' . $group->id . '" />';
                    echo '<input type="submit" value="' . _('Delete access to this shared folder') . '" />';
                    echo '</form></td>';
                }
                echo '</tr>';
            }
            if (count($available_sharedfolders) > 0 && $can_manage_sharedfolders) {
                echo '<tr><form action="actions.php" method="post"><td>';
                echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<input type="hidden" name="usergroup_id" value="' . $group->id . '" />';
                echo '<select name="sharedfolder_id">';
                foreach ($available_sharedfolders as $sharedfolder) {
                    echo '<option value="' . $sharedfolder->id . '" >' . $sharedfolder->name . '</option>';
                }
                echo '</select>';
                echo '</td><td>';
                echo '<select name="mode">';
                echo '<option value="rw" >' . _('Read-write') . '</option>';
                echo '<option value="ro" >' . _('Read only') . '</option>';
                echo '</select>';
                echo '</td><td><input type="submit" value="' . _('Add access to this shared folder') . '" /></td>';
                echo '</form></tr>';
            }
            echo '</table>';
            echo '</div>';
        }
        echo '<br />';
    }
    echo '<div>';
    // Session Settings configuration
    echo '<h2>';
    echo _('Session Settings configuration');
    echo '</h2>';
    if ($prefs_of_a_group != array()) {
        foreach ($prefs_of_a_group as $container => $prefs_of_a_group_value) {
            echo '<fieldset class="prefssessionusergroup">';
            echo '<legend>' . $prefs->getPrettyName('general_' . $container) . '</legend>';
            echo '<form action="actions.php" method="post">';
            $key_name = 'general';
            echo '<input type="hidden" name="container" value="' . $container . '" />';
            // from admin/functions.inc.php
            $color = 0;
            if (count($prefs_of_a_group_value) != 0) {
                echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3" style="margin-bottom: 10px;">';
                // TODO
                echo '<tr  class="title">';
                echo '<th>' . _('Name') . '</th>';
                echo '<th>' . _('Default value') . '</th>';
                echo '<th>' . _('Value') . '</th>';
                echo '<th>' . _('Action') . '</th>';
                echo '<tr>';
                foreach ($prefs_of_a_group_value as $element_key => $config_element) {
                    echo '<tr class="content' . ($color % 2 + 1) . '">';
                    echo '<td style="width: 250px;">';
                    echo '<span onmouseover="showInfoBulle(\'' . str_replace("'", "&rsquo;", $config_element->description_detailed) . '\'); return false;" onmouseout="hideInfoBulle(); return false;">' . $config_element->label . '</span>';
                    echo '<td>';
                    $default_element = $session_prefs[$container][$config_element->id];
                    $default_element->setFormSeparator('NaN');
                    // it must be different of ___
                    $default_element->setPath(array('key_name' => $key_name, 'container' => $container, 'element_id' => $config_element->id));
                    echo $default_element->toHTML(true);
                    echo '</td>';
                    echo '</td>';
                    echo '<td style="padding: 3px;">';
                    print_element($key_name, $container, $element_key, $config_element);
                    echo '</td>';
                    echo '<td>';
                    echo '<input type="button" value="' . _('Remove this overridden setting') . '" onclick="usergroup_settings_remove(\'' . $group->id . '\',\'' . $container . '\',\'' . $config_element->id . '\'); return false;"/>';
                    echo '</td>';
                    echo '</tr>';
                    $color++;
                }
                // end from
                echo '<tr class="content' . ($color % 2 + 1) . '">';
                echo '<td colspan="3"></td>';
                echo '<td>';
                echo '<input type="hidden" name="name" value="UserGroup_settings" />';
                echo '<input type="hidden" name="container" value="' . $container . '" />';
                echo '<input type="hidden" name="unique_id" value="' . $group->id . '" />';
                echo '<input type="hidden" name="action" value="modify" />';
                echo '<input type="submit" value="' . _('Save settings') . '" />';
                echo '</td>';
                echo '</tr>';
                echo '</table>';
                echo '</form>';
            }
            if ($unuse_settings[$container] != array()) {
                echo '<form action="actions.php" method="post">';
                echo '<input type="hidden" name="name" value="UserGroup_settings" />';
                echo '<input type="hidden" name="container" value="' . $container . '" />';
                echo '<input type="hidden" name="unique_id" value="' . $group->id . '" />';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<select name="element_id">';
                foreach ($unuse_settings[$container] as $setting_name => $setting_content) {
                    echo '<option value="' . $setting_name . '" >' . $setting_content->label . '</option>';
                }
                echo '</select>';
                echo ' ';
                echo '<input type="submit" value="' . _('Add this setting') . '" />';
                echo '</form>';
            }
            echo '</fieldset>';
        }
    }
    echo '</div>';
    // Session Settings configuration
    echo "\n\n\n";
    echo '</div>';
    page_footer();
    die;
}
Exemplo n.º 7
0
function show_default($userDB)
{
    $usersList = new UsersList($_REQUEST);
    $us = $usersList->search();
    $searchDiv = $usersList->getForm();
    $total_us = count($us);
    $users_list_empty = (is_null($us) or count($us) == 0);
    $userdb_rw = $userDB->isWriteable();
    $can_manage_users = isAuthorized('manageUsers');
    page_header();
    echo '<div id="users_div">';
    echo '<h1>' . _('Users') . '</h1>';
    echo $searchDiv;
    echo '<div id="users_list_div">';
    if ($users_list_empty) {
        echo _('No available user') . '<br />';
    } else {
        echo '<table class="main_sub sortable" id="user_list_table" border="0" cellspacing="1" cellpadding="5">';
        echo '<thead>';
        echo '<tr class="title">';
        if ($userdb_rw and $can_manage_users and $total_us > 1) {
            echo '<th class="unsortable"></th>';
        }
        echo '<th>' . _('Login') . '</th>';
        echo '<th>' . _('Display name') . '</th>';
        echo '</tr>';
        echo '</thead>';
        echo '<tbody>';
        $count = 0;
        foreach ($us as $u) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            echo '<tr class="' . $content . '">';
            if ($userdb_rw and $can_manage_users and $total_us > 1) {
                echo '<td><input class="input_checkbox" type="checkbox" name="checked_users[]" value="' . htmlspecialchars($u->getAttribute('login')) . '" /></td>';
            }
            echo '<td><a href="users.php?action=manage&id=' . urlencode($u->getAttribute('login')) . '">';
            echo $u->getAttribute('login');
            echo '</a></td>';
            echo '<td>' . $u->getAttribute('displayname') . '</td>';
            echo '<td><form action="users.php">';
            echo '<input type="submit" value="' . _('Manage') . '"/>';
            echo '<input type="hidden" name="action" value="manage" />';
            echo '<input type="hidden" name="id" value="' . htmlspecialchars($u->getAttribute('login')) . '" />';
            echo '</form></td>';
            if ($userdb_rw and $can_manage_users) {
                echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this user?') . '\');">';
                echo '<input type="submit" value="' . _('Delete') . '"/>';
                echo '<input type="hidden" name="name" value="User" />';
                echo '<input type="hidden" name="action" value="del" />';
                echo '<input type="hidden" name="checked_users[]" value="' . htmlspecialchars($u->getAttribute('login')) . '" />';
                echo '</form></td>';
            }
            echo '</tr>';
        }
        echo '</tbody>';
        if ($userdb_rw and $can_manage_users and $total_us > 1) {
            $content = 'content' . ($count++ % 2 == 0 ? 1 : 2);
            echo '<tfoot>';
            echo '<tr class="' . $content . '">';
            echo '<td colspan="4">';
            echo '<a href="javascript:;" onclick="markAllRows(\'user_list_table\'); return false">' . _('Mark all') . '</a>';
            echo ' / <a href="javascript:;" onclick="unMarkAllRows(\'user_list_table\'); return false">' . _('Unmark all') . '</a>';
            echo '</td>';
            echo '<td>';
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete selected users?') . '\') && updateMassActionsForm(this, \'user_list_table\');;">';
            echo '<input type="hidden" name="name" value="User" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="submit" value="' . _('Delete') . '"/><br />';
            echo '</form>';
            echo '</td>';
            echo '</tr>';
            echo '</tfoot>';
        }
        echo '</table>';
    }
    if ($userdb_rw and $can_manage_users) {
        echo '<h2>' . _('Add') . '</h2>';
        echo '<div id="user_add">';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="name" value="User" />';
        echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="5">';
        $content_color = 1;
        $minimun_attributes = array('login' => _('Login'), 'displayname' => _('Display name'), 'password' => _('Password'));
        foreach ($minimun_attributes as $minimun_attribute => $minimun_attribute_msg) {
            echo '<tr class="content' . $content_color . '">';
            echo '<th>' . $minimun_attribute_msg . '</th>';
            echo '<td><input type="' . $minimun_attribute . '" name="' . $minimun_attribute . '" value="" /></td>';
            echo '</tr>';
            $content_color = $content_color++ % 2 + 1;
        }
        echo '<tr class="content' . $content_color . '">';
        echo '<td colspan="2">';
        echo '<input type="submit" name="add" value="' . _('Add') . '" />';
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</form>';
        echo '</div>';
        echo '<br />';
        echo '<h2>' . _('Populate') . '</h2>';
        echo '<div id="user_populate">';
        echo '<p>';
        echo _('This feature is useful to create default accounts. It is mainly used when you want to test the system quickly. It is not recommended to use those default accounts on a production system because it is very easy to delete them by mistake using this "populate" feature.');
        echo '</p>';
        echo '<form action="actions.php" method="post">';
        echo '<input type="hidden" name="name" value="User" />';
        echo '<input type="hidden" name="action" value="populate" />';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        echo '<tr>';
        echo '<td>' . _('Overwrite existing: ') . '</td>';
        echo '<td><select name="override">';
        echo '<option value="1">' . _('Yes') . '</option>';
        echo '<option value="0" selected="selected">' . _('No') . '</option>';
        echo '</select></td>';
        echo '</tr><tr>';
        echo '<td>' . _('Password management:') . '</td>';
        echo '<td><select name="password" id="password_management_select" onchange="';
        echo '  if( $(\'password_str\').style.visibility== \'hidden\' )';
        echo '    $(\'password_str\').style.visibility = \'\';';
        echo '  else';
        echo '    $(\'password_str\').style.visibility = \'hidden\';';
        echo '">';
        echo '<option value="login">' . _('Same as username') . '</option>';
        echo '<option value="custom">' . _('Custom:') . '</option>';
        echo '</select></td>';
        echo '<td><input type="text" name="password_str" value="" id="password_str" style="visibility: hidden"/></td>';
        echo '</tr><tr>';
        echo '<td></td><td><input type="submit" value="' . _('Populate') . '"/></td>';
        echo '</tr></table>';
        echo '</form>';
        echo '</div>';
    }
    echo '</div>';
    echo '</div>';
    page_footer();
    die;
}
Exemplo n.º 8
0
function show_manage($id)
{
    global $schedules;
    $prefs = Preferences::getInstance();
    if (!$prefs) {
        die_error('get Preferences failed', __FILE__, __LINE__);
    }
    $userGroupDB = UserGroupDB::getInstance();
    $group = $userGroupDB->import($id);
    if (!is_object($group)) {
        die_error(_('Failed to load usergroup'));
    }
    $usergroupdb_rw = $userGroupDB->isWriteable();
    $policy = $group->getPolicy();
    $policy_rule_enable = 0;
    $policy_rules_disable = 0;
    foreach ($policy as $key => $value) {
        if ($value === true) {
            $policy_rule_enable++;
        } else {
            $policy_rules_disable++;
        }
    }
    $buffer = $prefs_policy = $prefs->get('general', 'policy');
    $default_policy = $prefs_policy['default_policy'];
    if (!is_object($group)) {
        die_error('Group "' . $id . '" is not OK', __FILE__, __LINE__);
    }
    if ($group->published) {
        $status = '<span class="msg_ok">' . _('Enabled') . '</span>';
        $status_change = _('Block');
        $status_change_value = 0;
    } else {
        $status = '<span class="msg_error">' . _('Blocked') . '</span>';
        $status_change = _('Enable');
        $status_change_value = 1;
    }
    $userDB = UserDB::getInstance();
    $applicationsGroupDB = ApplicationsGroupDB::getInstance();
    if ($group->isDefault() == false) {
        $users = $group->usersLogin();
        sort($users);
        $has_users = count($users) > 0;
        if ($usergroupdb_rw) {
            $usersList = new UsersList($_REQUEST);
            $users_all = $usersList->search();
            $search_form = $usersList->getForm(array('action' => 'manage', 'id' => $id, 'search_user' => true));
            if (is_null($users_all)) {
                $users_all = array();
            }
            $users_available = array();
            foreach ($users_all as $user) {
                $found = false;
                foreach ($users as $user2) {
                    if ($user2 == $user->getAttribute('login')) {
                        $found = true;
                    }
                }
                if (!$found) {
                    $users_available[] = $user->getAttribute('login');
                }
            }
        } else {
            $users_available = array();
            $users_all = array();
            foreach ($users as $a_login) {
                $users_all[] = $userDB->import($a_login);
            }
            usort($users_all, "user_cmp");
        }
    } else {
        $users = array();
        $users_available = array();
        $users_all = array();
        $search_form = null;
    }
    // Default usergroup
    $is_default_group = $prefs->get('general', 'user_default_group') == $id;
    // Publications
    $groups_apps = array();
    foreach (Abstract_Liaison::load('UsersGroupApplicationsGroup', $id, NULL) as $group_a) {
        $obj = $applicationsGroupDB->import($group_a->group);
        if (is_object($obj)) {
            $groups_apps[] = $obj;
        }
    }
    $groups_apps_all = $applicationsGroupDB->getList();
    $groups_apps_available = array();
    foreach ($groups_apps_all as $group_apps) {
        if (!in_array($group_apps, $groups_apps)) {
            $groups_apps_available[] = $group_apps;
        }
    }
    $can_manage_usersgroups = isAuthorized('manageUsersGroups');
    $can_manage_publications = isAuthorized('managePublications');
    $can_manage_sharedfolders = isAuthorized('manageServers');
    $prefs_to_get_for_a_group = array('session_settings_defaults', 'remote_desktop_settings', 'remote_applications_settings');
    $prefs_of_a_group = array();
    $unuse_settings = array();
    $session_prefs = array();
    foreach ($prefs_to_get_for_a_group as $prefs_to_get_for_a_group_value) {
        $prefs_of_a_group[$prefs_to_get_for_a_group_value] = array();
        $unuse_settings[$prefs_to_get_for_a_group_value] = array();
        $session_prefs[$prefs_to_get_for_a_group_value] = $prefs->getElements('general', $prefs_to_get_for_a_group_value);
        $prefs_of_a_group_unsort = Abstract_UserGroup_Preferences::loadByUserGroupId($group->getUniqueID(), 'general', $prefs_to_get_for_a_group_value);
        foreach ($session_prefs[$prefs_to_get_for_a_group_value] as $k4 => $v4) {
            // we should use the ones from the group ($prefs_of_a_group_unsort) but we can display then if they are in $session_prefs
            if (array_key_exists($k4, $prefs_of_a_group_unsort)) {
                $prefs_of_a_group[$prefs_to_get_for_a_group_value][$k4] = $prefs_of_a_group_unsort[$k4];
            } else {
                $unuse_settings[$prefs_to_get_for_a_group_value][$k4] = $v4;
            }
        }
    }
    page_header();
    echo '<div id="users_div">';
    echo '<h1><a href="?">' . _('User groups management') . '</a> - ' . $group->name . '</h1>';
    echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="5">';
    echo '<tr class="title">';
    echo '<th>' . _('Description') . '</th>';
    echo '<th>' . _('Status') . '</th>';
    echo '</tr>';
    echo '<tr class="content1">';
    echo '<td>' . $group->description . '</td>';
    echo '<td>' . $status . '</td>';
    echo '</tr>';
    echo '</table>';
    if ($can_manage_usersgroups) {
        echo '<div>';
        echo '<h2>' . _('Settings') . '</h1>';
        if ($group->type == 'static' and $can_manage_usersgroups and $usergroupdb_rw) {
            echo '<form action="actions.php" method="post">';
            if ($is_default_group) {
                echo '<input type="submit" value="' . _('Remove from default') . '"/>';
                echo '<input type="hidden" name="action" value="unset_default" />';
            } else {
                echo '<input type="submit" value="' . _('Define as default') . '"/>';
                echo '<input type="hidden" name="action" value="set_default" />';
            }
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="id" value="' . $group->getUniqueID() . '" />';
            echo '</form>';
            echo '<br/>';
        }
        if ($usergroupdb_rw || $group->type != 'static') {
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this group?') . '\');">';
            echo '<input type="submit" value="' . _('Delete this group') . '"/>';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="checked_groups[]" value="' . $id . '" />';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="hidden" name="published" value="' . $status_change_value . '" />';
            echo '<input type="submit" value="' . $status_change . '"/>';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="text" name="name_group"  value="' . $group->name . '" size="50" /> ';
            echo '<input type="submit" value="' . _('Update the name') . '"/>';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="text" name="description"  value="' . $group->description . '" size="50" /> ';
            echo '<input type="submit" value="' . _('Update the description') . '"/>';
            echo '</form>';
        }
        if ($group->type == 'dynamiccached') {
            echo '<br />';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo ' <select name="schedule">';
            foreach ($schedules as $interval => $text) {
                echo '<option value="' . $interval . '"';
                if ($group->schedule == $interval) {
                    echo ' selected="selected"';
                }
                echo '>' . $text . '</option>';
            }
            echo '</select>';
            echo '<input type="submit" value="' . _('Update the schedule') . '"/>';
            echo '</form>';
        }
        echo '</div>';
        echo '<br/>';
    }
    if (str_startswith($group->type, 'dynamic')) {
        echo '<div>';
        echo '<h2>' . _('Rules') . '</h1>';
        if ($can_manage_usersgroups) {
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify_rules" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
        }
        echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3">';
        echo '<tr class="content1">';
        echo '<th>' . _('Validation type') . '</th>';
        echo '<td><input type="radio" name="validation_type" value="and"';
        if ($group->validation_type == 'and') {
            echo ' checked="checked"';
        }
        echo ' /> ' . _('All') . ' <input type="radio" name="validation_type" value="or"';
        if ($group->validation_type == 'or') {
            echo ' checked="checked"';
        }
        echo ' /> ' . _('At least one') . '</td>';
        echo '</tr>';
        echo '<tr class="content2">';
        echo '<th>' . _('Filters') . '</th>';
        echo '<td>';
        $i = 0;
        $filter_attributes = $userDB->getAttributesList();
        foreach ($filter_attributes as $key1 => $value1) {
            if ($value1 == 'password') {
                unset($filter_attributes[$key1]);
            }
        }
        $filter_types = UserGroup_Rule::$types;
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        $i = 0;
        foreach ($group->rules as $rule) {
            echo '<tr>';
            echo '<td><select name="rules[' . $i . '][attribute]">';
            foreach ($filter_attributes as $filter_attribute) {
                echo '<option value="' . $filter_attribute . '"';
                if ($rule->attribute == $filter_attribute) {
                    echo ' selected="selected"';
                }
                echo '>' . $filter_attribute . '</option>';
            }
            echo '</select></td>';
            echo '<td><select name="rules[' . $i . '][type]">';
            foreach ($filter_types as $filter_type) {
                echo '<option value="' . $filter_type . '"';
                if ($rule->type == $filter_type) {
                    echo ' selected="selected"';
                }
                echo '>' . $filter_type . '</option>';
            }
            echo '</select></td>';
            echo '<td><input type="text" name="rules[' . $i . '][value]" value="' . $rule->value . '" /></td>';
            if ($can_manage_usersgroups) {
                echo '<td>';
                echo '<input';
                if ($i == 0 && count($group->rules) == 1 || $i == count($group->rules)) {
                    echo ' style="display: none;"';
                }
                echo ' type="button" onclick="del_field(this.parentNode.parentNode); return false;" value="-" />';
                echo '<input';
                if ($i + 1 != count($group->rules)) {
                    echo ' style="display: none;"';
                }
                echo ' type="button" onclick="add_field(this.parentNode.parentNode); return false;" value="+" />';
                echo '</td>';
            }
            echo '</tr>';
            $i++;
        }
        echo '</table>';
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '<br />';
        if ($can_manage_usersgroups) {
            echo '<input type="submit" value="' . _('Update rules') . '" />';
            echo '</form>';
        }
        echo '</div>';
        echo '<br />';
    }
    // Users list
    if (count($users_all) > 0 || count($users) > 0 || $group->isDefault()) {
        echo '<div>';
        echo '<h2>' . _('List of users in this group') . '</h2>';
        if ($group->isDefault()) {
            echo _('All available users are in this group.');
        } else {
            echo '<table border="0" cellspacing="1" cellpadding="3">';
            if (count($users) > 0) {
                foreach ($users as $user) {
                    echo '<tr>';
                    echo '<td><a href="users.php?action=manage&id=' . $user . '">' . $user . '</td>';
                    echo '<td>';
                    if ($usergroupdb_rw && $group->type == 'static' && !$group->isDefault() and $can_manage_usersgroups) {
                        echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this user?') . '\');">';
                        echo '<input type="hidden" name="action" value="del" />';
                        echo '<input type="hidden" name="name" value="User_UserGroup" />';
                        echo '<input type="hidden" name="group" value="' . $id . '" />';
                        echo '<input type="hidden" name="element" value="' . $user . '" />';
                        echo '<input type="submit" value="' . _('Delete from this group') . '" />';
                        echo '</form>';
                        echo '</td>';
                    }
                    echo '</tr>';
                }
            }
            if (count($users_available) > 0 && $usergroupdb_rw && $group->type == 'static' and $can_manage_usersgroups) {
                echo '<tr><form action="actions.php" method="post"><td>';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<input type="hidden" name="name" value="User_UserGroup" />';
                echo '<input type="hidden" name="group" value="' . $id . '" />';
                echo '<select name="element">';
                foreach ($users_available as $user) {
                    echo '<option value="' . $user . '" >' . $user . '</option>';
                }
                echo '</select>';
                echo '</td><td><input type="submit" value="' . _('Add to this group') . '" /></td>';
                echo '</form></tr>';
            }
            echo '</table>';
            if ($usergroupdb_rw && $group->type == 'static' and $can_manage_usersgroups) {
                echo '<br/>';
                echo $search_form;
            }
            echo '</div>';
            echo '<br/>';
        }
    }
    // Publications part
    if (count($groups_apps_all) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of publications for this group') . '</h1>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($groups_apps) > 0) {
            foreach ($groups_apps as $groups_app) {
                echo '<tr>';
                echo '<td><a href="appsgroup.php?action=manage&id=' . $groups_app->id . '">' . $groups_app->name . '</td>';
                if ($can_manage_publications) {
                    echo '<td>';
                    echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this publication?') . '\');">';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="name" value="Publication" />';
                    echo '<input type="hidden" name="group_u" value="' . $id . '" />';
                    echo '<input type="hidden" name="group_a" value="' . $groups_app->id . '" />';
                    echo '<input type="submit" value="' . _('Delete this publication') . '" />';
                    echo '</form>';
                    echo '</td>';
                }
                echo '</tr>';
            }
        }
        if (count($groups_apps_available) > 0 and $can_manage_publications) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="Publication" />';
            echo '<input type="hidden" name="group_u" value="' . $id . '" />';
            echo '<select name="group_a">';
            foreach ($groups_apps_available as $group_apps) {
                echo '<option value="' . $group_apps->id . '" >' . $group_apps->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this publication') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Policy of this group
    echo '<div>';
    echo '<h2>' . _('Policy of this group') . '</h2>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($policy as $key => $value) {
        if ($value === false) {
            continue;
        }
        $extends_from_default = in_array($key, $default_policy);
        $buffer = $extends_from_default === true ? ' (' . _('extend from default') . ')' : '';
        echo '<tr>';
        echo '<td>' . $key . ' ' . $buffer . '</td>';
        if ($can_manage_usersgroups && !$extends_from_default) {
            echo '<td>';
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this rule?') . '\');">';
            echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="id" value="' . $group->getUniqueID() . '" />';
            echo '<input type="hidden" name="element" value="' . $key . '" />';
            echo '<input type="submit" value="' . _('Delete this rule') . '" />';
            echo '</form>';
            echo '</td>';
        }
        echo '</tr>';
    }
    if ($can_manage_usersgroups && count($policy_rules_disable) > 0 && array_search(false, $policy) !== false) {
        echo '<tr><form action="actions.php" method="post"><td>';
        echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="id" value="' . $group->getUniqueID() . '" />';
        echo '<select name="element">';
        foreach ($policy as $key => $value) {
            if ($value === true) {
                continue;
            }
            echo '<option value="' . $key . '" >' . $key . '</option>';
        }
        echo '</select>';
        echo '</td><td><input type="submit" value="' . _('Add this rule') . '" /></td>';
        echo '</form></tr>';
    }
    echo '</table>';
    echo '</div>';
    echo '<br/>';
    if (Preferences::moduleIsEnabled('SharedFolderDB')) {
        $sharedfolderdb = SharedFolderDB::getInstance();
        $all_sharedfolders = $sharedfolderdb->getList();
        if (count($all_sharedfolders) > 0) {
            $available_sharedfolders = array();
            $used_sharedfolders = $sharedfolderdb->importFromUsergroup($group->getUniqueID());
            foreach ($all_sharedfolders as $sharedfolder) {
                if (in_array($sharedfolder->id, array_keys($used_sharedfolders))) {
                    continue;
                }
                $available_sharedfolders[] = $sharedfolder;
            }
            echo '<br />';
            echo '<div>';
            echo '<h2>' . _('Shared folders') . '</h1>';
            echo '<table border="0" cellspacing="1" cellpadding="3">';
            foreach ($used_sharedfolders as $sharedfolder) {
                echo '<tr>';
                echo '<td><a href="sharedfolders.php?action=manage&amp;id=' . $sharedfolder->id . '">' . $sharedfolder->name . '</a></td>';
                if ($can_manage_sharedfolders) {
                    echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this shared folder access?') . '\');">';
                    echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="sharedfolder_id" value="' . $sharedfolder->id . '" />';
                    echo '<input type="hidden" name="usergroup_id" value="' . $group->getUniqueID() . '" />';
                    echo '<input type="submit" value="' . _('Delete access to this shared folder') . '" />';
                    echo '</form></td>';
                }
                echo '</tr>';
            }
            if (count($available_sharedfolders) > 0 && $can_manage_sharedfolders) {
                echo '<tr><form action="actions.php" method="post"><td>';
                echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<input type="hidden" name="usergroup_id" value="' . $group->getUniqueID() . '" />';
                echo '<select name="sharedfolder_id">';
                foreach ($available_sharedfolders as $sharedfolder) {
                    echo '<option value="' . $sharedfolder->id . '" >' . $sharedfolder->name . '</option>';
                }
                echo '</select>';
                echo '</td><td><input type="submit" value="' . _('Add access to this shared folder') . '" /></td>';
                echo '</form></tr>';
            }
            echo '</table>';
            echo '</div>';
        }
        echo '<br />';
    }
    echo '<div>';
    // Session settings configuration
    echo '<h2>';
    echo _('Session settings configuration');
    echo '</h2>';
    if ($prefs_of_a_group != array()) {
        foreach ($prefs_of_a_group as $container => $prefs_of_a_group_value) {
            echo '<fieldset class="prefssessionusergroup">';
            echo '<legend>' . $prefs->getPrettyName($container) . '</legend>';
            echo '<form action="actions.php" method="post">';
            $key_name = 'general';
            echo '<input type="hidden" name="container" value="' . $container . '" />';
            // from admin/functions.inc.php
            $color = 0;
            if (count($prefs_of_a_group_value) != 0) {
                echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3" style="margin-bottom: 10px;">';
                // TODO
                echo '<tr  class="title">';
                echo '<th>' . _('Name') . '</th>';
                echo '<th>' . _('Default value') . '</th>';
                echo '<th>' . _('Value') . '</th>';
                echo '<th>' . _('Action') . '</th>';
                echo '<tr>';
                foreach ($prefs_of_a_group_value as $element_key => $usersgroup_preferences) {
                    $config_element = $usersgroup_preferences->toConfigElement();
                    echo '<tr class="content' . ($color % 2 + 1) . '">';
                    echo '<td style="width: 250px;">';
                    echo '<span onmouseover="showInfoBulle(\'' . str_replace("'", "&rsquo;", $config_element->description_detailed) . '\'); return false;" onmouseout="hideInfoBulle(); return false;">' . $config_element->label . '</span>';
                    echo '<td>';
                    $default_element = $session_prefs[$container][$config_element->id];
                    $default_element->setFormSeparator('NaN');
                    // it must be different of ___
                    $default_element->setPath(array('key_name' => $key_name, 'container' => $container, 'element_id' => $config_element->id));
                    echo $default_element->toHTML(true);
                    echo '</td>';
                    echo '</td>';
                    echo '<td style="padding: 3px;">';
                    print_element($key_name, $container, $element_key, $config_element);
                    echo '</td>';
                    echo '<td>';
                    echo '<input type="button" value="' . _('Remove this overriden setting') . '" onclick="usergroup_settings_remove(\'' . $group->getUniqueID() . '\',\'' . $container . '\',\'' . $config_element->id . '\'); return false;"/>';
                    echo '</td>';
                    echo '</tr>';
                    $color++;
                }
                // end from
                echo '<tr class="content' . ($color % 2 + 1) . '">';
                echo '<td colspan="3"></td>';
                echo '<td>';
                echo '<input type="hidden" name="name" value="UserGroup_settings" />';
                echo '<input type="hidden" name="container" value="' . $container . '" />';
                echo '<input type="hidden" name="unique_id" value="' . $group->getUniqueID() . '" />';
                echo '<input type="hidden" name="action" value="modify" />';
                echo '<input type="submit" value="' . _('Save settings') . '" />';
                echo '</td>';
                echo '</tr>';
                echo '</table>';
                echo '</form>';
            }
            if ($unuse_settings[$container] != array()) {
                echo '<form action="actions.php" method="post">';
                echo '<input type="hidden" name="name" value="UserGroup_settings" />';
                echo '<input type="hidden" name="container" value="' . $container . '" />';
                echo '<input type="hidden" name="unique_id" value="' . $group->getUniqueID() . '" />';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<select name="element_id">';
                foreach ($unuse_settings[$container] as $setting_name => $setting_content) {
                    echo '<option value="' . $setting_name . '" >' . $setting_content->label . '</option>';
                }
                echo '</select>';
                echo ' ';
                echo '<input type="submit" value="' . _('Add this setting') . '" />';
                echo '</form>';
            }
            echo '</fieldset>';
        }
    }
    echo '</div>';
    // Session settings configuration
    echo "\n\n\n";
    echo '</div>';
    page_footer();
    die;
}