summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/theme.inc2
-rw-r--r--misc/drupal.css23
-rw-r--r--modules/forum.module65
-rw-r--r--modules/forum/forum.module65
-rw-r--r--modules/tracker.module86
-rw-r--r--modules/tracker/tracker.module86
-rw-r--r--themes/xtemplate/default/xtemplate.css12
7 files changed, 161 insertions, 178 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index ccdfd08e1..fd9d40809 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -285,7 +285,7 @@ function theme_form_element($title, $value, $description = NULL, $id = NULL) {
}
else {
if ($id) {
- $title = "<label for=\"$id\" />";
+ $title = "<label for=\"$id\"></label>";
// TODO: does this make sense to do?
}
}
diff --git a/misc/drupal.css b/misc/drupal.css
index 1b6fb965b..1eb6af52e 100644
--- a/misc/drupal.css
+++ b/misc/drupal.css
@@ -37,24 +37,6 @@ li.leaf {
li a.active {
color: #000;
}
-#tracker table {
- border-collapse: collapse;
-}
-#tracker td {
- vertical-align: top;
- padding: 1em;
-}
-#tracker td ul {
- margin-top: 0;
- margin-bottom: 0;
-}
-#tracker td ul a {
- font-weight: normal;
-}
-#tracker th {
- text-align: left;
- padding: 0.25em 1em 0.25em 0em;
-}
#pager {
clear: both;
text-align: center;
@@ -185,9 +167,12 @@ li a.active {
#forum td.created, #forum td.posts, #forum td.topics, #forum td.last-reply, #forum td.replies, #forum td.pager {
white-space: nowrap;
}
-#forum td.posts, #forum td.topics, #forum td.replies, #forum td.pager {
+#forum td.posts, #forum td.topics, #forum td.replies, #forum td.pager, #tracker td.replies {
text-align: center;
}
+#tracker table {
+ width: 100%;
+}
.item-list .icon {
color: #555;
float: right;
diff --git a/modules/forum.module b/modules/forum.module
index 22ea82c30..3cf75c707 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -96,12 +96,14 @@ function forum_load($node) {
}
function forum_block($op = 'list', $delta = 0) {
+ global $user;
+
if ($op == 'list') {
$blocks[0]['info'] = t('Forum topics');
}
else {
if (user_access('access content')) {
- $content = node_title_list(db_query_range("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.type = 'forum' AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY sort DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));
+ $content = node_title_list(db_query_range("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.type = 'forum' AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY sort DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));
$content .= node_title_list(db_query_range("SELECT nid, title FROM {node} WHERE type = 'forum' AND status = 1 ORDER BY nid DESC", 0, variable_get('forum_block_num', '5')), t('New forum topics:'));
@@ -412,24 +414,25 @@ function forum_page() {
drupal_goto("node/view/$nid");
}
}
+ else {
+ if (empty($sortby)) {
+ $sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
+ }
- if (empty($sortby)) {
- $sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
- }
+ if (empty($forum_per_page)) {
+ $forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
+ }
- if (empty($forum_per_page)) {
- $forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
- }
+ $offset = ($from / $forum_per_page) + 1;
- $offset = ($from / $forum_per_page) + 1;
+ $forums = forum_get_forums($tid);
+ $parents = taxonomy_get_parents_all($tid);
+ if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
+ $topics = forum_get_topics($tid, $sortby, $forum_per_page);
+ }
- $forums = forum_get_forums($tid);
- $parents = taxonomy_get_parents_all($tid);
- if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
- $topics = forum_get_topics($tid, $sortby, $forum_per_page);
+ print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
-
- print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
else {
print theme('page', forum_help('admin/system/modules/forum'), t('Warning'));
@@ -455,6 +458,7 @@ function forum_page() {
* @return the output for the forum body.
*/
function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset) {
+ global $user;
// forum list, topics list, topic browser and 'add new topic' link
$vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
@@ -482,6 +486,27 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p
if (count($forums) || count($parents)) {
$output = "<div id=\"forum\">";
+ $output .= "<ul>";
+
+ if (module_exist('tracker')) {
+ if ($user->uid) {
+ $output .= " <li>". l(t('Track your forum discussions.'), "tracker/$user->uid") ."</li>";
+ }
+
+ $output .= " <li>". l(t('Track active forum discussions.'), 'tracker') ."</li>";
+ }
+
+ if (user_access('create forum topics')) {
+ $output .= "<li>". l(t('Post new forum topic.'), "node/add/forum/$tid") ."</li>";
+ }
+ else if ($user->uid) {
+ $output .= "<li>". t('You are not allowed to post a new forum topic.') .'</li>';
+ }
+ else {
+ $output .= '<li>'. t('<a href="%login">Login</a> to post a new forum topic.', array('%login' => url('user/login'))) .'</li>';
+ }
+ $output .= "</ul>";
+
$output .= theme('forum_list', $forums, $parents, $tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
@@ -571,7 +596,7 @@ function theme_forum_list($forums, $parents, $tid) {
* @return output for the topic list.
*/
function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset) {
- global $user, $id, $status, $user, $pager_total, $forum_topic_list_header;
+ global $id, $status, $pager_total, $forum_topic_list_header;
if ($topics) {
@@ -600,16 +625,6 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset
}
}
- if (user_access('create forum topics')) {
- $output = '<p>'. t('You can <a href="%post">post</a> new forum topics.', array('%post' => url("node/add/forum/$tid"))) .'</p>';
- }
- else if ($user->uid) {
- $output = '<p>'. t('You are not allowed to post new forum topics.') .'</p>';
- }
- else {
- $output = '<p>'. t('You must <a href="%login">login</a> to post new forum topics.', array('%login' => url('user/login'))) .'</p>';
- }
-
$output .= theme('table', $forum_topic_list_header, $rows);
return $output;
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 22ea82c30..3cf75c707 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -96,12 +96,14 @@ function forum_load($node) {
}
function forum_block($op = 'list', $delta = 0) {
+ global $user;
+
if ($op == 'list') {
$blocks[0]['info'] = t('Forum topics');
}
else {
if (user_access('access content')) {
- $content = node_title_list(db_query_range("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.type = 'forum' AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY sort DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));
+ $content = node_title_list(db_query_range("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.type = 'forum' AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY sort DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));
$content .= node_title_list(db_query_range("SELECT nid, title FROM {node} WHERE type = 'forum' AND status = 1 ORDER BY nid DESC", 0, variable_get('forum_block_num', '5')), t('New forum topics:'));
@@ -412,24 +414,25 @@ function forum_page() {
drupal_goto("node/view/$nid");
}
}
+ else {
+ if (empty($sortby)) {
+ $sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
+ }
- if (empty($sortby)) {
- $sortby = isset($user->sortby) ? $user->sortby : variable_get('forum_order', 1);
- }
+ if (empty($forum_per_page)) {
+ $forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
+ }
- if (empty($forum_per_page)) {
- $forum_per_page = isset($user->forum_per_page) ? $user->forum_per_page : variable_get('forum_per_page', 25);
- }
+ $offset = ($from / $forum_per_page) + 1;
- $offset = ($from / $forum_per_page) + 1;
+ $forums = forum_get_forums($tid);
+ $parents = taxonomy_get_parents_all($tid);
+ if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
+ $topics = forum_get_topics($tid, $sortby, $forum_per_page);
+ }
- $forums = forum_get_forums($tid);
- $parents = taxonomy_get_parents_all($tid);
- if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
- $topics = forum_get_topics($tid, $sortby, $forum_per_page);
+ print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
-
- print theme('forum_display', $forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset);
}
else {
print theme('page', forum_help('admin/system/modules/forum'), t('Warning'));
@@ -455,6 +458,7 @@ function forum_page() {
* @return the output for the forum body.
*/
function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page, $offset) {
+ global $user;
// forum list, topics list, topic browser and 'add new topic' link
$vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
@@ -482,6 +486,27 @@ function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_p
if (count($forums) || count($parents)) {
$output = "<div id=\"forum\">";
+ $output .= "<ul>";
+
+ if (module_exist('tracker')) {
+ if ($user->uid) {
+ $output .= " <li>". l(t('Track your forum discussions.'), "tracker/$user->uid") ."</li>";
+ }
+
+ $output .= " <li>". l(t('Track active forum discussions.'), 'tracker') ."</li>";
+ }
+
+ if (user_access('create forum topics')) {
+ $output .= "<li>". l(t('Post new forum topic.'), "node/add/forum/$tid") ."</li>";
+ }
+ else if ($user->uid) {
+ $output .= "<li>". t('You are not allowed to post a new forum topic.') .'</li>';
+ }
+ else {
+ $output .= '<li>'. t('<a href="%login">Login</a> to post a new forum topic.', array('%login' => url('user/login'))) .'</li>';
+ }
+ $output .= "</ul>";
+
$output .= theme('forum_list', $forums, $parents, $tid);
if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
@@ -571,7 +596,7 @@ function theme_forum_list($forums, $parents, $tid) {
* @return output for the topic list.
*/
function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset) {
- global $user, $id, $status, $user, $pager_total, $forum_topic_list_header;
+ global $id, $status, $pager_total, $forum_topic_list_header;
if ($topics) {
@@ -600,16 +625,6 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset
}
}
- if (user_access('create forum topics')) {
- $output = '<p>'. t('You can <a href="%post">post</a> new forum topics.', array('%post' => url("node/add/forum/$tid"))) .'</p>';
- }
- else if ($user->uid) {
- $output = '<p>'. t('You are not allowed to post new forum topics.') .'</p>';
- }
- else {
- $output = '<p>'. t('You must <a href="%login">login</a> to post new forum topics.', array('%login' => url('user/login'))) .'</p>';
- }
-
$output .= theme('table', $forum_topic_list_header, $rows);
return $output;
diff --git a/modules/tracker.module b/modules/tracker.module
index 8e5d8a11c..bbf6c0c5c 100644
--- a/modules/tracker.module
+++ b/modules/tracker.module
@@ -3,7 +3,7 @@
function tracker_help($section = 'admin/help#tracker') {
switch ($section) {
- case 'admin/help#tracer':
+ case 'admin/help#tracker':
return t('<p>The tracker module is a handy module for displaying the most recent posts. By following the <i>recent posts</i> link in the user block, a user may quickly review all recent postings.</p>');
case 'admin/system/modules#description':
return t('Enables tracking of recent posts for users.');
@@ -16,66 +16,62 @@ function tracker_link($type) {
}
}
-function tracker_posts($id = 0) {
+function tracker_page() {
+ global $user;
+
+ $output .= '';
+
+ if ($user->uid) {
+ $output .= "<ul>";
+ $output .= " <li>". l(t('Your active posts and discussions'), "tracker/$user->uid") ."</li>";
+ $output .= " <li>". l(t('All active posts and discussions'), 'tracker') ."</li>";
+ $output .= "</ul>";
+ }
- $header = array(
- array("data" => t("type"), "field" => "type"),
- array("data" => t("title"), "field" => "title"),
- array("data" => t("author"), "field" => "u.name"),
- array("data" => t("last post"), "field" => "last_activity", "sort" => "desc")
- );
+ if (arg(1)) {
+ $uid = check_query(arg(1));
- if ($id) {
- $sql = "SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_activity FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.uid = '". check_query($id) ."' AND n.status = 1 GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name";
- $sql .= tablesort_sql($header);
- $sresult = pager_query($sql, 10, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1 AND uid = '". check_query($id) ."'");
+ $result = pager_query("SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_post FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 AND (n.uid = '$uid' OR c.uid = '$uid') GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name ORDER BY last_post DESC", 25, 0, "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.status = 1 AND (n.uid = '$uid' OR c.uid = '$uid')");
}
else {
- $sql = "SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_activity FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name";
- $sql .= tablesort_sql($header);
- $sresult = pager_query($sql, 10, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1");
+ $result = pager_query("SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_post FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name ORDER BY last_post DESC", 25, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1");
}
- while ($node = db_fetch_object($sresult)) {
- if (node_hook($node, 'tracker_comments')) {
- $cresult = node_invoke($node, 'tracker_comments');
- }
- elseif ($id) {
- $cresult = db_query("SELECT c.*, u.name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.uid = %d AND c.nid = %d AND c.status = 0 ORDER BY c.cid DESC", $id, $node->nid);
- }
- else {
- $cresult = db_query("SELECT c.*, u.name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY c.cid DESC", $node->nid);
- }
-
- $type = ucfirst(node_invoke($node->type, "node_name"));
- $title = l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("mark") : "");
- $author = format_name($node);
-
- $comments = array();
- while ($comment = db_fetch_object($cresult)) {
- $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/view/$node->nid#comment-$comment->cid"), "%author" => format_name($comment))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : "") ."</li>\n";
- }
+ while ($node = db_fetch_object($result)) {
+ // Determine the number of comments:
+ if ($all = comment_num_all($node->nid)) {
+ $comments = $all;
- if ($comments) {
- $comments = "<ul>". implode("\n", $comments) ."</ul>";
+ if ($new = comment_num_new($node->nid)) {
+ $comments .= '<br />';
+ $comments .= l(t('%a new', array('%a' => $new)), "node/view/$node->nid", NULL, NULL, 'new');
+ }
}
else {
- $comments = "";
+ $comments = 0;
}
- $rows[] = array(array("data" => $type, "class" => "type"), array("data" => $title . $comments, "class" => "content"), array("data" => $author, "class" => "author"), array("data" => format_date($node->last_activity, "small"), "class" => "last_post"));
+ $rows[] = array(
+ ucfirst(node_invoke($node->type, "node_name")),
+ l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("mark") : ''),
+ format_name($node),
+ array('class' => 'replies', 'data' => $comments),
+ format_interval(time() - $node->last_post) ." ". t('ago')
+ );
}
- if ($pager = theme("pager", NULL, 10, 0, tablesort_pager())) {
- $rows[] = array(array("data" => $pager, "colspan" => 4));
+ if ($pager = theme('pager', NULL, 25, 0)) {
+ $rows[] = array(array('data' => $pager, 'colspan' => 4));
}
- $output = "<div id=\"tracker\">";
+ $header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last post'));
+
+ $output .= "<div id=\"tracker\">";
$output .= theme("table", $header, $rows);
$output .= "</div>";
- return $output;
+ print theme('page', $output);
}
function tracker_user($type, &$edit, &$user) {
@@ -84,10 +80,4 @@ function tracker_user($type, &$edit, &$user) {
}
}
-function tracker_page() {
- global $user;
-
- print theme("page", tracker_posts(arg(1)), t("Recent posts"));
-}
-
?>
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module
index 8e5d8a11c..bbf6c0c5c 100644
--- a/modules/tracker/tracker.module
+++ b/modules/tracker/tracker.module
@@ -3,7 +3,7 @@
function tracker_help($section = 'admin/help#tracker') {
switch ($section) {
- case 'admin/help#tracer':
+ case 'admin/help#tracker':
return t('<p>The tracker module is a handy module for displaying the most recent posts. By following the <i>recent posts</i> link in the user block, a user may quickly review all recent postings.</p>');
case 'admin/system/modules#description':
return t('Enables tracking of recent posts for users.');
@@ -16,66 +16,62 @@ function tracker_link($type) {
}
}
-function tracker_posts($id = 0) {
+function tracker_page() {
+ global $user;
+
+ $output .= '';
+
+ if ($user->uid) {
+ $output .= "<ul>";
+ $output .= " <li>". l(t('Your active posts and discussions'), "tracker/$user->uid") ."</li>";
+ $output .= " <li>". l(t('All active posts and discussions'), 'tracker') ."</li>";
+ $output .= "</ul>";
+ }
- $header = array(
- array("data" => t("type"), "field" => "type"),
- array("data" => t("title"), "field" => "title"),
- array("data" => t("author"), "field" => "u.name"),
- array("data" => t("last post"), "field" => "last_activity", "sort" => "desc")
- );
+ if (arg(1)) {
+ $uid = check_query(arg(1));
- if ($id) {
- $sql = "SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_activity FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.uid = '". check_query($id) ."' AND n.status = 1 GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name";
- $sql .= tablesort_sql($header);
- $sresult = pager_query($sql, 10, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1 AND uid = '". check_query($id) ."'");
+ $result = pager_query("SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_post FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 AND (n.uid = '$uid' OR c.uid = '$uid') GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name ORDER BY last_post DESC", 25, 0, "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.status = 1 AND (n.uid = '$uid' OR c.uid = '$uid')");
}
else {
- $sql = "SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_activity FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name";
- $sql .= tablesort_sql($header);
- $sresult = pager_query($sql, 10, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1");
+ $result = pager_query("SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, MAX(GREATEST(n.changed, c.timestamp)) AS last_post FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.status = 1 GROUP BY n.nid, n.title, n.type, n.changed, n.uid, u.name ORDER BY last_post DESC", 25, 0, "SELECT COUNT(nid) FROM {node} WHERE status = 1");
}
- while ($node = db_fetch_object($sresult)) {
- if (node_hook($node, 'tracker_comments')) {
- $cresult = node_invoke($node, 'tracker_comments');
- }
- elseif ($id) {
- $cresult = db_query("SELECT c.*, u.name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.uid = %d AND c.nid = %d AND c.status = 0 ORDER BY c.cid DESC", $id, $node->nid);
- }
- else {
- $cresult = db_query("SELECT c.*, u.name FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d AND c.status = 0 ORDER BY c.cid DESC", $node->nid);
- }
-
- $type = ucfirst(node_invoke($node->type, "node_name"));
- $title = l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("mark") : "");
- $author = format_name($node);
-
- $comments = array();
- while ($comment = db_fetch_object($cresult)) {
- $comments[] = "<li>". t("%subject by %author", array("%subject" => l($comment->subject, "node/view/$node->nid#comment-$comment->cid"), "%author" => format_name($comment))) ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : "") ."</li>\n";
- }
+ while ($node = db_fetch_object($result)) {
+ // Determine the number of comments:
+ if ($all = comment_num_all($node->nid)) {
+ $comments = $all;
- if ($comments) {
- $comments = "<ul>". implode("\n", $comments) ."</ul>";
+ if ($new = comment_num_new($node->nid)) {
+ $comments .= '<br />';
+ $comments .= l(t('%a new', array('%a' => $new)), "node/view/$node->nid", NULL, NULL, 'new');
+ }
}
else {
- $comments = "";
+ $comments = 0;
}
- $rows[] = array(array("data" => $type, "class" => "type"), array("data" => $title . $comments, "class" => "content"), array("data" => $author, "class" => "author"), array("data" => format_date($node->last_activity, "small"), "class" => "last_post"));
+ $rows[] = array(
+ ucfirst(node_invoke($node->type, "node_name")),
+ l($node->title, "node/view/$node->nid") ." ". (node_is_new($node->nid, $node->changed) ? theme("mark") : ''),
+ format_name($node),
+ array('class' => 'replies', 'data' => $comments),
+ format_interval(time() - $node->last_post) ." ". t('ago')
+ );
}
- if ($pager = theme("pager", NULL, 10, 0, tablesort_pager())) {
- $rows[] = array(array("data" => $pager, "colspan" => 4));
+ if ($pager = theme('pager', NULL, 25, 0)) {
+ $rows[] = array(array('data' => $pager, 'colspan' => 4));
}
- $output = "<div id=\"tracker\">";
+ $header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last post'));
+
+ $output .= "<div id=\"tracker\">";
$output .= theme("table", $header, $rows);
$output .= "</div>";
- return $output;
+ print theme('page', $output);
}
function tracker_user($type, &$edit, &$user) {
@@ -84,10 +80,4 @@ function tracker_user($type, &$edit, &$user) {
}
}
-function tracker_page() {
- global $user;
-
- print theme("page", tracker_posts(arg(1)), t("Recent posts"));
-}
-
?>
diff --git a/themes/xtemplate/default/xtemplate.css b/themes/xtemplate/default/xtemplate.css
index fcf8d4f08..1200ddca2 100644
--- a/themes/xtemplate/default/xtemplate.css
+++ b/themes/xtemplate/default/xtemplate.css
@@ -268,18 +268,6 @@ table {
#aggregator h3 {
margin-top: 1em;
}
-#tracker th {
- text-align: left;
- border-bottom: 1px solid #ddd;
-}
-#tracker tr.light, #tracker tr.dark {
- background-color: #fff;
-}
-#tracker td {
- vertical-align: top;
- padding: 1em 1em 1em 0;
- border-bottom: 1px solid #bbb;
-}
#forum table {
width: 100%;
}