Skip to content

Commit

Permalink
Just a quick change to make the behaviour of print_success_and_redire…
Browse files Browse the repository at this point in the history
…ct() cleaner by not overloading it.

M bug_assign.php
M bug_close.php
M bug_delete.php
M bug_monitor.php
M bug_reopen.php
M bug_resolve.php
M bug_update.php
M bugnote_add.php
M bugnote_delete.php
M bugnote_set_view_state.php
M bugnote_update.php
  - update to use print_successful_redirect() or
    print_successful_redirect_to_bug() as appropriate

M core/print_api.php
  (print_success_and_redirect): rename to print_successful_redirect() and
    remove the overloaded functionality of the function
  (print_successful_redirect_to_bug): new function to take on the overloaded
    functionality of the above function by looking up a bug view url and
    calling the function above with that URL


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1970 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Julian Fitzell committed Feb 20, 2003
1 parent 76e2737 commit cc9f048
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 35 deletions.
4 changes: 2 additions & 2 deletions bug_assign.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_assign.php,v 1.32 2003-02-20 02:35:26 vboctor Exp $
# $Id: bug_assign.php,v 1.33 2003-02-20 07:30:03 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -27,5 +27,5 @@

bug_assign( $f_bug_id, auth_get_current_user_id() );

print_success_and_redirect( $f_bug_id );
print_successful_redirect_to_bug( $f_bug_id );
?>
4 changes: 2 additions & 2 deletions bug_close.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_close.php,v 1.35 2003-02-20 02:35:27 vboctor Exp $
# $Id: bug_close.php,v 1.36 2003-02-20 07:30:03 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -28,5 +28,5 @@

bug_close( $f_bug_id, $f_bugnote_text );

print_success_and_redirect( 'view_all_bug_page.php' );
print_successful_redirect( 'view_all_bug_page.php' );
?>
4 changes: 2 additions & 2 deletions bug_delete.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_delete.php,v 1.35 2003-02-20 02:35:27 vboctor Exp $
# $Id: bug_delete.php,v 1.36 2003-02-20 07:30:03 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -28,5 +28,5 @@

bug_delete( $f_bug_id );

print_success_and_redirect( 'view_all_bug_page.php' );
print_successful_redirect( 'view_all_bug_page.php' );
?>
4 changes: 2 additions & 2 deletions bug_monitor.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_monitor.php,v 1.24 2003-02-20 02:35:27 vboctor Exp $
# $Id: bug_monitor.php,v 1.25 2003-02-20 07:30:04 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -31,5 +31,5 @@
bug_monitor( $f_bug_id, auth_get_current_user_id() );
}

print_success_and_redirect( $f_bug_id );
print_successful_redirect_to_bug( $f_bug_id );
?>
4 changes: 2 additions & 2 deletions bug_reopen.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_reopen.php,v 1.31 2003-02-20 02:35:27 vboctor Exp $
# $Id: bug_reopen.php,v 1.32 2003-02-20 07:30:04 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -27,5 +27,5 @@

bug_reopen( $f_bug_id, $f_bugnote_text );

print_success_and_redirect( $f_bug_id );
print_successful_redirect_to_bug( $f_bug_id );
?>
4 changes: 2 additions & 2 deletions bug_resolve.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_resolve.php,v 1.35 2003-02-20 02:35:28 vboctor Exp $
# $Id: bug_resolve.php,v 1.36 2003-02-20 07:30:04 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -41,5 +41,5 @@
bug_set_field( $f_bug_id, 'status', CLOSED );
}

print_success_and_redirect( $f_bug_id );
print_successful_redirect_to_bug( $f_bug_id );
?>
4 changes: 2 additions & 2 deletions bug_update.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_update.php,v 1.54 2003-02-20 02:35:28 vboctor Exp $
# $Id: bug_update.php,v 1.55 2003-02-20 07:30:04 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -80,5 +80,5 @@
bugnote_add( $f_bug_id, $f_bugnote_text, $f_private );
}

