Commit c6497f86 authored by Kevin Stover's avatar Kevin Stover

Fixing bugs and stuff.

parent 7a1965ea
Pipeline #542 passed with stage
in 1 minute and 27 seconds
......@@ -79,6 +79,8 @@ jQuery( document ).ready( function( $ ) {
// If we don't have a .nff extension, show our type error and bail.
if ( '.nff' !== extension[0] ) {
jQuery( '#row-nf-import-type-error' ).show();
importFormFile.name = '';
importFormFile.content = '';
return false;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -22,47 +22,40 @@ define( [], function() {
*/
maybeOpenModal: function( e ) {
e.preventDefault();
// Settings object for our batch processor
var settings = {
// Initial content for the popup modal
content: '',
// Batch processor slug. Must match what we have set in our PHP settings array.
batch_type: 'import_form_template',
loadingText: 'Importing...',
extraData: { template: this.model.get( 'id' ) },
onCompleteCallback: function( response ) {
// Bail if we don't return a form ID.
if ( 'undefined' == response.form_id ) return false;
window.location.href = nfAdmin.builderURL + response.form_id;
// If this isn't an ad, then early return
if ( 'ad' == this.model.get( 'type' ) ) {
// Open our jBox modal
var modal = new jBox( 'Modal', {
width: 450,
title: this.model.get( 'modal-title' ),
content: this.model.get( 'modal-content' ),
closeButton: 'box',
blockScroll: true
} );
modal.open();
} else {
// Settings object for our batch processor
var settings = {
// Batch processor slug. Must match what we have set in our PHP settings array.
batch_type: 'import_form_template',
loadingText: 'Importing...',
extraData: { template: this.model.get( 'id' ) },
onCompleteCallback: function( response ) {
// Bail if we don't return a form ID.
if ( 'undefined' == response.form_id ) return false;
window.location.href = nfAdmin.builderURL + response.form_id;
}
}
}
/**
* Instantiate our batch processor.
*
* This will open the modal and present the user with content and buttons.
*/
new NinjaBatchProcessor( settings );
// If this isn't an ad, then early return
if ( 'ad' != this.model.get( 'type' ) ) {
return true;
}
// Prevent page navigation.
e.preventDefault();
// Open our jBox modal
var modal = new jBox( 'Modal', {
width: 450,
title: this.model.get( 'modal-title' ),
content: this.model.get( 'modal-content' ),
closeButton: 'box',
blockScroll: true
} );
modal.open();
/**
* Instantiate our batch processor.
*
* This will open the modal and present the user with content and buttons.
*/
new NinjaBatchProcessor( settings );
}
}
} );
......
......@@ -252,7 +252,6 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
if ( ! isset ( $this->form[ 'fields' ][ $i ] ) ) continue;
$field_settings = $this->form[ 'fields' ][ $i ];
$field_settings[ 'parent_id' ] = $this->form[ 'ID' ];
// Array that tracks which settings need to be meta and which are columns.
$field_meta = $field_settings;
......@@ -266,9 +265,6 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
} else {
array_push( $insert_columns_types, '%s' );
}
// Remove this setting from our action meta tracking array.
// unset( $field_meta[ $column_name ] );
}
// Add our field to the database.
......@@ -359,6 +355,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
// Try to utf8 decode our results.
$data = WPN_Helper::utf8_decode( $decoded_data );
// If json_encode returns false, then this is an invalid utf8 decode.
if ( ! json_encode( $data ) ) {
$data = $decoded_data;
}
......@@ -376,7 +373,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
*/
$sql = "SHOW COLUMNS FROM {$wpdb->prefix}nf3_fields LIKE 'field_key'";
$results = $wpdb->get_results( $sql );
/**
* If we don't have the field_key column, we need to remove our new columns.
*
......@@ -390,7 +387,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
$db_stage_one_complete = true;
}
$this->form[ 'stage_one_complete' ] = $db_stage_one_complete;
$this->form[ 'db_stage_one_complete' ] = $db_stage_one_complete;
add_option( 'nf_doing_' . $this->_slug, 'true', false );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment