From 856a62ca215f921ef3e9ddf4080626565727532a Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 2 Apr 2003 09:46:50 +0000 Subject: [PATCH] updated meta-import web UI to allow duplicate import tables --- httemplate/misc/process/meta-import.cgi | 37 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 9e374b508..2939c8fb2 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -31,7 +31,9 @@ function SafeOnsubmit() { VALUE="<%= $cgi->param($field) %>"> <% } - my %schema = (); + my %schema; + use Tie::DxHash; + tie %schema, 'Tie::DxHash'; if ( $cgi->param('schema') ) { my $schema_string = $cgi->param('schema'); %> <% @@ -57,14 +59,16 @@ function SafeOnsubmit() { <% + my %unique; foreach my $table ( keys %schema ) { my @from_columns = $schema->table($table)->columns; my @fs_columns = dbdef->table($schema{$table})->columns; %> - <%= hashmaker($table, \@from_columns => \@fs_columns, - $table => $schema{$table}, ) %> + <%= hashmaker( $table.'__'.$unique{$table}++, + \@from_columns => \@fs_columns, + $table => $schema{$table}, ) %>


<% @@ -79,6 +83,7 @@ function SafeOnsubmit() { print "
\n";
 
+    my %unique;
     foreach my $table ( keys %schema ) {
       ( my $spaces = $table ) =~ s/./ /g;
       print "'$table' => { 'table' => '$schema{$table}',\n".
@@ -88,7 +93,7 @@ function SafeOnsubmit() {
                          or die "guru meditation #420: $_";
                        ( $1 => $2 );
                      }
-                 split( /\n/, $cgi->param($table) );
+                 split( /\n/, $cgi->param($table.'__'.$unique{$table}++) );
       foreach ( keys %map ) {
         print "$spaces                     '$_' => '$map{$_}',\n";
       }
@@ -116,11 +121,13 @@ function SafeOnsubmit() {
     "'.
       '
$labelfrom$labelto
". qq!\n". + "\n
". + qq!!. '
'. qq!\n". + "\n
". + qq!!. '
'. qq!!. @@ -146,6 +153,24 @@ function SafeOnsubmit() { object.options[index] = null; return value; } + function repack_${name}_from() { + var object = document.OneTrueForm.${name}_from; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$from ) ). " + } + function repack_${name}_to() { + var object = document.OneTrueForm.${name}_to; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$to ) ). " + } + function addOption_$name(object,value) { + var length = object.length; + object.options[length] = new Option(value, value, false, false); + } ". ''; } -- 2.11.0