Closed Bug 204631 Opened 21 years ago Closed 21 years ago

config.cgi should generate list of queryable fields

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: myk, Assigned: myk)

Details

Attachments

(1 file, 1 obsolete file)

config.cgi should generate a list of queryable fields so third-party clients
know what fields are queryable on each Bugzilla installation.
Attached patch patch v1: implementation (obsolete) — Splinter Review
This version uses the localizable field-descs.none.tmpl for fields with entries
in that template, falling back to database descriptions only when there's no
entry in the template.
Attachment #122590 - Attachment is obsolete: true
Attachment #122641 - Flags: review?(gerv)
Comment on attachment 122641 [details] [diff] [review]
patch v2: uses localizable field descriptions

>Index: globals.pl
>===================================================================
>+sub GetFieldDefs {

Is globals.pl the best place for this? How about the Bugzilla object?

>Index: query.cgi
>===================================================================
> $vars->{'fields'} = \@fields;
> 
> # Creating new charts - if the cmd-add value is there, we define the field
>Index: config.cgi
>===================================================================
>+# Generate a list of fields that can be queried.
>+$vars->{'field'} = [GetFieldDefs()];

Above it's "fields", here it's "field". Why is the GetFieldDefs() call inside
another array?

>Index: template/en/default/config.rdf.tmpl
>===================================================================
>+  <bz:fields>
>+    <Seq>
>+      [% PROCESS "global/field-descs.none.tmpl" %]
>+      [% FOREACH item = field %]

It's x above and item here. You might want to harmonise.

>+        <li>
>+          <bz:field rdf:about="[% Param('urlbase') %]field.cgi?name=[% item.name FILTER uri %]">

Er... do we have a field.cgi?

>+            <bz:name>[% item.name FILTER html %]</bz:name>
>+            <bz:description>[% (field_descs.${item.name} OR item.description) FILTER html %]</bz:description>

Surely this will prefer the name to the descriptive name?

Gerv
Attachment #122641 - Flags: review?(gerv) → review-
> Is globals.pl the best place for this? How about the Bugzilla object?

We need another file to put stuff which isn't (and reasonably shouldn't) be OO
based. This, the productinfo stuff, and so on.

I don't want to put it into Bugzilla, since that object is more high-level, sort of.
Comment on attachment 122641 [details] [diff] [review]
patch v2: uses localizable field descriptions

>Is globals.pl the best place for this? How about the Bugzilla object?

It's where this kind of stuff has gone in the past.  Is putting this into the
Bugzilla object a nit or a necessity?

>Above it's "fields", here it's "field".

query.cgi uses "fields" already, so I didn't change it, but I made it "field"
in config.cgi so it matches the other singular names in that script (which I
made singular per your review comments in bug 72837).

>Why is the GetFieldDefs() call inside another array?

GetFieldDefs() returns an array, but we want to assign an array reference to
$vars->{fields}, so we wrap it into an array reference constructor (square
brackets).

>It's x above and item here. You might want to harmonise.

These are standards in their respective files.

>Er... do we have a field.cgi?

No, but the actual value here is not that important.  It's just necessary for
each field to have a distinct URI.  I can also make them f.e.
"urn:bugzilla:field:foo", but note that we already employ non-existent URIs in
other parts of this RDF output, f.e. milestone.cgi.

>Surely this will prefer the name to the descriptive name?

This prefers the description in field_descs to the one in the database.  In
theory everything should be in the template, but we don't seem to have moved
over fully given that the database column still exists and that I found stuff
in the database that wasn't in the template on my tip install.

Per these responses, can you take another look?
Attachment #122641 - Flags: review- → review?(gerv)
Comment on attachment 122641 [details] [diff] [review]
patch v2: uses localizable field descriptions

r=gerv, then. Sorry for the delay :-)

Gerv
Attachment #122641 - Flags: review?(gerv) → review+
[myk@myk bztip]$ cvs commit globals.pl query.cgi config.cgi
template/en/default/config.*
Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.241; previous revision: 1.240
done
Checking in query.cgi;
/cvsroot/mozilla/webtools/bugzilla/query.cgi,v  <--  query.cgi
new revision: 1.118; previous revision: 1.117
done
Checking in config.cgi;
/cvsroot/mozilla/webtools/bugzilla/config.cgi,v  <--  config.cgi
new revision: 1.3; previous revision: 1.2
done
Checking in template/en/default/config.js.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/config.js.tmpl,v  <-- 
config.js.tmpl
new revision: 1.4; previous revision: 1.3
done
Checking in template/en/default/config.rdf.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/config.rdf.tmpl,v  <-- 
config.rdf.tmpl
new revision: 1.4; previous revision: 1.3
done
Status: NEW → RESOLVED
Closed: 21 years ago
Flags: approval+
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 2.18
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: