- Make the delete button work. It's just a shortcut to delete the entire user

now, roles can be individually activated/deactivated/deleted in the user
  editor window.
- Make an edit button, in case someone can't figure out how to click on the name
- Add the role active status for each type (we could make this a toggle button
  too, for fast editting)
This commit is contained in:
dave 2009-01-26 07:27:07 +00:00
parent eb87f5b6f1
commit e045e016df

View File

@ -27,6 +27,24 @@
user_auth_required('committee', 'admin');
include "judges.inc.php";
$show_types = $_GET['show_types'];
if(user_valid_type($show_types) == false) $show_types = array('judge');
$show_complete = ($_GET['show_complete'] == 'yes') ? 'yes' : 'no';
$show_year = ($_GET['show_year'] == 'all') ? 'all' : 'current';
$uid = intval($_GET['uid']);
if($_GET['action']=='remove') {
if(!$uid) {
echo "Invalid uid for delete";
exit;
}
user_delete($uid);
message_push(happy(i18n('User deleted.')));
}
send_header("User Editor",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php')
@ -36,10 +54,7 @@
function openeditor(id)
{
if(id)
currentid=id;
/* else
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;*/
if(id) currentid=id;
window.open("user_editor_window.php?id="+currentid,"User Editor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
return false;
@ -61,25 +76,6 @@ function toggleoptions()
<?
$show_types = $_GET['show_types'];
if(user_valid_type($show_types) == false) {
$show_types = array('judge');
}
$show_complete = ($_GET['show_complete'] == 'yes') ? 'yes' : 'no';
$show_year = ($_GET['show_year'] == 'all') ? 'all' : 'current';
$uid = intval($_GET['uid']);
if($_GET['action']=='remove') {
if(!$uid) {
echo "Invalid uid for delete";
exit;
}
user_delete($uid);
}
echo "<div class=\"notice\">";
echo "<a id=\"optionstext\" href=\"javascript:toggleoptions()\">- ".i18n('Hide Display Options')."</a>";
@ -167,9 +163,10 @@ function toggleoptions()
echo mysql_error();
echo "<tr>";
echo " <th>".i18n("Name")."</th>";
echo " <th>".i18n("Type(s)")."</th>";
echo " <th>".i18n("Email Address")."</th>";
echo " <th>".i18n("Year")."</th>";
echo " <th>".i18n("Type(s)")."</th>";
echo " <th>".i18n("Active")."</th>";
echo " <th>".i18n("Complete")."</th>";
echo " <th>".i18n("Actions")."</th>";
echo "</tr>";
@ -179,11 +176,6 @@ function toggleoptions()
{
echo "<tr><td>";
echo "<a href=\"#\" onclick=\"return openeditor({$r['id']})\">{$r['firstname']} {$r['lastname']}</a>";
echo "</td><td>";
$types = split(',', $r['types']);
foreach($types as $t) {
echo $user_what[$t]."<br />";
}
echo "</td>";
echo "<td>{$r['email']}</td>";
@ -191,8 +183,22 @@ function toggleoptions()
echo "<td>{$r['year']}</td>";
echo "<td>";
foreach($types as $t) {
$types = split(',', $r['types']);
foreach($types as $t) echo $user_what[$t]."<br />";
echo "</td>";
echo "<td>";
foreach($types as $t) {
if($r["{$t}_active"] == 'yes') {
echo "<div class=\"happy\" align=\"center\">".i18n("yes")."</div>";
} else {
echo "<div class=\"error\" align=\"center\">".i18n("no")."</div>";
}
}
echo "</td>";
echo "<td>";
foreach($types as $t) {
if($r["{$t}_complete"] == 'yes') {
echo "<div class=\"happy\" align=\"center\">".i18n("yes")."</div>";
$completeyes++;
@ -203,13 +209,14 @@ function toggleoptions()
}
echo "</td>";
echo "<td align=\"center\">";
echo "<a onclick=\"return confirmClick('Are you sure you want to deactivate this judge from this years fair?')\" href=\"judges_judges.php?action=remove&remove=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "<a href=\"#\" onclick=\"return openeditor({$r['id']})\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\"></a>&nbsp;";
echo "<a onclick=\"return confirmClick('Are you sure you completely delete this user?')\" href=\"user_list.php?action=remove&uid={$r['id']}\"><img border=0 src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.{$config['icon_extension']}\"></a>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo i18n("Note: Deleting judges from this list only deactivates the judge for this year's fair. To completely delete a judge, use the 'Manage Judges' page");
echo i18n("Note: Deleting users from this list is a permanent operation and cannot be undone. Consider editting the user and deactivating or deleting roles in their account instead.");
echo "<br />";
echo "<br />";
echo "$num ".i18n("people listed.");