View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0013682 | mantisbt | customization | public | 2011-12-15 10:15 | 2014-09-23 18:05 |
| Reporter | dregad | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| OS | Windows | OS Version | XP | ||
| Product Version | 1.2.8 | ||||
| Target Version | 1.2.9 | Fixed in Version | 1.2.9 | ||
| Summary | 0013682: Color codes for custom statuses not displayed cross-project | ||||
| Description | Assuming issue "1" in project "A" has a custom status "testing" defined as described under Additional Information below, the custom color is not used in the following situations, and displayed white instead:
| ||||
| Additional Information | Sample definitions for custom status: status_enum_string = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,60:testing,80:resolved,90:closed' status_colors = array ( | ||||
| Tags | No tags attached. | ||||
| Attached Files | 0001-Fix-cross-project-display-of-custom-status-colors.patch (5,741 bytes)
From 7dfab37c3c79328d55aa851190a86414f5664cf0 Mon Sep 17 00:00:00 2001
From: Damien Regad <damien.regad@merckgroup.com>
Date: Thu, 15 Dec 2011 16:43:14 +0100
Subject: [PATCH] Fix cross-project display of custom status colors
When a custom status is defined in a different project, its custom
color was not used (displayed white) in the following cases
- view issue details page, relationship
- View Issues
- My View
- Sponsorship
- Bug group action list
Fixes #13682
---
account_sponsor_page.php | 4 ++--
core/bug_group_action_api.php | 5 ++++-
core/helper_api.php | 10 ++++++----
core/relationship_api.php | 4 +++-
my_view_inc.php | 2 +-
view_all_inc.php | 2 +-
6 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/account_sponsor_page.php b/account_sponsor_page.php
index fd7fa55..b8ba78d 100644
--- a/account_sponsor_page.php
+++ b/account_sponsor_page.php
@@ -136,7 +136,7 @@
$t_released_label = $t_bug->fixed_in_version;
}
- echo '<tr bgcolor="' . get_status_color( $t_bug->status ) . '">';
+ echo '<tr bgcolor="' . get_status_color( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id ) . '">';
echo '<td><a href="' . string_get_bug_view_url( $row['bug'] ) . '">' . bug_format_id( $row['bug'] ) . '</a></td>';
echo '<td>' . project_get_field( $t_bug->project_id, 'name' ) . ' </td>';
echo '<td class="right">' . $t_released_label . ' </td>';
@@ -246,7 +246,7 @@
$t_released_label = $t_bug->fixed_in_version;
}
- echo '<tr bgcolor="' . get_status_color( $t_bug->status ) . '">';
+ echo '<tr bgcolor="' . get_status_color( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id ) . '">';
echo '<td><a href="' . string_get_bug_view_url( $row['bug'] ) . '">' . bug_format_id( $row['bug'] ) . '</a></td>';
echo '<td>' . project_get_field( $t_bug->project_id, 'name' ) . ' </td>';
echo '<td class="right">' . $t_released_label . ' </td>';
diff --git a/core/bug_group_action_api.php b/core/bug_group_action_api.php
index ef57fd4..ac3cb1e 100644
--- a/core/bug_group_action_api.php
+++ b/core/bug_group_action_api.php
@@ -80,7 +80,10 @@ function bug_group_action_print_bug_list( $p_bug_ids_array ) {
foreach( $p_bug_ids_array as $t_bug_id ) {
$t_class = sprintf( "row-%d", ( $t_i++ % 2 ) + 1 );
- echo sprintf( "<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color( bug_get_field( $t_bug_id, 'status' ) ), string_get_bug_view_link( $t_bug_id ), string_attribute( bug_get_field( $t_bug_id, 'summary' ) ) );
+ echo sprintf( "<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n",
+ get_status_color( bug_get_field( $t_bug_id, 'status' ), auth_get_current_user_id(), bug_get_field( $t_bug_id, 'project_id' ) ),
+ string_get_bug_view_link( $t_bug_id ),
+ string_attribute( bug_get_field( $t_bug_id, 'summary' ) ) );
}
echo '</table>';
diff --git a/core/helper_api.php b/core/helper_api.php
index ab0d902..5c80946 100644
--- a/core/helper_api.php
+++ b/core/helper_api.php
@@ -68,13 +68,15 @@ function helper_alternate_class( $p_index = null, $p_odd_class = 'row-1', $p_eve
}
/**
- * get the color string for the given status
+ * get the color string for the given status, user and project
* @param int $p_status
+ * @param int|null $p_user user id, defaults to null (all users)
+ * @param int|null $p_project project id, defaults to null (all projects)
* @return string
*/
-function get_status_color( $p_status ) {
- $t_status_label = MantisEnum::getLabel( config_get( 'status_enum_string' ), $p_status );
- $t_status_colors = config_get( 'status_colors' );
+function get_status_color( $p_status, $p_user = null, $p_project = null ) {
+ $t_status_label = MantisEnum::getLabel( config_get( 'status_enum_string', null, $p_user, $p_project ), $p_status );
+ $t_status_colors = config_get( 'status_colors', null, $p_user, $p_project );
$t_color = '#ffffff';
if ( isset( $t_status_colors[$t_status_label] ) ) {
diff --git a/core/relationship_api.php b/core/relationship_api.php
index a895b23..d5b78eb 100644
--- a/core/relationship_api.php
+++ b/core/relationship_api.php
@@ -677,7 +677,9 @@ function relationship_get_details( $p_bug_id, $p_relationship, $p_html = false,
$t_relationship_info_text .= "\n";
if( $p_html_preview == false ) {
- $t_relationship_info_html = '<tr bgcolor="' . get_status_color( $t_bug->status ) . '">' . $t_relationship_info_html . '</tr>' . "\n";
+ $t_relationship_info_html = '<tr bgcolor="'
+ . get_status_color( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id )
+ . '">' . $t_relationship_info_html . '</tr>' . "\n";
} else {
$t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>';
}
diff --git a/my_view_inc.php b/my_view_inc.php
index 892ce64..cedc67f 100644
--- a/my_view_inc.php
+++ b/my_view_inc.php
@@ -432,7 +432,7 @@ echo "($v_start - $v_end / $t_bug_count)";
$t_last_updated = date( config_get( 'normal_date_format' ), $t_bug->last_updated );
# choose color based on status
- $status_color = get_status_color( $t_bug->status );
+ $status_color = get_status_color( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id );
# Check for attachments
$t_attachment_count = 0;
diff --git a/view_all_inc.php b/view_all_inc.php
index 0972a83..dfd0d09 100644
--- a/view_all_inc.php
+++ b/view_all_inc.php
@@ -202,7 +202,7 @@
}
# choose color based on status
- $status_color = get_status_color( $t_row->status );
+ $status_color = get_status_color( $t_row->status, auth_get_current_user_id(), $t_row->project_id );
echo '<tr bgcolor="', $status_color, '" border="1" valign="top">';
--
1.7.5.4
| ||||
| related to | 0011323 | closed | dregad | Cross project relationships not picking up custom statuses |
| related to | 0015721 | closed | grangeway | Functionality to consider porting to master-2.0.x |
| has duplicate | 0013679 | closed | atrol | Cross project relationships not picking up colors of custom statuses |
| related to | 0013707 | closed | dregad | Custom resolutions not displayed cross-project |
| related to | 0013951 | new | Dynamic CSS for status colors does not allow project-specific colors | |
| child of | 0013728 | closed | dregad | Various display issues of custom enums cross-project |
|
Please test the attached patch to address the color display issue described in 0011323. Note that the changeset 4b7492d4 is also required for this to work in releases < 1.2.8 |
|
|
I applied the patch and it works. Thanks for patching this issue! |
|
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
|
MantisBT: master-1.2.x 4b7492d4 2011-08-29 09:01 Paul Richards Committer: dhx Details Diff |
Project override should only apply if $p_project hasn't been explicity set. For the most part, we use config_get(var) to get information for the current project [or overriden project] If we are explicity passing in a project ID, we should use this ID instead, and not override. Signed-off-by: David Hicks <d@hx.id.au> |
Affected Issues 0011323, 0013682 |
|
| mod - core/config_api.php | Diff File | ||
|
MantisBT: master a5aaf06b 2011-12-15 02:43 Details Diff |
Fix cross-project display of custom status colors When a custom status is defined in a different project, its custom color was not used (displayed white) in the following cases - view issue details page, relationship - View Issues - My View - Sponsorship - Bug group action list This ports 1.2.x commit 7dfab37c3c79328d55aa851190a86414f5664cf0, applying the modifications made in get_status_color() to html_get_status_css_class(). Fixes 0013682 |
Affected Issues 0013682 |
|
| mod - account_sponsor_page.php | Diff File | ||
| mod - core/bug_group_action_api.php | Diff File | ||
| mod - core/helper_api.php | Diff File | ||
| mod - core/html_api.php | Diff File | ||
| mod - core/relationship_api.php | Diff File | ||
| mod - my_view_inc.php | Diff File | ||
| mod - view_all_inc.php | Diff File | ||
|
MantisBT: master-1.2.x 7dfab37c 2011-12-15 02:43 Details Diff |
Fix cross-project display of custom status colors When a custom status is defined in a different project, its custom color was not used (displayed white) in the following cases - view issue details page, relationship - View Issues - My View - Sponsorship - Bug group action list Fixes 0013682 |
Affected Issues 0013682 |
|
| mod - account_sponsor_page.php | Diff File | ||
| mod - core/bug_group_action_api.php | Diff File | ||
| mod - core/helper_api.php | Diff File | ||
| mod - core/relationship_api.php | Diff File | ||
| mod - my_view_inc.php | Diff File | ||
| mod - view_all_inc.php | Diff File | ||