Skip to content

Commit

Permalink
Revert "Revert "Move menu generation functionality into Menu Class an…
Browse files Browse the repository at this point in the history
…d update CSS""

This reverts commit b5b3ae1.
  • Loading branch information
mantis committed Oct 18, 2014
1 parent b5b3ae1 commit b20cf13
Show file tree
Hide file tree
Showing 45 changed files with 1,122 additions and 729 deletions.
1 change: 0 additions & 1 deletion account_page.php
Expand Up @@ -140,7 +140,6 @@
<fieldset <?php echo $t_force_pw_reset_html ?>>
<legend><span><?php echo lang_get( 'edit_account_title' ); ?></span></legend>
<?php echo form_security_field( 'account_update' );
print_account_menu( 'account_page.php' );

if( !helper_call_custom_function( 'auth_can_change_password', array() ) ) {
# With LDAP -->
Expand Down
5 changes: 0 additions & 5 deletions account_prefs_inc.php
Expand Up @@ -93,11 +93,6 @@ function edit_account_prefs( $p_user_id = null, $p_error_if_protected = true, $p
<?php echo form_security_field( 'account_prefs_update' ) ?>
<input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
<input type="hidden" name="redirect_url" value="<?php echo $t_redirect_url ?>" />
<?php
if( $p_accounts_menu ) {
print_account_menu( 'account_prefs_page.php' );
}
?>
<div class="field-container">
<label for="default-project-id"><span><?php echo lang_get( 'default_project' ) ?></span></label>
<span class="select">
Expand Down
11 changes: 1 addition & 10 deletions account_prof_edit_page.php
Expand Up @@ -72,9 +72,6 @@

html_page_top();

if( profile_is_global( $f_profile_id ) ) {
print_manage_menu();
}
?>

<?php # Edit Profile Form BEGIN ?>
Expand All @@ -89,13 +86,7 @@
<input type="hidden" name="profile_id" value="<?php echo $v_id ?>" />
<?php echo lang_get( 'edit_profile_title' ) ?>
</td>
<td class="right">
<?php
if( !profile_is_global( $f_profile_id ) ) {
print_account_menu();
}
?>
</td>
<td class="right">&nbsp;</td>
</tr>
<tr class="row-1">
<th class="category" width="25%">
Expand Down
9 changes: 0 additions & 9 deletions account_prof_menu_page.php
Expand Up @@ -72,10 +72,6 @@

html_page_top( lang_get( 'manage_profiles_link' ) );

if( $g_global_profiles ) {
print_manage_menu( 'manage_prof_menu_page.php' );
}

if( $g_global_profiles ) {
$t_user_id = ALL_USERS;
} else {
Expand All @@ -91,11 +87,6 @@
<?php echo form_security_field( 'profile_update' )?>
<input type="hidden" name="action" value="add" />
<input type="hidden" name="user_id" value="<?php echo $t_user_id ?>" />
<?php
if( !$g_global_profiles ) {
print_account_menu( 'account_prof_menu_page.php' );
}
?>
<div class="field-container">
<label for="platform" class="required"><span><?php echo lang_get( 'platform' ) ?></span></label>
<span class="input"><input id="platform" type="text" name="platform" size="32" maxlength="32" /></span>
Expand Down
4 changes: 1 addition & 3 deletions account_sponsor_page.php
Expand Up @@ -100,9 +100,7 @@
<td class="form-title">
<?php echo lang_get( 'my_sponsorship' ) ?>
</td>
<td class="right">
<?php print_account_menu( 'account_sponsor_page.php' ) ?>
</td>
<td class="right">&nbsp;</td>
</tr>
</table>
<?php
Expand Down
3 changes: 0 additions & 3 deletions adm_config_report.php
Expand Up @@ -58,9 +58,6 @@

html_page_top( lang_get( 'configuration_report' ) );

print_manage_menu( 'adm_config_report.php' );
print_manage_config_menu( 'adm_config_report.php' );

$t_config_types = array(
CONFIG_TYPE_DEFAULT => 'default',
CONFIG_TYPE_INT => 'integer',
Expand Down
3 changes: 0 additions & 3 deletions adm_permissions_report.php
Expand Up @@ -45,9 +45,6 @@

html_page_top( lang_get( 'permissions_summary_report' ) );

print_manage_menu( 'adm_permissions_report.php' );
print_manage_config_menu( 'adm_permissions_report.php' );

/**
* return html for start of administration report section
* @param string $p_section_name Section name.
Expand Down
172 changes: 172 additions & 0 deletions config_menu_defaults_inc.php
@@ -0,0 +1,172 @@
<?php
# MantisBT - A PHP based bugtracking system

# Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Default Menu Configuration Variables
*
* This file should not be changed. If you want to override any of the values
* defined here, define them in a file called config_menu_inc.php, which will
* be loaded after this file.
*
* These configurations enable more advanced customization of mantis menus.
* The include and exclude configuration options below determine on which pages the
* menus configured in 'g_menus' are displayed. The format for the configuration
* names is 'g_exclude_' . menu_key . '_menu_pages' or 'g_include_' . menu_key . '_menu_pages'
* 'menu_key' is the array key in the 'g_menus' configuration array.
* The menu class checks for both configuration options.
* If neither option exists, the menu is considered global and is displayed on every page.
* If an 'exclude' option exists for the menu, the menu is considered global and is included on every page except those in the configuration list.
* If an 'include' option exists for the menu, it is only included on pages specified in the configuration list.
*
* Developers may extend and override the MantisMenu class to modify or completely replace the default MantisBT menus.
* To do so, create a config_menus_inc.php file at the root of your mantis site.
* Add the $g_menu_class variable and the name of the new menu class to the new file. Be sure it extends the MantisMenu class.
* Add the $g_menus array variable and add the menu names and function names as defined in the new menu class.
*
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/


/**
* The name of the default class. Developers may extend this class to
* customize the menus
*/
$g_menu_class = 'MantisMenu';

/**
* If ON this option causes submenus to be nested in the main menu ( manage, account, summary, etc. )
*/
$g_nested_menus = OFF;

/**
* Alphabetize submenus
*/
$g_alpha_sort_nested_menus = OFF;

/**
* list of default menus and the (static) class functions to build them
*/
$g_menus = array(
'main'=>'getMainMenu',
'manage'=>'getManageMenu',
'manage_config' => 'getManageConfigMenu',
'account' => 'getAccountMenu',
'summary'=>'getSummaryMenu',
'graphs'=>'getGraphsMenu',
'doc'=>'getDocMenu'
);

/**
* Configurations are used to determine which pages menus should be displayed on.
*/

/**
* List of pages which should exclude the main menu
*/
$g_exclude_main_menu_pages = array();

/**
* List of pages on which to include the manage menu.
*/
$g_include_manage_menu_pages = array(
'account_prof_edit_page.php',# depends if global profiles or not
'account_prof_menu_page.php', # depends if global profiles or not
'adm_config_report.php',
'adm_permissions_report.php',
'manage_config_columns_page.php',
'manage_config_email_page.php',
'manage_config_work_threshold_page.php',
'manage_config_workflow_graph_page.php',
'manage_config_workflow_page.php',
'manage_custom_field_edit_page.php',
'manage_custom_field_page.php',
'manage_overview_page.php',
'manage_plugin_page.php',
'manage_proj_cat_edit_page.php',
'manage_proj_create_page.php',
'manage_proj_edit_page.php',
'manage_proj_page.php',
'manage_proj_ver_edit_page.php',
'manage_tags_page.php',
'manage_user_create_page.php',
'manage_user_edit_page.php',
'manage_user_page.php',
'XmlImportExport'=>array(
'import',
'import_action',
),
'MantisGraph'=>array(
'config',
),
'MantisCoreFormatting'=>array(
'config',
),
);

$g_include_manage_config_menu_pages = array(
'adm_config_report.php',
'adm_permissions_report.php',
'manage_config_columns_page.php',
'manage_config_email_page.php',
'manage_config_work_threshold_page.php',
'manage_config_workflow_graph_page.php',
'manage_config_workflow_page.php',
);

$g_include_account_menu_pages = array(
'account_page.php',
'account_prefs_page.php',
'account_prof_edit_page.php', # depends if global profiles or not
'account_prof_menu_page.php', # depends on if global profiles or not.
'account_sponsor_page.php',
'account_manage_columns_page.php',
);

$g_include_doc_menu_pages = array(
'proj_doc_add_page.php',
'proj_doc_edit_page.php',
'proj_doc_page.php',
);

$g_include_summary_menu_pages = array(
'summary_page.php',
'MantisGraph'=>array(
'summary_graph_imp_resolution.php',
'summary_graph_imp_severity.php',
'summary_graph_imp_category.php',
'summary_graph_imp_priority.php',
'summary_jpgraph_page',
'summary_graph_imp_status.php',
),
);

$g_include_graphs_menu_pages = array(
'summary_page.php',
'MantisGraph'=>array(
'summary_jpgraph_page',
'summary_graph_imp_resolution.php',
'summary_graph_imp_severity.php',
'summary_graph_imp_category.php',
'summary_graph_imp_priority.php',
'summary_graph_imp_status.php',
),
);
10 changes: 10 additions & 0 deletions core.php
Expand Up @@ -32,6 +32,8 @@
* @uses config_api.php
* @uses config_defaults_inc.php
* @uses config_inc.php
* @uses config_menu_defaults_inc.php
* @uses config_menu_inc.php
* @uses constant_inc.php
* @uses crypto_api.php
* @uses custom_constants_inc.php
Expand Down Expand Up @@ -85,6 +87,14 @@
require_once( $g_config_path . 'config_inc.php' );
}

# Include default menu configuration settings
require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'config_menu_defaults_inc.php' );

# config_menu_inc may not be present if this is a new install
if( file_exists( $g_config_path . 'config_menu_inc.php' ) ) {
require_once( $g_config_path . 'config_menu_inc.php' );
}


/**
* Define an API inclusion function to replace require_once
Expand Down

0 comments on commit b20cf13

Please sign in to comment.