%# BEGIN LICENSE BLOCK
%# 
%# Copyright (c) 1996-2002 Jesse Vincent <jesse@bestpractical.com>
%# 
%# (Except where explictly superceded by other copyright notices)
%# 
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org
%# 
%# This work 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.
%# 
%# 
%# Unless otherwise specified, all modifications, corrections or
%# extensions to this work which alter its source code become the
%# property of Best Practical Solutions, LLC when submitted for
%# inclusion in the work.
%# 
%# 
%# END LICENSE BLOCK
% unless ( $count ) {
<span class="cf-value novalue"><&|/l&>no value</&></class>
% return;
% } elsif ( $count == 1 ) {
<span class="cf-value"><% $show_cb->( $values->First ) |n %></span>
% } else {
<ul class="cf-values">
% while ( my $value = $values->Next ) {
<li class="cf-value"><% $show_cb->( $value ) |n %></li>
% }
</ul>
% }
<%INIT>
my $values = $Ticket->CustomFieldValues( $Name );
my $count = $values->Count;

my $show_cb = sub {
    my $value = shift;
    my $linked = $value->LinkValueTo;
    if ( $linked ) {
        $m->out('<a href="'. $m->interp->apply_escapes( $value->LinkValueTo, 'h' ) .'" target="_new">');
    }
    $m->out( $m->interp->apply_escapes( $value->Content, 'h' ) );
    if ( $linked ) {
        $m->out('</a>');
    }
    return '';
};
</%INIT>
<%ARGS>
$Ticket => undef
$Name => undef
</%ARGS>
