[Rt-devel] Allow TicketList sorting when embedded in other pages

Jesse Vincent jesse at bestpractical.com
Wed May 30 13:12:17 EDT 2007


On May 30, 2007, at 8:50 AM, Nicholas Clark wrote:

> I'm not sure if the appended patch is what you want for RT.
>

+1. Seems reasonable. (Except for the use of CVS ;)


> The TicketList element is embedded into various pages generated by  
> RT. However,
> sorting is (as best I can tell) only enabled for searches and bulk  
> searches
> by privileged users. I tried enabling this for a custom page I'd  
> written
> for the Self-Service interface and it all went horribly wrong, because
> TicketList assumes that the query arguments needed on the sorting  
> link are
> those of the RT search. This is accurate for the current uses, but  
> not that
> flexible.
>
> With these changes it's possible to enable sorting on TicketList in  
> other
> situations, and have it pass through the correct (extra) page  
> parameters to
> reload those pages in sorted form.
>
> It would be possible to enable sorting of the open and closed pages  
> on the
> default self service interface, but I've not done that here.
>
> Nicholas Clark
>
> Index: rt-external/html/Elements/TicketList
> diff -c rt-external/html/Elements/TicketList:1.1.1.1 rt-external/ 
> html/Elements/TicketList:1.2
> *** rt-external/html/Elements/TicketList:1.1.1.1	Mon May 21  
> 15:38:40 2007
> --- rt-external/html/Elements/TicketList	Wed May 30 12:32:26 2007
> ***************
> *** 56,61 ****
> --- 56,62 ----
>       Page => $Page,
>       OrderBy => $OrderBy ,
>       BaseURL => $BaseURL,
> +     GenericQueryArgs => $GenericQueryArgs,
>       maxitems => $maxitems &>
>   % }
>
> ***************
> *** 167,172 ****
> --- 168,174 ----
>   $Order => undef
>   $OrderBy => undef
>   $BaseURL => undef
> + $GenericQueryArgs => undef
>   $Format => $RT::DefaultSearchResultFormat
>   $DisplayFormat => undef
>   $ShowNavigation => 1
> Index: rt-external/html/Elements/CollectionAsTable/Header
> diff -u rt-external/html/Elements/CollectionAsTable/Header:1.1.1.1  
> rt-external/html/Elements/CollectionAsTable/Header:1.2
> --- rt-external/html/Elements/CollectionAsTable/Header:1.1.1.1	Mon  
> May 21 15:38:40 2007
> +++ rt-external/html/Elements/CollectionAsTable/Header	Wed May 30  
> 12:32:26 2007
> @@ -49,6 +49,7 @@
>  $AllowSorting => undef
>  $Order=>undef
>  $BaseURL => undef
> +$GenericQueryArgs => undef
>  $Query => undef
>  $Rows => undef
>  $Page => undef
> @@ -57,7 +58,7 @@
>  <tr class="collection-as-table">
>  <%perl>
>
> -my %generic_query_args = ( Query => $Query, Rows => $Rows, Page =>  
> $Page, Format => $FormatString );
> +my $generic_query_args = $GenericQueryArgs || { Query => $Query,  
> Rows => $Rows, Page => $Page, Format => $FormatString };
>
>  my $item = 0;
>  foreach my $col (@Format) {
> @@ -98,7 +99,7 @@
>                  '<a href="' . $BaseURL
>                    . $m->comp(
>                      '/Elements/QueryString',
> -                    %generic_query_args,
> +                    %$generic_query_args,
>                      OrderBy => (
>                          $m->comp(
>                              '/Elements/RT__Ticket/ColumnMap',
> Index: rt-external/html/SelfService/Elements/MyRequests
> diff -u rt-external/html/SelfService/Elements/MyRequests:1.4 rt- 
> external/html/SelfService/Elements/MyRequests:1.5
> --- rt-external/html/SelfService/Elements/MyRequests:1.4	Tue May 29  
> 11:25:46 2007
> +++ rt-external/html/SelfService/Elements/MyRequests	Wed May 30  
> 12:32:26 2007
> @@ -50,6 +50,8 @@
>  			 Order   => $Order,
>  			 OrderBy => $OrderBy,
>  			 BaseURL => $BaseURL,
> +			 GenericQueryArgs => $GenericQueryArgs,
> +			 AllowSorting => $AllowSorting,
>  			 Page    => $Page &>
>  </&>
>
> @@ -69,8 +71,6 @@
>     $Query .= "' )";
>  }
>  $Query .= ' ' . $extra_constraint if $extra_constraint;
> -my $Order = "ASC";
> -my $OrderBy = "Created";
>  my @Format = qq{
>     '<B><A HREF="$RT::WebPath/SelfService/Display.html? 
> id=__id__">__id__</a></B>/TITLE:Ticket Reference',
>     '<B><A HREF="$RT::WebPath/SelfService/Display.html? 
> id=__id__">__Subject__</a></B>/TITLE:Subject',
> @@ -119,5 +119,9 @@
>  @status => ('open', 'new', 'stalled')
>  $extra_constraint => undef
>  $BaseURL => undef
> +$GenericQueryArgs => undef
> +$Order => "ASC"
> +$OrderBy => "Created"
> +$AllowSorting => undef
>  $Page => 1
>  </%ARGS>
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/ 
> rt-devel
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20070530/905c3a59/PGP.pgp


More information about the Rt-devel mailing list