[if-mm super][flag type=write table="ichelp"][/if-mm] [flag type=write table="[cgi mv_data_table]"] [set page_title][L]Table Import[/L][/set] [set table_perm]=i[/set] [set help_name]import.main[/set] [set ui_class]Admin[/set] [set icon_name]icon_config.gif[/set] @_UI_STD_HEAD_@ [if cgi ui_import_convert] [calc] my @tables = grep /\S/, split /[\s,\0]+/, q{[list-databases extended="i"]}; for(@tables) { #Log("tagging write $_"); $Tag->flag( { type => 'write', table => $_ } ); } return; [/calc] [/if] [if type=explicit compare="[value-extended name=upload_file test=isfile]"] [title-bar] [if cgi ui_import_convert] [L]Importing multiple tables:[/L] [else] [msg arg.0="[cgi mv_data_table]"]Import of table %s:[/msg] [/else] [/if] [calc] if(! $CGI->{ui_import_convert}) { $CGI->{ui_allow_multiple} = 0; $CGI->{ui_upload_filename} = "$Session->{id}.$CGI->{mv_data_table}.$CGI->{ui_upload_ext}"; } else { $CGI->{ui_upload_filename} = $CGI->{upload_file}; $CGI->{ui_upload_filename} =~ s:.*[/\\]::; $CGI->{ui_upload_filename} = $Tag->filter( 'filesafe', "$Session->{id}.$CGI->{ui_upload_filename}", ); if($CGI->{ui_import_convert} == 1) { $CGI->{ui_allow_multiple} = 1; $CGI->{ui_import_convert} = 'txt'; } elsif($CGI->{ui_import_convert} == 2) { $CGI->{ui_allow_multiple} = 1; $CGI->{ui_import_convert} = 'xls'; } elsif($CGI->{ui_import_convert} eq 'auto') { $CGI->{ui_allow_multiple} = 1; $CGI->{ui_import_convert} = 'auto'; } } return; [/calc] [value-extended name=upload_file outfile="upload/[cgi ui_upload_filename]" yes="[L]Upload succeeded[/L]" no="[L]Upload FAILED[/L]" ]

[if type=!file term="upload/[cgi ui_upload_filename]"] [msg arg.0="[cgi ui_upload_filename]"]Import file %s not found!!![/msg] [elsif cgi ui_upload_ext eq add] [import-fields add=1 autonumber="[cgi ui_autonumber]" convert="[cgi ui_import_convert]" delete="[cgi ui_allow_delete]" filter_field="[cgi ui_filter_field]" dir=backup ignore_fields="[cgi ui_ignore_fields]" file="upload/[cgi ui_upload_filename]" move=1 multiple="[cgi ui_allow_multiple]" transactions="[cgi ui_import_transactions]" quiet="[cgi ui_import_quiet]" table="[cgi mv_data_table]" ] [/elsif] [elsif cgi ui_upload_ext eq update] [import-fields convert="[cgi ui_import_convert]" delete="[cgi ui_allow_delete]" dir=backup file="upload/[cgi ui_upload_filename]" move=1 multiple="[cgi ui_allow_multiple]" transactions="[cgi ui_import_transactions]" quiet="[cgi ui_import_quiet]" table="[cgi mv_data_table]" filter_field="[cgi ui_filter_field]" ] [/elsif] [elsif cgi ui_upload_ext eq cleanse] [import-fields add=1 convert="[cgi ui_import_convert]" cleanse=1 delete="[cgi ui_allow_delete]" dir=backup file="upload/[cgi ui_upload_filename]" move=1 multiple="[cgi ui_allow_multiple]" transactions="[cgi ui_import_transactions]" quiet="[cgi ui_import_quiet]" table="[cgi mv_data_table]" filter_field="[cgi ui_filter_field]" ] [/elsif] [/if] [/if] [calc] return if ! $CGI->{mv_data_table}; $Values->{mv_data_table} = $CGI->{mv_data_table}; return; [/calc] [form-session-id]

[L]Table Name[/L] |
[msg arg.0="" arg.1=""]Fields to be %signored%s[/msg] | [perl tables="[cgi mv_data_table]"] my $chklist; my @cols = $Tag->db_columns($CGI->{mv_data_table}); for (my $i = 1; $i < @cols; $i++) { $chklist .= sprintf(q{ %s}, $cols[$i], $Tag->checked({name=>'ui_ignore_fields', value=>$cols[$i], multiple=>1}), $cols[$i]); } delete $Values->{ui_ignore_fields}; $chklist; [/perl]
[L]Import from File[/L] |

[L]Allow delete[/L] [L]Autonumber if no key[/L] [L]Use transactions[/L]
[L]Show summary/add record/delete record messages[/L]
[L]Show summary messages only[/L]
[L]Show *no* messages[/L]

[L]Field filters[/L]
[data table="mv_metadata" field="extended.filter_field" serial=1 key="[cgi mv_data_table]"]
[L]Specified one per line:[/L]

>     	fieldname1=filter
>     	fieldname2=filter1 filter2

[L]If multiple tables, must specify table as well:[/L]

>     	table1:fieldname1=filter
>     	table2:fieldname2=filter1 filter2

@_UI_STD_FOOTER_@