%# BEGIN LICENSE BLOCK
%# 
%#  Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#  
%#  This program is free software; you can redistribute it and/or modify
%#  it under the terms of version 2 of the GNU General Public License 
%#  as published by the Free Software Foundation.
%# 
%#  A copy of that license should have arrived with this
%#  software, but in any event can be snarfed from www.gnu.org.
%# 
%#  This program is distributed in the hope that it will be useful,
%#  but WITHOUT ANY WARRANTY; without even the implied warranty of
%#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%#  GNU General Public License for more details.
%# 
%# END LICENSE BLOCK

%# if the custom field is a select, enumerate the options
% if ($Field->Type =~ /^Select/) {
% my $CustomFieldValues = $Field->ValuesObj();
<select name="<%$Name%>" size="5" multiple>
% while (my $value = $CustomFieldValues->Next) {
<option value="<%$value->Name%>" <% grep (/^@{[$value->Name]}$/, @Values) && 'SELECTED'%>><% $value->Name%></option>
% }
<option value="" <% $#Values < 0 && 'SELECTED'%>><&|/l&>(no value)</&></option>
</select>
% }
%# otherwise, put in a textedity field
% else {
<input name="<%$Name%>" value="<%$Values[0]%>" />
% }
<%init>
my @Values =ref( $Values ) ? @{ $Values } : ( $Values ); 
</%init>
<%ARGS>
$Field => undef
$Name => 'CustomField'
$Values => undef
</%ARGS>
