Wee! Annoncements + news in compact view:

- New style, topic icons and topic starter + last poster :)
subsilver2 follows tomorrow
Have fun! :)
This commit is contained in:
Kevin
2008-08-15 23:12:14 +00:00
parent da9f9b1dbf
commit 26c7c3202f
5 changed files with 182 additions and 63 deletions

View File

@@ -143,18 +143,65 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_announcements, $portal_config['portal_number_of_announcements'], $start, 'announcements');
}
// Determining topic icons code borrowed from nickvergessens NV_recent_topics - http://www.flying-bits.org
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
$folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
switch ($fetch_news[$i]['topic_type'])
{
case POST_GLOBAL:
$topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
$folder = 'global_read';
$folder_new = 'global_unread';
break;
case POST_ANNOUNCE:
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'announce_read';
$folder_new = 'announce_unread';
break;
default:
$topic_type = '';
$folder = 'topic_read';
$folder_new = 'topic_unread';
if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED)
{
$folder .= '_hot';
$folder_new .= '_hot';
}
break;
}
if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED)
{
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
$folder .= '_locked';
$folder_new .= '_locked';
}
if ($fetch_news[$i]['topic_type'] == POST_GLOBAL)
{
$global_announce_list[$fetch_news[$i]['topic_id']] = true;
}
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
$template->assign_block_vars('announcements_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'FORUM_NAME' => ( $forum_id ) ? $fetch_news[$i]['forum_name'] : '',
'TITLE' => $fetch_news[$i]['topic_title'],
'POSTER' => $fetch_news[$i]['username'],
'POSTER_FULL' => $fetch_news[$i]['username_full'],
'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'],
'U_USER_PROFILE' => (($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '',
'TIME' => $fetch_news[$i]['topic_time'],
'LAST_POST_TIME' => $user->format_date($fetch_news[$i]['topic_last_post_time']),
'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'A_ID' => $i,
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'),
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id),

View File

@@ -135,19 +135,62 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_news, $portal_config['portal_number_of_news'], $start, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
}
// Determining topic icons code borrowed from nickvergessens NV_recent_topics - http://www.flying-bits.org
$replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
$folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
switch ($fetch_news[$i]['topic_type'])
{
case POST_STICKY:
$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
$folder = 'sticky_read';
$folder_new = 'sticky_unread';
break;
case POST_ANNOUNCE:
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'announce_read';
$folder_new = 'announce_unread';
break;
default:
$topic_type = '';
$folder = 'topic_read';
$folder_new = 'topic_unread';
if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED)
{
$folder .= '_hot';
$folder_new .= '_hot';
}
break;
}
if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED)
{
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
$folder .= '_locked';
$folder_new .= '_locked';
}
$folder_img = ($unread_topic) ? $folder_new : $folder;
$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
$template->assign_block_vars('news_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'FORUM_NAME' => ( $forum_id ) ? $fetch_news[$i]['forum_name'] : '',
'TITLE' => $fetch_news[$i]['topic_title'],
'POSTER' => $fetch_news[$i]['username'],
'POSTER_FULL' => $fetch_news[$i]['username_full'],
'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'],
'U_USER_PROFILE' => (($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '',
'TIME' => $fetch_news[$i]['topic_time'],
'LAST_POST_TIME' => $user->format_date($fetch_news[$i]['topic_last_post_time']),
'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'N_ID' => $i,
'BAD' => 'BOOBS',
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'),
'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt],
'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'),
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),

View File

@@ -134,18 +134,19 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
$topic_type = 't.topic_type = ' . POST_NORMAL;
$str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
$user_link = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ;
$post_link = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ;
$topic_order = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_time DESC' : 't.topic_time DESC' ;
$user_link = ( $portal_config['portal_news_style'] ) ? 't.topic_poster = u.user_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ) ;
$post_link = ( $portal_config['portal_news_style'] ) ? 't.topic_first_post_id = p.post_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ) ;
$topic_order = 't.topic_last_post_time DESC' ;
break;
case "news_all":
$topic_type = '( t.topic_type <> ' . POST_ANNOUNCE . ' ) AND ( t.topic_type <> ' . POST_GLOBAL . ')';
$str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
$user_link = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ;
$post_link = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ;
$topic_order = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_time DESC' : 't.topic_time DESC' ;
$user_link = ( $portal_config['portal_news_style'] ) ? 't.topic_poster = u.user_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ) ;
$post_link = ( $portal_config['portal_news_style'] ) ? 't.topic_first_post_id = p.post_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ) ;
$topic_order = 't.topic_last_post_time DESC' ;
break;
}
@@ -185,7 +186,13 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
t.topic_views,
t.poll_title,
t.topic_replies,
t.topic_replies_real,
t.topic_poster,
t.topic_type,
t.topic_status,
t.topic_last_poster_name,
t.topic_last_poster_id,
t.topic_last_poster_colour,
u.username,
u.user_id,
u.user_type,
@@ -307,13 +314,17 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
'post_text' => ap_validate($message),
'topic_id' => $row['topic_id'],
'topic_last_post_id' => $row['post_id'],
'topic_type' => $row['topic_type'],
'topic_status' => $row['topic_status'],
'forum_id' => $row['forum_id'],
'topic_replies' => $row['topic_replies'],
'topic_replies_real' => $row['topic_replies_real'],
'topic_time' => $user->format_date($row['post_time']),
'topic_last_post_time' => $row['topic_last_post_time'],
'topic_title' => $row['topic_title'],
'username' => $row['username'],
'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $row['post_username']),
'username_full_last' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour'], $row['topic_last_poster_name']),
'user_id' => $row['user_id'],
'user_type' => $row['user_type'],
'user_colour' => $row['user_colour'],

