Formidable Forms – Form Builder for WordPress - Version 2.0.12

Version Description

  • Add option to center form on page
  • Improve styling classes for more consistency across different field classes, and make all classes responsive
  • Added a few more styling classes: frm_three_fourths, frm_two_fifths, frm_three_fifths
  • Remove in-place-editing from the field keys on the form builder page
  • Add 'frm_after_update_field_name' hook for changing a field name during editing
  • Update Bootstrap multiselect to v0.9.13
  • Add license page to prepare for add-ons. Big things are coming.
  • Fix: Prevent loading icon from being huge in some themes
  • Fix: When the jQuery UI css is loaded by another plugin on the form builder page, the required icon looked the same whether required or not. This styling conflict is resolved.
  • Fix: Make sure the form description size can be changed in the styling settings.
  • Pro Features:
  • Views can now be filtered by fields in the repeating sections.
  • Added [parent_id] shortcode for use in views. This shortcode will only have a value when the displaying entries in repeating sections.
  • Allow views to be created using the repeated entries. Since each repeating row is an entry in a hidden form, we can allow views to be created using those repeating rows for more flexability.
  • Added order parameter to frm-entry-links
  • Allow options in a post status field to come from the form builder. The options should have separate values and the saved values can include 'publish', 'draft', 'private', 'scheduled'.
  • Remove the option to lock field and form keys. This is more of a hassle than a feature.
  • Allow the entry key to be used with the frm-field-value shortcode instead of forcing the entry
  • Replaced inline 50px height for image fields with .frm_image_from_url class for easier control
  • Improve file upload field in Chrome to prevent extra space from showing.
  • Added 'frm_save_post_name' filter. This can be used for custom form actions that create posts.
  • Added 'frm_display_data_opts' filter.
  • Prevent frm_display_id custom field from saving when a field is selected in the create post settings instead of customized content
  • Fix: When forms were submitted without ajax, the redirect wasn't working consistently.
  • Fix: The shortcodes weren't processing in the message shown after an entry is updated.
  • Fix: When we prevented the PayPal action from triggering on import, we stopped all actions. This is now fixed so an action can be set (in the code) to be triggered on import. Posts will now be created on import again.
  • Fix: The dynamic list field was showing the entry ID in the entries tab instead of the value.
  • Fix: The Add row button wasn't showing in a repeating section when returning to edit an entry if there were more than two rows in the section.
  • Fix: Improve dropping a field between two sections.
  • Fix: Remove nonce check for frm-entry-update-field shortode. Page caching gives front-end nonce checks issues.
  • Fix: We changed the parameters sent to the frm_after_update_field hook without realizing it. The 'field_id' attribute was sometimes an object, but was previously always an integer. This has been updated for reverse compatibility, and 'field' has been added with the full field object.
  • Fix: If you put -100 for the start date in a date field, -100 would show in the date field instead of 1915. This is now working correctly for dynamic values like this with three digits.
  • Fix: When filtering a view with a Dynamic field, NOT EQUAL TO will work correctly.
  • Fix: Double quotes were causing trouble when included inside an error message returned by the frm_validate_field_entry hook
  • Fix: Graphs using x_axis and start_date were having trouble
  • Fix: The js error after selecting an option in autocomplete field is fixed when there are calculations in the form.
Download this release

Release Info

Developer sswells
Plugin Icon 128x128 Formidable Forms – Form Builder for WordPress
Version 2.0.12
Comparing to
See all releases

Code changes from version 2.0.11 to 2.0.12

Files changed (39) hide show
  1. classes/controllers/FrmAddonsController.php +14 -0
  2. classes/controllers/FrmAppController.php +1 -1
  3. classes/controllers/FrmFieldsController.php +3 -0
  4. classes/controllers/FrmFormActionsController.php +5 -3
  5. classes/controllers/FrmFormsController.php +12 -9
  6. classes/controllers/FrmHooksController.php +4 -0
  7. classes/controllers/FrmSettingsController.php +6 -1
  8. classes/helpers/FrmAppHelper.php +8 -18
  9. classes/helpers/FrmFieldsHelper.php +1 -0
  10. classes/helpers/FrmFormsHelper.php +9 -2
  11. classes/helpers/FrmXMLHelper.php +4 -1
  12. classes/models/EDD_SL_Plugin_Updater.php +341 -0
  13. classes/models/FrmAddon.php +168 -0
  14. classes/models/FrmEntry.php +9 -0
  15. classes/models/FrmEntryFormat.php +2 -2
  16. classes/models/FrmEntryMeta.php +12 -3
  17. classes/models/FrmField.php +10 -2
  18. classes/models/FrmForm.php +1 -0
  19. classes/models/FrmFormAction.php +9 -0
  20. classes/models/FrmSettings.php +0 -3
  21. classes/models/FrmStyle.php +1 -0
  22. classes/views/addons/settings.php +31 -0
  23. classes/views/frm-entries/form.php +1 -1
  24. classes/views/frm-form-actions/_action_inside.php +1 -5
  25. classes/views/frm-forms/add_field.php +1 -5
  26. classes/views/frm-forms/settings.php +25 -6
  27. classes/views/frm-statistics/list.php +5 -5
  28. classes/views/styles/_general.php +6 -0
  29. css/_single_theme.css.php +41 -44
  30. css/custom_theme.css.php +113 -165
  31. css/frm_admin.css +33 -5
  32. formidable.php +1 -1
  33. js/bootstrap-multiselect.js +429 -229
  34. js/formidable.js +222 -147
  35. js/formidable.min.js +49 -48
  36. js/formidable_admin.js +38 -14
  37. languages/formidable-da_DK.po +1 -1
  38. languages/formidable-fr_FR.po +2 -2
  39. readme.txt +39 -1
classes/controllers/FrmAddonsController.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class FrmAddonsController {
4
+
5
+ public static function show_addons() {
6
+ $plugins = apply_filters( 'frm_installed_addons', array() );
7
+ if ( empty( $plugins ) ) {
8
+ _e( 'There are not any plugins on your site the require a license', 'formidable' );
9
+ return;
10
+ }
11
+
12
+ include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
13
+ }
14
+ }
classes/controllers/FrmAppController.php CHANGED
@@ -23,7 +23,7 @@ class FrmAppController {
23
  FrmAppHelper::load_font_style();
24
  }
25
 
26
- public static function get_form_nav( $form, $show_nav = '', $title = 'show' ) {
27
  global $pagenow, $frm_vars;
28
 
29
  $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
23
  FrmAppHelper::load_font_style();
24
  }
25
 
26
+ public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
27
  global $pagenow, $frm_vars;
28
 
29
  $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
classes/controllers/FrmFieldsController.php CHANGED
@@ -119,6 +119,9 @@ class FrmFieldsController {
119
  }
120
 
121
  FrmField::update( $id, array( $field => $value ) );
 
 
 
122
  echo stripslashes( wp_kses_post( $value ) );
123
  wp_die();
124
  }
119
  }
120
 
121
  FrmField::update( $id, array( $field => $value ) );
122
+
123
+ do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) );
124
+
125
  echo stripslashes( wp_kses_post( $value ) );
126
  wp_die();
127
  }
classes/controllers/FrmFormActionsController.php CHANGED
@@ -241,7 +241,7 @@ class FrmFormActionsController {
241
  public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
242
  $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
243
 
244
- if ( empty( $form_actions ) || ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) ) {
245
  return;
246
  }
247
 
@@ -254,9 +254,11 @@ class FrmFormActionsController {
254
 
255
  $stored_actions = $action_priority = array();
256
 
257
- foreach ( $form_actions as $action ) {
258
 
259
- if ( ! in_array( $event, $action->post_content['event'] ) ) {
 
 
260
  continue;
261
  }
262
 
241
  public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
242
  $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
243
 
244
+ if ( empty( $form_actions ) ) {
245
  return;
246
  }
247
 
254
 
255
  $stored_actions = $action_priority = array();
256
 
257
+ $importing = in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING;
258
 
259
+ foreach ( $form_actions as $action ) {
260
+ $trigger_on_import = $importing && in_array( 'import', $action->post_content['event'] );
261
+ if ( ! in_array( $event, $action->post_content['event'] ) && ! $trigger_on_import ) {
262
  continue;
263
  }
264
 
classes/controllers/FrmFormsController.php CHANGED
@@ -112,7 +112,7 @@ class FrmFormsController {
112
  if ( ! $id || ! is_numeric($id) ) {
113
  $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
114
  }
115
- return self::get_settings_vars($id, '', $message);
116
  }
117
 
118
  public static function update_settings() {
@@ -130,7 +130,7 @@ class FrmFormsController {
130
  FrmForm::update( $id, $_POST );
131
 
132
  $message = __( 'Settings Successfully Updated', 'formidable' );
133
- return self::get_settings_vars($id, '', $message);
134
  }
135
 
136
  public static function edit_key() {
@@ -185,9 +185,9 @@ class FrmFormsController {
185
  FrmForm::update( $id, $values );
186
  $message = __( 'Form was Successfully Updated', 'formidable' );
187
  if ( defined( 'DOING_AJAX' ) ) {
188
- die( $message );
189
  }
190
- return self::get_edit_vars( $id, '', $message );
191
  }
192
  }
193
 
@@ -227,7 +227,7 @@ class FrmFormsController {
227
  $form = FrmForm::duplicate( $params['id'], $params['template'], true );
228
  $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
229
  if ( $form ) {
230
- return self::get_edit_vars($form, '', $message, true);
231
  } else {
232
  return self::display_forms_list($params, __( 'There was a problem creating new template.', 'formidable' ));
233
  }
@@ -564,7 +564,7 @@ class FrmFormsController {
564
  return $save;
565
  }
566
 
567
- private static function get_edit_vars( $id, $errors = '', $message = '', $create_link = false ) {
568
  global $frm_vars;
569
 
570
  $form = FrmForm::getOne( $id );
@@ -609,7 +609,7 @@ class FrmFormsController {
609
  }
610
  }
611
 
612
- public static function get_settings_vars( $id, $errors = '', $message = '' ) {
613
  FrmAppHelper::permission_check( 'frm_edit_forms' );
614
 
615
  global $frm_vars;
@@ -1145,8 +1145,11 @@ class FrmFormsController {
1145
  $message = $frm_settings->failed_msg;
1146
  $class = 'frm_error_style';
1147
  }
1148
- $message = apply_filters('frm_content', $message, $form, $created);
1149
- $message = '<div class="' . esc_attr( $class ) . '">' . wpautop( do_shortcode( $message ) ) . '</div>';
 
 
 
1150
  $message = apply_filters('frm_main_feedback', $message, $form, $created);
1151
 
1152
  if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
112
  if ( ! $id || ! is_numeric($id) ) {
113
  $id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
114
  }
115
+ return self::get_settings_vars( $id, array(), $message );
116
  }
117
 
118
  public static function update_settings() {
130
  FrmForm::update( $id, $_POST );
131
 
132
  $message = __( 'Settings Successfully Updated', 'formidable' );
133
+ return self::get_settings_vars( $id, array(), $message );
134
  }
135
 
136
  public static function edit_key() {
185
  FrmForm::update( $id, $values );
186
  $message = __( 'Form was Successfully Updated', 'formidable' );
187
  if ( defined( 'DOING_AJAX' ) ) {
188
+ wp_die( $message );
189
  }
190
+ return self::get_edit_vars( $id, array(), $message );
191
  }
192
  }
193
 
227
  $form = FrmForm::duplicate( $params['id'], $params['template'], true );
228
  $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
229
  if ( $form ) {
230
+ return self::get_edit_vars( $form, array(), $message, true );
231
  } else {
232
  return self::display_forms_list($params, __( 'There was a problem creating new template.', 'formidable' ));
233
  }
564
  return $save;
565
  }
566
 
567
+ private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
568
  global $frm_vars;
569
 
570
  $form = FrmForm::getOne( $id );
609
  }
610
  }
611
 
612
+ public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
613
  FrmAppHelper::permission_check( 'frm_edit_forms' );
614
 
615
  global $frm_vars;
1145
  $message = $frm_settings->failed_msg;
1146
  $class = 'frm_error_style';
1147
  }
1148
+
1149
+ $message = FrmFormsHelper::get_success_message( array(
1150
+ 'message' => $message, 'form' => $form,
1151
+ 'entry_id' => $created, 'class' => $class,
1152
+ ) );
1153
  $message = apply_filters('frm_main_feedback', $message, $form, $created);
1154
 
1155
  if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
classes/controllers/FrmHooksController.php CHANGED
@@ -142,6 +142,10 @@ class FrmHooksController {
142
  add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
143
  add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
144
 
 
 
 
 
145
  // Fields Controller
146
  add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
147
  add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
142
  add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
143
  add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
144
 
145
+ // Addons Controller
146
+ add_action('wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
147
+ add_action('wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
148
+
149
  // Fields Controller
150
  add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
151
  add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
classes/controllers/FrmSettingsController.php CHANGED
@@ -22,7 +22,12 @@ class FrmSettingsController {
22
 
23
  $uploads = wp_upload_dir();
24
  $target_path = $uploads['basedir'] . '/formidable/css';
25
- $sections = apply_filters( 'frm_add_settings_section', array() );
 
 
 
 
 
26
 
27
  $captcha_lang = FrmAppHelper::locales( 'captcha' );
28
 
22
 
23
  $uploads = wp_upload_dir();
24
  $target_path = $uploads['basedir'] . '/formidable/css';
25
+
26
+ $sections = array();
27
+ if ( apply_filters( 'frm_include_addon_page', false ) ) {
28
+ $sections['licenses'] = array( 'class' => 'FrmAddonsController', 'function' => 'show_addons' );
29
+ }
30
+ $sections = apply_filters( 'frm_add_settings_section', $sections );
31
 
32
  $captcha_lang = FrmAppHelper::locales( 'captcha' );
33
 
classes/helpers/FrmAppHelper.php CHANGED
@@ -5,12 +5,12 @@ if ( ! defined('ABSPATH') ) {
5
 
6
  class FrmAppHelper {
7
  public static $db_version = 26; //version of the database we are moving to
8
- public static $pro_db_version = 28;
9
 
10
  /**
11
  * @since 2.0
12
  */
13
- public static $plug_version = '2.0.11';
14
 
15
  /**
16
  * @since 1.07.02
@@ -30,30 +30,20 @@ class FrmAppHelper {
30
  return dirname(dirname(dirname(__FILE__)));
31
  }
32
 
33
- public static function plugin_url( $url = '' ) {
34
  //prevously FRM_URL constant
35
- if ( empty($url) ) {
36
- $url = plugins_url('', self::plugin_folder() .'/formidable.php');
37
- }
38
-
39
- if ( is_ssl() && ! preg_match( '/^https:\/\/.*\..*$/', $url ) ) {
40
- $url = str_replace( 'http://', 'https://', $url );
41
- }
42
-
43
- return $url;
44
  }
45
 
46
- public static function relative_plugin_url( $url = '' ) {
47
- $url = self::plugin_url( $url );
48
- return str_replace( array( 'https:', 'http:' ), '', $url );
49
- }
50
 
51
  /**
52
  * @return string Site URL
53
  */
54
  public static function site_url() {
55
- $url = self::plugin_url(site_url());
56
- return $url;
57
  }
58
 
59
  /**
5
 
6
  class FrmAppHelper {
7
  public static $db_version = 26; //version of the database we are moving to
8
+ public static $pro_db_version = 29;
9
 
10
  /**
11
  * @since 2.0
12
  */
13
+ public static $plug_version = '2.0.12';
14
 
15
  /**
16
  * @since 1.07.02
30
  return dirname(dirname(dirname(__FILE__)));
31
  }
32
 
33
+ public static function plugin_url() {
34
  //prevously FRM_URL constant
35
+ return plugins_url( '', self::plugin_folder() .'/formidable.php' );
 
 
 
 
 
 
 
 
36
  }
37
 
38
+ public static function relative_plugin_url() {
39
+ return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
40
+ }
 
41
 
42
  /**
43
  * @return string Site URL
44
  */
45
  public static function site_url() {
46
+ return site_url();
 
47
  }
48
 
49
  /**
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -687,6 +687,7 @@ DEFAULT_HTML;
687
  'editlink', 'id', 'key', 'ip',
688
  'siteurl', 'sitename', 'admin_email',
689
  'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
 
690
  );
691
 
692
  foreach ( $fields as $field ) {
687
  'editlink', 'id', 'key', 'ip',
688
  'siteurl', 'sitename', 'admin_email',
689
  'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
690
+ 'parent[-|_]id',
691
  );
692
 
693
  foreach ( $fields as $field ) {
classes/helpers/FrmFormsHelper.php CHANGED
@@ -24,6 +24,7 @@ class FrmFormsHelper {
24
  'onchange' => false,
25
  'exclude' => false,
26
  'class' => '',
 
27
  );
28
  $args = wp_parse_args( $args, $defaults );
29
 
@@ -37,7 +38,7 @@ class FrmFormsHelper {
37
  }
38
 
39
  $where = apply_filters('frm_forms_dropdown', $query, $field_name);
40
- $forms = FrmForm::get_published_forms( $where );
41
  $add_html = array();
42
  self::add_html_attr( $args['onchange'], 'onchange', $add_html );
43
  self::add_html_attr( $args['class'], 'class', $add_html );
@@ -49,7 +50,7 @@ class FrmFormsHelper {
49
  <?php } ?>
50
  <?php foreach ( $forms as $form ) { ?>
51
  <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
52
- echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) );
53
  ?></option>
54
  <?php } ?>
55
  </select>
@@ -118,6 +119,12 @@ class FrmFormsHelper {
118
  echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
119
  }
120
 
 
 
 
 
 
 
121
  /**
122
  * Used when a form is created
123
  */
24
  'onchange' => false,
25
  'exclude' => false,
26
  'class' => '',
27
+ 'inc_children' => 'exclude',
28
  );
29
  $args = wp_parse_args( $args, $defaults );
30
 
38
  }
39
 
40
  $where = apply_filters('frm_forms_dropdown', $query, $field_name);
41
+ $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] );
42
  $add_html = array();
43
  self::add_html_attr( $args['onchange'], 'onchange', $add_html );
44
  self::add_html_attr( $args['class'], 'class', $add_html );
50
  <?php } ?>
51
  <?php foreach ( $forms as $form ) { ?>
52
  <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
53
+ echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ;
54
  ?></option>
55
  <?php } ?>
56
  </select>
119
  echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
120
  }
121
 
122
+ public static function get_success_message( $atts ) {
123
+ $message = apply_filters( 'frm_content', $atts['message'], $atts['form'], $atts['entry_id'] );
124
+ $message = '<div class="' . esc_attr( $atts['class'] ) . '">' . wpautop( do_shortcode( $message ) ) . '</div>';
125
+ return $message;
126
+ }
127
+
128
  /**
129
  * Used when a form is created
130
  */
classes/helpers/FrmXMLHelper.php CHANGED
@@ -367,9 +367,12 @@ class FrmXMLHelper {
367
 
368
  unset($item);
369
 
 
370
  if ( $post['post_type'] == $form_action_type ) {
371
  $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
372
- $post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
 
 
373
  unset($action_control);
374
  } else if ( $post['post_type'] == 'frm_styles' ) {
375
  // Properly encode post content before inserting the post
367
 
368
  unset($item);
369
 
370
+ $post_id = false;
371
  if ( $post['post_type'] == $form_action_type ) {
372
  $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
373
+ if ( $action_control ) {
374
+ $post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
375
+ }
376
  unset($action_control);
377
  } else if ( $post['post_type'] == 'frm_styles' ) {
378
  // Properly encode post content before inserting the post
classes/models/EDD_SL_Plugin_Updater.php ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // uncomment this line for testing
4
+ //set_site_transient( 'update_plugins', null );
5
+
6
+ // Exit if accessed directly
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Allows plugins to use their own update API.
13
+ *
14
+ * @author Pippin Williamson
15
+ * @version 1.6
16
+ */
17
+ class EDD_SL_Plugin_Updater {
18
+ private $api_url = '';
19
+ private $api_data = array();
20
+ private $name = '';
21
+ private $slug = '';
22
+ private $version = '';
23
+
24
+ /**
25
+ * Class constructor.
26
+ *
27
+ * @uses plugin_basename()
28
+ * @uses hook()
29
+ *
30
+ * @param string $_api_url The URL pointing to the custom API endpoint.
31
+ * @param string $_plugin_file Path to the plugin file.
32
+ * @param array $_api_data Optional data to send with API calls.
33
+ */
34
+ public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
35
+ $this->api_url = trailingslashit( $_api_url );
36
+ $this->api_data = $_api_data;
37
+ $this->name = plugin_basename( $_plugin_file );
38
+ $this->slug = basename( $_plugin_file, '.php' );
39
+ $this->version = $_api_data['version'];
40
+
41
+ // Set up hooks.
42
+ $this->init();
43
+ add_action( 'admin_init', array( $this, 'show_changelog' ) );
44
+ }
45
+
46
+ /**
47
+ * Set up WordPress filters to hook into WP's update process.
48
+ *
49
+ * @uses add_filter()
50
+ *
51
+ * @return void
52
+ */
53
+ public function init() {
54
+
55
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
56
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
57
+
58
+ add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
59
+ }
60
+
61
+ /**
62
+ * Check for Updates at the defined API endpoint and modify the update array.
63
+ *
64
+ * This function dives into the update API just when WordPress creates its update array,
65
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
66
+ * It is reassembled from parts of the native WordPress plugin update code.
67
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
68
+ *
69
+ * @uses api_request()
70
+ *
71
+ * @param array $_transient_data Update array build by WordPress.
72
+ * @return array Modified update array with custom plugin data.
73
+ */
74
+ function check_update( $_transient_data ) {
75
+
76
+ global $pagenow;
77
+
78
+ if( ! is_object( $_transient_data ) ) {
79
+ $_transient_data = new stdClass;
80
+ }
81
+
82
+ if ( 'plugins.php' == $pagenow && is_multisite() ) {
83
+ return $_transient_data;
84
+ }
85
+
86
+ if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
87
+
88
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
89
+
90
+ if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
91
+
92
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
93
+
94
+ if ( empty( $version_info->plugin ) ) {
95
+ $version_info->plugin = $this->name;
96
+ }
97
+
98
+ $_transient_data->response[ $this->name ] = $version_info;
99
+
100
+ }
101
+
102
+ $_transient_data->last_checked = time();
103
+ $_transient_data->checked[ $this->name ] = $this->version;
104
+
105
+ }
106
+ }
107
+
108
+ return $_transient_data;
109
+ }
110
+
111
+ /**
112
+ * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
113
+ *
114
+ * @param string $file
115
+ * @param array $plugin
116
+ */
117
+ public function show_update_notification( $file, $plugin ) {
118
+
119
+ if ( ! current_user_can( 'update_plugins' ) ) {
120
+ return;
121
+ }
122
+
123
+ if ( ! is_multisite() ) {
124
+ return;
125
+ }
126
+
127
+ if ( $this->name != $file ) {
128
+ return;
129
+ }
130
+
131
+ // Remove our filter on the site transient
132
+ remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
133
+
134
+ $update_cache = get_site_transient( 'update_plugins' );
135
+
136
+ if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
137
+
138
+ $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
139
+ $version_info = get_transient( $cache_key );
140
+
141
+ if( false === $version_info ) {
142
+
143
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
144
+
145
+ set_transient( $cache_key, $version_info, 3600 );
146
+ }
147
+
148
+ if ( ! is_object( $version_info ) ) {
149
+ return;
150
+ }
151
+
152
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
153
+
154
+ $update_cache->response[ $this->name ] = $version_info;
155
+
156
+ }
157
+
158
+ $update_cache->last_checked = time();
159
+ $update_cache->checked[ $this->name ] = $this->version;
160
+
161
+ set_site_transient( 'update_plugins', $update_cache );
162
+
163
+ } else {
164
+
165
+ $version_info = $update_cache->response[ $this->name ];
166
+
167
+ }
168
+
169
+ // Restore our filter
170
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
171
+
172
+ if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
173
+
174
+ // build a plugin list row, with update notification
175
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
176
+ echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
177
+
178
+ $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
179
+
180
+ if ( empty( $version_info->download_link ) ) {
181
+ printf(
182
+ __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
183
+ esc_html( $version_info->name ),
184
+ esc_url( $changelog_link ),
185
+ esc_html( $version_info->new_version )
186
+ );
187
+ } else {
188
+ printf(
189
+ __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
190
+ esc_html( $version_info->name ),
191
+ esc_url( $changelog_link ),
192
+ esc_html( $version_info->new_version ),
193
+ esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
194
+ );
195
+ }
196
+
197
+ echo '</div></td></tr>';
198
+ }
199
+ }
200
+
201
+
202
+ /**
203
+ * Updates information on the "View version x.x details" page with custom data.
204
+ *
205
+ * @uses api_request()
206
+ *
207
+ * @param mixed $_data
208
+ * @param string $_action
209
+ * @param object $_args
210
+ * @return object $_data
211
+ */
212
+ function plugins_api_filter( $_data, $_action = '', $_args = null ) {
213
+
214
+ if ( $_action != 'plugin_information' ) {
215
+
216
+ return $_data;
217
+
218
+ }
219
+
220
+ if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
221
+
222
+ return $_data;
223
+
224
+ }
225
+
226
+ $to_send = array(
227
+ 'slug' => $this->slug,
228
+ 'is_ssl' => is_ssl(),
229
+ 'fields' => array(
230
+ 'banners' => false, // These will be supported soon hopefully
231
+ 'reviews' => false,
232
+ )
233
+ );
234
+
235
+ $api_response = $this->api_request( 'plugin_information', $to_send );
236
+
237
+ if ( false !== $api_response ) {
238
+ $_data = $api_response;
239
+ }
240
+
241
+ return $_data;
242
+ }
243
+
244
+
245
+ /**
246
+ * Disable SSL verification in order to prevent download update failures
247
+ *
248
+ * @param array $args
249
+ * @param string $url
250
+ * @return object $array
251
+ */
252
+ function http_request_args( $args, $url ) {
253
+ // If it is an https request and we are performing a package download, disable ssl verification
254
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
255
+ $args['sslverify'] = false;
256
+ }
257
+ return $args;
258
+ }
259
+
260
+ /**
261
+ * Calls the API and, if successfull, returns the object delivered by the API.
262
+ *
263
+ * @uses get_bloginfo()
264
+ * @uses wp_remote_post()
265
+ * @uses is_wp_error()
266
+ *
267
+ * @param string $_action The requested action.
268
+ * @param array $_data Parameters for the API action.
269
+ * @return false|object
270
+ */
271
+ private function api_request( $_action, $_data ) {
272
+
273
+ global $wp_version;
274
+
275
+ $data = array_merge( $this->api_data, $_data );
276
+
277
+ if ( $data['slug'] != $this->slug ) {
278
+ return;
279
+ }
280
+
281
+ if ( empty( $data['license'] ) ) {
282
+ return;
283
+ }
284
+
285
+ if ( $this->api_url == home_url() ) {
286
+ return false; // Don't allow a plugin to ping itself
287
+ }
288
+
289
+ $api_params = array(
290
+ 'edd_action' => 'get_version',
291
+ 'license' => $data['license'],
292
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
293
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
294
+ 'slug' => $data['slug'],
295
+ 'author' => $data['author'],
296
+ 'url' => home_url()
297
+ );
298
+
299
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
300
+
301
+ if ( ! is_wp_error( $request ) ) {
302
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
303
+ }
304
+
305
+ if ( $request && isset( $request->sections ) ) {
306
+ $request->sections = maybe_unserialize( $request->sections );
307
+ } else {
308
+ $request = false;
309
+ }
310
+
311
+ return $request;
312
+ }
313
+
314
+ public function show_changelog() {
315
+
316
+ if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
317
+ return;
318
+ }
319
+
320
+ if ( empty( $_REQUEST['plugin'] ) ) {
321
+ return;
322
+ }
323
+
324
+ if ( empty( $_REQUEST['slug'] ) ) {
325
+ return;
326
+ }
327
+
328
+ if ( ! current_user_can( 'update_plugins' ) ) {
329
+ wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
330
+ }
331
+
332
+ $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
333
+
334
+ if ( $response && isset( $response->sections['changelog'] ) ) {
335
+ echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
336
+ }
337
+
338
+ exit;
339
+ }
340
+
341
+ }
classes/models/FrmAddon.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ die( 'You are not allowed to call this page directly.' );
5
+ }
6
+
7
+ class FrmAddon {
8
+ public $store_url = 'http://formidablepros.com';
9
+ public $plugin_file;
10
+ public $plugin_name;
11
+ public $plugin_slug;
12
+ public $option_name;
13
+ public $version;
14
+ public $author = 'Strategy11';
15
+
16
+ public function __construct() {
17
+
18
+ if ( empty( $this->plugin_slug ) ) {
19
+ $this->plugin_slug = preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->plugin_name ) ) );
20
+ }
21
+ if ( empty( $this->option_name ) ) {
22
+ $this->option_name = 'edd_' . $this->plugin_slug . '_license_';
23
+ }
24
+
25
+ add_filter( 'frm_installed_addons', array( &$this, 'insert_installed_addon' ) );
26
+ }
27
+
28
+ public function insert_installed_addon( $plugins ) {
29
+ $plugins[ $this->plugin_slug ] = $this;
30
+ return $plugins;
31
+ }
32
+
33
+ public static function get_addon( $plugin_slug ) {
34
+ $plugins = apply_filters( 'frm_installed_addons', array() );
35
+ $plugin = false;
36
+ if ( isset( $plugins[ $plugin_slug ] ) ) {
37
+ $plugin = $plugins[ $plugin_slug ];
38
+ }
39
+ return $plugin;
40
+ }
41
+
42
+ public function edd_plugin_updater() {
43
+
44
+ // retrieve our license key from the DB
45
+ $license = trim( get_option( $this->option_name . 'key' ) );
46
+
47
+ if ( ! empty( $license ) ) {
48
+ if ( ! class_exists('EDD_SL_Plugin_Updater') ) {
49
+ include( dirname( __FILE__ ) . '/EDD_SL_EDD_SL_Plugin_Updater.php' );
50
+ }
51
+
52
+ // setup the updater
53
+ new EDD_SL_Plugin_Updater( $this->store_url, $this->plugin_file, array(
54
+ 'version' => $this->version,
55
+ 'license' => $license,
56
+ 'item_name' => $this->plugin_name,
57
+ 'author' => $this->author,
58
+ ) );
59
+ }
60
+ }
61
+
62
+ public static function activate() {
63
+ check_ajax_referer( 'frm_ajax', 'nonce' );
64
+
65
+ if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) {
66
+ wp_die( __( 'Oops! You forgot to enter your license number.', 'formidable' ) );
67
+ }
68
+
69
+ $license = stripslashes( sanitize_text_field( $_POST['license'] ) );
70
+ $plugin_slug = sanitize_text_field( $_POST['plugin'] );
71
+ $this_plugin = self::get_addon( $plugin_slug );
72
+ update_option( $this_plugin->option_name . 'key', $license );
73
+
74
+ $response = array( 'success' => false, 'message' => '' );
75
+ try{
76
+ $license_data = $this_plugin->send_mothership_request( 'activate_license', $license );
77
+
78
+ // $license_data->license will be either "valid" or "invalid"
79
+ $is_valid = 'invalid';
80
+ if ( is_array( $license_data ) && $license_data['license'] == 'valid' ) {
81
+ $is_valid = $license_data['license'];
82
+ $response['success'] = __( 'Enjoy!', 'formidable' );
83
+ } else {
84
+ $response['message'] = __( 'That license is invalid', 'formidable' );
85
+ }
86
+
87
+ update_option( $this_plugin->option_name . 'active', $is_valid );
88
+ }
89
+ catch(Exception $e) {
90
+ $response['message'] = $e->getMessage();
91
+ }
92
+
93
+ echo json_encode( $response );
94
+ wp_die();
95
+ }
96
+
97
+ public static function deactivate() {
98
+ check_ajax_referer( 'frm_ajax', 'nonce' );
99
+
100
+ $license = stripslashes( sanitize_text_field( $_POST['license'] ) );
101
+ $plugin_slug = sanitize_text_field( $_POST['plugin'] );
102
+ $this_plugin = self::get_addon( $plugin_slug );
103
+
104
+ $response = array( 'success' => false, 'message' => '' );
105
+ try{
106
+ // $license_data->license will be either "deactivated" or "failed"
107
+ $license_data = $this_plugin->send_mothership_request( 'deactivate_license', $license );
108
+ if ( is_array( $license_data ) && $license_data['license'] == 'deactivated' ) {
109
+ $response['success'] = true;
110
+ $response['message'] = __( 'That license was removed successfully', 'helpdesk' );
111
+ } else {
112
+ $response['message'] = __( 'There was an error deactivating your license.', 'formidable' );
113
+ }
114
+ }
115
+ catch ( Exception $e ) {
116
+ $response['message'] = $e->getMessage();
117
+ }
118
+
119
+ delete_option( $this_plugin->option_name . 'active' );
120
+ delete_option( $this_plugin->option_name . 'key' );
121
+
122
+ echo json_encode( $response );
123
+ wp_die();
124
+ }
125
+
126
+ public function send_mothership_request( $action, $license ) {
127
+ $api_params = array(
128
+ 'edd_action' => $action,
129
+ 'license' => $license,
130
+ 'item_name' => urlencode( $this->plugin_name ),
131
+ 'url' => home_url(),
132
+ );
133
+
134
+ $arg_array = array(
135
+ 'body' => $api_params,
136
+ 'timeout' => 15,
137
+ 'sslverify' => false,
138
+ 'user-agent' => $this->plugin_slug . '/' . $this->version . '; ' . get_bloginfo( 'url' ),
139
+ );
140
+
141
+ $resp = wp_remote_post( $this->store_url, $arg_array );
142
+ $body = wp_remote_retrieve_body( $resp );
143
+
144
+ if ( is_wp_error( $resp ) ) {
145
+ $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>');
146
+ if ( is_wp_error( $resp ) ) {
147
+ $message .= ' '. $resp->get_error_message();
148
+ }
149
+ return $message;
150
+ } else if ( $body == 'error' || is_wp_error( $body ) ) {
151
+ return __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' );
152
+ } else {
153
+ $json_res = json_decode( $body, true );
154
+ if ( null !== $json_res ) {
155
+ if ( is_array( $json_res ) && isset( $json_res['error'] ) ) {
156
+ return $json_res['error'];
157
+ } else {
158
+ return $json_res;
159
+ }
160
+ } else if ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) {
161
+ return sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] .' '. $resp['body'] );
162
+ }
163
+ }
164
+
165
+ return __( 'Your License Key was invalid', 'formidable' );
166
+ }
167
+
168
+ }
classes/models/FrmEntry.php CHANGED
@@ -525,6 +525,15 @@ class FrmEntry {
525
  FrmAppHelper::sanitize_request( $sanitize_method, $values );
526
  }
