package MT::Plugin::SKR::DefaultPublishStatus;
########################################################################
#   DefaultPublishStatus
#           Copyright (c) SKYARC System Co.,Ltd.
########################################################################

use strict;

use vars qw( $MYNAME $VERSION );
$MYNAME = 'DefaultPublishStatus';
$VERSION = '0.01';

use base qw( MT::Plugin );
my $plugin = __PACKAGE__->new({
        name => $MYNAME,
        id => lc $MYNAME,
        key => lc $MYNAME,
        version => $VERSION,
        description => <<HTMLHEREDOC,
Set the scheduled publishing as default when an entry created newly.
HTMLHEREDOC
});
MT->add_plugin( $plugin );

sub instance { $plugin; }

### Registry
sub init_registry {
    my $plugin = shift;
    $plugin->registry({
        callbacks => {
           'MT::App::CMS::template_param.edit_entry' => \&_edit_entry_param,
        },
    });
}

###
sub _edit_entry_param {
    my ($cb, $app, $param, $tmpl) = @_;
    my $q = $app->{query}
        or return;
    my $eid = $q->param( 'id' )
        and return;

    $param->{status_draft}  = 0;
    $param->{status_review} = 0;
    $param->{status_future} = 1;
    $param->{status_publish} = 0;
}

1;