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

use lib '/app/tools/common/lib';
use Common::MapFace::MapFaceFileList;

use RSApache::Response::XSLT;

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

use constant kTemplate => '/app/tools/rps/templates/mapface/main.xsl';

sub cmd  { return "main"; }
sub area { return "mapface"; }

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;

    $self->{xml}{NewFileList}    = Common::MapFace::MapFaceFileList->new( status => Common::DB::Item::MapFaceFile::STATUS_NEW );
    $self->{xml}{ReviewFileList} = Common::MapFace::MapFaceFileList->new( status => Common::DB::Item::MapFaceFile::STATUS_REVIEW );
    $self->{xml}{ErrorFileList}  = Common::MapFace::MapFaceFileList->new( status => Common::DB::Item::MapFaceFile::STATUS_ERROR );
    $self->{xml}{CompletedFileList} = Common::MapFace::MapFaceFileList->new(
        status => Common::DB::Item::MapFaceFile::STATUS_COMPLETED,
        limit  => 10,
        order  => 'date_completed'
    );

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

    return $response;
}

1;
