[interchange-cvs] interchange - heins modified code/UI_Tag/auto_wizard.coretag

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Thu Nov 14 12:15:17 2002


User:      heins
Date:      2002-11-14 17:13:35 GMT
Modified:  code/UI_Tag auto_wizard.coretag
Log:
* Allow a wizard input to come from mv_metadata or any other table
  that has a similar structure.

	  db_id:  survey::the_survey::the_question

  This will read [data table=survey hash=1 key="the_survey::the_question"]
  and use its metadata settings to formulate the display.

  The overall wizard will soon be able to formulate itself based on something
  similar.

Revision  Changes    Path
1.6       +28 -2     interchange/code/UI_Tag/auto_wizard.coretag


rev 1.6, prev_rev 1.5
Index: auto_wizard.coretag
===================================================================
RCS file: /var/cvs/interchange/code/UI_Tag/auto_wizard.coretag,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- auto_wizard.coretag	5 Oct 2002 05:26:29 -0000	1.5
+++ auto_wizard.coretag	14 Nov 2002 17:13:35 -0000	1.6
@@ -145,6 +145,22 @@
 					$ref->{_break_labels} ||= ($blip = []);
 					next;
 				}
+				elsif($thing eq 'db_id') {
+					my ($t, $survey, $name) = split /:+/, $value, 3;
+					$thing = $name;
+					my $key = $survey . '::' . $name;
+					my $meta = $Tag->meta_record($key, undef, $t);
+					if($meta) {
+						for(keys %$meta) {
+							$ref->{$_} ||= {};
+							$ref->{$_}{$thing} = $meta->{$_};
+						}
+					}
+					$ref->{name}{$thing} = $thing;
+#::logDebug("meta record is " . ::uneval($meta));
+
+					undef $value;
+				}
 
 				$iip = $thing;
 				push @$qip, $iip;
@@ -153,7 +169,7 @@
 					push @$blip, "$iip=$break";
 					undef $break;
 				}
-				$ref->{label}{$iip} = $value;
+				$ref->{label}{$iip} = $value if $value;
 				next;
 			}
 
@@ -165,6 +181,16 @@
 			$ref->{$thing} ||= {};
 			$ref->{$thing}{$iip} = $value;
 		}
+		else {
+			unless (/^([A-Za-z]\w+)(?:=([^:]+))?\s*:\s*(.*)/s) {
+				$Tag->warnings(qq{Unrecognized "$_" in beginning section of script.});
+				next;
+			}
+			my $thing = $1;
+			my $modifier = $2;
+			my $value = $3;
+			$ref->{$thing} = $value;
+		}
 	}
 	push @pages, $ref;
 	$wizname ||= 'default';
@@ -412,7 +438,7 @@
 	$opts{no_meta} = 1;
 	$opts{defaults} = 1;
 	$opts{mv_cancelpage} ||= 'admin/index';
-	$opts{row_template} = <<'EOF';
+	$opts{row_template} ||= <<'EOF';
 {HELP?}<td>&nbsp;</td><td>
      <span style="color: blue">{HELP}</span>
 	 {HELP_URL?}<BR><A HREF="{HELP_URL}">more help</A>{/HELP_URL?}