From: <nuc...@us...> - 2008-02-01 18:48:57
|
Revision: 4942 http://mantisbt.svn.sourceforge.net/mantisbt/?rev=4942&view=rev Author: nuclear_eclipse Date: 2008-02-01 10:48:53 -0800 (Fri, 01 Feb 2008) Log Message: ----------- Added proper handling of id=0 categories. Modified Paths: -------------- trunk/mantisbt/bug_view_advanced_page.php trunk/mantisbt/bug_view_page.php trunk/mantisbt/core/category_api.php trunk/mantisbt/core/my_view_inc.php trunk/mantisbt/lang/strings_english.txt Modified: trunk/mantisbt/bug_view_advanced_page.php =================================================================== --- trunk/mantisbt/bug_view_advanced_page.php 2008-02-01 18:48:41 UTC (rev 4941) +++ trunk/mantisbt/bug_view_advanced_page.php 2008-02-01 18:48:53 UTC (rev 4942) @@ -167,11 +167,7 @@ <!-- Category --> <td> - <?php - if ( $t_bug->category_id != 0 ) { - echo string_display( category_full_name( $t_bug->category_id ) ); - } - ?> + <?php echo string_display( category_full_name( $t_bug->category_id ) ); ?> </td> <!-- Severity --> Modified: trunk/mantisbt/bug_view_page.php =================================================================== --- trunk/mantisbt/bug_view_page.php 2008-02-01 18:48:41 UTC (rev 4941) +++ trunk/mantisbt/bug_view_page.php 2008-02-01 18:48:53 UTC (rev 4942) @@ -170,11 +170,7 @@ <!-- Category --> <td> - <?php - if ( $t_bug->category_id != 0 ) { - echo string_display( category_full_name( $t_bug->category_id ) ); - } - ?> + <?php echo string_display( category_full_name( $t_bug->category_id ) ); ?> </td> <!-- Severity --> Modified: trunk/mantisbt/core/category_api.php =================================================================== --- trunk/mantisbt/core/category_api.php 2008-02-01 18:48:41 UTC (rev 4941) +++ trunk/mantisbt/core/category_api.php 2008-02-01 18:48:53 UTC (rev 4942) @@ -149,7 +149,7 @@ # -------------------- # Remove a category from the project - function category_remove( $p_category_id, $p_new_category_id = 1 ) { + function category_remove( $p_category_id, $p_new_category_id = 0 ) { $t_category_row = category_get_row( $p_category_id ); $c_category_id = db_prepare_int( $p_category_id ); @@ -188,7 +188,7 @@ # -------------------- # Remove all categories associated with a project - function category_remove_all( $p_project_id, $p_new_category_id = 1 ) { + function category_remove_all( $p_project_id, $p_new_category_id = 0 ) { $c_project_id = db_prepare_int( $p_project_id ); $c_new_category_id = db_prepare_int( $p_new_category_id ); @@ -233,7 +233,7 @@ # -------------------- # Return the definition row for the category - function category_get_row ( $p_category_id ) { + function category_get_row( $p_category_id ) { global $g_category_cache; if ( isset( $g_category_cache[$p_category_id] ) ) { return $g_category_cache[$p_category_id]; @@ -305,12 +305,16 @@ # Helpers function category_full_name( $p_category_id, $p_show_project=true ) { - $t_row = category_get_row( $p_category_id ); - $t_project_id = $t_row['project_id']; + if ( 0 == $p_category_id ) { # No Category + return lang_get( 'no_category' ); + } else { + $t_row = category_get_row( $p_category_id ); + $t_project_id = $t_row['project_id']; - if ( $p_show_project && ALL_PROJECTS != $t_project_id ) { - return '[' . project_get_name( $t_project_id ) . '] ' . $t_row['name']; + if ( $p_show_project && ALL_PROJECTS != $t_project_id ) { + return '[' . project_get_name( $t_project_id ) . '] ' . $t_row['name']; + } + + return $t_row['name']; } - - return $t_row['name']; } Modified: trunk/mantisbt/core/my_view_inc.php =================================================================== --- trunk/mantisbt/core/my_view_inc.php 2008-02-01 18:48:41 UTC (rev 4941) +++ trunk/mantisbt/core/my_view_inc.php 2008-02-01 18:48:53 UTC (rev 4942) @@ -277,13 +277,11 @@ <br /> <?php # type project name if viewing 'all projects' or bug is in subproject - if ( $v_category_id != 0 ) { - if ( ON == config_get( 'show_bug_project_links' ) && - helper_get_current_project() != $v_project_id ) { - echo string_display( category_full_name( $v_category_id ) ); - } else { - echo string_display( category_full_name( $v_category_id, false ) ); - } + if ( ON == config_get( 'show_bug_project_links' ) && + helper_get_current_project() != $v_project_id ) { + echo string_display( category_full_name( $v_category_id ) ); + } else { + echo string_display( category_full_name( $v_category_id, false ) ); } if ( $v_last_updated > strtotime( '-'.$t_filter['highlight_changed'].' hours' ) ) { Modified: trunk/mantisbt/lang/strings_english.txt =================================================================== --- trunk/mantisbt/lang/strings_english.txt 2008-02-01 18:48:41 UTC (rev 4941) +++ trunk/mantisbt/lang/strings_english.txt 2008-02-01 18:48:53 UTC (rev 4942) @@ -99,6 +99,7 @@ $s_empty_password_button = 'Use Empty Password'; $s_reauthenticate_title = 'Authenticate'; $s_reauthenticate_message = 'You are visting a secure page, and your secure session has expired. Please authenticate yourself to continue.'; +$s_no_category = 'No Category'; $s_duplicate_of = "duplicate of"; $s_has_duplicate = "has duplicate"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |