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 * Edit Project Page 19 * 20 * @package MantisBT 21 * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 22 * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net 23 * @link http://www.mantisbt.org 24 * 25 * @uses core.php 26 * @uses access_api.php 27 * @uses authentication_api.php 28 * @uses category_api.php 29 * @uses config_api.php 30 * @uses constant_inc.php 31 * @uses current_user_api.php 32 * @uses custom_field_api.php 33 * @uses date_api.php 34 * @uses event_api.php 35 * @uses file_api.php 36 * @uses form_api.php 37 * @uses gpc_api.php 38 * @uses helper_api.php 39 * @uses html_api.php 40 * @uses lang_api.php 41 * @uses print_api.php 42 * @uses project_api.php 43 * @uses project_hierarchy_api.php 44 * @uses string_api.php 45 * @uses user_api.php 46 * @uses utility_api.php 47 * @uses version_api.php 48 */ 49 50require_once( 'core.php' ); 51require_api( 'access_api.php' ); 52require_api( 'authentication_api.php' ); 53require_api( 'category_api.php' ); 54require_api( 'config_api.php' ); 55require_api( 'constant_inc.php' ); 56require_api( 'current_user_api.php' ); 57require_api( 'custom_field_api.php' ); 58require_api( 'date_api.php' ); 59require_api( 'event_api.php' ); 60require_api( 'file_api.php' ); 61require_api( 'form_api.php' ); 62require_api( 'gpc_api.php' ); 63require_api( 'helper_api.php' ); 64require_api( 'html_api.php' ); 65require_api( 'lang_api.php' ); 66require_api( 'print_api.php' ); 67require_api( 'project_api.php' ); 68require_api( 'project_hierarchy_api.php' ); 69require_api( 'string_api.php' ); 70require_api( 'user_api.php' ); 71require_api( 'utility_api.php' ); 72require_api( 'version_api.php' ); 73 74auth_reauthenticate(); 75 76$f_project_id = gpc_get_int( 'project_id' ); 77$f_show_global_users = gpc_get_bool( 'show_global_users' ); 78 79project_ensure_exists( $f_project_id ); 80$g_project_override = $f_project_id; 81access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); 82 83$t_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 87require_js( 'manage_proj_edit_page.js' ); 88 89layout_page_header( project_get_field( $f_project_id, 'name' ) ); 90 91layout_page_begin( 'manage_overview_page.php' ); 92 93print_manage_menu( 'manage_proj_edit_page.php' ); 94?> 95 96<!-- PROJECT PROPERTIES --> 97<div class="col-md-12 col-xs-12"> 98 <div class="space-10"></div> 99 <div id="manage-proj-update-div" class="form-container"> 100 <form id="manage-proj-update-form" method="post" action="manage_proj_update.php"> 101<div class="widget-box widget-color-blue2"> 102<div class="widget-header widget-header-small"> 103<h4 class="widget-title lighter"> 104 <?php print_icon( 'fa-puzzle-piece', 'ace-icon' ); ?> 105 <?php echo lang_get('edit_project_title') ?> 106</h4> 107</div> 108 109<div class="widget-body"> 110<div class="widget-main no-padding"> 111 <div class="table-responsive"> 112 <table class="table table-bordered table-condensed table-striped"> 113 <fieldset> 114 <?php echo form_security_field( 'manage_proj_update' ) ?> 115 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 116 <tr> 117 <td class="category"> 118 <label for="project-name"> 119 <span class="required">*</span> 120 <?php echo lang_get( 'project_name' ) ?> 121 </label> 122 </td> 123 <td> 124 <input type="text" id="project-name" name="name" required 125 class="input-sm" size="60" maxlength="128" 126 value="<?php echo string_attribute( $t_row['name'] ) ?>" 127 /> 128 </td> 129 </tr> 130 <tr> 131 <td class="category"> 132 <label for="project-status"> 133 <?php echo lang_get( 'status' ) ?> 134 </label> 135 </td> 136 <td> 137 <select id="project-status" name="status" class="input-sm"> 138 <?php print_enum_string_option_list( 'project_status', (int)$t_row['status'] ) ?> 139 </select> 140 </td> 141 </tr> 142 <tr> 143 <td class="category"> 144 <label for="project-enabled"> 145 <?php echo lang_get( 'enabled' ) ?> 146 </label> 147 </td> 148 <td> 149 <input type="checkbox" id="project-enabled" name="enabled" class="ace" 150 <?php check_checked( (int)$t_row['enabled'], ON ); ?> 151 /> 152 <span class="lbl"></span> 153 </td> 154 </tr> 155 <tr> 156 <td class="category"> 157 <label for="project-inherit-global"> 158 <?php echo lang_get( 'inherit_global' ) ?> 159 </label> 160 </td> 161 <td> 162 <input type="checkbox" id="project-inherit-global" name="inherit_global" class="ace" 163 <?php check_checked( (int)$t_row['inherit_global'], ON ); ?> 164 /> 165 <span class="lbl"></span> 166 </td> 167 </tr> 168 169 <tr> 170 <td class="category"> 171 <label for="project-view-state"> 172 <?php echo lang_get( 'view_status' ) ?> 173 </label> 174 </td> 175 <td> 176 <select id="project-view-state" name="view_state" class="input-sm"> 177 <?php print_enum_string_option_list( 'project_view_state', (int)$t_row['view_state']) ?> 178 </select> 179 </td> 180 </tr> 181 <?php 182 $g_project_override = $f_project_id; 183 if( file_is_uploading_enabled() && DATABASE !== config_get( 'file_upload_method' ) ) { 184 $t_file_path = $t_row['file_path']; 185 # Don't reveal the absolute path to non-administrators for security reasons 186 if( is_blank( $t_file_path ) && current_user_is_administrator() ) { 187 $t_file_path = config_get_global( 'absolute_path_default_upload_folder' ); 188 } 189 ?> 190 <tr> 191 <td class="category"> 192 <label for="project-file-path"> 193 <?php echo lang_get( 'upload_file_path' ) ?> 194 </label> 195 </td> 196 <td> 197 <input type="text" id="project-file-path" name="file_path" 198 class="input-sm" size="60" maxlength="250" 199 value="<?php echo string_attribute( $t_file_path ) ?>" 200 /> 201 </td> 202 </tr><?php 203 } ?> 204 <tr> 205 <td class="category"> 206 <label for="project-description"> 207 <?php echo lang_get( 'description' ) ?> 208 </label> 209 </td> 210 <td> 211 <?php # Newline after opening textarea tag is intentional, see #25839 ?> 212 <textarea class="form-control" id="project-description" name="description" cols="70" rows="5"> 213<?php echo string_textarea( $t_row['description'] ) ?> 214</textarea> 215 </td> 216 </tr> 217 218 <?php event_signal( 'EVENT_MANAGE_PROJECT_UPDATE_FORM', array( $f_project_id ) ); ?> 219 </fieldset> 220 </table> 221 </div> 222 </div> 223 </div> 224 <div class="widget-toolbox padding-8 clearfix"> 225 <span class="required pull-right"> * <?php echo lang_get( 'required' ) ?></span> 226 <input type="submit" class="btn btn-primary btn-white btn-round" 227 value="<?php echo lang_get( 'update_project_button' ) ?>" 228 /> 229 </div> 230 </div> 231 </form> 232</div> 233</div> 234 235<!-- PROJECT DELETE --> 236<div class="col-md-12 col-xs-12"> 237<?php 238# You must have global permissions to delete projects 239if( access_has_global_level ( config_get( 'delete_project_threshold' ) ) ) { ?> 240<div id="project-delete-div" class="form-container"> 241 <form id="project-delete-form" method="post" action="manage_proj_delete.php" class="pull-right"> 242 <fieldset> 243 <?php echo form_security_field( 'manage_proj_delete' ) ?> 244 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 245 <input type="submit" class="btn btn-primary btn-sm btn-white btn-round" 246 value="<?php echo lang_get( 'delete_project_button' ) ?>" 247 /> 248 </fieldset> 249 </form> 250</div> 251<?php } ?> 252</div> 253 254<?php 255if ( config_get_global( 'subprojects_enabled') == ON ) { 256?> 257<!-- SUBPROJECTS --> 258<div class="col-md-12 col-xs-12"> 259 <div class="space-10"></div> 260 <div id="manage-project-update-subprojects-div" class="form-container"> 261 <div class="widget-box widget-color-blue2"> 262 <div class="widget-header widget-header-small"> 263 <h4 class="widget-title lighter"> 264 <?php print_icon( 'fa-share-alt', 'ace-icon' ); ?> 265 <?php echo lang_get( 'subprojects' ); ?> 266 </h4> 267 </div> 268 <div class="widget-toolbox padding-8 clearfix"> 269 <?php 270 # Check the user's global access level before allowing project creation 271 if( access_has_global_level ( config_get( 'create_project_threshold' ) ) ) { 272 print_form_button( 273 'manage_proj_create_page.php?parent_id=' . $f_project_id, 274 lang_get( 'create_new_subproject_link' ), 275 null, 276 null, 277 'btn btn-sm btn-primary btn-white btn-round' 278 ); 279 } ?> 280 </div> 281 <form id="manage-project-subproject-add-form" method="post" action="manage_proj_subproj_add.php" class="form-inline"> 282 <div class="widget-body"> 283 <div class="widget-main"> 284 <fieldset> 285 <?php echo form_security_field( 'manage_proj_subproj_add' ) ?> 286 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 287 <!--suppress HtmlFormInputWithoutLabel --> 288 <select name="subproject_id" class="input-sm" required> 289 <option selected disabled value=""> 290 <?php echo '[', lang_get( 'select_project_button' ), ']' ?> 291 </option> 292<?php 293 $t_all_subprojects = project_hierarchy_get_subprojects( $f_project_id, true ); 294 $t_all_subprojects[] = $f_project_id; 295 $t_manage_access = config_get( 'manage_project_threshold' ); 296 $t_projects = project_get_all_rows(); 297 $t_projects = multi_sort( $t_projects, 'name' ); 298 foreach ( $t_projects as $t_project ) { 299 if( in_array( $t_project['id'], $t_all_subprojects ) || 300 in_array( $f_project_id, project_hierarchy_get_all_subprojects( $t_project['id'] ) ) || 301 !access_has_project_level( $t_manage_access, $t_project['id'] ) 302 ) { 303 continue; 304 } 305?> 306 <option value="<?php echo $t_project['id'] ?>"> 307 <?php echo string_attribute( $t_project['name'] ) ?> 308 </option> 309<?php 310 } # End looping over projects 311?> 312 </select> 313 <input type="submit" class="btn btn-sm btn-primary btn-white btn-round" 314 value="<?php echo lang_get( 'add_subproject' ); ?>" 315 /> 316 </fieldset> 317 </div> 318 </div> 319 </form> 320 </div> 321 </div> 322</div> 323 324<?php 325 $t_subproject_ids = current_user_get_accessible_subprojects( $f_project_id, true ); 326 if( array() != $t_subproject_ids ) { ?> 327 <div class="col-md-12 col-xs-12"> 328 <div class="space-10"></div> 329 <form id="manage-project-update-subprojects-form" action="manage_proj_update_children.php" method="post"> 330 <div class="widget-box widget-color-blue2"> 331 <div class="widget-header widget-header-small"> 332 <h4 class="widget-title lighter"> 333 <?php print_icon( 'fa-share-alt', 'ace-icon' ); ?> 334 <?php echo lang_get( 'subprojects' ); ?> 335 </h4> 336 </div> 337 <div class="widget-body"> 338 <div class="widget-main no-padding"> 339 <fieldset> 340 <?php echo form_security_field( 'manage_proj_update_children' ) ?> 341 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 342 <div class="table-responsive"> 343 <table class="table table-striped table-bordered table-condensed"> 344 <thead> 345 <tr> 346 <th><?php echo lang_get( 'name' ) ?></th> 347 <th><?php echo lang_get( 'status' ) ?></th> 348 <th><?php echo lang_get( 'enabled' ) ?></th> 349 <th><?php echo lang_get( 'inherit' ) ?></th> 350 <th><?php echo lang_get( 'view_status' ) ?></th> 351 <th><?php echo lang_get( 'description' ) ?></th> 352 <th colspan="2"><?php echo lang_get( 'actions' ) ?></th> 353 </tr> 354 </thead> 355 <tbody> 356<?php 357 foreach ( $t_subproject_ids as $t_subproject_id ) { 358 $t_subproject = project_get_row( $t_subproject_id ); 359 $t_inherit_parent = project_hierarchy_inherit_parent( $t_subproject_id, $f_project_id, true ); ?> 360 <tr> 361 <td> 362 <a href="manage_proj_edit_page.php?project_id=<?php echo $t_subproject['id'] ?>"> 363 <?php echo string_display_line( $t_subproject['name'] ) ?> 364 </a> 365 </td> 366 <td class="center"> 367 <?php echo get_enum_element( 'project_status', $t_subproject['status'] ) ?> 368 </td> 369 <td class="center"> 370 <?php echo trans_bool( $t_subproject['enabled'] ) ?> 371 </td> 372 <td class="center"> 373 <label> 374 <input type="checkbox" class="ace" name="inherit_child_<?php echo $t_subproject_id ?>" 375 <?php echo ( $t_inherit_parent ? 'checked="checked"' : '' ) ?> /> 376 <span class="lbl"></span> 377 </label> 378 </td> 379 <td class="center"> 380 <?php echo get_enum_element( 'project_view_state', $t_subproject['view_state'] ) ?> 381 </td> 382 <td> 383 <?php echo string_display_links( $t_subproject['description'] ) ?> 384 </td> 385 <td class="center"> 386 <div class="inline"> 387<?php 388 print_link_button( 389 'manage_proj_edit_page.php?project_id=' . $t_subproject['id'], 390 lang_get( 'edit' ), 'btn-xs' 391 ); 392 print_link_button( 393 "manage_proj_subproj_delete.php?project_id=$f_project_id&subproject_id=" 394 . $t_subproject['id'] 395 . form_security_param( 'manage_proj_subproj_delete' ), 396 lang_get( 'unlink_link' ), 'btn-xs' 397 ); 398?> 399 </div> 400 </td> 401 </tr> 402<?php 403 } # End of foreach loop over subprojects 404?> 405 </tbody> 406 </table> 407 </div> 408 </fieldset> 409 </div> 410 </div> 411 <div class="widget-toolbox padding-8 clearfix"> 412 <input type="submit" class="btn btn-primary btn-white btn-round" 413 value="<?php echo lang_get( 'update_subproject_inheritance' ) ?>" 414 /> 415 </div> 416 </div> 417 </form> 418</div> 419<?php 420 # End of subprojects listing / update form 421 } else { 422 # If there are no subprojects, clear floats to h2 overlap on div border 423?> 424 <br /> 425<?php } 426 427 } # are sub-projects enabled? 428?> 429 430<div class="col-md-12 col-xs-12"> 431 <div class="space-10"></div> 432 <div id="categories" class="form-container"> 433 <div class="widget-box widget-color-blue2"> 434 <div class="widget-header widget-header-small"> 435 <h4 class="widget-title lighter"> 436 <?php print_icon( 'fa-sitemap', 'ace-icon' ); ?> 437 <?php echo lang_get( 'categories' ); ?> 438 </h4> 439 </div> 440 <div class="widget-toolbox padding-8 clearfix"> 441 <form id="manage-project-category-copy-form" method="post" action="manage_proj_cat_copy.php" class="form-inline"> 442 <fieldset> 443 <?php echo form_security_field( 'manage_proj_cat_copy' ) ?> 444 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 445 <!--suppress HtmlFormInputWithoutLabel --> 446 <select name="other_project_id" class="input-sm" required> 447 <option selected disabled value=""> 448 <?php echo '[', lang_get( 'select_project_button' ), ']' ?> 449 </option> 450 <?php print_project_option_list( null, false, $f_project_id ); ?> 451 </select> 452 <input type="submit" name="copy_from" class="btn btn-sm btn-primary btn-white btn-round" 453 value="<?php echo lang_get( 'copy_categories_from' ) ?>" 454 /> 455 <input type="submit" name="copy_to" class="btn btn-sm btn-primary btn-white btn-round" 456 value="<?php echo lang_get( 'copy_categories_to' ) ?>" 457 /> 458 </fieldset> 459 </form> 460 </div> 461 <div class="widget-body"> 462 <div class="widget-main no-padding"> 463<?php 464 $t_categories = category_get_all_rows( $f_project_id ); 465 if( count( $t_categories ) > 0 ) { 466?> 467 <div class="table-responsive"> 468 <table class="table table-striped table-bordered table-condensed"> 469 <thead> 470 <tr> 471 <th><?php echo lang_get( 'category' ) ?></th> 472 <th><?php echo lang_get( 'assign_to' ) ?></th> 473 <th colspan="2" class="center"><?php echo lang_get( 'actions' ) ?></th> 474 </tr> 475 </thead> 476 <tbody> 477<?php 478 foreach ( $t_categories as $t_category ) { 479 $t_id = $t_category['id']; 480 $t_inherited = ( $t_category['project_id'] != $f_project_id ); 481?> 482 <tr> 483 <td><?php echo string_display_line( category_full_name( $t_id, $t_inherited, $f_project_id ) ) ?></td> 484 <td><?php echo prepare_user_name( $t_category['user_id'] ) ?></td> 485 <td class="center"> 486 <div class="inline"> 487<?php 488 if( !$t_inherited ) { 489 $t_id = urlencode( $t_id ); 490 $t_project_id = urlencode( $f_project_id ); 491 echo '<div class="pull-left">'; 492 print_form_button( 493 'manage_proj_cat_edit_page.php?id=' . $t_id . '&project_id=' . $t_project_id, 494 lang_get( 'edit' ), 495 null, 496 null, 497 'btn btn-xs btn-primary btn-white btn-round' 498 ); 499 echo '</div>'; 500 } 501 if( !$t_inherited ) { 502 echo '<div class="pull-left">'; 503 print_form_button( 504 'manage_proj_cat_delete.php?id=' . $t_id . '&project_id=' . $t_project_id, 505 lang_get( 'delete' ), 506 null, 507 null, 508 'btn btn-xs btn-primary btn-white btn-round' 509 ); 510 echo '</div>'; 511 } 512?> 513 </div> 514 </td> 515 </tr> 516<?php 517 } # end for loop 518?> 519 </tbody> 520 </table> 521 </div> 522<?php 523 } 524?> 525</div> 526</div> 527<div class="widget-toolbox padding-8 clearfix"> 528 <form id="project-add-category-form" method="post" action="manage_proj_cat_add.php" class="form-inline"> 529 <fieldset> 530 <?php echo form_security_field( 'manage_proj_cat_add' ) ?> 531 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 532 <!--suppress HtmlFormInputWithoutLabel --> 533 <input type="text" name="name" required size="32" maxlength="128" class="input-sm" /> 534 <input type="submit" class="btn btn-sm btn-primary btn-white btn-round" 535 value="<?php echo lang_get( 'add_category_button' ) ?>" 536 /> 537 <input type="submit" name="add_and_edit_category" 538 class="btn btn-sm btn-primary btn-white btn-round" 539 value="<?php echo lang_get( 'add_and_edit_category_button' ) ?>" 540 /> 541 </fieldset> 542 </form> 543</div> 544</div> 545</div> 546</div> 547 548 549<div class="col-md-12 col-xs-12"> 550<div class="space-10"></div> 551<div id="project-versions-div" class="form-container"> 552 <div class="widget-box widget-color-blue2"> 553 <div class="widget-header widget-header-small"> 554 <h4 class="widget-title lighter"> 555 <?php print_icon( 'fa-share-alt', 'ace-icon' ); ?> 556 <?php echo lang_get( 'versions' ); ?> 557 </h4> 558 </div> 559 <div class="widget-toolbox padding-8 clearfix"> 560 <form id="manage-project-version-copy-form" method="post" action="manage_proj_ver_copy.php" class="form-inline"> 561 <fieldset> 562 <?php echo form_security_field( 'manage_proj_ver_copy' ) ?> 563 <input type="hidden" class="form-control input-sm" name="project_id" value="<?php echo $f_project_id ?>" /> 564 <!--suppress HtmlFormInputWithoutLabel --> 565 <select name="other_project_id" class="input-sm" required> 566 <option selected disabled value=""><?php echo '[', lang_get( 'select_project_button' ), ']' ?></option> 567 <?php print_project_option_list( null, false, $f_project_id ); ?> 568 </select> 569 <input type="submit" name="copy_from" class="btn btn-sm btn-primary btn-white btn-round" 570 value="<?php echo lang_get( 'copy_versions_from' ) ?>" 571 /> 572 <input type="submit" name="copy_to" class="btn btn-sm btn-primary btn-white btn-round" 573 value="<?php echo lang_get( 'copy_versions_to' ) ?>" 574 /> 575 </fieldset> 576 </form> 577 </div> 578 <div class="widget-body"> 579 <div class="widget-main no-padding"> 580 <?php 581 $t_versions = version_get_all_rows( $f_project_id, VERSION_ALL, true ); 582 if( count( $t_versions ) > 0 ) { ?> 583 <div class="table-responsive"> 584 <table id="versions" class="table table-striped table-bordered table-condensed"> 585 <thead> 586 <tr> 587 <th><?php echo lang_get( 'version' ) ?></th> 588 <th><?php echo lang_get( 'released' ) ?></th> 589 <th><?php echo lang_get( 'obsolete' ) ?></th> 590 <th><?php echo lang_get( 'timestamp' ) ?></th> 591 <th><?php echo lang_get( 'actions' ) ?></th> 592 </tr> 593 </thead> 594 <tbody> 595<?php 596 foreach ( $t_versions as $t_version ) { 597 $t_inherited = $t_version['project_id'] != $f_project_id; 598 $t_name = version_full_name( $t_version['id'], $t_inherited, $f_project_id ); 599 $t_released = $t_version['released']; 600 $t_obsolete = $t_version['obsolete']; 601 if( !date_is_null( $t_version['date_order'] ) ) { 602 $t_date_formatted = date( config_get( 'complete_date_format' ), $t_version['date_order'] ); 603 } else { 604 $t_date_formatted = ' '; 605 } ?> 606 607 <tr> 608 <td><?php echo string_display_line( $t_name ) ?></td> 609 <td class="center"><?php echo trans_bool( $t_released ) ?></td> 610 <td class="center"><?php echo trans_bool( $t_obsolete ) ?></td> 611 <td class="center"><?php echo $t_date_formatted ?></td> 612 <td class="center"> 613 <div class="inline"> 614 <?php 615 $t_version_id = version_get_id( $t_name, $f_project_id ); 616 if( !$t_inherited ) { 617 echo '<div class="pull-left">'; 618 print_form_button( 619 'manage_proj_ver_edit_page.php?version_id=' . $t_version_id, 620 lang_get( 'edit' ) 621 ); 622 echo '</div>'; 623 624 echo '<div class="pull-left">'; 625 print_form_button( 626 'manage_proj_ver_delete.php?version_id=' . $t_version_id, 627 lang_get( 'delete' ) 628 ); 629 echo '</div>'; 630 } ?> 631 </div> 632 </td> 633 </tr> 634<?php 635 } # end for loop 636?> 637 </tbody> 638 </table> 639 </div> 640<?php 641 } 642?> 643 </div> 644 </div> 645 <div class="widget-toolbox padding-8 clearfix"> 646 <form id="manage-project-add-version-form" method="post" action="manage_proj_ver_add.php" class="form-inline"> 647 <fieldset> 648 <?php echo form_security_field( 'manage_proj_ver_add' ) ?> 649 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 650 <!--suppress HtmlFormInputWithoutLabel --> 651 <input type="text" class="input-sm" required name="version" size="32" maxlength="64" /> 652 <input type="submit" name="add_version" class="btn btn-sm btn-primary btn-white btn-round" 653 value="<?php echo lang_get( 'add_version_button' ) ?>" 654 /> 655 <input type="submit" name="add_and_edit_version" class="btn btn-sm btn-primary btn-white btn-round" 656 value="<?php echo lang_get( 'add_and_edit_version_button' ) ?>" 657 /> 658 </fieldset> 659 </form> 660 </div> 661 </div> 662</div> 663</div> 664 665<?php 666# You need either global permissions or project-specific permissions to link 667# custom fields 668$t_custom_field_count = count( custom_field_get_ids() ); 669if( access_has_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ) && 670 ( $t_custom_field_count > 0 ) ) { 671?> 672<div class="col-md-12 col-xs-12"> 673<div class="space-10"></div> 674<div id="customfields" class="form-container"> 675<div class="widget-box widget-color-blue2"> 676 <div class="widget-header widget-header-small"> 677 <h4 class="widget-title lighter"> 678 <?php print_icon( 'fa-flask', 'ace-icon' ); ?> 679 <?php echo lang_get( 'custom_fields_setup' ); ?> 680 </h4> 681 </div> 682 <div class="widget-toolbox padding-8 clearfix"> 683 <form id="manage-project-custom-field-copy-form" method="post" action="manage_proj_custom_field_copy.php" class="form-inline"> 684 <fieldset> 685 <?php echo form_security_field( 'manage_proj_custom_field_copy' ) ?> 686 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 687 <!--suppress HtmlFormInputWithoutLabel --> 688 <select name="other_project_id" class="input-sm" required> 689 <option selected disabled value=""><?php echo '[', lang_get( 'select_project_button' ), ']' ?></option> 690 <?php print_project_option_list( null, false, $f_project_id ); ?> 691 </select> 692 <input type="submit" name="copy_from" class="btn btn-sm btn-primary btn-white btn-round" 693 value="<?php echo lang_get( 'copy_from' ) ?>" 694 /> 695 <input type="submit" name="copy_to" class="btn btn-sm btn-primary btn-white btn-round" 696 value="<?php echo lang_get( 'copy_to' ) ?>" 697 /> 698 </fieldset> 699 </form> 700 </div> 701<?php 702 $t_custom_fields = custom_field_get_linked_ids( $f_project_id ); 703 $t_linked_count = count( $t_custom_fields ); 704 if( $t_linked_count > 0 ) { ?> 705 <div class="widget-body"> 706 <div class="widget-main no-padding"> 707 <div class="table-responsive"> 708 <table class="table table-striped table-bordered table-condensed"> 709 <thead> 710 <tr> 711 <th><?php echo lang_get( 'custom_field' ) ?></th> 712 <th><?php echo lang_get( 'custom_field_sequence' ) ?></th> 713 <th><?php echo lang_get( 'actions' ); ?></th> 714 </tr> 715 </thead> 716 <tbody> 717<?php 718 foreach( $t_custom_fields as $t_field_id ) { 719 $t_desc = custom_field_get_definition( $t_field_id ); ?> 720 <tr> 721 <td><?php echo '<a href="manage_custom_field_edit_page.php?field_id=' . $t_field_id . '">' . 722 custom_field_get_display_name( $t_desc['name'] ) . '</a>' ?></td> 723 <td class="center"> 724 <form method="post" action="manage_proj_custom_field_update.php" class="form-inline"> 725 <fieldset> 726 <?php echo form_security_field( 'manage_proj_custom_field_update' ) ?> 727 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 728 <input type="hidden" name="field_id" value="<?php echo $t_field_id ?>" /> 729 <!--suppress HtmlFormInputWithoutLabel --> 730 <input type="text" class="input-sm" name="sequence" size="2" 731 value="<?php echo custom_field_get_sequence( $t_field_id, $f_project_id ) ?>" 732 /> 733 <input type="submit" class="btn btn-sm btn-primary btn-white btn-round" 734 value="<?php echo lang_get( 'update' ) ?>" 735 /> 736 </fieldset> 737 </form> 738 </td> 739 <td class="center"><?php 740 # You need global permissions to edit custom field defs 741 print_form_button( 742 "manage_proj_custom_field_remove.php?field_id=$t_field_id&project_id=$f_project_id", 743 lang_get( 'remove_link' ) 744 ); ?> 745 </td> 746 </tr> 747<?php 748 } # end for loop 749?> 750 </tbody> 751 </table> 752 </div> 753 </div> 754 </div> 755<?php 756 } 757 if( $t_custom_field_count > $t_linked_count ) { ?> 758 <div class="widget-toolbox padding-8 clearfix"> 759 <form method="post" action="manage_proj_custom_field_add_existing.php" class="form-inline"> 760 <fieldset> 761 <?php echo form_security_field( 'manage_proj_custom_field_add_existing' ) ?> 762 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 763 <!--suppress HtmlFormInputWithoutLabel --> 764 <select name="field_id" class="input-sm"> 765 <?php 766 $t_cf_defs = array(); 767 foreach( custom_field_get_ids() as $t_cfid ) { 768 $t_cf_defs[] = custom_field_get_definition( $t_cfid ); 769 } 770 $t_custom_fields = multi_sort( $t_cf_defs, 'name' ); 771 772 foreach( $t_custom_fields as $t_field ) 773 { 774 if( !custom_field_is_linked( $t_field['id'], $f_project_id ) ) { 775 echo '<option value="', $t_field['id'], '">', 776 string_attribute( lang_get_defaulted( $t_field['name'] ) ), 777 '</option>' ; 778 } 779 } 780 ?> 781 </select> 782 <input type="submit" class="btn btn-sm btn-primary btn-white btn-round" 783 value="<?php echo lang_get( 'add_existing_custom_field' ) ?>" 784 /> 785 </fieldset> 786 </form> 787</div><?php 788 } ?> 789</div> 790</div> 791</div><?php 792} 793 794event_signal( 'EVENT_MANAGE_PROJECT_PAGE', array( $f_project_id ) ); 795?> 796 797<div class="col-md-12 col-xs-12"> 798 <div class="space-10"></div> 799 <div class="alert alert-info"> 800 <div class="center bigger-110"> 801 <?php 802 print_icon( 'fa-info-circle' ); 803 echo ' '; 804 if( VS_PUBLIC == project_get_field( $f_project_id, 'view_state' ) ) { 805 echo lang_get( 'public_project_msg' ); 806 } else { 807 echo lang_get( 'private_project_msg' ); 808 } ?> 809 </div> 810 </div> 811</div> 812 813<div class="col-md-12 col-xs-12"> 814 <div class="space-10"></div> 815 <div id="manage-project-users-div" class="form-container"> 816 <div class="widget-box widget-color-blue2"> 817 <div class="widget-header widget-header-small"> 818 <h4 class="widget-title lighter"> 819 <?php print_icon( 'fa-users', 'ace-icon' ); ?> 820 <?php echo lang_get( 'manage_accounts_title' ); ?> 821 </h4> 822 </div> 823 <div class="widget-body" id="manage-project-users-list"> 824 825 <div class="widget-toolbox padding-8 clearfix"> 826 <form id="manage-project-users-copy-form" method="post" action="manage_proj_user_copy.php" class="form-inline"> 827 <fieldset> 828 <?php echo form_security_field( 'manage_proj_user_copy' ) ?> 829 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 830 <!--suppress HtmlFormInputWithoutLabel --> 831 <select name="other_project_id" class="input-sm" required> 832 <option selected disabled value=""> 833 <?php echo '[', lang_get( 'select_project_button' ), ']' ?> 834 </option> 835 <?php print_project_option_list( null, false, $f_project_id ); ?> 836 </select> 837 <span class=form-inline"> 838 <input type="submit" name="copy_from" class="btn btn-sm btn-primary btn-white btn-round" 839 value="<?php echo lang_get( 'copy_users_from' ) ?>" 840 /> 841 <input type="submit" name="copy_to" class="btn btn-sm btn-primary btn-white btn-round" 842 value="<?php echo lang_get( 'copy_users_to' ) ?>" 843 /> 844 </span> 845 </fieldset> 846 </form> 847 </div> 848 <?php 849 $t_users = project_get_all_user_rows( $f_project_id, ANYBODY, $f_show_global_users ); 850 $t_users_count = count( $t_users ); 851 852 if( $t_users_count > 0 ) { 853 854 $t_user_ids = array(); 855 $t_sort = array(); 856 foreach ( $t_users as $t_ix => $t_user ) { 857 $t_user_display_name = user_get_name_from_row( $t_user ); 858 $t_users[$t_ix]['display_name'] = $t_user_display_name; 859 $t_user_ids[] = $t_user['id']; 860 $t_sort[] = $t_user_display_name; 861 } 862 863 user_cache_array_rows( $t_user_ids ); 864 array_multisort( $t_sort, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $t_users ); 865 866 ?> 867 <div id="manage-project-users-form-toolbox" class="hidden widget-toolbox padding-8 clearfix"> 868 <div class="btn-toolbar"> 869 <div class="widget-toolbar no-border pull-left"> 870 <!--suppress HtmlFormInputWithoutLabel --> 871 <input type="text" class="search input-sm" placeholder="<?php echo lang_get( 'filter_button' ) ?>" /> 872 </div> 873 <div class="widget-toolbar pull-left"> 874 <label> 875 <?php echo lang_get( 'show' ) ?> 876 <input id="input-per-page" type="text" min="5" size="2" class="input-sm" 877 value="<?php echo config_get( 'default_limit_view' ) ?>" 878 /> 879 </label> 880 <?php echo '(', lang_get( 'total' ), ': ', 881 $t_users_count, ' ', lang_get( 'users_link' ), ')' 882 ?> 883 </div> 884 <div class="btn-group pull-right"> 885 <ul class="pagination small no-margin"></ul> 886 </div> 887 </div> 888 </div> 889 890 <div class="widget-main no-padding" > 891 <form id="manage-project-users-form" method="post" action="manage_proj_user_update.php"> 892 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 893 <?php echo form_security_field( 'manage_proj_user_update' ) ?> 894 <div class="table-responsive listjs-table"> 895 <table class="table table-striped table-bordered table-condensed"> 896 <thead> 897 <tr> 898 <th> 899 <div class="sort" role="button" data-sort="key-name"> 900 <?php echo lang_get( 'username' ) ?> 901 </div> 902 </th> 903 <th> 904 <div class="sort" role="button" data-sort="key-email"> 905 <?php echo lang_get( 'email' ) ?> 906 </div> 907 </th> 908 <th class="col-md-4"> 909 <div class="sort" role="button" data-sort="key-access"> 910 <?php echo lang_get( 'access_level' ) ?> 911 </div> 912 </th> 913 <th> 914 <?php echo lang_get( 'remove_link' ) ?> 915 </th> 916 </tr> 917 </thead> 918 <tbody class="list"> 919<?php 920 # If including global users, fetch here all local user to later distinguish them 921 $t_local_users = array(); 922 if( $f_show_global_users ) { 923 $t_local_users = project_get_all_user_rows( $f_project_id, ANYBODY, false ); 924 } 925 926 foreach( $t_users as $t_user ) { 927 $t_username = $t_user['display_name']; 928 $t_can_manage_this_user = $t_can_manage_users 929 && access_has_project_level( $t_user['access_level'], $f_project_id ) 930 && ( !$f_show_global_users || isset( $t_local_users[$t_user['id']]) ); 931?> 932 <tr> 933 <td class="key-name" data-sortvalue="<?php echo $t_username ?>"> 934 <a href="manage_user_edit_page.php?user_id=<?php echo $t_user['id'] ?>"> 935 <?php echo prepare_user_name( $t_user['id'], false ); ?> 936 </a> 937 </td> 938 <td class="key-email"> 939 <?php 940 $t_email = user_get_email( $t_user['id'] ); 941 print_email_link( $t_email, $t_email ); 942 ?> 943 </td> 944 <?php 945 $t_current_level_string = get_enum_element( 'access_levels', $t_user['access_level'] ); 946 ?> 947 <td class="key-access" data-sortvalue="<?php echo $t_current_level_string ?>"> 948 <?php 949 if( $t_can_manage_this_user ) { 950 echo '<div class="editable_access_level">'; 951 echo $t_current_level_string . '<span class="hidden unchanged">'; 952 echo ' <a href="#" class="edit_link">[' . lang_get( 'edit' ) . ']</a>'; 953 echo '</span>'; 954 $t_arrow = layout_is_rtl() ? 'fa-long-arrow-left' : 'fa-long-arrow-right'; 955 echo ' <span class="changed_to">'; 956 print_icon( $t_arrow, 'fa-lg' ); 957 echo '</span>'; 958 echo '<select name="user_access_level[' . $t_user['id'] . ']" class="input-xs user_access_level"' 959 . ' data-original_val="' . $t_user['access_level'] . '" data-user_id="' . $t_user['id'] . '">'; 960 # only access levels that are less than or equal current user access level for current project 961 print_project_access_levels_option_list( (int)$t_user['access_level'], $f_project_id ); 962 echo '</select>'; 963 echo '</div>'; 964 } else { 965 echo $t_current_level_string; 966 } 967 ?> 968 </td> 969 <td class="center"> 970 <?php 971 # You need global or project-specific permissions to remove users 972 # from this project 973 if( $t_can_manage_this_user ) { 974 ?> 975 <div class="checkbox no-padding no-margin editable_user_delete"> 976 <label> 977 <input type="checkbox" name="user_access_delete[]" 978 class="ace user_access_delete" 979 value="<?php echo $t_user['id'] ?>" 980 /> 981 <span class="lbl"></span> 982 </label> 983 </div> 984 <?php 985 } 986 ?> 987 </td> 988 </tr> 989 <?php 990 } # end for 991 ?> 992 </tbody> 993 </table> 994 </div> 995 996 <div class="widget-toolbox padding-8 clearfix"> 997 <div class="form-inline pull-left"> 998 <input type="submit" name="submit-apply" 999 class="btn btn-primary btn-white btn-round" 1000 value="<?php echo lang_get( 'apply_changes' ) ?>" 1001 /> 1002 </div> 1003 <div class="form-inline pull-right"> 1004 <?php echo form_security_field( 'manage_proj_user_remove' ) ?> 1005 <input type="submit" name="btn-remove-all" 1006 class="btn btn-primary btn-white btn-round btn-xs" 1007 formaction="manage_proj_user_remove.php" 1008 value="<?php echo lang_get( 'remove_all_link' ) ?>" 1009 /> 1010 <button name="btn-undo-remove-all" class="hidden btn btn-primary btn-white btn-round btn-xs"> 1011 <?php echo lang_get( 'undo' ). ': ', lang_get( 'remove_all_link' ) ?> 1012 </button> 1013 </div> 1014 </div> 1015 </form> 1016 </div> 1017<?php 1018 } // end if user count > 0 1019?> 1020 </div> 1021 <div class="widget-toolbox padding-8 clearfix"> 1022<?php 1023 # You need global or project-specific permissions to remove users 1024 # from this project 1025 if( !$f_show_global_users ) { 1026 print_form_button( 1027 "manage_proj_edit_page.php?project_id=$f_project_id&show_global_users=true", 1028 lang_get( 'show_global_users' ), 1029 null, 1030 OFF, 1031 'btn btn-sm btn-primary btn-white btn-round' 1032 ); 1033 } else { 1034 print_form_button( 1035 "manage_proj_edit_page.php?project_id=$f_project_id", 1036 lang_get( 'hide_global_users' ), 1037 null, 1038 OFF, 1039 'btn btn-sm btn-primary btn-white btn-round' 1040 ); 1041 } 1042?> 1043 </div> 1044 </div> 1045 </div> 1046</div> 1047 1048<?php 1049# We want to allow people with global permissions and people with high enough 1050# permissions on the project we are editing 1051if( $t_can_manage_users ) { 1052$t_users = user_get_unassigned_by_project_id( $f_project_id ); 1053if( count( $t_users ) > 0 ) { ?> 1054<div class="col-md-12 col-xs-12"> 1055 <div class="space-10"></div> 1056 <div class="form-container"> 1057 <form id="manage-project-add-user-form" method="post" action="manage_proj_user_add.php"> 1058 <div class="widget-box widget-color-blue2"> 1059 <div class="widget-header widget-header-small"> 1060 <h4 class="widget-title lighter"> 1061 <?php print_icon( 'fa-user', 'ace-icon' ); ?> 1062 <?php echo lang_get( 'add_user_title' ); ?> 1063 </h4> 1064 </div> 1065 <div class="widget-body"> 1066 <div class="widget-main no-padding"> 1067 <div class="table-responsive"> 1068 <table class="table table-bordered table-condensed table-striped"> 1069 <fieldset> 1070 <?php echo form_security_field( 'manage_proj_user_add' ) ?> 1071 <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> 1072 <tr> 1073 <td class="category"> 1074 <label for="project-add-users-username"> 1075 <span class="required">*</span> 1076 <?php echo lang_get( 'username' ) ?> 1077 </label> 1078 </td> 1079 <td> 1080 <select id="project-add-users-username" name="user_id[]" 1081 class="input-sm" multiple="multiple" size="10" required> 1082<?php 1083 foreach( $t_users AS $t_user_id=>$t_display_name ) { 1084 echo '<option value="', $t_user_id, '">', string_attribute( $t_display_name ), '</option>'; 1085 } 1086?> 1087 </select> 1088 </td> 1089 </tr> 1090 <tr> 1091 <td class="category"> 1092 <label for="project-add-users-access-level"> 1093 <?php echo lang_get( 'access_level' ) ?> 1094 </label> 1095 </td> 1096 <td> 1097 <select id="project-add-users-access-level" name="access_level" class="input-sm"> 1098<?php 1099 # only access levels that are less than or equal current user access level for current project 1100 print_project_access_levels_option_list( 1101 config_get( 'default_new_account_access_level' ), 1102 $f_project_id 1103 ); 1104?> 1105 </select> 1106 </td> 1107 </tr> 1108 </fieldset> 1109 </table> 1110 </div> 1111 </div> 1112 </div> 1113 <div class="widget-toolbox padding-8 clearfix"> 1114 <span class="required pull-right"> * <?php echo lang_get( 'required' ) ?></span> 1115 <input type="submit" class="btn btn-primary btn-white btn-round" 1116 value="<?php echo lang_get( 'add_user_button' ) ?>" 1117 /> 1118 </div> 1119 </div> 1120 </form> 1121 </div> 1122</div> 1123<?php 1124 } 1125} 1126?> 1127 1128<?php 1129layout_page_end(); 1130