527
 
 
 
 
 
 
 
 
 
 
528
  public static function validate( $values, $exclude = false ) {
529
  _deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryValidate::validate' );
530
  return FrmEntryValidate::validate( $values, $exclude );
525
  FrmAppHelper::sanitize_request( $sanitize_method, $values );
526
  }
527
 
528
+ /**
529
+ * @param string $key
530
+ * @return int entry_id
531
+ */
532
+ public static function get_id_by_key( $key ) {
533
+ $entry_id = FrmDb::get_var( 'frm_items', array( 'item_key' => sanitize_title( $key ) ) );
534
+ return $entry_id;
535
+ }
536
+
537
  public static function validate( $values, $exclude = false ) {
538
  _deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryValidate::validate' );
539
  return FrmEntryValidate::validate( $values, $exclude );
classes/models/FrmEntryFormat.php CHANGED
@@ -64,7 +64,7 @@ class FrmEntryFormat {
64
 
65
  if ( $atts['clickable'] ) {
66
  $content = make_clickable( $content );
67
- }
68
 
69
  return $content;
70
  }
@@ -182,7 +182,7 @@ class FrmEntryFormat {
182
  $data = $default_data;
183
 
184
  if ( isset( $atts['entry']->description ) ) {
185
- $data = maybe_unserialize( $atts['entry']->description );
186
  } else if ( $atts['default_email'] ) {
187
  $data = array(
188
  'browser' => '[browser]',
64
 
65
  if ( $atts['clickable'] ) {
66
  $content = make_clickable( $content );
67
+ }
68
 
69
  return $content;
70
  }
182
  $data = $default_data;
183
 
184
  if ( isset( $atts['entry']->description ) ) {
185
+ $data = (array) maybe_unserialize( $atts['entry']->description );
186
  } else if ( $atts['default_email'] ) {
187
  $data = array(
188
  'browser' => '[browser]',
classes/models/FrmEntryMeta.php CHANGED
@@ -273,7 +273,7 @@ class FrmEntryMeta {
273
  $args = wp_parse_args($args, $defaults);
274
 
275
  $query = array();
276
- self::get_ids_query($where, $order_by, $limit, $unique, $args, $query);
277
  $query = implode(' ', $query);
278
 
279
  $cache_key = 'ids_'. maybe_serialize($where) . $order_by . 'l'. $limit . 'u'. $unique . maybe_serialize($args);
@@ -287,10 +287,19 @@ class FrmEntryMeta {
287
  * @param string $order_by
288
  * @param string $limit
289
  */
290
- private static function get_ids_query($where, $order_by, $limit, $unique, $args, array &$query) {
291
  global $wpdb;
292
  $query[] = 'SELECT';
293
- $query[] = $unique ? 'DISTINCT(it.item_id)' : 'it.item_id';
 
 
 
 
 
 
 
 
 
294
  $query[] = 'FROM '. $wpdb->prefix .'frm_item_metas it LEFT OUTER JOIN '. $wpdb->prefix .'frm_fields fi ON it.field_id=fi.id';
295
 
296
  $query[] = 'INNER JOIN '. $wpdb->prefix .'frm_items e ON (e.id=it.item_id)';
273
  $args = wp_parse_args($args, $defaults);
274
 
275
  $query = array();
276
+ self::get_ids_query($where, $order_by, $limit, $unique, $args, $query );
277
  $query = implode(' ', $query);
278
 
279
  $cache_key = 'ids_'. maybe_serialize($where) . $order_by . 'l'. $limit . 'u'. $unique . maybe_serialize($args);
287
  * @param string $order_by
288
  * @param string $limit
289
  */
290
+ private static function get_ids_query($where, $order_by, $limit, $unique, $args, array &$query ) {
291
  global $wpdb;
292
  $query[] = 'SELECT';
293
+
294
+ $defaults = array( 'return_parent_id' => false );
295
+ $args = array_merge( $defaults, $args );
296
+
297
+ if ( $args['return_parent_id'] ) {
298
+ $query[] = $unique ? 'DISTINCT(e.parent_item_id)' : 'e.parent_item_id';
299
+ } else {
300
+ $query[] = $unique ? 'DISTINCT(it.item_id)' : 'it.item_id';
301
+ }
302
+
303
  $query[] = 'FROM '. $wpdb->prefix .'frm_item_metas it LEFT OUTER JOIN '. $wpdb->prefix .'frm_fields fi ON it.field_id=fi.id';
304
 
305
  $query[] = 'INNER JOIN '. $wpdb->prefix .'frm_items e ON (e.id=it.item_id)';
classes/models/FrmField.php CHANGED
@@ -122,8 +122,7 @@ class FrmField {
122
  // If this is a repeating section, create new form
123
  if ( $field->type == 'divider' && self::is_option_true( $field, 'repeat' ) ) {
124
  // create the repeatable form
125
- $repeat_form_values = FrmFormsHelper::setup_new_vars( array( 'parent_form_id' => $form_id ) );
126
- $new_repeat_form_id = FrmForm::create( $repeat_form_values );
127
 
128
  // Save old form_select
129
  $old_repeat_form_id = $field->field_options['form_select'];
@@ -675,4 +674,13 @@ class FrmField {
675
  }
676
  return ( $is_repeating_field && self::is_option_true( $field, 'repeat' ) );
677
  }
 
 
 
 
 
 
 
 
 
678
  }
122
  // If this is a repeating section, create new form
123
  if ( $field->type == 'divider' && self::is_option_true( $field, 'repeat' ) ) {
124
  // create the repeatable form
125
+ $new_repeat_form_id = apply_filters( 'frm_create_repeat_form', 0, array( 'parent_form_id' => $form_id, 'field_name' => $field->name ) );
 
126
 
127
  // Save old form_select
128
  $old_repeat_form_id = $field->field_options['form_select'];
674
  }
675
  return ( $is_repeating_field && self::is_option_true( $field, 'repeat' ) );
676
  }
677
+
678
+ /**
679
+ * @param string $key
680
+ * @return int field id
681
+ */
682
+ public static function get_id_by_key( $key ) {
683
+ $id = FrmDb::get_var( 'frm_fields', array( 'field_key' => sanitize_title( $key ) ) );
684
+ return $id;
685
+ }
686
  }
classes/models/FrmForm.php CHANGED
@@ -527,6 +527,7 @@ class FrmForm {
527
  /**
528
  * Get all published forms
529
  * @since 2.0
 
530
  */
531
  public static function get_published_forms( $query = array(), $limit = 999, $inc_children = 'exclude' ) {
532
  $query['is_template'] = 0;
527
  /**
528
  * Get all published forms
529
  * @since 2.0
530
+ * @return array of forms
531
  */
532
  public static function get_published_forms( $query = array(), $limit = 999, $inc_children = 'exclude' ) {
533
  $query['is_template'] = 0;
classes/models/FrmFormAction.php CHANGED
@@ -626,4 +626,13 @@ class FrmFormAction {
626
  'limit' => 0,
627
  );
628
  }
 
 
 
 
 
 
 
 
 
629
  }
626
  'limit' => 0,
627
  );
628
  }
629
+
630
+ public static function trigger_labels() {
631
+ return apply_filters( 'frm_action_triggers', array(
632
+ 'create' => __( 'Create', 'formidable' ),
633
+ 'update' => __( 'Update', 'formidable' ),
634
+ 'delete' => __( 'Delete', 'formidable' ),
635
+ 'import' => __( 'Import', 'formidable' ),
636
+ ) );
637
+ }
638
  }
classes/models/FrmSettings.php CHANGED
@@ -5,7 +5,6 @@ class FrmSettings{
5
  public $menu;
6
  public $mu_menu;
7
  public $preview_page_id;
8
- public $lock_keys;
9
  public $use_html;
10
  public $jquery_css;
11
  public $accordion_js;
@@ -79,7 +78,6 @@ class FrmSettings{
79
  'menu' => 'Formidable',
80
  'mu_menu' => 0,
81
  'preview_page_id' => 0,
82
- 'lock_keys' => false,
83
  'use_html' => true,
84
  'jquery_css' => false,
85
  'accordion_js' => false,
@@ -193,7 +191,6 @@ class FrmSettings{
193
 
194
  $this->load_style = $params['frm_load_style'];
195
  $this->preview_page_id = (int) $params['frm-preview-page-id'];
196
- $this->lock_keys = isset($params['frm_lock_keys']) ? $params['frm_lock_keys'] : 0;
197
 
198
  $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
199
  //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
5
  public $menu;
6
  public $mu_menu;
7
  public $preview_page_id;
 
8
  public $use_html;
9
  public $jquery_css;
10
  public $accordion_js;
78
  'menu' => 'Formidable',
79
  'mu_menu' => 0,
80
  'preview_page_id' => 0,
 
81
  'use_html' => true,
82
  'jquery_css' => false,
83
  'accordion_js' => false,
191
 
192
  $this->load_style = $params['frm_load_style'];
193
  $this->preview_page_id = (int) $params['frm-preview-page-id'];
 
194
 
195
  $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
196
  //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
classes/models/FrmStyle.php CHANGED
@@ -306,6 +306,7 @@ class FrmStyle {
306
  'theme_css' => 'ui-lightness',
307
  'theme_name' => 'UI Lightness',
308
 
 
309
  'form_width' => '100%',
310
  'form_align' => 'left',
311
  'direction' => is_rtl() ? 'rtl' : 'ltr',
306
  'theme_css' => 'ui-lightness',
307
  'theme_name' => 'UI Lightness',
308
 
309
+ 'center_form' => '',
310
  'form_width' => '100%',
311
  'form_align' => 'left',
312
  'direction' => is_rtl() ? 'rtl' : 'ltr',
classes/views/addons/settings.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e( 'Plugin Licenses', 'formidable' ); ?></h2>
3
+
4
+ <?php
5
+
6
+ foreach ( $plugins as $slug => $plugin ) {
7
+ $license = get_option( 'edd_'. $slug .'_license_key' );
8
+ $status = get_option( 'edd_'. $slug .'_license_active' );
9
+ $activate = ( false !== $license && $status == 'valid' ) ? 'deactivate' : 'activate';
10
+ $icon_class = ( empty( $license ) ) ? 'frm_hidden' : '';
11
+ ?>
12
+
13
+ <div class="edd_frm_license_row">
14
+ <label class="frm_left_label" for="edd_<?php echo esc_attr( $slug ) ?>_license_key"><?php echo FrmAppHelper::kses( $plugin->plugin_name ) ?></label>
15
+ <div class="edd_frm_authorized alignleft <?php echo esc_attr( $activate == 'activate' ) ? 'frm_hidden' : '' ?>">
16
+ <span class="edd_frm_license"><?php echo esc_html( $license ); ?></span>
17
+ <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon frm_inactive_icon"></span>
18
+ <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr( $slug ) ?>" name="edd_<?php echo esc_attr( $slug ) ?>_license_deactivate" value="<?php esc_attr_e( 'Deactivate', 'formidable' ) ?>"/>
19
+ <p class="frm_license_msg"></p>
20
+ </div>
21
+ <div class="edd_frm_unauthorized alignleft <?php echo esc_attr( $activate == 'deactivate' ) ? 'frm_hidden' : '' ?>">
22
+ <input id="edd_<?php echo esc_attr( $slug ) ?>_license_key" name="edd_<?php echo esc_attr( $slug ) ?>_license_key" type="text" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
23
+ <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon <?php echo esc_attr( $icon_class ); ?>"></span>
24
+ <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr( $slug ) ?>" name="edd_<?php echo esc_attr( $slug ) ?>_license_activate" value="<?php esc_attr_e( 'Activate', 'formidable' ) ?>"/>
25
+ <p class="frm_license_msg"></p>
26
+ </div>
27
+
28
+ </div>
29
+ <?php } ?>
30
+
31
+ </div>
classes/views/frm-entries/form.php CHANGED
@@ -34,7 +34,7 @@ if ( $values['fields'] ) {
34
  }
35
 
36
  $frm_settings = FrmAppHelper::get_settings();
37
- if ( FrmAppHelper::is_admin() && ! $frm_settings->lock_keys ) { ?>
38
  <div class="frm_form_field form-field">
39
  <label class="frm_primary_label"><?php _e( 'Entry Key', 'formidable' ) ?></label>
40
  <input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" />
34
  }
35
 
36
  $frm_settings = FrmAppHelper::get_settings();
37
+ if ( FrmAppHelper::is_admin() ) { ?>
38
  <div class="frm_form_field form-field">
39
  <label class="frm_primary_label"><?php _e( 'Entry Key', 'formidable' ) ?></label>
40
  <input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" />
classes/views/frm-form-actions/_action_inside.php CHANGED
@@ -33,12 +33,8 @@ if ( count( $action_control->action_options['event'] ) == 1 || $action_control->
33
  <p><label class="frm_left_label"><?php _e( 'Trigger this action after', 'formidable' ) ?></label>
34
  <select name="<?php echo esc_attr( $action_control->get_field_name('event') ) ?>[]" multiple="multiple" class="frm_multiselect" id="<?php echo esc_attr( $action_control->get_field_id('event') ) ?>">
35
  <?php
36
- $event_labels = apply_filters( 'frm_action_triggers', array(
37
- 'create' => __( 'Create', 'formidable' ),
38
- 'update' => __( 'Update', 'formidable' ),
39
- 'delete' => __( 'Delete', 'formidable' ),
40
- ) );
41
 
 
42
  foreach ( $action_control->action_options['event'] as $event ) { ?>
43
  <option value="<?php echo esc_attr( $event ) ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo isset( $event_labels[ $event ] ) ? $event_labels[ $event ] : $event; ?></option>
44
  <?php
33
  <p><label class="frm_left_label"><?php _e( 'Trigger this action after', 'formidable' ) ?></label>
34
  <select name="<?php echo esc_attr( $action_control->get_field_name('event') ) ?>[]" multiple="multiple" class="frm_multiselect" id="<?php echo esc_attr( $action_control->get_field_id('event') ) ?>">
35
  <?php
 
 
 
 
 
36
 
37
+ $event_labels = FrmFormAction::trigger_labels();
38
  foreach ( $action_control->action_options['event'] as $event ) { ?>
39
  <option value="<?php echo esc_attr( $event ) ?>" <?php echo in_array( $event, (array) $form_action->post_content['event'] ) ? ' selected="selected"' : ''; ?> ><?php echo isset( $event_labels[ $event ] ) ? $event_labels[ $event ] : $event; ?></option>
40
  <?php
classes/views/frm-forms/add_field.php CHANGED
@@ -210,11 +210,7 @@ if ( $display['options'] ) { ?>
210
  <?php _e( 'Field Key', 'formidable' ) ?>
211
  </td>
212
  <td>
213
- <div class="<?php echo $frm_settings->lock_keys ? 'frm_field_key' : 'frm_ipe_field_key" title="'. esc_attr( __( 'Click to edit.', 'formidable' ) ); ?>" ><?php echo esc_html( $field['field_key'] ); ?></div>
214
- <?php if ( ! $frm_settings->lock_keys ) { ?>
215
- <input type="hidden" name="field_options[field_key_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['field_key'] ); ?>" />
216
- <?php } ?>
217
- </div>
218
  </td>
219
  </tr>
220
 
210
  <?php _e( 'Field Key', 'formidable' ) ?>
211
  </td>
212
  <td>
213
+ <input type="text" name="field_options[field_key_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['field_key'] ); ?>" />
 
 
 
 
214
  </td>
215
  </tr>
216
 
classes/views/frm-forms/settings.php CHANGED
@@ -32,8 +32,14 @@
32
  <li <?php echo ($a == 'advanced_settings') ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li>
33
  <li <?php echo ($a == 'email_settings') ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li>
34
  <li <?php echo ($a == 'html_settings') ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li>
35
- <?php foreach ( $sections as $sec_name => $section ) { ?>
36
- <li <?php echo ($a == $sec_name .'_settings') ? 'class="tabs active"' : '' ?>><a href="#<?php echo esc_attr( $sec_name ) ?>_settings"><?php echo ucfirst($sec_name) ?></a></li>
 
 
 
 
 
 
37
  <?php } ?>
38
  </ul>
39
  </div>
@@ -100,7 +106,6 @@
100
  </td>
101
  </tr>
102
  <?php } ?>
103
- <?php do_action('frm_additional_form_options', $values); ?>
104
  </table>
105
 
106
  <!--AJAX Section-->
@@ -159,7 +164,16 @@
159
  </tr>
160
  <?php do_action('frm_add_form_msg_options', $values); ?>
161
  </table>
162
- </div>
 
 
 
 
 
 
 
 
 
163
 
164
 
165
  <div id="frm_notification_settings" class="frm_email_settings email_settings tabs-panel widgets-holder-wrap <?php echo ($a == 'email_settings') ? ' frm_block' : ' frm_hidden'; ?>">
@@ -223,8 +237,13 @@
223
  </div>
224
  </div>
225
 
226
- <?php foreach ( $sections as $sec_name => $section ) { ?>
227
- <div id="<?php echo esc_attr( $sec_name ) ?>_settings" class="tabs-panel <?php echo ($a == $sec_name .'_settings') ? ' frm_block' : ' frm_hidden'; ?>"><?php
 
 
 
 
 
228
  if ( isset( $section['class'] ) ) {
229
  call_user_func( array( $section['class'], $section['function'] ), $values );
230
  } else {
32
  <li <?php echo ($a == 'advanced_settings') ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li>
33
  <li <?php echo ($a == 'email_settings') ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li>
34
  <li <?php echo ($a == 'html_settings') ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li>
35
+ <?php foreach ( $sections as $key => $section ) {
36
+ if ( isset( $section['name'] ) ) {
37
+ $sec_name = $section['name'];
38
+ $sec_anchor = $section['anchor'];
39
+ } else {
40
+ $sec_anchor = $sec_name = $key;
41
+ } ?>
42
+ <li <?php echo ($a == $sec_anchor .'_settings') ? 'class="tabs active"' : '' ?>><a href="#<?php echo esc_attr( $sec_anchor ) ?>_settings"><?php echo ucfirst($sec_name) ?></a></li>
43
  <?php } ?>
44
  </ul>
45
  </div>
106
  </td>
107
  </tr>
108
  <?php } ?>
 
109
  </table>
110
 
111
  <!--AJAX Section-->
164
  </tr>
165
  <?php do_action('frm_add_form_msg_options', $values); ?>
166
  </table>
167
+
168
+ <!--Misc Section-->
169
+ <?php if ( has_action( 'frm_additional_form_options' ) ) { ?>
170
+ <h3><?php _e( 'Miscellaneous', 'formidable' ); ?></h3>
171
+ <table class="form-table">
172
+ <?php do_action('frm_additional_form_options', $values); ?>
173
+ </table>
174
+ <?php } ?>
175
+
176
+ </div>
177
 
178
 
179
  <div id="frm_notification_settings" class="frm_email_settings email_settings tabs-panel widgets-holder-wrap <?php echo ($a == 'email_settings') ? ' frm_block' : ' frm_hidden'; ?>">
237
  </div>
238
  </div>
239
 
240
+ <?php foreach ( $sections as $key => $section ) {
241
+ if ( isset( $section['anchor'] ) ) {
242
+ $sec_anchor = $section['anchor'];
243
+ } else {
244
+ $sec_anchor = $key;
245
+ } ?>
246
+ <div id="<?php echo esc_attr( $sec_anchor ) ?>_settings" class="tabs-panel <?php echo ($a == $sec_anchor .'_settings') ? ' frm_block' : ' frm_hidden'; ?>"><?php
247
  if ( isset( $section['class'] ) ) {
248
  call_user_func( array( $section['class'], $section['function'] ), $values );
249
  } else {
classes/views/frm-statistics/list.php CHANGED
@@ -6,12 +6,12 @@
6
  </h2>
7
 
8
  <?php
9
- if ( $form ) {
10
- FrmAppController::get_form_nav( $form, true );
11
- }
12
- require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' );
13
 
14
- FrmAppHelper::update_message( __( 'view reports and statistics on your saved entries', 'formidable' ) );
15
  ?>
16
 
17
  <img class="frm_no_reports" src="http://fp.strategy11.com/wp-content/themes/formidablepro/images/reports1.png" alt="Reports"/>
6
  </h2>
7
 
8
  <?php
9
+ if ( $form ) {
10
+ FrmAppController::get_form_nav( $form, true );
11
+ }
12
+ require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' );
13
 
14
+ FrmAppHelper::update_message( __( 'view reports and statistics on your saved entries', 'formidable' ) );
15
  ?>
16
 
17
  <img class="frm_no_reports" src="http://fp.strategy11.com/wp-content/themes/formidablepro/images/reports1.png" alt="Reports"/>
classes/views/styles/_general.php CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  <div class="field-group clearfix frm-first-row">
2
  <label><?php _e( 'Alignment', 'formidable' ) ?></label>
3
  <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align">
1
+ <p>
2
+ <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> />
3
+ <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span>
4
+ </label>
5
+ </p>
6
+
7
  <div class="field-group clearfix frm-first-row">
8
  <label><?php _e( 'Alignment', 'formidable' ) ?></label>
9
  <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align">
css/_single_theme.css.php CHANGED
@@ -51,6 +51,9 @@ if ( ! isset($collapse_icon) ) {
51
  <?php if ( 'rtl' == $direction ) { ?>
52
  unicode-bidi:embed;
53
  <?php } ?>
 
 
 
54
  }
55
 
56
  .<?php echo $style_class ?>,
@@ -58,6 +61,12 @@ if ( ! isset($collapse_icon) ) {
58
  text-align:<?php echo $form_align . $important ?>;
59
  }
60
 
 
 
 
 
 
 
61
  .<?php echo $style_class ?> fieldset{
62
  border:<?php echo $fieldset ?> solid #<?php echo $fieldset_color . $important ?>;
63
  margin:0;
@@ -173,7 +182,7 @@ if ( ! isset($collapse_icon) ) {
173
  }
174
 
175
  /* Form description */
176
- .<?php echo $style_class ?> .frm-show-form > div.frm_description p{
177
  font-size:<?php echo $form_desc_size . $important ?>;
178
  color:#<?php echo $form_desc_color . $important ?>;
179
  }
@@ -331,6 +340,16 @@ if ( ! isset($collapse_icon) ) {
331
  box-shadow:0 1px 1px rgba(0, 0, 0, 0.075) inset;
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
334
  .<?php echo $style_class ?> input[type=text],
335
  .<?php echo $style_class ?> input[type=password],
336
  .<?php echo $style_class ?> input[type=email],
@@ -448,14 +467,15 @@ if ( ! $submit_style ) { ?>
448
  .<?php echo $style_class ?>.frm_login_form input[type=submit]{
449
  width:<?php echo ($submit_width == '' ? 'auto' : $submit_width) . $important ?>;
450
  font-family:<?php echo stripslashes($font) ?>;
451
- font-size:<?php echo $submit_font_size; ?>;
452
  height:<?php echo $submit_height . $important ?>;
453
  line-height:normal<?php echo $important ?>;
454
  text-align:center;
455
  background:#<?php echo $submit_bg_color;
456
  if ( ! empty($submit_bg_img) ) {
457
  echo ' url('. $submit_bg_img .')';
458
- } ?>;
 
459
  border-width:<?php echo $submit_border_width ?>;
460
  border-color:#<?php echo $submit_border_color . $important ?>;
461
  border-style:solid;
@@ -496,7 +516,7 @@ if ( ! $submit_style ) { ?>
496
 
497
  .<?php echo $style_class ?> input[type=submit]:focus,
498
  .<?php echo $style_class ?> .frm_submit input[type=button]:focus,
499
- .<?php echo $style_class ?>.frm_login_form input[type=submit]:focus.
500
  .<?php echo $style_class ?> input[type=submit]:active,
501
  .<?php echo $style_class ?> .frm_submit input[type=button]:active,
502
  .<?php echo $style_class ?>.frm_login_form input[type=submit]:active{
@@ -690,7 +710,7 @@ if ( ! $submit_style ) { ?>
690
  font-family:<?php echo stripslashes($font) . $important ?>;
691
  font-weight:<?php echo $submit_weight . $important ?>;
692
  color:#<?php echo $submit_text_color . $important ?>;
693
- background:#<?php echo $submit_bg_color ?>;
694
  border-width:<?php echo $submit_border_width ?>;
695
  border-color:#<?php echo $submit_border_color . $important ?>;
696
  }
@@ -707,8 +727,12 @@ if ( ! $submit_style ) { ?>
707
 
708
  .<?php echo $style_class ?> .frm_form_field.frm_half,
709
  .<?php echo $style_class ?> .frm_form_field.frm_third,
 
710
  .<?php echo $style_class ?> .frm_form_field.frm_fourth,
711
  .<?php echo $style_class ?> .frm_form_field.frm_fifth,
 
 
 
712
  .<?php echo $style_class ?> .frm_form_field.frm_inline,
713
  .<?php echo $style_class ?> .frm_form_field.frm_left_half,
714
  .<?php echo $style_class ?> .frm_form_field.frm_left_third,
@@ -719,13 +743,9 @@ if ( ! $submit_style ) { ?>
719
  .<?php echo $style_class ?> .frm_form_field.frm_first_half,
720
  .<?php echo $style_class ?> .frm_form_field.frm_first_third,
721
  .<?php echo $style_class ?> .frm_form_field.frm_first_two_thirds,
722
- .<?php echo $style_class ?> .frm_form_field.frm_two_thirds.frm_first,
723
  .<?php echo $style_class ?> .frm_form_field.frm_first_fourth,
724
  .<?php echo $style_class ?> .frm_form_field.frm_first_fifth,
725
- .<?php echo $style_class ?> .frm_form_field.frm_first_inline{
726
- float:right;
727
- }
728
-
729
  .<?php echo $style_class ?> .frm_form_field.frm_right_half,
730
  .<?php echo $style_class ?> .frm_form_field.frm_right_third,
731
  .<?php echo $style_class ?> .frm_form_field.frm_right_two_thirds,
@@ -737,51 +757,28 @@ if ( ! $submit_style ) { ?>
737
  .<?php echo $style_class ?> .frm_form_field.frm_last_two_thirds,
738
  .<?php echo $style_class ?> .frm_form_field.frm_last_fourth,
739
  .<?php echo $style_class ?> .frm_form_field.frm_last_fifth,
740
- .<?php echo $style_class ?> .frm_form_field.frm_last_inline,
741
- .<?php echo $style_class ?> .frm_form_field.frm_last{
742
- float:left;
 
 
743
  }
744
 
745
  .<?php echo $style_class ?> .frm_form_field.frm_left_half,
746
  .<?php echo $style_class ?> .frm_form_field.frm_first_half,
747
- .<?php echo $style_class ?> .frm_form_field.frm_half.frm_first{
748
- margin-left:4%;
749
- margin-right:0
750
- }
751
-
752
  .<?php echo $style_class ?> .frm_form_field.frm_left_third,
753
  .<?php echo $style_class ?> .frm_form_field.frm_first_third,
754
- .<?php echo $style_class ?> .frm_form_field.frm_third,
755
- .<?php echo $style_class ?> .frm_form_field.frm_left_two_thirds,
756
  .<?php echo $style_class ?> .frm_form_field.frm_first_two_thirds,
757
- .<?php echo $style_class ?> .frm_form_field.frm_two_thirds{
758
- margin-right:0;
759
- margin-left:5%;
760
- }
761
-
762
  .<?php echo $style_class ?> .frm_form_field.frm_left_fourth,
763
- .<?php echo $style_class ?> .frm_form_field.frm_fourth,
764
- .<?php echo $style_class ?> .frm_form_field.frm_first_fourth{
765
- margin-right:0;
766
- margin-left:4%;
767
- }
768
-
769
  .<?php echo $style_class ?> .frm_form_field.frm_left_fifth,
770
- .<?php echo $style_class ?> .frm_form_field.frm_fifth,
771
- .<?php echo $style_class ?> .frm_form_field.frm_first_fifth{
772
- margin-right:0;
773
- margin-left:5%;
774
- }
775
-
776
  .<?php echo $style_class ?> .frm_form_field.frm_left_inline,
777
- .<?php echo $style_class ?> .frm_form_field.frm_first_inline,
778
- .<?php echo $style_class ?> .frm_form_field.frm_inline{
779
  margin-right:0;
780
- margin-left:4%;
781
- }
782
-
783
- .frm_form_field.frm_last{
784
- margin-left:0;
785
  }
786
 
787
  .<?php echo $style_class ?> .frm_grid .frm_primary_label,
51
  <?php if ( 'rtl' == $direction ) { ?>
52
  unicode-bidi:embed;
53
  <?php } ?>
54
+ <?php if ( $center_form ) { ?>
55
+ margin:0 auto;
56
+ <?php } ?>
57
  }
58
 
59
  .<?php echo $style_class ?>,
61
  text-align:<?php echo $form_align . $important ?>;
62
  }
63
 
64
+ <?php if ( $center_form ) {?>
65
+ .frm_inline_form.<?php echo $style_class ?> form{
66
+ text-align:center;
67
+ }
68
+ <?php } ?>
69
+
70
  .<?php echo $style_class ?> fieldset{
71
  border:<?php echo $fieldset ?> solid #<?php echo $fieldset_color . $important ?>;
72
  margin:0;
182
  }
183
 
184
  /* Form description */
185
+ .<?php echo $style_class ?> .frm-show-form div.frm_description p{
186
  font-size:<?php echo $form_desc_size . $important ?>;
187
  color:#<?php echo $form_desc_color . $important ?>;
188
  }
340
  box-shadow:0 1px 1px rgba(0, 0, 0, 0.075) inset;
341
  }
342
 
343
+ .<?php echo $style_class ?> input[type=file]::-webkit-file-upload-button{
344
+ color:#<?php echo $text_color . $important ?>;
345
+ background-color:#<?php echo $bg_color . $important; ?>;
346
+ padding:<?php echo $field_pad . $important ?>;
347
+ border-radius:<?php echo $border_radius . $important ?>;
348
+ border-color:#<?php echo $border_color . $important ?>;
349
+ border-width:<?php echo $field_border_width . $important ?>;
350
+ border-style:<?php echo $field_border_style . $important ?>;
351
+ }
352
+
353
  .<?php echo $style_class ?> input[type=text],
354
  .<?php echo $style_class ?> input[type=password],
355
  .<?php echo $style_class ?> input[type=email],
467
  .<?php echo $style_class ?>.frm_login_form input[type=submit]{
468
  width:<?php echo ($submit_width == '' ? 'auto' : $submit_width) . $important ?>;
469
  font-family:<?php echo stripslashes($font) ?>;
470
+ font-size:<?php echo $submit_font_size . $important; ?>;
471
  height:<?php echo $submit_height . $important ?>;
472
  line-height:normal<?php echo $important ?>;
473
  text-align:center;
474
  background:#<?php echo $submit_bg_color;
475
  if ( ! empty($submit_bg_img) ) {
476
  echo ' url('. $submit_bg_img .')';
477
+ }
478
+ echo $important; ?>;
479
  border-width:<?php echo $submit_border_width ?>;
480
  border-color:#<?php echo $submit_border_color . $important ?>;
481
  border-style:solid;
516
 
517
  .<?php echo $style_class ?> input[type=submit]:focus,
518
  .<?php echo $style_class ?> .frm_submit input[type=button]:focus,
519
+ .<?php echo $style_class ?>.frm_login_form input[type=submit]:focus,
520
  .<?php echo $style_class ?> input[type=submit]:active,
521
  .<?php echo $style_class ?> .frm_submit input[type=button]:active,
522
  .<?php echo $style_class ?>.frm_login_form input[type=submit]:active{
710
  font-family:<?php echo stripslashes($font) . $important ?>;
711
  font-weight:<?php echo $submit_weight . $important ?>;
712
  color:#<?php echo $submit_text_color . $important ?>;
713
+ background:#<?php echo $submit_bg_color . $important ?>;
714
  border-width:<?php echo $submit_border_width ?>;
715
  border-color:#<?php echo $submit_border_color . $important ?>;
716
  }
727
 
728
  .<?php echo $style_class ?> .frm_form_field.frm_half,
729
  .<?php echo $style_class ?> .frm_form_field.frm_third,
730
+ .<?php echo $style_class ?> .frm_form_field.frm_two_thirds,
731
  .<?php echo $style_class ?> .frm_form_field.frm_fourth,
732
  .<?php echo $style_class ?> .frm_form_field.frm_fifth,
733
+ .<?php echo $style_class ?> .frm_form_field.frm_sixth,
734
+ .<?php echo $style_class ?> .frm_form_field.frm_seventh,
735
+ .<?php echo $style_class ?> .frm_form_field.frm_eighth,
736
  .<?php echo $style_class ?> .frm_form_field.frm_inline,
737
  .<?php echo $style_class ?> .frm_form_field.frm_left_half,
738
  .<?php echo $style_class ?> .frm_form_field.frm_left_third,
743
  .<?php echo $style_class ?> .frm_form_field.frm_first_half,
744
  .<?php echo $style_class ?> .frm_form_field.frm_first_third,
745
  .<?php echo $style_class ?> .frm_form_field.frm_first_two_thirds,
 
746
  .<?php echo $style_class ?> .frm_form_field.frm_first_fourth,
747
  .<?php echo $style_class ?> .frm_form_field.frm_first_fifth,
748
+ .<?php echo $style_class ?> .frm_form_field.frm_first_inline,
 
 
 
749
  .<?php echo $style_class ?> .frm_form_field.frm_right_half,
750
  .<?php echo $style_class ?> .frm_form_field.frm_right_third,
751
  .<?php echo $style_class ?> .frm_form_field.frm_right_two_thirds,
757
  .<?php echo $style_class ?> .frm_form_field.frm_last_two_thirds,
758
  .<?php echo $style_class ?> .frm_form_field.frm_last_fourth,
759
  .<?php echo $style_class ?> .frm_form_field.frm_last_fifth,
760
+ .<?php echo $style_class ?> .frm_form_field.frm_last_inline{
761
+ float:right;
762
+ margin-right:2.5%;
763
+ margin-left:0;
764
+ clear:none;
765
  }
766
 
767
  .<?php echo $style_class ?> .frm_form_field.frm_left_half,
768
  .<?php echo $style_class ?> .frm_form_field.frm_first_half,
769
+ .<?php echo $style_class ?> .frm_form_field.frm_first,
 
 
 
 
770
  .<?php echo $style_class ?> .frm_form_field.frm_left_third,
771
  .<?php echo $style_class ?> .frm_form_field.frm_first_third,
 
 
772
  .<?php echo $style_class ?> .frm_form_field.frm_first_two_thirds,
773
+ .<?php echo $style_class ?> .frm_form_field.frm_left_two_thirds,
774
+ .<?php echo $style_class ?> .frm_form_field.frm_first_fourth,
 
 
 
775
  .<?php echo $style_class ?> .frm_form_field.frm_left_fourth,
 
 
 
 
 
 
776
  .<?php echo $style_class ?> .frm_form_field.frm_left_fifth,
777
+ .<?php echo $style_class ?> .frm_form_field.frm_first_fifth,
 
 
 
 
 
778
  .<?php echo $style_class ?> .frm_form_field.frm_left_inline,
779
+ .<?php echo $style_class ?> .frm_form_field.frm_first_inline{
780
+ clear:right;
781
  margin-right:0;
 
 
 
 
 
782
  }
783
 
784
  .<?php echo $style_class ?> .frm_grid .frm_primary_label,
css/custom_theme.css.php CHANGED
@@ -37,6 +37,10 @@ legend.frm_hidden{
37
  box-shadow:none;
38
  }
39
 
 
 
 
 
40
  .frm_preview_page:before{
41
  content:normal !important;
42
  }
@@ -152,50 +156,12 @@ legend.frm_hidden{
152
  }
153
 
154
  .frm_inline_form .frm_form_field.form-field{
155
- float:left;
156
- margin-right:4%;
157
- clear:none;
158
- }
159
-
160
- .frm_inline_form .frm_form_field.frm_left_half,
161
- .frm_inline_form .frm_form_field.frm_left_third,
162
- .frm_inline_form .frm_form_field.frm_left_two_thirds,
163
- .frm_inline_form .frm_form_field.frm_left_fourth,
164
- .frm_inline_form .frm_form_field.frm_left_fifth,
165
- .frm_inline_form .frm_form_field.frm_left_inline,
166
- .frm_inline_form .frm_form_field.frm_first_half,
167
- .frm_inline_form .frm_form_field.frm_first_third,
168
- .frm_inline_form .frm_form_field.frm_first_two_thirds,
169
- .frm_inline_form .frm_form_field.frm_first_fourth,
170
- .frm_inline_form .frm_form_field.frm_first_fifth,
171
- .frm_inline_form .frm_form_field.frm_first_sixth,
172
- .frm_inline_form .frm_form_field.frm_first_seventh,
173
- .frm_inline_form .frm_form_field.frm_first_eighth,
174
- .frm_inline_form .frm_form_field.frm_first_inline {
175
- clear:left;
176
- }
177
-
178
- .frm_inline_form .frm_form_field.frm_right_half,
179
- .frm_inline_form .frm_form_field.frm_right_third,
180
- .frm_inline_form .frm_form_field.frm_right_two_thirds,
181
- .frm_inline_form .frm_form_field.frm_right_fourth,
182
- .frm_inline_form .frm_form_field.frm_right_fifth,
183
- .frm_inline_form .frm_form_field.frm_right_inline,
184
- .frm_inline_form .frm_form_field.frm_last_half,
185
- .frm_inline_form .frm_form_field.frm_last_third,
186
- .frm_inline_form .frm_form_field.frm_last_two_thirds,
187
- .frm_inline_form .frm_form_field.frm_last_fourth,
188
- .frm_inline_form .frm_form_field.frm_last_fifth,
189
- .frm_inline_form .frm_form_field.frm_last_sixth,
190
- .frm_inline_form .frm_form_field.frm_last_seventh,
191
- .frm_inline_form .frm_form_field.frm_last_eighth,
192
- .frm_inline_form .frm_form_field.frm_last_inline{
193
- margin-right:0;
194
  }
195
 
196
  .frm_inline_form .frm_submit{
197
- clear:none;
198
- float:left;
199
  }
200
 
201
  .with_frm_style.frm_center_submit .frm_submit{
@@ -219,6 +185,7 @@ foreach ( $styles as $style ) {
219
 
220
  .frm_ajax_loading{
221
  visibility:hidden;
 
222
  }
223
 
224
  .frm_ajax_loading.frm_loading_now{
@@ -564,6 +531,10 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
564
  }
565
  /* End Calendar Styling */
566
 
 
 
 
 
567
  .frm-loading-img{
568
  background:url(<?php echo FrmAppHelper::relative_plugin_url() ?>/images/ajax_loader.gif) no-repeat center center;
569
  padding:6px 12px;
@@ -644,16 +615,38 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
644
  clear:both;
645
  }
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  .frm_form_field.frm_half,
648
  .frm_form_field.frm_third,
 
649
  .frm_form_field.frm_fourth,
 
650
  .frm_form_field.frm_fifth,
 
 
 
651
  .frm_form_field.frm_sixth,
652
  .frm_form_field.frm_seventh,
653
  .frm_form_field.frm_eighth,
654
  .frm_form_field.frm_inline{
655
  clear:none;
656
  float:left;
 
657
  }
658
 
659
  .frm_form_field.frm_left_half,
@@ -674,26 +667,11 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
674
  .frm_form_field.frm_first{
675
  clear:left;
676
  float:left;
 
677
  }
678
 
679
- .frm_form_field.frm_right_half,
680
- .frm_form_field.frm_right_third,
681
- .frm_form_field.frm_right_two_thirds,
682
- .frm_form_field.frm_right_fourth,
683
- .frm_form_field.frm_right_fifth,
684
- .frm_form_field.frm_right_inline,
685
- .frm_form_field.frm_last_half,
686
- .frm_form_field.frm_last_third,
687
- .frm_form_field.frm_last_two_thirds,
688
- .frm_form_field.frm_last_fourth,
689
- .frm_form_field.frm_last_fifth,
690
- .frm_form_field.frm_last_sixth,
691
- .frm_form_field.frm_last_seventh,
692
- .frm_form_field.frm_last_eighth,
693
- .frm_form_field.frm_last_inline,
694
- .frm_form_field.frm_last{
695
- clear:none;
696
- float:right;
697
  }
698
 
699
  .frm_form_field.frm_left_half,
@@ -701,37 +679,7 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
701
  .frm_form_field.frm_first_half,
702
  .frm_form_field.frm_last_half,
703
  .frm_form_field.frm_half{
704
- width:48%;
705
- }
706
-
707
- .frm_form_field.frm_left_half,
708
- .frm_form_field.frm_first_half,
709
- .frm_form_field.frm_half.frm_first{
710
- margin-right:4%;
711
- }
712
-
713
- .with_frm_style .frm_form_field.frm_first_half.frm_right_container div.frm_description,
714
- .with_frm_style .frm_form_field.frm_first_half.frm_right_container .frm_error,
715
- .with_frm_style .frm_form_field.frm_first_half .frm_right_container div.frm_description,
716
- .with_frm_style .frm_form_field.frm_first_half .frm_right_container .frm_error,
717
- .with_frm_style .frm_form_field.frm_last_half.frm_right_container div.frm_description,
718
- .with_frm_style .frm_form_field.frm_last_half.frm_right_container .frm_error,
719
- .with_frm_style .frm_form_field.frm_half.frm_right_container div.frm_description,
720
- .with_frm_style .frm_form_field.frm_half.frm_right_container .frm_error{
721
- margin-right:33%;
722
- padding-right:12px;
723
- }
724
-
725
- .with_frm_style .frm_form_field.frm_first_half.frm_left_container div.frm_description,
726
- .with_frm_style .frm_form_field.frm_first_half.frm_left_container .frm_error,
727
- .with_frm_style .frm_form_field.frm_first_half .frm_left_container div.frm_description,
728
- .with_frm_style .frm_form_field.frm_first_half .frm_left_container .frm_error,
729
- .with_frm_style .frm_form_field.frm_last_half.frm_left_container div.frm_description,
730
- .with_frm_style .frm_form_field.frm_last_half.frm_left_container .frm_error,
731
- .with_frm_style .frm_form_field.frm_half.frm_left_container div.frm_description,
732
- .with_frm_style .frm_form_field.frm_half.frm_left_container .frm_error{
733
- margin-left:33%;
734
- padding-left:12px;
735
  }
736
 
737
  .frm_form_field.frm_left_third,
@@ -739,7 +687,7 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
739
  .frm_form_field.frm_right_third,
740
  .frm_form_field.frm_first_third,
741
  .frm_form_field.frm_last_third{
742
- width:30%;
743
  }
744
 
745
  .frm_form_field.frm_left_two_thirds,
@@ -747,16 +695,7 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
747
  .frm_form_field.frm_first_two_thirds,
748
  .frm_form_field.frm_last_two_thirds,
749
  .frm_form_field.frm_two_thirds{
750
- width:65%;
751
- }
752
-
753
- .frm_form_field.frm_left_third,
754
- .frm_form_field.frm_first_third,
755
- .frm_form_field.frm_third,
756
- .frm_form_field.frm_left_two_thirds,
757
- .frm_form_field.frm_first_two_thirds,
758
- .frm_form_field.frm_two_thirds{
759
- margin-right:5%;
760
  }
761
 
762
  .frm_form_field.frm_left_fourth,
@@ -764,13 +703,11 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
764
  .frm_form_field.frm_right_fourth,
765
  .frm_form_field.frm_first_fourth,
766
  .frm_form_field.frm_last_fourth{
767
- width:22%;
768
  }
769
 
770
- .frm_form_field.frm_left_fourth,
771
- .frm_form_field.frm_fourth,
772
- .frm_form_field.frm_first_fourth{
773
- margin-right:4%;
774
  }
775
 
776
  .frm_form_field.frm_left_fifth,
@@ -778,46 +715,37 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
778
  .frm_form_field.frm_right_fifth,
779
  .frm_form_field.frm_first_fifth,
780
  .frm_form_field.frm_last_fifth{
781
- width:16%;
782
  }
783
 
784
- .frm_form_field.frm_left_fifth,
785
- .frm_form_field.frm_fifth,
786
- .frm_form_field.frm_first_fifth{
787
- margin-right:5%;
788
  }
789
 
790
- .frm_form_field.frm_sixth,
791
- .frm_form_field.frm_first_sixth,
792
- .frm_form_field.frm_last_sixth{
793
- width:13%;
 
 
794
  }
795
 
796
  .frm_form_field.frm_sixth,
797
- .frm_form_field.frm_first_sixth{
798
- margin-right:4%;
 
799
  }
800
 
801
  .frm_form_field.frm_seventh,
802
  .frm_form_field.frm_first_seventh,
803
  .frm_form_field.frm_last_seventh{
804
- width:11%;
805
- }
806
-
807
- .frm_form_field.frm_seventh,
808
- .frm_form_field.frm_first_seventh{
809
- margin-right:3%;
810
  }
811
 
812
  .frm_form_field.frm_eighth,
813
  .frm_form_field.frm_first_eighth,
814
  .frm_form_field.frm_last_eighth{
815
- width:10%;
816
- }
817
-
818
- .frm_form_field.frm_eighth,
819
- .frm_form_field.frm_first_eighth{
820
- margin-right:2.5%;
821
  }
822
 
823
  .frm_form_field.frm_left_inline,
@@ -828,14 +756,28 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
828
  width:auto;
829
  }
830
 
831
- .frm_form_field.frm_left_inline,
832
- .frm_form_field.frm_first_inline,
833
- .frm_form_field.frm_inline{
834
- margin-right:4%;
 
 
 
 
 
 
835
  }
836
 
837
- .frm_form_field.frm_last{
838
- margin-right:0;
 
 
 
 
 
 
 
 
839
  }
840
 
841
  .frm_full,
@@ -1793,6 +1735,20 @@ html[xmlns] .frm_clearfix{
1793
  }
1794
  }
1795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1796
  @media only screen and (max-width: 600px) {
1797
  .frm_form_field.frm_half,
1798
  .frm_form_field.frm_left_half,
@@ -1804,44 +1760,27 @@ html[xmlns] .frm_clearfix{
1804
  .frm_form_field.frm_last_third,
1805
  .frm_form_field.frm_first_two_thirds,
1806
  .frm_form_field.frm_last_two_thirds,
1807
- .frm_form_field.frm_two_thirds{
1808
- width:100%;
1809
- margin-left:0;
1810
- margin-right:0;
1811
- float:none;
1812
- }
1813
-
1814
  .frm_form_field.frm_left_fourth,
1815
  .frm_form_field.frm_fourth,
1816
  .frm_form_field.frm_right_fourth,
1817
  .frm_form_field.frm_first_fourth,
1818
  .frm_form_field.frm_last_fourth,
1819
- .frm_form_field.frm_fifth{
1820
- width:48%;
1821
- }
1822
-
1823
- .frm_form_field.frm_first_fourth + .frm_form_field.frm_fourth,
1824
- .frm_form_field.frm_first.frm_fourth + .frm_form_field.frm_fourth,
1825
- .frm_form_field.frm_first.frm_fifth + .frm_form_field.frm_fifth,
1826
- .frm_form_field.frm_first.frm_fifth + .frm_form_field.frm_fifth + .frm_form_field.frm_fifth + .frm_form_field.frm_fifth{
1827
- margin-right:0;
1828
- }
1829
-
1830
- .frm_form_field.frm_fifth.frm_first,
1831
- .frm_form_field.frm_first.frm_fifth + .frm_form_field.frm_fifth + .frm_form_field.frm_fifth{
1832
- margin-right:4%
1833
- }
1834
-
1835
- .frm_form_field.frm_fifth.frm_last{
1836
- clear:both;
1837
- float:none;
1838
- }
1839
-
1840
  .frm_form_field.frm_first_inline,
1841
  .frm_form_field.frm_inline,
1842
  .frm_form_field.frm_last_inline{
 
 
1843
  margin-right:0;
1844
- clear:both;
1845
  float:none;
1846
  }
1847
 
@@ -1855,7 +1794,16 @@ html[xmlns] .frm_clearfix{
1855
  .frm_form_field.frm_four_col .frm_checkbox:nth-child(2n+2){
1856
  margin-right:0;
1857
  }
1858
- .frm_form_field .frm_repeat_grid.frm_first_repeat .frm_form_field.frm_repeat_buttons:not(.frm_fourth) label.frm_primary_label{
 
 
 
 
 
 
 
 
 
1859
  display:none !important;
1860
  }
1861
  }
37
  box-shadow:none;
38
  }
39
 
40
+ .with_frm_style input[type=file]{
41
+ display:initial;
42
+ }
43
+
44
  .frm_preview_page:before{
45
  content:normal !important;
46
  }
156
  }
157
 
158
  .frm_inline_form .frm_form_field.form-field{
159
+ margin-right:2.5%;
160
+ display:inline-block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
 
163
  .frm_inline_form .frm_submit{
164
+ display:inline-block;
 
165
  }
166
 
167
  .with_frm_style.frm_center_submit .frm_submit{
185
 
186
  .frm_ajax_loading{
187
  visibility:hidden;
188
+ width:auto;
189
  }
190
 
191
  .frm_ajax_loading.frm_loading_now{
531
  }
532
  /* End Calendar Styling */
533
 
534
+ .frm_image_from_url{
535
+ height:50px;
536
+ }
537
+
538
  .frm-loading-img{
539
  background:url(<?php echo FrmAppHelper::relative_plugin_url() ?>/images/ajax_loader.gif) no-repeat center center;
540
  padding:6px 12px;
615
  clear:both;
616
  }
617
 
618
+ .frm_form_field.frm_right_half,
619
+ .frm_form_field.frm_right_third,
620
+ .frm_form_field.frm_right_two_thirds,
621
+ .frm_form_field.frm_right_fourth,
622
+ .frm_form_field.frm_right_fifth,
623
+ .frm_form_field.frm_right_inline,
624
+ .frm_form_field.frm_last_half,
625
+ .frm_form_field.frm_last_third,
626
+ .frm_form_field.frm_last_two_thirds,
627
+ .frm_form_field.frm_last_fourth,
628
+ .frm_form_field.frm_last_fifth,
629
+ .frm_form_field.frm_last_sixth,
630
+ .frm_form_field.frm_last_seventh,
631
+ .frm_form_field.frm_last_eighth,
632
+ .frm_form_field.frm_last_inline,
633
+ .frm_form_field.frm_last,
634
  .frm_form_field.frm_half,
635
  .frm_form_field.frm_third,
636
+ .frm_form_field.frm_two_thirds,
637
  .frm_form_field.frm_fourth,
638
+ .frm_form_field.frm_three_fourths,
639
  .frm_form_field.frm_fifth,
640
+ .frm_form_field.frm_two_fifths,
641
+ .frm_form_field.frm_three_fifths,
642
+ .frm_form_field.frm_four_fifths,
643
  .frm_form_field.frm_sixth,
644
  .frm_form_field.frm_seventh,
645
  .frm_form_field.frm_eighth,
646
  .frm_form_field.frm_inline{
647
  clear:none;
648
  float:left;
649
+ margin-left:2.5%;
650
  }
651
 
652
  .frm_form_field.frm_left_half,
667
  .frm_form_field.frm_first{
668
  clear:left;
669
  float:left;
670
+ margin-left:0;
671
  }
672
 
673
+ .frm_form_field.frm_alignright{
674
+ float:right !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  }
676
 
677
  .frm_form_field.frm_left_half,
679
  .frm_form_field.frm_first_half,
680
  .frm_form_field.frm_last_half,
681
  .frm_form_field.frm_half{
682
+ width:48.75%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  }
684
 
685
  .frm_form_field.frm_left_third,
687
  .frm_form_field.frm_right_third,
688
  .frm_form_field.frm_first_third,
689
  .frm_form_field.frm_last_third{
690
+ width:31.66%;
691
  }
692
 
693
  .frm_form_field.frm_left_two_thirds,
695
  .frm_form_field.frm_first_two_thirds,
696
  .frm_form_field.frm_last_two_thirds,
697
  .frm_form_field.frm_two_thirds{
698
+ width:65.82%;
 
 
 
 
 
 
 
 
 
699
  }
700
 
701
  .frm_form_field.frm_left_fourth,
703
  .frm_form_field.frm_right_fourth,
704
  .frm_form_field.frm_first_fourth,
705
  .frm_form_field.frm_last_fourth{
706
+ width:23.12%;
707
  }
708
 
709
+ .frm_form_field.frm_three_fourths{
710
+ width:74.36%;
 
 
711
  }
712
 
713
  .frm_form_field.frm_left_fifth,
715
  .frm_form_field.frm_right_fifth,
716
  .frm_form_field.frm_first_fifth,
717
  .frm_form_field.frm_last_fifth{
718
+ width:18%;
719
  }
720
 
721
+ .frm_form_field.frm_two_fifths {
722
+ width:38.5%;
 
 
723
  }
724
 
725
+ .frm_form_field.frm_three_fifths {
726
+ width:59%;
727
+ }
728
+
729
+ .frm_form_field.frm_four_fifths {
730
+ width:79.5%;
731
  }
732
 
733
  .frm_form_field.frm_sixth,
734
+ .frm_form_field.frm_first_sixth,
735
+ .frm_form_field.frm_last_sixth{
736
+ width:14.58%;
737
  }
738
 
739
  .frm_form_field.frm_seventh,
740
  .frm_form_field.frm_first_seventh,
741
  .frm_form_field.frm_last_seventh{
742
+ width:12.14%;
 
 
 
 
 
743
  }
744
 
745
  .frm_form_field.frm_eighth,
746
  .frm_form_field.frm_first_eighth,
747
  .frm_form_field.frm_last_eighth{
748
+ width:10.31%;
 
 
 
 
 
749
  }
750
 
751
  .frm_form_field.frm_left_inline,
756
  width:auto;
757
  }
758
 
759
+ .with_frm_style .frm_form_field.frm_first_half.frm_right_container div.frm_description,
760
+ .with_frm_style .frm_form_field.frm_first_half.frm_right_container .frm_error,
761
+ .with_frm_style .frm_form_field.frm_first_half .frm_right_container div.frm_description,
762
+ .with_frm_style .frm_form_field.frm_first_half .frm_right_container .frm_error,
763
+ .with_frm_style .frm_form_field.frm_last_half.frm_right_container div.frm_description,
764
+ .with_frm_style .frm_form_field.frm_last_half.frm_right_container .frm_error,
765
+ .with_frm_style .frm_form_field.frm_half.frm_right_container div.frm_description,
766
+ .with_frm_style .frm_form_field.frm_half.frm_right_container .frm_error{
767
+ margin-right:33%;
768
+ padding-right:12px;
769
  }
770
 
771
+ .with_frm_style .frm_form_field.frm_first_half.frm_left_container div.frm_description,
772
+ .with_frm_style .frm_form_field.frm_first_half.frm_left_container .frm_error,
773
+ .with_frm_style .frm_form_field.frm_first_half .frm_left_container div.frm_description,
774
+ .with_frm_style .frm_form_field.frm_first_half .frm_left_container .frm_error,
775
+ .with_frm_style .frm_form_field.frm_last_half.frm_left_container div.frm_description,
776
+ .with_frm_style .frm_form_field.frm_last_half.frm_left_container .frm_error,
777
+ .with_frm_style .frm_form_field.frm_half.frm_left_container div.frm_description,
778
+ .with_frm_style .frm_form_field.frm_half.frm_left_container .frm_error{
779
+ margin-left:33%;
780
+ padding-left:12px;
781
  }
782
 
783
  .frm_full,
1735
  }
1736
  }
1737
 
1738
+ @media only screen and (max-width: 900px) {
1739
+ .frm_form_field .frm_repeat_grid .frm_form_field.frm_sixth label.frm_primary_label,
1740
+ .frm_form_field .frm_repeat_grid .frm_form_field.frm_seventh label.frm_primary_label,
1741
+ .frm_form_field .frm_repeat_grid .frm_form_field.frm_eighth label.frm_primary_label{
1742
+ display: block !important;
1743
+ }
1744
+
1745
+ .frm_form_field .frm_repeat_grid .frm_form_field.frm_repeat_buttons.frm_seventh label.frm_primary_label{
1746
+ display:none !important;
1747
+ }
1748
+
1749
+ }
1750
+
1751
+
1752
  @media only screen and (max-width: 600px) {
1753
  .frm_form_field.frm_half,
1754
  .frm_form_field.frm_left_half,
1760
  .frm_form_field.frm_last_third,
1761
  .frm_form_field.frm_first_two_thirds,
1762
  .frm_form_field.frm_last_two_thirds,
1763
+ .frm_form_field.frm_two_thirds,
 
 
 
 
 
 
1764
  .frm_form_field.frm_left_fourth,
1765
  .frm_form_field.frm_fourth,
1766
  .frm_form_field.frm_right_fourth,
1767
  .frm_form_field.frm_first_fourth,
1768
  .frm_form_field.frm_last_fourth,
1769
+ .frm_form_field.frm_three_fourths,
1770
+ .frm_form_field.frm_fifth,
1771
+ .frm_form_field.frm_two_fifths,
1772
+ .frm_form_field.frm_three_fifths,
1773
+ .frm_form_field.frm_four_fifths,
1774
+ .frm_form_field.frm_sixth,
1775
+ .frm_form_field.frm_seventh,
1776
+ .frm_form_field.frm_eighth,
 
 
 
 
 
 
 
 
 
 
 
 
 
1777
  .frm_form_field.frm_first_inline,
1778
  .frm_form_field.frm_inline,
1779
  .frm_form_field.frm_last_inline{
1780
+ width:100%;
1781
+ margin-left:0;
1782
  margin-right:0;
1783
+ clear:both;
1784
  float:none;
1785
  }
1786
 
1794
  .frm_form_field.frm_four_col .frm_checkbox:nth-child(2n+2){
1795
  margin-right:0;
1796
  }
1797
+
1798
+ .frm_form_field .frm_repeat_grid.frm_first_repeat .frm_form_field.frm_repeat_buttons:not(.frm_fourth):not(.frm_sixth):not(.frm_eighth) label.frm_primary_label{
1799
+ display:none !important;
1800
+ }
1801
+
1802
+ .frm_form_field .frm_repeat_grid .frm_form_field.frm_fifth label.frm_primary_label{
1803
+ display:block !important;
1804
+ }
1805
+
1806
+ .frm_form_field .frm_repeat_grid .frm_form_field.frm_repeat_buttons.frm_fifth label.frm_primary_label{
1807
  display:none !important;
1808
  }
1809
  }
css/frm_admin.css CHANGED
@@ -287,6 +287,10 @@ form label.frm_primary_label input{font-size:12px;}
287
  color:#AA0000;
288
  }
289
 
 
 
 
 
290
  /*Switch form dropdown*/
291
  .caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid #AAA;border-right:4px solid transparent;border-left:4px solid transparent;border-bottom:0 dotted;}
292
  .dropdown{position:relative;}
@@ -395,14 +399,18 @@ form label.frm_primary_label input{font-size:12px;}
395
  .multiselect-container>li>a>label.radio,
396
  .multiselect-container>li>a>label.checkbox{margin:0}
397
  .multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}
398
- .btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}
399
  .form-inline .multiselect-container label.checkbox,
400
  .form-inline .multiselect-container label.radio{padding:3px 20px;}
401
  .form-inline .multiselect-container li a label.checkbox input[type=checkbox],
402
  .form-inline .multiselect-container li a label.radio input[type=radio]{
403
  margin-left:-20px;margin-right:0;
404
  }
405
-
 
 
 
 
406
 
407
  .frm_scale{text-align:center;float:left;}
408
  .frm_scale input{display:block;margin:5px}
@@ -891,6 +899,20 @@ select.frm_cancelnew, input.frm_enternew{width:175px;}
891
  .frm_38_trigger .categorydiv div.tabs-panel.general_settings .postbox{margin-bottom:0;}
892
  .tabs-panel{height:auto !important; min-height:260px;}
893
  .tabs-panel.panel_secondary{min-height:20px;margin-top:10px;margin-left:150px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894
 
895
  /* Styles tabs */
896
  #general-style #frm_gen_font_box{padding-right:0;width:100%;}
@@ -1239,7 +1261,13 @@ a.frm_action_icon:hover {text-decoration:none;}
1239
 
1240
  .frm_action_icon.frm_required_icon:before{content: '\e612'; font-size:7px; vertical-align:top; line-height: 2.1em; margin-right:3px;}
1241
  .frm_38_trigger .frm_action_icon.frm_required_icon:before{font-size:8px;}
1242
- .frm_action_icon.frm_required_icon {color:#000;margin-top:0;}
 
 
 
 
 
 
1243
  a.frm_inactive_icon.frm_action_icon.frm_required_icon,
1244
  a.frm_action_icon.frm_required0{
1245
  color:#ababab;
@@ -1388,7 +1416,7 @@ span.howto{display:inline;}
1388
  .frm_sorting .no_repeat_section li.ui-state-default.edit_field_type_end_divider:hover{
1389
  border:1px solid transparent;
1390
  font-weight:normal;
1391
- background-color:transparent !important;
1392
  background-image:none;
1393
  padding:5px;
1394
  margin:20px 0;
@@ -1465,7 +1493,7 @@ ul.start_divider{
1465
  padding:6px;
1466
  }
1467
  .frm_sorting li.ui-state-default.edit_field_type_divider{
1468
- padding:0;
1469
  }
1470
  .frm_sorting li.edit_field_type_end_divider,
1471
  .frm_sorting .no_repeat_section li.ui-state-default.edit_field_type_end_divider:hover{
287
  color:#AA0000;
288
  }
289
 
290
+ .frm_image_from_url{
291
+ height:50px;
292
+ }
293
+
294
  /*Switch form dropdown*/
295
  .caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid #AAA;border-right:4px solid transparent;border-left:4px solid transparent;border-bottom:0 dotted;}
296
  .dropdown{position:relative;}
399
  .multiselect-container>li>a>label.radio,
400
  .multiselect-container>li>a>label.checkbox{margin:0}
401
  .multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}
402
+ .frm-btn-group.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}
403
  .form-inline .multiselect-container label.checkbox,
404
  .form-inline .multiselect-container label.radio{padding:3px 20px;}
405
  .form-inline .multiselect-container li a label.checkbox input[type=checkbox],
406
  .form-inline .multiselect-container li a label.radio input[type=radio]{
407
  margin-left:-20px;margin-right:0;
408
  }
409
+ .frm-btn-group.btn-group, .frm-btn-group.btn-group-vertical {
410
+ display: inline-block;
411
+ position: relative;
412
+ vertical-align: middle;
413
+ }
414
 
415
  .frm_scale{text-align:center;float:left;}
416
  .frm_scale input{display:block;margin:5px}
899
  .frm_38_trigger .categorydiv div.tabs-panel.general_settings .postbox{margin-bottom:0;}
900
  .tabs-panel{height:auto !important; min-height:260px;}
901
  .tabs-panel.panel_secondary{min-height:20px;margin-top:10px;margin-left:150px;}
902
+ .edd_frm_license_row{
903
+ line-height:2em;
904
+ clear:both;
905
+ }
906
+ .frm_license_msg{
907
+ margin-top:0;
908
+ }
909
+ .edd_frm_status_icon.frm_icon_font{
910
+ color:#D54E21;
911
+ margin:0 5px;
912
+ }
913
+ .edd_frm_status_icon.frm_icon_font.frm_inactive_icon{
914
+ color:green;
915
+ }
916
 
917
  /* Styles tabs */
918
  #general-style #frm_gen_font_box{padding-right:0;width:100%;}
1261
 
1262
  .frm_action_icon.frm_required_icon:before{content: '\e612'; font-size:7px; vertical-align:top; line-height: 2.1em; margin-right:3px;}
1263
  .frm_38_trigger .frm_action_icon.frm_required_icon:before{font-size:8px;}
1264
+ .frm_action_icon.frm_required_icon,
1265
+ .ui-state-default .frm_action_icon.frm_required_icon{
1266
+ color:#000;
1267
+ margin-top:0;
1268
+ }
1269
+
1270
+ .ui-state-default a.frm_action_icon.frm_required0,
1271
  a.frm_inactive_icon.frm_action_icon.frm_required_icon,
1272
  a.frm_action_icon.frm_required0{
1273
  color:#ababab;
1416
  .frm_sorting .no_repeat_section li.ui-state-default.edit_field_type_end_divider:hover{
1417
  border:1px solid transparent;
1418
  font-weight:normal;
1419
+ background-color:transparent;
1420
  background-image:none;
1421
  padding:5px;
1422
  margin:20px 0;
1493
  padding:6px;
1494
  }
1495
  .frm_sorting li.ui-state-default.edit_field_type_divider{
1496
+ padding:0 0 25px 0;
1497
  }
1498
  .frm_sorting li.edit_field_type_end_divider,
1499
  .frm_sorting .no_repeat_section li.ui-state-default.edit_field_type_end_divider:hover{
formidable.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Formidable
4
  Description: Quickly and easily create drag-and-drop forms
5
- Version: 2.0.11
6
  Plugin URI: http://formidablepro.com/
7
  Author URI: http://strategy11.com
8
  Author: Strategy11
2
  /*
3
  Plugin Name: Formidable
4
  Description: Quickly and easily create drag-and-drop forms
5
+ Version: 2.0.12
6
  Plugin URI: http://formidablepro.com/
7
  Author URI: http://strategy11.com
8
  Author: Strategy11
js/bootstrap-multiselect.js CHANGED
@@ -1,104 +1,121 @@
1
  /**
2
- * Bootstrap Multiselect v0.9.8 (https://github.com/davidstutz/bootstrap-multiselect)
3
  *
4
- * Copyright 2012 - 2014 David Stutz
5
  *
6
  * Dual licensed under the BSD-3-Clause and the Apache License, Version 2.0.
7
  */
8
- !function($) {
9
-
10
  "use strict";// jshint ;_;
11
 
12
  if (typeof ko !== 'undefined' && ko.bindingHandlers && !ko.bindingHandlers.multiselect) {
13
  ko.bindingHandlers.multiselect = {
14
-
15
- init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
16
-
17
- var listOfSelectedItems = allBindingsAccessor().selectedOptions;
18
- var config = ko.utils.unwrapObservable(valueAccessor());
19
-
20
- $(element).multiselect(config);
21
-
22
- if (isObservableArray(listOfSelectedItems)) {
23
-
24
- // Set the initial selection state on the multiselect list.
25
- $(element).multiselect('select', ko.utils.unwrapObservable(listOfSelectedItems));
26
-
27
- // Subscribe to the selectedOptions: ko.observableArray
28
- listOfSelectedItems.subscribe(function (changes) {
29
- var addedArray = [], deletedArray = [];
30
- forEach(changes, function (change) {
31
- switch (change.status) {
32
- case 'added':
33
- addedArray.push(change.value);
34
- break;
35
- case 'deleted':
36
- deletedArray.push(change.value);
37
- break;
38
- }
39
  });
40
-
41
- if (addedArray.length > 0) {
42
- $(element).multiselect('select', addedArray);
43
- }
44
-
45
- if (deletedArray.length > 0) {
46
- $(element).multiselect('deselect', deletedArray);
47
- }
48
- }, null, "arrayChange");
49
  }
50
- },
51
-
52
- update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
53
 
54
- var listOfItems = allBindingsAccessor().options,
55
- ms = $(element).data('multiselect'),
56
- config = ko.utils.unwrapObservable(valueAccessor());
57
-
58
- if (isObservableArray(listOfItems)) {
59
- // Subscribe to the options: ko.observableArray incase it changes later
60
- listOfItems.subscribe(function (theArray) {
61
- $(element).multiselect('rebuild');
62
- });
 
 
 
 
 
 
 
63
  }
64
 
65
- if (!ms) {
66
- $(element).multiselect(config);
67
- }
68
- else {
69
- ms.updateOriginalOptions();
 
 
 
 
 
 
 
 
 
 
70
  }
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
  };
73
  }
74
 
75
- function isObservableArray(obj) {
76
- return ko.isObservable(obj) && !(obj.destroyAll === undefined);
77
- }
78
-
79
  function forEach(array, callback) {
80
  for (var index = 0; index < array.length; ++index) {
81
- callback(array[index]);
82
  }
83
  }
84
 
85
  /**
86
  * Constructor to create a new multiselect using the given select.
87
- *
88
  * @param {jQuery} select
89
  * @param {Object} options
90
  * @returns {Multiselect}
91
  */
92
  function Multiselect(select, options) {
93
 
94
- this.options = this.mergeOptions(options);
95
  this.$select = $(select);
 
 
 
 
 
 
 
96
 
97
  // Initialization.
98
  // We have to clone to create a new reference.
99
  this.originalOptions = this.$select.clone()[0].options;
100
  this.query = '';
101
  this.searchTimeout = null;
 
102
 
103
  this.options.multiple = this.$select.attr('multiple') === "multiple";
104
  this.options.onChange = $.proxy(this.options.onChange, this);
@@ -114,16 +131,16 @@
114
  this.buildSelectAll();
115
  this.buildDropdownOptions();
116
  this.buildFilter();
117
-
118
  this.updateButtonText();
119
  this.updateSelectAll();
120
-
121
- if (this.options.disableIfEmpty) {
122
- this.disableIfEmpty();
123
  }
124
 
125
  this.$select.hide().after(this.$container);
126
- };
127
 
128
  Multiselect.prototype = {
129
 
@@ -139,22 +156,34 @@
139
  */
140
  buttonText: function(options, select) {
141
  if (options.length === 0) {
142
- return this.nonSelectedText + ' <b class="caret"></b>';
143
  }
144
- else {
145
- if (options.length > this.numberDisplayed) {
146
- return options.length + ' ' + this.nSelectedText + ' <b class="caret"></b>';
 
 
 
 
147
  }
148
  else {
149
- var selected = '';
150
- options.each(function() {
151
- var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).html();
152
-
153
- selected += label + ', ';
154
- });
155
- return selected.substr(0, selected.length - 2) + ' <b class="caret"></b>';
156
  }
157
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  },
159
  /**
160
  * Updates the title of the button similar to the buttonText function.
@@ -169,20 +198,23 @@
169
  }
170
  else {
171
  var selected = '';
 
 
172
  options.each(function () {
173
- selected += $(this).text() + ', ';
 
174
  });
175
  return selected.substr(0, selected.length - 2);
176
  }
177
  },
178
  /**
179
  * Create a label.
180
- *
181
  * @param {jQuery} element
182
  * @returns {String}
183
  */
184
- label: function(element){
185
- return $(element).attr('label') || $(element).html();
186
  },
187
  /**
188
  * Triggered on change of the multiselect.
@@ -197,19 +229,19 @@
197
  },
198
  /**
199
  * Triggered when the dropdown is shown.
200
- *
201
  * @param {jQuery} event
202
  */
203
  onDropdownShow: function(event) {
204
-
205
  },
206
  /**
207
  * Triggered when the dropdown is hidden.
208
- *
209
  * @param {jQuery} event
210
  */
211
  onDropdownHide: function(event) {
212
-
213
  },
214
  /**
215
  * Triggered after the dropdown is shown.
@@ -227,11 +259,19 @@
227
  onDropdownHidden: function(event) {
228
 
229
  },
 
 
 
 
 
 
 
230
  buttonClass: 'btn btn-default',
231
- dropRight: false,
232
- selectedClass: 'active',
233
  buttonWidth: 'auto',
234
  buttonContainer: '<div class="btn-group" />',
 
 
235
  // Maximum height of the dropdown menu.
236
  // If maximum height is exceeded a scrollbar will be displayed.
237
  maxHeight: false,
@@ -240,23 +280,30 @@
240
  includeSelectAllIfMoreThan: 0,
241
  selectAllText: ' Select all',
242
  selectAllValue: 'multiselect-all',
 
 
243
  enableFiltering: false,
244
  enableCaseInsensitiveFiltering: false,
 
245
  filterPlaceholder: 'Search',
246
  // possible options: 'text', 'value', 'both'
247
  filterBehavior: 'text',
 
248
  preventInputChangeEvent: false,
249
  nonSelectedText: 'None selected',
250
  nSelectedText: 'selected',
 
251
  numberDisplayed: 3,
252
  disableIfEmpty: false,
 
253
  templates: {
254
- button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"></button>',
255
  ul: '<ul class="multiselect-container dropdown-menu"></ul>',
256
  filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
257
- li: '<li><a href="javascript:void(0);"><label></label></a></li>',
 
258
  divider: '<li class="multiselect-item divider"></li>',
259
- liGroup: '<li class="multiselect-item group"><label class="multiselect-group"></label></li>'
260
  }
261
  },
262
 
@@ -278,7 +325,9 @@
278
  */
279
  buildButton: function() {
280
  this.$button = $(this.options.templates.button).addClass(this.options.buttonClass);
281
-
 
 
282
  // Adopt active state.
283
  if (this.$select.prop('disabled')) {
284
  this.disable();
@@ -290,7 +339,9 @@
290
  // Manually add button width if set.
291
  if (this.options.buttonWidth && this.options.buttonWidth !== 'auto') {
292
  this.$button.css({
293
- 'width' : this.options.buttonWidth
 
 
294
  });
295
  this.$container.css({
296
  'width': this.options.buttonWidth
@@ -339,12 +390,13 @@
339
  buildDropdownOptions: function() {
340
 
341
  this.$select.children().each($.proxy(function(index, element) {
342
-
 
343
  // Support optgroups and options without a group simultaneously.
344
- var tag = $(element).prop('tagName')
345
  .toLowerCase();
346
 
347
- if ($(element).prop('value') === this.options.selectAllValue) {
348
  return;
349
  }
350
 
@@ -353,7 +405,7 @@
353
  }
354
  else if (tag === 'option') {
355
 
356
- if ($(element).data('role') === 'divider') {
357
  this.createDivider();
358
  }
359
  else {
@@ -361,7 +413,7 @@
361
  }
362
 
363
  }
364
-
365
  // Other illegal tags will be ignored.
366
  }, this));
367
 
@@ -375,11 +427,11 @@
375
  // Apply or unapply the configured selected class.
376
  if (this.options.selectedClass) {
377
  if (checked) {
378
- $target.parents('li')
379
  .addClass(this.options.selectedClass);
380
  }
381
  else {
382
- $target.parents('li')
383
  .removeClass(this.options.selectedClass);
384
  }
385
  }
@@ -411,7 +463,7 @@
411
  else {
412
  // Unselect all other options and corresponding checkboxes.
413
  if (this.options.selectedClass) {
414
- $($checkboxesNotThis).parents('li').removeClass(this.options.selectedClass);
415
  }
416
 
417
  $($checkboxesNotThis).prop('checked', false);
@@ -422,7 +474,7 @@
422
  }
423
 
424
  if (this.options.selectedClass === "active") {
425
- $optionsNotThis.parents("a").css("outline", "");
426
  }
427
  }
428
  else {
@@ -435,7 +487,7 @@
435
 
436
  this.updateButtonText();
437
  this.updateSelectAll();
438
-
439
  this.options.onChange($option, checked);
440
 
441
  if(this.options.preventInputChangeEvent) {
@@ -443,53 +495,77 @@
443
  }
444
  }, this));
445
 
446
- $('li a', this.$ul).on('touchstart click', function(event) {
 
 
 
 
 
 
 
447
  event.stopPropagation();
448
 
449
  var $target = $(event.target);
450
-
451
- if (event.shiftKey) {
 
 
 
 
 
452
  var checked = $target.prop('checked') || false;
453
 
454
- if (checked) {
455
- var prev = $target.parents('li:last')
456
- .siblings('li[class="active"]:first');
457
-
458
- var currentIdx = $target.parents('li')
459
- .index();
460
- var prevIdx = prev.index();
461
-
462
- if (currentIdx > prevIdx) {
463
- $target.parents("li:last").prevUntil(prev).each(
464
- function() {
465
- $(this).find("input:first").prop("checked", true)
466
- .trigger("change");
467
- }
468
- );
469
  }
470
- else {
471
- $target.parents("li:last").nextUntil(prev).each(
472
- function() {
473
- $(this).find("input:first").prop("checked", true)
474
- .trigger("change");
475
- }
476
- );
 
 
 
 
 
477
  }
 
 
 
 
 
 
 
 
478
  }
 
 
 
 
 
 
 
 
479
  }
480
 
481
  $target.blur();
482
- });
483
 
484
  // Keyboard support.
485
  this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event) {
486
  if ($('input[type="text"]', this.$container).is(':focus')) {
487
  return;
488
  }
489
- if ((event.keyCode === 9 || event.keyCode === 27)
490
- && this.$container.hasClass('open')) {
491
-
492
- // Close on tab or escape.
493
  this.$button.click();
494
  }
495
  else {
@@ -527,35 +603,64 @@
527
  event.preventDefault();
528
  }
529
  }, this));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  },
531
 
532
  /**
533
  * Create an option using the given select option.
534
- *
535
  * @param {jQuery} element
536
  */
537
  createOptionValue: function(element) {
538
- if ($(element).is(':selected')) {
539
- $(element).prop('selected', true);
 
540
  }
541
 
542
  // Support the label attribute on options.
543
- var label = this.options.label(element);
544
- var value = $(element).val();
545
  var inputType = this.options.multiple ? "checkbox" : "radio";
546
 
547
  var $li = $(this.options.templates.li);
548
- //$('label', $li).addClass(inputType);
549
-
550
- if (this.options.checkboxName) {
551
- $('label', $li).append('<input type="' + inputType + '" name="' + this.options.checkboxName + '" />');
 
552
  }
553
  else {
554
- $('label', $li).append('<input type="' + inputType + '" />');
555
  }
556
-
557
- var selected = $(element).prop('selected') || false;
558
- var $checkbox = $('input', $li);
 
 
 
 
 
 
559
  $checkbox.val(value);
560
 
561
  if (value === this.options.selectAllValue) {
@@ -564,30 +669,30 @@
564
  .addClass('multiselect-all');
565
  }
566
 
567
- $('label', $li).append(" " + label);
568
 
569
  this.$ul.append($li);
570
 
571
- if ($(element).is(':disabled')) {
572
  $checkbox.attr('disabled', 'disabled')
573
  .prop('disabled', true)
574
- .parents('a')
575
  .attr("tabindex", "-1")
576
- .parents('li')
577
  .addClass('disabled');
578
  }
579
 
580
  $checkbox.prop('checked', selected);
581
 
582
  if (selected && this.options.selectedClass) {
583
- $checkbox.parents('li')
584
  .addClass(this.options.selectedClass);
585
  }
586
  },
587
 
588
  /**
589
  * Creates a divider using the given select option.
590
- *
591
  * @param {jQuery} element
592
  */
593
  createDivider: function(element) {
@@ -597,7 +702,7 @@
597
 
598
  /**
599
  * Creates an optgroup.
600
- *
601
  * @param {jQuery} group
602
  */
603
  createOptgroup: function(group) {
@@ -605,7 +710,17 @@
605
 
606
  // Add a header for the group.
607
  var $li = $(this.options.templates.liGroup);
608
- $('label', $li).text(groupName);
 
 
 
 
 
 
 
 
 
 
609
 
610
  this.$ul.append($li);
611
 
@@ -625,11 +740,15 @@
625
  * Checks if a select all has already been created.
626
  */
627
  buildSelectAll: function() {
628
- var alreadyHasSelectAll = this.hasSelectAll();
 
 
629
 
 
 
630
  if (!alreadyHasSelectAll && this.options.includeSelectAllOption && this.options.multiple
631
  && $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) {
632
-
633
  // Check whether to add a divider after the select all.
634
  if (this.options.includeSelectAllDivider) {
635
  this.$ul.prepend($(this.options.templates.divider));
@@ -638,11 +757,18 @@
638
  var $li = $(this.options.templates.li);
639
  $('label', $li).addClass("checkbox");
640
 
641
- if (this.options.checkboxName) {
642
- $('label', $li).append('<input type="checkbox" name="' + this.options.checkboxName + '" />');
 
 
 
 
 
 
 
643
  }
644
  else {
645
- $('label', $li).append('<input type="checkbox" />');
646
  }
647
 
648
  var $checkbox = $('input', $li);
@@ -652,8 +778,6 @@
652
  $checkbox.parent().parent()
653
  .addClass('multiselect-all');
654
 
655
- $('label', $li).append(" " + this.options.selectAllText);
656
-
657
  this.$ul.prepend($li);
658
 
659
  $checkbox.prop('checked', false);
@@ -673,11 +797,29 @@
673
 
674
  this.$filter = $(this.options.templates.filter);
675
  $('input', this.$filter).attr('placeholder', this.options.filterPlaceholder);
 
 
 
 
 
 
 
 
 
 
 
 
 
676
  this.$ul.prepend(this.$filter);
677
 
678
  this.$filter.val(this.query).on('click', function(event) {
679
  event.stopPropagation();
680
  }).on('input keydown', $.proxy(function(event) {
 
 
 
 
 
681
  // This is useful to catch "keydown" events after the browser has updated the control.
682
  clearTimeout(this.searchTimeout);
683
 
@@ -686,8 +828,9 @@
686
  if (this.query !== event.target.value) {
687
  this.query = event.target.value;
688
 
 
689
  $.each($('li', this.$ul), $.proxy(function(index, element) {
690
- var value = $('input', element).val();
691
  var text = $('label', element).text();
692
 
693
  var filterCandidate = '';
@@ -713,11 +856,25 @@
713
  showElement = true;
714
  }
715
 
716
- if (showElement) {
717
- $(element).show().removeClass("filter-hidden");
 
 
 
 
 
 
718
  }
719
  else {
720
- $(element).hide().addClass("filter-hidden");
 
 
 
 
 
 
 
 
721
  }
722
  }
723
  }, this));
@@ -752,7 +909,7 @@
752
  $input.prop('checked', true);
753
 
754
  if (this.options.selectedClass) {
755
- $input.parents('li')
756
  .addClass(this.options.selectedClass);
757
  }
758
  }
@@ -760,7 +917,7 @@
760
  $input.prop('checked', false);
761
 
762
  if (this.options.selectedClass) {
763
- $input.parents('li')
764
  .removeClass(this.options.selectedClass);
765
  }
766
  }
@@ -768,12 +925,12 @@
768
  if ($(element).is(":disabled")) {
769
  $input.attr('disabled', 'disabled')
770
  .prop('disabled', true)
771
- .parents('li')
772
  .addClass('disabled');
773
  }
774
  else {
775
  $input.prop('disabled', false)
776
- .parents('li')
777
  .removeClass('disabled');
778
  }
779
  }, this));
@@ -799,6 +956,10 @@
799
  for (var i = 0; i < selectValues.length; i++) {
800
  var value = selectValues[i];
801
 
 
 
 
 
802
  var $option = this.getOptionByValue(value);
803
  var $checkbox = this.getInputByValue(value);
804
 
@@ -811,19 +972,20 @@
811
  }
812
 
813
  if (this.options.selectedClass) {
814
- $checkbox.parents('li')
815
  .addClass(this.options.selectedClass);
816
  }
817
 
818
  $checkbox.prop('checked', true);
819
  $option.prop('selected', true);
 
 
 
 
820
  }
821
 
822
  this.updateButtonText();
823
-
824
- if (triggerOnChange && selectValues.length === 1) {
825
- this.options.onChange($option, true);
826
- }
827
  },
828
 
829
  /**
@@ -850,9 +1012,12 @@
850
  }
851
 
852
  for (var i = 0; i < deselectValues.length; i++) {
853
-
854
  var value = deselectValues[i];
855
 
 
 
 
 
856
  var $option = this.getOptionByValue(value);
857
  var $checkbox = this.getInputByValue(value);
858
 
@@ -861,34 +1026,47 @@
861
  }
862
 
863
  if (this.options.selectedClass) {
864
- $checkbox.parents('li')
865
  .removeClass(this.options.selectedClass);
866
  }
867
 
868
  $checkbox.prop('checked', false);
869
  $option.prop('selected', false);
 
 
 
 
870
  }
871
 
872
  this.updateButtonText();
873
-
874
- if (triggerOnChange && deselectValues.length === 1) {
875
- this.options.onChange($option, false);
876
- }
877
  },
878
 
879
  /**
880
  * Selects all enabled & visible options.
 
 
 
 
 
881
  */
882
- selectAll: function () {
 
883
  var allCheckboxes = $("li input[type='checkbox']:enabled", this.$ul);
884
  var visibleCheckboxes = allCheckboxes.filter(":visible");
885
  var allCheckboxesCount = allCheckboxes.length;
886
  var visibleCheckboxesCount = visibleCheckboxes.length;
887
-
888
- visibleCheckboxes.prop('checked', true);
889
- $("li:not(.divider):not(.disabled)", this.$ul).filter(":visible").addClass(this.options.selectedClass);
890
 
891
- if (allCheckboxesCount === visibleCheckboxesCount) {
 
 
 
 
 
 
 
 
 
892
  $("option:enabled", this.$select).prop('selected', true);
893
  }
894
  else {
@@ -900,6 +1078,10 @@
900
  return $.inArray($(this).val(), values) !== -1;
901
  }).prop('selected', true);
902
  }
 
 
 
 
903
  },
904
 
905
  /**
@@ -913,7 +1095,7 @@
913
  var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
914
 
915
  if(justVisible) {
916
- var visibleCheckboxes = $("li input[type='checkbox']:enabled", this.$ul).filter(":visible");
917
  visibleCheckboxes.prop('checked', false);
918
 
919
  var values = visibleCheckboxes.map(function() {
@@ -952,12 +1134,15 @@
952
  this.buildSelectAll();
953
  this.buildDropdownOptions();
954
  this.buildFilter();
955
-
956
  this.updateButtonText();
957
  this.updateSelectAll();
958
 
959
- if (this.options.disableIfEmpty) {
960
- this.disableIfEmpty();
 
 
 
961
  }
962
 
963
  if (this.options.dropRight) {
@@ -967,30 +1152,46 @@
967
 
968
  /**
969
  * The provided data will be used to build the dropdown.
970
- *
971
- * @param {Array} dataprovider
972
  */
973
  dataprovider: function(dataprovider) {
974
- var optionDOM = "";
975
  var groupCounter = 0;
976
-
 
977
  $.each(dataprovider, function (index, option) {
978
- if ($.isArray(option.children)) {
 
 
979
  groupCounter++;
980
- optionDOM += '<optgroup label="' + (option.title || 'Group ' + groupCounter) + '">';
981
-
982
- forEach(option.children, function(subOption) {
983
- optionDOM += '<option value="' + subOption.value + '">' + (subOption.label || subOption.value) + '</option>';
 
 
 
 
 
 
 
 
 
 
984
  });
985
-
986
- optionDOM += '</optgroup>';
987
  }
988
  else {
989
- optionDOM += '<option value="' + option.value + '">' + (option.label || option.value) + '</option>';
 
 
 
 
 
 
990
  }
 
 
991
  });
992
 
993
- this.$select.html(optionDOM);
994
  this.rebuild();
995
  },
996
 
@@ -1012,21 +1213,9 @@
1012
  .addClass('disabled');
1013
  },
1014
 
1015
- /**
1016
- * Disable the multiselect if there are no options in the select.
1017
- */
1018
- disableIfEmpty: function () {
1019
- if ($('option', this.$select).length <= 0) {
1020
- this.disable();
1021
- }
1022
- else {
1023
- this.enable();
1024
- }
1025
- },
1026
-
1027
  /**
1028
  * Set the options.
1029
- *
1030
  * @param {Array} options
1031
  */
1032
  setOptions: function(options) {
@@ -1035,23 +1224,23 @@
1035
 
1036
  /**
1037
  * Merges the given options with the default options.
1038
- *
1039
  * @param {Array} options
1040
  * @returns {Array}
1041
  */
1042
  mergeOptions: function(options) {
1043
- return $.extend(true, {}, this.defaults, options);
1044
  },
1045
-
1046
  /**
1047
  * Checks whether a select all checkbox is present.
1048
- *
1049
  * @returns {Boolean}
1050
  */
1051
  hasSelectAll: function() {
1052
- return $('li.' + this.options.selectAllValue, this.$ul).length > 0;
1053
  },
1054
-
1055
  /**
1056
  * Updates the select all checkbox based on the currently displayed and selected checkboxes.
1057
  */
@@ -1060,12 +1249,13 @@
1060
  var allBoxes = $("li:not(.multiselect-item):not(.filter-hidden) input:enabled", this.$ul);
1061
  var allBoxesLength = allBoxes.length;
1062
  var checkedBoxesLength = allBoxes.filter(":checked").length;
1063
- var selectAllLi = $("li." + this.options.selectAllValue, this.$ul);
1064
  var selectAllInput = selectAllLi.find("input");
1065
 
1066
  if (checkedBoxesLength > 0 && checkedBoxesLength === allBoxesLength) {
1067
  selectAllInput.prop("checked", true);
1068
  selectAllLi.addClass(this.options.selectedClass);
 
1069
  }
1070
  else {
1071
  selectAllInput.prop("checked", false);
@@ -1073,7 +1263,7 @@
1073
  }
1074
  }
1075
  },
1076
-
1077
  /**
1078
  * Update the button text and its title based on the currently selected options.
1079
  */
@@ -1081,15 +1271,20 @@
1081
  var options = this.getSelected();
1082
 
1083
  // First update the displayed button text.
1084
- $('button.multiselect', this.$container).html(this.options.buttonText(options, this.$select));
 
 
 
 
 
1085
 
1086
  // Now update the title attribute of the button.
1087
- $('button.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select));
1088
  },
1089
 
1090
  /**
1091
  * Get all selected options.
1092
- *
1093
  * @returns {jQUery}
1094
  */
1095
  getSelected: function() {
@@ -1098,7 +1293,7 @@
1098
 
1099
  /**
1100
  * Gets a select option by its value.
1101
- *
1102
  * @param {String} value
1103
  * @returns {jQuery}
1104
  */
@@ -1117,7 +1312,7 @@
1117
 
1118
  /**
1119
  * Get the input (radio/checkbox) by its value.
1120
- *
1121
  * @param {String} value
1122
  * @returns {jQuery}
1123
  */
@@ -1146,6 +1341,11 @@
1146
  return setTimeout(function() {
1147
  callback.apply(self || window, args);
1148
  }, timeout);
 
 
 
 
 
1149
  }
1150
  };
1151
 
@@ -1153,7 +1353,7 @@
1153
  return this.each(function() {
1154
  var data = $(this).data('multiselect');
1155
  var options = typeof option === 'object' && option;
1156
-
1157
  // Initialize the multiselect.
1158
  if (!data) {
1159
  data = new Multiselect(this, options);
1
  /**
2
+ * Bootstrap Multiselect v0.9.13 (https://github.com/davidstutz/bootstrap-multiselect)
3
  *
4
+ * Copyright 2012 - 2015 David Stutz
5
  *
6
  * Dual licensed under the BSD-3-Clause and the Apache License, Version 2.0.
7
  */
8
+ !function ($) {
 
9
  "use strict";// jshint ;_;
10
 
11
  if (typeof ko !== 'undefined' && ko.bindingHandlers && !ko.bindingHandlers.multiselect) {
12
  ko.bindingHandlers.multiselect = {
13
+ after: ['options', 'value', 'selectedOptions'],
14
+
15
+ init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
16
+ var $element = $(element);
17
+ var config = ko.toJS(valueAccessor());
18
+
19
+ $element.multiselect(config);
20
+
21
+ if (allBindings.has('options')) {
22
+ var options = allBindings.get('options');
23
+ if (ko.isObservable(options)) {
24
+ ko.computed({
25
+ read: function() {
26
+ options();
27
+ setTimeout(function() {
28
+ var ms = $element.data('multiselect');
29
+ if (ms)
30
+ ms.updateOriginalOptions();//Not sure how beneficial this is.
31
+ $element.multiselect('rebuild');
32
+ }, 1);
33
+ },
34
+ disposeWhenNodeIsRemoved: element
 
 
 
35
  });
36
+ }
 
 
 
 
 
 
 
 
37
  }
 
 
 
38
 
39
+ //value and selectedOptions are two-way, so these will be triggered even by our own actions.
40
+ //It needs some way to tell if they are triggered because of us or because of outside change.
41
+ //It doesn't loop but it's a waste of processing.
42
+ if (allBindings.has('value')) {
43
+ var value = allBindings.get('value');
44
+ if (ko.isObservable(value)) {
45
+ ko.computed({
46
+ read: function() {
47
+ value();
48
+ setTimeout(function() {
49
+ $element.multiselect('refresh');
50
+ }, 1);
51
+ },
52
+ disposeWhenNodeIsRemoved: element
53
+ }).extend({ rateLimit: 100, notifyWhenChangesStop: true });
54
+ }
55
  }
56
 
57
+ //Switched from arrayChange subscription to general subscription using 'refresh'.
58
+ //Not sure performance is any better using 'select' and 'deselect'.
59
+ if (allBindings.has('selectedOptions')) {
60
+ var selectedOptions = allBindings.get('selectedOptions');
61
+ if (ko.isObservable(selectedOptions)) {
62
+ ko.computed({
63
+ read: function() {
64
+ selectedOptions();
65
+ setTimeout(function() {
66
+ $element.multiselect('refresh');
67
+ }, 1);
68
+ },
69
+ disposeWhenNodeIsRemoved: element
70
+ }).extend({ rateLimit: 100, notifyWhenChangesStop: true });
71
+ }
72
  }
73
+
74
+ ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
75
+ $element.multiselect('destroy');
76
+ });
77
+ },
78
+
79
+ update: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
80
+ var $element = $(element);
81
+ var config = ko.toJS(valueAccessor());
82
+
83
+ $element.multiselect('setOptions', config);
84
+ $element.multiselect('rebuild');
85
  }
86
  };
87
  }
88
 
 
 
 
 
89
  function forEach(array, callback) {
90
  for (var index = 0; index < array.length; ++index) {
91
+ callback(array[index], index);
92
  }
93
  }
94
 
95
  /**
96
  * Constructor to create a new multiselect using the given select.
97
+ *
98
  * @param {jQuery} select
99
  * @param {Object} options
100
  * @returns {Multiselect}
101
  */
102
  function Multiselect(select, options) {
103
 
 
104
  this.$select = $(select);
105
+
106
+ // Placeholder via data attributes
107
+ if (this.$select.attr("data-placeholder")) {
108
+ options.nonSelectedText = this.$select.data("placeholder");
109
+ }
110
+
111
+ this.options = this.mergeOptions($.extend({}, options, this.$select.data()));
112
 
113
  // Initialization.
114
  // We have to clone to create a new reference.
115
  this.originalOptions = this.$select.clone()[0].options;
116
  this.query = '';
117
  this.searchTimeout = null;
118
+ this.lastToggledInput = null;
119
 
120
  this.options.multiple = this.$select.attr('multiple') === "multiple";
121
  this.options.onChange = $.proxy(this.options.onChange, this);
131
  this.buildSelectAll();
132
  this.buildDropdownOptions();
133
  this.buildFilter();
134
+
135
  this.updateButtonText();
136
  this.updateSelectAll();
137
+
138
+ if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
139
+ this.disable();
140
  }
141
 
142
  this.$select.hide().after(this.$container);
143
+ }
144
 
145
  Multiselect.prototype = {
146
 
156
  */
157
  buttonText: function(options, select) {
158
  if (options.length === 0) {
159
+ return this.nonSelectedText;
160
  }
161
+ else if (this.allSelectedText
162
+ && options.length === $('option', $(select)).length
163
+ && $('option', $(select)).length !== 1
164
+ && this.multiple) {
165
+
166
+ if (this.selectAllNumber) {
167
+ return this.allSelectedText + ' (' + options.length + ')';
168
  }
169
  else {
170
+ return this.allSelectedText;
 
 
 
 
 
 
171
  }
172
  }
173
+ else if (options.length > this.numberDisplayed) {
174
+ return options.length + ' ' + this.nSelectedText;
175
+ }
176
+ else {
177
+ var selected = '';
178
+ var delimiter = this.delimiterText;
179
+
180
+ options.each(function() {
181
+ var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text();
182
+ selected += label + delimiter;
183
+ });
184
+
185
+ return selected.substr(0, selected.length - 2);
186
+ }
187
  },
188
  /**
189
  * Updates the title of the button similar to the buttonText function.
198
  }
199
  else {
200
  var selected = '';
201
+ var delimiter = this.delimiterText;
202
+
203
  options.each(function () {
204
+ var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text();
205
+ selected += label + delimiter;
206
  });
207
  return selected.substr(0, selected.length - 2);
208
  }
209
  },
210
  /**
211
  * Create a label.
212
+ *
213
  * @param {jQuery} element
214
  * @returns {String}
215
  */
216
+ optionLabel: function(element){
217
+ return $(element).attr('label') || $(element).text();
218
  },
219
  /**
220
  * Triggered on change of the multiselect.
229
  },
230
  /**
231
  * Triggered when the dropdown is shown.
232
+ *
233
  * @param {jQuery} event
234
  */
235
  onDropdownShow: function(event) {
236
+
237
  },
238
  /**
239
  * Triggered when the dropdown is hidden.
240
+ *
241
  * @param {jQuery} event
242
  */
243
  onDropdownHide: function(event) {
244
+
245
  },
246
  /**
247
  * Triggered after the dropdown is shown.
259
  onDropdownHidden: function(event) {
260
 
261
  },
262
+ /**
263
+ * Triggered on select all.
264
+ */
265
+ onSelectAll: function() {
266
+
267
+ },
268
+ enableHTML: false,
269
  buttonClass: 'btn btn-default',
270
+ inheritClass: false,
 
271
  buttonWidth: 'auto',
272
  buttonContainer: '<div class="btn-group" />',
273
+ dropRight: false,
274
+ selectedClass: 'active',
275
  // Maximum height of the dropdown menu.
276
  // If maximum height is exceeded a scrollbar will be displayed.
277
  maxHeight: false,
280
  includeSelectAllIfMoreThan: 0,
281
  selectAllText: ' Select all',
282
  selectAllValue: 'multiselect-all',
283
+ selectAllName: false,
284
+ selectAllNumber: true,
285
  enableFiltering: false,
286
  enableCaseInsensitiveFiltering: false,
287
+ enableClickableOptGroups: false,
288
  filterPlaceholder: 'Search',
289
  // possible options: 'text', 'value', 'both'
290
  filterBehavior: 'text',
291
+ includeFilterClearBtn: true,
292
  preventInputChangeEvent: false,
293
  nonSelectedText: 'None selected',
294
  nSelectedText: 'selected',
295
+ allSelectedText: 'All selected',
296
  numberDisplayed: 3,
297
  disableIfEmpty: false,
298
+ delimiterText: ', ',
299
  templates: {
300
+ button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
301
  ul: '<ul class="multiselect-container dropdown-menu"></ul>',
302
  filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span><input class="form-control multiselect-search" type="text"></div></li>',
303
+ filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default multiselect-clear-filter" type="button"><i class="glyphicon glyphicon-remove-circle"></i></button></span>',
304
+ li: '<li><a tabindex="0"><label></label></a></li>',
305
  divider: '<li class="multiselect-item divider"></li>',
306
+ liGroup: '<li class="multiselect-item multiselect-group"><label></label></li>'
307
  }
308
  },
309
 
325
  */
326
  buildButton: function() {
327
  this.$button = $(this.options.templates.button).addClass(this.options.buttonClass);
328
+ if (this.$select.attr('class') && this.options.inheritClass) {
329
+ this.$button.addClass(this.$select.attr('class'));
330
+ }
331
  // Adopt active state.
332
  if (this.$select.prop('disabled')) {
333
  this.disable();
339
  // Manually add button width if set.
340
  if (this.options.buttonWidth && this.options.buttonWidth !== 'auto') {
341
  this.$button.css({
342
+ 'width' : this.options.buttonWidth,
343
+ 'overflow' : 'hidden',
344
+ 'text-overflow' : 'ellipsis'
345
  });
346
  this.$container.css({
347
  'width': this.options.buttonWidth
390
  buildDropdownOptions: function() {
391
 
392
  this.$select.children().each($.proxy(function(index, element) {
393
+
394
+ var $element = $(element);
395
  // Support optgroups and options without a group simultaneously.
396
+ var tag = $element.prop('tagName')
397
  .toLowerCase();
398
 
399
+ if ($element.prop('value') === this.options.selectAllValue) {
400
  return;
401
  }
402
 
405
  }
406
  else if (tag === 'option') {
407
 
408
+ if ($element.data('role') === 'divider') {
409
  this.createDivider();
410
  }
411
  else {
413
  }
414
 
415
  }
416
+
417
  // Other illegal tags will be ignored.
418
  }, this));
419
 
427
  // Apply or unapply the configured selected class.
428
  if (this.options.selectedClass) {
429
  if (checked) {
430
+ $target.closest('li')
431
  .addClass(this.options.selectedClass);
432
  }
433
  else {
434
+ $target.closest('li')
435
  .removeClass(this.options.selectedClass);
436
  }
437
  }
463
  else {
464
  // Unselect all other options and corresponding checkboxes.
465
  if (this.options.selectedClass) {
466
+ $($checkboxesNotThis).closest('li').removeClass(this.options.selectedClass);
467
  }
468
 
469
  $($checkboxesNotThis).prop('checked', false);
474
  }
475
 
476
  if (this.options.selectedClass === "active") {
477
+ $optionsNotThis.closest("a").css("outline", "");
478
  }
479
  }
480
  else {
487
 
488
  this.updateButtonText();
489
  this.updateSelectAll();
490
+
491
  this.options.onChange($option, checked);
492
 
493
  if(this.options.preventInputChangeEvent) {
495
  }
496
  }, this));
497
 
498
+ $('li a', this.$ul).on('mousedown', function(e) {
499
+ if (e.shiftKey) {
500
+ // Prevent selecting text by Shift+click
501
+ return false;
502
+ }
503
+ });
504
+
505
+ $('li a', this.$ul).on('touchstart click', $.proxy(function(event) {
506
  event.stopPropagation();
507
 
508
  var $target = $(event.target);
509
+
510
+ if (event.shiftKey && this.options.multiple) {
511
+ if($target.is("label")){ // Handles checkbox selection manually (see https://github.com/davidstutz/bootstrap-multiselect/issues/431)
512
+ event.preventDefault();
513
+ $target = $target.find("input");
514
+ $target.prop("checked", !$target.prop("checked"));
515
+ }
516
  var checked = $target.prop('checked') || false;
517
 
518
+ if (this.lastToggledInput !== null && this.lastToggledInput !== $target) { // Make sure we actually have a range
519
+ var from = $target.closest("li").index();
520
+ var to = this.lastToggledInput.closest("li").index();
521
+
522
+ if (from > to) { // Swap the indices
523
+ var tmp = to;
524
+ to = from;
525
+ from = tmp;
 
 
 
 
 
 
 
526
  }
527
+
528
+ // Make sure we grab all elements since slice excludes the last index
529
+ ++to;
530
+
531
+ // Change the checkboxes and underlying options
532
+ var range = this.$ul.find("li").slice(from, to).find("input");
533
+
534
+ range.prop('checked', checked);
535
+
536
+ if (this.options.selectedClass) {
537
+ range.closest('li')
538
+ .toggleClass(this.options.selectedClass, checked);
539
  }
540
+
541
+ for (var i = 0, j = range.length; i < j; i++) {
542
+ var $checkbox = $(range[i]);
543
+
544
+ var $option = this.getOptionByValue($checkbox.val());
545
+
546
+ $option.prop('selected', checked);
547
+ }
548
  }
549
+
550
+ // Trigger the select "change" event
551
+ $target.trigger("change");
552
+ }
553
+
554
+ // Remembers last clicked option
555
+ if($target.is("input") && !$target.closest("li").is(".multiselect-item")){
556
+ this.lastToggledInput = $target;
557
  }
558
 
559
  $target.blur();
560
+ }, this));
561
 
562
  // Keyboard support.
563
  this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event) {
564
  if ($('input[type="text"]', this.$container).is(':focus')) {
565
  return;
566
  }
567
+
568
+ if (event.keyCode === 9 && this.$container.hasClass('open')) {
 
 
569
  this.$button.click();
570
  }
571
  else {
603
  event.preventDefault();
604
  }
605
  }, this));
606
+
607
+ if(this.options.enableClickableOptGroups && this.options.multiple) {
608
+ $('li.multiselect-group', this.$ul).on('click', $.proxy(function(event) {
609
+ event.stopPropagation();
610
+
611
+ var group = $(event.target).parent();
612
+
613
+ // Search all option in optgroup
614
+ var $options = group.nextUntil('li.multiselect-group');
615
+ var $visibleOptions = $options.filter(":visible:not(.disabled)");
616
+
617
+ // check or uncheck items
618
+ var allChecked = true;
619
+ var optionInputs = $visibleOptions.find('input');
620
+ optionInputs.each(function() {
621
+ allChecked = allChecked && $(this).prop('checked');
622
+ });
623
+
624
+ optionInputs.prop('checked', !allChecked).trigger('change');
625
+ }, this));
626
+ }
627
  },
628
 
629
  /**
630
  * Create an option using the given select option.
631
+ *
632
  * @param {jQuery} element
633
  */
634
  createOptionValue: function(element) {
635
+ var $element = $(element);
636
+ if ($element.is(':selected')) {
637
+ $element.prop('selected', true);
638
  }
639
 
640
  // Support the label attribute on options.
641
+ var label = this.options.optionLabel(element);
642
+ var value = $element.val();
643
  var inputType = this.options.multiple ? "checkbox" : "radio";
644
 
645
  var $li = $(this.options.templates.li);
646
+ var $label = $('label', $li);
647
+ $label.addClass(inputType);
648
+
649
+ if (this.options.enableHTML) {
650
+ $label.html(" " + label);
651
  }
652
  else {
653
+ $label.text(" " + label);
654
  }
655
+
656
+ var $checkbox = $('<input/>').attr('type', inputType);
657
+
658
+ if (this.options.checkboxName) {
659
+ $checkbox.attr('name', this.options.checkboxName);
660
+ }
661
+ $label.prepend($checkbox);
662
+
663
+ var selected = $element.prop('selected') || false;
664
  $checkbox.val(value);
665
 
666
  if (value === this.options.selectAllValue) {
669
  .addClass('multiselect-all');
670
  }
671
 
672
+ $label.attr('title', $element.attr('title'));
673
 
674
  this.$ul.append($li);
675
 
676
+ if ($element.is(':disabled')) {
677
  $checkbox.attr('disabled', 'disabled')
678
  .prop('disabled', true)
679
+ .closest('a')
680
  .attr("tabindex", "-1")
681
+ .closest('li')
682
  .addClass('disabled');
683
  }
684
 
685
  $checkbox.prop('checked', selected);
686
 
687
  if (selected && this.options.selectedClass) {
688
+ $checkbox.closest('li')
689
  .addClass(this.options.selectedClass);
690
  }
691
  },
692
 
693
  /**
694
  * Creates a divider using the given select option.
695
+ *
696
  * @param {jQuery} element
697
  */
698
  createDivider: function(element) {
702
 
703
  /**
704
  * Creates an optgroup.
705
+ *
706
  * @param {jQuery} group
707
  */
708
  createOptgroup: function(group) {
710
 
711
  // Add a header for the group.
712
  var $li = $(this.options.templates.liGroup);
713
+
714
+ if (this.options.enableHTML) {
715
+ $('label', $li).html(groupName);
716
+ }
717
+ else {
718
+ $('label', $li).text(groupName);
719
+ }
720
+
721
+ if (this.options.enableClickableOptGroups) {
722
+ $li.addClass('multiselect-group-clickable');
723
+ }
724
 
725
  this.$ul.append($li);
726
 
740
  * Checks if a select all has already been created.
741
  */
742
  buildSelectAll: function() {
743
+ if (typeof this.options.selectAllValue === 'number') {
744
+ this.options.selectAllValue = this.options.selectAllValue.toString();
745
+ }
746
 
747
+ var alreadyHasSelectAll = this.hasSelectAll();
748
+
749
  if (!alreadyHasSelectAll && this.options.includeSelectAllOption && this.options.multiple
750
  && $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) {
751
+
752
  // Check whether to add a divider after the select all.
753
  if (this.options.includeSelectAllDivider) {
754
  this.$ul.prepend($(this.options.templates.divider));
757
  var $li = $(this.options.templates.li);
758
  $('label', $li).addClass("checkbox");
759
 
760
+ if (this.options.enableHTML) {
761
+ $('label', $li).html(" " + this.options.selectAllText);
762
+ }
763
+ else {
764
+ $('label', $li).text(" " + this.options.selectAllText);
765
+ }
766
+
767
+ if (this.options.selectAllName) {
768
+ $('label', $li).prepend('<input type="checkbox" name="' + this.options.selectAllName + '" />');
769
  }
770
  else {
771
+ $('label', $li).prepend('<input type="checkbox" />');
772
  }
773
 
774
  var $checkbox = $('input', $li);
778
  $checkbox.parent().parent()
779
  .addClass('multiselect-all');
780
 
 
 
781
  this.$ul.prepend($li);
782
 
783
  $checkbox.prop('checked', false);
797
 
798
  this.$filter = $(this.options.templates.filter);
799
  $('input', this.$filter).attr('placeholder', this.options.filterPlaceholder);
800
+
801
+ // Adds optional filter clear button
802
+ if(this.options.includeFilterClearBtn){
803
+ var clearBtn = $(this.options.templates.filterClearBtn);
804
+ clearBtn.on('click', $.proxy(function(event){
805
+ clearTimeout(this.searchTimeout);
806
+ this.$filter.find('.multiselect-search').val('');
807
+ $('li', this.$ul).show().removeClass("filter-hidden");
808
+ this.updateSelectAll();
809
+ }, this));
810
+ this.$filter.find('.input-group').append(clearBtn);
811
+ }
812
+
813
  this.$ul.prepend(this.$filter);
814
 
815
  this.$filter.val(this.query).on('click', function(event) {
816
  event.stopPropagation();
817
  }).on('input keydown', $.proxy(function(event) {
818
+ // Cancel enter key default behaviour
819
+ if (event.which === 13) {
820
+ event.preventDefault();
821
+ }
822
+
823
  // This is useful to catch "keydown" events after the browser has updated the control.
824
  clearTimeout(this.searchTimeout);
825
 
828
  if (this.query !== event.target.value) {
829
  this.query = event.target.value;
830
 
831
+ var currentGroup, currentGroupVisible;
832
  $.each($('li', this.$ul), $.proxy(function(index, element) {
833
+ var value = $('input', element).length > 0 ? $('input', element).val() : "";
834
  var text = $('label', element).text();
835
 
836
  var filterCandidate = '';
856
  showElement = true;
857
  }
858
 
859
+ // Toggle current element (group or group item) according to showElement boolean.
860
+ $(element).toggle(showElement).toggleClass('filter-hidden', !showElement);
861
+
862
+ // Differentiate groups and group items.
863
+ if ($(element).hasClass('multiselect-group')) {
864
+ // Remember group status.
865
+ currentGroup = element;
866
+ currentGroupVisible = showElement;
867
  }
868
  else {
869
+ // Show group name when at least one of its items is visible.
870
+ if (showElement) {
871
+ $(currentGroup).show().removeClass('filter-hidden');
872
+ }
873
+
874
+ // Show all group items when group name satisfies filter.
875
+ if (!showElement && currentGroupVisible) {
876
+ $(element).show().removeClass('filter-hidden');
877
+ }
878
  }
879
  }
880
  }, this));
909
  $input.prop('checked', true);
910
 
911
  if (this.options.selectedClass) {
912
+ $input.closest('li')
913
  .addClass(this.options.selectedClass);
914
  }
915
  }
917
  $input.prop('checked', false);
918
 
919
  if (this.options.selectedClass) {
920
+ $input.closest('li')
921
  .removeClass(this.options.selectedClass);
922
  }
923
  }
925
  if ($(element).is(":disabled")) {
926
  $input.attr('disabled', 'disabled')
927
  .prop('disabled', true)
928
+ .closest('li')
929
  .addClass('disabled');
930
  }
931
  else {
932
  $input.prop('disabled', false)
933
+ .closest('li')
934
  .removeClass('disabled');
935
  }
936
  }, this));
956
  for (var i = 0; i < selectValues.length; i++) {
957
  var value = selectValues[i];
958
 
959
+ if (value === null || value === undefined) {
960
+ continue;
961
+ }
962
+
963
  var $option = this.getOptionByValue(value);
964
  var $checkbox = this.getInputByValue(value);
965
 
972
  }
973
 
974
  if (this.options.selectedClass) {
975
+ $checkbox.closest('li')
976
  .addClass(this.options.selectedClass);
977
  }
978
 
979
  $checkbox.prop('checked', true);
980
  $option.prop('selected', true);
981
+
982
+ if (triggerOnChange) {
983
+ this.options.onChange($option, true);
984
+ }
985
  }
986
 
987
  this.updateButtonText();
988
+ this.updateSelectAll();
 
 
 
989
  },
990
 
991
  /**
1012
  }
1013
 
1014
  for (var i = 0; i < deselectValues.length; i++) {
 
1015
  var value = deselectValues[i];
1016
 
1017
+ if (value === null || value === undefined) {
1018
+ continue;
1019
+ }
1020
+
1021
  var $option = this.getOptionByValue(value);
1022
  var $checkbox = this.getInputByValue(value);
1023
 
1026
  }
1027
 
1028
  if (this.options.selectedClass) {
1029
+ $checkbox.closest('li')
1030
  .removeClass(this.options.selectedClass);
1031
  }
1032
 
1033
  $checkbox.prop('checked', false);
1034
  $option.prop('selected', false);
1035
+
1036
+ if (triggerOnChange) {
1037
+ this.options.onChange($option, false);
1038
+ }
1039
  }
1040
 
1041
  this.updateButtonText();
1042
+ this.updateSelectAll();
 
 
 
1043
  },
1044
 
1045
  /**
1046
  * Selects all enabled & visible options.
1047
+ *
1048
+ * If justVisible is true or not specified, only visible options are selected.
1049
+ *
1050
+ * @param {Boolean} justVisible
1051
+ * @param {Boolean} triggerOnSelectAll
1052
  */
1053
+ selectAll: function (justVisible, triggerOnSelectAll) {
1054
+ var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
1055
  var allCheckboxes = $("li input[type='checkbox']:enabled", this.$ul);
1056
  var visibleCheckboxes = allCheckboxes.filter(":visible");
1057
  var allCheckboxesCount = allCheckboxes.length;
1058
  var visibleCheckboxesCount = visibleCheckboxes.length;
 
 
 
1059
 
1060
+ if(justVisible) {
1061
+ visibleCheckboxes.prop('checked', true);
1062
+ $("li:not(.divider):not(.disabled)", this.$ul).filter(":visible").addClass(this.options.selectedClass);
1063
+ }
1064
+ else {
1065
+ allCheckboxes.prop('checked', true);
1066
+ $("li:not(.divider):not(.disabled)", this.$ul).addClass(this.options.selectedClass);
1067
+ }
1068
+
1069
+ if (allCheckboxesCount === visibleCheckboxesCount || justVisible === false) {
1070
  $("option:enabled", this.$select).prop('selected', true);
1071
  }
1072
  else {
1078
  return $.inArray($(this).val(), values) !== -1;
1079
  }).prop('selected', true);
1080
  }
1081
+
1082
+ if (triggerOnSelectAll) {
1083
+ this.options.onSelectAll();
1084
+ }
1085
  },
1086
 
1087
  /**
1095
  var justVisible = typeof justVisible === 'undefined' ? true : justVisible;
1096
 
1097
  if(justVisible) {
1098
+ var visibleCheckboxes = $("li input[type='checkbox']:not(:disabled)", this.$ul).filter(":visible");
1099
  visibleCheckboxes.prop('checked', false);
1100
 
1101
  var values = visibleCheckboxes.map(function() {
1134
  this.buildSelectAll();
1135
  this.buildDropdownOptions();
1136
  this.buildFilter();
1137
+
1138
  this.updateButtonText();
1139
  this.updateSelectAll();
1140
 
1141
+ if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
1142
+ this.disable();
1143
+ }
1144
+ else {
1145
+ this.enable();
1146
  }
1147
 
1148
  if (this.options.dropRight) {
1152
 
1153
  /**
1154
  * The provided data will be used to build the dropdown.
 
 
1155
  */
1156
  dataprovider: function(dataprovider) {
1157
+
1158
  var groupCounter = 0;
1159
+ var $select = this.$select.empty();
1160
+
1161
  $.each(dataprovider, function (index, option) {
1162
+ var $tag;
1163
+
1164
+ if ($.isArray(option.children)) { // create optiongroup tag
1165
  groupCounter++;
1166
+
1167
+ $tag = $('<optgroup/>').attr({
1168
+ label: option.label || 'Group ' + groupCounter,
1169
+ disabled: !!option.disabled
1170
+ });
1171
+
1172
+ forEach(option.children, function(subOption) { // add children option tags
1173
+ $tag.append($('<option/>').attr({
1174
+ value: subOption.value,
1175
+ label: subOption.label || subOption.value,
1176
+ title: subOption.title,
1177
+ selected: !!subOption.selected,
1178
+ disabled: !!subOption.disabled
1179
+ }));
1180
  });
 
 
1181
  }
1182
  else {
1183
+ $tag = $('<option/>').attr({
1184
+ value: option.value,
1185
+ label: option.label || option.value,
1186
+ title: option.title,
1187
+ selected: !!option.selected,
1188
+ disabled: !!option.disabled
1189
+ });
1190
  }
1191
+
1192
+ $select.append($tag);
1193
  });
1194
 
 
1195
  this.rebuild();
1196
  },
1197
 
1213
  .addClass('disabled');
1214
  },
1215
 
 
 
 
 
 
 
 
 
 
 
 
 
1216
  /**
1217
  * Set the options.
1218
+ *
1219
  * @param {Array} options
1220
  */
1221
  setOptions: function(options) {
1224
 
1225
  /**
1226
  * Merges the given options with the default options.
1227
+ *
1228
  * @param {Array} options
1229
  * @returns {Array}
1230
  */
1231
  mergeOptions: function(options) {
1232
+ return $.extend(true, {}, this.defaults, this.options, options);
1233
  },
1234
+
1235
  /**
1236
  * Checks whether a select all checkbox is present.
1237
+ *
1238
  * @returns {Boolean}
1239
  */
1240
  hasSelectAll: function() {
1241
+ return $('li.multiselect-all', this.$ul).length > 0;
1242
  },
1243
+
1244
  /**
1245
  * Updates the select all checkbox based on the currently displayed and selected checkboxes.
1246
  */
1249
  var allBoxes = $("li:not(.multiselect-item):not(.filter-hidden) input:enabled", this.$ul);
1250
  var allBoxesLength = allBoxes.length;
1251
  var checkedBoxesLength = allBoxes.filter(":checked").length;
1252
+ var selectAllLi = $("li.multiselect-all", this.$ul);
1253
  var selectAllInput = selectAllLi.find("input");
1254
 
1255
  if (checkedBoxesLength > 0 && checkedBoxesLength === allBoxesLength) {
1256
  selectAllInput.prop("checked", true);
1257
  selectAllLi.addClass(this.options.selectedClass);
1258
+ this.options.onSelectAll();
1259
  }
1260
  else {
1261
  selectAllInput.prop("checked", false);
1263
  }
1264
  }
1265
  },
1266
+
1267
  /**
1268
  * Update the button text and its title based on the currently selected options.
1269
  */
1271
  var options = this.getSelected();
1272
 
1273
  // First update the displayed button text.
1274
+ if (this.options.enableHTML) {
1275
+ $('.multiselect .multiselect-selected-text', this.$container).html(this.options.buttonText(options, this.$select));
1276
+ }
1277
+ else {
1278
+ $('.multiselect .multiselect-selected-text', this.$container).text(this.options.buttonText(options, this.$select));
1279
+ }
1280
 
1281
  // Now update the title attribute of the button.
1282
+ $('.multiselect', this.$container).attr('title', this.options.buttonTitle(options, this.$select));
1283
  },
1284
 
1285
  /**
1286
  * Get all selected options.
1287
+ *
1288
  * @returns {jQUery}
1289
  */
1290
  getSelected: function() {
1293
 
1294
  /**
1295
  * Gets a select option by its value.
1296
+ *
1297
  * @param {String} value
1298
  * @returns {jQuery}
1299
  */
1312
 
1313
  /**
1314
  * Get the input (radio/checkbox) by its value.
1315
+ *
1316
  * @param {String} value
1317
  * @returns {jQuery}
1318
  */
1341
  return setTimeout(function() {
1342
  callback.apply(self || window, args);
1343
  }, timeout);
1344
+ },
1345
+
1346
+ setAllSelectedText: function(allSelectedText) {
1347
+ this.options.allSelectedText = allSelectedText;
1348
+ this.updateButtonText();
1349
  }
1350
  };
1351
 
1353
  return this.each(function() {
1354
  var data = $(this).data('multiselect');
1355
  var options = typeof option === 'object' && option;
1356
+
1357
  // Initialize the multiselect.
1358
  if (!data) {
1359
  data = new Multiselect(this, options);
js/formidable.js CHANGED
@@ -85,16 +85,18 @@ function frmFrontFormJS(){
85
  if ( select ) {
86
  var otherField = jQuery(this).parent().children('.frm_other_input');
87
 
88
- if ( other ) {
89
- // Remove frm_pos_none
90
- otherField[0].className = otherField[0].className.replace( 'frm_pos_none', '' );
91
- } else {
92
- // Add frm_pos_none
93
- if ( otherField[0].className.indexOf( 'frm_pos_none' ) < 1 ) {
94
- otherField[0].className = otherField[0].className + ' frm_pos_none';
95
- }
96
- otherField[0].value = '';
97
- }
 
 
98
 
99
  // Radio
100
  } else if ( type === 'radio' ) {
@@ -254,89 +256,132 @@ function frmFrontFormJS(){
254
  return this_opts;
255
  }
256
 
257
- function hideOrShowField(i, f, field_id, selected, rec, parentField){
258
- f.inputName = 'item_meta['+ f.FieldName +']';
259
- f.hiddenName = 'item_meta['+ f.HideField +']';
260
- f.containerID = 'frm_field_'+ f.FieldName +'_container';
261
- f.hideContainerID = 'frm_field_'+ f.HideField +'_container';
 
 
 
 
262
  f.hideBy = '#';
263
- var getRepeat = false;
264
-
265
- if ( typeof parentField !== 'undefined' && parentField !== null ) {
266
- if ( parentField.length > 1 ) {
267
- parentField = parentField.eq(0);
268
- }
269
 
270
- if ( typeof parentField.attr('name') === 'undefined' ) {
271
- return;
272
- }
273
 
274
- // Accommodate for "other" options
275
- f.inputName = parentField.attr('name').replace( '[other]', '' ).replace('[]', '');
 
276
 
277
- var container = parentField.closest('.frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid');
278
- if ( container.length ) {
279
- var repeatInput = container.find('.frm_field_'+ f.FieldName +'_container');
280
- f.containerID = repeatInput.attr('id');
281
- f.hideContainerID = f.containerID.replace(f.FieldName, f.HideField);
282
- f.hiddenName = f.inputName.replace('['+ f.FieldName +']', '['+ f.HideField +']');
283
- }
284
- } else {
285
- setEmptyKeyInArray(f);
286
- getRepeat = true;
287
- parentField = jQuery('input[name^="'+ f.inputName +'"], textarea[name^="'+ f.inputName +'"], select[name^="'+ f.inputName +'"]');
288
 
 
289
  if ( parentField.length < 1 ) {
290
- // logic triggered on page load for fields in repeating section
291
- var parentClass = '.'+ f.containerID;
292
- if ( addingRow !== '' ) {
293
- parentClass = '#' + addingRow +' '+ parentClass;
294
- }
295
-
296
- var parentContainer = jQuery(parentClass);
297
- if ( parentContainer.length ) {
298
- parentField = parentContainer.find('input, textarea, select');
299
- if ( parentField.length ) {
300
- if ( addingRow === '' ) {
301
- var lastId = '';
302
- parentField.each(function(){
303
- var thisId = jQuery(this).closest('.frm_form_field').attr('id');
304
- if ( thisId != lastId ) { // don't trigger radio/checkbox multiple times
305
- hideOrShowField(i, f, f.FieldName, selected, rec, jQuery(this));
306
- }
307
- lastId = thisId;
308
- });
309
- } else {
310
- hideOrShowField(i, f, field_id, selected, rec, parentField);
311
- }
312
- } else {
313
- show_fields[f.hideContainerID][i] = false;
314
- hideFieldNow(i, f, rec);
315
- }
316
- return;
317
- }
318
  }
319
 
320
- if ( parentField.length > 1 ) {
321
- parentField = parentField.eq(0);
322
- }
323
- }
324
 
325
  setEmptyKeyInArray(f);
326
 
327
- // check if only the dependent field is in a repeating section
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  var hideContainer = document.getElementById(f.hideContainerID);
329
- if(hideContainer === null){
330
- // it is a repeating section, use the class
331
  f.hideBy = '.';
332
  }
 
333
 
334
- if ( f.FieldName !== field_id || typeof selected === 'undefined' || selected === 'und' ) {
 
 
 
 
335
  if ( ( f.Type === 'radio' || f.Type === 'data-radio' ) && parentField.attr('type') === 'radio' ) {
336
  selected = jQuery('input[name="'+ f.inputName +'"]:checked').val();
337
- if ( typeof selected === 'undefined' ) {
338
- selected = '';
339
- }
340
  } else if ( f.Type === 'select' || f.Type === 'time' || f.Type === 'data-select' || ( f.Type !== 'checkbox' && f.Type !== 'data-checkbox' ) ) {
341
  selected = parentField.val();
342
  }
@@ -344,86 +389,93 @@ function frmFrontFormJS(){
344
 
345
  if ( typeof selected === 'undefined' ) {
346
  if ( parentField.length === 0 ) {
347
- return; // the parent field is currently getting processed
348
  }
349
  selected = parentField.val();
350
- }
351
 
352
  if ( typeof selected === 'undefined' ) {
353
- // check for repeating/embedded field
354
- if ( getRepeat === true ) {
355
- var repeat = jQuery('.'+ f.containerID +' input, .'+ f.containerID +' select, .'+ f.containerID +' textarea');
356
- if ( repeat.length ) {
357
- repeat.each(function(){
358
- hideOrShowField(i, f, f.FieldName, selected, rec, jQuery(this));
359
- });
360
- return;
361
- }
362
- }
363
  selected = '';
364
  }
365
 
366
- // get selected checkbox values
367
- var checkVals = [];
368
- if ( f.Type === 'checkbox' || f.Type === 'data-checkbox' ) {
369
- checkVals = getCheckedVal(f.containerID, f.inputName);
370
 
371
- if ( checkVals.length ) {
372
- selected = checkVals;
373
- }else{
374
- selected = '';
375
- }
376
- }
 
 
 
377
 
 
 
 
 
378
  if ( selected === null || selected === '' || selected.length < 1 ) {
379
  show_fields[f.hideContainerID][i] = false;
380
  } else {
381
  show_fields[f.hideContainerID][i] = {'funcName':'getDataOpts', 'f':f, 'sel':selected};
382
  }
383
 
384
- if ( f.Type === 'checkbox' || (f.Type === 'data-checkbox' && typeof f.LinkedField === 'undefined') ) {
385
- show_fields[f.hideContainerID][i] = false;
386
 
387
- var match = false;
388
- if ( selected !== '') {
389
- if ( f.Condition === '!=' ) {
390
- show_fields[f.hideContainerID][i] = true;
391
- }
392
- for ( var b = 0; b<selected.length; b++ ) {
393
- match = operators(f.Condition, f.Value, selected[b]);
394
- if ( f.Condition === '!=' ) {
395
- if ( show_fields[f.hideContainerID][i] === true && match === false ) {
396
- show_fields[f.hideContainerID][i] = false;
397
- }
398
- } else if(show_fields[f.hideContainerID][i] === false && match){
399
- show_fields[f.hideContainerID][i] = true;
400
- }
401
- }
402
- } else {
403
- match = operators(f.Condition, f.Value, '');
404
- if(show_fields[f.hideContainerID][i] === false && match){
405
- show_fields[f.hideContainerID][i] = true;
406
- }
407
- }
408
- } else if ( typeof f.LinkedField !== 'undefined' && f.Type.indexOf('data-') === 0 ) {
409
  if ( typeof f.DataType === 'undefined' || f.DataType === 'data' ) {
410
- if ( selected === '' ) {
411
- hideAndClearDynamicField( f.hideContainerID, f.hideBy, f.HideField, 'hide' );
412
- } else if ( f.Type === 'data-radio' ) {
413
- if ( typeof f.DataType === 'undefined' ) {
414
- show_fields[f.hideContainerID][i] = operators(f.Condition, f.Value, selected);
415
- } else {
416
- show_fields[f.hideContainerID][i] = {'funcName':'getData','f':f,'sel':selected};
417
- }
418
- } else if ( f.Type === 'data-checkbox' || ( f.Type === 'data-select' && isNotEmptyArray( selected ) ) ) {
419
- hideAndClearDynamicField( f.hideContainerID, f.hideBy, f.HideField, 'show' );
420
- show_fields[f.hideContainerID][i] = true;
421
- getData(f, selected, 1);
422
- } else if ( f.Type === 'data-select' ) {
423
- show_fields[f.hideContainerID][i] = {'funcName':'getData','f':f,'sel':selected};
424
- }
425
- }
426
- }else if ( typeof f.Value === 'undefined' && f.Type.indexOf('data') === 0 ) {
427
  if ( selected === '' ) {
428
  f.Value = '1';
429
  } else {
@@ -433,9 +485,7 @@ function frmFrontFormJS(){
433
  f.Value = undefined;
434
  }else{
435
  show_fields[f.hideContainerID][i] = operators(f.Condition, f.Value, selected);
436
- }
437
-
438
- hideFieldNow(i, f, rec);
439
  }
440
 
441
  function setEmptyKeyInArray(f) {
@@ -444,6 +494,31 @@ function frmFrontFormJS(){
444
  }
445
  }
446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  function hideAndClearDynamicField(hideContainer, hideBy, field_id, hide){
448
  if ( jQuery.inArray(hideContainer, hidden_fields) === -1 ) {
449
  hidden_fields[ field_id ] = hideContainer;
@@ -911,15 +986,15 @@ function frmFrontFormJS(){
911
 
912
  var total = parseFloat(eval(thisFullCalc));
913
 
 
 
 
 
914
  // Set decimal points
915
  if ( isNumeric( dec ) ) {
916
  total = total.toFixed(dec);
917
  }
918
 
919
- if ( typeof total === 'undefined' ) {
920
- total = 0;
921
- }
922
-
923
  if ( totalField.val() != total ) {
924
  totalField.val(total);
925
  triggerChange( totalField, field_key );
@@ -1654,7 +1729,7 @@ function frmFrontFormJS(){
1654
  /* update calculations when a row is removed */
1655
  if ( this.type != 'file' ) {
1656
  var fieldID = this.name.replace('item_meta[', '').split(']')[2].replace('[', '');
1657
- doCalculation(fieldID);
1658
  }
1659
  });
1660
  });
85
  if ( select ) {
86
  var otherField = jQuery(this).parent().children('.frm_other_input');
87
 
88
+ if ( otherField.length ) {
89
+ if ( other ) {
90
+ // Remove frm_pos_none
91
+ otherField[0].className = otherField[0].className.replace( 'frm_pos_none', '' );
92
+ } else {
93
+ // Add frm_pos_none
94
+ if ( otherField[0].className.indexOf( 'frm_pos_none' ) < 1 ) {
95
+ otherField[0].className = otherField[0].className + ' frm_pos_none';
96
+ }
97
+ otherField[0].value = '';
98
+ }
99
+ }
100
 
101
  // Radio
102
  } else if ( type === 'radio' ) {
256
  return this_opts;
257
  }
258
 
259
+ /**
260
+ * Track whether fields should hide or show in show_fields variable
261
+ */
262
+ function hideOrShowField(i, f, triggerFieldId, selected, rec, parentField){
263
+ // Instantiate variables
264
+ f.inputName = 'item_meta['+ f.FieldName +']';
265
+ f.hiddenName = 'item_meta['+ f.HideField +']';
266
+ f.containerID = 'frm_field_'+ f.FieldName +'_container';
267
+ f.hideContainerID = 'frm_field_'+ f.HideField +'_container';
268
  f.hideBy = '#';
269
+ var getRepeat = false;
 
 
 
 
 
270
 
271
+ if ( typeof parentField !== 'undefined' && parentField !== null ) {
272
+ parentField = maybeGetFirstElement( parentField );
 
273
 
274
+ if ( typeof parentField.attr('name') === 'undefined' ) {
275
+ return;
276
+ }
277
 
278
+ updateObjectForRepeatingSection( parentField, f );
279
+ } else {
280
+ getRepeat = true;
281
+ parentField = jQuery('input[name^="'+ f.inputName +'"], textarea[name^="'+ f.inputName +'"], select[name^="'+ f.inputName +'"]');
 
 
 
 
 
 
 
282
 
283
+ // If in repeating section
284
  if ( parentField.length < 1 ) {
285
+ checkRepeatingFields( i, f, triggerFieldId, selected, rec );
286
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  }
288
 
289
+ parentField = maybeGetFirstElement( parentField );
290
+ }
 
 
291
 
292
  setEmptyKeyInArray(f);
293
 
294
+ maybeUpdateHideBy( f );
295
+
296
+ selected = getEnteredValue( i, f, triggerFieldId, selected, rec, parentField, getRepeat );
297
+ if ( selected === false ) {
298
+ return;
299
+ }
300
+
301
+ updateShowFields( i, f, selected );
302
+
303
+ adjustShowFieldsForRepeat(f, i);
304
+
305
+ hideFieldNow(i, f, rec);
306
+ }
307
+
308
+ function maybeGetFirstElement( parentField ) {
309
+ if ( parentField.length > 1 ) {
310
+ parentField = parentField.eq(0);
311
+ }
312
+ return parentField;
313
+ }
314
+
315
+ function updateObjectForRepeatingSection( parentField, f ) {
316
+ var container = parentField.closest('.frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid');
317
+ if ( container.length ) {
318
+ var repeatInput = container.find('.frm_field_'+ f.FieldName +'_container');
319
+ f.containerID = repeatInput.attr('id');
320
+ f.hideContainerID = f.containerID.replace(f.FieldName, f.HideField);
321
+ f.hiddenName = f.inputName.replace('['+ f.FieldName +']', '['+ f.HideField +']');
322
+ }
323
+ }
324
+
325
+ /**
326
+ * If field in logic is repeating, loop through each repeating field
327
+ */
328
+ function checkRepeatingFields( i, f, triggerFieldId, selected, rec ) {
329
+ // Get class for repeating field
330
+ var repeatingFieldClass = '.'+ f.containerID;
331
+ if ( addingRow !== '' && addingRow != undefined ) {
332
+ repeatingFieldClass = '#' + addingRow +' '+ repeatingFieldClass;
333
+ }
334
+
335
+ // Get all repeating field divs
336
+ var repeatingFieldDivs = jQuery(repeatingFieldClass);
337
+ if ( repeatingFieldDivs.length ) {
338
+ var repeatingFields = repeatingFieldDivs.find('input, textarea, select');
339
+
340
+ // If non-hidden fields exist in the repeating field divs
341
+ if ( repeatingFields.length ) {
342
+ if ( addingRow === '' || addingRow === undefined ) {
343
+ var lastId = '';
344
+
345
+ // Loop through each input/select/textarea in repeating fields
346
+ repeatingFields.each(function(){
347
+ var thisId = jQuery(this).closest('.frm_form_field').attr('id');
348
+ if ( thisId != lastId ) { // don't trigger radio/checkbox multiple times
349
+ hideOrShowField(i, f, f.FieldName, selected, rec, jQuery(this));
350
+ }
351
+ lastId = thisId;
352
+ });
353
+ } else {
354
+ hideOrShowField(i, f, triggerFieldId, selected, rec, repeatingFields);
355
+ }
356
+ } else {
357
+ setEmptyKeyInArray(f);
358
+ show_fields[f.hideContainerID][i] = false;
359
+ hideFieldNow(i, f, rec);
360
+ }
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Check if only the dependent field is in a repeating section
366
+ */
367
+ function maybeUpdateHideBy( f ) {
368
  var hideContainer = document.getElementById(f.hideContainerID);
369
+ if ( hideContainer === null ) {
370
+ // it is a repeating section, use the class
371
  f.hideBy = '.';
372
  }
373
+ }
374
 
375
+ /**
376
+ * Get the entered/selected value in the current field
377
+ */
378
+ function getEnteredValue( i, f, triggerFieldId, selected, rec, parentField, getRepeat ) {
379
+ if ( f.FieldName !== triggerFieldId || typeof selected === 'undefined' || selected === 'und' ) {
380
  if ( ( f.Type === 'radio' || f.Type === 'data-radio' ) && parentField.attr('type') === 'radio' ) {
381
  selected = jQuery('input[name="'+ f.inputName +'"]:checked').val();
382
+ if ( typeof selected === 'undefined' ) {
383
+ selected = '';
384
+ }
385
  } else if ( f.Type === 'select' || f.Type === 'time' || f.Type === 'data-select' || ( f.Type !== 'checkbox' && f.Type !== 'data-checkbox' ) ) {
386
  selected = parentField.val();
387
  }
389
 
390
  if ( typeof selected === 'undefined' ) {
391
  if ( parentField.length === 0 ) {
392
+ return false; // the parent field is currently getting processed
393
  }
394
  selected = parentField.val();
395
+ }
396
 
397
  if ( typeof selected === 'undefined' ) {
398
+ // check for repeating/embedded field
399
+ if ( getRepeat === true ) {
400
+ var repeat = jQuery('.'+ f.containerID +' input, .'+ f.containerID +' select, .'+ f.containerID +' textarea');
401
+ if ( repeat.length ) {
402
+ repeat.each(function(){
403
+ hideOrShowField(i, f, f.FieldName, selected, rec, jQuery(this));
404
+ });
405
+ return false;
406
+ }
407
+ }
408
  selected = '';
409
  }
410
 
411
+ // get selected checkbox values
412
+ var checkVals = [];
413
+ if ( f.Type === 'checkbox' || f.Type === 'data-checkbox' ) {
414
+ checkVals = getCheckedVal(f.containerID, f.inputName);
415
 
416
+ if ( checkVals.length ) {
417
+ selected = checkVals;
418
+ }else{
419
+ selected = '';
420
+ }
421
+ }
422
+
423
+ return selected;
424
+ }
425
 
426
+ /**
427
+ * Add values to the show_fields array
428
+ */
429
+ function updateShowFields( i, f, selected ) {
430
  if ( selected === null || selected === '' || selected.length < 1 ) {
431
  show_fields[f.hideContainerID][i] = false;
432
  } else {
433
  show_fields[f.hideContainerID][i] = {'funcName':'getDataOpts', 'f':f, 'sel':selected};
434
  }
435
 
436
+ if ( f.Type === 'checkbox' || (f.Type === 'data-checkbox' && typeof f.LinkedField === 'undefined') ) {
437
+ show_fields[f.hideContainerID][i] = false;
438
 
439
+ var match = false;
440
+ if ( selected !== '') {
441
+ if ( f.Condition === '!=' ) {
442
+ show_fields[f.hideContainerID][i] = true;
443
+ }
444
+ for ( var b = 0; b<selected.length; b++ ) {
445
+ match = operators(f.Condition, f.Value, selected[b]);
446
+ if ( f.Condition === '!=' ) {
447
+ if ( show_fields[f.hideContainerID][i] === true && match === false ) {
448
+ show_fields[f.hideContainerID][i] = false;
449
+ }
450
+ } else if(show_fields[f.hideContainerID][i] === false && match){
451
+ show_fields[f.hideContainerID][i] = true;
452
+ }
453
+ }
454
+ } else {
455
+ match = operators(f.Condition, f.Value, '');
456
+ if(show_fields[f.hideContainerID][i] === false && match){
457
+ show_fields[f.hideContainerID][i] = true;
458
+ }
459
+ }
460
+ } else if ( typeof f.LinkedField !== 'undefined' && f.Type.indexOf('data-') === 0 ) {
461
  if ( typeof f.DataType === 'undefined' || f.DataType === 'data' ) {
462
+ if ( selected === '' ) {
463
+ hideAndClearDynamicField( f.hideContainerID, f.hideBy, f.HideField, 'hide' );
464
+ } else if ( f.Type === 'data-radio' ) {
465
+ if ( typeof f.DataType === 'undefined' ) {
466
+ show_fields[f.hideContainerID][i] = operators(f.Condition, f.Value, selected);
467
+ } else {
468
+ show_fields[f.hideContainerID][i] = {'funcName':'getData','f':f,'sel':selected};
469
+ }
470
+ } else if ( f.Type === 'data-checkbox' || ( f.Type === 'data-select' && isNotEmptyArray( selected ) ) ) {
471
+ hideAndClearDynamicField( f.hideContainerID, f.hideBy, f.HideField, 'show' );
472
+ show_fields[f.hideContainerID][i] = true;
473
+ getData(f, selected, 1);
474
+ } else if ( f.Type === 'data-select' ) {
475
+ show_fields[f.hideContainerID][i] = {'funcName':'getData','f':f,'sel':selected};
476
+ }
477
+ }
478
+ }else if ( typeof f.Value === 'undefined' && f.Type.indexOf('data') === 0 ) {
479
  if ( selected === '' ) {
480
  f.Value = '1';
481
  } else {
485
  f.Value = undefined;
486
  }else{
487
  show_fields[f.hideContainerID][i] = operators(f.Condition, f.Value, selected);
488
+ }
 
 
489
  }
490
 
491
  function setEmptyKeyInArray(f) {
494
  }
495
  }
496
 
497
+ /**
498
+ * If a dependent field is in a repeating section, adjust the show_fields array so it includes every repeating field individually
499
+ */
500
+ function adjustShowFieldsForRepeat(f, i){
501
+ var hideFieldRepeatContainer = jQuery( '.' + f.hideContainerID ).closest('.frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid');
502
+
503
+ if ( hideFieldRepeatContainer.length ) {
504
+ //f.hideContainerID is in repeating section
505
+ var result = show_fields[f.hideContainerID][i];
506
+ delete show_fields[f.hideContainerID];
507
+
508
+ var fCopy = f;
509
+ var originalId = f.hideContainerID;
510
+ var repeatId;
511
+ jQuery.each(hideFieldRepeatContainer, function(key,val){
512
+ repeatId = '-' + val.id.replace( 'frm_section_', '' ) + '_container';
513
+ repeatId = originalId.replace( '_container', repeatId );
514
+ fCopy.hideContainerID = repeatId;
515
+
516
+ setEmptyKeyInArray(fCopy);
517
+ show_fields[repeatId][i] = result;
518
+ });
519
+ }
520
+ }
521
+
522
  function hideAndClearDynamicField(hideContainer, hideBy, field_id, hide){
523
  if ( jQuery.inArray(hideContainer, hidden_fields) === -1 ) {
524
  hidden_fields[ field_id ] = hideContainer;
986
 
987
  var total = parseFloat(eval(thisFullCalc));
988
 
989
+ if ( typeof total === 'undefined' ) {
990
+ total = 0;
991
+ }
992
+
993
  // Set decimal points
994
  if ( isNumeric( dec ) ) {
995
  total = total.toFixed(dec);
996
  }
997
 
 
 
 
 
998
  if ( totalField.val() != total ) {
999
  totalField.val(total);
1000
  triggerChange( totalField, field_key );
1729
  /* update calculations when a row is removed */
1730
  if ( this.type != 'file' ) {
1731
  var fieldID = this.name.replace('item_meta[', '').split(']')[2].replace('[', '');
1732
+ doCalculation(fieldID, jQuery(this));
1733
  }
1734
  });
1735
  });
js/formidable.min.js CHANGED
@@ -1,64 +1,65 @@
1
  function frmFrontFormJS(){function l(a){var b=jQuery(this),c=b.attr("type");"submit"!==c&&a.preventDefault();a=b.parents("form:first");var d=b="",f=this.name;if("frm_prev_page"===f||-1!==this.className.indexOf("frm_prev_page"))b=jQuery(a).find(".frm_next_page").attr("id").replace("frm_next_p_","");else if("frm_save_draft"===f||-1!==this.className.indexOf("frm_save_draft"))d=1;jQuery(".frm_next_page").val(b);jQuery(".frm_saving_draft").val(d);"submit"!==c&&a.trigger("submit")}function n(){jQuery(this).parent().children(".frm_toggle_container").slideToggle("fast");
2
- jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function p(){this.className=this.className.replace("frm_transparent","");this.parentNode.getElementsByTagName("a")[0].className.indexOf("frm_clear_file_link")}function u(){var a=this.type,b=!1,c=!1;if("select-one"===a)c=!0,"frm_other_trigger"===this.options[this.selectedIndex].className&&(b=!0);else if("select-multiple"===a)for(var c=!0,d=this.options,
3
- b=!1,f=0;f<d.length;f++)if("frm_other_trigger"===d[f].className&&d[f].selected){b=!0;break}c?(a=jQuery(this).parent().children(".frm_other_input"),b?a[0].className=a[0].className.replace("frm_pos_none",""):(1>a[0].className.indexOf("frm_pos_none")&&(a[0].className+=" frm_pos_none"),a[0].value="")):"radio"===a?jQuery(this).is(":checked")&&(jQuery(this).closest(".frm_radio").children(".frm_other_input").removeClass("frm_pos_none"),jQuery(this).closest(".frm_radio").siblings().children(".frm_other_input").addClass("frm_pos_none").val("")):
4
- "checkbox"===a&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function v(a){var b=y(this);if(b&&"undefined"!==typeof b){var c="reset";if(a.frmTriggered){if(a.frmTriggered==b)return;c="persist"}r("und",b,null,jQuery(this),c);E(b,jQuery(this))}}function y(a,b){var c="",c=a instanceof jQuery?a.attr("name"):a.name,c=c.replace("item_meta[",
5
  "").replace("[]","").split("]"),c=c.filter(function(a){return""!==a}),d=c[0],f=!1;if(1===c.length)return d;jQuery('input[name="item_meta['+d+'][form]"]').length&&(d=c[2].replace("[",""),f=!0);"other"===d&&(d=f?c[3].replace("[",""):c[1].replace("[",""));!0===b&&(d=d+"-"+c[0]+"-"+c[1].replace("[",""));return d}function r(a,b,c,d,f){var e;if("undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[b])e=void 0;else{e=__FRMRULES[b];for(var h=[],g=0,k=e.length;g<k;g++){var l=e[g];if("undefined"!==
6
- typeof l)for(var F=0,n=l.Conditions.length;F<n;F++){var p=l.Conditions[F];p.HideField=l.Setting.FieldName;p.MatchType=l.MatchType;p.Show=l.Show;h.push(p)}}e=h}if("undefined"!==typeof e){if("undefined"===typeof c||null===c)c="go";"persist"!==f&&(m=[],C=[]);f=d;h=!1;""===w&&"undefined"!==typeof f&&null!==f&&(1<f.length&&(f=f.eq(0)),h=f.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid"),"undefined"!==typeof h?(w=h.attr("id"),h=!0):h=!1);f=h;h=e.length;for(g=0;g<h;g++)e[g].FieldName===b?
7
- q(g,e[g],b,a,c,d):q(g,e[g],b,a,c),g===h-1&&(Y(c),f&&(w=""))}}function q(a,b,c,d,f,e){b.inputName="item_meta["+b.FieldName+"]";b.hiddenName="item_meta["+b.HideField+"]";b.containerID="frm_field_"+b.FieldName+"_container";b.hideContainerID="frm_field_"+b.HideField+"_container";b.hideBy="#";var h=!1;if("undefined"!==typeof e&&null!==e){1<e.length&&(e=e.eq(0));if("undefined"===typeof e.attr("name"))return;b.inputName=e.attr("name").replace("[other]","").replace("[]","");var g=e.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");
8
- g.length&&(g=g.find(".frm_field_"+b.FieldName+"_container"),b.containerID=g.attr("id"),b.hideContainerID=b.containerID.replace(b.FieldName,b.HideField),b.hiddenName=b.inputName.replace("["+b.FieldName+"]","["+b.HideField+"]"))}else{x(b);h=!0;e=jQuery('input[name^="'+b.inputName+'"], textarea[name^="'+b.inputName+'"], select[name^="'+b.inputName+'"]');if(1>e.length&&(g="."+b.containerID,""!==w&&(g="#"+w+" "+g),g=jQuery(g),g.length)){e=g.find("input, textarea, select");if(e.length)if(""===w){var k=
9
- "";e.each(function(){var c=jQuery(this).closest(".frm_form_field").attr("id");c!=k&&q(a,b,b.FieldName,d,f,jQuery(this));k=c})}else q(a,b,c,d,f,e);else m[b.hideContainerID][a]=!1,K(a,b,f);return}1<e.length&&(e=e.eq(0))}x(b);null===document.getElementById(b.hideContainerID)&&(b.hideBy=".");if(b.FieldName!==c||"undefined"===typeof d||"und"===d)if(("radio"===b.Type||"data-radio"===b.Type)&&"radio"===e.attr("type"))d=jQuery('input[name="'+b.inputName+'"]:checked').val(),"undefined"===typeof d&&(d="");
10
- else if("select"===b.Type||"time"===b.Type||"data-select"===b.Type||"checkbox"!==b.Type&&"data-checkbox"!==b.Type)d=e.val();if("undefined"===typeof d){if(0===e.length)return;d=e.val()}if("undefined"===typeof d){if(!0===h&&(c=jQuery("."+b.containerID+" input, ."+b.containerID+" select, ."+b.containerID+" textarea"),c.length)){c.each(function(){q(a,b,b.FieldName,d,f,jQuery(this))});return}d=""}c=[];if("checkbox"===b.Type||"data-checkbox"===b.Type)c=Z(b.containerID,b.inputName),d=c.length?c:"";m[b.hideContainerID][a]=
11
- null===d||""===d||1>d.length?!1:{funcName:"getDataOpts",f:b,sel:d};if("checkbox"===b.Type||"data-checkbox"===b.Type&&"undefined"===typeof b.LinkedField)if(c=m[b.hideContainerID][a]=!1,""!==d)for("!="===b.Condition&&(m[b.hideContainerID][a]=!0),e=0;e<d.length;e++)c=z(b.Condition,b.Value,d[e]),"!="===b.Condition?!0===m[b.hideContainerID][a]&&!1===c&&(m[b.hideContainerID][a]=!1):!1===m[b.hideContainerID][a]&&c&&(m[b.hideContainerID][a]=!0);else c=z(b.Condition,b.Value,""),!1===m[b.hideContainerID][a]&&
12
- c&&(m[b.hideContainerID][a]=!0);else if("undefined"!==typeof b.LinkedField&&0===b.Type.indexOf("data-")){if("undefined"===typeof b.DataType||"data"===b.DataType)""===d?A(b.hideContainerID,b.hideBy,b.HideField,"hide"):"data-radio"===b.Type?m[b.hideContainerID][a]="undefined"===typeof b.DataType?z(b.Condition,b.Value,d):{funcName:"getData",f:b,sel:d}:"data-checkbox"===b.Type||"data-select"===b.Type&&aa(d)?(A(b.hideContainerID,b.hideBy,b.HideField,"show"),m[b.hideContainerID][a]=!0,L(b,d,1)):"data-select"===
13
- b.Type&&(m[b.hideContainerID][a]={funcName:"getData",f:b,sel:d})}else"undefined"===typeof b.Value&&0===b.Type.indexOf("data")?(b.Value=""===d?"1":d,m[b.hideContainerID][a]=z(b.Condition,b.Value,d),b.Value=void 0):m[b.hideContainerID][a]=z(b.Condition,b.Value,d);K(a,b,f)}function x(a){"undefined"===typeof m[a.hideContainerID]&&(m[a.hideContainerID]=[])}function A(a,b,c,d){-1===jQuery.inArray(a,C)&&(C[c]=a,a="."===b?jQuery("."+a):jQuery(document.getElementById(a)),"hide"===d&&a.hide(),a.find(".frm_data_field_container").empty())}
14
- function M(a,b){a.hide();if(-1===jQuery.inArray(a.attr("id"),C)){C[b.HideField]=a.attr("id");var c=N(a);if(c.length){c.prop("checked",!1).prop("selectedIndex",0);c.not(":checkbox, :radio, select").val("");var d=!1;c.each(function(){"SELECT"==this.tagName&&null!==document.getElementById(this.id+"_chosen")&&jQuery(this).trigger("chosen:updated");(!1===d||0>["checkbox","radio"].indexOf(this.type))&&B(jQuery(this));d=!0})}}}function N(a){return a.find('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]:not([type=hidden])')}
15
- function O(a,b){var c=N(a);a:{var d=c.length;if(c.is(":checkbox, :radio")){if(c.is(":checked"))break a}else if(c.val())break a;if(d)for(var f=0;f<d;f++){var e=jQuery(c[f]),h=e.data("frmval");if("undefined"!==typeof h)if(!e.is(":checkbox, :radio"))e.val(h),B(e);else if(e.val()==h||jQuery.isArray(h)&&-1!==jQuery.inArray(e.val(),h))e.prop("checked",!0),B(e)}}if(1<c.length)for(d=0;d<c.length;d++)P(b.HideField,jQuery(c[d]));else P(b.HideField,c);a.show()}function B(a,b){"undefined"===typeof b&&(b="dependent");
16
- 1<a.length&&(a=a.eq(0));a.trigger({type:"change",selfTriggered:!0,frmTriggered:b})}function K(a,b,c){if("all"===b.MatchType||!1===m[b.hideContainerID][a])G.push({result:m[b.hideContainerID][a],show:b.Show,match:b.MatchType,FieldName:b.FieldName,HideField:b.HideField,hideContainerID:b.hideContainerID,hideBy:b.hideBy});else{var d="none";if("show"===b.Show){if(!0!==m[b.hideContainerID][a]){Q(m[b.hideContainerID][a],b.FieldName,c);return}d=""}a="."===b.hideBy?jQuery("."+b.hideContainerID):jQuery(document.getElementById(b.hideContainerID));
17
- a.length&&("none"===d?M(a,b):O(a,b))}}function Y(a){jQuery.each(G,function(b,c){delete G[b];if("undefined"!==typeof c&&"undefined"!==typeof c.result){var d=jQuery(c.hideBy+c.hideContainerID),f=c.show;if(d.length){if("any"===c.match&&-1===jQuery.inArray(!0,m[c.hideContainerID])||"all"===c.match&&-1<jQuery.inArray(!1,m[c.hideContainerID]))f="show"===c.show?"hide":"show";"show"===f?(O(d,c),!1!==typeof c.result&&!0!==typeof c.result&&Q(c.result,c.FieldName,a)):M(d,c)}}})}function z(a,b,c){"undefined"===
18
- typeof c&&(c="");jQuery.isArray(c)&&-1<jQuery.inArray(b,c)&&(c=b);-1!==String(b).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)&&(b=parseFloat(b),c=parseFloat(c));return"-1"!=String(b).indexOf("&quot;")&&z(a,b.replace("&quot;",'"'),c)?!0:{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){return b?-1!=b.indexOf(a):0},"not LIKE":function(a,b){return b?-1==b.indexOf(a):1}}[a](b,c)}function Q(a,b,c){"getDataOpts"==
19
- a.funcName?ba(a.f,a.sel,b,c):"getData"==a.funcName&&L(a.f,a.sel,0)}function L(a,b,c){var d=document.getElementById(a.hideContainerID),f=jQuery(d).find(".frm_data_field_container");if(0===f.length)return!0;c||f.html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_get_data",entry_id:b,field_id:a.LinkedField,current_field:a.HideField,hide_id:a.hideContainerID,nonce:frm_js.nonce},success:function(a){c?f.append(a):f.html(a);var b=f.children("input"),
20
- g=b.val();d.style.display=""===a&&!c||""===g?"none":"";B(b);return!0}})}function ba(a,b,c,d){if(!("stop"==d&&-1<jQuery.inArray(a.HideField,H)&&a.parentField&&"hidden"==a.parentField.attr("type"))){var f=jQuery('input[name^="'+a.hiddenName+'"], select[name^="'+a.hiddenName+'"]:not(":disabled"), textarea[name^="'+a.hiddenName+'"]'),e=[];f.each(function(){"radio"===this.type||"checkbox"===this.type?!0===this.checked&&e.push(jQuery(this).val()):e.push(jQuery(this).val())});if("select"!=a.DataType||"stop"!=
21
- d&&!jQuery("#"+a.hideContainerID+" .frm-loading-img").length||!(-1<jQuery.inArray(a.HideField,H))){0===e.length&&(e="");H.push(a.HideField);var h=document.getElementById(a.hideContainerID),g=jQuery(h).find(".frm_data_field_container");if(0===g.length&&f.length)return r(e,a.HideField,"stop",f),!1;if(""!==a.Value&&!z(a.Condition,a.Value,b))return h.style.display="none",g.html(""),r("",a.HideField,"stop",f),!1;g.html('<span class="frm-loading-img" style="visibility:visible;display:inline;"></span>');
 
22
  var k=a.DataType;jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_data_options",hide_field:c,entry_id:b,selected_field_id:a.LinkedField,field_id:a.HideField,hide_id:a.hideContainerID,nonce:frm_js.nonce},success:function(b){g.html(b);var c=g.find("select, input, textarea"),d=1;"hidden"==c.attr("type")&&(d=c.val());""===b||""===d?(h.style.display="none",e=""):"all"!=a.MatchType&&(h.style.display="");""!==b&&""!==e&&(jQuery.isArray(e)||(b=[],b.push(e),e=b),jQuery.each(e,function(a,
23
- b){if("undefined"!==typeof b&&""!==b)if("checkbox"==k||"radio"==k)1<c.length?c.filter('[value="'+b+'"]').attr("checked","checked"):c.val()==b&&c.attr("checked","checked");else if("select"==k){var d=c.children('option[value="'+b+'"]');d.length?d.prop("selected",!0):e.splice(a,1)}else c.val(b)}));c.hasClass("frm_chzn")&&jQuery().chosen&&jQuery(".frm_chzn").chosen({allow_single_deselect:!0});B(c)}})}}}function E(a,b){if("undefined"!==typeof __FRMCALC){var c=__FRMCALC,d=c.fields[a];if("undefined"!==typeof d)for(var d=
24
- d.total,f=[],e=0,h=d.length;e<h;e++){var g;var k=b;g=c.calc[d[e]].field_id;var l=document.getElementById("frm_field_"+g+"_container");null!==l?g=0===l.offsetHeight?!0:!1:(k=k.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid"),k.length?(k=k[0].id.replace("frm_section_",""),g=document.getElementById("frm_field_"+g+"-"+k+"_container"),g=null!==g&&0===g.offsetHeight?!0:!1):g=!1);g||R(c,d[e],f,b)}}}function R(a,b,c,d){var f=a.calc[b],e=f.calc,h=jQuery(document.getElementById("field_"+b)),
25
- g={triggerField:d,inSection:!1,thisFieldCall:'input[id^="field_'+b+'-"]'};1>h.length&&"undefined"!==typeof d&&(g.inSection=!0,g.thisFieldId=ca(a.fieldsWithCalc,b),h=S(g));e=da(f,e,a,c,g);a=f.calc_dec;e.indexOf(").toFixed(")&&(c=e.split(").toFixed("),T(c[1])&&(a=c[1],e=e.replace(").toFixed("+a,"")));e=parseFloat(eval(e));T(a)&&(e=e.toFixed(a));"undefined"===typeof e&&(e=0);h.val()!=e&&(h.val(e),B(h,b))}function da(a,b,c,d,f){for(var e=0,h=a.fields.length;e<h;e++){var g={triggerField:f.triggerField,
26
  thisFieldId:a.fields[e],inSection:f.inSection,valKey:f.inSection+""+a.fields[e],thisField:c.fields[a.fields[e]],thisFieldCall:"input"+c.fieldKeys[a.fields[e]]},k=c;"checkbox"==g.thisField.type||"select"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,select"+k.fieldKeys[g.thisFieldId]+" option:selected,"+g.thisFieldCall+"[type=hidden]":"radio"==g.thisField.type||"scale"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,"+g.thisFieldCall+"[type=hidden]":"textarea"==g.thisField.type&&
27
- (g.thisFieldCall=g.thisFieldCall+",textarea"+k.fieldKeys[g.thisFieldId]);d=ea(g,c,d);if("undefined"===typeof d[g.valKey]||isNaN(d[g.valKey]))d[g.valKey]=0;k="["+g.thisFieldId+"]";k=k.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");b=b.replace(new RegExp(k,"g"),d[g.valKey])}return b}function P(a,b){if("undefined"!==typeof __FRMCALC){var c=__FRMCALC,d=c.fieldsWithCalc[a];"undefined"!==typeof d&&R(c,d,[],b)}}function ea(a,b,c){if("undefined"!==typeof c[a.valKey]&&0!==c[a.valKey])return c;c[a.valKey]=0;
28
- var d;if(!1===a.inSection)d=jQuery(a.thisFieldCall);else if(d=S(a),null===d||"undefined"===typeof d)d=jQuery(a.thisFieldCall);if(null===d||"undefined"===typeof d||1>d.length)return c;d.each(function(){var d;d=a.thisField;var e=!1;if("hidden"==this.type)""!==I(this)&&(e=!0);else if("select"==d.type){var h=this.className;h&&-1<h.indexOf("frm_other_trigger")&&(e=!0)}else("checkbox"==d.type||"radio"==d.type)&&-1<this.id.indexOf("-other_")&&0>this.id.indexOf("-otext")&&(e=!0);e?(e=0,"select"==d.type?"hidden"==
29
- this.type?(d=!1,2<this.name.split("[").length&&(d=!0),d||(e=I(this))):e=jQuery(this).closest(".frm_other_container").find(".frm_other_input").val():"checkbox"!=d.type&&"radio"!=d.type||"hidden"==this.type||(e=I(this)),d=e):d="checkbox"!==this.type&&"radio"!==this.type||!this.checked?jQuery(this).val():this.value;"undefined"===typeof d&&(d="");if("date"==a.thisField.type)d=jQuery.datepicker.parseDate(b.date,d),null!==d&&(c[a.valKey]=Math.ceil(d/864E5));else{""!==d&&0!==d&&(d=d.trim(),d=parseFloat(d.replace(/,/g,
30
- "").match(/-?[\d\.]+$/)));if("undefined"===typeof d||isNaN(d)||""===d)d=0;c[a.valKey]+=d}});return c}function S(a){if("undefined"===typeof a.triggerField)return null;var b=a.triggerField.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");return b.length?(a=a.thisFieldCall.replace("[id=","[id^="),b.find(a)):null}function I(a){var b="";a=document.getElementById(a.id+"-otext");null!==a&&""!==a.value&&(b=a.value);return b}function U(a,b){jQuery(a).find('input[type="submit"], input[type="button"]').attr("disabled",
31
  "disabled");jQuery(a).find(".frm_ajax_loading").addClass("frm_loading_now");"undefined"==typeof b&&jQuery(a).find('input[name="frm_action"]').val();jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(a).serialize()+"&action=frm_entries_"+b+"&nonce="+frm_js.nonce,success:function(b){b=b.replace(/^\s+|\s+$/g,"");0===b.indexOf("{")&&(b=jQuery.parseJSON(b));if(""===b||!b||"0"===b||"object"!=typeof b&&0===b.indexOf("<!DOCTYPE")){var d=document.getElementById("frm_loading");null!==d&&(b=jQuery(a).find("input[type=file]").val(),
32
  "undefined"!=typeof b&&""!==b&&setTimeout(function(){jQuery(d).fadeIn("slow")},2E3));b=jQuery(a).find(".g-recaptcha");b.length&&(1>jQuery(a).find(".frm_next_page").length||1>jQuery(a).find(".frm_next_page").val())&&b.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');a.submit()}else if("object"!=typeof b){jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");var f=jQuery(a).find('input[name="form_id"]').val();jQuery(a).closest("#frm_form_"+
33
  f+"_container").replaceWith(b);frmFrontForm.scrollMsg(f);if("function"==typeof frmThemeOverride_frmAfterSubmit){var f=jQuery('input[name="frm_page_order_'+f+'"]').val(),e=jQuery(b).find('input[name="form_id"]').val();frmThemeOverride_frmAfterSubmit(e,f,b,a)}b=jQuery(a).find('input[name="id"]');b.length&&jQuery(document.getElementById("frm_edit_"+b.val())).find("a").addClass("frm_ajax_edited").click()}else{jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");
34
  f=!0;jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");var e="",h=!1,g=null,k;for(k in b)if(g=jQuery(a).find(jQuery(document.getElementById("frm_field_"+k+"_container"))),g.length){if(!g.is(":visible")){var l=g.closest(".frm_toggle_container");l.length&&l.prev(".frm_trigger").click()}g.is(":visible")&&(f=!1,""===e&&(frmFrontForm.scrollMsg(k,a,!0),e="#frm_field_"+k+"_container"),jQuery(a).find("#frm_field_"+k+"_container .g-recaptcha").length&&(h=
35
- !0,grecaptcha.reset()),V(g,k,b))}else if("redirect"==k){window.location=b[k];return}!0!==h&&jQuery(a).find(".g-recaptcha").closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');f&&a.submit()}},error:function(){jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");a.submit()}})}function V(a,b,c){a.length&&a.is(":visible")&&(a.addClass("frm_blank_field"),"function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(b,
36
- c):a.append('<div class="frm_error">'+c[b]+"</div>"))}function fa(){W(jQuery(this),"clear")}function ga(){W(jQuery(this),"replace")}function W(a,b){var c=a.data("frmval").replace(/(\n|\r\n)/g,"\r");if(""===c||"undefined"==typeof c)return!1;var d=a.val().replace(/(\n|\r\n)/g,"\r");"replace"==b?""===d&&a.addClass("frm_default").val(c):d==c&&a.removeClass("frm_default").val("")}function ha(){var a=jQuery(this),b=a.data("eid"),c=a.data("fid");a.append('<span class="spinner" style="display:inline"></span>');
37
- jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:b,form_id:c,nonce:frm_js.nonce},success:function(b){a.replaceWith(b)}});return!1}function ia(a,b){google.load("visualization","1.0",{packages:[b],callback:function(){if("table"==b){var c=new google.visualization.DataTable,d=!1;-1!==jQuery.inArray("id",a.options.fields)&&(d=!0,c.addColumn("number",frm_js.id));for(var f=a.fields.length,e="string",h=0,g=f;h<g;h++){var k=a.fields[h],e=X(k);c.addColumn(e,k.name)}h=
38
- !1;a.options.edit_link&&(h=!0,c.addColumn("string",a.options.edit_link));g=!1;a.options.delete_link&&(g=!0,c.addColumn("string",a.options.delete_link));k=0;if(null!==a.entries){var l=a.entries.length;c.addRows(l);for(var m=0,n=0;n<l;n++){var k=0,p=a.entries[n];d&&(c.setCell(m,k,p.id),k++);for(var q=0,r=f;q<r;q++){var t=a.fields[q],e=X(t),t=p.metas[t.id];"number"!=e||null!==t&&""!==t?"boolean"==e&&(t=null===t||"false"==t||!1===t?!1:!0):t=0;c.setCell(m,k,t);k++}h&&("undefined"!==typeof p.editLink?c.setCell(m,
39
- k,'<a href="'+p.editLink+'">'+a.options.edit_link+"</a>"):c.setCell(m,k,""),k++);g&&("undefined"!==typeof p.deleteLink?c.setCell(m,k,'<a href="'+p.deleteLink+'" class="frm_delete_link" onclick="return confirm('+a.options.confirm+')">'+a.options.delete_link+"</a>"):c.setCell(m,k,""));m++}}else for(c.addRows(1),h=k=0,g=f;h<g;h++)0<k?c.setCell(0,k,""):c.setCell(0,k,a.options.no_entries),k++;(new google.visualization.Table(document.getElementById("frm_google_table_"+a.options.form_id))).draw(c,a.graphOpts)}else ja(a)}})}
40
- function X(a){var b="string";if("number"==a.type)b="number";else if("checkbox"==a.type||"select"==a.type){var c=a.options.length;"select"==a.type&&""===a.options[0]&&(c="post_status"==a.field_options.post_field?3:c-1);1==c&&(b="boolean")}return b}function ja(a){var b=new google.visualization.DataTable,c=!1,d=!1,f=a.rows.length;if(0<f)if("table"==a.type){c=!0;b.addRows(a.rows[f-1][0]+1);for(var e=0;e<f;e++)b.setCell(a.rows[e])}else if("undefined"!=typeof a.rows[0].tooltip)for(var d=c=!0,h=0;h<f;h++){e=
41
  a.rows[h].tooltip;delete a.rows[h].tooltip;var g=Object.keys(a.rows[h]).map(function(b){return a.rows[h][b]});a.rows[h]=g;a.rows[h].push(e)}f=a.cols.length;if(c){if(0<f)for(c=0;c<f;c++)e=a.cols[c],b.addColumn(e.type,e.name);d&&(b.addColumn({type:"string",role:"tooltip"}),b.addRows(a.rows))}else{b=[[]];for(d=0;d<f;d++)b[0].push(a.cols[d].name);b=b.concat(a.rows);b=google.visualization.arrayToDataTable(b)}d=a.type.charAt(0).toUpperCase()+a.type.slice(1)+"Chart";(new google.visualization[d](document.getElementById("chart_"+
42
- a.graph_id))).draw(b,a.options)}function ka(){var a=jQuery(this),b=a.data("fid");a.wrap('<div class="frm_file_names frm_uploaded_files">');for(var c=a.get(0).files,d=0;d<c.length;d++)0===d?a.after(c[d].name+' <a href="#" class="frm_clear_file_link">'+frm_js.remove+"</a>"):a.after(c[d].name+"<br/>");a.hide();c=a.attr("name");c!="item_meta["+b+"][]"&&c.replace("item_meta[","").replace("[]","").split("][");a.closest(".frm_form_field").find(".frm_uploaded_files:last").after('<input name="'+c+'" data-fid="'+
43
- b+'"class="frm_transparent frm_multiple_file" multiple="multiple" type="file" />')}function la(){ma(jQuery(this).parent(".frm_uploaded_files"))}function na(){jQuery(this).parent(".frm_file_names").replaceWith("");return!1}function oa(){var a="frm_section_"+jQuery(this).data("parent")+"-"+jQuery(this).data("key"),b=jQuery(document.getElementById(a)),c=b.find("input, select, textarea");b.fadeOut("slow",function(){b.remove();c.each(function(){if("file"!=this.type){var a=this.name.replace("item_meta[",
44
- "").split("]")[2].replace("[","");E(a)}})});return!1}function pa(){var a=jQuery(this).data("parent"),b=0;0<jQuery(".frm_repeat_"+a).length&&(b=1+parseInt(jQuery(".frm_repeat_"+a+":last").attr("id").replace("frm_section_"+a+"-","")),"undefined"==typeof b&&(b=1));jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_add_form_row",field_id:a,i:b,nonce:frm_js.nonce},success:function(b){var d=b.html,f=jQuery(d).hide().fadeIn("slow");jQuery(".frm_repeat_"+a+":last").after(f);var e=
45
- ["other"],h,g="reset";w=f.attr("id");jQuery(d).find("input, select, textarea").each(function(){"file"!=this.type&&(h=this.name.replace("item_meta[","").split("]")[2].replace("[",""),-1==jQuery.inArray(h,e)&&(e.push(h),r("und",h,null,jQuery(this),g),E(h,jQuery(this)),g="persist"))});w="";for(var f=0,k=b.logic.check.length;f<k;f++)-1==jQuery.inArray(b.logic.check[f],e)&&1>jQuery(d).find(".frm_field_"+b.logic.check[f]+"_container").length&&(r("und",b.logic.check[f],null,null,g),g="persist");0<jQuery(d).find(".star").length&&
46
- jQuery(".star").rating();0<jQuery(d).find(".frm_chzn").length&&jQuery().chosen&&jQuery(".frm_chzn").chosen({allow_single_deselect:!0});"function"==typeof frmThemeOverride_frmAddRow&&frmThemeOverride_frmAddRow(a,b)}});return!1}function ma(a){a.fadeOut("slow",function(){a.remove()})}function qa(){var a=jQuery(this).data("frmtoggle");jQuery(a).is(":visible")?jQuery(a).slideUp("fast"):jQuery(a).slideDown("fast");return!1}function ca(a,b){for(var c in a)if(a.hasOwnProperty(c)&&a[c]===b)return c;return null}
47
- function aa(a){return jQuery.isArray(a)&&(1<a.length||""!==a[0])}function T(a){return!jQuery.isArray(a)&&0<=a-parseFloat(a)+1}function Z(a,b){var c=[];if("undefined"==typeof document.querySelector)jQuery("#"+a+' input[type=checkbox]:checked, input[type=hidden][name^="'+b+'"]').each(function(){c.push(this.value)});else for(var d=document.querySelectorAll("#"+a+' input[type=checkbox], input[type=hidden][name^="'+b+'"]'),f=0;f<d.length;f++)("checkbox"==d[f].type&&d[f].checked||"hidden"==d[f].type)&&
48
- c.push(d[f].value);return c}var m=[],G=[],C=[],H=[],w="",J="",D=[];return{init:function(){jQuery(document).on("click",".frm_trigger",n);var a=jQuery(".frm_blank_field");a.length&&a.closest(".frm_toggle_container").prev(".frm_trigger").click();jQuery.isFunction(jQuery.fn.placeholder)?jQuery(".frm-show-form input, .frm-show-form textarea").placeholder():jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){""===jQuery(this).val()&&jQuery(this).blur()});jQuery(document).on("focus",
49
- ".frm_toggle_default",fa);jQuery(document).on("blur",".frm_toggle_default",ga);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(ha);jQuery(document).on("change",".frm_multiple_file",ka);jQuery(document).on("click",".frm_clear_file_link",na);jQuery(document).on("click",".frm_remove_link",la);jQuery(document).on("focusin","input[data-frmmask]",function(){jQuery(this).mask(jQuery(this).data("frmmask").toString())});jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',
50
- v);jQuery(document).on("click",'.frm-show-form input[type="submit"], .frm-show-form input[name="frm_prev_page"], .frm-show-form .frm_save_draft',l);jQuery(document).on("change",'.frm_other_container input[type="checkbox"], .frm_other_container input[type="radio"], .frm_other_container select',u);jQuery(document).on("change","input[type=file].frm_transparent",p);jQuery(document).on("click",".frm_remove_form_row",oa);jQuery(document).on("click",".frm_add_form_row",pa);jQuery("a[data-frmtoggle]").click(qa);
51
  jQuery(".frm_month_heading, .frm_year_heading").click(function(){var a=jQuery(this).children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s");a.hasClass("ui-icon-triangle-1-e")?(a.addClass("ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e"),jQuery(this).next(".frm_toggle_container").fadeIn("slow")):(a.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s"),jQuery(this).next(".frm_toggle_container").hide())})},submitForm:function(a){a.preventDefault();jQuery(this).find(".wp-editor-wrap").length&&
52
- "undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();J=jQuery(this).find('input[name="frm_action"]').val();D=[];frmFrontForm.getAjaxFormErrors(this);if(0===Object.keys(D).length)U(this,J);else{jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");for(var b in D)a=jQuery(this).find(jQuery("#frm_field_"+b+"_container")),V(a,b,D)}},getAjaxFormErrors:function(a){"function"==typeof frmThemeOverride_jsErrors&&(D=frmThemeOverride_jsErrors(J,a))},checkFormErrors:function(a,
53
- b){U(a,b)},scrollToID:function(a){a=jQuery(document.getElementById(a).offset());window.scrollTo(a.left,a.top)},scrollMsg:function(a,b,c){var d="";if(d="undefined"==typeof b?jQuery(document.getElementById("frm_form_"+a+"_container")).offset().top:jQuery(b).find(document.getElementById("frm_field_"+a+"_container")).offset().top){d-=frm_js.offset;a=jQuery("html").css("margin-top");b=jQuery("body").css("margin-top");if(a||b)d=d-parseInt(a)-parseInt(b);if(d&&window.innerHeight&&(a=document.documentElement.scrollTop||
54
  document.body.scrollTop,d>a+window.innerHeight||d<a))return"undefined"===typeof c?jQuery(window).scrollTop(d):jQuery("html,body").animate({scrollTop:d},500),!1}},hideCondFields:function(a){a=JSON.parse(a);for(var b=0,c=a.length;b<c;b++){var d=document.getElementById("frm_field_"+a[b]+"_container");null!==d?d.style.display="none":jQuery(".frm_field_"+a[b]+"_container").hide()}},checkDependent:function(a){a=JSON.parse(a);for(var b="reset",c=0,d=a.length;c<d;c++)r("und",a[c],null,null,b),b="persist"},
