svn path=/trunk/boinc/; revision=958
This commit is contained in:
David Anderson 2003-02-24 21:31:36 +00:00
parent 04a155ec46
commit 2d7a33e79f
8 changed files with 194 additions and 6 deletions

13
html/user/logout.php Normal file
View File

@ -0,0 +1,13 @@
<?php
include_once("util.inc");
session_start();
session_destroy();
page_head("Logged out");
echo "You are now logged out";
page_tail();
?>

View File

@ -0,0 +1,155 @@
<?php
// Functions to display and edit project-specific prefs
// (Astropulse version)
// The prefs are as follows:
// <color_scheme>
// A few presets, plus "Custom" to control other parameters
// <start_hue>
// Starting hue (0..1) for graph
// <hue_change>
// Delta hue for graph (+ or -)
// <grow_time>
// Time to grow graph, back to front
// <hold_time>
// Time to hold completed graph
// <two_dim/>
// If present, draw 2-D graph
// <graph_alpha>
// transparency of graph (0..1)
function project_specific_prefs_default() {
return "<color_scheme>Tahiti Sunset</color_scheme>\n";
}
function option($name, $val) {
if ($name == $val) {
$x = "selected";
} else {
$x = "";
}
echo "<option name='$name' $x>$name\n";
}
// given struct, show form for editing
//
function project_specific_prefs_edit($prefs) {
$x = $prefs->color_scheme;
echo "<tr>
<td align=right>Color scheme:</td><td>
<select name=color_scheme>
";
option("Tahiti Sunset", $x);
option("Desert Sands", $x);
option("Underwater", $x);
option("Custom", $x);
echo "</select></td></tr>\n";
if ($prefs->color_scheme == "Custom") {
$sel2 = ($prefs->two_dim?"checked":"");
$sel3 = ($prefs->two_dim?"":"checked");
echo "
<tr><td align=right>Start hue</td>
<td><input name=start_hue value='$prefs->start_hue'></td></tr>
<tr><td align=right>Hue change</td>
<td><input name=hue_change value='$prefs->hue_change'></td></tr>
<tr><td align=right>Grow time</td>
<td><input name=grow_time value='$prefs->grow_time'></td></tr>
<tr><td align=right>Hold time</td>
<td><input name=hold_time value='$prefs->hold_time'></td></tr>
<tr><td align=right>Graph dimension</td>
<td><input type=radio name=two_dim value=yes $sel2>2-D
<input type=radio name=two_dim value=no $sel3>3-D</td></tr>
<tr><td align=right>Graph transparency</td>
<td><input name=graph_alpha value='$prefs->graph_alpha'></td></tr>
";
}
}
// Return XML version of project-specific prefs from form vars
//
function project_specific_prefs_parse_form() {
parse_str(getenv("QUERY_STRING"));
switch( $color_scheme ) {
case "Tahiti Sunset":
$start_hue = 0.5;
$hue_change = 0.5;
$grow_time = 10;
$hold_time = 5;
$graph_alpha = 0.7;
$two_dim = "no";
break;
case "Desert Sands":
$start_hue = 0.0;
$hue_change = 0.2;
$grow_time = 10;
$hold_time = 5;
$graph_alpha = 0.7;
$two_dim = "no";
break;
case "Underwater":
$start_hue = 0.2;
$hue_change = 0.4;
$grow_time = 10;
$hold_time = 5;
$graph_alpha = 0.7;
$two_dim = "no";
break;
case "Custom":
if (!isset($start_hue)) $start_hue = 0;
if (!isset($hue_change)) $hue_change = 1;
if (!isset($grow_time)) $grow_time = 10;
if (!isset($hold_time)) $hold_time = 5;
if (!isset($graph_alpha)) $graph_alpha = 0.7;
if (!isset($two_dim)) $two_dim = "no";
break;
}
$x = "<color_scheme>$color_scheme</color_scheme>
<start_hue>$start_hue</start_hue>
<hue_change>$hue_change</hue_change>
<grow_time>$grow_time</grow_time>
<hold_time>$hold_time</hold_time>
<graph_alpha>$graph_alpha</graph_alpha>
";
if ($two_dim == "yes") $x = $x."<two_dim/>\n";
return $x;
}
// show non-editable version of prefs
//
function project_specific_prefs_show($prefs) {
echo "<tr>
<td>Color scheme:</td>
<td>$prefs->color_scheme</td>
</tr>
";
if ($prefs->color_scheme == "Custom") {
$dim = $prefs->two_dim?"2":"3";
echo "
<tr><td align=right>Start hue</td>
<td>$prefs->start_hue</td></tr>
<tr><td align=right>Hue change</td>
<td>$prefs->hue_change</td></tr>
<tr><td align=right>Grow time</td>
<td>$prefs->grow_time</td></tr>
<tr><td align=right>Hold time</td>
<td>$prefs->hold_time</td></tr>
<tr><td align=right>Graph alpha</td>
<td>$prefs->graph_alpha</td></tr>
<tr><td align=right>Graph dimension</td>
<td>$dim</td></tr>
";
}
}
// parse XML, fill in struct
//
function project_specific_prefs_parse($prefs_xml) {
$prefs->color_scheme = parse_element($prefs_xml, "<color_scheme>");
$prefs->start_hue = parse_element($prefs_xml, "<start_hue>");
$prefs->hue_change = parse_element($prefs_xml, "<hue_change>");
$prefs->grow_time = parse_element($prefs_xml, "<grow_time>");
$prefs->hold_time = parse_element($prefs_xml, "<hold_time>");
$prefs->graph_alpha = parse_element($prefs_xml, "<graph_alpha>");
$prefs->two_dim = parse_element($prefs_xml, "<two_dim>");
return $prefs;
}

