Exemple #1
0
    } else {
        $JBMarkup->error_msg('Please select the sequence element!');
        echo "<br>";
    }
    // Add a new feed
} elseif ($_REQUEST['action'] == 'new_feed' || $_REQUEST['action'] == 'edit_feed') {
    jb_list_xml_import_feeds();
    JB_display_import_feed_form();
    // setup feed's sequence element
} elseif ($_REQUEST['action'] == 'setupstruct') {
    jb_list_xml_import_feeds();
    jb_display_structure_setup_form($_REQUEST['feed_id']);
    // setup fields, map fields to xml elements
} elseif ($_REQUEST['action'] == 'setupfields') {
    jb_list_xml_import_feeds();
    $feed = JB_XMLIMP_load_feed_row($_REQUEST['feed_id']);
    jb_display_field_setup_form($_REQUEST['feed_id']);
} else {
    jb_list_xml_import_feeds();
}
if ($_REQUEST['action'] == 'fetch') {
    $feed_id = (int) $_REQUEST['feed_id'];
    ?>
	<iframe src="xmlimport_iframe.php?feed_id=<?php 
    echo htmlentities($feed_id);
    ?>
" width="100%" height="200" id="iframe" name="iframe"></iframe>
	<?php 
}
if (jb_xml_bug_test()) {
    $JBMarkup->error_msg("PHP Bug warning: The system detected that your PHP version has a bug in the XML parser. This is not a bug in the Jamit Job Board, but a bug in 'libxml' that comes built in to PHP itself. An upgrade of PHP with the latest version of 'libxml' with  is recommended.</font> For details about the bug, please see <a href='http://bugs.php.net/bug.php?id=45996'>http://bugs.php.net/bug.php?id=45996</a>");
 function xmlFeedImporter($feed_id)
 {
     $this->feed_id = $feed_id;
     $this->line = 0;
     $this->depth = 0;
     $this->feed_row = JB_XMLIMP_load_feed_row($feed_id);
     JBPLUG_do_callback('xml_import_parser_construct', $this);
     //require_once (dirname(__FILE__).'/xml_import_custom_functions.php');
     // open the file depending on pickup method.
     // If FTP or URL then pre-fetch it and open the local file
     switch ($this->feed_row['pickup_method']) {
         case 'POST':
             // Read the raw input from stdin
             // http://www.php.net/wrappers.php
             // php://input is not available with enctype="multipart/form-data
             if (!($this->fp = fopen('php://input', 'rb'))) {
                 $this->set_import_error("Couldn't open input stream");
                 return false;
             }
             // check the key
             if (trim($this->feed_row['feed_key']) != '') {
                 $key = $_GET['key'];
                 if ($key != $this->feed_row['feed_key']) {
                     $this->set_import_error('Invalid key / key not received. Please make sure key is passed in the query string. eg. http://www.example.com/jb-xml-pickup.php?feed_id=1&key=something');
                     return false;
                 }
             }
             break;
         case 'FILE':
             if (file_exists($this->feed_row['feed_filename'])) {
                 $this->fp = fopen($this->feed_row['feed_filename'], 'rb');
             } else {
                 $this->set_import_error("File not found " . $this->feed_row['feed_filename']);
                 return false;
             }
             break;
         case 'URL':
             $url = $this->feed_row['feed_url'];
             /*$url_arr = parse_url($url);
             		
             		$header .= "GET ".$url_arr['path']."?".$url_arr['query']." HTTP/1.1\r\n";
             		$header .= "Host: ".$url_arr['host']."\r\n\r\n";
             		if ($url_arr['scheme']=='http') {
             			$port = 80;
             		} elseif ($url_arr['scheme']=='https') {
             			$port = 443;
             			$url_arr['host'] = 'ssl://'.$url_arr['host']; // works only if openssl is compiled
             		} else {
             			$port = $url_arr['port'];
             		}
             		//if (!$this->fp = fsockopen ($url_arr['host'], $port, $errno, $errstr, 30)) {
             		*/
             if (!($this->fp = fopen($url, 'rb'))) {
                 $this->set_import_error('Cannot open URL ' . $this->feed_row['feed_url']);
                 return false;
             }
             break;
         case 'FTP':
             $ftp_server = trim($this->feed_row['ftp_host']);
             $ftp_user = trim($this->feed_row['ftp_user']);
             $ftp_pass = trim($this->feed_row['ftp_pass']);
             $remote_file = trim($this->feed_row['ftp_filename']);
             // set up a connection or error
             if (!($conn_id = ftp_connect($ftp_server))) {
                 $this->set_import_error("FTP: Couldn't connect to {$ftp_server}");
                 return false;
             }
             // try to login
             if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
                 // turn passive mode on
                 ftp_pasv($conn_id, true);
                 $s = md5(JB_SITE_NAME . time());
                 if (function_exists('JB_get_cache_dir')) {
                     $cache_dir = JB_get_cache_dir();
                 } else {
                     $cache_dir = JB_basedirpath() . 'cache/';
                 }
                 $temp_filename = $cache_dir . 'import_temp_' . $s . '.xml';
                 if ($fp_temp = fopen($temp_filename, 'wb')) {
                     if (ftp_fget($conn_id, $fp_temp, $remote_file, FTP_BINARY, 0)) {
                         FCLOSE($fp_temp);
                         $this->fp = fopen($temp_filename, 'rb');
                     } else {
                         $this->set_import_error("FTP: Couldn't download {$remote_file}\n");
                         return false;
                     }
                 }
                 ftp_close($conn_id);
             } else {
                 $this->set_import_error("FTP: Couldn't login as {$ftp_user}\n");
                 return false;
             }
             // close the connection
             ftp_close($conn_id);
             break;
     }
     $this->FMD =& $this->feed_row['FMD'];
 }
