diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/admin/schema.php mantisbt/admin/schema.php
--- orig/admin/schema.php 2008-03-31 14:05:21.000000000 +0200
+++ mantisbt/admin/schema.php 2008-04-15 20:44:11.000000000 +0200
@@ -405,3 +405,5 @@
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), "
obsolete L NOTNULL DEFAULT \" '0' \"" ) );
+$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "
+ due_date T NOTNULL DEFAULT '1970-01-01' " ) );
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/bug_change_status_page.php mantisbt/bug_change_status_page.php
--- orig/bug_change_status_page.php 2008-03-31 13:45:26.000000000 +0200
+++ mantisbt/bug_change_status_page.php 2008-04-13 10:31:46.000000000 +0200
@@ -52,7 +52,7 @@
) ) {
access_denied();
}
-
+ $t_can_update_due_date = access_has_bug_level( config_get( 'due_date_update_threshold' ), $f_bug_id );
# get new issue handler if set, otherwise default to original handler
$f_handler_id = gpc_get_int( 'handler_id', bug_get_field( $f_bug_id, 'handler_id' ) );
@@ -161,6 +161,26 @@
+
+due_date ) ) {
+ $t_date_to_display = date( config_get( 'short_date_format' ), $t_bug->due_date );
+ }
+?>
+
>
+ |
+
+ |
+
+ ";
+ date_print_calendar( );
+ ?>
+ |
+
+
+
+
description = gpc_get_string( 'description' );
$t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) );
$t_bug_data->additional_information = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
+ $t_bug_data->due_date = gpc_get_string( 'due_date', '');
+ if ( is_blank ( $t_bug_data->due_date ) ) {
+ $t_bug_data->due_date = date_get_null();
+ }
$f_file = gpc_get_file( 'file', null ); #@@@ (thraxisp) Note that this always returns a structure
# size = 0, if no file
@@ -188,6 +192,7 @@
+
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/bug_report_advanced_page.php mantisbt/bug_report_advanced_page.php
--- orig/bug_report_advanced_page.php 2008-03-31 13:45:26.000000000 +0200
+++ mantisbt/bug_report_advanced_page.php 2008-04-13 10:25:43.000000000 +0200
@@ -45,6 +45,8 @@
( 0 == $f_master_bug_id ) ? '' : '?m_id=' . $f_master_bug_id );
}
+ $t_can_update_due_date = access_has_project_level( config_get( 'due_date_update_threshold' ), helper_get_current_project(), auth_get_current_user_id() );
+
if( $f_master_bug_id > 0 ) {
# master bug exists...
bug_ensure_exists( $f_master_bug_id );
@@ -114,6 +116,11 @@
$f_steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) );
$f_additional_info = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
$f_view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
+ $f_due_date =gpc_get_string( 'due_date', '');
+
+ if ( $f_due_date == '' ) {
+ $f_due_date = date_get_null();
+ }
$t_project_id = helper_get_current_project();
@@ -209,6 +216,26 @@
+
+
+>
+ |
+
+ |
+
+ ";
+ date_print_calendar();
+ ?>
+ |
+
+
@@ -554,6 +581,9 @@
window.document.report_bug_form.category_id.focus();
-->
-
+
+html_page_bottom1( __FILE__ ) ?>
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/bug_update.php mantisbt/bug_update.php
--- orig/bug_update.php 2008-03-31 13:45:27.000000000 +0200
+++ mantisbt/bug_update.php 2008-04-13 10:14:02.000000000 +0200
@@ -77,7 +77,11 @@
$t_bug_data->target_version = gpc_get_string( 'target_version', $t_bug_data->target_version );
$t_bug_data->view_state = gpc_get_int( 'view_state', $t_bug_data->view_state );
$t_bug_data->summary = gpc_get_string( 'summary', $t_bug_data->summary );
-
+ $t_bug_data->due_date = gpc_get_string( 'due_date', $t_bug_data->due_date);
+ if ( is_blank ( $t_bug_data->due_date ) ) {
+ $t_bug_data->due_date = date_get_null( );
+ }
+
$t_bug_data->description = gpc_get_string( 'description', $t_bug_data->description );
$t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', $t_bug_data->steps_to_reproduce );
$t_bug_data->additional_information = gpc_get_string( 'additional_information', $t_bug_data->additional_information );
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/bug_update_advanced_page.php mantisbt/bug_update_advanced_page.php
--- orig/bug_update_advanced_page.php 2008-03-31 13:45:27.000000000 +0200
+++ mantisbt/bug_update_advanced_page.php 2008-04-13 10:34:02.000000000 +0200
@@ -35,7 +35,7 @@
$f_bug_id = gpc_get_int( 'bug_id' );
$t_bug = bug_prepare_edit( bug_get( $f_bug_id, true ) );
-
+
if( $t_bug->project_id != helper_get_current_project() ) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
@@ -48,13 +48,13 @@
if ( SIMPLE_ONLY == config_get( 'show_update' ) ) {
print_header_redirect ( 'bug_update_page.php?bug_id=' . $f_bug_id );
}
-
+
if ( bug_is_readonly( $f_bug_id ) ) {
error_parameters( $f_bug_id );
trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
}
- access_ensure_bug_level( config_get( 'update_bug_threshold' ), $f_bug_id );
+ $t_can_update_due_date = access_has_bug_level( config_get( 'due_date_update_threshold' ), $f_bug_id );
html_page_top1( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
html_page_top2();
@@ -189,8 +189,34 @@
?>
-
- | |
+
+
+
+
+ |
+ ";
+ } else {
+ print "";
+ }
+ if ( $t_can_update_due_date ) {
+ $t_date_to_display = '';
+ if ( ! date_is_null( $t_bug->due_date ) ) {
+ $t_date_to_display = date( config_get( 'short_date_format' ), $t_bug->due_date );
+ }
+ print "";
+ date_print_calendar( );
+ ?>
+ |
+ due_date != $t_null_date ) print_date( config_get( 'short_date_format' ), $t_bug->due_date ); }?>
+
+
+
+ |
+
+
@@ -595,6 +621,10 @@
';
}
?>
view_state ) ?>
-
- |
+
+
+
+
+ |
+ ";
+ } else {
+ print "";
+ }
+ ?>
+ due_date ) ) {
+ print_date( config_get( 'short_date_format' ), $t_bug->due_date ); }
+ ?>
+ |
+
+
+ |
+
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/config_defaults_inc.php mantisbt/config_defaults_inc.php
--- orig/config_defaults_inc.php 2008-04-09 11:49:48.000000000 +0200
+++ mantisbt/config_defaults_inc.php 2008-04-13 10:14:02.000000000 +0200
@@ -1990,6 +1990,17 @@
# management threshold.
$g_manage_plugin_threshold = ADMINISTRATOR;
+
+ #############################
+ # Due Date
+ #############################
+
+ # threshold to update due date submitted
+ $g_due_date_update_threshold = DEVELOPER;
+
+ # threshold to see due date
+ $g_due_date_view_threshold = REPORTER;
+
#############################
# Mind mapping
#############################
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/core/bug_api.php mantisbt/core/bug_api.php
--- orig/core/bug_api.php 2008-03-31 13:45:23.000000000 +0200
+++ mantisbt/core/bug_api.php 2008-04-13 10:14:02.000000000 +0200
@@ -79,6 +79,9 @@
#internal helper objects
var $_stats = null;
+
+ #due date
+ var $due_date = '';
}
#===================================
@@ -105,6 +108,8 @@
$p_bug_database_result['date_submitted'] = db_unixtimestamp( $p_bug_database_result['date_submitted']['date_submitted'] );
if( !is_int( $p_bug_database_result['last_updated'] ) )
$p_bug_database_result['last_updated'] = db_unixtimestamp( $p_bug_database_result['last_updated'] );
+ if( !is_int( $p_bug_datebase_result['due_date'] ) )
+ $p_bug_datebase_result['due_date'] = db_unixtimestamp( $p_bug_datebase_result['due_date'] );
$g_cache_bug[ $p_bug_database_result['id'] ] = $p_bug_database_result;
if( !is_null( $p_stats ) ) {
$g_cache_bug[ $p_bug_database_result['id'] ]['_stats'] = $p_stats;
@@ -145,6 +150,8 @@
$row = db_fetch_array( $result );
$row['date_submitted'] = db_unixtimestamp( $row['date_submitted'] );
$row['last_updated'] = db_unixtimestamp( $row['last_updated'] );
+ $row['due_date'] = db_unixtimestamp( $row['due_date'] );
+
$g_cache_bug[$c_bug_id] = $row;
return $row;
@@ -335,6 +342,23 @@
}
# --------------------
+ # Check if the bug is overdue
+ function bug_is_overdue( $p_bug_id ) {
+ $t_bug_row = bug_cache_row( $p_bug_id );
+ $t_due_date = $t_bug_row[ 'due_date' ];
+ if ( ! date_is_null( $t_due_date) ) {
+ $t_now = db_unixtimestamp();
+ if ( $t_now > $t_due_date ) {
+ if ( bug_is_resolved( $p_bug_id ) ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ # --------------------
# Validate workflow state to see if bug can be moved to requested state
function bug_check_workflow( $p_bug_status, $p_wanted_status ) {
$t_status_enum_workflow = config_get( 'status_enum_workflow' );
@@ -393,6 +417,8 @@
$c_additional_info = $p_bug_data->additional_information;
$c_sponsorship_total = 0;
$c_sticky = 0;
+ $c_due_date = $p_bug_data->due_date;
+
# Summary cannot be blank
if ( is_blank( $c_summary ) ) {
@@ -419,6 +445,17 @@
$c_target_version = '';
}
+ #check due_date format
+ if ( !is_blank( $p_bug_data->due_date ) ) {
+ if ( !is_int( $p_bug_data->due_date ) ) {
+ $t_tmp = strtotime( $p_bug_data->due_date);
+ $c_due_date = date ( 'Y-m-d 00:00:01', $t_tmp );
+ } else {
+ $c_due_date = date ( 'Y-m-d H:i:s', $p_bug_data->due_date );
+ }
+ }
+
+
$t_bug_table = db_get_table( 'mantis_bug_table' );
$t_bug_text_table = db_get_table( 'mantis_bug_text_table' );
$t_category_table = db_get_table( 'mantis_category_table' );
@@ -474,7 +511,7 @@
platform, version,
build,
profile_id, summary, view_state, sponsorship_total, sticky, fixed_in_version,
- target_version
+ target_version, due_date
)
VALUES
( " . db_param(0) . ",
@@ -503,10 +540,11 @@
" . db_param(23) . ",
" . db_param(24) . ",
" . db_param(25) . ",
- " . db_param(26) . ")";
+ " . db_param(26) . ",
+ " . db_param(27) . ")";
db_query_bound( $query, Array( $c_project_id, $c_reporter_id, $c_handler_id, 0, $c_priority, $c_severity, $c_reproducibility, $t_status,
$t_resolution, 10, $c_category_id, db_now(), db_now(), 10, $t_text_id, $c_os, $c_os_build, $c_platform, $c_version,$c_build,
- $c_profile_id, $c_summary, $c_view_state, $c_sponsorship_total, $c_sticky, '', $c_target_version ) );
+ $c_profile_id, $c_summary, $c_view_state, $c_sponsorship_total, $c_sticky, '', $c_target_version, $c_due_date) );
$t_bug_id = db_insert_id($t_bug_table);
@@ -569,6 +607,7 @@
bug_set_field( $t_new_bug_id, 'target_version', $t_bug_data->target_version );
bug_set_field( $t_new_bug_id, 'sponsorship_total', 0 );
bug_set_field( $t_new_bug_id, 'sticky', 0 );
+ bug_set_field( $t_new_bug_id, 'due_date', $t_bug_data->due_date );
# COPY CUSTOM FIELDS
if ( $p_copy_custom_fields ) {
@@ -898,6 +937,16 @@
$t_fields[] = $c_bug_id;
db_query_bound( $query, $t_fields );
+
+ if ( !is_blank( $p_bug_data->due_date ) ) {
+ if ( !is_int( $p_bug_data->due_date ) ) {
+ $t_format = strtotime( $p_bug_data->due_date);
+ $p_bug_data->due_date = date ( 'Y-m-d 00:00:01', $t_format );
+ } else {
+ $p_bug_data->due_date = date ( 'Y-m-d H:i:s', $p_bug_data->due_date );
+ }
+ bug_set_field( $p_bug_id, 'due_date', $p_bug_data->due_date);
+ }
bug_clear_cache( $p_bug_id );
@@ -1190,17 +1239,34 @@
$c_status = $p_status; #generic, unknown type
$h_status = bug_get_field( $p_bug_id, $p_field_name );
+
+ if ( $p_field_name == 'due_date' ) {
+ if ( !date_is_null( $h_status ) ) {
+ $h_status = date( config_get ( 'short_date_format' ), $h_status );
+ } else {
+ $h_status = '';
+ }
+ $t_tmp = $p_status;
+ if ( !is_int( $p_status ) ) {
+ $t_tmp = strtotime( $p_status );
+ }
+ if ( !date_is_null( $t_tmp ) ) {
+ $c_status = date( 'Y-m-d 00:00:01', $t_tmp );
+ } else {
+ $c_status = '';
+ }
+ $c_field_name = lang_get( 'due_date' );
+ }
# return if status is already set
if ( $c_status == $h_status ) {
return true;
}
-
$t_bug_table = db_get_table( 'mantis_bug_table' );
# Update fields
$query = "UPDATE $t_bug_table
- SET $c_field_name=" . db_param(0) . "
+ SET $p_field_name=" . db_param(0) . "
WHERE id=" .db_param(1);
db_query_bound( $query, Array( $c_status, $c_bug_id ) );
@@ -1210,7 +1276,7 @@
# log changes except for duplicate_id which is obsolete and should be removed in
# Mantis 1.3.
if ( $p_field_name != 'duplicate_id' ) {
- history_log_event_direct( $p_bug_id, $p_field_name, $h_status, $p_status );
+ history_log_event_direct( $p_bug_id, $p_field_name, $h_status, $c_status );
}
bug_clear_cache( $p_bug_id );
@@ -1497,6 +1563,7 @@
$p_bug_data->summary = string_attribute( $p_bug_data->summary );
$p_bug_data->sponsorship_total = string_attribute( $p_bug_data->sponsorship_total );
$p_bug_data->sticky = string_attribute( $p_bug_data->sticky );
+ $p_bug_data->due_date = string_attribute( $p_bug_data->due_date );
$p_bug_data->description = string_textarea( $p_bug_data->description );
$p_bug_data->steps_to_reproduce = string_textarea( $p_bug_data->steps_to_reproduce );
@@ -1522,6 +1589,7 @@
$p_bug_data->summary = string_display_line_links( $p_bug_data->summary );
$p_bug_data->sponsorship_total = string_display_line( $p_bug_data->sponsorship_total );
$p_bug_data->sticky = string_display_line( $p_bug_data->sticky );
+ $p_bug_data->due_date = string_display_line( $p_bug_data->due_date );
$p_bug_data->description = string_display_links( $p_bug_data->description );
$p_bug_data->steps_to_reproduce = string_display_links( $p_bug_data->steps_to_reproduce );
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/core/columns_api.php mantisbt/core/columns_api.php
--- orig/core/columns_api.php 2008-04-13 10:12:16.000000000 +0200
+++ mantisbt/core/columns_api.php 2008-04-13 10:14:02.000000000 +0200
@@ -521,8 +521,12 @@
# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php
function print_column_edit( $p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) {
global $t_icon_path, $t_update_bug_threshold;
-
- echo '';
+
+ if ( bug_is_overdue( $p_row['id'] ) && access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_row['id'] )) {
+ print " | ";
+ } else {
+ echo ' | ';
+ }
if ( !bug_is_readonly( $p_row['id'] )
&& access_has_bug_level( $t_update_bug_threshold, $p_row['id'] ) ) {
echo '';
@@ -532,6 +536,20 @@
} else {
echo ' ';
}
+ if ( bug_is_overdue( $p_row['id'] ) && access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_row['id'] ) ) {
+ echo '';
+ echo ' ';
+ } else if ( ! date_is_null( $p_row[ 'due_date' ] ) && access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_row['id'] )) {
+ echo '';
+ echo ' ';
+ } else {
+ echo ' ';
+ }
+
echo ' | ';
}
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/core/date_api.php mantisbt/core/date_api.php
--- orig/core/date_api.php 2008-03-31 13:45:23.000000000 +0200
+++ mantisbt/core/date_api.php 2008-04-13 10:38:12.000000000 +0200
@@ -22,6 +22,20 @@
# --------------------------------------------------------
### Date API ###
+ # --------------------
+ # checks if date is null
+ function date_is_null ( $p_date ) {
+ if ( $p_date == date_get_null( ) ) {
+ return true;
+ }
+ return false;
+ }
+
+ # --------------------
+ # gets null date
+ function date_get_null ( ) {
+ return db_unixtimestamp( '1970-01-01 00:00:01' );
+ }
# --------------------
# prints the date given the formating string
@@ -149,4 +163,48 @@
}
}
}
+
+ # --------------------
+ # prints calendar icon and adds required javascript files.
+ # button_name is name of button that will display calendar icon
+ # in caste there are more than one calendar on page
+ function date_print_calendar ( $p_button_name = 'trigger' ) {
+ # @@@ (thraxisp) this may want a browser check ( MS IE >= 5.0, Mozilla >= 1.0, Safari >=1.2, ...)
+ if ( ( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ){
+ echo "\n";
+ echo "\n";
+ echo "\n";
+ echo "\n";
+ $t_icon_path = config_get( 'icon_path' );
+ $t_cal_icon = $t_icon_path ."calendar-img.gif";
+ echo "";
+ }
+ }
+ # --------------------
+ # creates javascript calendar objects, point to input element ($p_field_name) that
+ # diaplays date, and connects it with calendar button ($p_button_name) created with
+ # date_print_calendar.
+ # should be called right after tag
+ function date_finish_calendar ( $p_field_name, $p_button_name) {
+ # @@@ (thraxisp) this may want a browser check ( MS IE >= 5.0, Mozilla >= 1.0, Safari >=1.2, ...)
+ if ( ( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ){
+ $t_format = config_get( 'short_date_format' );
+ $t_new_format = str_replace( '-', '-%', $t_format );
+ $t_format = "%".$t_new_format;
+ echo "\n";
+ }
+ }
?>
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/core/filter_api.php mantisbt/core/filter_api.php
--- orig/core/filter_api.php 2008-04-09 11:49:48.000000000 +0200
+++ mantisbt/core/filter_api.php 2008-04-13 10:14:02.000000000 +0200
@@ -1537,6 +1537,7 @@
$row['date_submitted'] = db_unixtimestamp ( $row['date_submitted'] );
$row['last_updated'] = db_unixtimestamp ( $row['last_updated'] );
+ $row['due_date'] = db_unixtimestamp( $row['due_date'] );
array_push( $rows, $row );
}
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/css/default.css mantisbt/css/default.css
--- orig/css/default.css 2008-04-09 11:49:47.000000000 +0200
+++ mantisbt/css/default.css 2008-04-13 10:14:02.000000000 +0200
@@ -52,6 +52,7 @@
td.left { text-align: left; }
td.right { text-align: right; }
td.category { background-color: #c8c8e8; color: #000000; font-weight: bold; vertical-align : top; }
+td.overdue { background-color: #ff0000; color: #000000; font-weight: bold; }
td.col-1 { background-color: #d8d8d8; color: #000000; }
td.col-2 { background-color: #e8e8e8; color: #000000; }
diff -Naur --exclude=CVS --exclude=.svn --exclude='.git*' --exclude='*.swp' --exclude=config_inc.php orig/images/clock.png mantisbt/images/clock.png
--- orig/images/clock.png 1970-01-01 01:00:00.000000000 +0100
+++ mantisbt/images/clock.png 2008-04-13 10:14:02.000000000 +0200
@@ -0,0 +1,8 @@
+PNG
+
+
IHDR a gAMA 7 tEXtSoftware Adobe ImageReadyqe<