[Rt-commit] [rtir] 01/01: Giant copy from 4.2 for charting

Kevin Falcone falcone at bestpractical.com
Mon Jul 21 16:33:48 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/charting-updates
in repository rtir.

commit e7c5a88007dab5322000ec133324109f7f73c061
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Jul 21 16:26:03 2014 -0400

    Giant copy from 4.2 for charting
    
    This rips out some of the 4.0 copying and replaces with 4.2 copying.
    It also no longer requires that you have ShowChart=1 in your URL to get
    a chart, since 4.2 deals with that more gracefully.
    
    This probably has bugs, and still doesn't port saved charts into the
    RTIR search because I'd rather spend effort removing the RTIR specific
    BaseQuery search stuff.
    
    Documents that URLs with the old arguments aren't going to 'just work'
    on 3.2, but since the charts are much better, you'll want to rework them
    anyway.
    
    Fixes issues #30262
---
 docs/UPGRADING-3.2                           |  7 +++
 html/Callbacks/RTIR/Elements/Tabs/Privileged |  2 +-
 html/RTIR/Search/Reporting.html              | 79 +++++++++++++++++++++++-----
 3 files changed, 75 insertions(+), 13 deletions(-)

diff --git a/docs/UPGRADING-3.2 b/docs/UPGRADING-3.2
index 4d116d7..521cb82 100644
--- a/docs/UPGRADING-3.2
+++ b/docs/UPGRADING-3.2
@@ -9,3 +9,10 @@ for previous versions.
 
 The F<add_constituency> script has been moved from F<etc> to the standard
 F<bin> directory.
+
+=head2 Chart URLs changed
+
+RT 4.2 added improved charting (multiple group bys, calculations, etc),
+but the arguments passed have changed. If you have bookmarks pointing to
+/RTIR/Search/Reporting.html they likely will not work on RTIR 3.2.
+
diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 8f9fa3d..1c38ef0 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -450,7 +450,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update|Forward|
     if ( $args{'Query'} ) {
         PageMenu()->child(
             chart => title => loc('Chart'),
-            path => "/RTIR/Search/Reporting.html?ShowChart=1&". $query_string->( %args ),
+            path => "/RTIR/Search/Reporting.html?". $query_string->( %args ),
         );
 
         my $more = PageMenu->child( more => title => loc('Feeds') );
diff --git a/html/RTIR/Search/Reporting.html b/html/RTIR/Search/Reporting.html
index 1b9dcf8..23cbf90 100644
--- a/html/RTIR/Search/Reporting.html
+++ b/html/RTIR/Search/Reporting.html
@@ -49,24 +49,74 @@
 <& /Elements/Tabs &>
 <& /Elements/ListActions &>
 
+% if ( $ShowChart ) {
+<& /Search/Elements/Chart, %ARGS &>
+% }
+
 <form method="get" action="<% RT->Config->Get('WebPath') %>/RTIR/Search/Reporting.html">
 % my %hiddens = (Queue => $Queue, Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order);
 % while ( my ($key, $val) = each %hiddens ) {
 % next unless defined $val;
 <input type="hidden" class="hidden" name="<% $key %>" value="<% $val %>" />
 % }
-<&|/l&>Show chart</&>
-<&|/l_unsafe, $m->scomp('/Search/Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $FullQuery) &>grouped by [_1]</&>
-<&|/l_unsafe, $m->scomp('/Search/Elements/SelectChartType', Name => 'ChartStyle') &>style: [_1]</&>
-<input type="submit" class="button" name="ShowChart" value="<% loc('Go')%>" />
-</form>
 
-<br />
+<&| /Widgets/TitleBox, title => loc('Group by'), class => "chart-group-by" &>
+<fieldset><legend><% loc('Group tickets by') %></legend>
+<& /Search/Elements/SelectGroupBy,
+    Name => 'GroupBy',
+    Query => $ARGS{Query},
+    Default => $GroupBy[0],
+    &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& /Search/Elements/SelectGroupBy,
+    Name => 'GroupBy',
+    Query => $ARGS{Query},
+    Default => $GroupBy[1],
+    ShowEmpty => 1,
+    &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& /Search/Elements/SelectGroupBy,
+    Name => 'GroupBy',
+    Query => $ARGS{Query},
+    Default => $GroupBy[2],
+    ShowEmpty => 1,
+    &>
+</fieldset>
+</&>
 
-% if ( $ShowChart ) {
-<& /Search/Elements/Chart, Query => $FullQuery, PrimaryGroupBy => $PrimaryGroupBy, ChartStyle => $ChartStyle &>
-% }
+<&| /Widgets/TitleBox, title => loc("Calculate"), class => "chart-calculate" &>
 
+<fieldset><legend><% loc('Calculate values of') %></legend>
+<& /Search/Elements/SelectChartFunction, Default => $ChartFunction[0] &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& /Search/Elements/SelectChartFunction, Default => $ChartFunction[1], ShowEmpty => 1 &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& /Search/Elements/SelectChartFunction, Default => $ChartFunction[2], ShowEmpty => 1 &>
+</fieldset>
+
+</&>
+
+<&| /Widgets/TitleBox, title => loc('Picture'), class => "chart-picture" &>
+<label><% loc('Style') %>: <& /Search/Elements/SelectChartType, Default => $ChartStyle, Name => 'ChartStyle' &></label>
+<label><% loc("Width") %>: <input type="text" name="Width" value="<% $Width || "" %>"> <% loc("px") %></label>
+<span class="height">
+  &#x00d7;
+  <label><% loc("Height") %>: <input type="text" name="Height" value="<% $Height || "" %>"> <% loc("px") %></label>
+</span>
+</&>
+<script type="text/javascript">
+jQuery(".chart-picture [name=ChartStyle]").change(function(){
+    var t = jQuery(this);
+    t.closest("form").find("[name=Height]").closest(".height").toggle( t.val() !== "pie" );
+}).change();
+</script>
+
+<& /Elements/Submit, Label => loc('Update Chart'), Name => 'Update' &>
+</form>
 
 <%INIT>
 my $title = loc('Reporting');
@@ -83,9 +133,14 @@ else {
 </%INIT>
 
 <%ARGS>
-$PrimaryGroupBy => 'Status'
-$ChartStyle     => 'bar'
-$ShowChart      => 0
+$ShowChart      => 1
+
+ at GroupBy => 'Status'
+$ChartStyle => 'bar'
+ at ChartFunction => ('COUNT')
+$Description => undef
+$Width => undef
+$Height => undef
 
 $Queue     => ''
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list