%# 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

<table>
% while (my $CustomField = $CustomFields->Next) {
% my $Values = $ArticleObj->CustomFieldValues($CustomField->id);
<tr>
<td valign="top" align="right"><B><%$CustomField->Name%></b><br><small><i>(<%$CustomField->Type%>)</i></small></td>
<td valign="top">
% if ($CustomField->Type eq 'FreeformSingle') {
<input name="Article-<%$ArticleObj->Id%>-CustomField-<%$CustomField->Id%>-Value"
       value="<%$Values->First->Content%>">
% }
%  elsif ($CustomField->Type eq 'FreeformMultiple') {
<textarea name="Article-<%$ArticleObj->Id%>-CustomField-<%$CustomField->Id%>-Values">
%while (my $value = $Values->Next ) {
<%$value->Content%>
%}
</textarea>
% } 
%  elsif ($CustomField->Type eq 'TextSingle') {
<textarea rows="10" cols="60"name="Article-<%$ArticleObj->Id%>-CustomField-<%$CustomField->Id%>-Value">
%while (my $value = $Values->Next ) {
<%$value->Content%>
%}
</textarea>
% } 
% elsif ($CustomField->Type =~ /^Select/) {
% my $CustomFieldValues = $CustomField->ValuesObj();
<select name="Article-<%$ArticleObj->Id%>-CustomField-<%$CustomField->Id%>-Values"
        size="5"
        <%$CustomField->Type eq 'SelectMultiple' && 'MULTIPLE'%>
        >
% while (my $value = $CustomFieldValues->Next) {
<option value="<%$value->Name%>" 
        <% $Values->HasEntryWithContent($value->Name) && 'SELECTED' %>
        ><% $value->Name%></option>
% }
<option value="" <%$Values->Count == 0 && 'SELECTED' %>><&|/l&>(no value)</&></option>
</select>
% }
</TD>
</TR>
% }
</TABLE>

<%INIT>
my $CustomFields;
if ($ClassObj) {
        $CustomFields = $ClassObj->CustomFields();
        } else {
        $CustomFields = $ArticleObj->ClassObj->CustomFields();
        }
</%INIT>
<%ARGS>
$ArticleObj => undef
$ClassObj => undef
</%ARGS>
