View Issue Details

IDProjectCategoryView StatusLast Update
0006479mantisbtfeaturepublic2014-09-23 18:05
Reporterelmuerte Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.0.0rc3 
Target Version1.2.12Fixed in Version1.2.12 
Summary0006479: Direct project link
Description

We have a couple of projects in our BT. It would be great if it was possible to create a link that preselects a project for certain pages.

For example, the followig link would directly show all issues for project 1, even though the user previously switched to an other project
http://my.site/mantis/view_all_bug_page.php?projectid=1

And for example this link would directly show the "report issue" page for project 2
http://my.site/mantis/bug_report_page.php?projectid=2

TagsNo tags attached.
Attached Files
mantisBT#6479-direct-access-to-project-for-report-and-view-bug-list.diff (2,203 bytes)   
### Eclipse Workspace Patch 1.0
#P Mantis - M4D
Index: view_all_bug_page.php
===================================================================
--- view_all_bug_page.php	(revision 294)
+++ view_all_bug_page.php	(working copy)
@@ -32,6 +32,11 @@
 	auth_ensure_user_authenticated();
 
 	$f_page_number		= gpc_get_int( 'page_number', 1 );
+	$t_project_id = gpc_get_int('project_id',helper_get_current_project());
+	if(project_exists($t_project_id)){
+		helper_set_current_project($t_project_id);
+	}
+	
 
 	$t_per_page = null;
 	$t_bug_count = null;
Index: view_all_inc.php
===================================================================
--- view_all_inc.php	(revision 294)
+++ view_all_inc.php	(working copy)
@@ -52,9 +52,11 @@
 		$t_filter = filter_get_default();
 	}
 
+	$t_project_id = gpc_get_int('project_id',helper_get_current_project());
+	if(project_exists($t_project_id)){
+		helper_set_current_project($t_project_id);
+	}
 	
-	
-	
 	list( $t_sort, ) = explode( ',', $t_filter['sort'] );
 	list( $t_dir, ) = explode( ',', $t_filter['dir'] );
 
Index: bug_report_page.php
===================================================================
--- bug_report_page.php	(revision 311)
+++ bug_report_page.php	(working copy)
@@ -37,6 +37,12 @@
 	require_once( 'collapse_api.php' );
 
 	$f_master_bug_id = gpc_get_int( 'm_id', 0 );
+	
+	$t_project_id = gpc_get_int('project_id',helper_get_current_project());
+	if(project_exists($t_project_id)){
+		helper_set_current_project($t_project_id);
+	}
+	
 
 	# 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 ) ) {
Index: core/helper_api.php
===================================================================
--- core/helper_api.php	(revision 294)
+++ core/helper_api.php	(working copy)
@@ -282,8 +282,9 @@
  * @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;

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 

Activities

ape

ape

2006-12-11 13:06

reporter   ~0013802

If I understand your request correctly, you can achieve this using a URL like this:

http://your.site/mantis/set_project.php?project_id=2&make_default=no&ref=bug_report_page.php

I use this to create handy 'report a bug' links in some of my software. You can change the 'ref' parameter to any Mantis page you like.

vboctor

vboctor

2006-12-12 02:30

manager   ~0013806

You can also use the following link to go to a specific project page. At the moment this pre-selects the project and redirects to View Issues page. In future version, the project page may display some information about the project and provide some links / buttons for possible actions.

http://www.example.com/mantis/project_page.php?project_id=1

To go to the report page, you will have to use the link suggested by ape.

vboctor

vboctor

2007-04-16 02:26

manager   ~0014351

We should allow passing the project_id GET parameter to the bug_report_page.php and bug_report_advanced_page.php to simplify the construction of links that report bugs for specific projects.

ape

ape

2007-05-02 13:50

reporter   ~0014419

bug_report_page.php and bug_report_advanced_page.php supporting the project_id GET parameter would definitely make life simpler.

This bug could then be resolved with a similar fix to bug 0007667 (although for me the TinyURL feature is unnecessary--maybe it could be optional for those that don't like to see long complex links?)

Lapinkiller

Lapinkiller

2012-08-08 10:46

reporter   ~0032509

patch based on 1.28, using "project_id" GET parameter

dregad

dregad

2012-08-08 11:29

developer   ~0032511

Thanks for your contribution LapinKiller - I'll have a look at this later this week if I can.

If you can, please consider submitting your contributions as git patches, or even better github pull requests, to make our lives easier.

Lapinkiller

Lapinkiller

2012-08-08 13:09

reporter   ~0032514

sorry but git & and github are blocked at office i can't use git or github,
else, do you know how to do git patch without git ? ^^

dregad

dregad

2012-08-09 03:08

developer   ~0032521

They don't even let you install a local git client ? damn.
The network nazis here also blocked github a few weeks ago, but I managed to get an exception to bypass the policy as it was a business requirement for support of our internal Mantis ;-)

Don't worry I can live with unified diff - it's just a bit extra work.

Lapinkiller

Lapinkiller

2012-08-09 05:46

reporter   ~0032525

Last edited: 2012-08-10 03:38

i'm trying to get an exception too, but i'm in a very big company (more than 200 000 employees), so it's not easy to get this exception :(

for the client install i have a VM with admin rights (on my computer i can't do nothing...)

Lapinkiller

Lapinkiller

2012-08-13 02:54

reporter   ~0032546

github is now working at office :D

i have made a pull request (my first one), i hope it's ok.

dregad

dregad

2012-08-13 04:27

developer   ~0032548

github is now working at office :D

good to hear :)

i have made a pull request (my first one), i hope it's ok.

I'll review it and let you know.
Thanks for your contribution !

dregad

dregad

2012-08-13 09:17

developer   ~0032550

Salut Lapin

See my comments on your pull request
https://github.com/mantisbt/mantisbt/pull/57#issuecomment-7691307

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036186

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x edfbecf2

2012-08-12 19:50

Lapinkiller

Committer: Damien Regad


Details Diff
Fix 0006479: 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>
Affected Issues
0006479
mod - bug_report_page.php Diff File
mod - core/helper_api.php Diff File
mod - view_all_bug_page.php Diff File
mod - view_all_inc.php Diff File

MantisBT: master 0fdebfb5

2012-08-12 19:50

Lapinkiller

Committer: Damien Regad


Details Diff
Fix 0006479: 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>
Affected Issues
0006479
mod - bug_report_page.php Diff File
mod - core/helper_api.php Diff File
mod - view_all_bug_page.php Diff File
mod - view_all_inc.php Diff File

MantisBT: master-1.2.x 00dbc614

2012-08-13 01:51

dregad


Details Diff
Fix 0006479: Force page reload to refresh Project Selector Affected Issues
0006479
mod - bug_report_page.php Diff File
mod - view_all_bug_page.php Diff File
mod - view_all_inc.php Diff File

MantisBT: master efa18ce9

2012-08-13 01:51

dregad


Details Diff
Fix 0006479: Force page reload to refresh Project Selector Affected Issues
0006479
mod - bug_report_page.php Diff File
mod - view_all_bug_page.php Diff File
mod - view_all_inc.php Diff File