function jb_display_field_setup_form($load_fmd = true)
{
    $feed_id = (int) $_REQUEST['feed_id'];
    $feed = JB_XMLIMP_load_feed_row($feed_id);
    if ($load_fmd) {
        // prefill the $_REQUEST[] with all the options from the database
        $feed['FMD']->fillRequestFromOptions();
    } else {
        $feed['FMD']->fillOptionsFromRequest();
    }
    ?>

	<h3>Map fields</h3>

	<?php 
    //$sql = "SELECT * FROM form_fields WHERE form_id=1 anD field_type!='BLANK' AND field_type != 'SEPERATOR' ORDER BY section, list_sort_order";
    $sql = "SELECT *, t1.field_label AS FLABEL FROM form_field_translations as t1, form_fields as t2 WHERE t2.form_id=1 AND t2.field_id=t1.field_id AND field_type!='BLANK' AND field_type != 'SEPERATOR' AND lang='" . JB_escape_sql($_SESSION['LANG']) . "' order by section, field_sort";
    $result = jb_mysql_query($sql);
    ?>

	<form method="post" action="<?php 
    echo htmlentities($_SERVER['PHP_SELF']);
    ?>
">

	<input type="hidden" name="feed_id" value="<?php 
    echo htmlentities($feed_id);
    ?>
">
	<input type="hidden" name="action" value="setupfields">
	<input type="hidden" name="seq" value="<?php 
    echo $feed["FMD"]->seq;
    ?>
">

	<table  border="0" cellSpacing="1" cellPadding="3" bgColor="#d9d9d9"  >

		<tr bgColor="#eaeaea">
			<td colspan="3" style="background-color: #5296DE; color:white;"><b>Job Importing - Account Options</b></td>
		</tr>
		<?php 
    $_REQUEST['account_create'] = $_REQUEST['account_create'] == false ? 'ONLY_DEFAULT' : $_REQUEST['account_create'];
    ?>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">How to associate the jobs with employer's accounts?</span></td>
			<td colspan="2"><input type="radio" name="account_create" value="IMPORT_REJECT" <?php 
    echo $_REQUEST['account_create'] == 'IMPORT_REJECT' ? 'checked' : '';
    ?>
 > Insert using the employer's account details provided with the feed. Reject if a user/pass does not authenticate<br>
			<input type="radio" name="account_create" value="IMPORT_DEFAULT" <?php 
    echo $_REQUEST['account_create'] == 'IMPORT_DEFAULT' ? 'checked' : '';
    ?>
> Insert using the employer's account, but insert using the <b>default username</b> if user/pass do not authenticate<br>
			<input type="radio" name="account_create" value="IMPORT_CREATE" <?php 
    echo $_REQUEST['account_create'] == 'IMPORT_CREATE' ? 'checked' : '';
    ?>
> Insert using the employer's username, create a new account from the account data present in the feed. Allows blank passwords.<br>
			<input type="radio" name="account_create" value="ONLY_DEFAULT" <?php 
    echo $_REQUEST['account_create'] == 'ONLY_DEFAULT' ? 'checked' : '';
    ?>
> Always import the jobs under the <b>default username.</b> Allows blank passwords.<br>
			
			<b>Default Username</b><span class="is_required_mark">*</span>: <input type="text" size="20" name="default_user" value="<?php 
    echo jb_escape_html($_REQUEST['default_user']);
    ?>
"><br>
			
			</td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">How many credits to deduct?</span></td>
			<td colspan="2"><input type="text" name="deduct_credits" size="5" value="<?php 
    if ($_REQUEST['deduct_credits'] == false) {
        $_REQUEST['deduct_credits'] = 0;
    }
    echo $_REQUEST['deduct_credits'];
    ?>
">
			</td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">Account details</span></td>
			<td colspan="2"><span class="is_required_mark">*</span>If you selected any of the first three options above, then you will need to setup your account data fields: (The following are required: Username, password, Email, First name, Last name)<br>
			<table border="0" cellSpacing="1" cellPadding="3" bgColor="#d9d9d9" >
				<tr bgcolor="white">
					<td>Username:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_Username'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_Username">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_Username']);
    ?>
						</select>
					</td>
				</tr>
				<tr bgcolor="white">
					<td>Password:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_Password'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_Password">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_Password']);
    ?>
						</select> <input type="checkbox" name="pass_md5" <?php 
    if ($_REQUEST['pass_md5'] == 'Y') {
        echo ' checked ';
    }
    ?>
 value="Y">Passwords are encrypted using MD5 Hash
					</td>
				</tr>
				<tr bgcolor="white">
					<td>Account Email:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_Email'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_Email">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_Email']);
    ?>
						</select>
					</td>
				</tr>
				<tr bgcolor="white">
					<td>First Name:<span class="is_required_mark">*</span></td>
					<td><select type="select" <?php 
    if ($_REQUEST['ac_FirstName'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 name="ac_FirstName">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_FirstName']);
    ?>
						</select>
					</td>
				</tr>
				<tr bgcolor="white">
					<td>Last Name:<span class="is_required_mark">*</span></td>
					<td><select <?php 
    if ($_REQUEST['ac_LastName'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_LastName">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_LastName']);
    ?>
						</select>
					</td></tr>
				<tr bgcolor="white">
					<td>Company Name:</td>
					<td><select <?php 
    if ($_REQUEST['ac_CompName'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 type="select" name="ac_CompName">
						<option value="">[Select Field]</option>
						<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_CompName']);
    ?>
						</select>
					</td>
				</tr>

				<?php 
    //$sql = "SELECT * FROM form_fields WHERE form_id=4 AND field_type!='BLANK' AND field_type != 'SEPERATOR'  ";
    $sql = "SELECT *, t1.field_label AS FLABEL FROM form_field_translations as t1, form_fields as t2 WHERE t2.form_id=4 AND t2.field_id=t1.field_id AND field_type!='BLANK' AND field_type != 'SEPERATOR' AND lang='" . JB_escape_sql($_SESSION['LANG']) . "' order by section, field_sort ";
    $result2 = jb_mysql_query($sql);
    if (mysql_num_rows($result2) > 0) {
        while ($ac_row = mysql_fetch_array($result2)) {
            ?>
						<tr bgcolor="white">
							<td><?php 
            echo $ac_row['FLABEL'];
            ?>
:</td>
							<td><select <?php 
            if ($_REQUEST['ac_' . $ac_row['field_id']] != '') {
                ?>
 style="color:#008080; font-weight: bold" <?php 
            }
            ?>
 type="select" name="ac_<?php 
            echo $ac_row['field_id'];
            ?>
">
								<option value="">[Select Field]</option>
								<?php 
            JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['ac_' . $row['field_id']]);
            ?>
								</select>
							</td>
						</tr>
						<?php 
        }
    }
    ?>
					
			</table>
			
			</td>
		</tr>
		<tr bgColor="#eaeaea">
			<td colspan="3" style="background-color: #5296DE; color:white;"><b>Job Importing - Feed Commands</b></td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"><span style="font-weight: bold; font-size: 10pt">Command field</span></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['command_field'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="command_field">
				<option  value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['command_field']);
    ?>
				</select> - Does the feed have a field which tells the system what to do with the data? eg a command may be Add, Delete, Update. If no field is selected here, then all records are assumed as to be added.
			</td>
		</tr>

		<tr bgColor="#eaeaea">
			<td colspan="1" bgColor="white"></td>
			<td colspan="1"><b>Command</b></td>
			<td colspan="1"><b>Command name</b></td>
		</tr>
		<?php 
    if ($_REQUEST['insert_command'] == false) {
        $_REQUEST['insert_command'] = 'Add';
    }
    if ($_REQUEST['update_command'] == false) {
        $_REQUEST['update_command'] = 'Update';
    }
    if ($_REQUEST['delete_command'] == false) {
        $_REQUEST['delete_command'] = 'Delete';
    }
    ?>
		<tr bgcolor="white">
			<td colspan="1"></td>
			<td colspan="1">Insert a new job</td>
			<td colspan="1">Look for this command: <input type="text" name="insert_command" value="<?php 
    echo jb_escape_html($_REQUEST['insert_command']);
    ?>
"></td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"></td>
			<td colspan="1">Update existing job</td>
			<td colspan="1">Look for this command: <input type="text" name="update_command" value="<?php 
    echo jb_escape_html($_REQUEST['update_command']);
    ?>
"></td>
		</tr>
		<tr bgcolor="white">
			<td colspan="1"></td>
			<td colspan="1">Delete existing job</td>
			<td colspan="2">Look for this command: <input type="text" name="delete_command" value="<?php 
    echo jb_escape_html($_REQUEST['delete_command']);
    ?>
"></td>
		</tr>

		<tr bgColor="#eaeaea">
			<td colspan="3" style="background-color: #5296DE; color:white;"><b>Job Importing - Special Attributes</b></td>
		</tr>

		<tr bgcolor="white">
			<td colspan="1"><b>Application URL field</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['app_url'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="app_url">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['app_url']);
    ?>
				</select>
				<br>When the 'apply' button is pressed, Jamit will redirect the candidate to the 'Application URL'.
				<br>If no application URL present, Jamit should: <input type="radio" value="O" name="default_app_type" <?php 
    if ($_REQUEST['default_app_type'] == 'O') {
        echo ' checked ';
    }
    ?>
> <i>Accept applications for that posting on your site<i> or, <input type="radio" name="default_app_type" value="N" <?php 
    if (!$_REQUEST['default_app_type'] || $_REQUEST['default_app_type'] == 'N') {
        echo ' checked ';
    }
    ?>
> <i>Do not display the 'apply' button for that posting</i>
			</td>
		</tr>
	
		<tr bgcolor="white">
			<td colspan="1"><b>GUID</b><span class="is_required_mark">*</span> - Global Unique ID</td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['guid'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="guid">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['guid']);
    ?>
				</select> (This is a Global Unique Identifier for the job post. This ID is not just local, but used accross all possible job boards and databases. A URL is an excellent choice for a GUID.)
			</td>
		</tr>

		<tr bgcolor="white">
			<td colspan="1"><b>Post Date</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['post_date'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="post_date">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['post_date']);
    ?>
				</select> (Date and Time, Formatted to the specification of <a href="http://www.faqs.org/rfcs/rfc2822">RFC 2822</a> or YYYY-MM-DD. If date is invalid or not selected, the job will be imported with the current date and time.)
			</td>
		</tr>

		

		<tr bgcolor="white">
			<td colspan="1"><b>Post Mode</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['post_mode'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="post_mode">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['post_mode']);
    ?>
				</select> (Optional. This field represents the <i>post_mode field</i>. It can have one of the following values: 'free', 'normal', 'premium'. If not mapped, the post will be posted as 'normal')
			</td>
		</tr>

		<tr bgcolor="white">
			<td colspan="1"><b>Approval Status</b></td>
			<td colspan="2"><select <?php 
    if ($_REQUEST['approved'] != '') {
        ?>
 style="color:#008080; font-weight: bold" <?php 
    }
    ?>
 style="font-size: 10pt" type="select" name="Approval">
				<option value="">[Select Field]</option>
				<?php 
    JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['approved']);
    ?>
				</select> (Optional. This field represents the <i>approved</i> field. It can have one of the following values: 'Y' for approved posts or 'N' for not approved posts. If not mapped, the post will be posted as: <select style="font-weight: bold" name="default_approved" <?php 
    if ($_REQUEST['default_approved'] == 'Y') {
        echo 'selected';
    }
    ?>
><option value="Y">'Y - Approved'</option><option value="N" <?php 
    if ($_REQUEST['default_approved'] == 'N') {
        echo 'selected';
    }
    ?>
 >'N - Not Approved'</option></select>)
			</td>
		</tr>


		<tr><td colspan="3" style="background-color: #5296DE; color:white;"><b>Jobs Feed - Map your fields to the XML attributes<b></td></tr>
		
		<tr bgColor="#eaeaea">
			<td><b>Name</b></td>
			<td><b>XML Field</b></td>
			<td><b>Options</b></td>
			
		</tr>
		


		<?php 
    $code = "\t//The following are examples showing how to set the data\n" . "\t//structure with custom values. set_data_value() takes 3 arguments:\n" . "\t// (string) value, (string) field_id, and optionally (int) form_id.\n";
    $code2 = "//\tThe Feed Meta Data object is accessable like this:\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        ?>

			<tr bgcolor="white">

				<td>
					<span style="font-weight: bold; font-size: 10pt"><?php 
        echo $row['FLABEL'];
        if ($row['is_required'] == 'Y') {
            echo '<span class="is_required_mark">*</span>';
        }
        ?>
</span> <?php 
        echo $row['field_type'] . ' (#' . $row['field_id'];
        ?>
)
				</td>
				<td width="10%">
					<select <?php 
        if ($_REQUEST['xml_element_' . $row['field_id']] != '') {
            ?>
 style="color:#008080; font-weight: bold" <?php 
        }
        ?>
 style="font-size: 10pt" type="select" name="xml_element_<?php 
        echo $row['field_id'];
        ?>
">
					<option value="">[Select Field]</option>
					<?php 
        JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['xml_element_' . $row['field_id']]);
        ?>
					</select>
				</td>
				<td>

				<div style="font-size: 8pt;padding-left:50px;padding-right:auto">
		
					Validate? <?php 
        JB_XMLIMP_echo_validation_select('validate' . $row['field_id'], $_REQUEST['validate' . $row['field_id']]);
        ?>
					
					<?php 
        if ($row['field_type'] == 'MSELECT' || $row['field_type'] == 'RADIO' || $row['field_type'] == 'SELECT' || $row['field_type'] == 'CHECK') {
            if ($_REQUEST['code_mode' . $row['field_id']] == false) {
                $_REQUEST['code_mode' . $row['field_id']] = 'ADD_NEW';
            }
            ?>
<br>
						
						<span style="color: black; font-size:10pt">If the imported value does <b>not exist</b> as an <b>option</b> in your database, then:</span><br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_NEW" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'ADD_NEW') {
                echo 'checked';
            }
            ?>
 > - Add the value as a new option, using first three letters as the code<br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_PAIR" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'ADD_PAIR') {
                echo 'checked';
            }
            ?>
 > - Add the value as a new option, using <select style="font-weight: bold" type="select" name="code_pair<?php 
            echo $row['field_id'];
            ?>
