mirror of https://github.com/BOINC/boinc.git
- server: add optional <no_validate> element to output file <file_ref>s.
This tells the sample bitwise validator to ignore this file. - client: parse the above field (avoid "unparsed XML" msgs) svn path=/trunk/boinc/; revision=15514
This commit is contained in:
parent
b21be7c4d4
commit
cff13c8871
|
@ -5246,3 +5246,14 @@ David 29 June 2008
|
|||
|
||||
client/
|
||||
cs_prefs.C
|
||||
|
||||
David 30 June 2008
|
||||
- server: add optional <no_validate> element to output file <file_ref>s.
|
||||
This tells the sample bitwise validator to ignore this file.
|
||||
- client: parse the above field (avoid "unparsed XML" msgs)
|
||||
|
||||
client/
|
||||
client_types.C
|
||||
sched/
|
||||
sample_bitwise_validator.C
|
||||
validate_util.C,h
|
||||
|
|
|
@ -1212,6 +1212,7 @@ int APP_VERSION::api_major_version() {
|
|||
|
||||
int FILE_REF::parse(MIOFILE& in) {
|
||||
char buf[256];
|
||||
bool temp;
|
||||
|
||||
strcpy(file_name, "");
|
||||
strcpy(open_name, "");
|
||||
|
@ -1225,6 +1226,7 @@ int FILE_REF::parse(MIOFILE& in) {
|
|||
if (parse_bool(buf, "main_program", main_program)) continue;
|
||||
if (parse_bool(buf, "copy_file", copy_file)) continue;
|
||||
if (parse_bool(buf, "optional", optional)) continue;
|
||||
if (parse_bool(buf, "no_validate", temp)) continue;
|
||||
if (log_flags.unparsed_xml) {
|
||||
msg_printf(0, MSG_INFO,
|
||||
"[unparsed_xml] FILE_REF::parse(): unrecognized: %s\n", buf
|
||||
|
|
|
@ -367,16 +367,40 @@ function compare_bar_insuff($title, $width) {
|
|||
";
|
||||
}
|
||||
|
||||
function outcome_graph($x) {
|
||||
return "<td>outcome graph</td>";
|
||||
function outcome_graph($x, $width) {
|
||||
$n = $x[0]+$x[1]+$x[2];
|
||||
if (!$n) return empty_cell();
|
||||
$x0 = $width*$x[0]/$n;
|
||||
$x1 = $width*$x[1]/$n;
|
||||
$x2 = $width*$x[2]/$n;
|
||||
return "<td>
|
||||
<table class=bolt_bar><tr>
|
||||
<td class=bolt_bar height=10 width=$x0 bgcolor=green></td>
|
||||
<td class=bolt_bar width=$x1 bgcolor=red></td>
|
||||
<td class=bolt_bar width=$x2 bgcolor=yellow></td>
|
||||
</tr></table>
|
||||
</td>
|
||||
";
|
||||
}
|
||||
|
||||
function time_graph($t) {
|
||||
return "<td>time graph</td>";
|
||||
function time_graph($t, $w) {
|
||||
$x = (log10($t)+2)*$w/4;
|
||||
return "<td>
|
||||
<table class=bolt_bar><tr>
|
||||
<td class=bolt_bar width=$x bgcolor=green></td>
|
||||
</tr></table>
|
||||
</td>";
|
||||
}
|
||||
|
||||
function score_graph($t) {
|
||||
return "<td>score graph</td>";
|
||||
function score_graph($t, $w) {
|
||||
$x = $t*$w;
|
||||
$y = (1-$t)*$w;
|
||||
return "<td>
|
||||
<table class=bolt_bar><tr>
|
||||
<td class=bolt_bar height=10 width=$x bgcolor=green></td>
|
||||
<td class=bolt_bar width=$y bgcolor=white></td>
|
||||
</tr></table>
|
||||
</td>";
|
||||
}
|
||||
|
||||
function empty_cell() {
|
||||
|
|
|
@ -34,6 +34,9 @@ require_once("../inc/bolt_cat.inc");
|
|||
require_once("../inc/bolt_util.inc");
|
||||
require_once("../inc/bolt.inc");
|
||||
|
||||
echo "
|
||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"".URL_BASE."bolt.css\">
|
||||
";
|
||||
// the following are to minimize argument passing
|
||||
|
||||
$snap = null;
|
||||
|
@ -97,15 +100,16 @@ function spaces($level) {
|
|||
function filter_array($array) {
|
||||
global $snap, $filter, $filter_cat, $breakdown, $breakdown_cat;
|
||||
|
||||
if (!$filter) return $array;
|
||||
if (!$filter && !$breakdown) return $array;
|
||||
$x = array();
|
||||
foreach ($array as $y) {
|
||||
if (!array_key_exists($y->user_id, $snap->users)) continue;
|
||||
$u = $snap->users[$y->user_id];
|
||||
if ($filter->category($u) != $filter_cat) {
|
||||
if ($filter && $filter->categorize($u) != $filter_cat) {
|
||||
continue;
|
||||
}
|
||||
if ($breakdown && $breakdown_cat) {
|
||||
if ($breakdown->category($u) != $breakdown_cat) {
|
||||
if ($breakdown->categorize($u) != $breakdown_cat) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -188,10 +192,18 @@ function show_unit_row($unit, $class, $level, $is_answer) {
|
|||
global $breakdown, $breakdown_cat;
|
||||
|
||||
$a = $is_answer?" (answer)":"";
|
||||
echo "<tr>
|
||||
<td>".spaces($level)."$unit->name</td>
|
||||
<td>$class $a</td>
|
||||
";
|
||||
echo "<tr>";
|
||||
if ($breakdown && $breakdown_cat) {
|
||||
echo "
|
||||
<td><br></td>
|
||||
<td><br></td>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<td>".spaces($level)."$unit->name</td>
|
||||
<td>$class $a</td>
|
||||
";
|
||||
}
|
||||
if ($breakdown) {
|
||||
if ($breakdown_cat) {
|
||||
echo "<td>$breakdown_cat</td>\n";
|
||||
|
@ -206,8 +218,8 @@ function show_unit_row($unit, $class, $level, $is_answer) {
|
|||
$out = outcomes($views);
|
||||
$t = avg_time($views);
|
||||
echo "<td>$n</td>";
|
||||
echo outcome_graph($out);
|
||||
echo time_graph($t);
|
||||
echo outcome_graph($out, 200);
|
||||
echo time_graph($t, 200);
|
||||
echo empty_cell();
|
||||
break;
|
||||
case "BoltExercise":
|
||||
|
@ -218,14 +230,17 @@ function show_unit_row($unit, $class, $level, $is_answer) {
|
|||
$t = avg_time($views);
|
||||
$score = avg_score($results);
|
||||
echo "<td>$n</td>";
|
||||
echo outcome_graph($out);
|
||||
echo time_graph($t);
|
||||
echo score_graph($score);
|
||||
echo outcome_graph($out, 200);
|
||||
echo time_graph($t, 200);
|
||||
echo score_graph($score, 200);
|
||||
break;
|
||||
case "BoltExerciseSet":
|
||||
echo empty_cell();
|
||||
echo empty_cell();
|
||||
echo empty_cell();
|
||||
$xr = get_xset_results($unit);
|
||||
$score = avg_score($xr);
|
||||
echo score_graph($score);
|
||||
echo score_graph($score, 200);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
@ -253,7 +268,7 @@ function show_unit($unit, $level) {
|
|||
if ($breakdown) {
|
||||
foreach ($breakdown->categories() as $c) {
|
||||
$breakdown_cat = $c;
|
||||
show_unit_row($unit, $class, $level, $true);
|
||||
show_unit_row($unit, $class, $level, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +286,7 @@ function show_map() {
|
|||
global $snap, $course_id, $top_unit, $filter, $filter_cat, $breakdown;
|
||||
|
||||
$breakdown_name = get_str('breakdown', true);
|
||||
if ($breakdown_name) {
|
||||
if ($breakdown_name && $breakdown_name != 'none') {
|
||||
$breakdown = lookup_categorization($breakdown_name);
|
||||
if (!$breakdown) error_page("unknown breakdown $breakdown_name");
|
||||
} else {
|
||||
|
@ -293,10 +308,15 @@ function show_map() {
|
|||
page_head("Course map");
|
||||
$snap = read_map_snapshot($course_id);
|
||||
echo "
|
||||
<table class=bolt_box>
|
||||
<table class=\"bolt_box\">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
";
|
||||
if ($breakdown) {
|
||||
echo "<th>Group</th>";
|
||||
}
|
||||
echo "
|
||||
<th>Views</th>
|
||||
<th>Outcome</th>
|
||||
<th>Time</th>
|
||||
|
|
|
@ -72,6 +72,7 @@ int init_result(RESULT& result, void*& data) {
|
|||
string filedata;
|
||||
for (unsigned int i=0; i<files.size(); i++) {
|
||||
FILE_INFO& fi = files[i];
|
||||
if (fi.no_validate) continue;
|
||||
retval = read_file_string(fi.path.c_str(), filedata);
|
||||
if (retval) {
|
||||
if (fi.optional) {
|
||||
|
|
|
@ -44,6 +44,7 @@ int FILE_INFO::parse(XML_PARSER& xp) {
|
|||
char tag[256];
|
||||
bool is_tag, found=false;
|
||||
optional = false;
|
||||
no_validate = false;
|
||||
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
||||
if (!is_tag) continue;
|
||||
if (!strcmp(tag, "/file_ref")) {
|
||||
|
@ -54,6 +55,7 @@ int FILE_INFO::parse(XML_PARSER& xp) {
|
|||
continue;
|
||||
}
|
||||
if (xp.parse_bool(tag, "optional", optional)) continue;
|
||||
if (xp.parse_bool(tag, "no_validate", no_validate)) continue;
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -67,7 +69,7 @@ int get_output_file_info(RESULT& result, FILE_INFO& fi) {
|
|||
XML_PARSER xp(&mf);
|
||||
while (!xp.get(tag, sizeof(tag), is_tag)) {
|
||||
if (!is_tag) continue;
|
||||
if (!strcmp(tag, "file_info")) {
|
||||
if (!strcmp(tag, "file_ref")) {
|
||||
int retval = fi.parse(xp);
|
||||
if (retval) return retval;
|
||||
dir_hier_path(
|
||||
|
|
|
@ -26,10 +26,14 @@
|
|||
#include "boinc_db.h"
|
||||
#include "parse.h"
|
||||
|
||||
// bit of a misnomer - this actually taken from the <file_ref> elements
|
||||
// of result.xml_doc_in
|
||||
//
|
||||
struct FILE_INFO {
|
||||
std::string name;
|
||||
std::string path;
|
||||
bool optional;
|
||||
bool no_validate;
|
||||
|
||||
int parse(XML_PARSER&);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue