mirror of https://github.com/BOINC/boinc.git
venue, prefs editing
svn path=/trunk/boinc/; revision=934
This commit is contained in:
parent
b26e161e8d
commit
8431299599
|
@ -493,12 +493,20 @@ int SCHEDULER_REPLY::parse(FILE* in) {
|
|||
char buf[256], *p;
|
||||
int retval;
|
||||
|
||||
hostid = 0;
|
||||
host_total_credit = 0;
|
||||
host_expavg_credit = 0;
|
||||
host_create_time = 0;
|
||||
request_delay = 0;
|
||||
strcpy(message, "");
|
||||
strcpy(message_priority, "");
|
||||
request_delay = 0;
|
||||
hostid = 0;
|
||||
strcpy(project_name, "");
|
||||
global_prefs_xml = 0;
|
||||
project_prefs_xml = 0;
|
||||
strcpy(user_name, "");
|
||||
user_total_credit = 0;
|
||||
user_expavg_credit = 0;
|
||||
user_create_time = 0;
|
||||
code_sign_key = 0;
|
||||
code_sign_key_signature = 0;
|
||||
|
||||
|
|
5
db/db.h
5
db/db.h
|
@ -119,6 +119,7 @@ struct USER {
|
|||
char project_prefs[MAX_BLOB_SIZE];
|
||||
// within <project_preferences> tag
|
||||
int teamid; // if user is part of a team
|
||||
char venue[256]; // home/work/school (default)
|
||||
};
|
||||
|
||||
#define TEAM_TYPE_CLUB 1
|
||||
|
@ -190,6 +191,8 @@ struct HOST {
|
|||
// The following is derived (by server) from other fields
|
||||
double credit_per_cpu_sec;
|
||||
|
||||
char venue[256]; // home/work/school
|
||||
|
||||
int parse(FILE*);
|
||||
int parse_time_stats(FILE*);
|
||||
int parse_net_stats(FILE*);
|
||||
|
@ -238,6 +241,7 @@ struct WORKUNIT {
|
|||
int file_delete_state;
|
||||
int assimilate_state;
|
||||
int workseq_next; // if part of a sequence, the next WU
|
||||
int opaque; // project-specific; usually external ID
|
||||
|
||||
// the following not used in the DB
|
||||
char app_name[256];
|
||||
|
@ -291,6 +295,7 @@ struct RESULT {
|
|||
int validate_state;
|
||||
double claimed_credit; // CPU time times host credit/sec
|
||||
double granted_credit; // == canonical credit of WU
|
||||
int opaque; // project-specific; usually external ID
|
||||
|
||||
// the following not used in the DB
|
||||
char wu_name[256];
|
||||
|
|
|
@ -156,7 +156,7 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
"country='%s', postal_code='%s', "
|
||||
"total_credit=%.12e, expavg_credit=%.12e, expavg_time=%f, "
|
||||
"global_prefs='%s', project_prefs='%s', "
|
||||
"teamid=%d",
|
||||
"teamid=%d, venue='%s'",
|
||||
up->id,
|
||||
up->create_time,
|
||||
up->email_addr,
|
||||
|
@ -170,7 +170,8 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
up->expavg_time,
|
||||
up->global_prefs,
|
||||
up->project_prefs,
|
||||
up->teamid
|
||||
up->teamid,
|
||||
up->venue
|
||||
);
|
||||
unescape(up->email_addr);
|
||||
unescape(up->name);
|
||||
|
@ -234,7 +235,8 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
"m_nbytes=%f, m_cache=%f, m_swap=%f, "
|
||||
"d_total=%f, d_free=%f, "
|
||||
"n_bwup=%f, n_bwdown=%f, "
|
||||
"credit_per_cpu_sec=%f",
|
||||
"credit_per_cpu_sec=%f, "
|
||||
"venue='%s'",
|
||||
hp->id, hp->create_time, hp->userid,
|
||||
hp->rpc_seqno, hp->rpc_time,
|
||||
hp->total_credit, hp->expavg_credit, hp->expavg_time,
|
||||
|
@ -247,7 +249,8 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
hp->m_nbytes, hp->m_cache, hp->m_swap,
|
||||
hp->d_total, hp->d_free,
|
||||
hp->n_bwup, hp->n_bwdown,
|
||||
hp->credit_per_cpu_sec
|
||||
hp->credit_per_cpu_sec,
|
||||
hp->venue
|
||||
);
|
||||
unescape(hp->domain_name);
|
||||
unescape(hp->serialnum);
|
||||
|
@ -267,7 +270,7 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
"canonical_resultid=%d, canonical_credit=%f, "
|
||||
"timeout_check_time=%d, delay_bound=%d, "
|
||||
"error_mask=%d, file_delete_state=%d, assimilate_state=%d, "
|
||||
"workseq_next=%d",
|
||||
"workseq_next=%d, opaque=%d",
|
||||
wup->id, wup->create_time, wup->appid,
|
||||
wup->name, wup->xml_doc, wup->batch,
|
||||
wup->rsc_fpops, wup->rsc_iops, wup->rsc_memory, wup->rsc_disk,
|
||||
|
@ -275,7 +278,7 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
wup->canonical_resultid, wup->canonical_credit,
|
||||
wup->timeout_check_time, wup->delay_bound,
|
||||
wup->error_mask, wup->file_delete_state, wup->assimilate_state,
|
||||
wup->workseq_next
|
||||
wup->workseq_next, wup->opaque
|
||||
);
|
||||
break;
|
||||
case TYPE_RESULT:
|
||||
|
@ -287,14 +290,14 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
|
|||
"name='%s', cpu_time=%f, "
|
||||
"xml_doc_in='%s', xml_doc_out='%s', stderr_out='%s', "
|
||||
"batch=%d, file_delete_state=%d, validate_state=%d, "
|
||||
"claimed_credit=%f, granted_credit=%f",
|
||||
"claimed_credit=%f, granted_credit=%f, opaque=%d",
|
||||
rp->id, rp->create_time, rp->workunitid,
|
||||
rp->server_state, rp->outcome, rp->client_state,
|
||||
rp->hostid, rp->report_deadline, rp->sent_time, rp->received_time,
|
||||
rp->name, rp->cpu_time,
|
||||
rp->xml_doc_in, rp->xml_doc_out, rp->stderr_out,
|
||||
rp->batch, rp->file_delete_state, rp->validate_state,
|
||||
rp->claimed_credit, rp->granted_credit
|
||||
rp->claimed_credit, rp->granted_credit, rp->opaque
|
||||
);
|
||||
break;
|
||||
case TYPE_WORKSEQ:
|
||||
|
@ -386,6 +389,7 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
strcpy2(up->global_prefs, r[i++]);
|
||||
strcpy2(up->project_prefs, r[i++]);
|
||||
up->teamid = atoi(r[i++]);
|
||||
strcpy2(up->venue, r[i++]);
|
||||
break;
|
||||
case TYPE_TEAM:
|
||||
tp = (TEAM*)vp;
|
||||
|
@ -439,6 +443,7 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
hp->n_bwup = atof(r[i++]);
|
||||
hp->n_bwdown = atof(r[i++]);
|
||||
hp->credit_per_cpu_sec = atof(r[i++]);
|
||||
strcpy2(hp->venue, r[i++]);
|
||||
break;
|
||||
case TYPE_WORKUNIT:
|
||||
wup = (WORKUNIT*)vp;
|
||||
|
@ -462,6 +467,7 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
wup->file_delete_state = atoi(r[i++]);
|
||||
wup->assimilate_state = atoi(r[i++]);
|
||||
wup->workseq_next = atoi(r[i++]);
|
||||
wup->opaque = atoi(r[i++]);
|
||||
break;
|
||||
case TYPE_RESULT:
|
||||
rp = (RESULT*)vp;
|
||||
|
@ -486,6 +492,7 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
|
|||
rp->validate_state = atoi(r[i++]);
|
||||
rp->claimed_credit = atof(r[i++]);
|
||||
rp->granted_credit = atof(r[i++]);
|
||||
rp->opaque = atoi(r[i++]);
|
||||
break;
|
||||
case TYPE_WORKSEQ:
|
||||
wsp = (WORKSEQ*)vp;
|
||||
|
|
|
@ -52,6 +52,7 @@ create table user (
|
|||
global_prefs blob,
|
||||
project_prefs blob,
|
||||
teamid integer not null,
|
||||
venue varchar(254) not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
@ -114,6 +115,7 @@ create table host (
|
|||
n_bwdown double not null,
|
||||
|
||||
credit_per_cpu_sec double not null,
|
||||
venue varchar(254) not null,
|
||||
|
||||
primary key (id)
|
||||
);
|
||||
|
@ -144,6 +146,7 @@ create table workunit (
|
|||
file_delete_state integer not null,
|
||||
assimilate_state integer not null,
|
||||
workseq_next integer not null,
|
||||
opaque integer not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
@ -168,6 +171,7 @@ create table result (
|
|||
validate_state integer not null,
|
||||
claimed_credit double not null,
|
||||
granted_credit double not null,
|
||||
opaque integer not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ function show_host($host) {
|
|||
start_table();
|
||||
|
||||
row("Created", time_str($host->create_time));
|
||||
row("Venue", $host->venue);
|
||||
row("Total credit", $host->total_credit);
|
||||
row("Average credit", $host->expavg_credit);
|
||||
row("Average update time", time_str($host->expavg_time));
|
||||
|
@ -247,6 +248,7 @@ function show_user($user) {
|
|||
row("Total credit", $user->total_credit);
|
||||
row("Average credit", $user->expavg_credit);
|
||||
row("Last average time", time_str($user->expavg_time));
|
||||
row("Venue", $user->venue);
|
||||
end_table();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,25 @@ echo "
|
|||
<br>
|
||||
You can control when and how your computer is used.
|
||||
<br>
|
||||
We suggest using the defaults settings -
|
||||
just go to the bottom and click OK.
|
||||
To use the defaults settings,
|
||||
scroll to the bottom and click OK.
|
||||
";
|
||||
$prefs = default_prefs();
|
||||
global_prefs_update($user, $prefs);
|
||||
project_prefs_update($user, $prefs);
|
||||
|
||||
prefs_form_global($user, $prefs, "account_setup_first_email.php");
|
||||
echo "<form action=account_setup_first_action.php>
|
||||
<table cellpadding=6>
|
||||
";
|
||||
prefs_form_global($user, $prefs);
|
||||
prefs_form_email($prefs);
|
||||
venue_form($user);
|
||||
|
||||
echo "<tr><td><br></td><td><input type=submit value=\"OK\"></td></tr>
|
||||
</table>
|
||||
</form>\n
|
||||
";
|
||||
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -4,8 +4,6 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
|
@ -15,10 +13,18 @@ if ($user == NULL) {
|
|||
exit();
|
||||
}
|
||||
|
||||
no_cache();
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
// TODO: consolidate the three DB updates into one
|
||||
|
||||
$prefs = prefs_parse($user->prefs);
|
||||
prefs_global_parse_form($prefs);
|
||||
global_prefs_update($user, $prefs);
|
||||
|
||||
prefs_email_parse_form($prefs);
|
||||
project_prefs_update($user, $prefs);
|
||||
Header("Location: $next_url");
|
||||
|
||||
venue_parse($user);
|
||||
venue_update($user);
|
||||
|
||||
Header("Location: account_setup_first_download.php");
|
||||
|
||||
?>
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Account setup: email options", $user);
|
||||
echo "
|
||||
<h3>Account setup: email options</h3>
|
||||
<br>
|
||||
";
|
||||
$prefs = default_prefs();
|
||||
prefs_form_email($prefs, "account_setup_first_download.php");
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Account setup: graphics", $user);
|
||||
echo "
|
||||
<h3>Account setup: graphics</h3>
|
||||
<br>
|
||||
".PROJECT." lets you control the following properties of its graphics.
|
||||
";
|
||||
$prefs = null;
|
||||
prefs_form_project($prefs, "account_setup_first_download.php");
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -14,18 +14,21 @@ if ($user == NULL) {
|
|||
}
|
||||
page_head("Account setup: resource share", $user);
|
||||
echo "
|
||||
<h3>Account setup: resource share</h3>
|
||||
<br>
|
||||
You can control how your resources
|
||||
(computer time and disk space) are divided
|
||||
among ".PROJECT." and the other BOINC-based projects
|
||||
in which you participate.
|
||||
You do this by assigning a <b>resource share</b> to each project.
|
||||
The resources allocated to a project are proportional to its resource share.
|
||||
The default resource share is 100.
|
||||
<h3>Account setup</h3>
|
||||
";
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
prefs_form_resource($prefs, "account_setup_nonfirst_email.php");
|
||||
echo "<form action=account_setup_nonfirst_action.php>
|
||||
<table cellpadding=6>
|
||||
";
|
||||
prefs_form_resource($prefs);
|
||||
|
||||
venue_form($user);
|
||||
|
||||
echo "<tr><td><br></td><td><input type=submit value=\"OK\"></td></tr>
|
||||
</table>
|
||||
</form>\n
|
||||
";
|
||||
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -4,8 +4,6 @@ include_once("db.inc");
|
|||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
|
@ -15,10 +13,10 @@ if ($user == NULL) {
|
|||
exit();
|
||||
}
|
||||
|
||||
no_cache();
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
$prefs = prefs_parse($user->prefs);
|
||||
prefs_resource_parse_form($prefs);
|
||||
project_prefs_update($user, $prefs);
|
||||
Header("Location: $next_url");
|
||||
|
||||
Header("Location: account_setup_nonfirst_done.php");
|
||||
|
||||
?>
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Account setup: email options", $user);
|
||||
echo "
|
||||
<h3>Account setup: email options</h3>
|
||||
<br>
|
||||
";
|
||||
$prefs = default_prefs();
|
||||
prefs_form_email($prefs, "account_setup_nonfirst_done.php");
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Account setup: graphics", $user);
|
||||
echo "
|
||||
<h3>Account setup: graphics</h3>
|
||||
<br>
|
||||
".PROJECT." lets you control the following properties of its graphics.
|
||||
";
|
||||
$prefs = null;
|
||||
prefs_form_project($prefs, "account_setup_nonfirst_done.php");
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -40,7 +40,7 @@ function show_error($str) {
|
|||
|
||||
$authenticator = random_string();
|
||||
$query = sprintf(
|
||||
"insert into user (create_time, email_addr, name, web_password, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, teamid) values(%d, '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 0, 0)",
|
||||
"insert into user (create_time, email_addr, name, web_password, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, teamid, venue) values(%d, '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 0, 0, 'home')",
|
||||
time(),
|
||||
$new_email_addr,
|
||||
$HTTP_POST_VARS["new_name"],
|
||||
|
|
|
@ -170,8 +170,6 @@ function prefs_parse($prefs_xml) {
|
|||
// display preference subsets, with Edit buttons
|
||||
//
|
||||
function prefs_show_global($prefs) {
|
||||
echo "<tr>".TD2.LG_FONT."<b>Global preferences</b></font>
|
||||
<br><font size=-1>These apply to all BOINC projects in which you participate</font></td></tr>\n";
|
||||
if ($prefs->dont_run_on_batteries) {
|
||||
$batteries = "No";
|
||||
} else {
|
||||
|
@ -195,29 +193,23 @@ function prefs_show_global($prefs) {
|
|||
row2a("Maximum disk space to use:", "$prefs->disk_max_used_gb GB");
|
||||
row2a("Minimum disk space to leave free:", "$prefs->disk_min_free_gb GB");
|
||||
row2a("Maximum % of disk allowed to used:", "$prefs->disk_max_used_pct %");
|
||||
echo "<tr><td><a href=prefs_edit_global_form.php>Edit global preferences</a></td></tr>\n";
|
||||
}
|
||||
|
||||
function prefs_show_resource($prefs) {
|
||||
echo "<tr>".TD2.LG_FONT."<b>Resource share</b></font>
|
||||
<br><font size=-1>Control how your resources are divided among BOINC projects</font></td></tr>\n";
|
||||
row2a(PROJECT." resource share:", $prefs->resource_share);
|
||||
echo "<tr><td><a href=prefs_edit_resource_form.php>Edit resource share</a></td></tr>\n";
|
||||
row2(
|
||||
"Resource share:
|
||||
<br><font size=-1>If you participate in multiple BOINC projects, this is the proportion of your resources used by ".PROJECT."</font>",
|
||||
$prefs->resource_share
|
||||
);
|
||||
}
|
||||
|
||||
function prefs_show_email($prefs) {
|
||||
echo "<tr>".TD2.LG_FONT."<b>Email options</b></font>
|
||||
<br><font size=-1>Control how ".PROJECT." uses your email address</font></td></tr>\n";
|
||||
row2a("Should ".PROJECT." send you email newsletters?", $prefs->send_email?"Yes":"No");
|
||||
row2a("Should ".PROJECT." show your email address on its web site?", $prefs->show_email?"Yes":"No");
|
||||
echo "<tr><td><a href=prefs_edit_email_form.php>Edit email options</a></td></tr>\n";
|
||||
row2("Should ".PROJECT." send you email newsletters?", $prefs->send_email?"Yes":"No");
|
||||
row2("Should ".PROJECT." show your email address on its web site?", $prefs->show_email?"Yes":"No");
|
||||
}
|
||||
|
||||
function prefs_show_project($prefs) {
|
||||
echo "<tr>".TD2.LG_FONT."<b>Graphics preferences</b></font>
|
||||
<br><font size=-1>Customize ".PROJECT." screensaver graphics</font></td></tr>\n";
|
||||
project_specific_prefs_show($prefs);
|
||||
echo "<tr><td><a href=prefs_edit_project_form.php>Edit graphics preferences</a></td></tr>\n";
|
||||
}
|
||||
|
||||
function print_prefs_display($user) {
|
||||
|
@ -226,10 +218,16 @@ function print_prefs_display($user) {
|
|||
$project_prefs = prefs_parse($user->project_prefs);
|
||||
$project_specific_prefs = project_specific_prefs_parse($project_prefs->project_specific);
|
||||
|
||||
echo "<tr><td colspan=2><b>".PROJECT." preferences</b></td></tr>\n";
|
||||
prefs_show_resource($project_prefs);
|
||||
prefs_show_project($project_specific_prefs);
|
||||
prefs_show_email($project_prefs);
|
||||
echo "<tr><td><a href=prefs_edit_project_form.php>Edit ".PROJECT." preferences</a></td></tr>\n";
|
||||
echo "<tr><td colspan=2><hr></td></tr>\n";
|
||||
echo "<tr><td colspan=2><b>BOINC preferences</b></font>
|
||||
<br><font size=-1>These apply to all BOINC projects in which you participate</font></td></tr>\n";
|
||||
prefs_show_global($global_prefs);
|
||||
echo "<tr><td><a href=prefs_edit_global_form.php>Edit BOINC preferences</a></td></tr>\n";
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
|
@ -237,12 +235,9 @@ function print_prefs_display($user) {
|
|||
//
|
||||
// Functions to display preference subsets as forms
|
||||
//
|
||||
function prefs_form_global($user, $prefs, $next_url) {
|
||||
echo "<form action=prefs_edit_global_action.php>
|
||||
<input type=hidden name=next_url value=$next_url>
|
||||
<table cellpadding=6>
|
||||
<tr>
|
||||
<td align=right>Should ".PROJECT." run while computer is on batteries?
|
||||
function prefs_form_global($user, $prefs) {
|
||||
echo "<tr>
|
||||
<td align=right>Should ".PROJECT." run while the computer is on battery power?
|
||||
<br><font size=-1>(This matters only for portable computers)</font>
|
||||
</td><td valign=top>
|
||||
";
|
||||
|
@ -257,7 +252,7 @@ function prefs_form_global($user, $prefs, $next_url) {
|
|||
printf("No <input type=radio name=dont_run_if_user_active %s>\n", $prefs->dont_run_if_user_active?"checked":"");
|
||||
echo "</td></tr>
|
||||
<tr>
|
||||
<td align=right>Wait for your OK before connecting to Internet?
|
||||
<td align=right>Ask you before connecting to Internet?
|
||||
<br><font size=-1>(This matters only if you use a modem)</font>
|
||||
</td><td valign=top>
|
||||
";
|
||||
|
@ -286,17 +281,11 @@ function prefs_form_global($user, $prefs, $next_url) {
|
|||
<td align=right valign=top>Use no more than</td>
|
||||
<td><input size=5 name=disk_max_used_pct value='$prefs->disk_max_used_pct'> % of total space</td>
|
||||
</tr>
|
||||
<tr><td><br></td><td><input type=submit value=\"OK\"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
function prefs_form_email($prefs, $next_url) {
|
||||
echo "<form action=prefs_edit_email_action.php>
|
||||
<input type=hidden name=next_url value=$next_url>
|
||||
<table cellpadding=6>
|
||||
<tr>
|
||||
function prefs_form_email($prefs) {
|
||||
echo "<tr>
|
||||
<td align=right>Should ".PROJECT." send you email newsletters?</td><td>
|
||||
";
|
||||
printf("Yes <input type=radio name=send_email %s>\n", $prefs->send_email?"checked":"");
|
||||
|
@ -307,37 +296,48 @@ function prefs_form_email($prefs, $next_url) {
|
|||
printf("Yes <input type=radio name=show_email %s>\n", $prefs->show_email?"checked":"");
|
||||
printf("No <input type=radio name=show_email %s>\n", $prefs->show_email?"":"checked");
|
||||
echo" </td></tr>
|
||||
<tr><td><br></td><td><input type=submit value=OK></td></tr>
|
||||
</table></form>
|
||||
";
|
||||
}
|
||||
|
||||
function prefs_form_resource($prefs, $next_url) {
|
||||
echo "<form action=prefs_edit_resource_action.php>
|
||||
<input type=hidden name=next_url value=$next_url>
|
||||
<table cellpadding=6>
|
||||
<tr>
|
||||
<td align=right><b>Resource share:</b>
|
||||
<font size=-1><br>The proportion of your resources
|
||||
<br>allocated to ".PROJECT.".</font></td>
|
||||
<td><input name=resource_share value='$prefs->resource_share'></td>
|
||||
<tr><td><br></td><td><input type=submit value=OK></td></tr>
|
||||
</tr></table></form>
|
||||
function prefs_form_resource($prefs) {
|
||||
echo "<tr>
|
||||
<td width=50% valign=top align=right><b>Resource share:</b>
|
||||
<font size=-1><br>The proportion of your computer's resources
|
||||
(processing time and disk space)
|
||||
allocated to ".PROJECT."
|
||||
relative to the other BOINC projects in which you participate.
|
||||
The default is 100.
|
||||
For example, if you participate in two projects and
|
||||
give them resource shares of 100 and 200,
|
||||
the first will get 1/3 of our resources and the second will get 2/3.
|
||||
</font></td>
|
||||
<td valign=top><input name=resource_share value='$prefs->resource_share'></td>
|
||||
";
|
||||
}
|
||||
|
||||
function prefs_form_project($prefs_xml, $next_url) {
|
||||
function prefs_form_project($prefs_xml) {
|
||||
$prefs = project_specific_prefs_parse($prefs_xml);
|
||||
echo "<form action=prefs_edit_project_action.php>
|
||||
<input type=hidden name=next_url value=$next_url>
|
||||
<table cellpadding=6>
|
||||
";
|
||||
project_specific_prefs_edit($prefs);
|
||||
echo "
|
||||
<tr><td><br></td><td><input type=submit value=OK></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
||||
function venue_form($user) {
|
||||
echo "<tr><td align=right>Computer location</td><td>
|
||||
<select name=venue>
|
||||
<option name=home>Home
|
||||
<option name=work>Work
|
||||
<option name=school>School
|
||||
</select>
|
||||
</td></tr>
|
||||
";
|
||||
}
|
||||
|
||||
function venue_parse(&$user) {
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
$user->venue = $venue;
|
||||
}
|
||||
|
||||
function venue_update($user) {
|
||||
mysql_query("update user set venue='$user->venue' where id=$user->id");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
@ -389,13 +389,13 @@ function global_prefs_make_xml($prefs) {
|
|||
if ($prefs->confirm_before_connecting) {
|
||||
$xml = $xml."<confirm_before_connecting/>\n";
|
||||
}
|
||||
$xml = $xml."<low_water_days>$prefs->low_water_days</low_water_days>
|
||||
<high_water_days>$prefs->high_water_days</high_water_days>
|
||||
";
|
||||
$xml = $xml."<disk_max_used_gb>$prefs->disk_max_used_gb</disk_max_used_gb>
|
||||
<disk_max_used_pct>$prefs->disk_max_used_pct</disk_max_used_pct>
|
||||
<disk_min_free_gb>$prefs->disk_min_free_gb</disk_min_free_gb>
|
||||
";
|
||||
$xml = $xml
|
||||
."<low_water_days>$prefs->low_water_days</low_water_days>\n"
|
||||
."<high_water_days>$prefs->high_water_days</high_water_days>\n";
|
||||
$xml = $xml
|
||||
."<disk_max_used_gb>$prefs->disk_max_used_gb</disk_max_used_gb>\n"
|
||||
."<disk_max_used_pct>$prefs->disk_max_used_pct</disk_max_used_pct>\n"
|
||||
."<disk_min_free_gb>$prefs->disk_min_free_gb</disk_min_free_gb>\n";
|
||||
$xml = $xml."</global_preferences>\n";
|
||||
return $xml;
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Edit email options", $user);
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
prefs_form_email($prefs, "prefs.php");
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Edit preferences", $user);
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
prefs_form_project($prefs);
|
||||
$prefs = prefs_parse($user->global_prefs);
|
||||
prefs_form_global($user, $prefs);
|
||||
echo "<p>\n";
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -17,6 +17,6 @@ parse_str(getenv("QUERY_STRING"));
|
|||
$prefs = prefs_parse($user->prefs);
|
||||
prefs_global_parse_form($prefs);
|
||||
global_prefs_update($user, $prefs);
|
||||
Header("Location: $next_url");
|
||||
Header("Location: prefs.php");
|
||||
|
||||
?>
|
||||
|
|
|
@ -22,7 +22,17 @@ echo "<h3>Edit global preferences</h3>
|
|||
<br>otherwise edits may be overwritten.
|
||||
";
|
||||
|
||||
echo "<form action=prefs_edit_global_action.php>
|
||||
<table cellpadding=6>
|
||||
";
|
||||
|
||||
prefs_form_global($user, $prefs, "prefs.php");
|
||||
|
||||
echo "<tr><td><br></td><td><input type=submit value=\"OK\"></td></tr>
|
||||
</table>
|
||||
</form>\n
|
||||
";
|
||||
|
||||
echo "<a href=prefs.php>Back to preferences</a>\n";
|
||||
page_tail();
|
||||
|
||||
|
|
|
@ -19,6 +19,13 @@ no_cache();
|
|||
$prefs = prefs_parse($user->project_prefs);
|
||||
prefs_project_parse_form($prefs);
|
||||
project_prefs_update($user, $prefs);
|
||||
Header("Location: $next_url");
|
||||
|
||||
prefs_email_parse_form($prefs);
|
||||
project_prefs_update($user, $prefs);
|
||||
|
||||
venue_parse($user);
|
||||
venue_update($user);
|
||||
|
||||
Header("Location: prefs.php");
|
||||
|
||||
?>
|
||||
|
|
|
@ -15,8 +15,20 @@ if ($user == NULL) {
|
|||
page_head("Edit project preferences", $user);
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
prefs_form_project($prefs, "prefs.php");
|
||||
echo "<p>\n";
|
||||
|
||||
echo "<form action=prefs_edit_project_action.php>
|
||||
<table cellpadding=6>
|
||||
";
|
||||
|
||||
prefs_form_resource($prefs);
|
||||
prefs_form_project($prefs->project_specific);
|
||||
prefs_form_email($prefs);
|
||||
|
||||
echo "<tr><td><br></td><td><input type=submit value=\"OK\"></td></tr>
|
||||
</table>
|
||||
</form>\n
|
||||
";
|
||||
|
||||
page_tail();
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once("db.inc");
|
||||
include_once("util.inc");
|
||||
include_once("prefs.inc");
|
||||
|
||||
$authenticator = init_session();
|
||||
db_init();
|
||||
|
||||
$user = get_user_from_auth($authenticator);
|
||||
if ($user == NULL) {
|
||||
print_login_form();
|
||||
exit();
|
||||
}
|
||||
page_head("Edit resource share", $user);
|
||||
parse_str(getenv("QUERY_STRING"));
|
||||
$prefs = prefs_parse($user->project_prefs);
|
||||
prefs_form_resource($prefs, "prefs.php");
|
||||
page_tail();
|
||||
|
||||
?>
|
|
@ -42,8 +42,13 @@ function project_specific_prefs_parse_form() {
|
|||
function project_specific_prefs_show($prefs) {
|
||||
echo "<tr>\n
|
||||
<td>Color scheme:</td>\n
|
||||
<td>$prefs->color_scheme</td>\n
|
||||
</tr>\n";
|
||||
<td>";
|
||||
if ($prefs->color_scheme) {
|
||||
echo $prefs->color_scheme;
|
||||
} else {
|
||||
echo "None selected";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
// parse XML, fill in struct
|
||||
|
|
|
@ -214,6 +214,7 @@ new_host:
|
|||
reply.host.userid = reply.user.id;
|
||||
reply.host.rpc_seqno = 0;
|
||||
reply.host.rpc_time = time(0);
|
||||
strcpy(reply.host.venue, reply.user.venue);
|
||||
retval = db_host_new(reply.host);
|
||||
if (retval) {
|
||||
strcpy(reply.message, "server database error");
|
||||
|
|
|
@ -142,22 +142,22 @@ int SCHEDULER_REPLY::write(FILE* fout) {
|
|||
"<user_name>%s</user_name>\n"
|
||||
"<user_total_credit>%f</user_total_credit>\n"
|
||||
"<user_expavg_credit>%f</user_expavg_credit>\n"
|
||||
"<user_create_time>%d</user_create_time>\n",
|
||||
"<user_create_time>%d</user_create_time>\n"
|
||||
"<host_total_credit>%f</host_total_credit>\n"
|
||||
"<host_expavg_credit>%f</host_expavg_credit>\n",
|
||||
user.name,
|
||||
user.total_credit,
|
||||
user.expavg_credit,
|
||||
user.create_time
|
||||
user.create_time,
|
||||
host.total_credit,
|
||||
host.expavg_credit
|
||||
);
|
||||
|
||||
if (hostid) {
|
||||
fprintf(fout,
|
||||
"<hostid>%d</hostid>\n"
|
||||
"<host_total_credit>%f</host_total_credit>\n"
|
||||
"<host_expavg_credit>%f</host_expavg_credit>\n"
|
||||
"<host_create_time>%d</host_create_time>\n",
|
||||
hostid,
|
||||
host.total_credit,
|
||||
host.expavg_credit,
|
||||
host.create_time
|
||||
);
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ class Project {
|
|||
for ($i=0; $i<sizeof($this->users); $i++) {
|
||||
$user = $this->users[$i];
|
||||
$now = time(0);
|
||||
db_query("insert into user values (0, $now, '$user->email_addr', '$user->name', 'foobar', '$user->authenticator', 'Peru', '12345', 0, 0, 0, '', '', 0)");
|
||||
db_query("insert into user values (0, $now, '$user->email_addr', '$user->name', 'foobar', '$user->authenticator', 'Peru', '12345', 0, 0, 0, '', '', 0, 'home')");
|
||||
}
|
||||
|
||||
echo "adding apps\n";
|
||||
|
@ -388,9 +388,9 @@ class Project {
|
|||
|
||||
// show the URLs for user and admin sites
|
||||
//
|
||||
echo "The master URL for project $this->long_name is $this->master_url\n";
|
||||
$admin_url = $html_url."/".$this->short_name."/html_ops/index.html";
|
||||
echo "The admin URL for project $this->long_name is $admin_url\n";
|
||||
echo "Master URL: $this->master_url\n";
|
||||
$admin_url = $html_url."/".$this->short_name."_admin/index.php";
|
||||
echo "Admin URL: $admin_url\n";
|
||||
}
|
||||
|
||||
// moves the master web page to temp
|
||||
|
|
Loading…
Reference in New Issue