55
- loadGoogle:function(){if("undefined"!==typeof google&&google&&google.load)for(var a=__FRMTABLES,b=Object.keys(a),c=0;c<b.length;c++)for(var d=a[b[c]],f=b[c],e=0;e<d.length;e++)ia(d[e],f);else setTimeout(frmFrontForm.loadGoogle,30)},removeUsedTimes:function(a,b){var c=jQuery(a).parents("form:first").find('input[name="id"]');jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_fields_ajax_time_options",time_field:b,date_field:a.id,entry_id:c?c.val():"",date:jQuery(a).val(),
56
  nonce:frm_js.nonce},success:function(a){var c=jQuery(document.getElementById(b));c.find("option").removeAttr("disabled");if(a&&""!==a)for(var e in a)c.find('option[value="'+e+'"]').attr("disabled","disabled")}})},escapeHtml:function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},invisible:function(a){jQuery(a).css("visibility","hidden")},visible:function(a){jQuery(a).css("visibility","visible")}}}var frmFrontForm=frmFrontFormJS();
57
  jQuery(document).ready(function(l){frmFrontForm.init()});
58
- function frmEditEntry(l,n,p,u,v,y){var r=jQuery(document.getElementById("frm_edit_"+l)),q=r.html(),x=jQuery(document.getElementById(n+l)),A=x.html();x.html('<span class="frm-loading-img" id="'+n+l+'"></span><div class="frm_orig_content" style="display:none">'+A+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:p,entry_id:l,id:u,nonce:frm_js.nonce},success:function(A){x.children(".frm-loading-img").replaceWith(A);r.replaceWith('<span id="frm_edit_'+
59
- l+'"><a onclick="frmCancelEdit('+l+",'"+n+"','"+frmFrontForm.escapeHtml(q)+"',"+p+","+u+",'"+y+'\')" class="'+y+'">'+v+"</a></span>")}})}
60
- function frmCancelEdit(l,n,p,u,v,y){var r=jQuery(document.getElementById("frm_edit_"+l)),q=r.find("a"),x=q.html();q.hasClass("frm_ajax_edited")||(q=jQuery(document.getElementById(n+l)),q.children(".frm_forms").replaceWith(""),q.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));r.replaceWith('<a id="frm_edit_'+l+'" class="frm_edit_link '+y+'" href="javascript:frmEditEntry('+l+",'"+n+"',"+u+","+v+",'"+frmFrontForm.escapeHtml(x)+"','"+y+"')\">"+p+"</a>")}
61
- function frmUpdateField(l,n,p,u,v){jQuery(document.getElementById("frm_update_field_"+l+"_"+n)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:l,field_id:n,value:p,nonce:frm_js.nonce},success:function(){""===u.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+v)).fadeOut("slow"):jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+v)).replaceWith(u)}})}
62
  function frmDeleteEntry(l,n){jQuery(document.getElementById("frm_delete_"+l)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+l+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:l,nonce:frm_js.nonce},success:function(p){"success"==p.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById(n+l)).fadeOut("slow"):jQuery(document.getElementById("frm_delete_"+l)).replaceWith(p)}})}
