<%perl>
my $note_img = %{ $story->get_notes } ? 'note_fill' : 'note';
my $rightText = qq{
<a href="/workflow/profile/story/view_notes.html?id=} . $id .
 qq{"><img src="/media/images/$note_img.gif" border="0" alt="View Notes" /></a>
    <a href="/workflow/trail/story/}. $id . qq{"><img src="/media/images/} .
  $lang_key  . qq{/view_trail_teal.gif" border="0" alt="View Trail" /></a>
};

$m->comp("/widgets/wrappers/sharky/table_top.mc",
  	 caption => "Information",
	 number  => 1,
         id      => 'storyinfo',
	 rightText => $rightText

);
</%perl>
<table border="0" width="578" cellpadding="0" cellspacing="0">
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><%$lang->maketext('ID')%>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_id %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>


  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><%$lang->maketext('Story Type Element')%>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_element_name %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Title') %>:&nbsp;</span></td>
  <td width="470" class="fieldcontent">&nbsp;<% $story->get_name %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Description') %>:&nbsp;</span></td>
  <td width="470" class="fieldcontent">&nbsp;<% $story->get_description %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Slug') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_slug %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>


  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('URI') %>:&nbsp;</span></td>
% if (@ocs == 1) {
  <td width="470">&nbsp;<% $m->comp('/widgets/profile/preview_link.mc',
                                    type  => 'story',
                                    title => $story->get_primary_uri,
                                    doc   => $story,
                                    style => 'blackUnderlinedLink') %></td>
% } else {
  <td width="470">&nbsp;<% $story->get_primary_uri %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Preview in') %>:&nbsp;</span></td>
  <td width="470" valign="middle">&nbsp;<% $oc_select %>&nbsp;<%
                           $m->comp('/widgets/profile/preview_link.mc',
                                    type  => 'story',
                                    title => $story->get_primary_uri,
                                    doc   => $story,
                                    oc_js => 'window.document.theForm.ocSelect.options[window.document.theForm.ocSelect.selectedIndex].value',
                                    style => 'blackUnderlinedLink') %></td>
% }
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Source') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% Bric::Biz::Org::Source->lookup({ id => $story->get_source__id })->get_source_name %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

% unless (ENABLE_CATEGORY_BROWSER) {
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" valign="top" class="medHeader"><span class="label"><% $lang->maketext('Categories') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<%perl>
$m->print(join '<br />&nbsp;', sort { $a cmp $b }
          map { $_->get_uri } $story->get_categories);
</%perl>
  </td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>
% }   # unless ENABLE_CATEGORY_BROWSER

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Cover Date') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_cover_date %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Current Version') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_current_version %></td>
  </tr>

  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>

  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Published Version') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_published_version || ''%></td>
  </tr>

  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('First Published') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_first_publish_date || '' %></td>
  </tr>
  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Last Published') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_publish_date || '' %></td>
  </tr>

  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Expire Date') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% $story->get_expire_date %></td>
  </tr>

  <tr>
  <td bgcolor="white"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
  </tr>
  <tr>
  <td class="medHeader"><img src="/media/images/spacer.gif" height="18" width="1" /></td>
  <td width="<% $infoIndent %>" align="right" class="medHeader"><span class="label"><% $lang->maketext('Output Channels') %>:&nbsp;</span></td>
  <td width="470">&nbsp;<% join ', ', (map { $_->get_name } $story->get_output_channels) %></td>
  </tr>

</table>

<& '/widgets/wrappers/sharky/table_bottom.mc' &>

<& '/widgets/container_prof/container_prof.mc',
	tile   => $tile,
	tile_type => 'story',
	action    => 'view',
	start_count => 4,
        num      => 2
&>

% $m->comp("/widgets/wrappers/sharky/table_top.mc",
%  	 caption => "Associations",
%	 number  => 3);
<table border=0 width=578 cellpadding=0 cellspacing=0>
<tr>
  <td width=20 class="medHeader"><img src="/media/images/spacer.gif" width="20" height="20" /></td>
  <td width=100 class="medHeader"><span class="label"><% $lang->maketext('Type') %></span></td>
  <td width=1><img src="/media/images/spacer.gif" width="1" height="20" /></td>
  <td width=458 class="medHeader"><span class="label">&nbsp;<% $lang->maketext('Values') %></span></td>
</tr>
</table>

<table border=0 width=578 cellpadding=0 cellspacing=0>
<tr>
  <td width=121 align=right valign=top><span class=label><% $lang->maketext('Categories') %>:&nbsp;</span></td>
  <td width=457 valign=top height="25">
<%perl>
my @cats;
foreach my $cat ($story->get_categories) {
    push @cats, $cat->get_name;
}

$m->out(scalar(@cats) ? join(", ", @cats) : $lang->maketext("No categories defined."));
</%perl>
</tr>
</table>

<table border=0 cellpadding=0 cellspacing=0 width=578>
<tr><td class="medHeader"><img src="/media/images/spacer.gif" width="578" height="1" /></td></tr>
</table>

<table border=0 width=578 cellpadding=0 cellspacing=0>
<tr>
  <td width=121 align=right valign=top><span class=label><% $lang->maketext('Keywords') %>:&nbsp;</span></td>
  <td width=457 valign=top height="25">
<%perl>
my @keywords;
foreach my $kw ($story->get_keywords) {
    push @keywords, $kw->get_name;
}

$m->out(scalar(@keywords) ? join(", ", @keywords) : $lang->maketext("No keywords defined."));
</%perl>
</tr>
</table>

<table border=0 cellpadding=0 cellspacing=0 width=578>
<tr><td class="medHeader"><img src="/media/images/spacer.gif" width="578" height="1" /></td></tr>
</table>

<table border=0 cellpadding=0 cellspacing=0 width=578>
<tr>
  <td align=right width=121 valign=top><span class=label><% $lang->maketext('Contributors') %>:&nbsp;</span></td>
  <td width=457 valign=top height="25">

<%perl>
my @contribs;
foreach my $cntr ($story->get_contributors) {
    push @contribs,  $cntr->get_name;
}
$m->out(scalar(@contribs) ? join(", ", @contribs) : $lang->maketext("No contributors defined."));

</%perl>

  </td>
</table>
% $m->comp("/widgets/wrappers/sharky/table_bottom.mc");

<table width=160 cellpadding=0 cellspacing=0>
<tr>
  <td width=80><input type="image" src="/media/images/<% $lang_key %>/return_dgreen.gif" border=0 name="<% $widget %>|return_cb" value="Return To Desk">
  </td>
</tr>
</table>


<%args>
$widget
</%args>

<%init>
my $story = get_state_data($widget, 'story');
my $id = $story->get_id;
my $tile  = $story->get_tile();
my $agent = detect_agent();
my $infoIndent = $agent->nav4 ? FIELD_INDENT - 5 : FIELD_INDENT + 8;

my @ocs = $story->get_output_channels;
my $primocid = $story->get_primary_oc_id;
my $oc_select = '<select name="ocSelect">';
foreach my $oc (@ocs) {
    my $ocid = $oc->get_id;
    my $selected = $ocid == $primocid ? ' selected' : '';
    $oc_select .= qq{<option value="$ocid"$selected>} . $oc->get_name . '</option>';
}
$oc_select .= '</select>';
</%init>
