Name

links —

DESCRIPTION

EXAMPLES

No examples are available at this time. We do consider this a problem and will try to supply some.

NOTES

AVAILABILITY

links is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: code/Widget/links.widget
Lines: 12


# Copyright 2005-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: links.widget,v 1.3 2007-03-30 23:40:58 pajamian Exp $

CodeDef links Widget 1
CodeDef links Description Build links
CodeDef links MapRoutine Vend::Form::links

Source: lib/Vend/Form.pm
Lines: 387

sub links {
my($opt, $opts) = @_;

$opt->{joiner} = Vend::Interpolate::get_joiner($opt->{joiner}, "<br$Vend::Xtrailer>");
my $name = $opt->{name};
my $default = defined $opt->{value} ? $opt->{value} : $opt->{default};

$opt->{extra} = " $opt->{extra}" if $opt->{extra};

my $template = $opt->{template} || <<EOF;
<a href="{URL}"{EXTRA}>{SELECTED <b>}{LABEL}{SELECTED </b>}</a>
EOF

my $o_template = $opt->{o_template} || <<EOF;
<b>{TVALUE}</b>
EOF

my $href = $opt->{href} || $Global::Variable->{MV_PAGE};
$opt->{form} = "mv_action=return" unless $opt->{form};

my $no_encode = $opt->{pre_filter} eq 'decode_entities' ? 1 : 0;

my @out;
for(@$opts) {
#warn "iterating links opt $_ = " . uneval_it($_) . "\n";
  my $attr = { extra => $opt->{extra}};
  
  s/\*$// and $attr->{selected} = 1;

  ($attr->{value},$attr->{label}) = @$_;
  encode($attr->{label}, $ESCAPE_CHARS::std) unless $no_encode;
  if($attr->{value} =~ /^\s*\~\~(.*)\~\~\s*$/) {
    my $lab = $1;
    $lab =~ s/"/&quot;/g;
    $opt->{tvalue} = $lab;
    $opt->{tlabel} = $lab;
    push @out, attr_list($o_template, $opt);
    next;
  }

  next if ! $attr->{value} and ! $opt->{empty};
  if( ! length($attr->{label}) ) {
    $attr->{label} = $attr->{value} or next;
  }

  if ($default) {
    $attr->{selected} = $default eq $attr->{value} ? 1 : '';
  }

  my $form = $opt->{form};

  $attr->{label} =~ s/\s/&nbsp;/g if $opt->{nbsp};

  $attr->{url} = Vend::Interpolate::tag_area(
          $href,
          undef,
          {
            form => "$name=$attr->{value}\n$opt->{form}",
            secure => $opt->{secure},
          },
          );
  push @out, attr_list($template, $attr);
}
return join $opt->{joiner}, @out;
}

AUTHORS

Interchange Development Group

SEE ALSO

DocBook! Interchange!