web: finish job of making headings blue in striped tables

i.e. use row_heading() or row_heading_array() to generate the heading
This commit is contained in:
David Anderson 2016-12-02 23:25:01 -08:00
parent b2a93ac843
commit 107b170ae1
10 changed files with 89 additions and 105 deletions

View File

@ -216,28 +216,23 @@ function top_host_table_start($sort_by) {
global $host_sites;
shuffle($host_sites);
start_table('table-striped');
echo "<tr>";
echo "<th>".tra("Computer info")."</th>\n";
echo "<th>".tra("Rank")."</th>";
echo "<th>".tra("Owner")."</th>\n";
$x = array(
tra("Computer info"),
tra("Rank"),
tra("Owner"),
);
if ($sort_by == 'total_credit') {
echo "
<th><a href=top_hosts.php?sort_by=expavg_credit>".tra("Avg. credit")."</a></th>
<th>".tra("Total credit")."</th>
";
$x[] = "<a href=top_hosts.php?sort_by=expavg_credit>".tra("Avg. credit")."</a>";
$x[] = tra("Total credit");
} else {
echo "
<th>".tra("Recent average credit")."</th>
<th><a href=top_hosts.php?sort_by=total_credit>".tra("Total credit")."</a></th>
";
$x[] = tra("Recent average credit");
$x[] = "<a href=top_hosts.php?sort_by=total_credit>".tra("Total credit")."</a>";
}
echo "
<th>".tra("BOINC version")."</th>
<th>".tra("CPU")."</th>
<th>".tra("GPU")."</th>
<th>".tra("Operating system")."</th>
</tr>
";
$x[] = tra("BOINC version");
$x[] = tra("CPU");
$x[] = tra("GPU");
$x[] = tra("Operating system");
row_heading_array($x);
}
function host_nresults($host) {
@ -668,32 +663,33 @@ function user_host_table_start(
$private, $sort, $rev, $show_all, $any_product_name
) {
start_table('table-striped');
echo "<tr>";
$x = array();
$url = link_url_rev($sort, "id", $rev, $show_all);
echo "<th><a href=$url>".tra("Computer ID")."</a></th>\n";
$x[] = "<a href=$url>".tra("Computer ID")."</a>";
if ($private) {
$url = link_url_rev($sort, "name", $rev, $show_all);
echo "<th><a href=$url>".tra("Name")."</a></th>\n";
$x[] = "<a href=$url>".tra("Name")."</a>";
$url = link_url_rev($sort, "venue", $rev, $show_all);
if ($any_product_name) {
echo "<th>Model</th>\n";
$x[] = tra("Model");
}
echo "<th><a href=$url>".tra("Location")."</th>\n";
$x[] = "<a href=$url>".tra("Location")."</a>";
} else {
echo "<th>".tra("Rank")."</th>";
$x[] = tra("Rank");
}
$url = link_url_rev($sort, "expavg_credit", $rev, $show_all);
echo "<th><a href=$url>".tra("Avg. credit")."</a></th>\n";
$x[] = "<a href=$url>".tra("Avg. credit")."</a>";
$url = link_url_rev($sort, "total_credit", $rev, $show_all);
echo "<th><a href=$url>".tra("Total credit")."</a></th>\n";
echo "<th>".tra("BOINC<br>version")."</th>\n";
$x[] = "<a href=$url>".tra("Total credit")."</a>";
$x[] = tra("BOINC<br>version");
$url = link_url_rev($sort, "cpu", $rev, $show_all);
echo "<th><a href=$url>".tra("CPU")."</a></th>\n";
echo "<th>".tra("GPU")."</th>\n";
$x[] = "<a href=$url>".tra("CPU")."</a>";
$x[] = tra("GPU");
$url = link_url_rev($sort, "os", $rev, $show_all);
echo "<th><a href=$url>".tra("Operating System")."</a></th>\n";
$x[] = "<a href=$url>".tra("Operating System")."</a>";
$url = link_url_rev($sort, "rpc_time", $rev, $show_all);
echo "<th><a href=$url>".tra("Last contact")."</a></th>\n";
$x[] = "<a href=$url>".tra("Last contact")."</a>";
row_heading_array($x);
}
function show_user_hosts($userid, $private, $show_all, $sort, $rev) {

View File

@ -490,9 +490,8 @@ function prefs_display_venue($prefs, $venue, $subset) {
if (isset($prefs->$venue)) $x = $prefs->$venue;
if ($x) {
echo "<h3>".tra("Separate preferences for %1", $venue)."</h3>";
echo "<tr><td colspan=2>";
start_table();
row_heading(tra("Separate preferences for %1", $venue));
if ($subset == "global") {
prefs_show_global($x);
} else {

View File

@ -113,9 +113,9 @@ if (project_has_beta()) {
);
}
if (defined("EMAIL_FROM")) {
$x = "<br><p class=\"text-muted\">"
$x = "<br><small>"
.tra("Emails will be sent from %1; make sure your spam filter accepts this address.", EMAIL_FROM)
."</p>";
."</small>";
} else {
$x = "";
}
@ -271,8 +271,8 @@ function print_prefs_display_project($user, $columns=false) {
$switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
if ($columns) {
echo "<h3>".tra("Combined preferences").$switch_link."</h3>";
start_table();
row_heading(tra("Combined preferences").$switch_link);
prefs_show_privacy($user, true);
venue_show($user);
row_top(tra("Project specific settings"));
@ -281,10 +281,10 @@ function print_prefs_display_project($user, $columns=false) {
row_links("project", $project_prefs);
end_table();
} else {
if (isset($project_prefs->home) || isset($project_prefs->work) || isset($project_prefs->school)) {
echo "<h3>".tra("Primary (default) preferences").$switch_link."</h3>";
}
start_table();
if (isset($project_prefs->home) || isset($project_prefs->work) || isset($project_prefs->school)) {
row_heading(tra("Primary (default) preferences").$switch_link);
}
prefs_show_project($project_prefs, false);
prefs_show_privacy($user, false);
venue_show($user);

View File

@ -358,46 +358,43 @@ function result_page_url($info) {
function result_table_start($show_wu_link, $show_host_link, $info) {
start_table('table-striped');
echo "<tr>";
$x = array();
if ($info) {
if ($info->show_names) {
$i2 = clone $info;
$i2->show_names = 0;
$url = result_page_url($i2);
echo "<th>".tra("Task name")."<br><small>".tra("click for details")."<br><a href=$url>".tra("Show IDs")."</a></small></th>\n";
$x[] = tra("Task name")."<br><small>".tra("click for details")."<br><a href=$url>".tra("Show IDs")."</a></small>";
} else {
$i2 = clone $info;
$i2->show_names = 1;
$url = result_page_url($i2);
echo "<th>Task<br><small>".tra("click for details")."<br><a href=$url>".tra("Show names")."</a></small></th>\n";
$x[] = "Task<br><small>".tra("click for details")."<br><a href=$url>".tra("Show names")."</a></small>";
}
} else {
echo "<th>".tra("Task")."<br><small>".tra("click for details")."</small></th>\n";
$x[] = tra("Task")."<br><small>".tra("click for details")."</small>";
}
if ($show_wu_link) {
echo "<th>".tra("Work unit")."<br><small>".tra("click for details")."</small></th>\n";
$x[] = tra("Work unit")."<br><small>".tra("click for details")."</small>";
if (function_exists('project_result_info_heading')) {
$x = project_result_info_heading();
if ($x) {
echo "<th>$x</th>\n";
$y = project_result_info_heading();
if ($y) {
$x[] = $y;
}
}
}
if ($show_host_link) {
echo "<th>".tra("Computer")."</th>\n";
$x[] = tra("Computer");
}
echo "
<th>".tra("Sent")."</th>
<th>".tra("Time reported<br />or deadline")."
<br><small><a href=\"explain_state.php?field=result_time\">".tra("explain")."</a></small>
</th>
<th>".tra("Status")."</th>
<th>".tra("Run time<br />(sec)")."</th>
<th>".tra("CPU time<br />(sec)")."</th>
<th>".tra("Credit")."</th>
<th>".tra("Application")."</th>
</tr>
";
$x[] = tra("Sent");
$x[] = tra("Time reported<br />or deadline")."
<br><small><a href=\"explain_state.php?field=result_time\">".tra("explain")."</a></small>";
$x[] = tra("Status");
$x[] = tra("Run time<br />(sec)");
$x[] = tra("CPU time<br />(sec)");
$x[] = tra("Credit");
$x[] = tra("Application");
row_heading_array($x);
}
// was result invalid or timed out?
@ -827,7 +824,7 @@ function result_navigation($info, $where_clause) {
}
}
$x .= "<form action=result.php>".tra("Task name:")."<input size=40 name=result_name><input class=\"btn btn-primary\" type=submit value='OK'></form>";
$x .= '<form action="result.php">'.tra("Task name:").' <input "size=40" name="result_name"> <input class="btn btn-primary" type="submit" value="OK"></form>';
$x .= "</center><br>";
return $x;
}

View File

@ -367,27 +367,20 @@ function admin_list($teamid) {
}
function team_table_start($sort_by, $type_url) {
echo "<tr>
<th>".tra('Rank')."</th>
<th>".tra('Name')."</th>
<th>".tra('Members')."</th>
";
$x = array();
$x[] = tra('Rank');
$x[] = tra('Name');
$x[] = tra('Members');
if ($sort_by == "total_credit") {
echo "
<th><a href=top_teams.php?sort_by=expavg_credit".$type_url.">".tra('Recent average credit')."</a></th>
<th>".tra('Total credit')."</th>
";
$x[] = "<a href=top_teams.php?sort_by=expavg_credit".$type_url.">".tra('Recent average credit')."</a>";
$x[] = tra('Total credit');
} else {
echo "
<th>".tra('Recent average credit')."</th>
<th><a href=top_teams.php?sort_by=total_credit".$type_url.">".tra('Total credit')."</a></th>
";
$x[] = tra('Recent average credit');
$x[] = "<a href=top_teams.php?sort_by=total_credit".$type_url.">".tra('Total credit')."</a>";
}
echo "
<th>".tra('Country')."</th>
<th>".tra("Type")."</th>
</tr>
";
$x[] = tra('Country');
$x[] = tra("Type");
row_heading_array($x);
}
function team_links($team) {

View File

@ -480,7 +480,8 @@ function row_heading_array($x) {
}
function row_heading($x) {
row_heading_array(array($x));
echo '<tr><th class="bg-primary" colspan=99>'.$x.'</th></tr>
';
}
function random_string() {

View File

@ -370,18 +370,18 @@ function build_country_summary_page($countryMembers) {
page_head("User Profiles by Country", null, null, "../");
echo "Last updated " . pretty_time_str(time()) . "<p>";
echo "<table border=0>\n";
echo "<tr><td><b>Country</b></td><td align=\"center\"><b>Profiles</b></td></tr>\n";
start_table();
row_heading_array(array("Country", "Profiles"));
foreach ($countries as $country) {
$numMembers = count($countryMembers[$country]);
$name = get_legal_filename($country);
echo "<tr>\n<td><a href=\"profile_country_",
"{$name}_1.html\">$country</a></td><td align=\"center\">$numMembers</td></td>\n";
"{$name}_1.html\">$country</a></td><td>$numMembers</td></td>\n";
}
echo "</table>";
end_table();
page_tail(false, "../");
close_output_buffer($filename);

View File

@ -56,7 +56,7 @@ function option($name, $val) {
define('COLOR_DESC', tra('Color scheme for graphics'));
// xgettext:no-php-format
define("MAX_GFX_CPU_PCT_DESC", tra("Maximum CPU % for graphics%10 ... 100%2", "<br><p class=\"text-muted\">", "</p>"));
define("MAX_GFX_CPU_PCT_DESC", tra("Maximum CPU % for graphics%10 ... 100%2", "<br><small>", "</small>"));
define('APP_SELECT_DESC', tra('Run only the selected applications'));
define('APP_SELECT_TOOLTIP', tra('Only get tasks for certain applications. Useful to focus on particular applications, or to exclude them.'));
define('ACCEPT_ANY_DESC', tra('If no work for selected applications is available, accept work from other applications?'));

View File

@ -14,6 +14,11 @@ table a:hover, .table a:hover, a:hover {
text-decoration: underline;
}
table a:visited, .table a:visited, a:visited {
color: sandybrown;
text-decoration: underline;
}
.nav.navbar-nav li a {
color: white;
}
@ -34,7 +39,8 @@ hr {
}
img.icon {
background-color: gray;
padding: 3px;
background-color: lightgray;
}
blockquote {

View File

@ -43,27 +43,19 @@ function get_top_participants($offset, $sort_by) {
function user_table_start($sort_by) {
start_table('table-striped');
echo "
<tr>
<th>".tra("Rank")."</th>
<th>".tra("Name")."</th>
";
$x = array();
$x[] = tra("Rank");
$x[] = tra("Name");
if ($sort_by == "total_credit") {
echo "
<th><a href=top_users.php?sort_by=expavg_credit>".tra("Recent average credit")."</a></th>
<th>".tra("Total credit")."</th>
";
$x[] = "<a href=top_users.php?sort_by=expavg_credit>".tra("Recent average credit")."</a>";
$x[] = tra("Total credit");
} else {
echo "
<th>".tra("Recent average credit")."</th>
<th><a href=top_users.php?sort_by=total_credit>".tra("Total credit")."</a></th>
";
$x[] = tra("Recent average credit");
$x[] = "<a href=top_users.php?sort_by=total_credit>".tra("Total credit")."</a>";
}
echo "
<th>".tra("Country")."</th>
<th>".tra("Participant since")."</th>
</tr>
";
$x[] = tra("Country");
$x[] = tra("Participant since");
row_heading_array($x);
}
function show_user_row($user, $i) {