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; global $host_sites;
shuffle($host_sites); shuffle($host_sites);
start_table('table-striped'); start_table('table-striped');
echo "<tr>"; $x = array(
echo "<th>".tra("Computer info")."</th>\n"; tra("Computer info"),
echo "<th>".tra("Rank")."</th>"; tra("Rank"),
echo "<th>".tra("Owner")."</th>\n"; tra("Owner"),
);
if ($sort_by == 'total_credit') { if ($sort_by == 'total_credit') {
echo " $x[] = "<a href=top_hosts.php?sort_by=expavg_credit>".tra("Avg. credit")."</a>";
<th><a href=top_hosts.php?sort_by=expavg_credit>".tra("Avg. credit")."</a></th> $x[] = tra("Total credit");
<th>".tra("Total credit")."</th>
";
} else { } else {
echo " $x[] = tra("Recent average credit");
<th>".tra("Recent average credit")."</th> $x[] = "<a href=top_hosts.php?sort_by=total_credit>".tra("Total credit")."</a>";
<th><a href=top_hosts.php?sort_by=total_credit>".tra("Total credit")."</a></th>
";
} }
echo " $x[] = tra("BOINC version");
<th>".tra("BOINC version")."</th> $x[] = tra("CPU");
<th>".tra("CPU")."</th> $x[] = tra("GPU");
<th>".tra("GPU")."</th> $x[] = tra("Operating system");
<th>".tra("Operating system")."</th> row_heading_array($x);
</tr>
";
} }
function host_nresults($host) { function host_nresults($host) {
@ -668,32 +663,33 @@ function user_host_table_start(
$private, $sort, $rev, $show_all, $any_product_name $private, $sort, $rev, $show_all, $any_product_name
) { ) {
start_table('table-striped'); start_table('table-striped');
echo "<tr>"; $x = array();
$url = link_url_rev($sort, "id", $rev, $show_all); $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) { if ($private) {
$url = link_url_rev($sort, "name", $rev, $show_all); $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); $url = link_url_rev($sort, "venue", $rev, $show_all);
if ($any_product_name) { 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 { } else {
echo "<th>".tra("Rank")."</th>"; $x[] = tra("Rank");
} }
$url = link_url_rev($sort, "expavg_credit", $rev, $show_all); $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); $url = link_url_rev($sort, "total_credit", $rev, $show_all);
echo "<th><a href=$url>".tra("Total credit")."</a></th>\n"; $x[] = "<a href=$url>".tra("Total credit")."</a>";
echo "<th>".tra("BOINC<br>version")."</th>\n"; $x[] = tra("BOINC<br>version");
$url = link_url_rev($sort, "cpu", $rev, $show_all); $url = link_url_rev($sort, "cpu", $rev, $show_all);
echo "<th><a href=$url>".tra("CPU")."</a></th>\n"; $x[] = "<a href=$url>".tra("CPU")."</a>";
echo "<th>".tra("GPU")."</th>\n"; $x[] = tra("GPU");
$url = link_url_rev($sort, "os", $rev, $show_all); $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); $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) { 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 (isset($prefs->$venue)) $x = $prefs->$venue;
if ($x) { if ($x) {
echo "<h3>".tra("Separate preferences for %1", $venue)."</h3>";
echo "<tr><td colspan=2>";
start_table(); start_table();
row_heading(tra("Separate preferences for %1", $venue));
if ($subset == "global") { if ($subset == "global") {
prefs_show_global($x); prefs_show_global($x);
} else { } else {

View File

@ -113,9 +113,9 @@ if (project_has_beta()) {
); );
} }
if (defined("EMAIL_FROM")) { 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) .tra("Emails will be sent from %1; make sure your spam filter accepts this address.", EMAIL_FROM)
."</p>"; ."</small>";
} else { } else {
$x = ""; $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>"; $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
if ($columns) { if ($columns) {
echo "<h3>".tra("Combined preferences").$switch_link."</h3>";
start_table(); start_table();
row_heading(tra("Combined preferences").$switch_link);
prefs_show_privacy($user, true); prefs_show_privacy($user, true);
venue_show($user); venue_show($user);
row_top(tra("Project specific settings")); row_top(tra("Project specific settings"));
@ -281,10 +281,10 @@ function print_prefs_display_project($user, $columns=false) {
row_links("project", $project_prefs); row_links("project", $project_prefs);
end_table(); end_table();
} else { } 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(); 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_project($project_prefs, false);
prefs_show_privacy($user, false); prefs_show_privacy($user, false);
venue_show($user); 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) { function result_table_start($show_wu_link, $show_host_link, $info) {
start_table('table-striped'); start_table('table-striped');
echo "<tr>"; $x = array();
if ($info) { if ($info) {
if ($info->show_names) { if ($info->show_names) {
$i2 = clone $info; $i2 = clone $info;
$i2->show_names = 0; $i2->show_names = 0;
$url = result_page_url($i2); $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 { } else {
$i2 = clone $info; $i2 = clone $info;
$i2->show_names = 1; $i2->show_names = 1;
$url = result_page_url($i2); $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 { } 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) { 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')) { if (function_exists('project_result_info_heading')) {
$x = project_result_info_heading(); $y = project_result_info_heading();
if ($x) { if ($y) {
echo "<th>$x</th>\n"; $x[] = $y;
} }
} }
} }
if ($show_host_link) { if ($show_host_link) {
echo "<th>".tra("Computer")."</th>\n"; $x[] = tra("Computer");
} }
echo " $x[] = tra("Sent");
<th>".tra("Sent")."</th> $x[] = tra("Time reported<br />or deadline")."
<th>".tra("Time reported<br />or deadline")." <br><small><a href=\"explain_state.php?field=result_time\">".tra("explain")."</a></small>";
<br><small><a href=\"explain_state.php?field=result_time\">".tra("explain")."</a></small> $x[] = tra("Status");
</th> $x[] = tra("Run time<br />(sec)");
<th>".tra("Status")."</th> $x[] = tra("CPU time<br />(sec)");
<th>".tra("Run time<br />(sec)")."</th> $x[] = tra("Credit");
<th>".tra("CPU time<br />(sec)")."</th> $x[] = tra("Application");
<th>".tra("Credit")."</th> row_heading_array($x);
<th>".tra("Application")."</th>
</tr>
";
} }
// was result invalid or timed out? // 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>"; $x .= "</center><br>";
return $x; return $x;
} }

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@ function option($name, $val) {
define('COLOR_DESC', tra('Color scheme for graphics')); define('COLOR_DESC', tra('Color scheme for graphics'));
// xgettext:no-php-format // 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_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('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?')); 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; text-decoration: underline;
} }
table a:visited, .table a:visited, a:visited {
color: sandybrown;
text-decoration: underline;
}
.nav.navbar-nav li a { .nav.navbar-nav li a {
color: white; color: white;
} }
@ -34,7 +39,8 @@ hr {
} }
img.icon { img.icon {
background-color: gray; padding: 3px;
background-color: lightgray;
} }
blockquote { blockquote {

View File

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