">
					<option value="">[Select Field]</option>
					<?php 
            JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['code_pair' . $row['field_id']]);
            ?>
					</select> for the code.<br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="ERROR" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'ERROR') {
                echo 'checked';
            }
            ?>
 > - Throw an error & skip the whole record<br>
						<input type="radio" name="code_mode<?php 
            echo $row['field_id'];
            ?>
" value="IGNORE" <?php 
            if ($_REQUEST['code_mode' . $row['field_id']] == 'IGNORE') {
                echo 'checked';
            }
            ?>
 > - Don't do anything, import anyway<br>

						<?php 
        } elseif ($row['field_type'] == 'CATEGORY') {
            if ($_REQUEST['cat_mode' . $row['field_id']] == false) {
                $_REQUEST['cat_mode' . $row['field_id']] = 'ADD_MATCH';
            }
            ?>
<br>
						<span style="color: black; font-size:10pt;">If the imported value does <b>not exist</b> as a <b>category</b> on your database, then:</span><br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_NEW" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'ADD_NEW') {
                echo 'checked';
            }
            ?>
 > - Add the value as a new category, under the category of: 
						<select style="font-weight: bold" name="parent_category<?php 
            echo $row['field_id'];
            ?>
">
						<?php 
            JB_category_option_list2(0, $_REQUEST['parent_category' . $row['field_id']], 1);
            ?>
						</select>
						<br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="ADD_MATCH" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'ADD_MATCH') {
                echo 'checked';
            }
            ?>
 > - Attempt to match the category name with text from <select style="font-weight: bold" type="select" name="cat_match<?php 
            echo $row['field_id'];
            ?>
