summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2003-04-27 16:12:50 +0200
committerbbaetz%acm.org <>2003-04-27 16:12:50 +0200
commitd56611c283d252af894d27986496b1d36170c2da (patch)
tree190578849ab0b7e7f5758e2e996a54af5c3de043
parentb47c2c65cf72b993d5cedffd2325b6bfb90e28d5 (diff)
downloadbugzilla-d56611c283d252af894d27986496b1d36170c2da.tar.gz
bugzilla-d56611c283d252af894d27986496b1d36170c2da.tar.xz
Byg 202463 - prefill 'assign to' with default component owner
patch by slamm@yahoo-inc.com (Steve Lamm) r=bbaetz, a=justdave
-rwxr-xr-xenter_bug.cgi22
-rw-r--r--template/en/default/bug/create/create.html.tmpl51
2 files changed, 59 insertions, 14 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi
index 9784b81a3..8f736ff03 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -242,17 +242,19 @@ elsif (1 == @{$::components{$product}}) {
}
my @components;
-SendSQL("SELECT name, description FROM components " .
- "WHERE product_id = $product_id ORDER BY name");
+SendSQL("SELECT name, description, login_name, realname
+ FROM components, profiles
+ WHERE product_id = $product_id
+ AND initialowner=userid
+ ORDER BY name");
while (MoreSQLData()) {
- my ($name, $description) = FetchSQLData();
-
- my %component;
-
- $component{'name'} = $name;
- $component{'description'} = $description;
-
- push @components, \%component;
+ my ($name, $description, $login, $realname) = FetchSQLData();
+ push @components, {
+ name => $name,
+ description => $description,
+ default_login => $login,
+ default_realname => $realname,
+ };
}
my %default;
diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl
index fcc894e1e..4196f77bb 100644
--- a/template/en/default/bug/create/create.html.tmpl
+++ b/template/en/default/bug/create/create.html.tmpl
@@ -23,9 +23,52 @@
[% PROCESS global/header.html.tmpl
title = "Enter Bug"
h2 = "This page lets you enter a new bug into Bugzilla."
+ onload="set_assign_to();"
%]
-<form method="post" action="post_bug.cgi">
+<script type="text/javascript" language="JavaScript">
+<!--
+
+var default_owners = new Array([% component_.size %]);
+var components = new Array([% component_.size %]);
+[% count = 0 %]
+[%- FOREACH c = component_ %]
+ components[[% count %]] = "[% c.name FILTER html %]";
+ default_owners[[% count %]] = "[% c.default_login FILTER html %]";
+ [% count = count + 1 %]
+[%- END %]
+var last_default_owner;
+function set_assign_to() {
+ // Based on the selected component, fill the "Assign To:" field
+ // with the default component owner.
+ var form = document.Create;
+ assigned_to = form.assigned_to.value
+ var index = -1;
+ if (form.component.type == 'select-one') {
+ index = form.component.selectedIndex;
+ } else if (form.component.type == 'hidden') {
+ // Assume there is only one component in the list
+ index = 0;
+ }
+ if (index != -1) {
+ var owner = default_owners[index];
+ var component = components[index];
+ if (assigned_to == last_default_owner
+ || assigned_to == owner
+ || assigned_to == ''
+ || confirm('Would you like to change\n\n' +
+ ' "Assign To: ' + assigned_to + '"\n\n' +
+ 'to the default "' + component + '" owner:\n\n' +
+ ' ' + owner + "?")) {
+ form.assigned_to.value = owner;
+ last_default_owner = owner;
+ }
+ }
+}
+-->
+</script>
+
+<form name="Create" id="Create" method="post" action="post_bug.cgi">
<input type="hidden" name="product" value="[% product FILTER html %]">
<table cellspacing="2" cellpadding="0" border="0">
@@ -78,7 +121,7 @@
</strong>
</td>
<td>
- <select name="component" size="5">
+ <select name="component" onchange="set_assign_to();" size="5">
[%- FOREACH c = component_ %]
<option value="[% c.name FILTER html %]"
[% " selected=\"selected\"" IF c.name == default.component_ %]>
@@ -134,13 +177,13 @@
<tr>
<td align="right">
<strong>
- <a href="bug_status.html#assigned_to">Assigned To</a>:
+ <a href="bug_status.html#assigned_to">Assign To</a>:
</strong>
</td>
<td colspan="3">
<input name="assigned_to" size="32"
value="[% assigned_to FILTER html %]">
- (Leave blank to assign to default component owner)
+ <noscript>(Leave blank to assign to default component owner)</noscript>
</td>
</tr>