[interchange-cvs] interchange - heins modified dist/lib/UI/pages/admin/meta_editor.html

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Mon Feb 10 12:47:00 2003


User:      heins
Date:      2003-02-10 17:46:29 GMT
Modified:  dist/lib/UI/pages/admin meta_editor.html
Log:
* Solve annoying problem where you edit a view-specific field display
  and have to re-enter custom view information that is already
  present in a modified base meta display.

Revision  Changes    Path
2.6       +26 -1     interchange/dist/lib/UI/pages/admin/meta_editor.html


rev 2.6, prev_rev 2.5
Index: meta_editor.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/meta_editor.html,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -r2.5 -r2.6
--- meta_editor.html	14 Jan 2003 02:25:50 -0000	2.5
+++ meta_editor.html	10 Feb 2003 17:46:29 -0000	2.6
@@ -66,11 +66,36 @@
 
 @_UI_STD_HEAD_@
 
+[flag type=write table="[cgi mv_data_table]"]
+
+[perl table="[cgi mv_data_table]"]
+	### If there is a view, set defaults from non-view record
+	### for this item
+	
+	# Always want this removed first, don't proceed if no view
+	$Tag->tmp('tmp_defaults');
+	return unless $CGI->{ui_meta_view};
+
+	my $db = $Db{$CGI->{mv_data_table}};
+
+	# Don't bother if already exists
+	return if $db->record_exists($CGI->{item_id});
+
+	my $id = $CGI->{item_id};
+	$id =~ s/^[^:]+:+//;
+	my $rec = $db->row_hash($id)
+		or return;
+	delete $rec->{code};
+	$Scratch->{tmp_defaults} = $rec;
+	return;
+[/perl]
+
 [table-editor
 	item_id="[cgi item_id]"
 	table="[cgi mv_data_table]"
 	no-table-meta=1
 	no-meta=1
+	default=`$Scratch->{tmp_defaults}`
 	ui_data_fields="
 		=Typical
 
@@ -113,4 +138,4 @@
 	][/table-editor]
 
 @_UI_STD_FOOTER_@
-<!-- page: @@MV_PAGE@@ version: $Revision: 2.5 $ -->
+<!-- page: @@MV_PAGE@@ version: $Revision: 2.6 $ -->