*** empty log message ***

svn path=/trunk/boinc/; revision=1224
This commit is contained in:
Eric Heien 2003-05-20 22:20:08 +00:00
parent 5b097cc8fa
commit eee26a0db4
5 changed files with 53 additions and 36 deletions

View File

@ -4272,3 +4272,12 @@ Erik May 19 2003
sched/
handle_request.C
server_types.C,h
Eric May 20, 2003
- When you create a team you automatically join it
html_user/
team.inc
team_create_action.php
team_join_action.php

View File

@ -135,6 +135,41 @@ function show_team_row($team, $i) {
$team->total_credit, $team->country );
}
function user_join_team($team, $user) {
if ($user->teamid != 0) {
$query_team_other = sprintf(
"select * from team where id = %d",
$user->teamid
);
$result_team_other = mysql_query($query_team_other);
$first_team = mysql_fetch_object($result_team_other);
$first_nusers = $first_team->nusers;
$first_new_nusers = $first_nusers - 1;
$query_team_table_other = sprintf(
"update team set nusers = %d where id = %d",
$first_new_nusers,
$first_team->id
);
$result_team_table_other = mysql_query($query_team_table_other);
}
$query_user_table = sprintf(
"update user set teamid = %d where id = %d",
$team->id,
$user->id
);
$result_user_table = mysql_query($query_user_table);
$nusers = $team->nusers;
$new_nusers = $nusers + 1;
$query_team_table = sprintf(
"update team set nusers = %d where id = %d",
$new_nusers,
$team->id
);
$result_team_table = mysql_query($query_team_table);
if ($result_user_table && $result_team_table) return true;
else return false;
}
function team_edit_form($team, $label, $url) {
echo "<form method=post action=$url>\n";
if ($team) {

View File

@ -23,12 +23,16 @@
$_POST["name_html"],
$_POST["description"],
$_POST["country"],
1
0
);
$result = mysql_query($query);
if ($result) {
$teamid = mysql_insert_id();
$team_result = mysql_query("select * from team where id = $teamid");
$new_team = mysql_fetch_object($team_result);
mysql_free_result($team_result);
user_join_team($new_team,$user);
Header("Location: team_display.php?teamid=$teamid");
} else {
page_head("Error");

View File

@ -16,41 +16,12 @@
page_head("Unable to add $user->name");
echo "You are already a member of $team->name.";
} else {
if ($user->teamid != 0) {
$query_team_other = sprintf(
"select * from team where id = %d",
$user->teamid
);
$result_team_other = mysql_query($query_team_other);
$first_team = mysql_fetch_object($result_team_other);
$first_nusers = $first_team->nusers;
$first_new_nusers = $first_nusers - 1;
$query_team_table_other = sprintf(
"update team set nusers = %d where id = %d",
$first_new_nusers,
$first_team->id
);
$result_team_table_other = mysql_query($query_team_table_other);
}
$query_user_table = sprintf(
"update user set teamid = %d where id = %d",
$team->id,
$user->id
);
$result_user_table = mysql_query($query_user_table);
$nusers = $team->nusers;
$new_nusers = $nusers + 1;
$query_team_table = sprintf(
"update team set nusers = %d where id = %d",
$new_nusers,
$team->id
);
$result_team_table = mysql_query($query_team_table);
if ($result_user_table && $result_team_table) {
page_head("Joined $team_name");
$success = user_join_team($team,$user);
if ($success == true) {
page_head("Joined $team->name");
echo "<h2>Joined team</h2>";
echo "You have joined
<a href=team_display.php?teamid=$team->id>$team_name</a>.
<a href=team_display.php?teamid=$team->id>$team->name</a>.
";
} else {
page_head("Error");

2
todo
View File

@ -107,8 +107,6 @@ implement a "fetch prefs" command (regular RPC w/o work request)
all RPCs should return a "user-specific project URL"
to be used in GUI (might refer to user page)
when you create a team you should join that team
in GUI, project name should hyperlink to a project-specified URL
(typically user page for that project)