diff -Naur mantisbt-1.2.3/config_defaults_inc.php mantisbt-patch/config_defaults_inc.php
--- mantisbt-1.2.3/config_defaults_inc.php 2010-09-22 10:39:51.000000000 +0200
+++ mantisbt-patch/config_defaults_inc.php 2010-09-22 10:49:00.000000000 +0200
@@ -777,6 +777,14 @@
$g_show_project_menu_bar = OFF;
/**
+ * Show available projects in a condensed mode: only current project,
+ * its parents and children are displayed in the project menu bar;
+ * projects are displayed only once in project dropdown.
+ * @global int $g_show_projects_condensed
+ */
+ $g_show_projects_condensed = OFF;
+
+ /**
* show assigned to names
* This is in the view all pages
* @global int $g_show_assigned_names
diff -Naur mantisbt-1.2.3/core/html_api.php mantisbt-patch/core/html_api.php
--- mantisbt-1.2.3/core/html_api.php 2010-09-22 10:40:42.000000000 +0200
+++ mantisbt-patch/core/html_api.php 2010-09-22 11:30:16.000000000 +0200
@@ -865,9 +865,33 @@
echo '
';
@@ -880,11 +904,19 @@
* @return null
*/
function print_subproject_menu_bar( $p_project_id, $p_parents = '' ) {
- $t_subprojects = current_user_get_accessible_subprojects( $p_project_id );
+ $t_recursive = false;
+ $t_subprojects = $p_project_id;
+ if( !is_array( $p_project_id ) ) {
+ $t_recursive = true;
+ $t_subprojects = current_user_get_accessible_subprojects( $p_project_id );
+ }
+
$t_char = ':';
foreach( $t_subprojects as $t_subproject ) {
echo $t_char . ' ' . string_html_specialchars( project_get_field( $t_subproject, 'name' ) ) . ' ';
- print_subproject_menu_bar( $t_subproject, $p_parents . $t_subproject . ';' );
+ if( $t_recursive ) {
+ print_subproject_menu_bar( $t_subproject, $p_parents . $t_subproject . ';' );
+ }
$t_char = ',';
}
}
diff -Naur mantisbt-1.2.3/core/print_api.php mantisbt-patch/core/print_api.php
--- mantisbt-1.2.3/core/print_api.php 2010-09-22 10:41:12.000000000 +0200
+++ mantisbt-patch/core/print_api.php 2010-09-22 13:56:34.000000000 +0200
@@ -462,7 +462,9 @@
* @return void
*/
function print_project_option_list( $p_project_id = null, $p_include_all_projects = true, $p_filter_project_id = null, $p_trace = false ) {
- $t_project_ids = current_user_get_accessible_projects();
+ $t_condensed = ( config_get( 'show_projects_condensed' ) != OFF );
+ $t_project_ids = $t_condensed ? current_user_get_all_accessible_subprojects( ALL_PROJECTS ) :
+ current_user_get_accessible_projects();
project_cache_array_rows( $t_project_ids );
if( $p_include_all_projects ) {
@@ -471,14 +473,24 @@
echo '>' . lang_get( 'all_projects' ) . '' . "\n";
}
- $t_project_count = count( $t_project_ids );
- for( $i = 0;$i < $t_project_count;$i++ ) {
- $t_id = $t_project_ids[$i];
+ $t_projects = array();
+ foreach( $t_project_ids as $t_id ) {
+ $t_projects[$t_id] = project_get_field( $t_id, 'name' );
+ }
+ asort( $t_projects );
+ if( $t_condensed ) {
+ $t_selected_id = split( ';', $p_project_id );
+ $p_project_id = $t_selected_id[ count( $t_selected_id ) - 1 ];
+ }
+
+ foreach( $t_projects as $t_id => $t_name ) {
if( $t_id != $p_filter_project_id ) {
echo '' . string_attribute( project_get_field( $t_id, 'name' ) ) . ' ' . "\n";
- print_subproject_option_list( $t_id, $p_project_id, $p_filter_project_id, $p_trace, Array() );
+ echo '>' . string_attribute( $t_name ) . '' . "\n";
+ if( !$t_condensed ) {
+ print_subproject_option_list( $t_id, $p_project_id, $p_filter_project_id, $p_trace, Array() );
+ }
}
}
}
diff -Naur mantisbt-1.2.3/core/user_api.php mantisbt-patch/core/user_api.php
--- mantisbt-1.2.3/core/user_api.php 2010-09-22 10:40:58.000000000 +0200
+++ mantisbt-patch/core/user_api.php 2010-09-22 13:58:39.000000000 +0200
@@ -1001,7 +1001,7 @@
/** @todo (thraxisp) Should all top level projects be a sub-project of ALL_PROJECTS implicitly?
* affects how news and some summaries are generated
*/
- $t_todo = user_get_accessible_subprojects( $p_user_id, $p_project_id );
+ $t_todo = $p_project_id == ALL_PROJECTS ? user_get_accessible_projects( $p_user_id ) : user_get_accessible_subprojects( $p_user_id, $p_project_id );
$t_subprojects = Array();
while( $t_todo ) {