63
  function frmOnSubmit(l){console.warn("DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm");frmFrontForm.submitForm(l,this)}
64
  function frm_resend_email(l,n){console.warn("DEPRECATED: function frm_resend_email in v2.0");$link=jQuery(document.getElementById("frm_resend_email"));$link.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:l,form_id:n,nonce:frm_js.nonce},success:function(l){$link.replaceWith(l)}})};
1
  function frmFrontFormJS(){function l(a){var b=jQuery(this),c=b.attr("type");"submit"!==c&&a.preventDefault();a=b.parents("form:first");var d=b="",f=this.name;if("frm_prev_page"===f||-1!==this.className.indexOf("frm_prev_page"))b=jQuery(a).find(".frm_next_page").attr("id").replace("frm_next_p_","");else if("frm_save_draft"===f||-1!==this.className.indexOf("frm_save_draft"))d=1;jQuery(".frm_next_page").val(b);jQuery(".frm_saving_draft").val(d);"submit"!==c&&a.trigger("submit")}function n(){jQuery(this).parent().children(".frm_toggle_container").slideToggle("fast");
2
+ jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function p(){this.className=this.className.replace("frm_transparent","");this.parentNode.getElementsByTagName("a")[0].className.indexOf("frm_clear_file_link")}function v(){var a=this.type,b=!1,c=!1;if("select-one"===a)c=!0,"frm_other_trigger"===this.options[this.selectedIndex].className&&(b=!0);else if("select-multiple"===a)for(var c=!0,d=this.options,
3
+ b=!1,f=0;f<d.length;f++)if("frm_other_trigger"===d[f].className&&d[f].selected){b=!0;break}c?(a=jQuery(this).parent().children(".frm_other_input"),a.length&&(b?a[0].className=a[0].className.replace("frm_pos_none",""):(1>a[0].className.indexOf("frm_pos_none")&&(a[0].className+=" frm_pos_none"),a[0].value=""))):"radio"===a?jQuery(this).is(":checked")&&(jQuery(this).closest(".frm_radio").children(".frm_other_input").removeClass("frm_pos_none"),jQuery(this).closest(".frm_radio").siblings().children(".frm_other_input").addClass("frm_pos_none").val("")):
4
+ "checkbox"===a&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function w(a){var b=y(this);if(b&&"undefined"!==typeof b){var c="reset";if(a.frmTriggered){if(a.frmTriggered==b)return;c="persist"}r("und",b,null,jQuery(this),c);E(b,jQuery(this))}}function y(a,b){var c="",c=a instanceof jQuery?a.attr("name"):a.name,c=c.replace("item_meta[",
5
  "").replace("[]","").split("]"),c=c.filter(function(a){return""!==a}),d=c[0],f=!1;if(1===c.length)return d;jQuery('input[name="item_meta['+d+'][form]"]').length&&(d=c[2].replace("[",""),f=!0);"other"===d&&(d=f?c[3].replace("[",""):c[1].replace("[",""));!0===b&&(d=d+"-"+c[0]+"-"+c[1].replace("[",""));return d}function r(a,b,c,d,f){var e;if("undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[b])e=void 0;else{e=__FRMRULES[b];for(var h=[],g=0,k=e.length;g<k;g++){var l=e[g];if("undefined"!==
6
+ typeof l)for(var F=0,n=l.Conditions.length;F<n;F++){var p=l.Conditions[F];p.HideField=l.Setting.FieldName;p.MatchType=l.MatchType;p.Show=l.Show;h.push(p)}}e=h}if("undefined"!==typeof e){if("undefined"===typeof c||null===c)c="go";"persist"!==f&&(m=[],B=[]);f=d;h=!1;""===u&&"undefined"!==typeof f&&null!==f&&(1<f.length&&(f=f.eq(0)),h=f.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid"),"undefined"!==typeof h?(u=h.attr("id"),h=!0):h=!1);f=h;h=e.length;for(g=0;g<h;g++)e[g].FieldName===b?
7
+ q(g,e[g],b,a,c,d):q(g,e[g],b,a,c),g===h-1&&(aa(c),f&&(u=""))}}function q(a,b,c,d,f,e){b.inputName="item_meta["+b.FieldName+"]";b.hiddenName="item_meta["+b.HideField+"]";b.containerID="frm_field_"+b.FieldName+"_container";b.hideContainerID="frm_field_"+b.HideField+"_container";b.hideBy="#";var h=!1;if("undefined"!==typeof e&&null!==e){e=x(e);if("undefined"===typeof e.attr("name"))return;var g=e.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");g.length&&(g=g.find(".frm_field_"+b.FieldName+
8
+ "_container"),b.containerID=g.attr("id"),b.hideContainerID=b.containerID.replace(b.FieldName,b.HideField),b.hiddenName=b.inputName.replace("["+b.FieldName+"]","["+b.HideField+"]"))}else{h=!0;e=jQuery('input[name^="'+b.inputName+'"], textarea[name^="'+b.inputName+'"], select[name^="'+b.inputName+'"]');if(1>e.length){C(a,b,c,d,f);return}e=x(e)}G(b);null===document.getElementById(b.hideContainerID)&&(b.hideBy=".");d=ba(a,b,c,d,f,e,h);if(!1!==d){c=d;m[b.hideContainerID][a]=null===c||""===c||1>c.length?
9
+ !1:{funcName:"getDataOpts",f:b,sel:c};if("checkbox"===b.Type||"data-checkbox"===b.Type&&"undefined"===typeof b.LinkedField)if(d=m[b.hideContainerID][a]=!1,""!==c)for("!="===b.Condition&&(m[b.hideContainerID][a]=!0),e=0;e<c.length;e++)d=z(b.Condition,b.Value,c[e]),"!="===b.Condition?!0===m[b.hideContainerID][a]&&!1===d&&(m[b.hideContainerID][a]=!1):!1===m[b.hideContainerID][a]&&d&&(m[b.hideContainerID][a]=!0);else d=z(b.Condition,b.Value,""),!1===m[b.hideContainerID][a]&&d&&(m[b.hideContainerID][a]=
10
+ !0);else if("undefined"!==typeof b.LinkedField&&0===b.Type.indexOf("data-")){if("undefined"===typeof b.DataType||"data"===b.DataType)""===c?L(b.hideContainerID,b.hideBy,b.HideField,"hide"):"data-radio"===b.Type?m[b.hideContainerID][a]="undefined"===typeof b.DataType?z(b.Condition,b.Value,c):{funcName:"getData",f:b,sel:c}:(!(d="data-checkbox"===b.Type)&&(d="data-select"===b.Type)&&(d=jQuery.isArray(c)&&(1<c.length||""!==c[0])),d?(L(b.hideContainerID,b.hideBy,b.HideField,"show"),m[b.hideContainerID][a]=
11
+ !0,M(b,c,1)):"data-select"===b.Type&&(m[b.hideContainerID][a]={funcName:"getData",f:b,sel:c}))}else"undefined"===typeof b.Value&&0===b.Type.indexOf("data")?(b.Value=""===c?"1":c,m[b.hideContainerID][a]=z(b.Condition,b.Value,c),b.Value=void 0):m[b.hideContainerID][a]=z(b.Condition,b.Value,c);ca(b,a);N(a,b,f)}}function x(a){1<a.length&&(a=a.eq(0));return a}function C(a,b,c,d,f){var e="."+b.containerID;""!==u&&void 0!=u&&(e="#"+u+" "+e);e=jQuery(e);if(e.length)if(e=e.find("input, textarea, select"),
12
+ e.length)if(""===u||void 0===u){var h="";e.each(function(){var c=jQuery(this).closest(".frm_form_field").attr("id");c!=h&&q(a,b,b.FieldName,d,f,jQuery(this));h=c})}else q(a,b,c,d,f,e);else G(b),m[b.hideContainerID][a]=!1,N(a,b,f)}function ba(a,b,c,d,f,e,h){if(b.FieldName!==c||"undefined"===typeof d||"und"===d)if(("radio"===b.Type||"data-radio"===b.Type)&&"radio"===e.attr("type"))d=jQuery('input[name="'+b.inputName+'"]:checked').val(),"undefined"===typeof d&&(d="");else if("select"===b.Type||"time"===
13
+ b.Type||"data-select"===b.Type||"checkbox"!==b.Type&&"data-checkbox"!==b.Type)d=e.val();if("undefined"===typeof d){if(0===e.length)return!1;d=e.val()}if("undefined"===typeof d){if(!0===h&&(c=jQuery("."+b.containerID+" input, ."+b.containerID+" select, ."+b.containerID+" textarea"),c.length))return c.each(function(){q(a,b,b.FieldName,d,f,jQuery(this))}),!1;d=""}c=[];if("checkbox"===b.Type||"data-checkbox"===b.Type)c=da(b.containerID,b.inputName),d=c.length?c:"";return d}function G(a){"undefined"===
14
+ typeof m[a.hideContainerID]&&(m[a.hideContainerID]=[])}function ca(a,b){var c=jQuery("."+a.hideContainerID).closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");if(c.length){var d=m[a.hideContainerID][b];delete m[a.hideContainerID];var f=a.hideContainerID,e;jQuery.each(c,function(c,g){e="-"+g.id.replace("frm_section_","")+"_container";e=f.replace("_container",e);a.hideContainerID=e;G(a);m[e][b]=d})}}function L(a,b,c,d){-1===jQuery.inArray(a,B)&&(B[c]=a,a="."===b?jQuery("."+a):jQuery(document.getElementById(a)),
15
+ "hide"===d&&a.hide(),a.find(".frm_data_field_container").empty())}function O(a,b){a.hide();if(-1===jQuery.inArray(a.attr("id"),B)){B[b.HideField]=a.attr("id");var c=P(a);if(c.length){c.prop("checked",!1).prop("selectedIndex",0);c.not(":checkbox, :radio, select").val("");var d=!1;c.each(function(){"SELECT"==this.tagName&&null!==document.getElementById(this.id+"_chosen")&&jQuery(this).trigger("chosen:updated");(!1===d||0>["checkbox","radio"].indexOf(this.type))&&A(jQuery(this));d=!0})}}}function P(a){return a.find('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]:not([type=hidden])')}
16
+ function Q(a,b){var c=P(a);a:{var d=c.length;if(c.is(":checkbox, :radio")){if(c.is(":checked"))break a}else if(c.val())break a;if(d)for(var f=0;f<d;f++){var e=jQuery(c[f]),h=e.data("frmval");if("undefined"!==typeof h)if(!e.is(":checkbox, :radio"))e.val(h),A(e);else if(e.val()==h||jQuery.isArray(h)&&-1!==jQuery.inArray(e.val(),h))e.prop("checked",!0),A(e)}}if(1<c.length)for(d=0;d<c.length;d++)R(b.HideField,jQuery(c[d]));else R(b.HideField,c);a.show()}function A(a,b){"undefined"===typeof b&&(b="dependent");
17
+ 1<a.length&&(a=a.eq(0));a.trigger({type:"change",selfTriggered:!0,frmTriggered:b})}function N(a,b,c){if("all"===b.MatchType||!1===m[b.hideContainerID][a])H.push({result:m[b.hideContainerID][a],show:b.Show,match:b.MatchType,FieldName:b.FieldName,HideField:b.HideField,hideContainerID:b.hideContainerID,hideBy:b.hideBy});else{var d="none";if("show"===b.Show){if(!0!==m[b.hideContainerID][a]){S(m[b.hideContainerID][a],b.FieldName,c);return}d=""}a="."===b.hideBy?jQuery("."+b.hideContainerID):jQuery(document.getElementById(b.hideContainerID));
18
+ a.length&&("none"===d?O(a,b):Q(a,b))}}function aa(a){jQuery.each(H,function(b,c){delete H[b];if("undefined"!==typeof c&&"undefined"!==typeof c.result){var d=jQuery(c.hideBy+c.hideContainerID),f=c.show;if(d.length){if("any"===c.match&&-1===jQuery.inArray(!0,m[c.hideContainerID])||"all"===c.match&&-1<jQuery.inArray(!1,m[c.hideContainerID]))f="show"===c.show?"hide":"show";"show"===f?(Q(d,c),!1!==typeof c.result&&!0!==typeof c.result&&S(c.result,c.FieldName,a)):O(d,c)}}})}function z(a,b,c){"undefined"===
19
+ typeof c&&(c="");jQuery.isArray(c)&&-1<jQuery.inArray(b,c)&&(c=b);-1!==String(b).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)&&(b=parseFloat(b),c=parseFloat(c));return"-1"!=String(b).indexOf("&quot;")&&z(a,b.replace("&quot;",'"'),c)?!0:{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){return b?-1!=b.indexOf(a):0},"not LIKE":function(a,b){return b?-1==b.indexOf(a):1}}[a](b,c)}function S(a,b,c){"getDataOpts"==
20
+ a.funcName?ea(a.f,a.sel,b,c):"getData"==a.funcName&&M(a.f,a.sel,0)}function M(a,b,c){var d=document.getElementById(a.hideContainerID),f=jQuery(d).find(".frm_data_field_container");if(0===f.length)return!0;c||f.html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_get_data",entry_id:b,field_id:a.LinkedField,current_field:a.HideField,hide_id:a.hideContainerID,nonce:frm_js.nonce},success:function(a){c?f.append(a):f.html(a);var b=f.children("input"),
21
+ g=b.val();d.style.display=""===a&&!c||""===g?"none":"";A(b);return!0}})}function ea(a,b,c,d){if(!("stop"==d&&-1<jQuery.inArray(a.HideField,I)&&a.parentField&&"hidden"==a.parentField.attr("type"))){var f=jQuery('input[name^="'+a.hiddenName+'"], select[name^="'+a.hiddenName+'"]:not(":disabled"), textarea[name^="'+a.hiddenName+'"]'),e=[];f.each(function(){"radio"===this.type||"checkbox"===this.type?!0===this.checked&&e.push(jQuery(this).val()):e.push(jQuery(this).val())});if("select"!=a.DataType||"stop"!=
22
+ d&&!jQuery("#"+a.hideContainerID+" .frm-loading-img").length||!(-1<jQuery.inArray(a.HideField,I))){0===e.length&&(e="");I.push(a.HideField);var h=document.getElementById(a.hideContainerID),g=jQuery(h).find(".frm_data_field_container");if(0===g.length&&f.length)return r(e,a.HideField,"stop",f),!1;if(""!==a.Value&&!z(a.Condition,a.Value,b))return h.style.display="none",g.html(""),r("",a.HideField,"stop",f),!1;g.html('<span class="frm-loading-img" style="visibility:visible;display:inline;"></span>');
23
  var k=a.DataType;jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_data_options",hide_field:c,entry_id:b,selected_field_id:a.LinkedField,field_id:a.HideField,hide_id:a.hideContainerID,nonce:frm_js.nonce},success:function(b){g.html(b);var c=g.find("select, input, textarea"),d=1;"hidden"==c.attr("type")&&(d=c.val());""===b||""===d?(h.style.display="none",e=""):"all"!=a.MatchType&&(h.style.display="");""!==b&&""!==e&&(jQuery.isArray(e)||(b=[],b.push(e),e=b),jQuery.each(e,function(a,
24
+ b){if("undefined"!==typeof b&&""!==b)if("checkbox"==k||"radio"==k)1<c.length?c.filter('[value="'+b+'"]').attr("checked","checked"):c.val()==b&&c.attr("checked","checked");else if("select"==k){var d=c.children('option[value="'+b+'"]');d.length?d.prop("selected",!0):e.splice(a,1)}else c.val(b)}));c.hasClass("frm_chzn")&&jQuery().chosen&&jQuery(".frm_chzn").chosen({allow_single_deselect:!0});A(c)}})}}}function E(a,b){if("undefined"!==typeof __FRMCALC){var c=__FRMCALC,d=c.fields[a];if("undefined"!==typeof d)for(var d=
25
+ d.total,f=[],e=0,h=d.length;e<h;e++){var g;var k=b;g=c.calc[d[e]].field_id;var l=document.getElementById("frm_field_"+g+"_container");null!==l?g=0===l.offsetHeight?!0:!1:(k=k.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid"),k.length?(k=k[0].id.replace("frm_section_",""),g=document.getElementById("frm_field_"+g+"-"+k+"_container"),g=null!==g&&0===g.offsetHeight?!0:!1):g=!1);g||T(c,d[e],f,b)}}}function T(a,b,c,d){var f=a.calc[b],e=f.calc,h=jQuery(document.getElementById("field_"+b)),
26
+ g={triggerField:d,inSection:!1,thisFieldCall:'input[id^="field_'+b+'-"]'};1>h.length&&"undefined"!==typeof d&&(g.inSection=!0,g.thisFieldId=fa(a.fieldsWithCalc,b),h=U(g));e=ga(f,e,a,c,g);a=f.calc_dec;e.indexOf(").toFixed(")&&(c=e.split(").toFixed("),V(c[1])&&(a=c[1],e=e.replace(").toFixed("+a,"")));e=parseFloat(eval(e));"undefined"===typeof e&&(e=0);V(a)&&(e=e.toFixed(a));h.val()!=e&&(h.val(e),A(h,b))}function ga(a,b,c,d,f){for(var e=0,h=a.fields.length;e<h;e++){var g={triggerField:f.triggerField,
27
  thisFieldId:a.fields[e],inSection:f.inSection,valKey:f.inSection+""+a.fields[e],thisField:c.fields[a.fields[e]],thisFieldCall:"input"+c.fieldKeys[a.fields[e]]},k=c;"checkbox"==g.thisField.type||"select"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,select"+k.fieldKeys[g.thisFieldId]+" option:selected,"+g.thisFieldCall+"[type=hidden]":"radio"==g.thisField.type||"scale"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,"+g.thisFieldCall+"[type=hidden]":"textarea"==g.thisField.type&&
28
+ (g.thisFieldCall=g.thisFieldCall+",textarea"+k.fieldKeys[g.thisFieldId]);d=ha(g,c,d);if("undefined"===typeof d[g.valKey]||isNaN(d[g.valKey]))d[g.valKey]=0;k="["+g.thisFieldId+"]";k=k.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");b=b.replace(new RegExp(k,"g"),d[g.valKey])}return b}function R(a,b){if("undefined"!==typeof __FRMCALC){var c=__FRMCALC,d=c.fieldsWithCalc[a];"undefined"!==typeof d&&T(c,d,[],b)}}function ha(a,b,c){if("undefined"!==typeof c[a.valKey]&&0!==c[a.valKey])return c;c[a.valKey]=0;
29
+ var d;if(!1===a.inSection)d=jQuery(a.thisFieldCall);else if(d=U(a),null===d||"undefined"===typeof d)d=jQuery(a.thisFieldCall);if(null===d||"undefined"===typeof d||1>d.length)return c;d.each(function(){var d;d=a.thisField;var e=!1;if("hidden"==this.type)""!==J(this)&&(e=!0);else if("select"==d.type){var h=this.className;h&&-1<h.indexOf("frm_other_trigger")&&(e=!0)}else("checkbox"==d.type||"radio"==d.type)&&-1<this.id.indexOf("-other_")&&0>this.id.indexOf("-otext")&&(e=!0);e?(e=0,"select"==d.type?"hidden"==
30
+ this.type?(d=!1,2<this.name.split("[").length&&(d=!0),d||(e=J(this))):e=jQuery(this).closest(".frm_other_container").find(".frm_other_input").val():"checkbox"!=d.type&&"radio"!=d.type||"hidden"==this.type||(e=J(this)),d=e):d="checkbox"!==this.type&&"radio"!==this.type||!this.checked?jQuery(this).val():this.value;"undefined"===typeof d&&(d="");if("date"==a.thisField.type)d=jQuery.datepicker.parseDate(b.date,d),null!==d&&(c[a.valKey]=Math.ceil(d/864E5));else{""!==d&&0!==d&&(d=d.trim(),d=parseFloat(d.replace(/,/g,
31
+ "").match(/-?[\d\.]+$/)));if("undefined"===typeof d||isNaN(d)||""===d)d=0;c[a.valKey]+=d}});return c}function U(a){if("undefined"===typeof a.triggerField)return null;var b=a.triggerField.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");return b.length?(a=a.thisFieldCall.replace("[id=","[id^="),b.find(a)):null}function J(a){var b="";a=document.getElementById(a.id+"-otext");null!==a&&""!==a.value&&(b=a.value);return b}function W(a,b){jQuery(a).find('input[type="submit"], input[type="button"]').attr("disabled",
32
  "disabled");jQuery(a).find(".frm_ajax_loading").addClass("frm_loading_now");"undefined"==typeof b&&jQuery(a).find('input[name="frm_action"]').val();jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(a).serialize()+"&action=frm_entries_"+b+"&nonce="+frm_js.nonce,success:function(b){b=b.replace(/^\s+|\s+$/g,"");0===b.indexOf("{")&&(b=jQuery.parseJSON(b));if(""===b||!b||"0"===b||"object"!=typeof b&&0===b.indexOf("<!DOCTYPE")){var d=document.getElementById("frm_loading");null!==d&&(b=jQuery(a).find("input[type=file]").val(),
33
  "undefined"!=typeof b&&""!==b&&setTimeout(function(){jQuery(d).fadeIn("slow")},2E3));b=jQuery(a).find(".g-recaptcha");b.length&&(1>jQuery(a).find(".frm_next_page").length||1>jQuery(a).find(".frm_next_page").val())&&b.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');a.submit()}else if("object"!=typeof b){jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");var f=jQuery(a).find('input[name="form_id"]').val();jQuery(a).closest("#frm_form_"+
34
  f+"_container").replaceWith(b);frmFrontForm.scrollMsg(f);if("function"==typeof frmThemeOverride_frmAfterSubmit){var f=jQuery('input[name="frm_page_order_'+f+'"]').val(),e=jQuery(b).find('input[name="form_id"]').val();frmThemeOverride_frmAfterSubmit(e,f,b,a)}b=jQuery(a).find('input[name="id"]');b.length&&jQuery(document.getElementById("frm_edit_"+b.val())).find("a").addClass("frm_ajax_edited").click()}else{jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");
35
  f=!0;jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");var e="",h=!1,g=null,k;for(k in b)if(g=jQuery(a).find(jQuery(document.getElementById("frm_field_"+k+"_container"))),g.length){if(!g.is(":visible")){var l=g.closest(".frm_toggle_container");l.length&&l.prev(".frm_trigger").click()}g.is(":visible")&&(f=!1,""===e&&(frmFrontForm.scrollMsg(k,a,!0),e="#frm_field_"+k+"_container"),jQuery(a).find("#frm_field_"+k+"_container .g-recaptcha").length&&(h=
36
+ !0,grecaptcha.reset()),X(g,k,b))}else if("redirect"==k){window.location=b[k];return}!0!==h&&jQuery(a).find(".g-recaptcha").closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');f&&a.submit()}},error:function(){jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");a.submit()}})}function X(a,b,c){a.length&&a.is(":visible")&&(a.addClass("frm_blank_field"),"function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(b,
37
+ c):a.append('<div class="frm_error">'+c[b]+"</div>"))}function ia(){Y(jQuery(this),"clear")}function ja(){Y(jQuery(this),"replace")}function Y(a,b){var c=a.data("frmval").replace(/(\n|\r\n)/g,"\r");if(""===c||"undefined"==typeof c)return!1;var d=a.val().replace(/(\n|\r\n)/g,"\r");"replace"==b?""===d&&a.addClass("frm_default").val(c):d==c&&a.removeClass("frm_default").val("")}function ka(){var a=jQuery(this),b=a.data("eid"),c=a.data("fid");a.append('<span class="spinner" style="display:inline"></span>');
38
+ jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:b,form_id:c,nonce:frm_js.nonce},success:function(b){a.replaceWith(b)}});return!1}function la(a,b){google.load("visualization","1.0",{packages:[b],callback:function(){if("table"==b){var c=new google.visualization.DataTable,d=!1;-1!==jQuery.inArray("id",a.options.fields)&&(d=!0,c.addColumn("number",frm_js.id));for(var f=a.fields.length,e="string",h=0,g=f;h<g;h++){var k=a.fields[h],e=Z(k);c.addColumn(e,k.name)}h=
39
+ !1;a.options.edit_link&&(h=!0,c.addColumn("string",a.options.edit_link));g=!1;a.options.delete_link&&(g=!0,c.addColumn("string",a.options.delete_link));k=0;if(null!==a.entries){var l=a.entries.length;c.addRows(l);for(var m=0,n=0;n<l;n++){var k=0,p=a.entries[n];d&&(c.setCell(m,k,p.id),k++);for(var q=0,r=f;q<r;q++){var t=a.fields[q],e=Z(t),t=p.metas[t.id];"number"!=e||null!==t&&""!==t?"boolean"==e&&(t=null===t||"false"==t||!1===t?!1:!0):t=0;c.setCell(m,k,t);k++}h&&("undefined"!==typeof p.editLink?c.setCell(m,
40
+ k,'<a href="'+p.editLink+'">'+a.options.edit_link+"</a>"):c.setCell(m,k,""),k++);g&&("undefined"!==typeof p.deleteLink?c.setCell(m,k,'<a href="'+p.deleteLink+'" class="frm_delete_link" onclick="return confirm('+a.options.confirm+')">'+a.options.delete_link+"</a>"):c.setCell(m,k,""));m++}}else for(c.addRows(1),h=k=0,g=f;h<g;h++)0<k?c.setCell(0,k,""):c.setCell(0,k,a.options.no_entries),k++;(new google.visualization.Table(document.getElementById("frm_google_table_"+a.options.form_id))).draw(c,a.graphOpts)}else ma(a)}})}
41
+ function Z(a){var b="string";if("number"==a.type)b="number";else if("checkbox"==a.type||"select"==a.type){var c=a.options.length;"select"==a.type&&""===a.options[0]&&(c="post_status"==a.field_options.post_field?3:c-1);1==c&&(b="boolean")}return b}function ma(a){var b=new google.visualization.DataTable,c=!1,d=!1,f=a.rows.length;if(0<f)if("table"==a.type){c=!0;b.addRows(a.rows[f-1][0]+1);for(var e=0;e<f;e++)b.setCell(a.rows[e])}else if("undefined"!=typeof a.rows[0].tooltip)for(var d=c=!0,h=0;h<f;h++){e=
42
  a.rows[h].tooltip;delete a.rows[h].tooltip;var g=Object.keys(a.rows[h]).map(function(b){return a.rows[h][b]});a.rows[h]=g;a.rows[h].push(e)}f=a.cols.length;if(c){if(0<f)for(c=0;c<f;c++)e=a.cols[c],b.addColumn(e.type,e.name);d&&(b.addColumn({type:"string",role:"tooltip"}),b.addRows(a.rows))}else{b=[[]];for(d=0;d<f;d++)b[0].push(a.cols[d].name);b=b.concat(a.rows);b=google.visualization.arrayToDataTable(b)}d=a.type.charAt(0).toUpperCase()+a.type.slice(1)+"Chart";(new google.visualization[d](document.getElementById("chart_"+
43
+ a.graph_id))).draw(b,a.options)}function na(){var a=jQuery(this),b=a.data("fid");a.wrap('<div class="frm_file_names frm_uploaded_files">');for(var c=a.get(0).files,d=0;d<c.length;d++)0===d?a.after(c[d].name+' <a href="#" class="frm_clear_file_link">'+frm_js.remove+"</a>"):a.after(c[d].name+"<br/>");a.hide();c=a.attr("name");c!="item_meta["+b+"][]"&&c.replace("item_meta[","").replace("[]","").split("][");a.closest(".frm_form_field").find(".frm_uploaded_files:last").after('<input name="'+c+'" data-fid="'+
44
+ b+'"class="frm_transparent frm_multiple_file" multiple="multiple" type="file" />')}function oa(){pa(jQuery(this).parent(".frm_uploaded_files"))}function qa(){jQuery(this).parent(".frm_file_names").replaceWith("");return!1}function ra(){var a="frm_section_"+jQuery(this).data("parent")+"-"+jQuery(this).data("key"),b=jQuery(document.getElementById(a)),c=b.find("input, select, textarea");b.fadeOut("slow",function(){b.remove();c.each(function(){if("file"!=this.type){var a=this.name.replace("item_meta[",
45
+ "").split("]")[2].replace("[","");E(a,jQuery(this))}})});return!1}function sa(){var a=jQuery(this).data("parent"),b=0;0<jQuery(".frm_repeat_"+a).length&&(b=1+parseInt(jQuery(".frm_repeat_"+a+":last").attr("id").replace("frm_section_"+a+"-","")),"undefined"==typeof b&&(b=1));jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_add_form_row",field_id:a,i:b,nonce:frm_js.nonce},success:function(b){var d=b.html,f=jQuery(d).hide().fadeIn("slow");jQuery(".frm_repeat_"+a+":last").after(f);
46
+ var e=["other"],h,g="reset";u=f.attr("id");jQuery(d).find("input, select, textarea").each(function(){"file"!=this.type&&(h=this.name.replace("item_meta[","").split("]")[2].replace("[",""),-1==jQuery.inArray(h,e)&&(e.push(h),r("und",h,null,jQuery(this),g),E(h,jQuery(this)),g="persist"))});u="";for(var f=0,k=b.logic.check.length;f<k;f++)-1==jQuery.inArray(b.logic.check[f],e)&&1>jQuery(d).find(".frm_field_"+b.logic.check[f]+"_container").length&&(r("und",b.logic.check[f],null,null,g),g="persist");0<
47
+ jQuery(d).find(".star").length&&jQuery(".star").rating();0<jQuery(d).find(".frm_chzn").length&&jQuery().chosen&&jQuery(".frm_chzn").chosen({allow_single_deselect:!0});"function"==typeof frmThemeOverride_frmAddRow&&frmThemeOverride_frmAddRow(a,b)}});return!1}function pa(a){a.fadeOut("slow",function(){a.remove()})}function ta(){var a=jQuery(this).data("frmtoggle");jQuery(a).is(":visible")?jQuery(a).slideUp("fast"):jQuery(a).slideDown("fast");return!1}function fa(a,b){for(var c in a)if(a.hasOwnProperty(c)&&
48
+ a[c]===b)return c;return null}function V(a){return!jQuery.isArray(a)&&0<=a-parseFloat(a)+1}function da(a,b){var c=[];if("undefined"==typeof document.querySelector)jQuery("#"+a+' input[type=checkbox]:checked, input[type=hidden][name^="'+b+'"]').each(function(){c.push(this.value)});else for(var d=document.querySelectorAll("#"+a+' input[type=checkbox], input[type=hidden][name^="'+b+'"]'),f=0;f<d.length;f++)("checkbox"==d[f].type&&d[f].checked||"hidden"==d[f].type)&&c.push(d[f].value);return c}var m=
49
+ [],H=[],B=[],I=[],u="",K="",D=[];return{init:function(){jQuery(document).on("click",".frm_trigger",n);var a=jQuery(".frm_blank_field");a.length&&a.closest(".frm_toggle_container").prev(".frm_trigger").click();jQuery.isFunction(jQuery.fn.placeholder)?jQuery(".frm-show-form input, .frm-show-form textarea").placeholder():jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){""===jQuery(this).val()&&jQuery(this).blur()});jQuery(document).on("focus",".frm_toggle_default",
50
+ ia);jQuery(document).on("blur",".frm_toggle_default",ja);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(ka);jQuery(document).on("change",".frm_multiple_file",na);jQuery(document).on("click",".frm_clear_file_link",qa);jQuery(document).on("click",".frm_remove_link",oa);jQuery(document).on("focusin","input[data-frmmask]",function(){jQuery(this).mask(jQuery(this).data("frmmask").toString())});jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',
51
+ w);jQuery(document).on("click",'.frm-show-form input[type="submit"], .frm-show-form input[name="frm_prev_page"], .frm-show-form .frm_save_draft',l);jQuery(document).on("change",'.frm_other_container input[type="checkbox"], .frm_other_container input[type="radio"], .frm_other_container select',v);jQuery(document).on("change","input[type=file].frm_transparent",p);jQuery(document).on("click",".frm_remove_form_row",ra);jQuery(document).on("click",".frm_add_form_row",sa);jQuery("a[data-frmtoggle]").click(ta);
52
  jQuery(".frm_month_heading, .frm_year_heading").click(function(){var a=jQuery(this).children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s");a.hasClass("ui-icon-triangle-1-e")?(a.addClass("ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e"),jQuery(this).next(".frm_toggle_container").fadeIn("slow")):(a.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s"),jQuery(this).next(".frm_toggle_container").hide())})},submitForm:function(a){a.preventDefault();jQuery(this).find(".wp-editor-wrap").length&&
53
+ "undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();K=jQuery(this).find('input[name="frm_action"]').val();D=[];frmFrontForm.getAjaxFormErrors(this);if(0===Object.keys(D).length)W(this,K);else{jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");for(var b in D)a=jQuery(this).find(jQuery("#frm_field_"+b+"_container")),X(a,b,D)}},getAjaxFormErrors:function(a){"function"==typeof frmThemeOverride_jsErrors&&(D=frmThemeOverride_jsErrors(K,a))},checkFormErrors:function(a,
54
+ b){W(a,b)},scrollToID:function(a){a=jQuery(document.getElementById(a).offset());window.scrollTo(a.left,a.top)},scrollMsg:function(a,b,c){var d="";if(d="undefined"==typeof b?jQuery(document.getElementById("frm_form_"+a+"_container")).offset().top:jQuery(b).find(document.getElementById("frm_field_"+a+"_container")).offset().top){d-=frm_js.offset;a=jQuery("html").css("margin-top");b=jQuery("body").css("margin-top");if(a||b)d=d-parseInt(a)-parseInt(b);if(d&&window.innerHeight&&(a=document.documentElement.scrollTop||
55
  document.body.scrollTop,d>a+window.innerHeight||d<a))return"undefined"===typeof c?jQuery(window).scrollTop(d):jQuery("html,body").animate({scrollTop:d},500),!1}},hideCondFields:function(a){a=JSON.parse(a);for(var b=0,c=a.length;b<c;b++){var d=document.getElementById("frm_field_"+a[b]+"_container");null!==d?d.style.display="none":jQuery(".frm_field_"+a[b]+"_container").hide()}},checkDependent:function(a){a=JSON.parse(a);for(var b="reset",c=0,d=a.length;c<d;c++)r("und",a[c],null,null,b),b="persist"},
