function JB_category_option_list2($category_id, $selected) { if (func_num_args() > 2) { $form_id = func_get_arg(2); $form_id_sql = " AND `form_id`='" . JB_escape_sql($form_id) . "' "; } global $depth, $cat_names; if ($depth == '') { $depth = 0; } if ($_SESSION['LANG'] == '') { $query = "SELECT * FROM categories WHERE category_id='" . JB_escape_sql($category_id) . "' {$form_id_sql} ORDER by list_order, category_name "; } else { $query = "SELECT *, t2.category_name as NAME FROM categories as t1, cat_name_translations as t2 WHERE t1.category_id=t2.category_id AND t1.category_id='" . JB_escape_sql($category_id) . "' AND t2.lang='" . JB_escape_sql($_SESSION['LANG']) . "' {$form_id_sql} ORDER by list_order, t2.category_name "; } $result = JB_mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $cat_names[$depth] = $row['NAME']; if ($depth != 0) { if ($row['category_id'] == $selected) { $sel = " selected "; } echo "<option " . $sel . " value='" . $row['category_id'] . "'>"; for ($i = 0; $i < count($cat_names); $i++) { if ($i > 0) { $j = " -> "; } echo $j . $cat_names[$i]; } echo "</option>"; } $query = "SELECT * FROM categories WHERE parent_category_id='" . JB_escape_sql($category_id) . "' {$form_id_sql} ORDER by list_order, category_name "; $result = JB_mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $depth++; JB_category_option_list2($row['category_id'], $selected); unset($cat_names[$depth]); $depth--; } }
require dirname(__FILE__) . "/admin_common.php"; require_once "../include/posts.inc.php"; require_once "../include/category.inc.php"; JB_admin_header('Admin -> Select Category'); ?> Please select the category and click OK<br> The category will be the starting category for the field. <form name="cat_selector" > <select height="10" name="select" onchange="change_it(); "> <option value="0">[Select Starting Category]</option> <?php $form_id = (int) $_REQUEST['form_id']; if ($form_id == '') { $form_id = 1; } JB_category_option_list2(0, $selected, $form_id); ?> </select> <input type="button" value="OK" onclick="window.close()" > </form> <script type="text/javascript"> function change_it() { var selectBox = document.forms[0].select; user_input = selectBox.options[selectBox.selectedIndex].value user_text = selectBox.options[selectBox.selectedIndex].text window.opener.document.form2.category_init_id.value = user_input; window.opener.document.form2.category_init_name.value = user_text;
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"> </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 }