Index: lang/strings_english.txt =================================================================== --- lang/strings_english.txt (wersja 5156) +++ lang/strings_english.txt (kopia robocza) @@ -1511,4 +1511,12 @@ # mind mapping $s_mindmap = 'Mindmap'; $s_freemind_export = 'Freemind Export'; + +# custom per project bug status groups +$s_project_custom_bug_status_group = 'Select bug status group'; +$s_project_custom_bug_use_workflow = 'Use workflow'; + +# tree model relationship +$s_bug_path = 'Bug path'; +$s_enable_tree_model = 'Enable tree model bug relationship'; ?> \ brakuje znaku końca linii na końcu pliku Index: manage_proj_create_page.php =================================================================== --- manage_proj_create_page.php (wersja 5156) +++ manage_proj_create_page.php (kopia robocza) @@ -102,6 +102,42 @@ + + + + + + + +
+ + + + + + + + + + + + /> + + + Index: manage_proj_update.php =================================================================== --- manage_proj_update.php (wersja 5156) +++ manage_proj_update.php (kopia robocza) @@ -40,5 +40,39 @@ project_update( $f_project_id, $f_name, $f_description, $f_status, $f_view_state, $f_file_path, $f_enabled, $f_inherit_global ); + # Per project bug status group + config_set("per_project_bug_status_selected", gpc_get_int("per_project_bug_status"), NO_USER, $f_project_id); + $f_workflow = gpc_get_bool('use_workflow', false); + if (gpc_get_int("per_project_bug_status")) { + # custom bug status group selected + $t_status_enum = 'per_project_bug_status_'.gpc_get_int("per_project_bug_status"); + config_set("status_enum_string", config_get($t_status_enum.'_enum'), NO_USER, $f_project_id); + if ($f_workflow) { + config_set('status_enum_workflow', config_get($t_status_enum.'_workflow'), NO_USER, $f_project_id); + config_set('per_project_bug_status_workflow', 1, NO_USER, $f_project_id); + } else { + config_set('status_enum_workflow', array(), NO_USER, $f_project_id); + config_set('per_project_bug_status_workflow', 0, NO_USER, $f_project_id); + } + } else { + # use the default bug status group + config_set("status_enum_string", config_get('status_enum_string', null, null, 0), NO_USER, $f_project_id); + if ($f_workflow) { + config_set("status_enum_workflow", config_get('status_enum_workflow', null, null, 0), NO_USER, $f_project_id); + config_set('per_project_bug_status_workflow', 1, NO_USER, $f_project_id); + } else { + config_set("status_enum_workflow", array(), NO_USER, $f_project_id); + config_set('per_project_bug_status_workflow', 0, NO_USER, $f_project_id); + } + } + + # tree model bug relations + $t_enable_tree_model = gpc_get_bool('enable_tree_model'); + if ($t_enable_tree_model) { + config_set('tree_model_relationships', 1, NO_USER, $f_project_id); + } else { + config_set('tree_model_relationships', 0, NO_USER, $f_project_id); + } + print_header_redirect( 'manage_proj_page.php' ); ?> Index: config_defaults_inc.php =================================================================== --- config_defaults_inc.php (wersja 5156) +++ config_defaults_inc.php (kopia robocza) @@ -1995,4 +1995,62 @@ # Enables or disables the mind mapping features including ability to export Freemind files and # in browser view of generated mindmaps. $g_mindmap_enabled = ON; + + ################################# + # Per project bug status groups + ################################# + + # This feature enables you to choose per project custom bug status groups and + # workflows. + + # Custom status groups enum. + # The value of each enum should be the title of the bug status group (probably in + # your own language). + # For each group, you should define the folowing config entries (where XX is the + # status group ID/index as defined in the enum): + # 1. $g_per_project_bug_status_XX_enum + # With avaible status enum (like in $g_status_enum_string). + # If you define a custom status, you should also create a language code for it + # or you will recieve a lot of errors in mantis (for the language your mantis + # installation is using). + # 2. $g_per_project_bug_status_XX_workflow + # You should define here a valid workflow (like in $g_status_enum_workflow) + # or set it to array(); + # + # Example: + # $g_per_project_bug_status_enums = '10:Simple (new/acknowledged/resolved/closed)'; + # $g_per_project_bug_status_10_enum = '10:new,30:acknowledged,80:resolved,90:closed'; + # $g_per_project_bug_status_10_workflow = array( + # NEW_ => '30:acknowledged', + # ACKNOWLEDGED => '10:new,80:resolved', + # RESOLVED => '30:acknowledged,90:closed', + # CLOSED => '30:acknowledged' + # ); + $g_per_project_bug_status_enums = ''; + + # Per project, selected bug status group. + # This config entry will be changed per project to specify which bug status group + # from the $g_per_project_bug_status_enums is select, or will stay blank for the + # default status group (from status_enum_string) + $g_per_project_bug_status_selected = ''; + + # Per project, should a workflow be used with selected status group. + # This is a boolean flag, if set, current bug status group workflow will be assigned + # to status_enum_workflow. + $g_per_project_bug_status_workflow = ''; + + + ############################# + # Tree model relationships + ############################# + + # If set to 1, this enables tree model relationships. In this mode. each bug may + # have only one "child of" relationship and circular relationships are detected + # and rejected. + # If this is enabled on an existing project with bugs with circular relationships, + # the first "child of" relation will be treated as valid, the other will be ignored. + # 'tree_model_relationships' should be set to 0 if you have a project with complex + # bug relationship model, and enable this only in the project that needs this. + $g_tree_model_relationships = 0; + ?> \ brakuje znaku końca linii na końcu pliku Index: manage_proj_edit_page.php =================================================================== --- manage_proj_edit_page.php (wersja 5156) +++ manage_proj_edit_page.php (kopia robocza) @@ -117,6 +117,48 @@ + +> + + + + + +
+ + /> + + + + + +> + + + + + /> + + + + > Index: core/columns_api.php =================================================================== --- core/columns_api.php (wersja 5156) +++ core/columns_api.php (kopia robocza) @@ -56,6 +56,7 @@ 'summary', 'version', 'view_state', + 'bug_path', ); # Add project custom fields to the array. Only add the ones for which the current user has at least read access. @@ -484,6 +485,14 @@ # -------------------- # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + function print_column_title_bug_path( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + echo ''; + echo lang_get( 'bug_path' ); + echo ''; + } + + # -------------------- + # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php function print_column_selection( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { global $t_checkboxes_exist, $t_update_bug_threshold; @@ -782,4 +791,69 @@ echo ''; } + + # -------------------- + # $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php + function print_column_bug_path( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { + # stack of bugs, used to detect circular relations + $t_bug_stack = array(); + # cache of projects using tree model bug relations + $t_tree_model_projects = array(); + # array of bugs to display + $t_bugs = array(); + # current bug Id. + $t_bug_id = $p_row['id']; + # current project Id. + $t_project_id = $p_row['project_id']; + + # check if this project use tree model + if (config_get('tree_model_relationships', false, null, $t_project_id)) { + $t_tree_model_projects[] = $t_project_id; + } else { + echo ''; + return; + } + + while ( 1 ) { + $t_relations = relationship_get_all_dest($t_bug_id); + $t_bug_id = null; + # get parent bug + foreach ($t_relations as $t_relationship) { + if ($t_relationship->type == 2) { + # only the first parent relation is considered valid + $t_bug_id = $t_relationship->src_bug_id; + $t_project_id = $t_relationship->src_project_id; + } + } + + if ($t_bug_id == null) { + # no parent bug + break; + } else if (in_array($t_bug_id, $t_bug_stack)) { + # circular relation! + array_unshift($t_bugs, string_get_bug_view_link($t_bug_id).'~'); + break; + } + + if (!in_array($t_project_id, $t_tree_model_projects)) { + if (config_get('tree_model_relationships', false, null, $t_project_id)) { + $t_tree_model_projects[] = $t_project_id; + } else { + # this project doesn't support tree model bug relations + array_unshift($t_bugs, string_get_bug_view_link($t_bug_id).'!'); + break; + } + } + + # add bug to the path + array_unshift($t_bugs, string_get_bug_view_link($t_bug_id)); + $t_bug_stack[] = $t_bug_id; + } + + # generate path string to display + $t_path = implode(' / ', $t_bugs); + + echo '', $t_path , ''; + } + ?> Index: manage_proj_create.php =================================================================== --- manage_proj_create.php (wersja 5156) +++ manage_proj_create.php (kopia robocza) @@ -54,6 +54,43 @@ if ( 0 != $f_parent_id ) { project_hierarchy_add( $t_project_id, $f_parent_id, $f_inherit_parent ); } + + # Update per project bug status group + if ($t_project_id) { + config_set("per_project_bug_status_selected", gpc_get_int("per_project_bug_status"), NO_USER, $t_project_id); + $f_workflow = gpc_get_bool('use_workflow', false); + if (gpc_get_int("per_project_bug_status")) { //use_workflow + # use custom bug status group + $status_enum = 'per_project_bug_status_'.gpc_get_int("per_project_bug_status"); + config_set("status_enum_string", config_get($status_enum.'_enum'), NO_USER, $t_project_id); + if ($f_workflow) { + config_set('status_enum_workflow', config_get($status_enum.'_workflow'), NO_USER, $t_project_id); + config_set('per_project_bug_status_workflow', 1, NO_USER, $t_project_id); + } else { + config_set('status_enum_workflow', array(), NO_USER, $t_project_id); + config_set('per_project_bug_status_workflow', 0, NO_USER, $t_project_id); + } + } else { + # use the default bug status group + config_set("status_enum_string", config_get('status_enum_string', null, null, 0), NO_USER, $t_project_id); + if ($f_workflow) { + config_set("status_enum_workflow", config_get('status_enum_workflow', null, null, 0), NO_USER, $t_project_id); + config_set('per_project_bug_status_workflow', 1, NO_USER, $t_project_id); + } else { + config_set("status_enum_workflow", array(), NO_USER, $t_project_id); + config_set('per_project_bug_status_workflow', 0, NO_USER, $t_project_id); + } + } + } + + # tree model bug relations + $t_enable_tree_model = gpc_get_bool('enable_tree_model'); + if ($t_enable_tree_model) { + config_set('tree_model_relationships', 1, NO_USER, $t_project_id); + } else { + config_set('tree_model_relationships', 0, NO_USER, $t_project_id); + } + $t_redirect_url = 'manage_proj_page.php';