RSS
To get this branch, use:
bzr branch /bugzilla/4.2
2616 by jouni%heikniemi.net
Bug 141006: Run edit*.cgis in taint mode.
1
#!/usr/bin/perl -wT
193 by terry%netscape.com
Added new pages to edit existing components.
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
3
#
371 by dmose%mozilla.org
updated license boilerplate
4
# The contents of this file are subject to the Mozilla Public
5
# License Version 1.1 (the "License"); you may not use this file
6
# except in compliance with the License. You may obtain a copy of
7
# the License at http://www.mozilla.org/MPL/
8
#
9
# Software distributed under the License is distributed on an "AS
10
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
# implied. See the License for the specific language governing
12
# rights and limitations under the License.
13
#
14
# The Original Code is mozilla.org code.
15
#
16
# The Initial Developer of the Original Code is Holger
17
# Schurig. Portions created by Holger Schurig are
18
# Copyright (C) 1999 Holger Schurig. All
19
# Rights Reserved.
20
#
21
# Contributor(s): Holger Schurig <holgerschurig@nikocity.de>
1265 by justdave%syndicomm.com
Fix for bug 14461: QA contact is no longer required. You can still leave it blank in editing and creating components if you
22
#                 Terry Weissman <terry@mozilla.org>
3859 by lpsolit%gmail.com
Bug 271596: editcomponents priv allows you to see/edit products you don't have access to - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=justdave
23
#                 Frédéric Buclin <LpSolit@gmail.com>
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
24
#                 Akamai Technologies <bugzilla-dev@akamai.com>
193 by terry%netscape.com
Added new pages to edit existing components.
25
26
use strict;
5304 by mkanat%bugzilla.org
Bug 399954: Make Bugzilla able to hold its dependencies in a local directory
27
use lib qw(. lib);
193 by terry%netscape.com
Added new pages to edit existing components.
28
3966 by lpsolit%gmail.com
Bug 287325: Ability to add custom plain-text fields to a Bug - Patch by Myk Melez <myk@mozilla.org> r=mkanat a=justdave
29
use Bugzilla;
2537 by kiko%async.com.br
Fix for bug 234175: Remove deprecated ConnectToDatabase() and
30
use Bugzilla::Constants;
2770 by gerv%gerv.net
Bug 225687 - add group controls to charts, along with various other cleanups. Patch by gerv; r=joel, a=justdave.
31
use Bugzilla::Util;
4296 by lpsolit%gmail.com
Bug 282121: Remove globals.pl from scripts that no longer use it - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
32
use Bugzilla::Error;
3138 by mkanat%kerio.com
Bug 283237: Move DBname_to_id out of globals.pl
33
use Bugzilla::User;
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
34
use Bugzilla::Component;
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
35
use Bugzilla::Token;
2188 by gerv%gerv.net
Bug 16009 - generic charting. Patch by gerv; r,a=justdave.
36
2659 by timeless%mozdev.org
Bug 242405 Turning on QA contact causes taint error in Bugzilla/Series.pm when adding a component
37
my $cgi = Bugzilla->cgi;
3762 by lpsolit%gmail.com
Bug 312157: Remove $::template and $::vars from globals.pl - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
38
my $template = Bugzilla->template;
39
my $vars = {};
5311 by lpsolit%gmail.com
Part 2 of bug 182083: add Help for more admin pages - Patch by me, r=Colin
40
# There is only one section about components in the documentation,
41
# so all actions point to the same page.
42
$vars->{'doc_section'} = 'components.html';
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
43
44
#
45
# Preliminary checks:
46
#
193 by terry%netscape.com
Added new pages to edit existing components.
47
3308 by lpsolit%gmail.com
Bug 86328: Deleting bugs doesn't delete dependent records properly - Patch by Frederic Buclin <LpSolit@gmail.com> r=wurblzap a=justdave
48
my $user = Bugzilla->login(LOGIN_REQUIRED);
193 by terry%netscape.com
Added new pages to edit existing components.
49
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
50
print $cgi->header();
193 by terry%netscape.com
Added new pages to edit existing components.
51
3684 by lpsolit%gmail.com
Bug 304696: Replace UserInGroup() by $user->in_group() when checking user privs in edit*.cgi files - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave
52
$user->in_group('editcomponents')
4674 by lpsolit%gmail.com
Bug 189627: Implement per-product privileges - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
53
  || scalar(@{$user->get_products_by_permission('editcomponents')})
