? files
? forum.tpl.patch
? install_tag_fix.patch
? maintenance_theme.patch
? wall_of_text.patch
? profiles/InstallerAutolocale.zip
? sites/logrus.com.x
? sites/all/dynamic_text.tar.gz.txt
? sites/all/modules
? sites/all/themes
? sites/default/settings.php
? themes/bluemarine/install_page.tpl.php
? themes/bluemarine/maintenance_page.tpl.php
? themes/garland/maintenance_page.tpl.php
Index: modules/forum/forum.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.css,v
retrieving revision 1.4
diff -u -p -r1.4 forum.css
--- modules/forum/forum.css 27 May 2007 17:57:48 -0000 1.4
+++ modules/forum/forum.css 11 Jul 2007 16:56:28 -0000
@@ -19,6 +19,10 @@
#forum tr.new-topics td.forum {
background-image: url(../../misc/forum-new.png);
}
+#forum div.indent {
+ margin-left: 20px;
+}
+
.forum-topic-navigation {
padding: 1em 0 0 3em; /* LTR */
border-top: 1px solid #888;
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.407
diff -u -p -r1.407 forum.module
--- modules/forum/forum.module 2 Jul 2007 17:08:35 -0000 1.407
+++ modules/forum/forum.module 11 Jul 2007 16:56:29 -0000
@@ -34,18 +34,19 @@ function forum_help($path, $arg) {
function forum_theme() {
return array(
'forum_display' => array(
+ 'file' => 'forum_display',
'arguments' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
),
- 'forum_list' => array(
- 'arguments' => array('forums' => NULL, 'parents' => NULL, 'tid' => NULL),
- ),
'forum_topic_list' => array(
+ 'file' => 'forum_topic_list',
'arguments' => array('tid' => NULL, 'topics' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL),
),
'forum_icon' => array(
+ 'file' => 'forum_icon',
'arguments' => array('new_posts' => NULL, 'num_posts' => 0, 'comment_mode' => 0, 'sticky' => 0),
),
'forum_topic_navigation' => array(
+ 'file' => 'forum_topic_navigation',
'arguments' => array('node' => NULL),
),
);
@@ -868,11 +869,11 @@ function forum_page($tid = 0) {
}
/**
- * Format the forum body.
+ * Process variables for forum_display.tpl.php
*
- * @ingroup themeable
+ * Arguments: $forums, $topics, $parents, $tid, $sortby, $forum_per_page
*/
-function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {
+function template_preprocess_forum_display(&$variables) {
global $user;
// forum list, topics list, topic browser and 'add new topic' link
@@ -882,14 +883,14 @@ function theme_forum_display($forums, $t
// Breadcrumb navigation:
$breadcrumb = array();
- if ($tid) {
+ if ($variables['tid']) {
$breadcrumb[] = array('path' => 'forum', 'title' => $title);
}
- if ($parents) {
- $parents = array_reverse($parents);
- foreach ($parents as $p) {
- if ($p->tid == $tid) {
+ if ($variables['parents']) {
+ $variables['parents'] = array_reverse($variables['parents']);
+ foreach ($variables['parents'] as $p) {
+ if ($p->tid == $variables['tid']) {
$title = $p->name;
}
else {
@@ -903,235 +904,166 @@ function theme_forum_display($forums, $t
$breadcrumb[] = array('path' => $_GET['q']);
menu_set_location($breadcrumb);
- if (count($forums) || count($parents)) {
- $output = '
';
- $output .= '
';
+ $variables['forums_defined'] = count($variables['forums']) || count($variables['parents']);
+ if ($variables['forums_defined']) {
// Format the "post new content" links listing.
$forum_types = array();
- // Load the vocabulary.
- $forum_vid = variable_get('forum_nav_vocabulary', '');
- $vocabulary = taxonomy_vocabulary_load($forum_vid);
-
// Loop through all node types for forum vocabulary.
foreach ($vocabulary->nodes as $type) {
// Check if the current user has the 'create' permission for this node type.
if (node_access('create', $type)) {
// Fetch the "General" name of the content type;
// Push the link with title and url to the array.
- $forum_types[$type] = array('title' => t('Post new @node_type', array('@node_type' => node_get_types('name', $type))), 'href' => "node/add/$type/$tid");
+ $forum_types[$type] = array('title' => t('Post new @node_type', array('@node_type' => node_get_types('name', $type))), 'href' => "node/add/$type/$variables[tid]");
}
}
- if (!empty($forum_types)) {
- // Theme links for the prepared content types data.
- $output .= theme('links', $forum_types);
- }
- else {
- $output .= '- '. t('Login to post a new forum topic.', array('@login' => url('user/login', array('query' => drupal_get_destination())))) .'
';
+ if (empty($forum_types)) {
// The user is logged-in; but denied access to create any new forum content type.
if ($user->uid) {
- $output .= t('You are not allowed to post new content in forum.');
+ $forum_types['disallowed'] = array('title' => t('You are not allowed to post new content in forum.'));
}
// The user is not logged-in; and denied access to create any new forum content type.
else {
- $output .= t('Login to post new content in forum.', array('@login' => url('user/login', array('query' => drupal_get_destination()))));
+ $forum_types['login'] = array('title' => t('Login to post new content in forum.', array('@login' => url('user/login', array('query' => drupal_get_destination())))), 'html' => TRUE);
}
}
- $output .= '
';
-
- $output .= theme('forum_list', $forums, $parents, $tid);
+ $variables['links'] = $forum_types;
- if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
- $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
- drupal_add_feed(url('taxonomy/term/'. $tid .'/0/feed'), 'RSS - '. $title);
- }
- $output .= '
';
- }
- else {
- drupal_set_title(t('No forums defined'));
- $output = '';
- }
-
- return $output;
-}
-
-/**
- * Format the forum listing.
- *
- * @ingroup themeable
- */
-function theme_forum_list($forums, $parents, $tid) {
- global $user;
-
- if ($forums) {
-
- $header = array(t('Forum'), t('Topics'), t('Posts'), t('Last post'));
-
- foreach ($forums as $forum) {
- if (!empty($forum->container)) {
- $description = '\n";
- $description .= '
'. l($forum->name, "forum/$forum->tid") ."
\n";
-
- if (!empty($forum->description)) {
- $description .= '
'. filter_xss_admin($forum->description) ."
\n";
+ // Sanitize each forum so that the template can safely print the data.
+ foreach ($variables['forums'] as $id => $forum) {
+ $variables['forums'][$id]->description = !empty($forum->description) ? filter_xss_admin($forum->description) : '';
+ $variables['forums'][$id]->link = url("forum/$forum->tid");
+ $variables['forums'][$id]->name = check_plain($forum->name);
+ $variables['forums'][$id]->is_container = !empty($forum->container);
+ if ($user->uid) {
+ $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->tid, $user->uid);
+ if ($variables['forums'][$id]->new_topics) {
+ $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new', '@count new');
+ $variables['forums'][$id]->new_url = url("forum/$forum->tid", array('fragment' => 'new'));
}
- $description .= "
\n";
-
- $rows[] = array(array('data' => $description, 'class' => 'container', 'colspan' => '4'));
+ $variables['forums'][$id]->old_topics = $forum->num_topics - $variables['forums'][$id]->new_topics;
}
else {
- $new_topics = _forum_topics_unread($forum->tid, $user->uid);
- $forum->old_topics = $forum->num_topics - $new_topics;
- if (!$user->uid) {
- $new_topics = 0;
- }
-
- $description = '\n";
- $description .= '
'. l($forum->name, "forum/$forum->tid") ."
\n";
-
- if (!empty($forum->description)) {
- $description .= '
'. filter_xss_admin($forum->description) ."
\n";
- }
- $description .= "
\n";
-
- $row = array(
- 'data' => array(
- array('data' => $description, 'class' => 'forum'),
- array('data' => $forum->num_topics . ($new_topics ? '
'. l(format_plural($new_topics, '1 new', '@count new'), "forum/$forum->tid", array('fragment' => 'new')) : ''), 'class' => 'topics'),
- array('data' => $forum->num_posts, 'class' => 'posts'),
- array('data' => _forum_format($forum->last_post), 'class' => 'last-reply'),
- ),
- );
- if ($new_topics > 0) {
- $row['class'] = 'new-topics';
- }
- $rows[] = $row;
+ $variables['forums'][$id]->new_topics = 0;
+ $variables['forums'][$id]->old_topics = $forum->num_topics;
}
+ $variables['forums'][$id]->last_reply = _forum_format($forum->last_post);
}
- return theme('table', $header, $rows);
-
+ if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers', array()))) {
+ $variables['topics'] = theme('forum_topic_list', $variables['tid'], $variables['topics'], $variables['sortby'], $variables['forum_per_page']);
+ drupal_add_feed(url('taxonomy/term/'. $variables['tid'] .'/0/feed'), 'RSS - '. $title);
+ }
+ }
+ else {
+ drupal_set_title(t('No forums defined'));
}
-
}
/**
* Format the topic listing.
*
+ * $tid, $topics, $sortby, $forum_per_page
+ *
* @ingroup themeable
*/
-function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
+function template_preprocess_forum_topic_list(&$variables) {
global $forum_topic_list_header;
- $rows = array();
- if ($topics) {
- foreach ($topics as $topic) {
- // folder is new if topic is new or there are new comments since last visit
- if ($topic->tid != $tid) {
- $rows[] = array(
- array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
- array('data' => check_plain($topic->title), 'class' => 'title'),
- array('data' => l(t('This topic has been moved'), "forum/$topic->tid"), 'colspan' => '3')
- );
+ // Create the tablesorting header.
+ $ts = tablesort_init($forum_topic_list_header);
+ $header = '';
+ foreach ($forum_topic_list_header as $cell) {
+ $cell = tablesort_header($cell, $forum_topic_list_header, $ts);
+ $header .= _theme_table_cell($cell, TRUE);
+ }
+ $variables['header'] = $header;
+
+ $rows = array();
+ if (!empty($variables['topics'])) {
+ foreach ($variables['topics'] as $id => $topic) {
+ $variables['topics'][$id]->icon = theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky);
+
+ if ($topic->tid != $variables['tid']) {
+ $variables['topics'][$id]->moved = TRUE;
+ $variables['topics'][$id]->title = check_plain($topic->title);
+ $variables['topics'][$id]->description = l(t('This topic has been moved'), "forum/$topic->tid");
}
else {
- $rows[] = array(
- array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
- array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
- array('data' => $topic->num_comments . ($topic->new_replies ? '
'. l(format_plural($topic->new_replies, '1 new', '@count new'), "node/$topic->nid", array('fragment' => 'new')) : ''), 'class' => 'replies'),
- array('data' => _forum_format($topic), 'class' => 'created'),
- array('data' => _forum_format(isset($topic->last_reply) ? $topic->last_reply : NULL), 'class' => 'last-reply')
- );
+ $variables['topics'][$id]->moved = FALSE;
+ $variables['topics'][$id]->title = l($topic->title, "node/$topic->nid");
+ if ($topic->new_replies) {
+ $variables['topics'][$id]->new_text = format_plural($topic->new_replies, '1 new', '@count new');
+ $variables['topics'][$id]->new_url = url("node/$topic->nid", array('fragment' => 'new'));
+ }
+ $variables['topics'][$id]->created = _forum_format($topic);
+ $variables['topics'][$id]->last_reply = _forum_format(isset($topic->last_reply) ? $topic->last_reply : NULL);
}
}
}
+ else {
+ // Make this safe for the template
+ $variables['topics'] = array();
+ }
- $output = theme('table', $forum_topic_list_header, $rows);
- $output .= theme('pager', NULL, $forum_per_page, 0);
-
- return $output;
+ $variables['pager'] = theme('pager', NULL, $variables['forum_per_page'], 0);
}
/**
* Format the icon for each individual topic.
*
- * @ingroup themeable
+ * $new_posts, $num_posts = 0, $comment_mode = 0, $sticky = 0
*/
-function theme_forum_icon($new_posts, $num_posts = 0, $comment_mode = 0, $sticky = 0) {
-
- if ($num_posts > variable_get('forum_hot_topic', 15)) {
- $icon = $new_posts ? 'hot-new' : 'hot';
+function template_preprocess_forum_icon(&$variables) {
+ $variables['hot_threshold'] = variable_get('forum_hot_topic', 15);
+ if ($variables['num_posts'] > $variables['hot_threshold']) {
+ $variables['icon'] = $variables['new_posts'] ? 'hot-new' : 'hot';
}
else {
- $icon = $new_posts ? 'new' : 'default';
- }
-
- if ($comment_mode == COMMENT_NODE_READ_ONLY || $comment_mode == COMMENT_NODE_DISABLED) {
- $icon = 'closed';
+ $variables['icon'] = $variables['new_posts'] ? 'new' : 'default';
}
- if ($sticky == 1) {
- $icon = 'sticky';
+ if ($variables['comment_mode'] == COMMENT_NODE_READ_ONLY || $variables['comment_mode'] == COMMENT_NODE_DISABLED) {
+ $variables['icon'] = 'closed';
}
- $output = theme('image', "misc/forum-$icon.png");
-
- if ($new_posts) {
- $output = "$output";
+ if ($variables['sticky'] == 1) {
+ $variables['icon'] = 'sticky';
}
-
- return $output;
}
/**
* Format the next/previous forum topic navigation links.
*
- * @ingroup themeable
+ * $node
*/
-function theme_forum_topic_navigation($node) {
+function template_preprocess_forum_topic_navigation(&$variables) {
$output = '';
// get previous and next topic
$sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, ". _forum_get_topic_order_sql(variable_get('forum_order', 1));
- $result = db_query(db_rewrite_sql($sql), isset($node->tid) ? $node->tid : 0);
+ $result = db_query(db_rewrite_sql($sql), isset($variables['node']->tid) ? $variables['node']->tid : 0);
+
+ $stop = $variables['prev'] = $variables['next'] = 0;
- $stop = 0;
while ($topic = db_fetch_object($result)) {
if ($stop == 1) {
- $next = new stdClass();
- $next->nid = $topic->nid;
- $next->title = $topic->title;
+ $variables['next'] = $topic->nid;
+ $variables['next_title'] = check_plain($topic->title);
+ $variables['next_url'] = url("node/$topic->nid");
break;
}
- if ($topic->nid == $node->nid) {
+ if ($topic->nid == $variables['node']->nid) {
$stop = 1;
}
else {
- $prev = new stdClass();
- $prev->nid = $topic->nid;
- $prev->title = $topic->title;
+ $variables['prev'] = $topic->nid;
+ $variables['prev_title'] = check_plain($topic->title);
+ $variables['prev_url'] = url("node/$topic->nid");
}
}
-
- if (!empty($prev) || !empty($next)) {
- $output .= '';
-
- if (!empty($prev)) {
- $output .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'topic-previous', 'title' => t('Go to previous forum topic')));
- }
- if (!empty($prev) && !empty($next)) {
- // Word break (a is an inline element)
- $output .= ' ';
- }
- if (!empty($next)) {
- $output .= l($next->title . t(' ›'), 'node/'. $next->nid, array('class' => 'topic-next', 'title' => t('Go to next forum topic')));
- }
-
- $output .= '
';
- }
-
- return $output;
}
function _forum_user_last_visit($nid) {
Index: modules/forum/forum_display.tpl.php
===================================================================
RCS file: modules/forum/forum_display.tpl.php
diff -N modules/forum/forum_display.tpl.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/forum/forum_display.tpl.php 11 Jul 2007 16:56:29 -0000
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+ >
+ is_container): ?>
+ |
+
+ |
+
+
+ depth; $i++): ?>
+
+ '; ?>
+
+
+ description; ?>
+
+ |
+ is_container): ?>
+
+ num_topics ?>
+ new_topics): ?>
+
+ new_text; ?>
+
+ |
+ num_posts ?> |
+ last_reply ?> |
+
+
+
+
+
+
+
+
+
+
+
+
Index: modules/forum/forum_icon.tpl.php
===================================================================
RCS file: modules/forum/forum_icon.tpl.php
diff -N modules/forum/forum_icon.tpl.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/forum/forum_icon.tpl.php 11 Jul 2007 16:56:29 -0000
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
Index: modules/forum/forum_topic_list.tpl.php
===================================================================
RCS file: modules/forum/forum_topic_list.tpl.php
diff -N modules/forum/forum_topic_list.tpl.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/forum/forum_topic_list.tpl.php 11 Jul 2007 16:56:29 -0000
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+ >
+ | icon; ?> |
+ title; ?> |
+ moved): ?>
+ description; ?> |
+
+
+ num_comments; ?>
+ new_replies): ?>
+
+ new_text; ?>
+
+ |
+ created; ?>
+ | last_reply; ?>
+
+ |
+
+
+
+
+
+
Index: modules/forum/forum_topic_navigation.tpl.php
===================================================================
RCS file: modules/forum/forum_topic_navigation.tpl.php
diff -N modules/forum/forum_topic_navigation.tpl.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/forum/forum_topic_navigation.tpl.php 11 Jul 2007 16:56:29 -0000
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file