| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 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. 8 # 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. 13 # 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/>. 16 17 /** 18 * @package MantisBT 19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 21 * @link http://www.mantisbt.org 22 * 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 46 */ 47 48 /** 49 * MantisBT Core API's 50 */ 51 require_once ( 'core.php' ); 52 require_api( 'access_api.php' ); 53 require_api( 'authentication_api.php' ); 54 require_api( 'category_api.php' ); 55 require_api( 'config_api.php' ); 56 require_api( 'constant_inc.php' ); 57 require_api( 'current_user_api.php' ); 58 require_api( 'custom_field_api.php' ); 59 require_api( 'date_api.php' ); 60 require_api( 'event_api.php' ); 61 require_api( 'file_api.php' ); 62 require_api( 'form_api.php' ); 63 require_api( 'gpc_api.php' ); 64 require_api( 'helper_api.php' ); 65 require_api( 'html_api.php' ); 66 require_api( 'lang_api.php' ); 67 require_api( 'print_api.php' ); 68 require_api( 'project_api.php' ); 69 require_api( 'project_hierarchy_api.php' ); 70 require_api( 'string_api.php' ); 71 require_api( 'user_api.php' ); 72 require_api( 'utility_api.php' ); 73 require_api( 'version_api.php' ); 74 75 auth_reauthenticate(); 76 77 $f_project_id = gpc_get_int( 'project_id' ); 78 $f_show_global_users = gpc_get_bool( 'show_global_users' ); 79 80 project_ensure_exists( $f_project_id ); 81 access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); 82 83 $row = project_get_row( $f_project_id ); 84 85 $t_can_manage_users = access_has_project_level( config_get( 'project_user_threshold' ), $f_project_id ); 86 87 html_page_top( project_get_field( $f_project_id, 'name' ) ); 88 89 print_manage_menu( 'manage_proj_edit_page.php' ); 90 ?> 91 92 <!-- PROJECT PROPERTIES --> 93 <div id="manage-proj-update-div" class="form-container"> 94 <form id="manage-proj-update-form" method="post" action="manage_proj_update.php"> 95 <fieldset> 96 <legend><span><?php echo lang_get( 'edit_project_title' ) ?></span></legend> 97 <?php echo form_security_field( 'manage_proj_update' ) ?> 98 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 99 <div class="field-container <?php echo helper_alternate_class_no_attribute() ?>"> 100 <label for="project-name"><span><?php echo lang_get( 'project_name' ) ?></span></label> 101 <span class="input"><input type="text" id="project-name" name="name" size="50" maxlength="128" value="<?php echo string_attribute( $row['name'] ) ?>" /></span> 102 <span class="label-style"></span> 103 </div> 104 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 105 <label for="project-status"><span><?php echo lang_get( 'status' ) ?></span></label> 106 <span class="select"> 107 <select id="project-status" name="status"> 108 <?php print_enum_string_option_list( 'project_status', $row['status'] ) ?> 109 </select> 110 </span> 111 <span class="label-style"></span> 112 </div> 113 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 114 <label for="project-enabled"><span><?php echo lang_get( 'enabled' ) ?></span></label> 115 <span class="checkbox"><input type="checkbox" id="project-enabled" name="enabled" <?php check_checked( $row['enabled'], ON ); ?> /></span> 116 <span class="label-style"></span> 117 </div> 118 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 119 <label for="project-inherit-global"><span><?php echo lang_get( 'inherit_global' ) ?></span></label> 120 <span class="checkbox"><input type="checkbox" id="project-inherit-global" name="inherit_global" <?php check_checked( $row['inherit_global'], ON ); ?> /></span> 121 <span class="label-style"></span> 122 </div> 123 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 124 <label for="project-view-state"><span><?php echo lang_get( 'view_status' ) ?></span></label> 125 <span class="select"> 126 <select id="project-view-state" name="view_state"> 127 <?php print_enum_string_option_list( 'view_state', $row['view_state']) ?> 128 </select> 129 </span> 130 <span class="label-style"></span> 131 </div> 132 <?php 133 if ( file_is_uploading_enabled() ) { ?> 134 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 135 <label for="project-file-path"><span><?php echo lang_get( 'upload_file_path' ) ?></span></label> 136 <span class="input"><input type="text" id="project-file-path" name="file_path" size="50" maxlength="250" value="<?php echo string_attribute( $row['file_path'] ) ?>" /></span> 137 <span class="label-style"></span> 138 </div><?php 139 } ?> 140 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 141 <label for="project-description"><span><?php echo lang_get( 'description' ) ?></span></label> 142 <span class="textarea"><textarea id="project-description" name="description" cols="60" rows="5"><?php echo string_textarea( $row['description'] ) ?></textarea></span> 143 <span class="label-style"></span> 144 </div> 145 146 <?php event_signal( 'EVENT_MANAGE_PROJECT_UPDATE_FORM', array( $f_project_id ) ); ?> 147 148 <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'update_project_button' ) ?>" /></span> 149 </fieldset> 150 </form> 151 </div> 152 153 <!-- PROJECT DELETE --> 154 <?php 155 # You must have global permissions to delete projects 156 if ( access_has_global_level ( config_get( 'delete_project_threshold' ) ) ) { ?> 157 <div id="project-delete-div" class="form-container"> 158 <form id="project-delete-form" method="post" action="manage_proj_delete.php" class="action-button"> 159 <fieldset> 160 <?php echo form_security_field( 'manage_proj_delete' ) ?> 161 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 162 <input type="submit" class="button" value="<?php echo lang_get( 'delete_project_button' ) ?>" /> 163 </fieldset> 164 </form> 165 </div> 166 <?php } ?> 167 168 <?php 169 # reset the class counter 170 helper_alternate_class_no_attribute( 0 ); 171 ?> 172 173 <!-- SUBPROJECTS --> 174 <div id="manage-project-update-subprojects-div" class="form-container"> 175 <h2><?php echo lang_get( 'subprojects' ); ?></h2> 176 <?php 177 # Check the user's global access level before allowing project creation 178 if ( access_has_global_level ( config_get( 'create_project_threshold' ) ) ) { 179 print_button( 'manage_proj_create_page.php?parent_id=' . $f_project_id, lang_get( 'create_new_subproject_link' ) ); 180 } ?> 181 <form id="manage-project-subproject-add-form" method="post" action="manage_proj_subproj_add.php"> 182 <fieldset> 183 <?php echo form_security_field( 'manage_proj_subproj_add' ) ?> 184 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 185 <select name="subproject_id"><?php 186 $t_all_subprojects = project_hierarchy_get_subprojects( $f_project_id, /* $p_show_disabled */ true ); 187 $t_all_subprojects[] = $f_project_id; 188 $t_manage_access = config_get( 'manage_project_threshold' ); 189 $t_projects = project_get_all_rows(); 190 $t_projects = multi_sort( $t_projects, 'name', ASCENDING ); 191 foreach ( $t_projects as $t_project ) { 192 if ( in_array( $t_project['id'], $t_all_subprojects ) || 193 in_array( $f_project_id, project_hierarchy_get_all_subprojects( $t_project['id'] ) ) || 194 !access_has_project_level( $t_manage_access, $t_project['id'] ) ) { 195 continue; 196 } ?> 197 <option value="<?php echo $t_project['id'] ?>"><?php echo string_attribute( $t_project['name'] ) ?></option><?php 198 } # End looping over projects ?> 199 </select> 200 <input type="submit" value="<?php echo lang_get('add_subproject'); ?>" /> 201 </fieldset> 202 </form> 203 <?php 204 205 $t_subproject_ids = current_user_get_accessible_subprojects( $f_project_id, /* show_disabled */ true ); 206 if ( Array() != $t_subproject_ids ) { ?> 207 <form id="manage-project-update-subprojects-form" action="manage_proj_update_children.php" method="post"> 208 <fieldset> 209 <?php echo form_security_field( 'manage_proj_update_children' ) ?> 210 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 211 <table cellspacing="1" cellpadding="5" border="1"> 212 <tr class="row-category"> 213 <th><?php echo lang_get( 'name' ) ?></th> 214 <th><?php echo lang_get( 'status' ) ?></th> 215 <th><?php echo lang_get( 'enabled' ) ?></th> 216 <th><?php echo lang_get( 'inherit' ) ?></th> 217 <th><?php echo lang_get( 'view_status' ) ?></th> 218 <th><?php echo lang_get( 'description' ) ?></th> 219 <th colspan="2"><?php echo lang_get( 'actions' ) ?></th> 220 </tr><?php 221 foreach ( $t_subproject_ids as $t_subproject_id ) { 222 $t_subproject = project_get_row( $t_subproject_id ); 223 $t_inherit_parent = project_hierarchy_inherit_parent( $t_subproject_id, $f_project_id, true ); ?> 224 <tr <?php echo helper_alternate_class() ?>> 225 <td> 226 <a href="manage_proj_edit_page.php?project_id=<?php echo $t_subproject['id'] ?>"><?php echo string_display( $t_subproject['name'] ) ?></a> 227 </td> 228 <td class="center"> 229 <?php echo get_enum_element( 'project_status', $t_subproject['status'] ) ?> 230 </td> 231 <td class="center"> 232 <?php echo trans_bool( $t_subproject['enabled'] ) ?> 233 </td> 234 <td class="center"> 235 <input type="checkbox" name="inherit_child_<?php echo $t_subproject_id ?>" <?php echo ( $t_inherit_parent ? 'checked="checked"' : '' ) ?> /> 236 </td> 237 <td class="center"> 238 <?php echo get_enum_element( 'project_view_state', $t_subproject['view_state'] ) ?> 239 </td> 240 <td> 241 <?php echo string_display_links( $t_subproject['description'] ) ?> 242 </td> 243 <td class="center"><?php 244 print_bracket_link( 'manage_proj_edit_page.php?project_id=' . $t_subproject['id'], lang_get( 'edit_link' ) ); ?> 245 </td> 246 <td class="center"><?php 247 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' ) ); 248 ?> 249 </td> 250 </tr><?php 251 } # End of foreach loop over subprojects ?> 252 </table> 253 <span class="submit-button"><input type="submit" value="<?php echo lang_get( 'update_subproject_inheritance' ) ?>" /></span> 254 </fieldset> 255 </form><?php 256 } # End of hiding subproject listing if there are no subprojects ?> 257 258 </div> 259 260 <div id="categories" class="form-container"> 261 <h2><?php echo lang_get( 'categories' ); ?></h2> 262 <form id="manage-project-category-copy-form" method="post" action="manage_proj_cat_copy.php"> 263 <fieldset> 264 <?php echo form_security_field( 'manage_proj_cat_copy' ) ?> 265 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 266 <select name="other_project_id"> 267 <?php print_project_option_list( null, false, $f_project_id ); ?> 268 </select> 269 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_categories_from' ) ?>" /> 270 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_categories_to' ) ?>" /> 271 </fieldset> 272 </form><?php 273 $t_categories = category_get_all_rows( $f_project_id ); 274 if ( count( $t_categories ) > 0 ) { ?> 275 <table cellspacing="1" cellpadding="5" border="1"> 276 <tr class="row-category"> 277 <th><?php echo lang_get( 'category' ) ?></th> 278 <th><?php echo lang_get( 'assign_to' ) ?></th> 279 <th colspan="2" class="center"><?php echo lang_get( 'actions' ) ?></th> 280 </tr><?php 281 282 foreach ( $t_categories as $t_category ) { 283 $t_id = $t_category['id']; 284 $t_inherited = ( $t_category['project_id'] != $f_project_id ? true : false ); 285 286 $t_name = $t_category['name']; 287 if ( NO_USER != $t_category['user_id'] && user_exists( $t_category['user_id'] )) { 288 $t_user_name = user_get_name( $t_category['user_id'] ); 289 } else { 290 $t_user_name = ''; 291 } ?> 292 293 <tr <?php echo helper_alternate_class() ?>> 294 <td><?php echo string_display( category_full_name( $t_category['id'] , /* showProject */ $t_inherited, $f_project_id ) ) ?></td> 295 <td><?php echo string_display_line( $t_user_name ) ?></td> 296 <td class="center"> 297 <?php if ( !$t_inherited ) { 298 $t_id = urlencode( $t_id ); 299 $t_project_id = urlencode( $f_project_id ); 300 301 print_button( 'manage_proj_cat_edit_page.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get( 'edit_link' ) ); 302 } ?> 303 </td> 304 <td class="center"> 305 <?php if ( !$t_inherited ) { 306 print_button( 'manage_proj_cat_delete.php?id=' . $t_id . '&project_id=' . $t_project_id, lang_get( 'delete_link' ) ); 307 } ?> 308 </td> 309 </tr><?php 310 } # end for loop ?> 311 </table><?php 312 } ?> 313 314 <form id="project-add-category-form" method="post" action="manage_proj_cat_add.php"> 315 <fieldset> 316 <?php echo form_security_field( 'manage_proj_cat_add' ) ?> 317 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 318 <input type="text" name="name" size="32" maxlength="128" /> 319 <input type="submit" class="button" value="<?php echo lang_get( 'add_category_button' ) ?>" /> 320 </fieldset> 321 </form> 322 323 </div><?php 324 325 # reset the class counter 326 helper_alternate_class( 0 ); ?> 327 328 <div id="project-versions-div" class="form-container"> 329 <h2><?php echo lang_get( 'versions' ); ?></h2> 330 <form id="manage-project-version-copy-form" method="post" action="manage_proj_ver_copy.php"> 331 <fieldset> 332 <?php echo form_security_field( 'manage_proj_ver_copy' ) ?> 333 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 334 <select name="other_project_id"> 335 <?php print_project_option_list( null, false, $f_project_id ); ?> 336 </select> 337 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_versions_from' ) ?>" /> 338 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_versions_to' ) ?>" /> 339 </fieldset> 340 </form><?php 341 342 $t_versions = version_get_all_rows( $f_project_id, /* released = */ null, /* obsolete = */ null ); 343 if ( count( $t_versions ) > 0 ) { ?> 344 <table id="versions" cellspacing="1" cellpadding="5" border="1"> 345 <tr class="row-category"> 346 <th><?php echo lang_get( 'version' ) ?></th> 347 <th><?php echo lang_get( 'released' ) ?></th> 348 <th><?php echo lang_get( 'obsolete' ) ?></th> 349 <th><?php echo lang_get( 'timestamp' ) ?></th> 350 <th colspan="2"><?php echo lang_get( 'actions' ) ?></th> 351 </tr><?php 352 353 foreach ( $t_versions as $t_version ) { 354 $t_inherited = ( $t_version['project_id'] != $f_project_id ? true : false ); 355 $t_name = version_full_name( $t_version['id'], /* showProject */ $t_inherited, $f_project_id ); 356 $t_released = $t_version['released']; 357 $t_obsolete = $t_version['obsolete']; 358 if( !date_is_null( $t_version['date_order'] ) ) { 359 $t_date_formatted = date( config_get( 'complete_date_format' ), $t_version['date_order'] ); 360 } else { 361 $t_date_formatted = ' '; 362 } ?> 363 364 <tr <?php echo helper_alternate_class() ?>> 365 <td><?php echo string_display( $t_name ) ?></td> 366 <td><?php echo trans_bool( $t_released ) ?></td> 367 <td><?php echo trans_bool( $t_obsolete ) ?></td> 368 <td><?php echo $t_date_formatted ?></td> 369 <td><?php 370 $t_version_id = version_get_id( $t_name, $f_project_id ); 371 if ( !$t_inherited ) { 372 print_button( 'manage_proj_ver_edit_page.php?version_id=' . $t_version_id, lang_get( 'edit_link' ) ); 373 } ?> 374 </td> 375 <td><?php 376 if ( !$t_inherited ) { 377 print_button( 'manage_proj_ver_delete.php?version_id=' . $t_version_id, lang_get( 'delete_link' ) ); 378 } ?> 379 </td> 380 </tr><?php 381 } # end for loop ?> 382 </table><?php 383 } ?> 384 <form id="manage-project-add-version-form" method="post" action="manage_proj_ver_add.php"> 385 <fieldset> 386 <?php echo form_security_field( 'manage_proj_ver_add' ) ?> 387 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 388 <input type="text" name="version" size="32" maxlength="64" /> 389 <input type="submit" name="add_version" class="button" value="<?php echo lang_get( 'add_version_button' ) ?>" /> 390 <input type="submit" name="add_and_edit_version" class="button" value="<?php echo lang_get( 'add_and_edit_version_button' ) ?>" /> 391 </fieldset> 392 </form> 393 </div><?php 394 395 # reset the class counter 396 helper_alternate_class( 0 ); 397 398 # You need either global permissions or project-specific permissions to link 399 # custom fields 400 $t_custom_field_count = count( custom_field_get_ids() ); 401 if ( access_has_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ) && 402 ( $t_custom_field_count > 0 ) ) { 403 ?> 404 <div id="customfields" class="form-container"> 405 <h2><?php echo lang_get( 'custom_fields_setup' ) ?></h2> 406 <form id="manage-project-custom-field-copy-form" method="post" action="manage_proj_custom_field_copy.php"> 407 <fieldset> 408 <?php echo form_security_field( 'manage_proj_custom_field_copy' ) ?> 409 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 410 <select name="other_project_id"> 411 <?php print_project_option_list( null, false, $f_project_id ); ?> 412 </select> 413 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_from' ) ?>" /> 414 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_to' ) ?>" /> 415 </fieldset> 416 </form><?php 417 $t_custom_fields = custom_field_get_linked_ids( $f_project_id ); 418 $t_linked_count = count( $t_custom_fields ); 419 if ( $t_linked_count > 0 ) { ?> 420 <table cellspacing="1" cellpadding="5" border="1"> 421 <tr class="row-category"> 422 <th><?php echo lang_get( 'custom_field' ) ?></th> 423 <th><?php echo lang_get( 'custom_field_sequence' ) ?></th> 424 <th><?php echo lang_get( 'actions' ); ?></th> 425 </tr><?php 426 foreach( $t_custom_fields as $t_field_id ) { 427 $t_desc = custom_field_get_definition( $t_field_id ); ?> 428 <tr <?php echo helper_alternate_class() ?>> 429 <td><?php echo string_display( $t_desc['name'] ) ?></td> 430 <td> 431 <form method="post" action="manage_proj_custom_field_update.php"> 432 <fieldset> 433 <?php echo form_security_field( 'manage_proj_custom_field_update' ) ?> 434 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 435 <input type="hidden" name="field_id" value="<?php echo $t_field_id ?>" /> 436 <input type="text" name="sequence" value="<?php echo custom_field_get_sequence( $t_field_id, $f_project_id ) ?>" size="2" /> 437 <input type="submit" class="button-small" value="<?php echo lang_get( 'update' ) ?>" /> 438 </fieldset> 439 </form> 440 </td> 441 <td><?php 442 # You need global permissions to edit custom field defs 443 print_button( "manage_proj_custom_field_remove.php?field_id=$t_field_id&project_id=$f_project_id", lang_get( 'remove_link' ) ); ?> 444 </td> 445 </tr><?php 446 } # end for loop ?> 447 </table><?php 448 } 449 450 if( $t_custom_field_count > $t_linked_count ) { ?> 451 <form method="post" action="manage_proj_custom_field_add_existing.php"> 452 <fieldset> 453 <?php echo form_security_field( 'manage_proj_custom_field_add_existing' ) ?> 454 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 455 <select name="field_id"> 456 <?php 457 $t_custom_fields = custom_field_get_ids(); 458 459 foreach( $t_custom_fields as $t_field_id ) 460 { 461 if( !custom_field_is_linked( $t_field_id, $f_project_id ) ) { 462 $t_desc = custom_field_get_definition( $t_field_id ); 463 echo "<option value=\"$t_field_id\">" . string_attribute( $t_desc['name'] ) . '</option>' ; 464 } 465 } 466 ?> 467 </select> 468 <input type="submit" class="button" value="<?php echo lang_get( 'add_existing_custom_field' ) ?>" /> 469 </fieldset> 470 </form><?php 471 } ?> 472 </div><?php 473 } 474 475 event_signal( 'EVENT_MANAGE_PROJECT_PAGE', array( $f_project_id ) ); 476 ?> 477 478 <div class="important-msg"><?php 479 if ( VS_PUBLIC == project_get_field( $f_project_id, 'view_state' ) ) { 480 echo lang_get( 'public_project_msg' ); 481 } else { 482 echo lang_get( 'private_project_msg' ); 483 } ?> 484 </div> 485 486 <div id="manage-project-users-div" class="form-container"> 487 <h2><?php echo lang_get( 'manage_accounts_title' ) ?></h2> 488 <form id="manage-project-users-copy-form" method="post" action="manage_proj_user_copy.php"> 489 <fieldset> 490 <?php echo form_security_field( 'manage_proj_user_copy' ) ?> 491 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 492 <select name="other_project_id"> 493 <?php print_project_option_list( null, false, $f_project_id ); ?> 494 </select> 495 <span class="action-button"> 496 <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_users_from' ) ?>" /> 497 <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_users_to' ) ?>" /> 498 </span> 499 </fieldset> 500 </form> 501 <table cellspacing="1" cellpadding="5" border="1"> 502 <tr class="row-category"> 503 <th><?php echo lang_get( 'username' ) ?></th> 504 <th><?php echo lang_get( 'email' ) ?></th> 505 <th><?php echo lang_get( 'access_level' ) ?></th> 506 <th><?php echo lang_get( 'actions' ) ?></th> 507 </tr><?php 508 $t_users = project_get_all_user_rows( $f_project_id, ANYBODY, $f_show_global_users ); 509 $t_display = array(); 510 $t_sort = array(); 511 foreach ( $t_users as $t_user ) { 512 $t_user_name = string_attribute( $t_user['username'] ); 513 $t_sort_name = utf8_strtolower( $t_user_name ); 514 if ( ( isset( $t_user['realname'] ) ) && ( $t_user['realname'] > "" ) && ( ON == config_get( 'show_realname' ) ) ){ 515 $t_user_name = string_attribute( $t_user['realname'] ) . " (" . $t_user_name . ")"; 516 if ( ON == config_get( 'sort_by_last_name') ) { 517 $t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 ); 518 $t_sort_name = $t_sort_name_bits[1] . ', ' . $t_sort_name_bits[1]; 519 } else { 520 $t_sort_name = utf8_strtolower( $t_user_name ); 521 } 522 } 523 $t_display[] = $t_user_name; 524 $t_sort[] = $t_sort_name; 525 } 526 527 array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display ); 528 529 # reset the class counter 530 helper_alternate_class( 0 ); 531 532 $t_users_count = count( $t_sort ); 533 $t_removable_users_exist = false; 534 535 for ( $i = 0; $i < $t_users_count; $i++ ) { 536 $t_user = $t_users[$i]; 537 ?> 538 <tr <?php echo helper_alternate_class() ?>> 539 <td><?php echo $t_display[$i] ?></td> 540 <td> 541 <?php 542 $t_email = user_get_email( $t_user['id'] ); 543 print_email_link( $t_email, $t_email ); 544 ?> 545 </td> 546 <td><?php echo get_enum_element( 'access_levels', $t_user['access_level'] ) ?></td> 547 <td class="center"><?php 548 # You need global or project-specific permissions to remove users 549 # from this project 550 if ( $t_can_manage_users && access_has_project_level( $t_user['access_level'], $f_project_id ) ) { 551 if ( project_includes_user( $f_project_id, $t_user['id'] ) ) { 552 print_button( "manage_proj_user_remove.php?project_id=$f_project_id&user_id=" . $t_user['id'], lang_get( 'remove_link' ) ); 553 $t_removable_users_exist = true; 554 } 555 } ?> 556 </td> 557 </tr><?php 558 } # end for ?> 559 </table> 560 <?php 561 # You need global or project-specific permissions to remove users 562 # from this project 563 if ( !$f_show_global_users ) { 564 print_button( "manage_proj_edit_page.php?project_id=$f_project_id&show_global_users=true", lang_get( 'show_global_users' ) ); 565 } else { 566 print_button( "manage_proj_edit_page.php?project_id=$f_project_id", lang_get( 'hide_global_users' ) ); 567 } 568 569 if ( $t_removable_users_exist ) { 570 echo ' '; 571 print_button( "manage_proj_user_remove.php?project_id=$f_project_id", lang_get( 'remove_all_link' ) ); 572 } 573 574 # We want to allow people with global permissions and people with high enough 575 # permissions on the project we are editing 576 if ( $t_can_manage_users ) { 577 $t_users = user_get_unassigned_by_project_id( $f_project_id ); 578 if( count( $t_users ) > 0 ) { ?> 579 <form id="manage-project-add-user-form" method="post" action="manage_proj_user_add.php"> 580 <fieldset> 581 <legend><span><?php echo lang_get( 'add_user_title' ) ?></span></legend> 582 <?php echo form_security_field( 'manage_proj_user_add' ) ?> 583 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 584 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 585 <label for="project-add-users-username"><span><?php echo lang_get( 'username' ) ?></span></label> 586 <span class="select"> 587 <select id="project-add-users-username" name="user_id[]" multiple="multiple" size="10"><?php 588 foreach( $t_users AS $t_user_id=>$t_display_name ) { 589 echo '<option value="', $t_user_id, '">', $t_display_name, '</option>'; 590 } ?> 591 </select> 592 </span> 593 <span class="label-style"></span> 594 </div> 595 <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>"> 596 <label for="project-add-users-access-level"><span><?php echo lang_get( 'access_level' ) ?></span></label> 597 <span class="select"> 598 <select id="project-add-users-access-level" name="access_level"><?php 599 # only access levels that are less than or equal current user access level for current project 600 print_project_access_levels_option_list( config_get( 'default_new_account_access_level' ), $f_project_id ); ?> 601 </select> 602 </span> 603 <span class="label-style"></span> 604 </div> 605 <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'add_user_button' ) ?>" /></span> 606 </fieldset> 607 </form> 608 <?php 609 } 610 } 611 ?> 612 </div><?php 613 614 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |