#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package AppUser::User::Command::Contact;

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

use lib '/app/tools/appuser/lib';
use AppUser::User::ContactForm;

use lib '/app/tools/rps/lib';
use RPS::Command;
use base 'RPS::Command';

sub cmd  { return "contact"; }
sub area { return "user"; }

use constant kTemplate => '/app/tools/appuser/templates/contact.xsl';

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

    # Give any inherited methods the first crack at this.
    # (This checks for login and basic access permissions).
    #
    my $response = $self->SUPER::execute();
    return $response if $response;

    my $user = $self->_getUser();
    my $id   = $user->UserID();
    my $form = AppUser::User::ContactForm->new( userID => $id );

    $self->{xml}{Form} = $form;

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

1;
