From dbb331284ef8ca422b4fb304d23e9e1fcf566c55 Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 10 Jul 2014 12:07:51 +0200 Subject: [PATCH 01/10] [ticket/12838] Add template events to acp_ranks.html PHPBB3-12838 --- phpBB/adm/style/acp_ranks.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index dd2d07a837..29dc0dea6f 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -45,6 +45,8 @@ + +

@@ -71,6 +73,7 @@ {L_RANK_IMAGE} {L_RANK_TITLE} {L_RANK_MINIMUM} + {L_ACTION} @@ -80,6 +83,7 @@ {ranks.RANK_TITLE}  -   {ranks.RANK_TITLE}   -  {ranks.MIN_POSTS} + {ICON_EDIT} {ICON_DELETE} From 1f61f3a416a4ca3f072ff453255016d158f433c7 Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 10 Jul 2014 12:10:06 +0200 Subject: [PATCH 02/10] [ticket/12838] Add _before versions PHPBB3-12838 --- phpBB/adm/style/acp_ranks.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index 29dc0dea6f..ea69e1254b 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -24,6 +24,9 @@

{L_ACP_RANKS} + + +
@@ -70,6 +73,7 @@ + @@ -80,6 +84,7 @@ + From bfdaefa7f6fb75fd28b401fc322b87d5574d66e4 Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 10 Jul 2014 12:16:50 +0200 Subject: [PATCH 03/10] [ticket/12838] Update events.md PHPBB3-12838 --- phpBB/docs/events.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index f1c03672c3..f9b6d9227b 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -78,6 +78,50 @@ acp_posting_buttons_before * Since: 3.1.0-b4 * Purpose: Add content before BBCode posting buttons in the ACP +acp_ranks_edit_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC2 +* Purpose: Add content after the rank details when editing a rank in the ACP + +acp_ranks_edit_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC2 +* Purpose: Add content before the rank details when editing a rank in the ACP + +acp_ranks_list_column_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC2 +* Purpose: Add content before the first column in the ranks list in the ACP + +acp_ranks_list_column_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC2 +* Purpose: Add content after the last column (but before the action column) +in the ranks list in the ACP + +acp_ranks_list_header_after +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC2 +* Purpose: Add content before the first header-column in the ranks list in the ACP + +acp_ranks_list_header_before +=== +* Locations: + + adm/style/acp_ranks.html +* Since: 3.1.0-RC2 +* Purpose: Add content after the last header-column (but before the action column) +in the ranks list in the ACP + acp_simple_footer_after === * Location: adm/style/simple_footer.html From 9468d173bc4deb8e757b651d636f1102da670385 Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 10 Jul 2014 13:29:07 +0200 Subject: [PATCH 04/10] [ticket/12838] Add core events to acp_ranks.php PHPBB3-12838 --- phpBB/includes/acp/acp_ranks.php | 45 ++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index fdbd0e0a1d..4690196176 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -25,7 +25,7 @@ class acp_ranks function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $request; + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; $user->add_lang('acp/posting'); @@ -73,6 +73,17 @@ class acp_ranks 'rank_image' => htmlspecialchars_decode($rank_image) ); + /** + * Modify the SQL array when saving a rank + * + * @event core.acp_ranks_save_modify_sql_ary + * @var int rank_id The ID of the rank (if available) + * @var array sql_ary Array with the rank's data + * @since 3.1.0-RC2 + */ + $vars = array('rank_id', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_save_modify_sql_ary', compact($vars))); + if ($rank_id) { $sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id"; @@ -202,7 +213,7 @@ class acp_ranks $filename_list = '' . $filename_list; unset($existing_imgs, $imglist); - $template->assign_vars(array( + $tpl_ary = array( 'S_EDIT' => true, 'U_BACK' => $this->u_action, 'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'], @@ -212,9 +223,21 @@ class acp_ranks 'S_FILENAME_LIST' => $filename_list, 'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif', 'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false, - 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0) + 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0, ); + /** + * Modify the template output array for editing/adding ranks + * + * @event core.acp_ranks_edit_modify_tpl_ary + * @var int rank_id The ID of the rank (if available) + * @var array tpl_ary Array with the rank's template data + * @since 3.1.0-RC2 + */ + $vars = array('rank_id', 'tpl_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_edit_modify_tpl_ary', compact($vars))); + + $template->assign_vars($tpl_ary); return; break; @@ -231,7 +254,7 @@ class acp_ranks while ($row = $db->sql_fetchrow($result)) { - $template->assign_block_vars('ranks', array( + $rank_row = array( 'S_RANK_IMAGE' => ($row['rank_image']) ? true : false, 'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false, @@ -240,8 +263,20 @@ class acp_ranks 'MIN_POSTS' => $row['rank_min'], 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['rank_id'], - 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id']) + 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id'], ); + + /** + * Modify the template output array for each listed rank + * + * @event core.acp_ranks_list_modify_rank_row + * @var array rank_row Array with the rank's template data + * @since 3.1.0-RC2 + */ + $vars = array('rank_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_ranks_list_modify_rank_row', compact($vars))); + + $template->assign_block_vars('ranks', $rank_row); } $db->sql_freeresult($result); From 0bece6dada5af1f8245a2200f43978e5dd7f5f63 Mon Sep 17 00:00:00 2001 From: PayBas Date: Thu, 10 Jul 2014 16:24:17 +0200 Subject: [PATCH 05/10] [ticket/12838] Simplify special rank template conditional PHPBB3-12838 --- phpBB/adm/style/acp_ranks.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index ea69e1254b..fa06513b98 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -41,7 +41,7 @@
-
{L_RANK_IMAGE} {L_RANK_TITLE} {L_RANK_MINIMUM}
{ranks.RANK_TITLE}  -   {ranks.RANK_TITLE}   -  {ranks.MIN_POSTS}