Commit a4663548 authored by Dries's avatar Dries

- Patch #158536 by merlinofchaos and dvessel: tpl-ified the forum module.

parent 9339b704
<?php // $Id$
/**
* @file forum-display.tpl.php
* Default theme implementation to display a forum, which may contain forum
* containers as well as forum topics.
*
* Variables available:
*
* - $links: An array of links that allow a user to post new forum topics.
* It may also contain a string telling a user they must log in in order
* to post.
* - $forums: The forums to display (as processed by forum-list.tpl.php)
* - $topics: The topics to display (as processed by forum-topic-list.tpl.php)
*
* @see template_preprocess_forum_display()
* @see theme_forum_display()
*
*/
?>
<?php if ($forums_defined): ?>
<div id="forum">
<?php print theme('links', $links); ?>
<?php print $forums; ?>
<?php print $topics; ?>
</div>
<?php endif; ?>
<?php
// $Id$
/**
* @file forum-format-topic.tpl.php
* Default theme implementation to format a simple string indicated when and
* by whom a topic was posted.
*
* Available variables:
*
* - $author: The author of the post.
* - $time: How long ago the post was created.
* - $topic: An object with the raw data of the post. Unsafe, be sure
* to clean this data before printing.
*
* @see template_preprocess_forum_format_topic()
* @see theme_forum_format_topic()
*/
?>
<?php if ($topic->timestamp): ?>
<?php print t(
'@time ago<br />by !author', array(
'@time' => $time,
'!author' => $author,
)); ?>
<?php else: ?>
<?php print t('n/a'); ?>
<?php endif; ?>
<?php
// $Id$
/**
* @file forum-icon.tpl.php
* Display an appropriate icon for a forum post.
*
* Available variables:
* - $new_posts: Indicates whether or not the topic contains new posts.
* - $icon: The icon to display. May be one of 'hot', 'hot-new', 'new',
* 'default', 'closed', or 'sticky'.
*
* @see template_preprocess_forum_icon()
* @see theme_forum_icon()
*/
?>
<?php if ($new_posts): ?>
<a name="new">
<?php endif; ?>
<?php print theme('image', "misc/forum-$icon.png") ?>
<?php if ($new_posts): ?>
</a>
<?php endif; ?>
<?php
// $Id
/**
* @file forum-list.tpl.php
* Default theme implementation to display a list of forums.
*
* Available variables:
* - $forums: An array of forums to display.
*
* Each $forum in $forums contains:
* - $forum->is_container: Is TRUE if the forum can contain other forums. Is
* FALSE if the forum can contain only topics.
* - $forum->depth: How deep the forum is in the current hierarchy.
* - $forum->name: The name of the forum.
* - $forum->link: The URL to link to this forum.
* - $forum->description: The description of this forum.
* - $forum->new_topics: True if the forum contains unread posts.
* - $forum->new_url: A URL to the forum's unread posts.
* - $forum->new_text: Text for the above URL which tells how many new posts.
* - $forum->old_topics: A count of posts that have already been read.
* - $forum->num_posts: The total number of posts in the forum.
* - $forum->last_reply: Text representing the last time a forum was posted or
* commented in.
*
* @see template_preprocess_forum_list()
* @see theme_forum_list()
*/
?>
<table>
<thead>
<tr>
<th><?php print t('Forum'); ?></th>
<th><?php print t('Topics');?></th>
<th><?php print t('Posts'); ?></th>
<th><?php print t('Last post'); ?></th>
</tr>
</thead>
<tbody>
<?php // Keep a row count for striping. ?>
<?php $row = 0; ?>
<?php foreach ($forums as $forum): ?>
<tr class="<?php print $row % 2 == 0 ? 'odd' : 'even';?>">
<?php if ($forum->is_container): ?>
<td colspan="4" class="container">
<?php else: ?>
<td class="forum">
<?php endif; ?>
<?php /* Enclose the contents of this cell with X divs, where X is the
* depth this forum resides at. This will allow us to use CSS
* left-margin for indenting.
*/ ?>
<?php $end_divs = ''; ?>
<?php for ($i = 0; $i < $forum->depth; $i++): ?>
<div class="indent">
<?php $end_divs .= '</div>'; ?>
<?php endfor; ?>
<div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a></div>
<div class="description"><?php print $forum->description; ?></div>
<?php print $end_divs; ?>
</td>
<?php if (!$forum->is_container): ?>
<td class="topics">
<?php print $forum->num_topics ?>
<?php if ($forum->new_topics): ?>
<br />
<a href="<?php print $forum->new_url; ?>"><?php print $forum->new_text; ?></a>
<?php endif; ?>
</td>
<td class="posts"><?php print $forum->num_posts ?></td>
<td class="last-reply"><?php print $forum->last_reply ?></td>
<?php endif; ?>
</tr>
<?php $row++; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php
// $Id$
/**
* @file forum-topic-list.tpl.php
*
* Theme implementation to display a list of forum topics.
*
* Available variables:
*
* - $header: The table header. This is pre-generated with click-sorting
* information. If you need to change this, @see template_preprocess_forum_topic_list().
* - $pager: The pager to display beneath the table.
* - $topics: An array of topics to be displayed.
*
* Each topic contains:
*
* - $topic->icon: The icon to display.
* - $topic->moved: A flag to indicate whether the topic has been moved to
* another forum.
* - $topic->title: The title of the topic. Safe to output.
* - $topic->description: If the topic has been moved, this contains an
* explanation and a link.
* - $topic->num_comments: The number of replies on this topic.
* - $topic->new_replies: A flag to indicate whether there are unread comments.
* - $topic->new_url: If there are unread replies, this is a link to them.
* - $topic->new_text: Text containing the translated, properly pluralized count.
* - $topic->created: An outputtable string represented when the topic was posted.
* - $topic->last_reply: An outputtable string representing when the topic was
* last replied to.
* - $topic->timestamp: The raw timestamp this topic was posted.
*
* @see template_preprocess_forum_topic_list()
* @see theme_forum_topic_list()
*/
?>
<table>
<thead>
<tr><?php print $header; ?></tr>
</thead>
<tbody>
<?php $row = 0; ?>
<?php foreach ($topics as $topic): ?>
<tr class="<?php print $row % 2 == 0 ? 'odd' : 'even';?>">
<td class="icon"><?php print $topic->icon; ?></td>
<td class="title"><?php print $topic->title; ?></td>
<?php if ($topic->moved): ?>
<td colspan="3"><?php print $topic->description; ?></td>
<?php else: ?>
<td class="replies">
<?php print $topic->num_comments; ?>
<?php if ($topic->new_replies): ?>
<br />
<a href="<?php print $topic->new_url; ?>"><?php print $topic->new_text; ?></a>
<?php endif; ?>
</td>
<td class="created"><?php print $topic->created; ?>
<td class="last-reply"><?php print $topic->last_reply; ?>
<?php endif; ?>
</tr>
<?php $row++; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php print $pager; ?>
<?php
// $Id$
/**
* @file forum-topic-navigation.tpl.php
* Default theme implementation to display the topic navigation string at the
* bottom of all forum topics.
*
* Available variables:
*
* - $prev: The node ID of the previous post.
* - $prev_url: The URL of the previous post.
* - $prev_title: The title of the previous post.
*
* - $next: The node ID of the next post.
* - $next_url: The URL of the next post.
* - $next_title: The title of the next post.
*
* - $node: The raw node currently being viewed. Contains unsafe data
* and any data in this must be cleaned before presenting.
*
* @see template_preprocess_forum_topic_navigation()
* @see theme_forum_topic_navigation()
*/
?>
<?php if ($prev || $next): ?>
<div class="forum-topic-navigation clear-block">
<?php if ($prev): ?>
<a href="<?php print $prev_url; ?>" class="topic-previous" title="<?php print t('Go to previous forum topic') ?>"><?php print $prev_title ?></a>
<?php endif; ?>
<?php if ($next): ?>
<a href="<?php print $next_url; ?>" class="topic-next" title="<?php print t('Go to next forum topic') ?>"><?php print $next_title ?></a>
<?php endif; ?>
</div>
<?php endif; ?>
......@@ -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;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment