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

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Sun Aug 18 04:00:03 2002


User:      heins
Date:      2002-08-18 07:59:08 GMT
Modified:  lib/Vend Interpolate.pm
Log:
* Regularize [page ...] tag. Allow calling of CSS class by [page extra=3Dcl=
ass],
  or anything with [page extra=3D| class=3Dfoo style=3Dbar | href=3D...].

Revision  Changes    Path
2.106     +17 -11    interchange/lib/Vend/Interpolate.pm


rev 2.106, prev_rev 2.105
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.105
retrieving revision 2.106
diff -u -r2.105 -r2.106
--- Interpolate.pm	15 Aug 2002 16:30:34 -0000	2.105
+++ Interpolate.pm	18 Aug 2002 07:59:08 -0000	2.106
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 #=20
-# $Id: Interpolate.pm,v 2.105 2002/08/15 16:30:34 mheins Exp $
+# $Id: Interpolate.pm,v 2.106 2002/08/18 07:59:08 mheins 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.105 $, 10);
+$VERSION =3D substr(q$Revision: 2.106 $, 10);
=20
 @EXPORT =3D qw (
=20
@@ -3087,10 +3087,19 @@
 sub tag_page {
     ($page, $arg, $opt) =3D @_;
=20
-#::logDebug("tag_page opt=3D" . ::uneval($opt));
-	return '<A HREF=3D"' . form_link(@_) . '">' if defined $opt and $opt->{fo=
rm};
+	my $extra;
+	if($extra =3D ($opt ||=3D {})->{extra} || '') {
+		$extra =3D~ s/^(\w+)$/class=3D$1/;
+		$extra =3D " $extra";
+	}
+
+	my $url;
+	my $urlroutine =3D $opt->{secure} ? \&secure_vendUrl : \&vendUrl;
=20
-	if ($opt->{search}) {
+	if($opt->{form}) {
+		$url =3D form_link(@_);
+	}
+	elsif ($opt->{search}) {
 		$page =3D escape_scan($opt->{search});
 	}
 	elsif ($page eq 'scan') {
@@ -3098,13 +3107,10 @@
 		undef $arg;
 	}
=20
-	$urlroutine =3D $opt->{secure} ? \&secure_vendUrl : \&vendUrl;
-
-	resolve_static();
-
-	my $extra =3D $opt->{extra} ? " $opt->{extra}" : '';
+	resolve_static(), $url =3D $urlroutine->($page)
+		unless $url;
=20
-    return '<a href=3D"' . $urlroutine->($page,$arg || undef) . qq!"$extra=
>!;
+    return qq{<a href=3D"$url"$extra>};
 }
=20
 # Returns an href which will call up the specified PAGE.