View Issue Details

IDProjectCategoryView StatusLast Update
0008406mantisbtsub-projectspublic2007-09-28 17:23
Reporteremathieu Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.1.0a4 
Summary0008406: Configuration options should be inherited from parent project
Description

I could be interesting to modify the config_get rules as following:

#     looks for specified config_id + current user + current project.
  • if not found, config_id + current user + parent_projects

    if not found, config_id + current user + all_project

    if not found, config_id + default user + current project

  • if not found, config_id + default user + parent_projects

    if not found, config_id + default user + all_project.

    3.use GLOBAL[config_id]

TagsNo tags attached.

Activities

emathieu

emathieu

2007-09-28 13:22

reporter   ~0015757

I tried to do it myself and found it simple to patch:
in core/config_api.php
in function config_get
replace
if ( ! in_array( ALL_PROJECTS, $t_projects ) ) {
$t_projects[] = ALL_PROJECTS;
}

with
if ( ! in_array( ALL_PROJECTS, $t_projects ) ) {
$t_parent = project_hierarchy_get_parent_id( $t_projects[0] );
while ( -1 != $t_parent ) {
$t_projects[] = $t_parent;
$t_parent = project_hierarchy_get_parent_id( $t_parent );
}
$t_projects[] = ALL_PROJECTS;
}

jreese

jreese

2007-09-28 13:49

reporter   ~0015758

You will need to consider the possibility of having a loop in the hierarchy. Eg, if you find that a project is already in your array (same as checking for ALL_PROJECTS), then 'break' the while loop.

emathieu

emathieu

2007-09-28 13:59

reporter   ~0015759

Tanks for your comment.
I changed the loop condition to
while ( ( -1 != $t_parent ) && ( ! in_array( $t_parent, $t_projects ) ) ){

emathieu

emathieu

2007-09-28 17:23

reporter   ~0015760

I forgot to mention to add

$t_core_dir = dirname( FILE ).DIRECTORY_SEPARATOR;
require_once( $t_core_dir . 'project_hierarchy_api.php' );

at the beginning of core/config_api.php