diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 53984c982..d52707470 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -87,28 +87,44 @@ var flags = new Array([% product.active_components.size %]); [% count = count + 1 %] [%- END %] -function Create_onsubmit() +var wantsReminder = [% Bugzilla.user.wants_worktime_reminder('new bug') ? 'true' : 'false' %]; +var noTimeTracking = [% product.notimetracking ? 'true' : 'false' %]; + +function validateEntryForm(theform) { - var wt = bzParseTime(document.Create.work_time.value); - if (wt !== null && (wt === undefined || wt != wt)) - wt = null; - else if (wt < 0) - wt = 0; -[% IF Bugzilla.user.wants_worktime_reminder('new bug') %] - if (wt === null || [% product.notimetracking ? "wt != 0" : "wt == 0" %]) - { - wt = prompt("Please, verify working time:", "0"); - if (wt == null || wt == undefined || (""+wt).length <= 0) + if (theform.short_desc.value == '') { - document.Create.work_time.focus(); - return false; + alert('Please enter a summary sentence for this [% terms.bug %].'); + return false; } - } -[% END %] - if (wt === null) - wt = 0; - document.Create.work_time.value = wt; - return true; + // Validate attachment + var t = document.getElementById('attachment_true'); + if (t.style.display != 'none' && !validateAttachmentForm(theform)) + return false; + else if (t.style.display == 'none') + { + // Clear attachment description so it won't be created + theform.description.value = ''; + } + // Validate worktime + var wt = bzParseTime(theform.work_time.value); + if (wt !== null && (wt === undefined || wt != wt)) + wt = null; + else if (wt < 0) + wt = 0; + if (wantsReminder && (wt === null || noTimeTracking == (wt != 0))) + { + wt = prompt("Please, verify working time:", "0"); + if (wt == null || wt == undefined || (""+wt).length <= 0) + { + theform.work_time.focus(); + return false; + } + } + if (wt === null) + wt = 0; + theform.work_time.value = wt; + return true; } function set_assign_to() { @@ -247,12 +263,13 @@ function show_resolution_field(showhide) } } -function checkWorktime() +function checkWorktime(inp) { - [% IF product.notimetracking %] - wt = bzParseTime(document.Create.work_time.value); - document.Create.work_time.parentNode.style.backgroundColor = wt != 0 ? '#FFC0C0' : null; - [% END %] + if (noTimeTracking) + { + wt = bzParseTime(inp.value); + inp.parentNode.style.backgroundColor = (wt != 0 ? '#FFC0C0' : null); + } } TUI_alternates['expert_fields'] = 'Show Advanced Fields'; @@ -273,7 +290,7 @@ TUI_hide_default('expert_fields');
+ onsubmit="return validateEntryForm(this)"> @@ -543,7 +560,7 @@ TUI_hide_default('expert_fields');   Hours Worked: - + [% END %] Depends on: @@ -746,10 +763,7 @@ TUI_hide_default('expert_fields');   - +