Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dfe913735106
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 00dbc6140581
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Aug 13, 2012

  1. Fix #6479: Direct project links

    Adding possibility to change the current project id via GET/POST
    parameters. Enables direct project selection for the following pages:
     * bug_report_page.php
     * view_all_bug_page.php
    
    Lapinkiller's original patch was modified to align with MantisBT coding
    guidelines, and reword the commit message.
    
    Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
    Lapinkiller authored and dregad committed Aug 13, 2012

    Verified

    This commit was signed with the committer’s verified signature.
    anthonyfok Anthony Fok
    Copy the full SHA
    edfbecf View commit details
  2. Copy the full SHA
    00dbc61 View commit details
Showing with 33 additions and 10 deletions.
  1. +19 −10 bug_report_page.php
  2. +3 −0 core/helper_api.php
  3. +11 −0 view_all_bug_page.php
29 changes: 19 additions & 10 deletions bug_report_page.php
Original file line number Diff line number Diff line change
@@ -38,11 +38,6 @@

$f_master_bug_id = gpc_get_int( 'm_id', 0 );

# this page is invalid for the 'All Project' selection except if this is a clone
if ( ( ALL_PROJECTS == helper_get_current_project() ) && ( 0 == $f_master_bug_id ) ) {
print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' );
}

if ( $f_master_bug_id > 0 ) {
# master bug exists...
bug_ensure_exists( $f_master_bug_id );
@@ -94,7 +89,23 @@

$t_project_id = $t_bug->project_id;
} else {
access_ensure_project_level( config_get( 'report_bug_threshold' ) );
# Get Project Id and set it as current
$t_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
if( ( ALL_PROJECTS == $t_project_id || project_exists( $t_project_id ) )
&& $t_project_id != helper_get_current_project()
) {
helper_set_current_project( $t_project_id );
# Reloading the page is required so that the project browser
# reflects the new current project
print_header_redirect( $_SERVER['REQUEST_URI'], true, false, true );
}

# New issues cannot be reported for the 'All Project' selection
if ( ( ALL_PROJECTS == helper_get_current_project() ) ) {
print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' );
}

access_ensure_project_level( config_get( 'report_bug_threshold' ) );

$f_build = gpc_get_string( 'build', '' );
$f_platform = gpc_get_string( 'platform', '' );
@@ -121,8 +132,6 @@
$f_due_date = date_get_null();
}

$t_project_id = helper_get_current_project();

$t_changed_project = false;
}

@@ -210,7 +219,7 @@
</tr>
<?php
}

if ( $tpl_show_eta ) {
?>

@@ -226,7 +235,7 @@
</tr>
<?php
}

if ( $tpl_show_severity ) {
?>
<tr <?php echo helper_alternate_class() ?>>
3 changes: 3 additions & 0 deletions core/helper_api.php
Original file line number Diff line number Diff line change
@@ -265,8 +265,11 @@ function helper_get_current_project_trace() {
* @return bool always true
*/
function helper_set_current_project( $p_project_id ) {
global $g_cache_current_project;

$t_project_cookie_name = config_get( 'project_cookie' );

$g_cache_current_project = $p_project_id;
gpc_set_cookie( $t_project_cookie_name, $p_project_id, true );

return true;
11 changes: 11 additions & 0 deletions view_all_bug_page.php
Original file line number Diff line number Diff line change
@@ -33,6 +33,17 @@

$f_page_number = gpc_get_int( 'page_number', 1 );

# Get Project Id and set it as current
$t_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
if( ( ALL_PROJECTS == $t_project_id || project_exists( $t_project_id ) )
&& $t_project_id != helper_get_current_project()
) {
helper_set_current_project( $t_project_id );
# Reloading the page is required so that the project browser
# reflects the new current project
print_header_redirect( $_SERVER['REQUEST_URI'], true, false, true );
}

$t_per_page = null;
$t_bug_count = null;
$t_page_count = null;