56
+ loadGoogle:function(){if("undefined"!==typeof google&&google&&google.load)for(var a=__FRMTABLES,b=Object.keys(a),c=0;c<b.length;c++)for(var d=a[b[c]],f=b[c],e=0;e<d.length;e++)la(d[e],f);else setTimeout(frmFrontForm.loadGoogle,30)},removeUsedTimes:function(a,b){var c=jQuery(a).parents("form:first").find('input[name="id"]');jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_fields_ajax_time_options",time_field:b,date_field:a.id,entry_id:c?c.val():"",date:jQuery(a).val(),
57
  nonce:frm_js.nonce},success:function(a){var c=jQuery(document.getElementById(b));c.find("option").removeAttr("disabled");if(a&&""!==a)for(var e in a)c.find('option[value="'+e+'"]').attr("disabled","disabled")}})},escapeHtml:function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},invisible:function(a){jQuery(a).css("visibility","hidden")},visible:function(a){jQuery(a).css("visibility","visible")}}}var frmFrontForm=frmFrontFormJS();
58
  jQuery(document).ready(function(l){frmFrontForm.init()});
59
+ function frmEditEntry(l,n,p,v,w,y){var r=jQuery(document.getElementById("frm_edit_"+l)),q=r.html(),x=jQuery(document.getElementById(n+l)),C=x.html();x.html('<span class="frm-loading-img" id="'+n+l+'"></span><div class="frm_orig_content" style="display:none">'+C+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:p,entry_id:l,id:v,nonce:frm_js.nonce},success:function(C){x.children(".frm-loading-img").replaceWith(C);r.replaceWith('<span id="frm_edit_'+
60
+ l+'"><a onclick="frmCancelEdit('+l+",'"+n+"','"+frmFrontForm.escapeHtml(q)+"',"+p+","+v+",'"+y+'\')" class="'+y+'">'+w+"</a></span>")}})}
61
+ function frmCancelEdit(l,n,p,v,w,y){var r=jQuery(document.getElementById("frm_edit_"+l)),q=r.find("a"),x=q.html();q.hasClass("frm_ajax_edited")||(q=jQuery(document.getElementById(n+l)),q.children(".frm_forms").replaceWith(""),q.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));r.replaceWith('<a id="frm_edit_'+l+'" class="frm_edit_link '+y+'" href="javascript:frmEditEntry('+l+",'"+n+"',"+v+","+w+",'"+frmFrontForm.escapeHtml(x)+"','"+y+"')\">"+p+"</a>")}
62
+ function frmUpdateField(l,n,p,v,w){jQuery(document.getElementById("frm_update_field_"+l+"_"+n)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:l,field_id:n,value:p,nonce:frm_js.nonce},success:function(){""===v.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+w)).fadeOut("slow"):jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+w)).replaceWith(v)}})}
63
  function frmDeleteEntry(l,n){jQuery(document.getElementById("frm_delete_"+l)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+l+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:l,nonce:frm_js.nonce},success:function(p){"success"==p.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById(n+l)).fadeOut("slow"):jQuery(document.getElementById("frm_delete_"+l)).replaceWith(p)}})}
