logo       
Google Custom Search
    AddThis Social Bookmark Button

Recently Viewed: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

mantisbt manage_proj_subproj_add.php,NONE,1.1 manage_proj_subproj_delete.ph: msg#00042

Subject: mantisbt manage_proj_subproj_add.php,NONE,1.1 manage_proj_subproj_delete.php,NONE,1.1 changelog_page.php,1.12,1.13 config_defaults_inc.php,1.241,1.242 core.php,1.36,1.37 login_select_proj_page.php,1.35,1.36 manage_proj_create.php,1.6,1.7 manage_proj_create_page.php,1.7,1.8 manage_proj_edit_page.php,1.82,1.83 manage_proj_page.php,1.12,1.13 set_project.php,1.50,1.51 summary_page.php,1.43,1.44
Update of /cvsroot/mantisbt/mantisbt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3554

Modified Files:
        changelog_page.php config_defaults_inc.php core.php 
        login_select_proj_page.php manage_proj_create.php 
        manage_proj_create_page.php manage_proj_edit_page.php 
        manage_proj_page.php set_project.php summary_page.php 
Added Files:
        manage_proj_subproj_add.php manage_proj_subproj_delete.php 
Log Message:
Enh #5237: Support for subprojects that can be linked to several parent projects

Index: manage_proj_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_proj_page.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- manage_proj_page.php        12 Feb 2005 20:01:06 -0000      1.12
+++ manage_proj_page.php        13 Feb 2005 21:36:17 -0000      1.13
@@ -81,6 +81,10 @@
                  continue;
                }
 
+               if ( !project_hierarchy_is_toplevel( $v_id ) ) {
+                       continue;
+               }
+
 ?>
 <tr <?php echo helper_alternate_class() ?>>
        <td>

Index: login_select_proj_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/login_select_proj_page.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- login_select_proj_page.php  26 Sep 2004 12:15:26 -0000      1.35
+++ login_select_proj_page.php  13 Feb 2005 21:36:17 -0000      1.36
@@ -37,7 +37,7 @@
        </td>
        <td width="60%">
                <select name="project_id">
-               <?php print_project_option_list( ALL_PROJECTS ) ?>
+               <?php print_project_option_list( ALL_PROJECTS, false, null, 
true ) ?>
                </select>
        </td>
 </tr>

Index: changelog_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/changelog_page.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- changelog_page.php  12 Feb 2005 20:01:05 -0000      1.12
+++ changelog_page.php  13 Feb 2005 21:36:16 -0000      1.13
@@ -35,10 +35,16 @@
        $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() 
);
 
        if ( ALL_PROJECTS == $f_project_id ) {
-               $t_project_ids = user_get_accessible_projects( $t_user_id );
+               $t_topprojects = $t_project_ids = user_get_accessible_projects( 
$t_user_id );
+               foreach ( $t_topprojects as $t_project ) {
+                       $t_project_ids = array_merge( $t_project_ids, 
user_get_all_accessible_subprojects( $t_user_id, $t_project ) );
+               }
+
+               $t_project_ids = array_unique( $t_project_ids );
        } else {
                access_ensure_project_level( config_get( 
'view_changelog_threshold' ), $f_project_id );
-               $t_project_ids = array( $f_project_id );
+               $t_project_ids = user_get_all_accessible_subprojects( 
$t_user_id, $f_project_id );
+               array_unshift( $t_project_ids, $f_project_id );
        }
 
        # this page is invalid for the 'All Project' selection

Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- config_defaults_inc.php     12 Feb 2005 20:01:05 -0000      1.241
+++ config_defaults_inc.php     13 Feb 2005 21:36:16 -0000      1.242
@@ -1169,6 +1169,7 @@
        $g_mantis_filters_table                                 = 
$g_db_table_prefix.'_filters_table';
        $g_mantis_sponsorship_table                             = 
