1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[feature/pagination-as-list] Various fixes and improvements

Extracted common template code for prosilver as per subsilver2.
Various other fixups and oversight corrections, changed name
of the "new" template function and re-introduced existing
version. Altered on_page to compensate for removal of some
templating vars from pagination routine.

PHPBB3-10968
This commit is contained in:
Drae
2012-07-05 18:56:14 +01:00
parent 922147f05a
commit dc71c0629e
53 changed files with 303 additions and 569 deletions

View File

@@ -101,7 +101,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
generate_pagination($url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : ''), $forum_topics, $topics_per_page, $start);
$base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : '');
generate_template_pagination($base_url, 'pagination', $forum_topics, $topics_per_page, $start);
$template->assign_vars(array(
'ACTION' => $action,
@@ -131,7 +132,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''),
'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start),
'PAGE_NUMBER' => on_page($base_url, $forum_topics, $topics_per_page, $start),
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics),
));

View File

@@ -171,10 +171,11 @@ class mcp_logs
$log_count = 0;
$start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start);
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($base_url, $log_count, $config['topics_per_page'], $start),
'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count),
'L_TITLE' => $user->lang['MCP_LOGS'],

View File

@@ -215,7 +215,8 @@ class mcp_notes
}
}
generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start);
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'U_POST_ACTION' => $this->u_action,
@@ -227,7 +228,7 @@ class mcp_notes
'L_TITLE' => $user->lang['MCP_NOTES_USER'],
'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($base_url, $log_count, $config['topics_per_page'], $start),
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count),
'RANK_TITLE' => $rank_title,

View File

@@ -297,8 +297,9 @@ class mcp_pm_reports
}
}
}
generate_pagination($this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start);
$base_url = $this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir";
generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start);
// Now display the page
$template->assign_vars(array(
@@ -309,7 +310,7 @@ class mcp_pm_reports
'S_MCP_ACTION' => $this->u_action,
'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false,
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($base_url, $total, $config['topics_per_page'], $start),
'TOTAL' => $total,
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
)

View File

@@ -419,7 +419,8 @@ class mcp_queue
}
unset($rowset, $forum_names);
generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start);
$base_url = $this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir";
generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start);
// Now display the page
$template->assign_vars(array(
@@ -432,7 +433,7 @@ class mcp_queue
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true,
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($base_url, $total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $user->lang((($mode == 'unapproved_posts') ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
));

View File

@@ -411,7 +411,8 @@ class mcp_reports
unset($report_ids, $row);
}
generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start);
$base_url = $this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir";
generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start);
// Now display the page
$template->assign_vars(array(
@@ -423,7 +424,7 @@ class mcp_reports
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($base_url, $total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),

View File

@@ -306,9 +306,10 @@ function mcp_topic_view($id, $mode, $action)
'post_ids' => $post_id_list,
));
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir");
if ($posts_per_page)
{
generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"), $total, $posts_per_page, $start);
generate_template_pagination($base_url, 'pagination', $total, $posts_per_page, $start);
}
$template->assign_vars(array(
@@ -349,7 +350,7 @@ function mcp_topic_view($id, $mode, $action)
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&amp;t={$topic_info['topic_id']}&amp;start=$start") . '">', '</a>'),
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&amp;start=$start") . '">', '</a>'),
'PAGE_NUMBER' => on_page($total, $posts_per_page, $start),
'PAGE_NUMBER' => on_page($base_url, $total, $posts_per_page, $start),
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),
));
}

View File

@@ -175,7 +175,8 @@ class mcp_warn
));
}
generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&amp;mode=list&amp;st=$st&amp;sk=$sk&amp;sd=$sd"), $user_count, $config['topics_per_page'], $start);
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&amp;mode=list&amp;st=$st&amp;sk=$sk&amp;sd=$sd");
generate_template_pagination($base_url, 'pagination', $user_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'U_POST_ACTION' => $this->u_action,
@@ -184,7 +185,7 @@ class mcp_warn
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,
'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($base_url, $user_count, $config['topics_per_page'], $start),
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count),
));
}