64
  function frmOnSubmit(l){console.warn("DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm");frmFrontForm.submitForm(l,this)}
65
  function frm_resend_email(l,n){console.warn("DEPRECATED: function frm_resend_email in v2.0");$link=jQuery(document.getElementById("frm_resend_email"));$link.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:l,form_id:n,nonce:frm_js.nonce},success:function(l){$link.replaceWith(l)}})};
js/formidable_admin.js CHANGED
@@ -220,7 +220,6 @@ function frmAdminBuildJS(){
220
  revert:true,
221
  forcePlaceholderSize:false,
222
  tolerance:'pointer',
223
- container: 'ul.frm_sorting',
224
  receive:function(event,ui){
225
  if ( cancelSort ) {
226
  ui.item.addClass('frm_cancel_sort');
@@ -803,8 +802,9 @@ function frmAdminBuildJS(){
803
  function toggleFormid(field_id, form_id, main_form_id, checked){
804
  // change form ids of all fields in section
805
  var children = fieldsInSection(field_id);
 
806
  jQuery.ajax({type:'POST',url:ajaxurl,
807
- data:{action:'frm_toggle_repeat', form_id:form_id, parent_form_id:main_form_id, checked:checked, field_id:field_id, children:children, nonce:frmGlobal.nonce},
808
  success:function(id){
809
  //return form id to hidden field
810
  jQuery('input[name="field_options[form_select_'+field_id+']"]').val(id);
@@ -870,16 +870,6 @@ function frmAdminBuildJS(){
870
  }
871
  }
872
 
873
- function setIPEKey(){
874
- jQuery(this).editInPlace({
875
- show_buttons:"true",value_required:"true",
876
- save_button: '<a class="inplace_save save button button-small">'+frm_admin_js.ok+'</a>',
877
- cancel_button:'<a class="inplace_cancel cancel">'+frm_admin_js.cancel+'</a>',
878
- bg_out:"#fffbcc",
879
- callback:function(x,text){jQuery(this).next('input').val(text);return text;}
880
- });
881
- }
882
-
883
  function setIPELabel(){
884
  jQuery(this).editInPlace({
885
  url:ajaxurl,params:'action=frm_field_name_in_place_edit&nonce='+frmGlobal.nonce,
@@ -1692,7 +1682,38 @@ function frmAdminBuildJS(){
1692
  }
1693
  return false;
1694
  }
1695
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1696
  /* Import/Export page */
1697
  function validateExport(e){
1698
  e.preventDefault();
@@ -1772,6 +1793,7 @@ function frmAdminBuildJS(){
1772
  function initiateMultiselect(){
1773
  jQuery('.frm_multiselect').multiselect({
1774
  templates: {ul:'<ul class="multiselect-container frm-dropdown-menu"></ul>'},
 
1775
  nonSelectedText:frm_admin_js['default']
1776
  });
1777
  }
@@ -1969,7 +1991,6 @@ function frmAdminBuildJS(){
1969
 
1970
  $newFields.on('keypress', '.frm_ipe_field_label, .frm_ipe_field_option, .frm_ipe_field_option_key', blurField);
1971
  $newFields.on('mouseenter', '.frm_ipe_field_option, .frm_ipe_field_option_key', setIPEOpts);
1972
- $newFields.on('mouseenter', '.frm_ipe_field_key', setIPEKey);
1973
  $newFields.on('mouseenter', '.frm_ipe_field_label', setIPELabel);
1974
  $newFields.on('mouseenter', '.frm_ipe_field_desc, .frm_ipe_field_conf_desc', setIPEDesc);
1975
  $newFields.on('click', '.frm_add_logic_row', addFieldLogicRow);
@@ -2336,6 +2357,9 @@ function frmAdminBuildJS(){
2336
  $globalForm.on('click', '.frm_show_auth_form', showAuthForm);
2337
  jQuery(document.getElementById('frm_uninstall_now')).click(uninstallNow);
2338
  initiateMultiselect();
 
 
 
2339
  },
2340
 
2341
  exportInit: function(){
220
  revert:true,
221
  forcePlaceholderSize:false,
222
  tolerance:'pointer',
 
223
  receive:function(event,ui){
224
  if ( cancelSort ) {
225
  ui.item.addClass('frm_cancel_sort');
802
  function toggleFormid(field_id, form_id, main_form_id, checked){
803
  // change form ids of all fields in section
804
  var children = fieldsInSection(field_id);
805
+ var field_name = document.getElementById('field_label_' + field_id).innerHTML;
806
  jQuery.ajax({type:'POST',url:ajaxurl,
807
+ data:{action:'frm_toggle_repeat', form_id:form_id, parent_form_id:main_form_id, checked:checked, field_id:field_id, field_name:field_name, children:children, nonce:frmGlobal.nonce},
808
  success:function(id){
809
  //return form id to hidden field
810
  jQuery('input[name="field_options[form_select_'+field_id+']"]').val(id);
870
  }
871
  }
872
 
 
 
 
 
 
 
 
 
 
 
873
  function setIPELabel(){
874
  jQuery(this).editInPlace({
875
  url:ajaxurl,params:'action=frm_field_name_in_place_edit&nonce='+frmGlobal.nonce,
1682
  }
1683
  return false;
1684
  }
1685
+
1686
+ function saveAddonLicense() {
1687
+ var button = jQuery(this);
1688
+ var buttonName = this.name;
1689
+ var pluginSlug = button.data('plugin');
1690
+ var action = buttonName.replace('edd_'+pluginSlug+'_license_', '');
1691
+ var license = document.getElementById('edd_'+pluginSlug+'_license_key').value;
1692
+ jQuery.ajax({
1693
+ type:'POST',url:ajaxurl,dataType:'json',
1694
+ data:{action:'frm_addon_'+action,license:license,plugin:pluginSlug,nonce:frmGlobal.nonce},
1695
+ success:function(msg){
1696
+ var thisRow = button.closest('.edd_frm_license_row');
1697
+ if ( action == 'deactivate' ) {
1698
+ license = '';
1699
+ document.getElementById('edd_'+pluginSlug+'_license_key').value = '';
1700
+ }
1701
+ thisRow.find('.edd_frm_license').html( license );
1702
+ if ( msg.success === true ) {
1703
+ thisRow.find('.frm_icon_font').removeClass('frm_hidden');
1704
+ }
1705
+ thisRow.find('div.alignleft').toggleClass( 'frm_hidden', 1000 );
1706
+ var messageBox = thisRow.find('.frm_license_msg');
1707
+ messageBox.html(msg.message);
1708
+ if ( msg.message !== '' ){
1709
+ setTimeout(function(){
1710
+ messageBox.html('');
1711
+ },5000);
1712
+ }
1713
+ }
1714
+ });
1715
+ }
1716
+
1717
  /* Import/Export page */
1718
  function validateExport(e){
1719
  e.preventDefault();
1793
  function initiateMultiselect(){
1794
  jQuery('.frm_multiselect').multiselect({
1795
  templates: {ul:'<ul class="multiselect-container frm-dropdown-menu"></ul>'},
1796
+ buttonContainer: '<div class="btn-group frm-btn-group" />',
1797
  nonSelectedText:frm_admin_js['default']
1798
  });
1799
  }
1991
 
1992
  $newFields.on('keypress', '.frm_ipe_field_label, .frm_ipe_field_option, .frm_ipe_field_option_key', blurField);
1993
  $newFields.on('mouseenter', '.frm_ipe_field_option, .frm_ipe_field_option_key', setIPEOpts);
 
1994
  $newFields.on('mouseenter', '.frm_ipe_field_label', setIPELabel);
1995
  $newFields.on('mouseenter', '.frm_ipe_field_desc, .frm_ipe_field_conf_desc', setIPEDesc);
1996
  $newFields.on('click', '.frm_add_logic_row', addFieldLogicRow);
2357
  $globalForm.on('click', '.frm_show_auth_form', showAuthForm);
2358
  jQuery(document.getElementById('frm_uninstall_now')).click(uninstallNow);
2359
  initiateMultiselect();
2360
+
2361
+ // activate addon licenses
2362
+ jQuery('.edd_frm_save_license').click(saveAddonLicense);
2363
  },
2364
 
2365
  exportInit: function(){
languages/formidable-da_DK.po CHANGED
@@ -6764,7 +6764,7 @@ msgstr "Indsnævre, hvilke poster der skal avendes. De egnskaber vælges med SQL
6764
 
6765
  #: pro/classes/views/displays/mb_advanced.php:68
6766
  #@ formidable
6767
- msgid "No Entries Messsage"
6768
  msgstr "Besked ved ingen poster"
6769
 
6770
  #: pro/classes/views/displays/mb_advanced.php:78
6764
 
6765
  #: pro/classes/views/displays/mb_advanced.php:68
6766
  #@ formidable
6767
+ msgid "No Entries Message"
6768
  msgstr "Besked ved ingen poster"
6769
 
6770
  #: pro/classes/views/displays/mb_advanced.php:78
languages/formidable-fr_FR.po CHANGED
@@ -8111,8 +8111,8 @@ msgstr "Réstreindre les entrées qui seront utilisés. Les options uniques util
8111
 
8112
  #: pro/classes/views/displays/mb_advanced.php:68
8113
  #@ formidable
8114
- msgid "No Entries Messsage"
8115
- msgstr "Pas de messsage"
8116
 
8117
  #: pro/classes/views/displays/mb_advanced.php:106
8118
  #@ formidable
8111
 
8112
  #: pro/classes/views/displays/mb_advanced.php:68
8113
  #@ formidable
8114
+ msgid "No Entries Message"
8115
+ msgstr "Pas de message"
8116
 
8117
  #: pro/classes/views/displays/mb_advanced.php:106
8118
  #@ formidable
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://formidablepro.com/donate
4
  Tags: admin, AJAX, captcha, contact, contact form, database, email, feedback, form, forms, javascript, jquery, page, plugin, poll, Post, spam, survey, template, widget, wpmu, form builder
5
  Requires at least: 3.6
6
  Tested up to: 4.3
7
- Stable tag: 2.0.11
8
 
9
  Beautiful forms in 60 seconds. The WordPress form builder that enables you to create forms with a simple drag-and-drop interface and in-place editing.
10
 
@@ -89,6 +89,44 @@ A. Try clearing your browser cache. As plugin modifications are made, frequent j
89
  [See more FAQs](http://formidablepro.com/formidable-faqs/ "Formidable Form FAQs")
90
 
91
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  = 2.0.11 =
93
  * Fix issue with clearing array keys when sanitizing an array when displaying entry values
94
  * When the email "reply to" value uses the "from" setting, only use the email address without the name
4
  Tags: admin, AJAX, captcha, contact, contact form, database, email, feedback, form, forms, javascript, jquery, page, plugin, poll, Post, spam, survey, template, widget, wpmu, form builder
5
  Requires at least: 3.6
6
  Tested up to: 4.3
7
+ Stable tag: 2.0.12
8
 
9
  Beautiful forms in 60 seconds. The WordPress form builder that enables you to create forms with a simple drag-and-drop interface and in-place editing.
10
 
89
  [See more FAQs](http://formidablepro.com/formidable-faqs/ "Formidable Form FAQs")
90
 
91
  == Changelog ==
92
+ = 2.0.12 =
93
+ * Add option to center form on page
94
+ * Improve styling classes for more consistency across different field classes, and make all classes responsive
95
+ * Added a few more styling classes: frm_three_fourths, frm_two_fifths, frm_three_fifths
96
+ * Remove in-place-editing from the field keys on the form builder page
97
+ * Add 'frm_after_update_field_name' hook for changing a field name during editing
98
+ * Update Bootstrap multiselect to v0.9.13
99
+ * Add license page to prepare for add-ons. Big things are coming.
100
+ * Fix: Prevent loading icon from being huge in some themes
101
+ * Fix: When the jQuery UI css is loaded by another plugin on the form builder page, the required icon looked the same whether required or not. This styling conflict is resolved.
102
+ * Fix: Make sure the form description size can be changed in the styling settings.
103
+ * **Pro Features:**
104
+ * Views can now be filtered by fields in the repeating sections.
105
+ * Added [parent_id] shortcode for use in views. This shortcode will only have a value when the displaying entries in repeating sections.
106
+ * Allow views to be created using the repeated entries. Since each repeating row is an entry in a hidden form, we can allow views to be created using those repeating rows for more flexability.
107
+ * Added order parameter to frm-entry-links
108
+ * Allow options in a post status field to come from the form builder. The options should have separate values and the saved values can include 'publish', 'draft', 'private', 'scheduled'.
109
+ * Remove the option to lock field and form keys. This is more of a hassle than a feature.
110
+ * Allow the entry key to be used with the frm-field-value shortcode instead of forcing the entry
111
+ * Replaced inline 50px height for image fields with .frm_image_from_url class for easier control
112
+ * Improve file upload field in Chrome to prevent extra space from showing.
113
+ * Added 'frm_save_post_name' filter. This can be used for custom form actions that create posts.
114
+ * Added 'frm_display_data_opts' filter.
115
+ * Prevent frm_display_id custom field from saving when a field is selected in the create post settings instead of customized content
116
+ * Fix: When forms were submitted without ajax, the redirect wasn't working consistently.
117
+ * Fix: The shortcodes weren't processing in the message shown after an entry is updated.
118
+ * Fix: When we prevented the PayPal action from triggering on import, we stopped all actions. This is now fixed so an action can be set (in the code) to be triggered on import. Posts will now be created on import again.
119
+ * Fix: The dynamic list field was showing the entry ID in the entries tab instead of the value.
120
+ * Fix: The Add row button wasn't showing in a repeating section when returning to edit an entry if there were more than two rows in the section.
121
+ * Fix: Improve dropping a field between two sections.
122
+ * Fix: Remove nonce check for frm-entry-update-field shortode. Page caching gives front-end nonce checks issues.
123
+ * Fix: We changed the parameters sent to the frm_after_update_field hook without realizing it. The 'field_id' attribute was sometimes an object, but was previously always an integer. This has been updated for reverse compatibility, and 'field' has been added with the full field object.
124
+ * Fix: If you put -100 for the start date in a date field, -100 would show in the date field instead of 1915. This is now working correctly for dynamic values like this with three digits.
125
+ * Fix: When filtering a view with a Dynamic field, NOT EQUAL TO will work correctly.
126
+ * Fix: Double quotes were causing trouble when included inside an error message returned by the frm_validate_field_entry hook
127
+ * Fix: Graphs using x_axis and start_date were having trouble
128
+ * Fix: The js error after selecting an option in autocomplete field is fixed when there are calculations in the form.
129
+
130
  = 2.0.11 =
131
  * Fix issue with clearing array keys when sanitizing an array when displaying entry values
132
  * When the email "reply to" value uses the "from" setting, only use the email address without the name