Skip to content

Commit

Permalink
0004185: [customization] Support custom menu options (vboctor)
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2754 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Jul 24, 2004
1 parent fc8427b commit 7b577fc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
15 changes: 14 additions & 1 deletion config_defaults_inc.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: config_defaults_inc.php,v 1.181 2004-07-24 14:04:45 vboctor Exp $
# $Id: config_defaults_inc.php,v 1.182 2004-07-24 15:20:36 vboctor Exp $
# --------------------------------------------------------


Expand Down Expand Up @@ -1143,6 +1143,19 @@
# Whether to start editng a custom field immediately after creating it
$g_custom_field_edit_after_create = ON;


#################
# Custom Menus
#################

# Add custom options to the main menu. For example:
# $g_main_menu_custom_options = array( array( "My Link", MANAGER, 'my_link.php' ),
# array( "My Link2", ADMINISTRATOR, 'my_link2.php' ) );
# Note that if the caption is found in custom_strings_inc.php, then it will be replaced by the
# translated string. Options will only be added to the menu if the current logged in user has
# the appropriate access level.
$g_main_menu_custom_options = array ();

##########
# Icons
##########
Expand Down
22 changes: 21 additions & 1 deletion core/html_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: html_api.php,v 1.112 2004-07-24 14:17:12 vboctor Exp $
# $Id: html_api.php,v 1.113 2004-07-24 15:20:45 vboctor Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -369,6 +369,22 @@ function html_end() {
# HTML Menu API
###########################################################################

function prepare_custom_menu_options( $p_config ) {
$t_custom_menu_options = config_get( $p_config );
$t_options = array();

foreach( $t_custom_menu_options as $t_custom_option ) {
$t_access_level = $t_custom_option[1];
if ( access_has_project_level( $t_access_level ) ) {
$t_caption = lang_get_defaulted( $t_custom_option[0] );
$t_link = $t_custom_option[2];
$t_options[] = "<a href=\"$t_link\">$t_caption</a>";
}
}

return $t_options;
}

# --------------------
# Print the main menu
function print_menu() {
Expand Down Expand Up @@ -433,6 +449,10 @@ function print_menu() {
$t_menu_options[] = '<a href="account_page.php">' . lang_get( 'account_link' ) . '</a>';
}

# Add custom options
$t_custom_options = prepare_custom_menu_options( 'main_menu_custom_options' );
$t_menu_options = array_merge( $t_menu_options, $t_custom_options );

# Logout (no if anonymously logged in)
if ( !current_user_is_anonymous() ) {
$t_menu_options[] = '<a href="logout_page.php">' . lang_get( 'logout_link' ) . '</a>';
Expand Down
2 changes: 2 additions & 0 deletions doc/ChangeLog
Expand Up @@ -4,6 +4,7 @@ Mantis ChangeLog

- 0004137: [feature] Support a simple "view" URL (vboctor)
- 0004145: [feature] Mantis pages should have descriptive titles (vboctor)
- 0004185: [customization] Support custom menu options (vboctor)
- 0003880: [filters] Ordering doesnt take last_updated into account (narcissus)
- 0003945: [filters] Give the ability to "Update Fixed in Version" in view_all_bug_page.php (narcissus)
- 0004073: [filters] Edit filter page now too wide. 'Apply filter' button is drawn off screen (narcissus)
Expand All @@ -20,6 +21,7 @@ Mantis ChangeLog
- 0003714: [upgrade] Please add in a way to transfer attachments from the database to disk (thraxisp)
- 0003877: [email] Upgrade to PHPMailer 1.72 (vboctor)
- 0002220: [installation] usage of consistent naming schema for images (vboctor)
- New Config: main_menu_custom_options (default empty) - Allow addition of custom menu options to main menu (vboctor)
- Updated German and Brazilian Portuguese language.

2004.07.20 - 0.19.0a2
Expand Down

0 comments on commit 7b577fc

Please sign in to comment.