[Rt-commit] r6570 - in rt/branches/3.6-RELEASE: .
jesse at bestpractical.com
jesse at bestpractical.com
Fri Dec 1 13:57:28 EST 2006
Author: jesse
Date: Fri Dec 1 13:57:27 2006
New Revision: 6570
Modified:
rt/branches/3.6-RELEASE/ (props changed)
rt/branches/3.6-RELEASE/html/Search/Build.html
Log:
r45310 at pinglin (orig r6507): clkao | 2006-11-23 03:50:33 -0500
Cluster the processing of saved search related management together.
Modified: rt/branches/3.6-RELEASE/html/Search/Build.html
==============================================================================
--- rt/branches/3.6-RELEASE/html/Search/Build.html (original)
+++ rt/branches/3.6-RELEASE/html/Search/Build.html Fri Dec 1 13:57:27 2006
@@ -239,6 +239,62 @@
# }}}
+# {{{ 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/;
@@ -690,61 +746,6 @@
# }}}
-# {{{ 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 ];
- }
-
-}
-
-# }}}
-
# {{{ If we're modifying an old query, check if it has changed
my $dirty = 0;
$dirty = 1
More information about the Rt-commit
mailing list