mirror of https://github.com/BOINC/boinc.git
web: make buttons more legible
The bootstrap 'btn-success' colors are white text on light green. This is hard to read. Change this to a darker green (seagreen). There are two cases: form submit buttons, and links. Lots of each; not sure I got them all. Each of these should be factored into a single function; maybe later. Also: - use sprintf() instead of "foo".tra("xxx")."blah" - fix sending HTML email with linux 'mail' command - fix display of friends
This commit is contained in:
parent
6bbdea848c
commit
ef2239d58e
|
@ -490,8 +490,9 @@ function form_general($label, $item) {
|
|||
function form_submit($text, $attrs='') {
|
||||
form_general(
|
||||
"",
|
||||
sprintf('<button %s type="submit" class="btn btn-success">%s</button>',
|
||||
$attrs, $text
|
||||
sprintf(
|
||||
'<button %s type="submit" class="btn" %s>%s</button>',
|
||||
$attrs, button_style(), $text
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,15 @@ function send_email($user, $subject, $body, $body_html=null, $email_addr=null) {
|
|||
$email_addr = $user->email_addr;
|
||||
}
|
||||
if (defined('EMAIL_USE_CMD')) {
|
||||
$cmd = "mail -s \"$subject\" $email_addr";
|
||||
$pipe = popen($cmd, "w");
|
||||
fwrite($pipe, $body);
|
||||
if ($body_html) {
|
||||
$cmd = "mail -a \"Content-type: text/html\" -s \"$subject\" $email_addr";
|
||||
$pipe = popen($cmd, "w");
|
||||
fwrite($pipe, $body_html);
|
||||
} else {
|
||||
$cmd = "mail -s \"$subject\" $email_addr";
|
||||
$pipe = popen($cmd, "w");
|
||||
fwrite($pipe, $body);
|
||||
}
|
||||
pclose($pipe);
|
||||
return true;
|
||||
} else if (function_exists("make_php_mailer")) {
|
||||
|
|
|
@ -91,11 +91,17 @@ function pm_team_form($user, $teamid, $error=null) {
|
|||
echo "<textarea name=\"content\" class=\"form-control\" rows=\"18\">$content</textarea>";
|
||||
echo "</td></tr>\n";
|
||||
end_table();
|
||||
echo "<tr><td></td><td>
|
||||
<input class=\"btn btn-primary\" type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\">
|
||||
<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Send message")."\">
|
||||
</td></tr>\n
|
||||
";
|
||||
echo sprintf(
|
||||
'<tr><td></td><td>
|
||||
<input class="btn" %s type="submit" name="preview" value="%s">
|
||||
<input class="btn" %s type="submit" value="%s">
|
||||
</td></tr>
|
||||
',
|
||||
button_style('blue'),
|
||||
tra("Preview"),
|
||||
button_style(),
|
||||
tra("Send message")
|
||||
);
|
||||
end_table();
|
||||
page_tail();
|
||||
}
|
||||
|
|
|
@ -627,7 +627,13 @@ function print_prefs_form(
|
|||
prefs_form_project_specific($prefs->project_specific, $project_error);
|
||||
}
|
||||
|
||||
row2("", "<input class=\"btn btn-success\" type=submit value=\"$submit_value\" name=\"action\">");
|
||||
row2("",
|
||||
sprintf(
|
||||
'<input class="btn" %s type=submit value="%s" name="action">',
|
||||
button_style(),
|
||||
$submit_value
|
||||
)
|
||||
);
|
||||
end_table();
|
||||
echo "</form>\n";
|
||||
}
|
||||
|
|
|
@ -515,7 +515,11 @@ function team_edit_form($team, $label, $url) {
|
|||
);
|
||||
}
|
||||
row2("",
|
||||
"<input class=\"btn btn-success\" type=submit name=new value='$label'>"
|
||||
sprintf(
|
||||
'<input class="btn" %s type=submit name=new value="%s">',
|
||||
button_style(),
|
||||
$label
|
||||
)
|
||||
);
|
||||
end_table();
|
||||
echo "</form>\n";
|
||||
|
|
|
@ -325,7 +325,8 @@ function show_preference_links() {
|
|||
}
|
||||
}
|
||||
|
||||
// return describing a friend: their name, and profile picture if it exists
|
||||
// return string describing a friend:
|
||||
// their name, and profile picture if it exists
|
||||
//
|
||||
function friend_links($user) {
|
||||
if (is_banished($user)) {
|
||||
|
@ -348,7 +349,7 @@ function friend_links($user) {
|
|||
}
|
||||
$alt = tra("Profile");
|
||||
$x .= sprintf(
|
||||
'<a href="%sview_profile.php?userid=%d"><img title="%s" src="%s" alt="%s"></a><br>',
|
||||
'<p><a href="%sview_profile.php?userid=%d"><img title="%s" src="%s" alt="%s"></a><br>',
|
||||
url_base(),
|
||||
$user->id,
|
||||
tra("View the profile of %1", $user->name),
|
||||
|
@ -359,7 +360,6 @@ function friend_links($user) {
|
|||
if (function_exists("project_user_links")) {
|
||||
$x .= project_user_links($user);
|
||||
}
|
||||
$x .= '</div>';
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
@ -470,14 +470,14 @@ function show_community_private($user) {
|
|||
}
|
||||
|
||||
$friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
|
||||
$x = '';
|
||||
$x = [];
|
||||
if ($friends) {
|
||||
foreach($friends as $friend) {
|
||||
$fuser = BoincUser::lookup_id($friend->user_dest);
|
||||
if (!$fuser) continue;
|
||||
$x .= friend_links($fuser);
|
||||
$x[] = friend_links($fuser);
|
||||
}
|
||||
row2(tra("Friends"), $x);
|
||||
row2(tra("Friends"), implode('<br>', $x));
|
||||
} else {
|
||||
row2(tra("Friends"), '---');
|
||||
}
|
||||
|
|
|
@ -913,20 +913,38 @@ function current_url() {
|
|||
return $url;
|
||||
}
|
||||
|
||||
// Show a single link formatted to look like a button.
|
||||
// @param url The destination URL of the button
|
||||
// @param text The text to display on the button
|
||||
// @param desc The title of the destination - typically used as a popup
|
||||
// @param class The optional CSS class of the button. Defaults to a standard button
|
||||
// @params extra Additional text in href tag
|
||||
// style for a button
|
||||
// the colors for bootstrap' btn-success are almost illegible;
|
||||
// the green is too light. Use a darker green.
|
||||
//
|
||||
function button_style($color='green', $font_size=null) {
|
||||
$fs = '';
|
||||
if ($font_size) {
|
||||
$fs = sprintf('; font-size:%dpx', $font_size);
|
||||
}
|
||||
$c = 'seagreen';
|
||||
if ($color == 'blue') $c = 'steelblue';
|
||||
return sprintf(
|
||||
'style="background-color:%s; color:white; text-decoration:none%s"',
|
||||
$c, $fs
|
||||
);
|
||||
}
|
||||
// Show a link formatted to look like a button.
|
||||
// url: the destination of the lin
|
||||
// text: The text to display on the button
|
||||
// desc: tooltip text (show on hover)
|
||||
// class: class of the button, e.g. btn
|
||||
// extra: Additional text in href tag
|
||||
//
|
||||
|
||||
function button_text($url, $text, $desc=null, $class=null, $extra='') {
|
||||
if (!$desc) {
|
||||
$desc = $text;
|
||||
}
|
||||
if (!$extra && !$class) {
|
||||
$extra = button_style();
|
||||
}
|
||||
if (!$class) {
|
||||
$class = "btn-success btn-sm";
|
||||
$class = "btn btn-sm";
|
||||
}
|
||||
return sprintf(' <a href="%s" title="%s" class="btn %s" %s>%s</a>',
|
||||
$url, $desc, $class, $extra, $text
|
||||
|
|
|
@ -97,7 +97,9 @@ echo '
|
|||
|
||||
if (user_can_create_thread($user, $forum)) {
|
||||
show_button(
|
||||
"forum_post.php?id=$id", tra("New thread"), tra("Add a new thread to this forum")
|
||||
"forum_post.php?id=$id",
|
||||
tra("New thread"),
|
||||
tra("Add a new thread to this forum")
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -106,15 +108,16 @@ echo '</td>
|
|||
<div class="form-group">
|
||||
';
|
||||
echo select_from_array("sort", $forum_sort_styles, $sort_style);
|
||||
echo '
|
||||
<input class="btn btn-success btn-sm" type="submit" value="Sort">
|
||||
echo sprintf('
|
||||
<input class="btn btn-sm" %s type="submit" value="Sort">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<p></p>
|
||||
';
|
||||
<p></p> ',
|
||||
button_style()
|
||||
);
|
||||
|
||||
show_forum($forum, $start, $sort_style, $user);
|
||||
|
||||
|
|
|
@ -165,19 +165,24 @@ function show_message_row($thread, $parent_post) {
|
|||
}
|
||||
}
|
||||
if (!$logged_in_user->prefs->no_signature_by_default) {
|
||||
$enable_signature="checked=\"true\"";
|
||||
$enable_signature='checked="true"';
|
||||
} else {
|
||||
$enable_signature="";
|
||||
}
|
||||
$x2 .= "</textarea><p> </p>
|
||||
<input class=\"btn btn-primary btn-sm \" type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\">
|
||||
<input class=\"btn btn-success btn-sm \" type=\"submit\" value=\"".tra("Post reply")."\">
|
||||
$x2 .= sprintf('</textarea><p> </p>
|
||||
<input class="btn btn-sm" %s type="submit" name="preview" value="%s">
|
||||
<input class="btn btn-sm" %s type="submit" value="%s">
|
||||
|
||||
<input type=\"checkbox\" name=\"add_signature\" id=\"add_signature\" value=\"add_it\" ".$enable_signature.">
|
||||
<label for=\"add_signature\">".tra("Add my signature to this reply")."</label>
|
||||
|
||||
</form>
|
||||
";
|
||||
<input type="checkbox" name="add_signature" id="add_signature" %s>
|
||||
<label for="add_signature"> %s </label>
|
||||
</form>',
|
||||
button_style('blue'),
|
||||
tra("Preview"),
|
||||
button_style(),
|
||||
tra("Post reply"),
|
||||
$enable_signature,
|
||||
tra("Add my signature to this reply")
|
||||
);
|
||||
row2($x1, $x2, false, "20%");
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,12 @@ row2(tra("Sort by"),
|
|||
'<select class="form-control" name="search_sort">'.$sortlist.'</select');
|
||||
|
||||
row1(" ");
|
||||
row2("","<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
|
||||
row2("",
|
||||
sprintf('<input class="btn btn-success" %s type="submit" value="%s"',
|
||||
button_style(),
|
||||
tra("Start the search")
|
||||
)
|
||||
);
|
||||
echo "</form>";
|
||||
end_table();
|
||||
|
||||
|
|
|
@ -42,13 +42,22 @@ if ($retval) {
|
|||
if ($venue == '') {
|
||||
$venue = '('.tra("none").')';
|
||||
}
|
||||
echo "
|
||||
".tra("The venue of this computer has been set to %1.", "<b>$venue</b>")."
|
||||
echo sprintf(
|
||||
'%s
|
||||
<p>
|
||||
".tra("Preference changes will take effect when the computer communicates with this project.")."
|
||||
%s
|
||||
<p>
|
||||
<a href=show_host_detail.php?hostid=$hostid>".tra("Return to computer page")."</a>.
|
||||
";
|
||||
<a class="btn" %s href=%s>%s</a>
|
||||
',
|
||||
tra(
|
||||
'The venue of this computer has been set to %1.',
|
||||
"<b>$venue</b>"
|
||||
),
|
||||
tra('Preference changes will take effect when the computer communicates with this project.'),
|
||||
button_style(),
|
||||
HOME_PAGE,
|
||||
tra('Continue to home page')
|
||||
);
|
||||
page_tail();
|
||||
} else {
|
||||
db_error_page();
|
||||
|
|
|
@ -72,12 +72,16 @@ if (file_exists(PROFILE_PATH . "profile_alpha.html")) {
|
|||
echo "</ul></td></tr>";
|
||||
|
||||
row1(tra("Search profile text"));
|
||||
rowify("
|
||||
<form action=\"profile_search_action.php\" method=\"GET\">
|
||||
<input type=\"text\" name=\"search_string\">
|
||||
<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Search")."\">
|
||||
</form>
|
||||
");
|
||||
rowify(
|
||||
sprintf(
|
||||
'<form action="profile_search_action.php" method="GET">
|
||||
<input type="text" name="search_string">
|
||||
<input class="btn btn-sm" %s type="submit" value="%s">
|
||||
</form>',
|
||||
button_style(),
|
||||
tra("Search")
|
||||
)
|
||||
);
|
||||
end_table();
|
||||
|
||||
page_tail();
|
||||
|
|
|
@ -85,9 +85,13 @@ function left(){
|
|||
}
|
||||
}
|
||||
echo "<p><p>";
|
||||
echo sprintf('<center><a href=home.php class="btn btn-success">%s</a></center>
|
||||
',
|
||||
tra('Continue to your home page')
|
||||
echo sprintf('<center>%s</center>',
|
||||
button_text('home.php',
|
||||
tra('Continue to your home page'),
|
||||
'',
|
||||
'',
|
||||
button_style('green', 16)
|
||||
)
|
||||
);
|
||||
echo "<p><p>";
|
||||
echo sprintf('%s
|
||||
|
|
|
@ -80,7 +80,12 @@ function show_admins($user, $teamid) {
|
|||
start_table();
|
||||
row1(tra("Add Team Admin"));
|
||||
row2(tra("Email address of team member:"), '<input class="form-control" name="email_addr">');
|
||||
row2("", "<input class=\"btn btn-success\" type=submit action value=\"".tra("Add")."\">");
|
||||
row2("",
|
||||
sprintf('<input class="btn" %s type=submit action value="%s">',
|
||||
button_style(),
|
||||
tra("Add")
|
||||
)
|
||||
);
|
||||
end_table();
|
||||
echo "</form>";
|
||||
|
||||
|
|
|
@ -110,7 +110,11 @@ foreach ($users as $user) {
|
|||
if ($navailable_users > 0) {
|
||||
echo "<input type=hidden name=navailable_users value=$navailable_users>";
|
||||
end_table();
|
||||
echo "<input class=\"btn btn-success\" type=submit value=\"".tra("Change founder")."\">";
|
||||
echo sprintf(
|
||||
'<input class="btn" %s type=submit value="%s">',
|
||||
button_style(),
|
||||
tra("Change founder")
|
||||
);
|
||||
} else {
|
||||
echo "<tr>
|
||||
<td colspan='4'>".tra("There are no users to transfer team to.")."</td>
|
||||
|
|
|
@ -89,7 +89,13 @@ function user_search_form() {
|
|||
row2(tra("Decreasing average credit"), "<input type=radio name=search_type value=\"rac\">");
|
||||
row2(tra("Decreasing total credit"), "<input type=radio name=search_type value=\"total\">");
|
||||
}
|
||||
row2("", "<input class=\"btn btn-success\" type=submit name=action value=".tra("Search").">");
|
||||
row2("",
|
||||
sprintf(
|
||||
'<input class="btn" %s type=submit name=action value="%s">',
|
||||
button_style(),
|
||||
tra("Search")
|
||||
)
|
||||
);
|
||||
end_table();
|
||||
echo "
|
||||
<script>document.f.search_string.focus()</script>
|
||||
|
|
Loading…
Reference in New Issue