1 # Copyright 2005-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: uploadhelper.widget,v 1.7 2009-05-20 09:39:19 racke Exp $
10 CodeDef uploadhelper Widget 1
11 CodeDef uploadhelper Description File upload
12 CodeDef uploadhelper Routine <<EOR
14 # $column, $value, $record->{outboard}, $record->{width}
17 my $name = $opt->{name};
18 my $val = $opt->{value};
19 my $umask = $opt->{umask} || '022';
20 my $path = $opt->{path} || $opt->{outboard};
21 my $size = $opt->{cols} || $opt->{width};
25 $size = qq{ SIZE="$size"} if $size > 0;
29 my $base = $::Variable->{UI_BASE} || 'admin';
30 my $view_url = Vend::Interpolate::tag_area("$base/do_view", "$path/$val");
31 $out .= qq{<A HREF="$view_url">};
36 $out .= qq{<input type="checkbox" name="ui_upload_file_delete:$name" value="1">};
37 $out .= errmsg('Delete');
39 $out .= qq{ <INPUT TYPE=file NAME="$name" VALUE="$val">
40 <INPUT TYPE=hidden NAME="ui_upload_file_path:$name" VALUE="$path">
41 <INPUT TYPE=hidden NAME="$name" VALUE="$val">
42 <INPUT TYPE=hidden NAME="ui_upload_umask:$name" VALUE="$umask">};
45 $out = qq{<INPUT TYPE=hidden NAME="ui_upload_file_path:$name" VALUE="$path">
46 <INPUT TYPE=file NAME="$name"$size>
47 <INPUT TYPE=hidden NAME="ui_upload_umask:$name" VALUE="$umask">};