Closed Bug 437003 Opened 16 years ago Closed 16 years ago

Add hook to buglist.cgi to add columns to bug list.

Categories

(Bugzilla :: Query/Bug List, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: elliotte_martin, Assigned: elliotte_martin)

References

Details

Attachments

(2 files, 3 obsolete files)

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648)
Build Identifier: 3.1.3

Add hook to buglist.cgi to add columns to bug list at line 692.
Bugzilla::Hook::process("buglist-columns", {'columns' => $columns} );

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Attachment #323517 - Flags: review?(mkanat)
Component: Creating/Changing Bugs → Query/Bug List
How would the hook work? Available columns are already listed in colchange.cgi. If you want to display a column which has multiple values (flags, dependencies, etc...) then this should be fixed for real, not via a hook.
Comment on attachment 323517 [details] [diff] [review]
columns hook  (v1)

Needs POD in Bugzilla::Hook.
Attachment #323517 - Flags: review?(mkanat) → review-
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → Bugzilla 3.2
Attachment #323658 - Flags: review?(mkanat)
Comment on attachment 323658 [details] [diff] [review]
POD changes in Hook.pm and example file

>Index: Bugzilla/Hook.pm
>+This happens after the standard columns have been defined and right before the display

  Make sure these lines are less than 80 chars (ideally less than 76).

>+=item C<columns> - A hashref of column definitions.

  You'll need to be more specific than that--extension authors won't have any idea what a column definition is!

>+# The Initial Developer of the Original Code is Everything Solved, Inc.
>+# Portions created by Everything Solved, Inc. are Copyright (C) 2007 
>+# Everything Solved, Inc. All Rights Reserved.

  No, actually it's Canonical, since we did this work under their banner.

>+$columns->{'newcol'} = { 'name' => 'bugs.newcol' , 'title' => 'New Column' };

  Let's call that example (with Example as the title) and actually make it work. (That is, bugs.newcol doesn't work, but we could use some column that really does exist but doesn't get displayed directly, like bugs.delta_ts.)

  Also, FWIW, in Perl you don't have to manually quote the key. That's what the => operator does.
Attachment #323658 - Flags: review?(mkanat) → review-
Attachment #323658 - Attachment is obsolete: true
Attachment #325066 - Flags: review?(mkanat)
Comment on attachment 325066 [details] [diff] [review]
POD changes in Hook.pm and example file (v2)

  This is much better! A few things to fix, though:

>+ 1. ID: a unique identifier by which the column is referred
>+
>+ 2. Name: The name of the column in the database
>+
>+ 3. Title: The title of the column as displayed to users.

  You can make ordered lists in POD like this:

=over

=item 1

C<id> - A unique...

=item 2

C<name> - fkasdjfals;kdfj

=back

Also change the names to be in C<> like that and be the exact hash key names.

>+The definition is structured as:
>+$columns->{$id} = { name => $name , title => $title };

  That should look like:

-----------
The definition is structured as:

 $columns->{$id} = { name => $name , title => $title };
------------

That makes it two separate paragraphs, and the second one will look like preformatted text (which it is).

>+Example:

  That's in the example code, so it can probably stay there (thus making this POD a little shorter).
Attachment #325066 - Flags: review?(mkanat) → review-
Attachment #325066 - Attachment is obsolete: true
Attachment #325185 - Flags: review?(mkanat)
Comment on attachment 325185 [details] [diff] [review]
POD changes in Hook.pm and example file (v3)

>+Bugzilla::Hook::process('install-before_final_checks', {'silent' => $silent });

  Wrong hook.

>+=item C<columns> - A hashref of column definitions.

  You can just say something like, "A hashref, where the keys are blah and the values are hashrefs with the following fields:"

>+$columns->{$id} = { name => $name , title => $title };

  Put a single space before that so that it shows up as code in the rendered POD.

  (Oh, and nit: no space before the comma.)
Attachment #325185 - Flags: review?(mkanat) → review-
Attachment #325185 - Attachment is obsolete: true
Attachment #325231 - Flags: review?(mkanat)
Comment on attachment 325231 [details] [diff] [review]
POD changes in Hook.pm and example file (v4)

>+=item 1
>+
>+C<id> - A unique identifier by which the column is referred.

  id is not actually a column field, right? I can fix this on checkin, or you can post a new patch.

  Otherwise this looks great. :-)
Attachment #325231 - Flags: review?(mkanat) → review+
Flags: approval3.2+
Flags: approval3.0+
Flags: approval+
Target Milestone: Bugzilla 3.2 → Bugzilla 3.0
(In reply to comment #11)
> (From update of attachment 325231 [details] [diff] [review])
> >+=item 1
> >+
> >+C<id> - A unique identifier by which the column is referred.
> 
>   id is not actually a column field, right? I can fix this on checkin, or you
> can post a new patch.
No, it's not a column field, it's a unique ID to refer to a column though and the hashref which includes the actual column name and the title shown on the column heading. 

Assignee: create-and-change → elliotte_martin
Status: NEW → ASSIGNED
(In reply to comment #11)

> >+C<id> - A unique identifier by which the column is referred.
>   id is not actually a column field, right? I can fix this on checkin, or you
> can post a new patch.
>   Otherwise this looks great. :-)
Max, you just assigned this to me, but I'm not sure what I am supposed to do.  See my comment #12.  Did you just want me to clarify that's its not a column field name?
Hey, no, I just reassigned it to you because it was assigned to nobody, and you're the person who actually fixed it.

I fixed the POD on checkin. I also put the hook description in the right alphabetical order (and added a note to the POD that things are in alphabetical order).

tip:

Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.375; previous revision: 1.374
done
Checking in Bugzilla/Hook.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Hook.pm,v  <--  Hook.pm
new revision: 1.16; previous revision: 1.15
done
RCS file: /cvsroot/mozilla/webtools/bugzilla/extensions/example/code/buglist-columns.pl,v
done
Checking in extensions/example/code/buglist-columns.pl;
/cvsroot/mozilla/webtools/bugzilla/extensions/example/code/buglist-columns.pl,v  <--  buglist-columns.pl
initial revision: 1.1
done

3.2:

Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.374.2.1; previous revision: 1.374
done
Checking in Bugzilla/Hook.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Hook.pm,v  <--  Hook.pm
new revision: 1.14.2.2; previous revision: 1.14.2.1
done
Checking in extensions/example/code/buglist-columns.pl;
/cvsroot/mozilla/webtools/bugzilla/extensions/example/code/buglist-columns.pl,v  <--  buglist-columns.pl
new revision: 1.1.2.1; previous revision: 1.1
done

3.0:

cvs commit[mkanat@landfill 11:13:26 mkanat30]$ cvs commit
Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.351.2.10; previous revision: 1.351.2.9
done
Checking in Bugzilla/Hook.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Hook.pm,v  <--  Hook.pm
new revision: 1.7.2.3; previous revision: 1.7.2.2
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: