<div class="desk_item">
  <div class="head">
    <span class="<% $idv_class %>"><% "$id v." . $obj->get_version %></span>
    <span class="<% $title_class %>"><% $name %></span>
    <% $m->comp('publish_status_span.mc',
                sorted => $highlight eq 'name' ? 'sorted' : '',
                asset => $obj) %>
  </div>
  <div class="body">
    <dl>
      <dt><% $lang->maketext('Category') %></dt>
      <dd<% $classes->{category_name} || $classes->{location} || '' %>><% $cat %></dd>
      <dt><% $lang->maketext('Site') %></dt>
      <dd<% $classes->{site_id} || '' %>><% $site %></dd>
      <dt><% $lang->maketext(($class eq 'formatting' ? 'Output Channel' : $disp  . ' Type')) %></dt>
      <dd<% $classes->{element} || '' %>><% $type || '&nbsp;' %></dd>
      <dt><% $lang->maketext($date_label) %></dt>
      <dd<% $classes->{cover_date} || '' %>><% $date || '&nbsp;' %></dd>
      <dt><% $lang->maketext('Priority') %></dt>
      <dd<% $classes->{priority} || '' %>><% $lang->maketext($priors->{$obj->get_priority}) %></dd>
    </dl>
    <p><% $elink %></p>

% if ($can_edit && $desk_opts) {
    <div class="mover"><label for="move<% $id %>"><% $lang->maketext($mlabel) %></label>
      <& '/widgets/profile/select.mc',
         name     => "$widget|next_desk",
         value    => $desk_val,
         options  => $desk_opts,
         useTable => 0,
         id       => "move$id" &>
    </div>
% } else {
    <div class="mover">&nbsp;</div>
% }
    <ul class="actions">
      <li><a href="<% $ppage . '/' . lc $vlabel %>_notes.html?id=<% $aid %>">Notes</a></li>
      <li><a href="<% $item_url %>"><% $lang->maketext($item_label) %></a></li>
      <li><a href="<% $link %>"><% $lang->maketext($vlabel) %></a></li>
      <li><a href="/workflow/events/<% $class %>/<% $aid %>"><% $lang->maketext('Log') %></a></li>
      <li><% $pub %></li>
    </ul>
  </div>
</div>
<%once>;
my $priors = Bric::Biz::Asset->list_priorities;
</%once>
<%args>
$mlabel => 'Move to Desk'
$widget => 'desk_asset'
$obj
$highlight
$can_edit
$vlabel => 'View'
$desk_val
$desk_opts
$ppage
$disp
$type
$pub => ''
$aid
$class  => 'story'
$did
$desk_type
$user => undef
$label => undef
$action => undef
</%args>
<%init>;
# Get the ID.
my $id = $obj->get_id;

my $cats = $r->pnotes("desk.cats") || {};
my ($name, $date, $date_label, $cat);
my $header_class = 'lightHeader';

my $site_id = $obj->get_site_id;
my $site = Bric::Biz::Site->lookup({id => $site_id})->get_name || '&nbsp;';
my $alias = '';
my $title_class = 'title';
my $idv_class = 'idv';
if ($class eq 'formatting') {
    $date = $obj->get_deploy_date || '&nbsp';
    $date_label = 'Deployed Date';
    $name = $obj->get_uri;
    my $cat_id = $obj->get_category_id;
    if (defined $cat_id) {
	unless ($cat = $cats->{$cat_id}) {
	    $cat = Bric::Biz::Category->lookup({ id => $cat_id })->get_uri;
	    $cats->{$cat_id} = $cat;
	    $r->pnotes("desk.cats", $cats);
	}
    } else {
	$cat = '&nbsp;';
    }
} else {
    $name = $obj->get_name;
    $date = $obj->get_cover_date;
    $date_label = 'Cover Date';
    my $co = $vlabel eq 'Edit';
    $alias = 'alias' if $obj->get_alias_id;
    if ($highlight eq 'name') {
        $title_class .= "sorted";
    } elsif ($alias) {
        $title_class .= $alias;
    }
    if ($highlight eq 'id') {
        $idv_class .= "sorted";
    } elsif ($alias) {
        $idv_class .= $alias;
    }
    if ($class eq 'media') {
	$cat = $cats->{$obj->get_category__id} ||= $obj->get_category_object;
	$cat = $cat->get_uri if $cat;
        $name = $m->comp('/widgets/profile/preview_link.mc',
                         type  => $class,
                         doc   => $obj,
                         title => $name )
          if $obj->get_file_name;
    } else {
	$cat = $obj->get_primary_category;
	$cat = $cat->get_uri if $cat;
	$cat ||= '&nbsp;';
        $name = $m->comp('/widgets/profile/preview_link.mc',
                         type  => $class,
                         doc   => $obj,
                         title => $name );
    }
    $header_class = 'aliasHeader' if $obj->get_alias_id;
}
$cat ||= '&nbsp;';
my $classes = { $highlight => ' class="sorted"' };
my $rowspan = 5;

my $link = $ppage . '/' . $aid;
my $item_label = 'Trail';
my $item_url = "/workflow/trail/$class/$aid";
if ($desk_type eq 'workflow') {
    $link .= '?return=' . $did;
    if ($vlabel eq 'Edit') {
        $link .= '&amp;checkout=1';
    }
} else {
    if ($vlabel eq 'Edit') {
        $link .= '?checkout=1';
    }
    if ($class eq 'story') {
        $item_label = 'Clone';
#        $item_url = $r->uri . "?$widget|clone_cb=$aid";
        $item_url = "/workflow/profile/workspace/clone/$aid";
    }
}

my $elink = $user ? $user : $label ? '<a href="' . $r->uri . "?"
  . join('&amp;', "$widget|$action=$aid", "$widget|asset_class=$class")
  . qq{">$label</a>} : '';
</%init>
<%doc>
###############################################################################

=head1 NAME

/widgets/desk/desk_item.html - Desk Item Presentation.

=head1 VERSION

$LastChangedRevision$

=head1 DATE

$LastChangedDate: 2004-05-24 18:17:44 -0700 (Mon, 24 May 2004) $

=head1 DESCRIPTION

This element handles the display of individual assets on a desk or workspace.

</%doc>
