[Rt-commit] r6566 - in rt/branches/3.6-RELEASE: .
jesse at bestpractical.com
jesse at bestpractical.com
Fri Dec 1 13:55:28 EST 2006
Author: jesse
Date: Fri Dec 1 13:55:27 2006
New Revision: 6566
Modified:
rt/branches/3.6-RELEASE/ (props changed)
rt/branches/3.6-RELEASE/html/Search/Chart.html
Log:
r45290 at pinglin (orig r6500): clkao | 2006-11-22 07:27:01 -0500
Use RT::SavedSearch for Chart saving as well.
Modified: rt/branches/3.6-RELEASE/html/Search/Chart.html
==============================================================================
--- rt/branches/3.6-RELEASE/html/Search/Chart.html (original)
+++ rt/branches/3.6-RELEASE/html/Search/Chart.html Fri Dec 1 13:55:27 2006
@@ -58,36 +58,31 @@
push @Objects, RT::System->new($session{'CurrentUser'})
if $session{'CurrentUser'}->HasRight( Object=> $RT::System,
Right => 'SuperUser');
-
+my @actions;
if ( $ARGS{Save} ) {
- if ( $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 = _load_container_object( $obj_type, $obj_id );
- my $name = $obj_type eq 'RT::System' ? "Search - $Description" : 'SavedSearch';
- my ( $search_id, $search_msg ) = $container_object->AddAttribute(
- Name => $name,
- Description => $Description,
- Content => {
- Query => $Query,
- SearchType => 'Chart',
- PrimaryGroupBy => $PrimaryGroupBy,
- SecondaryGroupBy => $SecondaryGroupBy,
- ChartStyle => $ChartStyle,
-
- }
- );
-
+ my $saved_search = RT::SavedSearch->new( $session{'CurrentUser'} );
+ my ( $ok, $search_msg ) = $saved_search->Save(
+ Privacy => $ARGS{'Owner'},
+ Name => $Description,
+ Type => 'Chart',
+ SearchParams => {
+ Query => $Query,
+ PrimaryGroupBy => $PrimaryGroupBy,
+ SecondaryGroupBy => $SecondaryGroupBy,
+ ChartStyle => $ChartStyle
+ });
+ if ($ok) {
+ push @actions, loc( 'Chart [_1] saved.', $Description );
+ }
+ else {
+ push @actions, [ loc("Can't save chart").': '.loc($search_msg), 0 ];
}
}
</%init>
<& /Elements/Header, Title => $title &>
<& /Ticket/Elements/Tabs, Title => $title &>
+<& /Elements/ListActions, actions => \@actions &>
<& /Search/Elements/Chart, %ARGS &>
<form method="post" action="Chart.html" name="SaveChart">
More information about the Rt-commit
mailing list