#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
# the XML version of this command is used to
# support AJAX requests. It differs from the main
# command in the following ways:
# 	1. Inherits from XMLCommand instead of Command
# 	2. Has a different cmd (usually appended with "_xml")
# 	3. Returns an XML response instead of XSLT
#
package RPS::Master::Command::SearchXML;
use strict;
use warnings;

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

use lib '/app/tools/rps/lib';
use RPS::Master::SearchForm;

use RPS::XMLCommand;
use base 'RPS::XMLCommand';

sub cmd  { return 'search_xml'; }
sub area { return 'master'; }

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

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

    $self->{xml}{Form} = RPS::Master::SearchForm->new( searchTerm => $self->getParam("Query") );

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

###
1;    # Play nicely.
###
