1 <& /Elements/ListActions, actions => \@results &>
2 <table width="100%"><tr>
3 % foreach my $type ('Ticket', 'Chart') {
5 <&|/Widgets/TitleBox, title => loc('Saved '.$titles{$type}) &>
6 % foreach my $Object (@Objects) {
7 % $SavedSearches = RT::SavedSearches->new($session{CurrentUser});
8 % $SavedSearches->LimitToPrivacy(join('-',ref($Object),$Object->Id), $type);
9 % my $title = $titles{$type};
10 % if (ref $Object eq 'RT::User' && $Object->Id == $session{CurrentUser}->Id) {
11 % $title = loc("My saved ".lc($title));
13 % $title = loc("[_1]'s saved ".lc($title),$Object->Name);
15 % $title = $m->interp->apply_escapes($title, 'h');
17 % my $oid = join('-', ref($Object), $Object->Id, 'SavedSearch', '__id__');
18 % my $resultpath = $paths{$type};
20 % qq{<a href="__WebPath__/$resultpath?__ResultsURL__">__Name__</a>/TITLE:$title},
22 % qq{<a href="__WebPath__/Search/Build.html?SavedSearchLoad=$oid">[Edit]</a> } .
23 % qq{<a href="$uri?Delete=$oid">[Delete]</a>/TITLE:},
25 % my $format = join(',', map { "'$_'" } @cols);
26 <& /Elements/CollectionList,
28 Class => 'RT::SavedSearch',
30 Collection => $SavedSearches,
31 PassArguments => [qw(Format Name id)],
40 my $SavedSearches = RT::SavedSearches->new($session{'CurrentUser'});
41 push @Objects, $SavedSearches->_PrivacyObjects;
42 push @Objects, RT::System->new( $session{'CurrentUser'} )
43 if $session{'CurrentUser'}->HasRight( Object=> $RT::System,
44 Right => 'SuperUser' );
46 my $uri = '__WebPath__'.$m->request_path;
49 if ( $Delete =~ /(.*)-SavedSearch-(\d+)/) {
50 my ($privacy, $id) = ($1, $2);
51 my $record = RT::SavedSearch->new($session{'CurrentUser'});
52 $record->Load($privacy, $id);
54 my ($status, $msg) = $record->Delete;
58 push @results, "Saved search #$Delete not found";
62 my %titles = ( 'Ticket' => 'Searches', 'Chart' => 'Charts' );
63 my %paths = ( 'Ticket' => 'Search/Results.html',
64 'Chart' => 'Search/Chart.html',