diff --git a/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm b/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm index 502546e79ea..4f83ee6c543 100644 --- a/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm +++ b/mozilla/webtools/testopia/Bugzilla/Testopia/Product.pm @@ -41,7 +41,7 @@ sub environments { push @objs, Bugzilla::Testopia::Environment->new($id); } $self->{'environments'} = \@objs; - return $self->{'environmets'}; + return $self->{'environments'}; } sub builds { diff --git a/mozilla/webtools/testopia/template/en/default/testopia/run/add.html.tmpl b/mozilla/webtools/testopia/template/en/default/testopia/run/add.html.tmpl index e220ee4e439..c63c89b5a38 100644 --- a/mozilla/webtools/testopia/template/en/default/testopia/run/add.html.tmpl +++ b/mozilla/webtools/testopia/template/en/default/testopia/run/add.html.tmpl @@ -38,6 +38,7 @@ [% PROCESS global/header.html.tmpl %] + [% PROCESS testopia/style.none.tmpl %] [% PROCESS testopia/search/variables.none.tmpl %] diff --git a/mozilla/webtools/testopia/template/en/default/testopia/run/form.html.tmpl b/mozilla/webtools/testopia/template/en/default/testopia/run/form.html.tmpl index 9573d1df9d5..319df03e8be 100644 --- a/mozilla/webtools/testopia/template/en/default/testopia/run/form.html.tmpl +++ b/mozilla/webtools/testopia/template/en/default/testopia/run/form.html.tmpl @@ -18,7 +18,31 @@ # Contributor(s): Ed Fuentetaja # Greg Hendricks #%] - + + + @@ -44,24 +68,6 @@ - - - - - - - + + + + + + + @@ -89,5 +134,8 @@
Manager Environment - - - New -
Status - [% SET statuslist = [{ id => 1, name => 'Running'}, {id => 0, name=> 'Stopped'}] %] - [% PROCESS select sel = { name => "status", - list => statuslist, - default => run.stop_date ? 0 : 1 } - %] - - Build [% PROCESS select sel = { name => "build", @@ -74,6 +80,45 @@
Status + [% SET statuslist = [{ id => 1, name => 'Running'}, {id => 0, name=> 'Stopped'}] %] + [% PROCESS select sel = { name => "status", + list => statuslist, + default => run.stop_date ? 0 : 1 } + %] + +
+ + + + + + + + + + + + + + +
Environment
ID + + New +
Or Select from Product + [% PROCESS select sel = { name => 'prod_pick', + list => user.get_selectable_products, + default => run.plan.product_id + events => 'onChange="getProdEnvs(this.value)"' } %] +
+ [% PROCESS select sel = { name => 'env_pick' }%] +
Summary
- +
+ diff --git a/mozilla/webtools/testopia/tr_new_plan.cgi b/mozilla/webtools/testopia/tr_new_plan.cgi index 313b66005d2..aabc871fe6d 100755 --- a/mozilla/webtools/testopia/tr_new_plan.cgi +++ b/mozilla/webtools/testopia/tr_new_plan.cgi @@ -130,6 +130,21 @@ elsif ($action eq 'getcomps'){ print $json->objToJson(\@comps); exit; } +elsif ($action eq 'getenvs'){ + Bugzilla->login; + my $product_id = $cgi->param('product_id'); + + detaint_natural($product_id); + my $product = Bugzilla::Testopia::Product->new($product_id); + + my @envs; + foreach my $e (@{$product->environments}){ + push @envs, {'id' => $e->id, 'name' => $e->name}; + } + my $json = new JSON; + print $json->objToJson(\@envs); + exit; +} #################### ### Display Form ### #################### diff --git a/mozilla/webtools/testopia/tr_new_run.cgi b/mozilla/webtools/testopia/tr_new_run.cgi index 55355e8321f..1372da2b58b 100755 --- a/mozilla/webtools/testopia/tr_new_run.cgi +++ b/mozilla/webtools/testopia/tr_new_run.cgi @@ -85,7 +85,7 @@ if ($action eq 'Add'){ my $build = $cgi->param('build'); my $summary = $cgi->param('summary'); my $notes = $cgi->param('notes'); - my $env = $cgi->param('environment'); + my $env = $cgi->param('environment') ? $cgi->param('environment') : $cgi->param('env_pick'); ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if $summary eq ''; ThrowUserError('testopia-missing-required-field', {'field' => 'environment'}) if $env eq ''; diff --git a/mozilla/webtools/testopia/tr_show_run.cgi b/mozilla/webtools/testopia/tr_show_run.cgi index 66d36eb452c..5e0b7e4ae8d 100755 --- a/mozilla/webtools/testopia/tr_show_run.cgi +++ b/mozilla/webtools/testopia/tr_show_run.cgi @@ -337,8 +337,6 @@ sub get_cc_xml { sub do_update { my ($run) = @_; - ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if ($cgi->param('summary') eq ''); - ThrowUserError('testopia-missing-required-field', {'field' => 'environment'}) if ($cgi->param('environment') eq ''); my $timestamp; $timestamp = $run->stop_date; $timestamp = undef if $cgi->param('status') && $run->stop_date; @@ -347,9 +345,12 @@ sub do_update { my $prodver = $cgi->param('product_version'); my $planver = $cgi->param('plan_version'); my $build = $cgi->param('build'); - my $env = $cgi->param('environment'); + my $env = $cgi->param('environment') ? $cgi->param('environment') : $cgi->param('env_pick'); my $manager = DBNameToIdAndCheck(trim($cgi->param('manager'))); my $notes = trim($cgi->param('notes')); + + ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if ($cgi->param('summary') eq ''); + ThrowUserError('testopia-missing-required-field', {'field' => 'environment'}) if ($env eq ''); trick_taint($summary); trick_taint($prodver);