From 3f91d426523519596ebc3bd03e7339538666f015 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 31 Jul 2017 20:56:40 -0700 Subject: [PATCH] BOINC web: some bootstrap conversion --- doc/help_lang.php | 14 ++-- doc/keywords.php | 95 +++++++++++++++++++++++++ html/inc/keywords.inc | 159 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 263 insertions(+), 5 deletions(-) create mode 100644 doc/keywords.php create mode 100644 html/inc/keywords.inc diff --git a/doc/help_lang.php b/doc/help_lang.php index e31da2d416..cae3062768 100644 --- a/doc/help_lang.php +++ b/doc/help_lang.php @@ -1,6 +1,10 @@ status; $image = button_image($status); - list_item_array(array( + row_array(array( vol_info($vol), vol_modes($vol), info($vol), @@ -109,8 +113,8 @@ function show_vols($vols) { boinc_projects email list. "; - list_start("border=0"); - list_heading_array(array( + start_table("table-striped"); + row_heading_array(array( "Volunteer name
click to contact", "Voice/Text", "Info", @@ -119,7 +123,7 @@ function show_vols($vols) { foreach ($vols as $vol) { show_vol($vol); } - list_end(); + end_table(); } if ($lang) { diff --git a/doc/keywords.php b/doc/keywords.php new file mode 100644 index 0000000000..cefb267d7b --- /dev/null +++ b/doc/keywords.php @@ -0,0 +1,95 @@ +. + +// show keywords as XML or as C or Python defines + +require_once("../inc/xml.inc"); +require_once("../inc/util_basic.inc"); +require_once("keywords.inc"); + +function kw_xml($id, $kw) { + echo " + $id + $kw->category + $kw->level + $kw->name + $kw->symbol +"; + if ($kw->level > 0) { + echo " $kw->parent\n"; + } + echo "\n"; +} + +function show_xml() { + global $job_keywords; + xml_header(); + echo "\n"; + foreach ($job_keywords as $id=>$kw) { + kw_xml($id, $kw); + } + echo "\n"; +} + +function show_c() { + global $job_keywords; + header('Content-type:text/plain'); + foreach ($job_keywords as $id=>$kw) { + echo "#define $kw->symbol $id\n"; + } +} + +function show_python() { + global $job_keywords; + header('Content-type:text/plain'); + foreach ($job_keywords as $id=>$kw) { + echo "$kw->symbol = $id\n"; + } +} + +function show_bash() { + global $job_keywords; + header('Content-type:text/plain'); + foreach ($job_keywords as $id=>$kw) { + echo "$kw->symbol='$id'\n"; + } +} + +function show_php() { + global $job_keywords; + header('Content-type:text/plain'); + foreach ($job_keywords as $id=>$kw) { + echo "define('$kw->symbol', $id);\n"; + } +} + +$header = get_str('header', true); +if ($header == 'c') { + show_c(); +} else if ($header == 'python') { + show_python(); +} else if ($header == 'bash') { + show_bash(); +} else if ($header == 'php') { + show_php(); +} else { + show_xml(); +} + +?> diff --git a/html/inc/keywords.inc b/html/inc/keywords.inc new file mode 100644 index 0000000000..47c6405efa --- /dev/null +++ b/html/inc/keywords.inc @@ -0,0 +1,159 @@ +. + +// job/project/preference keywords, master list + +define('KW_CATEGORY_SCIENCE', 0); +define('KW_CATEGORY_LOC', 1); + +define('KW_ASTRONOMY', 1); +define('KW_SETI', 2); +define('KW_PULSARS', 3); +define('KW_GW', 4); +define('KW_COSMOLOGY', 5); +define('KW_PHYSICS', 6); +define('KW_PARTICLE_PHYSICS', 7); +define('KW_NANOSCIENCE', 8); +define('KW_BIOMED', 9); +define('KW_DRUG_DISCOVERY', 10); +define('KW_PROTEINS', 11); +define('KW_GENETICS', 12); +define('KW_DISEASE', 13); +define('KW_CANCER', 14); +define('KW_MATH_CS', 15); +define('KW_AI', 16); +define('KW_DIABETES', 17); +define('KW_CANCER_PROSTATE', 18); +define('KW_CANCER_BREAST', 19); +define('KW_EUROPE', 20); +define('KW_GERMANY', 21); +define('KW_ASIA', 22); +define('KW_AMERICAS', 23); +define('KW_US', 24); +define('KW_UCB', 25); +define('KW_AEI', 26); +define('KW_CERN', 27); +define('KW_UW', 28); +define('KW_EARTH_SCI', 29); + +$job_keywords = array(); + +function keyword($symbol, $category, $level, $parent, $name) { + global $job_keywords; + $x = (object)array( + 'category'=>$category, + 'level'=>$level, + 'parent'=>$parent, + 'name'=>$name, + 'symbol'=>$symbol + ); + $job_keywords[constant($symbol)] = $x; +} + +keyword('KW_ASTRONOMY', KW_CATEGORY_SCIENCE, 0, 0, + 'Astronomy' +); + keyword('KW_SETI', KW_CATEGORY_SCIENCE, 1, KW_ASTRONOMY, + 'Search for Extraterrestrial Intelligence' + ); + keyword('KW_PULSARS', KW_CATEGORY_SCIENCE, 1, KW_ASTRONOMY, + 'Detection and study of pulsars' + ); + keyword('KW_GW', KW_CATEGORY_SCIENCE, 1, KW_ASTRONOMY, + 'Detection and study of gravitational waves' + ); + keyword('KW_COSMOLOGY', KW_CATEGORY_SCIENCE, 1, KW_ASTRONOMY, + 'Cosmology' + ); +keyword('KW_PHYSICS', KW_CATEGORY_SCIENCE, 0, 0, + 'Physics' +); + keyword('KW_PARTICLE_PHYSICS', KW_CATEGORY_SCIENCE, 1, KW_PHYSICS, + 'Particle physics' + ); + keyword('KW_NANOSCIENCE', KW_CATEGORY_SCIENCE, 1, KW_PHYSICS, + 'Nanoscience' + ); +keyword('KW_BIOMED', KW_CATEGORY_SCIENCE, 0, 0, + 'Biology and Medicine' +); + keyword('KW_DRUG_DISCOVERY', KW_CATEGORY_SCIENCE, 1, KW_BIOMED, + 'Drug discovery' + ); + keyword('KW_PROTEINS', KW_CATEGORY_SCIENCE, 1, KW_BIOMED, + 'Protein research' + ); + keyword('KW_GENETICS', KW_CATEGORY_SCIENCE, 1, KW_BIOMED, + 'Genetics and Phylogeny' + ); + keyword('KW_DISEASE', KW_CATEGORY_SCIENCE, 1, KW_BIOMED, + 'Disease research' + ); + keyword('KW_DIABETES', KW_CATEGORY_SCIENCE, 2, KW_DISEASE, + 'Diabetes research' + ); + keyword('KW_CANCER', KW_CATEGORY_SCIENCE, 2, KW_DISEASE, + 'Cancer research' + ); + keyword('KW_CANCER_PROSTATE', KW_CATEGORY_SCIENCE, 3, KW_CANCER, + 'Prostate cancer research' + ); + keyword('KW_CANCER_BREAST', KW_CATEGORY_SCIENCE, 3, KW_CANCER, + 'Breast cancer research' + ); +keyword('KW_MATH_CS', KW_CATEGORY_SCIENCE, 0, 0, + 'Mathematics and Computer Science' +); +keyword('KW_AI', KW_CATEGORY_SCIENCE, 0, 0, + 'Artificial Intelligence and Cognitive Science' +); +keyword('KW_EARTH_SCI', KW_CATEGORY_SCIENCE, 0, 0, + 'Earth sciences' +); + +// Locations + +keyword('KW_EUROPE', KW_CATEGORY_LOC, 0, 0, + 'Europe' +); + 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_ASIA', KW_CATEGORY_LOC, 0, 0, + 'Asia' +); +keyword('KW_AMERICAS', KW_CATEGORY_LOC, 0, 0, + 'The Americas' +); + keyword('KW_US', KW_CATEGORY_LOC, 1, KW_AMERICAS, + 'United States' + ); + keyword('KW_UCB', KW_CATEGORY_LOC, 2, KW_US, + 'University of California, Berkeley' + ); + keyword('KW_UW', KW_CATEGORY_LOC, 2, KW_US, + 'University of Washington' + ); +?>