[interchange-cvs] interchange - heins modified 6 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Mon Feb 4 20:34:00 2002


User:      heins
Date:      2002-02-05 01:33:12 GMT
Modified:  code/UI_Tag display.coretag
Modified:  lib/Vend Data.pm Form.pm Interpolate.pm Order.pm Parse.pm
Log:
	* Fix problem with $Tag->display() called with null table, affecting
	  "wizard" mode.

	* Re-introduce "restrict" tag into Interchange, unintentionally
	  omitted when the great tag move was made.

	* Clean up of [sql ...] tag, which now becomes useful as a way
	  of doing [query list=1 ...].

	* Give proper encoding behavior to [display type=value ...]

	* Fix bad status code on PGP failure.

Revision  Changes    Path
1.3       +42 -32    interchange/code/UI_Tag/display.coretag


rev 1.3, prev_rev 1.2
Index: display.coretag
===================================================================
RCS file: /anon_cvs/repository/interchange/code/UI_Tag/display.coretag,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- display.coretag	4 Feb 2002 23:35:36 -0000	1.2
+++ display.coretag	5 Feb 2002 01:33:11 -0000	1.3
@@ -84,43 +84,48 @@
 		}
 	}
 
+#::logDebug("metarecord=$record");
 	my $w;
 
 	METAMAKE: {
-		last METAMAKE unless $record;
-
-		## Here we allow override with the display tag, even with views and
-		## extended
-		my @override = qw/
-							append
-							attribute
-							db
-							extra
-							field
-							filter
-							height
-							help
-							help_url
-							label
-							lookup
-							lookup_exclude
-							lookup_query
-							name
-							options
-							outboard
-							passed
-							pre_filter
-							prepend
-							type
-							width
-							/;
-		for(keys %$record) {
-			delete $record->{$_} if ! length($record->{$_});
-			next unless defined $opt->{$_};
-			$record->{$_} = $opt->{$_};
+		if( ! $record ) {
+			$record = { %$opt };
+		}
+		else {
+			## Here we allow override with the display tag, even with views and
+			## extended
+			my @override = qw/
+								append
+								attribute
+								db
+								extra
+								field
+								filter
+								height
+								help
+								help_url
+								label
+								lookup
+								lookup_exclude
+								lookup_query
+								name
+								options
+								outboard
+								passed
+								pre_filter
+								prepend
+								type
+								width
+								/;
+			for(keys %$record) {
+				delete $record->{$_} if ! length($record->{$_});
+				next unless defined $opt->{$_};
+				$record->{$_} = $opt->{$_};
+			}
 		}
 
 		$record->{name} ||= $column;
+#::logDebug("record now=" . ::uneval($record));
 
 		if($record->{options} and $record->{options} =~ /^[\w:]+$/) {
 #::logDebug("checking options");
@@ -155,6 +160,7 @@
 			}
 		}
 
+#::logDebug("checking for custom widget");
 		if ($record->{type} =~ s/^custom\s+//s) {
 			my $wid = lc $record->{type};
 			$wid =~ tr/-/_/;
@@ -175,6 +181,7 @@
 			last METAMAKE;
 		}
 
+#::logDebug("formatting prepend/append");
 		for(qw/append prepend/) {
 			next unless $record->{$_};
 			$record->{$_} = Vend::Util::resolve_links($record->{$_});
@@ -190,6 +197,7 @@
 			$record->{$_} =~ s/_UI_KEY_/$key/g;
 		}
 
+#::logDebug("overriding defaults");
 #::logDebug("passed=$record->{passed}") if $record->{debug};
 		my %things = (
 			attribute	=> $column,
@@ -205,7 +213,8 @@
 			next if length $record->{$k};
 			$record->{$k} = $v;
 		}
-		
+
+#::logDebug("calling Vend::Form");
 		$w = Vend::Form::display($record);
 		if($record->{filter}) {
 			$w .= qq{<INPUT TYPE=hidden NAME="ui_filter:$record->{name}" VALUE="};
@@ -214,6 +223,7 @@
 		}
 	}
 
+#::logDebug("widget=$w");
 	if(! defined $w) {
 		my $text = $opt->{value};
 		my $iname = $opt->{name} || $column;



2.7       +3 -3      interchange/lib/Vend/Data.pm


rev 2.7, prev_rev 2.6
Index: Data.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Data.pm,v
retrieving revision 2.6
retrieving revision 2.7
diff -u -r2.6 -r2.7
--- Data.pm	31 Jan 2002 17:57:02 -0000	2.6
+++ Data.pm	5 Feb 2002 01:33:11 -0000	2.7
@@ -1,6 +1,6 @@
 # Vend::Data - Interchange databases
 #
-# $Id: Data.pm,v 2.6 2002/01/31 17:57:02 mheins Exp $
+# $Id: Data.pm,v 2.7 2002/02/05 01:33:11 mheins Exp $
 # 
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -361,11 +361,11 @@
 	my ($db);
 
 	$opt->{table} = $Vend::Cfg->{ProductFiles}[0] unless defined $opt->{table};
-	$db = $Vend::Database{$opt->{table}}
+	$db = database_exists_ref($opt->{table})
 		or die "dbi_query: unknown base table $opt->{table}.\n";
-	$db = $db->ref();
 
 	$type = lc $type;
+	$type ||= 'list';
 
 	if ($list and $type ne 'list') {
 		$query = '' if ! defined $query;



2.10      +9 -5      interchange/lib/Vend/Form.pm


rev 2.10, prev_rev 2.9
Index: Form.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Form.pm,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -r2.9 -r2.10
--- Form.pm	4 Feb 2002 04:19:46 -0000	2.9
+++ Form.pm	5 Feb 2002 01:33:11 -0000	2.10
@@ -1,6 +1,6 @@
 # Vend::Form - Generate Form widgets
 # 
-# $Id: Form.pm,v 2.9 2002/02/04 04:19:46 mheins Exp $
+# $Id: Form.pm,v 2.10 2002/02/05 01:33:11 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -36,7 +36,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.9 $, 10);
+$VERSION = substr(q$Revision: 2.10 $, 10);
 
 @EXPORT = qw (
 	display
@@ -945,10 +945,15 @@
 		$data = options_to_array($opt->{passed}, $opt);
 	}
 	elsif($opt->{column} and $opt->{table}) {
+		GETDATA: {
 		my $key = $opt->{outboard} || $item->{code} || $opt->{code};
-		$opt->{passed} = $Tag->data($opt->{table}, $opt->{column}, $key);
+			last GETDATA unless length($key);
+			last GETDATA unless ::database_exists_ref($opt->{table});
+			$opt->{passed} = $Tag->data($opt->{table}, $opt->{column}, $key)
+				and
 		$data = options_to_array($opt->{passed}, $opt);
 	}
+	}
 	elsif(! $Global::VendRoot) {
 		# Not in Interchange
 	}
@@ -1076,8 +1081,7 @@
 		radio       => \&box,
 		select      => \&dropdown,
 		show        => \&show_data,
-		value       => \&processed_value,
-		value       => sub { my $opt = shift; return $opt->{value} },
+		value       => sub { my $opt = shift; return $opt->{encoded} },
 		yesno		=> \&yesno,
 	);
 



2.56      +3 -3      interchange/lib/Vend/Interpolate.pm


rev 2.56, prev_rev 2.55
Index: Interpolate.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.55
retrieving revision 2.56
diff -u -r2.55 -r2.56
--- Interpolate.pm	4 Feb 2002 01:31:17 -0000	2.55
+++ Interpolate.pm	5 Feb 2002 01:33:11 -0000	2.56
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.55 2002/02/04 01:31:17 mheins Exp $
+# $Id: Interpolate.pm,v 2.56 2002/02/05 01:33:11 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.55 $, 10);
+$VERSION = substr(q$Revision: 2.56 $, 10);
 
 @EXPORT = qw (
 
@@ -2129,7 +2129,7 @@
 }
 
 sub ed {
-	return $_[0] if $Safe_data or $::Pragma->{safe_data};
+	return $_[0] if ! $_[0] or $Safe_data or $::Pragma->{safe_data};
 	$_[0] =~ s/\[/&#91;/g;
 	return $_[0];
 }



2.15      +3 -3      interchange/lib/Vend/Order.pm


rev 2.15, prev_rev 2.14
Index: Order.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Order.pm,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -r2.14 -r2.15
--- Order.pm	4 Feb 2002 01:31:17 -0000	2.14
+++ Order.pm	5 Feb 2002 01:33:11 -0000	2.15
@@ -1,6 +1,6 @@
 # Vend::Order - Interchange order routing routines
 #
-# $Id: Order.pm,v 2.14 2002/02/04 01:31:17 mheins Exp $
+# $Id: Order.pm,v 2.15 2002/02/05 01:33:11 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -28,7 +28,7 @@
 package Vend::Order;
 require Exporter;
 
-$VERSION = substr(q$Revision: 2.14 $, 10);
+$VERSION = substr(q$Revision: 2.15 $, 10);
 
 @ISA = qw(Exporter);
 
@@ -804,7 +804,7 @@
 	print PGP $body;
 	close PGP;
 	if($?) {
-		logError("PGP failed with status %s: %s", $? << 8, $!);
+		logError("PGP failed with status %s: %s", $? >> 8, $!);
 		return 0;
 	}
 	$body = readfile("$fpre.out");



2.10      +7 -2      interchange/lib/Vend/Parse.pm


rev 2.10, prev_rev 2.9
Index: Parse.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Parse.pm,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -r2.9 -r2.10
--- Parse.pm	29 Jan 2002 05:52:43 -0000	2.9
+++ Parse.pm	5 Feb 2002 01:33:11 -0000	2.10
@@ -1,6 +1,6 @@
 # Vend::Parse - Parse Interchange tags
 # 
-# $Id: Parse.pm,v 2.9 2002/01/29 05:52:43 mheins Exp $
+# $Id: Parse.pm,v 2.10 2002/02/05 01:33:11 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -35,7 +35,7 @@
 
 @ISA = qw(Exporter Vend::Parser);
 
-$VERSION = substr(q$Revision: 2.9 $, 10);
+$VERSION = substr(q$Revision: 2.10 $, 10);
 
 @EXPORT = ();
 @EXPORT_OK = qw(find_matching_end);
@@ -66,9 +66,13 @@
 				unless			=> [qw( type term op compare )],
 				or				=> [qw( type term op compare )],
 				and				=> [qw( type term op compare )],
+				restrict		=> [qw( enable )],
 			);
 
 my %addAttr = (
+				qw(
+					restrict		1
+				)
 			);
 
 my %hasEndTag = (
@@ -76,6 +80,7 @@
 				qw(
                         if              1
                         unless          1
+					restrict		1
 				)
 			);