View Issue Details

IDProjectCategoryView StatusLast Update
0006849mantisbtadministrationpublic2007-08-05 02:32
Reporterjiangxin Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Summary0006849: Full colour support for manage_config_*_page.php
Description

In manageconfig*_page.php, some configurable fields have a background colour indicator feature, but some fields not.

This patch add colour indicator for "Who can alter this value", "Who can change..." fields.

TagsNo tags attached.

Activities

2006-03-15 10:54

 

color_indicator_for_acl.patch (8,048 bytes)   
diff --exclude=CVS -u -r mantis-sf-mirror/manage_config_email_page.php mantis/manage_config_email_page.php
--- mantis-sf-mirror/manage_config_email_page.php	2006-03-15 16:44:39.281250000 +0800
+++ mantis/manage_config_email_page.php	2006-03-15 16:41:43.453125000 +0800
@@ -214,7 +214,11 @@
 	}
 	$t_notify_flags = array_merge_recursive2( $t_notify_flags, config_get( 'notify_flags' ) );
 
-	$t_can_change_flags = $t_access >= config_get_access( 'notify_flags' );
+	$t_access_file    = ADMINISTRATOR;
+	$t_access_global  = config_get_access( 'notify_flags', null, ALL_PROJECTS );
+	$t_access_project = config_get_access( 'notify_flags' );
+
+	$t_can_change_flags = $t_access >= $t_access_project;
 	$t_can_change_defaults = $t_access >= config_get_access( 'default_notify_flags' );
 
 	echo '<br /><br />';
@@ -259,10 +263,18 @@
 		get_section_end_for_email();
 
 		if ( $t_can_change_flags  || $t_can_change_defaults ) {
-			echo '<p>' . lang_get( 'notify_actions_change_access' ) . ':';
+			$t_colour = '';
+			if ( $t_access_global != $t_access_file ) {
+				$t_colour = '  style="background:' . $t_colour_global . '" '; # all projects override
+			}
+			if ( $t_access_project != $t_access_global ) {
+				$t_colour = '  style="background:' . $t_colour_project . '" '; # project overrides
+			}
+
+			echo '<div' . $t_colour . '>' . lang_get( 'notify_actions_change_access' ) . ':';
 			echo '<select name="notify_actions_access">';
-			print_enum_string_option_list( 'access_levels', config_get_access( 'notify_flags' ) );
-			echo '</select> </p>';
+			print_enum_string_option_list( 'access_levels', $t_access_project );
+			echo '</select> </div><br />';
 
 			echo "<input type=\"submit\" class=\"button\" value=\"" . lang_get( 'change_configuration' ) . "\" />\n";
 
diff --exclude=CVS -u -r mantis-sf-mirror/manage_config_work_threshold_page.php mantis/manage_config_work_threshold_page.php
--- mantis-sf-mirror/manage_config_work_threshold_page.php	2006-03-15 16:44:39.312500000 +0800
+++ mantis/manage_config_work_threshold_page.php	2006-03-15 16:41:43.484375000 +0800
@@ -53,6 +53,7 @@
 	    global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global;
 
         $t_file = config_get_global( $p_threshold );
+        $t_access_file = ADMINISTRATOR;
         if ( ! is_array( $t_file ) ) {
             $t_file_exp = array();
 		    foreach( $t_access_levels as $t_access_level => $t_label ) {
@@ -65,6 +66,7 @@
 		}
         
         $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS );
+        $t_access_global = config_get_access( $p_threshold, null, ALL_PROJECTS );
         if ( ! is_array( $t_global ) ) {
             $t_global_exp = array();
 		    foreach( $t_access_levels as $t_access_level => $t_label ) {
@@ -77,6 +79,7 @@
 		}
         
         $t_project = config_get( $p_threshold );
+        $t_access_project = config_get_access( $p_threshold );
         if ( ! is_array( $t_project ) ) {
             $t_project_exp = array();
 		    foreach( $t_access_levels as $t_access_level => $t_label ) {
@@ -124,12 +127,22 @@
             }
 			echo '<td class="center"' . $t_colour . '>' . $t_value . '</td>';
 		}
+		$t_colour = '';
+		if ( $t_access_global != $t_access_file ) {
+			$t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override
+			if ( ALL_PROJECTS == $t_project_id ) 
+				set_overrides( $p_threshold );
+		}
+		if ( $t_access_project != $t_access_global ) {
+			$t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides
+			set_overrides( $p_threshold );
+		} 
 		if ( $t_can_change ) {
-			echo '<td> <select name="access_' . $p_threshold . '">';
+			echo '<td'. $t_colour . '> <select name="access_' . $p_threshold . '">';
 			print_enum_string_option_list( 'access_levels', config_get_access( $p_threshold ) );
 			echo '</select> </td>';
 		} else {
-			echo '<td>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . '&nbsp;</td>';
+			echo '<td' . $t_colour .'>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . '&nbsp;</td>';
 		}
 
 		echo '</tr>' . "\n";
@@ -141,8 +154,11 @@
         $t_file = config_get_global( $p_threshold );
         $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS );
         $t_project = config_get( $p_threshold );
+        $t_access_file = ADMINISTRATOR;
+        $t_access_global = config_get_access( $p_threshold, null, ALL_PROJECTS );
+        $t_access_project = config_get_access( $p_threshold );
         
-		$t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user )
+		$t_can_change = access_has_project_level( $t_access_project, $t_project_id, $t_user )
 		          && ( ( ALL_PROJECTS == $t_project_id ) || ! $p_all_projects_only );
 
         $t_colour = '';
