|
|
Choosing A Webhost: |
mantisbt/core bug_api.php,1.100.2.1,1.100.2.2 print_api.php,1.152,1.152.2.1: msg#00031bug-tracking.mantis.cvs
Update of /cvsroot/mantisbt/mantisbt/core In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv30878/core Modified Files: Tag: EXP_TEMPLATE bug_api.php print_api.php Log Message: checkpoint Index: bug_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/bug_api.php,v retrieving revision 1.100.2.1 retrieving revision 1.100.2.2 diff -u -d -r1.100.2.1 -r1.100.2.2 --- bug_api.php 30 Apr 2006 19:00:45 -0000 1.100.2.1 +++ bug_api.php 15 May 2006 15:26:45 -0000 1.100.2.2 @@ -67,6 +67,10 @@ #internal helper objects var $_stats = null; + # extended information + var $attachments = NULL; + + // return a string to display a bug field function display( $p_field ) { switch ( $p_field ) { @@ -95,6 +99,7 @@ case 'os': case 'os_build': case 'build': + case 'attachments': return $this->$p_field; break; case 'summary': @@ -116,6 +121,39 @@ } } + + function get_link( $p_key ) { + switch ($p_key) { + case 'update': + return string_get_bug_page( $p_key ) . '?bug_id=' . $this->id; + break; + } + } + + function extend_data( $p_section ) { + switch ( $p_section ) { + case 'attachments': + $t_attachments = bug_get_attachments( $this->id ); + $t_can_download = file_can_download_bug_attachments( $this->id ); + $t_can_delete = file_can_delete_bug_attachments( $this->id ); + $t_max_size = config_get( 'preview_attachments_inline_max_size' ); + foreach( $t_attachments as $t_key => $t_attach ) { + $t_attachments[$t_key]['can_download'] = $t_can_download; + $t_attachments[$t_key]['can_delete'] = $t_can_delete; + $t_attachments[$t_key]['icon_path'] = get_file_icon( $t_attachments[$t_key]['filename'] ); + $t_attachments[$t_key]['display_inline'] = + ( $t_attachments[$t_key]['filesize']/1024 <= $t_max_size ) && + ( $t_attachments[$t_key]['filesize'] != 0 ) && + ( in_array( strtolower( file_get_extension( $t_attachments[$t_key]['filename'] ) ), array( 'png', 'jpg', 'jpeg', 'gif', 'bmp' ), true ) ); + } + $this->attachments = $t_attachments; + break; + default: + echo 'extend_data: bad section'; + } + } + + } #=================================== @@ -1487,4 +1525,93 @@ return $p_bug_data; } + + function bug_handler_list ( $p_bug_id ) { + $t_status = bug_get_field( $p_bug_id, 'status' ); + $t_reporter_id = bug_get_field( $p_bug_id, 'reporter_id' ); + $t_handler_id = bug_get_field( $p_bug_id, 'handler_id' ); + $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); + $t_current_user_id = auth_get_current_user_id(); + $t_new_status = ( ON == config_get( 'auto_set_status_to_assigned' ) ) ? + config_get( 'bug_assigned_status' ) : $t_status; + + $t_options = array(); + $t_default_assign_to = null; + + if ( ( $t_handler_id != $t_current_user_id ) && + ( access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $t_current_user_id ) ) ) { + $t_options[ $t_current_user_id ] = '[' . lang_get( 'myself' ) . ']'; + $t_default_assign_to = $t_current_user_id; + } + + if ( ( $t_handler_id != $t_reporter_id ) && user_exists( $t_reporter_id ) && + ( access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $t_reporter_id ) ) ) { + $t_options[ $t_reporter_id ] = '[' . lang_get( 'reporter' ) . ']'; + + if ( $t_default_assign_to === null ) { + $t_default_assign_to = $t_reporter_id; + } + } + + $t_options[0] = ''; + } + + $t_options = $t_options + get_assign_to_option_list( 0, $t_project_id, + config_get( 'handle_bug_threshold' ) ); + + return array( 'default' => $t_default_assign_to, + users => $t_options) + } + + function bug_buttons( $p_bug_id ) { + $t_resolved = config_get( 'bug_resolved_status_threshold' ); + $t_status = bug_get_field( $p_bug_id, 'status' ); + $t_reopen_status = config_get( 'bug_reopen_status' ); + $t_readonly = bug_is_readonly( $p_bug_id ); + $t_bug_project_id = bug_get_field( $p_bug_id, 'project_id' ); + $t_current_access = access_get_project_level( $t_bug_project_id ); + + $t_access['update_button'] = !$t_readonly && + access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ); + + $t_access['assign_button'] = !$t_readonly && + access_has_bug_level( config_get( 'update_bug_assign_threshold', + config_get( 'update_bug_threshold' ) ), $p_bug_id ) && + ( OFF == config_get( 'auto_set_status_to_assigned' ) || + bug_check_workflow( $t_status, config_get( 'bug_assigned_status' ) ) ); + $t_access['assign_button_list'] = bug_handler_list ( $p_bug_id ) + + $t_access['change_to_status'] = get_status_option_list( $t_current_access, + $t_status, false, + ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() && + ( ON == config_get( 'allow_reporter_close' ) ) ) ); + $t_access['change_button'] = count( $t_access['change_to_status'] ) > 0; + + if ( !current_user_is_anonymous() ) { + $t_access['monitor_button'] = true; + if ( user_is_monitoring_bug( auth_get_current_user_id(), $p_bug_id ) ) { + $t_access['monitor_button_label'] = 'unmonitor_bug_button'; + $t_access['monitor_button_action'] = 'del'; + } else { + $t_access['monitor_button_label'] = 'monitor_bug_button'; + $t_access['monitor_button_action'] = 'add'; + } + } else { + $t_access['monitor_button'] = false; + } + + $t_access['child_button'] = !$t_readonly && + ON == config_get( 'enable_relationship' ) && + access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ); + + $t_access['reopen_button'] = ( $t_resolved <= $t_status ) && + ( access_has_bug_level( config_get( 'reopen_bug_threshold' ), $p_bug_id ) || + ( ( bug_get_field( $p_bug_id, 'reporter_id' ) == auth_get_current_user_id() ) && + ( ON == config_get( 'allow_reporter_reopen' ) ) + ) ); + $t_access['move_button'] = !$t_readonly && + access_has_bug_level( config_get( 'move_bug_threshold' ), $p_bug_id ); + + $t_access['move_button'] = access_has_bug_level( config_get( 'delete_bug_threshold' ), $p_bug_id ); + } ?> Index: print_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/print_api.php,v retrieving revision 1.152 retrieving revision 1.152.2.1 diff -u -d -r1.152 -r1.152.2.1 --- print_api.php 21 Mar 2006 13:06:06 -0000 1.152 +++ print_api.php 15 May 2006 15:26:45 -0000 1.152.2.1 @@ -168,7 +168,7 @@ # This populates an option list with the appropriate users by access level # # @@@ from print_reporter_option_list - function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) { + function get_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) { $t_users = array(); if ( null === $p_project_id ) { @@ -199,9 +199,21 @@ array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display ); for ($i = 0; $i < count( $t_sort ); $i++ ) { $t_row = $t_users[$i]; - PRINT '<option value="' . $t_row['id'] . '" '; - check_selected( $p_user_id, $t_row['id'] ); - PRINT '>' . $t_display[$i] . '</option>'; + $t_list[ $t_row['id'] = $t_display[$i]; + } + return $t_list; + } + + # -------------------- + # This populates an option list with the appropriate users by access level + # + # @@@ from print_reporter_option_list + function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) { + $t_users = get_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ); + foreach ( $t_users as $t_id => $t_name ) { + PRINT '<option value="' . $t_id . '" '; + check_selected( $p_user_id, $t_id ); + PRINT '>' . $t_name . '</option>'; } } @@ -1412,7 +1424,7 @@ # -------------------- # Get icon corresponding to the specified filename - function print_file_icon( $p_filename ) { + function get_file_icon( $p_filename ) { $t_file_type_icons = config_get( 'file_type_icons' ); $ext = strtolower( file_get_extension( $p_filename ) ); @@ -1421,7 +1433,13 @@ } $t_name = $t_file_type_icons[$ext]; - PRINT '<img src="' . config_get( 'path' ) . 'images/'. $t_name . '" width="16" height="16" border="0" />'; + return config_get( 'path' ) . 'images/'. $t_name; + } + + # -------------------- + # Get icon corresponding to the specified filename + function print_file_icon( $p_filename ) { + PRINT '<img src="' . get_file_icon( $p_filename ) . '" width="16" height="16" border="0" />'; } ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | mantisbt/themes_c dummy_file_for_cvs,NONE,1.1.2.1, Glenn Henshaw |
|---|---|
| Next by Date: | web bot.php,1.15,1.16 sponsors.php,1.14,1.15, Victor Boctor |
| Previous by Thread: | mantisbt/themes_c dummy_file_for_cvs,NONE,1.1.2.1, Glenn Henshaw |
| Next by Thread: | web bot.php,1.15,1.16 sponsors.php,1.14,1.15, Victor Boctor |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |