View Issue Details

IDProjectCategoryView StatusLast Update
0009260mantisbtbugtrackerpublic2014-12-08 00:33
ReportermthibeaultAssigned Tovboctor 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0a1 
Target VersionFixed in Version1.3.0-beta.1 
Summary0009260: Manage Columns doesn't work per project
Description

When trying to get manage columns to work, expected feature are not available.

Additional Information

manage_columns_fix.patch
Fix for the manage columns against Revision 5358

Tagspatch

Activities

2008-06-12 16:32

 

manage_columns_fix.patch (8,271 bytes)
Index: mantisbt/lang/strings_english.txt
===================================================================
--- mantisbt/lang/strings_english.txt	(revision 5358)
+++ mantisbt/lang/strings_english.txt	(working copy)
@@ -1514,8 +1514,10 @@
 $s_excel_columns_title = 'Excel Columns';
 $s_update_columns_as_global_default = 'Update Columns as Global Default for All Projects';
 $s_update_columns_for_current_project = 'Update Columns For Current Project';
-$s_update_columns_as_my_default = 'Update Columns as Default for All Projects';
-$s_reset_columns_configuration = 'Reset Columns Configuration';
+$s_update_columns_as_my_default = 'Update Columns as my Default for All Projects';
+$s_reset_columns_configuration_as_global_default = 'Reset Columns as Global Default for All Projects';
+$s_reset_columns_configuration_for_current_project = 'Reset Columns For Current Project';
+$s_reset_columns_configuration_as_my_default = 'Reset Columns as my Default for All Projects';
 $s_copy_columns_from = 'Copy Columns From';
 $s_copy_columns_to = 'Copy Columns To';
 
Index: mantisbt/manage_columns_inc.php
===================================================================
--- mantisbt/manage_columns_inc.php	(revision 5358)
+++ mantisbt/manage_columns_inc.php	(working copy)
@@ -143,9 +143,21 @@
 		<?php } else { ?>
 		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="update_columns_for_current_project" value="<?php echo lang_get( 'update_columns_for_current_project' ) ?>" />
 		<?php } } ?>
-<?php if ( $t_manage_page && current_user_is_administrator() ) { ?>
+		<?php
+			if ( $t_manage_page ) {
+				if ( $t_project_id == ALL_PROJECTS ) {
+					if ( current_user_is_administrator() ) {
+		?>
 		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="update_columns_as_global_default" value="<?php echo lang_get( 'update_columns_as_global_default' ) ?>" />
-<?php } ?>
+		<?php
+					}
+				} else {
+		?>
+		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="update_columns_for_current_project" value="<?php echo lang_get( 'update_columns_for_current_project' ) ?>" />
+		<?php
+				}
+			}
+		?>
 	</td>
 </tr>
 
@@ -183,16 +195,34 @@
 
 <br />
 
