[interchange-cvs] interchange - heins modified code/UI_Tag/display.coretag
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Sun Jun 9 00:05:02 2002
User: heins
Date: 2002-06-09 04:04:28 GMT
Modified: code/UI_Tag display.coretag
Log:
Fixes:
* Allow two types of return so that the widget can
be inserted into a template by the calling routine.
When called with the array return, returns
the widget code, the help, help_url, and label.
* Fix bad subroutine call.
Revision Changes Path
1.6 +14 -7 interchange/code/UI_Tag/display.coretag
rev 1.6, prev_rev 1.5
Index: display.coretag
===================================================================
RCS file: /anon_cvs/repository/interchange/code/UI_Tag/display.coretag,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- display.coretag 16 Feb 2002 09:39:08 -0000 1.5
+++ display.coretag 9 Jun 2002 04:04:28 -0000 1.6
@@ -235,7 +235,7 @@
my $count;
$count = $text =~ s/(\r\n|\r|\n)/$1/g;
- encode($text, $ESCAPE_CHARS::std);
+ HTML::Entities::encode($text, $ESCAPE_CHARS::std);
my $size;
if ($count) {
$count++;
@@ -256,7 +256,9 @@
EOF
}
- return $w unless $template;
+ my $array_return = wantarray;
+
+ return $w unless $template || $array_return;
if($template and $template !~ /\s/) {
$template = <<'EOF';
@@ -284,10 +286,15 @@
: $record->{label},
);
- # Strip the {TAG} {/TAG} pairs if nothing there
- $template =~ s#{([A-Z_]+)}(.*?){/\1}#$sub{$1} ? $2: '' #ges;
- # Insert the TAG
- $template =~ s/\$([A-Z_]+)\$/$sub{$1}/g;
- return $template;
+ if($array_return) {
+ return ($w, $sub{LABEL}, $sub{HELP}, $record->{help_url});
+ }
+ else {
+ # Strip the {TAG} {/TAG} pairs if nothing there
+ $template =~ s#{([A-Z_]+)}(.*?){/\1}#$sub{$1} ? $2: '' #ges;
+ # Insert the TAG
+ $template =~ s/\$([A-Z_]+)\$/$sub{$1}/g;
+ return $template;
+ }
}
EOR