From b5f050c431d0de873e8957eede9d710f71d8e1d8 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" Date: Mon, 17 Jul 2006 19:58:56 +0000 Subject: [PATCH] Bug 344513: Make plain-text custom fields functional on all pages except enter_bug.cgi Patch By Max Kanat-Alexander r=LpSolit, a=myk git-svn-id: svn://10.0.0.236/trunk@202246 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/buglist.cgi | 4 ++ mozilla/webtools/bugzilla/colchange.cgi | 3 ++ .../bugzilla/skins/standard/show_bug.css | 18 ++++++++ .../template/en/default/bug/edit.html.tmpl | 5 ++- .../template/en/default/bug/field.html.tmpl | 41 ++++++++++++------- .../en/default/bug/show-multiple.html.tmpl | 14 +++++++ .../template/en/default/bug/show.html.tmpl | 2 + .../en/default/global/field-descs.none.tmpl | 11 +++++ .../en/default/list/edit-multiple.html.tmpl | 8 ++++ 9 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 mozilla/webtools/bugzilla/skins/standard/show_bug.css diff --git a/mozilla/webtools/bugzilla/buglist.cgi b/mozilla/webtools/bugzilla/buglist.cgi index c16e70a69fc..882a2977758 100755 --- a/mozilla/webtools/bugzilla/buglist.cgi +++ b/mozilla/webtools/bugzilla/buglist.cgi @@ -625,6 +625,10 @@ DefineColumn("percentage_complete", DefineColumn("relevance" , "relevance" , "Relevance" ); DefineColumn("deadline" , $dbh->sql_date_format('bugs.deadline', '%Y-%m-%d') . " AS deadline", "Deadline"); +foreach my $field (Bugzilla->get_fields({ custom => 1, obsolete => 0})) { + DefineColumn($field->name, 'bugs.' . $field->name, $field->description); +} + ################################################################################ # Display Column Determination ################################################################################ diff --git a/mozilla/webtools/bugzilla/colchange.cgi b/mozilla/webtools/bugzilla/colchange.cgi index 3f06ca533e9..1ff65b73ba9 100755 --- a/mozilla/webtools/bugzilla/colchange.cgi +++ b/mozilla/webtools/bugzilla/colchange.cgi @@ -20,6 +20,7 @@ # # Contributor(s): Terry Weissman # Gervase Markham +# Max Kanat-Alexander use strict; @@ -77,6 +78,8 @@ if (UserInGroup(Bugzilla->params->{"timetrackinggroup"})) { push(@masterlist, ("short_desc", "short_short_desc")); +push(@masterlist, Bugzilla->custom_field_names); + $vars->{'masterlist'} = \@masterlist; my @collist; diff --git a/mozilla/webtools/bugzilla/skins/standard/show_bug.css b/mozilla/webtools/bugzilla/skins/standard/show_bug.css new file mode 100644 index 00000000000..012d3b5e9b1 --- /dev/null +++ b/mozilla/webtools/bugzilla/skins/standard/show_bug.css @@ -0,0 +1,18 @@ +/* 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. + * + * Contributor(s): Max Kanat-Alexander + */ + +.field_label { + text-align: right; +} diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl index dc80079d525..83bb5fb51cc 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl @@ -18,6 +18,7 @@ # # Contributor(s): Gervase Markham # Vaskin Kissoyan + # Max Kanat-Alexander #%] [% PROCESS global/variables.none.tmpl %] @@ -498,7 +499,9 @@ [% USE Bugzilla %] [% FOREACH field = Bugzilla.get_fields({ obsolete => 0, custom => 1 }) %] - [% PROCESS bug/field.html.tmpl value=bug.${field.name} %] + + [% PROCESS bug/field.html.tmpl value=bug.${field.name} editable=1 %] + [% END %]
diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl index cbde9cf2783..9c45b3e57ea 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/field.html.tmpl @@ -17,20 +17,33 @@ # Rights Reserved. # # Contributor(s): Myk Melez + # Max Kanat-Alexander #%] - - [% SWITCH field.type %] - [% CASE constants.FIELD_TYPE_FREETEXT %] - - - - - - +[%# INTERFACE: + # field: a Bugzilla::Field object + # value: The value of the field for this bug. + # editable: Whether the field should be displayed as an editable + # or as just the plain text of its value. + #%] + + + [% IF editable %] + ' IF editable %] + + + +[% IF editable %] + [% SWITCH field.type %] + [% CASE constants.FIELD_TYPE_FREETEXT %] + + [% END %] +[% ELSE %] + [% value FILTER html %] +[% END %] + diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/show-multiple.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/show-multiple.html.tmpl index 22bc3db6994..c76e07699ac 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/show-multiple.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/show-multiple.html.tmpl @@ -20,6 +20,7 @@ # Gervase Markham # Toms Baugis # Olav Vitters + # Max Kanat-Alexander #%] [% PROCESS "global/field-descs.none.tmpl" %] @@ -164,6 +165,19 @@ [% PROCESS row cell = "status_whiteboard" fullrow = 1 %] [% END %] + [% USE Bugzilla %] + [% field_counter = 0 %] + [% FOREACH field = Bugzilla.get_fields({ obsolete => 0, custom => 1 }) %] + [% field_counter = field_counter + 1 %] + [%# Odd-numbered fields get an opening %] + [% '' IF field_counter % 2 %] + [% PROCESS bug/field.html.tmpl value=bug.${field.name} editable=0 %] + [%# Even-numbered fields get a closing %] + [% '' IF !(field_counter % 2) %] + [% END %] + [%# And we have to finish the row if we ended on an odd number. %] + [% '' IF field_counter % 2 %] + [% IF (bug.dependson.size || bug.blocked.size) %] [% PROCESS dependencies name = "dependson" %] [% PROCESS dependencies name = "blocked" %] diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/show.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/show.html.tmpl index 99fd466600c..eb7457a7ceb 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/show.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/show.html.tmpl @@ -19,6 +19,7 @@ # Contributor(s): Gervase Markham # Vaskin Kissoyan # Bradley Baetz + # Max Kanat-Alexander #%] [% PROCESS global/variables.none.tmpl %] @@ -39,6 +40,7 @@ "bz_component_$bug.component", "bz_bug_$bug.bug_id" ] + style_urls = ['skins/standard/show_bug.css'] %] [% END %] diff --git a/mozilla/webtools/bugzilla/template/en/default/global/field-descs.none.tmpl b/mozilla/webtools/bugzilla/template/en/default/global/field-descs.none.tmpl index 7a27251212a..ba6f675e4db 100644 --- a/mozilla/webtools/bugzilla/template/en/default/global/field-descs.none.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/global/field-descs.none.tmpl @@ -69,6 +69,17 @@ "votes" => "Votes", "work_time" => "Hours Worked"} %] +[%# Also include any custom fields or fields which don't have a + Description here, by copying their Description from the + database. If you want to override this for your language + or your installation, just use a hook. %] + +[% USE Bugzilla %] +[% FOREACH field = Bugzilla.get_fields() %] + [% SET field_descs.${field.name} = field.description + IF !field_descs.${field_name}.exists %] +[% END %] + [% status_descs = { "UNCONFIRMED" => "UNCONFIRMED", "NEW" => "NEW", "ASSIGNED" => "ASSIGNED", diff --git a/mozilla/webtools/bugzilla/template/en/default/list/edit-multiple.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/list/edit-multiple.html.tmpl index 92a083a6819..958a95cf828 100644 --- a/mozilla/webtools/bugzilla/template/en/default/list/edit-multiple.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/list/edit-multiple.html.tmpl @@ -17,6 +17,7 @@ # Rights Reserved. # # Contributor(s): Myk Melez + # Max Kanat-Alexander #%] [% PROCESS global/variables.none.tmpl %] @@ -206,6 +207,13 @@ [% END %] + [% USE Bugzilla %] + [% FOREACH field = Bugzilla.get_fields({ obsolete => 0, custom => 1 }) %] + + [% PROCESS bug/field.html.tmpl value=dontchange editable=1 %] + + [% END %] +