Skip to content
This repository
tag: DEB_4_9_8_2003…
Fetching contributors…

Cannot retrieve contributors at this time

file 46 lines (43 sloc) 1.514 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
CodeDef imagehelper Widget 1
CodeDef imagehelper Routine <<EOR
sub {
    my ($opt) = @_;

my $name = $opt->{name};
my $size = $opt->{cols} || $opt->{width};
my $val = $opt->{value};
my $path = $opt->{image_path} || $opt->{outboard};
my $imagebase = $opt->{image_base} || $opt->{prepend};

Vend::Interpolate::vars_and_comments(\$path);
Vend::Interpolate::vars_and_comments(\$imagebase);
if ($imagebase ||= '') {
$imagebase =~ s/^\s+//;
$imagebase =~ s:[\s/]*$:/:;
}

my $of_widget;
if($path =~ s!/\*(?:\.([^/]+))?$!!) {
my $spec = $1;
my @files = UI::Primitive::list_images($path, $spec);
unshift(@files, "=(none)");
my $passed = join ",", map { s/,/&#44;/g; $_} @files;
my $opt = {
type => 'select',
default => $val,
attribute => 'mv_data_file_oldfile',
passed => $passed,
};
$of_widget = Vend::Interpolate::tag_accessories(
undef, undef, $opt, { 'mv_data_file_oldfile' => $val } );
}
else {
$of_widget = qq{<INPUT TYPE=hidden NAME=mv_data_file_oldfile VALUE="$val">};
}
$size = qq{ SIZE="$size"} if $size > 0;
    if ($val) {
        qq{<A HREF="$imagebase$path/$val">$val</A>&nbsp;<INPUT TYPE=hidden NAME=mv_data_file_field VALUE="$name">
<INPUT TYPE=hidden NAME=mv_data_file_path VALUE="$path">$of_widget<INPUT TYPE=file NAME="$name" VALUE="$val">};
    } else {
        qq{<INPUT TYPE=hidden NAME=mv_data_file_field VALUE="$name">
<INPUT TYPE=hidden NAME=mv_data_file_path VALUE="$path">$of_widget<INPUT TYPE=file NAME="$name"$size>};
    }
}
EOR
Something went wrong with that request. Please try again.