[interchange-cvs] interchange - heins modified 3 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Fri Dec 28 12:17:00 2001


User:      heins
Date:      2001-12-28 17:16:26 GMT
Modified:  scripts  interchange.PL
Modified:  lib/Vend Config.pm Interpolate.pm
Log:
	* Add AliasTable construct so that flypage can be aliased. This allows
	  rerouting of requests such that no directory lookup cycle is needed.

	  Application is for content management and creation of pseudo-paths
	  referencing database objects.

	  Allows initialization of CGI inputs via base_control field.

	  Field names are hard-coded to begin with, mapping will be examined.

Revision  Changes    Path
2.18      +40 -7     interchange/scripts/interchange.PL


rev 2.18, prev_rev 2.17
Index: interchange.PL
===================================================================
RCS file: /anon_cvs/repository/interchange/scripts/interchange.PL,v
retrieving revision 2.17
retrieving revision 2.18
diff -u -r2.17 -r2.18
--- interchange.PL	2001/11/28 03:35:45	2.17
+++ interchange.PL	2001/12/28 17:16:26	2.18
@@ -50,7 +50,7 @@
 #
 # Interchange version 4.9.0
 #
-# $Id: interchange.PL,v 2.17 2001/11/28 03:35:45 jon Exp $
+# $Id: interchange.PL,v 2.18 2001/12/28 17:16:26 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -2099,16 +2099,15 @@
 #show_times("end session get") if $Global::ShowTimes;
 
 	$Vend::FinalPath = $Vend::Session->{last_url} = $CGI::path_info;
-	if(	defined $Vend::Session->{one_time_path_alias}{$Vend::FinalPath} ) {
-		$CGI::path_info
-					= $Vend::FinalPath
-					= delete $Vend::Session->{one_time_path_alias}{$Vend::FinalPath};
-	} 
-	elsif( defined $Vend::Session->{path_alias}{$Vend::FinalPath}	) {
+
+	if( defined $Vend::Session->{path_alias}{$Vend::FinalPath}	) {
 		$CGI::path_info
 					= $Vend::FinalPath
 					= $Vend::Session->{path_alias}{$Vend::FinalPath};
+		delete $Vend::Session->{path_alias}{$Vend::FinalPath}
+			if delete $Vend::Session->{one_time_path_alias}{$Vend::FinalPath};
 	}
+
     url_history($Vend::FinalPath) if $Vend::Cfg->{History};
 
 # TRACK
@@ -2229,6 +2228,40 @@
 
 	$Vend::FinalPath =~ s:^/+::;
 	$Vend::FinalPath =~ s/(\.html?)$//;
+
+	if(
+		$Vend::Cfg->{AliasTable}
+			and
+		my $record = database_exists_ref($Vend::Cfg->{AliasTable})
+						->row_hash($Vend::FinalPath)
+	 )
+	{
+		$Vend::FinalPath = $record->{real_page};
+
+		# This prevents filesystem access when we never want it
+		# If base page is not passed we allow normal resolution
+		$record->{base_page}
+			and $Vend::ForceFlypage = $record->{base_page};
+
+		my $ref;
+
+		## Here we populate CGI variables if desired
+		## Explicitly passed variables override this
+		if(
+			$record->{base_control}
+				and
+			$ref = get_option_hash($record->{base_control})
+		  )
+		{
+			for(keys %$ref) {
+				next if defined $CGI::values{$_};
+				$CGI::values{$_} = $ref->{$_};
+			}
+		}
+
+	}
+
+
 	$Vend::Session->{extension} = $1 || '';
 #::logDebug("path=$Vend::FinalPath");
 



2.17      +3 -2      interchange/lib/Vend/Config.pm


rev 2.17, prev_rev 2.16
Index: Config.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Config.pm,v
retrieving revision 2.16
retrieving revision 2.17
diff -u -r2.16 -r2.17
--- Config.pm	2001/12/06 01:25:19	2.16
+++ Config.pm	2001/12/28 17:16:26	2.17
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.16 2001/12/06 01:25:19 jon Exp $
+# $Id: Config.pm,v 2.17 2001/12/28 17:16:26 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -95,7 +95,7 @@
 use Vend::Parse;
 use Vend::Util;
 
-$VERSION = substr(q$Revision: 2.16 $, 10);
+$VERSION = substr(q$Revision: 2.17 $, 10);
 
 my %CDname;
 
@@ -424,6 +424,7 @@
 	['NoSearch',         'wildcard',         'userdb'],
 	['OrderCounter',	 undef,     	     ''],
 	['MimeType',         'hash',             ''],
+	['AliasTable',	 	 undef,     	     ''],
 	['ImageAlias',	 	 'hash',     	     ''],
 	['TableRestrict',	 'hash',     	     ''],
 	['Filter',		 	 'hash',     	     ''],



2.33      +6 -2      interchange/lib/Vend/Interpolate.pm


rev 2.33, prev_rev 2.32
Index: Interpolate.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.32
retrieving revision 2.33
diff -u -r2.32 -r2.33
--- Interpolate.pm	2001/11/21 19:33:10	2.32
+++ Interpolate.pm	2001/12/28 17:16:26	2.33
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.32 2001/11/21 19:33:10 mheins Exp $
+# $Id: Interpolate.pm,v 2.33 2001/12/28 17:16:26 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.32 $, 10);
+$VERSION = substr(q$Revision: 2.33 $, 10);
 
 @EXPORT = qw (
 
@@ -5798,6 +5798,10 @@
 
     if($page) {
 		$selector = 'passed in tag';
+	}
+	elsif(	$Vend::ForceFlypage ) {
+		$selector = $Vend::ForceFlypage;
+		undef $Vend::ForceFlypage;
 	}
 	elsif(	$selector = $Vend::Cfg->{PageSelectField}
 			and db_column_exists($base,$selector)