1# Copyright 2005-2007 Interchange Development Group and others 2# 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. 7# 8# $Id: uploadblob.widget,v 1.5 2007-03-30 23:40:58 pajamian Exp $ 9 10CodeDef uploadblob Widget 1 11CodeDef uploadblob Description File upload to BLOB 12CodeDef uploadblob Routine <<EOR 13sub { 14 # $column, $value, $record->{outboard}, $record->{width} 15 my ($opt) = @_; 16 my $name = $opt->{name}; 17 my $size = $opt->{cols} || $opt->{width}; 18 19 my $pre = $opt->{prepend} || ''; 20 my $app = $opt->{append} || ''; 21 my $out = $pre; 22 23 if(my $n = $opt->{name_to}) { 24 $out .= qq{<INPUT TYPE=hidden NAME="mv_data_file_name_to_$name" VALUE="$n">}; 25 } 26 if(my $s = $opt->{size_to}) { 27 $out .= qq{<INPUT TYPE=hidden NAME="mv_data_file_size_to_$name" VALUE="$s">}; 28 } 29 30 $size = qq{ SIZE="$size"} if $size > 0; 31 $out .= qq{<INPUT TYPE=hidden NAME="mv_data_file_field" VALUE="$name"> 32<INPUT TYPE=hidden NAME="mv_data_file_path" VALUE=""> 33<INPUT TYPE=hidden NAME="mv_data_file_oldfile" VALUE=""> 34<INPUT TYPE=file NAME="$name"$size>$app}; 35 return $out; 36} 37EOR 38 39CodeDef uploadblob ExtraMeta <<EOM 40{ 41 _order => [ qw/ name_to size_to /], 42 name_to => { 43 options => 'columns::', 44 label => 'Field to store uploadblob file name in', 45 help => 'if any -- must be in fields of table editor', 46 widget => 'select', 47 }, 48 size_to => { 49 options => 'columns::', 50 label => 'Field to store uploadblob size in', 51 help => 'if any -- must be in fields of table editor', 52 widget => 'select', 53 }, 54} 55EOM 56