* Copyright 2010 (c) Franck Villaume - Capgemini
* http://fusionforge.org
*
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
* FusionForge 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 FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
require_once $gfwww.'admin/admin_utils.php';
+// user must be forge admin to proceed
session_require_global_perm ('forge_admin');
-
+
$HTML->header(array('title'=>_('User List')));
-echo '<h1>' . _('User List') . '</h1>';
/**
* performAction() - Updates the indicated user status
* @param string $user_id - the user id to act upon
*/
function performAction($newStatus, $statusString, $user_id) {
- $u =& user_get_object($user_id);
+ $u = user_get_object($user_id);
if (!$u || !is_object($u)) {
exit_error(_('Could Not Get User'),'home');
} elseif ($u->isError()) {
exit_error($u->getErrorMessage(),'home');
}
if($newStatus=="D") {
+ if(!$u->setStatus($newStatus)) {
+ exit_error($u->getErrorMessage(),'home');
+ }
if(!$u->delete(true)) {
exit_error($u->getErrorMessage(),'home');
}
}
}
- echo "<div class='feedback'>" .sprintf(_('User updated to %1$s status'), $statusString)."</div>";
+ echo '<p class="feedback">' .sprintf(_('User updated to %1$s status'), $statusString)."</p>";
}
-function show_users_list ($users) {
+function show_users_list ($users, $filter='') {
+ if (!count($users)) {
+ echo '<p>'. _('No such users found') .'</p>';
+ return;
+ }
+
echo '<p>' ._('Key') .':
<span class="active">'._('Active'). '</span>
<span class="deleted">' ._('Deleted') .'</span>
' ',
' ',
' ',
+ ' ',
' '
);
'/admin/userlist.php?sortorder=user_name',
'/admin/userlist.php?sortorder=user_name',
'/admin/userlist.php?sortorder=user_name',
+ '/admin/userlist.php?sortorder=user_name',
'/admin/userlist.php?sortorder=user_name'
);
echo '<td width="15%" style="text-align:center">';
echo ($u->getAddDate() ? date(_('Y-m-d H:i'), $u->getAddDate()) : '-');
echo '</td>';
- echo '<td width="15%" style="text-align:center">'.util_make_link ('/developer/?form_dev='.$u->getID(),_('[DevProfile]')).'</td>';
- echo '<td width="15%" style="text-align:center">'.util_make_link ('/admin/userlist.php?action=activate&user_id='.$u->getID(),_('[Activate]')).'</td>';
- echo '<td width="15%" style="text-align:center">'.util_make_link ('/admin/userlist.php?action=delete&user_id='.$u->getID(),_('[Delete]')).'</td>';
- echo '<td width="15%" style="text-align:center">'.util_make_link ('/admin/userlist.php?action=suspend&user_id='.$u->getID(),_('[Suspend]')).'</td>';
+ echo '<td width="12%" style="text-align:center">'.util_make_link ('/developer/?form_dev='.$u->getID(),_('[DevProfile]')).'</td>';
+ echo '<td width="12%" style="text-align:center">'.util_make_link ('/admin/userlist.php?action=activate&user_id='.$u->getID().$filter,_('[Activate]')).'</td>';
+ echo '<td width="12%" style="text-align:center">'.util_make_link ('/admin/userlist.php?action=delete&user_id='.$u->getID().$filter,_('[Delete]')).'</td>';
+ echo '<td width="12%" style="text-align:center">'.util_make_link ('/admin/userlist.php?action=suspend&user_id='.$u->getID().$filter,_('[Suspend]')).'</td>';
+ echo '<td width="12%" style="text-align:center">'.util_make_link ('/admin/passedit.php?user_id='.$u->getID().$filter,_('[Change PW]')).'</td>';
echo '</tr>';
$count ++;
}
-
+
echo $GLOBALS['HTML']->listTableBottom();
}
if ($action=='delete') {
performAction('D', "DELETED", $user_id);
- //plugin webcal
- //del webcal user
- plugin_hook('del_cal_user',$user_id);
} else if ($action=='activate') {
performAction('A', "ACTIVE", $user_id);
- //plugin webcal
- //create webcal user
- plugin_hook('add_cal_user',$user_id);
} else if ($action=='suspend') {
performAction('S', "SUSPENDED", $user_id);
}
// Show list of users
-print "<p>" ._('User list for group:');
+print "<p>" ._('User list for project: ');
if (!$group_id) {
$user_name_search = getStringFromRequest('user_name_search');
$res = db_query_params('SELECT user_id FROM users ORDER BY '.$sortorder,
array ());
}
- show_users_list (user_get_objects(util_result_column_to_array($res,0)));
+ $filter='';
+ if (in_array($status,array('D','A','S','P'))) {
+ $filter = '&status='.$status;
+ }
+ show_users_list (user_get_objects(util_result_column_to_array($res,0)),$filter);
} else {
/*
- Show list for one group
+ Show list for one project
*/
$project = group_get_object($group_id) ;
print "<strong>" . $project->getPublicName() . "</strong></p>";