Lines Matching refs:opt

252 	my $opt = shift;
259 my $delim = Vend::Interpolate::get_joiner($opt->{delimiter}, ',');
264 my $opt = shift;
272 my $delim = Vend::Interpolate::get_joiner($opt->{delimiter}, ',');
281 my $opt = shift;
282 return attr_list($Template{$opt->{type}} || $Template{default}, $opt);
287 my($opt, $data) = @_;
290 if (defined $opt->{value}) {
291 $val = $opt->{value};
293 elsif(defined $opt->{default}) {
294 $val = $opt->{default};
306 my($opt, $opts) = @_;
308 $opt->{joiner} = Vend::Interpolate::get_joiner($opt->{joiner}, "<br$Vend::Xtrailer>");
309 my $name = $opt->{name};
310 my $default = defined $opt->{value} ? $opt->{value} : $opt->{default};
312 $opt->{extra} = " $opt->{extra}" if $opt->{extra};
314 my $template = $opt->{template} || <<EOF;
318 my $o_template = $opt->{o_template} || <<EOF;
322 my $href = $opt->{href} || $Global::Variable->{MV_PAGE};
323 $opt->{form} = "mv_action=return" unless $opt->{form};
325 my $no_encode = $opt->{pre_filter} eq 'decode_entities' ? 1 : 0;
330 my $attr = { extra => $opt->{extra}};
339 $opt->{tvalue} = $lab;
340 $opt->{tlabel} = $lab;
341 push @out, attr_list($o_template, $opt);
345 next if ! $attr->{value} and ! $opt->{empty};
354 my $form = $opt->{form};
356 $attr->{label} =~ s/\s/&nbsp;/g if $opt->{nbsp};
362 form => "$name=$attr->{value}\n$opt->{form}",
363 secure => $opt->{secure},
368 return join $opt->{joiner}, @out;
427 my($opt) = @_;
429 my $name = $opt->{name};
430 my $val = $opt->{value};
436 if($opt->{time} and $opt->{time_adjust} =~ /([-+]?)(\d+)/) {
453 $selapp = " $opt->{$stag}";
454 $optapp = " $opt->{$otag}";
457 $selapp = qq{ $_="$opt->{$stag}"};
458 $optapp = qq{ $_="$opt->{$otag}"};
460 $sel_extra .= $opt->{$stag} ? $selapp : '';
461 $opt_extra .= $opt->{$otag} ? $optapp : '';
468 if ($opt->{blank}) {
486 if ($opt->{blank}) {
500 if(my $by = $opt->{year_begin} || $::Variable->{UI_DATE_BEGIN}) {
502 my $ey = $opt->{year_end} || $::Variable->{UI_DATE_END} || ($cy + 10);
511 if ($opt->{blank}) {
522 return $out unless $opt->{time};
527 my $blank_time = ($opt->{blank} and $1 !~ /[1-9]/);
532 if ($opt->{blank}) {
536 my $ampm = defined $opt->{ampm} ? $opt->{ampm} : 1;
543 $opt->{minutes} ||= '';
545 if($opt->{minutes} =~ /half/i) {
548 elsif($opt->{minutes} =~ /hourly/i) {
551 elsif($opt->{minutes} =~ /ten/i) {
554 elsif($opt->{minutes} =~ /[\0,]/) {
555 @min = grep /^\d+$/ && $_ <= 59, split /[\0,\s]+/, $opt->{minutes};
561 $opt->{start_hour} ||= 0;
563 $opt->{$_} = int(abs($opt->{$_}));
564 if($opt->{$_} > 23) {
565 $opt->{$_} = 0;
568 $opt->{start_hour} ||= 0;
569 $opt->{end_hour} ||= 23;
571 for my $hr ( $opt->{start_hour} .. $opt->{end_hour} ) {
572 next if defined $opt->{start_hour} and $hr < $opt->{start_hour};
573 next if defined $opt->{end_hour} and $hr > $opt->{end_hour};
576 if($opt->{ampm}) {
620 my($opt) = @_;
621 my($name, $val) = ($opt->{name}, $opt->{value});
623 my $width = $opt->{width} || 16;
624 $opt->{filter} = 'option_format'
625 unless length($opt->{filter});
626 $val = Vend::Interpolate::filter_value($opt->{filter}, $val);
636 my $height = $opt->{height} || 5;
657 my ($opt, $opts) = @_;
658 my $name = $opt->{name};
659 $opt->{name} = "X$name";
660 my $usenl = $opt->{rows} > 1 ? 1 : 0;
661 my $only = $opt->{replace} ? 1 : 0;
662 $opt->{extra} .= qq{ onChange="addItem(this.form['X$name'],this.form['$name'],$usenl,$only)"}
663 unless $opt->{extra} =~ m/\bonchange\s*=/i;
665 $opt->{rows} = $opt->{height} unless length($opt->{rows});
666 $opt->{cols} = $opt->{width} unless length($opt->{cols});
669 my $out = dropdown($opt, $opts);
671 my $template = $opt->{o_template} || '';
673 if($opt->{rows} > 1) {
682 $opt->{name} = $name;
683 $tbox = attr_list($template, $opt);
685 return $opt->{reverse} ? $tbox . $out : $out . $tbox;
689 my ($opt, $opts) = @_;
691 if($opt->{textarea}) {
692 my $template = $opt->{o_template};
695 if(! $opt->{rows} or $opt->{rows} > 1) {
699 unless $opt->{conditional_text} and length($opt->{value}) < 3;
706 unless $opt->{conditional_text} and length($opt->{value}) < 3;
710 $addl = attr_list($template, $opt);
713 $addl = qq|<input type="text" name="$opt->{name}"|;
714 $addl .= qq| size="$opt->{cols}" value="">|;
716 if($opt->{reverse}) {
717 $opt->{append} = length($opt->{append}) ? "$addl$opt->{append}" : $addl;
720 $opt->{prepend} = length($opt->{prepend}) ? "$opt->{prepend}$addl" : $addl;
722 return dropdown($opt, $opts);
726 my($opt, $opts) = @_;
728 $opt->{multiple} = 1 if $opt->{type} eq 'multiple';
732 my $price = $opt->{price} || {};
737 my $run = attr_list($Template{selecthead}, $opt);
741 if($opt->{multiple}) {
743 if($opt->{rawvalue}) {
758 if($opt->{cols}) {
759 my $cols = $opt->{cols};
769 my $default = $opt->{value};
772 my $no_encode = $opt->{pre_filter} eq 'decode_entities' ? 1 : 0;
820 if($opt->{option_template}) {
823 $run .= attr_list($opt->{option_template}, $attr);
835 $run .= attr_list($Template{selecttail}, $opt);
864 my $opt = shift;
865 $opt->{value} = is_yes($opt->{value});
866 my $yes = defined $opt->{yes_value} ? $opt->{yes_value} : 1;
867 my $no = defined $opt->{no_value} ? $opt->{no_value} : '';
868 my $yes_title = defined $opt->{yes_title} ? $opt->{yes_title} : errmsg('Yes');
869 my $no_title = defined $opt->{no_title} ? $opt->{no_title} : errmsg('No');
871 my $routine = $opt->{subwidget} || \&dropdown;
872 if($opt->{variant} eq 'checkbox') {
881 return $routine->($opt, \@opts);
892 my $opt = shift;
893 $opt->{value} = is_no($opt->{value});
898 my $routine = $opt->{subwidget} || \&dropdown;
899 return $routine->($opt, \@opts);
903 my($opt, $opts) = @_;
905 my $inc = $opt->{breakmod};
908 $opt->{variant} ||= $opt->{type};
912 if($opt->{nbsp}) {
916 elsif ($opt->{left}) {
925 elsif ($opt->{right}) {
941 my $price = $opt->{price} || {};
944 my $default = $opt->{value};
945 my $no_encode = $opt->{pre_filter} eq 'decode_entities' ? 1 : 0;
954 $opt->{tvalue} = $lab;
955 $opt->{tlabel} = $lab;
956 $run .= attr_list($o_template, $opt);
966 undef $opt->{selected};
968 and $opt->{selected} = 1;
969 $opt->{selected} = '' if defined $opt->{value};
984 and $opt->{selected} = 1;
987 my $regex = $opt->{contains}
990 $default =~ $regex and $opt->{selected} = 1;
993 $opt->{tvalue} = encode($value, $ESCAPE_CHARS::std);
995 if($opt->{option_template}) {
996 $opt->{tlabel} = attr_list($opt->{option_template}, $attr);
997 $opt->{tlabel} =~ s/ /&nbsp;/g if $xlt;
1001 $opt->{tlabel} = $label;
1004 $opt->{ttitle} = $help;
1006 $run .= attr_list($template, $opt);
1013 my ($passed, $opt) = @_;
1021 $opt ||= {};
1028 my $delim = $opt->{delimiter} || ',';
1048 if(! $opt->{sort_option}) {
1051 elsif($opt->{sort_option} eq 'none') {
1054 elsif($opt->{sort_option} =~ /n/i) {
1071 if ($opt->{applylocale}) {
1081 my($opt, $item, $data) = @_;
1083 if($opt->{debug}) {
1084 ::logDebug("display called, options=" . uneval($opt));
1088 if(! ref $opt) {
1091 if($opt =~ /^$Codere$/) {
1092 $opt = { name => $opt };
1095 return $opt;
1098 elsif (ref $opt eq 'ARRAY') {
1101 for(@$opt) {
1107 if($opt->{override}) {
1108 $opt->{value} = $opt->{default};
1111 $opt->{default} = $opt->{value} if defined $opt->{value};
1113 if($opt->{pre_filter} and defined $opt->{value}) {
1114 $opt->{value} = Vend::Interpolate::filter_value(
1115 $opt->{pre_filter},
1116 $opt->{value},
1126 $item = get_option_hash($item || $opt->{item});
1131 $opt ||= {};
1137 $opt->{attribute} ||= $opt->{name};
1138 $opt->{prepend} = '' unless defined $opt->{prepend};
1139 $opt->{append} = '' unless defined $opt->{append};
1140 $opt->{delimiter} = ',' unless length($opt->{delimiter});
1141 $opt->{cols} ||= $opt->{width} || $opt->{size};
1142 $opt->{rows} ||= $opt->{height};
1144 if($opt->{js_check}) {
1145 my @checks = grep /\w/, split /[\s,\0]+/, $opt->{js_check};
1148 $sub->($opt);
1164 my $type = parse_type($opt);
1170 if($look = $opt->{lookup_query}) {
1172 my $tab = $opt->{db} || $opt->{table} || $Vend::Cfg->{ProductFiles}[0];
1183 my $j = $opt->{label_joiner} || '-';
1189 elsif($look = $opt->{lookup}) {
1192 my $tab = $opt->{db} || $opt->{table} || $Vend::Cfg->{ProductFiles}[0];
1195 my $fld = $opt->{field} || $look;
1203 my $order = $opt->{sort} || $f[1] || $f[0];
1210 my $join = $opt->{label_joiner} || '-';
1218 elsif($opt->{passed}) {
1219 $data = options_to_array($opt->{passed}, $opt);
1221 elsif(! $opt->{already_got_data} and $opt->{column} and $opt->{table} ) {
1223 last GETDATA if $opt->{table} eq 'mv_null';
1224 my $key = $opt->{outboard} || $item->{code} || $opt->{code};
1226 last GETDATA unless ::database_exists_ref($opt->{table});
1227 $opt->{passed} = $Tag->data($opt->{table}, $opt->{column}, $key)
1229 $data = options_to_array($opt->{passed}, $opt);
1236 if($opt->{options}) {
1237 $ary = options_to_array($opt->{options}, $opt) || [];
1242 if($opt->{lookup_exclude}) {
1245 $sub = sub { $_[0] !~ m{$opt->{lookup_exclude}} };
1249 "Bad lookup pattern m{%s}: %s", $opt->{lookup_exclude}, $@,
1263 unless($opt->{lookup_merge}) {
1284 and $opt->{item} || ! $opt->{name};
1285 $opt->{name} = $opt->{attribute}
1286 unless $opt->{name};
1287 $opt->{value} = $item->{$opt->{attribute} || $opt->{name}};
1288 $opt->{name} .= $adder if defined $adder;
1293 $opt->{name} = "mv_order_$opt->{attribute}" unless $opt->{name};
1296 $opt->{price} = get_option_hash($opt->{price_data})
1297 if $opt->{price};
1299 $opt->{name} ||= $opt->{attribute};
1301 if(defined $opt->{value}) {
1304 elsif(defined $item->{$opt->{name}}) {
1305 $opt->{value} = $item->{$opt->{name}};
1307 elsif($opt->{cgi_default} and ! $opt->{override}) {
1308 my $def = $CGI::values{$opt->{name}};
1309 $opt->{value} = $def if defined($def);
1311 elsif($opt->{values_default} and ! $opt->{override}) {
1312 my $def = $::Values->{$opt->{name}};
1313 $opt->{value} = $def if defined($def);
1316 $opt->{value} = $opt->{default} if ! defined $opt->{value};
1318 if(length($opt->{blank_default}) and ! length($opt->{value}) ) {
1319 $opt->{value} = $opt->{blank_default};
1322 $opt->{encoded} = encode($opt->{value}, $ESCAPE_CHARS::std);
1323 if($opt->{display_filter}) {
1325 $opt->{display_filter},
1326 $opt->{value},
1328 $opt->{filtered} = encode($newv, $ESCAPE_CHARS::std);
1330 $opt->{value} =~ s/&#91;/\[/g if $opt->{enable_itl};
1332 if($opt->{class}) {
1333 if($opt->{extra}) {
1334 $opt->{extra} =~ s{(^|\s+)class=(["'])?[^\s'"]+\2}{$1};
1335 $opt->{extra} =~ s/\s+$//;
1336 $opt->{extra} .= qq{ class="$opt->{class}"};
1339 $opt->{extra} = qq{class="$opt->{class}"};
1358 next if defined $opt->{$k};
1359 $opt->{$k} = $v;
1363 if($opt->{variant}) {
1365 $opt->{subwidget} = $Vend::UserWidget->{$opt->{variant}}
1369 if(my $c = $opt->{check}) {
1370 $c = "$opt->{name}=$c" unless $c =~ /=/;
1372 $opt->{append} .= qq{<input type="hidden" name="mv_individual_profile" value="$c">};
1375 if($opt->{js}) {
1376 $opt->{extra} ||= '';
1377 $opt->{extra} .= " $opt->{js}";
1378 $opt->{extra} =~ s/^\s+//;
1380 return $sub->($opt, $data);
1384 my $opt = shift;
1385 if(ref($opt) ne 'HASH') {
1387 return $opt;
1391 my $type = $opt->{type} = lc($opt->{type}) || 'text';
1398 my $rows = $1 || $opt->{rows} || 4;
1399 $cols = $2 || $opt->{cols} || 40;
1400 $opt->{type} = 'textarea';
1401 $opt->{rows} = $rows;
1402 $opt->{cols} = $cols;
1405 $opt->{cols} = $1;
1406 $opt->{type} = 'text';
1409 $opt->{type} = 'text';
1413 $opt->{type} = lc $1;
1416 $opt->{time} = 1 if $extra =~ /time/i;
1417 $opt->{ampm} = 1 if $extra =~ /ampm/i;
1418 $opt->{blank} = 1 if $extra =~ /blank/i;
1420 and $opt->{minutes} = $1)
1422 ($extra =~ /half/i and $opt->{minutes} = 'half_hourly')
1424 ($extra =~ /hourly/i and $opt->{minutes} = 'hourly')
1426 ($extra =~ /tens/i and $opt->{minutes} = 'tens')
1429 $opt->{start_hour} = $1;
1430 $opt->{end_hour} = $2;
1432 $opt->{time_adjust} = $1
1438 $opt->{type} = 'hiddentext';
1441 $type =~ /(\d+)/ and $opt->{cols} = $1;
1442 $opt->{type} = 'password';
1447 $opt->{type} = 'range';
1449 $opt->{default} = $opt->{item}{$select}
1450 if $opt->{item};
1453 $opt->{type} = 'box';
1455 $opt->{type} = 'checkbox';
1458 $opt->{type} = 'radio';
1462 $opt->{fontsize} = $1;
1466 $opt->{nbsp} = 1;
1469 $opt->{breakmod} = $1;
1470 $opt->{left} = 1;
1473 $opt->{breakmod} = $1;
1474 $opt->{right} = 1;
1478 $opt->{rows} = $opt->{rows} || $1 || 1;
1479 $opt->{cols} = $opt->{cols} || $2 || 16;
1480 $opt->{type} = 'combo';
1483 $opt->{rows} ||= $1;
1484 $opt->{cols} ||= $2;
1485 $opt->{type} = 'combo';
1486 $opt->{textarea} = 1;
1487 $opt->{reverse} = 1;
1488 $opt->{conditional_text} = 1;
1491 $opt->{rows} = $opt->{rows} || $1 || 1;
1492 $opt->{cols} = $opt->{cols} || $2 || 16;
1493 $opt->{type} = 'combo';
1494 $opt->{reverse} = 1;
1497 $opt->{nbsp} = 1;
1498 $opt->{type} = 'links';
1501 $opt->{rows} = $opt->{rows} || $opt->{height} || $1 || 1;
1502 $opt->{cols} = $opt->{cols} || $opt->{width} || $2 || 16;
1503 $opt->{type} = 'movecombo';
1504 $opt->{replace} = 1 if $type =~ /replace/;
1507 $opt->{type} = 'select';
1508 $opt->{multiple} = 1;
1510 and $opt->{extra} ||= $1;
1514 $opt->{type} = 'yesno';
1516 $opt->{variant} = $type =~ /radio/ ? 'radio' : $type;
1520 $opt->{type} = 'noyes';
1522 $opt->{variant} = $type =~ /radio/ ? 'radio' : $type;
1525 return $opt->{type};