[Rt-commit] rt branch, 4.2/saved-chart-show-partly, repushed

? sunnavy sunnavy at bestpractical.com
Sun Jan 11 14:19:11 EST 2015


The branch 4.2/saved-chart-show-partly was deleted and repushed:
       was b2a3f09c43aada35951c367e1f3e5044d2216178
       now 4020550dd8282b33b975ec7864e31e2c10a1656a

1:  b2a3f09 ! 1:  8befa8d allow user to customize the visibility of image/table/sql in chart
    @@ -1,9 +1,9 @@
     Author: sunnavy <sunnavy at bestpractical.com>
     
    -    pie/bar/table only chart styles
    +    allow user to customize the visibility of image/table/sql in chart
         
         sometimes users want to show part of it.
    -    (e.g. when the charts are added to a dashboard)
    +    (e.g. when a chart is added to a dashboard)
     
     diff --git a/share/html/Search/Chart b/share/html/Search/Chart
     --- a/share/html/Search/Chart
    @@ -13,19 +13,90 @@
      s/\D//g for grep defined, $Width, $Height;
      $Width  ||= 600;
     -$Height ||= ($ChartStyle eq 'pie' ? $Width : 400);
    -+$Height ||= ($ChartStyle =~ /pie/ ? $Width : 400);
    - $Height = $Width if $ChartStyle eq 'pie';
    +-$Height = $Width if $ChartStyle eq 'pie';
    ++$Height ||= ($ChartStyle =~ /\bpie\b/ ? $Width : 400);
    ++$Height = $Width if $ChartStyle =~ /\bpie\b/;
      
      my $plot_error = sub {
    +     my $text = shift;
    +@@
    + $ChartStyle = 'bar' if @data > 2;
    + 
    + my $chart_class;
    +-if ($ChartStyle eq 'pie') {
    ++if ($ChartStyle =~ /\bpie\b/) {
    +     require GD::Graph::pie;
    +     $chart_class = "GD::Graph::pie";
    + } else {
    +
    +diff --git a/share/html/Search/Chart.html b/share/html/Search/Chart.html
    +--- a/share/html/Search/Chart.html
    ++++ b/share/html/Search/Chart.html
    +@@
    + </&>
    + 
    + <&| /Widgets/TitleBox, title => loc('Picture'), class => "chart-picture" &>
    +-<label><% loc('Style') %>: <& Elements/SelectChartType, Default => $query{ChartStyle}[0], Name => 'ChartStyle' &></label>
    ++<input name="ChartStyle" type="hidden" value="<% $query{ChartStyle}[0] %>" />
    ++<label><% loc('Style') %>: <& Elements/SelectChartType, Default => $query{ChartStyle}[0] =~ /^(pie|bar|table)\b/ ? $1 : undef &></label>
    ++<span class="width">
    + <label><% loc("Width") %>: <input type="text" name="Width" value="<% $query{'Width'} || q{} %>"> <% loc("px") %></label>
    ++</span>
    + <span class="height">
    +   &#x00d7;
    +   <label><% loc("Height") %>: <input type="text" name="Height" value="<% $query{'Height'} || q{} %>"> <% loc("px") %></label>
    + </span>
    ++<div class="include-table">
    ++    <input type="checkbox" name="ChartStyleIncludeTable" <% $query{ChartStyle}[0] =~ /\btable\b/ ? 'checked="checked"' : '' |n %>> <% loc('Include data table') %>
    ++</div>
    ++<div class="include-sql">
    ++    <input type="checkbox" name="ChartStyleIncludeSQL" <% $query{ChartStyle}[0] =~ /\bsql\b/ ? 'checked="checked"' : '' |n %>> <% loc('Include TicketSQL query') %>
    ++</div>
    + </&>
    + <script type="text/javascript">
    +-jQuery(".chart-picture [name=ChartStyle]").change(function(){
    ++var updateChartStyle = function() {
    ++    var val = jQuery(".chart-picture [name=ChartType]").val();
    ++    if ( val != 'table' && jQuery(".chart-picture [name=ChartStyleIncludeTable]").is(':checked') ) {
    ++        val += '+table';
    ++    }
    ++    if ( jQuery(".chart-picture [name=ChartStyleIncludeSQL]").is(':checked') ) {
    ++        val += '+sql';
    ++    }
    ++    jQuery(".chart-picture [name=ChartStyle]").val(val);
    ++};
    ++jQuery(".chart-picture [name=ChartType]").change(function(){
    +     var t = jQuery(this);
    +-    t.closest("form").find("[name=Height]").closest(".height").toggle( t.val() !== "pie" );
    ++    t.closest("form").find("[name=Height]").closest(".height").toggle( t.val() == 'bar' );
    ++    t.closest("form").find("[name=Width]").closest(".width").toggle( t.val() !== 'table' );
    ++    t.closest("form .chart-picture").find("div.include-table").toggle( t.val() !== 'table' );
    ++    updateChartStyle();
    + }).change();
    ++
    ++jQuery(".chart-picture [name=ChartStyleIncludeTable]").change( updateChartStyle );
    ++jQuery(".chart-picture [name=ChartStyleIncludeSQL]").change( updateChartStyle );
    + </script>
    + 
    + <& /Elements/Submit, Label => loc('Update Chart'), Name => 'Update' &>
     
     diff --git a/share/html/Search/Elements/Chart b/share/html/Search/Elements/Chart
     --- a/share/html/Search/Elements/Chart
     +++ b/share/html/Search/Elements/Chart
     @@
    + <%args>
    + $Query => "id > 0"
    + @GroupBy => ()
    +-$ChartStyle => 'bar'
    ++$ChartStyle => 'bar+table+sql'
    + @ChartFunction => 'COUNT'
    + </%args>
    + <%init>
    +@@
      my $query_string = $m->comp('/Elements/QueryString', %ARGS, GroupBy => \@GroupBy );
      </%init>
      <div class="chart-wrapper">
    -+% if ( ($ChartStyle || '') ne 'table only' ) {
    ++% if ( ($ChartStyle || '') =~ /\b(?:pie|bar)\b/ ) {
      <span class="chart image">
      % if (RT->Config->Get('DisableGD')) {
      <% loc('Graphical charts are not available.') %><br />
    @@ -35,11 +106,11 @@
      </span>
     +% }
     +
    -+% if ( ($ChartStyle || '') !~ /^(?:pie|bar) only$/ ) {
    ++% if ( ($ChartStyle || '') =~ /\btable\b/ ) {
      <& ChartTable, %ARGS, Table => { $report->FormatTable( %columns ) } &>
     +% }
     +
    -+% if ( ($ChartStyle || '') !~ / only$/ ) {
    ++% if ( ($ChartStyle || '') =~ /\bsql\b/ ) {
      <div class="query"><span class="label"><% loc('Query') %>:</span><span class="value"><% $Query %></span></div>
     +% }
      </div>
    @@ -52,12 +123,10 @@
      </%args>
      <select id="<%$Name%>" name="<%$Name%>">
     -% foreach my $option (qw(bar pie)) {
    -+% foreach my $option ('bar', 'bar only', 'pie', 'pie only', 'table only') {
    ++% foreach my $option ('bar', 'pie', 'table') {
      % # 'bar' # loc
    -+% # 'bar only' # loc
      % # 'pie' # loc
    -+% # 'pie only' # loc
    -+% # 'table only' # loc
    ++% # 'table' # loc
      <option value="<%$option%>"<% $option eq $Default ? qq[ selected="selected"] : '' |n %>><%loc($option)%></option>
      % }
      </select>
    @@ -109,3 +178,16 @@
      }
      
      .chart-meta .chart-type {
    +
    +diff --git a/t/mail/dashboard-chart-with-utf8.t b/t/mail/dashboard-chart-with-utf8.t
    +--- a/t/mail/dashboard-chart-with-utf8.t
    ++++ b/t/mail/dashboard-chart-with-utf8.t
    +@@
    +     fields    => {
    +         SavedSearchDescription => 'chart foo',
    +         SavedSearchOwner       => 'RT::User-' . $root->id,
    ++        ChartStyle             => 'bar',
    +     },
    +     button => 'SavedSearchSave',
    + );
    +
-:  ------- > 2:  32827ec only bars need to be lifted up a bit
-:  ------- > 3:  4020550 upgrade step as old "bar" or "pie" implies "bar+table+sql" or "pie+table+sql"



More information about the rt-commit mailing list