From 945721f48f74d5cfffef7c7cf3a3d6bc2521f5dd Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 15 Jul 2003 13:16:32 +0000 Subject: import of rt 3.0.4 --- rt/html/Search/Bulk.html | 217 +++++++++++++++++++++++++++++++ rt/html/Search/Elements/PickRestriction | 141 ++++++++++++++++++++ rt/html/Search/Elements/TicketHeader | 40 ++++++ rt/html/Search/Elements/TicketHeaderCell | 55 ++++++++ rt/html/Search/Elements/TicketRow | 55 ++++++++ rt/html/Search/Listing.html | 112 ++++++++++++++++ 6 files changed, 620 insertions(+) create mode 100644 rt/html/Search/Bulk.html create mode 100644 rt/html/Search/Elements/PickRestriction create mode 100644 rt/html/Search/Elements/TicketHeader create mode 100644 rt/html/Search/Elements/TicketHeaderCell create mode 100644 rt/html/Search/Elements/TicketRow create mode 100644 rt/html/Search/Listing.html (limited to 'rt/html/Search') diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html new file mode 100644 index 000000000..df43cfa50 --- /dev/null +++ b/rt/html/Search/Bulk.html @@ -0,0 +1,217 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<& /Elements/Header, Title => loc("Bulk ticket update") &> +<& /Elements/Tabs, Title => loc("Bulk ticket update") &> + +<& /Elements/ListActions, actions => \@results &> + +
+ + + +%foreach my $col (@cols) { +% my $colalias = $col; +% $colalias =~ s/(Obj\-\>|)(Name|AsString)//; + + +%} + + +<%PERL> + +my $i; + + + +$session{'tickets'}->RedoSearch(); +while (my $Ticket = $session{'tickets'}->Next) { + $i++; + if ($i % 2) { + $bgcolor = "#dddddd"; + } + else { + $bgcolor = "#ffffff"; + } + + + +%# The ticket view is controlled by config.pm, WebOptions +%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') &> + + + + + +
+ + + + + + + + + + + + + + + +
<&|/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 => '' &>
+ +
+<& /Elements/TitleBoxEnd&> +<& /Elements/TitleBoxStart, title => loc('Add comments or replies to selected tickets') &> + + + + + + +
<&|/l&>Update Type: +
<&|/l&>Subject:
<&|/l&>Attach:
<&|/l&>Message: + <& /Elements/MessageBox, Name=>"UpdateContent"&> +
+<& /Elements/TitleBoxEnd &> + +<& /Elements/TitleBoxStart, title => loc('Edit Relationships'), color => "#336633"&> +<&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.
+<& /Ticket/Elements/BulkLinks &> +<& /Elements/TitleBoxEnd &> + +<& /Elements/Submit &> + + +
+<%INIT> + +# 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 ); + +Abort(loc("No search to operate on.")) unless ($session{'tickets'}); + + +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; +} + +#Iterate through each ticket we've been handed +my @linkresults; + +while (my $Ticket = $session{'tickets'}->Next) { + $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); + next unless ($ARGS{"UpdateTicket".$Ticket->Id}); + $RT::Logger->debug ("Matched\n"); + #Update the basics. + my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS); + my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS); + #Update the watchers + my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); + + #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 @updateresults; + if ($do_comment_reply) { + ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); + } + my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults); + @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; + + @results = (@results, @tempresults); +} + + diff --git a/rt/html/Search/Elements/PickRestriction b/rt/html/Search/Elements/PickRestriction new file mode 100644 index 000000000..a6911df5a --- /dev/null +++ b/rt/html/Search/Elements/PickRestriction @@ -0,0 +1,141 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +
+ +<& /Elements/TitleBoxStart, title => loc('Refine search')&> + + +
    +
  • <&|/l&>Owner is <& /Elements/SelectBoolean, Name => "OwnerOp", + TrueVal=> '=', + FalseVal => '!=' +&> +<& /Elements/SelectOwner, Name => "ValueOfOwner" &> + +
  • +<&|/l&>Requestor email address +<& /Elements/SelectMatch, Name => "RequestorOp" &> + + +
  • +<&|/l&>Subject <& /Elements/SelectMatch, Name => "SubjectOp" &> + + +
  • <&|/l&>Queue <& /Elements/SelectBoolean, Name => "QueueOp" , + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' &> +<& /Elements/SelectQueue, Name => loc("ValueOfQueue") &> + + +
  • <&|/l&>Priority <& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> + + + +
  • +<& /Elements/SelectDateType, Name => 'DateType' &> +<& /Elements/SelectDateRelation, Name=>"DateOp" &> +<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &> + +
  • <&|/l&>Ticket attachment + +<& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> +<& /Elements/SelectBoolean, Name => "AttachmentFieldOp", + True => loc("matches"), + False => loc("does not match"), + TrueVal => 'LIKE', + FalseVal => 'NOT LIKE' +&> + + +
  • <&|/l&>Status +<& /Elements/SelectBoolean, Name => "StatusOp", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' +&> +<& /Elements/SelectStatus, Name => "ValueOfStatus" &> + + +% while ( my $CustomField = $CustomFields->Next ) { + +
  • <% $CustomField->Name %> + <& /Elements/SelectCustomFieldOperator, Name => "CustomFieldOp". $CustomField->id, + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', FalseVal => '!=' &> + +<& /Elements/SelectCustomFieldValue, Name => "CustomField".$CustomField->id, + CustomField => $CustomField, + &> +% } + +
+ +<& /Elements/TitleBoxEnd &> + +<& /Elements/TitleBoxStart, title => loc('Ordering and sorting')&> + +
    + +
  • <&|/l&>Results per page <& /Elements/SelectResultsPerPage, Name => "RowsPerPage", + Default => $session{'tickets_rows_per_page'} || '50' +&> + +
  • <&|/l&>Sort results by <& /Elements/SelectTicketSortBy, Name => "TicketsSortBy", + Default => $session{'tickets_sort_by'} +&> +<& /Elements/SelectSortOrder, Name => 'TicketsSortOrder', Default => $session{'tickets_sort_order'} &> + +
  • > <&|/l&>Don't show search results +
  • <& /Elements/Refresh, Name => 'RefreshSearchInterval' , Default => $session{'tickets_refresh_interval'} &> + +
+ + + + + + +<& /Elements/TitleBoxEnd &> + +<& /Elements/Submit, Label => loc('Search'), Name => 'Action'&> + +
+ + + <%INIT> +my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); + foreach ( $session{'tickets'}->RestrictionValues('Queue') ) { + # Gotta load up the $queue object, since queues get stored by name now. + my $queue = RT::Queue->new($session{'CurrentUser'}); + $queue->Load($_); + $CustomFields->LimitToQueue($queue->Id); + } + + $CustomFields->LimitToGlobal(); + + diff --git a/rt/html/Search/Elements/TicketHeader b/rt/html/Search/Elements/TicketHeader new file mode 100644 index 000000000..ed2f60e4e --- /dev/null +++ b/rt/html/Search/Elements/TicketHeader @@ -0,0 +1,40 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK + +<& TicketHeaderCell , Attribute => 'id', Header => '#'&> +<& TicketHeaderCell , Attribute => 'Subject'&> +<& TicketHeaderCell , Attribute => 'Status'&> +<& TicketHeaderCell , Attribute => 'Queue'&> +<& TicketHeaderCell , Attribute => 'Owner'&> +<& TicketHeaderCell , Attribute => 'Priority'&> + + +  +<& TicketHeaderCell , Attribute => 'Requestor(s)'&> +<& TicketHeaderCell , Attribute => 'Created'&> +<& TicketHeaderCell , Attribute => 'Told', Header => 'Last Contact'&> +<& TicketHeaderCell , Attribute => 'LastUpdated', Header => 'Last Updated'&> +<& TicketHeaderCell , Attribute => 'TimeLeft', Header => 'Left'&> + +%# loc('Last Notified'); diff --git a/rt/html/Search/Elements/TicketHeaderCell b/rt/html/Search/Elements/TicketHeaderCell new file mode 100644 index 000000000..5def9ea37 --- /dev/null +++ b/rt/html/Search/Elements/TicketHeaderCell @@ -0,0 +1,55 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<%INIT> +my ($order,$curorder); + $Attribute =~ s/Obj->(Name|AsString|AgeAsString)//g; + if ($session{'tickets_sort_order'} =~ /^asc$/i) { + $order = 'DESC'; + $curorder = 'ASC'; + } else { + $order = 'ASC'; + $curorder = 'DESC'; + } +$Header = $Attribute unless ($Header); + + + +% if (grep (/^$Attribute$/i, $session{'tickets'}->SortFields)) { + +% } else { +HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u%>&TicketsSortBy=<%$Attribute%>&TicketsSortOrder=<%$curorder%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>"> +% } +<% loc($Header) %> + +% } else { +<% loc($Header) %> +% } + +<%ARGS> +$Header => undef +$Attribute => undef + diff --git a/rt/html/Search/Elements/TicketRow b/rt/html/Search/Elements/TicketRow new file mode 100644 index 000000000..5d1ad209a --- /dev/null +++ b/rt/html/Search/Elements/TicketRow @@ -0,0 +1,55 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK + + +<%$Ticket->id%> +<%$Ticket->Subject%> +<%loc($Ticket->Status)%> +<%$Ticket->QueueObj->Name%> +<%$Ticket->Owner == $RT::Nobody->Id ? loc('Nobody') : $Ticket->OwnerObj->Name%> +<%$Ticket->Priority%> + +<%$Ticket->Requestors->MemberEmailAddressesAsString%> +<%$Ticket->CreatedObj->AgeAsString || '-'%> +<%$Ticket->ToldObj->AgeAsString || '-'%> +<%$Ticket->LastUpdatedObj->AgeAsString || '-'%> +<%$Ticket->TimeLeft%> + + +<%ARGS> +$Ticket => undef +$i => undef + diff --git a/rt/html/Search/Listing.html b/rt/html/Search/Listing.html new file mode 100644 index 000000000..508534549 --- /dev/null +++ b/rt/html/Search/Listing.html @@ -0,0 +1,112 @@ +%# BEGIN LICENSE BLOCK +%# +%# Copyright (c) 1996-2003 Jesse Vincent +%# +%# (Except where explictly superceded by other copyright notices) +%# +%# 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. +%# +%# Unless otherwise specified, all modifications, corrections or +%# extensions to this work which alter its source code become the +%# property of Best Practical Solutions, LLC when submitted for +%# inclusion in the work. +%# +%# +%# END LICENSE BLOCK +<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> +<& /Ticket/Elements/Tabs, + current_tab => 'Search/Listing.html', + Title => $title &> + +%if ($ticketcount && ! $ARGS{'HideResults'}) { + +<& Elements/TicketHeader, %ARGS &> +% my $i; +%while (my $Ticket = $session{'tickets'}->Next) { +% $i++; +<& Elements/TicketRow, Ticket => $Ticket, i=> $i, %ARGS &> +%} +
+
+ +<&|/l&>First page +   +% if ( $session{'tickets'}->FirstRow >= $session{'tickets_rows_per_page'}-1 ) { +<<&|/l&>Previous page +   +% } +% if ( $session{'tickets'}->FirstRow + $session{'tickets_rows_per_page'} < $ticketcount ) { +<&|/l&>Next page> +% } +%#  
<&|/l&>Goto page
+
+
+ + + + + + +
+(<&|/l, ($session{'tickets'}->FirstRow+1), ($session{'tickets'}->FirstRow() + $session{'tickets'}->RowsPerPage() ) &>[_1] - [_2] shown) + + +<&|/l&>Update all these tickets at once + +
+ +% } + + + + + +
+<& /Elements/TitleBoxStart, title => loc('Current search criteria')&> + +%my %restrictions=$session{'tickets'}->DescribeRestrictions(); +%foreach my $row (keys %restrictions){ +<%$restrictions{"$row"}%> [<&|/l&>delete]
+%} +
+
+<&|/l&>Bookmarkable URL for this search +<& /Elements/TitleBoxEnd&> +
+ +<& Elements/PickRestriction, %ARGS &> + +
+ +<%INIT> + +my ($title, $ticketcount); +$session{'i'}++; +if ($session{'tickets'}) { + if ($ARGS{'DeleteRestriction'}) { + $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'}); + } + if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) { + $session{'tickets'}->ClearRestrictions; + } +} + ProcessSearchQuery(ARGS=>\%ARGS); + $session{'tickets'}->RedoSearch(); + if ( $session{'tickets'}->DescribeRestrictions()) { + $ticketcount = $session{tickets}->CountAll(); + $title = loc('Found [quant,_1,ticket]', $ticketcount); + } else { + $title = loc("Find tickets"); + } + +<%CLEANUP> +$session{'tickets'}->PrepForSerialization(); + -- cgit v1.2.1 From 289340780927b5bac2c7604d7317c3063c6dd8cc Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Mar 2004 02:05:38 +0000 Subject: import of rt 3.0.9 --- rt/html/Search/Bulk.html | 1 + rt/html/Search/Elements/PickRestriction | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'rt/html/Search') diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index df43cfa50..de9143c8a 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -175,6 +175,7 @@ if ($ARGS{'UpdateContent'} && #Iterate through each ticket we've been handed my @linkresults; +$session{'tickets'}->RedoSearch(); while (my $Ticket = $session{'tickets'}->Next) { $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); next unless ($ARGS{"UpdateTicket".$Ticket->Id}); diff --git a/rt/html/Search/Elements/PickRestriction b/rt/html/Search/Elements/PickRestriction index a6911df5a..0021ab2bc 100644 --- a/rt/html/Search/Elements/PickRestriction +++ b/rt/html/Search/Elements/PickRestriction @@ -34,9 +34,10 @@ <& /Elements/SelectOwner, Name => "ValueOfOwner" &>
  • -<&|/l&>Requestor email address -<& /Elements/SelectMatch, Name => "RequestorOp" &> - +<& /Elements/SelectWatcherType, Name => "WatcherRole", AllowNull => 0 &> +<&|/l&>email address +<& /Elements/SelectMatch, Name => "WatcherRoleOp" &> +
  • <&|/l&>Subject <& /Elements/SelectMatch, Name => "SubjectOp" &> @@ -47,7 +48,7 @@ False => loc("isn't"), TrueVal=> '=', FalseVal => '!=' &> -<& /Elements/SelectQueue, Name => loc("ValueOfQueue") &> +<& /Elements/SelectQueue, Name => "ValueOfQueue" &>
  • <&|/l&>Priority <& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> @@ -77,7 +78,7 @@ TrueVal=> '=', FalseVal => '!=' &> -<& /Elements/SelectStatus, Name => "ValueOfStatus" &> +<& /Elements/SelectStatus, Name => "ValueOfStatus", SkipDeleted => 1 &> % while ( my $CustomField = $CustomFields->Next ) { -- cgit v1.2.1 From c582e92888b4a5553e1b4e5214cf35217e4a0cf0 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Nov 2004 12:13:50 +0000 Subject: import rt 3.0.12 --- rt/html/Search/Bulk.html | 13 +++++++------ rt/html/Search/Elements/PickRestriction | 4 ++-- rt/html/Search/Listing.html | 13 +++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'rt/html/Search') diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index de9143c8a..9ecac494f 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -145,7 +145,7 @@ while (my $Ticket = $session{'tickets'}->Next) { <& /Ticket/Elements/BulkLinks &> <& /Elements/TitleBoxEnd &> -<& /Elements/Submit &> +<& /Elements/Submit, Label => loc('Update All') &> @@ -180,6 +180,11 @@ while (my $Ticket = $session{'tickets'}->Next) { $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); next unless ($ARGS{"UpdateTicket".$Ticket->Id}); $RT::Logger->debug ("Matched\n"); + my @updateresults; + if ($do_comment_reply) { + ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); + } + #Update the basics. my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS); my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS); @@ -205,11 +210,7 @@ while (my $Ticket = $session{'tickets'}->Next) { delete $ARGS{$Ticket->Id.'-RefersTo'}; delete $ARGS{'RefersTo-'.$Ticket->Id}; - my @updateresults; - if ($do_comment_reply) { - ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); - } - my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults); + my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults); @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; @results = (@results, @tempresults); diff --git a/rt/html/Search/Elements/PickRestriction b/rt/html/Search/Elements/PickRestriction index 0021ab2bc..ff9b86ba5 100644 --- a/rt/html/Search/Elements/PickRestriction +++ b/rt/html/Search/Elements/PickRestriction @@ -21,8 +21,8 @@ %# %# %# END LICENSE BLOCK -
    - + + <& /Elements/TitleBoxStart, title => loc('Refine search')&> diff --git a/rt/html/Search/Listing.html b/rt/html/Search/Listing.html index 508534549..68b1fd75c 100644 --- a/rt/html/Search/Listing.html +++ b/rt/html/Search/Listing.html @@ -37,16 +37,16 @@
    -<&|/l&>First page +<&|/l&>First page    % if ( $session{'tickets'}->FirstRow >= $session{'tickets_rows_per_page'}-1 ) { -<<&|/l&>Previous page +<<&|/l&>Previous page    % } % if ( $session{'tickets'}->FirstRow + $session{'tickets_rows_per_page'} < $ticketcount ) { -<&|/l&>Next page> +<&|/l&>Next page> % } -%#  <&|/l&>Goto page +%#  
    <&|/l&>Goto page
    @@ -57,7 +57,7 @@ -<&|/l&>Update all these tickets at once +<&|/l&>Update all these tickets at once @@ -75,7 +75,7 @@ %}

    -<&|/l&>Bookmarkable URL for this search +<&|/l&>Bookmarkable URL for this search <& /Elements/TitleBoxEnd&> @@ -96,6 +96,7 @@ if ($session{'tickets'}) { } if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) { $session{'tickets'}->ClearRestrictions; + $session{'tickets'}->CleanSlate; } } ProcessSearchQuery(ARGS=>\%ARGS); -- cgit v1.2.1 From d39d52aac8f38ea9115628039f0df5aa3ac826de Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 3 Dec 2004 20:40:48 +0000 Subject: import rt 3.2.2 --- rt/html/Search/Build.html | 801 +++++++++++++++++++++++ rt/html/Search/Bulk.html | 118 +++- rt/html/Search/Edit.html | 86 +++ rt/html/Search/Elements/BuildFormatString | 215 ++++++ rt/html/Search/Elements/DisplayOptions | 109 +++ rt/html/Search/Elements/EditFormat | 122 ++++ rt/html/Search/Elements/EditSearches | 94 +++ rt/html/Search/Elements/NewListActions | 66 ++ rt/html/Search/Elements/PickBasics | 184 ++++++ rt/html/Search/Elements/PickCFs | 87 +++ rt/html/Search/Elements/PickCriteria | 74 +++ rt/html/Search/Elements/SearchPrivacy | 53 ++ rt/html/Search/Elements/SelectAndOr | 51 ++ rt/html/Search/Elements/SelectLinks | 64 ++ rt/html/Search/Elements/SelectPersonType | 74 +++ rt/html/Search/Elements/SelectSearchObject | 58 ++ rt/html/Search/Elements/SelectSearchesForObjects | 63 ++ rt/html/Search/Results.html | 136 ++++ rt/html/Search/Results.rdf | 85 +++ rt/html/Search/Results.tsv | 114 ++++ 20 files changed, 2636 insertions(+), 18 deletions(-) create mode 100644 rt/html/Search/Build.html create mode 100755 rt/html/Search/Edit.html create mode 100644 rt/html/Search/Elements/BuildFormatString create mode 100644 rt/html/Search/Elements/DisplayOptions create mode 100644 rt/html/Search/Elements/EditFormat create mode 100644 rt/html/Search/Elements/EditSearches create mode 100644 rt/html/Search/Elements/NewListActions create mode 100644 rt/html/Search/Elements/PickBasics create mode 100644 rt/html/Search/Elements/PickCFs create mode 100644 rt/html/Search/Elements/PickCriteria create mode 100644 rt/html/Search/Elements/SearchPrivacy create mode 100644 rt/html/Search/Elements/SelectAndOr create mode 100644 rt/html/Search/Elements/SelectLinks create mode 100644 rt/html/Search/Elements/SelectPersonType create mode 100644 rt/html/Search/Elements/SelectSearchObject create mode 100644 rt/html/Search/Elements/SelectSearchesForObjects create mode 100755 rt/html/Search/Results.html create mode 100644 rt/html/Search/Results.rdf create mode 100644 rt/html/Search/Results.tsv (limited to 'rt/html/Search') diff --git a/rt/html/Search/Build.html b/rt/html/Search/Build.html new file mode 100644 index 000000000..bbf2a1de9 --- /dev/null +++ b/rt/html/Search/Build.html @@ -0,0 +1,801 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 &> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Build.html".$QueryString, + Title => $title, + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage +&> + +
    + + + + + + + + + + + +
    +<& Elements/PickCriteria, query => $Query, cfqueues => \%queues &> +<& /Elements/Submit, Caption => loc('Add additional criteria'), Label => loc('Add'), Name => 'AddClause'&> + + +<& /Elements/TitleBoxStart, title => loc("Query") . ": " .$Description &> +<& Elements/NewListActions, actions => \@actions &> + +
    +
    + + + + + +
    + + +%# +
    +<& /Elements/TitleBoxEnd &> +
    +<& Elements/EditSearches, CurrentSearch => $search_hash, Dirty => $dirty, SearchId => $SearchId &> +
    + +<& Elements/DisplayOptions, %ARGS, Format=> $Format, +AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy, Order => $Order &> +
    +
    + +<%INIT> +use Tree::Simple; + +my $search_hash = {}; +my $search; +my $title = loc("Query Builder"); + +# {{{ Clear out unwanted data +if ($NewQuery or $ARGS{'Delete'}) { + # Wipe all data-carrying variables clear if we want a new + # search, or we're deleting an old one.. + $Query = ''; + $Format = ''; + $Description = ''; + $SearchId = ''; + $Order = ''; + $OrderBy = ''; + $RowsPerPage = ''; + # ($search hasn't been set yet; no need to clear) + + # ..then wipe the session out.. + undef $session{'CurrentSearchHash'}; + + # ..and the search results. + $session{'tickets'}->CleanSlate() if defined $session{'tickets'}; +} +# }}} + +# {{{ 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'}; + +# These variables are what define a search_hash; this is also +# where we give sane defaults. +$Query ||= $search_hash->{'Query'}; +$Format ||= $search_hash->{'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'}; +# }}} + +my @actions = (); +my %queues; + +# Clean unwanted junk from the format +$Format = $m->comp('/Elements/ScrubHTML', Content => $Format) if ($Format); + +# {{{ If we're asked to delete the current search, make it go away and reset the search parameters +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); + } + + } +} +# }}} + +# {{{ If the user wants to copy a search, uncouple from the one that this was based on, but don't erase the $Query or $Format +if ( $ARGS{'CopySearch'} ) { + $SearchId = 'new'; + $search = undef; + $Description = loc("[_1] copy", $Description); +} +# }}} + +# {{{ if we're asked to revert the current search, we just want to load it +if ( $ARGS{'Revert'} ) { + $ARGS{'LoadSavedSearch'} = $SearchId; +} +# }}} + +# {{{ 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); + } + + # We have a $search and now; import the others + $SearchId = $ARGS{'LoadSavedSearch'}; + $Description = $search->Description; + $Format = $search->SubValue('Format'); + $Query = $search->SubValue('Query'); + $Order = $search->SubValue('Order'); + $OrderBy = $search->SubValue('OrderBy'); + $RowsPerPage = $search->SubValue('RowsPerPage'); +} + +# }}} + +# {{{ Parse the query +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 @options; +my $optionlist; +$Query = ""; +%queues = (); + +# Build the optionlist from the tree, so we can do additions and movements based on it +$optionlist = build_array( \$Query, $ARGS{clauses}, $tree, \@options, \%queues ); + +my $currentkey; +$currentkey = $options[$ARGS{clauses}] if defined $ARGS{clauses}; + +# {{{ Try to find if we're adding a clause +foreach my $arg ( keys %ARGS ) { + if ( $arg =~ m/ValueOf(.+)/ && $ARGS{$arg} ne "") { + # We're adding a $1 clause + my $field = $1; + my ($keyword, $op, $value); + + #figure out if it's a grouping + if ( $ARGS{ $field . "Field" } ) { + $keyword = $ARGS{ $field . "Field" }; + } + else { + $keyword = $field; + } + + $value = $ARGS{'ValueOf' . $field}; + $op = $ARGS{ $field . 'Op' }; + if ( $value eq 'NULL' && $op =~ /=/) { + if ($op eq '=') { + $op = "IS"; + } elsif ($op eq '!=') { + $op = "IS NOT"; + } + + # This isn't "right", but... + # It has to be this way until #5182 is fixed + $value = "'NULL'"; + } else { + $value = "'$value'"; + } + + my $clause = { + Key => $keyword, + Op => $op, + Value => $value + }; + + my $newnode = Tree::Simple->new($clause); + if ($currentkey) { + my $newindex = $currentkey->getIndex() + 1; + if (!$currentkey->getParent->getParent()->isRoot()) { + } + $currentkey->insertSibling($newindex, $newnode); + $currentkey = $newnode; + } + else { + $tree->getChild(0)->addChild($newnode); + $currentkey = $newnode; + } + $newnode->getParent()->setNodeValue($ARGS{'AndOr'}); + } +} +# }}} + +# {{{ Move things around +if ( $ARGS{"Up"} ) { + if ($currentkey) { + my $index = $currentkey->getIndex(); + if ( $currentkey->getIndex() > 0 ) { + my $parent = $currentkey->getParent(); + $parent->removeChild($index); + $parent->insertChild($index - 1, $currentkey); + $currentkey = $parent->getChild($index - 1); + } + else { + push( @actions, [ "error: can't move up", -1 ] ); + } + } + else { + push( @actions, [ "error: nothing to move", -1 ] ); + } +} +elsif ( $ARGS{"Down"} ) { + if ($currentkey) { + my $index = $currentkey->getIndex(); + my $parent = $currentkey->getParent(); + if ( $currentkey->getIndex() < ($parent->getChildCount - 1) ) { + $parent->removeChild($index); + $parent->insertChild($index + 1, $currentkey); + $currentkey = $parent->getChild($index + 1); + } + else { + push( @actions, [ "error: can't move down", -1 ] ); + } + } + else { + push( @actions, [ "error: nothing to move", -1 ] ); + } +} +elsif ( $ARGS{"Left"} ) { + if ($currentkey) { + my $parent = $currentkey->getParent(); + my $grandparent = $parent->getParent(); + if (!$grandparent->isRoot) { + my $index = $parent->getIndex(); + $parent->removeChild($currentkey); + $grandparent->insertChild($index, $currentkey); + if ($parent->isLeaf()) { + $grandparent->removeChild($parent); + } + } + else { + push( @actions, [ "error: can't move left", -1 ] ); + } + } + else { + push( @actions, [ "error: nothing to move", -1 ] ); + } +} +elsif ( $ARGS{"Right"} ) { + if ($currentkey) { + my $parent = $currentkey->getParent(); + my $index = $currentkey->getIndex(); + my $newparent; + if ($index > 0 ) { + my $sibling = $parent->getChild($index - 1); + if (ref($sibling->getNodeValue)) { + $parent->removeChild($currentkey); + my $newtree = Tree::Simple->new('AND', $parent); + $newtree->addChild($currentkey); + } else { + $parent->removeChild($index); + $sibling->addChild($currentkey); + } + } + else { + $parent->removeChild($currentkey); + $newparent = Tree::Simple->new('AND', $parent); + $newparent->addChild($currentkey); + } + } else { + push( @actions, [ "error: nothing to move", -1 ] ); + } +} +elsif ( $ARGS{"DeleteClause"} ) { + if ($currentkey) { + $currentkey->getParent()->removeChild($currentkey); + } + else { + push( @actions, [ "error: nothing to delete", -1 ] ); + } +} +elsif ( $ARGS{"Toggle"} ) { + my $ea; + if ($currentkey) { + my $value = $currentkey->getNodeValue(); + my $parent = $currentkey->getParent(); + my $parentvalue = $parent->getNodeValue(); + + if ( $parentvalue eq 'AND') { + $parent->setNodeValue('OR'); + } + else { + $parent->setNodeValue('AND'); + } + } + else { + push( @actions, [ "error: nothing to toggle", -1 ] ); + } +} +elsif ( $ARGS{"Clear"} ) { + $tree = Tree::Simple->new(Tree::Simple->ROOT); +} +# }}} + +# {{{ Rebuild $Query based on the additions / movements +$Query = ""; +@options = (); +%queues = (); +$optionlist = build_array( \$Query, $currentkey, $tree, \@options, \%queues ); + +sub build_array { + my $Query = shift; + my $currentkey = shift; + my $tree = shift; + my ($keys, $queues) = @_; + my $i = 0; + my $optionlist; + my $depth = 0; + my %parens; + + $tree->traverse( sub { + my ($_tree) = @_; + + return if $_tree->getParent->isRoot(); + + push @$keys, $_tree; + my $clause = $_tree->getNodeValue(); + my $str; + my $ea = $_tree->getParent()->getNodeValue(); + if (ref($clause)) { + $str .= $ea . " " if $_tree->getIndex() > 0; + $str .= $clause->{Key} . " " . $clause->{Op} . " " . $clause->{Value}; + + if ( $clause->{Key} eq "Queue" ) { + $queues->{ $clause->{Value} } = 1; + } + } else { + $str = $ea if $_tree->getIndex() > 0; + } + + my $selected; + if ($_tree == $currentkey) { + $selected = "SELECTED"; + } + else { + $selected = ""; + } + + foreach my $p (keys %parens) { + if ($p > $_tree->getDepth) { + $$Query .= ')' x $parens{$p}; + $parens{$p}--; + } + } + + $optionlist .= "\n"; + my $parent = $_tree->getParent(); + if (!($parent->isRoot || $parent->getParent()->isRoot) && + !ref($parent->getNodeValue())) { + if ( $_tree->getIndex() == 0) { + $$Query .= '('; + $parens{$_tree->getDepth}++; + } + } + $$Query .= " " . $str . " "; + + if ($_tree->getDepth < $depth) { + $$Query .= ')'; + $parens{$depth}--; + } + + $i++; + }); + + foreach my $p (keys %parens) { + $$Query .= ") " x $parens{$p}; + } + + return $optionlist; + +} + +use Regexp::Common qw /delimited/; + +# States +use constant VALUE => 1; +use constant AGGREG => 2; +use constant OP => 4; +use constant PAREN => 8; +use constant KEYWORD => 16; + +sub ParseQuery { + my $string = shift; + my $tree = shift; + my @actions = shift; + my $want = KEYWORD | PAREN; + my $last = undef; + + my $depth = 1; + + # make a tree root + $$tree = Tree::Simple->new(Tree::Simple->ROOT); + my $root = Tree::Simple->new('AND', $$tree); + my $lastnode = $root; + my $parentnode = $root; + + # get the FIELDS from Tickets_Overlay + my $tickets = new RT::Tickets( $session{'CurrentUser'} ); + my %FIELDS = %{ $tickets->FIELDS }; + + # Lower Case version of FIELDS, for case insensitivity + my %lcfields = map { ( lc($_) => $_ ) } ( keys %FIELDS ); + + my @tokens = qw[VALUE AGGREG OP PAREN KEYWORD]; + my $re_aggreg = qr[(?i:AND|OR)]; + my $re_value = qr[$RE{delimited}{-delim=>qq{\'\"}}|\d+]; + my $re_keyword = qr[$RE{delimited}{-delim=>qq{\'\"}}|(?:\{|\}|\w|\.)+]; + my $re_op = qr[=|!=|>=|<=|>|<|(?i:IS NOT)|(?i:IS)|(?i:NOT LIKE)|(?i:LIKE)] ; # long to short + my $re_paren = qr'\(|\)'; + + # assume that $ea is AND if it's not set + my ( $ea, $key, $op, $value ) = ( "AND", "", "", "" ); + + # order of matches in the RE is important.. op should come early, + # because it has spaces in it. otherwise "NOT LIKE" might be parsed + # as a keyword or value. + + while ( $string =~ /( + $re_aggreg + |$re_op + |$re_keyword + |$re_value + |$re_paren + )/igx + ) + { + my $val = $1; + my $current = 0; + + # Highest priority is last + $current = OP if _match( $re_op, $val ); + $current = VALUE if _match( $re_value, $val ); + $current = KEYWORD + if _match( $re_keyword, $val ) && ( $want & KEYWORD ); + $current = AGGREG if _match( $re_aggreg, $val ); + $current = PAREN if _match( $re_paren, $val ); + + unless ( $current && $want & $current ) { + + # Error + # FIXME: I will only print out the highest $want value + my $token = $tokens[ ( ( log $want ) / ( log 2 ) ) ]; + push @actions, [ "current: $current, want $want, Error near ->$val<- expecting a " . $token . " in '$string'\n", -1 ]; + } + + # State Machine: + my $parentdepth = $depth; + + # Parens are highest priority + if ( $current & PAREN ) { + if ( $val eq "(" ) { + $depth++; + # make a new node that the clauses can be children of + $parentnode = Tree::Simple->new($ea, $parentnode); + } + else { + $depth--; + $parentnode = $parentnode->getParent(); + $lastnode = $parentnode; + } + + $want = KEYWORD | PAREN | AGGREG; + } + elsif ( $current & AGGREG ) { + $ea = $val; + $want = KEYWORD | PAREN; + } + elsif ( $current & KEYWORD ) { + $key = $val; + $want = OP; + } + elsif ( $current & OP ) { + $op = $val; + $want = VALUE; + } + elsif ( $current & VALUE ) { + $value = $val; + + # Remove surrounding quotes from $key, $val + # (in future, simplify as for($key,$val) { action on $_ }) + if ( $key =~ /$RE{delimited}{-delim=>qq{\'\"}}/ ) { + substr( $key, 0, 1 ) = ""; + substr( $key, -1, 1 ) = ""; + } + if ( $val =~ /$RE{delimited}{-delim=>qq{\'\"}}/ ) { + substr( $val, 0, 1 ) = ""; + substr( $val, -1, 1 ) = ""; + } + + # Unescape escaped characters + $key =~ s!\\(.)!$1!g; + $val =~ s!\\(.)!$1!g; + + my $class; + if ( exists $lcfields{ lc $key } ) { + $key = $lcfields{ lc $key }; + $class = $FIELDS{$key}->[0]; + } + if ( $class ne 'INT' ) { + $val = "'$val'"; + } + + push @actions, [ "Unknown field: $key", -1 ] unless $class; + + $want = PAREN | AGGREG; + } + else { + push @actions, [ "I'm lost", -1 ]; + } + + if ( $current & VALUE ) { + if ( $key =~ /^CF./ ) { + $key = "'" . $key . "'"; + } + my $clause = { + Key => $key, + Op => $op, + Value => $val + }; + + # explicity add a child to it + $lastnode = Tree::Simple->new($clause, $parentnode); + $lastnode->getParent()->setNodeValue($ea); + + ( $ea, $key, $op, $value ) = ( "", "", "", "" ); + } + + $last = $current; + } # while + + push @actions, [ "Incomplete query", -1 ] + unless ( ( $want | PAREN ) || ( $want | KEYWORD ) ); + + push @actions, [ "Incomplete Query", -1 ] + unless ( $last && ( $last | PAREN ) || ( $last || VALUE ) ); + + # This will never happen, because the parser will complain + push @actions, [ "Mismatched parentheses", -1 ] + unless $depth == 1; +} + +sub _match { + + # Case insensitive equality + my ( $y, $x ) = @_; + return 1 if $x =~ /^$y$/i; + + # return 1 if ((lc $x) eq (lc $y)); # Why isnt this equiv? + return 0; +} + +sub debug { + my $message = shift; + $m->print($message . "
    "); +} + +# }}} + +# }}} + +# {{{ Deal with format changes +my ($AvailableColumns, $CurrentFormat); +($Format, $AvailableColumns, $CurrentFormat) = $m->comp('Elements/BuildFormatString', cfqueues => \%queues, %ARGS, Format => $Format); +# }}} + +# {{{ 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 if defined $search and + ($search->SubValue('Format') ne $Format or + $search->SubValue('Query') ne $Query or + $search->SubValue('Order') ne $Order or + $search->SubValue('OrderBy') ne $OrderBy or + $search->SubValue('RowsPerPage') ne $RowsPerPage); +# }}} + +# {{{ Push the updates into the session so we don't loose 'em +$search_hash->{'SearchId'} = $SearchId; +$search_hash->{'Format'} = $Format; +$search_hash->{'Query'} = $Query; +$search_hash->{'Description'} = $Description; +$search_hash->{'Object'} = $search; +$search_hash->{'Order'} = $Order; +$search_hash->{'OrderBy'} = $OrderBy; +$search_hash->{'RowsPerPage'} = $RowsPerPage; + +$session{'CurrentSearchHash'} = $search_hash; +# }}} + +# {{{ Show the results, if we were asked. +if ( $ARGS{"DoSearch"} ) { + $m->comp("Results.html" , Query => $Query, Format => $Format, Order => $Order, OrderBy => $OrderBy, Rows => $RowsPerPage); + $m->abort(); +} +# }}} + +# {{{ Build a querystring for the tabs + +my $QueryString; +if ($NewQuery) { + $QueryString = '?NewQuery=1'; +} else { + $QueryString = '?' . $m->comp('/Elements/QueryString', + Query => $Query, + Format => $Format, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage) if ($Query); +} +# }}} + + + +<%ARGS> +$NewQuery => 0 +$SearchId => undef +$Query => undef +$Format => undef +$Description => undef +$Order => undef +$OrderBy => undef +$RowsPerPage => undef +$HideResults => 0 + diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index 9ecac494f..f75934bf3 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -1,8 +1,14 @@ -%# BEGIN LICENSE BLOCK +%# {{{ BEGIN BPS TAGGED BLOCK %# -%# Copyright (c) 1996-2003 Jesse Vincent +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# %# -%# (Except where explictly superceded by other copyright notices) +%# (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 @@ -14,13 +20,29 @@ %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU %# General Public License for more details. %# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. +%# 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. +%# +%# +%# 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 LICENSE BLOCK +%# }}} END BPS TAGGED BLOCK <& /Elements/Header, Title => loc("Bulk ticket update") &> <& /Elements/Tabs, Title => loc("Bulk ticket update") &> @@ -42,10 +64,8 @@ my $i; - - -$session{'tickets'}->RedoSearch(); -while (my $Ticket = $session{'tickets'}->Next) { +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { $i++; if ($i % 2) { $bgcolor = "#dddddd"; @@ -129,7 +149,7 @@ while (my $Ticket = $session{'tickets'}->Next) { <&|/l&>Update Type: <&|/l&>Subject: @@ -138,9 +158,38 @@ while (my $Ticket = $session{'tickets'}->Next) { <& /Elements/MessageBox, Name=>"UpdateContent"&> + + +% foreach (keys %allcfs) { + + + +% } +
    +% my $cf = $allcfs{$_}; +% my $pref; +% if ($cf->Queue == 0) { +% $pref = "[Global]"; +% } else { +% $pref = "[Queue: " . $cfqnames{$_} . "]"; +% } +<%$pref%> <% $cf->Name %>
    +<% $cf->FriendlyType %> +
    +% if ($cf->Type ne "FreeformMultiple") { +<& /Ticket/Elements/EditCustomField, CustomField => $cf &> +% } else { +Add Values
    + +
    +Delete Values
    + +% } +
    + <& /Elements/TitleBoxEnd &> -<& /Elements/TitleBoxStart, title => loc('Edit Relationships'), color => "#336633"&> +<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> <&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.
    <& /Ticket/Elements/BulkLinks &> <& /Elements/TitleBoxEnd &> @@ -157,8 +206,30 @@ map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); my ($bgcolor, @results); my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString ); -Abort(loc("No search to operate on.")) unless ($session{'tickets'}); +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->CustomFields; + while (my $cf = $cfs->Next) { + $allcfs{$cf->Id} = $cf; + $cfqnames{$cf->Id} = $cfqn; + } + } +} my $do_comment_reply=0; # Prepare for ticket updates @@ -175,8 +246,8 @@ if ($ARGS{'UpdateContent'} && #Iterate through each ticket we've been handed my @linkresults; -$session{'tickets'}->RedoSearch(); -while (my $Ticket = $session{'tickets'}->Next) { +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); next unless ($ARGS{"UpdateTicket".$Ticket->Id}); $RT::Logger->debug ("Matched\n"); @@ -191,6 +262,17 @@ while (my $Ticket = $session{'tickets'}->Next) { #Update the watchers my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); + #Update custom fields + my $pat = "^(\\d+)-(.*)\$"; + foreach (keys %ARGS) { + $ARGS{"Ticket-" . $Ticket->Id . "-CustomField-" . $1 . "-" . $2} = $ARGS{$_} if (/$pat/o); + } + my @cfresults = ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS); + foreach (keys %ARGS) { + delete $ARGS{"Ticket-" . $Ticket->Id . "-CustomField-" . $1 . "-" . $2} if (/$pat/o); + } + + #Update the links $ARGS{'id'} = $Ticket; $ARGS{$Ticket->Id.'-MergeInto'} = $ARGS{'Ticket-MergeInto'}; @@ -210,7 +292,7 @@ while (my $Ticket = $session{'tickets'}->Next) { delete $ARGS{$Ticket->Id.'-RefersTo'}; delete $ARGS{'RefersTo-'.$Ticket->Id}; - my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults); + my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults, @cfresults); @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; @results = (@results, @tempresults); diff --git a/rt/html/Search/Edit.html b/rt/html/Search/Edit.html new file mode 100755 index 000000000..769d38d9d --- /dev/null +++ b/rt/html/Search/Edit.html @@ -0,0 +1,86 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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&> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Edit.html?".$QueryString, + Title => $title, + Format => $Format, + Query => $Query, + Rows => $ARGS{'Rows'}, + OrderBy => $ARGS{'OrderBy'}, + Order => $ARGS{'Order'} &> + +<& Elements/NewListActions, actions => \@actions &> + +
    + + +
    + +
    +<& /Elements/Submit, Label => loc("Apply"), Reset => 1, Caption => loc("Apply your changes")&> +
    + +<%INIT> +my $title = loc("Edit Query"); +$Format = $m->comp('/Elements/ScrubHTML', Content => $Format); +my $QueryString = $m->comp('/Elements/QueryString', + Query => $Query, + Format => $Format, + Rows => $ARGS{'Rows'}, + OrderBy => $ARGS{'OrderBy'}, + Order => $ARGS{'Order'}, + ); + + + + +<%ARGS> +$Query => undef +$Format => undef +$SearchId => 'new' +@actions => undef + diff --git a/rt/html/Search/Elements/BuildFormatString b/rt/html/Search/Elements/BuildFormatString new file mode 100644 index 000000000..e5e131b6c --- /dev/null +++ b/rt/html/Search/Elements/BuildFormatString @@ -0,0 +1,215 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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> +$Format => undef +%cfqueues => undef + +<%init> + +unless ($Format) { + $Format = $RT::DefaultSearchResultFormat; +} + +my @fields = ( + "QueueName", "OwnerName", + "id", "Status", + "Subject", "ExtendedStatus", + "Priority", "InitialPriority", + "FinalPriority", "EffectiveId", + "Type", "TimeWorked", + "TimeLeft", "TimeEstimated", + "Requestors", "Cc", + "AdminCc", "StartsRelative", + "StartedRelative", "CreatedRelative", + "LastUpdatedRelative", "ToldRelative", + "DueRelative", "ResolvedRelative", + "Starts", "Started", + "Created", "CreatedBy", + "LastUpdated", "LastUpdatedBy", + "Told", "Due", + "Resolved", "NEWLINE", + "RefersTo", "ReferredToBy", + "DependsOn", "DependedOnBy", + "MemberOf", "Members", + "Parents", "Children", + "-", +); + +my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); +foreach (keys %cfqueues) { + my $id = $_; + $id =~ s/^.'*(.*).'*$/$1/; + # Gotta load up the $queue object, since queues get stored by name now. + my $queue = RT::Queue->new($session{'CurrentUser'}); + $queue->Load($id); + $CustomFields->LimitToQueue($queue->Id); +} +$CustomFields->LimitToGlobal; + +while ( my $CustomField = $CustomFields->Next ) { + my $queuestr; + if ($CustomField->QueueObj && $CustomField->QueueObj->Id != 0) { + $queuestr = $CustomField->QueueObj->Name . "."; + } + push @fields, "CustomField." . $queuestr . "{" . $CustomField->Name . "}"; +} + +my ( @seen); + +my @format = split( /,\s*/, $Format ); +foreach my $field (@format) { + my %column = (); + $field =~ s/'(.*)'/$1/; + my ( $prefix, $suffix ); + if ( $field =~ m/(.*)__(.*)__(.*)/ ) { + $prefix = $1; + $suffix = $3; + $field = $2; + } + $field = "" if !$field; + $column{Prefix} = $prefix; + $column{Suffix} = $suffix; + $field =~ s/\s*(.*)\s*/$1/; + $column{Column} = $field; + push @seen, \%column; +} + +if ( $ARGS{"RemoveCol"} ) { + my $index = $ARGS{'CurrentDisplayColumns'}; + my $column = $seen[$index]; + if ($index) { + delete $seen[$index]; + my @temp = @seen; + @seen = (); + foreach my $element (@temp) { + next unless $element; + push @seen, $element; + } + } +} +elsif ( $ARGS{"AddCol"} ) { + if ( defined $ARGS{'SelectDisplayColumns'} ) { + my $selected = $ARGS{'SelectDisplayColumns'}; + my @columns; + if (ref($selected) eq 'ARRAY') { + @columns = @$selected; + } else { + push @columns, $selected; + } + foreach my $col (@columns) { + my %column = (); + $column{Column} = $fields[ $col ]; + + if ( $ARGS{Face} eq "Bold" ) { + $column{Prefix} .= ""; + } + if ( $ARGS{Face} eq "Italic" ) { + $column{Prefix} .= ""; + } + if ( $ARGS{Size} ) { + $column{Prefix} .= "<" . $ARGS{Size} . ">"; + } + if ( $ARGS{Link} eq "Display" ) { + $column{Prefix} .= ""; + } + elsif ( $ARGS{Link} eq "Take" ) { + $column{Prefix} .= + ""; + } + + my $suffix; + if ( $ARGS{'Link'} eq "Display" || $ARGS{'Link'} eq "Take" ) { + $column{Suffix} .= ""; + } + if ( $ARGS{Size} ) { + $column{Suffix} .= ""; + } + if ( $ARGS{Face} eq "Italic" ) { + $column{Suffix} .= ""; + } + if ( $ARGS{Face} eq "Bold" ) { + $column{Suffix} .= ""; + } + if ( $ARGS{Title} ) { + $column{Suffix} .= "/TITLE:" . $ARGS{Title}; + } + push @seen, \%column; + } + } +} +elsif ( $ARGS{"ColUp"} ) { + my $index = $ARGS{'CurrentDisplayColumns'}; + if ( defined $index && ( $index - 1 ) >= 0 ) { + my $column = $seen[$index]; + $seen[$index] = $seen[ $index - 1 ]; + $seen[ $index - 1 ] = $column; + $ARGS{CurrentDisplayColumns} = $index - 1; + } +} +elsif ( $ARGS{"ColDown"} ) { + my $index = $ARGS{'CurrentDisplayColumns'}; + if ( defined $index && ( $index + 1 ) < scalar @seen ) { + my $column = $seen[$index]; + $seen[$index] = $seen[ $index + 1 ]; + $seen[ $index + 1 ] = $column; + $ARGS{CurrentDisplayColumns} = $index + 1; + } +} + +$Format = ""; +foreach my $field (@seen) { + next unless $field; + $Format .= ", \n" if $Format; + $Format .= "'"; + $Format .= $field->{Prefix}; + $Format .= "__" . $field->{Column} . "__" if ( $field->{Column} ne "" ) ; + $Format .= $field->{Suffix}; + $Format .= "'"; +} +return($Format, \@fields, \@seen); + + + diff --git a/rt/html/Search/Elements/DisplayOptions b/rt/html/Search/Elements/DisplayOptions new file mode 100644 index 000000000..330948d32 --- /dev/null +++ b/rt/html/Search/Elements/DisplayOptions @@ -0,0 +1,109 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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/TitleBoxStart, title => loc("Display Columns") &> + + + + + +
    +<& EditFormat, %ARGS &> + + + + + + + +
    +<&|/l&>Order by: + + + +
    +<&|/l&>Rows per page: + +<& /Elements/SelectResultsPerPage, + Name => "RowsPerPage", + Default => $RowsPerPage &> +
    +
    +<& /Elements/Submit, Caption => "Do the Search", Label => loc('Search'), Name => 'DoSearch'&> +<& /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; + + + +<%ARGS> +$Order => undef +$OrderBy => undef +$RowsPerPage => undef +$Format => undef + diff --git a/rt/html/Search/Elements/EditFormat b/rt/html/Search/Elements/EditFormat new file mode 100644 index 000000000..7d314aee6 --- /dev/null +++ b/rt/html/Search/Elements/EditFormat @@ -0,0 +1,122 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 + + + + + + + + + + + + + +
    +<&|/l&>Available Columns: + +Format: + +<&|/l&>Show Columns: +
    + + +Link: + +
    Title: +
    Size: + +
    Face: + +
    + + + +
    +
    + + + +
    +
    +
    + +<%ARGS> +$CurrentFormat => undef +$AvailableColumns => undef + diff --git a/rt/html/Search/Elements/EditSearches b/rt/html/Search/Elements/EditSearches new file mode 100644 index 000000000..cd9f1ef3b --- /dev/null +++ b/rt/html/Search/Elements/EditSearches @@ -0,0 +1,94 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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/TitleBoxStart, title => loc('Saved searches') &> +<&|/l&>Privacy: +% if ($CurrentSearch->{'Object'} && $CurrentSearch->{'Object'}->id) { +<& SearchPrivacy, Object => $CurrentSearch->{'Object'}->Object &>
    +% } else { +<& SelectSearchObject, Name => 'Owner', Objects => \@Objects &>
    +% } +<&|/l&>Description:
    + +
    +% if ($SearchId ne 'new') { +% if ($Dirty) { + +% } + + + +% } + +% if ($Dirty or $SearchId eq 'new') { + +% } +
    +<&|/l&>Load saved search:
    +<& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects&> + +<& /Elements/TitleBoxEnd &> + +<%init> +my @Objects; + +push @Objects, $session{CurrentUser}->UserObj; + +my $groups = RT::Groups->new($session{'CurrentUser'}); + +$groups->LimitToUserDefinedGroups; +$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id, + Recursively => 1); + + push (@Objects, @{$groups->ItemsArrayRef()}); + + +<%ARGS> +$SearchId => undef +$CurrentSearch => undef +$Description => undef +$HideResults => 0 +$Dirty => 0 + diff --git a/rt/html/Search/Elements/NewListActions b/rt/html/Search/Elements/NewListActions new file mode 100644 index 000000000..7b81d80b1 --- /dev/null +++ b/rt/html/Search/Elements/NewListActions @@ -0,0 +1,66 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 +% if ($actions[0] ) { +<%loc('Results')%>
    +% foreach my $action (@actions) { +% next unless ($action); +% my @item = @$action; +% if ($item[1] < 0) { + +% } + <%$item[0]%>
    +% if ($item[1] < 0) { +
    +% } +% } +
    +% } +<%init> +@actions = grep (/./,@actions); + +<%ARGS> +@actions => undef + diff --git a/rt/html/Search/Elements/PickBasics b/rt/html/Search/Elements/PickBasics new file mode 100644 index 000000000..d7e19788f --- /dev/null +++ b/rt/html/Search/Elements/PickBasics @@ -0,0 +1,184 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 + +% foreach my $field (@fields) { + +% if ($field eq "Attachment") { +<& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> + +<& /Elements/SelectBoolean, Name => "AttachmentOp", + True => loc("matches"), + False => loc("does not match"), + TrueVal => 'LIKE', + FalseVal => 'NOT LIKE' +&> + + +% } elsif ($field eq "Dates") { +<& /Elements/SelectDateType, Name=>"DateField" &> + +<& /Elements/SelectDateRelation, Name=>"DateOp" &> + +<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &> +% } elsif ($field eq "Links") { +<& SelectLinks, Name=>"LinksField" &> + +<& /Elements/SelectBoolean, Name => "LinksOp", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' +&> + + +%} elsif ($field eq "Priority") { + + +<& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> + + +%} elsif ($field =~ m/Time.*/) { + + +<& /Elements/SelectEqualityOperator, Name => "TimeOp" &> + + +% } elsif ($field eq "Status") { +<&|/l&>Status + +<& /Elements/SelectBoolean, Name => "StatusOp", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' +&> + +<& /Elements/SelectStatus, Name => "ValueOfStatus", SkipDeleted => 1 &> +%} elsif ($field =~ m/.*Priority/ || $field =~ m/Time.*/) { +<&|/l&><%$field%> + +<& /Elements/SelectEqualityOperator, Name => $field . "Op" &> + +" SIZE=5> +% } elsif ($field eq "Queue") { +<&|/l&>Queue + +<& /Elements/SelectBoolean, Name => "QueueOp" , + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' &> + +<& /Elements/SelectQueue, Name => "ValueOfQueue", NamedValues => 1 &> +% } elsif ($field eq "id") { +<&|/l&>Id + +<& /Elements/SelectEqualityOperator, Name => "idOp" &> + + +% } elsif ($field eq "People") { +% foreach my $field (@people) { + +% if ($field eq "Actor") { + + +<& /Elements/SelectBoolean, Name => "ActorOp", + TrueVal=> '=', + FalseVal => '!=' +&> + +<& /Elements/SelectOwner, Name => "ValueOfActor" &> +% } elsif ($field eq 'Watcher') { +<& SelectPersonType, Name => 'WatcherField', Default => 'Requestor' &> + +<& /Elements/SelectMatch, Name => "WatcherOp" &> + + +% } else { +<&|/l&><%$field%> +<& /Elements/SelectMatch, Name => "$field" . "Op" &> +" value=""SIZE=20> +% } + +% } +% } else { +<&|/l&><%$field%> + +<& /Elements/SelectMatch, Name => "$field" . "Op" &> + +" value="" SIZE=20> +% } + +% } +<& '/Elements/Callback', _CallbackName => 'EndOfList' &> +<%INIT> +my @fields = ('Attachment', + 'Queue', + 'Status', + 'People', + 'Dates', + 'Time', + 'Priority', + 'Links', + 'id', + ); + +my @people = ('Actor', + 'Watcher', + ); + diff --git a/rt/html/Search/Elements/PickCFs b/rt/html/Search/Elements/PickCFs new file mode 100644 index 000000000..fb143ba57 --- /dev/null +++ b/rt/html/Search/Elements/PickCFs @@ -0,0 +1,87 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 +% while ( my $CustomField = $CustomFields->Next ) { + + +% my $name; +% if ($CustomField->QueueObj->id) { +% $name = "'CF." . $CustomField->QueueObj->Name . +% ".{" . $CustomField->Name . "}'"; +% } else { +% $name = "'CF." . $CustomField->Name . "'"; +% } +<% $CustomField->Name %> + + +<& /Elements/SelectCustomFieldOperator, Name => $name . "Op", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', FalseVal => '!=' &> + + +<& /Elements/SelectCustomFieldValue, Name => "ValueOf" . $name, + CustomField => $CustomField, + &> + +% } + +<%INIT> +my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); +foreach (keys %cfqueues) { + my $id = $_; + $id =~ s/^.'*(.*).'*$/$1/; + # Gotta load up the $queue object, since queues get stored by name now. + my $queue = RT::Queue->new($session{'CurrentUser'}); + $queue->Load($id); + $CustomFields->LimitToQueue($queue->Id); +} +$CustomFields->LimitToGlobal(); + + + +<%ARGS> +%cfqueues => undef + diff --git a/rt/html/Search/Elements/PickCriteria b/rt/html/Search/Elements/PickCriteria new file mode 100644 index 000000000..344830e34 --- /dev/null +++ b/rt/html/Search/Elements/PickCriteria @@ -0,0 +1,74 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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/TitleBoxStart, title => loc('Add Criteria')&> + + + + + + + <& PickBasics &> + <& PickCFs, cfqueues => \%cfqueues &> + +
    + + + +
    + Aggregator: + <& SelectAndOr, Name => "AndOr" &> +
    +
    +
    +
     
    + +<& /Elements/TitleBoxEnd &> + +<%ARGS> +$addquery => 0 +$query => undef +%cfqueues => undef + diff --git a/rt/html/Search/Elements/SearchPrivacy b/rt/html/Search/Elements/SearchPrivacy new file mode 100644 index 000000000..5f6f207fe --- /dev/null +++ b/rt/html/Search/Elements/SearchPrivacy @@ -0,0 +1,53 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 + +% if (ref($Object) eq 'RT::User' && $Object->id == $session{'CurrentUser'}->Id) { +<&|/l&>My saved searches +% } else { +<&|/l, $Object->Name&>[_1]'s saved searches +% } diff --git a/rt/html/Search/Elements/SelectAndOr b/rt/html/Search/Elements/SelectAndOr new file mode 100644 index 000000000..11df03ff1 --- /dev/null +++ b/rt/html/Search/Elements/SelectAndOr @@ -0,0 +1,51 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 +AND +OR + +<%ARGS> +$Name => "Operator" + \ No newline at end of file diff --git a/rt/html/Search/Elements/SelectLinks b/rt/html/Search/Elements/SelectLinks new file mode 100644 index 000000000..b814e3088 --- /dev/null +++ b/rt/html/Search/Elements/SelectLinks @@ -0,0 +1,64 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 => 'LinksField' + + +<%INIT> +my @fields = ('HasMember', + 'MemberOf', + 'DependsOn', + 'DependentOn', + 'RefersTo', + 'ReferredToBy', + 'LinkedTo', + ); + diff --git a/rt/html/Search/Elements/SelectPersonType b/rt/html/Search/Elements/SelectPersonType new file mode 100644 index 000000000..01f389304 --- /dev/null +++ b/rt/html/Search/Elements/SelectPersonType @@ -0,0 +1,74 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 + + +<%INIT> +my @types; +if ($Scope =~ 'queue') { + @types = qw(Cc AdminCc); +} +else { + @types = qw(Requestor Cc AdminCc Watcher Owner); +} + +my @subtypes = qw(EmailAddress Name RealName Nickname Organization Address1 Address2 WorkPhone HomePhone MobilePhone PagerPhone); + + +<%ARGS> +$AllowNull => 1 +$Default=>undef +$Scope => 'ticket' +$Name => 'WatcherType' + diff --git a/rt/html/Search/Elements/SelectSearchObject b/rt/html/Search/Elements/SelectSearchObject new file mode 100644 index 000000000..6eaa680f8 --- /dev/null +++ b/rt/html/Search/Elements/SelectSearchObject @@ -0,0 +1,58 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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> +@Objects => undef +$Name => undef + + diff --git a/rt/html/Search/Elements/SelectSearchesForObjects b/rt/html/Search/Elements/SelectSearchesForObjects new file mode 100644 index 000000000..3f0c458cb --- /dev/null +++ b/rt/html/Search/Elements/SelectSearchesForObjects @@ -0,0 +1,63 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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> +@Objects => undef +$Name => undef + + diff --git a/rt/html/Search/Results.html b/rt/html/Search/Results.html new file mode 100755 index 000000000..dfcc7885c --- /dev/null +++ b/rt/html/Search/Results.html @@ -0,0 +1,136 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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, Refresh => $session{'tickets_refresh_interval'} &> +<& /Ticket/Elements/Tabs, + current_tab => "Search/Results.html".$QueryString, + Title => $title, + Format => $Format, + Query => $Query, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order &> +
    +<& /Elements/TicketList, + Query => $Query, + AllowSorting => 1, + OrderBy => $OrderBy, + Order => $Order, + Rows => $Rows, + Page => $Page, + Format => $Format, + BaseURL => $RT::WebPath."/Search/Results.html?" + + &> +
    +
    + + + + + + + +<& /Elements/Refresh, Name => 'TicketsRefreshInterval', Default => $session {'tickets_refresh_interval'} &> + +
    +
    +
    +<&|/l&>Update multiple tickets
    +<&|/l&>Bookmarkable link
    +<&|/l&>spreadsheet | +<&|/l&>RSS | +<&|/l&>Work offline
    +<& /Elements/Callback, _CallbackName => 'SearchActions', QueryString => $QueryString&> +
    +<%INIT> +my ($title, $ticketcount); +$session{'i'}++; +$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) unless ($session{'tickets'}); +$session{'tickets'}->FromSQL($Query) if ($Query); +$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); + +if ($OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'} + or $Order ne $session{'CurrentSearchHash'}->{'Order'}) { + $session{'CurrentSearchHash'}->{'OrderBy'} = $OrderBy; + $session{'CurrentSearchHash'}->{'Order'} = $Order; + # Invalidate the ordering cache + undef $session{'tickets'}->{'items_array'}; +} + + +if ( $session{'tickets'}->Query()) { + $ticketcount = $session{tickets}->CountAll(); + $title = loc('Found [quant,_1,ticket]', $ticketcount); +} else { + $title = loc("Find tickets"); +} + +my $QueryString = "?".$m->comp('/Elements/QueryString', + Query => $Query, + Format => $Format, + Rows => $Rows, + OrderBy => $OrderBy, + Order => $Order, + Page => $Page); + + +if ($ARGS{'TicketsRefreshInterval'}) { + $session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'}; +} + + +<%CLEANUP> +$session{'tickets'}->PrepForSerialization(); + +<%ARGS> +$Query => undef +$Format => undef +$HideResults => 0 +$Rows => 50 +$Page => 1 +$OrderBy => 'id' +$Order => 'ASC' + diff --git a/rt/html/Search/Results.rdf b/rt/html/Search/Results.rdf new file mode 100644 index 000000000..8054c8616 --- /dev/null +++ b/rt/html/Search/Results.rdf @@ -0,0 +1,85 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 +<%INIT> + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); +$r->content_type('application/rdf+xml'); + + + + # create an RSS 1.0 file (http://purl.org/rss/1.0/) + use XML::RSS; + my $rss = new XML::RSS (version => '1.0'); + $rss->channel( + title => "$RT::rtname: Syndicated Search", + link => $RT::WebURL, + description => "", + dc => { + }, + syn => { + updatePeriod => "hourly", + updateFrequency => "1", + updateBase => "1901-01-01T00:00+00:00", + }, + ); + + + while ( my $Ticket = $Tickets->Next()) { + my $row; + $rss->add_item( + title => $Ticket->Subject, + link => $RT::WebURL."/Ticket/Display.html?id=".$Ticket->id, + description => $Ticket->Transactions->First->Content, + dc => { + subject => $Ticket->Subject, + creator => $Ticket->CreatorObj->RealName . "<".$Ticket->CreatorObj->EmailAddress.">", + }, + ); + } +$m->out($rss->as_string); +$m->abort(); + diff --git a/rt/html/Search/Results.tsv b/rt/html/Search/Results.tsv new file mode 100644 index 000000000..631e299f0 --- /dev/null +++ b/rt/html/Search/Results.tsv @@ -0,0 +1,114 @@ +%# {{{ BEGIN BPS TAGGED BLOCK +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2004 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 +<%INIT> + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); + +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 ); + + $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; + if ($@) {die "Failed to find $attr - ". $@}; + } + + my $cfs = $Ticket->QueueObj->CustomFields(); + 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; + foreach my $attr (@attrs) { + my $label = $attr; + $label =~ s'Obj-.(AsString|Name|ISO)''g; + push @header, $label; + } + foreach my $id (sort keys %known_cfs) { + push @header, $known_cfs{$id}; + } + +$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"); +} + + +$m->abort(); + -- cgit v1.2.1 From e81cd66ea62231e89fbd30a95a0e5bdde2292eeb Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 3 Dec 2004 20:51:54 +0000 Subject: landing rt 3.2.2 --- rt/html/Search/Elements/PickRestriction | 142 ------------------------------- rt/html/Search/Elements/TicketHeader | 40 --------- rt/html/Search/Elements/TicketHeaderCell | 55 ------------ rt/html/Search/Elements/TicketRow | 55 ------------ rt/html/Search/Listing.html | 113 ------------------------ 5 files changed, 405 deletions(-) delete mode 100644 rt/html/Search/Elements/PickRestriction delete mode 100644 rt/html/Search/Elements/TicketHeader delete mode 100644 rt/html/Search/Elements/TicketHeaderCell delete mode 100644 rt/html/Search/Elements/TicketRow delete mode 100644 rt/html/Search/Listing.html (limited to 'rt/html/Search') diff --git a/rt/html/Search/Elements/PickRestriction b/rt/html/Search/Elements/PickRestriction deleted file mode 100644 index ff9b86ba5..000000000 --- a/rt/html/Search/Elements/PickRestriction +++ /dev/null @@ -1,142 +0,0 @@ -%# BEGIN LICENSE BLOCK -%# -%# Copyright (c) 1996-2003 Jesse Vincent -%# -%# (Except where explictly superceded by other copyright notices) -%# -%# 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. -%# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. -%# -%# -%# END LICENSE BLOCK -
    - -<& /Elements/TitleBoxStart, title => loc('Refine search')&> - - -
      -
    • <&|/l&>Owner is <& /Elements/SelectBoolean, Name => "OwnerOp", - TrueVal=> '=', - FalseVal => '!=' -&> -<& /Elements/SelectOwner, Name => "ValueOfOwner" &> - -
    • -<& /Elements/SelectWatcherType, Name => "WatcherRole", AllowNull => 0 &> -<&|/l&>email address -<& /Elements/SelectMatch, Name => "WatcherRoleOp" &> - - -
    • -<&|/l&>Subject <& /Elements/SelectMatch, Name => "SubjectOp" &> - - -
    • <&|/l&>Queue <& /Elements/SelectBoolean, Name => "QueueOp" , - True => loc("is"), - False => loc("isn't"), - TrueVal=> '=', - FalseVal => '!=' &> -<& /Elements/SelectQueue, Name => "ValueOfQueue" &> - - -
    • <&|/l&>Priority <& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> - - - -
    • -<& /Elements/SelectDateType, Name => 'DateType' &> -<& /Elements/SelectDateRelation, Name=>"DateOp" &> -<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &> - -
    • <&|/l&>Ticket attachment - -<& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> -<& /Elements/SelectBoolean, Name => "AttachmentFieldOp", - True => loc("matches"), - False => loc("does not match"), - TrueVal => 'LIKE', - FalseVal => 'NOT LIKE' -&> - - -
    • <&|/l&>Status -<& /Elements/SelectBoolean, Name => "StatusOp", - True => loc("is"), - False => loc("isn't"), - TrueVal=> '=', - FalseVal => '!=' -&> -<& /Elements/SelectStatus, Name => "ValueOfStatus", SkipDeleted => 1 &> - - -% while ( my $CustomField = $CustomFields->Next ) { - -
    • <% $CustomField->Name %> - <& /Elements/SelectCustomFieldOperator, Name => "CustomFieldOp". $CustomField->id, - True => loc("is"), - False => loc("isn't"), - TrueVal=> '=', FalseVal => '!=' &> - -<& /Elements/SelectCustomFieldValue, Name => "CustomField".$CustomField->id, - CustomField => $CustomField, - &> -% } - -
    - -<& /Elements/TitleBoxEnd &> - -<& /Elements/TitleBoxStart, title => loc('Ordering and sorting')&> - -
      - -
    • <&|/l&>Results per page <& /Elements/SelectResultsPerPage, Name => "RowsPerPage", - Default => $session{'tickets_rows_per_page'} || '50' -&> - -
    • <&|/l&>Sort results by <& /Elements/SelectTicketSortBy, Name => "TicketsSortBy", - Default => $session{'tickets_sort_by'} -&> -<& /Elements/SelectSortOrder, Name => 'TicketsSortOrder', Default => $session{'tickets_sort_order'} &> - -
    • > <&|/l&>Don't show search results -
    • <& /Elements/Refresh, Name => 'RefreshSearchInterval' , Default => $session{'tickets_refresh_interval'} &> - -
    - - - - - - -<& /Elements/TitleBoxEnd &> - -<& /Elements/Submit, Label => loc('Search'), Name => 'Action'&> - -
    - - - <%INIT> -my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); - foreach ( $session{'tickets'}->RestrictionValues('Queue') ) { - # Gotta load up the $queue object, since queues get stored by name now. - my $queue = RT::Queue->new($session{'CurrentUser'}); - $queue->Load($_); - $CustomFields->LimitToQueue($queue->Id); - } - - $CustomFields->LimitToGlobal(); - - diff --git a/rt/html/Search/Elements/TicketHeader b/rt/html/Search/Elements/TicketHeader deleted file mode 100644 index ed2f60e4e..000000000 --- a/rt/html/Search/Elements/TicketHeader +++ /dev/null @@ -1,40 +0,0 @@ -%# BEGIN LICENSE BLOCK -%# -%# Copyright (c) 1996-2003 Jesse Vincent -%# -%# (Except where explictly superceded by other copyright notices) -%# -%# 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. -%# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. -%# -%# -%# END LICENSE BLOCK - -<& TicketHeaderCell , Attribute => 'id', Header => '#'&> -<& TicketHeaderCell , Attribute => 'Subject'&> -<& TicketHeaderCell , Attribute => 'Status'&> -<& TicketHeaderCell , Attribute => 'Queue'&> -<& TicketHeaderCell , Attribute => 'Owner'&> -<& TicketHeaderCell , Attribute => 'Priority'&> - - -  -<& TicketHeaderCell , Attribute => 'Requestor(s)'&> -<& TicketHeaderCell , Attribute => 'Created'&> -<& TicketHeaderCell , Attribute => 'Told', Header => 'Last Contact'&> -<& TicketHeaderCell , Attribute => 'LastUpdated', Header => 'Last Updated'&> -<& TicketHeaderCell , Attribute => 'TimeLeft', Header => 'Left'&> - -%# loc('Last Notified'); diff --git a/rt/html/Search/Elements/TicketHeaderCell b/rt/html/Search/Elements/TicketHeaderCell deleted file mode 100644 index 5def9ea37..000000000 --- a/rt/html/Search/Elements/TicketHeaderCell +++ /dev/null @@ -1,55 +0,0 @@ -%# BEGIN LICENSE BLOCK -%# -%# Copyright (c) 1996-2003 Jesse Vincent -%# -%# (Except where explictly superceded by other copyright notices) -%# -%# 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. -%# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. -%# -%# -%# END LICENSE BLOCK -<%INIT> -my ($order,$curorder); - $Attribute =~ s/Obj->(Name|AsString|AgeAsString)//g; - if ($session{'tickets_sort_order'} =~ /^asc$/i) { - $order = 'DESC'; - $curorder = 'ASC'; - } else { - $order = 'ASC'; - $curorder = 'DESC'; - } -$Header = $Attribute unless ($Header); - - - -% if (grep (/^$Attribute$/i, $session{'tickets'}->SortFields)) { - -% } else { -HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|u%>&TicketsSortBy=<%$Attribute%>&TicketsSortOrder=<%$curorder%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>"> -% } -<% loc($Header) %> - -% } else { -<% loc($Header) %> -% } - -<%ARGS> -$Header => undef -$Attribute => undef - diff --git a/rt/html/Search/Elements/TicketRow b/rt/html/Search/Elements/TicketRow deleted file mode 100644 index 5d1ad209a..000000000 --- a/rt/html/Search/Elements/TicketRow +++ /dev/null @@ -1,55 +0,0 @@ -%# BEGIN LICENSE BLOCK -%# -%# Copyright (c) 1996-2003 Jesse Vincent -%# -%# (Except where explictly superceded by other copyright notices) -%# -%# 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. -%# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. -%# -%# -%# END LICENSE BLOCK - - -<%$Ticket->id%> -<%$Ticket->Subject%> -<%loc($Ticket->Status)%> -<%$Ticket->QueueObj->Name%> -<%$Ticket->Owner == $RT::Nobody->Id ? loc('Nobody') : $Ticket->OwnerObj->Name%> -<%$Ticket->Priority%> - -<%$Ticket->Requestors->MemberEmailAddressesAsString%> -<%$Ticket->CreatedObj->AgeAsString || '-'%> -<%$Ticket->ToldObj->AgeAsString || '-'%> -<%$Ticket->LastUpdatedObj->AgeAsString || '-'%> -<%$Ticket->TimeLeft%> - - -<%ARGS> -$Ticket => undef -$i => undef - diff --git a/rt/html/Search/Listing.html b/rt/html/Search/Listing.html deleted file mode 100644 index 68b1fd75c..000000000 --- a/rt/html/Search/Listing.html +++ /dev/null @@ -1,113 +0,0 @@ -%# BEGIN LICENSE BLOCK -%# -%# Copyright (c) 1996-2003 Jesse Vincent -%# -%# (Except where explictly superceded by other copyright notices) -%# -%# 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. -%# -%# Unless otherwise specified, all modifications, corrections or -%# extensions to this work which alter its source code become the -%# property of Best Practical Solutions, LLC when submitted for -%# inclusion in the work. -%# -%# -%# END LICENSE BLOCK -<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> -<& /Ticket/Elements/Tabs, - current_tab => 'Search/Listing.html', - Title => $title &> - -%if ($ticketcount && ! $ARGS{'HideResults'}) { - -<& Elements/TicketHeader, %ARGS &> -% my $i; -%while (my $Ticket = $session{'tickets'}->Next) { -% $i++; -<& Elements/TicketRow, Ticket => $Ticket, i=> $i, %ARGS &> -%} -
    -
    - -<&|/l&>First page -   -% if ( $session{'tickets'}->FirstRow >= $session{'tickets_rows_per_page'}-1 ) { -<<&|/l&>Previous page -   -% } -% if ( $session{'tickets'}->FirstRow + $session{'tickets_rows_per_page'} < $ticketcount ) { -<&|/l&>Next page> -% } -%#  
    <&|/l&>Goto page
    -
    -
    - - - - - - -
    -(<&|/l, ($session{'tickets'}->FirstRow+1), ($session{'tickets'}->FirstRow() + $session{'tickets'}->RowsPerPage() ) &>[_1] - [_2] shown) - - -<&|/l&>Update all these tickets at once - -
    - -% } - - - - - -
    -<& /Elements/TitleBoxStart, title => loc('Current search criteria')&> - -%my %restrictions=$session{'tickets'}->DescribeRestrictions(); -%foreach my $row (keys %restrictions){ -<%$restrictions{"$row"}%> [<&|/l&>delete]
    -%} -
    -
    -<&|/l&>Bookmarkable URL for this search -<& /Elements/TitleBoxEnd&> -
    - -<& Elements/PickRestriction, %ARGS &> - -
    - -<%INIT> - -my ($title, $ticketcount); -$session{'i'}++; -if ($session{'tickets'}) { - if ($ARGS{'DeleteRestriction'}) { - $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'}); - } - if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) { - $session{'tickets'}->ClearRestrictions; - $session{'tickets'}->CleanSlate; - } -} - ProcessSearchQuery(ARGS=>\%ARGS); - $session{'tickets'}->RedoSearch(); - if ( $session{'tickets'}->DescribeRestrictions()) { - $ticketcount = $session{tickets}->CountAll(); - $title = loc('Found [quant,_1,ticket]', $ticketcount); - } else { - $title = loc("Find tickets"); - } - -<%CLEANUP> -$session{'tickets'}->PrepForSerialization(); - -- cgit v1.2.1 From d4d0590bef31071e8809ec046717444b95b3f30a Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 15 Oct 2005 09:11:20 +0000 Subject: import rt 3.4.4 --- rt/html/Search/Build.html | 746 ++++++++++++----------- rt/html/Search/Bulk.html | 75 +-- rt/html/Search/Edit.html | 6 +- rt/html/Search/Elements/BuildFormatString | 196 +++--- rt/html/Search/Elements/DisplayOptions | 17 +- rt/html/Search/Elements/EditFormat | 60 +- rt/html/Search/Elements/EditQuery | 65 ++ rt/html/Search/Elements/EditSearches | 18 +- rt/html/Search/Elements/NewListActions | 6 +- rt/html/Search/Elements/PickBasics | 189 +++--- rt/html/Search/Elements/PickCFs | 31 +- rt/html/Search/Elements/PickCriteria | 20 +- rt/html/Search/Elements/SearchPrivacy | 6 +- rt/html/Search/Elements/SelectAndOr | 12 +- rt/html/Search/Elements/SelectGroup | 65 ++ rt/html/Search/Elements/SelectLinks | 8 +- rt/html/Search/Elements/SelectPersonType | 22 +- rt/html/Search/Elements/SelectSearchObject | 6 +- rt/html/Search/Elements/SelectSearchesForObjects | 9 +- rt/html/Search/Results.html | 30 +- rt/html/Search/Results.rdf | 6 +- rt/html/Search/Results.tsv | 9 +- 22 files changed, 901 insertions(+), 701 deletions(-) create mode 100644 rt/html/Search/Elements/EditQuery create mode 100644 rt/html/Search/Elements/SelectGroup (limited to 'rt/html/Search') diff --git a/rt/html/Search/Build.html b/rt/html/Search/Build.html index bbf2a1de9..cb6462651 100644 --- a/rt/html/Search/Build.html +++ b/rt/html/Search/Build.html @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,27 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} +%# +%# Data flow here: +%# The page receives a Query from the previous page, and maybe arguments +%# corresponding to actions. (If it doesn't get a Query argument, it pulls +%# one out of the session hash. Also, it could be getting just a raw query from +%# Build/Edit.html (Advanced).) +%# +%# After doing some stuff with default arguments and saved searches, the ParseQuery +%# function (which is similar to, but not the same as, _parser in RT/Tickets_Overlay_SQL) +%# converts the Query into a RT::Interface::Web::QueryBuilder::Tree. This mason file +%# then adds stuff to or modifies the tree based on the actions that had been requested +%# by clicking buttons. It then calls GetQueryAndOptionList on the tree to generate +%# the SQL query (which is saved as a hidden input) and the option list for the Clauses +%# box in the top right corner. +%# +%# Worthwhile refactoring: the tree manipulation code for the actions could use some cleaning +%# up. The node-adding code is different in the "add" actions from in ParseQuery, which leads +%# to things like ParseQuery correctly not quoting numbers in numerical fields, while the "add" +%# action does quote it (this breaks SQLite). +%# <& /Elements/Header, Title => $title &> <& /Ticket/Elements/Tabs, current_tab => "Search/Build.html".$QueryString, @@ -58,36 +78,28 @@ - - -
    -<& Elements/PickCriteria, query => $Query, cfqueues => \%queues &> + + + + - + + + + + + +
    +<& Elements/PickCriteria, query => $Query, cfqueues => $queues &> <& /Elements/Submit, Caption => loc('Add additional criteria'), Label => loc('Add'), Name => 'AddClause'&> + +<& Elements/EditQuery, + %ARGS, + actions => \@actions, + optionlist => $optionlist, + Description => $Description &> -<& /Elements/TitleBoxStart, title => loc("Query") . ": " .$Description &> -<& Elements/NewListActions, actions => \@actions &> - -
    -
    - - - - - -
    - - -%# -
    -<& /Elements/TitleBoxEnd &> -
    +
    <& Elements/EditSearches, CurrentSearch => $search_hash, Dirty => $dirty, SearchId => $SearchId &>
    @@ -95,27 +107,35 @@ AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy, Order => $Order &>
    +<& /Elements/Submit, Caption => loc("Do the Search"), Label => loc('Search'), Name => 'DoSearch'&> +
    <%INIT> -use Tree::Simple; +use RT::Interface::Web::QueryBuilder; +use RT::Interface::Web::QueryBuilder::Tree; my $search_hash = {}; my $search; my $title = loc("Query Builder"); # {{{ Clear out unwanted data -if ($NewQuery or $ARGS{'Delete'}) { +if ( $NewQuery or $ARGS{'Delete'} ) { + # Wipe all data-carrying variables clear if we want a new # search, or we're deleting an old one.. - $Query = ''; - $Format = ''; + $Query = ''; + $Format = ''; $Description = ''; - $SearchId = ''; - $Order = ''; - $OrderBy = ''; + $SearchId = ''; + $Order = ''; + $OrderBy = ''; $RowsPerPage = ''; + # ($search hasn't been set yet; no need to clear) # ..then wipe the session out.. @@ -124,6 +144,7 @@ if ($NewQuery or $ARGS{'Delete'}) { # ..and the search results. $session{'tickets'}->CleanSlate() if defined $session{'tickets'}; } + # }}} # {{{ Attempt to load what we can from the session, set defaults @@ -133,61 +154,71 @@ $search_hash = $session{'CurrentSearchHash'}; # These variables are what define a search_hash; this is also # where we give sane defaults. -$Query ||= $search_hash->{'Query'}; -$Format ||= $search_hash->{'Format'}; +$Query ||= $search_hash->{'Query'}; +$Format ||= $search_hash->{'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); +$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'}; + # }}} my @actions = (); -my %queues; # Clean unwanted junk from the format -$Format = $m->comp('/Elements/ScrubHTML', Content => $Format) if ($Format); +$Format = $m->comp( '/Elements/ScrubHTML', Content => $Format ) if ($Format); # {{{ If we're asked to delete the current search, make it go away and reset the search parameters 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; + 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'}); + 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); - } + 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 + ); + } } } + # }}} # {{{ If the user wants to copy a search, uncouple from the one that this was based on, but don't erase the $Query or $Format if ( $ARGS{'CopySearch'} ) { - $SearchId = 'new'; - $search = undef; - $Description = loc("[_1] copy", $Description); + $SearchId = 'new'; + $search = undef; + $Description = loc( "[_1] copy", $Description ); } + # }}} # {{{ if we're asked to revert the current search, we just want to load it if ( $ARGS{'Revert'} ) { $ARGS{'LoadSavedSearch'} = $SearchId; } + # }}} # {{{ if we're asked to load a search, load it. @@ -196,15 +227,18 @@ 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); - + 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'}); + elsif ( $obj_type eq 'RT::Group' ) { + my $group = RT::Group->new( $session{'CurrentUser'} ); $group->Load($obj_id); $search = $group->Attributes->WithId($search_id); } @@ -231,260 +265,227 @@ if ( $actions[0] ) { $m->abort(); } -my @options; -my $optionlist; $Query = ""; -%queues = (); -# Build the optionlist from the tree, so we can do additions and movements based on it -$optionlist = build_array( \$Query, $ARGS{clauses}, $tree, \@options, \%queues ); +my @options = $tree->GetDisplayedNodes; -my $currentkey; -$currentkey = $options[$ARGS{clauses}] if defined $ARGS{clauses}; +my @current_values = grep { defined } @options[@clauses]; # {{{ Try to find if we're adding a clause foreach my $arg ( keys %ARGS ) { - if ( $arg =~ m/ValueOf(.+)/ && $ARGS{$arg} ne "") { - # We're adding a $1 clause - my $field = $1; - my ($keyword, $op, $value); - - #figure out if it's a grouping - if ( $ARGS{ $field . "Field" } ) { - $keyword = $ARGS{ $field . "Field" }; - } - else { - $keyword = $field; - } - - $value = $ARGS{'ValueOf' . $field}; - $op = $ARGS{ $field . 'Op' }; - if ( $value eq 'NULL' && $op =~ /=/) { - if ($op eq '=') { - $op = "IS"; - } elsif ($op eq '!=') { - $op = "IS NOT"; - } + if ( + $arg =~ m/^ValueOf(.+)/ + && ( ref $ARGS{$arg} eq "ARRAY" + ? grep { $_ ne "" } @{ $ARGS{$arg} } + : $ARGS{$arg} ne "" ) + ) + { - # This isn't "right", but... - # It has to be this way until #5182 is fixed - $value = "'NULL'"; - } else { - $value = "'$value'"; + # We're adding a $1 clause + my $field = $1; + my ( $keyword, $op, $value ); + + #figure out if it's a grouping + if ( $ARGS{ $field . "Field" } ) { + $keyword = $ARGS{ $field . "Field" }; + } + else { + $keyword = $field; } - my $clause = { - Key => $keyword, - Op => $op, - Value => $value - }; - - my $newnode = Tree::Simple->new($clause); - if ($currentkey) { - my $newindex = $currentkey->getIndex() + 1; - if (!$currentkey->getParent->getParent()->isRoot()) { - } - $currentkey->insertSibling($newindex, $newnode); - $currentkey = $newnode; - } - else { - $tree->getChild(0)->addChild($newnode); - $currentkey = $newnode; - } - $newnode->getParent()->setNodeValue($ARGS{'AndOr'}); + my ( @ops, @values ); + if ( ref $ARGS{ 'ValueOf' . $field } eq "ARRAY" ) { + + # we have many keys/values to iterate over, because there is + # more than one CF with the same name. + @ops = @{ $ARGS{ $field . 'Op' } }; + @values = @{ $ARGS{ 'ValueOf' . $field } }; + } + else { + @ops = ( $ARGS{ $field . 'Op' } ); + @values = ( $ARGS{ 'ValueOf' . $field } ); + } + $RT::Logger->error("Bad Parameters passed into Query Builder") + unless @ops == @values; + + for my $i ( 0 .. @ops - 1 ) { + my ( $op, $value ) = ( $ops[$i], $values[$i] ); + next if $value eq ""; + + if ( $value eq 'NULL' && $op =~ /=/ ) { + if ( $op eq '=' ) { + $op = "IS"; + } + elsif ( $op eq '!=' ) { + $op = "IS NOT"; + } + + # This isn't "right", but... + # It has to be this way until #5182 is fixed + $value = "'NULL'"; + } + else { + $value = "'$value'"; + } + + my $clause = { + Key => $keyword, + Op => $op, + Value => $value + }; + + my $newnode = RT::Interface::Web::QueryBuilder::Tree->new($clause); + if (@current_values) { + foreach my $value (@current_values) { + my $newindex = $value->getIndex() + 1; + $value->insertSibling( $newindex, $newnode ); + $value = $newnode; + } + } + else { + $tree->getChild(0)->addChild($newnode); + @current_values = $newnode; + } + $newnode->getParent()->setNodeValue( $ARGS{'AndOr'} ); + } } } + # }}} # {{{ Move things around if ( $ARGS{"Up"} ) { - if ($currentkey) { - my $index = $currentkey->getIndex(); - if ( $currentkey->getIndex() > 0 ) { - my $parent = $currentkey->getParent(); - $parent->removeChild($index); - $parent->insertChild($index - 1, $currentkey); - $currentkey = $parent->getChild($index - 1); - } - else { - push( @actions, [ "error: can't move up", -1 ] ); + if (@current_values) { + foreach my $value (@current_values) { + my $index = $value->getIndex(); + if ( $value->getIndex() > 0 ) { + my $parent = $value->getParent(); + $parent->removeChild($index); + $parent->insertChild( $index - 1, $value ); + $value = $parent->getChild( $index - 1 ); + } + else { + push( @actions, [ loc("error: can't move up"), -1 ] ); + } } } else { - push( @actions, [ "error: nothing to move", -1 ] ); + push( @actions, [ loc("error: nothing to move"), -1 ] ); } } elsif ( $ARGS{"Down"} ) { - if ($currentkey) { - my $index = $currentkey->getIndex(); - my $parent = $currentkey->getParent(); - if ( $currentkey->getIndex() < ($parent->getChildCount - 1) ) { - $parent->removeChild($index); - $parent->insertChild($index + 1, $currentkey); - $currentkey = $parent->getChild($index + 1); - } - else { - push( @actions, [ "error: can't move down", -1 ] ); + if (@current_values) { + foreach my $value (@current_values) { + my $index = $value->getIndex(); + my $parent = $value->getParent(); + if ( $value->getIndex() < ( $parent->getChildCount - 1 ) ) { + $parent->removeChild($index); + $parent->insertChild( $index + 1, $value ); + $value = $parent->getChild( $index + 1 ); + } + else { + push( @actions, [ loc("error: can't move down"), -1 ] ); + } } } else { - push( @actions, [ "error: nothing to move", -1 ] ); + push( @actions, [ loc("error: nothing to move"), -1 ] ); } } elsif ( $ARGS{"Left"} ) { - if ($currentkey) { - my $parent = $currentkey->getParent(); - my $grandparent = $parent->getParent(); - if (!$grandparent->isRoot) { - my $index = $parent->getIndex(); - $parent->removeChild($currentkey); - $grandparent->insertChild($index, $currentkey); - if ($parent->isLeaf()) { - $grandparent->removeChild($parent); - } - } - else { - push( @actions, [ "error: can't move left", -1 ] ); + if (@current_values) { + foreach my $value (@current_values) { + my $parent = $value->getParent(); + my $grandparent = $parent->getParent(); + if ( !$grandparent->isRoot ) { + my $index = $parent->getIndex(); + $parent->removeChild($value); + $grandparent->insertChild( $index, $value ); + if ( $parent->isLeaf() ) { + $grandparent->removeChild($parent); + } + } + else { + push( @actions, [ loc("error: can't move left"), -1 ] ); + } } } else { - push( @actions, [ "error: nothing to move", -1 ] ); + push( @actions, [ loc("error: nothing to move"), -1 ] ); } } elsif ( $ARGS{"Right"} ) { - if ($currentkey) { - my $parent = $currentkey->getParent(); - my $index = $currentkey->getIndex(); - my $newparent; - if ($index > 0 ) { - my $sibling = $parent->getChild($index - 1); - if (ref($sibling->getNodeValue)) { - $parent->removeChild($currentkey); - my $newtree = Tree::Simple->new('AND', $parent); - $newtree->addChild($currentkey); - } else { - $parent->removeChild($index); - $sibling->addChild($currentkey); - } - } - else { - $parent->removeChild($currentkey); - $newparent = Tree::Simple->new('AND', $parent); - $newparent->addChild($currentkey); - } - } else { - push( @actions, [ "error: nothing to move", -1 ] ); + if (@current_values) { + foreach my $value (@current_values) { + my $parent = $value->getParent(); + my $index = $value->getIndex(); + my $newparent; + if ( $index > 0 ) { + my $sibling = $parent->getChild( $index - 1 ); + if ( ref( $sibling->getNodeValue ) ) { + $parent->removeChild($value); + my $newtree = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $parent ); + $newtree->addChild($value); + } + else { + $parent->removeChild($index); + $sibling->addChild($value); + } + } + else { + $parent->removeChild($value); + $newparent = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $parent ); + $newparent->addChild($value); + } + } + } + else { + push( @actions, [ loc("error: nothing to move"), -1 ] ); } } elsif ( $ARGS{"DeleteClause"} ) { - if ($currentkey) { - $currentkey->getParent()->removeChild($currentkey); + if (@current_values) { + $_->getParent()->removeChild($_) for @current_values; } else { - push( @actions, [ "error: nothing to delete", -1 ] ); + push( @actions, [ loc("error: nothing to delete"), -1 ] ); } } elsif ( $ARGS{"Toggle"} ) { my $ea; - if ($currentkey) { - my $value = $currentkey->getNodeValue(); - my $parent = $currentkey->getParent(); - my $parentvalue = $parent->getNodeValue(); - - if ( $parentvalue eq 'AND') { - $parent->setNodeValue('OR'); - } - else { - $parent->setNodeValue('AND'); - } + if (@current_values) { + foreach my $value (@current_values) { + my $parent = $value->getParent(); + + if ( $parent->getNodeValue eq 'AND' ) { + $parent->setNodeValue('OR'); + } + else { + $parent->setNodeValue('AND'); + } + } } else { - push( @actions, [ "error: nothing to toggle", -1 ] ); + push( @actions, [ loc("error: nothing to toggle"), -1 ] ); } } -elsif ( $ARGS{"Clear"} ) { - $tree = Tree::Simple->new(Tree::Simple->ROOT); -} + +$tree->PruneChildlessAggregators; + # }}} # {{{ Rebuild $Query based on the additions / movements -$Query = ""; -@options = (); -%queues = (); -$optionlist = build_array( \$Query, $currentkey, $tree, \@options, \%queues ); - -sub build_array { - my $Query = shift; - my $currentkey = shift; - my $tree = shift; - my ($keys, $queues) = @_; - my $i = 0; - my $optionlist; - my $depth = 0; - my %parens; - - $tree->traverse( sub { - my ($_tree) = @_; - - return if $_tree->getParent->isRoot(); - - push @$keys, $_tree; - my $clause = $_tree->getNodeValue(); - my $str; - my $ea = $_tree->getParent()->getNodeValue(); - if (ref($clause)) { - $str .= $ea . " " if $_tree->getIndex() > 0; - $str .= $clause->{Key} . " " . $clause->{Op} . " " . $clause->{Value}; - - if ( $clause->{Key} eq "Queue" ) { - $queues->{ $clause->{Value} } = 1; - } - } else { - $str = $ea if $_tree->getIndex() > 0; - } - - my $selected; - if ($_tree == $currentkey) { - $selected = "SELECTED"; - } - else { - $selected = ""; - } - - foreach my $p (keys %parens) { - if ($p > $_tree->getDepth) { - $$Query .= ')' x $parens{$p}; - $parens{$p}--; - } - } - - $optionlist .= "\n"; - my $parent = $_tree->getParent(); - if (!($parent->isRoot || $parent->getParent()->isRoot) && - !ref($parent->getNodeValue())) { - if ( $_tree->getIndex() == 0) { - $$Query .= '('; - $parens{$_tree->getDepth}++; - } - } - $$Query .= " " . $str . " "; - - if ($_tree->getDepth < $depth) { - $$Query .= ')'; - $parens{$depth}--; - } - - $i++; - }); - - foreach my $p (keys %parens) { - $$Query .= ") " x $parens{$p}; - } +$Query = ""; +my $optionlist_arrayref; + +($Query, $optionlist_arrayref) = $tree->GetQueryAndOptionList(\@current_values); + +my $optionlist = join "\n", map { qq() } @$optionlist_arrayref; + - return $optionlist; -} use Regexp::Common qw /delimited/; @@ -496,18 +497,18 @@ use constant PAREN => 8; use constant KEYWORD => 16; sub ParseQuery { - my $string = shift; - my $tree = shift; + my $string = shift; + my $tree = shift; my @actions = shift; - my $want = KEYWORD | PAREN; - my $last = undef; + my $want = KEYWORD | PAREN; + my $last = undef; my $depth = 1; # make a tree root - $$tree = Tree::Simple->new(Tree::Simple->ROOT); - my $root = Tree::Simple->new('AND', $$tree); - my $lastnode = $root; + $$tree = RT::Interface::Web::QueryBuilder::Tree->new; + my $root = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $$tree ); + my $lastnode = $root; my $parentnode = $root; # get the FIELDS from Tickets_Overlay @@ -521,17 +522,20 @@ sub ParseQuery { my $re_aggreg = qr[(?i:AND|OR)]; my $re_value = qr[$RE{delimited}{-delim=>qq{\'\"}}|\d+]; my $re_keyword = qr[$RE{delimited}{-delim=>qq{\'\"}}|(?:\{|\}|\w|\.)+]; - my $re_op = qr[=|!=|>=|<=|>|<|(?i:IS NOT)|(?i:IS)|(?i:NOT LIKE)|(?i:LIKE)] ; # long to short + my $re_op = + qr[=|!=|>=|<=|>|<|(?i:IS NOT)|(?i:IS)|(?i:NOT LIKE)|(?i:LIKE)] + ; # long to short my $re_paren = qr'\(|\)'; - # assume that $ea is AND if it's not set + # assume that $ea is AND if it is not set my ( $ea, $key, $op, $value ) = ( "AND", "", "", "" ); # order of matches in the RE is important.. op should come early, # because it has spaces in it. otherwise "NOT LIKE" might be parsed # as a keyword or value. - while ( $string =~ /( + while ( + $string =~ /( $re_aggreg |$re_op |$re_keyword @@ -556,7 +560,15 @@ sub ParseQuery { # Error # FIXME: I will only print out the highest $want value my $token = $tokens[ ( ( log $want ) / ( log 2 ) ) ]; - push @actions, [ "current: $current, want $want, Error near ->$val<- expecting a " . $token . " in '$string'\n", -1 ]; + push @actions, + [ + loc( +"current: $current, want $want, Error near ->$val<- expecting a " + . $token + . " in '$string'\n" + ), + -1 + ]; } # State Machine: @@ -565,20 +577,21 @@ sub ParseQuery { # Parens are highest priority if ( $current & PAREN ) { if ( $val eq "(" ) { - $depth++; - # make a new node that the clauses can be children of - $parentnode = Tree::Simple->new($ea, $parentnode); + $depth++; + + # make a new node that the clauses can be children of + $parentnode = RT::Interface::Web::QueryBuilder::Tree->new( $ea, $parentnode ); } else { - $depth--; - $parentnode = $parentnode->getParent(); - $lastnode = $parentnode; + $depth--; + $parentnode = $parentnode->getParent(); + $lastnode = $parentnode; } $want = KEYWORD | PAREN | AGGREG; } elsif ( $current & AGGREG ) { - $ea = $val; + $ea = $val; $want = KEYWORD | PAREN; } elsif ( $current & KEYWORD ) { @@ -616,27 +629,27 @@ sub ParseQuery { $val = "'$val'"; } - push @actions, [ "Unknown field: $key", -1 ] unless $class; + push @actions, [ loc("Unknown field: $key"), -1 ] unless $class; $want = PAREN | AGGREG; } else { - push @actions, [ "I'm lost", -1 ]; + push @actions, [ loc("I'm lost"), -1 ]; } if ( $current & VALUE ) { - if ( $key =~ /^CF./ ) { - $key = "'" . $key . "'"; - } + if ( $key =~ /^CF./ ) { + $key = "'" . $key . "'"; + } my $clause = { Key => $key, Op => $op, Value => $val }; - # explicity add a child to it - $lastnode = Tree::Simple->new($clause, $parentnode); - $lastnode->getParent()->setNodeValue($ea); + # explicity add a child to it + $lastnode = RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode ); + $lastnode->getParent()->setNodeValue($ea); ( $ea, $key, $op, $value ) = ( "", "", "", "" ); } @@ -644,14 +657,14 @@ sub ParseQuery { $last = $current; } # while - push @actions, [ "Incomplete query", -1 ] + push @actions, [ loc("Incomplete query"), -1 ] unless ( ( $want | PAREN ) || ( $want | KEYWORD ) ); - push @actions, [ "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, [ "Mismatched parentheses", -1 ] + push @actions, [ loc("Mismatched parentheses"), -1 ] unless $depth == 1; } @@ -667,24 +680,32 @@ sub _match { sub debug { my $message = shift; - $m->print($message . "
    "); + $m->print( $message . "
    " ); } # }}} # }}} +my $queues = $tree->GetReferencedQueues; + # {{{ Deal with format changes -my ($AvailableColumns, $CurrentFormat); -($Format, $AvailableColumns, $CurrentFormat) = $m->comp('Elements/BuildFormatString', cfqueues => \%queues, %ARGS, Format => $Format); +my ( $AvailableColumns, $CurrentFormat ); +( $Format, $AvailableColumns, $CurrentFormat ) = $m->comp( + 'Elements/BuildFormatString', + cfqueues => $queues, + %ARGS, Format => $Format +); + # }}} # {{{ 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 + 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, @@ -692,83 +713,102 @@ if ( $ARGS{'Save'} ) { OrderBy => $OrderBy, RowsPerPage => $RowsPerPage, ); - $search->SetDescription( $Description ); + $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 + # 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) { + 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'}); + 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]; + 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]; + 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 if defined $search and - ($search->SubValue('Format') ne $Format or - $search->SubValue('Query') ne $Query or - $search->SubValue('Order') ne $Order or - $search->SubValue('OrderBy') ne $OrderBy or - $search->SubValue('RowsPerPage') ne $RowsPerPage); +$dirty = 1 + if defined $search + and ($search->SubValue('Format') ne $Format + or $search->SubValue('Query') ne $Query + or $search->SubValue('Order') ne $Order + or $search->SubValue('OrderBy') ne $OrderBy + or $search->SubValue('RowsPerPage') ne $RowsPerPage ); + # }}} # {{{ Push the updates into the session so we don't loose 'em -$search_hash->{'SearchId'} = $SearchId; -$search_hash->{'Format'} = $Format; -$search_hash->{'Query'} = $Query; +$search_hash->{'SearchId'} = $SearchId; +$search_hash->{'Format'} = $Format; +$search_hash->{'Query'} = $Query; $search_hash->{'Description'} = $Description; -$search_hash->{'Object'} = $search; -$search_hash->{'Order'} = $Order; -$search_hash->{'OrderBy'} = $OrderBy; +$search_hash->{'Object'} = $search; +$search_hash->{'Order'} = $Order; +$search_hash->{'OrderBy'} = $OrderBy; $search_hash->{'RowsPerPage'} = $RowsPerPage; $session{'CurrentSearchHash'} = $search_hash; + # }}} # {{{ Show the results, if we were asked. if ( $ARGS{"DoSearch"} ) { - $m->comp("Results.html" , Query => $Query, Format => $Format, Order => $Order, OrderBy => $OrderBy, Rows => $RowsPerPage); + $m->comp( + "Results.html", + Query => $Query, + Format => $Format, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage + ); $m->abort(); } + # }}} # {{{ Build a querystring for the tabs @@ -776,14 +816,20 @@ if ( $ARGS{"DoSearch"} ) { my $QueryString; if ($NewQuery) { $QueryString = '?NewQuery=1'; -} else { - $QueryString = '?' . $m->comp('/Elements/QueryString', - Query => $Query, - Format => $Format, - Order => $Order, - OrderBy => $OrderBy, - Rows => $RowsPerPage) if ($Query); } +else { + $QueryString = '?' + . $m->comp( + '/Elements/QueryString', + Query => $Query, + Format => $Format, + Order => $Order, + OrderBy => $OrderBy, + Rows => $RowsPerPage + ) + if ($Query); +} + # }}} @@ -798,4 +844,6 @@ $Order => undef $OrderBy => undef $RowsPerPage => undef $HideResults => 0 +@clauses => () + diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index f75934bf3..f9eef26b6 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,13 +42,13 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <& /Elements/Header, Title => loc("Bulk ticket update") &> <& /Elements/Tabs, Title => loc("Bulk ticket update") &> <& /Elements/ListActions, actions => \@results &> - -
    + + @@ -75,8 +75,7 @@ while (my $Ticket = $Tickets->Next) { } - -%# The ticket view is controlled by config.pm, WebOptions + %foreach my $col (@cols) { +% while (my $CF = $TxnCFs->Next()) { + + + + +% } # end if while
    <&|/l&>Update
    % if ($col eq 'id') { @@ -153,44 +152,26 @@ while (my $Ticket = $Tickets->Next) {
    <&|/l&>Subject:
    <% $CF->Name %>:<& /Elements/EditCustomField, + CustomField => $CF, + NamePrefix => "Object-RT::Transaction--CustomField-" + &><% $CF->FriendlyType %>
    <&|/l&>Attach:
    <&|/l&>Message: <& /Elements/MessageBox, Name=>"UpdateContent"&>
    - -% foreach (keys %allcfs) { - - - -% } -
    -% my $cf = $allcfs{$_}; -% my $pref; -% if ($cf->Queue == 0) { -% $pref = "[Global]"; -% } else { -% $pref = "[Queue: " . $cfqnames{$_} . "]"; -% } -<%$pref%> <% $cf->Name %>
    -<% $cf->FriendlyType %> -
    -% if ($cf->Type ne "FreeformMultiple") { -<& /Ticket/Elements/EditCustomField, CustomField => $cf &> -% } else { -Add Values
    - -
    -Delete Values
    - -% } -
    - <& /Elements/TitleBoxEnd &> + <& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> -<&|/l&>Enter tickets or URIs to link tickets to. Seperate multiple entries with spaces.
    +<&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.
    <& /Ticket/Elements/BulkLinks &> <& /Elements/TitleBoxEnd &> @@ -223,7 +204,7 @@ while (my $Ticket = $Tickets->Next) { unless ( exists $cfqs{$cfqid} ) { $cfqs{$cfqid} = 1; $count++; - my $cfs = $cfq->CustomFields; + my $cfs = $cfq->TicketCustomFields; while (my $cf = $cfs->Next) { $allcfs{$cf->Id} = $cf; $cfqnames{$cf->Id} = $cfqn; @@ -245,9 +226,11 @@ if ($ARGS{'UpdateContent'} && #Iterate through each ticket we've been handed 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"); @@ -262,16 +245,6 @@ while (my $Ticket = $Tickets->Next) { #Update the watchers my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); - #Update custom fields - my $pat = "^(\\d+)-(.*)\$"; - foreach (keys %ARGS) { - $ARGS{"Ticket-" . $Ticket->Id . "-CustomField-" . $1 . "-" . $2} = $ARGS{$_} if (/$pat/o); - } - my @cfresults = ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS); - foreach (keys %ARGS) { - delete $ARGS{"Ticket-" . $Ticket->Id . "-CustomField-" . $1 . "-" . $2} if (/$pat/o); - } - #Update the links $ARGS{'id'} = $Ticket; @@ -291,11 +264,15 @@ while (my $Ticket = $Tickets->Next) { delete $ARGS{'MemberOf-'.$Ticket->Id}; delete $ARGS{$Ticket->Id.'-RefersTo'}; delete $ARGS{'RefersTo-'.$Ticket->Id}; - - my @tempresults = (@watchresults, @basicresults, @dateresults, @updateresults, @linkresults, @cfresults); + my @tempresults = (@watchresults, @basicresults, @dateresults, + @updateresults, @linkresults); @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); + diff --git a/rt/html/Search/Edit.html b/rt/html/Search/Edit.html index 769d38d9d..16e8a0e71 100755 --- a/rt/html/Search/Edit.html +++ b/rt/html/Search/Edit.html @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <& /Elements/Header, Title => $title&> <& /Ticket/Elements/Tabs, current_tab => "Search/Edit.html?".$QueryString, diff --git a/rt/html/Search/Elements/BuildFormatString b/rt/html/Search/Elements/BuildFormatString index e5e131b6c..639e62c29 100644 --- a/rt/html/Search/Elements/BuildFormatString +++ b/rt/html/Search/Elements/BuildFormatString @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,45 +42,76 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <%args> $Format => undef %cfqueues => undef +$Face => undef +$Size => undef +$Link => undef +$Title => undef +$AddCol => undef +$RemoveCol => undef +$ColUp => undef +$ColDown => undef +$SelectDisplayColumns => undef +$CurrentDisplayColumns => undef <%init> unless ($Format) { $Format = $RT::DefaultSearchResultFormat; } - -my @fields = ( - "QueueName", "OwnerName", - "id", "Status", - "Subject", "ExtendedStatus", - "Priority", "InitialPriority", - "FinalPriority", "EffectiveId", - "Type", "TimeWorked", - "TimeLeft", "TimeEstimated", - "Requestors", "Cc", - "AdminCc", "StartsRelative", - "StartedRelative", "CreatedRelative", - "LastUpdatedRelative", "ToldRelative", - "DueRelative", "ResolvedRelative", - "Starts", "Started", - "Created", "CreatedBy", - "LastUpdated", "LastUpdatedBy", - "Told", "Due", - "Resolved", "NEWLINE", - "RefersTo", "ReferredToBy", - "DependsOn", "DependedOnBy", - "MemberOf", "Members", - "Parents", "Children", - "-", + + +# All the things we can display in the format string by default +my @fields = qw( + id + Status + ExtendedStatus + Subject + QueueName + OwnerName + Priority + InitialPriority + FinalPriority + Type + TimeWorked + TimeLeft + TimeEstimated + CreatedBy + LastUpdatedBy + Requestors + Cc + AdminCc + Starts + StartsRelative + Started + StartedRelative + Created + CreatedRelative + LastUpdated + LastUpdatedRelative + Told + ToldRelative + Due + DueRelative + Resolved + ResolvedRelative + RefersTo + ReferredToBy + DependsOn + DependedOnBy + MemberOf + Members + Parents + Children + NEWLINE ); my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); -foreach (keys %cfqueues) { - my $id = $_; +foreach my $id (keys %cfqueues) { + # What does this _do_? What are the keys to cfqueues $id =~ s/^.'*(.*).'*$/$1/; # Gotta load up the $queue object, since queues get stored by name now. my $queue = RT::Queue->new($session{'CurrentUser'}); @@ -117,8 +148,8 @@ foreach my $field (@format) { push @seen, \%column; } -if ( $ARGS{"RemoveCol"} ) { - my $index = $ARGS{'CurrentDisplayColumns'}; +if ( $RemoveCol ) { + my $index = $CurrentDisplayColumns; my $column = $seen[$index]; if ($index) { delete $seen[$index]; @@ -130,9 +161,9 @@ if ( $ARGS{"RemoveCol"} ) { } } } -elsif ( $ARGS{"AddCol"} ) { - if ( defined $ARGS{'SelectDisplayColumns'} ) { - my $selected = $ARGS{'SelectDisplayColumns'}; +elsif ( $AddCol ) { + if ( defined $SelectDisplayColumns ) { + my $selected = $SelectDisplayColumns; my @columns; if (ref($selected) eq 'ARRAY') { @columns = @$selected; @@ -141,74 +172,71 @@ elsif ( $ARGS{"AddCol"} ) { } foreach my $col (@columns) { my %column = (); - $column{Column} = $fields[ $col ]; - - if ( $ARGS{Face} eq "Bold" ) { - $column{Prefix} .= ""; - } - if ( $ARGS{Face} eq "Italic" ) { - $column{Prefix} .= ""; - } - if ( $ARGS{Size} ) { - $column{Prefix} .= "<" . $ARGS{Size} . ">"; - } - if ( $ARGS{Link} eq "Display" ) { - $column{Prefix} .= ""; - } - elsif ( $ARGS{Link} eq "Take" ) { - $column{Prefix} .= - ""; - } - - my $suffix; - if ( $ARGS{'Link'} eq "Display" || $ARGS{'Link'} eq "Take" ) { - $column{Suffix} .= ""; - } - if ( $ARGS{Size} ) { - $column{Suffix} .= ""; - } - if ( $ARGS{Face} eq "Italic" ) { - $column{Suffix} .= ""; - } - if ( $ARGS{Face} eq "Bold" ) { - $column{Suffix} .= ""; - } - if ( $ARGS{Title} ) { - $column{Suffix} .= "/TITLE:" . $ARGS{Title}; - } - push @seen, \%column; - } + $column{Column} = $col; + + if ( $Face eq "Bold" ) { + $column{Prefix} .= ""; + $column{Suffix} .= ""; + } + if ( $Face eq "Italic" ) { + $column{Prefix} .= ""; + $column{Suffix} .= ""; + } + if ($Size) { + $column{Prefix} .= "<" . $m->interp->apply_escapes( $Size, 'h' ) . ">"; + $column{Suffix} .= "interp->apply_escapes( $Size, 'h' ) . ">"; + } + if ( $Link eq "Display" ) { + $column{Prefix} .= + ""; + $column{Suffix} .= ""; + } + elsif ( $Link eq "Take" ) { + $column{Prefix} .= ""; + $column{Suffix} .= ""; + } + + if ($Title) { + $column{Suffix} .= "/TITLE:" . $m->interp->apply_escapes( $Title, 'h' ); } + push @seen, \%column; +} +} } -elsif ( $ARGS{"ColUp"} ) { - my $index = $ARGS{'CurrentDisplayColumns'}; +elsif ( $ColUp ) { + my $index = $CurrentDisplayColumns; if ( defined $index && ( $index - 1 ) >= 0 ) { my $column = $seen[$index]; $seen[$index] = $seen[ $index - 1 ]; $seen[ $index - 1 ] = $column; - $ARGS{CurrentDisplayColumns} = $index - 1; + $CurrentDisplayColumns = $index - 1; } } -elsif ( $ARGS{"ColDown"} ) { - my $index = $ARGS{'CurrentDisplayColumns'}; +elsif ( $ColDown ) { + my $index = $CurrentDisplayColumns; if ( defined $index && ( $index + 1 ) < scalar @seen ) { my $column = $seen[$index]; $seen[$index] = $seen[ $index + 1 ]; $seen[ $index + 1 ] = $column; - $ARGS{CurrentDisplayColumns} = $index + 1; + $CurrentDisplayColumns = $index + 1; } } -$Format = ""; + +my @format_string; foreach my $field (@seen) { next unless $field; - $Format .= ", \n" if $Format; - $Format .= "'"; - $Format .= $field->{Prefix}; - $Format .= "__" . $field->{Column} . "__" if ( $field->{Column} ne "" ) ; - $Format .= $field->{Suffix}; - $Format .= "'"; + my $row = "'" . $field->{Prefix}; + $row .= "__" . $m->interp->apply_escapes( $field->{Column}, 'h' ) . "__" + unless ( $field->{Column} eq "" ); + $row .= $field->{Suffix} . "'"; + push( @format_string, $row ); } + +$Format = join(",\n", @format_string); + + return($Format, \@fields, \@seen); diff --git a/rt/html/Search/Elements/DisplayOptions b/rt/html/Search/Elements/DisplayOptions index 330948d32..43a9d9998 100644 --- a/rt/html/Search/Elements/DisplayOptions +++ b/rt/html/Search/Elements/DisplayOptions @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <& /Elements/TitleBoxStart, title => loc("Display Columns") &> @@ -54,15 +54,15 @@
    <&|/l&>Order by: - +
    <&|/l&>Rows per page: - + <& /Elements/SelectResultsPerPage, Name => "RowsPerPage", Default => $RowsPerPage &> @@ -91,13 +91,14 @@ SELECTED
    -<& /Elements/Submit, Caption => "Do the Search", Label => loc('Search'), Name => 'DoSearch'&> <& /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'}; + diff --git a/rt/html/Search/Elements/EditFormat b/rt/html/Search/Elements/EditFormat index 7d314aee6..dc8720f26 100644 --- a/rt/html/Search/Elements/EditFormat +++ b/rt/html/Search/Elements/EditFormat @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,14 +42,14 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} + + + + + + + + + + + + + + + + + + -% } -% } else { -<&|/l&><%$field%> + + + + + + + + -% } -<& '/Elements/Callback', _CallbackName => 'EndOfList' &> <%INIT> -my @fields = ('Attachment', - 'Queue', - 'Status', - 'People', - 'Dates', - 'Time', - 'Priority', - 'Links', - 'id', - ); - my @people = ('Actor', 'Watcher', + 'WatcherGroup', ); diff --git a/rt/html/Search/Elements/PickCFs b/rt/html/Search/Elements/PickCFs index fb143ba57..435a07ad3 100644 --- a/rt/html/Search/Elements/PickCFs +++ b/rt/html/Search/Elements/PickCFs @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,24 +42,17 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} % while ( my $CustomField = $CustomFields->Next ) { - % } - <%INIT> my $CustomFields = RT::CustomFields->new( $session{'CurrentUser'}); -foreach (keys %cfqueues) { - my $id = $_; +foreach my $id (keys %cfqueues) { $id =~ s/^.'*(.*).'*$/$1/; - # Gotta load up the $queue object, since queues get stored by name now. + # Gotta load up the $queue object, since queues get stored by name now. my $id my $queue = RT::Queue->new($session{'CurrentUser'}); $queue->Load($id); $CustomFields->LimitToQueue($queue->Id); diff --git a/rt/html/Search/Elements/PickCriteria b/rt/html/Search/Elements/PickCriteria index 344830e34..129344443 100644 --- a/rt/html/Search/Elements/PickCriteria +++ b/rt/html/Search/Elements/PickCriteria @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,26 +42,32 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <& /Elements/TitleBoxStart, title => loc('Add Criteria')&>
    -<&|/l&>Available Columns: +<&|/l&>Add Columns: -Format: +<&|/l&>Format: @@ -58,50 +58,42 @@ Format:
    -Link: - - - + + -
    Title: -
    Size: - +
    <&|/l&>Size: + -
    Face: - - - + +
    - +% my $i=0; +% foreach my $field (@$CurrentFormat) { + % }
    diff --git a/rt/html/Search/Elements/EditQuery b/rt/html/Search/Elements/EditQuery new file mode 100644 index 000000000..783541a64 --- /dev/null +++ b/rt/html/Search/Elements/EditQuery @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 }}} +<& NewListActions, actions => $actions &> +<& /Elements/TitleBoxStart, title => join(': ', grep defined, loc("Query"), $Description) &> + +

    + + + + + + +%# +

    +<& /Elements/TitleBoxEnd &> +<%ARGS> +$Description +$optionlist +$actions + diff --git a/rt/html/Search/Elements/EditSearches b/rt/html/Search/Elements/EditSearches index cd9f1ef3b..bc6b80e6f 100644 --- a/rt/html/Search/Elements/EditSearches +++ b/rt/html/Search/Elements/EditSearches @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,8 +42,11 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <& /Elements/TitleBoxStart, title => loc('Saved searches') &> +%# 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 &>
    @@ -52,13 +55,14 @@ % } <&|/l&>Description:
    -
    + % if ($SearchId ne 'new') { % if ($Dirty) { % } + % } @@ -66,12 +70,18 @@ % }
    +% } <&|/l&>Load saved search:
    <& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects&> <& /Elements/TitleBoxEnd &> <%init> + +unless ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', + Object=> $RT::System )) { + return; +} my @Objects; push @Objects, $session{CurrentUser}->UserObj; diff --git a/rt/html/Search/Elements/NewListActions b/rt/html/Search/Elements/NewListActions index 7b81d80b1..eb82544f3 100644 --- a/rt/html/Search/Elements/NewListActions +++ b/rt/html/Search/Elements/NewListActions @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} % if ($actions[0] ) { <%loc('Results')%>
    % foreach my $action (@actions) { diff --git a/rt/html/Search/Elements/PickBasics b/rt/html/Search/Elements/PickBasics index d7e19788f..8a48f6b18 100644 --- a/rt/html/Search/Elements/PickBasics +++ b/rt/html/Search/Elements/PickBasics @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,11 +42,18 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK -
    -% foreach my $field (@fields) { +%# END BPS TAGGED BLOCK }}} +
    +<&|/l&>id + +<& /Elements/SelectEqualityOperator, Name => "idOp" &> + + +
    -% if ($field eq "Attachment") { <& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> <& /Elements/SelectBoolean, Name => "AttachmentOp", @@ -57,44 +64,26 @@ &> -% } elsif ($field eq "Dates") { -<& /Elements/SelectDateType, Name=>"DateField" &> - -<& /Elements/SelectDateRelation, Name=>"DateOp" &> - -<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &> -% } elsif ($field eq "Links") { -<& SelectLinks, Name=>"LinksField" &> - -<& /Elements/SelectBoolean, Name => "LinksOp", - True => loc("is"), - False => loc("isn't"), - TrueVal=> '=', - FalseVal => '!=' -&> - - -%} elsif ($field eq "Priority") { - - -<& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> - - -%} elsif ($field =~ m/Time.*/) { - +
    +<&|/l&>Queue -<& /Elements/SelectEqualityOperator, Name => "TimeOp" &> +<& /Elements/SelectBoolean, Name => "QueueOp" , + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' &> - -% } elsif ($field eq "Status") { +<& /Elements/SelectQueue, + Name => "ValueOfQueue", + NamedValues => 1, + CheckQueueRight => 'ShowTicket' &> +
    <&|/l&>Status <& /Elements/SelectBoolean, Name => "StatusOp", @@ -105,32 +94,9 @@ &> <& /Elements/SelectStatus, Name => "ValueOfStatus", SkipDeleted => 1 &> -%} elsif ($field =~ m/.*Priority/ || $field =~ m/Time.*/) { -<&|/l&><%$field%> - -<& /Elements/SelectEqualityOperator, Name => $field . "Op" &> - -" SIZE=5> -% } elsif ($field eq "Queue") { -<&|/l&>Queue - -<& /Elements/SelectBoolean, Name => "QueueOp" , - True => loc("is"), - False => loc("isn't"), - TrueVal=> '=', - FalseVal => '!=' &> - -<& /Elements/SelectQueue, Name => "ValueOfQueue", NamedValues => 1 &> -% } elsif ($field eq "id") { -<&|/l&>Id - -<& /Elements/SelectEqualityOperator, Name => "idOp" &> - - -% } elsif ($field eq "People") { -% foreach my $field (@people) { +
    -% if ($field eq "Actor") { -<& /Elements/SelectOwner, Name => "ValueOfActor" &> -% } elsif ($field eq 'Watcher') { +<& /Elements/SelectOwner, Name => "ValueOfActor", ValueAttribute => 'Name' &> +
    <& SelectPersonType, Name => 'WatcherField', Default => 'Requestor' &> <& /Elements/SelectMatch, Name => "WatcherOp" &> -% } else { -<&|/l&><%$field%> -<& /Elements/SelectMatch, Name => "$field" . "Op" &> -" value=""SIZE=20> -% } +
    +<& 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' &> +
    +<& /Elements/SelectDateType, Name=>"DateField" &> + +<& /Elements/SelectDateRelation, Name=>"DateOp" &> + +<& /Elements/SelectDate, Name => "ValueOfDate", ShowTime => 0, Default => '' &>
    + + +<& /Elements/SelectEqualityOperator, Name => "TimeOp" &> -<& /Elements/SelectMatch, Name => "$field" . "Op" &> + +
    + + +<& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> -" value="" SIZE=20> -% } + +
    +<& SelectLinks, Name=>"LinksField" &> + +<& /Elements/SelectBoolean, Name => "LinksOp", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', + FalseVal => '!=' &> + +
    - -% my $name; -% if ($CustomField->QueueObj->id) { -% $name = "'CF." . $CustomField->QueueObj->Name . -% ".{" . $CustomField->Name . "}'"; -% } else { -% $name = "'CF." . $CustomField->Name . "'"; -% } +% my $name = "'CF.{" . $CustomField->Name . "}'"; +
    <% $CustomField->Name %> -<& /Elements/SelectCustomFieldOperator, Name => $name . "Op", - True => loc("is"), - False => loc("isn't"), - TrueVal=> '=', FalseVal => '!=' &> + <& /Elements/SelectCustomFieldOperator, Name => $name . "Op", + True => loc("is"), + False => loc("isn't"), + TrueVal=> '=', FalseVal => '!=' &> <& /Elements/SelectCustomFieldValue, Name => "ValueOf" . $name, @@ -67,13 +60,11 @@ &>
    - - <& PickBasics &> - <& PickCFs, cfqueues => \%cfqueues &> + + +
    - Aggregator: + <&|/l&>Aggregator: <& SelectAndOr, Name => "AndOr" &>
    +
    + + <& PickBasics &> + <& PickCFs, cfqueues => \%cfqueues &> +
    +
     
    diff --git a/rt/html/Search/Elements/SearchPrivacy b/rt/html/Search/Elements/SearchPrivacy index 5f6f207fe..270e1baa3 100644 --- a/rt/html/Search/Elements/SearchPrivacy +++ b/rt/html/Search/Elements/SearchPrivacy @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <%args> $Object => undef diff --git a/rt/html/Search/Elements/SelectAndOr b/rt/html/Search/Elements/SelectAndOr index 11df03ff1..2f3c70477 100644 --- a/rt/html/Search/Elements/SelectAndOr +++ b/rt/html/Search/Elements/SelectAndOr @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,10 +42,10 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK -AND -OR +%# END BPS TAGGED BLOCK }}} +<&|/l&>AND +<&|/l&>OR <%ARGS> $Name => "Operator" - \ No newline at end of file + diff --git a/rt/html/Search/Elements/SelectGroup b/rt/html/Search/Elements/SelectGroup new file mode 100644 index 000000000..edd53713f --- /dev/null +++ b/rt/html/Search/Elements/SelectGroup @@ -0,0 +1,65 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2005 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., 675 Mass Ave, Cambridge, MA 02139, USA. +%# +%# +%# 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 }}} + + +<%INIT> +my $groups = new RT::Groups($session{'CurrentUser'}); +$groups->Limit(FIELD => 'Domain', OPERATOR => '=', VALUE => $Domain); + + +<%ARGS> +$AllowNull => 1 +$Default=> '' +$Name => 'Group' +$Domain => 'UserDefined'; + diff --git a/rt/html/Search/Elements/SelectLinks b/rt/html/Search/Elements/SelectLinks index b814e3088..00ec80bd3 100644 --- a/rt/html/Search/Elements/SelectLinks +++ b/rt/html/Search/Elements/SelectLinks @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} % if ($AllowNull) { % } -%for my $option (@types) { -%foreach my $subtype (@subtypes) { - +% for my $option (@types) { +% if ($Suffix) { + +% next; +% } +% foreach my $subtype (@subtypes) { + +% } % } -%} <%INIT> @@ -59,6 +63,9 @@ my @types; if ($Scope =~ 'queue') { @types = qw(Cc AdminCc); } +elsif ($Suffix eq 'Group') { + @types = qw(Requestor Cc AdminCc Watcher); +} else { @types = qw(Requestor Cc AdminCc Watcher Owner); } @@ -68,6 +75,7 @@ my @subtypes = qw(EmailAddress Name RealName Nickname Organization Address1 Addr <%ARGS> $AllowNull => 1 +$Suffix => '' $Default=>undef $Scope => 'ticket' $Name => 'WatcherType' diff --git a/rt/html/Search/Elements/SelectSearchObject b/rt/html/Search/Elements/SelectSearchObject index 6eaa680f8..e9df5179f 100644 --- a/rt/html/Search/Elements/SelectSearchObject +++ b/rt/html/Search/Elements/SelectSearchObject @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <%args> @Objects => undef $Name => undef diff --git a/rt/html/Search/Elements/SelectSearchesForObjects b/rt/html/Search/Elements/SelectSearchesForObjects index 3f0c458cb..e6be66a58 100644 --- a/rt/html/Search/Elements/SelectSearchesForObjects +++ b/rt/html/Search/Elements/SelectSearchesForObjects @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <%args> @Objects => undef $Name => undef @@ -57,6 +57,9 @@ $Name => undef % } % my @searches = $object->Attributes->Named('SavedSearch'); % foreach my $search (@searches) { +% # Skip it if it is not a ticket search. +% next if ($search->SubValue('SearchType') +% && $search->SubValue('SearchType') ne 'Ticket'); % } % } diff --git a/rt/html/Search/Results.html b/rt/html/Search/Results.html index dfcc7885c..5849378a8 100755 --- a/rt/html/Search/Results.html +++ b/rt/html/Search/Results.html @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> <& /Ticket/Elements/Tabs, current_tab => "Search/Results.html".$QueryString, @@ -52,7 +52,6 @@ Rows => $Rows, OrderBy => $OrderBy, Order => $Order &> -
    <& /Elements/TicketList, Query => $Query, AllowSorting => 1, @@ -81,24 +80,26 @@ <&|/l&>Update multiple tickets
    <&|/l&>Bookmarkable link
    <&|/l&>spreadsheet | -<&|/l&>RSS | -<&|/l&>Work offline
    +<&|/l&>RSS | +<&|/l&>Work offline
    <& /Elements/Callback, _CallbackName => 'SearchActions', QueryString => $QueryString&> <%INIT> my ($title, $ticketcount); $session{'i'}++; -$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) unless ($session{'tickets'}); +$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) ; $session{'tickets'}->FromSQL($Query) if ($Query); $session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); -if ($OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'} - or $Order ne $session{'CurrentSearchHash'}->{'Order'}) { - $session{'CurrentSearchHash'}->{'OrderBy'} = $OrderBy; - $session{'CurrentSearchHash'}->{'Order'} = $Order; - # Invalidate the ordering cache - undef $session{'tickets'}->{'items_array'}; -} + +$session{'CurrentSearchHash'} = { + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $Rows + }; + if ( $session{'tickets'}->Query()) { @@ -116,6 +117,7 @@ my $QueryString = "?".$m->comp('/Elements/QueryString', Order => $Order, Page => $Page); +my $ShortQueryString = "?".$m->comp('/Elements/QueryString', Query => $Query); if ($ARGS{'TicketsRefreshInterval'}) { $session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'}; diff --git a/rt/html/Search/Results.rdf b/rt/html/Search/Results.rdf index 8054c8616..ee71fea94 100644 --- a/rt/html/Search/Results.rdf +++ b/rt/html/Search/Results.rdf @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <%INIT> my $Tickets = RT::Tickets->new($session{'CurrentUser'}); diff --git a/rt/html/Search/Results.tsv b/rt/html/Search/Results.tsv index 631e299f0..17aa88ae1 100644 --- a/rt/html/Search/Results.tsv +++ b/rt/html/Search/Results.tsv @@ -1,8 +1,8 @@ -%# {{{ BEGIN BPS TAGGED BLOCK +%# BEGIN BPS TAGGED BLOCK {{{ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -42,7 +42,7 @@ %# works based on those contributions, and sublicense and distribute %# those contributions and any derivatives thereof. %# -%# }}} END BPS TAGGED BLOCK +%# END BPS TAGGED BLOCK }}} <%INIT> my $Tickets = RT::Tickets->new($session{'CurrentUser'}); @@ -84,7 +84,8 @@ my @attrs = qw( id QueueObj->Name Subject Status TimeEstimated TimeWorked TimeLe my @header; foreach my $attr (@attrs) { my $label = $attr; - $label =~ s'Obj-.(AsString|Name|ISO)''g; + $label =~ s'Obj-.(?:AsString|Name|ISO)''g; + $label =~ s'-\>MemberEmailAddressesAsString''g; push @header, $label; } foreach my $id (sort keys %known_cfs) { -- cgit v1.2.1