print_success_and_redirect( $f_bug_id );
print_successful_redirect_to_bug( $f_bug_id );
?>
4 changes: 2 additions & 2 deletions bugnote_add.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bugnote_add.php,v 1.38 2003-02-20 03:32:25 vboctor Exp $
# $Id: bugnote_add.php,v 1.39 2003-02-20 07:30:04 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -35,5 +35,5 @@
email_bugnote_add( $f_bug_id );
}

print_success_and_redirect( $f_bug_id );
print_successful_redirect_to_bug( $f_bug_id );
?>
4 changes: 2 additions & 2 deletions bugnote_delete.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bugnote_delete.php,v 1.32 2003-02-20 02:49:32 vboctor Exp $
# $Id: bugnote_delete.php,v 1.33 2003-02-20 07:30:04 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -33,5 +33,5 @@

bugnote_delete( $f_bugnote_id );

print_success_and_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
?>
4 changes: 2 additions & 2 deletions bugnote_set_view_state.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bugnote_set_view_state.php,v 1.21 2003-02-20 02:49:32 vboctor Exp $
# $Id: bugnote_set_view_state.php,v 1.22 2003-02-20 07:30:05 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -34,5 +34,5 @@

bugnote_set_view_state( $f_bugnote_id, $f_private );

print_success_and_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
?>
4 changes: 2 additions & 2 deletions bugnote_update.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bugnote_update.php,v 1.34 2003-02-20 02:49:32 vboctor Exp $
# $Id: bugnote_update.php,v 1.35 2003-02-20 07:30:05 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -37,5 +37,5 @@

bugnote_set_text( $f_bugnote_id, $f_bugnote_text );

print_success_and_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' );
?>
30 changes: 17 additions & 13 deletions core/print_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: print_api.php,v 1.46 2003-02-20 02:35:28 vboctor Exp $
# $Id: print_api.php,v 1.47 2003-02-20 07:30:05 jfitzell Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -57,31 +57,35 @@ function print_header_redirect( $p_url, $p_die=true ) {
function print_header_redirect_view( $p_bug_id ) {
print_header_redirect( string_get_bug_view_url( $p_bug_id ) );
}

# --------------------
# If the show query count is ON, prints success and redirects in one second.
# If the show query count is OFF, redirects right away.
# $p_redirect_to can be a string, which means the url to redirect to
# $p_redirect_to can be a number, which means the bug id to redirect to.
function print_success_and_redirect( $p_redirect_to ) {
if ( is_integer( $p_redirect_to ) ) {
$t_url = string_get_bug_view_url( $p_redirect_to, auth_get_current_user_id() );
} else {
$t_url = $p_redirect_to;
}
# Get a view URL for the bug id based on the user's preference and
# call print_successful_redirect() with that URL
function print_successful_redirect_to_bug( $p_bug_id ) {
$t_url = string_get_bug_view_url( $p_bug_id, auth_get_current_user_id() );

print_successful_redirect( $t_url );
}

# --------------------
# If the show query count is ON, print success and redirect after the
# configured system wait time.
# If the show query count is OFF, redirect right away.
function print_successful_redirect( $p_redirect_to ) {
if ( ON == config_get( 'show_queries_count' ) ) {
html_meta_redirect( $t_url );
html_meta_redirect( $p_redirect_to );
html_page_top1();
html_page_top2();
echo '<br /><div class="center">';
echo lang_get( 'operation_successful' ) . '<br />';
print_bracket_link( $t_url, lang_get( 'proceed' ) );
print_bracket_link( $p_redirect_to, lang_get( 'proceed' ) );
echo '</div>';
html_page_bottom1();
} else {
print_header_redirect( $t_url );
}
}

# --------------------
# Print a redirect header to update a bug
function print_header_redirect_update( $p_bug_id ) {
Expand Down

0 comments on commit cc9f048

Please sign in to comment.