View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012907 | mantisbt | filters | public | 2011-04-04 10:10 | 2011-04-05 09:20 |
| Reporter | dominik | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | new | Resolution | open | ||
| Product Version | 1.2.4 | ||||
| Summary | 0012907: Filter is not passed on when switching projects | ||||
| Description | Attached is a small patch which a) fixes a bug that prevented the current filter from being passed on when switching project and b) introduced new config switch $g_pass_on_filter_for_all_pages (boolean) which allows to define if filter settings are passed on when switching projects Would be nice to see that patch implemented. Patch is against master-1.2.x. | ||||
| Tags | patch | ||||
| Attached Files | filter.patch (3,557 bytes)
From 4c14e78fc3baf22f5b1993ccdc3005caf8e872be Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Mon, 4 Apr 2011 15:18:21 +0200
Subject: [PATCH 001/002] Fixed bug which prevented passing on current filter settings when switching projects
---
set_project.php | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/set_project.php b/set_project.php
index e45dc2e..38e2f17 100644
--- a/set_project.php
+++ b/set_project.php
@@ -26,6 +26,8 @@
require_once( 'core.php' );
require_once( 'current_user_api.php' );
+
+ $t_old_project = helper_get_current_project();
$f_project_id = gpc_get_string( 'project_id' );
$f_make_default = gpc_get_bool ( 'make_default' );
@@ -71,7 +73,7 @@
# if view_all_bug_page, pass on filter
if ( strcasecmp( 'view_all_bug_page.php', $t_referrer_page ) == 0 ) {
- $t_source_filter_id = filter_db_get_project_current( $f_project_id );
+ $t_source_filter_id = filter_db_get_project_current( $t_old_project );
$t_redirect_url = 'view_all_set.php?type=4';
if ( $t_source_filter_id !== null ) {
--
1.7.3.1.msysgit.0
From 89e45393952e54a86305fa5a5cadf17d049adad9 Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Mon, 4 Apr 2011 15:50:00 +0200
Subject: [PATCH 002/002] Added config switch $g_pass_on_filter_for_all_pages (boolean) which allows to define if filter settings are passed on when switching projects
OFF = pass filter settings on only for view_all_bug_page.php (default)
ON = pass filter settings on for all pages
---
config_defaults_inc.php | 7 +++++++
config_inc.php | 7 +++++++
set_project.php | 2 +-
3 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 085ce87..1b3cf3a 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -2895,6 +2895,13 @@
* @global string $g_create_short_url
*/
$g_create_short_url = 'http://tinyurl.com/create.php?url=%s';
+
+ /**
+ * This switch enables/disables passing on current filter when switching between projects
+ * Default is OFF (filter is passed on only for view_all_bug_page.php), ON = filter is passed on for all pages
+ * @global string $g_pass_on_filter_for_all_pages
+ */
+ $g_pass_on_filter_for_all_pages = OFF;
/*************************************
* MantisBT Database Table Variables *
diff --git a/config_inc.php b/config_inc.php
index f583161..b4cb2d2 100644
--- a/config_inc.php
+++ b/config_inc.php
@@ -256,6 +256,13 @@
* @global int $g_bug_readonly_status_threshold
*/
$g_bug_readonly_status_threshold = CLOSED;
+
+ /**
+ * This switch enables/disables passing on current filter when switching between projects
+ * Default is OFF (filter is passed on only for view_all_bug_page.php), ON = filter is passed on for all pages
+ * @global string $g_pass_on_filter_for_all_pages
+ */
+ $g_pass_on_filter_for_all_pages = ON;
/*
* Environment specific settings
diff --git a/set_project.php b/set_project.php
index 38e2f17..df8839b 100644
--- a/set_project.php
+++ b/set_project.php
@@ -72,7 +72,7 @@
$t_param = $t_matches[3];
# if view_all_bug_page, pass on filter
- if ( strcasecmp( 'view_all_bug_page.php', $t_referrer_page ) == 0 ) {
+ if ( strcasecmp( 'view_all_bug_page.php', $t_referrer_page ) == 0 || config_get( 'pass_on_filter_for_all_pages' ) ) {
$t_source_filter_id = filter_db_get_project_current( $t_old_project );
$t_redirect_url = 'view_all_set.php?type=4';
--
1.7.3.1.msysgit.0 filter_without_private_config.patch (2,925 bytes)
From 4c14e78fc3baf22f5b1993ccdc3005caf8e872be Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Mon, 4 Apr 2011 15:18:21 +0200
Subject: [PATCH 001/002] Fixed bug which prevented passing on current filter settings when switching projects
---
set_project.php | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/set_project.php b/set_project.php
index e45dc2e..38e2f17 100644
--- a/set_project.php
+++ b/set_project.php
@@ -26,6 +26,8 @@
require_once( 'core.php' );
require_once( 'current_user_api.php' );
+
+ $t_old_project = helper_get_current_project();
$f_project_id = gpc_get_string( 'project_id' );
$f_make_default = gpc_get_bool ( 'make_default' );
@@ -71,7 +73,7 @@
# if view_all_bug_page, pass on filter
if ( strcasecmp( 'view_all_bug_page.php', $t_referrer_page ) == 0 ) {
- $t_source_filter_id = filter_db_get_project_current( $f_project_id );
+ $t_source_filter_id = filter_db_get_project_current( $t_old_project );
$t_redirect_url = 'view_all_set.php?type=4';
if ( $t_source_filter_id !== null ) {
--
1.7.3.1.msysgit.0
From 89e45393952e54a86305fa5a5cadf17d049adad9 Mon Sep 17 00:00:00 2001
From: Dominik Blunk <dominik@blunk.ch>
Date: Mon, 4 Apr 2011 15:50:00 +0200
Subject: [PATCH 002/002] Added config switch $g_pass_on_filter_for_all_pages (boolean) which allows to define if filter settings are passed on when switching projects
OFF = pass filter settings on only for view_all_bug_page.php (default)
ON = pass filter settings on for all pages
---
config_defaults_inc.php | 7 +++++++
set_project.php | 2 +-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 085ce87..1b3cf3a 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -2895,6 +2895,13 @@
* @global string $g_create_short_url
*/
$g_create_short_url = 'http://tinyurl.com/create.php?url=%s';
+
+ /**
+ * This switch enables/disables passing on current filter when switching between projects
+ * Default is OFF (filter is passed on only for view_all_bug_page.php), ON = filter is passed on for all pages
+ * @global string $g_pass_on_filter_for_all_pages
+ */
+ $g_pass_on_filter_for_all_pages = OFF;
/*************************************
* MantisBT Database Table Variables *
diff --git a/set_project.php b/set_project.php
index 38e2f17..df8839b 100644
--- a/set_project.php
+++ b/set_project.php
@@ -72,7 +72,7 @@
$t_param = $t_matches[3];
# if view_all_bug_page, pass on filter
- if ( strcasecmp( 'view_all_bug_page.php', $t_referrer_page ) == 0 ) {
+ if ( strcasecmp( 'view_all_bug_page.php', $t_referrer_page ) == 0 || config_get( 'pass_on_filter_for_all_pages' ) ) {
$t_source_filter_id = filter_db_get_project_current( $t_old_project );
$t_redirect_url = 'view_all_set.php?type=4';
--
1.7.3.1.msysgit.0 | ||||