break; case "process_smart_fill_contents": $form_id = $_SESSION["ft"]["add_form_form_id"]; ft_set_form_field_types($form_id, $request); // finalize the form and redirect to step 6 $form_info = ft_get_form($form_id); if ($form_info["is_complete"] != 'yes') { $response = ft_finalize_form($form_id); echo ft_convert_to_json($response); } else { echo "{ \"success\": \"1\", \"message\": \"\" }"; } break; case "get_js_webpage_parse_method": $url = $request["url"]; $method = ft_get_js_webpage_parse_method($url); echo "{ \"scrape_method\": \"{$method}\" }"; break; // used on the Add Form Step 5 page and Edit Field Options pages. It uploads // the files to the /upload folder and returns the filenames (renamed & stored in sessions). // That information is then used by the JS to load and process the page content // used on the Add Form Step 5 page and Edit Field Options pages. It uploads // the files to the /upload folder and returns the filenames (renamed & stored in sessions). // That information is then used by the JS to load and process the page content case "upload_scraped_pages_for_smart_fill": $num_pages = $request["num_pages"]; $settings = ft_get_settings(array("file_upload_dir", "file_upload_url"), "core"); $file_upload_dir = $settings["file_upload_dir"]; $file_upload_url = $settings["file_upload_url"]; $upload_tmp_file_prefix = "ft_sf_tmp_"; if (!isset($_SESSION["ft"]["smart_fill_tmp_uploaded_files"])) {
$iframe_loaded_js_rows[] = "page_ns.form_{$i}_loaded = false;"; } $iframe_loaded_js = implode("\n", $iframe_loaded_js_rows); $num_pages = count($form_urls); // get the list of (non-system) field IDs $custom_field_ids = array(); foreach ($form_fields as $field_info) { if ($field_info["is_system_field"] == "yes") { continue; } $custom_field_ids[] = $field_info["field_id"]; } $custom_field_id_str = implode(",", $custom_field_ids); // this chunk of code determines what method should be used to make the form web page(s) available to // the javascript, to let it parse and Smart Fill the field types and options $scrape_method = ft_get_js_webpage_parse_method($form_info["form_url"]); $raw_field_types_js = ft_get_raw_field_types_js(); $field_size_labels_js = ft_generate_field_type_size_labels(); // ------------------------------------------------------------------------------------------------ // compile the header information $page_vars["page"] = "add_form5"; $page_vars["page_url"] = ft_get_page_url("add_form5"); $page_vars["head_title"] = "{$LANG['phrase_add_form']} - {$LANG["phrase_step_5"]}"; $page_vars["form_id"] = $form_id; $page_vars["form_info"] = $form_info; $page_vars["form_fields"] = $form_fields; $page_vars["form_urls"] = $form_urls; $page_vars["scrape_method"] = $scrape_method; $page_vars["text_add_form_field_types_multiple_fields_found8"] = ft_eval_smarty_string($LANG["text_add_form_field_types_multiple_fields_found8"], array("ONCLICK" => "ft.display_message('ft_message', 1, \$('#upload_files_text').html())")); $page_vars["sortable_id"] = $sortable_id; $page_vars["js_messages"] = array("word_na", "word_found", "word_delete", "word_none", "notify_smart_fill_submitted", "phrase_not_found", "word_options", "phrase_multiple_fields_found", "notify_multiple_fields_found", "phrase_field_type", "phrase_form_page", "word_options", "word_select", "word_textbox", "word_password", "word_file", "phrase_radio_buttons", "word_checkboxes", "word_textarea", "phrase_multi_select", "word_page", "word_na", "notify_smart_fill_field_not_found", "validation_select_field_type", "word_resolved", "notify_multi_field_updated", "notify_field_updated", "word_skipped", "phrase_field_skipped", "notify_multi_field_selected", "notify_field_selected", "word_horizontal", "word_vertical", "word_order", "phrase_field_value", "phrase_display_value", "notify_add_display_values", "phrase_previous_field", "phrase_next_field", "validation_smart_fill_upload_all_pages", "notify_smart_fill_upload_fields_fail", "notify_smart_fill_files_uploaded_successfully", "validation_upload_html_files_only", "word_okay", "word_error", "word_yes", "word_no", "phrase_please_confirm", "confirm_refresh_page");