<& '/widgets/wrappers/sharky/table_top.mc',
    caption => "Notes for Prior Versions",
    number  => $number++
&>
<table class="listManager">
<tr>
    <th width="10%">Version</th>
    <th>Note</th>
</tr>

% my $count = 0;
% foreach my $n (@notes) {
%    if ( $n->{id} && $n->{note} ) {
<tr class="<% (++$count % 2 == 0) ? 'even' : 'odd' %>">
    <td class="name"><% $n->{id} %></td>
    <td><% $n->{note} |h %></td>
</tr>
%    }
% }

% unless ($count) {
<tr>
    <td colspan="2"><% $lang->maketext('No existing notes.') %></td>
</tr>
% }
</table>


<& '/widgets/wrappers/sharky/table_bottom.mc' &>
<& '/widgets/wrappers/sharky/table_top.mc',
    caption => "New Note",
    number  => $number &>
% my $key = $widget . '|note';
<& '/widgets/profile/displayFormElement.mc',
    key => $key,
    vals => { disp => 'Note',
              value => $current,
              props => { type => 'textarea',
                         cols => 45,
                         rows => 4
                       }
            }
&>
<& '/widgets/profile/hidden.mc',
    name    => 'return_url',
    value   => $return_url,
&>

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

<& '/widgets/profile/button.mc',
    disp    => 'Save',
    widget  => $widget,
    cb      => 'add_note_cb',
    button  => 'save_red',
    useTable => 0 &>
<& '/widgets/profile/button.mc',
    disp    => 'Cancel',
    widget  => $widget,
    cb      => 'return_cb',
    button  => 'cancel_lgreen',
    useTable => 0 &>
<%args>
$widget
$number
</%args>
<%init>;
my $notes      = get_state_data($widget => 'notes');
my @notes 	= map { { id => $_, note => $notes->{$_} } }
            	  sort { $b <=> $a } keys %$notes;
my $version    = get_state_data($widget => 'version');
my $return_url = get_state_data($widget => 'return_url');
my $obj        = get_state_data($widget => 'obj');
my $current = $obj->get_note;
</%init>

