diff --git a/webtools/bugzilla/CGI.pl b/webtools/bugzilla/CGI.pl index 2cf6ffeca8a8..6bcb1ba02285 100644 --- a/webtools/bugzilla/CGI.pl +++ b/webtools/bugzilla/CGI.pl @@ -1194,7 +1194,8 @@ sub DumpBugActivity { $datepart = "and bugs_activity.bug_when >= $starttime"; } my $query = " - SELECT IFNULL(fielddefs.name, bugs_activity.fieldid), + SELECT IFNULL(fielddefs.description, bugs_activity.fieldid), + bugs_activity.attach_id, bugs_activity.bug_when, bugs_activity.removed, bugs_activity.added, profiles.login_name @@ -1219,7 +1220,9 @@ sub DumpBugActivity { my @row; my $incomplete_data = 0; while (@row = FetchSQLData()) { - my ($field,$when,$removed,$added,$who) = (@row); + my ($field,$attachid,$when,$removed,$added,$who) = (@row); + $field =~ s/^Attachment/Attachment #$attachid<\/a>/ + if (Param('useattachmenttracker') && $attachid); $removed = html_quote($removed); $added = html_quote($added); $removed = " " if $removed eq ""; @@ -1289,6 +1292,8 @@ Actions: } if (UserInGroup("editcomponents")) { $html .= ", components"; + $html .= ", attachment statuses" + if Param('useattachmenttracker'); } if (UserInGroup("creategroups")) { $html .= ", groups"; diff --git a/webtools/bugzilla/bug_form.pl b/webtools/bugzilla/bug_form.pl index c554cb0b079c..d2f6cc3f4525 100644 --- a/webtools/bugzilla/bug_form.pl +++ b/webtools/bugzilla/bug_form.pl @@ -283,18 +283,26 @@ if (@::legal_keywords) { }; } -print "Attachments:\n"; -SendSQL("select attach_id, creation_ts, mimetype, description from attachments where bug_id = $id"); -while (MoreSQLData()) { - my ($attachid, $date, $mimetype, $desc) = (FetchSQLData()); - if ($date =~ /^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) { - $date = "$3/$4/$2 $5:$6"; +# 2001-05-16 myk@mozilla.org: use the attachment tracker to display attachments +# if this installation has enabled use of the attachment tracker. +if (Param('useattachmenttracker')) { + print "\n"; + use Attachment; + &Attachment::list($id); +} else { + print "Attachments:\n"; + SendSQL("select attach_id, creation_ts, mimetype, description from attachments where bug_id = $id"); + while (MoreSQLData()) { + my ($attachid, $date, $mimetype, $desc) = (FetchSQLData()); + if ($date =~ /^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) { + $date = "$3/$4/$2 $5:$6"; + } + my $link = "showattachment.cgi?attach_id=$attachid"; + $desc = value_quote($desc); + print qq{$date$desc   ($mimetype)}; } - my $link = "showattachment.cgi?attach_id=$attachid"; - $desc = value_quote($desc); - print qq{$date$desc   ($mimetype)}; + print "Create a new attachment (proposed patch, testcase, etc.)\n"; } -print "Create a new attachment (proposed patch, testcase, etc.)\n"; sub EmitDependList { diff --git a/webtools/bugzilla/buglist.cgi b/webtools/bugzilla/buglist.cgi index 2b2a394bf73f..830b66599f57 100755 --- a/webtools/bugzilla/buglist.cgi +++ b/webtools/bugzilla/buglist.cgi @@ -415,6 +415,22 @@ sub GenerateSQL { } $f = "$table.$field"; }, + # 2001-05-16 myk@mozilla.org: enable querying against attachment status + # if this installation has enabled use of the attachment manager. + "^attachstatusdefs.name," => sub { + my $attachtable = "attachments_$chartid"; + my $statustable = "attachstatuses_$chartid"; + my $statusdefstable = "attachstatusdefs_$chartid"; + push(@supptables, "attachments $attachtable"); + push(@supptables, "attachstatuses $statustable"); + push(@supptables, "attachstatusdefs $statusdefstable"); + push(@wherepart, "bugs.bug_id = $attachtable.bug_id"); + push(@wherepart, "$attachtable.attach_id = $statustable.attach_id"); + push(@wherepart, "$statustable.statusid = $statusdefstable.id"); + my $table = $statusdefstable; + my $field = "name"; + $f = "$table.$field"; + }, "^changedin," => sub { $f = "(to_days(now()) - to_days(bugs.delta_ts))"; }, diff --git a/webtools/bugzilla/checksetup.pl b/webtools/bugzilla/checksetup.pl index 4c3ab81d3cec..7c165b9ebdff 100755 --- a/webtools/bugzilla/checksetup.pl +++ b/webtools/bugzilla/checksetup.pl @@ -192,6 +192,7 @@ unless (have_vers("DBI","1.13")) { push @missing,"DBI" } unless (have_vers("Data::Dumper",0)) { push @missing,"Data::Dumper" } unless (have_vers("DBD::mysql","1.2209")) { push @missing,"DBD::mysql" } unless (have_vers("Date::Parse",0)) { push @missing,"Date::Parse" } +unless (have_vers("Template","2.01")) { push @missing,"Template" } # If CGI::Carp was loaded successfully for version checking, it changes the # die and warn handlers, we don't want them changed, so we need to stash the @@ -838,6 +839,7 @@ my %table; $table{bugs_activity} = 'bug_id mediumint not null, + attach_id mediumint null, who mediumint not null, bug_when datetime not null, fieldid mediumint not null, @@ -859,10 +861,33 @@ $table{attachments} = filename mediumtext not null, thedata longblob not null, submitter_id mediumint not null, + isobsolete tinyint not null default 0, index(bug_id), index(creation_ts)'; +# 2001-05-05 myk@mozilla.org: Tables to support the attachment tracker. +# "attachstatuses" stores one record for each status on each attachment. +# "attachstatusdefs" defines the statuses that can be set on attachments. +# Note: These tables are only used if the parameter "useattachmenttracker" +# is turned on via editparameters.cgi. + +$table{attachstatuses} = + ' + attach_id MEDIUMINT NOT NULL , + statusid SMALLINT NOT NULL , + PRIMARY KEY(attach_id, statusid) + '; + +$table{attachstatusdefs} = + ' + id SMALLINT NOT NULL PRIMARY KEY , + name VARCHAR(50) NOT NULL , + description MEDIUMTEXT NULL , + sortkey SMALLINT NOT NULL DEFAULT 0 , + product VARCHAR(64) NOT NULL + '; + # # Apostrophe's are not supportied in the enum types. # See http://bugzilla.mozilla.org/show_bug.cgi?id=27309 @@ -1294,6 +1319,8 @@ AddFDef("attachments.description", "Attachment description", 0); AddFDef("attachments.thedata", "Attachment data", 0); AddFDef("attachments.mimetype", "Attachment mime type", 0); AddFDef("attachments.ispatch", "Attachment is patch", 0); +AddFDef("attachments.isobsolete", "Attachment is obsolete", 0); +AddFDef("attachstatusdefs.name", "Attachment Status", 0); AddFDef("target_milestone", "Target Milestone", 0); AddFDef("delta_ts", "Last changed date", 0); AddFDef("(to_days(now()) - to_days(bugs.delta_ts))", "Days since bug changed", @@ -2322,6 +2349,12 @@ unless (-d 'data/duplicates') { # AddField('groups', 'isactive', 'tinyint not null default 1'); +# +# 2001-06-15 myk@mozilla.org: +# isobsolete determines whether or not an attachment is pertinent/relevant/valid. +# +AddField('attachments', 'isobsolete', 'tinyint not null default 0'); + # 2001-04-29 jake@acutex.net - Remove oldemailtech # http://bugzilla.mozilla.org/show_bugs.cgi?id=71552 if (-d 'shadow') { @@ -2470,6 +2503,11 @@ AddField("bugs", "assignee_accessible", "tinyint not null default 1"); AddField("bugs", "qacontact_accessible", "tinyint not null default 1"); AddField("bugs", "cclist_accessible", "tinyint not null default 1"); +# 2001-08-21 myk@mozilla.org bug84338: +# Add a field for the attachment ID to the bugs_activity table, so installations +# using the attachment manager can record changes to attachments. +AddField("bugs_activity", "attach_id", "mediumint null"); + # If you had to change the --TABLE-- definition in any way, then add your # differential change code *** A B O V E *** this comment. # diff --git a/webtools/bugzilla/defparams.pl b/webtools/bugzilla/defparams.pl index 46a00b78f149..31bd57d4f9ad 100644 --- a/webtools/bugzilla/defparams.pl +++ b/webtools/bugzilla/defparams.pl @@ -669,4 +669,9 @@ DefParam("moved-default-component", "t", ''); +DefParam("useattachmenttracker", + "Whether or not to use the attachment tracker that adds additional features for tracking bug attachments.", + "b", + 0); + 1; diff --git a/webtools/bugzilla/processmail b/webtools/bugzilla/processmail index b82c80aca579..45f5aa31016c 100755 --- a/webtools/bugzilla/processmail +++ b/webtools/bugzilla/processmail @@ -135,7 +135,7 @@ sub ProcessOneBug { SendSQL("SELECT profiles.login_name, fielddefs.description, " . - " bug_when, removed, added " . + " bug_when, removed, added, attach_id " . "FROM bugs_activity, fielddefs, profiles " . "WHERE bug_id = $id " . " AND fielddefs.fieldid = bugs_activity.fieldid " . @@ -153,13 +153,14 @@ sub ProcessOneBug { my $difftext = ""; my $lastwho = ""; foreach my $ref (@diffs) { - my ($who, $what, $when, $old, $new) = (@$ref); + my ($who, $what, $when, $old, $new, $attachid) = (@$ref); if ($who ne $lastwho) { $lastwho = $who; $difftext .= "\n$who" . Param('emailsuffix') . " changed:\n\n"; $difftext .= FormatTriple("What ", "Removed", "Added"); $difftext .= ('-' x 76) . "\n"; } + $what =~ s/^Attachment/Attachment #$attachid/ if (Param('useattachmenttracker') && $attachid); $difftext .= FormatTriple($what, $old, $new); } diff --git a/webtools/bugzilla/template/default/attachment/edit.atml b/webtools/bugzilla/template/default/attachment/edit.atml new file mode 100755 index 000000000000..742822369b7e --- /dev/null +++ b/webtools/bugzilla/template/default/attachment/edit.atml @@ -0,0 +1,192 @@ +[% INCLUDE global/header + title = "Edit Attachment #$attachid for Bug #$bugid" + h1 = "Edit Attachment #$attachid for Bug #$bugid" + h2 = bugsummary + style = " + th { text-align: right; vertical-align: top; } + td { text-align: left; vertical-align: top; } + td#info { text-align: right; vertical-align: top; } + td#actions { text-align: right; vertical-align: bottom; } + td#noview { text-align: left; vertical-align: center; } + " +%] + +
+ + + + + + + + + [% IF isviewable %] + + [% ELSE %] + + [% END %] + + + +
+ + Description:
+
+ + MIME Type:
+
+ + Flags:
+ patch + obsolete
+ + [% IF statusdefs.size %] + Status:
+ [% FOREACH def = statusdefs %] + [% def.name %]
+ [% END %] + [% END %] + +
+ Comment (on the bug):
+
+
+ + + +
+
+ + + + + + +

