diff --git a/checkin_notes b/checkin_notes index 27b251df18..3559b4f06f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -10561,6 +10561,7 @@ David 7 Nov 2007 bug_report_form.php (removed) create_account_action.php sample_index.php + team_admins.php (new) team_delta.php team_display.php team_edit_action.php diff --git a/html/user/team_admins.php b/html/user/team_admins.php new file mode 100644 index 0000000000..db4b6bf6b7 --- /dev/null +++ b/html/user/team_admins.php @@ -0,0 +1,110 @@ +create_time); + echo " + ".user_links($user)." + $date + + "; + show_button("team_admins.php?teamid=$admin->teamid&action=remove&userid=$user->id", "Remove"); + echo " + "; +} + +function show_admins($teamid) { + page_head("Add or remove Team Admins"); + echo " + You can select team members as 'Team Admins'. + Team Admins can: + + Team Admins cannot: + + If a Team Admin quits the team, they cease to be a Team Admin. +

+ We recommend that you select only people + you know and trust very well as Team Admins. + "; + $admins = BoincTeamAdmin::enum("teamid=$teamid"); + start_table(); + if (count($admins)==0) { + row1("No admins"); + } else { + row1("Current Team Admins", 3); + table_header("Name", "Became Team Admin on", ""); + foreach ($admins as $admin) { + $user = BoincUser::lookup_id($admin->userid); + show_admin($user, $admin); + } + } + end_table(); + + echo " +

+

+ + + "; + start_table(); + row1("Add Team Admin"); + row2("Email address of team member:", ""); + row2("", ""); + end_table(); + echo "
"; + + page_tail(); +} + +function remove_admin($team) { + $userid = get_int('userid'); + $ret = BoincTeamAdmin::delete("teamid=$team->id and userid=$userid"); + if (!$ret) { + error_page("failed to remove admin"); + } +} + +function add_admin($team) { + $email_addr = get_str('email_addr'); + $user = BoincUser::lookup("email_addr='$email_addr'"); + if (!$user) error_page("no such user"); + if ($user->teamid != $team->id) error_page("User is not member of team"); + if (is_admin($user, $team)) { + error_page("$email_addr is already an admin of $team->name"); + } + $now = time(); + $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ($team->id, $user->id, $now)"); + if (!$ret) error_page("Couldn't add admin"); +} + +$user = get_logged_in_user(); +$teamid = get_int('teamid'); +$team = BoincTeam::lookup_id($teamid); +if (!$team) error_page("No such team"); +require_founder_login($user, $team); + +$action = get_str('action', true); +switch($action) { +case 'remove': + remove_admin($team); + Header("Location: team_admins.php?teamid=$teamid"); + exit(); +case 'add': + add_admin($team); + Header("Location: team_admins.php?teamid=$teamid"); + exit(); +} +show_admins($teamid); + +?>