]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for bug 204631: enhances config.cgi to generate a list of queryable fields so...
authormyk%mozilla.org <>
Tue, 24 Jun 2003 01:01:35 +0000 (01:01 +0000)
committermyk%mozilla.org <>
Tue, 24 Jun 2003 01:01:35 +0000 (01:01 +0000)
r=gerv
a=myk

config.cgi
globals.pl
query.cgi
template/en/default/config.js.tmpl
template/en/default/config.rdf.tmpl

index d1ad3cdc9487d98b3d1928e5e4e4a75116920b74..a02ff8c7bc514618097833e8c8efa615f5061944 100755 (executable)
@@ -87,6 +87,9 @@ foreach my $status (@::legal_bug_status) {
 $vars->{'open_status'} = \@open_status;
 $vars->{'closed_status'} = \@closed_status;
 
+# Generate a list of fields that can be queried.
+$vars->{'field'} = [GetFieldDefs()];
+
 # Determine how the user would like to receive the output; 
 # default is JavaScript.
 my $format = GetFormat("config", $::FORM{'format'}, $::FORM{'ctype'} || "js");
index 9c36e9003bc08da2ce242d68f015e86264cfc1a0..d8d11be535d4c8b3ec0efc563ce5a80a10334bcb 100644 (file)
@@ -627,6 +627,26 @@ sub GetSelectableProductHash {
 }
 
 
+sub GetFieldDefs {
+    my $extra = "";
+    if (!UserInGroup(Param('timetrackinggroup'))) {
+        $extra = "WHERE name NOT IN ('estimated time', 'remaining_time', " .
+                 "'work_time', 'percentage_complete')";
+    }
+
+    my @fields;
+    PushGlobalSQLState();
+    SendSQL("SELECT name, description FROM fielddefs $extra ORDER BY sortkey");
+    while (MoreSQLData()) {
+        my ($name, $description) = FetchSQLData();
+        push(@fields, { name => $name, description => $description });
+    }
+    PopGlobalSQLState();
+
+    return(@fields);
+}
+
+
 sub CanSeeBug {
 
     my ($id, $userid) = @_;
index e450898dafeb8ca669280e61c5ef6a56ddf87362..2a8051b6b6d1a2c360d6a595dcef507578f64afe 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -314,19 +314,7 @@ $vars->{'bug_severity'} = \@::legal_severity;
 # Boolean charts
 my @fields;
 push(@fields, { name => "noop", description => "---" });
-SendSQL("SELECT name, description FROM fielddefs ORDER BY sortkey");
-while (MoreSQLData()) {
-    my ($name, $description) = FetchSQLData();
-    if (($name eq "estimated_time" ||
-         $name eq "remaining_time" ||
-         $name eq "work_time" ||
-         $name eq "percentage_complete" ) &&
-        (!UserInGroup(Param('timetrackinggroup')))) {
-        next;
-    }
-    push(@fields, { name => $name, description => $description });
-}
-
+push(@fields, GetFieldDefs());
 $vars->{'fields'} = \@fields;
 
 # Creating new charts - if the cmd-add value is there, we define the field
index 26d089fd69cf5bfc2f83f395e03b025202077b48..a74c5d34d6bc35515786b9a20c9a624514a99fe3 100644 (file)
@@ -101,8 +101,18 @@ var component_exceptions = new Array(
   //        //                                            ^^^^
 );
 
+// Queryable Fields
+// ================
+[% PROCESS "global/field-descs.none.tmpl" %]
+var field = [
+[% FOREACH x = field %]
+  { name:        '[% x.name FILTER js %]', 
+    description: '[% (field_descs.${x.name} OR x.description) FILTER js %]' },
+[% END %]
+];
+
 // Deprecated Variables
-// ================================
+// ====================
 //
 // Other names for various variables.  These are deprecated
 // and could go away at any time.  Use them at your own risk!
index 6aa51f657026904119a9e94bd91575a3ca4194f2..884c26a0c33b9c4382d8cf3fee2b765a912e0330 100644 (file)
     </bz:target_milestones>
   [% END %]
 
+  <bz:fields>
+    <Seq>
+      [% PROCESS "global/field-descs.none.tmpl" %]
+      [% FOREACH item = field %]
+        <li>
+          <bz:field rdf:about="[% Param('urlbase') %]field.cgi?name=[% item.name FILTER uri %]">
+            <bz:name>[% item.name FILTER html %]</bz:name>
+            <bz:description>[% (field_descs.${item.name} OR item.description) FILTER html %]</bz:description>
+          </bz:field>
+        </li>
+      [% END %]
+    </Seq>
+  </bz:fields>
 </bz:installation>
 
 </RDF>