]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 214861: Allow loading of stored queries as the bug set for reporting - Patch...
authorlpsolit%gmail.com <>
Thu, 13 Aug 2009 15:52:04 +0000 (15:52 +0000)
committerlpsolit%gmail.com <>
Thu, 13 Aug 2009 15:52:04 +0000 (15:52 +0000)
chart.cgi
template/en/default/reports/create-chart.html.tmpl

index ab145c42a941ec80ef0a4965975a51562fdce69d..60a34725399634e9750ae6892bebda3e389afcfd 100755 (executable)
--- a/chart.cgi
+++ b/chart.cgi
@@ -47,6 +47,7 @@ use lib qw(. lib);
 
 use Bugzilla;
 use Bugzilla::Constants;
+use Bugzilla::CGI;
 use Bugzilla::Error;
 use Bugzilla::Util;
 use Bugzilla::Chart;
@@ -186,6 +187,18 @@ elsif ($action eq "alter") {
     
     edit($series);
 }
+elsif ($action eq "convert_search") {
+    my $saved_search = $cgi->param('series_from_search') || '';
+    my ($query) = grep { $_->name eq $saved_search } @{ $user->queries };
+    my $url = '';
+    if ($query) {
+        my $params = new Bugzilla::CGI($query->edit_link);
+        # These two parameters conflict with the one below.
+        $url = $params->canonicalise_query('format', 'query_format');
+        $url = '&amp;' . html_quote($url);
+    }
+    print $cgi->redirect(-location => correct_urlbase() . "query.cgi?format=create-series$url");
+}
 else {
     ThrowCodeError("unknown_action");
 }
index d911d03fd0890d82831067a8be3778e670992955..4762c62c0c97fcd567dc23fb83f7f6414f8d5639 100644 (file)
@@ -260,7 +260,23 @@ function subcatSelected() {
 </form>
 
 [% IF user.in_group('editbugs') %]
-  <h3><a href="query.cgi?format=create-series">Create New Data Set</a></h3>
+  <h3>Create New Data Set</h3>
+  <p>
+    You can either create a new data set based on one of your saved searches
+    or start with a clean slate.
+  </p>
+
+  <form action="chart.cgi" id="create_series" name="create_series" method="GET">
+    <input type="hidden" name="action" value="convert_search">
+    <label for="series_from_search">Based on:</label>
+    <select id="series_from_search" name="series_from_search">
+      <option value="">(Clean slate)</option>
+      [% FOREACH q = user.queries %]
+        <option value="[% q.name FILTER html %]">[% q.name FILTER html %]</option>
+      [% END %]
+    </select>
+    <input id="submit_create" type="submit" value="Create a new data set">
+  </form>
 [% END %]                 
 
 [% PROCESS global/footer.html.tmpl %]