[interchange-cvs] interchange - heins modified 3 files

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Wed Jul 2 11:16:00 2003


User:      heins
Date:      2003-07-02 15:15:31 GMT
Modified:  lib/Vend/Table Editor.pm
Modified:  dist/lib/UI/pages/admin item_edit.html flex_editor.html
Log:
* Allow default opening of a particular tab by adding * to the end of the
  tab label.

	Overridden by explicit "start_at" option given in options/args.

* Further allow focus of editor to start at a particular field if
  it is marked with a *.

   ui_data_fields => q{

   			=General

			foo
			bar

			=Specific*

			buz
			baz*
		},

	The "Specific" tab will be presented open when the record is edited.
	The form focus will be at the "baz" field.

Revision  Changes    Path
1.37      +12 -7     interchange/lib/Vend/Table/Editor.pm


rev 1.37, prev_rev 1.36
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- Editor.pm	2 Jul 2003 04:05:51 -0000	1.36
+++ Editor.pm	2 Jul 2003 15:15:31 -0000	1.37
@@ -1,6 +1,6 @@
 # Vend::Table::Editor - Swiss-army-knife table editor for Interchange
 #
-# $Id: Editor.pm,v 1.36 2003/07/02 04:05:51 mheins Exp $
+# $Id: Editor.pm,v 1.37 2003/07/02 15:15:31 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike@perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Table::Editor;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.36 $, 10);
+$VERSION = substr(q$Revision: 1.37 $, 10);
 
 use Vend::Util;
 use Vend::Interpolate;
@@ -1569,14 +1569,18 @@
 		my @breaks;
 		my @break_labels;
 		my $fstring = "\n\n$opt->{ui_data_fields}";
-		while ($fstring =~ s/\n+(?:\n[ \t]*=(.*))?\n+[ \t]*(\w[:.\w]+)/\n$2/) {
-			push @breaks, $2;
-			push @break_labels, "$2=$1" if $1;
+		while ($fstring =~ s/\n+(?:\n[ \t]*=(.*?)(\*?))?\n+[ \t]*(\w[:.\w]+)/\n$3/) {
+			push @breaks, $3;
+			$opt->{start_at} ||= $3 if $2;
+			push @break_labels, "$3=$1" if $1;
 		}
 		$opt->{ui_break_before} = join(" ", @breaks)
 			if ! $opt->{ui_break_before};
 		$opt->{ui_break_before_label} = join(",", @break_labels)
 			if ! $opt->{ui_break_before_label};
+		while($fstring =~ s/\n(.*)[ \t]*\*/\n$1/) {
+			$opt->{focus_at} = $1;
+		}
 		$opt->{ui_data_fields} = $fstring;
 	}
 
@@ -3592,16 +3596,17 @@
 EOF
 
 	my $end_script = '';
-	if( $opt->{start_at}
+	if( $opt->{start_at} || $opt->{focus_at}
 			and
 		$opt->{form_name}
 			and
 		$widget->{$opt->{start_at}} !~ /radio|check/i
 		)
 	{
+		my $foc = $opt->{focus_at} || $opt->{start_at};
 		$end_script = <<EOF;
 <script>
-	document.$opt->{form_name}.$opt->{start_at}.focus();
+	document.$opt->{form_name}.$foc.focus();
 </script>
 EOF
 	}



2.7       +2 -2      interchange/dist/lib/UI/pages/admin/item_edit.html


rev 2.7, prev_rev 2.6
Index: item_edit.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/item_edit.html,v
retrieving revision 2.6
retrieving revision 2.7
diff -u -r2.6 -r2.7
--- item_edit.html	14 Jan 2003 02:25:50 -0000	2.6
+++ item_edit.html	2 Jul 2003 15:15:31 -0000	2.7
@@ -59,7 +59,7 @@
 
 @_UI_STD_HEAD_@
 <P>
-[table-editor cgi=1 output_map="[scratch ui_style_edit]" ui_style="[scratch ui_style_edit]"]
+[table-editor cgi=1 form_name=item_editor output_map="[scratch ui_style_edit]" ui_style="[scratch ui_style_edit]"]
 
 [if-mm super]
 <A HREF="[area href=admin/flex_editor
@@ -76,4 +76,4 @@
 [/if-mm]
 
 @_UI_STD_FOOTER_@
-<!-- page: @@MV_PAGE@@ version: $Revision: 2.6 $ -->
+<!-- page: @@MV_PAGE@@ version: $Revision: 2.7 $ -->



2.9       +2 -2      interchange/dist/lib/UI/pages/admin/flex_editor.html


rev 2.9, prev_rev 2.8
Index: flex_editor.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/flex_editor.html,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -r2.8 -r2.9
--- flex_editor.html	14 Jan 2003 02:25:50 -0000	2.8
+++ flex_editor.html	2 Jul 2003 15:15:31 -0000	2.9
@@ -74,7 +74,7 @@
 [/strip]@_UI_STD_HEAD_@
 
 [tmp tmp_item_id][cgi item_id][/tmp]
-[table-editor cgi=1 output_map="[scratch ui_style_edit]" ui_style="[scratch ui_style_edit]"]
+[table-editor cgi=1 form_name=flex_editor output_map="[scratch ui_style_edit]" ui_style="[scratch ui_style_edit]"]
 
 <A HREF="[area href=admin/flex_editor
 				form='
@@ -91,4 +91,4 @@
 
 @_UI_STD_FOOTER_@
 
-<!-- page: @@MV_PAGE@@ version: $Id: flex_editor.html,v 2.8 2003/01/14 02:25:50 mheins Exp $ -->
+<!-- page: @@MV_PAGE@@ version: $Id: flex_editor.html,v 2.9 2003/07/02 15:15:31 mheins Exp $ -->