View Issue Details

IDProjectCategoryView StatusLast Update
0008860mantisbttime trackingpublic2017-04-26 12:00
ReporterkynxAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version1.3.0-beta.1 
Target VersionFixed in Version 
Summary0008860: User entered time is overwritten
Description

If you enter a time (say '0:15:00') for a note then click the 'Start' button, the time you enter is overwritten with whatever value the stopwatch already has.

This is annoying when you've already put time into the bug but have only just gone to the bug page.

The attached patch adds an onblur handler to the time input that updates the stopwatch with the user-entered value. It also adds some (very basic) validation to the time entered. Tested in FF2.0.0.11 and IE6.

Tagspatch

Activities

2008-02-06 05:56

 

time_tracking_edit.diff (1,473 bytes)
Index: javascript/time_tracking_stopwatch.js
===================================================================
--- javascript/time_tracking_stopwatch.js	(revision 4960)
+++ javascript/time_tracking_stopwatch.js	(working copy)
@@ -42,5 +42,21 @@
 	}
 }
 
+function time_tracking_swonblur(input) {
+	var time = input.value.split(/:/);
+	var mult = [3600, 60, 1];
+	var new_ms = 0;
+	for (i=0; i<time.length && i<3; i++)
+	{
+		if (isNaN(parseInt(time[i])))
+		{
+			alert('Please enter a valid time');
+			return false;
+		}
+		new_ms += parseInt(time[i]) * mult[i] * 1000;
+	}	
+	time_tracking_ms = new_ms;
+}
+
 setTimeout("time_tracking_display();", 1000);
 
Index: bugnote_add_inc.php
===================================================================
--- bugnote_add_inc.php	(revision 4960)
+++ bugnote_add_inc.php	(working copy)
@@ -77,7 +77,7 @@
 	<td>
 		<?php if ( config_get('time_tracking_stopwatch') && ON == config_get( 'use_javascript' )) { ?>
 		<script type="text/javascript" language="JavaScript" src="javascript/time_tracking_stopwatch.js"></script>
-		<input type="text" name="time_tracking" size="5" value="00:00" />
+		<input type="text" name="time_tracking" onblur="time_tracking_swonblur(this)" size="5" value="00:00" />
 		<input type="button" name="time_tracking_ssbutton" value="Start" onclick="time_tracking_swstartstop()" />
 		<input type="button" name="time_tracking_reset" value="R" onclick="time_tracking_swreset()" />
 		<?php } else { ?>
time_tracking_edit.diff (1,473 bytes)
AbsolutelyFreeWeb

AbsolutelyFreeWeb

2011-12-24 05:12

reporter   ~0030691

LOL, assigned since 2008 and NO UPDATE?

atrol

atrol

2014-02-01 06:14

developer   ~0039270

Unassigned after having been assigned for a long time without progress.

ethraza

ethraza

2017-04-26 12:00

reporter   ~0056723

Came to talk about it and found this.
Nine years? What was wrong with this diff at the time? This would work in the 2.3.1 branch or now is too late to apply this diff?

Issue History

Date Modified Username Field Change
2008-02-06 05:56 kynx New Issue
2008-02-06 05:56 kynx File Added: time_tracking_edit.diff
2008-04-21 09:56 daryn Status new => assigned
2008-04-21 09:56 daryn Assigned To => daryn
2011-12-24 05:12 AbsolutelyFreeWeb Note Added: 0030691
2014-02-01 06:14 atrol Tag Attached: patch
2014-02-01 06:14 atrol Note Added: 0039270
2014-02-01 06:14 atrol Assigned To daryn =>
2014-02-01 06:14 atrol Status assigned => acknowledged
2014-10-12 18:35 grangeway Product Version git trunk => 1.3.0-beta.1
2017-04-26 12:00 ethraza Note Added: 0056723