1<?php
2// This file is part of BOINC.
3// http://boinc.berkeley.edu
4// Copyright (C) 2008 University of California
5//
6// BOINC is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License
8// as published by the Free Software Foundation,
9// either version 3 of the License, or (at your option) any later version.
10//
11// BOINC is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19// show summary of a workunit
20
21require_once("../inc/util.inc");
22require_once("../inc/boinc_db.inc");
23require_once("../inc/result.inc");
24
25check_get_args(array("wuid"));
26
27BoincDb::get(true);
28
29$wuid = get_int("wuid");
30$wu = BoincWorkunit::lookup_id($wuid);
31if (!$wu) {
32    error_page(tra("can't find workunit"));
33}
34
35page_head(tra("Workunit %1", $wuid));
36$app = BoincApp::lookup_id($wu->appid);
37
38start_table();
39row2(tra("name"), $wu->name);
40row2(tra("application"), $app->user_friendly_name);
41row2(tra("created"), time_str($wu->create_time));
42if ($wu->canonical_resultid) {
43    row2(tra("canonical result"),
44        "<a href=result.php?resultid=$wu->canonical_resultid>$wu->canonical_resultid</a>"
45    );
46    row2(tra("granted credit"), format_credit($wu->canonical_credit));
47}
48
49// if app is using adaptive replication and no canonical result yet,
50// don't show anything more
51// (so that bad guys can't tell if they have an unreplicated job)
52
53$config = get_config();
54if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) {
55    row2(tra("Tasks in progress"), tra("suppressed pending completion"));
56    end_table();
57} else {
58    row2(tra("minimum quorum"), $wu->min_quorum);
59    row2(tra("initial replication"), $wu->target_nresults);
60    row2(tra("max # of error/total/success tasks"),
61        "$wu->max_error_results, $wu->max_total_results, $wu->max_success_results"
62    );
63    if ($wu->error_mask) {
64        row2(tra("errors"), wu_error_mask_str($wu->error_mask));
65    }
66    if ($wu->need_validate) {
67        row2(tra("validation"), tra("Pending"));
68    }
69    if (function_exists('project_workunit')) {
70        project_workunit($wu);
71    }
72    end_table();
73
74    result_table_start(false, true, null);
75    $results = BoincResult::enum("workunitid=$wuid");
76    foreach ($results as $result) {
77        show_result_row($result, false, true, false);
78    }
79    echo "</table>\n";
80}
81
82page_tail();
83
84?>
85