Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ticket/10650] Last post subject in forum list. #654

Merged
merged 8 commits into from
Apr 4, 2012
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions phpBB/adm/style/acp_forums.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ <h3>{L_WARNING}</h3>
<dd><label><input type="radio" class="radio" name="display_recent" value="1"<!-- IF S_DISPLAY_ACTIVE_TOPICS --> id="display_recent" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="display_recent" value="0"<!-- IF not S_DISPLAY_ACTIVE_TOPICS --> id="display_recent" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="display_last_subject">{L_DISPLAY_LAST_SUBJECT}:</label><br /><span>{L_DISPLAY_LAST_SUBJECT_EXPLAIN}</span></dt>
<dd><label><input type="radio" class="radio" name="display_last_subject" value="1"<!-- IF S_DISPLAY_SUBJECT --> id="display_subject" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="display_last_subject" value="0"<!-- IF not S_DISPLAY_SUBJECT --> id="display_subject" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="topics_per_page">{L_FORUM_TOPICS_PAGE}:</label><br /><span>{L_FORUM_TOPICS_PAGE_EXPLAIN}</span></dt>
<dd><input type="text" id="topics_per_page" name="topics_per_page" value="{TOPICS_PER_PAGE}" size="4" maxlength="4" /></dd>
Expand Down
1 change: 1 addition & 0 deletions phpBB/develop/create_schema_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ function get_schema_struct()
'forum_options' => array('UINT:20', 0),
'display_subforum_list' => array('BOOL', 1),
'display_on_index' => array('BOOL', 1),
'display_last_subject' => array('BOOL', 1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be disabled (0) by default, imo. When a new addition is added that changes the existing functionality, it should be as unobtrusive as possible (i.e. current functionality should be retained by default, and then un-required changes/improvements should be configurable via the ACP). This also applies in the SQL files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, this is adding a new feature but adding an option for it to be disabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a big deal so if everyone really thinks this needs to be enabled by default, then fine. I just think that it's a good rule of thumb that when changing something (we are changing the way the last post info is displayed), it should default to how the user expects it to, and then give them the option to change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the 5 most downloaded MODs, I doubt anyone will complain.

People expect things to change when they update from 3.0 to 3.1

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with unknownbliss.

'enable_indexing' => array('BOOL', 1),
'enable_icons' => array('BOOL', 1),
'enable_prune' => array('BOOL', 0),
Expand Down
4 changes: 4 additions & 0 deletions phpBB/includes/acp/acp_forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ function main($id, $mode)
'forum_style' => request_var('forum_style', 0),
'display_subforum_list' => request_var('display_subforum_list', false),
'display_on_index' => request_var('display_on_index', false),
'display_last_subject' => request_var('display_last_subject', true),
'forum_topics_per_page' => request_var('topics_per_page', 0),
'enable_indexing' => request_var('enable_indexing', true),
'enable_icons' => request_var('enable_icons', false),
Expand Down Expand Up @@ -444,6 +445,7 @@ function main($id, $mode)
'enable_prune' => false,
'prune_days' => 7,
'prune_viewed' => 7,
'display_last_subject' => 0,
'prune_freq' => 1,
'forum_flags' => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS,
'forum_options' => 0,
Expand Down Expand Up @@ -636,6 +638,7 @@ function main($id, $mode)
'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false,
'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false,
'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false,
'S_DISPLAY_SUBJECT' => ($forum_data['display_last_subject']) ? true : false,
'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false,
'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false,
'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false,
Expand Down Expand Up @@ -804,6 +807,7 @@ function main($id, $mode)
'FORUM_TOPICS' => $row['forum_topics'],
'FORUM_POSTS' => $row['forum_posts'],

'S_DISPLAY_SUBJECT' => ($row['display_last_subject']) ? true : false,
'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false,
'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false,

Expand Down
6 changes: 6 additions & 0 deletions phpBB/includes/functions_display.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
if ($row['forum_last_post_id'])
{
$last_post_subject = $row['forum_last_post_subject'];
if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30)
{
$last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30)));
$last_post_subject .= '...';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation messed up? ^^

