#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Distribution::Command::AlbumDetail;
use strict;
use warnings;

use lib '/app/tools/rps/lib';
use RPS::Distribution::AlbumDetailList;
use RPS::Distribution::AlbumDetailList;

#use base 'RPS::Command';
use base 'RSApache::Command::XMLCommand';

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

use lib '/app/tools/appuser/lib';
use AppUser::DB::Item::AccessLevel;

use lib '/app/tools/metadata/lib';
use Metadata::Importer;
use Metadata::Parser;

sub cmd  { return 'albumdetail'; }
sub area { return 'distribution'; }

use constant kTemplate => "/app/tools/rps/templates/distribution/albumdetail.xsl";
use constant kPageSize => 10;

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

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

    my $albums = new RPS::Distribution::AlbumDetailList(
        display    => $self->getParam("show"),
        page       => $self->getParam("page"),
        show_all   => $self->getParam("showall"),
        catalog_no => $self->getParam("catalog"),
        null_catno => $self->getParam("null_catno"),
        colset     => $self->getParam("colset"),
        page_size  => kPageSize
    );

    $self->{xml}->{Distribution}->{Albums} = $albums;

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

    return $response;
}

1;