-<?php
-	if ( $t_account_page ) {
-?>
 <!-- RESET CONFIGURATION -->
 <div class="border-center">
 <!-- Reset Button -->
 	<form method="post" action="manage_config_columns_reset.php">
-		<input type="submit" class="button" value="<?php echo lang_get( 'reset_columns_configuration' ) ?>" />
-	</form>
-</div>
+		<input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />
+		<input type="hidden" name="form_page" value="<?php echo $t_account_page ? 'account' : 'manage'; ?>" />
+
+		<?php
+			if ( $t_account_page ) {
+				if ( $t_project_id == ALL_PROJECTS ) { ?>
+		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="reset_columns_configuration_as_my_default" value="<?php echo lang_get( 'reset_columns_configuration_as_my_default' ) ?>" />
+		<?php } else { ?>
+		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="reset_columns_configuration_for_current_project" value="<?php echo lang_get( 'reset_columns_configuration_for_current_project' ) ?>" />
+		<?php } } ?>
+		<?php
+			if ( $t_manage_page ) {
+				if ( $t_project_id == ALL_PROJECTS ) {
+					if ( current_user_is_administrator() ) {
+		?>
+		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="reset_columns_configuration_as_global_default" value="<?php echo lang_get( 'reset_columns_configuration_as_global_default' ) ?>" />
+		<?php
+					}
+				} else {
+		?>
+		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" name="reset_columns_configuration_for_current_project" value="<?php echo lang_get( 'reset_columns_configuration_for_current_project' ) ?>" />
 <?php
 	}
-?>
\ No newline at end of file
+			}
+?>
+	</form>
+</div>
\ No newline at end of file
Index: mantisbt/manage_config_columns_reset.php
===================================================================
--- mantisbt/manage_config_columns_reset.php	(revision 5358)
+++ mantisbt/manage_config_columns_reset.php	(working copy)
@@ -29,21 +29,56 @@
 
 	helper_ensure_post();
 
+	# @@@ access_ensure_project_level( config_get( 'manage_project_threshold' ) );
+	
+	$f_project_id = gpc_get_int( 'project_id' );
+	$f_reset_columns_configuration_for_current_project = gpc_get_bool( 'reset_columns_configuration_for_current_project' );
+	$f_reset_columns_configuration_as_my_default = gpc_get_bool( 'reset_columns_configuration_as_my_default' );
+	$f_reset_columns_configuration_as_global_default = gpc_get_bool( 'reset_columns_configuration_as_global_default' );
+	$f_form_page = gpc_get_string( 'form_page' );
+	
+	# only admins can reset global defaults.for ALL_PROJECT
+	if ( $f_reset_columns_configuration_columns_as_global_default && $f_project_id == ALL_PROJECTS && !current_user_is_administrator() ) {
+		access_denied();
+	}
+	
+	# only MANAGERS can reset global defaults.for a project
+	if ( $f_reset_columns_configuration_as_global_default && $f_project_id != ALL_PROJECTS ) {
+		access_ensure_project_level( MANAGER, $f_project_id );
+	}
+
+	# user should only be able to reset columns for a project that is accessible.
+	if ( $f_reset_columns_configuration_for_current_project && $f_project_id != ALL_PROJECTS ) {
+		access_ensure_project_level( VIEWER, $f_project_id );
+	}
+	
+	if ( $f_reset_columns_configuration_as_my_default ) {
+		$t_project_id = ALL_PROJECTS;
+	} else {
+		$t_project_id = $f_project_id;
+		project_ensure_exists( $t_project_id );
+	}
+	
+	# Calculate the user id to set the configuration for.
+	if ( $f_reset_columns_configuration_as_my_default ) {
+	$t_user_id = auth_get_current_user_id();
+	} else {
+		$t_user_id = NO_USER;
+	}
+	
 	auth_ensure_user_authenticated();
 	auth_reauthenticate();
 
-	$t_user_id = auth_get_current_user_id();
+	config_delete( 'view_issues_page_columns', $t_user_id, $t_project_id );
+	config_delete( 'print_issues_page_columns', $t_user_id, $t_project_id );
+	config_delete( 'csv_columns', $t_user_id, $t_project_id );
+	config_delete( 'excel_columns', $t_user_id, $t_project_id );
 
-	config_delete_for_user( 'view_issues_page_columns', $t_user_id );
-	config_delete_for_user( 'print_issues_page_columns', $t_user_id );
-	config_delete_for_user( 'csv_columns', $t_user_id );
-	config_delete_for_user( 'excel_columns', $t_user_id );
-
 	echo '<br />';
 	echo '<div align="center">';
 
-	$t_redirect_url = 'account_manage_columns_page.php';
-	html_page_top1( lang_get( 'manage_email_config' ) );
+	$t_redirect_url = $f_form_page === 'account' ? 'account_manage_columns_page.php' : 'manage_config_columns_page.php';
+	html_page_top1();
 	html_meta_redirect( $t_redirect_url );
 	html_page_top2();
 	echo '<br />';
Index: mantisbt/manage_config_columns_set.php
===================================================================
--- mantisbt/manage_config_columns_set.php	(revision 5358)
+++ mantisbt/manage_config_columns_set.php	(working copy)
@@ -65,7 +65,7 @@
 	}
 
 	# Calculate the user id to set the configuration for.
-	if ( $f_update_columns_as_my_default || $f_update_columns_for_current_project ) {
+	if ( $f_update_columns_as_my_default ) {
 		$t_user_id = auth_get_current_user_id();
 	} else {
 		$t_user_id = NO_USER;
@@ -89,10 +89,10 @@
 	config_set( 'print_issues_page_columns', $t_print_issues_columns, $t_user_id, $t_project_id );
 	config_set( 'csv_columns', $t_csv_columns, $t_user_id, $t_project_id );
 	config_set( 'excel_columns', $t_excel_columns, $t_user_id, $t_project_id );
-?>
-<br />
-<div align="center">
-<?php
+
+	echo '<br />';
+	echo '<div align="center">';
+
 	$t_redirect_url = $f_form_page === 'account' ? 'account_manage_columns_page.php' : 'manage_config_columns_page.php';
 	html_page_top1();
 	html_meta_redirect( $t_redirect_url );
@@ -100,7 +100,7 @@
 	echo '<br />';
 	echo lang_get( 'operation_successful' ) . '<br />';
 	print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
-?>
-</div>
+	echo '</div>';
 
-<?php html_page_bottom1( __FILE__ ) ?>
\ No newline at end of file
+	html_page_bottom1( __FILE__ )
+?>
\ No newline at end of file
manage_columns_fix.patch (8,271 bytes)
vboctor

vboctor

2014-11-25 11:08

manager   ~0041906

This should already be fixed based on my fixes. I believe in both 1.2.x and master.

Issue History

Date Modified Username Field Change
2008-06-12 16:32 mthibeault New Issue
2008-06-12 16:32 mthibeault File Added: manage_columns_fix.patch
2008-06-21 23:38 vboctor Tag Attached: patch
2008-07-15 16:09 grangeway Status new => assigned
2008-07-15 16:09 grangeway Assigned To => grangeway
2014-11-07 16:23 atrol Assigned To grangeway =>
2014-11-07 16:23 atrol Status assigned => new
2014-11-25 11:08 vboctor Assigned To => vboctor
2014-11-25 11:08 vboctor Status new => resolved
2014-11-25 11:08 vboctor Resolution open => fixed
2014-11-25 11:08 vboctor Fixed in Version => 1.3.0-beta.1
2014-11-25 11:08 vboctor Note Added: 0041906
2014-12-08 00:33 vboctor Status resolved => closed