Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (48 sloc) 1.69 KB
# 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: uploadhelper.widget,v 1.7 2009-05-20 09:39:19 racke Exp $
CodeDef uploadhelper Widget 1
CodeDef uploadhelper Description File upload
CodeDef uploadhelper Routine <<EOR
sub {
# $column, $value, $record->{outboard}, $record->{width}
my ($opt) = @_;
my $name = $opt->{name};
my $val = $opt->{value};
my $umask = $opt->{umask} || '022';
my $path = $opt->{path} || $opt->{outboard};
my $size = $opt->{cols} || $opt->{width};
$path =~ s:^/+::;
my $view_url;
$size = qq{ SIZE="$size"} if $size > 0;
my $out = '';
if ($val) {
if($path) {
my $base = $::Variable->{UI_BASE} || 'admin';
my $view_url = Vend::Interpolate::tag_area("$base/do_view", "$path/$val");
$out .= qq{<A HREF="$view_url">};
}
$out .= $val;
if ($path) {
$out .= "</A>";
$out .= qq{<input type="checkbox" name="ui_upload_file_delete:$name" value="1">};
$out .= errmsg('Delete');
}
$out .= qq{&nbsp;<INPUT TYPE=file NAME="$name" VALUE="$val">
<INPUT TYPE=hidden NAME="ui_upload_file_path:$name" VALUE="$path">
<INPUT TYPE=hidden NAME="$name" VALUE="$val">
<INPUT TYPE=hidden NAME="ui_upload_umask:$name" VALUE="$umask">};
}
else {
$out = qq{<INPUT TYPE=hidden NAME="ui_upload_file_path:$name" VALUE="$path">
<INPUT TYPE=file NAME="$name"$size>
<INPUT TYPE=hidden NAME="ui_upload_umask:$name" VALUE="$umask">};
}
return $out;
}
EOR
Jump to Line
Something went wrong with that request. Please try again.