From ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 2 Aug 2007 19:56:20 +0000 Subject: import rt 3.6.4 --- rt/html/Search/Build.html | 313 +++++++-------- rt/html/Search/Bulk.html | 482 ++++++++++++++--------- rt/html/Search/Chart | 148 +++++++ rt/html/Search/Chart.html | 73 ++++ rt/html/Search/Edit.html | 12 +- rt/html/Search/Elements/BuildFormatString | 27 +- rt/html/Search/Elements/Chart | 139 +++++++ rt/html/Search/Elements/DisplayOptions | 71 +++- rt/html/Search/Elements/EditFormat | 30 +- rt/html/Search/Elements/EditQuery | 24 +- rt/html/Search/Elements/EditSearches | 57 ++- rt/html/Search/Elements/NewListActions | 14 +- rt/html/Search/Elements/PickBasics | 65 ++- rt/html/Search/Elements/PickCFs | 6 +- rt/html/Search/Elements/PickCriteria | 20 +- rt/html/Search/Elements/SearchPrivacy | 6 +- rt/html/Search/Elements/SearchesForObject | 65 +++ rt/html/Search/Elements/SelectAndOr | 10 +- rt/html/Search/Elements/SelectChartType | 56 +++ rt/html/Search/Elements/SelectGroup | 14 +- rt/html/Search/Elements/SelectGroupBy | 63 +++ rt/html/Search/Elements/SelectLinks | 12 +- rt/html/Search/Elements/SelectPersonType | 16 +- rt/html/Search/Elements/SelectSearchObject | 6 +- rt/html/Search/Elements/SelectSearchesForObjects | 11 +- rt/html/Search/Results.html | 89 +++-- rt/html/Search/Results.rdf | 8 +- rt/html/Search/Results.tsv | 109 ++--- rt/html/Search/Simple.html | 93 +++++ 29 files changed, 1447 insertions(+), 592 deletions(-) create mode 100644 rt/html/Search/Chart create mode 100644 rt/html/Search/Chart.html create mode 100644 rt/html/Search/Elements/Chart create mode 100644 rt/html/Search/Elements/SearchesForObject create mode 100644 rt/html/Search/Elements/SelectChartType create mode 100644 rt/html/Search/Elements/SelectGroupBy create mode 100644 rt/html/Search/Simple.html (limited to 'rt/html/Search') diff --git a/rt/html/Search/Build.html b/rt/html/Search/Build.html index 5a66e02c9..ba5f7a1dd 100644 --- a/rt/html/Search/Build.html +++ b/rt/html/Search/Build.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -74,15 +76,15 @@ Rows => $RowsPerPage &> -
- - - - + + + + +
@@ -101,19 +104,15 @@ - - - -
<& Elements/PickCriteria, query => $Query, cfqueues => $queues &> -<& /Elements/Submit, Caption => loc('Add additional criteria'), Label => loc('Add'), Name => 'AddClause'&> +<& /Elements/Submit, Caption => loc('Add these terms to your search'), Label => loc('Add'), Name => 'AddClause'&> @@ -91,6 +93,7 @@ actions => \@actions, optionlist => $optionlist, Description => $Description &> +<& /Elements/Submit, Label => loc('Add and Search'), Name => 'DoSearch'&>
+ <& Elements/DisplayOptions, %ARGS, Format=> $Format, AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy, Order => $Order &> -
-<& /Elements/Submit, Caption => loc("Do the Search"), Label => loc('Search'), Name => 'DoSearch'&> +<& /Elements/Submit, Label => loc('Add and Search'), Name => 'DoSearch'&>
-
+ <%INIT> use RT::Interface::Web::QueryBuilder; @@ -134,7 +133,7 @@ if ( $NewQuery or $ARGS{'Delete'} ) { $SearchId = ''; $Order = ''; $OrderBy = ''; - $RowsPerPage = ''; + $RowsPerPage = undef; # ($search hasn't been set yet; no need to clear) @@ -147,22 +146,43 @@ if ( $NewQuery or $ARGS{'Delete'} ) { # }}} +if (ref $OrderBy eq "ARRAY") { + $OrderBy = join("|", @$OrderBy); +} +if (ref $Order eq "ARRAY") { + $Order = join("|", @$Order); +} + # {{{ Attempt to load what we can from the session, set defaults # We don't read or write to the session again until the end $search_hash = $session{'CurrentSearchHash'}; +# Read from user preferences +my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {}; + # These variables are what define a search_hash; this is also # where we give sane defaults. $Query ||= $search_hash->{'Query'}; -$Format ||= $search_hash->{'Format'}; +$Format ||= $search_hash->{'Format'} || $prefs->{'Format'}; $Description ||= $search_hash->{'Description'}; $SearchId ||= $search_hash->{'SearchId'} || 'new'; -$Order ||= $search_hash->{'Order'} || 'ASC'; -$OrderBy ||= $search_hash->{'OrderBy'} || 'id'; -$RowsPerPage = ( $search_hash->{'RowsPerPage'} || 50 ) - unless defined($RowsPerPage); -$search ||= $search_hash->{'Object'}; +$Order ||= $search_hash->{'Order'} || $prefs->{'Order'} || 'ASC'; +$OrderBy ||= $search_hash->{'OrderBy'} || $prefs->{'OrderBy'} || 'id'; + +unless ( defined $RowsPerPage ) { + if ( defined $search_hash->{'RowsPerPage'} ) { + $RowsPerPage = $search_hash->{'RowsPerPage'}; + } + elsif ( defined $prefs->{'RowsPerPage'} ) { + $RowsPerPage = $prefs->{'RowsPerPage'}; + } + else { + $RowsPerPage = 50; + } +} + + $search ||= $search_hash->{'Object'}; # }}} @@ -175,31 +195,14 @@ $Format = $m->comp( '/Elements/ScrubHTML', Content => $Format ) if ($Format); if ( $ARGS{'Delete'} ) { # We set $SearchId to 'new' above already, so peek into the %ARGS - if ( $ARGS{'SearchId'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) { - my $obj_type = $1; - my $obj_id = $2; - my $search_id = $3; - - my $container_object; - if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id ) - { - $container_object = $session{'CurrentUser'}->UserObj; - } - elsif ( $obj_type eq 'RT::Group' ) { - $container_object = RT::Group->new( $session{'CurrentUser'} ); - $container_object->Load($obj_id); - } - - if ( $container_object->id ) { - - # We have the object the entry is an attribute on; delete - # the entry.. - $container_object->Attributes->DeleteEntry( - Name => 'SavedSearch', - id => $search_id + my ($container_object, $search_id) = _parse_saved_search ($ARGS{'SearchId'}); + if ($container_object && $container_object->id) { + # We have the object the entry is an attribute on; delete the + # entry.. + $container_object->Attributes->DeleteEntry( + Name => 'SavedSearch', + id => $search_id ); - } - } } @@ -223,25 +226,8 @@ if ( $ARGS{'Revert'} ) { # {{{ if we're asked to load a search, load it. -if ( $ARGS{'LoadSavedSearch'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) { - my $obj_type = $1; - my $obj_id = $2; - my $search_id = $3; - - # We explicitly list out the available types (user and group) and - # don't trust user input here - if ( ( $obj_type eq 'RT::User' ) - && ( $obj_id == $session{'CurrentUser'}->id ) ) - { - $search = - $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id); - - } - elsif ( $obj_type eq 'RT::Group' ) { - my $group = RT::Group->new( $session{'CurrentUser'} ); - $group->Load($obj_id); - $search = $group->Attributes->WithId($search_id); - } +if ( my ($container_object, $search_id ) = _parse_saved_search ($ARGS{'LoadSavedSearch'})) { + $search = $container_object->Attributes->WithId($search_id); # We have a $search and now; import the others $SearchId = $ARGS{'LoadSavedSearch'}; @@ -255,6 +241,62 @@ if ( $ARGS{'LoadSavedSearch'} =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) { # }}} +# {{{ if we're asked to save the current search, save it +if ( $ARGS{'Save'} ) { + if ( $search && $search->id ) { + # permission check + if ($search->Object->isa('RT::System')) { + unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) { + Abort("No permission to save system-wide searches"); + } + } + + # This search is based on a previously loaded search -- so + # just update the current search object with new values + $search->SetSubValues( + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage, + ); + $search->SetDescription($Description); + + } + elsif ( $SearchId eq 'new' ) { + my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} ); + my ( $ok, $search_msg ) = $saved_search->Save( + Privacy => $ARGS{'Owner'}, + Name => $Description, + SearchParams => { + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage } ); + + if ($ok) { + $search = $session{'CurrentUser'}->UserObj->Attributes->WithId($saved_search->Id); + # Build new SearchId + $SearchId = + ref( $session{'CurrentUser'}->UserObj ) . '-' + . $session{'CurrentUser'}->UserObj->Id + . '-SavedSearch-' + . $search->Id; + } + else { + push @actions, [ loc("Can't find a saved search to work with").': '.loc($search_msg), 0 ]; + } + } + else { + push @actions, [ loc("Can't save this search"), 0 ]; + } + +} + +# }}} + + # {{{ Parse the query use Regexp::Common qw /delimited/; @@ -278,7 +320,7 @@ my $_match = sub { my $ParseQuery = sub { my $string = shift; my $tree = shift; - my @actions = shift; + my $actions = shift; my $want = KEYWORD | PAREN; my $last = undef; @@ -287,9 +329,12 @@ my $ParseQuery = sub { # make a tree root $$tree = RT::Interface::Web::QueryBuilder::Tree->new; my $root = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $$tree ); - my $lastnode = $root; my $parentnode = $root; + # on new searches, we're passed undef but still need to construct the + # RT::Interface::Web::QueryBuilder::Tree. Quiet warning + return unless defined $string; + # get the FIELDS from Tickets_Overlay my $tickets = new RT::Tickets( $session{'CurrentUser'} ); my %FIELDS = %{ $tickets->FIELDS }; @@ -339,13 +384,10 @@ my $ParseQuery = sub { # Error # FIXME: I will only print out the highest $want value my $token = $tokens[ ( ( log $want ) / ( log 2 ) ) ]; - push @actions, + push @$actions, [ - loc( -"current: $current, want $want, Error near ->$val<- expecting a " - . $token - . " in '$string'\n" - ), + loc("Error near ->[_1]<- expecting a [_2] in '[_3]'", + $val, $token, $string ), -1 ]; } @@ -364,13 +406,13 @@ my $ParseQuery = sub { else { $depth--; $parentnode = $parentnode->getParent(); - $lastnode = $parentnode; } $want = KEYWORD | PAREN | AGGREG; } elsif ( $current & AGGREG ) { $ea = $val; + $parentnode->setNodeValue($ea); $want = KEYWORD | PAREN; } elsif ( $current & KEYWORD ) { @@ -400,20 +442,28 @@ my $ParseQuery = sub { $val =~ s!\\(.)!$1!g; my $class; - if ( exists $lcfields{ lc $key } ) { - $key = $lcfields{ lc $key }; - $class = $FIELDS{$key}->[0]; + + my ($key_base, $subkey) = split(/\./,$key,2); + $key_base =~ s/\..*$//; # Strip off .EmailAddress, for example + + if ( exists $lcfields{lc $key_base } ) { + $key = $lcfields{lc $key_base } . (defined $subkey ? '.'.$subkey : ''); + $class = $FIELDS{$key_base}->[0]; + } + elsif ( $key =~ /^C(?:ustom)?F(?:ield)?\.{(.*)}$/i ) { + $class = $FIELDS{'CF'}->[0]; } + if ( $class ne 'INT' ) { $val = "'$val'"; } - push @actions, [ loc("Unknown field: $key"), -1 ] unless $class; + push @$actions, [ loc("Unknown field: $key"), -1 ] unless $class; $want = PAREN | AGGREG; } else { - push @actions, [ loc("I'm lost"), -1 ]; + push @$actions, [ loc("I'm lost"), -1 ]; } if ( $current & VALUE ) { @@ -427,33 +477,40 @@ my $ParseQuery = sub { }; # explicity add a child to it - $lastnode = RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode ); - $lastnode->getParent()->setNodeValue($ea); + RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode ); ( $ea, $key, $op, $value ) = ( "", "", "", "" ); + } $last = $current; } # while - push @actions, [ loc("Incomplete query"), -1 ] + push @$actions, [ loc("Incomplete query"), -1 ] unless ( ( $want | PAREN ) || ( $want | KEYWORD ) ); - push @actions, [ loc("Incomplete Query"), -1 ] + push @$actions, [ loc("Incomplete Query"), -1 ] unless ( $last && ( $last | PAREN ) || ( $last || VALUE ) ); # This will never happen, because the parser will complain - push @actions, [ loc("Mismatched parentheses"), -1 ] + push @$actions, [ loc("Mismatched parentheses"), -1 ] unless $depth == 1; }; my $tree; -$ParseQuery->( $Query, \$tree, \@actions ); - -# if parsing went poorly, send them to the edit page to fix it -if ( $actions[0] ) { - $m->comp( "Edit.html", Query => $Query, actions => \@actions ); - $m->abort(); +{ + my @parsing_errors; + $ParseQuery->( $Query, \$tree, \@parsing_errors ); + + # if parsing went poorly, send them to the edit page + # to fix it + if ( @parsing_errors ) { + return $m->comp( + "Edit.html", + Query => $Query, + actions => \@parsing_errors + ); + } } $Query = ""; @@ -583,7 +640,7 @@ elsif ( $ARGS{"Toggle"} ) { # {{{ Try to find if we're adding a clause foreach my $arg ( keys %ARGS ) { if ( - $arg =~ m/^ValueOf(.+)/ + $arg =~ m/^ValueOf(\w+|'CF.{.*?}')$/ && ( ref $ARGS{$arg} eq "ARRAY" ? grep { $_ ne "" } @{ $ARGS{$arg} } : $ARGS{$arg} ne "" ) @@ -695,77 +752,6 @@ my ( $AvailableColumns, $CurrentFormat ); # }}} -# {{{ if we're asked to save the current search, save it -if ( $ARGS{'Save'} ) { - - if ( $search && $search->id ) { - - # This search is based on a previously loaded search -- so - # just update the current search object with new values - $search->SetSubValues( - Format => $Format, - Query => $Query, - Order => $Order, - OrderBy => $OrderBy, - RowsPerPage => $RowsPerPage, - ); - $search->SetDescription($Description); - - } - elsif ( $SearchId eq 'new' && $ARGS{'Owner'} =~ /^(.*?)-(\d+)$/ ) { - - # We're saving a new search - my $obj_type = $1; - my $obj_id = $2; - - # Find out if we're saving on the user, or a group - my $container_object; - if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id ) - { - $container_object = $session{'CurrentUser'}->UserObj; - } - elsif ( $obj_type eq 'RT::Group' ) { - $container_object = RT::Group->new( $session{'CurrentUser'} ); - $container_object->Load($obj_id); - } - - if ( $container_object->id ) { - - # If we got one or the other, add the saerch - my ( $search_id, $search_msg ) = $container_object->AddAttribute( - Name => 'SavedSearch', - Description => $Description, - Content => { - Format => $Format, - Query => $Query, - Order => $Order, - OrderBy => $OrderBy, - RowsPerPage => $RowsPerPage, - } - ); - $search = - $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id); - - # Build new SearchId - $SearchId = - ref( $session{'CurrentUser'}->UserObj ) . '-' - . $session{'CurrentUser'}->UserObj->Id - . '-SavedSearch-' - . $search->Id; - } - unless ( $search->id ) { - push @actions, [ loc("Can't find a saved search to work with"), 0 ]; - } - - } - else { - push @actions, [ loc("Can't save this search"), 0 ]; - } - -} - -# }}} - # {{{ If we're modifying an old query, check if it has changed my $dirty = 0; $dirty = 1 @@ -793,7 +779,7 @@ $session{'CurrentSearchHash'} = $search_hash; # }}} # {{{ Show the results, if we were asked. -if ( $ARGS{"DoSearch"} ) { +if ( $ARGS{"DoSearch"}) { $m->comp( "Results.html", Query => $Query, @@ -802,6 +788,7 @@ if ( $ARGS{"DoSearch"} ) { OrderBy => $OrderBy, Rows => $RowsPerPage ); + $m->comp('/Elements/Footer'); $m->abort(); } diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index f9eef26b6..9742df5ae 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,185 +45,220 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/Header, Title => loc("Bulk ticket update") &> -<& /Elements/Tabs, Title => loc("Bulk ticket update") &> +<& /Elements/Header, Title => $title &> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Bulk.html", + Title => $title, + Format => $ARGS{'Format'}, # we don't want the locally modified one + Query => $Query, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order &> <& /Elements/ListActions, actions => \@results &> -
- - - - -%foreach my $col (@cols) { -% my $colalias = $col; -% $colalias =~ s/(Obj\-\>|)(Name|AsString)//; - - + +% foreach my $var qw(Query Format OrderBy Order Rows Page) { + %} - - -<%PERL> - -my $i; - -$Tickets->RedoSearch(); -while (my $Ticket = $Tickets->Next) { - $i++; - if ($i % 2) { - $bgcolor = "#dddddd"; - } - else { - $bgcolor = "#ffffff"; - } - - - -%foreach my $col (@cols) { - -%} - -%} - - - -
<&|/l&>Update<% loc($colalias) %> 
-% if ($col eq 'id') { -<%$Ticket->Id()%> -% } -%else { -<% eval "\$Ticket->$col()" %>  -%} -
- -
- - -<& /Elements/TitleBoxStart, title => loc('Update selected tickets') &> - - -
+<& /Elements/TicketList, Query => $Query, + DisplayFormat => $Format, + Format => $ARGS{'Format'}, + Verbatim => 1, + AllowSorting => 1, + OrderBy => $OrderBy, + Order => $Order, + Rows => $Rows, + Page => $Page, + BaseURL => $RT::WebPath."/Search/Bulk.html?" + &> + +
+ +<& /Elements/Submit, Label => loc('Update'), CheckAll => 1, ClearAll => 1 &> +
+<&|/Widgets/TitleBox, title => $title &> + + + - + - + +
- - - - - - - - - - - - - - + + + + + + + + + + + + + +
<&|/l&>Make Owner: <& /Elements/SelectOwner, Name => "Owner" &> ( <&|/l&>Force change)
<&|/l&>Add Requestor:
<&|/l&>Remove Requestor:
<&|/l&>Add Cc:
<&|/l&>Remove Cc:
<&|/l&>Add AdminCc:
<&|/l&>Remove AdminCc:
<&|/l&>Make Owner: <& /Elements/SelectOwner, Name => "Owner" &> ( <&|/l&>Force change)
<&|/l&>Add Requestor:
<&|/l&>Remove Requestor:
<&|/l&>Add Cc:
<&|/l&>Remove Cc:
<&|/l&>Add AdminCc:
<&|/l&>Remove AdminCc:
-
+ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
<&|/l&>Make subject:
<&|/l&>Make priority:
<&|/l&>Make queue: <& /Elements/SelectQueue, Name => "Queue" &>
<&|/l&>Make Status: <& /Elements/SelectStatus, Name => "Status" &>
<&|/l&>Make date Starts: <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Started: <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Told: <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Due: <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Resolved: <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make subject:
<&|/l&>Make priority:
<&|/l&>Make queue: <& /Elements/SelectQueue, Name => "Queue" &>
<&|/l&>Make Status: <& /Elements/SelectStatus, Name => "Status" &>
<&|/l&>Make date Starts: <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Started: <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Told: <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Due: <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &>
<&|/l&>Make date Resolved: <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &>
-
-<& /Elements/TitleBoxEnd&> -<& /Elements/TitleBoxStart, title => loc('Add comments or replies to selected tickets') &> + +<&| /Widgets/TitleBox, title => loc('Add comments or replies to selected tickets') &> - + - + % while (my $CF = $TxnCFs->Next()) { - - - + + - + &><% $CF->FriendlyType %> + % } # end if while - - +
<&|/l&>Update Type:
<&|/l&>Update Type:
<&|/l&>Subject:
<&|/l&>Subject:
<% $CF->Name %>:<& /Elements/EditCustomField, +
<% $CF->Name %>:<& /Elements/EditCustomField, CustomField => $CF, NamePrefix => "Object-RT::Transaction--CustomField-" - &><% $CF->FriendlyType %>
<&|/l&>Attach:
<&|/l&>Message: +
<&|/l&>Attach:
<&|/l&>Message: <& /Elements/MessageBox, Name=>"UpdateContent"&>
-<& /Elements/TitleBoxEnd &> - + +<&|/Widgets/TitleBox, title => loc('Edit Custom Fields'), color => "#336633"&> +<%perl> +my $cfs = RT::CustomFields->new($session{'CurrentUser'}); +$cfs->LimitToGlobal(); +$cfs->LimitToQueue($_) for keys %$seen_queues; + + + + + + + +% while (my $cf = $cfs->Next()) { + + +% my $rows = 5; +% my @add = (NamePrefix => 'Bulk-Add-CustomField-', CustomField => $cf, Rows => $rows, Multiple => ($cf->MaxValues ==1 ? 0 : 1) , Cols => 25); +% my @del = (NamePrefix => 'Bulk-Delete-CustomField-', CustomField => $cf, Rows => $rows, Multiple => 1, Cols => 25); +% if ($cf->Type eq 'Select') { + + +% } elsif ($cf->Type eq 'Combobox') { + + +% } elsif ($cf->Type eq 'Freeform') { + + +% } elsif ($cf->Type eq 'Text') { + + +% } else { +% $RT::Logger->crit("Unknown CustomField type: " . $cf->Type); +% } + +% } +
<&|/l&>Name<&|/l&>Add values<&|/l&>Delete values
<%$cf->Name%>
+(<%$cf->FriendlyType%>)
<& /Elements/EditCustomFieldSelect, @add &><& /Elements/EditCustomFieldSelect, @del &><& /Elements/EditCustomFieldCombobox, @add &><& /Elements/EditCustomFieldCombobox, @del &><& /Elements/EditCustomFieldFreeform, @add &><& /Elements/EditCustomFieldFreeform, @del &><& /Elements/EditCustomFieldText, @add &> 
+ -<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> -<&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.
+<&|/Widgets/TitleBox, title => loc('Edit Links'), color => "#336633"&> +<&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.
<& /Ticket/Elements/BulkLinks &> -<& /Elements/TitleBoxEnd &> + + +<& /Elements/Submit, Label => loc('Update') &> + -<& /Elements/Submit, Label => loc('Update All') &> + - <%INIT> +my $title = loc("Update multiple tickets"); # Iterate through the ARGS hash and remove anything with a null value. -map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); - -my ($bgcolor, @results); -my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString ); - - -my $Tickets = RT::Tickets->new($session{'CurrentUser'}); -$Tickets->FromSQL($ARGS{'Query'}); - -Abort(loc("No search to operate on.")) unless ($Tickets); - -my %allcfs; -my %cfqnames; -my %cfqs; -my $count = 0; -while (my $Ticket = $Tickets->Next) { - my $cfq = $Ticket->QueueObj; - my $cfqid = $cfq->Id; - my $cfqn = $cfq->Name; - unless ( exists $cfqs{$cfqid} ) { - $cfqs{$cfqid} = 1; - $count++; - my $cfs = $cfq->TicketCustomFields; - while (my $cf = $cfs->Next) { - $allcfs{$cf->Id} = $cf; - $cfqnames{$cf->Id} = $cfqn; - } +map ( $ARGS{$_} =~ /^$/ && ( delete $ARGS{$_} ), keys %ARGS ); + +my (@results); + +$Page ||= 1; + +$Format ||= $RT::DefaultSearchResultFormat; + +# inject _CHECKBOX to the first field. +$Format =~ s/'?([^']+)'?,/'___CHECKBOX__$1',/; + +my $Tickets = RT::Tickets->new( $session{'CurrentUser'} ); +$Tickets->FromSQL($Query); +if ( $OrderBy =~ /\|/ ) { + + # Multiple Sorts + my @OrderBy = split /\|/, $OrderBy; + my @Order = split /\|/, $Order; + $Tickets->OrderByCols( + map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } + ( 0 .. $#OrderBy ) ); +} +else { + $Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order ); +} + +$Tickets->RowsPerPage($Rows) if ($Rows); +$Tickets->GotoPage( $Page - 1 ); # SB uses page 0 as the first page + +Abort( loc("No search to operate on.") ) unless ($Tickets); + +# build up a list of all custom fields for tickets that we're displaying, so +# we can display sane edit widgets. + +my $fields = {}; +my $seen_queues = {}; +while ( my $ticket = $Tickets->Next ) { + next if $seen_queues->{ $ticket->Queue }++; + + my $custom_fields = $ticket->QueueObj->TicketCustomFields; + while ( my $field = $custom_fields->Next ) { + $fields->{ $field->id } = $field; } } -my $do_comment_reply=0; +my $do_comment_reply = 0; + # Prepare for ticket updates -$ARGS{'UpdateContent'} =~ s/\r\n/\n/g; -chomp ($ARGS{'UpdateContent'}) ; - -if ($ARGS{'UpdateContent'} && - $ARGS{'UpdateContent'} ne '' && - $ARGS{'UpdateContent'} ne "-- \n" . - $session{'CurrentUser'}->UserObj->Signature) { - $do_comment_reply=1; +if ($ARGS{'UpdateContent'}) { + $ARGS{'UpdateContent'} =~ s/\r\n/\n/g; + chomp( $ARGS{'UpdateContent'} ); + + if ($ARGS{'UpdateContent'} ne '' + && $ARGS{'UpdateContent'} ne "-- \n" + . $session{'CurrentUser'}->UserObj->Signature ) { + $do_comment_reply = 1; + } } #Iterate through each ticket we've been handed @@ -229,50 +266,131 @@ my @linkresults; my %queues; $Tickets->RedoSearch(); -while (my $Ticket = $Tickets->Next) { - $queues{$Ticket->QueueObj->Id}++; - $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); - next unless ($ARGS{"UpdateTicket".$Ticket->Id}); - $RT::Logger->debug ("Matched\n"); - my @updateresults; + +# pull out the labels for any custom fields we want to update + +my $cf_del_keys; +@$cf_del_keys = grep { /^Bulk-Delete-CustomField/ } keys %ARGS; +my $cf_add_keys; +@$cf_add_keys = grep { /^Bulk-Add-CustomField/ } keys %ARGS; + + +while ( my $Ticket = $Tickets->Next ) { + next unless ( $ARGS{ "UpdateTicket" . $Ticket->Id } ); + + #Update the links + $ARGS{'id'} = $Ticket->id; + $queues{ $Ticket->QueueObj->Id }++; + + my @updateresults; if ($do_comment_reply) { - ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); + ProcessUpdateMessage( + TicketObj => $Ticket, + ARGSRef => \%ARGS, + Actions => \@updateresults + ); } #Update the basics. - my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS); - my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS); + my @basicresults = + ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS ); + my @dateresults = + ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS ); + #Update the watchers - my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); + my @watchresults = + ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS ); + foreach my $type qw(MergeInto DependsOn MemberOf RefersTo) { + $ARGS{ $Ticket->id . "-" . $type } = $ARGS{"Ticket-$type"}; + $ARGS{ $type . "-" . $Ticket->id } = $ARGS{"$type-Ticket"}; + } + @linkresults = + ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS ); + foreach my $type qw(MergeInto DependsOn MemberOf RefersTo) { + delete $ARGS{ $type . "-" . $Ticket->id }; + delete $ARGS{ $Ticket->id . "-" . $type }; + } - #Update the links - $ARGS{'id'} = $Ticket; - $ARGS{$Ticket->Id.'-MergeInto'} = $ARGS{'Ticket-MergeInto'}; - $ARGS{$Ticket->Id.'-DependsOn'} = $ARGS{'Ticket-DependsOn'}; - $ARGS{'DependsOn-'.$Ticket->Id} = $ARGS{'DependsOn-Ticket'}; - $ARGS{$Ticket->Id.'-MemberOf'} = $ARGS{'Ticket-MemberOf'}; - $ARGS{'MemberOf-'.$Ticket->Id} = $ARGS{'MemberOf-Ticket'}; - $ARGS{$Ticket->Id.'-RefersTo'} = $ARGS{'Ticket-RefersTo'}; - $ARGS{'RefersTo-'.$Ticket->Id} = $ARGS{'RefersTo-Ticket'}; - @linkresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); - delete $ARGS{'id'}; - delete $ARGS{$Ticket->Id.'-MergeInto'}; - delete $ARGS{$Ticket->Id.'-DependsOn'}; - delete $ARGS{'DependsOn-'.$Ticket->Id}; - delete $ARGS{$Ticket->Id.'-MemberOf'}; - delete $ARGS{'MemberOf-'.$Ticket->Id}; - delete $ARGS{$Ticket->Id.'-RefersTo'}; - delete $ARGS{'RefersTo-'.$Ticket->Id}; - my @tempresults = (@watchresults, @basicresults, @dateresults, - @updateresults, @linkresults); - @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; - - @results = (@results, @tempresults); + my @cfresults; + + foreach my $list ( $cf_add_keys, $cf_del_keys ) { + next unless $list->[0]; + + + my $op; + if ( $list->[0] =~ /Add/ ) { + $op = 'add'; + + } + elsif ( $list->[0] =~ /Del/ ) { + $op = 'del'; + } + else { + $RT::Logger->crit( + "Got an op that was neither add nor delete. can never happen" + . $list->[0] ); + last; + } + + foreach my $key (@$list) { + my ( $cfid, $cf ); + if ( $key =~ /CustomField-(\d+)-/ ) { + $cfid = $1; + $cf = RT::CustomField->new( $session{'CurrentUser'} ); + $cf->Load($cfid); + } + else {next} + my @values = + ref( $ARGS{$key} ) eq 'ARRAY' + ? @{ $ARGS{$key} } + : ( $ARGS{$key} ); + map { s/(\r\n|\r)/\n/g; } @values; # fix the newlines + # now break the multiline values into multivalues + @values = map { split( /\n/, $_ ) } @values + unless ( $cf->SingleValue ); + + my $current_values = $Ticket->CustomFieldValues($cfid); + foreach my $value (@values) { + if ( $op eq 'del' && $current_values->HasEntry($value) ) { + my ( $id, $msg ) = $Ticket->DeleteCustomFieldValue( + Field => $cfid, + Value => $value + ); + push @cfresults, $msg; + } + + elsif ( $op eq 'add' && !$current_values->HasEntry($value) ) { + my ( $id, $msg ) = $Ticket->AddCustomFieldValue( + Field => $cfid, + Value => $value + ); + push @cfresults, $msg; + } + } + } + } + my @tempresults = ( + @watchresults, @basicresults, @dateresults, + @updateresults, @linkresults, @cfresults + ); + + @tempresults = + map { loc( "Ticket [_1]: [_2]", $Ticket->Id, $_ ) } @tempresults; + + @results = ( @results, @tempresults ); } -my $TxnCFs = RT::CustomFields->new($session{CurrentUser}); -$TxnCFs->LimitToLookupType("RT::Queue-RT::Ticket-RT::Transaction"); -$TxnCFs->LimitToGlobalOrObjectId(sort keys %queues); +my $TxnCFs = RT::CustomFields->new( $session{CurrentUser} ); +$TxnCFs->LimitToLookupType( RT::Transaction->CustomFieldLookupType ); +$TxnCFs->LimitToGlobalOrObjectId( sort keys %queues ); +<%args> +$Format => undef +$Page => 1 +$Rows => undef +$Order => 'ASC' +$OrderBy => 'id' +$Query => undef + diff --git a/rt/html/Search/Chart b/rt/html/Search/Chart new file mode 100644 index 000000000..ea52bb1f9 --- /dev/null +++ b/rt/html/Search/Chart @@ -0,0 +1,148 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Query => "id > 0" +$PrimaryGroupBy => 'Queue' +$SecondaryGroupBy => undef +$ChartStyle => 'bars' + +<%init> +my @keys; +my @values; +my $chart_class; +use GD; +use GD::Text; + +if ($ChartStyle eq 'pie') { + require GD::Graph::pie; + $chart_class = "GD::Graph::pie"; +} else { + require GD::Graph::bars; + $chart_class = "GD::Graph::bars"; +} + +use RT::Report::Tickets; +my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} ); +$tix->FromSQL( $Query ); +my $count_name = $tix->Column( FUNCTION => 'COUNT', FIELD => 'id' ); +$tix->GroupBy( FIELD => $PrimaryGroupBy ); +my $value_name = $tix->Column( FIELD => $PrimaryGroupBy ); + +my $chart = $chart_class->new( 600 => 400 ); +if ($chart_class eq "GD::Graph::bars") { + $chart->set( + x_label => $tix->Label( $PrimaryGroupBy ), + x_labels_vertical => 1, + y_label => 'Tickets', + show_values => 1 + ); + $chart->set_legend_font( ['verdana', 'arial', gdMediumBoldFont], 12); +} + +my %class = ( + Queue => 'RT::Queue', + Owner => 'RT::User', +); +my $class = $class{ $PrimaryGroupBy }; + +while ( my $entry = $tix->Next ) { + if ( $class ) { + my $q = $class->new( $session{'CurrentUser'} ); + $q->Load( $entry->__Value( $value_name ) ); + push @keys, $q->Name; + } + else { + push @keys, $entry->__Value($value_name); + } + + $keys[-1] ||= loc('(no value)'); + if ($chart_class eq 'GD::Graph::pie') { + $keys[-1] .= " - ". $entry->__Value( $count_name ); + } + push @values, $entry->__Value($count_name); +} + +# XXX: Convert 1970-01-01 date to the 'Not Set' +# this code should be generalized!!! +if ( $PrimaryGroupBy =~ /(Daily|Monthly|Annually)$/ ) { + my $re; + $re = qr{1970-01-01} if $PrimaryGroupBy =~ /Daily$/; + $re = qr{1970-01} if $PrimaryGroupBy =~ /Monthly$/; + $re = qr{1970} if $PrimaryGroupBy =~ /Annually$/; + foreach (@keys) { + s/^$re/loc('Not Set')/e; + } +} + +unless (@keys && @values) { + @keys = (''); + @values = (0); +} + +my %data; +foreach my $key (@keys) { $data{$key} = shift @values; } +my @sorted_keys = sort @keys; +my @sorted_values = map { $data{$_}} @sorted_keys; + + + +my $plot = $chart->plot( [ [@sorted_keys], [@sorted_values] ] ) or die $chart->error; + +if ( $plot->can('png') ) { + $r->content_type('image/png'); + $m->out( $plot->png ); +} +elsif ( $plot->can('gif') ) { + $r->content_type('image/gif'); + $m->out( $plot->gif ); +} +else { + die "Your GD library appears to support neither PNG nor GIF"; +} +$m->abort(); + diff --git a/rt/html/Search/Chart.html b/rt/html/Search/Chart.html new file mode 100644 index 000000000..a07d89502 --- /dev/null +++ b/rt/html/Search/Chart.html @@ -0,0 +1,73 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Query => "id > 0" +$PrimaryGroupBy => 'Queue' +$SecondaryGroupBy => '' +$ChartStyle => 'bars' +$Description => undef + +<%init> +$ARGS{SecondaryGroupBy} ||= ''; + +my $title = loc( "Search results grouped by [_1]", $PrimaryGroupBy ); + +my $saved_search = $m->comp( '/Widgets/SavedSearch:new', + SearchType => 'Chart', + SearchFields => [qw(Query PrimaryGroupBy SecondaryGroupBy ChartStyle)] ); + +my @actions = $m->comp( '/Widgets/SavedSearch:process', args => \%ARGS, self => $saved_search ); + + +<& /Elements/Header, Title => $title &> +<& /Ticket/Elements/Tabs, Title => $title &> +<& /Elements/ListActions, actions => \@actions &> +<& /Search/Elements/Chart, %ARGS &> + + +<& /Widgets/SavedSearch:show, %ARGS, Action => 'Chart.html', self => $saved_search, Title => 'Saved charts' &> diff --git a/rt/html/Search/Edit.html b/rt/html/Search/Edit.html index 16e8a0e71..21df0db97 100755 --- a/rt/html/Search/Edit.html +++ b/rt/html/Search/Edit.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -56,11 +58,11 @@ <& Elements/NewListActions, actions => \@actions &>
- + -
+
-
+
<& /Elements/Submit, Label => loc("Apply"), Reset => 1, Caption => loc("Apply your changes")&>
diff --git a/rt/html/Search/Elements/BuildFormatString b/rt/html/Search/Elements/BuildFormatString index cffb81a48..3bd39b5c2 100644 --- a/rt/html/Search/Elements/BuildFormatString +++ b/rt/html/Search/Elements/BuildFormatString @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -171,12 +173,12 @@ elsif ( $AddCol ) { $column{Column} = $col; if ( $Face eq "Bold" ) { - $column{Prefix} .= ""; - $column{Suffix} .= ""; + $column{Prefix} .= ""; + $column{Suffix} .= ""; } if ( $Face eq "Italic" ) { - $column{Prefix} .= ""; - $column{Suffix} .= ""; + $column{Prefix} .= ""; + $column{Suffix} .= ""; } if ($Size) { $column{Prefix} .= "<" . $m->interp->apply_escapes( $Size, 'h' ) . ">"; @@ -184,11 +186,11 @@ elsif ( $AddCol ) { } if ( $Link eq "Display" ) { $column{Prefix} .= - ""; + ""; $column{Suffix} .= ""; } elsif ( $Link eq "Take" ) { - $column{Prefix} .= ""; $column{Suffix} .= ""; } @@ -223,10 +225,13 @@ elsif ( $ColDown ) { my @format_string; foreach my $field (@seen) { next unless $field; - my $row = "'" . $field->{Prefix}; - $row .= "__" . $m->interp->apply_escapes( $field->{Column}, 'h' ) . "__" + my $row = "'"; + $row .= $field->{Prefix} if $field->{Prefix}; + $row .= "__" . ($field->{Column} =~ m/\(/ ? $field->{Column} # func, don't escape + : $m->interp->apply_escapes( $field->{Column}, 'h' )) . "__" unless ( $field->{Column} eq "" ); - $row .= $field->{Suffix} . "'"; + $row .= $field->{Suffix} if $field->{Suffix}; + $row .= "'"; push( @format_string, $row ); } diff --git a/rt/html/Search/Elements/Chart b/rt/html/Search/Elements/Chart new file mode 100644 index 000000000..2eca6afda --- /dev/null +++ b/rt/html/Search/Elements/Chart @@ -0,0 +1,139 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Query => "id > 0" +$PrimaryGroupBy => 'Queue' +$SecondaryGroupBy => undef +$ChartStyle => 'bars' + +<%init> +use RT::Report::Tickets; +my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} ); +$tix->FromSQL( $Query ); +my $count_name = $tix->Column( FUNCTION => 'COUNT', FIELD => 'id' ); +$tix->GroupBy( FIELD => $PrimaryGroupBy ); +my $value_name = $tix->Column( FIELD => $PrimaryGroupBy ); + +my %class = ( + Queue => 'RT::Queue', + Owner => 'RT::User', +); +my $class = $class{ $PrimaryGroupBy }; + +my (@keys, @values); +while ( my $entry = $tix->Next ) { + if ($class) { + my $q = $class->new( $session{'CurrentUser'} ); + $q->Load( $entry->__Value( $value_name ) ); + push @keys, $q->Name; + } + else { + push @keys, $entry->__Value( $value_name ); + } + $keys[-1] ||= loc('(no value)'); + push @values, $entry->__Value( $count_name ); +} + +# XXX: Convert 1970-01-01 date to the 'Not Set' +# this code should be generalized!!! +if ( $PrimaryGroupBy =~ /(Daily|Monthly|Annually)$/ ) { + my $re; + $re = qr{1970-01-01} if $PrimaryGroupBy =~ /Daily$/; + $re = qr{1970-01} if $PrimaryGroupBy =~ /Monthly$/; + $re = qr{1970} if $PrimaryGroupBy =~ /Annually$/; + foreach (@keys) { + s/^$re/loc('Not Set')/e; + } +} + +my %data; +foreach my $key (@keys) { $data{$key} = shift @values; } +my @sorted_keys = sort @keys; +my @sorted_values = map { $data{$_}} @sorted_keys; + + +my $query_string = $m->comp('/Elements/QueryString', %ARGS); + + +<% loc('Query:') %> <% $Query %>
+ +
+ + + + + + +% my ($i,$total); +% while (my $key = shift @sorted_keys) { +% $i++; +% my $value = shift @sorted_values; +% $total += $value; + + + + +% } + +%$i++; + + + + + +
<% $tix->Label($PrimaryGroupBy) %> +<&|/l&>Tickets +
+<%$key%> + +<%$value%> +
+<%loc('Total')%> + +<%$total%> +
diff --git a/rt/html/Search/Elements/DisplayOptions b/rt/html/Search/Elements/DisplayOptions index 43a9d9998..4bed0902b 100644 --- a/rt/html/Search/Elements/DisplayOptions +++ b/rt/html/Search/Elements/DisplayOptions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,43 +45,53 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/TitleBoxStart, title => loc("Display Columns") &> +<&| /Widgets/TitleBox, title => loc("Display Columns") &> - - @@ -97,11 +99,11 @@ - - + @@ -177,7 +166,7 @@ TrueVal=> '=', FalseVal => '!=' &> <%INIT> my @people = ('Actor', diff --git a/rt/html/Search/Elements/PickCFs b/rt/html/Search/Elements/PickCFs index 435a07ad3..734f5f871 100644 --- a/rt/html/Search/Elements/PickCFs +++ b/rt/html/Search/Elements/PickCFs @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/Search/Elements/PickCriteria b/rt/html/Search/Elements/PickCriteria index 129344443..58b29fb57 100644 --- a/rt/html/Search/Elements/PickCriteria +++ b/rt/html/Search/Elements/PickCriteria @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,12 +45,12 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/TitleBoxStart, title => loc('Add Criteria')&> -
<& EditFormat, %ARGS &> - + - - -
+ + +% for my $o (0..3) { - + - +
+ +% if ($o == 0) { <&|/l&>Order by: - +% } +
+% } +
<&|/l&>Rows per page: <& /Elements/SelectResultsPerPage, @@ -91,14 +103,34 @@ SELECTED
-<& /Elements/TitleBoxEnd &> + <%INIT> my $tickets = new RT::Tickets($session{'CurrentUser'}); my %fields = %{$tickets->FIELDS}; map { $fields{$_}->[0] =~ /^(?:ENUM|INT|DATE|STRING)$/ || delete $fields{$_} } keys %fields; delete $fields{'EffectiveId'}; +$fields{ $_ . '.EmailAddress' } = 1 foreach( qw(Requestor Cc AdminCc) ); + +# Add all available CustomFields to the list of sortable columns. +my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}}; +$fields{$_}=1 for @cfs; + +# Add PAW sort +$fields{'Custom.Ownership'} = 1; +my @Order; +my @OrderBy; +if ($OrderBy =~ /\|/) { + @OrderBy = split /\|/, $OrderBy; +} else { + @OrderBy = ( $OrderBy ); +} +if ($Order =~ /\|/) { + @Order = split /\|/, $Order; +} else { + @Order = ( $Order ); +} @@ -107,4 +139,5 @@ $Order => undef $OrderBy => undef $RowsPerPage => undef $Format => undef +$GroupBy => 'id' diff --git a/rt/html/Search/Elements/EditFormat b/rt/html/Search/Elements/EditFormat index dc8720f26..fa0ac96e0 100644 --- a/rt/html/Search/Elements/EditFormat +++ b/rt/html/Search/Elements/EditFormat @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -56,7 +58,7 @@ <&|/l&>Show Columns:
+ -
<&|/l&>Title: -
<&|/l&>Size: +
<&|/l&>Title: +
<&|/l&>Size: -
<&|/l&>Style: +
<&|/l&>Style:
- + - + -
+
- - - + + +
+
diff --git a/rt/html/Search/Elements/EditQuery b/rt/html/Search/Elements/EditQuery index 783541a64..5c40c2573 100644 --- a/rt/html/Search/Elements/EditQuery +++ b/rt/html/Search/Elements/EditQuery @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -44,20 +46,20 @@ %# %# END BPS TAGGED BLOCK }}} <& NewListActions, actions => $actions &> -<& /Elements/TitleBoxStart, title => join(': ', grep defined, loc("Query"), $Description) &> +<&|/Widgets/TitleBox, title => join(': ', grep defined, loc("Current search"), $Description) &>

- - - - - - -%# + + + + + + +%#

-<& /Elements/TitleBoxEnd &> + <%ARGS> $Description $optionlist diff --git a/rt/html/Search/Elements/EditSearches b/rt/html/Search/Elements/EditSearches index bc6b80e6f..9ab9f944d 100644 --- a/rt/html/Search/Elements/EditSearches +++ b/rt/html/Search/Elements/EditSearches @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,62 +45,59 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/TitleBoxStart, title => loc('Saved searches') &> +<&| /Widgets/TitleBox, title => loc($Title)&> %# Hide all the save functionality if the user shouldn't see it. % if ($session{'CurrentUser'}->HasRight( Right => 'CreateSavedSearch', % Object=> $RT::System )) { <&|/l&>Privacy: % if ($CurrentSearch->{'Object'} && $CurrentSearch->{'Object'}->id) { -<& SearchPrivacy, Object => $CurrentSearch->{'Object'}->Object &>
+<& SearchPrivacy, Object => $CurrentSearch->{'Object'}->Object &>
% } else { -<& SelectSearchObject, Name => 'Owner', Objects => \@Objects &>
+<& SelectSearchObject, Name => 'Owner', Objects => \@Objects &>
% } <&|/l&>Description:
- + % if ($SearchId ne 'new') { % if ($Dirty) { - + % } - - - - + +% if ($AllowCopy) { + % } + -% if ($Dirty or $SearchId eq 'new') { - % } -
+ +
% } -<&|/l&>Load saved search:
-<& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects&> - -<& /Elements/TitleBoxEnd &> +<&|/l&>Load saved search:
+<& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects, SearchType => $SearchType &> + + <%init> - unless ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', - Object=> $RT::System )) { + Object=> $RT::System )) { return; } -my @Objects; - -push @Objects, $session{CurrentUser}->UserObj; - -my $groups = RT::Groups->new($session{'CurrentUser'}); -$groups->LimitToUserDefinedGroups; -$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id, - Recursively => 1); +use RT::SavedSearches; +my @Objects = RT::SavedSearches->new($session{CurrentUser})->_PrivacyObjects; +push @Objects, RT::System->new($session{'CurrentUser'}) + if $session{'CurrentUser'}->HasRight( Object=> $RT::System, + Right => 'SuperUser'); - push (@Objects, @{$groups->ItemsArrayRef()}); <%ARGS> +$SearchType => 'Ticket' $SearchId => undef $CurrentSearch => undef $Description => undef $HideResults => 0 $Dirty => 0 +$AllowCopy => 1 +$Title => 'Saved searches' diff --git a/rt/html/Search/Elements/NewListActions b/rt/html/Search/Elements/NewListActions index eb82544f3..535ac8cb9 100644 --- a/rt/html/Search/Elements/NewListActions +++ b/rt/html/Search/Elements/NewListActions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -44,19 +46,19 @@ %# %# END BPS TAGGED BLOCK }}} % if ($actions[0] ) { -<%loc('Results')%>
+<%loc('Results')%>
% foreach my $action (@actions) { % next unless ($action); % my @item = @$action; % if ($item[1] < 0) { - + % } - <%$item[0]%>
+ <%$item[0]%>
% if ($item[1] < 0) {
% } % } -
+
% } <%init> @actions = grep (/./,@actions); diff --git a/rt/html/Search/Elements/PickBasics b/rt/html/Search/Elements/PickBasics index 8a48f6b18..44a378c14 100644 --- a/rt/html/Search/Elements/PickBasics +++ b/rt/html/Search/Elements/PickBasics @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -49,11 +51,11 @@
<& /Elements/SelectEqualityOperator, Name => "idOp" &> - +
+
<& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> <& /Elements/SelectBoolean, Name => "AttachmentOp", @@ -63,7 +65,7 @@ FalseVal => 'NOT LIKE' &> - +
- + <& /Elements/SelectBoolean, Name => "ActorOp", TrueVal=> '=', @@ -117,21 +119,7 @@ <& /Elements/SelectMatch, Name => "WatcherOp" &> - -
-<& SelectPersonType, Name => 'WatcherGroupField', Default => 'RequestorGroup', Suffix => 'Group' &> - -<& /Elements/SelectBoolean, Name => "WatcherGroupOp", - True=> loc('belongs to'), - False=> loc('does not belong to'), - TrueVal=> '=', - FalseVal => '!=' -&> - -<& SelectGroup, Name => 'ValueOfWatcherGroup' &> -
@@ -143,28 +131,29 @@
- + <& /Elements/SelectEqualityOperator, Name => "TimeOp" &> - + +<& /Elements/SelectTimeUnits, Name =>'ValueOfTime' &>
- + <& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> - +
- +
+<&| /Widgets/TitleBox, title => loc('Add Criteria')&> +
- -
+ + -
<&|/l&>Aggregator: <& SelectAndOr, Name => "AndOr" &> @@ -61,8 +63,8 @@
- +
+ <& PickBasics &> <& PickCFs, cfqueues => \%cfqueues &>
@@ -71,7 +73,7 @@
 
-<& /Elements/TitleBoxEnd &> + <%ARGS> $addquery => 0 diff --git a/rt/html/Search/Elements/SearchPrivacy b/rt/html/Search/Elements/SearchPrivacy index 270e1baa3..745ba62ac 100644 --- a/rt/html/Search/Elements/SearchPrivacy +++ b/rt/html/Search/Elements/SearchPrivacy @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/Search/Elements/SearchesForObject b/rt/html/Search/Elements/SearchesForObject new file mode 100644 index 000000000..45aa4535e --- /dev/null +++ b/rt/html/Search/Elements/SearchesForObject @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Object => undef + +<%init> +# Returns an array of search objects associated on $Object, +# in the form of [Description, searchObj] +my @result; +while (my $search = $Object->Attributes->Next) { + my $desc; + if ($search->Name eq 'SavedSearch') { + push @result, [$search->Description, $search]; + } + elsif ($search->Name =~ m/^Search - (.*)/) { + push @result, [$1, $search]; + } +} +return @result; + diff --git a/rt/html/Search/Elements/SelectAndOr b/rt/html/Search/Elements/SelectAndOr index 2f3c70477..c8122660a 100644 --- a/rt/html/Search/Elements/SelectAndOr +++ b/rt/html/Search/Elements/SelectAndOr @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,8 +45,8 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<&|/l&>AND -<&|/l&>OR +<&|/l&>AND +<&|/l&>OR <%ARGS> $Name => "Operator" diff --git a/rt/html/Search/Elements/SelectChartType b/rt/html/Search/Elements/SelectChartType new file mode 100644 index 000000000..43a6182bf --- /dev/null +++ b/rt/html/Search/Elements/SelectChartType @@ -0,0 +1,56 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Name => 'ChartType' +$Default => 'bar' + + diff --git a/rt/html/Search/Elements/SelectGroup b/rt/html/Search/Elements/SelectGroup index edd53713f..3f78d3964 100644 --- a/rt/html/Search/Elements/SelectGroup +++ b/rt/html/Search/Elements/SelectGroup @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,14 +45,14 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} - % if ($AllowNull) { - + % } %while (my $group = $groups->Next) { - + %} - + <%INIT> my $groups = new RT::Groups($session{'CurrentUser'}); diff --git a/rt/html/Search/Elements/SelectGroupBy b/rt/html/Search/Elements/SelectGroupBy new file mode 100644 index 000000000..0ffb5e453 --- /dev/null +++ b/rt/html/Search/Elements/SelectGroupBy @@ -0,0 +1,63 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<%args> +$Name => 'GroupBy' +$Default => 'Status' +$Query => '' + + +<%init> +use RT::Report::Tickets; +my $report = RT::Report::Tickets->new( $session{'CurrentUser'} ); +my @options = $report->Groupings( Query => $Query ); + diff --git a/rt/html/Search/Elements/SelectLinks b/rt/html/Search/Elements/SelectLinks index 00ec80bd3..f3586528d 100644 --- a/rt/html/Search/Elements/SelectLinks +++ b/rt/html/Search/Elements/SelectLinks @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,11 +45,11 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} - % foreach (@fields) { - + % } - + <%ARGS> $Name => 'LinksField' diff --git a/rt/html/Search/Elements/SelectPersonType b/rt/html/Search/Elements/SelectPersonType index d4127c97b..bc631dbb0 100644 --- a/rt/html/Search/Elements/SelectPersonType +++ b/rt/html/Search/Elements/SelectPersonType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,20 +45,20 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} - % if ($AllowNull) { - + % } % for my $option (@types) { % if ($Suffix) { - + % next; % } % foreach my $subtype (@subtypes) { - + % } % } - + <%INIT> my @types; diff --git a/rt/html/Search/Elements/SelectSearchObject b/rt/html/Search/Elements/SelectSearchObject index e9df5179f..f52a83372 100644 --- a/rt/html/Search/Elements/SelectSearchObject +++ b/rt/html/Search/Elements/SelectSearchObject @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/Search/Elements/SelectSearchesForObjects b/rt/html/Search/Elements/SelectSearchesForObjects index e6be66a58..dc8368577 100644 --- a/rt/html/Search/Elements/SelectSearchesForObjects +++ b/rt/html/Search/Elements/SelectSearchesForObjects @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -46,6 +48,7 @@ <%args> @Objects => undef $Name => undef +$SearchType => 'Ticket', - - - - - - +% my %hiddens = (Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order, HideResults => $HideResults, Page => $Page ); +
+
+%foreach my $key (keys(%hiddens)) { + +%} <& /Elements/Refresh, Name => 'TicketsRefreshInterval', Default => $session {'tickets_refresh_interval'} &> - +
-
-<&|/l&>Update multiple tickets
-<&|/l&>Bookmarkable link
+
+<&|/l&>Update multiple tickets
+<&|/l&>Bookmarkable link
<&|/l&>spreadsheet | -<&|/l&>RSS | -<&|/l&>Work offline
+<&|/l&>RSS | +<&|/l&>Work offline
+
<&|/l&>chart +% %hiddens = (Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order); +%foreach my $key (keys(%hiddens)) { + +%} +<&|/l, $m->scomp('Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $Query) &>grouped by [_1] +<&|/l, $m->scomp('Elements/SelectChartType', Name => 'ChartStyle') &>style: [_1] + +
<& /Elements/Callback, _CallbackName => 'SearchActions', QueryString => $QueryString&>
<%INIT> +# Read from user preferences +my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {}; + +# These variables are what define a search_hash; this is also +# where we give sane defaults. +$Format ||= $prefs->{'Format'}; +$Order ||= $prefs->{'Order'} || 'ASC'; +$OrderBy ||= $prefs->{'OrderBy'} || 'id'; + +# Some forms pass in "RowsPerPage" rather than "Rows" +# We call it RowsPerPage everywhere else. + +if ( !defined($Rows) ) { + if ( $ARGS{'RowsPerPage'} ) { + $Rows = $ARGS{'RowsPerPage'}; + } elsif ( defined $prefs->{'RowsPerPage'} ) { + $Rows = $prefs->{'RowsPerPage'}; + } else { + $Rows = 50; + } +} + my ($title, $ticketcount); $session{'i'}++; $session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) ; $session{'tickets'}->FromSQL($Query) if ($Query); -$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); +if ($OrderBy =~ /\|/) { + # Multiple Sorts + my @OrderBy = split /\|/,$OrderBy; + my @Order = split /\|/,$Order; + $session{'tickets'}->OrderByCols( + map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } ( 0 + .. $#OrderBy ) );; +} else { + $session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); +} $session{'CurrentSearchHash'} = { Format => $Format, Query => $Query, + Page => $Page, Order => $Order, OrderBy => $OrderBy, RowsPerPage => $Rows }; - if ( $session{'tickets'}->Query()) { $ticketcount = $session{tickets}->CountAll(); $title = loc('Found [quant,_1,ticket]', $ticketcount); @@ -116,13 +156,12 @@ my $QueryString = "?".$m->comp('/Elements/QueryString', OrderBy => $OrderBy, Order => $Order, Page => $Page); - my $ShortQueryString = "?".$m->comp('/Elements/QueryString', Query => $Query); +my $RSSFeedURL = "$RT::WebPath/Search/Results.rdf$ShortQueryString"; if ($ARGS{'TicketsRefreshInterval'}) { $session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'}; } - <%CLEANUP> $session{'tickets'}->PrepForSerialization(); @@ -131,8 +170,8 @@ $session{'tickets'}->PrepForSerialization(); $Query => undef $Format => undef $HideResults => 0 -$Rows => 50 +$Rows => undef $Page => 1 -$OrderBy => 'id' -$Order => 'ASC' +$OrderBy => undef +$Order => undef diff --git a/rt/html/Search/Results.rdf b/rt/html/Search/Results.rdf index 7cc248306..fe97a314c 100644 --- a/rt/html/Search/Results.rdf +++ b/rt/html/Search/Results.rdf @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -47,7 +49,7 @@ my $Tickets = RT::Tickets->new($session{'CurrentUser'}); $Tickets->FromSQL($ARGS{'Query'}); -$r->content_type('application/rdf+xml'); +$r->content_type('application/rss+xml'); diff --git a/rt/html/Search/Results.tsv b/rt/html/Search/Results.tsv index e6b20481f..bb1907317 100644 --- a/rt/html/Search/Results.tsv +++ b/rt/html/Search/Results.tsv @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,45 +45,64 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} +<%ARGS> +$OrderBy => 'id' +$Order => 'ASC' + <%INIT> -my $Tickets = RT::Tickets->new($session{'CurrentUser'}); -$Tickets->FromSQL($ARGS{'Query'}); +my $Tickets = RT::Tickets->new( $session{'CurrentUser'} ); +$Tickets->FromSQL( $ARGS{'Query'} ); +if ( $OrderBy =~ /\|/ ) { + + # Multiple Sorts + my @OrderBy = split /\|/, $OrderBy; + my @Order = split /\|/, $Order; + $Tickets->OrderByCols( + map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } + ( 0 .. $#OrderBy ) ); +} +else { + $Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order ); +} my @rows; my %known_cfs; my @attrs = qw( id QueueObj->Name Subject Status TimeEstimated TimeWorked TimeLeft Priority FinalPriority OwnerObj->Name - Requestors->MemberEmailAddressesAsString DueObj->ISO ToldObj->ISO - CreatedObj->ISO ResolvedObj->ISO ); + Requestors->MemberEmailAddressesAsString Cc->MemberEmailAddressesAsString AdminCc->MemberEmailAddressesAsString + DueObj->ISO ToldObj->ISO CreatedObj->ISO ResolvedObj->ISO LastUpdatedObj->ISO); - $r->content_type('application/vnd.ms-excel'); - while ( my $Ticket = $Tickets->Next()) { - my $row; - foreach my $attr (@attrs) { - my $method = '$Ticket->'.$attr.'()'; - $row->{$attr} = eval $method; +$r->content_type('application/vnd.ms-excel'); +while ( my $Ticket = $Tickets->Next()) { + my $row; + foreach my $attr (@attrs) { + if ($attr =~ /(.*)->ISO$/ and $Ticket->$1->Unix <= 0) { + $row->{$attr} = ""; + } else { + my $method = '$Ticket->'.$attr.'()'; + $row->{$attr} = eval $method; if ($@) {die "Failed to find $attr - ". $@}; - } - - my $cfs = $Ticket->QueueObj->TicketCustomFields(); - while (my $cf = $cfs->Next) { - my @content; - my $values = $Ticket->CustomFieldValues($cf->Id); - while (my $value = $values->Next) { - push @content, $value->Content; - } - $row->{'CustomField-'.$cf->Id} = join(', ',@content); - if ($row->{'CustomField-'.$cf->Id}) { - $known_cfs{$cf->Id} = $cf->Name; - } } - push @rows, $row; - + } + my $cfs = $Ticket->QueueObj->TicketCustomFields(); + while (my $cf = $cfs->Next) { + my @content; + my $values = $Ticket->CustomFieldValues($cf->Id); + while (my $value = $values->Next) { + push @content, $value->Content; + } + $row->{'CustomField-'.$cf->Id} = join(', ',@content); + if ($row->{'CustomField-'.$cf->Id}) { + $known_cfs{$cf->Id} = $cf->Name; + } } + push @rows, $row; +} + { -my @header; + my @header; foreach my $attr (@attrs) { my $label = $attr; $label =~ s'Obj-.(?:AsString|Name|ISO)''g; @@ -89,27 +110,25 @@ my @header; push @header, $label; } foreach my $id (sort keys %known_cfs) { - push @header, $known_cfs{$id}; + push @header, "CF-".$known_cfs{$id}; } - -$m->out(join("\t", @header)); -$m->out("\n"); + $m->out(join("\t", @header)); + $m->out("\n"); } + foreach my $row (@rows) { - my @row; - foreach my $attr(@attrs) { - push @row, $row->{"$attr"}; - } - foreach my $id (sort keys %known_cfs) { - my $val = $row->{'CustomField-'.$id}; - $val =~ s/(\n|\r)//g; - push @row, $val; - } - - $m->out(join("\t",@row)); - $m->out("\n"); + my @row; + foreach my $attr(@attrs) { + push @row, $row->{"$attr"}; + } + foreach my $id (sort keys %known_cfs) { + my $val = $row->{'CustomField-'.$id}; + $val =~ s/(\n|\r)//g; + push @row, $val; + } + $m->out(join("\t",@row)); + $m->out("\n"); } - $m->abort(); diff --git a/rt/html/Search/Simple.html b/rt/html/Search/Simple.html new file mode 100644 index 000000000..cdffc4c46 --- /dev/null +++ b/rt/html/Search/Simple.html @@ -0,0 +1,93 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# +%# +%# (Except where explicitly superseded by other copyright notices) +%# +%# +%# LICENSE: +%# +%# This work is made available to you under the terms of Version 2 of +%# the GNU General Public License. A copy of that license should have +%# been provided with this software, but in any event can be snarfed +%# from www.gnu.org. +%# +%# This work is distributed in the hope that it will be useful, but +%# WITHOUT ANY WARRANTY; without even the implied warranty of +%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%# General Public License for more details. +%# +%# You should have received a copy of the GNU General Public License +%# along with this program; if not, write to the Free Software +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/copyleft/gpl.html. +%# +%# +%# CONTRIBUTION SUBMISSION POLICY: +%# +%# (The following paragraph is not intended to limit the rights granted +%# to you to modify and distribute this software under the terms of +%# the GNU General Public License and is only of importance to you if +%# you choose to contribute your changes and enhancements to the +%# community by submitting them to Best Practical Solutions, LLC.) +%# +%# By intentionally submitting any modifications, corrections or +%# derivatives to this work, or any other work intended for use with +%# Request Tracker, to Best Practical Solutions, LLC, you confirm that +%# you are the copyright holder for those contributions and you grant +%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable, +%# royalty-free, perpetual, license to use, copy, create derivative +%# works based on those contributions, and sublicense and distribute +%# those contributions and any derivatives thereof. +%# +%# END BPS TAGGED BLOCK }}} +<& /Elements/Header, Title => $title &> +<& /Elements/Tabs, + current_toptab => "Search/Simple.html", + Title => $title +&> + +
+
+ +

<&|/l&>Search for tickets. Enter id numbers, queues by name, Owners by username and Requestors by email address. RT will look for anything else you enter in ticket bodies and attachments.

+ +

<&|/l&>Searching the full text of every ticket can take a long time, but if you need to do it, you can search for any word in full ticket history for any word by typing fulltext:word.

+

<&|/l&>RT will look for anything else you enter in ticket subjects.

+ +
+
+
+ +
+
+ +<%INIT> +my $title = loc("Search for tickets"); +use RT::Search::Googleish; + +if ($q) { + my $tickets = new RT::Tickets( $session{'CurrentUser'} ); + + $m->comp('/Elements/Callback', %ARGS, _CallbackName => 'ModifyQuery', query => \$q); + + if ($q =~ /^(\d+)$/) { + RT::Interface::Web::Redirect($RT::WebURL."/Ticket/Display.html?id=".$q); + } + my $search = RT::Search::Googleish->new(Argument => $q, + TicketsObj => $tickets); + + $m->comp( "Results.html", Query => $search->QueryToSQL() ); + $m->comp( "/Elements/Footer" ); + $m->abort(); +} + + +<%ARGS> +$q => undef + + -- cgit v1.2.1