View File

@@ -8,6 +8,7 @@
<li class="header"><dl><dt>{L_LATEST_ANNOUNCEMENTS}</dt></dl></li>
</ul>
<ul class="topiclist topics">
<li class="bg2">
<dl>
<dt style="border-left:0px; width: 99%">
@@ -17,37 +18,45 @@
</li>
</ul>
<span class="corners-bottom"><span></span></span>
</div>
</div>
<!-- ELSE -->
<!-- IF announcements_row.S_FIRST_ROW -->
<a name="a{announcements_row.A_ID}"></a>
<div class="forabg">
<div class="inner">
<span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header"><dl><dt>{L_LATEST_ANNOUNCEMENTS}</dt></dl></li>
<li class="header">
<dl class="icon">
<dt>{L_LATEST_ANNOUNCEMENTS}</dt>
<dd class="posts">{L_REPLIES}</dd>
<dd class="views">{L_VIEWS}</dd>
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
</dl>
</li>
</ul>
<ul class="topiclist topics">
<!-- ENDIF -->
<li class="row<!-- IF announcements_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
<dl>
<dt style="border-left:0px; width: 99%">
<a name="a{announcements_row.A_ID}"></a><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/>
<!-- IF announcements_row.S_UNREAD_INFO --><a href="{announcements_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements_row.U_VIEW_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {announcements_row.ATTACH_ICON_IMG} <!-- IF announcements_row.S_POLL --> <strong>{L_POLL}: </strong><!-- ENDIF -->
<a href="{announcements_row.U_VIEW_COMMENTS}" title="{announcements_row.TITLE}" class="topictitle">{announcements_row.TITLE}</a>
<br style="clear:both" />
<dl class="icon" style="background-image: url({announcements_row.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
<dt style="<!-- IF announcements_row.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{announcements_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{announcements_row.TOPIC_FOLDER_IMG_ALT}"><!-- IF announcements_row.S_UNREAD_TOPIC --><a href="{announcements_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><!-- IF announcements_row.ATTACH_ICON_IMG -->{announcements_row.ATTACH_ICON_IMG} <!-- ENDIF --><a href="{announcements_row.U_VIEW_COMMENTS}" title="{announcements_row.TITLE}" class="topictitle">{announcements_row.TITLE}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> &bull; <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->
<!-- IF announcements_row.PAGINATION --><strong class="pagination"><span>{announcements_row.PAGINATION}</span></strong><!-- ENDIF -->
{L_POSTED} {L_POST_BY_AUTHOR}: {announcements_row.POSTER_FULL} {L_POSTED_ON_DATE} {announcements_row.TIME}
<br style="clear:both" />
<br />{L_POSTED} {L_POST_BY_AUTHOR} {announcements_row.POSTER_FULL} {L_POSTED_ON_DATE} {announcements_row.TIME}
<!-- IF announcements_row.FORUM_NAME -->
{L_FORUM}: <strong><a href="{announcements_row.U_VIEWFORUM}">{announcements_row.FORUM_NAME}</a></strong>
<br />{L_FORUM}: <a href="{announcements_row.U_VIEWFORUM}" style="font-weight: bold;">{announcements_row.FORUM_NAME}</a>
<!-- ELSE -->
{L_GLOBAL_ANNOUNCEMENT}
<br />{L_GLOBAL_ANNOUNCEMENT}
<!-- ENDIF -->
<br style="clear:both" />
<span style="float: left; font-size:0.9em;"><a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}"><em>{L_COMMENTS}: {announcements_row.REPLIES}</em></a>
<em>&nbsp;&bull;&nbsp;{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}</em></span>
</dt>
<dd class="posts">{announcements_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
<dd class="views">{announcements_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn><!-- IF announcements_row.S_UNREAD_INFO --><a href="{announcements_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{announcements_row.U_VIEW_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {L_POST_BY_AUTHOR} {announcements_row.USERNAME_FULL_LAST}<br />
{L_POSTED_ON_DATE} {announcements_row.LAST_POST_TIME}</span>
</dd>
</dl>
</li>
<!-- IF announcements_row.S_LAST_ROW -->
@@ -55,12 +64,14 @@
<li class="row<!-- IF announcements_row.S_ROW_COUNT is even --> bg2<!-- ELSE --> bg1<!-- ENDIF -->">
<div class="topic-actions">
<div class="pagination">
{TOTAL_ANNOUNCEMENTS}
<!-- IF AP_PAGE_NUMBER --><!-- IF AP_PAGINATION --> &bull; {AP_PAGE_NUMBER} &bull; <span>{AP_PAGINATION}</span><!-- ELSE --> &bull; {AP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
</div>
</div>
</li>
<!-- ENDIF -->
</ul>
<span class="corners-bottom"><span></span></span>
</div>

View File

@@ -21,30 +21,37 @@
</div>
<!-- ELSE -->
<!-- IF news_row.S_FIRST_ROW -->
<a name="n{news_row.N_ID}"></a>
<div class="forabg">
<div class="inner">
<span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header"><dl><dt>{L_LATEST_NEWS}</dt></dl></li>
<li class="header">
<dl class="icon">
<dt>{L_LATEST_NEWS}</dt>
<dd class="posts">{L_REPLIES}</dd>
<dd class="views">{L_VIEWS}</dd>
<dd class="lastpost"><span>{L_LAST_POST}</span></dd>
</dl>
</li>
</ul>
<ul class="topiclist topics">
<!-- ENDIF -->
<li class="row<!-- IF news_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
<dl>
<dt style="border-left:0px; width: 99%">
<a name="n{news_row.N_ID}"></a><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/>
<!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_VIEW_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row.U_LAST_COMMENTS}" title="{S_NEWEST_OR_FIRST}" class="topictitle">{news_row.TITLE}</a>
<br style="clear:both" />
<dl class="icon" style="background-image: url({news_row.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
<dt style="<!-- IF news_row.TOPIC_ICON_IMG -->background-image: url({T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}); background-repeat: no-repeat;<!-- ENDIF -->" title="{news_row.TOPIC_FOLDER_IMG_ALT}"><!-- IF news_row.S_UNREAD_TOPIC --><a href="{news_row.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><!-- IF news_row.ATTACH_ICON_IMG -->{news_row.ATTACH_ICON_IMG} <!-- ENDIF --><a href="{news_row.U_VIEW_COMMENTS}" title="{news_row.TITLE}" class="topictitle">{news_row.TITLE}</a><!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --> &bull; <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->
<!-- IF news_row.PAGINATION --><strong class="pagination"><span>{news_row.PAGINATION}</span></strong><!-- ENDIF -->
{POSTED_BY_TEXT} {L_POST_BY_AUTHOR}: {news_row.POSTER_FULL} {L_POSTED_ON_DATE} {news_row.TIME}
<br style="clear:both" />
<br />{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} {L_POSTED_ON_DATE} {news_row.TIME}
<!-- IF news_row.FORUM_NAME -->
{L_FORUM}: <strong><a href="{news_row.U_VIEWFORUM}">{news_row.FORUM_NAME}</a></strong>
<br style="clear:both" />
<br />{L_FORUM}: <a href="{news_row.U_VIEWFORUM}" style="font-weight: bold;">{news_row.FORUM_NAME}</a>
<!-- ENDIF -->
<span style="float: left; font-size:0.9em;"><a href="{news_row.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><em>{L_COMMENTS}: {news_row.REPLIES}</em></a>
<em>&nbsp;&bull;&nbsp;{L_TOPIC_VIEWS}: {news_row.TOPIC_VIEWS}</em></span>
</dt>
<dd class="posts">{news_row.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
<dd class="views">{news_row.TOPIC_VIEWS} <dfn>{L_VIEWS}</dfn></dd>
<dd class="lastpost"><span><dfn>{L_LAST_POST}</dfn><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_VIEW_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {L_POST_BY_AUTHOR} {news_row.USERNAME_FULL_LAST}<br />
{L_POSTED_ON_DATE} {news_row.LAST_POST_TIME}</span>
</dd>
</dl>
</li>
<!-- IF news_row.S_LAST_ROW -->