project long name

svn path=/trunk/boinc/; revision=919
This commit is contained in:
David Anderson 2003-02-14 22:35:35 +00:00
parent 5cd327f2d6
commit a8de830c7d
5 changed files with 52 additions and 23 deletions

10
db/db.h
View File

@ -32,9 +32,17 @@
// Maximum allowed size for SQL based blobs (Binary Large Object)
#define MAX_BLOB_SIZE 4096
// represents the project as a whole.
// There is only of these per DB
//
struct PROJECT {
int id;
char name[256];
char short_name[256];
// used as directory name and part of DB name of server side,
// so no spaces or special chars
char long_name[256];
// shown on client side, e.g. in GUI
// can contain spaces etc.
};
// A compilation target, i.e. a architecture/OS combination.

View File

@ -95,9 +95,10 @@ void BOINC_MYSQL_DB::struct_to_str(void* vp, char* q, int type) {
case TYPE_PROJECT:
prp = (PROJECT*)vp;
sprintf(q,
"id=%d, name='%s'",
"id=%d, short_name='%s', long_name='%s'",
prp->id,
prp->name
prp->short_name,
prp->long_name
);
break;
case TYPE_PLATFORM:
@ -335,7 +336,8 @@ void BOINC_MYSQL_DB::row_to_struct(MYSQL_ROW& r, void* vp, int type) {
prp = (PROJECT*)vp;
memset(prp, 0, sizeof(PROJECT));
prp->id = atoi(r[i++]);
strcpy2(prp->name, r[i++]);
strcpy2(prp->short_name, r[i++]);
strcpy2(prp->long_name, r[i++]);
break;
case TYPE_PLATFORM:
pp = (PLATFORM*)vp;

View File

@ -2,7 +2,8 @@ use BOINC_DB_NAME
create table project (
id integer not null auto_increment,
name varchar(254) not null,
short_name varchar(254) not null,
long_name varchar(254) not null,
primary key (id)
);

View File

@ -97,10 +97,10 @@ function element_end($parser, $name) {
$parse_result->resource_share = $text;
break;
case "show_email":
$parse_result->show_email = $text;
$parse_result->show_email = true;
break;
case "send_email":
$parse_result->send_email = $text;
$parse_result->send_email = true;
break;
case "mod_time":
$parse_result->mod_time = $text;
@ -123,6 +123,8 @@ function char_handler($parser, $x) {
$text = $text.$x;
}
// state of prefs for new users
//
function default_prefs() {
$p = null;
$p->dont_run_on_batteries = 1;
@ -135,15 +137,25 @@ function default_prefs() {
$p->disk_min_free_gb = 1;
$p->resource_share = 100;
$p->show_email = 0;
$p->send_email = 1;
$p->show_email = false;
$p->send_email = true;
return $p;
}
// state of prefs before parsing
//
function initial_prefs() {
$p = default_prefs;
$p->show_email = false;
$p->send_email = false;
}
// parse prefs (either global or project) from XML to a struct
//
function prefs_parse($prefs_xml) {
global $parse_result;
$parse_result = default_prefs();
$parse_result = initial_prefs();
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
@ -216,7 +228,7 @@ function print_prefs_display($user) {
prefs_show_resource($project_prefs);
prefs_show_project($project_specific_prefs);
prefs_show_email($global_prefs);
prefs_show_email($project_prefs);
prefs_show_global($global_prefs);
echo "</table>";
}
@ -390,9 +402,15 @@ function global_prefs_make_xml($prefs) {
function project_prefs_make_xml($prefs) {
$xml = "<project_preferences>\n";
if ($prefs->show_email) {
$xml = $xml."<show_email/>\n";
}
if ($prefs->send_email) {
$xml = $xml."<send_email/>\n";
}
$xml = $xml
."<resource_share>$prefs->resource_share</resource_share>\n"
."<project_specific>\n$prefs->project_specific\n</project_specific>\n";
."<project_specific>\n$prefs->project_specific</project_specific>\n";
$xml = $xml."</project_preferences>\n";
return $xml;
}

View File

@ -134,19 +134,19 @@ int SCHEDULER_REPLY::write(FILE* fout) {
if (nucleus_only) goto end;
fprintf(fout,
"<project_name>%s</project_name>\n",
gproject.name
"<project_name>%s</project_name>\n",
gproject.long_name
);
fprintf(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.name,
user.total_credit,
user.expavg_credit,
user.create_time
"<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.name,
user.total_credit,
user.expavg_credit,
user.create_time
);
if (hostid) {
@ -159,7 +159,7 @@ int SCHEDULER_REPLY::write(FILE* fout) {
host.total_credit,
host.expavg_credit,
host.create_time
);
);
}
if (send_global_prefs) {