View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004768 | mantisbt | feature | public | 2004-10-25 02:04 | 2014-11-20 16:54 |
| Reporter | masc | Assigned To | atrol | ||
| Priority | low | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Platform | X86 | OS | Windows | OS Version | Win2K |
| Summary | 0004768: States transitions diagram | ||||
| Description | I designed a script to graph the whole transitions automa based on the same graphviz_api we use to graph the relationships. It's just a draft and I would like to have some feedback from you in order to improve it. Just copy the files and call the adm_status_automa.php | ||||
| Tags | No tags attached. | ||||
| Attached Files | adm_status_automa.php_ (2,055 bytes)
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: $
# --------------------------------------------------------
# ======================================================================
# Author: Marcello Scata' <marcelloscata at users.sourceforge.net> ITALY
# ======================================================================
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
auth_ensure_user_authenticated();
compress_enable();
html_page_top1();
html_page_top2();
$t_access_levels = explode_enum_string( config_get( 'access_levels_enum_string' ) );
echo '<br><br><div align="center">' . "\n";
echo '<table class="hide" border="0" cellspacing="3" cellpadding="0">' . "\n";
$t_flag = false;
foreach( $t_access_levels as $t_access_level ) {
list( $t_access_level_id, $t_access_level_label ) = explode_enum_arr( $t_access_level );
if( $t_access_level_id >= ADMINISTRATOR )
continue;
$t_access_level_label = get_enum_element( 'access_levels', $t_access_level_id );
if( !$t_flag) echo '<tr>';
echo '<td valign="top" width="50%">' . "\n";
echo '<table class="width100" cellspacing="1"><tr><td class="form-title" style="text-align:center">' . strtoupper( $t_access_level_label );
if( $t_access_level_id == current_user_get_access_level() ) echo ' (' . lang_get( 'myself' ) . ')';
echo '</td></tr>';
echo '<td style="text-align:center"><img src="adm_status_automa_img.php?access=' . $t_access_level_id . '" vspace=20></td></tr>';
echo '</table>' . "\n";
echo '</td>' . "\n";
if( $t_flag) echo '</tr>' . "\n";
$t_flag = !$t_flag;
}
echo '</table></div>' . "\n";
html_page_bottom1( __FILE__ );
?> adm_status_automa_img.php_ (4,325 bytes)
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: $
# --------------------------------------------------------
# ======================================================================
# Author: Marcello Scata' <marcelloscata at users.sourceforge.net> ITALY
# ======================================================================
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path . 'graphviz_api.php' );
compress_enable();
$f_access_level = gpc_get_int( 'access', VIEWER );
$t_enum_status = config_get( 'status_enum_string' );
$t_enum_workflow = config_get( 'status_enum_workflow' );
$t_reopen = config_get( 'bug_reopen_status' );
$t_thresh_array = config_get( 'set_status_threshold' );
$t_bug_submit_status = config_get( 'bug_submit_status' );
$t_bug_readonly_status_threshold = config_get( 'bug_readonly_status_threshold' );
$t_reopen_bug_threshold = config_get( 'reopen_bug_threshold' );
$t_bug_reopen_status = config_get( 'bug_reopen_status' );
$t_graph_fontname = config_get( 'relationship_graph_fontname' );
$t_graph_fontsize = config_get( 'relationship_graph_fontsize' );
$t_graph_fontpath = config_get( 'relationship_graph_fontpath' );
$t_dot_tool = config_get( 'dot_tool' );
$t_graph_attributes = array ( );
if ( !empty( $t_graph_fontpath ) )
$t_graph_attributes['fontpath'] = $t_graph_fontpath;
$t_graph = new Digraph( 'STATES', $t_graph_attributes, $t_dot_tool );
$t_graph->set_default_node_attr( array (
'fontname' => $t_graph_fontname,
'fontsize' => $t_graph_fontsize,
'shape' => 'record',
'style' => 'filled',
'height' => '0.2',
'width' => '0.4'
) );
$t_graph->set_default_edge_attr( array (
'fontname' => $t_graph_fontname,
'fontsize' => $t_graph_fontsize,
'style' => 'solid',
'color' => '#000000',
'dir' => 'forward'
) );
$t_status_arr = explode_enum_string( $t_enum_status );
foreach ( $t_status_arr as $t_status ) {
list( $t_status_id, $t_status_label ) = explode_enum_arr( $t_status );
$t_status_label = get_enum_element( 'status', $t_status_id );
$t_node_attributes = array ( );
$t_node_attributes['label'] = $t_status_label;
if( $t_bug_submit_status == $t_status_id || $t_bug_readonly_status_threshold <= $t_status_id ) {
# submit status with bold border
$t_node_attributes['style'] = 'bold, filled';
}
else {
$t_node_attributes['style'] = 'filled';
}
$t_node_attributes['color'] = 'black';
$t_node_attributes['fillcolor'] = get_status_color( $t_status_id );
$t_node_attributes['URL'] = '';
$t_node_attributes['tooltip'] = '';
$t_graph->add_node( $t_status_id, $t_node_attributes );
if( isset( $t_enum_workflow[$t_status_id] ) ) {
$t_next_arr = explode_enum_string( $t_enum_workflow[$t_status_id] );
foreach ( $t_next_arr as $t_next ) {
if ( !is_blank( $t_next ) ) {
list( $t_next_id, $t_next_label ) = explode_enum_arr( $t_next );
# link to itself
if( $t_status_id == $t_next_id )
continue;
if( access_get_status_threshold( $t_next_id ) <= $f_access_level ) {
$t_color = '#000000';
}
else {
$t_color = '#C0C0C0';
}
$t_graph->add_edge( $t_status_id, $t_next_id, array ( 'style' => 'solid', 'color' => $t_color, 'dir' => 'forward' ) );
}
}
}
}
# add user defined arcs and implicit reopen arcs
foreach ( $t_status_arr as $t_status ) {
list( $t_status_id, $t_status_label ) = explode_enum_arr( $t_status );
if ( $t_status_id >= $t_bug_readonly_status_threshold ) {
if( access_get_status_threshold( $t_bug_reopen_status ) <= $f_access_level ) {
$t_color = '#0000ff';
}
else {
$t_color = '#C0C0C0';
}
$t_graph->add_edge( $t_status_id, $t_bug_reopen_status, array ( 'style' => 'solid', 'color' => $t_color, 'dir' => 'forward' ) );
}
}
$t_graph->output( 'png', true );
?> | ||||
|
Nice thing. I've seen some flows in my config which aren't intended. |
|
|
The thick border is to highlight the read-only states on one side and the NEW state on the other side while the blu arrows are to highlight the reopen linkes. I know I have to add some explaination on the page. |
|
|
This looks good. It does show the duplicate transitions that can be introduced by reopen. |
|
|
Looks good, following are my comments:
|
|
|
Will look at this patch to see if this is same functionality to workflow_graph_img.php that exists now, or different. |
|
|
Similar Graphviz based implementation like 0012253 |
|