From 1901a23e86522917fdbb077d14803e8fd847a2a6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 31 Jul 2017 20:58:28 -0700 Subject: [PATCH] web: if workunit has keywords, show them on WU detail page add initial version of keyword hierarchy --- html/inc/keywords.inc | 110 ++++++++++++++++++++++++++++++++++++- html/user/workunit.php | 122 ++++++++++++++++++++++++----------------- 2 files changed, 179 insertions(+), 53 deletions(-) diff --git a/html/inc/keywords.inc b/html/inc/keywords.inc index 47c6405efa..0eb1fb311f 100644 --- a/html/inc/keywords.inc +++ b/html/inc/keywords.inc @@ -51,6 +51,32 @@ define('KW_AEI', 26); define('KW_CERN', 27); define('KW_UW', 28); define('KW_EARTH_SCI', 29); +define('KW_SPAIN', 30); +define('KW_SAN_JORGE', 31); +define('KW_NUMBER_THEORY', 32); +define('KW_CRYPTO', 33); +define('KW_ENV_RESEARCH', 34); +define('KW_CLIMATE', 35); +define('KW_CZECH', 36); +define('KW_CHARLES_PRAGUE', 37); +define('KW_RECHENKRAFT', 38); +define('KW_RHEINMAIN', 39); +define('KW_HUNGARY', 40); +define('KW_IRELAND', 41); +define('KW_UC_DUBLIN', 42); +define('KW_POLAND', 43); +define('KW_RUSSIA', 44); +define('KW_SW_STATE_RUSSIA', 45); +define('KW_RAS', 46); +define('KW_PRBB', 47); +define('KW_UK', 48); +define('KW_OXFORD', 49); +define('KW_CHINA', 50); +define('KW_U_DAYTON', 51); +define('KW_WRIGHT_STATE', 52); +define('KW_USC', 53); +define('KW_FULLERTON', 54); +define('KW_ARIZONA_STATE', 55); $job_keywords = array(); @@ -120,32 +146,95 @@ keyword('KW_BIOMED', KW_CATEGORY_SCIENCE, 0, 0, keyword('KW_MATH_CS', KW_CATEGORY_SCIENCE, 0, 0, 'Mathematics and Computer Science' ); + keyword('KW_NUMBER_THEORY', KW_CATEGORY_SCIENCE, 1, KW_MATH_CS, + 'Number Theory' + ); + keyword('KW_CRYPTO', KW_CATEGORY_SCIENCE, 1, KW_MATH_CS, + 'Cryptography' + ); keyword('KW_AI', KW_CATEGORY_SCIENCE, 0, 0, 'Artificial Intelligence and Cognitive Science' ); keyword('KW_EARTH_SCI', KW_CATEGORY_SCIENCE, 0, 0, 'Earth sciences' ); + keyword('KW_ENV_RESEARCH', KW_CATEGORY_SCIENCE, 1, KW_EARTH_SCI, + 'Environmental research' + ); + keyword('KW_CLIMATE', KW_CATEGORY_SCIENCE, 1, KW_EARTH_SCI, + 'Climate research' + ); // Locations keyword('KW_EUROPE', KW_CATEGORY_LOC, 0, 0, 'Europe' ); + keyword('KW_CERN', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'CERN' + ); + keyword('KW_CZECH', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'Czech Republic' + ); + keyword('KW_CHARLES_PRAGUE', KW_CATEGORY_LOC, 2, KW_GERMANY, + 'Charles University in Prague' + ); keyword('KW_GERMANY', KW_CATEGORY_LOC, 1, KW_EUROPE, 'Germany' ); keyword('KW_AEI', KW_CATEGORY_LOC, 2, KW_GERMANY, 'Albert Einstein Institute for Gravitational Physics' ); - keyword('KW_CERN', KW_CATEGORY_LOC, 1, KW_EUROPE, - 'CERN' + keyword('KW_RECHENKRAFT', KW_CATEGORY_LOC, 2, KW_GERMANY, + 'Rechenkraft.net e.V' + ); + keyword('KW_RHEINMAIN', KW_CATEGORY_LOC, 2, KW_GERMANY, + 'Hochschule RheinMain University of Applied Sciences' + ); + keyword('KW_HUNGARY', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'Hungary' ); + keyword('KW_IRELAND', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'Ireland' + ); + keyword('KW_UC_DUBLIN', KW_CATEGORY_LOC, 2, KW_IRELAND, + 'University College Dublin' + ); + keyword('KW_POLAND', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'Poland' + ); + keyword('KW_RUSSIA', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'Russia' + ); + keyword('KW_SW_STATE_RUSSIA', KW_CATEGORY_LOC, 2, KW_SPAIN, + 'Southwest State University, Russia' + ); + keyword('KW_RAS', KW_CATEGORY_LOC, 2, KW_SPAIN, + 'Russian Academy of Science' + ); + keyword('KW_SPAIN', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'Spain' + ); + keyword('KW_SAN_JORGE', KW_CATEGORY_LOC, 2, KW_SPAIN, + 'San Jorge University, Zaragoza, Spain' + ); + keyword('KW_PRBB', KW_CATEGORY_LOC, 2, KW_SPAIN, + 'Barcelona Biomedical Research Park' + ); + keyword('KW_UK', KW_CATEGORY_LOC, 1, KW_EUROPE, + 'United Kingdom' + ); + keyword('KW_OXFORD', KW_CATEGORY_LOC, 2, KW_UK, + 'Oxford University' + ); keyword('KW_ASIA', KW_CATEGORY_LOC, 0, 0, 'Asia' ); + keyword('KW_CHINA', KW_CATEGORY_LOC, 1, KW_ASIA, + 'China' + ); keyword('KW_AMERICAS', KW_CATEGORY_LOC, 0, 0, - 'The Americas' + 'Americas' ); keyword('KW_US', KW_CATEGORY_LOC, 1, KW_AMERICAS, 'United States' @@ -156,4 +245,19 @@ keyword('KW_AMERICAS', KW_CATEGORY_LOC, 0, 0, keyword('KW_UW', KW_CATEGORY_LOC, 2, KW_US, 'University of Washington' ); + keyword('KW_U_DAYTON', KW_CATEGORY_LOC, 2, KW_US, + 'University of Dayton' + ); + keyword('KW_WRIGHT_STATE', KW_CATEGORY_LOC, 2, KW_US, + 'Wright State University' + ); + keyword('KW_USC', KW_CATEGORY_LOC, 2, KW_US, + 'University of Southern California' + ); + keyword('KW_FULLERTON', KW_CATEGORY_LOC, 2, KW_US, + 'California State University Fullerton' + ); + keyword('KW_ARIZONA_STATE', KW_CATEGORY_LOC, 2, KW_US, + 'Arizona State University' + ); ?> diff --git a/html/user/workunit.php b/html/user/workunit.php index 34cf318c0e..cbf6933c55 100644 --- a/html/user/workunit.php +++ b/html/user/workunit.php @@ -21,64 +21,86 @@ require_once("../inc/util.inc"); require_once("../inc/boinc_db.inc"); require_once("../inc/result.inc"); +require_once("../inc/keywords.inc"); check_get_args(array("wuid")); -BoincDb::get(true); +function keyword_string($kwds) { + global $job_keywords; + + $ks = explode(" ", $kwds); + $first = true; + $x = ""; + foreach ($ks as $k) { + if ($first) { + $first = false; + } else { + $x .= ", "; + } + $x .= $job_keywords[$k]->name; + } + return $x; +} + +function show_wu($wu) { + page_head(tra("Workunit %1", $wu->id)); + $app = BoincApp::lookup_id($wu->appid); + + start_table(); + row2(tra("name"), $wu->name); + row2(tra("application"), $app->user_friendly_name); + row2(tra("created"), time_str($wu->create_time)); + if ($wu->keywords) { + row2(tra("keywords"), keyword_string($wu->keywords)); + } + if ($wu->canonical_resultid) { + row2(tra("canonical result"), + "canonical_resultid>$wu->canonical_resultid" + ); + row2(tra("granted credit"), format_credit($wu->canonical_credit)); + } + + // if app is using adaptive replication and no canonical result yet, + // don't show anything more + // (so that bad guys can't tell if they have an unreplicated job) + + $config = get_config(); + if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) { + row2(tra("Tasks in progress"), tra("suppressed pending completion")); + end_table(); + } else { + row2(tra("minimum quorum"), $wu->min_quorum); + row2(tra("initial replication"), $wu->target_nresults); + row2(tra("max # of error/total/success tasks"), + "$wu->max_error_results, $wu->max_total_results, $wu->max_success_results" + ); + if ($wu->error_mask) { + row2(tra("errors"), wu_error_mask_str($wu->error_mask)); + } + if ($wu->need_validate) { + row2(tra("validation"), tra("Pending")); + } + if (function_exists('project_workunit')) { + project_workunit($wu); + } + end_table(); + + result_table_start(false, true, null); + $results = BoincResult::enum("workunitid=$wu->id"); + foreach ($results as $result) { + show_result_row($result, false, true, false); + } + echo "\n"; + } + + page_tail(); +} $wuid = get_int("wuid"); $wu = BoincWorkunit::lookup_id($wuid); if (!$wu) { error_page(tra("can't find workunit")); } - -page_head(tra("Workunit %1", $wuid)); -$app = BoincApp::lookup_id($wu->appid); - -start_table(); -row2(tra("name"), $wu->name); -row2(tra("application"), $app->user_friendly_name); -row2(tra("created"), time_str($wu->create_time)); -if ($wu->canonical_resultid) { - row2(tra("canonical result"), - "canonical_resultid>$wu->canonical_resultid" - ); - row2(tra("granted credit"), format_credit($wu->canonical_credit)); -} - -// if app is using adaptive replication and no canonical result yet, -// don't show anything more -// (so that bad guys can't tell if they have an unreplicated job) - -$config = get_config(); -if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) { - row2(tra("Tasks in progress"), tra("suppressed pending completion")); - end_table(); -} else { - row2(tra("minimum quorum"), $wu->min_quorum); - row2(tra("initial replication"), $wu->target_nresults); - row2(tra("max # of error/total/success tasks"), - "$wu->max_error_results, $wu->max_total_results, $wu->max_success_results" - ); - if ($wu->error_mask) { - row2(tra("errors"), wu_error_mask_str($wu->error_mask)); - } - if ($wu->need_validate) { - row2(tra("validation"), tra("Pending")); - } - if (function_exists('project_workunit')) { - project_workunit($wu); - } - end_table(); - - result_table_start(false, true, null); - $results = BoincResult::enum("workunitid=$wuid"); - foreach ($results as $result) { - show_result_row($result, false, true, false); - } - echo "\n"; -} - -page_tail(); +show_wu($wu); ?>