+ Attachment cannot be viewed because its MIME type is not either text/*, image/*, or application/vnd.mozilla.*. + Download the attachment instead. +

+
+ + Attachments on this Bug: + [% FOREACH a = attachments %] + [% IF a == attachid %] + #[% a %] + [% ELSE %] + #[% a %] + [% END %] + [% "|" UNLESS loop.last() %] + [% END %] + +
+ + + +
+ +[% INCLUDE global/footer %] diff --git a/webtools/bugzilla/template/default/attachment/list.atml b/webtools/bugzilla/template/default/attachment/list.atml new file mode 100755 index 000000000000..3086c8dc0fc1 --- /dev/null +++ b/webtools/bugzilla/template/default/attachment/list.atml @@ -0,0 +1,58 @@ +
+ + + + + + + + + + [% FOREACH attachment = attachments %] + + + + + + + + + + + + [% END %] + + + + + +
AttachmentTypeModifiedStatusActions
+ [% IF attachment.isobsolete %] + [% attachment.description %] + [% ELSE %] + [% attachment.description %] + [% END %] + + [% IF attachment.ispatch %] + patch + [% ELSE %] + [% attachment.mimetype %] + [% END %] + [% attachment.date %] + + [% IF attachment.statuses.size == 0 %] + none + [% ELSE %] + [% FOREACH s = attachment.statuses %] + [% s %]
+ [% END %] + [% END %] +
+
+ Edit +
+ Create a new attachment (proposed patch, testcase, etc.) + + View All +
+
diff --git a/webtools/bugzilla/template/default/attachment/updated.atml b/webtools/bugzilla/template/default/attachment/updated.atml new file mode 100755 index 000000000000..7b52deebc573 --- /dev/null +++ b/webtools/bugzilla/template/default/attachment/updated.atml @@ -0,0 +1,16 @@ +[% INCLUDE global/header + title = "Changes Submitted" + style = "th { text-align: left; }" +%] + +

+ Your changes have been submitted for + attachment #[% attachid %] + of bug #[% bugid %]. +

+ +[% mailresults %] + +
+ +[% INCLUDE global/footer %] diff --git a/webtools/bugzilla/template/default/attachment/viewall.atml b/webtools/bugzilla/template/default/attachment/viewall.atml new file mode 100755 index 000000000000..9a22b716ac55 --- /dev/null +++ b/webtools/bugzilla/template/default/attachment/viewall.atml @@ -0,0 +1,78 @@ +[% INCLUDE global/header + title = "View All Attachments for Bug #$bugid" + h1 = "View All Attachments for Bug #$bugid" + h2 = bugsummary + style = " + th { text-align: right; vertical-align: top; } + td { text-align: left; vertical-align: top; } + td#info { text-align: right; vertical-align: top; } + td#actions { text-align: right; vertical-align: bottom; } + " +%] + +
+ +[% FOREACH a = attachments %] + +
+ + + + + + + + + + + + + + + +
+ Attachment #[% a.attachid %] +
+ [% IF a.isobsolete %] + [% a.description %] + [% ELSE %] + [% a.description %] + [% END %] + + [% IF a.ispatch %] + patch + [% ELSE %] + [% a.mimetype %] + [% END %] + [% a.date %] + + [% IF a.statuses.size == 0 %] + none + [% ELSE %] + [% FOREACH s = a.statuses %] + [% s %]
+ [% END %] + [% END %] +
+
+ Edit +
+ + [% IF a.isviewable %] + + [% ELSE %] +

+ Attachment cannot be viewed because its MIME type is not text/*, image/*, or application/vnd.mozilla.*. + Download the attachment instead. +

+ [% END %] +
+ +

+ +[% END %] + +[% INCLUDE global/footer %] diff --git a/webtools/bugzilla/template/default/attachstatus/create.atml b/webtools/bugzilla/template/default/attachstatus/create.atml new file mode 100755 index 000000000000..602dab92e6ca --- /dev/null +++ b/webtools/bugzilla/template/default/attachstatus/create.atml @@ -0,0 +1,56 @@ +[% INCLUDE global/header + title = "Create Attachment Status" + style = " + th { text-align: right; vertical-align: top; } + td { text-align: left; vertical-align: top; } + " +%] + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name: + +
Description: + +
Sort Key: + +
Product: + +
+ +
+
+ +[% INCLUDE global/footer %] diff --git a/webtools/bugzilla/template/default/attachstatus/edit.atml b/webtools/bugzilla/template/default/attachstatus/edit.atml new file mode 100755 index 000000000000..646e0f0bf3d9 --- /dev/null +++ b/webtools/bugzilla/template/default/attachstatus/edit.atml @@ -0,0 +1,52 @@ +[% INCLUDE global/header + title = "Edit Attachment Status" + style = " + th { text-align: right; vertical-align: top; } + td { text-align: left; vertical-align: top; } + " +%] + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name: + +
Description: + +
Sort Key: + +
Product: + [% product %] +
+ +
+
+ +[% INCLUDE global/footer %] diff --git a/webtools/bugzilla/template/default/attachstatus/list.atml b/webtools/bugzilla/template/default/attachstatus/list.atml new file mode 100755 index 000000000000..acae5cd8d5c6 --- /dev/null +++ b/webtools/bugzilla/template/default/attachstatus/list.atml @@ -0,0 +1,52 @@ +[% INCLUDE global/header + title = 'Administer Attachment Statuses' + message = message + style = " + th { text-align: left; } + " +%] + + + + + + + + + + + + [% FOREACH statusdef = statusdefs %] + + + + + + + + + + [% END %] + + + + + + +
NameDescriptionSort KeyProductAction(s)
[% statusdef.name FILTER html %][% statusdef.description FILTER html %][% statusdef.sortkey %][% statusdef.product %] + Edit + Delete +
+ Create +
+ + + +[% INCLUDE global/footer %] diff --git a/webtools/bugzilla/template/default/global/footer b/webtools/bugzilla/template/default/global/footer new file mode 100755 index 000000000000..e06d3d8e1fab --- /dev/null +++ b/webtools/bugzilla/template/default/global/footer @@ -0,0 +1,6 @@ + +[% PerformSubsts(Param('footerhtml')) %] + + + + diff --git a/webtools/bugzilla/template/default/global/header b/webtools/bugzilla/template/default/global/header new file mode 100755 index 000000000000..676b7ddf41f5 --- /dev/null +++ b/webtools/bugzilla/template/default/global/header @@ -0,0 +1,49 @@ +[% DEFAULT + title = "" + h1 = title + h2 = "" + extra = "" + jscript = "" + style = "" + message = "" +%] + + + + [% title %] + [% Param('headerhtml') %] + [% jscript %] + + + + + [% PerformSubsts(Param('bannerhtml')) %] + +[% IF h1 || h2 %] + + + + + + +
+ + + + +
+ [% h1 %] +
+
 [% h2 %]
+[% END %] + + [% IF message %] +
+ [% message %] +
+ [% END %] + + [% Param('shutdownhtml') %] +