[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Mon Aug 4 02:01:00 EDT 2003


User:      heins
Date:      2003-08-04 05:01:37 GMT
Modified:  lib/Vend Menu.pm Util.pm
Log:
* Add cheesy auto_format page/URL detection facility to try and
  tolerate user-built menus a bit better. In particular, this will
  recognize a non http: anchored absolute URL and will tolerate
  anchors in the page name.

  Called with auto-format=1 as a param.

Revision  Changes    Path
2.31      +6 -3      interchange/lib/Vend/Menu.pm


rev 2.31, prev_rev 2.30
Index: Menu.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Menu.pm,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -r2.30 -r2.31
--- Menu.pm	10 May 2003 22:06:14 -0000	2.30
+++ Menu.pm	4 Aug 2003 05:01:37 -0000	2.31
@@ -1,6 +1,6 @@
 # Vend::Menu - Interchange menu processing routines
 #
-# $Id: Menu.pm,v 2.30 2003/05/10 22:06:14 mheins Exp $
+# $Id: Menu.pm,v 2.31 2003/08/04 05:01:37 mheins Exp $
 #
 # Copyright (C) 2002 Mike Heins, <mike at perusion.net>
 #
@@ -21,7 +21,7 @@
 
 package Vend::Menu;
 
-$VERSION = substr(q$Revision: 2.30 $, 10);
+$VERSION = substr(q$Revision: 2.31 $, 10);
 
 use Vend::Util;
 use strict;
@@ -1259,6 +1259,7 @@
 							href => $row->{page},
 							form => $row->{form},
 							add_dot_html => $add,
+							auto_format => 1,
 						});
 	}
 	$row->{name} =~ s/ /&nbsp;/g;
@@ -1365,7 +1366,8 @@
 								form => $form,
 								no_count => $opt->{timed},
 								add_dot_html => $add,
-								no_session_id => $opt->{timed}
+								no_session_id => $opt->{timed},
+								auto_format => 1,
 							});
 
 		unless($opt->{no_open}) {
@@ -1451,6 +1453,7 @@
 									href => $row->{page},
 									form => $row->{form},
 									add_dot_html => $add,
+									auto_format => 1,
 								});
 	}
 	extra_value($opt->{extra_value}, $row)



2.64      +11 -2     interchange/lib/Vend/Util.pm


rev 2.64, prev_rev 2.63
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.63
retrieving revision 2.64
diff -u -r2.63 -r2.64
--- Util.pm	26 Jul 2003 22:01:12 -0000	2.63
+++ Util.pm	4 Aug 2003 05:01:37 -0000	2.64
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.63 2003/07/26 22:01:12 mheins Exp $
+# $Id: Util.pm,v 2.64 2003/08/04 05:01:37 mheins Exp $
 # 
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -87,7 +87,7 @@
 use Vend::File;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.63 $, 10);
+$VERSION = substr(q$Revision: 2.64 $, 10);
 
 my $Eval_routine;
 my $Eval_routine_file;
@@ -1155,6 +1155,15 @@
 
 sub vendUrl {
     my($path, $arguments, $r, $opt) = @_;
+
+	if($opt->{auto_format}) {
+		return $path if $path =~ m{^/};
+		$path =~ s:#([^/.])+$::
+            and $opt->{anchor} = $1;
+		$path =~ s/\.html?$//i
+			and $opt->{add_dot_html} = 1;
+	}
+
     $r = $Vend::Cfg->{VendURL}
 		unless defined $r;
 







More information about the interchange-cvs mailing list