$g_db_table_prefix.'_sponsorship_table';
        $g_mantis_tokens_table                                  = 
$g_db_table_prefix.'_tokens_table';
+       $g_mantis_project_hierarchy_table                       = 
$g_db_table_prefix.'_project_hierachy_table';
 
        ###########################
        # Mantis Enum Strings

--- NEW FILE: manage_proj_subproj_add.php ---
<?php
        # Mantis - a php based bugtracking system
        # Copyright (C) 2000 - 2002  Kenzaburo Ito - 
kenito-J7RQz27tXwtAfugRpC6u6w@xxxxxxxxxxxxxxxx
        # Copyright (C) 2002 - 2004  Mantis Team   - 
mantisbt-dev-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
        # This program is distributed under the terms and conditions of the GPL
        # See the README and LICENSE files for details

        # --------------------------------------------------------
        # $Id: manage_proj_subproj_add.php,v 1.1 2005/02/13 21:36:17 jlatour 
Exp $
        # --------------------------------------------------------

        require_once( 'core.php' );

        $t_core_path = config_get( 'core_path' );

        $f_project_id    = gpc_get_int( 'project_id' );
        $f_subproject_id = gpc_get_int( 'subproject_id' );

        access_ensure_project_level( config_get( 'manage_project_threshold' ), 
$f_project_id );

        project_hierarchy_add( $f_subproject_id, $f_project_id );

        $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . 
$f_project_id;

        html_page_top1();
        html_meta_redirect( $t_redirect_url );
        html_page_top2();
?>
<br />
<div align="center">
<?php
        echo lang_get( 'operation_successful' ).'<br />';
        print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
?>
</div>

<?php html_page_bottom1( __FILE__ ) ?>

Index: core.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- core.php    12 Feb 2005 20:01:05 -0000      1.36
+++ core.php    13 Feb 2005 21:36:17 -0000      1.37
@@ -111,6 +111,7 @@
        }
 
        require_once( $t_core_path.'project_api.php' );
+       require_once( $t_core_path.'project_hierarchy_api.php' );
        require_once( $t_core_path.'access_api.php' );
        require_once( $t_core_path.'print_api.php' );
        require_once( $t_core_path.'helper_api.php' );

Index: summary_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/summary_page.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- summary_page.php    12 Feb 2005 20:01:08 -0000      1.43
+++ summary_page.php    13 Feb 2005 21:36:17 -0000      1.44
@@ -22,17 +22,27 @@
        $t_project_id = helper_get_current_project();
        $t_user_id = auth_get_current_user_id();
 
