[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: manage_config_work_threshold_page.php,v 1.14.2.1 2007-10-13 22:33:24 giallu Exp $ 22 # -------------------------------------------------------- 23 24 require_once ( 'core.php' ); 25 26 $t_core_path = config_get( 'core_path' ); 27 require_once ( $t_core_path . 'email_api.php' ); 28 29 auth_reauthenticate(); 30 31 html_page_top1( lang_get( 'manage_threshold_config' ) ); 32 html_page_top2(); 33 34 print_manage_menu( 'adm_permissions_report.php' ); 35 print_manage_config_menu( 'manage_config_work_threshold_page.php' ); 36 37 $t_user = auth_get_current_user_id(); 38 $t_project_id = helper_get_current_project(); 39 $t_access = user_get_access_level( $t_user, $t_project_id ); 40 $t_show_submit = false; 41 42 $t_access_levels = get_enum_to_array( config_get( 'access_levels_enum_string' ) ); 43 44 $t_overrides = array(); 45 function set_overrides( $p_config ) { 46 global $t_overrides; 47 if ( ! in_array( $p_config, $t_overrides ) ) { 48 $t_overrides[] = $p_config; 49 } 50 } 51 52 function get_section_begin( $p_section_name ) { 53 global $t_access_levels; 54 55 echo '<table class="width100">'; 56 echo '<tr><td class="form-title" colspan="' . ( count( $t_access_levels ) + 2 ) . '">' . strtoupper( $p_section_name ) . '</td></tr>' . "\n"; 57 echo '<tr><td class="form-title" width="40%" rowspan="2">' . lang_get( 'perm_rpt_capability' ) . '</td>'; 58 echo '<td class="form-title"style="text-align:center" width="40%" colspan="' . count( $t_access_levels ) . '">' . lang_get( 'access_levels' ) . '</td>'; 59 echo '<td class="form-title" style="text-align:center" rowspan="2"> ' . lang_get( 'alter_level' ) . ' </td></tr><tr>'; 60 foreach( $t_access_levels as $t_access_level => $t_access_label ) { 61 echo '<td class="form-title" style="text-align:center"> ' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), $t_access_level ) . ' </td>'; 62 } 63 echo '</tr>' . "\n"; 64 } 65 66 function get_capability_row( $p_caption, $p_threshold, $p_all_projects_only=false ) { 67 global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; 68 69 $t_file = config_get_global( $p_threshold ); 70 if ( ! is_array( $t_file ) ) { 71 $t_file_exp = array(); 72 foreach( $t_access_levels as $t_access_level => $t_label ) { 73 if ( $t_access_level >= $t_file ) { 74 $t_file_exp[] = $t_access_level; 75 } 76 } 77 } else { 78 $t_file_exp = $t_file; 79 } 80 81 $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); 82 if ( ! is_array( $t_global ) ) { 83 $t_global_exp = array(); 84 foreach( $t_access_levels as $t_access_level => $t_label ) { 85 if ( $t_access_level >= $t_global ) { 86 $t_global_exp[] = $t_access_level; 87 } 88 } 89 } else { 90 $t_global_exp = $t_global; 91 } 92 93 $t_project = config_get( $p_threshold ); 94 if ( ! is_array( $t_project ) ) { 95 $t_project_exp = array(); 96 foreach( $t_access_levels as $t_access_level => $t_label ) { 97 if ( $t_access_level >= $t_project ) { 98 $t_project_exp[] = $t_access_level; 99 } 100 } 101 } else { 102 $t_project_exp = $t_project; 103 } 104 105 $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) 106 && ( ( ALL_PROJECTS == $t_project_id ) || ! $p_all_projects_only ); 107 108 echo '<tr ' . helper_alternate_class() . '><td>' . string_display( $p_caption ) . '</td>'; 109 foreach( $t_access_levels as $t_access_level => $t_access_label ) { 110 $t_file = in_array( $t_access_level, $t_file_exp ); 111 $t_global = in_array( $t_access_level, $t_global_exp ); 112 $t_project = in_array( $t_access_level, $t_project_exp ) ; 113 114 $t_colour = ''; 115 if ( $t_global != $t_file ) { 116 $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override 117 if ( $t_can_change ) { 118 set_overrides( $p_threshold ); 119 } 120 } 121 if ( $t_project != $t_global ) { 122 $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides 123 if ( $t_can_change ) { 124 set_overrides( $p_threshold ); 125 } 126 } 127 128 if ( $t_can_change ) { 129 $t_checked = $t_project ? "CHECKED" : ""; 130 $t_value = "<input type=\"checkbox\" name=\"flag_thres_" . $p_threshold . "[]\" value=\"$t_access_level\" $t_checked />"; 131 $t_show_submit = true; 132 } else { 133 if ( $t_project ) { 134 $t_value = '<img src="images/ok.gif" width="20" height="15" alt="X" title="X" />'; 135 } else { 136 $t_value = ' '; 137 } 138 } 139 echo '<td class="center"' . $t_colour . '>' . $t_value . '</td>'; 140 } 141 if ( $t_can_change ) { 142 echo '<td> <select name="access_' . $p_threshold . '">'; 143 print_enum_string_option_list( 'access_levels', config_get_access( $p_threshold ) ); 144 echo '</select> </td>'; 145 } else { 146 echo '<td>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' </td>'; 147 } 148 149 echo '</tr>' . "\n"; 150 } 151 152 function get_capability_boolean( $p_caption, $p_threshold, $p_all_projects_only=false ) { 153 global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; 154 155 $t_file = config_get_global( $p_threshold ); 156 $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); 157 $t_project = config_get( $p_threshold ); 158 159 $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) 160 && ( ( ALL_PROJECTS == $t_project_id ) || ! $p_all_projects_only ); 161 162 $t_colour = ''; 163 if ( $t_global != $t_file ) { 164 $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override 165 if ( $t_can_change ) { 166 set_overrides( $p_threshold ); 167 } 168 } 169 if ( $t_project != $t_global ) { 170 $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides 171 if ( $t_can_change ) { 172 set_overrides( $p_threshold ); 173 } 174 } 175 176 echo '<tr ' . helper_alternate_class() . '><td>' . string_display( $p_caption ) . '</td>'; 177 if ( $t_can_change ) { 178 $t_checked = ( ON == config_get( $p_threshold ) ) ? "CHECKED" : ""; 179 $t_value = "<input type=\"checkbox\" name=\"flag_" . $p_threshold . "\" value=\"1\" $t_checked />"; 180 $t_show_submit = true; 181 } else { 182 if ( ON == config_get( $p_threshold ) ) { 183 $t_value = '<img src="images/ok.gif" width="20" height="15" title="X" alt="X" />'; 184 } else { 185 $t_value = ' '; 186 } 187 } 188 echo '<td' . $t_colour . '>' . $t_value . '</td><td class="left" colspan="' . ( count( $t_access_levels ) - 1 ). '"></td>'; 189 190 if ( $t_can_change ) { 191 echo '<td><select name="access_' . $p_threshold . '">'; 192 print_enum_string_option_list( 'access_levels', config_get_access( $p_threshold ) ); 193 echo '</select> </td>'; 194 } else { 195 echo '<td>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' </td>'; 196 } 197 198 echo '</tr>' . "\n"; 199 } 200 201 function get_capability_enum( $p_caption, $p_threshold, $p_enum, $p_all_projects_only=false ) { 202 global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; 203 204 $t_file = config_get_global( $p_threshold ); 205 $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); 206 $t_project = config_get( $p_threshold ); 207 208 $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) 209 && ( ( ALL_PROJECTS == $t_project_id ) || ! $p_all_projects_only ); 210 211 $t_colour = ''; 212 if ( $t_global != $t_file ) { 213 $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override 214 if ( $t_can_change ) { 215 set_overrides( $p_threshold ); 216 } 217 } 218 if ( $t_project != $t_global ) { 219 $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides 220 if ( $t_can_change ) { 221 set_overrides( $p_threshold ); 222 } 223 } 224 225 echo '<tr ' . helper_alternate_class() . '><td>' . string_display( $p_caption ) . '</td>'; 226 if ( $t_can_change ) { 227 echo '<td class="left" colspan="3"' . $t_colour . '><select name="flag_' . $p_threshold . '">'; 228 print_enum_string_option_list( $p_enum, config_get( $p_threshold ) ); 229 echo '</select></td><td colspan="' . ( count( $t_access_levels ) - 3 ) . '"></td>'; 230 $t_show_submit = true; 231 } else { 232 $t_value = get_enum_to_string( lang_get( $p_enum . '_enum_string' ), config_get( $p_threshold ) ) . ' '; 233 echo '<td class="left" colspan="3"' . $t_colour . '>' . $t_value . '</td><td colspan="' . ( count( $t_access_levels ) - 3 ) . '"></td>'; 234 } 235 236 if ( $t_can_change ) { 237 echo '<td><select name="access_' . $p_threshold . '">'; 238 print_enum_string_option_list( 'access_levels', config_get_access( $p_threshold ) ); 239 echo '</select> </td>'; 240 } else { 241 echo '<td>' . get_enum_to_string( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' </td>'; 242 } 243 244 echo '</tr>' . "\n"; 245 } 246 247 function get_section_end() { 248 echo '</table><br />' . "\n"; 249 } 250 251 $t_colour_project = config_get( 'colour_project'); 252 $t_colour_global = config_get( 'colour_global'); 253 254 echo "<br /><br />\n"; 255 256 if ( ALL_PROJECTS == $t_project_id ) { 257 $t_project_title = lang_get( 'config_all_projects' ); 258 } else { 259 $t_project_title = sprintf( lang_get( 'config_project' ) , string_display( project_get_name( $t_project_id ) ) ); 260 } 261 echo '<p class="bold">' . $t_project_title . '</p>' . "\n"; 262 echo '<p>' . lang_get( 'colour_coding' ) . '<br />'; 263 if ( ALL_PROJECTS <> $t_project_id ) { 264 echo '<span style="background-color:' . $t_colour_project . '">' . lang_get( 'colour_project' ) .'</span><br />'; 265 } 266 echo '<span style="background-color:' . $t_colour_global . '">' . lang_get( 'colour_global' ) . '</span></p>'; 267 268 echo "<form name=\"mail_config_action\" method=\"post\" action=\"manage_config_work_threshold_set.php\">\n"; 269 270 # Issues 271 get_section_begin( lang_get( 'issues' ) ); 272 get_capability_row( lang_get( 'report_issue' ), 'report_bug_threshold' ); 273 get_capability_enum( lang_get( 'submit_status' ), 'bug_submit_status', 'status' ); 274 get_capability_row( lang_get( 'update_issue' ), 'update_bug_threshold' ); 275 get_capability_boolean( lang_get( 'allow_close_immediate' ), 'allow_close_immediately' ); 276 get_capability_boolean( lang_get( 'allow_reporter_close' ), 'allow_reporter_close' ); 277 get_capability_row( lang_get( 'monitor_issue' ), 'monitor_bug_threshold' ); 278 get_capability_row( lang_get( 'handle_issue' ), 'handle_bug_threshold' ); 279 get_capability_row( lang_get( 'assign_issue' ), 'update_bug_assign_threshold' ); 280 get_capability_row( lang_get( 'move_issue' ), 'move_bug_threshold', true ); 281 get_capability_row( lang_get( 'delete_issue' ), 'delete_bug_threshold' ); 282 get_capability_row( lang_get( 'reopen_issue' ), 'reopen_bug_threshold' ); 283 get_capability_boolean( lang_get( 'allow_reporter_reopen' ), 'allow_reporter_reopen' ); 284 get_capability_enum( lang_get( 'reopen_status' ), 'bug_reopen_status', 'status' ); 285 get_capability_enum( lang_get( 'reopen_resolution' ), 'bug_reopen_resolution', 'resolution' ); 286 get_capability_enum( lang_get( 'resolved_status' ), 'bug_resolved_status_threshold', 'status' ); 287 get_capability_enum( lang_get( 'readonly_status' ), 'bug_readonly_status_threshold', 'status' ); 288 get_capability_row( lang_get( 'update_readonly_issues' ), 'update_readonly_bug_threshold' ); 289 get_capability_row( lang_get( 'update_issue_status' ), 'update_bug_status_threshold' ); 290 get_capability_row( lang_get( 'view_private_issues' ), 'private_bug_threshold' ); 291 get_capability_row( lang_get( 'set_view_status' ), 'set_view_status_threshold' ); 292 get_capability_row( lang_get( 'update_view_status' ), 'change_view_status_threshold' ); 293 get_capability_row( lang_get( 'show_list_of_users_monitoring_issue' ), 'show_monitor_list_threshold' ); 294 get_capability_boolean( lang_get( 'set_status_assigned' ), 'auto_set_status_to_assigned' ); 295 get_capability_enum( lang_get( 'assigned_status' ), 'bug_assigned_status', 'status' ); 296 get_capability_boolean( lang_get( 'limit_access' ), 'limit_reporters', true ); 297 get_section_end(); 298 299 # Notes 300 get_section_begin( lang_get( 'notes' ) ); 301 get_capability_row( lang_get( 'add_notes' ), 'add_bugnote_threshold' ); 302 get_capability_row( lang_get( 'update_notes' ), 'update_bugnote_threshold' ); 303 get_capability_boolean( lang_get( 'allow_user_edit' ), 'bugnote_allow_user_edit_delete' ); 304 get_capability_row( lang_get( 'delete_note' ), 'delete_bugnote_threshold' ); 305 get_capability_row( lang_get( 'view_private_notes' ), 'private_bugnote_threshold' ); 306 get_section_end(); 307 308 # Others 309 get_section_begin( lang_get('others' ) ); 310 get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'changelog_link' ), 'view_changelog_threshold' ); 311 get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'assigned_to' ), 'view_handler_threshold' ); 312 get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'bug_history' ), 'view_history_threshold' ); 313 get_capability_row( lang_get( 'send_reminders' ), 'bug_reminder_threshold' ); 314 get_section_end(); 315 316 317 if ( $t_show_submit ) { 318 echo "<input type=\"submit\" class=\"button\" value=\"" . lang_get( 'change_configuration' ) . "\" />\n"; 319 } 320 321 echo "</form>\n"; 322 323 if ( $t_show_submit && ( 0 < count( $t_overrides ) ) ) { 324 echo "<div class=\"right\"><form name=\"threshold_config_action\" method=\"post\" action=\"manage_config_revert.php\">\n"; 325 echo "<input name=\"revert\" type=\"hidden\" value=\"" . implode( ',', $t_overrides ) . "\"></input>"; 326 echo "<input name=\"project\" type=\"hidden\" value=\"$t_project_id\"></input>"; 327 echo "<input name=\"return\" type=\"hidden\" value=\"" . $_SERVER['PHP_SELF'] ."\"></input>"; 328 echo "<input type=\"submit\" class=\"button\" value=\""; 329 if ( ALL_PROJECTS == $t_project_id ) { 330 echo lang_get( 'revert_to_system' ); 331 } else { 332 echo lang_get( 'revert_to_all_project' ); 333 } 334 echo "\" />\n"; 335 echo "</form></div>\n"; 336 } 337 338 html_page_bottom1( __FILE__ ); 339 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |