diff options
Diffstat (limited to 'rt/html/Search')
22 files changed, 592 insertions, 810 deletions
diff --git a/rt/html/Search/Build.html b/rt/html/Search/Build.html index ba5f7a1dd..5a66e02c9 100644 --- a/rt/html/Search/Build.html +++ b/rt/html/Search/Build.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -76,15 +74,15 @@ Rows => $RowsPerPage &> -<form method="post" action="Build.html" name="BuildQuery"> -<input type="hidden" class="hidden" name="SearchId" value="<%$SearchId%>" /> -<input type="hidden" class="hidden" name="Query" value="<%$Query%>" /> -<input type="hidden" class="hidden" name="Format" value="<%$Format%>" /> -<table width="100%" border="0" cellpadding="5"> +<FORM METHOD="POST" ACTION="Build.html" NAME="BuildQuery"> +<input type=hidden name=SearchId value="<%$SearchId%>"> +<input type=hidden name=Query value="<%$Query%>"> +<input type=hidden name=Format value="<%$Format%>"> +<table width=100% border="0" cellpadding="5"> <tr valign="top"> <td class="boxcontainer" rowspan="2" width="65%"> <& Elements/PickCriteria, query => $Query, cfqueues => $queues &> -<& /Elements/Submit, Caption => loc('Add these terms to your search'), Label => loc('Add'), Name => 'AddClause'&> +<& /Elements/Submit, Caption => loc('Add additional criteria'), Label => loc('Add'), Name => 'AddClause'&> </td> <td> @@ -93,7 +91,6 @@ actions => \@actions, optionlist => $optionlist, Description => $Description &> -<& /Elements/Submit, Label => loc('Add and Search'), Name => 'DoSearch'&> </td> </tr> @@ -104,15 +101,19 @@ </tr> <tr> -<td colspan="2" class="boxcontainer"> +<td colspan=2 class="boxcontainer"> <& Elements/DisplayOptions, %ARGS, Format=> $Format, AvailableColumns => $AvailableColumns, CurrentFormat => $CurrentFormat, RowsPerPage => $RowsPerPage, OrderBy => $OrderBy, Order => $Order &> -<& /Elements/Submit, Label => loc('Add and Search'), Name => 'DoSearch'&> +</td> +</tr> +<tr> +<td colspan=2 class="boxcontainer"> +<& /Elements/Submit, Caption => loc("Do the Search"), Label => loc('Search'), Name => 'DoSearch'&> </td> </tr> </table> -</form> +</FORM> <%INIT> use RT::Interface::Web::QueryBuilder; @@ -133,7 +134,7 @@ if ( $NewQuery or $ARGS{'Delete'} ) { $SearchId = ''; $Order = ''; $OrderBy = ''; - $RowsPerPage = undef; + $RowsPerPage = ''; # ($search hasn't been set yet; no need to clear) @@ -146,43 +147,22 @@ if ( $NewQuery or $ARGS{'Delete'} ) { # }}} -if (ref $OrderBy eq "ARRAY") { - $OrderBy = join("|", @$OrderBy); -} -if (ref $Order eq "ARRAY") { - $Order = join("|", @$Order); -} - # {{{ Attempt to load what we can from the session, set defaults # We don't read or write to the session again until the end $search_hash = $session{'CurrentSearchHash'}; -# Read from user preferences -my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {}; - # These variables are what define a search_hash; this is also # where we give sane defaults. $Query ||= $search_hash->{'Query'}; -$Format ||= $search_hash->{'Format'} || $prefs->{'Format'}; +$Format ||= $search_hash->{'Format'}; $Description ||= $search_hash->{'Description'}; $SearchId ||= $search_hash->{'SearchId'} || 'new'; -$Order ||= $search_hash->{'Order'} || $prefs->{'Order'} || 'ASC'; -$OrderBy ||= $search_hash->{'OrderBy'} || $prefs->{'OrderBy'} || 'id'; - -unless ( defined $RowsPerPage ) { - if ( defined $search_hash->{'RowsPerPage'} ) { - $RowsPerPage = $search_hash->{'RowsPerPage'}; - } - elsif ( defined $prefs->{'RowsPerPage'} ) { - $RowsPerPage = $prefs->{'RowsPerPage'}; - } - else { - $RowsPerPage = 50; - } -} - - $search ||= $search_hash->{'Object'}; +$Order ||= $search_hash->{'Order'} || 'ASC'; +$OrderBy ||= $search_hash->{'OrderBy'} || 'id'; +$RowsPerPage = ( $search_hash->{'RowsPerPage'} || 50 ) + unless defined($RowsPerPage); +$search ||= $search_hash->{'Object'}; # }}} @@ -195,14 +175,31 @@ $Format = $m->comp( '/Elements/ScrubHTML', Content => $Format ) if ($Format); if ( $ARGS{'Delete'} ) { # We set $SearchId to 'new' above already, so peek into the %ARGS - my ($container_object, $search_id) = _parse_saved_search ($ARGS{'SearchId'}); - if ($container_object && $container_object->id) { - # We have the object the entry is an attribute on; delete the - # entry.. - $container_object->Attributes->DeleteEntry( - Name => 'SavedSearch', - id => $search_id + 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 ); + } + } } @@ -226,8 +223,25 @@ if ( $ARGS{'Revert'} ) { # {{{ if we're asked to load a search, load it. -if ( my ($container_object, $search_id ) = _parse_saved_search ($ARGS{'LoadSavedSearch'})) { - $search = $container_object->Attributes->WithId($search_id); +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'}; @@ -241,62 +255,6 @@ if ( my ($container_object, $search_id ) = _parse_saved_search ($ARGS{'LoadSaved # }}} -# {{{ if we're asked to save the current search, save it -if ( $ARGS{'Save'} ) { - if ( $search && $search->id ) { - # permission check - if ($search->Object->isa('RT::System')) { - unless ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) { - Abort("No permission to save system-wide searches"); - } - } - - # This search is based on a previously loaded search -- so - # just update the current search object with new values - $search->SetSubValues( - Format => $Format, - Query => $Query, - Order => $Order, - OrderBy => $OrderBy, - RowsPerPage => $RowsPerPage, - ); - $search->SetDescription($Description); - - } - elsif ( $SearchId eq 'new' ) { - my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} ); - my ( $ok, $search_msg ) = $saved_search->Save( - Privacy => $ARGS{'Owner'}, - Name => $Description, - SearchParams => { - Format => $Format, - Query => $Query, - Order => $Order, - OrderBy => $OrderBy, - RowsPerPage => $RowsPerPage } ); - - if ($ok) { - $search = $session{'CurrentUser'}->UserObj->Attributes->WithId($saved_search->Id); - # Build new SearchId - $SearchId = - ref( $session{'CurrentUser'}->UserObj ) . '-' - . $session{'CurrentUser'}->UserObj->Id - . '-SavedSearch-' - . $search->Id; - } - else { - push @actions, [ loc("Can't find a saved search to work with").': '.loc($search_msg), 0 ]; - } - } - else { - push @actions, [ loc("Can't save this search"), 0 ]; - } - -} - -# }}} - - # {{{ Parse the query use Regexp::Common qw /delimited/; @@ -320,7 +278,7 @@ my $_match = sub { my $ParseQuery = sub { my $string = shift; my $tree = shift; - my $actions = shift; + my @actions = shift; my $want = KEYWORD | PAREN; my $last = undef; @@ -329,12 +287,9 @@ my $ParseQuery = sub { # make a tree root $$tree = RT::Interface::Web::QueryBuilder::Tree->new; my $root = RT::Interface::Web::QueryBuilder::Tree->new( 'AND', $$tree ); + my $lastnode = $root; my $parentnode = $root; - # on new searches, we're passed undef but still need to construct the - # RT::Interface::Web::QueryBuilder::Tree. Quiet warning - return unless defined $string; - # get the FIELDS from Tickets_Overlay my $tickets = new RT::Tickets( $session{'CurrentUser'} ); my %FIELDS = %{ $tickets->FIELDS }; @@ -384,10 +339,13 @@ my $ParseQuery = sub { # Error # FIXME: I will only print out the highest $want value my $token = $tokens[ ( ( log $want ) / ( log 2 ) ) ]; - push @$actions, + push @actions, [ - loc("Error near ->[_1]<- expecting a [_2] in '[_3]'", - $val, $token, $string ), + loc( +"current: $current, want $want, Error near ->$val<- expecting a " + . $token + . " in '$string'\n" + ), -1 ]; } @@ -406,13 +364,13 @@ my $ParseQuery = sub { else { $depth--; $parentnode = $parentnode->getParent(); + $lastnode = $parentnode; } $want = KEYWORD | PAREN | AGGREG; } elsif ( $current & AGGREG ) { $ea = $val; - $parentnode->setNodeValue($ea); $want = KEYWORD | PAREN; } elsif ( $current & KEYWORD ) { @@ -442,28 +400,20 @@ my $ParseQuery = sub { $val =~ s!\\(.)!$1!g; my $class; - - my ($key_base, $subkey) = split(/\./,$key,2); - $key_base =~ s/\..*$//; # Strip off .EmailAddress, for example - - if ( exists $lcfields{lc $key_base } ) { - $key = $lcfields{lc $key_base } . (defined $subkey ? '.'.$subkey : ''); - $class = $FIELDS{$key_base}->[0]; - } - elsif ( $key =~ /^C(?:ustom)?F(?:ield)?\.{(.*)}$/i ) { - $class = $FIELDS{'CF'}->[0]; + if ( exists $lcfields{ lc $key } ) { + $key = $lcfields{ lc $key }; + $class = $FIELDS{$key}->[0]; } - if ( $class ne 'INT' ) { $val = "'$val'"; } - push @$actions, [ loc("Unknown field: $key"), -1 ] unless $class; + push @actions, [ loc("Unknown field: $key"), -1 ] unless $class; $want = PAREN | AGGREG; } else { - push @$actions, [ loc("I'm lost"), -1 ]; + push @actions, [ loc("I'm lost"), -1 ]; } if ( $current & VALUE ) { @@ -477,40 +427,33 @@ my $ParseQuery = sub { }; # explicity add a child to it - RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode ); + $lastnode = RT::Interface::Web::QueryBuilder::Tree->new( $clause, $parentnode ); + $lastnode->getParent()->setNodeValue($ea); ( $ea, $key, $op, $value ) = ( "", "", "", "" ); - } $last = $current; } # while - push @$actions, [ loc("Incomplete query"), -1 ] + push @actions, [ loc("Incomplete query"), -1 ] unless ( ( $want | PAREN ) || ( $want | KEYWORD ) ); - push @$actions, [ loc("Incomplete Query"), -1 ] + push @actions, [ loc("Incomplete Query"), -1 ] unless ( $last && ( $last | PAREN ) || ( $last || VALUE ) ); # This will never happen, because the parser will complain - push @$actions, [ loc("Mismatched parentheses"), -1 ] + push @actions, [ loc("Mismatched parentheses"), -1 ] unless $depth == 1; }; my $tree; -{ - my @parsing_errors; - $ParseQuery->( $Query, \$tree, \@parsing_errors ); - - # if parsing went poorly, send them to the edit page - # to fix it - if ( @parsing_errors ) { - return $m->comp( - "Edit.html", - Query => $Query, - actions => \@parsing_errors - ); - } +$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(); } $Query = ""; @@ -640,7 +583,7 @@ elsif ( $ARGS{"Toggle"} ) { # {{{ Try to find if we're adding a clause foreach my $arg ( keys %ARGS ) { if ( - $arg =~ m/^ValueOf(\w+|'CF.{.*?}')$/ + $arg =~ m/^ValueOf(.+)/ && ( ref $ARGS{$arg} eq "ARRAY" ? grep { $_ ne "" } @{ $ARGS{$arg} } : $ARGS{$arg} ne "" ) @@ -752,6 +695,77 @@ my ( $AvailableColumns, $CurrentFormat ); # }}} +# {{{ if we're asked to save the current search, save it +if ( $ARGS{'Save'} ) { + + if ( $search && $search->id ) { + + # This search is based on a previously loaded search -- so + # just update the current search object with new values + $search->SetSubValues( + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage, + ); + $search->SetDescription($Description); + + } + elsif ( $SearchId eq 'new' && $ARGS{'Owner'} =~ /^(.*?)-(\d+)$/ ) { + + # We're saving a new search + my $obj_type = $1; + my $obj_id = $2; + + # Find out if we're saving on the user, or a group + my $container_object; + if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id ) + { + $container_object = $session{'CurrentUser'}->UserObj; + } + elsif ( $obj_type eq 'RT::Group' ) { + $container_object = RT::Group->new( $session{'CurrentUser'} ); + $container_object->Load($obj_id); + } + + if ( $container_object->id ) { + + # If we got one or the other, add the saerch + my ( $search_id, $search_msg ) = $container_object->AddAttribute( + Name => 'SavedSearch', + Description => $Description, + Content => { + Format => $Format, + Query => $Query, + Order => $Order, + OrderBy => $OrderBy, + RowsPerPage => $RowsPerPage, + } + ); + $search = + $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id); + + # Build new SearchId + $SearchId = + ref( $session{'CurrentUser'}->UserObj ) . '-' + . $session{'CurrentUser'}->UserObj->Id + . '-SavedSearch-' + . $search->Id; + } + unless ( $search->id ) { + push @actions, [ loc("Can't find a saved search to work with"), 0 ]; + } + + } + else { + push @actions, [ loc("Can't save this search"), 0 ]; + } + +} + +# }}} + # {{{ If we're modifying an old query, check if it has changed my $dirty = 0; $dirty = 1 @@ -779,7 +793,7 @@ $session{'CurrentSearchHash'} = $search_hash; # }}} # {{{ Show the results, if we were asked. -if ( $ARGS{"DoSearch"}) { +if ( $ARGS{"DoSearch"} ) { $m->comp( "Results.html", Query => $Query, @@ -788,7 +802,6 @@ if ( $ARGS{"DoSearch"}) { OrderBy => $OrderBy, Rows => $RowsPerPage ); - $m->comp('/Elements/Footer'); $m->abort(); } diff --git a/rt/html/Search/Bulk.html b/rt/html/Search/Bulk.html index 9742df5ae..f9eef26b6 100644 --- a/rt/html/Search/Bulk.html +++ b/rt/html/Search/Bulk.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,220 +43,185 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/Header, Title => $title &> -<& /Ticket/Elements/Tabs, - current_tab => "Search/Bulk.html", - Title => $title, - Format => $ARGS{'Format'}, # we don't want the locally modified one - Query => $Query, - Rows => $Rows, - OrderBy => $OrderBy, - Order => $Order &> +<& /Elements/Header, Title => loc("Bulk ticket update") &> +<& /Elements/Tabs, Title => loc("Bulk ticket update") &> <& /Elements/ListActions, actions => \@results &> -<form method="post" action="<%$RT::WebPath%>/Search/Bulk.html" enctype="multipart/form-data"> -% foreach my $var qw(Query Format OrderBy Order Rows Page) { -<input type="hidden" class="hidden" name="<%$var%>" value="<%$ARGS{$var}%>" /> +<FORM METHOD="POST" ACTION="<%$RT::WebPath%>/Search/Bulk.html" > +<input type="hidden" name="Query" value="<%$ARGS{'Query'}%>"> +<TABLE WIDTH=100% border=0 cellpadding=3 CELLSPACING=0> +<TR> +<TH><&|/l&>Update</&></TH> +%foreach my $col (@cols) { +% my $colalias = $col; +% $colalias =~ s/(Obj\-\>|)(Name|AsString)//; + +<TH><% loc($colalias) %> </TH> %} -<& /Elements/TicketList, Query => $Query, - DisplayFormat => $Format, - Format => $ARGS{'Format'}, - Verbatim => 1, - AllowSorting => 1, - OrderBy => $OrderBy, - Order => $Order, - Rows => $Rows, - Page => $Page, - BaseURL => $RT::WebPath."/Search/Bulk.html?" - &> - -<hr> - -<& /Elements/Submit, Label => loc('Update'), CheckAll => 1, ClearAll => 1 &> -<br /> -<&|/Widgets/TitleBox, title => $title &> -<table> -<tr> -<td valign="top"> +</TR> + +<%PERL> + +my $i; + +$Tickets->RedoSearch(); +while (my $Ticket = $Tickets->Next) { + $i++; + if ($i % 2) { + $bgcolor = "#dddddd"; + } + else { + $bgcolor = "#ffffff"; + } + </%PERL> +<TR bgcolor="<%$bgcolor%>"> +<TD><input type=checkbox name="UpdateTicket<%$Ticket->Id%>" value="1" CHECKED></TD> +%foreach my $col (@cols) { +<TD> +% if ($col eq 'id') { +<A HREF="<% $RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id()%></A> +% } +%else { +<% eval "\$Ticket->$col()" %> +%} +</TD> +%} +</TR> +%} + + + +</TABLE> + +<HR> + + +<& /Elements/TitleBoxStart, title => loc('Update selected tickets') &> +<TABLE> +<TR> +<TD VALIGN=TOP> <table> -<tr><td class="label"> <&|/l&>Make Owner</&>: </td> -<td class="value"> <& /Elements/SelectOwner, Name => "Owner" &> (<input type="checkbox" class="checkbox" name="ForceOwnerChange" /> <&|/l&>Force change</&>) </td></tr> -<tr><td class="label"> <&|/l&>Add Requestor</&>: </td> -<td class="value"> <input name="AddRequestor" size="20" /> </td></tr> -<tr><td class="label"> <&|/l&>Remove Requestor</&>: </td> -<td class="value"> <input name="DeleteRequestor" size="20" /> </td></tr> -<tr><td class="label"> <&|/l&>Add Cc</&>: </td> -<td class="value"> <input name="AddCc" size="20" /> </td></tr> -<tr><td class="label"> <&|/l&>Remove Cc</&>: </td> -<td class="value"> <input name="DeleteCc" size="20" /> </td></tr> -<tr><td class="label"> <&|/l&>Add AdminCc</&>: </td> -<td class="value"> <input name="AddAdminCc" size="20" /> </td></tr> -<tr><td class="label"> <&|/l&>Remove AdminCc</&>: </td> -<td class="value"> <input name="DeleteAdminCc" size="20" /> </td></tr> +<tr><td class=label> <&|/l&>Make Owner</&>: </td> +<td class=value> <& /Elements/SelectOwner, Name => "Owner" &> (<input type=checkbox name="ForceOwnerChange"> <&|/l&>Force change</&>) </td></tr> +<tr><td class=label> <&|/l&>Add Requestor</&>: </td> +<td class=value> <INPUT Name="AddRequestor" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Remove Requestor</&>: </td> +<td class=value> <INPUT Name="DeleteRequestor" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Add Cc</&>: </td> +<td class=value> <INPUT Name="AddCc" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Remove Cc</&>: </td> +<td class=value> <INPUT Name="DeleteCc" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Add AdminCc</&>: </td> +<td class=value> <INPUT Name="AddAdminCc" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Remove AdminCc</&>: </td> +<td class=value> <INPUT Name="DeleteAdminCc" SIZE=20> </td></tr> </table> -</td> -<td valign="top"> +</TD> +<TD VALIGN=TOP> <table> -<tr><td class="label"> <&|/l&>Make subject</&>: </td> -<td class="value"> <input name="Subject" size="20" /> </td></tr> -<tr><td class="label"> <&|/l&>Make priority</&>: </td> -<td class="value"> <input name="Priority" size="4" /> </td></tr> -<tr><td class="label"> <&|/l&>Make queue</&>: </td> -<td class="value"> <& /Elements/SelectQueue, Name => "Queue" &> </td></tr> -<tr><td class="label"> <&|/l&>Make Status</&>: </td> -<td class="value"> <& /Elements/SelectStatus, Name => "Status" &> </td></tr> -<tr><td class="label"> <&|/l&>Make date Starts</&>: </td> -<td class="value"> <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &> </td></tr> -<tr><td class="label"> <&|/l&>Make date Started</&>: </td> -<td class="value"> <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &> </td></tr> -<tr><td class="label"> <&|/l&>Make date Told</&>: </td> -<td class="value"> <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &> </td></tr> -<tr><td class="label"> <&|/l&>Make date Due</&>: </td> -<td class="value"> <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &> </td></tr> -<tr><td class="label"> <&|/l&>Make date Resolved</&>: </td> -<td class="value"> <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make subject</&>: </td> +<td class=value> <INPUT Name="Subject" SIZE=20> </td></tr> +<tr><td class=label> <&|/l&>Make priority</&>: </td> +<td class=value> <INPUT Name="Priority" SIZE=4> </td></tr> +<tr><td class=label> <&|/l&>Make queue</&>: </td> +<td class=value> <& /Elements/SelectQueue, Name => "Queue" &> </td></tr> +<tr><td class=label> <&|/l&>Make Status</&>: </td> +<td class=value> <& /Elements/SelectStatus, Name => "Status" &> </td></tr> +<tr><td class=label> <&|/l&>Make date Starts</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Starts_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Started</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Started_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Told</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Told_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Due</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Due_Date", ShowTime => 0, Default => '' &> </td></tr> +<tr><td class=label> <&|/l&>Make date Resolved</&>: </td> +<td class=value> <& /Elements/SelectDate, Name => "Resolved_Date", ShowTime => 0, Default => '' &> </td></tr> </table> -</td> -</tr> +</TD> +</TR> </table> -</&> -<&| /Widgets/TitleBox, title => loc('Add comments or replies to selected tickets') &> +<& /Elements/TitleBoxEnd&> +<& /Elements/TitleBoxStart, title => loc('Add comments or replies to selected tickets') &> <table> -<tr><td align="right"><&|/l&>Update Type</&>:</td> +<tr><td align=right><&|/l&>Update Type</&>:</td> <td><select name="UpdateType"> <option value="private" ><&|/l&>Comments (not sent to requestors)</&></option> <option value="response" ><&|/l&>Reply to requestors</&></option> </select> </td></tr> -<tr><td align="right"><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size="60" value="" /></td></tr> +<tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value=""></td></tr> % while (my $CF = $TxnCFs->Next()) { -<tr> -<td align="right"><% $CF->Name %>:</td> -<td><& /Elements/EditCustomField, +<TR> +<TD ALIGN=RIGHT><% $CF->Name %>:</TD> +<TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix => "Object-RT::Transaction--CustomField-" - &><em><% $CF->FriendlyType %></em></td> -</td></tr> + &><em><% $CF->FriendlyType %></em></TD> +</TD></TR> % } # end if while - <tr><td align="right"><&|/l&>Attach</&>:</td><td><input name="UpdateAttachment" type="file" /></td></tr> - <tr><td class="labeltop"><&|/l&>Message</&>:</td><td> + <tr><td align=right><&|/l&>Attach</&>:</td><td><input name="UpdateAttachment" type="file"></td></tr> + <tr><td class=labeltop><&|/l&>Message</&>:</td><td> <& /Elements/MessageBox, Name=>"UpdateContent"&> </td></tr> </table> -</&> -<&|/Widgets/TitleBox, title => loc('Edit Custom Fields'), color => "#336633"&> -<%perl> -my $cfs = RT::CustomFields->new($session{'CurrentUser'}); -$cfs->LimitToGlobal(); -$cfs->LimitToQueue($_) for keys %$seen_queues; -</%perl> -<table> -<tr> -<th><&|/l&>Name</&></th> -<th><&|/l&>Add values</&></th> -<th><&|/l&>Delete values</&></th> -</tr> -% while (my $cf = $cfs->Next()) { -<tr> -<td class="label"><%$cf->Name%><br /> -<em>(<%$cf->FriendlyType%>)</em></td> -% my $rows = 5; -% my @add = (NamePrefix => 'Bulk-Add-CustomField-', CustomField => $cf, Rows => $rows, Multiple => ($cf->MaxValues ==1 ? 0 : 1) , Cols => 25); -% my @del = (NamePrefix => 'Bulk-Delete-CustomField-', CustomField => $cf, Rows => $rows, Multiple => 1, Cols => 25); -% if ($cf->Type eq 'Select') { -<td><& /Elements/EditCustomFieldSelect, @add &></td> -<td><& /Elements/EditCustomFieldSelect, @del &></td> -% } elsif ($cf->Type eq 'Combobox') { -<td><& /Elements/EditCustomFieldCombobox, @add &></td> -<td><& /Elements/EditCustomFieldCombobox, @del &></td> -% } elsif ($cf->Type eq 'Freeform') { -<td><& /Elements/EditCustomFieldFreeform, @add &></td> -<td><& /Elements/EditCustomFieldFreeform, @del &></td> -% } elsif ($cf->Type eq 'Text') { -<td><& /Elements/EditCustomFieldText, @add &></td> -<td> </td> -% } else { -% $RT::Logger->crit("Unknown CustomField type: " . $cf->Type); -% } -</tr> -% } -</table> -</&> +<& /Elements/TitleBoxEnd &> -<&|/Widgets/TitleBox, title => loc('Edit Links'), color => "#336633"&> -<em><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&></em><br /> -<& /Ticket/Elements/BulkLinks &> -</&> - -<& /Elements/Submit, Label => loc('Update') &> +<& /Elements/TitleBoxStart, title => loc('Edit Links'), color => "#336633"&> +<i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&></i><br> +<& /Ticket/Elements/BulkLinks &> +<& /Elements/TitleBoxEnd &> -</form> +<& /Elements/Submit, Label => loc('Update All') &> +</FORM> <%INIT> -my $title = loc("Update multiple tickets"); # Iterate through the ARGS hash and remove anything with a null value. -map ( $ARGS{$_} =~ /^$/ && ( delete $ARGS{$_} ), keys %ARGS ); - -my (@results); - -$Page ||= 1; - -$Format ||= $RT::DefaultSearchResultFormat; - -# inject _CHECKBOX to the first field. -$Format =~ s/'?([^']+)'?,/'___CHECKBOX__$1',/; - -my $Tickets = RT::Tickets->new( $session{'CurrentUser'} ); -$Tickets->FromSQL($Query); -if ( $OrderBy =~ /\|/ ) { - - # Multiple Sorts - my @OrderBy = split /\|/, $OrderBy; - my @Order = split /\|/, $Order; - $Tickets->OrderByCols( - map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } - ( 0 .. $#OrderBy ) ); -} -else { - $Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order ); -} - -$Tickets->RowsPerPage($Rows) if ($Rows); -$Tickets->GotoPage( $Page - 1 ); # SB uses page 0 as the first page - -Abort( loc("No search to operate on.") ) unless ($Tickets); - -# build up a list of all custom fields for tickets that we're displaying, so -# we can display sane edit widgets. - -my $fields = {}; -my $seen_queues = {}; -while ( my $ticket = $Tickets->Next ) { - next if $seen_queues->{ $ticket->Queue }++; - - my $custom_fields = $ticket->QueueObj->TicketCustomFields; - while ( my $field = $custom_fields->Next ) { - $fields->{ $field->id } = $field; +map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); + +my ($bgcolor, @results); +my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString ); + + +my $Tickets = RT::Tickets->new($session{'CurrentUser'}); +$Tickets->FromSQL($ARGS{'Query'}); + +Abort(loc("No search to operate on.")) unless ($Tickets); + +my %allcfs; +my %cfqnames; +my %cfqs; +my $count = 0; +while (my $Ticket = $Tickets->Next) { + my $cfq = $Ticket->QueueObj; + my $cfqid = $cfq->Id; + my $cfqn = $cfq->Name; + unless ( exists $cfqs{$cfqid} ) { + $cfqs{$cfqid} = 1; + $count++; + my $cfs = $cfq->TicketCustomFields; + while (my $cf = $cfs->Next) { + $allcfs{$cf->Id} = $cf; + $cfqnames{$cf->Id} = $cfqn; + } } } -my $do_comment_reply = 0; - +my $do_comment_reply=0; # Prepare for ticket updates -if ($ARGS{'UpdateContent'}) { - $ARGS{'UpdateContent'} =~ s/\r\n/\n/g; - chomp( $ARGS{'UpdateContent'} ); - - if ($ARGS{'UpdateContent'} ne '' - && $ARGS{'UpdateContent'} ne "-- \n" - . $session{'CurrentUser'}->UserObj->Signature ) { - $do_comment_reply = 1; - } +$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 @@ -266,131 +229,50 @@ my @linkresults; my %queues; $Tickets->RedoSearch(); - -# pull out the labels for any custom fields we want to update - -my $cf_del_keys; -@$cf_del_keys = grep { /^Bulk-Delete-CustomField/ } keys %ARGS; -my $cf_add_keys; -@$cf_add_keys = grep { /^Bulk-Add-CustomField/ } keys %ARGS; - - -while ( my $Ticket = $Tickets->Next ) { - next unless ( $ARGS{ "UpdateTicket" . $Ticket->Id } ); - - #Update the links - $ARGS{'id'} = $Ticket->id; - $queues{ $Ticket->QueueObj->Id }++; - - my @updateresults; +while (my $Ticket = $Tickets->Next) { + $queues{$Ticket->QueueObj->Id}++; + $RT::Logger->debug( "Checking Ticket ".$Ticket->Id ."\n"); + next unless ($ARGS{"UpdateTicket".$Ticket->Id}); + $RT::Logger->debug ("Matched\n"); + my @updateresults; if ($do_comment_reply) { - ProcessUpdateMessage( - TicketObj => $Ticket, - ARGSRef => \%ARGS, - Actions => \@updateresults - ); + ProcessUpdateMessage(TicketObj => $Ticket, ARGSRef => \%ARGS, Actions => \@updateresults); } #Update the basics. - my @basicresults = - ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS ); - my @dateresults = - ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS ); - + my @basicresults = ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS); + my @dateresults = ProcessTicketDates(TicketObj => $Ticket, ARGSRef => \%ARGS); #Update the watchers - my @watchresults = - ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS ); + my @watchresults = ProcessTicketWatchers(TicketObj => $Ticket, ARGSRef => \%ARGS); - foreach my $type qw(MergeInto DependsOn MemberOf RefersTo) { - $ARGS{ $Ticket->id . "-" . $type } = $ARGS{"Ticket-$type"}; - $ARGS{ $type . "-" . $Ticket->id } = $ARGS{"$type-Ticket"}; - } - @linkresults = - ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS ); - foreach my $type qw(MergeInto DependsOn MemberOf RefersTo) { - delete $ARGS{ $type . "-" . $Ticket->id }; - delete $ARGS{ $Ticket->id . "-" . $type }; - } - - my @cfresults; - - foreach my $list ( $cf_add_keys, $cf_del_keys ) { - next unless $list->[0]; - - - my $op; - if ( $list->[0] =~ /Add/ ) { - $op = 'add'; - - } - elsif ( $list->[0] =~ /Del/ ) { - $op = 'del'; - } - else { - $RT::Logger->crit( - "Got an op that was neither add nor delete. can never happen" - . $list->[0] ); - last; - } - - foreach my $key (@$list) { - my ( $cfid, $cf ); - if ( $key =~ /CustomField-(\d+)-/ ) { - $cfid = $1; - $cf = RT::CustomField->new( $session{'CurrentUser'} ); - $cf->Load($cfid); - } - else {next} - my @values = - ref( $ARGS{$key} ) eq 'ARRAY' - ? @{ $ARGS{$key} } - : ( $ARGS{$key} ); - map { s/(\r\n|\r)/\n/g; } @values; # fix the newlines - # now break the multiline values into multivalues - @values = map { split( /\n/, $_ ) } @values - unless ( $cf->SingleValue ); - - my $current_values = $Ticket->CustomFieldValues($cfid); - foreach my $value (@values) { - if ( $op eq 'del' && $current_values->HasEntry($value) ) { - my ( $id, $msg ) = $Ticket->DeleteCustomFieldValue( - Field => $cfid, - Value => $value - ); - push @cfresults, $msg; - } - - elsif ( $op eq 'add' && !$current_values->HasEntry($value) ) { - my ( $id, $msg ) = $Ticket->AddCustomFieldValue( - Field => $cfid, - Value => $value - ); - push @cfresults, $msg; - } - } - } - } - my @tempresults = ( - @watchresults, @basicresults, @dateresults, - @updateresults, @linkresults, @cfresults - ); - - @tempresults = - map { loc( "Ticket [_1]: [_2]", $Ticket->Id, $_ ) } @tempresults; - @results = ( @results, @tempresults ); + #Update the links + $ARGS{'id'} = $Ticket; + $ARGS{$Ticket->Id.'-MergeInto'} = $ARGS{'Ticket-MergeInto'}; + $ARGS{$Ticket->Id.'-DependsOn'} = $ARGS{'Ticket-DependsOn'}; + $ARGS{'DependsOn-'.$Ticket->Id} = $ARGS{'DependsOn-Ticket'}; + $ARGS{$Ticket->Id.'-MemberOf'} = $ARGS{'Ticket-MemberOf'}; + $ARGS{'MemberOf-'.$Ticket->Id} = $ARGS{'MemberOf-Ticket'}; + $ARGS{$Ticket->Id.'-RefersTo'} = $ARGS{'Ticket-RefersTo'}; + $ARGS{'RefersTo-'.$Ticket->Id} = $ARGS{'RefersTo-Ticket'}; + @linkresults = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); + delete $ARGS{'id'}; + delete $ARGS{$Ticket->Id.'-MergeInto'}; + delete $ARGS{$Ticket->Id.'-DependsOn'}; + delete $ARGS{'DependsOn-'.$Ticket->Id}; + delete $ARGS{$Ticket->Id.'-MemberOf'}; + delete $ARGS{'MemberOf-'.$Ticket->Id}; + delete $ARGS{$Ticket->Id.'-RefersTo'}; + delete $ARGS{'RefersTo-'.$Ticket->Id}; + my @tempresults = (@watchresults, @basicresults, @dateresults, + @updateresults, @linkresults); + @tempresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @tempresults; + + @results = (@results, @tempresults); } -my $TxnCFs = RT::CustomFields->new( $session{CurrentUser} ); -$TxnCFs->LimitToLookupType( RT::Transaction->CustomFieldLookupType ); -$TxnCFs->LimitToGlobalOrObjectId( sort keys %queues ); +my $TxnCFs = RT::CustomFields->new($session{CurrentUser}); +$TxnCFs->LimitToLookupType("RT::Queue-RT::Ticket-RT::Transaction"); +$TxnCFs->LimitToGlobalOrObjectId(sort keys %queues); </%INIT> -<%args> -$Format => undef -$Page => 1 -$Rows => undef -$Order => 'ASC' -$OrderBy => 'id' -$Query => undef -</%args> diff --git a/rt/html/Search/Edit.html b/rt/html/Search/Edit.html index 21df0db97..16e8a0e71 100755 --- a/rt/html/Search/Edit.html +++ b/rt/html/Search/Edit.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -58,11 +56,11 @@ <& Elements/NewListActions, actions => \@actions &> <form method="post" action="Build.html"> -<input type="hidden" class="hidden" name="SearchId" value="<%$SearchId%>" /> +<input type="hidden" name="SearchId" value="<%$SearchId%>"> <textarea name="Query" rows="8" cols="72"><%$Query%></textarea> -<br /> +<br> <textarea name="Format" rows="8" cols="72"><%$Format%></textarea> -<br /> +<br> <& /Elements/Submit, Label => loc("Apply"), Reset => 1, Caption => loc("Apply your changes")&> </form> diff --git a/rt/html/Search/Elements/BuildFormatString b/rt/html/Search/Elements/BuildFormatString index 3bd39b5c2..cffb81a48 100644 --- a/rt/html/Search/Elements/BuildFormatString +++ b/rt/html/Search/Elements/BuildFormatString @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -173,12 +171,12 @@ elsif ( $AddCol ) { $column{Column} = $col; if ( $Face eq "Bold" ) { - $column{Prefix} .= "<b>"; - $column{Suffix} .= "</b>"; + $column{Prefix} .= "<B>"; + $column{Suffix} .= "</B>"; } if ( $Face eq "Italic" ) { - $column{Prefix} .= "<i>"; - $column{Suffix} .= "</i>"; + $column{Prefix} .= "<I>"; + $column{Suffix} .= "</I>"; } if ($Size) { $column{Prefix} .= "<" . $m->interp->apply_escapes( $Size, 'h' ) . ">"; @@ -186,11 +184,11 @@ elsif ( $AddCol ) { } if ( $Link eq "Display" ) { $column{Prefix} .= - "<a HREF=\"" . $RT::WebPath . "/Ticket/Display.html?id=__id__\">"; + "<A HREF=\"" . $RT::WebPath . "/Ticket/Display.html?id=__id__\">"; $column{Suffix} .= "</a>"; } elsif ( $Link eq "Take" ) { - $column{Prefix} .= "<a HREF=\"" . $RT::WebPath + $column{Prefix} .= "<A HREF=\"" . $RT::WebPath . "/Ticket/Display.html?Action=Take&id=__id__\">"; $column{Suffix} .= "</a>"; } @@ -225,13 +223,10 @@ elsif ( $ColDown ) { my @format_string; foreach my $field (@seen) { next unless $field; - my $row = "'"; - $row .= $field->{Prefix} if $field->{Prefix}; - $row .= "__" . ($field->{Column} =~ m/\(/ ? $field->{Column} # func, don't escape - : $m->interp->apply_escapes( $field->{Column}, 'h' )) . "__" + my $row = "'" . $field->{Prefix}; + $row .= "__" . $m->interp->apply_escapes( $field->{Column}, 'h' ) . "__" unless ( $field->{Column} eq "<blank>" ); - $row .= $field->{Suffix} if $field->{Suffix}; - $row .= "'"; + $row .= $field->{Suffix} . "'"; push( @format_string, $row ); } diff --git a/rt/html/Search/Elements/DisplayOptions b/rt/html/Search/Elements/DisplayOptions index 4bed0902b..43a9d9998 100644 --- a/rt/html/Search/Elements/DisplayOptions +++ b/rt/html/Search/Elements/DisplayOptions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,53 +43,43 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<&| /Widgets/TitleBox, title => loc("Display Columns") &> +<& /Elements/TitleBoxStart, title => loc("Display Columns") &> <table> <tr> <td> <& EditFormat, %ARGS &> </td> -<td valign="top"> -<table valign="top"> - -% for my $o (0..3) { +<td valign=top> +<table valign=top> <tr> -<td class="label"> -% if ($o == 0) { +<td class=label> <&|/l&>Order by</&>: -% } -</td> -<td class="value"> +</td><td class=value> <select name="OrderBy"> -% if ($o > 0) { -<option value="">[none]</option> -% } -% foreach my $field (sort keys %fields) { +% foreach my $field (keys %fields) { % next unless $field; -<option value="<%$field%>" -% if (defined $OrderBy[$o] and $field eq $OrderBy[$o]) { -selected +<option value=<%$field%> +% if ($field =~ /^$OrderBy$/i) { +SELECTED % } ><&|/l&><%$field%></&></option> % } </select> <select name="Order"> <option value="ASC" -% unless ( ($Order[$o]||'') eq "DESC" ) { -selected +% if ($Order eq "ASC") { +SELECTED % } -><&|/l&>Asc</&></option> +><&|/l&>Ascending</&></option> <option value="DESC" -% if ( ($Order[$o]||'') eq "DESC" ) { -selected +% if ($Order eq "DESC") { +SELECTED % } -><&|/l&>Desc</&></option> +><&|/l&>Descending</&></option> </select> </td> </tr> -% } -<tr> -<td class="label"> +<td class=label> <&|/l&>Rows per page</&>: </td><td class="value"> <& /Elements/SelectResultsPerPage, @@ -103,34 +91,14 @@ selected </td> </tr> </table> -</&> +<& /Elements/TitleBoxEnd &> <%INIT> my $tickets = new RT::Tickets($session{'CurrentUser'}); my %fields = %{$tickets->FIELDS}; map { $fields{$_}->[0] =~ /^(?:ENUM|INT|DATE|STRING)$/ || delete $fields{$_} } keys %fields; delete $fields{'EffectiveId'}; -$fields{ $_ . '.EmailAddress' } = 1 foreach( qw(Requestor Cc AdminCc) ); - -# Add all available CustomFields to the list of sortable columns. -my @cfs = grep /^CustomField/, @{$ARGS{AvailableColumns}}; -$fields{$_}=1 for @cfs; - -# Add PAW sort -$fields{'Custom.Ownership'} = 1; -my @Order; -my @OrderBy; -if ($OrderBy =~ /\|/) { - @OrderBy = split /\|/, $OrderBy; -} else { - @OrderBy = ( $OrderBy ); -} -if ($Order =~ /\|/) { - @Order = split /\|/, $Order; -} else { - @Order = ( $Order ); -} </%INIT> @@ -139,5 +107,4 @@ $Order => undef $OrderBy => undef $RowsPerPage => undef $Format => undef -$GroupBy => 'id' </%ARGS> diff --git a/rt/html/Search/Elements/EditFormat b/rt/html/Search/Elements/EditFormat index fa0ac96e0..dc8720f26 100644 --- a/rt/html/Search/Elements/EditFormat +++ b/rt/html/Search/Elements/EditFormat @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -58,7 +56,7 @@ <&|/l&>Show Columns</&>: </td> <tr> -<td valign="top"> +<td valign=top> <select size="6" name="SelectDisplayColumns" multiple> % foreach my $field ( @$AvailableColumns) { <option value="<%$field%>"><% loc( $field) %></option> @@ -73,14 +71,14 @@ <option value="Display"><&|/l&>Display</&></option> <option value="Take"><&|/l&>Take</&></option> </select> -<br /><&|/l&>Title</&>: <input name="Title" size="10" /> -<br /><&|/l&>Size</&>: +<br><&|/l&>Title</&>: <input name="Title" size=10> +<br><&|/l&>Size</&>: <select name="Size"> <option value="">-</option> <option value="Small"><&|/l&>Small</&></option> <option value="Large"><&|/l&>Large</&></option> </select> -<br /><&|/l&>Style</&>: +<br><&|/l&>Style</&>: <select name="Face"> <option value="">-</option> <option value="Bold"><&|/l&>Bold</&></option> @@ -88,24 +86,24 @@ </select> </td> <td> -<input type="submit" class="button" name="AddCol" value=" → " /> +<input type=submit name="AddCol" value="->"> </td> -<td valign="top"> -<select size="4" name="CurrentDisplayColumns"> +<td valign=top> +<select size=4 name="CurrentDisplayColumns"> % my $i=0; % foreach my $field (@$CurrentFormat) { <option value="<%$i++%>><%$field->{Column}%>"> <%loc( $field->{Column}) %></option> % } </select> -<br /> +<br> <center> -<input type="submit" class="button" name="ColUp" value=" ↑ " /> -<input type="submit" class="button" name="ColDown" value=" ↓ " /> -<input type="submit" class="button" name="RemoveCol" value="<%loc('Delete')%>" /> +<input type="submit" name="ColUp" value="^"> +<input type="submit" name="ColDown" value="v"> +<input type="submit" name="RemoveCol" value="<%loc('Delete')%>"> </center> </td> -<td colspan="3" align="center"> +<td colspan=3 align=center> </td> </tr> </table> diff --git a/rt/html/Search/Elements/EditQuery b/rt/html/Search/Elements/EditQuery index 5c40c2573..783541a64 100644 --- a/rt/html/Search/Elements/EditQuery +++ b/rt/html/Search/Elements/EditQuery @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -46,20 +44,20 @@ %# %# END BPS TAGGED BLOCK }}} <& NewListActions, actions => $actions &> -<&|/Widgets/TitleBox, title => join(': ', grep defined, loc("Current search"), $Description) &> +<& /Elements/TitleBoxStart, title => join(': ', grep defined, loc("Query"), $Description) &> <select size="10" name="clauses" style="width: 100%" multiple> % $m->out($optionlist); </select> <p align="center"> -<input type="submit" class="button" name="Up" value=" ↑ " /> -<input type="submit" class="button" name="Down" value=" ↓ " /> -<input type="submit" class="button" name="Left" value=" ← " /> -<input type="submit" class="button" name="Right" value=" → " /> -<input type="submit" class="button" name="Toggle" value="<&|/l&>And/Or</&>" /> -<input type="submit" class="button" name="DeleteClause" value="<&|/l&>Delete</&>" /> -%#<input type="submit" class="button" name="EditQuery" value="Advanced" /> +<input type=submit name="Up" value="^"> +<input type=submit name="Down" value="v"> +<input type=submit name="Left" value="<"> +<input type=submit name="Right" value=">"> +<input type=submit name="Toggle" value="<&|/l&>And/Or</&>"> +<input type=submit name="DeleteClause" value="<&|/l&>Delete</&>"> +%#<input type=submit name="EditQuery" value="Advanced"> </p> -</&> +<& /Elements/TitleBoxEnd &> <%ARGS> $Description $optionlist diff --git a/rt/html/Search/Elements/EditSearches b/rt/html/Search/Elements/EditSearches index 9ab9f944d..bc6b80e6f 100644 --- a/rt/html/Search/Elements/EditSearches +++ b/rt/html/Search/Elements/EditSearches @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,59 +43,62 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<&| /Widgets/TitleBox, title => loc($Title)&> +<& /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 &><br /> +<& SearchPrivacy, Object => $CurrentSearch->{'Object'}->Object &><br> % } else { -<& SelectSearchObject, Name => 'Owner', Objects => \@Objects &><br /> +<& SelectSearchObject, Name => 'Owner', Objects => \@Objects &><br> % } <&|/l&>Description</&>:<br> -<font size="-1"><input size="25" name="Description" value="<%$CurrentSearch->{'Description'} || ''%>" /></font> +<font size="-1"><input size="25" name="Description" value="<%$CurrentSearch->{'Description'}%>"></font> <nobr> % if ($SearchId ne 'new') { % if ($Dirty) { -<input type="submit" class="button" name="Revert" value="<%loc('Revert')%>" /> -% } -<input type="submit" class="button" name="Delete" value="<%loc('Delete')%>" /> -% if ($AllowCopy) { -<input type="submit" class="button" name="CopySearch" value="<%loc('Copy')%>" /> +<input type="submit" name="Revert" value="<%loc('Revert')%>"> % } +<input type="submit" name="Delete" value="<%loc('Delete')%>"> +<input type="submit" name="CopySearch" value="<%loc('Copy')%>"> </nobr> % } -<input type="submit" name="Save" value="<%loc('Save')%>" class="button" /> -<hr /> + +% if ($Dirty or $SearchId eq 'new') { +<input type="submit" name="Save" value="<%loc('Save')%>"> +% } +<hr> % } -<&|/l&>Load saved search:</&><br /> -<& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects, SearchType => $SearchType &> -<input value="<%loc('Load')%>" type="submit" class="button" /> -</&> +<&|/l&>Load saved search:</&><br> +<& SelectSearchesForObjects, Name => 'LoadSavedSearch', Objects => \@Objects&> +<input value="<%loc('Load')%>" type="submit"> +<& /Elements/TitleBoxEnd &> <%init> + unless ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch', - Object=> $RT::System )) { + Object=> $RT::System )) { return; } +my @Objects; + +push @Objects, $session{CurrentUser}->UserObj; + +my $groups = RT::Groups->new($session{'CurrentUser'}); -use RT::SavedSearches; -my @Objects = RT::SavedSearches->new($session{CurrentUser})->_PrivacyObjects; -push @Objects, RT::System->new($session{'CurrentUser'}) - if $session{'CurrentUser'}->HasRight( Object=> $RT::System, - Right => 'SuperUser'); +$groups->LimitToUserDefinedGroups; +$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id, + Recursively => 1); + push (@Objects, @{$groups->ItemsArrayRef()}); </%INIT> <%ARGS> -$SearchType => 'Ticket' $SearchId => undef $CurrentSearch => undef $Description => undef $HideResults => 0 $Dirty => 0 -$AllowCopy => 1 -$Title => 'Saved searches' </%ARGS> diff --git a/rt/html/Search/Elements/NewListActions b/rt/html/Search/Elements/NewListActions index 535ac8cb9..eb82544f3 100644 --- a/rt/html/Search/Elements/NewListActions +++ b/rt/html/Search/Elements/NewListActions @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -46,19 +44,19 @@ %# %# END BPS TAGGED BLOCK }}} % if ($actions[0] ) { -<b><%loc('Results')%></b><br /> +<b><%loc('Results')%></b><br> % foreach my $action (@actions) { % next unless ($action); % my @item = @$action; % if ($item[1] < 0) { -<font color="red"> +<font color=red> % } - <%$item[0]%><br /> + <%$item[0]%><BR> % if ($item[1] < 0) { </font> % } % } -<br /> +<BR> % } <%init> @actions = grep (/./,@actions); diff --git a/rt/html/Search/Elements/PickBasics b/rt/html/Search/Elements/PickBasics index 44a378c14..8a48f6b18 100644 --- a/rt/html/Search/Elements/PickBasics +++ b/rt/html/Search/Elements/PickBasics @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -51,11 +49,11 @@ </td><td> <& /Elements/SelectEqualityOperator, Name => "idOp" &> </td><td> -<input name="ValueOfid" size="5" /> +<INPUT Name="ValueOfid" SIZE=5> </td> </tr> -<tr><td> +<tr><td align=right> <& /Elements/SelectAttachmentField, Name => 'AttachmentField' &> </td><td> <& /Elements/SelectBoolean, Name => "AttachmentOp", @@ -65,7 +63,7 @@ FalseVal => 'NOT LIKE' &> </td><td> -<input name="ValueOfAttachment" size="20" /> +<Input Name="ValueOfAttachment" Size=20> </td> </tr> <tr> @@ -99,11 +97,11 @@ </td> </tr> <tr><td class="label"> -<select name="ActorField"> -<option value="Owner"><&|/l&>Owner</&></option> -<option value="Creator"><&|/l&>Creator</&></option> -<option value="LastUpdatedBy"><&|/l&>LastUpdatedBy</&></option> -</select> +<SELECT NAME="ActorField"> +<OPTION VALUE="Owner"><&|/l&>Owner</&></OPTION> +<OPTION VALUE="Creator"><&|/l&>Creator</&></OPTION> +<OPTION VALUE="LastUpdatedBy"><&|/l&>LastUpdatedBy</&></OPTION> +</SELECT> </td><td> <& /Elements/SelectBoolean, Name => "ActorOp", TrueVal=> '=', @@ -119,7 +117,21 @@ </td><td> <& /Elements/SelectMatch, Name => "WatcherOp" &> </td><td> -<input name="ValueOfWatcher" size="20" /> +<Input Name="ValueOfWatcher" Size=20> +</tr> +<tr> +<td class="label"> +<& SelectPersonType, Name => 'WatcherGroupField', Default => 'RequestorGroup', Suffix => 'Group' &> +</td><td> +<& /Elements/SelectBoolean, Name => "WatcherGroupOp", + True=> loc('belongs to'), + False=> loc('does not belong to'), + TrueVal=> '=', + FalseVal => '!=' +&> +</td><td> +<& SelectGroup, Name => 'ValueOfWatcherGroup' &> +</td> </tr> <tr> <td class="label"> @@ -131,29 +143,28 @@ </td></tr> <tr> <td class="label"> -<select name="TimeField"> -<option value="TimeWorked"><&|/l&>Time Worked</&></option> -<option value="TimeEstimated"><&|/l&>Time Estimated</&></option> -<option value="TimeLeft"><&|/l&>Time Left</&></option> -</select> +<SELECT NAME="TimeField"> +<OPTION VALUE="TimeWorked"><&|/l&>Time Worked</&></OPTION> +<OPTION VALUE="TimeEstimated"><&|/l&>Time Estimated</&></OPTION> +<OPTION VALUE="TimeLeft"><&|/l&>Time Left</&></OPTION> +</SELECT> </td><td> <& /Elements/SelectEqualityOperator, Name => "TimeOp" &> </td><td> -<input name="ValueOfTime" size="5" /> -<& /Elements/SelectTimeUnits, Name =>'ValueOfTime' &> +<INPUT Name="ValueOfTime" SIZE=5> </td> </tr> <tr> <td class="label"> -<select name="PriorityField"> -<option value="Priority"><&|/l&>Priority</&></option> -<option value="InitialPriority"><&|/l&>Initial Priority</&></option> -<option value="FinalPriority"><&|/l&>Final Priority</&></option> -</select> +<SELECT NAME="PriorityField"> +<OPTION VALUE="Priority"><&|/l&>Priority</&></OPTION> +<OPTION VALUE="InitialPriority"><&|/l&>Initial Priority</&></OPTION> +<OPTION VALUE="FinalPriority"><&|/l&>Final Priority</&></OPTION> +</SELECT> </td><td> <& /Elements/SelectEqualityOperator, Name => "PriorityOp" &> </td><td> -<input name="ValueOfPriority" size="5" /> +<INPUT Name="ValueOfPriority" SIZE=5> </td> </tr> <tr> @@ -166,7 +177,7 @@ TrueVal=> '=', FalseVal => '!=' &> </td><td> -<input name="ValueOfLinks" value="" size="5" /> +<INPUT Name="ValueOfLinks" value="" SIZE=5> </td></tr> <%INIT> my @people = ('Actor', diff --git a/rt/html/Search/Elements/PickCFs b/rt/html/Search/Elements/PickCFs index 734f5f871..435a07ad3 100644 --- a/rt/html/Search/Elements/PickCFs +++ b/rt/html/Search/Elements/PickCFs @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/Search/Elements/PickCriteria b/rt/html/Search/Elements/PickCriteria index 58b29fb57..129344443 100644 --- a/rt/html/Search/Elements/PickCriteria +++ b/rt/html/Search/Elements/PickCriteria @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,12 +43,12 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<&| /Widgets/TitleBox, title => loc('Add Criteria')&> -<table width="100%" cellspacing="0" cellpadding="0" border="0"> +<& /Elements/TitleBoxStart, title => loc('Add Criteria')&> +<table width=100% cellspacing=0 cellpadding=0 border=0> <tr> <td> - <table cellspacing="0" border="0"> - <tr><td class="label"> + <table cellspacing=0 border=0> + <tr><td class=label> <&|/l&>Aggregator</&>: </td> <td><& SelectAndOr, Name => "AndOr" &> @@ -63,8 +61,8 @@ </td> </tr> <tr> - <td valign="top"> - <table cellspacing="0" border="0"> + <td valign=top> + <table cellspacing=0 border=0> <& PickBasics &> <& PickCFs, cfqueues => \%cfqueues &> </table> @@ -73,7 +71,7 @@ <tr><td> </td></tr> </table> -</&> +<& /Elements/TitleBoxEnd &> <%ARGS> $addquery => 0 diff --git a/rt/html/Search/Elements/SearchPrivacy b/rt/html/Search/Elements/SearchPrivacy index 745ba62ac..270e1baa3 100644 --- a/rt/html/Search/Elements/SearchPrivacy +++ b/rt/html/Search/Elements/SearchPrivacy @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/Search/Elements/SelectAndOr b/rt/html/Search/Elements/SelectAndOr index c8122660a..2f3c70477 100644 --- a/rt/html/Search/Elements/SelectAndOr +++ b/rt/html/Search/Elements/SelectAndOr @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,8 +43,8 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<input type="radio" class="radio" name="<%$Name%>" checked value="AND" /><&|/l&>AND</&></input> -<input type="radio" class="radio" name="<%$Name%>" value="OR" /><&|/l&>OR</&></input> +<input type=radio NAME="<%$Name%>" CHECKED VALUE="AND"><&|/l&>AND</&></input> +<input type=radio NAME="<%$Name%>" VALUE="OR"><&|/l&>OR</&></input> <%ARGS> $Name => "Operator" diff --git a/rt/html/Search/Elements/SelectGroup b/rt/html/Search/Elements/SelectGroup index 3f78d3964..edd53713f 100644 --- a/rt/html/Search/Elements/SelectGroup +++ b/rt/html/Search/Elements/SelectGroup @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,14 +43,14 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<select name="<%$Name%>"> +<SELECT NAME="<%$Name%>"> % if ($AllowNull) { -<option value="">-</option> +<OPTION VALUE="">-</OPTION> % } %while (my $group = $groups->Next) { -<option value="<%$group->id%>" <%$group->id eq $Default && "SELECTED"%>><%$group->Name%></option> +<OPTION VALUE="<%$group->id%>" <%$group->id eq $Default && "SELECTED"%>><%$group->Name%></OPTION> %} -</select> +</SELECT> <%INIT> my $groups = new RT::Groups($session{'CurrentUser'}); diff --git a/rt/html/Search/Elements/SelectLinks b/rt/html/Search/Elements/SelectLinks index f3586528d..00ec80bd3 100644 --- a/rt/html/Search/Elements/SelectLinks +++ b/rt/html/Search/Elements/SelectLinks @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,11 +43,11 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<select name="<%$Name%>"> +<SELECT NAME="<%$Name%>"> % foreach (@fields) { -<option value="<%$_%>"><&|/l&><%$_%></&></option> +<OPTION VALUE="<%$_%>"><&|/l&><%$_%></&></OPTION> % } -</select> +</SELECT> <%ARGS> $Name => 'LinksField' </%ARGS> diff --git a/rt/html/Search/Elements/SelectPersonType b/rt/html/Search/Elements/SelectPersonType index bc631dbb0..d4127c97b 100644 --- a/rt/html/Search/Elements/SelectPersonType +++ b/rt/html/Search/Elements/SelectPersonType @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,20 +43,20 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<select NAME ="<%$Name%>"> +<SELECT NAME ="<%$Name%>"> % if ($AllowNull) { -<option value="">-</option> +<OPTION VALUE="">-</OPTION> % } % for my $option (@types) { % if ($Suffix) { -<option value="<% $option %><% $Suffix %>" <%$option eq $Default && "SELECTED"%> ><%loc($option)%></option> +<OPTION VALUE="<% $option %><% $Suffix %>" <%$option eq $Default && "SELECTED"%> ><%loc($option)%></OPTION> % next; % } % foreach my $subtype (@subtypes) { -<option value="<%"$option.$subtype"%>" <%$option eq $Default && $subtype eq 'EmailAddress' && "SELECTED"%> ><% loc($option) %> <% loc($subtype) %></option> +<OPTION VALUE="<%"$option.$subtype"%>" <%$option eq $Default && $subtype eq 'EmailAddress' && "SELECTED"%> ><% loc($option) %> <% loc($subtype) %></OPTION> % } % } -</select> +</SELECT> <%INIT> my @types; diff --git a/rt/html/Search/Elements/SelectSearchObject b/rt/html/Search/Elements/SelectSearchObject index f52a83372..e9df5179f 100644 --- a/rt/html/Search/Elements/SelectSearchObject +++ b/rt/html/Search/Elements/SelectSearchObject @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: diff --git a/rt/html/Search/Elements/SelectSearchesForObjects b/rt/html/Search/Elements/SelectSearchesForObjects index dc8368577..e6be66a58 100644 --- a/rt/html/Search/Elements/SelectSearchesForObjects +++ b/rt/html/Search/Elements/SelectSearchesForObjects @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -48,7 +46,6 @@ <%args> @Objects => undef $Name => undef -$SearchType => 'Ticket', </%args> <select name="<%$Name%>"> % foreach my $object (@Objects) { @@ -60,9 +57,9 @@ $SearchType => 'Ticket', % } % my @searches = $object->Attributes->Named('SavedSearch'); % foreach my $search (@searches) { -% # Skip it if it is not of search type we want. +% # Skip it if it is not a ticket search. % next if ($search->SubValue('SearchType') -% && $search->SubValue('SearchType') ne $SearchType); +% && $search->SubValue('SearchType') ne 'Ticket'); <option value="<%ref($object)%>-<%$object->id%>-SavedSearch-<%$search->Id%>"> -<%$search->Description||loc('Unnamed search')%></option> % } % } diff --git a/rt/html/Search/Results.html b/rt/html/Search/Results.html index 917cebfa5..5849378a8 100755 --- a/rt/html/Search/Results.html +++ b/rt/html/Search/Results.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,8 +43,7 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'}, - RSSAutoDiscovery => $RSSFeedURL &> +<& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &> <& /Ticket/Elements/Tabs, current_tab => "Search/Results.html".$QueryString, Title => $title, @@ -66,82 +63,45 @@ BaseURL => $RT::WebPath."/Search/Results.html?" &> -% my %hiddens = (Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order, HideResults => $HideResults, Page => $Page ); -<div align="right"> -<form method="get" action="<%$RT::WebPath%>/Search/Results.html"> -%foreach my $key (keys(%hiddens)) { -<input type="hidden" class="hidden" name="<%$key%>" value="<%defined($hiddens{$key})?$hiddens{$key}:''%>"/> -%} +<div align=right> +<form method=get action="<%$RT::WebPath%>/Search/Results.html"> +<input type="hidden" name="Query" value="<%$Query%>" /> +<input type="hidden" name="Format" value="<%$Format%>" /> +<input type="hidden" name="HideResults" value="<%$HideResults%>" /> +<input type="hidden" name="Rows" value="<%$Rows%>" /> +<input type="hidden" name="Page" value="<%$Page%>" /> +<input type="hidden" name="OrderBy" value="<%$OrderBy%>" /> +<input type="hidden" name="Order" value="<%$Order%>" /> <& /Elements/Refresh, Name => 'TicketsRefreshInterval', Default => $session {'tickets_refresh_interval'} &> -<input type="submit" class="button" value="<&|/l&>Go!</&>" /> +<input type=submit value="<&|/l&>Go!</&>"> </form> </div> -<div align="right"> -<a href="<%$RT::WebPath%>/Search/Bulk.html<%$QueryString%>"><&|/l&>Update multiple tickets</&></a><br /> -<a href="<%$RT::WebPath%>/Search/Results.html<%$QueryString%>"><&|/l&>Bookmarkable link</&></a><br /> +<div align=right> +<a href="<%$RT::WebPath%>/Search/Bulk.html<%$QueryString%>"><&|/l&>Update multiple tickets</&></a><br> +<a href="<%$RT::WebPath%>/Search/Results.html<%$QueryString%>"><&|/l&>Bookmarkable link</&></a><br> <a href="<%$RT::WebPath%>/Search/Results.tsv<%$QueryString%>"><&|/l&>spreadsheet</&></a> | -<a href="<%$RSSFeedURL%>"><&|/l&>RSS</&></a> | -<a href="<%$RT::WebPath%>/Tools/Offline.html<%$ShortQueryString%>"><&|/l&>Work offline</&></a><br /> -<form method="get" action="<%$RT::WebPath%>/Search/Chart.html"><&|/l&>chart</&> -% %hiddens = (Query => $Query, Format => $Format, Rows => $Rows, OrderBy => $OrderBy, Order => $Order); -%foreach my $key (keys(%hiddens)) { -<input type="hidden" class="hidden" name="<%$key%>" value="<%defined($hiddens{$key})?$hiddens{$key}:''%>"/> -%} -<&|/l, $m->scomp('Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $Query) &>grouped by [_1]</&> -<&|/l, $m->scomp('Elements/SelectChartType', Name => 'ChartStyle') &>style: [_1]</&> -<input type="submit" class="button" value="<%loc('Go')%>" /> -</form> +<a href="<%$RT::WebPath%>/Search/Results.rdf<%$ShortQueryString%>"><&|/l&>RSS</&></a> | +<a href="<%$RT::WebPath%>/Tools/Offline.html<%$ShortQueryString%>"><&|/l&>Work offline</&></a><br> <& /Elements/Callback, _CallbackName => 'SearchActions', QueryString => $QueryString&> </div> <%INIT> -# Read from user preferences -my $prefs = $session{'CurrentUser'}->UserObj->Preferences("SearchDisplay") || {}; - -# These variables are what define a search_hash; this is also -# where we give sane defaults. -$Format ||= $prefs->{'Format'}; -$Order ||= $prefs->{'Order'} || 'ASC'; -$OrderBy ||= $prefs->{'OrderBy'} || 'id'; - -# Some forms pass in "RowsPerPage" rather than "Rows" -# We call it RowsPerPage everywhere else. - -if ( !defined($Rows) ) { - if ( $ARGS{'RowsPerPage'} ) { - $Rows = $ARGS{'RowsPerPage'}; - } elsif ( defined $prefs->{'RowsPerPage'} ) { - $Rows = $prefs->{'RowsPerPage'}; - } else { - $Rows = 50; - } -} - my ($title, $ticketcount); $session{'i'}++; $session{'tickets'} = RT::Tickets->new($session{'CurrentUser'}) ; $session{'tickets'}->FromSQL($Query) if ($Query); +$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); -if ($OrderBy =~ /\|/) { - # Multiple Sorts - my @OrderBy = split /\|/,$OrderBy; - my @Order = split /\|/,$Order; - $session{'tickets'}->OrderByCols( - map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } ( 0 - .. $#OrderBy ) );; -} else { - $session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); -} $session{'CurrentSearchHash'} = { Format => $Format, Query => $Query, - Page => $Page, Order => $Order, OrderBy => $OrderBy, RowsPerPage => $Rows }; + if ( $session{'tickets'}->Query()) { $ticketcount = $session{tickets}->CountAll(); $title = loc('Found [quant,_1,ticket]', $ticketcount); @@ -156,12 +116,13 @@ my $QueryString = "?".$m->comp('/Elements/QueryString', OrderBy => $OrderBy, Order => $Order, Page => $Page); + my $ShortQueryString = "?".$m->comp('/Elements/QueryString', Query => $Query); -my $RSSFeedURL = "$RT::WebPath/Search/Results.rdf$ShortQueryString"; if ($ARGS{'TicketsRefreshInterval'}) { $session{'tickets_refresh_interval'} = $ARGS{'TicketsRefreshInterval'}; } + </%INIT> <%CLEANUP> $session{'tickets'}->PrepForSerialization(); @@ -170,8 +131,8 @@ $session{'tickets'}->PrepForSerialization(); $Query => undef $Format => undef $HideResults => 0 -$Rows => undef +$Rows => 50 $Page => 1 -$OrderBy => undef -$Order => undef +$OrderBy => 'id' +$Order => 'ASC' </%ARGS> diff --git a/rt/html/Search/Results.rdf b/rt/html/Search/Results.rdf index fe97a314c..7cc248306 100644 --- a/rt/html/Search/Results.rdf +++ b/rt/html/Search/Results.rdf @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -49,7 +47,7 @@ my $Tickets = RT::Tickets->new($session{'CurrentUser'}); $Tickets->FromSQL($ARGS{'Query'}); -$r->content_type('application/rss+xml'); +$r->content_type('application/rdf+xml'); diff --git a/rt/html/Search/Results.tsv b/rt/html/Search/Results.tsv index bb1907317..e6b20481f 100644 --- a/rt/html/Search/Results.tsv +++ b/rt/html/Search/Results.tsv @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC %# <jesse@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -22,9 +22,7 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -%# 02110-1301 or visit their web page on the internet at -%# http://www.gnu.org/copyleft/gpl.html. +%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -45,64 +43,45 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<%ARGS> -$OrderBy => 'id' -$Order => 'ASC' -</%ARGS> <%INIT> -my $Tickets = RT::Tickets->new( $session{'CurrentUser'} ); -$Tickets->FromSQL( $ARGS{'Query'} ); -if ( $OrderBy =~ /\|/ ) { - - # Multiple Sorts - my @OrderBy = split /\|/, $OrderBy; - my @Order = split /\|/, $Order; - $Tickets->OrderByCols( - map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } } - ( 0 .. $#OrderBy ) ); -} -else { - $Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order ); -} +my $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 Cc->MemberEmailAddressesAsString AdminCc->MemberEmailAddressesAsString - DueObj->ISO ToldObj->ISO CreatedObj->ISO ResolvedObj->ISO LastUpdatedObj->ISO); + 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) { - if ($attr =~ /(.*)->ISO$/ and $Ticket->$1->Unix <= 0) { - $row->{$attr} = ""; - } else { - my $method = '$Ticket->'.$attr.'()'; - $row->{$attr} = eval $method; + $r->content_type('application/vnd.ms-excel'); + while ( my $Ticket = $Tickets->Next()) { + my $row; + foreach my $attr (@attrs) { + my $method = '$Ticket->'.$attr.'()'; + $row->{$attr} = eval $method; if ($@) {die "Failed to find $attr - ". $@}; - } - } + } - my $cfs = $Ticket->QueueObj->TicketCustomFields(); - while (my $cf = $cfs->Next) { - my @content; - my $values = $Ticket->CustomFieldValues($cf->Id); - while (my $value = $values->Next) { - push @content, $value->Content; - } - $row->{'CustomField-'.$cf->Id} = join(', ',@content); - if ($row->{'CustomField-'.$cf->Id}) { - $known_cfs{$cf->Id} = $cf->Name; + my $cfs = $Ticket->QueueObj->TicketCustomFields(); + while (my $cf = $cfs->Next) { + my @content; + my $values = $Ticket->CustomFieldValues($cf->Id); + while (my $value = $values->Next) { + push @content, $value->Content; + } + $row->{'CustomField-'.$cf->Id} = join(', ',@content); + if ($row->{'CustomField-'.$cf->Id}) { + $known_cfs{$cf->Id} = $cf->Name; + } } - } - push @rows, $row; -} + push @rows, $row; + + } { - my @header; +my @header; foreach my $attr (@attrs) { my $label = $attr; $label =~ s'Obj-.(?:AsString|Name|ISO)''g; @@ -110,25 +89,27 @@ while ( my $Ticket = $Tickets->Next()) { push @header, $label; } foreach my $id (sort keys %known_cfs) { - push @header, "CF-".$known_cfs{$id}; + push @header, $known_cfs{$id}; } - $m->out(join("\t", @header)); - $m->out("\n"); -} +$m->out(join("\t", @header)); +$m->out("\n"); +} foreach my $row (@rows) { - my @row; - foreach my $attr(@attrs) { - push @row, $row->{"$attr"}; - } - foreach my $id (sort keys %known_cfs) { - my $val = $row->{'CustomField-'.$id}; - $val =~ s/(\n|\r)//g; - push @row, $val; - } - $m->out(join("\t",@row)); - $m->out("\n"); + my @row; + foreach my $attr(@attrs) { + push @row, $row->{"$attr"}; + } + foreach my $id (sort keys %known_cfs) { + my $val = $row->{'CustomField-'.$id}; + $val =~ s/(\n|\r)//g; + push @row, $val; + } + + $m->out(join("\t",@row)); + $m->out("\n"); } + $m->abort(); </%INIT> |