| [ 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: changelog_page.php,v 1.23.2.1 2007-10-13 22:33:11 giallu Exp $ 22 # -------------------------------------------------------- 23 24 require_once ( 'core.php' ); 25 26 $t_core_path = config_get( 'core_path' ); 27 28 require_once( $t_core_path.'bug_api.php' ); 29 30 # Print header for the specified project version. 31 function print_version_header( $p_version_id ) { 32 $t_project_id = version_get_field( $p_version_id, 'project_id' ); 33 $t_version_name = version_get_field( $p_version_id, 'version' ); 34 $t_project_name = project_get_field( $t_project_id, 'name' ); 35 36 $t_release_title = string_display( $t_project_name ) . ' - ' . string_display( $t_version_name ); 37 echo '<tt>'; 38 echo '<br />', $t_release_title, '<br />'; 39 echo str_pad( '', strlen( $t_release_title ), '=' ), '<br />'; 40 } 41 42 function print_project_header ( $p_project_name ) { 43 echo '<br /><span class="pagetitle">', string_display( $p_project_name ), ' - ', lang_get( 'changelog' ), '</span><br />'; 44 } 45 46 $t_user_id = auth_get_current_user_id(); 47 $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() ); 48 49 if ( ALL_PROJECTS == $f_project_id ) { 50 $t_topprojects = $t_project_ids = user_get_accessible_projects( $t_user_id ); 51 foreach ( $t_topprojects as $t_project ) { 52 $t_project_ids = array_merge( $t_project_ids, user_get_all_accessible_subprojects( $t_user_id, $t_project ) ); 53 } 54 55 $t_project_ids_to_check = array_unique( $t_project_ids ); 56 $t_project_ids = array(); 57 58 foreach ( $t_project_ids_to_check as $t_project_id ) { 59 $t_changelog_view_access_level = config_get( 'view_changelog_threshold', null, null, $t_project_id ); 60 if ( access_has_project_level( $t_changelog_view_access_level, $t_project_id ) ) { 61 $t_project_ids[] = $t_project_id; 62 } 63 } 64 } else { 65 access_ensure_project_level( config_get( 'view_changelog_threshold' ), $f_project_id ); 66 $t_project_ids = user_get_all_accessible_subprojects( $t_user_id, $f_project_id ); 67 array_unshift( $t_project_ids, $f_project_id ); 68 } 69 70 html_page_top1( lang_get( 'changelog' ) ); // title 71 html_page_top2(); 72 73 $t_project_index = 0; 74 75 foreach( $t_project_ids as $t_project_id ) { 76 $c_project_id = db_prepare_int( $t_project_id ); 77 $t_project_name = project_get_field( $t_project_id, 'name' ); 78 $t_can_view_private = access_has_project_level( config_get( 'private_bug_threshold' ), $t_project_id ); 79 80 $t_limit_reporters = config_get( 'limit_reporters' ); 81 $t_user_access_level_is_reporter = ( REPORTER == access_get_project_level( $t_project_id ) ); 82 83 $t_resolved = config_get( 'bug_resolved_status_threshold' ); 84 $t_bug_table = config_get( 'mantis_bug_table' ); 85 $t_relation_table = config_get( 'mantis_bug_relationship_table' ); 86 87 $t_version_rows = version_get_all_rows( $t_project_id ); 88 89 $t_project_header_printed = false; 90 91 foreach( $t_version_rows as $t_version_row ) { 92 $t_issues_planned = 0; 93 $t_issues_resolved = 0; 94 95 $t_version_header_printed = false; 96 97 $t_version = $t_version_row['version']; 98 $c_version = db_prepare_string( $t_version ); 99 100 $t_version_id = version_get_id( $t_version, $t_project_id ); 101 102 $query = "SELECT $t_bug_table.*, $t_relation_table.source_bug_id FROM $t_bug_table 103 LEFT JOIN $t_relation_table ON $t_bug_table.id=$t_relation_table.destination_bug_id AND $t_relation_table.relationship_type=2 104 WHERE project_id='$c_project_id' AND fixed_in_version='$c_version' ORDER BY status ASC, last_updated DESC"; 105 106 $t_description = version_get_field( $t_version_id, 'description' ); 107 108 $t_first_entry = true; 109 $t_issue_ids = array(); 110 $t_issue_parents = array(); 111 112 $t_result = db_query( $query ); 113 114 while ( $t_row = db_fetch_array( $t_result ) ) { 115 # hide private bugs if user doesn't have access to view them. 116 if ( !$t_can_view_private && ( $t_row['view_state'] == VS_PRIVATE ) ) { 117 continue; 118 } 119 120 bug_cache_database_result( $t_row ); 121 122 # check limit_Reporter (Issue #4770) 123 # reporters can view just issues they reported 124 if ( ON === $t_limit_reporters && $t_user_access_level_is_reporter && 125 !bug_is_user_reporter( $t_row['id'], $t_user_id )) { 126 continue; 127 } 128 129 $t_issue_id = $t_row['id']; 130 $t_issue_parent = $t_row['source_bug_id']; 131 132 if ( !helper_call_custom_function( 'changelog_include_issue', array( $t_issue_id ) ) ) { 133 continue; 134 } 135 136 $t_issues_resolved++; 137 138 $t_issue_ids[] = $t_issue_id; 139 $t_issue_parents[] = $t_issue_parent; 140 141 } 142 143 if ( $t_issues_resolved > 0 ) { 144 if ( !$t_project_header_printed ) { 145 print_project_header( $t_project_name ); 146 $t_project_header_printed = true; 147 } 148 149 if ( !$t_version_header_printed ) { 150 print_version_header( $t_version_id ); 151 $t_version_header_printed = true; 152 } 153 154 if ( !is_blank( $t_description ) ) { 155 echo string_display( "<br />$t_description<br /><br />" ); 156 } 157 } 158 159 160 $t_issue_set_ids = array(); 161 $t_issue_set_levels = array(); 162 $k = 0; 163 164 while ( 0 < count( $t_issue_ids ) ) { 165 $t_issue_id = $t_issue_ids[$k]; 166 $t_issue_parent = $t_issue_parents[$k]; 167 168 if ( !in_array( $t_issue_parent, $t_issue_ids ) ) { 169 $l = array_search( $t_issue_parent, $t_issue_set_ids ); 170 if ( $l !== false ) { 171 for ( $m = $l+1; $m < count( $t_issue_set_ids ) && $t_issue_set_levels[$m] > $t_issue_set_levels[$l]; $m++ ) { 172 #do nothing 173 } 174 $t_issue_set_ids_end = array_splice( $t_issue_set_ids, $m ); 175 $t_issue_set_levels_end = array_splice( $t_issue_set_levels, $m ); 176 $t_issue_set_ids[] = $t_issue_id; 177 $t_issue_set_levels[] = $t_issue_set_levels[$l] + 1; 178 $t_issue_set_ids = array_merge( $t_issue_set_ids, $t_issue_set_ids_end ); 179 $t_issue_set_levels = array_merge( $t_issue_set_levels, $t_issue_set_levels_end ); 180 } 181 else { 182 $t_issue_set_ids[] = $t_issue_id; 183 $t_issue_set_levels[] = 0; 184 } 185 array_splice( $t_issue_ids, $k, 1 ); 186 array_splice( $t_issue_parents, $k, 1 ); 187 } 188 else { 189 $k++; 190 } 191 if ( count( $t_issue_ids ) <= $k ) { 192 $k = 0; 193 } 194 } 195 196 for ( $j = 0; $j < count( $t_issue_set_ids ); $j++ ) { 197 $t_issue_set_id = $t_issue_set_ids[$j]; 198 $t_issue_set_level = $t_issue_set_levels[$j]; 199 200 helper_call_custom_function( 'changelog_print_issue', array( $t_issue_set_id, $t_issue_set_level ) ); 201 } 202 203 echo '</tt>'; 204 } 205 206 207 $t_project_index++; 208 } 209 210 if ( $t_project_index == 0 ) { 211 echo '<br /><span class="pagetitle">' . lang_get('changelog_empty') . '</span>'; 212 } 213 html_page_bottom1( __FILE__ ); 214 ?>
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 |
|