[Rt-commit] r6507 - rt/branches/3.6-EXPERIMENTAL-LONDRES/html/Search

clkao at bestpractical.com clkao at bestpractical.com
Thu Nov 23 03:50:34 EST 2006


Author: clkao
Date: Thu Nov 23 03:50:33 2006
New Revision: 6507

Modified:
   rt/branches/3.6-EXPERIMENTAL-LONDRES/html/Search/Build.html

Log:
Cluster the processing of saved search related management together.


Modified: rt/branches/3.6-EXPERIMENTAL-LONDRES/html/Search/Build.html
==============================================================================
--- rt/branches/3.6-EXPERIMENTAL-LONDRES/html/Search/Build.html	(original)
+++ rt/branches/3.6-EXPERIMENTAL-LONDRES/html/Search/Build.html	Thu Nov 23 03:50:33 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