[Rt-devel] [PATCH] Redirect to ticket display on quick create

Jesse Vincent jesse at bestpractical.com
Mon Nov 15 15:57:12 EST 2010




On Wed 10.Nov'10 at 15:12:11 -0800, Ivan Kohler wrote:
> Hi,
> 
> This small patch adds a config/preference to allow redirection to ticket 
> display on Quick ticket creation, instead of back to RT at a glance.

Hiya Ivan,

Thanks for the patch.  With some tweaks, I'd be happy to have this in 
3.9. My first round notes are inline:

> --- share/html/index.html	31 Dec 2009 13:14:14 -0000	1.1.1.1
> +++ share/html/index.html	10 Nov 2010 23:00:16 -0000
> @@ -115,7 +115,11 @@
>                          From => $session{'CurrentUser'}->EmailAddress,
>                          Content => $ARGS{'Content'},
>                          Subject => $ARGS{'Subject'});
> -        push @results, $msg;
> +        if ( $t && $t->Id && RT->Config->Get('QuickCreateDisplay', $session{'CurrentUser'}) ) {
> +          RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Ticket/Display.html?id=". $t->Id);

We've actually got a usefully newly generalized bit in 3.9: 
    /Elements/MaybeRedirectForResults  

It encapsulates the logic of following up a POST with a redirect to a
GET with the right stuff in the @results hash.


> +        } else {
> +          push @results, $msg;
> +        }
>      }
>      elsif ( !$ValidCFs ) {
>          push @results, "can't quickly create ticket in queue " .
> Index: lib/RT/Config.pm
> ===================================================================
> RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Config.pm,v
> retrieving revision 1.5
> diff -u -r1.5 Config.pm
> --- lib/RT/Config.pm	6 Jun 2010 04:22:40 -0000	1.5
> +++ lib/RT/Config.pm	10 Nov 2010 23:00:16 -0000
> @@ -313,6 +313,16 @@
>              Hints => 'Use css rules to display text monospaced and with formatting preserved, but wrap as needed.  This does not work well with IE6 and you should use the previous option', #loc
>          },
>      },
> +    QuickCreateDisplay => {

Maybe DisplayAfterQuickCreate, as it's a bit more descriptive.


> +        Section         => 'Ticket display',
> +        Overridable     => 1,
> +        SortOrder       => 6,
> +        Widget          => '/Widgets/Form/Boolean',
> +        WidgetArguments => {
> +            Description => 'On Quick Create, redirect to ticket display', #loc
> +            #Hints => '', #loc
> +        },
> +    },
>  
>      # User overridable locale options
>      DateTimeFormat => {



More information about the rt-devel mailing list