Added Recent Topics Block;
Removed unnecessary comment from calendar block file; Fixed incorrect language variables in news block;
This commit is contained in:
52
root/language/en/mods/portal/portal_recent_module.php
Normal file
52
root/language/en/mods/portal/portal_recent_module.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Portal - Clock
|
||||
* @version $Id$
|
||||
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*/
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($lang) || !is_array($lang))
|
||||
{
|
||||
$lang = array();
|
||||
}
|
||||
|
||||
// DEVELOPERS PLEASE NOTE
|
||||
//
|
||||
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
|
||||
//
|
||||
// Placeholders can now contain order information, e.g. instead of
|
||||
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||
// translators to re-order the output of data while ensuring it remains correct
|
||||
//
|
||||
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||
// equally where a string contains only two placeholders which are used to wrap text
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
$lang = array_merge($lang, array(
|
||||
'PORTAL_RECENT' => 'Recent',
|
||||
'PORTAL_RECENT_TOPIC' => 'Recent topics',
|
||||
'PORTAL_RECENT_ANN' => 'Recent announcements',
|
||||
'PORTAL_RECENT_HOT_TOPIC' => 'Recent popular topics',
|
||||
|
||||
// ACP
|
||||
'ACP_PORTAL_RECENT_SETTINGS' => 'Recent topics settings',
|
||||
'ACP_PORTAL_RECENT_SETTINGS_EXP' => 'This is where you customize the recent topics block.',
|
||||
'PORTAL_MAX_TOPIC' => 'Limit of recent announcements/hot topics',
|
||||
'PORTAL_MAX_TOPIC_EXP' => '0 means infinite',
|
||||
'PORTAL_RECENT_TITLE_LIMIT' => 'Character limit for each recent topic',
|
||||
'PORTAL_RECENT_TITLE_LIMIT_EXP' => '0 means infinite',
|
||||
'PORTAL_RECENT_FORUM' => 'Recent topics forums',
|
||||
'PORTAL_RECENT_FORUM_EXP' => 'Forum(s) we pull the topics from, leave blank to pull from all forums. If "Exclude forums" is set to "Yes", select the forums you want to exclude.<br />If "Exclude forums" is set to "No" select the forums you want to see.<br />Select/Deselect multiple forums by holding <samp>CTRL</samp> and clicking.',
|
||||
'PORTAL_EXCLUDE_FORUM' => 'Exclude Forums',
|
||||
'PORTAL_EXCLUDE_FORUM_EXP' => 'Select "Yes" if you want to exlude the selected forums from the recent topics block, and "No" if you want to see only the selected forums in the recent topics block.',
|
||||
));
|
||||
|
||||
?>
|
||||
@@ -298,7 +298,7 @@ class portal_calendar_module
|
||||
$event_end_day = trim(request_var('event_end_day', ''));
|
||||
$event_end_time = trim(request_var('event_end_time', ''));
|
||||
$event_all_day = request_var('event_all_day', false); // default to false
|
||||
$event_url = request_var('event_url', ' '); // @todo: check if we need the str_replace when using serialize
|
||||
$event_url = request_var('event_url', ' ');
|
||||
$event_permission = request_var('permission-setting', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
|
||||
252
root/portal/modules/portal_recent.php
Normal file
252
root/portal/modules/portal_recent.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Portal - Recent
|
||||
* @version $Id: portal_default.php 706 2010-10-07 10:15:15Z marc1706 $
|
||||
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @package Recent
|
||||
*/
|
||||
class portal_recent_module
|
||||
{
|
||||
/**
|
||||
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||
* top 1
|
||||
* left 2
|
||||
* center 4
|
||||
* right 8
|
||||
* bottom 16
|
||||
*/
|
||||
var $columns = 21;
|
||||
|
||||
/**
|
||||
* Default modulename
|
||||
*/
|
||||
var $name = 'PORTAL_RECENT';
|
||||
|
||||
/**
|
||||
* Default module-image:
|
||||
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||
*/
|
||||
var $image_src = '';
|
||||
|
||||
/**
|
||||
* module-language file
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
var $language = 'portal_recent_module';
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
*/
|
||||
var $custom_acp_tpl = '';
|
||||
|
||||
function get_template_center($module_id)
|
||||
{
|
||||
global $config, $template, $db, $auth, $phpbb_root_path, $phpEx;
|
||||
|
||||
//
|
||||
// Exclude forums
|
||||
//
|
||||
$sql_where = '';
|
||||
if ($config['board3_recent_forum_' . $module_id] > 0)
|
||||
{
|
||||
$exclude_forums = explode(',', $config['board3_recent_forum_' . $module_id]);
|
||||
|
||||
$sql_where = ' AND ' . $db->sql_in_set('forum_id', array_map('intval', $exclude_forums), ($config['board3_exclude_forums_' . $module_id]) ? true : false);
|
||||
}
|
||||
|
||||
// Get a list of forums the user cannot read
|
||||
$forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));
|
||||
|
||||
// Determine first forum the user is able to read (must not be a category)
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_type = ' . FORUM_POST;
|
||||
|
||||
$forum_sql = '';
|
||||
if (sizeof($forum_ary))
|
||||
{
|
||||
$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
|
||||
$forum_sql = ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary, true);
|
||||
}
|
||||
|
||||
$result = $db->sql_query_limit($sql, 1);
|
||||
$g_forum_id = (int) $db->sql_fetchfield('forum_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
//
|
||||
// Recent announcements
|
||||
//
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
WHERE topic_status <> ' . FORUM_LINK . '
|
||||
AND topic_approved = 1
|
||||
AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ')
|
||||
AND topic_moved_id = 0
|
||||
' . $sql_where . '' . $forum_sql . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]);
|
||||
|
||||
while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
|
||||
{
|
||||
// auto auth
|
||||
if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
|
||||
{
|
||||
$template->assign_block_vars('latest_announcements', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
//
|
||||
// Recent hot topics
|
||||
//
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
WHERE topic_approved = 1
|
||||
AND topic_replies >=' . $config['hot_threshold'] . '
|
||||
AND topic_moved_id = 0
|
||||
' . $sql_where . '' . $forum_sql . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]);
|
||||
|
||||
while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
|
||||
{
|
||||
// auto auth
|
||||
if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
|
||||
{
|
||||
$template->assign_block_vars('latest_hot_topics', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
//
|
||||
// Recent topic (only show normal topic)
|
||||
//
|
||||
$sql = 'SELECT topic_title, forum_id, topic_id
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
WHERE topic_status <> ' . ITEM_MOVED . '
|
||||
AND topic_approved = 1
|
||||
AND topic_type = ' . POST_NORMAL . '
|
||||
AND topic_moved_id = 0
|
||||
' . $sql_where . '' . $forum_sql . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]);
|
||||
|
||||
while(($row = $db->sql_fetchrow($result)) && ($row['topic_title']))
|
||||
{
|
||||
// auto auth
|
||||
if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
|
||||
{
|
||||
$template->assign_block_vars('latest_topics', array(
|
||||
'TITLE' => character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]),
|
||||
'FULL_TITLE' => censor_text($row['topic_title']),
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
|
||||
));
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return 'recent_center.html';
|
||||
}
|
||||
|
||||
function get_template_acp($module_id)
|
||||
{
|
||||
return array(
|
||||
'title' => 'ACP_PORTAL_RECENT_SETTINGS',
|
||||
'vars' => array(
|
||||
'legend1' => 'ACP_PORTAL_RECENT_SETTINGS',
|
||||
'board3_max_topics_' . $module_id => array('lang' => 'PORTAL_MAX_TOPIC', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||
'board3_recent_title_limit_' . $module_id => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||
'board3_recent_forum_' . $module_id => array('lang' => 'PORTAL_RECENT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_forums', 'submit' => 'store_selected_forums'),
|
||||
'board3_recent_exclude_forums_' . $module_id => array('lang' => 'PORTAL_EXCLUDE_FORUM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* API functions
|
||||
*/
|
||||
function install($module_id)
|
||||
{
|
||||
set_config('board3_max_topics_' . $module_id, 10);
|
||||
set_config('board3_recent_title_limit_' . $module_id, 100);
|
||||
set_config('board3_recent_forum_' . $module_id, '');
|
||||
set_config('board3_recent_exclude_forums_' . $module_id, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
function uninstall($module_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$del_config = array(
|
||||
'board3_max_topics_' . $module_id,
|
||||
'board3_recent_title_limit_' . $module_id,
|
||||
'board3_recent_forum_' . $module_id,
|
||||
'board3_recent_exclude_forums_' . $module_id,
|
||||
);
|
||||
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Create forum select box
|
||||
function select_forums($value, $key, $module_id)
|
||||
{
|
||||
global $user, $config;
|
||||
|
||||
$forum_list = make_forum_select(false, false, true, true, true, false, true);
|
||||
|
||||
$selected = array();
|
||||
if(isset($config[$key]) && strlen($config[$key]) > 0)
|
||||
{
|
||||
$selected = explode(',', $config[$key]);
|
||||
}
|
||||
// Build forum options
|
||||
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
|
||||
foreach ($forum_list as $f_id => $f_row)
|
||||
{
|
||||
$s_forum_options .= '<option value="' . $f_id . '"' . ((in_array($f_id, $selected)) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
|
||||
}
|
||||
$s_forum_options .= '</select>';
|
||||
|
||||
return $s_forum_options;
|
||||
|
||||
}
|
||||
|
||||
// Store selected forums
|
||||
function store_selected_forums($key, $module_id)
|
||||
{
|
||||
global $db, $cache;
|
||||
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
set_config($key, $news);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -11,7 +11,7 @@
|
||||
<!-- ELSE -->
|
||||
<div style="margin-bottom: <!-- IF announcements_row.S_LAST_ROW -->0px<!-- ELSE -->1px<!-- ENDIF -->" class="post <!-- IF news_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
|
||||
<div class="inner"><span class="portal-corners-top-inner"></span>
|
||||
<h4 class="first"><a name="n"></a><a name="n{news_row.N_ID}"></a><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news_row.U_VIEW_COMMENTS}"><strong>{news_row.TITLE}</strong></a></h4>
|
||||
<h4 class="first"><a name="n"></a><a name="n{news_row.N_ID}"></a><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news_row.U_VIEW_COMMENTS}"><strong>{news_row.TITLE}</strong></a></h4>
|
||||
<!-- IF news_row.PAGINATION --><strong class="pagination"><span>{news_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<ul class="linklist">
|
||||
<li>{POSTED_BY_TEXT} {L_POST_BY_AUTHOR}: {news_row.POSTER_FULL} » {news_row.TIME}</li>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<!-- ENDIF -->
|
||||
<li class="row<!-- IF news_row.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
|
||||
<dl class="icon" style="background-image: url({news_row.TOPIC_FOLDER_IMG_SRC}); background-repeat: no-repeat;">
|
||||
<dt style="<!-- IF S_DISPLAY_NEWS_RVS -->width: 44%;<!-- ELSE -->width: 60%;<!-- ENDIF --> <!-- 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 --><!-- IF news_row.S_POLL --><strong>{L_POLL}: </strong><!-- 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 --> • <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->
|
||||
<dt style="<!-- IF S_DISPLAY_NEWS_RVS -->width: 44%;<!-- ELSE -->width: 60%;<!-- ENDIF --> <!-- 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 --><!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- 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 --> • <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> • <!-- ENDIF -->
|
||||
<!-- IF news_row.PAGINATION --><strong class="pagination"><span>{news_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
<br />{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} » {news_row.TIME}
|
||||
<!-- IF news_row.FORUM_NAME -->
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<!--version $Id$ //-->
|
||||
<!-- IF .latest_announcements or .latest_hot_topics or .latest_topics -->
|
||||
{$C_BLOCK_H_L}<dt>{L_PORTAL_RECENT}</dt>{$C_BLOCK_H_R}
|
||||
<ul class="topiclist bg1">
|
||||
<li><dl>
|
||||
<dd style="border-left:0px; width:100%">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<!-- IF .latest_announcements --><td class="row1"><strong>{L_PORTAL_RECENT_ANN}</strong></td><!-- ENDIF -->
|
||||
<!-- IF .latest_hot_topics --><td class="row1"><strong>{L_PORTAL_RECENT_HOT_TOPIC}</strong></td><!-- ENDIF -->
|
||||
<!-- IF .latest_topics --><td class="row1"><strong>{L_PORTAL_RECENT_TOPIC}</strong></td><!-- ENDIF -->
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- IF .latest_announcements -->
|
||||
<td class="row1" style="width: 33%;" valign="top">
|
||||
<span class="gensmall">
|
||||
<!-- BEGIN latest_announcements -->
|
||||
<a href="{latest_announcements.U_VIEW_TOPIC}" title="{latest_announcements.FULL_TITLE}">{latest_announcements.TITLE}</a><br />
|
||||
<!-- END latest_announcements -->
|
||||
</span>
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF .latest_hot_topics -->
|
||||
<td class="row1" style="width: 33%;" valign="top">
|
||||
<span class="gensmall">
|
||||
<!-- BEGIN latest_hot_topics -->
|
||||
<a href="{latest_hot_topics.U_VIEW_TOPIC}" title="{latest_hot_topics.FULL_TITLE}">{latest_hot_topics.TITLE}</a><br />
|
||||
<!-- END latest_hot_topics -->
|
||||
</span>
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF .latest_topics -->
|
||||
<td class="row1" style="width: 33%;" valign="top">
|
||||
<span class="gensmall">
|
||||
<!-- BEGIN latest_topics -->
|
||||
<a href="{latest_topics.U_VIEW_TOPIC}" title="{latest_topics.FULL_TITLE}">{latest_topics.TITLE}</a><br />
|
||||
<!-- END latest_topics -->
|
||||
</span>
|
||||
</td>
|
||||
<!-- ENDIF -->
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl></li>
|
||||
</ul>
|
||||
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||
<!-- ENDIF -->
|
||||
Reference in New Issue
Block a user