X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fmeta-import.cgi;h=4c3c7d665e6c706f8bc924f703ed626408919139;hp=d42d6d46676e2776f21b22d43475cf2e5176e0bf;hb=64d21fc13eddf275f614f54ff9e17eca74dcd858;hpb=59aa696fb295598b6ceecaa45009617ef6d56aaf diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index d42d6d466..4c3c7d665 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -19,6 +19,7 @@ function SafeOnsubmit() { gSafeOnsubmit[i](); } +
<% #one unless ( $cgi->param('magic') ) { @@ -41,23 +42,19 @@ credcode dundet invline payment prodclas repforms webserv ); %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %>
-
- - <% } elsif ( $cgi->param('magic') eq 'process' ) { %> -
<% my $schema_string = $cgi->param('schema'); + %><% my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ or die "guru meditation #420: $_"; ( $1 => $2 ); @@ -88,18 +85,47 @@ credcode dundet invline payment prodclas repforms webserv %>
-
- - <% - } elsif ( $cgi->param('magic') eq 'process' ) { + } elsif ( $cgi->param('magic') eq 'process2' ) { - %> - print results!! - <% + print "
\n";
+    #false laziness with above
+    my $schema_string = $cgi->param('schema');
+    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
+                         or die "guru meditation #420: $_";
+                       ( $1 => $2 );
+                     }
+                 split( /\n/, $schema_string );
+    foreach my $table ( keys %schema ) {
+      ( my $spaces = $table ) =~ s/./ /g;
+      print "'$table' => { 'table' => '$schema{$table}',\n".
+            #(length($table) x ' '). "         'map'   => {\n";
+            "$spaces        'map'   => {\n";
+      my %map = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
+                         or die "guru meditation #420: $_";
+                       ( $1 => $2 );
+                     }
+                 split( /\n/, $cgi->param($table) );
+      foreach ( keys %map ) {
+        print "$spaces                     '$_' => '$map{$_}',\n";
+      }
+      print "$spaces                   },\n";
+      print "$spaces      },\n";
+
+    }
+    print "\n
"; + + } else { + warn "unrecognized magic: ". $cgi->param('magic'); } + %> + + + + + <% #hashmaker widget sub hashmaker { my($name, $from, $to, $labelfrom, $labelto) = @_;