<%doc>
###############################################################################

=head1 NAME

<name> -- <description>

=head1 VERSION

$LastChangedRevision$

=head1 DATE

$LastChangedDate$

=head1 DESCRIPTION

<description>

=cut

</%doc>

%#-- Once Section --#
<%once>
my $widget = 'desk_asset';
</%once>

%#-- Args Section --#
<%args>
$story_sort_by    => undef
$media_sort_by    => undef
$template_sort_by => undef
$offset           => 0
$show_all         => undef
</%args>

%#-- Init Section --#
<%init>;
my ($w_id, $d_id) = $r->uri =~ m!/(\d+)/(\d+)/?$!;
my $d = Bric::Biz::Workflow::Parts::Desk->lookup({'id' => $d_id});
my $d_name = $d ? $d->get_name : 'Unknown';
my $wf = Bric::Biz::Workflow->lookup({ id => $w_id });
my $wfname = '&quot;' . $wf->get_name . '&quot;';
</%init>

%#-- Begin HTML --#

<& '/widgets/wrappers/sharky/header.mc',
   title => "$d_name Desk",
   context => "Workflow | $wfname | &quot;$d_name&quot;"
 &>

<%perl>;
# Don't display anything if the desk object could not be found.
if ($d) {
    $m->out(qq{<form method="post" action="} . $r->uri
      . qq{" name="desk" onsubmit="return confirmChanges(this)">});

    $m->comp('/widgets/desk/desk.mc',
             desk_id  => $d_id,
             desk     => $d,
             wf       => $wf,
             work_id  => $w_id,
             sort_by  => $story_sort_by,
             class    => 'story',
             offset   => $offset,
             show_all => $show_all,
            );
    $m->comp('/widgets/desk/desk.mc',
             desk_id  => $d_id,
             desk     => $d,
             wf       => $wf,
             sort_by  => $media_sort_by,
             work_id  => $w_id,
             class    => 'media',
             offset   => $offset,
             show_all => $show_all,
            );
    $m->comp('/widgets/desk/desk.mc',
             desk     => $d,
             wf       => $wf,
             sort_by  => $template_sort_by,
             desk_id  => $d_id,
             work_id  => $w_id,
             class    => 'template',
             offset   => $offset,
             show_all => $show_all,
            );
    $m->comp('/widgets/desk/desk_bottom.html',
             widget   => $widget,
             wf       => $wf,
             w_id     => $w_id,
             desk     => $d,
             offset   => $offset,
             show_all => $show_all,
            );
    $m->out("</form>\n");
}
$m->comp('/widgets/wrappers/sharky/footer.mc', param => \%ARGS);
</%perl>

%#-- End HTML --#


