% $m->comp("/widgets/wrappers/sharky/table_top.mc",
%  	 caption => "Existing Notes",
%	 number  => $number++);

<table border="0" cellpadding="0" cellspacing="0" width="578" bordercolor="#cccc99">
<tr>
    <th class="medHeader" width="68">Version</th>
    <td width="1" height="25"><img src="/media/images/spacer.gif" width="1" height="1" /></td>   
    <th width="509" class="medHeader">Note</th>
</tr>

% foreach my $n (@notes) {
%     if ($flag) {
<tr>
    <td colspan="3" height="1" class="medHeader"><img src="/media/images/spacer.gif" width="1" height="1" /></td>
</tr>
%     } # if
<tr valign="top">
    <td align="right" class="label"><% $n->{id} %>&nbsp;</td>
    <td width="1" height="25" class="medHeader"><img src="/media/images/spacer.gif" width="1" height="1" /></td>   
    <td>&nbsp;<% $n->{note} %></td>
%     $flag = 1;
% } # foreach
% unless (@notes) {
<tr>
    <td colspan="2">&nbsp;<%$lang->maketext('No existing notes.')%></td>
    <td width="1" height="25"><img src="/media/images/spacer.gif" width="1" height="1" /></td>   
</tr>
% } # unless

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

% $m->comp("/widgets/wrappers/sharky/table_top.mc",
%  	 caption => "Current 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
		}
	}  &>

<input type="hidden" name="return_url" value="<% $return_url %>">
% $m->comp("/widgets/wrappers/sharky/table_bottom.mc");
<table border=0 width=580 cellpadding=0 cellspacing=0>
<tr>
  <td>
  <input type="image" src="/media/images/<% $lang_key %>/save_red.gif" border=0 name="<% $widget %>|add_note_cb">
  <input type="image" src="/media/images/<% $lang_key %>/cancel_red.gif" border=0  name="<% $widget %>|return_cb" value="Return">
  </td>
</tr>
</table>
<%args>
$widget
$number
</%args>

<%init>;
my $notes = get_state_data($widget, 'notes');
my $version = get_state_data($widget, 'version');
my $return_url = get_state_data($widget, 'return_url');

my $current = delete $notes->{$version};

my @notes = map { { id => $_, note => $notes->{$_} } }
  sort { $notes->{$a} <=> $notes->{$b} } keys %$notes;
my $flag;
</%init>
