[interchange-cvs] interchange - heins modified 13 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Tue Oct 9 18:33:01 2001


User:      heins
Date:      2001-10-09 22:32:53 GMT
Modified:  dist/lib/UI Primitive.pm
Modified:  dist/lib/UI/pages/admin flex_select.html flex_editor.html
Modified:           spread.html
Modified:  lib/Vend Config.pm Util.pm
Modified:  dist/lib/UI/usertag row_edit.tag table_editor.tag
Added:     dist/lib/UI/pages/admin db_metaconfig_edit.html
Added:              db_metaconfig.html db_metaconfig_select.html
Added:              db_metaconfig_spread.html
Added:     dist/lib/UI/usertag meta_record.tag
Log:
	* Start committing improved mv_metadata scheme. This is still interim;
	  the current commit really only covers table display and not field
	  display. View management is not yet in.

	* Not for stable branch.

	* Uses "extended" field in mv_metadata table to store additional
	  metadata items, allowing very configurability of almost all aspects
	  of table_editor and flex_select.

	* Uses the new serialized hash key capability of table_editor to
	  manage the keys. See the pages/admin/db_metaconfig*.html files
	  for examples.

    * Eventually all fields will be configurable on a per-view basis, with
	  special handling for spreadsheet mode.

    * The files committed should be considered "watched" by Mike; no change
	  should happen without Mike's concurrence as this is a work in progress.

Revision  Changes    Path
2.6       +40 -1     interchange/dist/lib/UI/Primitive.pm


rev 2.6, prev_rev 2.5
Index: Primitive.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/Primitive.pm,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -r2.5 -r2.6
--- Primitive.pm	2001/10/06 07:03:36	2.5
+++ Primitive.pm	2001/10/09 22:32:52	2.6
@@ -1,6 +1,6 @@
 # UI::Primitive - Interchange configuration manager primitives
 
-# $Id: Primitive.pm,v 2.5 2001/10/06 07:03:36 mheins Exp $
+# $Id: Primitive.pm,v 2.6 2001/10/09 22:32:52 mheins Exp $
 
 # Copyright (C) 1998-2001 Red Hat, Inc. <interchange@redhat.com>
 
@@ -25,7 +25,7 @@
 
 package UI::Primitive;
 
-$VERSION = substr(q$Revision: 2.5 $, 10);
+$VERSION = substr(q$Revision: 2.6 $, 10);
 $DEBUG = 0;
 
 use vars qw!
@@ -42,7 +42,7 @@
 use Vend::Util qw/errmsg/;
 $DECODE_CHARS = qq{&[<"\000-\037\177-\377};
 
-@EXPORT = qw( ui_check_acl ui_acl_enabled ) ;
+@EXPORT = qw( ui_check_acl ui_acl_enabled meta_record) ;
 
 =head1 NAME
 
@@ -787,6 +787,43 @@
     }
 }
 
