@@ -12,7 +12,7 @@ |
||
12 | 12 | table_row( |
13 | 13 | $desc->long_name, |
14 | 14 | $desc->description, |
15 | - empty($desc->url)?'':"<a href=$desc->url>View</a>", |
|
15 | + empty($desc->url) ? '' : "<a href=$desc->url>View</a>", |
|
16 | 16 | kw_array_to_str($desc->sci_kw) |
17 | 17 | ); |
18 | 18 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // show list of BUDA apps and variants, |
53 | 53 | // w/ buttons for adding and deleting |
54 | 54 | // |
55 | -function app_list($notice=null) { |
|
55 | +function app_list($notice = null) { |
|
56 | 56 | global $buda_root; |
57 | 57 | if (!is_dir($buda_root)) { |
58 | 58 | mkdir($buda_root); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | // |
247 | 247 | $x = "<input_template>\n"; |
248 | 248 | $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files); |
249 | - for ($i=0; $i<$ninfiles; $i++) { |
|
249 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
250 | 250 | $x .= " <file_info>\n <sticky/>\n <no_delete/>\n <executable/>\n </file_info>\n"; |
251 | 251 | } |
252 | 252 | $x .= " <workunit>\n"; |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
456 | -function app_form($desc=null) { |
|
457 | - page_head_select2($desc?"Edit Docker app $desc->name":'Create Docker app'); |
|
456 | +function app_form($desc = null) { |
|
457 | + page_head_select2($desc ? "Edit Docker app $desc->name" : 'Create Docker app'); |
|
458 | 458 | form_start('buda.php'); |
459 | 459 | form_input_hidden('action', 'app_action'); |
460 | 460 | if ($desc) { |
@@ -465,22 +465,22 @@ discard block |
||
465 | 465 | form_input_text('Internal name<br><small>No spaces</small>', 'name'); |
466 | 466 | } |
467 | 467 | form_input_text('User-visible name', 'long_name', |
468 | - $desc?$desc->long_name:null |
|
468 | + $desc ? $desc->long_name : null |
|
469 | 469 | ); |
470 | 470 | form_input_textarea( |
471 | 471 | 'Description<br><small>... of what the app does and of the research goals</small>', |
472 | 472 | 'description', |
473 | - $desc?$desc->description:null |
|
473 | + $desc ? $desc->description : null |
|
474 | 474 | ); |
475 | 475 | form_select2_multi('Science keywords', |
476 | 476 | 'sci_kw', |
477 | 477 | keyword_select_options(KW_CATEGORY_SCIENCE), |
478 | - $desc?$desc->sci_kw:null |
|
478 | + $desc ? $desc->sci_kw : null |
|
479 | 479 | ); |
480 | 480 | form_input_text( |
481 | 481 | 'URL of web page describing app', |
482 | 482 | 'url', |
483 | - $desc?$desc->url:'' |
|
483 | + $desc ? $desc->url : '' |
|
484 | 484 | ); |
485 | 485 | // don't include location keywords; |
486 | 486 | // various people may submit jobs to this app |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | form_input_hidden('app', $app); |
199 | 199 | form_input_hidden('action', 'variant_action'); |
200 | 200 | form_input_text("Plan class$pc", 'variant'); |
201 | - form_select("Dockerfile$sb", 'dockerfile', $sbitems); |
|
201 | + form_select("dockerfile$sb", 'dockerfile', $sbitems); |
|
202 | 202 | form_select2_multi("Application files$sb", 'app_files', $sbitems, null); |
203 | 203 | form_input_text( |
204 | 204 | 'Input file names<br><small>Space-separated</small>', |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | // Note: we don't currently allow indirect file access. |
384 | 384 | // If we did, we'd need to create job.toml to mount project dir |
385 | 385 | |
386 | - app_list("Variant $variant added for app $app."); |
|
386 | + app_list("variant $variant added for app $app."); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | function variant_delete() { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if ($ret) { |
411 | 411 | error_page("delete failed"); |
412 | 412 | } |
413 | - $notice = "Variant $variant of app $app removed."; |
|
413 | + $notice = "variant $variant of app $app removed."; |
|
414 | 414 | app_list($notice); |
415 | 415 | } else { |
416 | 416 | page_head("Confirm"); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | if ($ret) { |
441 | 441 | error_page('delete failed'); |
442 | 442 | } |
443 | - $notice = "App $app removed."; |
|
443 | + $notice = "app $app removed."; |
|
444 | 444 | app_list($notice); |
445 | 445 | } else { |
446 | 446 | page_head('Confirm'); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | $dir = "$buda_root/$name"; |
507 | 507 | if (file_exists($dir)) { |
508 | - error_page("App $name already exists."); |
|
508 | + error_page("app $name already exists."); |
|
509 | 509 | } |
510 | 510 | mkdir($dir); |
511 | 511 | $desc->user_id = $user->id; |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | // prefix for links; needed for pages not in top dir |
142 | 142 | $user, |
143 | 143 | // logged-in user, if any |
144 | - $fixed=false, |
|
144 | + $fixed = false, |
|
145 | 145 | // if true, navbar is fixed at top of page. |
146 | 146 | // NOTE: if you do this, you must set a global var $fixed_navbar |
147 | 147 | // to true at compile time |
148 | 148 | // (it needs to be set when page_head() is called). |
149 | - $inverse=false |
|
149 | + $inverse = false |
|
150 | 150 | // white on black? |
151 | 151 | ) { |
152 | 152 | global $master_url; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // output a panel. |
227 | 227 | // $content_func is a function that generates the panel contents |
228 | 228 | // |
229 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
229 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
230 | 230 | echo sprintf('<div class="panel %s"> |
231 | 231 | ', $class |
232 | 232 | ); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // $left_width is the width of left column in 1/12 units. |
254 | 254 | // $arg is passed to the functions. |
255 | 255 | // |
256 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
256 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
257 | 257 | echo ' |
258 | 258 | <div class="container-fluid"> |
259 | 259 | '; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | </div> |
269 | 269 | '; |
270 | 270 | } |
271 | - $right_width = 12-$left_width; |
|
271 | + $right_width = 12 - $left_width; |
|
272 | 272 | echo ' |
273 | 273 | <div class="row"> |
274 | 274 | <div class="col-sm-'.$left_width.'"> |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | // use extra = "name=x" |
293 | 293 | // call forum_focus(x, foo) after defining the field |
294 | 294 | // |
295 | -function form_start($action, $method='get', $extra='') { |
|
295 | +function form_start($action, $method = 'get', $extra = '') { |
|
296 | 296 | echo sprintf( |
297 | 297 | '<div class="container-fluid"> |
298 | 298 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // just the input field |
325 | 325 | // |
326 | 326 | function form_input_text_field( |
327 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
327 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
328 | 328 | ) { |
329 | 329 | return sprintf( |
330 | 330 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | // the whole row |
336 | 336 | // |
337 | 337 | function form_input_text( |
338 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
338 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
339 | 339 | ) { |
340 | 340 | echo sprintf(' |
341 | 341 | <div class="form-group"> |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | ); |
364 | 364 | } |
365 | 365 | |
366 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
366 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
367 | 367 | echo sprintf(' |
368 | 368 | <div class="form-group"> |
369 | 369 | <label align=right class="%s" for="%s">%s</label> |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | // $items is either a string of <option> elements, |
381 | 381 | // or an array of [value, name] pairs |
382 | 382 | // |
383 | -function form_select($label, $name, $items, $selected=null) { |
|
383 | +function form_select($label, $name, $items, $selected = null) { |
|
384 | 384 | echo sprintf(' |
385 | 385 | <div class="form-group"> |
386 | 386 | <label align=right class="%s" for="%s">%s</label> |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | foreach ($items as $i) { |
394 | 394 | echo sprintf( |
395 | 395 | '<option %s value=%s>%s</option>', |
396 | - ($i[0]==$selected)?'selected':'', |
|
396 | + ($i[0] == $selected) ? 'selected' : '', |
|
397 | 397 | $i[0], $i[1] |
398 | 398 | ); |
399 | 399 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | // same, for multiple select. |
407 | 407 | // $selected, if non-null, is a list of selected values |
408 | 408 | // |
409 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { |
|
409 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { |
|
410 | 410 | echo sprintf(' |
411 | 411 | <div class="form-group"> |
412 | 412 | <label align=right class="%s" for="%s">%s</label> |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | foreach ($items as $i) { |
419 | 419 | echo sprintf( |
420 | 420 | '<option %s value=%s>%s</option>', |
421 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
421 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
422 | 422 | $i[0], $i[1] |
423 | 423 | ); |
424 | 424 | } |
@@ -427,12 +427,12 @@ discard block |
||
427 | 427 | |
428 | 428 | // return a list of strings for checkbox items |
429 | 429 | // |
430 | -function checkbox_item_strings($items, $attrs='') { |
|
430 | +function checkbox_item_strings($items, $attrs = '') { |
|
431 | 431 | $x = []; |
432 | 432 | foreach ($items as $i) { |
433 | 433 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
434 | 434 | ', |
435 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
435 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
436 | 436 | ); |
437 | 437 | } |
438 | 438 | return $x; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | // $items is list of (name, label, checked) |
442 | 442 | // |
443 | -function form_checkboxes($label, $items, $attrs='') { |
|
443 | +function form_checkboxes($label, $items, $attrs = '') { |
|
444 | 444 | echo sprintf(' |
445 | 445 | <div class="form-group"> |
446 | 446 | <label align=right class="%s">%s</label> |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // |
460 | 460 | function form_radio_buttons( |
461 | 461 | $label, $name, $items, $selected, |
462 | - $assign_ids=false // assign IDs to buttons based on names |
|
462 | + $assign_ids = false // assign IDs to buttons based on names |
|
463 | 463 | ) { |
464 | 464 | echo sprintf(' |
465 | 465 | <div class="form-group"> |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
470 | 470 | ); |
471 | 471 | foreach ($items as $i) { |
472 | - $checked = ($selected == $i[0])?"checked":""; |
|
472 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
473 | 473 | if ($assign_ids) { |
474 | 474 | $id = sprintf('id="%s_%s"', $name, $i[0]); |
475 | 475 | } else { |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | '; |
508 | 508 | } |
509 | 509 | |
510 | -function form_submit($text, $attrs='') { |
|
510 | +function form_submit($text, $attrs = '') { |
|
511 | 511 | form_general( |
512 | 512 | "", |
513 | 513 | sprintf( |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | ); |
518 | 518 | } |
519 | 519 | |
520 | -function form_checkbox($label, $name, $checked=false) { |
|
520 | +function form_checkbox($label, $name, $checked = false) { |
|
521 | 521 | echo sprintf(' |
522 | 522 | <div class="form-group"> |
523 | 523 | <label align=right class="%s">%s</label> |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | <input type="checkbox" name="%s" %s> |
530 | 530 | </div> |
531 | 531 | </div> |
532 | - ', $name, $checked?"checked":"" |
|
532 | + ', $name, $checked ? "checked" : "" |
|
533 | 533 | ); |
534 | 534 | } |
535 | 535 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | // $selected is the list of selected values. |
558 | 558 | // $extra is e.g. id=foo |
559 | 559 | // |
560 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { |
|
560 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { |
|
561 | 561 | echo sprintf(' |
562 | 562 | <div class="form-group"> |
563 | 563 | <label align=right class="%s" for="%s">%s</label> |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | foreach ($items as $i) { |
570 | 570 | echo sprintf( |
571 | 571 | '<option %s value=%s>%s</option>', |
572 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
572 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
573 | 573 | $i[0], $i[1] |
574 | 574 | ); |
575 | 575 | } |
@@ -24,72 +24,72 @@ discard block |
||
24 | 24 | define('KW_CATEGORY_SCIENCE', 0); |
25 | 25 | define('KW_CATEGORY_LOC', 1); |
26 | 26 | |
27 | -define('KW_ASTRONOMY', 1); |
|
28 | -define('KW_SETI', 2); |
|
29 | -define('KW_PULSARS', 3); |
|
30 | -define('KW_GW', 4); |
|
31 | -define('KW_COSMOLOGY', 5); |
|
32 | -define('KW_PHYSICS', 6); |
|
27 | +define('KW_ASTRONOMY', 1); |
|
28 | +define('KW_SETI', 2); |
|
29 | +define('KW_PULSARS', 3); |
|
30 | +define('KW_GW', 4); |
|
31 | +define('KW_COSMOLOGY', 5); |
|
32 | +define('KW_PHYSICS', 6); |
|
33 | 33 | define('KW_PARTICLE_PHYSICS', 7); |
34 | -define('KW_NANOSCIENCE', 8); |
|
35 | -define('KW_BIOMED', 9); |
|
34 | +define('KW_NANOSCIENCE', 8); |
|
35 | +define('KW_BIOMED', 9); |
|
36 | 36 | define('KW_DRUG_DISCOVERY', 10); |
37 | -define('KW_PROTEINS', 11); |
|
38 | -define('KW_GENETICS', 12); |
|
39 | -define('KW_DISEASE', 13); |
|
40 | -define('KW_CANCER', 14); |
|
41 | -define('KW_MATH_CS', 15); |
|
42 | -define('KW_AI', 16); |
|
43 | -define('KW_OCEANIA', 17); |
|
44 | -define('KW_AUSTRALIA', 18); |
|
37 | +define('KW_PROTEINS', 11); |
|
38 | +define('KW_GENETICS', 12); |
|
39 | +define('KW_DISEASE', 13); |
|
40 | +define('KW_CANCER', 14); |
|
41 | +define('KW_MATH_CS', 15); |
|
42 | +define('KW_AI', 16); |
|
43 | +define('KW_OCEANIA', 17); |
|
44 | +define('KW_AUSTRALIA', 18); |
|
45 | 45 | |
46 | -define('KW_EUROPE', 20); |
|
47 | -define('KW_GERMANY', 21); |
|
48 | -define('KW_ASIA', 22); |
|
49 | -define('KW_AMERICAS', 23); |
|
50 | -define('KW_US', 24); |
|
51 | -define('KW_UCB', 25); |
|
52 | -define('KW_AEI', 26); |
|
53 | -define('KW_CERN', 27); |
|
54 | -define('KW_UW', 28); |
|
55 | -define('KW_EARTH_SCI', 29); |
|
56 | -define('KW_SPAIN', 30); |
|
57 | -define('KW_SAN_JORGE', 31); |
|
58 | -define('KW_NUMBER_THEORY', 32); |
|
59 | -define('KW_CRYPTO', 33); |
|
60 | -define('KW_ENV_RESEARCH', 34); |
|
61 | -define('KW_CLIMATE', 35); |
|
62 | -define('KW_CZECH', 36); |
|
46 | +define('KW_EUROPE', 20); |
|
47 | +define('KW_GERMANY', 21); |
|
48 | +define('KW_ASIA', 22); |
|
49 | +define('KW_AMERICAS', 23); |
|
50 | +define('KW_US', 24); |
|
51 | +define('KW_UCB', 25); |
|
52 | +define('KW_AEI', 26); |
|
53 | +define('KW_CERN', 27); |
|
54 | +define('KW_UW', 28); |
|
55 | +define('KW_EARTH_SCI', 29); |
|
56 | +define('KW_SPAIN', 30); |
|
57 | +define('KW_SAN_JORGE', 31); |
|
58 | +define('KW_NUMBER_THEORY', 32); |
|
59 | +define('KW_CRYPTO', 33); |
|
60 | +define('KW_ENV_RESEARCH', 34); |
|
61 | +define('KW_CLIMATE', 35); |
|
62 | +define('KW_CZECH', 36); |
|
63 | 63 | define('KW_CHARLES_PRAGUE', 37); |
64 | -define('KW_RECHENKRAFT', 38); |
|
65 | -define('KW_RHEINMAIN', 39); |
|
66 | -define('KW_HUNGARY', 40); |
|
67 | -define('KW_IRELAND', 41); |
|
68 | -define('KW_UC_DUBLIN', 42); |
|
69 | -define('KW_POLAND', 43); |
|
70 | -define('KW_RUSSIA', 44); |
|
64 | +define('KW_RECHENKRAFT', 38); |
|
65 | +define('KW_RHEINMAIN', 39); |
|
66 | +define('KW_HUNGARY', 40); |
|
67 | +define('KW_IRELAND', 41); |
|
68 | +define('KW_UC_DUBLIN', 42); |
|
69 | +define('KW_POLAND', 43); |
|
70 | +define('KW_RUSSIA', 44); |
|
71 | 71 | define('KW_SW_STATE_RUSSIA', 45); |
72 | -define('KW_RAS', 46); |
|
73 | -define('KW_PRBB', 47); |
|
74 | -define('KW_UK', 48); |
|
75 | -define('KW_OXFORD', 49); |
|
76 | -define('KW_CHINA', 50); |
|
77 | -define('KW_U_DAYTON', 51); |
|
78 | -define('KW_WRIGHT_STATE', 52); |
|
79 | -define('KW_USC', 53); |
|
80 | -define('KW_FULLERTON', 54); |
|
81 | -define('KW_ARIZONA_STATE', 55); |
|
82 | -define('KW_U_ILLINOIS', 56); |
|
83 | -define('KW_U_WARSAW', 57); |
|
84 | -define('KW_RPI', 58); |
|
85 | -define('KW_INTERNATIONAL', 59); |
|
86 | -define('KW_UND', 60); |
|
87 | -define('KW_HOLLAND', 61); |
|
88 | -define('KW_CHEMISTRY', 62); |
|
89 | -define('KW_GAMES', 63); |
|
90 | -define('KW_VIRUS', 64); |
|
91 | -define('KW_FRANCE', 65); |
|
92 | -define('KW_CANADA', 66); |
|
72 | +define('KW_RAS', 46); |
|
73 | +define('KW_PRBB', 47); |
|
74 | +define('KW_UK', 48); |
|
75 | +define('KW_OXFORD', 49); |
|
76 | +define('KW_CHINA', 50); |
|
77 | +define('KW_U_DAYTON', 51); |
|
78 | +define('KW_WRIGHT_STATE', 52); |
|
79 | +define('KW_USC', 53); |
|
80 | +define('KW_FULLERTON', 54); |
|
81 | +define('KW_ARIZONA_STATE', 55); |
|
82 | +define('KW_U_ILLINOIS', 56); |
|
83 | +define('KW_U_WARSAW', 57); |
|
84 | +define('KW_RPI', 58); |
|
85 | +define('KW_INTERNATIONAL', 59); |
|
86 | +define('KW_UND', 60); |
|
87 | +define('KW_HOLLAND', 61); |
|
88 | +define('KW_CHEMISTRY', 62); |
|
89 | +define('KW_GAMES', 63); |
|
90 | +define('KW_VIRUS', 64); |
|
91 | +define('KW_FRANCE', 65); |
|
92 | +define('KW_CANADA', 66); |
|
93 | 93 | |
94 | 94 | $job_keywords = array(); |
95 | 95 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | -function kw_options($id, $indent='') { |
|
333 | +function kw_options($id, $indent = '') { |
|
334 | 334 | global $job_keywords; |
335 | 335 | $kw = $job_keywords[$id]; |
336 | 336 | $opts = [[$id, "$indent$kw->name"]]; |