Initial code using Drupal 6.38

This commit is contained in:
Manuel Cillero 2017-07-24 15:21:05 +02:00
commit 4824608a33
467 changed files with 90887 additions and 0 deletions

View file

@ -0,0 +1,7 @@
#tracker td.replies {
text-align: center;
}
#tracker table {
width: 100%;
}

View file

@ -0,0 +1,12 @@
name = Tracker
description = Enables tracking of recent posts for users.
dependencies[] = comment
package = Core - optional
version = VERSION
core = 6.x
; Information added by Drupal.org packaging script on 2016-02-24
version = "6.38"
project = "drupal"
datestamp = "1456343372"

View file

@ -0,0 +1,74 @@
<?php
/**
* @file
* Enables tracking of recent posts for users.
*/
/**
* Implementation of hook_help().
*/
function tracker_help($path, $arg) {
switch ($path) {
case 'admin/help#tracker':
$output = '<p>'. t('The tracker module displays the most recently added or updated content on your site, and provides user-level tracking to follow the contributions of particular authors.') .'</p>';
$output .= '<p>'. t("The <em>Recent posts</em> page is available via a link in the navigation menu block and displays new and recently-updated content (including the content type, the title, the author's name, number of comments, and time of last update) in reverse chronological order. Posts are marked updated when changes occur in the text, or when new comments are added. To use the tracker module to follow a specific user's contributions, select the <em>Track</em> tab from the user's profile page.") .'</p>';
$output .= '<p>'. t('For more information, see the online handbook entry for <a href="@tracker">Tracker module</a>.', array('@tracker' => 'http://drupal.org/handbook/modules/tracker/')) .'</p>';
return $output;
}
}
/**
* Implementation of hook_menu().
*/
function tracker_menu() {
$items['tracker'] = array(
'title' => 'Recent posts',
'page callback' => 'tracker_page',
'access arguments' => array('access content'),
'weight' => 1,
'file' => 'tracker.pages.inc',
);
$items['tracker/all'] = array(
'title' => 'All recent posts',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['tracker/%user_uid_optional'] = array(
'title' => 'My recent posts',
'access callback' => '_tracker_myrecent_access',
'access arguments' => array(1),
'page arguments' => array(1),
'type' => MENU_LOCAL_TASK,
);
$items['user/%user/track'] = array(
'title' => 'Track',
'page callback' => 'tracker_page',
'page arguments' => array(1, TRUE),
'access callback' => '_tracker_user_access',
'access arguments' => array(1),
'type' => MENU_LOCAL_TASK,
'file' => 'tracker.pages.inc',
);
$items['user/%user/track/posts'] = array(
'title' => 'Track posts',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
return $items;
}
/**
* Access callback for tracker/%user_uid_optional
*/
function _tracker_myrecent_access($account) {
// This path is only allowed for authenticated users looking at their own posts.
return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content');
}
/**
* Access callback for user/%user/track
*/
function _tracker_user_access($account) {
return user_view_access($account) && user_access('access content');
}

View file

@ -0,0 +1,72 @@
<?php
/**
* @file
* User page callbacks for the tracker module.
*/
/**
* Menu callback. Prints a listing of active nodes on the site.
*/
function tracker_page($account = NULL, $set_title = FALSE) {
// Add CSS
drupal_add_css(drupal_get_path('module', 'tracker') .'/tracker.css', 'module', 'all', FALSE);
if ($account) {
if ($set_title) {
// When viewed from user/%user/track, display the name of the user
// as page title -- the tab title remains Track so this needs to be done
// here and not in the menu definiton.
drupal_set_title(check_plain($account->name));
}
// TODO: These queries are very expensive, see http://drupal.org/node/105639
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
$sql = db_rewrite_sql($sql);
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
$sql_count = db_rewrite_sql($sql_count);
$result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->uid, $account->uid);
}
else {
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_updated DESC';
$sql = db_rewrite_sql($sql);
$sql_count = 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1';
$sql_count = db_rewrite_sql($sql_count);
$result = pager_query($sql, 25, 0, $sql_count);
}
$rows = array();
while ($node = db_fetch_object($result)) {
// Determine the number of comments:
$comments = 0;
if ($node->comment_count) {
$comments = $node->comment_count;
if ($new = comment_num_new($node->nid)) {
$comments .= '<br />';
$comments .= l(format_plural($new, '1 new', '@count new'), "node/$node->nid", array('query' => comment_new_page_count($node->comment_count, $new, $node), 'fragment' => 'new'));
}
}
$rows[] = array(
check_plain(node_get_types('name', $node->type)),
l($node->title, "node/$node->nid") .' '. theme('mark', node_mark($node->nid, $node->changed)),
theme('username', $node),
array('class' => 'replies', 'data' => $comments),
t('!time ago', array('!time' => format_interval(time() - $node->last_updated)))
);
}
if (!$rows) {
$rows[] = array(array('data' => t('No posts available.'), 'colspan' => '5'));
}
$header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last updated'));
$output = '<div id="tracker">';
$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, 25, 0);
$output .= '</div>';
return $output;
}