+sub meta_record {
+	my ($item, $view, $mtable) = @_;
+	return undef unless $item;
+	$mtable ||= $::Variable->{UI_META_TABLE} || 'mv_metadata',
+	my $mdb = Vend::Data::database_exists_ref($mtable)
+		or return undef;
+	my $record;
+	if($view) {
+		$record = $mdb->row_hash("${view}::$item");
+	}
+	$record = $mdb->row_hash($item) if ! $record;
+
+	return undef if ! $record;
+
+	# Get additional settings from extended field, which is a serialized
+	# hash
+	my $hash;
+	if($record->{extended}) {
+		$hash = Vend::Util::get_option_hash($record->{extended});
+		if(ref $hash eq 'HASH') {
+			@$record{keys %$hash} = values %$hash;
+		}
+		else {
+			undef $hash;
+		}
+	}
+
+	# Allow view settings to be placed in the extended area
+	if($view and $hash and $hash->{view}) {
+		my $view_hash = $record->{view}{$view};
+		ref $view_hash
+			and @$record{keys %$view_hash} = values %$view_hash;
+	}
+::logDebug("return meta_record=" . ::uneval($record) );
+	return $record;
+}
+
 my $base_entry_value;
 
 sub meta_display {
@@ -893,6 +930,7 @@
 		$record->{name} ||= $column;
 
 		if($record->{options} and $record->{options} =~ /^[\w:]+$/) {
+#::logDebug("checking options");
 			PASS: {
 				my $passed = $record->{options};
 
@@ -905,6 +943,7 @@
 				elsif($passed =~ /^columns(::(\w*))?\s*$/) {
 					my $total = $1;
 					my $tname = $2 || $record->{db} || $table;
+#::logDebug("columns options, total=$total tname=$tname");
 					$tname = $base_entry_value if $total eq '::';
 					my $db = $Vend::Database{$tname};
 					$record->{passed} = join (',', "=--none--", $db->columns())



2.4       +16 -24    interchange/dist/lib/UI/pages/admin/flex_select.html


rev 2.4, prev_rev 2.3
Index: flex_select.html
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/pages/admin/flex_select.html,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -r2.3 -r2.4
--- flex_select.html	2001/08/16 18:29:57	2.3
+++ flex_select.html	2001/10/09 22:32:52	2.4
@@ -36,20 +36,12 @@
 	[or]
 		[cgi page_title]
 	[or]
-		[loop list="[cgi mv_data_table]"]
 		[L]Select for table edit[/L]:
-		[page href="__UI_BASE__/flex_editor" secure="[scratch page_secure]"
+		[page href="__UI_BASE__/db_metaconfig_select" secure="[scratch page_secure]"
 				 form='
-				 mv_data_table=__UI_META_TABLE__
-				 ui_meta_view=dbconfig
-				 ui_data_fields=code name height field options attribute width type display_filter help help_url
-				 ui_break_before=height display_filter
-				 page_title=[L]Change display information[/L]: [loop-code]
-				 ui_return_to=__UI_BASE__/gentable
-				 ui_return_stack=1
-				 item_id=[loop-code]
-		 '][loop-code]</A>
-		[/loop]
+						 ui_view=[cgi ui_meta_view]
+						 ui_table=[cgi mv_data_table]
+				 '][cgi mv_data_table]</A>
 	[/either]
 [/tmp]
 [tmp help_name][either][cgi help_name][or]flex.select[/either][/tmp]
@@ -71,6 +63,9 @@
 <!-- item_id_left: [cgi item_id_left] -->
 [perl tables="[cgi mv_data_table] __UI_META_TABLE__"]
 	delete $Scratch->{ui_location};
+	$Scratch->{ui_class} = $CGI->{ui_class}
+		if $CGI->{ui_class}
+		&&  $CGI->{ui_class} =~ /^\w+$/;
 	if($CGI->{ui_sequence_edit}) {
 		my $doit;
 		if($CGI->{item_id_left} =~ s/^(.*?),//) {
@@ -209,23 +204,18 @@
 [perl tables="[cgi mv_data_table] __UI_META_TABLE__"]
 	my $tab = $CGI->{mv_data_table};
 	my $ref = $Db{$tab};
-	my $mref = $Db{__UI_META_TABLE__};
+	my $meta = $Tag->meta_record($CGI->{mv_data_table}, $CGI->{ui_meta_view});
 	
 	if (! $ref) {
 		$Scratch->{keypos} = 0;
 		return;
 	}
-	elsif (! $mref) {
+	elsif (! $meta) {
 		$Scratch->{keypos} = 0;
 	}
 
-	my $meta;
-	if($mref and $mref->record_exists($CGI->{mv_data_table}) ) {
-		$meta = $mref->row_hash($CGI->{mv_data_table});
-	}
-	else {
-		$meta = {};
-	}
+	$meta ||= {};
+
 	if($CGI->{ui_flex_key}) {
 		$Scratch->{keypos} = $CGI->{ui_flex_key};
 	}
@@ -234,6 +224,7 @@
 	}
 	$Scratch->{keyname} = $ref->config('KEY');
 
+	$CGI->{ui_show_fields} ||= $meta->{ui_show_fields} || $meta->{field};
 	$Config->{NoSearch} = '';
 	$ui_text_qualification = $CGI->{ui_text_qualification};
 	if ($ui_text_qualification and $CGI->{ui_text_qualification} =~ /[<!=>\^]/ ) {
@@ -351,12 +342,13 @@
 	else {
 		$CGI->{ui_text_qualification} = "ra=yes";
 	}
-	$CGI->{ui_sort_field} = $meta->{lookup} || $Scratch->{keyname}
-		if ! $CGI->{ui_sort_field};
+	$CGI->{ui_sort_field}	||= $meta->{ui_sort_field}
+							||  $meta->{lookup}
+							||  $Scratch->{keyname};
 	$CGI->{ui_list_size} = $meta->{height}
 		if ! $CGI->{ui_list_size};
 
-	if(! ($CGI->{ui_show_fields} ||= $meta->{field}) ) {
+	if(! $CGI->{ui_show_fields} ) {
 		$CGI->{ui_show_fields} = 
 			$CGI->{ui_description_fields}
 				= join ",", $ref->columns();



2.2       +7 -19     interchange/dist/lib/UI/pages/admin/flex_editor.html


rev 2.2, prev_rev 2.1
Index: flex_editor.html
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/pages/admin/flex_editor.html,v
retrieving revision 2.1
retrieving revision 2.2
diff -u -r2.1 -r2.2
--- flex_editor.html	2001/07/31 10:00:15	2.1
+++ flex_editor.html	2001/10/09 22:32:52	2.2
@@ -21,29 +21,17 @@
 		[L]Select for table edit[/L]:
 		 [cgi mv_data_table]
 		[if cgi ui_meta_view]
-		 (<b>[page href="__UI_BASE__/flex_editor"
+		 (<b>[page href="__UI_BASE__/db_metaconfig_edit"
 				 form='
-				 mv_data_table=__UI_META_TABLE__
-				 ui_meta_view=dbconfig
-				 ui_data_fields=code name height field options attribute width type display_filter help help_url
-				 ui_break_before=height display_filter
-				 page_title=[L]Change display information[/L]: [cgi mv_data_table]
-				 ui_return_to=__UI_BASE__/gentable
-				 ui_return_stack=1
-				 item_id=[cgi ui_meta_view]::[cgi mv_data_table]
+				 ui_table=[cgi mv_data_table]
+				 ui_view=[cgi ui_meta_view]
 		 '][cgi ui_meta_view]</b> [L]view[/L]</A>)
 		 [/if]
-		([page href="__UI_BASE__/flex_editor"
+		 (<b>[page href="__UI_BASE__/db_metaconfig_edit"
 				 form='
-				 mv_data_table=__UI_META_TABLE__
-				 ui_meta_view=dbconfig
-				 ui_data_fields=code name height field options attribute width type display_filter help help_url
-				 ui_break_before=height display_filter
-				 page_title=Change display information: [cgi mv_data_table]
-				 ui_return_to=__UI_BASE__/gentable
-				 ui_return_stack=1
-				 item_id=[cgi mv_data_table]
-		 '][L]standard view[/L]</A>)
+				 ui_table=[cgi mv_data_table]
+				 ui_view=[cgi ui_meta_view]
+				 '][L]standard view[/L]</A>)
 		[/if-mm]
 		 [/if]
 	[or]



2.1       +25 -38    interchange/dist/lib/UI/pages/admin/spread.html


rev 2.1, prev_rev 2.0
Index: spread.html
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/pages/admin/spread.html,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- spread.html	2001/07/18 02:22:00	2.0
+++ spread.html	2001/10/09 22:32:52	2.1
@@ -13,52 +13,41 @@
 [set ui_class]Admin[/set]
 [seti help_name][either][cgi help_name][or]gensql.main[/either][/seti]
 [seti icon_name][either][cgi icon_name][or]icon_config.gif[/either][/seti]
+
 @_UI_STD_HEAD_@
 
-[perl tables="[cgi mv_data_table]"]
+[perl tables="[cgi mv_data_table] __UI_META_TABLE__"]
 	my $table = $CGI->{mv_data_table};
 	my $db = $Db{$table};
+	my $mrec = $Tag->meta_record($table, $CGI->{ui_meta_view}) || {};
 	$Values->{mv_data_table} = $table;
-	$Values->{ui_data_key_name} = $Db{$table}->config('KEY');
-	$Values->{ui_data_fields} =
-		$CGI->{ui_data_fields} ||
-		$CGI->{mv_data_fields} ||
-		$Values->{"spread:$table:ui_data_fields"} ||
-		join(" ", $db->columns());
-	my @fields;
-	@fields = grep
+	$Values->{ui_data_key_name} = $db->config('KEY');
+	my @fields = grep
 				$_ ne $Values->{ui_data_key_name},
-				split /[\0\s,]+/, $Values->{ui_data_fields};
+				split /[\0\s,]+/,
+					$CGI->{ui_data_fields} ||
+					$CGI->{mv_data_fields} ||
+					$Values->{"spread:$table:ui_data_fields"} ||
+					$mrec->{spread_fields}     ||
+					$mrec->{attribute}     ||
+					join(" ", $db->columns());
 	$Values->{ui_data_fields} = join " ", @fields;
+
 	$Values->{"ui_spread_meta:$table"} = $CGI->{"ui_spread_meta:$table"}
 		if defined $CGI->{"ui_spread_meta:$table"};
-	$Values->{ui_meta_display} = $Values->{"ui_spread_meta:$table"};
-
-	if($Values->{"ui_spreadsheet_rows:$table"}) {
-		$Values->{"ui_spreadsheet_rows"} = $Values->{"ui_spreadsheet_rows:$table"};
-	}
-	else {
-		$Values->{"ui_spreadsheet_rows"} = 10;
-	}
 
-	if($Values->{"ui_textarea_rows:$table"}) {
-		$Values->{"ui_textarea_rows"} = $Values->{"ui_textarea_rows:$table"};
-	}
-	else {
-		$Values->{"ui_textarea_rows"} = 4;
-	}
+	$Values->{ui_meta_display} = $Values->{"ui_spread_meta:$table"};
 
-	if($CGI->{"ui_spread_size:$table"}) {
-		$Values->{"ui_spread_size"}
-			= $Values->{"ui_spread_size:$table"}
-			= $CGI->{"ui_spread_size:$table"};
-	}
-	elsif($Values->{"ui_spread_size:$table"}) {
-		$Values->{"ui_spread_size"} = $Values->{"ui_spread_size:$table"};
-	}
-	else {
-		$Values->{"ui_spread_size"} = 12;
-	}
+	$Values->{ui_spreadsheet_rows} =
+		$Values->{"ui_spreadsheet_rows:$table"}
+			||= $CGI->{"ui_spreadsheet_rows:$table"} || $mrec->{spread_height} || 10; 
+
+	$Values->{ui_textarea_rows} =
+		$Values->{"ui_textarea_rows:$table"} ||= $mrec->{spread_textarea_rows} || 4;
+
+	$Values->{ui_spread_size} =
+		$Values->{"ui_spread_size:$table"}
+			||= $CGI->{"ui_spread_size:$table"} || $mrec->{spread_width} || 12; 
 
 	return;
 [/perl]
@@ -75,6 +64,7 @@
 <INPUT TYPE=hidden NAME="mv_data_key" VALUE="[value ui_data_key_name]">
 <INPUT TYPE=hidden NAME="mv_data_decode" VALUE="yes">
 <INPUT TYPE=hidden NAME="mv_update_empty" VALUE="1">
+<INPUT TYPE=hidden NAME="mv_update_empty_key" VALUE="0">
 <INPUT TYPE=hidden NAME="ui_text_qualification" value="[cgi ui_text_qualification]">
 <INPUT TYPE=hidden NAME="ui_return_to" value="[cgi ui_return_to]">
 <INPUT TYPE=hidden NAME="mv_data_fields"
@@ -117,7 +107,6 @@
 				sp=@@MV_PAGE@@
 				fi=[value mv_data_table]
 			"]
-[rotate-table reparse=0 rotate="[value ui_rotate_spread]" interpolate=1]
 
 <table __UI_T_PROPERTIES__>
 
@@ -125,7 +114,6 @@
 <td colspan="[scratch ui_num_col]" bgcolor=__UI_C_TOPBLOCKBAR__><img src="bg.gif" width=__UI_MAIN_WIDTH__ height=1></td>
 </tr>
 
-[with param=table value="[value mv_data_table]"]
 <TR BGCOLOR="__UI_C_INTBLOCK__" CELLPADDING=2>
 	<TH ALIGN=CENTER>&nbsp;</TH>
 	<TH ALIGN=CENTER>[value ui_data_key_name]</TH>
@@ -253,7 +241,6 @@
 </tr>
 
 </TABLE>
-[/rotate-table]
 </center>
 [/search-region]
 </FORM>



2.1                  interchange/dist/lib/UI/pages/admin/db_metaconfig_edit.html


rev 2.1, prev_rev 2.0



2.1                  interchange/dist/lib/UI/pages/admin/db_metaconfig.html


rev 2.1, prev_rev 2.0



2.1                  interchange/dist/lib/UI/pages/admin/db_metaconfig_select.html


rev 2.1, prev_rev 2.0



2.1                  interchange/dist/lib/UI/pages/admin/db_metaconfig_spread.html


rev 2.1, prev_rev 2.0



2.10      +11 -2     interchange/lib/Vend/Config.pm


rev 2.10, prev_rev 2.9
Index: Config.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Config.pm,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -r2.9 -r2.10
--- Config.pm	2001/10/08 14:38:42	2.9
+++ Config.pm	2001/10/09 22:32:52	2.10
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.9 2001/10/08 14:38:42 racke Exp $
+# $Id: Config.pm,v 2.10 2001/10/09 22:32:52 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.9 $, 10);
+$VERSION = substr(q$Revision: 2.10 $, 10);
 
 my %CDname;
 
@@ -2951,6 +2951,7 @@
 	order			Order
 	posnumber		PosNumber
 	posroutine		PosRoutine
+	maproutine		MapRoutine
 	replaceattr		replaceAttr
 	replacehtml		replaceHTML
 	required		Required
@@ -3050,6 +3051,14 @@
 			) unless ref($sub) =~ /CODE/;
 		}
 		$c->{$p}{$tag} = $sub;
+		$c->{Order}{$tag} = []
+			unless defined $c->{Order}{$tag};
+	}
+	elsif (! $C and $p eq 'MapRoutine') {
+		$val =~ s/^\s+//;
+		$val =~ s/\s+$//;
+		no strict 'refs';
+		$c->{Routine}{$tag} = \&{"$val"};
 		$c->{Order}{$tag} = []
 			unless defined $c->{Order}{$tag};
 	}



2.6       +6 -6      interchange/lib/Vend/Util.pm


rev 2.6, prev_rev 2.5
Index: Util.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Util.pm,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -r2.5 -r2.6
--- Util.pm	2001/10/06 07:03:37	2.5
+++ Util.pm	2001/10/09 22:32:52	2.6
@@ -1,6 +1,6 @@
 # Vend::Util - Interchange utility functions
 #
-# $Id: Util.pm,v 2.5 2001/10/06 07:03:37 mheins Exp $
+# $Id: Util.pm,v 2.6 2001/10/09 22:32:52 mheins Exp $
 # 
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -79,7 +79,7 @@
 use Safe;
 use subs qw(logError logGlobal);
 use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.5 $, 10);
+$VERSION = substr(q$Revision: 2.6 $, 10);
 
 BEGIN {
 	eval {
@@ -775,9 +775,9 @@
 
 sub dotted_hash {
 	my($hash, $key, $value) = @_;
-::logDebug("dotted_hash hash=$hash key=$key");
+#::logDebug("dotted_hash hash=$hash key=$key");
 	$hash = get_option_hash($hash) unless is_hash($hash);
-::logDebug("dotted_hash hash=$hash key=$key after get_option_hash");
+#::logDebug("dotted_hash hash=$hash key=$key after get_option_hash");
 	unless (is_hash($hash)) {
 		return undef unless defined $value;
 		$hash = {};
@@ -788,19 +788,19 @@
 
 	if(! defined $value) {
 		# Retrieving
-::logDebug("dotted_hash retrieving key=$key");
+#::logDebug("dotted_hash retrieving key=$key");
 		$ref = $hash->{shift @keys};
 		for(@keys) {
 			return undef unless is_hash($ref);
 			$ref = $ref->{$_};
 		}
-::logDebug("dotted_hash returning value=$ref");
+#::logDebug("dotted_hash returning value=$ref");
 		return $ref;
 	}
 
 	# Storing
 	$final = pop @keys;
-::logDebug("dotted_hash storing key=$key final=$final value=$value");
+#::logDebug("dotted_hash storing key=$key final=$final value=$value");
 	$ref = $hash;
 
 	for(@keys) {
@@ -810,7 +810,7 @@
 
 	$ref->{$final} = $value;
 	$hash = uneval_it($hash);
-::logDebug("dotted_hash returning=$hash");
+#::logDebug("dotted_hash returning=$hash");
 	return $hash;
 }
 



2.1       +8 -11     interchange/dist/lib/UI/usertag/row_edit.tag


rev 2.1, prev_rev 2.0
Index: row_edit.tag
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/usertag/row_edit.tag,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- row_edit.tag	2001/07/18 02:22:15	2.0
+++ row_edit.tag	2001/10/09 22:32:52	2.1
@@ -11,17 +11,14 @@
 	my $db = $Db{$table} || Vend::Data::database_exists_ref($table);
 	my $mtab = $Variable->{UI_META_TABLE} || 'mvmetadata';
 	my $mdb = $Db{$mtab} || Vend::Data::database_exists_ref($mtab);
-	my $view;
-	if($mdb and $mdb->record_exists("$CGI->{ui_meta_view}::$table")) {
-		$view = $mdb->row_hash("$CGI->{ui_meta_view}::$table");
-	}
-	elsif($mdb and $mdb->record_exists($table)) {
-		$view = $mdb->row_hash($table);
-	}
-	$view = {} if ! ref $view;
+	$opt->{view} ||= $CGI->{ui_meta_view};
+
+	my $view = UI::Primitive::meta_record($table, $opt->{view}) || {};
 	
-	return "NON-EXISTENT DATABASE '$table' for row-edit" unless defined $db;
-	#$db = $db->ref() unless $Vend::Interpolate::Db{$table};
+	return errmsg("non-existent table '%s' for row-edit", $table)
+		unless $db;
+	$db = $db->ref();
+
 	my $acl = UI::Primitive::get_ui_table_acl();
 
 	my $bad;
@@ -39,7 +36,7 @@
 
 	my @cols;
 
-	if($columns ||= $view->{attribute}) {
+	if($columns ||= $view->{spread_cols} || $view->{attribute}) {
 		@cols = split /[\s,\0]+/, $columns;
 		my %col;
 		for(@cols) {



2.12      +60 -64    interchange/dist/lib/UI/usertag/table_editor.tag


rev 2.12, prev_rev 2.11
Index: table_editor.tag
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/usertag/table_editor.tag,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -r2.11 -r2.12
--- table_editor.tag	2001/10/06 07:03:36	2.11
+++ table_editor.tag	2001/10/09 22:32:52	2.12
@@ -143,6 +143,7 @@
 					label       
 					override    
 					passed      
+					options      
 					outboard
 					append
 					prepend
@@ -201,6 +202,7 @@
 	my $override    = $opt->{override};
 	my $pre_filter  = $opt->{pre_filter};
 	my $passed      = $opt->{passed};
+	my $options     = $opt->{options};
 	my $outboard    = $opt->{outboard};
 	my $prepend     = $opt->{prepend};
 	my $append      = $opt->{append};
@@ -293,33 +295,59 @@
 	$Scratch->{$opt->{cancel_text}} = $ctext if $ctext;
 	$Scratch->{$opt->{back_text}}   = $btext if $btext;
 
+	if($opt->{wizard} and ! $table) {
+		$table = 'mv_null';
+		$Vend::Database{mv_null} = 
+			bless [
+					{},
+					undef,
+					[ 'code', 'value' ],
+					[ 'code' => 0, 'value' => 1 ],
+					0,
+					{ },
+					], 'Vend::Table::InMemory';
+	}
+
+	my @mapdirect = qw/
+		mv_data_decode
+		mv_data_table
+		mv_blob_field
+		mv_blob_nick
+		mv_blob_pointer
+		mv_blob_label
+		mv_blob_title
+		left_width
+		table_width
+		ui_break_before
+		ui_break_before_label
+		ui_data_fields
+		ui_data_fields_all
+		ui_data_key_name
+		ui_display_only
+		ui_hide_key
+		ui_meta_specific
+		ui_meta_view
+		ui_nextpage
+		ui_new_item
+		ui_delete_box
+		mv_update_empty
+	/;
+
+	$table = $CGI->{mv_data_table} if  $CGI->{mv_data_table} and ! $table;
+
+	my $tmeta = UI::Primitive::meta_record($table, $opt->{ui_meta_view}) || {};
+
+	for(grep defined $tmeta->{$_}, @mapdirect) {
+		$opt->{$_} = $tmeta->{$_};
+	}
+
 	if($opt->{cgi}) {
-		my @mapdirect = qw/
-			item_id
-			item_id_left
-			mv_data_decode
-			mv_data_table
-			mv_blob_field
-			mv_blob_nick
-			mv_blob_pointer
-			mv_blob_label
-			mv_blob_title
-			ui_break_before
-			ui_break_before_label
-			ui_data_fields
-			ui_data_fields_all
-			ui_data_key_name
-			ui_display_only
-			ui_hide_key
-			ui_meta_specific
-			ui_meta_view
-			ui_nextpage
-			ui_new_item
-			ui_sequence_edit
-			ui_clone_id
-			ui_clone_tables
-			ui_delete_box
-			mv_update_empty
+		unshift @mapdirect, qw/
+				item_id
+				item_id_left
+				ui_clone_id
+				ui_clone_tables
+				ui_sequence_edit
 		/;
 		for(@mapdirect) {
 			next if ! defined $CGI->{$_};
@@ -331,6 +359,7 @@
 			[ qr/^ui_te_extra:/, $extra ],
 			[ qr/^ui_te_widget:/, $widget ],
 			[ qr/^ui_te_passed:/, $passed ],
+			[ qr/^ui_te_options:/, $options ],
 			[ qr/^ui_te_outboard:/, $outboard ],
 			[ qr/^ui_te_prepend:/, $prepend ],
 			[ qr/^ui_te_append:/, $append ],
@@ -471,19 +500,6 @@
 		return undef;
 	};
 
-	if($opt->{wizard} and ! $table) {
-		$table = 'mv_null';
-		$Vend::Database{mv_null} = 
-			bless [
-					{},
-					undef,
-					[ 'code', 'value' ],
-					[ 'code' => 0, 'value' => 1 ],
-					0,
-					{ },
-					], 'Vend::Table::InMemory';
-	}
-
 	my $db = Vend::Data::database_exists_ref($table)
 		or return $die->('table-editor: bad table %s', $table);
 
@@ -491,37 +507,16 @@
 		$opt->{ui_data_fields} = $opt->{ui_display_only} = $opt->{ui_wizard_fields};
 	}
 
-	$Variable->{UI_META_TABLE} = 'mv_metadata' if ! $Variable->{UI_META_TABLE};
-
-	my $mdb = Vend::Data::database_exists_ref($Variable->{UI_META_TABLE})
-		or return $die->('table-editor: bad meta table %s', $table);
-
 	my $keycol = $db->config('KEY');
 
-	my $view_table = $opt->{ui_meta_view};
-
-	if (! $view_table) {
-		$view_table = $table;
-	}
-	elsif ("\L$view_table" ne 'none') {
-		$view_table = "$view_table::$table";
-	}
-
 	$opt->{form_name} = qq{ NAME="$opt->{form_name}"}
 		if $opt->{form_name};
 
 	###############################################################
 	# Get the field display information including breaks and labels
 	###############################################################
-	if( $mdb
-		and ! $opt->{ui_data_fields}
-		and ! $opt->{ui_data_fields_all}
-		and $view_table
-		and $mdb->record_exists($view_table)
-		)
-	{
-#::logDebug("meta info for table: view_table=$view_table table=$table");
-		$opt->{ui_data_fields} = $mdb->field($view_table || $table, 'options');
+	if( ! $opt->{ui_data_fields} and ! $opt->{ui_data_fields_all}) {
+		$opt->{ui_data_fields} = $tmeta->{ui_data_fields} || $tmeta->{options};
 	}
 
 	$opt->{ui_data_fields} =~ s/\r\n/\n/g;
@@ -531,7 +526,7 @@
 #::logDebug("Found break fields");
 		my @breaks;
 		my @break_labels;
-		while ($opt->{ui_data_fields} =~ s/\n+(?:\n[ \t]*=(.*))?\n+[ \t]*(\w+)/\n$2/) {
+		while ($opt->{ui_data_fields} =~ s/\n+(?:\n[ \t]*=(.*))?\n+[ \t]*(\w[:.\w]+)/\n$2/) {
 			push @breaks, $2;
 			push @break_labels, "$2=$1" if $1;
 		}
@@ -1155,7 +1150,7 @@
          <td class=cwidget> 
            \$WIDGET\$
          </td>
-         <td class=chelp>~TKEY~<i>\$HELP\$</i>{HELPURL}<BR><A HREF="\$HELP_URL\$">help</A>{/HELPURL}</FONT></td>
+         <td class=chelp>~TKEY~<i>\$HELP\$</i>{HELP_URL}<BR><A HREF="\$HELP_URL\$">help</A>{/HELP_URL}</FONT></td>
        </tr>
      </table>
    </td>
@@ -1323,6 +1318,7 @@
 										override => $overridden,
 										field => $field->{$c},
 										passed => $passed->{$c},
+										options => $options->{$c},
 										outboard => $outboard->{$c},
 										append => $append->{$c},
 										prepend => $prepend->{$c},



2.1                  interchange/dist/lib/UI/usertag/meta_record.tag


rev 2.1, prev_rev 2.0