From 8ec8da0491ad89604700b3e29a227966f6d84ba1 Mon Sep 17 00:00:00 2001 From: Perl Tidy Date: Wed, 5 Dec 2018 15:38:52 -0500 Subject: no bug - reformat all the code using the new perltidy rules --- editcomponents.cgi | 274 +++++++++++++++++++++++++++-------------------------- 1 file changed, 139 insertions(+), 135 deletions(-) (limited to 'editcomponents.cgi') diff --git a/editcomponents.cgi b/editcomponents.cgi index f8cef5971..5070b1d1f 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -20,9 +20,10 @@ use Bugzilla::User; use Bugzilla::Component; use Bugzilla::Token; -my $cgi = Bugzilla->cgi; +my $cgi = Bugzilla->cgi; my $template = Bugzilla->template; -my $vars = {}; +my $vars = {}; + # There is only one section about components in the documentation, # so all actions point to the same page. $vars->{'doc_section'} = 'components.html'; @@ -37,16 +38,15 @@ print $cgi->header(); $user->in_group('editcomponents') || scalar(@{$user->get_products_by_permission('editcomponents')}) - || ThrowUserError("auth_failure", {group => "editcomponents", - action => "edit", - object => "components"}); + || ThrowUserError("auth_failure", + {group => "editcomponents", action => "edit", object => "components"}); # # often used variables # -my $product_name = trim($cgi->param('product') || ''); -my $comp_name = trim($cgi->param('component') || ''); -my $action = trim($cgi->param('action') || ''); +my $product_name = trim($cgi->param('product') || ''); +my $comp_name = trim($cgi->param('component') || ''); +my $action = trim($cgi->param('action') || ''); my $showbugcounts = (defined $cgi->param('showbugcounts')); my $token = $cgi->param('token'); @@ -55,18 +55,19 @@ my $token = $cgi->param('token'); # unless ($product_name) { - my $selectable_products = $user->get_selectable_products; - # If the user has editcomponents privs for some products only, - # we have to restrict the list of products to display. - unless ($user->in_group('editcomponents')) { - $selectable_products = $user->get_products_by_permission('editcomponents'); - } - $vars->{'products'} = $selectable_products; - $vars->{'showbugcounts'} = $showbugcounts; - - $template->process("admin/components/select-product.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + my $selectable_products = $user->get_selectable_products; + + # If the user has editcomponents privs for some products only, + # we have to restrict the list of products to display. + unless ($user->in_group('editcomponents')) { + $selectable_products = $user->get_products_by_permission('editcomponents'); + } + $vars->{'products'} = $selectable_products; + $vars->{'showbugcounts'} = $showbugcounts; + + $template->process("admin/components/select-product.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } my $product = $user->check_can_admin_product($product_name); @@ -76,11 +77,11 @@ my $product = $user->check_can_admin_product($product_name); # unless ($action) { - $vars->{'showbugcounts'} = $showbugcounts; - $vars->{'product'} = $product; - $template->process("admin/components/list.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + $vars->{'showbugcounts'} = $showbugcounts; + $vars->{'product'} = $product; + $template->process("admin/components/list.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # @@ -90,11 +91,11 @@ unless ($action) { # if ($action eq 'add') { - $vars->{'token'} = issue_session_token('add_component'); - $vars->{'product'} = $product; - $template->process("admin/components/create.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + $vars->{'token'} = issue_session_token('add_component'); + $vars->{'product'} = $product; + $template->process("admin/components/create.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # @@ -102,43 +103,45 @@ if ($action eq 'add') { # if ($action eq 'new') { - check_token_data($token, 'add_component'); - # Do the user matching - Bugzilla::User::match_field ({ - 'initialowner' => { 'type' => 'single' }, - 'initialqacontact' => { 'type' => 'single' }, - 'triage_owner' => { 'type' => 'single' }, - 'initialcc' => { 'type' => 'multi' }, - }); - - my $default_assignee = trim($cgi->param('initialowner') || ''); - my $default_qa_contact = trim($cgi->param('initialqacontact') || ''); - my $description = trim($cgi->param('description') || ''); - my $triage_owner = trim($cgi->param('triage_owner') || ''); - my @initial_cc = $cgi->param('initialcc'); - my $isactive = $cgi->param('isactive'); - - my $component = Bugzilla::Component->create({ - name => $comp_name, - product => $product, - description => $description, - initialowner => $default_assignee, - initialqacontact => $default_qa_contact, - initial_cc => \@initial_cc, - triage_owner_id => $triage_owner, - # XXX We should not be creating series for products that we - # didn't create series for. - create_series => 1, - }); - - $vars->{'message'} = 'component_created'; - $vars->{'comp'} = $component; - $vars->{'product'} = $product; - delete_token($token); - - $template->process("admin/components/list.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + check_token_data($token, 'add_component'); + + # Do the user matching + Bugzilla::User::match_field({ + 'initialowner' => {'type' => 'single'}, + 'initialqacontact' => {'type' => 'single'}, + 'triage_owner' => {'type' => 'single'}, + 'initialcc' => {'type' => 'multi'}, + }); + + my $default_assignee = trim($cgi->param('initialowner') || ''); + my $default_qa_contact = trim($cgi->param('initialqacontact') || ''); + my $description = trim($cgi->param('description') || ''); + my $triage_owner = trim($cgi->param('triage_owner') || ''); + my @initial_cc = $cgi->param('initialcc'); + my $isactive = $cgi->param('isactive'); + + my $component = Bugzilla::Component->create({ + name => $comp_name, + product => $product, + description => $description, + initialowner => $default_assignee, + initialqacontact => $default_qa_contact, + initial_cc => \@initial_cc, + triage_owner_id => $triage_owner, + + # XXX We should not be creating series for products that we + # didn't create series for. + create_series => 1, + }); + + $vars->{'message'} = 'component_created'; + $vars->{'comp'} = $component; + $vars->{'product'} = $product; + delete_token($token); + + $template->process("admin/components/list.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # @@ -148,14 +151,14 @@ if ($action eq 'new') { # if ($action eq 'del') { - $vars->{'token'} = issue_session_token('delete_component'); - $vars->{'comp'} = - Bugzilla::Component->check({ product => $product, name => $comp_name }); - $vars->{'product'} = $product; - - $template->process("admin/components/confirm-delete.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + $vars->{'token'} = issue_session_token('delete_component'); + $vars->{'comp'} + = Bugzilla::Component->check({product => $product, name => $comp_name}); + $vars->{'product'} = $product; + + $template->process("admin/components/confirm-delete.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # @@ -163,21 +166,21 @@ if ($action eq 'del') { # if ($action eq 'delete') { - check_token_data($token, 'delete_component'); - my $component = - Bugzilla::Component->check({ product => $product, name => $comp_name }); + check_token_data($token, 'delete_component'); + my $component + = Bugzilla::Component->check({product => $product, name => $comp_name}); - $component->remove_from_db; + $component->remove_from_db; - $vars->{'message'} = 'component_deleted'; - $vars->{'comp'} = $component; - $vars->{'product'} = $product; - $vars->{'no_edit_component_link'} = 1; - delete_token($token); + $vars->{'message'} = 'component_deleted'; + $vars->{'comp'} = $component; + $vars->{'product'} = $product; + $vars->{'no_edit_component_link'} = 1; + delete_token($token); - $template->process("admin/components/list.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + $template->process("admin/components/list.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # @@ -187,19 +190,19 @@ if ($action eq 'delete') { # if ($action eq 'edit') { - $vars->{'token'} = issue_session_token('edit_component'); - my $component = - Bugzilla::Component->check({ product => $product, name => $comp_name }); - $vars->{'comp'} = $component; + $vars->{'token'} = issue_session_token('edit_component'); + my $component + = Bugzilla::Component->check({product => $product, name => $comp_name}); + $vars->{'comp'} = $component; - $vars->{'initial_cc_names'} = - join(', ', map($_->login, @{$component->initial_cc})); + $vars->{'initial_cc_names'} + = join(', ', map($_->login, @{$component->initial_cc})); - $vars->{'product'} = $product; + $vars->{'product'} = $product; - $template->process("admin/components/edit.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + $template->process("admin/components/edit.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # @@ -207,44 +210,45 @@ if ($action eq 'edit') { # if ($action eq 'update') { - check_token_data($token, 'edit_component'); - # Do the user matching - Bugzilla::User::match_field ({ - 'initialowner' => { 'type' => 'single' }, - 'initialqacontact' => { 'type' => 'single' }, - 'triage_owner' => { 'type' => 'single' }, - 'initialcc' => { 'type' => 'multi' }, - }); - - my $comp_old_name = trim($cgi->param('componentold') || ''); - my $default_assignee = trim($cgi->param('initialowner') || ''); - my $default_qa_contact = trim($cgi->param('initialqacontact') || ''); - my $description = trim($cgi->param('description') || ''); - my $triage_owner = trim($cgi->param('triage_owner') || ''); - my @initial_cc = $cgi->param('initialcc'); - my $isactive = $cgi->param('isactive'); - - my $component = - Bugzilla::Component->check({ product => $product, name => $comp_old_name }); - - $component->set_name($comp_name); - $component->set_description($description); - $component->set_default_assignee($default_assignee); - $component->set_default_qa_contact($default_qa_contact); - $component->set_triage_owner($triage_owner); - $component->set_cc_list(\@initial_cc); - $component->set_is_active($isactive); - my $changes = $component->update(); - - $vars->{'message'} = 'component_updated'; - $vars->{'comp'} = $component; - $vars->{'product'} = $product; - $vars->{'changes'} = $changes; - delete_token($token); - - $template->process("admin/components/list.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - exit; + check_token_data($token, 'edit_component'); + + # Do the user matching + Bugzilla::User::match_field({ + 'initialowner' => {'type' => 'single'}, + 'initialqacontact' => {'type' => 'single'}, + 'triage_owner' => {'type' => 'single'}, + 'initialcc' => {'type' => 'multi'}, + }); + + my $comp_old_name = trim($cgi->param('componentold') || ''); + my $default_assignee = trim($cgi->param('initialowner') || ''); + my $default_qa_contact = trim($cgi->param('initialqacontact') || ''); + my $description = trim($cgi->param('description') || ''); + my $triage_owner = trim($cgi->param('triage_owner') || ''); + my @initial_cc = $cgi->param('initialcc'); + my $isactive = $cgi->param('isactive'); + + my $component + = Bugzilla::Component->check({product => $product, name => $comp_old_name}); + + $component->set_name($comp_name); + $component->set_description($description); + $component->set_default_assignee($default_assignee); + $component->set_default_qa_contact($default_qa_contact); + $component->set_triage_owner($triage_owner); + $component->set_cc_list(\@initial_cc); + $component->set_is_active($isactive); + my $changes = $component->update(); + + $vars->{'message'} = 'component_updated'; + $vars->{'comp'} = $component; + $vars->{'product'} = $product; + $vars->{'changes'} = $changes; + delete_token($token); + + $template->process("admin/components/list.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; } # No valid action found -- cgit v1.2.3-24-g4f1b