Commit 4d16c7c6 authored by Dries's avatar Dries

Implemented more suggestions by Keith:

- Made sure the 'Topic' title is only shown above the topics, not the icons.

- Automatically shorten the username when it is too long.  I implemented this
  as part of format_name() and could therefore nuke some code in the
  statistics module.  This is change is somewhat experimental and I'm willing
  to revert or change this if a number of people aren't too happy with this
  behavior.

- Left align the dates and authors: makes it easier/faster to scan.

- Made the little tablesort arrows clickable.
parent ea86b76c
......@@ -822,11 +822,23 @@ function format_date($timestamp, $type = "medium", $format = "") {
function format_name($object) {
if ($object->uid && $object->name) {
/*
** Shorten the name when it is too long or it will break many
** tables.
*/
if (strlen($object->name) > 20) {
$name = substr($object->name, 0, 15) ."...";
}
else {
$name = $object->name;
}
if (arg(0) == "admin") {
$output = l($object->name, "admin/user/edit/$object->uid", array("title" => t("Administer user profile.")));
$output = l($name, "admin/user/edit/$object->uid", array("title" => t("Administer user profile.")));
}
else {
$output = l($object->name, "user/view/$object->uid", array("title" => t("View user profile.")));
$output = l($name, "user/view/$object->uid", array("title" => t("View user profile.")));
}
}
else if ($object->name) {
......
......@@ -31,7 +31,7 @@ function tablesort($cell, $header) {
$cell["class"] = "cell-highlight";
$image = "&nbsp;<img src=\"". $theme->image("arrow-". $ts["sort"]. ".gif"). "\"></img>";
}
$cell["data"] = l($cell["data"], $_GET["q"], array(), "sort=". $ts["sort"]. "&order=". urlencode($cell["data"]). $ts["query_string"]). $image;
$cell["data"] = l($cell["data"] . $image, $_GET["q"], array(), "sort=". $ts["sort"]. "&order=". urlencode($cell["data"]). $ts["query_string"]);
return $cell;
}
......
......@@ -128,9 +128,11 @@ th {
margin: 0.5em;
}
#forum td.created, #forum td.posts, #forum td.topics, #forum td.last-reply, #forum td.replies, #forum td.pager {
text-align: center;
white-space: nowrap;
}
#forum td.posts, #forum td.topics, #forum td.replies, #forum td.pager {
text-align: center;
}
.item-list .icon {
color: #555;
float: right;
......
......@@ -321,7 +321,8 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
global $user, $forum_topic_list_header;
$forum_topic_list_header = array(
array("data" => t("Topic"), "field" => "n.title", "colspan" => "2"),
array("data" => "&nbsp;"),
array("data" => t("Topic"), "field" => "n.title"),
array("data" => t("Replies"),"field" => "num_comments"),
array("data" => t("Created"), "field" => "n.created"),
array("data" => t("Last reply"), "field" => "date_sort", "sort" => "desc"),
......
......@@ -321,7 +321,8 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
global $user, $forum_topic_list_header;
$forum_topic_list_header = array(
array("data" => t("Topic"), "field" => "n.title", "colspan" => "2"),
array("data" => "&nbsp;"),
array("data" => t("Topic"), "field" => "n.title"),
array("data" => t("Replies"),"field" => "num_comments"),
array("data" => t("Created"), "field" => "n.created"),
array("data" => t("Last reply"), "field" => "date_sort", "sort" => "desc"),
......
......@@ -637,12 +637,11 @@ function statistics_display_online_block() {
if (user_access("access userlist") && $users) {
/* Display a list of currently online users */
$max_users = variable_get("statistics_block_online_max_cnt", 10);
$max_name_len = variable_get("statistics_block_online_max_len", 15);
$uid = reset($user_list);
while (($uid) && ($max_users)) {
$user = user_load(array("uid" => $uid));
/* When displaying name, be sure it's not more than defined max length */
$items[] = l((strlen($user->name) > $max_name_len ? substr($user->name, 0, $max_name_len) ."..." : $user->name), "user/view/$user->uid");
$items[] = format_name($user);
$uid = next($user_list);
/*
** When $max_users reaches zero, we break out even if there are
......
......@@ -637,12 +637,11 @@ function statistics_display_online_block() {
if (user_access("access userlist") && $users) {
/* Display a list of currently online users */
$max_users = variable_get("statistics_block_online_max_cnt", 10);
$max_name_len = variable_get("statistics_block_online_max_len", 15);
$uid = reset($user_list);
while (($uid) && ($max_users)) {
$user = user_load(array("uid" => $uid));
/* When displaying name, be sure it's not more than defined max length */
$items[] = l((strlen($user->name) > $max_name_len ? substr($user->name, 0, $max_name_len) ."..." : $user->name), "user/view/$user->uid");
$items[] = format_name($user);
$uid = next($user_list);
/*
** When $max_users reaches zero, we break out even if there are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment