From 4d58a7894762df0fa4cf74c3d1abadc2d8e1596c Mon Sep 17 00:00:00 2001 From: SL-Gundam Date: Thu, 6 Oct 2016 22:20:42 +0200 Subject: [PATCH] Preliminary support for MantisBT 2.0.x and ModernUI --- EmailReporting.php | 2 +- core/config_api.php | 35 +++++++++++++++++++++++++++++++++++ doc/CHANGELOG.txt | 1 + pages/manage_config.php | 8 +++----- pages/manage_config_edit.php | 4 ++-- pages/manage_mailbox.php | 8 +++----- pages/manage_mailbox_edit.php | 4 ++-- pages/manage_rule.php | 7 +++---- pages/view_changelog.php | 8 +++----- pages/view_readme.php | 8 +++----- 10 files changed, 56 insertions(+), 29 deletions(-) diff --git a/EmailReporting.php b/EmailReporting.php index 72ed48d..72b3651 100644 --- a/EmailReporting.php +++ b/EmailReporting.php @@ -63,7 +63,7 @@ function register() $this->version = '0.9.3-DEV'; $this->requires = array( - 'MantisCore' => '1.2.6, <1.3.99', + 'MantisCore' => '1.2.6, <2.0.99', ); $this->author = plugin_lang_get( 'plugin_author' ); diff --git a/core/config_api.php b/core/config_api.php index 2efb971..1690c81 100644 --- a/core/config_api.php +++ b/core/config_api.php @@ -98,6 +98,41 @@ function ERP_get_mailboxes( $p_mailbox_id = FALSE, $p_mailbox_plugin_content = T } } + # -------------------- + # Page header en beginning. + function ERP_page_begin( $p_page = '' ) + { + // MantisBT 2.0.x + if ( function_exists( 'layout_page_header' ) ) + { + layout_page_header( $p_page ); + layout_page_begin( 'manage_overview_page.php' ); + print_manage_menu( 'manage_plugin_page.php' ); + } + // pre-MantisBT 2.0.x + else + { + html_page_top( $p_page ); + print_manage_menu(); + } + } + + # -------------------- + # Page footer + function ERP_page_end( $p_page = '' ) + { + // MantisBT 2.0.x + if ( function_exists( 'layout_page_end' ) ) + { + layout_page_end(); + } + // pre-MantisBT 2.0.x + else + { + html_page_bottom( $p_page ); + } + } + # -------------------- # output the menu with the ERP menu links function ERP_print_menu( $p_page = '' ) diff --git a/doc/CHANGELOG.txt b/doc/CHANGELOG.txt index 99e9cae..3ec0e1a 100644 --- a/doc/CHANGELOG.txt +++ b/doc/CHANGELOG.txt @@ -1,5 +1,6 @@ Changelog: Jul 2016 - EmailReporting-0.9.3-DEV + - Preliminary support for MantisBT 2.0.x and ModernUI - Fix possible fatal error on return value - Added error when __construct is not run when it should have - Added fallback in case of an unknown email priority diff --git a/pages/manage_config.php b/pages/manage_config.php index dd76b26..d0a8f96 100644 --- a/pages/manage_config.php +++ b/pages/manage_config.php @@ -2,12 +2,10 @@ auth_reauthenticate( ); access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); -layout_page_header( plugin_lang_get( 'plugin_title' ) ); - -layout_page_begin( 'manage_overview_page.php' ); - plugin_require_api( 'core/config_api.php' ); +ERP_page_begin( plugin_lang_get( 'plugin_title' ) ); + $t_this_page = 'manage_config'; ERP_print_menu( $t_this_page ); @@ -191,5 +189,5 @@ diff --git a/pages/manage_config_edit.php b/pages/manage_config_edit.php index 1eb5e49..84d8deb 100644 --- a/pages/manage_config_edit.php +++ b/pages/manage_config_edit.php @@ -62,7 +62,7 @@ } else { - layout_page_header( plugin_lang_get( 'plugin_title' ) ); + ERP_page_begin( plugin_lang_get( 'plugin_title' ) ); echo '
'; echo plugin_lang_get( 'mail_bug_priority_array_failure' ) . ' '; @@ -71,7 +71,7 @@ $t_notsuccesfull = TRUE; - layout_page_end(); + ERP_page_end( __FILE__ ); } if ( !isset( $t_notsuccesfull ) ) diff --git a/pages/manage_mailbox.php b/pages/manage_mailbox.php index 6b76d6e..718fba5 100644 --- a/pages/manage_mailbox.php +++ b/pages/manage_mailbox.php @@ -2,12 +2,10 @@ auth_reauthenticate( ); access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); -layout_page_header( plugin_lang_get( 'plugin_title' ) ); - -layout_page_begin( 'manage_overview_page.php' ); - plugin_require_api( 'core/config_api.php' ); +ERP_page_begin( plugin_lang_get( 'plugin_title' ) ); + $t_this_page = 'manage_mailbox'; ERP_print_menu( $t_this_page ); @@ -139,5 +137,5 @@
diff --git a/pages/manage_mailbox_edit.php b/pages/manage_mailbox_edit.php index 95e20fb..617a685 100644 --- a/pages/manage_mailbox_edit.php +++ b/pages/manage_mailbox_edit.php @@ -73,7 +73,7 @@ { $t_no_redirect = TRUE; - layout_page_header( plugin_lang_get( 'plugin_title' ) ); + ERP_page_begin( plugin_lang_get( 'plugin_title' ) ); ?>
diff --git a/pages/view_changelog.php b/pages/view_changelog.php index 0567d1b..10bbf60 100644 --- a/pages/view_changelog.php +++ b/pages/view_changelog.php @@ -2,12 +2,10 @@ auth_reauthenticate( ); access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); -layout_page_header( plugin_lang_get( 'plugin_title' ) ); - -layout_page_begin( 'manage_overview_page.php' ); - plugin_require_api( 'core/config_api.php' ); +ERP_page_begin( plugin_lang_get( 'plugin_title' ) ); + $t_this_page = 'view_changelog'; ERP_print_menu( $t_this_page ); @@ -20,5 +18,5 @@ diff --git a/pages/view_readme.php b/pages/view_readme.php index a3da162..48bd177 100644 --- a/pages/view_readme.php +++ b/pages/view_readme.php @@ -2,12 +2,10 @@ auth_reauthenticate( ); access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); -layout_page_header( plugin_lang_get( 'plugin_title' ) ); - -layout_page_begin( 'manage_overview_page.php' ); - plugin_require_api( 'core/config_api.php' ); +ERP_page_begin( plugin_lang_get( 'plugin_title' ) ); + $t_this_page = 'view_readme'; ERP_print_menu( $t_this_page ); @@ -20,5 +18,5 @@