2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
24 * @uses access_api.php
25 * @uses authentication_api.php
26 * @uses category_api.php
27 * @uses config_api.php
28 * @uses constant_inc.php
31 * @uses helper_api.php
36 * @uses project_api.php
37 * @uses project_hierarchy_api.php
38 * @uses string_api.php
40 * @uses utility_api.php
43 require_once( 'core.php' );
44 require_api( 'access_api.php' );
45 require_api( 'authentication_api.php' );
46 require_api( 'category_api.php' );
47 require_api( 'config_api.php' );
48 require_api( 'constant_inc.php' );
49 require_api( 'form_api.php' );
50 require_api( 'gpc_api.php' );
51 require_api( 'helper_api.php' );
52 require_api( 'html_api.php' );
53 require_api( 'icon_api.php' );
54 require_api( 'lang_api.php' );
55 require_api( 'print_api.php' );
56 require_api( 'project_api.php' );
57 require_api( 'project_hierarchy_api.php' );
58 require_api( 'string_api.php' );
59 require_api( 'user_api.php' );
60 require_api( 'utility_api.php' );
62 auth_reauthenticate();
64 $f_sort = gpc_get_string( 'sort', 'name' );
65 $f_dir = gpc_get_string( 'dir', 'ASC' );
67 if ( 'ASC' == $f_dir ) {
68 $t_direction = ASCENDING
;
70 $t_direction = DESCENDING
;
73 html_page_top( lang_get( 'manage_projects_link' ) );
75 print_manage_menu( 'manage_proj_page.php' );
77 # Project Menu Form BEGIN
80 <table
class="width100" cellspacing
="1">
82 <td
class="form-title" colspan
="5">
84 echo lang_get( 'projects_title' );
86 # Check the user's global access level before allowing project creation
87 if ( access_has_global_level ( config_get( 'create_project_threshold' ) ) ) {
88 print_button( 'manage_proj_create_page.php', lang_get( 'create_new_project_link' ) );
93 <tr
class="row-category">
96 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'name' ), 'name', $t_direction, $f_sort );
97 print_sort_icon( $t_direction, $f_sort, 'name' );
102 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'status' ), 'status', $t_direction, $f_sort );
103 print_sort_icon( $t_direction, $f_sort, 'status' );
108 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'enabled' ), 'enabled', $t_direction, $f_sort );
109 print_sort_icon( $t_direction, $f_sort, 'enabled' );
114 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'view_status' ), 'view_state', $t_direction, $f_sort );
115 print_sort_icon( $t_direction, $f_sort, 'view_state' );
120 print_manage_project_sort_link( 'manage_proj_page.php', lang_get( 'description' ), 'description', $t_direction, $f_sort );
121 print_sort_icon( $t_direction, $f_sort, 'description' );
126 $t_manage_project_threshold = config_get( 'manage_project_threshold' );
127 $t_projects = user_get_accessible_projects( auth_get_current_user_id(), true );
128 $t_full_projects = array();
129 foreach ( $t_projects as $t_project_id ) {
130 $t_full_projects[] = project_get_row( $t_project_id );
132 $t_projects = multi_sort( $t_full_projects, $f_sort, $t_direction );
133 $t_stack = array( $t_projects );
135 while ( 0 < count( $t_stack ) ) {
136 $t_projects = array_shift( $t_stack );
138 if ( 0 == count( $t_projects ) ) {
142 $t_project = array_shift( $t_projects );
143 $t_project_id = $t_project['id'];
144 $t_level = count( $t_stack );
146 # only print row if user has project management privileges
147 if (access_has_project_level( $t_manage_project_threshold, $t_project_id, auth_get_current_user_id() ) ) {
150 <tr
<?php
echo helper_alternate_class() ?
>>
152 <a href
="manage_proj_edit_page.php?project_id=<?php echo $t_project['id'] ?>"><?php
echo str_repeat( "» ", $t_level ) . string_display( $t_project['name'] ) ?
></a
>
155 <?php
echo get_enum_element( 'project_status', $t_project['status'] ) ?
>
158 <?php
echo trans_bool( $t_project['enabled'] ) ?
>
161 <?php
echo get_enum_element( 'project_view_state', $t_project['view_state'] ) ?
>
164 <?php
echo string_display_links( $t_project['description'] ) ?
>
169 $t_subprojects = project_hierarchy_get_subprojects( $t_project_id, true );
171 if ( 0 < count( $t_projects ) ||
0 < count( $t_subprojects ) ) {
172 array_unshift( $t_stack, $t_projects );
175 if ( 0 < count( $t_subprojects ) ) {
176 $t_full_projects = array();
177 foreach ( $t_subprojects as $t_project_id ) {
178 $t_full_projects[] = project_get_row( $t_project_id );
180 $t_subprojects = multi_sort( $t_full_projects, $f_sort, $t_direction );
181 array_unshift( $t_stack, $t_subprojects );
188 <!-- GLOBAL CATEGORIES
-->
189 <a name
="categories" />
191 <table
class="width75" cellspacing
="1">
195 <td
class="form-title" colspan
="3">
196 <?php
echo lang_get( 'global_categories' ) ?
>
200 $t_categories = category_get_all_rows( ALL_PROJECTS
);
202 if ( count( $t_categories ) > 0 ) {
204 <tr
class="row-category">
206 <?php
echo lang_get( 'category' ) ?
>
209 <?php
echo lang_get( 'assign_to' ) ?
>
212 <?php
echo lang_get( 'actions' ) ?
>
218 foreach ( $t_categories as $t_category ) {
219 $t_id = $t_category['id'];
221 $t_name = $t_category['name'];
222 if ( NO_USER
!= $t_category['user_id'] && user_exists( $t_category['user_id'] )) {
223 $t_user_name = user_get_name( $t_category['user_id'] );
228 <!-- Repeated Info Row
-->
229 <tr
<?php
echo helper_alternate_class() ?
>>
231 <?php
echo string_display( category_full_name( $t_category['id'], false ) ) ?
>
234 <?php
echo string_display_line( $t_user_name ) ?
>
238 $t_id = urlencode( $t_id );
239 $t_project_id = urlencode( ALL_PROJECTS
);
241 print_button( "manage_proj_cat_edit_page.php?id=$t_id&project_id=$t_project_id", lang_get( 'edit_link' ) );
243 print_button( "manage_proj_cat_delete.php?id=$t_id&project_id=$t_project_id", lang_get( 'delete_link' ) );
251 <!-- Add Category Form
-->
253 <td
class="left" colspan
="3">
254 <form method
="post" action
="manage_proj_cat_add.php">
255 <?php
echo form_security_field( 'manage_proj_cat_add' ) ?
>
256 <input type
="hidden" name
="project_id" value
="<?php echo ALL_PROJECTS ?>" />
257 <input type
="text" name
="name" size
="32" maxlength
="128" />
258 <input type
="submit" class="button" value
="<?php echo lang_get( 'add_category_button' ) ?>" />