[interchange-cvs] interchange - heins modified lib/Vend/Menu.pm
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Mon Aug 19 22:44:01 2002
User: heins
Date: 2002-08-20 02:43:57 GMT
Modified: lib/Vend Menu.pm
Log:
* More bug fixes.
* Introduced an MSIE positioning problem in my last run -- fixed.
* Now can surely limit indications to one when menu_class changes.
* dhtml_flyout() now does the two-pass transforms.
Revision Changes Path
2.14 +41 -15 interchange/lib/Vend/Menu.pm
rev 2.14, prev_rev 2.13
Index: Menu.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Menu.pm,v
retrieving revision 2.13
retrieving revision 2.14
diff -u -r2.13 -r2.14
--- Menu.pm 19 Aug 2002 02:26:01 -0000 2.13
+++ Menu.pm 20 Aug 2002 02:43:56 -0000 2.14
@@ -1,6 +1,6 @@
# Vend::Menu - Interchange payment processing routines
#
-# $Id: Menu.pm,v 2.13 2002/08/19 02:26:01 mheins Exp $
+# $Id: Menu.pm,v 2.14 2002/08/20 02:43:56 mheins Exp $
#
# Copyright (C) 2002 Mike Heins, <mike@perusion.net>
#
@@ -21,11 +21,12 @@
=20
package Vend::Menu;
=20
-$VERSION =3D substr(q$Revision: 2.13 $, 10);
+$VERSION =3D substr(q$Revision: 2.14 $, 10);
=20
use Vend::Util;
use strict;
=20
+my $indicated;
my %transform =3D (
nbsp =3D> sub {
my ($row, $fields) =3D @_;
@@ -101,6 +102,7 @@
page_class =3D> sub {
my ($row, $fields) =3D @_;
return 1 unless $row->{indicated};
+ return 1 if $row->{mv_level};
return 1 if ref($fields) ne 'ARRAY';
my $status =3D 1;
for(@$fields) {
@@ -109,6 +111,7 @@
#::logDebug("setting scratch $f to row=3D$c=3D$row->{$c}");
$::Scratch->{$f} =3D $row->{$c};
}
+ $$indicated =3D 0;
return 1;
},
menu_group =3D> sub {
@@ -163,13 +166,16 @@
my($s,$r) =3D split /=3D/, $_;
$rev =3D $indicator =3D~ s/^\s*!\s*// ? 1 : 0;
$last =3D $indicator =3D~ s/\s*!\s*$// ? 1 : 0;
-::logDebug("checking scratch $s=3D$::Scratch->{$s} eq row=3D$r=3D$row->{$r=
}");
+#::logDebug("checking scratch $s=3D$::Scratch->{$s} eq row=3D$r=3D$row->{$=
r}");
$status =3D $::Scratch->{$s} eq $row->{$r};
if($rev xor $status) {
$row->{indicated} =3D 1;
}
last if $last;
}
+ if($row->{indicated}) {
+ $indicated =3D \$row->{indicated};
+ }
return 1;
},
indicator_profile =3D> sub {
@@ -329,11 +335,14 @@
my $list =3D $opt->{object}{mv_results};
$main =3D '';
for(@$list) {
-::logDebug("here's a row: " . ::uneval($_));
+#::logDebug("here's a row: " . ::uneval($_));
$main .=3D menu_link($template, $_, $opt);
}
}
=20
+ # Prevent possibility of memory leak
+ undef $indicated;
+
my $header;
$header =3D ::interpolate_html($opt->{header_template})
if $opt->{header_template};
@@ -400,20 +409,39 @@
subordinate =3D> 'code',
autodetect =3D> '1',
sort =3D> $opt->{sort} || 'code',
- iterator =3D> \&tree_line,
- row_repository =3D> [],
full =3D> '1',
spacing =3D> '4',
_transform =3D> $opt->{_transform},
);
-=09
+
for(@{$opt->{_transform} || []}) {
$o{$_} =3D $opt->{$_};
}
=20
- push @out, Vend::Tags->tree(\%o);
+ my $main;
+ my $rows;
+ if($opt->{iterator}) {
+ $o{iterator} =3D $opt->{iterator};
+ $main =3D Vend::Tags->tree(\%o);
+ $rows =3D $o{object}{mv_results};
+ }
+ else {
+ $o{iterator} =3D \&transforms_only;
+ Vend::Tags->tree(\%o);
+ delete $o{_transform};
+ $rows =3D $o{object}{mv_results};
+ $main =3D '';
+ for(@$rows) {
+#::logDebug("here's a row: " . ::uneval($_));
+ $main .=3D tree_line(undef, $_, \%o);
+ }
+ }
+
+ # Prevent possibility of memory leak
+ undef $indicated;
+
+ push @out, $main;
=20
- my $rows =3D $o{row_repository} || [];
my %seen;
my @levels =3D grep !$seen{$_}++, map { $_->{mv_level} } @$rows;
@levels =3D sort { $a <=3D> $b } @levels;
@@ -530,9 +558,9 @@
var pos =3D 0;
if( browserType() =3D=3D "ie" )
if(anchor_down =3D=3D 1)=20
- pos =3D obj.getBoundingClientRect().right - 2;
- else
pos =3D obj.getBoundingClientRect().left + 2;
+ else
+ pos =3D obj.getBoundingClientRect().right - 2;
else {
var n =3D 0;
var x =3D obj.offsetParent;
@@ -1026,9 +1054,6 @@
$row->{page} =3D Vend::Tags->area( { href =3D> $row->{page}, form =3D> $=
form });
}
=20
- if($opt->{row_repository}) {
- push @{$opt->{row_repository}}, $row;
- }
my @values =3D @{$row}{@$fields};
=20
for(@values) {
@@ -1228,7 +1253,8 @@
if(! $opt->{name}) {
logError("No file or name specified for menu.");
}
- $opt->{file} .=3D "/$opt->{name}.txt";
+ my $nm =3D escape_chars($opt->{name});
+ $opt->{file} .=3D "/$nm.txt";
}
return old_simple($name, $opt, $template) unless $opt->{dhtml_browser};
return dhtml_simple($name, $opt, $template);