[interchange-cvs] interchange - kwalsh modified lib/Vend/Interpolate.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Thu Jul 25 13:08:11 2002


User:      kwalsh
Date:      2002-07-25 17:07:22 GMT
Modified:  lib/Vend Interpolate.pm
Log:
	* Changed the MV_SHIP_MODIFIERS variable to allow the modifier
	  names to be separated using any combination of whitespace, commas
	  or pipe symbols, as suggested by Jon Jensen and Mike Heins.

	* If the current page is secure then all 'more matches' links will
	  also point to the secure server.

	* Don't display the 'Last' anchor if [last-anchor]none[/last-anchor]
	  has been specified.

Revision  Changes    Path
2.90      +21 -10    interchange/lib/Vend/Interpolate.pm


rev 2.90, prev_rev 2.89
Index: Interpolate.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/Interpolate.pm,v
retrieving revision 2.89
retrieving revision 2.90
diff -u -r2.89 -r2.90
--- Interpolate.pm	23 Jul 2002 22:43:02 -0000	2.89
+++ Interpolate.pm	25 Jul 2002 17:07:21 -0000	2.90
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 #=20
-# $Id: Interpolate.pm,v 2.89 2002/07/23 22:43:02 racke Exp $
+# $Id: Interpolate.pm,v 2.90 2002/07/25 17:07:21 kwalsh Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA =3D qw(Exporter);
=20
-$VERSION =3D substr(q$Revision: 2.89 $, 10);
+$VERSION =3D substr(q$Revision: 2.90 $, 10);
=20
 @EXPORT =3D qw (
=20
@@ -3558,7 +3558,12 @@
=20
 sub more_link_template {
 	my ($anchor, $arg, $form_arg) =3D @_;
-	my $url =3D tag_area( "scan/MM=3D$arg", '', { form =3D> $form_arg } );
+
+	my $url =3D tag_area("scan/MM=3D$arg", '', {
+	    form =3D> $form_arg,
+	    secure =3D> $CGI::secure,
+	});
+
 	my $lt =3D $link_template;
 	$lt =3D~ s/\$URL\$/$url/g;
 	$lt =3D~ s/\$ANCHOR\$/$anchor/g;
@@ -3724,10 +3729,12 @@
 		else {
 			$last_anchor =3D ::errmsg('Last');
 		}
- 		$last =3D $total - 1;
- 		my $last_beg_idx =3D $total - ($total % $chunk || $chunk);
- 		$arg =3D "$session:$last_beg_idx:$last:$chunk";
- 		$next_tag .=3D ' ' . more_link_template($last_anchor, $arg, $form_arg);
+		unless ($last_anchor eq 'none') {
+			$last =3D $total - 1;
+			my $last_beg_idx =3D $total - ($total % $chunk || $chunk);
+			$arg =3D "$session:$last_beg_idx:$last:$chunk";
+			$next_tag .=3D ' ' . more_link_template($last_anchor, $arg, $form_arg);
+		}
 	}
 	else {
 		$r =3D~ s:\[(last|next)[-_]anchor\]$All\[/\1[-_]anchor\]::i;
@@ -5822,10 +5829,14 @@
 	else {
 #::logDebug("standard field selection");
 	    my $use_modifier;
-	    if (defined $::Variable->{MV_SHIP_MODIFIERS} && $field =3D~ /^($::Var=
iable->{MV_SHIP_MODIFIERS})$/){
-		$use_modifier =3D 1;
+
+	    if ($::Variable->{MV_SHIP_MODIFIERS}){
+		my @pieces =3D grep {$_ =3D quotemeta $_} split(/[\s,|]+/,$::Variable->{=
MV_SHIP_MODIFIERS});
+		my $regex =3D join('|',@pieces);
+		$use_modifier =3D 1 if ($regex && $field =3D~ /^($regex)$/);
 	    }
-	    my $col_checked;
+
+	    my $col_checked =3D 0;
 	    foreach my $item (@$Vend::Items){
 		my $value;
 		if ($use_modifier && defined $item->{$field}){