--- pop_links.module.orig 2008-08-09 11:33:58.000000000 +1000 +++ pop_links.module 2008-08-09 16:50:46.000000000 +1000 @@ -247,18 +247,20 @@ function pop_links_stats() { $header = array( array('data' => t('Timestamp'), 'field' => 'p.timestamp', 'sort' => 'desc'), - array('data' => t('Link'), 'field' => 'n.title'), + array('data' => t('Node'), 'field' => 'n.title'), + array('data' => t('Link'), 'field' => 'p.url'), array('data' => t('User'), 'field' => 'u.name'), array('data' => t('Hostname')) ); - $sql = "SELECT p.cid, n.title, p.url, u.name, p.hostname, p.timestamp FROM {pop_links_stats} p LEFT JOIN {users} u ON u.uid = p.uid LEFT JOIN {node} n ON n.nid = p.nid" . tablesort_sql($header); + $sql = "SELECT p.cid, n.nid, n.title, p.url, u.name, p.hostname, p.timestamp FROM {pop_links_stats} p LEFT JOIN {users} u ON u.uid = p.uid LEFT JOIN {node} n ON n.nid = p.nid" . tablesort_sql($header); $result = pager_query(db_rewrite_sql($sql), 30); while ($click_data = db_fetch_object($result)) { $rows[] = array( array('data' => format_date($click_data->timestamp, 'small'), 'class' => 'nowrap'), - _pop_links_format_item($click_data->title, $click_data->url), + _pop_links_format_item_node($click_data->nid, $click_data->title), + _pop_links_format_item_link($click_data->url), theme('username', $click_data), $click_data->hostname); } @@ -270,13 +272,23 @@ } /** - * format table data with two lines: node title & external link path + * format table column with the node-title and hyperlink (if present) */ -function _pop_links_format_item($title, $path, $width = 35) { - $path = ($path ? $path : '/'); - $output = ($title ? "$title
" : ''); - $output .= truncate_utf8($path, $width, FALSE, TRUE); - return $output; +function _pop_links_format_item_node($nid, $title, $width = 45) { + if ($nid && $title) { + return l(truncate_utf8($title, $width, TRUE, TRUE), 'node/'. $nid); + } + return NULL; +} + +/** + * format table column with the target hyperlink + */ +function _pop_links_format_item_link($path, $width = 35) { + if ($path) { + return l(truncate_utf8($path, $width, FALSE, TRUE), $path); + } + return NULL; } /**