<HTML>
<HEAD>
<TITLE>MySQLMan: Import From File</TITLE>

<SCRIPT language="Javascript">
<!--
function AddAll (From, To) {
	var FromObj = document.ImportForm[From];
	var ToObj   = document.ImportForm[To];
	
	var i     = 1;
	var track = 1;
	while (i < FromObj.options.length) {
		if (track == FromObj.options.length) {
			alert ("You can not add more than the number of fields in the select list.");
			return;
		}
		if (ToObj.options[track].value != "") { track++; continue }
		for (var l = 1; l < ToObj.options.length; l++) {
			if (ToObj.options[l].value == FromObj.options[i].value) {
				alert ("You can not have duplitcate values for an import.");
				return false;
			}
		}
		ToObj.options[track].value    = FromObj.options[i].value;
		ToObj.options[track].text     = FromObj.options[i].text;
		ToObj.options[track].selected = true;
		i++;
		track++;
	}
	return true;
}

function AddIt (From, To) {
	var FromObj = document.ImportForm[From];
	var ToObj   = document.ImportForm[To];
	
	var track = 1;
	var i     = 1;
	while (i < FromObj.options.length) {
		if (track == FromObj.options.length) {
			alert ("You can not add more than the number of fields in the select list.");
			return false;
		}
		if (ToObj.options[track].value != "") { track++; continue }
		if (FromObj.options[i].selected) {
			for (var l = 1; l < ToObj.options.length; l++) {
				if (ToObj.options[l].value == FromObj.options[i].value) {
					alert ("You can not have duplitcate values for an import.");
					return false;
				}
			}
			ToObj.options[track].value    = FromObj.options[i].value;
			ToObj.options[track].text     = FromObj.options[i].text;
			ToObj.options[track].selected = true;
			track++;
		}
		i++;
	}
	return true;
}

function Clear (What) {
	var Obj   = document.ImportForm[What];
	for (var i = 1; i < Obj.options.length; i++) {
		Obj.options[i].value    = "";
		Obj.options[i].text     = "";
		Obj.options[i].selected = false;
	}
	return true;
} 

//-->
</SCRIPT>

</HEAD>
<BODY BGCOLOR="#CCCCCC">
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width="100%" align=center valign=top>
			<tr><td bgcolor="navy">
					<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
                    <b>MySQLMan: Import From File</b>
			</td></tr>
			<tr><td>
<%include header.txt%>
<UL>
<table bgcolor="#FFFFCC" border=1 cellpadding=5 cellspacing=3>
<td>
<li><B> Import Data to Table <%table%>:</B><BR>
	<UL>
		<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="<%script_url%>" name="ImportForm">
		<INPUT TYPE="hidden" name="<%do_param%>" VALUE='import'>
		<INPUT TYPE="hidden" NAME=data_source VALUE="<%data_source%>">
		<INPUT TYPE="hidden" NAME=table VALUE="<%table%>">
		<INPUT TYPE="hidden" NAME=origin VALUE="property">

		<table>
	<tr>
	<td><b>File on server.&nbsp;&nbsp;</b></td>
	<td>Path: <INPUT TYPE="text" NAME="server_file" VALUE= "" SIZE="64"></td>
	</tr>
	<tr>
	<td>OR</td>
	</tr>
	<tr>
	<td><b>File on local drive.&nbsp;&nbsp;</b></td>
	<td>Path: <INPUT TYPE="file" NAME="upload_local_file" VALUE= "" SIZE="64"></td>
	</tr>
	</table>
	<P>
		<B>Select fields:</B><BR>
		<INPUT TYPE="radio" NAME="import_all_cols" VALUE="1" checked> All fields<BR>
		<INPUT TYPE="radio" NAME="import_all_cols" VALUE="0"> Selected Fields
		<UL>
			<li>Please note that the order should match the order of the fields in the file.
			<P>
			<%include fields_selection.txt%>
			</P>
		</UL>

		<INPUT TYPE="checkbox" NAME="local" VALUE="LOCAL" checked> Local Import<BR>
		<INPUT TYPE="checkbox" NAME="replace_op" VALUE="1" checked> Do not show error message if there are duplicate records and do the following:<BR>
		<UL>
		<INPUT TYPE="radio" NAME="replace_act" VALUE="IGNORE" checked>Ignore<BR>
		<INPUT TYPE="radio" NAME="replace_act" VALUE="REPLACE">Replace<BR>
		</UL>
		Fields:
		<UL>
		Delimiter: <INPUT TYPE="text" NAME="delimiter" VALUE="|" SIZE="2"><BR>
		Escape Character: <INPUT TYPE="text" NAME="escape_char" VALUE="\" SIZE="2"><BR>
		</UL>
		Records:
		<UL>
		Delimiter: <INPUT TYPE="text" NAME="rec_del" VALUE="\n" SIZE="3"><BR>
		Ignore first <INPUT TYPE="text" NAME="ignore_line" VALUE="0" SIZE="3"> Lines
		</UL>
		<P>
		<INPUT TYPE="submit" value=" Import ">
		</FORM>
	</UL>
</td></table>

</UL>
</td></tr></table>
</BODY>
</HTML>
