From bf646df2bc21afc10dc0b074b13c8742ef43d461 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 2 Mar 2006 06:10:22 +0000 Subject: =?UTF-8?q?Bug=20311258:=20use=20objects=20in=20admin=20templates?= =?UTF-8?q?=20(products=20&=20co)=20-=20Patch=20by=20Andr=C3=A9=20Batosti?= =?UTF-8?q?=20=20r=3DLpSolit=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editcomponents.cgi | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'editcomponents.cgi') diff --git a/editcomponents.cgi b/editcomponents.cgi index 3cbd71a9c..601873e83 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -96,8 +96,7 @@ $user->can_see_product($product->name) unless ($action) { $vars->{'showbugcounts'} = $showbugcounts; - $vars->{'product'} = $product->name; - $vars->{'components'} = $product->components; + $vars->{'product'} = $product; $template->process("admin/components/list.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -113,7 +112,7 @@ unless ($action) { if ($action eq 'add') { - $vars->{'product'} = $product->name; + $vars->{'product'} = $product; $template->process("admin/components/create.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -212,8 +211,12 @@ if ($action eq 'new') { # Make versioncache flush unlink "$datadir/versioncache"; - $vars->{'name'} = $comp_name; - $vars->{'product'} = $product->name; + $component = + new Bugzilla::Component({product_id => $product->id, + name => $comp_name}); + + $vars->{'comp'} = $component; + $vars->{'product'} = $product; $template->process("admin/components/created.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -234,7 +237,7 @@ if ($action eq 'del') { $vars->{'comp'} = Bugzilla::Component::check_component($product, $comp_name); - $vars->{'prod'} = $product; + $vars->{'product'} = $product; $template->process("admin/components/confirm-delete.html.tmpl", $vars) || ThrowTemplateError($template->error()); @@ -264,9 +267,7 @@ if ($action eq 'delete') { {nb => $component->bug_count }); } } - - $vars->{'deleted_bug_count'} = $component->bug_count; - + $dbh->bz_lock_tables('components WRITE', 'flaginclusions WRITE', 'flagexclusions WRITE'); @@ -281,8 +282,8 @@ if ($action eq 'delete') { unlink "$datadir/versioncache"; - $vars->{'name'} = $component->name; - $vars->{'product'} = $product->name; + $vars->{'comp'} = $component; + $vars->{'product'} = $product; $template->process("admin/components/deleted.html.tmpl", $vars) || ThrowTemplateError($template->error()); exit; @@ -301,7 +302,7 @@ if ($action eq 'edit') { $vars->{'comp'} = Bugzilla::Component::check_component($product, $comp_name); - $vars->{'prod'} = $product; + $vars->{'product'} = $product; $template->process("admin/components/edit.html.tmpl", $vars) @@ -379,7 +380,6 @@ if ($action eq 'update') { undef, ($description, $component_old->id)); $vars->{'updated_description'} = 1; - $vars->{'description'} = $description; } if ($default_assignee ne $component_old->default_assignee->login) { @@ -388,8 +388,6 @@ if ($action eq 'update') { undef, ($default_assignee_id, $component_old->id)); $vars->{'updated_initialowner'} = 1; - $vars->{'initialowner'} = $default_assignee; - } if (Param('useqacontact') @@ -399,13 +397,14 @@ if ($action eq 'update') { ($default_qa_contact_id, $component_old->id)); $vars->{'updated_initialqacontact'} = 1; - $vars->{'initialqacontact'} = $default_qa_contact; } $dbh->bz_unlock_tables(); - $vars->{'name'} = $comp_name; - $vars->{'product'} = $product->name; + my $component = new Bugzilla::Component($component_old->id); + + $vars->{'comp'} = $component; + $vars->{'product'} = $product; $template->process("admin/components/updated.html.tmpl", $vars) || ThrowTemplateError($template->error()); -- cgit v1.2.1