-       #checking if it's a per project statistic or all projects
        if ( ALL_PROJECTS == $t_project_id ) {
-               # Only projects to which the user have access
-               $t_accessible_projects_array = user_get_accessible_projects( 
$t_user_id );
-               if ( count( $t_accessible_projects_array ) > 0 ) {
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
-               } else {
-                       $specific_where = '1=1';
+               $t_topprojects = $t_project_ids = user_get_accessible_projects( 
$t_user_id );
+               foreach ( $t_topprojects as $t_project ) {
+                       $t_project_ids = array_merge( $t_project_ids, 
user_get_all_accessible_subprojects( $t_user_id, $t_project ) );
                }
+
+               $t_project_ids = array_unique( $t_project_ids );
        } else {
-               $specific_where = " project_id='$t_project_id'";
+               access_ensure_project_level( config_get( 
'view_changelog_threshold' ), $t_project_id );
+               $t_project_ids = user_get_all_accessible_subprojects( 
$t_user_id, $t_project_id );
+               array_unshift( $t_project_ids, $t_project_id );
+       }
+
+       $t_project_ids = array_map( 'db_prepare_int', $t_project_ids );
+
+       if ( 0 == count( $t_project_ids ) ) {
+               $specific_where = ' 1 <> 1';
+       } elseif ( 1 == count( $t_project_ids ) ) {
+               $specific_where = ' project_id=' . $t_project_ids[0];
+       } else {
+               $specific_where = ' project_id IN (' . join( ',', 
$t_project_ids ) . ')';
        }
 
        $t_bug_table = config_get( 'mantis_bug_table' );
@@ -119,7 +129,7 @@
 <tr valign="top">
        <td width="50%">
                <?php # PROJECT # ?>
-               <?php if ( ALL_PROJECTS == $t_project_id ) { ?>
+               <?php if ( 1 < count( $t_project_ids ) ) { ?>
                <table class="width100" cellspacing="1">
                <tr>
                        <td class="form-title" colspan="1">

--- NEW FILE: manage_proj_subproj_delete.php ---
<?php
        # Mantis - a php based bugtracking system
        # Copyright (C) 2000 - 2002  Kenzaburo Ito - 
kenito-J7RQz27tXwtAfugRpC6u6w@xxxxxxxxxxxxxxxx
        # Copyright (C) 2002 - 2004  Mantis Team   - 
mantisbt-dev-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
        # This program is distributed under the terms and conditions of the GPL
        # See the README and LICENSE files for details

        # --------------------------------------------------------
        # $Id: manage_proj_subproj_delete.php,v 1.1 2005/02/13 21:36:17 jlatour 
Exp $
        # --------------------------------------------------------

        require_once( 'core.php' );

        $t_core_path = config_get( 'core_path' );

        $f_project_id    = gpc_get_int( 'project_id' );
        $f_subproject_id = gpc_get_int( 'subproject_id' );

        access_ensure_project_level( config_get( 'manage_project_threshold' ), 
$f_project_id );

        project_hierarchy_remove( $f_subproject_id, $f_project_id );

        $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . 
$f_project_id;

        html_page_top1();
        html_meta_redirect( $t_redirect_url );
        html_page_top2();
?>
<br />
<div align="center">
<?php
        echo lang_get( 'operation_successful' ).'<br />';
        print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
?>
</div>

<?php html_page_bottom1( __FILE__ ) ?>

Index: manage_proj_edit_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_proj_edit_page.php,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- manage_proj_edit_page.php   12 Feb 2005 20:01:06 -0000      1.82
+++ manage_proj_edit_page.php   13 Feb 2005 21:36:17 -0000      1.83
@@ -145,6 +145,116 @@
        helper_alternate_class( 0 );
 ?>
 
+<!-- SUBPROJECTS -->
+<div align="center">
+<table class="width75" cellspacing="1">
+
+<!-- Title -->
+<tr>
+       <td class="form-title" colspan="6">
+               <?php echo lang_get( 'subprojects' ) ?>
+                <?php
+                       # Check the user's global access level before allowing 
project creation
+                       if ( access_has_global_level ( config_get( 
'create_project_threshold' ) ) ) {
+                               print_bracket_link( 
'manage_proj_create_page.php?parent_id=' . $f_project_id, lang_get( 
'create_new_subproject_link' ) );
+                       }
+                ?>
+       </td>
+</tr>
+
+<!-- Subprojects -->
+<?php
+       $t_subproject_ids = current_user_get_accessible_subprojects( 
$f_project_id );
+
+       if ( Array() != $t_subproject_ids ) {
+?>
+<tr class="row-category">
+       <td width="20%">
+               <?php echo lang_get( 'name' ) ?>
+       </td>
+       <td width="10%">
+               <?php echo lang_get( 'status' ) ?>
+       </td>
+       <td width="10%">
+               <?php echo lang_get( 'enabled' ) ?>
+       </td>
+       <td width="10%">
+               <?php echo lang_get( 'view_status' ) ?>
+       </td>
+       <td width="30%">
+               <?php echo lang_get( 'description' ) ?>
+       </td>
+       <td width="20%">
+               <?php echo lang_get( 'actions' ) ?>
+       </td>
+</tr>
+
+<?php
+               foreach ( $t_subproject_ids as $t_subproject_id ) {
+                       $t_subproject = project_get_row( $t_subproject_id );
+?>
+<tr <?php echo helper_alternate_class() ?>>
+       <td>
+               <a href="manage_proj_edit_page.php?project_id=<?php echo 
$t_subproject['id'] ?>"><?php echo string_display( $t_subproject['name'] ) 
?></a>
+       </td>
+       <td>
+               <?php echo get_enum_element( 'project_status', 
$t_subproject['status'] ) ?>
+       </td>
+       <td>
+               <?php echo trans_bool( $t_subproject['enabled'] ) ?>
+       </td>
+       <td>
+               <?php echo get_enum_element( 'project_view_state', 
$t_subproject['view_state'] ) ?>
+       </td>
+       <td>
+               <?php echo string_display_links( $t_subproject['description'] ) 
?>
+       </td>
+       <td class="center">
+               <?php
+                               print_bracket_link( 
'manage_proj_edit_page.php?project_id=' . $t_subproject['id'], lang_get( 
'edit_link' ) );
+                               echo ' ';
+                               print_bracket_link( 
'manage_proj_subproj_delete.php?project_id=' . $f_project_id . 
'&amp;subproject_id=' . $t_subproject['id'], lang_get( 'unlink_link' ) );
+               ?>
+       </td>
+</tr>
+<?php
+               } # End of foreach loop over subprojects
+       } # End of hiding subproject listing if there are no subprojects
+?>
+
+<!-- Add subproject -->
+<tr>
+       <td class="left" colspan="2">
+               <form method="post" action="manage_proj_subproj_add.php">
+                       <input type="hidden" name="project_id" value="<?php 
echo $f_project_id ?>" />
+                       <select name="subproject_id">
+<?php
+       $t_all_subprojects = project_hierarchy_get_subprojects( $f_project_id );
+       $t_all_subprojects[] = $f_project_id;
+
+       $t_projects = project_get_all_rows();
+
+       $t_projects = multi_sort( $t_projects, 'name', ASC );
+
+       foreach ( $t_projects as $t_project ) {
+               if ( in_array( $t_project['id'], $t_all_subprojects ) || 
in_array( $f_project_id, project_hierarchy_get_all_subprojects( 
$t_project['id'] ) ) ) {
+                       continue;
+               }
+?>
+                               <option value="<?php echo $t_project['id'] 
?>"><?php echo $t_project['name'] ?></option>
+<?php
+       } # End looping over projects
+?>
+                       </select>
+                       <input type="submit" value="<?php echo 
lang_get('add_subproject'); ?>">
+               </form>
+       </td>
+</tr>
+
+</table>
+
+<br />
+
 <!-- PROJECT CATEGORIES -->
 <div align="center">
 <table class="width75" cellspacing="1">
@@ -222,7 +332,7 @@
                <form method="post" action="manage_proj_cat_copy.php">
                        <input type="hidden" name="project_id" value="<?php 
echo $f_project_id ?>" />
                        <select name="other_project_id">
-                               <?php print_project_option_list( null, false ) 
?>
+                               <?php print_project_option_list( null, false, 
$f_project_id ); ?>
                        </select>
                        <input type="submit" name="copy_from" class="button" 
value="<?php echo lang_get( 'copy_categories_from' ) ?>" />
                        <input type="submit" name="copy_to" class="button" 
value="<?php echo lang_get( 'copy_categories_to' ) ?>" />
@@ -442,7 +552,7 @@
                                <td class="category">
                                        <?php echo lang_get( 'access_level' ) ?>
                                </td>
-                               <td class="category"> &nbsp; </td>
+                               <td class="category">&nbsp;  </td>
                        </tr>
                        <tr class="row-1" valign="top">
                                <td>
@@ -533,9 +643,9 @@
        }  # end for
 ?>
        <tr>
-       <td> &nbsp; </td>
-       <td> &nbsp; </td>
-       <td> &nbsp; </td>
+       <td>&nbsp;  </td>
+       <td>&nbsp;  </td>
+       <td>&nbsp;  </td>
        <td class="center">
        <?php
                # You need global or project-specific permissions to remove 
users

Index: manage_proj_create_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_proj_create_page.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- manage_proj_create_page.php 12 Apr 2004 21:04:35 -0000      1.7
+++ manage_proj_create_page.php 13 Feb 2005 21:36:17 -0000      1.8
@@ -18,13 +18,26 @@
 
 <?php print_manage_menu( 'manage_proj_create_page.php' ) ?>
 
+<?php
+       $f_parent_id = gpc_get_int( 'parent_id', null );
+?>
+
 <br />
 <div align="center">
 <form method="post" action="manage_proj_create.php">
+<?php if ( null != $f_parent_id ) { ?>
+<input type="hidden" name="parent_id" value="<?php echo $f_parent_id ?>">
+<?php } ?>
 <table class="width75" cellspacing="1">
 <tr>
-       <td class="form-title" colspan="2">
-               <?php echo lang_get( 'add_project_title' ) ?>
+<td class="form-title" colspan="2">
+               <?php
+                       if ( null != $f_parent_id ) {
+                               echo lang_get( 'add_subproject_title' );
+                       } else {
+                               echo lang_get( 'add_project_title' );
+                       }
+               ?>
        </td>
 </tr>
 <tr class="row-1">

Index: manage_proj_create.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/manage_proj_create.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- manage_proj_create.php      1 Dec 2004 12:45:22 -0000       1.6
+++ manage_proj_create.php      13 Feb 2005 21:36:17 -0000      1.7
@@ -9,7 +9,13 @@
        # $Id$
        # --------------------------------------------------------
 ?>
-<?php require_once( 'core.php' ) ?>
+<?php
+       require_once( 'core.php' );
+
+       $t_core_path = config_get( 'core_path' );
+
+       require_once( $t_core_path.'project_hierarchy_api.php' );
+?>
 <?php
        access_ensure_global_level( config_get( 'create_project_threshold' ) );
 
@@ -27,6 +33,12 @@
                project_add_user( $t_project_id, $t_current_user_id, 
$t_access_level );
        }
 
+       $f_parent_id    = gpc_get_int( 'parent_id', 0 );
+
+       if ( 0 != $f_parent_id ) {
+               project_hierarchy_add( $t_project_id, $f_parent_id );
+       }
+
        $t_redirect_url = 'manage_proj_page.php';
 
        html_page_top1();

Index: set_project.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/set_project.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- set_project.php     12 Feb 2005 20:01:07 -0000      1.50
+++ set_project.php     13 Feb 2005 21:36:17 -0000      1.51
@@ -17,17 +17,21 @@
        require_once( $t_core_path.'current_user_api.php' );
 ?>
 <?php
-       $f_project_id   = gpc_get_int( 'project_id' );
-       $f_make_default = gpc_get_bool( 'make_default' );
+       $f_project_id   = gpc_get_string( 'project_id' );
+       $f_make_default = gpc_get_bool  ( 'make_default' );
        $f_ref                  = gpc_get_string( 'ref', '' );
 
-       if ( ALL_PROJECTS != $f_project_id ) {
-               project_ensure_exists( $f_project_id );
+       $t_project = split( ';', $f_project_id );
+       $t_top     = $t_project[0];
+       $t_bottom  = $t_project[ count( $t_project ) ];
+
+       if ( ALL_PROJECTS != $t_bottom ) {
+               project_ensure_exists( $t_bottom );
        }
 
        # Set default project
        if ( $f_make_default ) {
-               current_user_set_default_project( $f_project_id );
+               current_user_set_default_project( $t_top );
        }
 
        helper_set_current_project( $f_project_id );



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>