diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-12-11 12:44:39 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-12-11 12:44:39 +0000 |
commit | 544aefad8aa6d9dfc14b550194a471dc1a9cbde2 (patch) | |
tree | 4d84ddc67088720864a6fca79ee47b0d326d274a /modules/forum.module | |
parent | b9f2b7e2a6b7769457f2f7d4aa361788314e2ed5 (diff) | |
download | brdo-544aefad8aa6d9dfc14b550194a471dc1a9cbde2.tar.gz brdo-544aefad8aa6d9dfc14b550194a471dc1a9cbde2.tar.bz2 |
- Modified patch #40534: improved themability of forum icons (makes it possible to use animated gifs) + removed forum setting.
Diffstat (limited to 'modules/forum.module')
-rw-r--r-- | modules/forum.module | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/modules/forum.module b/modules/forum.module index 3aae6b469..9dc3ef13a 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -326,7 +326,6 @@ function _forum_get_vid() { function forum_admin_configure() { $form = array(); - $form['forum_icon_path'] = array('#type' => 'textfield', '#title' => t('Forum icon path'), '#default_value' => variable_get('forum_icon_path', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory. You may use images of whatever size you wish, but it is recommended to use 15x15 or 16x16. ')); $number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 10000)); $form['forum_hot_topic'] = array('#type' => 'select', '#title' => t('Hot topic threshold'), '#default_value' => variable_get('forum_hot_topic', 15), '#options' => $number, '#description' => t('The number of posts a topic must have to be considered hot.')); $number = drupal_map_assoc(array(10, 25, 50, 75, 100)); @@ -964,14 +963,14 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) { // folder is new if topic is new or there are new comments since last visit if ($topic->tid != $tid) { $rows[] = array( - array('data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'), + 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') ); } else { $rows[] = array( - array('data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'), + 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 ? '<br />'. l(t('%a new', array('%a' => $topic->new_replies)), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'), array('data' => _forum_format($topic), 'class' => 'created'), @@ -987,34 +986,30 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) { return $output; } -function _forum_icon($new_posts, $num_posts = 0, $comment_mode = 0, $sticky = 0) { - - $base_path = variable_get('forum_icon_path', ''); - if ($base_path) { - if ($num_posts > variable_get('forum_hot_topic', 15)) { - $icon = $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'; - } - - if ($sticky == 1) { - $icon = 'sticky'; - } - - // default - $file = variable_get('forum_icon_path', 'misc') ."/forum-$icon.png"; +/** + * Format the icon for each individual topic. + * + * @ingroup themeable + */ +function theme_forum_icon($new_posts, $num_posts = 0, $comment_mode = 0, $sticky = 0) { - $output = theme('image', $file); + if ($num_posts > variable_get('forum_hot_topic', 15)) { + $icon = $new_posts ? 'hot-new' : 'hot'; } else { - $output = ' '; + $icon = $new_posts ? 'new' : 'default'; } + if ($comment_mode == COMMENT_NODE_READ_ONLY || $comment_mode == COMMENT_NODE_DISABLED) { + $icon = 'closed'; + } + + if ($sticky == 1) { + $icon = 'sticky'; + } + + $output = theme('image', "misc/forum-$icon.png"); + if ($new_posts) { $output = "<a name=\"new\">$output</a>"; } |