/
uploadblob.widget
53 lines (48 loc) · 1.61 KB
/
uploadblob.widget
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
47
48
49
50
51
52
53
# 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.
CodeDef uploadblob Widget 1
CodeDef uploadblob Description File upload to BLOB
CodeDef uploadblob Routine <<EOR
sub {
# $column, $value, $record->{outboard}, $record->{width}
my ($opt) = @_;
my $name = $opt->{name};
my $size = $opt->{cols} || $opt->{width};
my $pre = $opt->{prepend} || '';
my $app = $opt->{append} || '';
my $out = $pre;
if(my $n = $opt->{name_to}) {
$out .= qq{<INPUT TYPE=hidden NAME="mv_data_file_name_to_$name" VALUE="$n">};
}
if(my $s = $opt->{size_to}) {
$out .= qq{<INPUT TYPE=hidden NAME="mv_data_file_size_to_$name" VALUE="$s">};
}
$size = qq{ SIZE="$size"} if $size > 0;
$out .= qq{<INPUT TYPE=hidden NAME="mv_data_file_field" VALUE="$name">
<INPUT TYPE=hidden NAME="mv_data_file_path" VALUE="">
<INPUT TYPE=hidden NAME="mv_data_file_oldfile" VALUE="">
<INPUT TYPE=file NAME="$name"$size>$app};
return $out;
}
EOR
CodeDef uploadblob ExtraMeta <<EOM
{
_order => [ qw/ name_to size_to /],
name_to => {
options => 'columns::',
label => 'Field to store uploadblob file name in',
help => 'if any -- must be in fields of table editor',
widget => 'select',
},
size_to => {
options => 'columns::',
label => 'Field to store uploadblob size in',
help => 'if any -- must be in fields of table editor',
widget => 'select',
},
}
EOM