">
					<option value="">[Select Field]</option>
					<?php 
            JB_XMLIMP_echo_element_option_list($feed, $_REQUEST['cat_match' . $row['field_id']]);
            ?>
					</select><br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="ERROR" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'ERROR') {
                echo 'checked';
            }
            ?>
 > - Throw an error & skip the whole record<br>
						<input type="radio" name="cat_mode<?php 
            echo $row['field_id'];
            ?>
" value="IGNORE" <?php 
            if ($_REQUEST['cat_mode' . $row['field_id']] == 'IGNORE') {
                echo 'checked';
            }
            ?>
 > - Don't do anything, import anyway<br>
						<?php 
        } else {
            if ($row['field_type'] == 'EDITOR') {
                if ($_REQUEST['allow_html' . $row['field_id']] == '') {
                    $_REQUEST['allow_html' . $row['field_id']] = 'Y';
                }
            }
            ?>
						<br>
						or, <input type="checkbox" name="ignore<?php 
            echo $row['field_id'];
            ?>
" <?php 
            if ($_REQUEST['ignore' . $row['field_id']] == 'Y') {
                echo ' checked ';
            }
            ?>
 value="Y" style="font-size: 8pt"> Ignore field & Replace with: <input style="font-size: 8pt" name="replace<?php 
            echo $row['field_id'];
            ?>
" value="<?php 
            echo jb_escape_html($_REQUEST['replace' . $row['field_id']]);
            ?>
" size="20" type="text"><br>
						<input type="checkbox" name="allow_html<?php 
            echo $row['field_id'];
            ?>
" value="Y"  <?php 
            if ($_REQUEST['allow_html' . $row['field_id']] == 'Y') {
                echo 'checked';
            }
            ?>
 > - Allow limited HTML<br>
<?php 
        }
        ?>
				</div>
				</td>
				
			</tr>

			<tr bgColor="#EFF3FF">
				<td colspan="3">&nbsp;</td>
			</tr>

			<?php 
        if ($_REQUEST['xml_element_' . $row['field_id']]) {
            $tag = ", <<-- mapped to <" . $_REQUEST['xml_element_' . $row['field_id']] . ">";
        } else {
            $tag = '';
        }
        $field_list .= "- Field id:" . $row['field_id'] . ", Label: '" . $row['FLABEL'] . "', Field Type:" . $row['field_type'] . " {$tag} \n";
    }
    ?>

		<tr><td colspan="3" bgcolor="white">
		<input type="submit" name="submit_field_setup" value="Save" style="font-size:14pt;">
		</td>
		</tr>
		<tr><td colspan="3">
				Advanced: Summary of field mappings. The following box displays a summary of the fields and which elements they have been mapped to thus far.
				<textaREA rows="5" style="width:100%; font-size:10px"><?php 
    echo htmlentities($field_list);
    ?>
</textaREA>
			</td>
		</tr>

	</table>
	<?php 
}