+ Abort(loc("Couldn't load queue #[_1]", $id)) unless $QueueObj->id;
+}
+$id ||= 0;
+
+my $find_scrips = sub {
+ my %args = (Added => 1, @_);
+ my $scrips = RT::Scrips->new($session{'CurrentUser'});
+ $scrips->LimitByStage( $args{'Stage'} )
+ if $args{'Stage'};
+ my $method = $args{'Added'}? 'LimitToAdded' : 'LimitToNotAdded';
+ $scrips->$method(0, $id);
+ $scrips->ApplySortOrder if $args{'Added'};
+ $scrips->FindAllRows;
+ return $scrips;
+};
+
+$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Scrips'};
+my $Rows = RT->Config->Get('AdminSearchResultRows')->{'Scrips'} || 50;
+my $DisplayFormat = $Format;
+if ( $id ) {
+ $DisplayFormat = "__RemoveCheckBox__, $DisplayFormat";
+} else {
+ $DisplayFormat = "__CheckBox.{RemoveScrip}__, $DisplayFormat";
+}
+$DisplayFormat .= ", __Move.{$id}__";
+
+my %common_applied_args = (
+ %ARGS,
+ Format => $Format,
+ DisplayFormat => $DisplayFormat,
+ Rows => 0,
+ Page => 1,
+ AllowSorting => 0,
+ PassArguments => [ qw(Format id) ],
+);
+
+if ( $RemoveScrips ) {
+ foreach my $sid ( @RemoveScrip ) {
+ my $scrip = RT::Scrip->new( $session{'CurrentUser'} );
+ $scrip->Load( $sid );
+ next unless $scrip->id;
+
+ my ($status, $msg) = $scrip->RemoveFromObject( $id );
+ push @actions, $msg;