From: <vb...@us...> - 2003-02-13 14:04:14
|
Update of /cvsroot/mantisbt/mantisbt/core In directory sc8-pr-cvs1:/tmp/cvs-serv32345/core Modified Files: access_api.php html_api.php Log Message: M core/access_api.php (access_can_close): Reversed the login to make it less confusing. M core/html_api.php - Moved the td's inside the html APIs so that they are only printed if the button is printed. This removes spaces between buttons that were dependent on the number of hidden buttons (which doesn't make sense). I didn't want to put the td's in the html_button since it is a generic method. M bug_view_advanced_page.php M bug_view_page.php - Simplified the code. - Now the buttons always appear centered independent of the hidden buttons. - More checks can still move to the APIs (can be done later). Index: access_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/access_api.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- access_api.php 13 Feb 2003 13:24:19 -0000 1.14 +++ access_api.php 13 Feb 2003 14:04:10 -0000 1.15 @@ -308,18 +308,18 @@ # it assumes that the user has access to the project function access_can_close_bug ( $p_bug_id ) { // Allow closing defects if reporter of the bug and reporter can close or if above threshold - if ( OFF == config_get( 'allow_reporter_close' ) || - !bug_is_user_reporter( $p_bug_id, auth_get_current_user_id() ) ) { - return access_level_check_greater_or_equal( config_get( 'close_bug_threshold' ) ); + if ( ON == config_get( 'allow_reporter_close' ) && + bug_is_user_reporter( $p_bug_id, auth_get_current_user_id() ) ) { + return true; } - return true; + return access_level_check_greater_or_equal( config_get( 'close_bug_threshold' ) ); } # -------------------- # Make sure that the current user can close the specified bug # See access_can_close_bug() for details. function access_ensure_can_close_bug( $p_bug_id ) { - if (!access_can_close_bug( $p_bug_id ) ) { + if ( !access_can_close_bug( $p_bug_id ) ) { access_denied(); } } Index: html_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- html_api.php 11 Feb 2003 08:59:33 -0000 1.43 +++ html_api.php 13 Feb 2003 14:04:11 -0000 1.44 @@ -637,9 +637,11 @@ # Print a button to update the given bug function html_button_bug_update( $p_bug_id ) { if ( access_level_check_greater_or_equal( config_get( 'update_bug_threshold' ) ) ) { + echo '<td class="center">'; html_button( string_get_bug_update_page(), lang_get( 'update_bug_button' ), array( 'bug_id' => $p_bug_id ) ); + echo '</td>'; } } # -------------------- @@ -649,9 +651,11 @@ $t_handler_id = bug_get_field( $p_bug_id, 'handler_id' ); if ( $t_handler_id != auth_get_current_user_id() ) { + echo '<td class="center">'; html_button( 'bug_assign.php', lang_get( 'bug_assign_button' ), array( 'bug_id' => $p_bug_id ) ); + echo '</td>'; } } } @@ -659,9 +663,11 @@ # Print a button to resolve the given bug function html_button_bug_resolve( $p_bug_id ) { if ( access_level_check_greater_or_equal( config_get( 'handle_bug_threshold' ) ) ) { + echo '<td class="center">'; html_button( 'bug_resolve_page.php', lang_get( 'resolve_bug_button' ), array( 'bug_id' => $p_bug_id ) ); + echo '</td>'; } } # -------------------- @@ -670,20 +676,22 @@ if ( access_level_check_greater_or_equal( config_get( 'reopen_bug_threshold' ) ) || ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() && ON == config_get( 'allow_reporter_reopen' ) ) ) { + echo '<td class="center">'; html_button( 'bug_reopen_page.php', lang_get( 'reopen_bug_button' ), array( 'bug_id' => $p_bug_id ) ); + echo '</td>'; } } # -------------------- # Print a button to close the given bug function html_button_bug_close( $p_bug_id ) { - if ( access_level_check_greater_or_equal( config_get( 'close_bug_threshold' ) ) - || ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() - && ON == config_get( 'allow_reporter_close' ) ) ) { + if ( access_can_close_bug ( $p_bug_id ) && ( $t_bug->status < CLOSED ) ) { + echo '<td class="center">'; html_button( 'bug_close_page.php', lang_get( 'close_bug_button' ), array( 'bug_id' => $p_bug_id ) ); + echo '</td>'; } } # -------------------- @@ -696,9 +704,11 @@ } if ( access_level_check_greater_or_equal( $t_threshold ) ) { + echo '<td class="center">'; html_button( 'bug_monitor.php', lang_get( 'monitor_bug_button' ), array( 'bug_id' => $p_bug_id, 'action' => 'add' ) ); + echo '</td>'; } } # -------------------- @@ -713,9 +723,11 @@ # Print a button to delete the given bug function html_button_bug_delete( $p_bug_id ) { if ( access_level_check_greater_or_equal( config_get( 'allow_bug_delete_access_level' ) ) ) { + echo '<td class="center">'; html_button( 'bug_delete.php', lang_get( 'delete_bug_button' ), array( 'bug_id' => $p_bug_id ) ); + echo '</td>'; } } ?> |