#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package BookPub::Catalog::Command::Main;
use strict;
use warnings;

use lib '/app/tools/bookpub/lib';
use BookPub::Catalog::RecentlyViewedBookList;
use BookPub::Catalog::ImprintList;

use base 'BookPub::Command';

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

sub cmd  { return 'main'; }
sub area { return 'catalog'; }

use constant kTemplate => "/app/tools/bookpub/templates/catalog/main.xsl";

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

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

    $self->{xml}{RecentlyViewed} = BookPub::Catalog::RecentlyViewedBookList->new( user_id => $self->_getUser()->UserID() );
    $self->{xml}{ImprintList} = BookPub::Catalog::ImprintList->new();

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

1;
