18
# Contributor(s): Albert Ting <alt@sonic.net>
18
# Contributor(s): Albert Ting <alt@sonic.net>
19
# Max Kanat-Alexander <mkanat@bugzilla.org>
19
# Max Kanat-Alexander <mkanat@bugzilla.org>
20
#
20
# Frédéric Buclin <LpSolit@gmail.com>
21
# Direct any questions on this source code to mozilla.org
21
23
use strict;
23
use strict;
24
use lib qw(. lib);
24
use lib qw(. lib);
39
my $action = shift;
39
my $action = shift;
40
my $cgi = Bugzilla->cgi;
40
my $cgi = Bugzilla->cgi;
41
my $template = Bugzilla->template;
41
my $template = Bugzilla->template;
43
$vars->{'classifications'} = [Bugzilla::Classification::get_all_classifications()]
44
if ($action eq 'select');
42
# There is currently only one section about classifications,
45
# There is currently only one section about classifications,
43
# so all pages point to it. Let's define it here.
46
# so all pages point to it. Let's define it here.
44
$vars->{'doc_section'} = 'classifications.html';
47
$vars->{'doc_section'} = 'classifications.html';
78
# action='' -> Show nice list of classifications
81
# action='' -> Show nice list of classifications
80
83
LoadTemplate('select') unless $action;
83
Bugzilla::Classification::get_all_classifications();
85
$vars->{'classifications'} = \@classifications;
86
LoadTemplate("select");
90
# action='add' -> present form for parameters for new classification
86
# action='add' -> present form for parameters for new classification
129
$dbh->do("INSERT INTO classifications (name, description, sortkey)
125
$dbh->do("INSERT INTO classifications (name, description, sortkey)
130
VALUES (?, ?, ?)", undef, ($class_name, $description, $sortkey));
126
VALUES (?, ?, ?)", undef, ($class_name, $description, $sortkey));
132
$vars->{'classification'} = $class_name;
134
delete_token($token);
128
delete_token($token);
135
LoadTemplate($action);
129
130
$vars->{'message'} = 'classification_created';
131
$vars->{'classification'} = new Bugzilla::Classification({name => $class_name});
132
$vars->{'classifications'} = [Bugzilla::Classification::get_all_classifications];
133
$vars->{'token'} = issue_session_token('reclassify_classifications');
134
LoadTemplate('reclassify');
177
# lock the tables before we start to change everything:
176
# lock the tables before we start to change everything:
178
$dbh->bz_start_transaction();
177
$dbh->bz_start_transaction();
179
# update products just in case
180
$dbh->do("UPDATE products SET classification_id = 1
181
WHERE classification_id = ?", undef, $classification->id);
180
# delete
183
# delete
181
$dbh->do("DELETE FROM classifications WHERE id = ?", undef,
184
$dbh->do("DELETE FROM classifications WHERE id = ?", undef,
182
$classification->id);
185
$classification->id);
184
# update products just in case
185
$dbh->do("UPDATE products SET classification_id = 1
186
WHERE classification_id = ?", undef, $classification->id);
188
$dbh->bz_commit_transaction();
187
$dbh->bz_commit_transaction();
190
$vars->{'classification'} = $classification;
189
$vars->{'message'} = 'classification_deleted';
191
190
$vars->{'classification'} = $class_name;
192
delete_token($token);
191
delete_token($token);
193
LoadTemplate($action);
192
LoadTemplate('select');
268
$dbh->bz_commit_transaction();
267
$dbh->bz_commit_transaction();
269
$vars->{'message'} = 'classification_updated';
270
$vars->{'classification'} = $class_name;
270
delete_token($token);
271
delete_token($token);
271
LoadTemplate($action);
272
LoadTemplate('select');
137
initialqacontact => $default_qa_contact,
137
initialqacontact => $default_qa_contact,
138
initial_cc => \@initial_cc });
138
initial_cc => \@initial_cc });
140
$vars->{'message'} = 'component_created';
140
$vars->{'comp'} = $component;
141
$vars->{'comp'} = $component;
141
$vars->{'product'} = $product;
142
$vars->{'product'} = $product;
142
delete_token($token);
143
delete_token($token);
144
$template->process("admin/components/created.html.tmpl", $vars)
145
$template->process("admin/components/list.html.tmpl", $vars)
145
|| ThrowTemplateError($template->error());
146
|| ThrowTemplateError($template->error());
175
$component->remove_from_db;
176
$component->remove_from_db;
178
$vars->{'message'} = 'component_deleted';
177
$vars->{'comp'} = $component;
179
$vars->{'comp'} = $component;
178
$vars->{'product'} = $product;
180
$vars->{'product'} = $product;
181
$vars->{'no_edit_component_link'} = 1;
179
delete_token($token);
182
delete_token($token);
181
$template->process("admin/components/deleted.html.tmpl", $vars)
184
$template->process("admin/components/list.html.tmpl", $vars)
182
|| ThrowTemplateError($template->error());
185
|| ThrowTemplateError($template->error());
234
$component->set_cc_list(\@initial_cc);
237
$component->set_cc_list(\@initial_cc);
235
my $changes = $component->update();
238
my $changes = $component->update();
240
$vars->{'message'} = 'component_updated';
237
$vars->{'comp'} = $component;
241
$vars->{'comp'} = $component;
238
$vars->{'product'} = $product;
242
$vars->{'product'} = $product;
239
$vars->{'changes'} = $changes;
243
$vars->{'changes'} = $changes;
240
delete_token($token);
244
delete_token($token);
242
$template->process("admin/components/updated.html.tmpl", $vars)
246
$template->process("admin/components/list.html.tmpl", $vars)
243
|| ThrowTemplateError($template->error());
247
|| ThrowTemplateError($template->error());
333
$dbh->bz_commit_transaction();
333
$dbh->bz_commit_transaction();
335
$vars->{'name'} = $cgi->param('name');
335
$vars->{'name'} = $name;
336
$vars->{'message'} = "flag_type_created";
336
$vars->{'message'} = "flag_type_created";
337
delete_token($token);
337
delete_token($token);
339
$vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
340
$vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
339
# Return the appropriate HTTP response headers.
342
# Return the appropriate HTTP response headers.
340
print $cgi->header();
343
print $cgi->header();
342
# Generate and return the UI (HTML page) from the appropriate template.
345
$template->process("admin/flag-type/list.html.tmpl", $vars)
343
$template->process("global/message.html.tmpl", $vars)
344
|| ThrowTemplateError($template->error());
346
|| ThrowTemplateError($template->error());
427
undef, $id);
429
undef, $id);
430
$vars->{'name'} = $cgi->param('name');
432
$vars->{'name'} = $name;
431
$vars->{'message'} = "flag_type_changes_saved";
433
$vars->{'message'} = "flag_type_changes_saved";
432
delete_token($token);
434
delete_token($token);
436
$vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
437
$vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
434
# Return the appropriate HTTP response headers.
439
# Return the appropriate HTTP response headers.
435
print $cgi->header();
440
print $cgi->header();
437
# Generate and return the UI (HTML page) from the appropriate template.
442
$template->process("admin/flag-type/list.html.tmpl", $vars)
438
$template->process("global/message.html.tmpl", $vars)
439
|| ThrowTemplateError($template->error());
443
|| ThrowTemplateError($template->error());
484
$vars->{'message'} = "flag_type_deleted";
488
$vars->{'message'} = "flag_type_deleted";
485
delete_token($token);
489
delete_token($token);
491
$vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
492
$vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
487
# Return the appropriate HTTP response headers.
494
# Return the appropriate HTTP response headers.
488
print $cgi->header();
495
print $cgi->header();
490
# Generate and return the UI (HTML page) from the appropriate template.
497
$template->process("admin/flag-type/list.html.tmpl", $vars)
491
$template->process("global/message.html.tmpl", $vars)
492
|| ThrowTemplateError($template->error());
498
|| ThrowTemplateError($template->error());
509
$vars->{'flag_type'} = $flag_type;
515
$vars->{'flag_type'} = $flag_type;
510
delete_token($token);
516
delete_token($token);
518
$vars->{'bug_types'} = Bugzilla::FlagType::match({'target_type' => 'bug'});
519
$vars->{'attachment_types'} = Bugzilla::FlagType::match({'target_type' => 'attachment'});
512
# Return the appropriate HTTP response headers.
521
# Return the appropriate HTTP response headers.
513
print $cgi->header();
522
print $cgi->header();
515
# Generate and return the UI (HTML page) from the appropriate template.
524
# Generate and return the UI (HTML page) from the appropriate template.
516
$template->process("global/message.html.tmpl", $vars)
525
$template->process("admin/flag-type/list.html.tmpl", $vars)
517
|| ThrowTemplateError($template->error());
526
|| ThrowTemplateError($template->error());
257
VALUES (?, ?, 1, ?, ?, ?)',
257
VALUES (?, ?, 1, ?, ?, ?)',
258
undef, ($name, $desc, $regexp, $isactive, $icon_url));
258
undef, ($name, $desc, $regexp, $isactive, $icon_url));
260
my $gid = $dbh->bz_last_key('groups', 'id');
260
my $group = new Bugzilla::Group({name => $name});
261
my $admin = Bugzilla::Group->new({name => 'admin'})->id();
261
my $admin = Bugzilla::Group->new({name => 'admin'})->id();
262
# Since we created a new group, give the "admin" group all privileges
262
# Since we created a new group, give the "admin" group all privileges
263
# initially.
263
# initially.
265
(member_id, grantor_id, grant_type)
265
(member_id, grantor_id, grant_type)
266
VALUES (?, ?, ?)');
266
VALUES (?, ?, ?)');
268
$sth->execute($admin, $gid, GROUP_MEMBERSHIP);
268
$sth->execute($admin, $group->id, GROUP_MEMBERSHIP);
269
$sth->execute($admin, $gid, GROUP_BLESS);
269
$sth->execute($admin, $group->id, GROUP_BLESS);
270
$sth->execute($admin, $gid, GROUP_VISIBLE);
270
$sth->execute($admin, $group->id, GROUP_VISIBLE);
272
# Permit all existing products to use the new group if makeproductgroups.
272
# Permit all existing products to use the new group if makeproductgroups.
273
if ($cgi->param('insertnew')) {
273
if ($cgi->param('insertnew')) {
275
(group_id, product_id, entry, membercontrol,
275
(group_id, product_id, entry, membercontrol,
276
othercontrol, canedit)
276
othercontrol, canedit)
277
SELECT ?, products.id, 0, ?, ?, 0 FROM products',
277
SELECT ?, products.id, 0, ?, ?, 0 FROM products',
278
undef, ($gid, CONTROLMAPSHOWN, CONTROLMAPNA));
278
undef, ($group->id, CONTROLMAPSHOWN, CONTROLMAPNA));
280
Bugzilla::Group::RederiveRegexp($regexp, $gid);
280
Bugzilla::Group::RederiveRegexp($regexp, $group->id);
281
delete_token($token);
281
delete_token($token);
283
$vars->{'message'} = 'group_created';
284
$vars->{'group'} = $group;
285
get_current_and_available($group, $vars);
286
$vars->{'token'} = issue_session_token('edit_group');
283
print $cgi->header();
288
print $cgi->header();
284
$template->process("admin/groups/created.html.tmpl", $vars)
289
$template->process("admin/groups/edit.html.tmpl", $vars)
285
|| ThrowTemplateError($template->error());
290
|| ThrowTemplateError($template->error());
455
delete_token($token);
460
delete_token($token);
462
$vars->{'message'} = 'group_deleted';
463
$vars->{'groups'} = [Bugzilla::Group->get_all];
457
print $cgi->header();
465
print $cgi->header();
458
$template->process("admin/groups/deleted.html.tmpl", $vars)
466
$template->process("admin/groups/list.html.tmpl", $vars)
459
|| ThrowTemplateError($template->error());
467
|| ThrowTemplateError($template->error());
521
$vars->{'users'} = \@deleted;
528
$vars->{'users'} = \@deleted;
522
$vars->{'regexp'} = $regexp;
529
$vars->{'regexp'} = $regexp;
523
delete_token($token);
530
delete_token($token);
532
$vars->{'message'} = 'group_membership_removed';
533
$vars->{'group'} = $group->name;
534
$vars->{'groups'} = [Bugzilla::Group->get_all];
525
print $cgi->header();
536
print $cgi->header();
526
$template->process("admin/groups/remove.html.tmpl", $vars)
537
$template->process("admin/groups/list.html.tmpl", $vars)
527
|| ThrowTemplateError($template->error());
538
|| ThrowTemplateError($template->error());
93
print $cgi->header();
93
print $cgi->header();
95
$vars->{'message'} = 'keyword_created';
95
$vars->{'name'} = $keyword->name;
96
$vars->{'name'} = $keyword->name;
96
$template->process("admin/keywords/created.html.tmpl", $vars)
97
$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
99
$template->process("admin/keywords/list.html.tmpl", $vars)
97
|| ThrowTemplateError($template->error());
100
|| ThrowTemplateError($template->error());
105
# action='edit' -> present the edit keywords from
106
# action='edit' -> present the edit keywords from
133
$keyword->set_name($cgi->param('name'));
134
$keyword->set_name($cgi->param('name'));
134
$keyword->set_description($cgi->param('description'));
135
$keyword->set_description($cgi->param('description'));
135
$keyword->update();
136
my $changes = $keyword->update();
137
delete_token($token);
138
delete_token($token);
139
print $cgi->header();
140
print $cgi->header();
142
$vars->{'message'} = 'keyword_updated';
141
$vars->{'keyword'} = $keyword;
143
$vars->{'keyword'} = $keyword;
142
$template->process("admin/keywords/rebuild-cache.html.tmpl", $vars)
144
$vars->{'changes'} = $changes;
145
$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
147
$template->process("admin/keywords/list.html.tmpl", $vars)
143
|| ThrowTemplateError($template->error());
148
|| ThrowTemplateError($template->error());
174
print $cgi->header();
178
print $cgi->header();
176
$template->process("admin/keywords/rebuild-cache.html.tmpl", $vars)
180
$vars->{'message'} = 'keyword_deleted';
181
$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
183
$template->process("admin/keywords/list.html.tmpl", $vars)
177
|| ThrowTemplateError($template->error());
184
|| ThrowTemplateError($template->error());
1
#!/usr/bin/perl -wT
1
#!/usr/bin/perl -wT
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
4
#
4
# The contents of this file are subject to the Mozilla Public
5
# This is a script to edit the target milestones. It is largely a copy of
5
# License Version 1.1 (the "License"); you may not use this file
6
# the editversions.cgi script, since the two fields were set up in a
6
# except in compliance with the License. You may obtain a copy of
7
# very similar fashion.
7
# the License at http://www.mozilla.org/MPL/
9
# (basically replace each occurrence of 'milestone' with 'version', and
9
# Software distributed under the License is distributed on an "AS
10
# you'll have the original script)
10
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
#
11
# implied. See the License for the specific language governing
12
# Matt Masson <matthew@zeroknowledge.com>
12
# rights and limitations under the License.
14
# Contributors : Gavin Shelley <bugzilla@chimpychompy.org>
14
# The Initial Developer of the Original Code is Matt Masson.
15
# Portions created by Matt Masson are Copyright (C) 2000 Matt Masson.
16
# All Rights Reserved.
18
# Contributors : Matt Masson <matthew@zeroknowledge.com>
19
# Gavin Shelley <bugzilla@chimpychompy.org>
15
# Frédéric Buclin <LpSolit@gmail.com>
20
# Frédéric Buclin <LpSolit@gmail.com>
18
use strict;
22
use strict;
19
use lib qw(. lib);
23
use lib qw(. lib);
116
sortkey => $sortkey });
120
sortkey => $sortkey });
117
delete_token($token);
121
delete_token($token);
123
$vars->{'message'} = 'milestone_created';
119
$vars->{'milestone'} = $milestone;
124
$vars->{'milestone'} = $milestone;
120
$vars->{'product'} = $product;
125
$vars->{'product'} = $product;
121
$template->process("admin/milestones/created.html.tmpl", $vars)
126
$template->process("admin/milestones/list.html.tmpl", $vars)
122
|| ThrowTemplateError($template->error());
127
|| ThrowTemplateError($template->error());
158
$milestone->remove_from_db;
163
$milestone->remove_from_db;
159
delete_token($token);
164
delete_token($token);
166
$vars->{'message'} = 'milestone_deleted';
161
$vars->{'milestone'} = $milestone;
167
$vars->{'milestone'} = $milestone;
162
$vars->{'product'} = $product;
168
$vars->{'product'} = $product;
169
$vars->{'no_edit_milestone_link'} = 1;
164
$template->process("admin/milestones/deleted.html.tmpl", $vars)
171
$template->process("admin/milestones/list.html.tmpl", $vars)
165
|| ThrowTemplateError($template->error());
172
|| ThrowTemplateError($template->error());
203
delete_token($token);
210
delete_token($token);
212
$vars->{'message'} = 'milestone_updated';
205
$vars->{'milestone'} = $milestone;
213
$vars->{'milestone'} = $milestone;
206
$vars->{'product'} = $product;
214
$vars->{'product'} = $product;
207
$vars->{'changes'} = $changes;
215
$vars->{'changes'} = $changes;
208
$template->process("admin/milestones/updated.html.tmpl", $vars)
216
$template->process("admin/milestones/list.html.tmpl", $vars)
209
|| ThrowTemplateError($template->error());
217
|| ThrowTemplateError($template->error());
26
# Frédéric Buclin <LpSolit@gmail.com>
26
# Frédéric Buclin <LpSolit@gmail.com>
27
# Greg Hendricks <ghendricks@novell.com>
27
# Greg Hendricks <ghendricks@novell.com>
28
# Lance Larsh <lance.larsh@oracle.com>
28
# Lance Larsh <lance.larsh@oracle.com>
30
# Direct any questions on this source code to
32
# Holger Schurig <holgerschurig@nikocity.de>
34
use strict;
30
use strict;
35
use lib qw(. lib);
31
use lib qw(. lib);
73
action => "edit",
69
action => "edit",
74
object => "products"});
70
object => "products"});
72
sub get_group_controls {
75
my $group_controls = $product->group_controls;
76
# Convert Group Controls (membercontrol and othercontrol) from
77
# integer to string to display Membercontrol/Othercontrol names
80
(CONTROLMAPNA) => 'NA',
81
(CONTROLMAPSHOWN) => 'Shown',
82
(CONTROLMAPDEFAULT) => 'Default',
83
(CONTROLMAPMANDATORY) => 'Mandatory'};
85
foreach my $group (keys %$group_controls) {
86
foreach my $control ('membercontrol', 'othercontrol') {
87
$group_controls->{$group}->{$control} =
88
$constants->{$group_controls->{$group}->{$control}};
91
return $group_controls;
77
# often used variables
95
# often used variables
340
delete_token($token);
358
delete_token($token);
360
$vars->{'message'} = 'product_created';