From 88d26275229b5f52f435130496169766313c87b7 Mon Sep 17 00:00:00 2001 From: "bugreport%peshkin.net" <> Date: Sat, 21 Aug 2004 04:49:17 +0000 Subject: Bug 224208 Add a higher level of categorization (.ie departments, locations, etc.) patch by Albert Ting r=joel, glob a=myk --- Bugzilla/Bug.pm | 10 +- Bugzilla/Search.pm | 17 +- buglist.cgi | 6 + bugzilla.dtd | 4 +- checksetup.pl | 19 + colchange.cgi | 9 +- defparams.pl | 17 + editclassifications.cgi | 391 +++++++++++++++++++++ editproducts.cgi | 225 ++++++++++-- enter_bug.cgi | 57 ++- globals.pl | 89 ++++- js/productform.js | 76 +++- long_list.cgi | 9 +- query.cgi | 23 +- report.cgi | 8 +- .../en/default/admin/classifications/add.html.tmpl | 45 +++ .../en/default/admin/classifications/del.html.tmpl | 60 ++++ .../default/admin/classifications/delete.html.tmpl | 31 ++ .../default/admin/classifications/edit.html.tmpl | 70 ++++ .../en/default/admin/classifications/new.html.tmpl | 32 ++ .../admin/classifications/reclassify.html.tmpl | 84 +++++ .../default/admin/classifications/select.html.tmpl | 70 ++++ .../default/admin/classifications/update.html.tmpl | 37 ++ .../admin/products/groupcontrol/edit.html.tmpl | 2 + template/en/default/bug/edit.html.tmpl | 5 + template/en/default/bug/show-multiple.html.tmpl | 10 +- template/en/default/filterexceptions.pl | 1 + .../default/global/choose-classification.html.tmpl | 65 ++++ template/en/default/global/field-descs.none.tmpl | 1 + template/en/default/global/useful-links.html.tmpl | 11 +- template/en/default/global/user-error.html.tmpl | 38 ++ template/en/default/search/form.html.tmpl | 106 +++++- .../en/default/search/search-advanced.html.tmpl | 35 +- template/en/default/search/search-help.html.tmpl | 7 +- .../default/search/search-report-graph.html.tmpl | 8 +- .../default/search/search-report-select.html.tmpl | 2 +- .../default/search/search-report-table.html.tmpl | 8 +- .../en/default/search/search-specific.html.tmpl | 22 +- 38 files changed, 1607 insertions(+), 103 deletions(-) create mode 100755 editclassifications.cgi create mode 100644 template/en/default/admin/classifications/add.html.tmpl create mode 100644 template/en/default/admin/classifications/del.html.tmpl create mode 100644 template/en/default/admin/classifications/delete.html.tmpl create mode 100644 template/en/default/admin/classifications/edit.html.tmpl create mode 100644 template/en/default/admin/classifications/new.html.tmpl create mode 100644 template/en/default/admin/classifications/reclassify.html.tmpl create mode 100644 template/en/default/admin/classifications/select.html.tmpl create mode 100644 template/en/default/admin/classifications/update.html.tmpl create mode 100644 template/en/default/global/choose-classification.html.tmpl diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 8863f5432..d5aa5fd17 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -48,6 +48,7 @@ sub fields { # Keep this ordering in sync with bugzilla.dtd my @fields = qw(bug_id alias creation_ts short_desc delta_ts reporter_accessible cclist_accessible + classification_id classification product component version rep_platform op_sys bug_status resolution bug_file_loc status_whiteboard keywords @@ -137,7 +138,8 @@ sub initBug { my $query = " SELECT - bugs.bug_id, alias, bugs.product_id, products.name, version, + bugs.bug_id, alias, products.classification_id, classifications.name, + bugs.product_id, products.name, version, rep_platform, op_sys, bug_status, resolution, priority, bug_severity, bugs.component_id, components.name, assigned_to, reporter, bug_file_loc, short_desc, target_milestone, @@ -147,8 +149,9 @@ sub initBug { reporter_accessible, cclist_accessible, estimated_time, remaining_time from bugs left join votes using(bug_id), - products, components + classifications, products, components where bugs.bug_id = $bug_id + AND classifications.id = products.classification_id AND products.id = bugs.product_id AND components.id = bugs.component_id group by bugs.bug_id"; @@ -159,7 +162,8 @@ sub initBug { if ((@row = &::FetchSQLData()) && $self->{'who'}->can_see_bug($bug_id)) { my $count = 0; my %fields; - foreach my $field ("bug_id", "alias", "product_id", "product", "version", + foreach my $field ("bug_id", "alias", "classification_id", "classification", + "product_id", "product", "version", "rep_platform", "op_sys", "bug_status", "resolution", "priority", "bug_severity", "component_id", "component", "assigned_to", "reporter", "bug_file_loc", "short_desc", diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 91785963f..23bb34eae 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -96,6 +96,11 @@ sub init { push @wherepart, "bugs.product_id = map_products.id"; } + if (lsearch($fieldsref, 'map_classifications.name') >= 0) { + push @supptables, "classifications AS map_classifications"; + push @wherepart, "map_products.classification_id = map_classifications.id"; + } + if (lsearch($fieldsref, 'map_components.name') >= 0) { push @supptables, "components AS map_components"; push @wherepart, "bugs.component_id = map_components.id"; @@ -152,7 +157,7 @@ sub init { my @legal_fields = ("product", "version", "rep_platform", "op_sys", "bug_status", "resolution", "priority", "bug_severity", - "assigned_to", "reporter", "component", + "assigned_to", "reporter", "component", "classification", "target_milestone", "bug_group"); foreach my $field ($params->param()) { @@ -761,6 +766,16 @@ sub init { $term); }, + "^classification,(?!changed)" => sub { + # Generate the restriction condition + $f = $ff = "classifications.name"; + $funcsbykey{",$t"}->(); + $term = build_subselect("map_products.classification_id", + "classifications.id", + "classifications", + $term); + }, + "^keywords," => sub { &::GetVersionTable(); my @list; diff --git a/buglist.cgi b/buglist.cgi index eaca25612..3c575d2b8 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -458,6 +458,7 @@ DefineColumn("short_desc" , "bugs.short_desc" , "Summary" DefineColumn("status_whiteboard" , "bugs.status_whiteboard" , "Status Summary" ); DefineColumn("component" , "map_components.name" , "Component" ); DefineColumn("product" , "map_products.name" , "Product" ); +DefineColumn("classification" , "map_classifications.name" , "Classification" ); DefineColumn("version" , "bugs.version" , "Version" ); DefineColumn("op_sys" , "bugs.op_sys" , "OS" ); DefineColumn("target_milestone" , "bugs.target_milestone" , "Target Milestone" ); @@ -554,6 +555,11 @@ if (grep('relevance', @displaycolumns) && !$fulltext) { my @selectcolumns = ("bug_id", "bug_severity", "priority", "bug_status", "resolution"); +# if using classification, we also need to look in product.classification_id +if (Param("useclassification")) { + push (@selectcolumns,"product"); +} + # remaining and actual_time are required for precentage_complete calculation: if (lsearch(\@displaycolumns, "percentage_complete") >= 0) { push (@selectcolumns, "remaining_time"); diff --git a/bugzilla.dtd b/bugzilla.dtd index aecf9920d..82ccfff18 100644 --- a/bugzilla.dtd +++ b/bugzilla.dtd @@ -5,7 +5,7 @@ maintainer CDATA #REQUIRED exporter CDATA #IMPLIED > - + @@ -16,6 +16,8 @@ + + diff --git a/checksetup.pl b/checksetup.pl index 703358cec..807fa9016 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1786,10 +1786,17 @@ $table{logincookies} = index(lastused)'; +$table{classifications} = + 'id smallint not null auto_increment primary key, + name varchar(64) not null, + description mediumtext, + + unique(name)'; $table{products} = 'id smallint not null auto_increment primary key, name varchar(64) not null, + classification_id smallint not null default 1, description mediumtext, milestoneurl tinytext not null, disallownew tinyint not null, @@ -2153,6 +2160,7 @@ sub AddFDef ($$$) { # be created with their associated schema change. AddFDef("bug_id", "Bug \#", 1); AddFDef("short_desc", "Summary", 1); +AddFDef("classification", "Classification", 1); AddFDef("product", "Product", 1); AddFDef("version", "Version", 1); AddFDef("rep_platform", "Platform", 1); @@ -4021,6 +4029,7 @@ AddField("profiles", "extern_id", "varchar(64)"); AddGroup('tweakparams', 'Can tweak operating parameters'); AddGroup('editusers', 'Can edit or disable users'); AddGroup('creategroups', 'Can create and destroy groups.'); +AddGroup('editclassifications', 'Can create, destroy, and edit classifications.'); AddGroup('editcomponents', 'Can create, destroy, and edit components.'); AddGroup('editkeywords', 'Can create, destroy, and edit keywords.'); AddGroup('admin', 'Administrators'); @@ -4388,6 +4397,16 @@ if (GetFieldDef('bugs', 'short_desc')->[2]) { # if it allows nulls $dbh->do("UPDATE groups SET last_changed = NOW() WHERE name = 'admin'"); +# 2003-10-24 - alt@sonic.net, bug 224208 +# Support classification level and make sure there is a default classification +AddField('products', 'classification_id', 'smallint DEFAULT 1'); +$sth = $dbh->prepare("SELECT name FROM classifications WHERE id=1"); +$sth->execute; +if (! $sth->rows) { + $dbh->do("INSERT INTO classifications (id,name,description) " . + "VALUES(1,'Unclassified','Unassigned to any classifications')"); +} + # # Final checks... diff --git a/colchange.cgi b/colchange.cgi index 8d3ee49da..03d5388bf 100755 --- a/colchange.cgi +++ b/colchange.cgi @@ -47,8 +47,13 @@ my $cgi = Bugzilla->cgi; my @masterlist = ("opendate", "changeddate", "bug_severity", "priority", "rep_platform", "assigned_to", "assigned_to_realname", "reporter", "reporter_realname", "bug_status", - "resolution", "product", "component", "version", "op_sys", - "votes"); + "resolution"); + +if (Param("useclassification")) { + push(@masterlist, "classification"); +} + +push(@masterlist, ("product", "component", "version", "op_sys", "votes")); if (Param("usebugaliases")) { unshift(@masterlist, "alias"); diff --git a/defparams.pl b/defparams.pl index 8260be978..c0e608a4d 100644 --- a/defparams.pl +++ b/defparams.pl @@ -320,6 +320,23 @@ sub find_languages { checker => \&check_multi }, + { + name => 'useclassification', + desc => 'If this is on, Bugzilla will associate each product with a ' . + 'specific classification. But you must have "editclassification" ' . + 'permissions enabled in order to edit classifications', + type => 'b', + default => 0 + }, + + { + name => 'showallproducts', + desc => 'If this is on and useclassification is set, Bugzilla will add a' . + '"All" link in the "New Bug" page to list all available products', + type => 'b', + default => 0 + }, + { name => 'makeproductgroups', desc => 'If this is on, Bugzilla will associate a bug group with each ' . diff --git a/editclassifications.cgi b/editclassifications.cgi new file mode 100755 index 000000000..c1186f792 --- /dev/null +++ b/editclassifications.cgi @@ -0,0 +1,391 @@ +#!/usr/bin/perl -wT +# -*- Mode: perl; indent-tabs-mode: nil; cperl-indent-level: 4 -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Albert Ting +# +# Contributor(s): Albert Ting +# +# Direct any questions on this source code to mozilla.org + +use strict; +use lib "."; + +use Bugzilla; +use Bugzilla::Constants; +require "CGI.pl"; +require "globals.pl"; + +my $cgi = Bugzilla->cgi; +my $dbh = Bugzilla->dbh; + +use vars qw ($template $vars); + +# TestClassification: just returns if the specified classification does exists +# CheckClassification: same check, optionally emit an error text + +sub TestClassification ($) { + my $cl = shift; + + trick_taint($cl); + # does the classification exist? + my $sth = $dbh->prepare("SELECT name + FROM classifications + WHERE name=?"); + $sth->execute($cl); + my @row = $sth->fetchrow_array(); + return $row[0]; +} + +sub CheckClassification ($) { + my $cl = shift; + + unless ($cl) { + ThrowUserError("classification_not_specified"); + } + if (! TestClassification($cl)) { + ThrowUserError("classification_doesnt_exist", { name => $cl }); + } +} + +sub LoadTemplate ($) { + my $action = shift; + + $action =~ /(\w+)/; + $action = $1; + print $cgi->header(); + $template->process("admin/classifications/$action.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; +} + +# +# Preliminary checks: +# + +Bugzilla->login(LOGIN_REQUIRED); + +print $cgi->header(); + +ThrowUserError("auth_cant_edit_classifications") unless UserInGroup("editclassifications"); +ThrowUserError("auth_classification_not_enabled") unless Param("useclassification"); + +# +# often used variables +# +my $action = trim($cgi->param('action') || ''); +my $classification = trim($cgi->param('classification') || ''); +trick_taint($classification); +$vars->{'classification'} = $classification; + +# +# action='' -> Show nice list of classifications +# + +unless ($action) { + my @classifications; + # left join is tricky + # - must select "classifications" fields if you want a REAL value + # - must use "count(products.classification_id)" if you want a true + # count. If you use count(classifications.id), it will return 1 for NULL + # - must use "group by classifications.id" instead of + # products.classification_id. Otherwise it won't look for all + # classification ids, just the ones used by the products. + my $sth = $dbh->prepare("SELECT classifications.id,classifications.name, + classifications.description, + COUNT(classification_id) as total + FROM classifications + LEFT JOIN products ON classifications.id=products.classification_id + GROUP BY classifications.id + ORDER BY name"); + $sth->execute(); + while (my ($id,$classification,$description,$total) = $sth->fetchrow_array()) { + my $cl = {}; + $cl->{'id'} = $id; + $cl->{'classification'} = $classification; + $cl->{'description'} = $description if (defined $description); + $cl->{'total'} = $total; + + push(@classifications, $cl); + } + + $vars->{'classifications'} = \@classifications; + LoadTemplate("select"); +} + +# +# action='add' -> present form for parameters for new classification +# +# (next action will be 'new') +# + +if ($action eq 'add') { + LoadTemplate($action); +} + +# +# action='new' -> add classification entered in the 'action=add' screen +# + +if ($action eq 'new') { + if (TestClassification($classification)) { + ThrowUserError("classification_already_exists", { name => $classification }); + } + my $description = trim($cgi->param('description') || ''); + trick_taint($description); + + # Add the new classification. + my $sth = $dbh->prepare("INSERT INTO classifications (name,description) + VALUES (?,?)"); + $sth->execute($classification,$description); + + # Make versioncache flush + unlink "data/versioncache"; + + LoadTemplate($action); +} + +# +# action='del' -> ask if user really wants to delete +# +# (next action would be 'delete') +# + +if ($action eq 'del') { + CheckClassification($classification); + my $sth; + + # display some data about the classification + $sth = $dbh->prepare("SELECT id, description + FROM classifications + WHERE name=?"); + $sth->execute($classification); + my ($classification_id, $description) = $sth->fetchrow_array(); + + ThrowUserError("classification_not_deletable") if ($classification_id eq "1"); + + $sth = $dbh->prepare("SELECT name + FROM products + WHERE classification_id=$classification_id"); + $sth->execute(); + ThrowUserError("classification_has_products") if ($sth->fetchrow_array()); + + $vars->{'description'} = $description if (defined $description); + + LoadTemplate($action); +} + +# +# action='delete' -> really delete the classification +# + +if ($action eq 'delete') { + CheckClassification($classification); + + my $sth; + my $classification_id = get_classification_id($classification); + + if ($classification_id == 1) { + ThrowUserError("cant_delete_default_classification", { name => $classification }); + } + + # lock the tables before we start to change everything: + $dbh->do("LOCK TABLES classifications WRITE, products WRITE"); + + # delete + $sth = $dbh->prepare("DELETE FROM classifications WHERE id=?"); + $sth->execute($classification_id); + + # update products just in case + $sth = $dbh->prepare("UPDATE products + SET classification_id=1 + WHERE classification_id=?"); + $sth->execute($classification_id); + + $dbh->do("UNLOCK TABLES"); + + unlink "data/versioncache"; + + LoadTemplate($action); +} + +# +# action='edit' -> present the edit classifications from +# +# (next action would be 'update') +# + +if ($action eq 'edit') { + CheckClassification($classification); + + my @products = (); + my $has_products = 0; + my $sth; + + + # get data of classification + $sth = $dbh->prepare("SELECT id,description + FROM classifications + WHERE name=?"); + $sth->execute($classification); + my ($classification_id,$description) = $sth->fetchrow_array(); + $vars->{'description'} = $description if (defined $description); + + $sth = $dbh->prepare("SELECT name,description + FROM products + WHERE classification_id=? + ORDER BY name"); + $sth->execute($classification_id); + while ( my ($product, $prod_description) = $sth->fetchrow_array()) { + my $prod = {}; + $has_products = 1; + $prod->{'name'} = $product; + $prod->{'description'} = $prod_description if (defined $prod_description); + push(@products, $prod); + } + $vars->{'products'} = \@products if ($has_products); + + LoadTemplate($action); +} + +# +# action='update' -> update the classification +# + +if ($action eq 'update') { + my $classificationold = trim($cgi->param('classificationold') || ''); + my $description = trim($cgi->param('description') || ''); + my $descriptionold = trim($cgi->param('descriptionold') || ''); + my $checkvotes = 0; + my $sth; + + CheckClassification($classificationold); + + my $classification_id = get_classification_id($classificationold); + trick_taint($description); + + # Note that we got the $classification_id using $classificationold + # above so it will remain static even after we rename the + # classification in the database. + + $dbh->do("LOCK TABLES classifications WRITE"); + + if ($description ne $descriptionold) { + $sth = $dbh->prepare("UPDATE classifications + SET description=? + WHERE id=?"); + $sth->execute($description,$classification_id); + $vars->{'updated_description'} = 1; + } + + if ($classification ne $classificationold) { + unless ($classification) { + $dbh->do("UNLOCK TABLES"); + ThrowUserError("classification_not_specified") + } + + if (TestClassification($classification)) { + $dbh->do("UNLOCK TABLES"); + ThrowUserError("classification_already_exists", { name => $classification }); + } + $sth = $dbh->prepare("UPDATE classifications + SET name=? WHERE id=?"); + $sth->execute($classification,$classification_id); + $vars->{'updated_classification'} = 1; + } + $dbh->do("UNLOCK TABLES"); + + unlink "data/versioncache"; + LoadTemplate($action); +} + +# +# action='reclassify' -> reclassify products for the classification +# + +if ($action eq 'reclassify') { + CheckClassification($classification); + my $sth; + + # display some data about the classification + $sth = $dbh->prepare("SELECT id, description + FROM classifications + WHERE name=?"); + $sth->execute($classification); + my ($classification_id, $description) = $sth->fetchrow_array(); + + $vars->{'description'} = $description if (defined $description); + + $sth = $dbh->prepare("UPDATE products + SET classification_id=? + WHERE name=?"); + if (defined $cgi->param('add_products')) { + if (defined $cgi->param('prodlist')) { + foreach my $prod ($cgi->param("prodlist")) { + trick_taint($prod); + $sth->execute($classification_id,$prod); + } + } + } elsif (defined $cgi->param('remove_products')) { + if (defined $cgi->param('myprodlist')) { + foreach my $prod ($cgi->param("myprodlist")) { + trick_taint($prod); + $sth->execute(1,$prod); + } + } + } elsif (defined $cgi->param('migrate_products')) { + if (defined $cgi->param('clprodlist')) { + foreach my $prod ($cgi->param("clprodlist")) { + trick_taint($prod); + $sth->execute($classification_id,$prod); + } + } + } + + my @selected_products = (); + my @class_products = (); + + $sth = $dbh->prepare("SELECT classifications.id, + products.name, + classifications.name, + classifications.id > 1 as unknown + FROM products,classifications + WHERE classifications.id=products.classification_id + ORDER BY unknown, products.name, classifications.name"); + $sth->execute(); + while ( my ($clid, $name, $clname) = $sth->fetchrow_array() ) { + if ($clid == $classification_id) { + push(@selected_products,$name); + } else { + my $cl = {}; + if ($clid == 1) { + $cl->{'name'} = "[$clname] $name"; + } else { + $cl->{'name'} = "$name [$clname]"; + } + $cl->{'value'} = $name; + push(@class_products,$cl); + } + } + $vars->{'selected_products'} = \@selected_products; + $vars->{'class_products'} = \@class_products; + + LoadTemplate($action); +} + +# +# No valid action found +# + +ThrowCodeError("action_unrecognized", $vars); diff --git a/editproducts.cgi b/editproducts.cgi index bd71bdd6d..74a62166e 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -86,20 +86,80 @@ sub CheckProduct ($) } } +# TestClassification: just returns if the specified classification does exists +# CheckClassification: same check, optionally emit an error text + +sub TestClassification ($) +{ + my $cl = shift; + + # does the classification exist? + SendSQL("SELECT name + FROM classifications + WHERE name=" . SqlQuote($cl)); + return FetchOneColumn(); +} + +sub CheckClassification ($) +{ + my $cl = shift; + + # do we have a classification? + unless ($cl) { + print "Sorry, you haven't specified a classification."; + PutTrailer(); + exit; + } + + unless (TestClassification $cl) { + print "Sorry, classification '$cl' does not exist."; + PutTrailer(); + exit; + } +} + +sub CheckClassificationProduct ($$) +{ + my $cl = shift; + my $prod = shift; + + CheckClassification($cl); + CheckProduct($prod); + + # does the classification exist? + SendSQL("SELECT products.name + FROM products,classifications + WHERE products.name=" . SqlQuote($prod) . + " AND classifications.name=" . SqlQuote($cl)); + my $res = FetchOneColumn(); + + unless ($res) { + print "Sorry, classification->product '$cl'->'$prod' does not exist."; + PutTrailer(); + exit; + } +} + # # Displays the form to edit a products parameters # -sub EmitFormElements ($$$$$$$$) +sub EmitFormElements ($$$$$$$$$) { - my ($product, $description, $milestoneurl, $disallownew, + my ($classification, $product, $description, $milestoneurl, $disallownew, $votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone) = @_; $product = value_quote($product); $description = value_quote($description); + if (Param('useclassification')) { + print " Classification:\n"; + print " ",html_quote($classification),"\n"; + print "\n"; + } + print " Product:\n"; print " \n"; print "\n"; @@ -197,23 +257,83 @@ unless (UserInGroup("editcomponents")) { # # often used variables # +my $classification = trim($::FORM{classification} || ''); my $product = trim($::FORM{product} || ''); my $action = trim($::FORM{action} || ''); my $headerdone = 0; my $localtrailer = "edit more products"; +my $classhtmlvarstart = ""; +my $classhtmlvar = ""; + +if (Param('useclassification') && (defined $classification)) { + $classhtmlvar = "&classification=" . url_quote($classification); + $classhtmlvarstart = "?classification=" . url_quote($classification); +} + +if (Param('useclassification') && (defined $classification)) { + $localtrailer .= ", edit in this classification"; +} + +# +# product = '' -> Show nice list of products +# + +if (Param('useclassification')) { + unless ($classification) { + PutHeader("Select classification"); + + SendSQL("SELECT classifications.name,classifications.description,COUNT(classification_id) as total + FROM classifications + LEFT JOIN products ON classifications.id=products.classification_id + GROUP BY classifications.id + ORDER BY name"); + print "\n"; + print " \n"; + print " \n"; + print " \n"; + print ""; + while ( MoreSQLData() ) { + my ($classification, $description, $count) = FetchSQLData(); + $description ||= "missing"; + print "\n"; + print " \n"; + print " \n"; + $count ||= "none"; + print " \n"; + } + print "
Edit products of ...DescriptionTotal
$classification$description$count
\n"; + + PutTrailer(); + exit; + } +} + # # action='' -> Show nice list of products # unless ($action) { - PutHeader("Select product"); + if (Param('useclassification')) { + PutHeader("Select product in " . $classification); + } else { + PutHeader("Select product"); + } - SendSQL("SELECT products.name,description,disallownew, + my $query="SELECT products.name,products.description,disallownew, votesperuser,maxvotesperbug,votestoconfirm,COUNT(bug_id) - FROM products LEFT JOIN bugs ON products.id = bugs.product_id - GROUP BY products.name - ORDER BY products.name"); + FROM products"; + if (Param('useclassification')) { + $query .= ",classifications"; + } + $query .= " LEFT JOIN bugs ON products.id = bugs.product_id"; + if (Param('useclassification')) { + $query .= " WHERE classifications.name=" . + SqlQuote($classification) . + " AND classifications.id=products.classification_id"; + } + $query .= " GROUP BY products.name ORDER BY products.name"; + SendSQL($query); print "\n"; print " \n"; print " \n"; @@ -231,19 +351,19 @@ unless ($action) { $disallownew = $disallownew ? 'closed' : 'open'; $bugs ||= 'none'; print "\n"; - print " \n"; + print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; - print " \n"; + print " \n"; print ""; } print "\n"; print " \n"; - print " \n"; + print " \n"; print "
Edit product ...Description
$product$product$description$disallownew$votesperuser$maxvotesperbug$votestoconfirm$bugsDeleteDelete
Add a new productAddAdd
\n"; PutTrailer(); @@ -262,12 +382,15 @@ unless ($action) { if ($action eq 'add') { PutHeader("Add product"); + if (Param('useclassification')) { + CheckClassification($classification); + } #print "This page lets you add a new product to bugzilla.\n"; print "
\n"; print "\n"; - EmitFormElements('', '', '', 0, 0, 10000, 0, "---"); + EmitFormElements($classification,'', '', '', 0, 0, 10000, 0, "---"); print "\n"; print " \n"; @@ -282,6 +405,7 @@ if ($action eq 'add') { print "\n"; print "\n"; print "\n"; + print "\n"; print ""; my $other = $localtrailer; @@ -349,10 +473,15 @@ if ($action eq 'new') { $votestoconfirm ||= 0; my $defaultmilestone = $::FORM{defaultmilestone} || "---"; + my $classification_id = 1; + if (Param('useclassification')) { + $classification_id = get_classification_id($classification); + } + # Add the new product. SendSQL("INSERT INTO products ( " . "name, description, milestoneurl, disallownew, votesperuser, " . - "maxvotesperbug, votestoconfirm, defaultmilestone" . + "maxvotesperbug, votestoconfirm, defaultmilestone, classification_id" . " ) VALUES ( " . SqlQuote($product) . "," . SqlQuote($description) . "," . @@ -366,9 +495,11 @@ if ($action eq 'new') { SqlQuote($votesperuser) . "," . SqlQuote($maxvotesperbug) . "," . SqlQuote($votestoconfirm) . "," . - SqlQuote($defaultmilestone) . ")"); + SqlQuote($defaultmilestone) . "," . + SqlQuote($classification_id) . ")"); SendSQL("SELECT LAST_INSERT_ID()"); my $product_id = FetchOneColumn(); + SendSQL("INSERT INTO versions ( " . "value, product_id" . " ) VALUES ( " . @@ -455,7 +586,8 @@ if ($action eq 'new') { PutTrailer($localtrailer, "add a new product", "add components to this new product"); + url_quote($product) . $classhtmlvar . + "\">add components to this new product"); exit; } @@ -470,15 +602,23 @@ if ($action eq 'new') { if ($action eq 'del') { PutHeader("Delete product"); CheckProduct($product); + my $classification_id=1; + if (Param('useclassification')) { + CheckClassificationProduct($classification,$product); + $classification_id = get_classification_id($classification); + } # display some data about the product - SendSQL("SELECT id, description, milestoneurl, disallownew - FROM products - WHERE name=" . SqlQuote($product)); - my ($product_id, $description, $milestoneurl, $disallownew) = FetchSQLData(); + SendSQL("SELECT classifications.description, + products.id, products.description, milestoneurl, disallownew + FROM products,classifications + WHERE products.name=" . SqlQuote($product) . + " AND classifications.id=" . SqlQuote($classification_id)); + my ($class_description, $product_id, $prod_description, $milestoneurl, $disallownew) = FetchSQLData(); my $milestonelink = $milestoneurl ? "$milestoneurl" : "missing"; - $description ||= "description missing"; + $prod_description ||= "description missing"; + $class_description ||= "description missing"; $disallownew = $disallownew ? 'closed' : 'open'; print "
Version:
\n"; @@ -486,13 +626,23 @@ if ($action eq 'del') { print " \n"; print " \n"; + if (Param('useclassification')) { + print "\n"; + print " \n"; + print " \n"; + + print "\n"; + print " \n"; + print " \n"; + } + print "\n"; print " \n"; print " \n"; print "\n"; print " \n"; - print " \n"; + print " \n"; if (Param('usetargetmilestone')) { print "\n"; @@ -548,7 +698,7 @@ if ($action eq 'del') { # if (Param('usetargetmilestone')) { print "\n\n"; - print " \n"; + print " \n"; print " @@ -67,12 +142,35 @@ -[%# *** Product Component Version Target *** %] - +[%# *** Classification Product Component Version Target *** %]
PartValue
Classification:$classification
Description:$class_description
Product:$product
Description:$description$prod_description
Edit milestones:Edit milestones:"; SendSQL("SELECT value FROM milestones @@ -603,6 +753,8 @@ one."; print "\n"; print "\n"; + print "\n"; print ""; PutTrailer($localtrailer); @@ -706,25 +858,32 @@ if ($action eq 'delete') { if ($action eq 'edit') { PutHeader("Edit product"); CheckProduct($product); + my $classification_id=1; + if (Param('useclassification')) { + CheckClassificationProduct($classification,$product); + $classification_id = get_classification_id($classification); + } # get data of product - SendSQL("SELECT id,description,milestoneurl,disallownew, + SendSQL("SELECT classifications.description, + products.id,products.description,milestoneurl,disallownew, votesperuser,maxvotesperbug,votestoconfirm,defaultmilestone - FROM products - WHERE name=" . SqlQuote($product)); - my ($product_id,$description, $milestoneurl, $disallownew, + FROM products,classifications + WHERE products.name=" . SqlQuote($product) . + " AND classifications.id=" . SqlQuote($classification_id)); + my ($class_description, $product_id,$prod_description, $milestoneurl, $disallownew, $votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone) = FetchSQLData(); print "
\n"; print "\n"; - EmitFormElements($product, $description, $milestoneurl, + EmitFormElements($classification, $product, $prod_description, $milestoneurl, $disallownew, $votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone); print "\n"; - print " \n"; + print " \n"; print " \n\n"; - print " \n"; + print " \n"; print " \n\n"; - print " \n"; + print " \n"; print " \n\n"; - print " \n"; + print " \n"; print "\n
Edit components:Edit components:"; SendSQL("SELECT name,description FROM components @@ -744,7 +903,7 @@ if ($action eq 'edit') { print "
Edit versions:Edit versions:"; SendSQL("SELECT value FROM versions @@ -767,7 +926,7 @@ if ($action eq 'edit') { # if (Param('usetargetmilestone')) { print "
Edit milestones:Edit milestones:"; SendSQL("SELECT value FROM milestones @@ -787,7 +946,7 @@ if ($action eq 'edit') { } print "
Edit Group Access ControlsEdit Group Access Controls\n"; SendSQL("SELECT id, name, isactive, entry, membercontrol, othercontrol, canedit " . "FROM groups, " . @@ -820,10 +979,12 @@ if ($action eq 'edit') { print "
\n"; + print "\n"; print "\n"; print "\n"; + html_quote($prod_description) . "\">\n"; print "\n"; print "\n"; @@ -843,7 +1004,6 @@ if ($action eq 'edit') { exit; } - # # action='updategroupcontrols' -> update the product # @@ -1325,6 +1485,7 @@ if ($action eq 'editgroupcontrols') { } $vars->{'header_done'} = $headerdone; $vars->{'product'} = $product; + $vars->{'classification'} = $classification; $vars->{'groups'} = \@groups; $vars->{'const'} = { 'CONTROLMAPNA' => CONTROLMAPNA, diff --git a/enter_bug.cgi b/enter_bug.cgi index cbe2929aa..a0291fae5 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -53,6 +53,7 @@ use vars qw( $userid %versions $proddesc + $classdesc ); # If we're using bug groups to restrict bug entry, we need to know who the @@ -67,12 +68,47 @@ if (!defined $product) { GetVersionTable(); Bugzilla->login(); - my %products; + if ( ! Param('useclassification') ) { + # just pick the default one + $::FORM{'classification'}=(keys %::classdesc)[0]; + } + + if (!defined $::FORM{'classification'}) { + my %classdesc; + my %classifications; + + foreach my $c (GetSelectableClassifications()) { + $classdesc{$c} = $::classdesc{$c}; + $classifications{$c} = $::classifications{$c}; + } + + my $classification_size = scalar(keys %classdesc); + if ($classification_size == 0) { + ThrowUserError("no_products"); + } + elsif ($classification_size > 1) { + $vars->{'classdesc'} = \%classdesc; + $vars->{'classifications'} = \%classifications; + + $vars->{'target'} = "enter_bug.cgi"; + $vars->{'format'} = $::FORM{'format'}; + + print "Content-type: text/html\n\n"; + $template->process("global/choose-classification.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; + } + $::FORM{'classification'} = (keys %classdesc)[0]; + $::MFORM{'classification'} = [$::FORM{'classification'}]; + } + my %products; foreach my $p (@enterable_products) { - if (CanEnterProduct($p)) - { - $products{$p} = $::proddesc{$p}; + if (CanEnterProduct($p)) { + if (IsInClassification($::FORM{'classification'},$p) || + $::FORM{'classification'} eq "__all") { + $products{$p} = $::proddesc{$p}; + } } } @@ -81,7 +117,19 @@ if (!defined $product) { ThrowUserError("no_products"); } elsif ($prodsize > 1) { + my %classifications; + if ( ! Param('useclassification') ) { + @{$classifications{"all"}} = keys %products; + } + elsif ($::FORM{'classification'} eq "__all") { + %classifications = %::classifications; + } else { + $classifications{$::FORM{'classification'}} = + $::classifications{$::FORM{'classification'}}; + } $vars->{'proddesc'} = \%products; + $vars->{'classifications'} = \%classifications; + $vars->{'classdesc'} = \%::classdesc; $vars->{'target'} = "enter_bug.cgi"; $vars->{'format'} = $cgi->param('format'); @@ -252,6 +300,7 @@ SendSQL("SELECT name, description, login_name, realname ORDER BY name"); while (MoreSQLData()) { my ($name, $description, $login, $realname) = FetchSQLData(); + push @components, { name => $name, description => $description, diff --git a/globals.pl b/globals.pl index 9872dff70..829417e44 100644 --- a/globals.pl +++ b/globals.pl @@ -55,6 +55,7 @@ sub globals_pl_sillyness { $zz = @main::legal_versions; $zz = @main::milestoneurl; $zz = %main::proddesc; + $zz = %main::classdesc; $zz = @main::prodmaxvotes; $zz = $main::template; $zz = $main::userid; @@ -184,6 +185,19 @@ sub GenerateVersionTable { $carray{$c} = 1; } + SendSQL("SELECT products.name, classifications.name " . + "FROM products, classifications " . + "WHERE classifications.id = products.classification_id " . + "ORDER BY classifications.name"); + while (@line = FetchSQLData()) { + my ($p,$c) = (@line); + if (!defined $::classifications{$c}) { + $::classifications{$c} = []; + } + my $ref = $::classifications{$c}; + push @$ref, $p; + } + my $dotargetmilestone = 1; # This used to check the param, but there's # enough code that wants to pretend we're using # target milestones, even if they don't get @@ -191,6 +205,13 @@ sub GenerateVersionTable { # about them anyway. my $mpart = $dotargetmilestone ? ", milestoneurl" : ""; + + SendSQL("select name, description from classifications ORDER BY name"); + while (@line = FetchSQLData()) { + my ($n, $d) = (@line); + $::classdesc{$n} = $d; + } + SendSQL("select name, description, votesperuser, disallownew$mpart from products ORDER BY name"); while (@line = FetchSQLData()) { my ($p, $d, $votesperuser, $dis, $u) = (@line); @@ -275,8 +296,10 @@ sub GenerateVersionTable { '*::legal_bug_status', '*::legal_resolution'])); print $fh (Data::Dumper->Dump([\@::settable_resolution, \%::proddesc, + \%::classifications, \%::classdesc, \@::enterable_products, \%::prodmaxvotes], ['*::settable_resolution', '*::proddesc', + '*::classifications', '*::classdesc', '*::enterable_products', '*::prodmaxvotes'])); if ($dotargetmilestone) { @@ -494,6 +517,24 @@ sub CanEditProductId { return (!defined($result)); } +sub IsInClassification { + my ($classification,$productname) = @_; + + if (! Param('useclassification')) { + return 1; + } else { + my $query = "SELECT classifications.name " . + "FROM products,classifications " . + "WHERE products.classification_id=classifications.id "; + $query .= "AND products.name = " . SqlQuote($productname); + PushGlobalSQLState(); + SendSQL($query); + my ($ret) = FetchSQLData(); + PopGlobalSQLState(); + return ($ret eq $classification); + } +} + # # This function determines if a user can enter bugs in the named # product. @@ -527,18 +568,21 @@ sub GetEnterableProducts { return (@products); } + # # This function returns an alphabetical list of product names to which # the user can enter bugs. If the $by_id parameter is true, also retrieves IDs # and pushes them onto the list as id, name [, id, name...] for easy slurping # into a hash by the calling code. sub GetSelectableProducts { - my ($by_id) = @_; + my ($by_id,$by_classification) = @_; my $extra_sql = $by_id ? "id, " : ""; - my $query = "SELECT $extra_sql name " . - "FROM products " . + my $extra_from_sql = $by_classification ? ", classifications" : ""; + + my $query = "SELECT $extra_sql products.name " . + "FROM products $extra_from_sql " . "LEFT JOIN group_control_map " . "ON group_control_map.product_id = products.id "; if (Param('useentrygroupdefault')) { @@ -551,7 +595,13 @@ sub GetSelectableProducts { $query .= "AND group_id NOT IN(" . join(',', values(%{Bugzilla->user->groups})) . ") "; } - $query .= "WHERE group_id IS NULL ORDER BY name"; + $query .= "WHERE group_id IS NULL "; + if ($by_classification) { + $query .= "AND classifications.id = products.classification_id "; + $query .= "AND classifications.name = "; + $query .= SqlQuote($by_classification) . " "; + } + $query .= "ORDER BY name"; PushGlobalSQLState(); SendSQL($query); my @products = (); @@ -609,6 +659,18 @@ sub GetSelectableProductHash { return $selectables; } +# +# This function returns an alphabetical list of classifications that has products the user can enter bugs. +sub GetSelectableClassifications { + my @selectable_classes = (); + + foreach my $c (keys %::classdesc) { + if ( scalar(GetSelectableProducts(0,$c)) > 0) { + push(@selectable_classes,$c); + } + } + return (@selectable_classes); +} sub GetFieldDefs { my $extra = ""; @@ -740,6 +802,25 @@ sub DBNameToIdAndCheck { { name => $name }, "abort"); } +sub get_classification_id { + my ($classification) = @_; + PushGlobalSQLState(); + SendSQL("SELECT id FROM classifications WHERE name = " . SqlQuote($classification)); + my ($classification_id) = FetchSQLData(); + PopGlobalSQLState(); + return $classification_id; +} + +sub get_classification_name { + my ($classification_id) = @_; + die "non-numeric classification_id '$classification_id' passed to get_classification_name" + unless ($classification_id =~ /^\d+$/); + PushGlobalSQLState(); + SendSQL("SELECT name FROM classifications WHERE id = $classification_id"); + my ($classification) = FetchSQLData(); + PopGlobalSQLState(); + return $classification; +} diff --git a/js/productform.js b/js/productform.js index 0be0d4971..7cf07d732 100644 --- a/js/productform.js +++ b/js/productform.js @@ -21,6 +21,72 @@ /* this file contains functions to update form controls based on a * collection of javascript arrays containing strings */ +/* selectClassification reads the selection from f.classification and updates + * f.product accordingly + * - f: a form containing classification, product, component, varsion and + * target_milestone select boxes. + * globals (3vil!): + * - prods, indexed by classification name + * - first_load: boolean, specifying if it is the first time we load + * the query page. + * - last_sel: saves our last selection list so we know what has + * changed, and optimize for additions. + */ +function selectClassification(classfield, product, component, version, milestone) { + /* this is to avoid handling events that occur before the form + * itself is ready, which could happen in buggy browsers. + */ + if (!classfield) { + return; + } + + /* if this is the first load and nothing is selected, no need to + * merge and sort all components; perl gives it to us sorted. + */ + if ((first_load) && (classfield.selectedIndex == -1)) { + first_load = false; + return; + } + + /* don't reset first_load as done in selectProduct. That's because we + want selectProduct to handle the first_load attribute + */ + + /* - sel keeps the array of classifications we are selected. + * - merging says if it is a full list or just a list of classifications + * that were added to the current selection. + */ + var merging = false; + var sel = Array(); + + /* if nothing selected, pick all */ + var findall = classfield.selectedIndex == -1; + sel = get_selection(classfield, findall, false); + if (!findall) { + /* save sel for the next invocation of selectClassification() */ + var tmp = sel; + + /* this is an optimization: if we have just added classifications to an + * existing selection, no need to clear the form controls and add + * everybody again; just merge the new ones with the existing + * options. + */ + if ((last_sel.length > 0) && (last_sel.length < sel.length)) { + sel = fake_diff_array(sel, last_sel); + merging = true; + } + last_sel = tmp; + } + /* save original options selected */ + var saved_prods = get_selection(product, false, true); + + /* do the actual fill/update, reselect originally selected options */ + updateSelect(prods, sel, product, merging); + restoreSelection(product, saved_prods); + selectProduct(product, component, version, milestone); +} + + /* selectProduct reads the selection from the product control and * updates version, component and milestone controls accordingly. * @@ -68,7 +134,15 @@ function selectProduct(product, component, version, milestone) { /* if nothing selected, pick all */ var findall = product.selectedIndex == -1; - sel = get_selection(product, findall, false); + if (useclassification) { + /* update index based on the complete product array */ + sel = get_selection(product, findall, true); + for (var i=0; iparam('buglist') || $cgi->param('bug_id') || @@ -81,7 +83,8 @@ foreach my $bug_id (split(/[:,]/, $buglist)) { my %bug; my @row = FetchSQLData(); - foreach my $field ("bug_id", "alias", "product", "version", "rep_platform", + foreach my $field ("bug_id", "alias", "classification", "product", + "version", "rep_platform", "op_sys", "bug_status", "resolution", "priority", "bug_severity", "component", "assigned_to", "reporter", "bug_file_loc", "short_desc", "target_milestone", diff --git a/query.cgi b/query.cgi index bacb5cd3c..c22a11471 100755 --- a/query.cgi +++ b/query.cgi @@ -127,7 +127,7 @@ sub PrefillForm { # Nothing must be undef, otherwise the template complains. foreach my $name ("bug_status", "resolution", "assigned_to", "rep_platform", "priority", "bug_severity", - "product", "reporter", "op_sys", + "classification", "product", "reporter", "op_sys", "component", "version", "chfield", "chfieldfrom", "chfieldto", "chfieldvalue", "target_milestone", "email", "emailtype", "emailreporter", @@ -274,9 +274,24 @@ for (my $i = 0; $i < @products; ++$i) { # Assign hash back to product array. $products[$i] = \%product; } - $vars->{'product'} = \@products; +# Create data structures representing each classification +if (Param('useclassification')) { + my @classifications = (); + + foreach my $c (sort(GetSelectableClassifications())) { + # Create hash to hold attributes for each classification. + my %classification = ( + 'name' => $c, + 'products' => [ GetSelectableProducts(0,$c) ] + ); + # Assign hash back to classification array. + push @classifications, \%classification; + } + $vars->{'classification'} = \@classifications; +} + # We use 'component_' because 'component' is a Template Toolkit reserved word. $vars->{'component_'} = \@components; @@ -300,7 +315,9 @@ push @chfields, "[Bug creation]"; # This is what happens when you have variables whose definition depends # on the DB schema, and then the underlying schema changes... foreach my $val (@::log_columns) { - if ($val eq 'product_id') { + if ($val eq 'classification_id') { + $val = 'classification'; + } elsif ($val eq 'product_id') { $val = 'product'; } elsif ($val eq 'component_id') { $val = 'component'; diff --git a/report.cgi b/report.cgi index 66060723d..fac2f0e75 100755 --- a/report.cgi +++ b/report.cgi @@ -113,6 +113,7 @@ $columns{'bug_status'} = "bugs.bug_status"; $columns{'resolution'} = "bugs.resolution"; $columns{'component'} = "map_components.name"; $columns{'product'} = "map_products.name"; +$columns{'classification'} = "map_classifications.name"; $columns{'version'} = "bugs.version"; $columns{'op_sys'} = "bugs.op_sys"; $columns{'votes'} = "bugs.votes"; @@ -134,8 +135,13 @@ $columns{''} = "42217354"; || ThrowCodeError("report_axis_invalid", {fld => "z", val => $tbl_field}); my @axis_fields = ($row_field, $col_field, $tbl_field); - my @selectnames = map($columns{$_}, @axis_fields); +# add product if person is requesting classification +if (lsearch(\@axis_fields,"classification") >= 0) { + if (lsearch(\@axis_fields,"product") < 0) { + push(@selectnames,($columns{'product'})); + } +} # Clone the params, so that Bugzilla::Search can modify them my $params = new Bugzilla::CGI($cgi); diff --git a/template/en/default/admin/classifications/add.html.tmpl b/template/en/default/admin/classifications/add.html.tmpl new file mode 100644 index 000000000..d6a7c3880 --- /dev/null +++ b/template/en/default/admin/classifications/add.html.tmpl @@ -0,0 +1,45 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Add new classification" +%] + + + + + + + + + + + +
Classification:
Description:
+
+ + + + +

Back to the main [% terms.bugs %] page +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/del.html.tmpl b/template/en/default/admin/classifications/del.html.tmpl new file mode 100644 index 000000000..008971562 --- /dev/null +++ b/template/en/default/admin/classifications/del.html.tmpl @@ -0,0 +1,60 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Delete classification" +%] + + + + + + + + + + + + + + + +
PartValue
Classification:[% classification FILTER html %]
Description: + [% IF description %] + [% description FILTER html %] + [% ELSE %] + description missing + [% END %] +
+ +

Confirmation

+ +

Do you really want to delete this classification?

+

+ + + +
+ +

Back to the main [% terms.bugs %] page +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/delete.html.tmpl b/template/en/default/admin/classifications/delete.html.tmpl new file mode 100644 index 000000000..b2ec26cbb --- /dev/null +++ b/template/en/default/admin/classifications/delete.html.tmpl @@ -0,0 +1,31 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Classification deleted" +%] + +Classification [% classification FILTER html %] deleted.
+ +

Back to the main [% terms.bugs %] page +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/edit.html.tmpl b/template/en/default/admin/classifications/edit.html.tmpl new file mode 100644 index 000000000..ebc16e82e --- /dev/null +++ b/template/en/default/admin/classifications/edit.html.tmpl @@ -0,0 +1,70 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Edit classification" +%] + +

+ + + + + + + + + + + + + +
Classification:
Description:
Edit products + [% IF products AND products.size > 0 %] + + [% FOREACH product = products %] + + + + + [% END %] +
[% product.name FILTER html %] + [% IF product.description %] + [% product.description FILTER html %] + [% ELSE %] + description missing + [% END %] +
+ [% ELSE %] + none + [% END %] +
+ + + + + +
+ +

Back to the main [% terms.bugs %] page +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/new.html.tmpl b/template/en/default/admin/classifications/new.html.tmpl new file mode 100644 index 000000000..c8046b898 --- /dev/null +++ b/template/en/default/admin/classifications/new.html.tmpl @@ -0,0 +1,32 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Adding new classification" +%] + +OK, done. + +

Back to the main [% terms.bugs %] page, +add products to this new classification, +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/reclassify.html.tmpl b/template/en/default/admin/classifications/reclassify.html.tmpl new file mode 100644 index 000000000..d860f67cf --- /dev/null +++ b/template/en/default/admin/classifications/reclassify.html.tmpl @@ -0,0 +1,84 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Reclassify products" +%] + +[% main_classification = classification %] + +

+ + + + + + + + + + + + + + + + + + + + + + + +
Classification:[% main_classification FILTER html %]
Description: + [% IF description %] + [% description FILTER html %] + [% ELSE %] + description missing + [% END %] +
Products:Products[% main_classification FILTER html %] Products
+ +

+ +
+
+ + + +
+ +

Back to the main [% terms.bugs %] page, +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/select.html.tmpl b/template/en/default/admin/classifications/select.html.tmpl new file mode 100644 index 000000000..5908375d2 --- /dev/null +++ b/template/en/default/admin/classifications/select.html.tmpl @@ -0,0 +1,70 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Select classification" +%] + +[% filt_classification = classification FILTER html %] + + + + + + + + + + [% FOREACH cl = classifications %] + + + + [% IF (cl.id == 1) %] + + [% ELSE %] + + [% END %] + + [%# don't allow user to delete the default id. %] + [% IF (cl.id == 1) %] + + [% ELSE %] + + [% END %] + + [% END %] + + + + + +
Edit Classification ...DescriptionProductsAction
[% cl.classification FILTER html %] + [% IF cl.description %] + [% cl.description FILTER html %] + [% ELSE %] + none + [% END %] + [% cl.total FILTER html %]reclassify ([% cl.total FILTER html %]) delete
Add a new classificationAdd
+ +

Back to the main [% terms.bugs %] page +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/classifications/update.html.tmpl b/template/en/default/admin/classifications/update.html.tmpl new file mode 100644 index 000000000..3ad7bbc69 --- /dev/null +++ b/template/en/default/admin/classifications/update.html.tmpl @@ -0,0 +1,37 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Albert Ting + #%] + +[% PROCESS global/header.html.tmpl + title = "Update classification" +%] + +[% IF updated_description %] + Updated description.
+[% END %] + +[% IF updated_classification %] + Updated classification name.
+[% END %] + +

Back to the main [% terms.bugs %] page +or edit more classifications. + +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/admin/products/groupcontrol/edit.html.tmpl b/template/en/default/admin/products/groupcontrol/edit.html.tmpl index 85816398b..6bd30040d 100644 --- a/template/en/default/admin/products/groupcontrol/edit.html.tmpl +++ b/template/en/default/admin/products/groupcontrol/edit.html.tmpl @@ -22,6 +22,7 @@ [% PROCESS global/variables.none.tmpl %] [% filt_product = product FILTER html %] +[% filt_classification = classification FILTER html %] [% PROCESS global/header.html.tmpl title = "Edit Group Controls for '$filt_product'" %] @@ -29,6 +30,7 @@

+ diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index f4c68bb4d..b898afee1 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -119,6 +119,11 @@
- [% PROCESS cell attr = { description => "Product", - name => "product" } %] + + [% PROCESS cell attr = { description => "Version", name => "version" } %] [% PROCESS cell attr = { description => "Platform", diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index 8d25e2536..c1921a908 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -500,6 +500,7 @@ ], 'admin/products/groupcontrol/edit.html.tmpl' => [ + 'filt_classification', 'filt_product', 'group.bugcount', 'group.id', diff --git a/template/en/default/global/choose-classification.html.tmpl b/template/en/default/global/choose-classification.html.tmpl new file mode 100644 index 000000000..b7b8fb66e --- /dev/null +++ b/template/en/default/global/choose-classification.html.tmpl @@ -0,0 +1,65 @@ + + +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Albert Ting + # + # Contributor(s): Albert Ting + #%] + +[%# INTERFACE: + # classdesc: hash. May be empty. The hash keys are the classifications, and the values + # are their descriptions. + #%] + +[% IF target == "enter_bug.cgi" %] + [% title = "Select Classification" %] + [% h2 = "Please select the classification." %] +[% END %] + +[% DEFAULT title = "Choose the classification" %] +[% PROCESS global/header.html.tmpl %] + +
+ [% IF Param('useclassification') %] + [% IF bug.classification_id != "1" %] + [[% bug.classification FILTER html %]] + [% END %] + [% END %] [% terms.Bug %]#: diff --git a/template/en/default/bug/show-multiple.html.tmpl b/template/en/default/bug/show-multiple.html.tmpl index 6b48feb00..8cf86dd5f 100644 --- a/template/en/default/bug/show-multiple.html.tmpl +++ b/template/en/default/bug/show-multiple.html.tmpl @@ -62,8 +62,14 @@ ([% bug.alias FILTER html %]) [% END %] + Product:   + [% IF Param("useclassification") %] + [[% bug.classification FILTER html %]]  + [% END %] + [% bug.product FILTER html %] +
+ +[% IF Param('showallproducts') %] + + + + + +[% END %] + +[% FOREACH p = classdesc.keys.sort %] + [% IF classifications.$p.size > 0 %] + + + + [% IF classdesc.$p %] + + [% END %] + + [% END %] +[% END %] + +
+ + All: +  Show all products
+ + [% p FILTER html %]: +  [% classdesc.$p FILTER html %]
+ +[% PROCESS global/footer.html.tmpl %] diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl index 7a21ca056..1080e8e44 100644 --- a/template/en/default/global/field-descs.none.tmpl +++ b/template/en/default/global/field-descs.none.tmpl @@ -32,6 +32,7 @@ "bug_status" => "Status", "changeddate" => "Last Changed Date", "cc" => "CC", + "classification" => "Classification", "cclist_accessible" => "CC list accessible?", "component_id" => "Component ID", "component" => "Component", diff --git a/template/en/default/global/useful-links.html.tmpl b/template/en/default/global/useful-links.html.tmpl index 7e568372c..8a11b2ad3 100644 --- a/template/en/default/global/useful-links.html.tmpl +++ b/template/en/default/global/useful-links.html.tmpl @@ -77,8 +77,17 @@ IF user.groups.tweakparams %] [% ' | Users' IF user.groups.editusers || user.can_bless %] - [% ' | Products' + [% IF Param('useclassification') %] + [% IF user.groups.editclassifications %] + [% ' | Classifications' %] + [% END %] + [% IF user.groups.editcomponents %] + [% ' | Products' %] + [% END %] + [% ELSE %] + [% ' | Products' IF user.groups.editcomponents %] + [% END %] [% ' | Flags' IF user.groups.editcomponents %] [% ' | Groups' diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index a17b1275b..7638806cf 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -142,6 +142,40 @@ [% title = "Comment Too Long" %] Comments cannot be longer than 65,535 characters. + [% ELSIF error == "auth_classification_not_enabled" %] + [% title = "Classification Not Enabled" %] + Sorry, classification is not enabled. + + [% ELSIF error == "auth_cant_edit_classifications" %] + [% title = "Access Denied" %] + Sorry, you aren't a member of the 'editclassifications' group, and so + you aren't allowed to add, modify or delete classifications. + + [% ELSIF error == "classification_not_specified" %] + [% title = "You Must Supply A Classification Name" %] + You must enter a classification name. + + [% ELSIF error == "classification_already_exists" %] + [% title = "Classification Already Exists" %] + A classification with the name '[% name FILTER html %]' already exists. + + [% ELSIF error == "classification_doesnt_exist" %] + [% title = "Classification Does Not Exist" %] + The classification '[% name FILTER html %]' does not exist. + + [% ELSIF error == "classification_not_deletable" %] + [% title = "Default Classification Can Not Be Deleted" %] + You can not delete the default classification + + [% ELSIF error == "classification_has_products" %] + Sorry, there are products for this classification. You + must reassign those products to another classification before you + can delete this one. + + [% ELSIF error == "cant_delete_default_classification" %] + Sorry, but you can not delete the default classification, + '[% name FILTER html %]'. + [% ELSIF error == "auth_cant_edit_components" %] [% title = "Access Denied" %] Sorry, you aren't a member of the 'editcomponents' group, and so @@ -463,6 +497,10 @@ [% title = "Invalid group name" %] The group you specified, [% name FILTER html %], is not valid here. + [% ELSIF error == "invalid_group_name" %] + [% title = "Invalid group name" %] + The group you specified, [% name FILTER html %], is not valid here. + [% ELSIF error == "invalid_maxrows" %] [% title = "Invalid Max Rows" %] The maximum number of rows, '[% maxrows FILTER html %]', must be diff --git a/template/en/default/search/form.html.tmpl b/template/en/default/search/form.html.tmpl index f875f3541..77308f28b 100644 --- a/template/en/default/search/form.html.tmpl +++ b/template/en/default/search/form.html.tmpl @@ -21,6 +21,81 @@ # Gervase Markham #%] + + + [% PROCESS global/variables.none.tmpl %] [% query_variants = [ @@ -56,7 +131,7 @@
+ [% IF Param('useclassification') %] + + [% END %]
+ + + + + + + +
Classification:
+ +
+
@@ -83,7 +181,7 @@ -- cgit v1.2.3-24-g4f1b