$last_post_time = $user->format_date($row['forum_last_post_time']);
$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&amp;p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
}
Expand Down Expand Up @@ -451,6 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false,
'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false,
'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false,
'S_DISPLAY_SUBJECT' => ($row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false,
'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false,

'FORUM_ID' => $row['forum_id'],
Expand Down
3 changes: 3 additions & 0 deletions phpBB/install/database_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ function database_update_info()
GROUPS_TABLE => array(
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
),
FORUMS_TABLE => array(
'display_last_subject' => array('BOOL', 1),
),
PROFILE_FIELDS_TABLE => array(
'field_show_on_pm' => array('BOOL', 0),
),
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/firebird_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ CREATE TABLE phpbb_forums (
forum_options INTEGER DEFAULT 0 NOT NULL,
display_subforum_list INTEGER DEFAULT 1 NOT NULL,
display_on_index INTEGER DEFAULT 1 NOT NULL,
display_last_subject INTEGER DEFAULT 1 NOT NULL,
enable_indexing INTEGER DEFAULT 1 NOT NULL,
enable_icons INTEGER DEFAULT 1 NOT NULL,
enable_prune INTEGER DEFAULT 0 NOT NULL,
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/mssql_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ CREATE TABLE [phpbb_forums] (
[forum_options] [int] DEFAULT (0) NOT NULL ,
[display_subforum_list] [int] DEFAULT (1) NOT NULL ,
[display_on_index] [int] DEFAULT (1) NOT NULL ,
[display_last_subject] [int] DEFAULT (1) NOT NULL ,
[enable_indexing] [int] DEFAULT (1) NOT NULL ,
[enable_icons] [int] DEFAULT (1) NOT NULL ,
[enable_prune] [int] DEFAULT (0) NOT NULL ,
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/mysql_40_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ CREATE TABLE phpbb_forums (
forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL,
display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
display_last_subject tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/mysql_41_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ CREATE TABLE phpbb_forums (
forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL,
display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
display_last_subject tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_icons tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_prune tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/oracle_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ CREATE TABLE phpbb_forums (
forum_options number(20) DEFAULT '0' NOT NULL,
display_subforum_list number(1) DEFAULT '1' NOT NULL,
display_on_index number(1) DEFAULT '1' NOT NULL,
display_last_subject number(1) DEFAULT '1' NOT NULL,
enable_indexing number(1) DEFAULT '1' NOT NULL,
enable_icons number(1) DEFAULT '1' NOT NULL,
enable_prune number(1) DEFAULT '0' NOT NULL,
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/postgres_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ CREATE TABLE phpbb_forums (
forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0),
display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
display_last_subject INT2 DEFAULT '1' NOT NULL CHECK (display_last_subject >= 0),
enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
enable_icons INT2 DEFAULT '1' NOT NULL CHECK (enable_icons >= 0),
enable_prune INT2 DEFAULT '0' NOT NULL CHECK (enable_prune >= 0),
Expand Down
1 change: 1 addition & 0 deletions phpBB/install/schemas/sqlite_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ CREATE TABLE phpbb_forums (
forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0',
display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1',
display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1',
display_last_subject INTEGER UNSIGNED NOT NULL DEFAULT '1',
enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1',
enable_icons INTEGER UNSIGNED NOT NULL DEFAULT '1',
enable_prune INTEGER UNSIGNED NOT NULL DEFAULT '0',
Expand Down
2 changes: 2 additions & 0 deletions phpBB/language/en/acp/forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
'DELETE_ALL_POSTS' => 'Delete posts',
'DELETE_SUBFORUMS' => 'Delete subforums and posts',
'DISPLAY_ACTIVE_TOPICS' => 'Enable active topics',
'DISPLAY_LAST_SUBJECT' => 'Display subject of last added post on forum list',
'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'If set to yes the subject of the last added post will be displayed in the forum list with a hyperlink to the post.',
'DISPLAY_ACTIVE_TOPICS_EXPLAIN' => 'If set to yes active topics in selected subforums will be displayed under this category.',

'EDIT_FORUM' => 'Edit forum',
Expand Down
6 changes: 5 additions & 1 deletion phpBB/styles/prosilver/template/forumlist_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
<dd class="posts">{forumrow.POSTS} <dfn>{L_POSTS}</dfn></dd>
<dd class="lastpost"><span>
<!-- IF forumrow.U_UNAPPROVED_TOPICS --><a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a><!-- ENDIF -->
<!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn> {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL}
<!-- IF forumrow.LAST_POST_TIME --><dfn>{L_LAST_POST}</dfn>
<!-- IF forumrow.S_DISPLAY_SUBJECT -->
<a href="{forumrow.U_LAST_POST}">{forumrow.LAST_POST_SUBJECT}</a></br>
<!-- ENDIF -->
{L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL}
<!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <!-- ENDIF --><br />{forumrow.LAST_POST_TIME}<!-- ELSE -->{L_NO_POSTS}<br />&nbsp;<!-- ENDIF --></span>
</dd>
<!-- ENDIF -->
Expand Down