Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / manage_proj_edit_page.php
blobabce00a137c73da444a3818b0103f469c1aee430
1 <?php
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/>.
17 /**
18 * @package MantisBT
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
23 * @uses core.php
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
29 * @uses current_user_api.php
30 * @uses custom_field_api.php
31 * @uses date_api.php
32 * @uses event_api.php
33 * @uses file_api.php
34 * @uses form_api.php
35 * @uses gpc_api.php
36 * @uses helper_api.php
37 * @uses html_api.php
38 * @uses lang_api.php
39 * @uses print_api.php
40 * @uses project_api.php
41 * @uses project_hierarchy_api.php
42 * @uses string_api.php
43 * @uses user_api.php
44 * @uses utility_api.php
45 * @uses version_api.php
48 require_once( 'core.php' );
49 require_api( 'access_api.php' );
50 require_api( 'authentication_api.php' );
51 require_api( 'category_api.php' );
52 require_api( 'config_api.php' );
53 require_api( 'constant_inc.php' );
54 require_api( 'current_user_api.php' );
55 require_api( 'custom_field_api.php' );
56 require_api( 'date_api.php' );
57 require_api( 'event_api.php' );
58 require_api( 'file_api.php' );
59 require_api( 'form_api.php' );
60 require_api( 'gpc_api.php' );
61 require_api( 'helper_api.php' );
62 require_api( 'html_api.php' );
63 require_api( 'lang_api.php' );
64 require_api( 'print_api.php' );
65 require_api( 'project_api.php' );
66 require_api( 'project_hierarchy_api.php' );
67 require_api( 'string_api.php' );
68 require_api( 'user_api.php' );
69 require_api( 'utility_api.php' );
70 require_api( 'version_api.php' );
72 auth_reauthenticate();
74 $f_project_id = gpc_get_int( 'project_id' );
75 $f_show_global_users = gpc_get_bool( 'show_global_users' );
77 project_ensure_exists( $f_project_id );
78 access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id );
80 $row = project_get_row( $f_project_id );
82 $t_can_manage_users = access_has_project_level( config_get( 'project_user_threshold' ), $f_project_id );
84 html_page_top( project_get_field( $f_project_id, 'name' ) );
86 print_manage_menu( 'manage_proj_edit_page.php' );
88 <br />
89 <!-- PROJECT PROPERTIES -->
90 <div align="center">
91 <form method="post" action="manage_proj_update.php">
92 <?php echo form_security_field( 'manage_proj_update' ) ?>
93 <table class="width75" cellspacing="1">
95 <!-- Title -->
96 <tr>
97 <td class="form-title" colspan="2">
98 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
99 <?php echo lang_get( 'edit_project_title' ) ?>
100 </td>
101 </tr>
103 <!-- Name -->
104 <tr <?php echo helper_alternate_class() ?>>
105 <td class="category" width="25%">
106 <?php echo lang_get( 'project_name' ) ?>
107 </td>
108 <td width="75%">
109 <input type="text" name="name" size="50" maxlength="128" value="<?php echo string_attribute( $row['name'] ) ?>" />
110 </td>
111 </tr>
113 <!-- Status -->
114 <tr <?php echo helper_alternate_class() ?>>
115 <td class="category">
116 <?php echo lang_get( 'status' ) ?>
117 </td>
118 <td>
119 <select name="status">
120 <?php print_enum_string_option_list( 'project_status', $row['status'] ) ?>
121 </select>
122 </td>
123 </tr>
125 <!-- Enabled -->
126 <tr <?php echo helper_alternate_class() ?>>
127 <td class="category">
128 <?php echo lang_get( 'enabled' ) ?>
129 </td>
130 <td>
131 <input type="checkbox" name="enabled" <?php check_checked( $row['enabled'], ON ); ?> />
132 </td>
133 </tr>
135 <!-- Category Inheritance -->
136 <tr <?php echo helper_alternate_class() ?>>
137 <td class="category">
138 <?php echo lang_get( 'inherit_global' ) ?>
139 </td>
140 <td>
141 <input type="checkbox" name="inherit_global" <?php check_checked( $row['inherit_global'], ON ); ?> />
142 </td>
143 </tr>
145 <!-- View Status (public/private) -->
146 <tr <?php echo helper_alternate_class() ?>>
147 <td class="category">
148 <?php echo lang_get( 'view_status' ) ?>
149 </td>
150 <td>
151 <select name="view_state">
152 <?php print_enum_string_option_list( 'view_state', $row['view_state']) ?>
153 </select>
154 </td>
155 </tr>
157 <!-- File upload path (if uploading is enabled) -->
158 <?php if ( file_is_uploading_enabled() ) { ?>
159 <tr <?php echo helper_alternate_class() ?>>
160 <td class="category">
161 <?php echo lang_get( 'upload_file_path' ) ?>
162 </td>
163 <td>
164 <input type="text" name="file_path" size="50" maxlength="250" value="<?php echo string_attribute( $row['file_path'] ) ?>" />
165 </td>
166 </tr>
167 <?php } ?>
169 <!-- Description -->
170 <tr <?php echo helper_alternate_class() ?>>
171 <td class="category">
172 <?php echo lang_get( 'description' ) ?>
173 </td>
174 <td>
175 <textarea name="description" cols="60" rows="5"><?php echo string_textarea( $row['description'] ) ?></textarea>
176 </td>
177 </tr>
179 <?php event_signal( 'EVENT_MANAGE_PROJECT_UPDATE_FORM', array( $f_project_id ) ); ?>
181 <!-- Submit Button -->
182 <tr>
183 <td>&nbsp;</td>
184 <td>
185 <input type="submit" class="button" value="<?php echo lang_get( 'update_project_button' ) ?>" />
186 </td>
187 </tr>
188 </table>
189 </form>
190 </div>
192 <br />
194 <!-- PROJECT DELETE -->
195 <?php
196 # You must have global permissions to delete projects
197 if ( access_has_global_level ( config_get( 'delete_project_threshold' ) ) ) { ?>
198 <div class="border center">
199 <form method="post" action="manage_proj_delete.php">
200 <?php echo form_security_field( 'manage_proj_delete' ) ?>
201 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
202 <input type="submit" class="button" value="<?php echo lang_get( 'delete_project_button' ) ?>" />
203 </form>
204 </div>
205 <?php } ?>
207 <br />
209 <?php
210 # reset the class counter
211 helper_alternate_class( 0 );
214 <!-- SUBPROJECTS -->
215 <div align="center">
216 <table class="width75" cellspacing="1">
218 <!-- Title -->
219 <tr>
220 <td class="form-title" colspan="6">
221 <?php
222 echo lang_get( 'subprojects' );
224 # Check the user's global access level before allowing project creation
225 if ( access_has_global_level ( config_get( 'create_project_threshold' ) ) ) {
226 print_button( 'manage_proj_create_page.php?parent_id=' . $f_project_id, lang_get( 'create_new_subproject_link' ) );
229 </td>
230 </tr>
232 <!-- Subprojects -->
233 <form name="update_children_form" action="manage_proj_update_children.php" method="post">
234 <?php echo form_security_field( 'manage_proj_update_children' ) ?>
235 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
236 <?php
237 $t_subproject_ids = current_user_get_accessible_subprojects( $f_project_id, /* show_disabled */ true );
239 if ( Array() != $t_subproject_ids ) {
241 <tr class="row-category">
242 <td width="20%">
243 <?php echo lang_get( 'name' ) ?>
244 </td>
245 <td width="10%">
246 <?php echo lang_get( 'status' ) ?>
247 </td>
248 <td width="10%">
249 <?php echo lang_get( 'enabled' ) ?>
250 </td>
251 <td width="10%">
252 <?php echo lang_get( 'inherit' ) ?>
253 </td>
254 <td width="10%">
255 <?php echo lang_get( 'view_status' ) ?>
256 </td>
257 <td width="20%">
258 <?php echo lang_get( 'description' ) ?>
259 </td>
260 <td width="20%">
261 <?php echo lang_get( 'actions' ) ?>
262 </td>
263 </tr>
265 <?php
266 foreach ( $t_subproject_ids as $t_subproject_id ) {
267 $t_subproject = project_get_row( $t_subproject_id );
268 $t_inherit_parent = project_hierarchy_inherit_parent( $t_subproject_id, $f_project_id, true );
270 <tr <?php echo helper_alternate_class() ?>>
271 <td>
272 <a href="manage_proj_edit_page.php?project_id=<?php echo $t_subproject['id'] ?>"><?php echo string_display( $t_subproject['name'] ) ?></a>
273 </td>
274 <td class="center">
275 <?php echo get_enum_element( 'project_status', $t_subproject['status'] ) ?>
276 </td>
277 <td class="center">
278 <?php echo trans_bool( $t_subproject['enabled'] ) ?>
279 </td>
280 <td class="center">
281 <input type="checkbox" name="inherit_child_<?php echo $t_subproject_id ?>" <?php echo ( $t_inherit_parent ? 'checked="checked"' : '' ) ?> />
282 </td>
283 <td class="center">
284 <?php echo get_enum_element( 'project_view_state', $t_subproject['view_state'] ) ?>
285 </td>
286 <td>
287 <?php echo string_display_links( $t_subproject['description'] ) ?>
288 </td>
289 <td class="center">
290 <?php
291 print_bracket_link( 'manage_proj_edit_page.php?project_id=' . $t_subproject['id'], lang_get( 'edit_link' ) );
292 print_bracket_link( "manage_proj_subproj_delete.php?project_id=$f_project_id&subproject_id=" . $t_subproject['id'] . form_security_param( 'manage_proj_subproj_delete' ), lang_get( 'unlink_link' ) );
294 </td>
295 </tr>
296 <?php
297 } # End of foreach loop over subprojects
298 } # End of hiding subproject listing if there are no subprojects
301 <tr>
302 <td colspan="6">
303 <input type="submit" value="<?php echo lang_get( 'update_subproject_inheritance' ) ?>" />
304 </form>
305 </td>
306 </tr>
308 <!-- Add subproject -->
309 <tr>
310 <td colspan="7">
311 <form method="post" action="manage_proj_subproj_add.php">
312 <?php echo form_security_field( 'manage_proj_subproj_add' ) ?>
313 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
314 <select name="subproject_id">
315 <?php
316 $t_all_subprojects = project_hierarchy_get_subprojects( $f_project_id, /* $p_show_disabled */ true );
317 $t_all_subprojects[] = $f_project_id;
318 $t_manage_access = config_get( 'manage_project_threshold' );
320 $t_projects = project_get_all_rows();
322 $t_projects = multi_sort( $t_projects, 'name', ASCENDING );
324 foreach ( $t_projects as $t_project ) {
325 if ( in_array( $t_project['id'], $t_all_subprojects ) ||
326 in_array( $f_project_id, project_hierarchy_get_all_subprojects( $t_project['id'] ) ) ||
327 !access_has_project_level( $t_manage_access, $t_project['id'] ) ) {
328 continue;
331 <option value="<?php echo $t_project['id'] ?>"><?php echo string_attribute( $t_project['name'] ) ?></option>
332 <?php
333 } # End looping over projects
335 </select>
336 <input type="submit" value="<?php echo lang_get('add_subproject'); ?>">
337 </form>
338 </td>
339 </tr>
341 </table>
342 </div>
344 <br />
346 <!-- PROJECT CATEGORIES -->
347 <a name="categories" />
348 <div align="center">
349 <table class="width75" cellspacing="1">
351 <!-- Title -->
352 <tr>
353 <td class="form-title" colspan="3">
354 <?php echo lang_get( 'categories' ) ?>
355 </td>
356 </tr>
357 <?php
358 $t_categories = category_get_all_rows( $f_project_id );
360 if ( count( $t_categories ) > 0 ) {
362 <tr class="row-category">
363 <td>
364 <?php echo lang_get( 'category' ) ?>
365 </td>
366 <td>
367 <?php echo lang_get( 'assign_to' ) ?>
368 </td>
369 <td class="center">
370 <?php echo lang_get( 'actions' ) ?>
371 </td>
372 </tr>
373 <?php
376 foreach ( $t_categories as $t_category ) {
377 $t_id = $t_category['id'];
379 if ( $t_category['project_id'] != $f_project_id ) {
380 $t_inherited = true;
381 } else {
382 $t_inherited = false;
385 $t_name = $t_category['name'];
386 if ( NO_USER != $t_category['user_id'] && user_exists( $t_category['user_id'] )) {
387 $t_user_name = user_get_name( $t_category['user_id'] );
388 } else {
389 $t_user_name = '';
392 <!-- Repeated Info Row -->
393 <tr <?php echo helper_alternate_class() ?>>
394 <td>
395 <?php echo string_display( category_full_name( $t_category['id'] , /* showProject */ $t_inherited, $f_project_id ) ) ?>
396 </td>
397 <td>
398 <?php echo string_display_line( $t_user_name ) ?>
399 </td>
400 <td class="center">
401 <?php if ( !$t_inherited ) {
402 $t_id = urlencode( $t_id );
403 $t_project_id = urlencode( $f_project_id );
405 print_button( 'manage_proj_cat_edit_page.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get( 'edit_link' ) );
406 echo '&nbsp;';
407 print_button( 'manage_proj_cat_delete.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get( 'delete_link' ) );
408 } ?>
409 </td>
410 </tr>
411 <?php
412 } # end for loop
415 <!-- Add Category Form -->
416 <tr>
417 <td class="left" colspan="3">
418 <form method="post" action="manage_proj_cat_add.php">
419 <?php echo form_security_field( 'manage_proj_cat_add' ) ?>
420 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
421 <input type="text" name="name" size="32" maxlength="128" />
422 <input type="submit" class="button" value="<?php echo lang_get( 'add_category_button' ) ?>" />
423 </form>
424 </td>
425 </tr>
427 <!-- Copy Categories Form -->
428 <tr>
429 <td class="left" colspan="3">
430 <form method="post" action="manage_proj_cat_copy.php">
431 <?php echo form_security_field( 'manage_proj_cat_copy' ) ?>
432 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
433 <select name="other_project_id">
434 <?php print_project_option_list( null, false, $f_project_id ); ?>
435 </select>
436 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_categories_from' ) ?>" />
437 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_categories_to' ) ?>" />
438 </form>
439 </td>
440 </tr>
441 </table>
443 <br />
445 <?php
446 # reset the class counter
447 helper_alternate_class( 0 );
450 <!-- PROJECT VERSIONS -->
451 <a name="versions" />
452 <table class="width75" cellspacing="1">
454 <!-- Title -->
455 <tr>
456 <td class="form-title" colspan="3">
457 <?php echo lang_get( 'versions' ) ?>
458 </td>
459 </tr>
460 <?php
461 $t_versions = version_get_all_rows( $f_project_id, /* released = */ null, /* obsolete = */ null );
463 if ( count( $t_versions ) > 0 ) {
465 <tr class="row-category">
466 <td>
467 <?php echo lang_get( 'version' ) ?>
468 </td>
469 <td class="center">
470 <?php echo lang_get( 'released' ) ?>
471 </td>
472 <td class="center">
473 <?php echo lang_get( 'obsolete' ) ?>
474 </td>
475 <td class="center">
476 <?php echo lang_get( 'timestamp' ) ?>
477 </td>
478 <td class="center">
479 <?php echo lang_get( 'actions' ) ?>
480 </td>
481 </tr>
482 <?php
485 foreach ( $t_versions as $t_version ) {
486 if ( $t_version['project_id'] != $f_project_id ) {
487 $t_inherited = true;
488 } else {
489 $t_inherited = false;
492 $t_name = version_full_name( $t_version['id'], /* showProject */ $t_inherited, $f_project_id );
494 $t_released = $t_version['released'];
495 $t_obsolete = $t_version['obsolete'];
496 if( !date_is_null( $t_version['date_order'] ) ) {
497 $t_date_formatted = date( config_get( 'complete_date_format' ), $t_version['date_order'] );
498 } else {
499 $t_date_formatted = ' ';
502 <!-- Repeated Info Rows -->
503 <tr <?php echo helper_alternate_class() ?>>
504 <td>
505 <?php echo string_display( $t_name ) ?>
506 </td>
507 <td class="center">
508 <?php echo trans_bool( $t_released ) ?>
509 </td>
510 <td class="center">
511 <?php echo trans_bool( $t_obsolete ) ?>
512 </td>
513 <td class="center">
514 <?php echo $t_date_formatted ?>
515 </td>
516 <td class="center">
517 <?php
518 $t_version_id = version_get_id( $t_name, $f_project_id );
520 if ( !$t_inherited ) {
521 print_button( 'manage_proj_ver_edit_page.php?version_id=' . $t_version_id, lang_get( 'edit_link' ) );
522 echo '&nbsp;';
523 print_button( 'manage_proj_ver_delete.php?version_id=' . $t_version_id, lang_get( 'delete_link' ) );
526 </td>
527 </tr>
528 <?php
529 } # end for loop
532 <!-- Version Add Form -->
533 <tr>
534 <td class="left" colspan="3">
535 <form method="post" action="manage_proj_ver_add.php">
536 <?php echo form_security_field( 'manage_proj_ver_add' ) ?>
537 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
538 <input type="text" name="version" size="32" maxlength="64" />
539 <input type="submit" name="add_version" class="button" value="<?php echo lang_get( 'add_version_button' ) ?>" />
540 <input type="submit" name="add_and_edit_version" class="button" value="<?php echo lang_get( 'add_and_edit_version_button' ) ?>" />
541 </form>
542 </td>
543 </tr>
544 <tr>
545 <td class="left" colspan="3">
546 <form method="post" action="manage_proj_ver_copy.php">
547 <?php echo form_security_field( 'manage_proj_ver_copy' ) ?>
548 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
549 <select name="other_project_id">
550 <?php print_project_option_list( null, false, $f_project_id ); ?>
551 </select>
552 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_versions_from' ) ?>" />
553 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_versions_to' ) ?>" />
554 </form>
555 </td>
556 </tr>
557 </table>
558 </div>
561 <?php
562 # reset the class counter
563 helper_alternate_class( 0 );
566 <!-- PROJECT CUSTOM FIELD -->
567 <a name="customfields" />
569 <?php
570 # You need either global permissions or project-specific permissions to link
571 # custom fields
572 if ( access_has_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ) &&
573 ( count( custom_field_get_ids() ) > 0 ) ) {
575 <br />
576 <div align="center">
577 <table class="width75" cellspacing="1">
578 <tr>
579 <td class="form-title" colspan="3">
580 <?php echo lang_get( 'custom_fields_setup' ) ?>
581 </td>
582 </tr>
583 <?php
584 $t_custom_fields = custom_field_get_linked_ids( $f_project_id );
586 if ( count( $t_custom_fields ) > 0 ) {
588 <tr class="row-category">
589 <td width="50%">
590 <?php echo lang_get( 'custom_field' ) ?>
591 </td>
592 <td width="25%">
593 <?php echo lang_get( 'custom_field_sequence' ) ?>
594 </td>
595 <td class="center" width="25%">
596 <?php echo lang_get( 'actions' ); ?>
597 </td>
598 </tr>
599 <?php
600 $t_index = 0;
602 foreach( $t_custom_fields as $t_field_id ) {
603 $t_desc = custom_field_get_definition( $t_field_id );
605 <tr <?php echo helper_alternate_class() ?>>
606 <td>
607 <?php echo string_display( $t_desc['name'] ) ?>
608 </td>
609 <td>
610 <form method="post" action="manage_proj_custom_field_update.php">
611 <?php echo form_security_field( 'manage_proj_custom_field_update' ) ?>
612 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
613 <input type="hidden" name="field_id" value="<?php echo $t_field_id ?>" />
614 <input type="text" name="sequence" value="<?php echo custom_field_get_sequence( $t_field_id, $f_project_id ) ?>" size="2" />
615 <input type="submit" class="button-small" value="<?php echo lang_get( 'update' ) ?>" />
616 </form>
617 <?php
618 $t_index++;
620 </td>
621 <td class="center">
622 <?php
623 # You need global permissions to edit custom field defs
624 print_button( "manage_proj_custom_field_remove.php?field_id=$t_field_id&project_id=$f_project_id", lang_get( 'remove_link' ) );
626 </td>
627 </tr>
628 <?php
629 } # end for loop
632 <tr>
633 <td class="left" colspan="3">
634 <form method="post" action="manage_proj_custom_field_add_existing.php">
635 <?php echo form_security_field( 'manage_proj_custom_field_add_existing' ) ?>
636 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
637 <select name="field_id">
638 <?php
639 $t_custom_fields = custom_field_get_ids();
641 foreach( $t_custom_fields as $t_field_id )
643 if( !custom_field_is_linked( $t_field_id, $f_project_id ) ) {
644 $t_desc = custom_field_get_definition( $t_field_id );
645 echo "<option value=\"$t_field_id\">" . string_attribute( $t_desc['name'] ) . '</option>' ;
649 </select>
650 <input type="submit" class="button" value="<?php echo lang_get( 'add_existing_custom_field' ) ?>" />
651 </form>
652 </td>
653 </tr>
654 <tr>
655 <td class="left" colspan="3">
656 <form method="post" action="manage_proj_custom_field_copy.php">
657 <?php echo form_security_field( 'manage_proj_custom_field_copy' ) ?>
658 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
659 <select name="other_project_id">
660 <?php print_project_option_list( null, false, $f_project_id ); ?>
661 </select>
662 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_from' ) ?>" />
663 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_to' ) ?>" />
664 </form>
665 </td>
666 </tr>
667 </table>
668 </div>
669 <?php
672 event_signal( 'EVENT_MANAGE_PROJECT_PAGE', array( $f_project_id ) );
675 <!-- PROJECT VIEW STATUS -->
676 <br />
677 <div align="center">
678 <table class="width75" cellspacing="1">
679 <tr>
680 <td class="center">
681 <?php
682 if ( VS_PUBLIC == project_get_field( $f_project_id, 'view_state' ) ) {
683 echo lang_get( 'public_project_msg' );
684 } else {
685 echo lang_get( 'private_project_msg' );
688 </td>
689 </tr>
690 </table>
691 </div>
694 <!-- USER MANAGEMENT (ADD) -->
695 <?php
696 # We want to allow people with global permissions and people with high enough
697 # permissions on the project we are editing
698 if ( $t_can_manage_users ) {
700 <br />
701 <br />
702 <div align="center">
703 <table class="width75" cellspacing="1">
704 <form method="post" action="manage_proj_user_add.php">
705 <?php echo form_security_field( 'manage_proj_user_add' ) ?>
706 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
707 <tr>
708 <td class="form-title" colspan="5">
709 <?php echo lang_get( 'add_user_title' ) ?>
710 </td>
711 </tr>
712 <tr class="row-1" valign="top">
713 <td class="category">
714 <?php echo lang_get( 'username' ) ?>
715 </td>
716 <td class="category">
717 <?php echo lang_get( 'access_level' ) ?>
718 </td>
719 <td class="category">&nbsp; </td>
720 </tr>
721 <tr class="row-1" valign="top">
722 <td>
723 <select name="user_id[]" multiple="multiple" size="10">
724 <?php print_project_user_list_option_list( $f_project_id ) ?>
725 </select>
726 </td>
727 <td>
728 <select name="access_level">
729 <?php
730 # only access levels that are less than or equal current user access level for current project
731 print_project_access_levels_option_list( config_get( 'default_new_account_access_level' ), $f_project_id );
733 </select>
734 </td>
735 <td>
736 <input type="submit" class="button" value="<?php echo lang_get( 'add_user_button' ) ?>" />
737 </td>
738 </tr>
739 </form>
740 <!-- Copy Users Form -->
741 <form method="post" action="manage_proj_user_copy.php">
742 <?php echo form_security_field( 'manage_proj_user_copy' ) ?>
743 <tr>
744 <td class="left" colspan="3">
745 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
746 <select name="other_project_id">
747 <?php print_project_option_list( null, false, $f_project_id ); ?>
748 </select>
749 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_users_from' ) ?>" />
750 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_users_to' ) ?>" />
751 </td>
752 </tr>
753 </form>
754 </table>
755 </div>
756 <?php
761 <!-- LIST OF USERS -->
762 <br />
763 <div align="center">
764 <table class="width75" cellspacing="1">
765 <tr>
766 <td class="form-title" colspan="4">
767 <?php echo lang_get( 'manage_accounts_title' ) ?>
768 </td>
769 </tr>
770 <tr class="row-category">
771 <td>
772 <?php echo lang_get( 'username' ) ?>
773 </td>
774 <td>
775 <?php echo lang_get( 'email' ) ?>
776 </td>
777 <td>
778 <?php echo lang_get( 'access_level' ) ?>
779 </td>
780 <td class="center">
781 <?php echo lang_get( 'actions' ) ?>
782 </td>
783 </tr>
784 <?php
785 $t_users = project_get_all_user_rows( $f_project_id, ANYBODY, $f_show_global_users );
786 $t_display = array();
787 $t_sort = array();
788 foreach ( $t_users as $t_user ) {
789 $t_user_name = string_attribute( $t_user['username'] );
790 $t_sort_name = utf8_strtolower( $t_user_name );
791 if ( ( isset( $t_user['realname'] ) ) && ( $t_user['realname'] > "" ) && ( ON == config_get( 'show_realname' ) ) ){
792 $t_user_name = string_attribute( $t_user['realname'] ) . " (" . $t_user_name . ")";
793 if ( ON == config_get( 'sort_by_last_name') ) {
794 $t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 );
795 $t_sort_name = $t_sort_name_bits[1] . ', ' . $t_sort_name_bits[1];
796 } else {
797 $t_sort_name = utf8_strtolower( $t_user_name );
800 $t_display[] = $t_user_name;
801 $t_sort[] = $t_sort_name;
804 array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display );
806 # reset the class counter
807 helper_alternate_class( 0 );
809 $t_users_count = count( $t_sort );
810 $t_removable_users_exist = false;
812 for ( $i = 0; $i < $t_users_count; $i++ ) {
813 $t_user = $t_users[$i];
815 <tr <?php echo helper_alternate_class() ?>>
816 <td>
817 <?php echo $t_display[$i] ?>
818 </td>
819 <td>
820 <?php
821 $t_email = user_get_email( $t_user['id'] );
822 print_email_link( $t_email, $t_email );
824 </td>
825 <td>
826 <?php echo get_enum_element( 'access_levels', $t_user['access_level'] ) ?>
827 </td>
828 <td class="center">
829 <?php
830 # You need global or project-specific permissions to remove users
831 # from this project
832 if ( $t_can_manage_users ) {
833 if ( project_includes_user( $f_project_id, $t_user['id'] ) ) {
834 print_button( "manage_proj_user_remove.php?project_id=$f_project_id&user_id=" . $t_user['id'], lang_get( 'remove_link' ) );
835 $t_removable_users_exist = true;
839 </td>
840 </tr>
841 <?php
842 } # end for
844 <tr>
845 <td>&nbsp; </td>
846 <td>&nbsp; </td>
847 <td>&nbsp; </td>
848 <td class="center">
849 <?php
850 # You need global or project-specific permissions to remove users
851 # from this project
852 if ( !$f_show_global_users ) {
853 print_button( "manage_proj_edit_page.php?project_id=$f_project_id&show_global_users=true", lang_get( 'show_global_users' ) );
854 } else {
855 print_button( "manage_proj_edit_page.php?project_id=$f_project_id", lang_get( 'hide_global_users' ) );
858 if ( $t_removable_users_exist ) {
859 echo '&nbsp;';
860 print_button( "manage_proj_user_remove.php?project_id=$f_project_id", lang_get( 'remove_all_link' ) );
863 </td>
864 </tr>
865 </table>
866 </div>
868 <?php
869 html_page_bottom();