#------------------------------------------------------------
# Copyright (C) 2010 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package Support::Messaging::Command::DashboardUpdate;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use RSApache::Response::XSLT;
use Common::DB::Item::Client;

use lib '/app/tools/bookpub/lib';
use BookPub::Dashboard::UpdateList;

use base 'Support::Command';

sub cmd  { return 'dashboard_update' }
sub area { return 'messaging'; }

use constant kTemplate => "/app/tools/support/templates/messaging/dashboard_update.xsl";

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

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

    my $deleteID = $self->getParam('delete');

    if ($deleteID) {
        BookPub::Dashboard::Update->Delete( messageID => $deleteID );

    }

    $self->{xml}{Form}->{Updates} = BookPub::Dashboard::UpdateList->new();

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

1;