View File

@ -227,6 +227,11 @@ new_host:
reply.hostid = reply.host.id;
// this tells client to updates its host ID
}
if (reply.user.teamid) {
TEAM team;
retval = db_team(reply.user.teamid, team);
if (!retval) reply.team = team;
}
return 0;
}

View File

@ -106,6 +106,7 @@ SCHEDULER_REPLY::SCHEDULER_REPLY() {
code_sign_key_signature = 0;
memset(&user, 0, sizeof(user));
memset(&host, 0, sizeof(host));
memset(&team, 0, sizeof(team));
nucleus_only = false;
}
@ -153,6 +154,15 @@ int SCHEDULER_REPLY::write(FILE* fout) {
host.expavg_credit
);
// might want to send team credit too.
//
if (team.id) {
fprintf(fout,
"<team_name>%s</team_name>\n",
team.name
);
}
if (hostid) {
fprintf(fout,
"<hostid>%d</hostid>\n"

View File

@ -67,6 +67,7 @@ struct SCHEDULER_REPLY {
bool nucleus_only; // send only message
USER user;
HOST host;
TEAM team;
vector<APP> apps;
vector<APP_VERSION> app_versions;
vector<WORKUNIT>wus;

View File

@ -16,7 +16,7 @@
$app_version = new App_Version($app);
$app_version->platform = $platform;
$app_version->exec_dir = "../apps";
$app_version->exec_name = "ap_win_0.02.exe";
$app_version->exec_name = "ap_win_0.05.exe";
$core_app = new App("core client");
$core_app_version = new App_Version($core_app);
@ -38,6 +38,7 @@
$project->start_validate = false;
$project->shmem_key = 0x31415927;
$project->project_php_file = "project_ap.inc";
$project->project_prefs_php_file = "project_specific_prefs_ap.inc";
$project->install();

View File

@ -16,7 +16,7 @@
$app_version = new App_Version($app);
$app_version->platform = $platform;
$app_version->exec_dir = "../apps";
$app_version->exec_name = "ap_win_0.02.exe";
$app_version->exec_name = "ap_win_0.05.exe";
$core_app = new App("core client");
$core_app_version = new App_Version($core_app);

View File

@ -155,6 +155,7 @@ class Project {
var $start_result_retry;
var $start_validate;
var $project_php_file;
var $project_prefs_php_file;
var $make_work_wu_template;
var $make_work_result_template;
@ -297,12 +298,15 @@ class Project {
// copy the user and administrative PHP files to the project dir,
//
PassThru("cp -f $source_dir/html_user/* $this->project_dir/html_user");
PassThru("cp -f $source_dir/tools/country_select $this->project_dir/html_user");
PassThru("cp -f $source_dir/html_ops/* $this->project_dir/html_ops");
PassThru("cp -f $source_dir/html_user/* $this->project_dir/html_user >> /dev/null 2>&1");
PassThru("cp -f $source_dir/tools/country_select $this->project_dir/html_user >> /dev/null 2>&1");
PassThru("cp -f $source_dir/html_ops/* $this->project_dir/html_ops >> /dev/null 2>&1");
if ($this->project_php_file) {
PassThru("cp -f $source_dir/html_user/$this->project_php_file $this->project_dir/html_user/project.inc");
}
if ($this->project_prefs_php_file) {
PassThru("cp -f $source_dir/html_user/$this->project_prefs_php_file $this->project_dir/html_user/project_specific_prefs.inc");
}
// Copy the sched server in the cgi directory with the
// cgi names given $source_dir/html_usr/schedulers.txt
@ -633,7 +637,6 @@ class Host {
function install() {
$base_dir = get_env_var("BOINC_HOSTS_DIR");
$this->host_dir = $base_dir."/".$this->name;
$user = $this->user;
PassThru("rm -rf $this->host_dir");
PassThru("mkdir $this->host_dir");