1<?php 2 3/* 4 Phoronix Test Suite 5 URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/ 6 Copyright (C) 2014 - 2018, Phoronix Media 7 Copyright (C) 2014 - 2018, Michael Larabel 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. 21*/ 22 23 24class phoromatic_r_add_test_build_suite_details implements pts_webui_interface 25{ 26 public static function page_title() 27 { 28 return ''; 29 } 30 public static function page_header() 31 { 32 return null; 33 } 34 public static function preload($PAGE) 35 { 36 return true; 37 } 38 public static function render_page_process($PATH) 39 { 40 $test_profile = new pts_test_profile($_GET['tp']); 41 $name = $test_profile->get_title(); 42 $description = $test_profile->get_description(); 43 44 $tid = 't_' . rand(1, 20000); 45 echo '<div id="' . $tid . '">'; 46 echo '<p align="right"><a onclick="javascript:phoromatic_remove_from_suite_list(\'' . $tid . '\');">Remove Test</a></p>'; 47 echo '<h2>' . $name . ' [' . $test_profile->get_identifier() . '] </h2>'; 48 echo '<p><em>' . $description . '</em></p>'; 49 echo '<p>More information on this test can be found via <a href="?tests/' . $test_profile->get_identifier() . '">the test profile page</a> or <a target="_blank" href="http://openbenchmarking.org/test/' . $test_profile->get_identifier() . '">OpenBenchmarking.org</a>.</p>'; 50 51 $test_options = $test_profile->get_test_option_objects(); 52 53 echo '<input type="hidden" name="test_add[]" value="' . $test_profile->get_identifier() . '" />'; 54 $test_prefix = "test_option_" . str_replace('.', '-', microtime(true)) . "_"; 55 echo '<input type="hidden" name="test_prefix[]" value="' . $test_prefix . '" />'; 56 57 if(count($test_options) == 0) 58 { 59 echo '<p><strong>No configurable user options for this test.</strong></p>'; 60 } 61 else 62 { 63 for($i = 0; $i < count($test_options); $i++) 64 { 65 $o = $test_options[$i]; 66 $option_count = $o->option_count(); 67 68 echo '<p id="' . $test_prefix . $o->get_identifier() . '_name">' . $o->get_name() . '</p>'; 69 70 if($option_count == 0) 71 { 72 echo '<p><input type="text" name="' . $test_prefix . $o->get_identifier() . '" id="' . $test_prefix . $o->get_identifier() . '" /></p>'; 73 } 74 else 75 { 76 echo '<p><select name="' . $test_prefix . $o->get_identifier() . '" id="' . $test_prefix . $o->get_identifier() . '" onChange="phoromatic_test_select_update_selected_name(this);" onload="phoromatic_test_select_update_selected_name(this);">'; 77 78 $opts = array(); 79 $selected_index = 0; 80 for($j = 0; $j < $option_count; $j++) 81 { 82 $v = $o->format_option_value_from_input($o->get_option_value($j)); 83 $selected = isset($_GET['tpa']) && strpos($_GET['tpa'], $o->get_option_name($j)) !== false; 84 if($selected) 85 { 86 $selected_index = $j; 87 } 88 echo '<option value="' . $v . '" ' . ($selected ? 'selected="selected"' : null) . '>' . $o->get_option_name($j) . '</option>'; 89 $opts[] = $o->get_name() . ': ' . $o->get_option_name($j) . '::' . $v; 90 } 91 if($j > 1) 92 { 93 echo '<option value="' . implode('||', $opts) . '">Test All Options</option>'; 94 } 95 96 echo '</select></p>'; 97 echo '<input name="' . $test_prefix . $o->get_identifier() . '_selected" id="' . $test_prefix . $o->get_identifier() . '_selected" type="hidden" value="' . $o->get_name() . ': ' . $o->get_option_name($selected_index) . '" />'; 98 } 99 } 100 } 101 echo '<hr />'; 102 echo '</div>'; 103 } 104} 105 106?> 107