@@ -173,12 +189,23 @@
         }
 		echo '<td' . $t_colour . '>' . $t_value . '</td><td class="left" colspan="' . ( count( $t_access_levels ) - 1 ). '"></td>';
 
+		$t_colour = '';
+		if ( $t_access_global != $t_access_file ) {
+			$t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override
+			if ( ALL_PROJECTS == $t_project_id ) 
+				set_overrides( $p_threshold );
+		}
+		if ( $t_access_project != $t_access_global ) {
+			$t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides
+			set_overrides( $p_threshold );
+		} 
+
 		if ( $t_can_change ) {
-			echo '<td><select name="access_' . $p_threshold . '">';
-			print_enum_string_option_list( 'access_levels', config_get_access( $p_threshold ) );
+			echo '<td' . $t_colour . '><select name="access_' . $p_threshold . '">';
+			print_enum_string_option_list( 'access_levels', $t_access_project );
 			echo '</select> </td>';
 		} else {
-			echo '<td>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . '&nbsp;</td>';
+			echo '<td' . $t_colour . '>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), $t_access_project ) . '&nbsp;</td>';
 		}
 
 		echo '</tr>' . "\n";
@@ -190,6 +217,9 @@
         $t_file = config_get_global( $p_threshold );
         $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS );
         $t_project = config_get( $p_threshold );
+        $t_access_file = ADMINISTRATOR;
+        $t_access_global = config_get_access( $p_threshold, null, ALL_PROJECTS );
+        $t_access_project = config_get_access( $p_threshold );
         
 		$t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user )
 		          && ( ( ALL_PROJECTS == $t_project_id ) || ! $p_all_projects_only );
@@ -219,12 +249,23 @@
 		    echo '<td class="left" colspan="3"' . $t_colour . '>' . $t_value . '</td><td colspan="' . ( count( $t_access_levels ) - 3 ) . '"></td>';
         }
 
+		$t_colour = '';
+		if ( $t_access_global != $t_access_file ) {
+			$t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override
+			if ( ALL_PROJECTS == $t_project_id ) 
+				set_overrides( $p_threshold );
+		}
+		if ( $t_access_project != $t_access_global ) {
+			$t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides
+			set_overrides( $p_threshold );
+		} 
+
 		if ( $t_can_change ) {
-			echo '<td><select name="access_' . $p_threshold . '">';
+			echo '<td'. $t_colour . '><select name="access_' . $p_threshold . '">';
 			print_enum_string_option_list( 'access_levels', config_get_access( $p_threshold ) );
 			echo '</select> </td>';
 		} else {
-			echo '<td>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . '&nbsp;</td>';
+			echo '<td'. $t_colour . '>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . '&nbsp;</td>';
 		}
 
 		echo '</tr>' . "\n";
color_indicator_for_acl.patch (8,048 bytes)   
mkornatzki

mkornatzki

2007-02-12 15:10

reporter   ~0014038

can you please upload the patch again?

Issue History

Date Modified Username Field Change
2006-03-15 10:54 jiangxin New Issue
2006-03-15 10:54 jiangxin File Added: color_indicator_for_acl.patch
2007-02-12 15:10 mkornatzki Note Added: 0014038