User web: fix an annoyance when team founder transfer is requested and the requester leaves the team.

NOTE: DB UPDATE REQUIRED.

svn path=/trunk/boinc/; revision=13673
This commit is contained in:
Rytis Slatkevičius 2007-09-26 15:46:54 +00:00
parent 38d2d3a226
commit 4b8aeabf91
6 changed files with 51 additions and 18 deletions

View File

@ -8785,3 +8785,18 @@ Charlie 25 Sep 2007
mac_build/
boinc.xcodeproj/
project.pbxproj
Rytis 26 Sep 2007
- User web: fix an annoyance when team founder transfer is requested and
the requester leaves the team.
NOTE: DB UPDATE REQUIRED.
db/schema.sql
html/
inc/
team.inc
ops/
db_update.php
user/
team_change_founder_form.php
team_founder_transfer_form.php

View File

@ -112,7 +112,7 @@ create table team (
expavg_credit double not null, /* temp */
expavg_time double not null,
seti_id integer not null,
ping_user integer unsigned not null default 0,
ping_user integer not null default 0,
ping_time integer unsigned not null default 0,
primary key (id)
) type=InnoDB;

View File

@ -1,4 +1,5 @@
<?php
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
require_once("../inc/util.inc");
require_once("../inc/db.inc");
@ -191,7 +192,7 @@ function user_join_team($team, $user) {
function user_quit_team($user) {
if (!$user->teamid) return;
mysql_query("update user set teamid=0 where id=$user->id");
mysql_query("update team set ping_user=0 where id=".$user->teamid." and ping_user=".$user->id);
mysql_query("update team set ping_user=-ping_user where id=".$user->teamid." and ping_user=".$user->id);
$now = time();
mysql_query("insert into team_delta (userid, teamid, timestamp, joining, total_credit) values ($user->id, $user->teamid, $now, 0, $user->total_credit)");
}
@ -297,7 +298,7 @@ function team_count_nusers($teamid) {
// 30 days to assume foundership before someone elase can request it
//
function new_transfer_request_ok($team, $now) {
if ($team->ping_user == 0) {
if ($team->ping_user <= 0) {
if ($team->ping_time < $now - 60 * 86400) {
return true;
}

View File

@ -440,11 +440,16 @@ function update_7_26_2007() {
);
}
function update_9_26_2007() {
// Change field type from unsigned to signed
do_query("ALTER TABLE `team` CHANGE `ping_user` `ping_user` INT( 10 ) NOT NULL DEFAULT '0'");
}
// modify the following to call the function you want.
// Make sure you do all needed functions, in order.
// (Look at your DB structure using "explain" queries to see
// which ones you need).
//update_7_26_2007();
//update_9_26_2007();
?>

View File

@ -1,4 +1,5 @@
<?php
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
// handler for the "change founder" team management function
@ -15,20 +16,27 @@ require_founder_login($user, $team);
page_head("Change founder of $team->name");
if ($team->ping_user) {
$ping_user = lookup_user_id($team->ping_user);
echo "<p>Team member ".user_links($ping_user)." has requested this
team's founder position. This may be because you left
the team or haven't had contact with the team for a long time.
";
echo "<p>Use the following form to transfer team founder position or
<form method=\"post\" action=\"team_founder_transfer_action.php\">
<input type=\"hidden\" name=\"action\" value=\"decline\">
<input type=\"hidden\" name=\"teamid\" value=\"".$team->id."\">
<input type=\"submit\" value=\"decline proposal\">
</form>
</p>
";
if ($team->ping_user != 0) {
if ($team->ping_user < 0) {
$ping_user = lookup_user_id(-$team->ping_user);
echo "<p>Team member ".user_links($ping_user)." has requested this
team's founder position, but has already left the team.</p>
";
} else {
$ping_user = lookup_user_id($team->ping_user);
echo "<p>Team member ".user_links($ping_user)." has requested this
team's founder position. This may be because you left
the team or haven't had contact with the team for a long time.</p>
";
echo "<p>Use the following form to transfer team founder position or
<form method=\"post\" action=\"team_founder_transfer_action.php\">
<input type=\"hidden\" name=\"action\" value=\"decline\">
<input type=\"hidden\" name=\"teamid\" value=\"".$team->id."\">
<input type=\"submit\" value=\"decline proposal\">
</form>
</p>
";
}
}
echo "

View File

@ -1,4 +1,5 @@
<?php
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
require_once("../inc/db.inc");
require_once("../inc/util.inc");
@ -52,6 +53,9 @@ if (new_transfer_request_ok($team, $now)) {
";
}
} else {
if ($team->ping_user < 0) {
$team->ping_user = -$team->ping_user;
}
$ping_user = lookup_user_id($team->ping_user);
echo "<p>Founder change has already been requested by ".
user_links($ping_user)." on ".date_str($team->ping_time).".