Cleanup the roles page so it's not so vertically abundant.

This commit is contained in:
dave 2010-08-19 22:56:31 +00:00
parent 1427900873
commit 7b454e322a
2 changed files with 36 additions and 25 deletions

View File

@ -91,7 +91,7 @@ case 'save':
<form class="editor" id="orgform">
<table width="90%">
<tr><td style="text-align: left" colspan="2"><b>Organization</b'><hr /></td></tr>
<tr><td style="text-align: left" colspan="2"><b>Organization</b><hr /></td></tr>
<tr><?=user_edit_item($u, 'Organization Name', 'organization')?></tr>
<tr><?=user_edit_item($u, 'Phone', 'phonework')?></tr>
<tr><?=user_edit_item($u, 'Fax', 'fax')?></tr>

View File

@ -70,7 +70,7 @@ case 'delete':
case 'remove':
/* Like delete, only we're only deleting a role, not the whole account */
happy_("{$roles[$role]['name']} role successfully removed.");
echo error(i18n("Permanently Removed"));
echo i18n("Removed");
user_delete($u, $role);
exit;
@ -83,7 +83,7 @@ case 'remove':
$u['roles'][$role]['active'] = 'yes';
user_save($u);
happy_("{$roles[$role]['name']} role for %1 successfully activated",array($config['FAIRYEAR']));
echo happy(i18n("Active"));
echo i18n("Active");
exit;
case 'deactivate':
@ -95,7 +95,7 @@ case 'remove':
$u['roles'][$role]['active'] = 'no';
user_save($u);
happy_("{$roles[$role]['name']} role for %1 successfully deactivated",array($config['FAIRYEAR']));
echo error(i18n("Deactivated"));
echo i18n("Deactivated");
exit;
}
@ -108,73 +108,84 @@ case 'remove':
echo '<li>'.i18n("An <b>Active Role</b> indicates you would like to participate in the %1 %2 as that role (Judge, Volunteer, etc.)",array($config['FAIRYEAR'],$config['fairname']));
echo '</li><li>'.i18n("A <b>Deactivated Role</b> indicates you cannot participate in the deactivated roles this year, but would like remain on the mailing lists for future years. You can activate your deactivated role at any time.");
echo '</li><li>'.i18n("The <b>Remove Role</b> button completely deletes the role from your account. You will not receive future emails for the removed role. This action cannot be undone.");
echo '</li><li>'.i18n("The <b>Delete Entire Account</b> button at the bottom of the page completely deletes your entire account. You will not receive any future email for any roles. It completely removes you from the system. This action cannot be undone.");
echo '</ul>';
?>
<script type="text/javascript">
function activate(role)
{
$("#status_"+role).load("<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=activate&users_id=<?=$u['id']?>&role="+role,$('#rolesform').serializeArray());
$("#rolestatus_"+role).load("<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=activate&users_id=<?=$u['id']?>&role="+role,$('#rolesform').serializeArray());
$("#activate_"+role).attr('disabled', 'disabled');
$("#deactivate_"+role).removeAttr('disabled');
$("#remove_"+role).removeAttr('disabled');
$("#rolestatus_"+role).removeClass('notice');
$("#rolestatus_"+role).addClass('happy');
return false;
}
function deactivate(role)
{
$("#status_"+role).load("<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=deactivate&users_id=<?=$u['id']?>&role="+role,$('#rolesform').serializeArray());
$("#rolestatus_"+role).load("<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=deactivate&users_id=<?=$u['id']?>&role="+role,$('#rolesform').serializeArray());
$("#activate_"+role).removeAttr('disabled');
$("#deactivate_"+role).attr('disabled', 'disabled');
$("#remove_"+role).attr('disabled', 'disabled');
$("#rolestatus_"+role).removeClass('happy');
$("#rolestatus_"+role).addClass('notice');
return false;
}
function remove(role)
{
var con = confirmClick("<?=i18n("Are you sure you want to remove this role from your account?\\nThis action cannot be undone.")?>");
if(con == true) {
$("#status_"+role).load("<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=remove&users_id=<?=$u['id']?>&role="+role,$('#rolesform').serializeArray());
$("#rolestatus_"+role).load("<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=remove&users_id=<?=$u['id']?>&role="+role,$('#rolesform').serializeArray());
$("#activate_"+role).attr('disabled', 'disabled');
$("#deactivate_"+role).attr('disabled', 'disabled');
$("#remove_"+role).attr('disabled', 'disabled');
$("#rolestatus_"+role).removeClass('happy');
$("#rolestatus_"+role).addClass('notice');
}
}
</script>
<form id="rolesform">
<form class="editor" id="rolesform">
<table width="90%">
<?
foreach(array_keys($u['roles']) as $r) {
echo '<h3>'.i18n("Role: {$roles[$r]['name']}").'</h3>';
echo "<div id=\"status_$r\">";
if($u['roles'][$r]['active'] == 'yes') {
echo happy(i18n('Active'));
$cs = i18n('Active');
$cl = 'happy';
$a = 'disabled="disabled"';
$d = '';
} else {
echo notice(i18n('Deactivated'));
$cs = i18n('Deactivated');
$cl = 'notice';
$a = '';
$d = 'disabled="disabled"';
}
?>
</div>
<tr>
<td><b><?=i18n($roles[$r]['name'])?></b></td>
<td><div class="<?=$cl?>" id="rolestatus_<?=$r?>"><?=$cs?></div></td>
<td>
<table><tr><td>
<input style="width: 200px;" id="activate_<?=$r?>" <?=$a?> onclick="activate('<?=$r?>');return false;" type="submit" value="<?=i18n("Activate Role")?>">
</td><td>
<input style="width: 200px;" id="deactivate_<?=$r?>"<?=$d?> onclick="deactivate('<?=$r?>');return false;" type="submit" value="<?=i18n("Deactivate Role")?>">
</td><td>
<input style="width: 200px;" id="remove_<?=$r?>"<?=$d?> onclick="remove('<?=$r?>');return false;" type="submit" value="<?=i18n("Remove Role")?>">
<button style="width: 100px;" id="activate_<?=$r?>" <?=$a?> onclick="activate('<?=$r?>');return false;" ><?=i18n("Activate")?></button>
<button style="width: 100px;" id="deactivate_<?=$r?>" <?=$d?> onclick="deactivate('<?=$r?>');return false;" ><?=i18n("Deactivate")?></button>
<button style="width: 100px;" id="remove_<?=$r?>" <?=$d?> onclick="remove('<?=$r?>');return false;" ><?=i18n("Remove")?></button>
</td></tr></table>
<br />
<hr />
</td></tr>
<?
}
?>
</table>
</form>
<br/><hr/><br/>
<?=i18n("The <b>Delete Entire Account</b> button completely deletes your entire account. You will not receive any future email for any roles. It completely removes you from the system. This action cannot be undone.")?>
<br/>
<form method="post" action="<?=$config['SFIABDIRECTORY']?>/user_roles.php?action=delete&users_id=<?=$u['id']?>" >
<input style="width: 300px;" onclick="return confirmClick('<?=i18n("Are you sure you want to completely delete your account?\\nDoing so will remove you from our mailing list for future years and you will never hear from us again.\\nThis action cannot be undone.")?>');"
type="submit" value="<?=i18n("Delete Entire Account")?>">