[Rt-commit] r2342 - in rt/branches/QUEBEC-EXPERIMENTAL: . html/Search lib/RT/Interface

clkao at bestpractical.com clkao at bestpractical.com
Fri Mar 11 18:59:06 EST 2005


Author: clkao
Date: Fri Mar 11 18:59:06 2005
New Revision: 2342

Modified:
   rt/branches/QUEBEC-EXPERIMENTAL/   (props changed)
   rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Build.html
   rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm
Log:
 r2470 at ab:  clkao | 2005-03-12 07:56:47 +0800
 Move _parse_saved_search and _load_container_object to RT::Interface::Web.


Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Build.html
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Build.html	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Build.html	Fri Mar 11 18:59:06 2005
@@ -151,39 +151,6 @@
 # Clean unwanted junk from the format
 $Format = $m->comp( '/Elements/ScrubHTML', Content => $Format ) if ($Format);
 
-sub _load_container_object {
-    my ($obj_type, $obj_id) = @_;
-    if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id)  {
-	return $session{'CurrentUser'}->UserObj;
-    }
-    elsif ($obj_type eq 'RT::Group') {
-	my $group = RT::Group->new($session{'CurrentUser'});
-	$group->Load($obj_id);
-	return $group;
-    }
-    elsif ($obj_type eq 'RT::System') {
-	# XXX: check hasright
-	return RT::System->new($session{'CurrentUser'});
-    }
-    else {
-#	push( @actions, [ loc("error: Invalid object type"), -1 ] );
-    }
-
-}
-
-sub _parse_saved_search {
-    my $spec = shift;
-    if ($spec  !~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
-#	push( @actions, [ loc("error: Invalid argument"), -1 ] );
-	return;
-    }
-    my $obj_type  = $1;
-    my $obj_id    = $2;
-    my $search_id = $3;
-
-    return (_load_container_object ($obj_type, $obj_id), $search_id);
-}
-
 # {{{ If we're asked to delete the current search, make it go away and reset the search parameters
 if ( $ARGS{'Delete'} ) {
 

Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm	Fri Mar 11 18:59:06 2005
@@ -1508,6 +1508,49 @@
     };
 }
 
+=head2 _load_container_object ( $type, $id );
+
+Instantiate container object for saving searches.
+
+=cut
+
+sub _load_container_object {
+    my ($obj_type, $obj_id) = @_;
+    if ( $obj_type eq 'RT::User' && $obj_id == $session{'CurrentUser'}->Id)  {
+	return $session{'CurrentUser'}->UserObj;
+    }
+    elsif ($obj_type eq 'RT::Group') {
+	my $group = RT::Group->new($session{'CurrentUser'});
+	$group->Load($obj_id);
+	return $group;
+    }
+    elsif ($obj_type eq 'RT::System') {
+	# XXX: check hasright
+	return RT::System->new($session{'CurrentUser'});
+    }
+    else {
+    }
+}
+
+=head2 _parse_saved_search ( $arg );
+
+Given a serialization string for saved search, and returns the
+container object and the search id.
+
+=cut
+
+sub _parse_saved_search {
+    my $spec = shift;
+    if ($spec  !~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
+	return;
+    }
+    my $obj_type  = $1;
+    my $obj_id    = $2;
+    my $search_id = $3;
+
+    return (_load_container_object ($obj_type, $obj_id), $search_id);
+}
+
 eval "require RT::Interface::Web_Vendor";
 die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Web_Vendor.pm});
 eval "require RT::Interface::Web_Local";


More information about the Rt-commit mailing list