3001 by jocuri%softhome.net
Patch for bug 265898: edit*.cgi files should all use ThrowUserError(); patch by Frédéric Buclin <LpSolit@gmail.com>, r=vladd, a=myk.
54
  || ThrowUserError("auth_failure", {group  => "editcomponents",
55
                                     action => "edit",
56
                                     object => "components"});
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
57
58
#
59
# often used variables
60
#
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
61
my $product_name  = trim($cgi->param('product')     || '');
62
my $comp_name     = trim($cgi->param('component')   || '');
63
my $action        = trim($cgi->param('action')      || '');
64
my $showbugcounts = (defined $cgi->param('showbugcounts'));
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
65
my $token         = $cgi->param('token');
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
66
67
#
68
# product = '' -> Show nice list of products
69
#
70
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
71
unless ($product_name) {
4674 by lpsolit%gmail.com
Bug 189627: Implement per-product privileges - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
72
    my $selectable_products = $user->get_selectable_products;
73
    # If the user has editcomponents privs for some products only,
74
    # we have to restrict the list of products to display.
75
    unless ($user->in_group('editcomponents')) {
76
        $selectable_products = $user->get_products_by_permission('editcomponents');
77
    }
78
    $vars->{'products'} = $selectable_products;
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
79
    $vars->{'showbugcounts'} = $showbugcounts;
3859 by lpsolit%gmail.com
Bug 271596: editcomponents priv allows you to see/edit products you don't have access to - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=justdave
80
81
    $template->process("admin/components/select-product.html.tmpl", $vars)
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
82
      || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
83
    exit;
84
}
85
4674 by lpsolit%gmail.com
Bug 189627: Implement per-product privileges - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
86
my $product = $user->check_can_admin_product($product_name);
3859 by lpsolit%gmail.com
Bug 271596: editcomponents priv allows you to see/edit products you don't have access to - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=justdave
87
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
88
#
89
# action='' -> Show nice list of components
90
#
91
92
unless ($action) {
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
93
    $vars->{'showbugcounts'} = $showbugcounts;
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
94
    $vars->{'product'} = $product;
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
95
    $template->process("admin/components/list.html.tmpl", $vars)
96
        || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
97
    exit;
98
}
99
100
#
101
# action='add' -> present form for parameters for new component
102
#
103
# (next action will be 'new')
104
#
105
106
if ($action eq 'add') {
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
107
    $vars->{'token'} = issue_session_token('add_component');
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
108
    $vars->{'product'} = $product;
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
109
    $template->process("admin/components/create.html.tmpl", $vars)
110
        || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
111
    exit;
112
}
113
114
#
115
# action='new' -> add component entered in the 'action=add' screen
116
#
117
118
if ($action eq 'new') {
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
119
    check_token_data($token, 'add_component');
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
120
    # Do the user matching
6943 by Frédéric Buclin
Bug 534057: Auto-completion no longer works in email_in.pl
121
    Bugzilla::User::match_field ({
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
122
        'initialowner'     => { 'type' => 'single' },
123
        'initialqacontact' => { 'type' => 'single' },
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
124
        'initialcc'        => { 'type' => 'multi'  },
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
125
    });
126
127
    my $default_assignee   = trim($cgi->param('initialowner')     || '');
128
    my $default_qa_contact = trim($cgi->param('initialqacontact') || '');
129
    my $description        = trim($cgi->param('description')      || '');
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
130
    my @initial_cc         = $cgi->param('initialcc');
7456 by Dave Lawrence
Bug 77193 - Add the ability to retire (disable) old versions, components and milestones
131
    my $isactive           = $cgi->param('isactive');
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
132
6559 by lpsolit%gmail.com
Bug 487769: checksetup.pl can no longer create versions in TestProduct due to insufficient privileges (checksetup.pl fails) - Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r/a=LpSolit
133
    my $component = Bugzilla::Component->create({
134
        name             => $comp_name,
135
        product          => $product,
136
        description      => $description,
137
        initialowner     => $default_assignee,
138
        initialqacontact => $default_qa_contact,
139
        initial_cc       => \@initial_cc,
140
        # XXX We should not be creating series for products that we
141
        # didn't create series for.
142
        create_series    => 1,
143
   });
2188 by gerv%gerv.net
Bug 16009 - generic charting. Patch by gerv; r,a=justdave.
144
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
145
    $vars->{'message'} = 'component_created';
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
146
    $vars->{'comp'} = $component;
147
    $vars->{'product'} = $product;
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
148
    delete_token($token);
149
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
150
    $template->process("admin/components/list.html.tmpl", $vars)
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
151
      || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
152
    exit;
153
}
154
155
#
156
# action='del' -> ask if user really wants to delete
157
#
158
# (next action would be 'delete')
159
#
160
161
if ($action eq 'del') {
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
162
    $vars->{'token'} = issue_session_token('delete_component');
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
163
    $vars->{'comp'} =
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
164
      Bugzilla::Component->check({ product => $product, name => $comp_name });
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
165
    $vars->{'product'} = $product;
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
166
167
    $template->process("admin/components/confirm-delete.html.tmpl", $vars)
168
        || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
169
    exit;
170
}
171
172
#
173
# action='delete' -> really delete the component
174
#
175
176
if ($action eq 'delete') {
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
177
    check_token_data($token, 'delete_component');
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
178
    my $component =
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
179
        Bugzilla::Component->check({ product => $product, name => $comp_name });
180
181
    $component->remove_from_db;
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
182
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
183
    $vars->{'message'} = 'component_deleted';
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
184
    $vars->{'comp'} = $component;
185
    $vars->{'product'} = $product;
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
186
    $vars->{'no_edit_component_link'} = 1;
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
187
    delete_token($token);
188
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
189
    $template->process("admin/components/list.html.tmpl", $vars)
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
190
      || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
191
    exit;
192
}
193
194
#
195
# action='edit' -> present the edit component form
196
#
197
# (next action would be 'update')
198
#
199
200
if ($action eq 'edit') {
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
201
    $vars->{'token'} = issue_session_token('edit_component');
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
202
    my $component =
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
203
        Bugzilla::Component->check({ product => $product, name => $comp_name });
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
204
    $vars->{'comp'} = $component;
205
206
    $vars->{'initial_cc_names'} = 
207
        join(', ', map($_->login, @{$component->initial_cc}));
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
208
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
209
    $vars->{'product'} = $product;
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
210
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
211
    $template->process("admin/components/edit.html.tmpl", $vars)
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
212
      || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
213
    exit;
214
}
215
216
#
217
# action='update' -> update the component
218
#
219
220
if ($action eq 'update') {
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
221
    check_token_data($token, 'edit_component');
3622 by lpsolit%gmail.com
Bug 189635: editcomponents.cgi should use user-matching for the default assignee and QA contact - Patch by GavinS <bugzilla@chimpychompy.org> r=LpSolit a=justdave
222
    # Do the user matching
6943 by Frédéric Buclin
Bug 534057: Auto-completion no longer works in email_in.pl
223
    Bugzilla::User::match_field ({
3622 by lpsolit%gmail.com
Bug 189635: editcomponents.cgi should use user-matching for the default assignee and QA contact - Patch by GavinS <bugzilla@chimpychompy.org> r=LpSolit a=justdave
224
        'initialowner'     => { 'type' => 'single' },
225
        'initialqacontact' => { 'type' => 'single' },
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
226
        'initialcc'        => { 'type' => 'multi'  },
3622 by lpsolit%gmail.com
Bug 189635: editcomponents.cgi should use user-matching for the default assignee and QA contact - Patch by GavinS <bugzilla@chimpychompy.org> r=LpSolit a=justdave
227
    });
228
3668 by lpsolit%gmail.com
Bug 301743: Replace old code from editcomponents.cgi by methods and routines from Component.pm and Product.pm - Patch by Tiago R. Mello <timello@gmail.com> r=LpSolit a=justdave
229
    my $comp_old_name         = trim($cgi->param('componentold')     || '');
230
    my $default_assignee      = trim($cgi->param('initialowner')     || '');
231
    my $default_qa_contact    = trim($cgi->param('initialqacontact') || '');
232
    my $description           = trim($cgi->param('description')      || '');
4567 by mkanat%bugzilla.org
Bug 38922: Default (Initial) CC list for each component
233
    my @initial_cc            = $cgi->param('initialcc');
7456 by Dave Lawrence
Bug 77193 - Add the ability to retire (disable) old versions, components and milestones
234
    my $isactive              = $cgi->param('isactive');
235
  
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
236
    my $component =
237
        Bugzilla::Component->check({ product => $product, name => $comp_old_name });
238
239
    $component->set_name($comp_name);
240
    $component->set_description($description);
241
    $component->set_default_assignee($default_assignee);
242
    $component->set_default_qa_contact($default_qa_contact);
243
    $component->set_cc_list(\@initial_cc);
7456 by Dave Lawrence
Bug 77193 - Add the ability to retire (disable) old versions, components and milestones
244
    $component->set_is_active($isactive);
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
245
    my $changes = $component->update();
246
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
247
    $vars->{'message'} = 'component_updated';
4040 by lpsolit%gmail.com
Bug 311258: use objects in admin templates (products & co) - Patch by André Batosti <batosti@async.com.br> r=LpSolit a=justdave
248
    $vars->{'comp'} = $component;
249
    $vars->{'product'} = $product;
5296 by lpsolit%gmail.com
Bug 313123: Implement $component->create and $component->update based on Object.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
250
    $vars->{'changes'} = $changes;
4612 by lpsolit%gmail.com
Bug 281181: [SECURITY] It's way too easy to delete versions/components/milestones etc... - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
251
    delete_token($token);
252
5441 by lpsolit%gmail.com
Bug 325487: Admin pages should require less "clicks" (remove useless confirmation pages) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=justdave r=mkanat a=LpSolit
253
    $template->process("admin/components/list.html.tmpl", $vars)
2739 by jocuri%softhome.net
Patch for bug 190220: templatize editcomponents.cgi; patch by GavinS <bugzilla@chimpychompy.org>; r=jouni, a=justdave.
254
      || ThrowTemplateError($template->error());
353 by terry%mozilla.org
Patch by Holger Schurig <holger@holger.om.org> -- rewriting and enhancing the
255
    exit;
256
}
257
258
# No valid action found
7188 by Frédéric Buclin
Bug 565879: Merge ThrowCodeError("action_unrecognized"), ThrowUserError("no_valid_action") and ThrowCodeError("unknown_action")
259
ThrowUserError('unknown_action', {action => $action});