#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Region::Command::Search;

use lib '/app/tools/common/lib';
use RSApache::Response::XSLT;

use lib '/app/tools/rps/lib';
use RPS::DB::Item::Region;
use RPS::SearchCommand;
use base 'RPS::SearchCommand';

use constant kTemplate => '/app/tools/rps/templates/region/index.xsl';
use constant kPageSize => 30;

sub cmd  { return "search"; }
sub area { return "region"; }

sub execute
{
	my ($self) = @_;

	# Give any inherited methods the first crack at this.
	# (This checks for login and basic access permissions).
	#
	my $response;
	my %searchArgs = (xmlClass => 'RPS::Region::Region',
					  xmlTag   => 'Region',
                      loadSubs => 1,
                      searchMethod => 'SearchEditable',
                      getAllMethod => 'GetAllEditable',
					  pageSize => kPageSize);

    # regular search, either show all or search by Query
    #
    $searchArgs{dbClass} = 'RPS::DB::Item::Region';

	$response = $self->SUPER::execute(%searchArgs);
	return $response if $response;


	$response = RSApache::Response::XSLT->new($self->{xml}, kTemplate);
	return $response;
}


1;
