Contact Form Email - Version 1.3.09

Version Description

  • Faster form load speed
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Contact Form Email
Version 1.3.09
Comparing to
See all releases

Code changes from version 1.3.08 to 1.3.09

README.txt CHANGED
@@ -456,6 +456,9 @@ When you click a field already added into the contact form builder area, you can
456
 
457
  == Changelog ==
458
 
 
 
 
459
  = 1.3.08 =
460
  * Insertion block update
461
 
@@ -1081,5 +1084,5 @@ When you click a field already added into the contact form builder area, you can
1081
 
1082
  == Upgrade Notice ==
1083
 
1084
- = 1.3.08 =
1085
- * Insertion block update
456
 
457
  == Changelog ==
458
 
459
+ = 1.3.09 =
460
+ * Faster form load speed
461
+
462
  = 1.3.08 =
463
  * Insertion block update
464
 
1084
 
1085
  == Upgrade Notice ==
1086
 
1087
+ = 1.3.09 =
1088
+ * Faster form load speed
controllers/elementor/cp-elementor-widget.inc.php CHANGED
@@ -23,14 +23,11 @@ if (!class_exists('CP_ContactFormToEmail_Elementor'))
23
 
24
  function enqueue_frontend_styles() {
25
  wp_enqueue_style('cfte-publicstyle', plugins_url('/../../css/stylepublic.css', __FILE__));
26
-
27
- wp_deregister_script('query-stringify');
28
- wp_register_script('query-stringify', plugins_url('/../../js/jQuery.stringify.js', __FILE__));
29
-
30
  wp_deregister_script($this->prefix.'_validate_script');
31
  wp_register_script($this->prefix.'_validate_script', plugins_url('/../../js/jquery.validate.js', __FILE__));
32
  wp_enqueue_script( $this->prefix.'_builder_script',
33
- plugins_url('/../../js/fbuilderf.jquery.js?nc=1', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
34
  }
35
 
36
  /**
23
 
24
  function enqueue_frontend_styles() {
25
  wp_enqueue_style('cfte-publicstyle', plugins_url('/../../css/stylepublic.css', __FILE__));
26
+
 
 
 
27
  wp_deregister_script($this->prefix.'_validate_script');
28
  wp_register_script($this->prefix.'_validate_script', plugins_url('/../../js/jquery.validate.js', __FILE__));
29
  wp_enqueue_script( $this->prefix.'_builder_script',
30
+ plugins_url('/../../js/fbuilderf.jquery.js?nc=3', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip",$this->prefix."_validate_script"), false, true );
31
  }
32
 
33
  /**
cp-admin-int.inc.php CHANGED
@@ -224,8 +224,7 @@ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST[$this->prefix.'_post_
224
  if (typeof $easyFormQuery == 'undefined')
225
  {
226
  // This code won't be used in most cases. This code is for preventing problems in wrong WP themes and conflicts with third party plugins.
227
- // In some cases a third party plugin or WP theme affect the expected jQuery scripts, this code autodetect that and provide an alternative solution
228
- document.write ("<"+"script type='text/javascript' src='<?php echo plugins_url('js/jQuery.stringify.js', __FILE__); ?>'></"+"script>");
229
  document.write ("<"+"script type='text/javascript' src='<?php echo plugins_url('js/jquery.validate.js', __FILE__); ?>'></"+"script>");
230
  document.write ("<"+"script type='text/javascript' src='<?php echo plugins_url('js/fbuilderf.jquery.js?nc=1', __FILE__); ?>'></"+"script>");
231
  }
224
  if (typeof $easyFormQuery == 'undefined')
225
  {
226
  // This code won't be used in most cases. This code is for preventing problems in wrong WP themes and conflicts with third party plugins.
227
+ // In some cases a third party plugin or WP theme affect the expected jQuery scripts, this code autodetect that and provide an alternative solution
 
228
  document.write ("<"+"script type='text/javascript' src='<?php echo plugins_url('js/jquery.validate.js', __FILE__); ?>'></"+"script>");
229
  document.write ("<"+"script type='text/javascript' src='<?php echo plugins_url('js/fbuilderf.jquery.js?nc=1', __FILE__); ?>'></"+"script>");
230
  }
cp-main-class.inc.php CHANGED
@@ -224,15 +224,12 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
224
  wp_enqueue_style('cfte-stylepublic', plugins_url('css/stylepublic.css', __FILE__) );
225
  wp_enqueue_style('cfte-stylecalendar', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__));
226
  wp_enqueue_style('cfte-custompublicstyle', $this->get_site_url( false ).'?cp_cfte_resources=css');
227
-
228
- wp_deregister_script('query-stringify');
229
- wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
230
-
231
  wp_deregister_script($this->prefix.'_validate_script');
232
  wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
233
 
234
  wp_enqueue_script( $this->prefix.'_builder_script',
235
- plugins_url('/js/fbuilderf.jquery.js?nc=1', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-dialog","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
236
 
237
  wp_enqueue_script( $this->prefix.'_customjs', $this->get_site_url( false ).'?cp_cfte_resources=customjs',array($this->prefix.'_builder_script'));
238
 
@@ -454,15 +451,14 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
454
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'datepicker.min.js'; ?>'></script>
455
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'widget.min.js'; ?>'></script>
456
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'position.min.js'; ?>'></script>
457
- <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'tooltip.min.js'; ?>'></script>
458
- <script type='text/javascript' src='<?php echo plugins_url('js/jQuery.stringify.js', __FILE__); ?>'></script>
459
  <script type='text/javascript' src='<?php echo plugins_url('js/jquery.validate.js', __FILE__); ?>'></script>
460
  <script type='text/javascript'>
461
  /* <![CDATA[ */
462
  var <?php echo $this->prefix; ?>_fbuilder_config<?php echo '_'.$this->print_counter; ?> = {"obj":"{\"pub\":true,\"identifier\":\"<?php echo '_'.$this->print_counter; ?>\",\"messages\": {\n \t \t\"required\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_is_required', CP_CFEMAIL_DEFAULT_vs_text_is_required));?>\",\n \t \t\"email\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_is_email', CP_CFEMAIL_DEFAULT_vs_text_is_email));?>\",\n \t \t\"datemmddyyyy\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_datemmddyyyy', CP_CFEMAIL_DEFAULT_vs_text_datemmddyyyy));?>\",\n \t \t\"dateddmmyyyy\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_dateddmmyyyy', CP_CFEMAIL_DEFAULT_vs_text_dateddmmyyyy));?>\",\n \t \t\"number\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_number', CP_CFEMAIL_DEFAULT_vs_text_number));?>\",\n \t \t\"digits\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_digits', CP_CFEMAIL_DEFAULT_vs_text_digits));?>\",\n \t \t\"max\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_max', CP_CFEMAIL_DEFAULT_vs_text_max));?>\",\n \t \t\"min\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_min', CP_CFEMAIL_DEFAULT_vs_text_min));?>\",\"previous\": \"<?php echo str_replace(array('"'),array('\\"'),$previous_label); ?>\",\"next\": \"<?php echo str_replace(array('"'),array('\\"'),$next_label); ?>\"\n \t }}"};
463
  /* ]]> */
464
  </script>
465
- <script type='text/javascript' src='<?php echo plugins_url('js/fbuilderf.jquery.js?nc=1', __FILE__); ?>'></script>
466
  <script type='text/javascript' src='<?php echo $this->get_site_url( false ).'?cp_cfte_resources=customjs'; ?>'></script>
467
  <?php
468
  }
@@ -555,15 +551,12 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
555
 
556
  wp_enqueue_script( 'cfte_gutenberg_editor', plugins_url('/js/block.js', __FILE__));
557
 
558
- wp_enqueue_style('cfte-publicstyle', plugins_url('css/stylepublic.css', __FILE__));
559
-
560
- wp_deregister_script('query-stringify');
561
- wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
562
 
563
  wp_deregister_script($this->prefix.'_validate_script');
564
  wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
565
  wp_enqueue_script( $this->prefix.'_builder_script',
566
- plugins_url('/js/fbuilderf.jquery.js?nc=1', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
567
 
568
  $forms = array();
569
  $rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$this->table_items." ORDER BY form_name");
@@ -596,10 +589,8 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
596
 
597
  function insert_adminScripts($hook) {
598
  if ($this->get_param("page") == $this->menu_parameter && $this->get_param("addbk") != '1' && !$this->get_param("edititem"))
599
- {
600
- wp_deregister_script('query-stringify');
601
- wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
602
- wp_enqueue_script( $this->prefix.'_builder_script', plugins_url('/js/fbuilderf.jquery.js?nc=1', __FILE__),array("jquery","jquery-ui-core","jquery-ui-sortable","jquery-ui-tabs","jquery-ui-droppable","jquery-ui-button","query-stringify","jquery-ui-datepicker") );
603
  wp_enqueue_style('cfte-adminstyles', plugins_url('css/style.css', __FILE__) );
604
  wp_enqueue_style('cfte-admincalendarstyles', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__) );
605
  wp_enqueue_style('cfte-newadminstyle', plugins_url('/css/newadminlayout.css', __FILE__));
224
  wp_enqueue_style('cfte-stylepublic', plugins_url('css/stylepublic.css', __FILE__) );
225
  wp_enqueue_style('cfte-stylecalendar', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__));
226
  wp_enqueue_style('cfte-custompublicstyle', $this->get_site_url( false ).'?cp_cfte_resources=css');
227
+
 
 
 
228
  wp_deregister_script($this->prefix.'_validate_script');
229
  wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
230
 
231
  wp_enqueue_script( $this->prefix.'_builder_script',
232
+ plugins_url('/js/fbuilderf.jquery.js?nc=3', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-dialog","jquery-ui-position","jquery-ui-tooltip",$this->prefix."_validate_script"), false, true );
233
 
234
  wp_enqueue_script( $this->prefix.'_customjs', $this->get_site_url( false ).'?cp_cfte_resources=customjs',array($this->prefix.'_builder_script'));
235
 
451
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'datepicker.min.js'; ?>'></script>
452
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'widget.min.js'; ?>'></script>
453
  <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'position.min.js'; ?>'></script>
454
+ <script type='text/javascript' src='<?php echo $plugin_url.'/../../../wp-includes/js/jquery/ui/'.$prefix_ui.'tooltip.min.js'; ?>'></script>
 
455
  <script type='text/javascript' src='<?php echo plugins_url('js/jquery.validate.js', __FILE__); ?>'></script>
456
  <script type='text/javascript'>
457
  /* <![CDATA[ */
458
  var <?php echo $this->prefix; ?>_fbuilder_config<?php echo '_'.$this->print_counter; ?> = {"obj":"{\"pub\":true,\"identifier\":\"<?php echo '_'.$this->print_counter; ?>\",\"messages\": {\n \t \t\"required\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_is_required', CP_CFEMAIL_DEFAULT_vs_text_is_required));?>\",\n \t \t\"email\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_is_email', CP_CFEMAIL_DEFAULT_vs_text_is_email));?>\",\n \t \t\"datemmddyyyy\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_datemmddyyyy', CP_CFEMAIL_DEFAULT_vs_text_datemmddyyyy));?>\",\n \t \t\"dateddmmyyyy\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_dateddmmyyyy', CP_CFEMAIL_DEFAULT_vs_text_dateddmmyyyy));?>\",\n \t \t\"number\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_number', CP_CFEMAIL_DEFAULT_vs_text_number));?>\",\n \t \t\"digits\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_digits', CP_CFEMAIL_DEFAULT_vs_text_digits));?>\",\n \t \t\"max\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_max', CP_CFEMAIL_DEFAULT_vs_text_max));?>\",\n \t \t\"min\": \"<?php echo str_replace(array('"'),array('\\"'),$this->get_option('vs_text_min', CP_CFEMAIL_DEFAULT_vs_text_min));?>\",\"previous\": \"<?php echo str_replace(array('"'),array('\\"'),$previous_label); ?>\",\"next\": \"<?php echo str_replace(array('"'),array('\\"'),$next_label); ?>\"\n \t }}"};
459
  /* ]]> */
460
  </script>
461
+ <script type='text/javascript' src='<?php echo plugins_url('js/fbuilderf.jquery.js?nc=3', __FILE__); ?>'></script>
462
  <script type='text/javascript' src='<?php echo $this->get_site_url( false ).'?cp_cfte_resources=customjs'; ?>'></script>
463
  <?php
464
  }
551
 
552
  wp_enqueue_script( 'cfte_gutenberg_editor', plugins_url('/js/block.js', __FILE__));
553
 
554
+ wp_enqueue_style('cfte-publicstyle', plugins_url('css/stylepublic.css', __FILE__));
 
 
 
555
 
556
  wp_deregister_script($this->prefix.'_validate_script');
557
  wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
558
  wp_enqueue_script( $this->prefix.'_builder_script',
559
+ plugins_url('/js/fbuilderf.jquery.js?nc=3', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip",$this->prefix."_validate_script"), false, true );
560
 
561
  $forms = array();
562
  $rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$this->table_items." ORDER BY form_name");
589
 
590
  function insert_adminScripts($hook) {
591
  if ($this->get_param("page") == $this->menu_parameter && $this->get_param("addbk") != '1' && !$this->get_param("edititem"))
592
+ {
593
+ wp_enqueue_script( $this->prefix.'_builder_script', plugins_url('/js/fbuilderf.jquery.js?nc=3', __FILE__),array("jquery","jquery-ui-core","jquery-ui-sortable","jquery-ui-tabs","jquery-ui-droppable","jquery-ui-button","jquery-ui-datepicker") );
 
 
594
  wp_enqueue_style('cfte-adminstyles', plugins_url('css/style.css', __FILE__) );
595
  wp_enqueue_style('cfte-admincalendarstyles', plugins_url('css/cupertino/jquery-ui-1.8.20.custom.css', __FILE__) );
596
  wp_enqueue_style('cfte-newadminstyle', plugins_url('/css/newadminlayout.css', __FILE__));
form-to-email.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Contact Form Email
4
  Plugin URI: https://form2email.dwbooster.com/download
5
  Description: Contact form that sends the data to email and also to a database list and CSV file.
6
- Version: 1.3.08
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
3
  Plugin Name: Contact Form Email
4
  Plugin URI: https://form2email.dwbooster.com/download
5
  Description: Contact form that sends the data to email and also to a database list and CSV file.
6
+ Version: 1.3.09
7
  Author: CodePeople
8
  Author URI: https://form2email.dwbooster.com
9
  Text Domain: contact-form-to-email
js/fbuilderf.jquery.js CHANGED
@@ -1,1279 +1,2 @@
1
- /** jQuery.holdReady( true ); */
2
- jQuery(window).on('load', function(){
3
- (function($) {
4
- $.fn.CFTEfbuilder = function(options){
5
- var opt = $.extend({},
6
- {
7
- typeList:new Array({id:"ftext",name:"Single Line"},{id:"fnumber",name:"Number"},{id:"femail",name:"Email"},{id:"fdate",name:"Date Time"},{id:"ftextarea",name:"Text Area"},{id:"fcurrency",name:"Currency"},{id:"fcheck",name:"Checkboxes"},{id:"fradio",name:"Radio Buttons"},{id:"fdropdown",name:"Dropdown"},{id:"ffile",name:"Upload File"},{id:"fpassword",name:"Password"},{id:"fPhone",name:"Phone field"},{id:"fCommentArea",name:"Instruct. Text"},{id:"fhidden",name:"Hidden"},{id:"fSectionBreak",name:"Section break"},{id:"fPageBreak",name:"Page break"},{id:"fsummary",name:"Summary"},{id:"fMedia",name:"Media"},{id:"fButton",name:"Button"},{id:"fhtml",name:"HTML content"},{id:"facceptance",name:"Accept / GDPR"},{id:"category",name:"Container Controls"},{id:"ffieldset",name:"Fieldset"},{id:"fdiv",name:"Div"},{id:"category",name:"Form Controls with Datasource Connection"},{id:"ftextds",name:"Line Text DS"},{id:"femailds",name:"Email DS"},{id:"ftextareads",name:"Text Area DS"},{id:"fcheckds",name:"Checkboxes DS"},{id:"fradiods",name:"Radio Btns DS"},{id:"fPhoneds",name:"Phone DS"},{id:"fdropdownds",name:"Dropdown DS"},{id:"fhiddends",name:"Hidden DS"},{id:"fnumberds",name:"Number DS"},{id:"fcurrencyds",name:"Currency DS"}),
8
- pub:false,
9
- identifier:"",
10
- title:""
11
- },options, true);
12
- if (opt.pub)
13
- {
14
- opt.messages = $.extend({
15
- previous: "Previous",
16
- next: "Next",
17
- page: "Page",
18
- of: "of",
19
- required: "This field is required.",
20
- email: "Please enter a valid email address.",
21
- datemmddyyyy: "Please enter a valid date with this format(mm/dd/yyyy)",
22
- dateddmmyyyy: "Please enter a valid date with this format(dd/mm/yyyy)",
23
- number: "Please enter a valid number.",
24
- digits: "Please enter only digits.",
25
- maxlength: $.validator.format("Please enter no more than {0} characters"),
26
- minlength: $.validator.format("Please enter at least {0} characters."),
27
- equalTo: "Please enter the same value again.",
28
- max: $.validator.format("Please enter a value less than or equal to {0}."),
29
- min: $.validator.format("Please enter a value greater than or equal to {0}.")
30
- },opt.messages);
31
- opt.messages.max = $.validator.format(opt.messages.max);
32
- opt.messages.min = $.validator.format(opt.messages.min);
33
- $.extend($.validator.messages, opt.messages);
34
- }
35
- getNameByIdFromType = function(id){
36
- for (var i=0;i<opt.typeList.length;i++)
37
- if (opt.typeList[i].id == id)
38
- return opt.typeList[i].name;
39
- return "";
40
- }
41
- if (!opt.pub)
42
- {
43
- for (var i=0;i<opt.typeList.length;i++)
44
- {
45
- if (opt.typeList[i].id=="category")
46
- $("#tabs-1").append('<div style="clear:both;"></div><br /><div class="category-description">'+opt.typeList[i].name+'</div><hr />');
47
- else
48
- $("#tabs-1").append('<div class="button width40 '+(((i>5 && i!=20) || (i%2==1))?"n":"itemForm")+'" id="'+opt.typeList[i].id+'">'+opt.typeList[i].name+'</div>');
49
- }
50
- $("#tabs-1").append('<div class="clearer"></div>');
51
- }
52
- if (!opt.pub) $( ".button").button();
53
- var items = new Array();
54
- var itemSelected = -2;
55
- editItem = function(id) {
56
- if (!opt.pub) $('#tabs').tabs("option", "active", 1);
57
- try { $('#tabs-2').html(items[id].showAllSettings()); } catch (e) {}
58
- itemSelected = id;
59
- $(".helpfbuilder").click(function(){
60
- alert($(this).attr("text"));
61
- });
62
- $("#sValue").bind("keyup",function(){
63
- items[id].value = $(this).val();
64
- reloadItems();
65
- });
66
- $("#sURL").bind("keyup",function(){
67
- items[id].url = $(this).val();
68
- reloadItems();
69
- });
70
- $("#sMessage").bind("keyup",function(){
71
- items[id].message = $(this).val();
72
- reloadItems();
73
- });
74
- $("#sMinDate").change(function(){
75
- items[id].minDate = $(this).val();
76
- reloadItems();
77
- });
78
- $("#sMaxDate").change(function(){
79
- items[id].maxDate = $(this).val();
80
- reloadItems();
81
- });
82
- $("#sDefaultDate").change(function(){
83
- items[id].defaultDate = $(this).val();
84
- reloadItems();
85
- });
86
- $("#sTitle").keyup(function(){
87
- var str = $(this).val();
88
- items[id].title = str.replace(/\n/g,"<br />");
89
- reloadItems();
90
- });
91
- $("#sName").keyup(function(){
92
- items[id].name = $(this).val();
93
- reloadItems();
94
- });
95
- $("#sShortlabel").keyup(function(){
96
- items[id].shortlabel = $(this).val();
97
- reloadItems();
98
- });
99
- $("#sPredefined").keyup(function(){
100
- items[id].predefined = $(this).val();
101
- reloadItems();
102
- });
103
- $("#sPredefinedClick").click(function(){
104
- items[id].predefinedClick = $(this).is(':checked');
105
- reloadItems();
106
- });
107
- $("#sEq").keyup(function(){
108
- items[id].eq = $(this).val();
109
- reloadItems();
110
- });
111
- $("#sSuffix").keyup(function(){
112
- items[id].suffix = $(this).val();
113
- reloadItems();
114
- });
115
- $("#sPrefix").keyup(function(){
116
- items[id].prefix = $(this).val();
117
- reloadItems();
118
- });
119
- $("#sDecimalSymbol").keyup(function(){
120
- items[id].decimalsymbol = $(this).val();
121
- reloadItems();
122
- });
123
- $("#sGroupingSymbol").keyup(function(){
124
- items[id].groupingsymbol = $(this).val();
125
- reloadItems();
126
- });
127
- $("#sDropdownRange").keyup(function(){
128
- items[id].dropdownRange = $(this).val();
129
- reloadItems();
130
- });
131
- $("#sRequired").click(function(){
132
- items[id].required = $(this).is(':checked');
133
- reloadItems();
134
- });
135
- $("#sReadOnly").click(function(){
136
- items[id].readonly = $(this).is(':checked');
137
- reloadItems();
138
- });
139
- $("#sShowDropdown").click(function(){
140
- items[id].showDropdown = $(this).is(':checked');
141
- if ($(this).is(':checked'))
142
- $("#divdropdownRange").css("display","");
143
- else
144
- $("#divdropdownRange").css("display","none");
145
- reloadItems();
146
- });
147
- $("#sSize").change(function(){
148
- items[id].size = $(this).val();
149
- reloadItems();
150
- });
151
- $("#sFormat").change(function(){
152
- items[id].dformat = $(this).val();
153
- reloadItems();
154
- });
155
- $("#sLayout").change(function(){
156
- items[id].layout = $(this).val();
157
- reloadItems();
158
- });
159
- $("#sMin").change(function(){
160
- items[id].min = $(this).val();
161
- reloadItems();
162
- });
163
- $("#sMax").change(function(){
164
- items[id].max = $(this).val();
165
- reloadItems();
166
- });
167
- $("#sMinlength").change(function(){
168
- items[id].minlength = $(this).val();
169
- reloadItems();
170
- });
171
- $("#sMaxlength").change(function(){
172
- items[id].maxlength = $(this).val();
173
- reloadItems();
174
- });
175
- $("#sEqualTo").change(function(){
176
- items[id].equalTo = $(this).val();
177
- reloadItems();
178
- });
179
- $(".showHideDependencies").click(function(){
180
- if (items[id].showDep)
181
- {
182
- $(this).parent().removeClass("show");
183
- $(this).parent().addClass("hide");
184
- $(this).html("Show Dependencies");
185
- items[id].showDep = false;
186
- }
187
- else
188
- {
189
- $(this).parent().addClass("show");
190
- $(this).parent().removeClass("hide");
191
- $(this).html("Hide Dependencies");
192
- items[id].showDep = true;
193
- }
194
- return false;
195
- });
196
- $(".choice_remove").click(function(){
197
- if (items[id].choices.length==1)
198
- {
199
- items[id].choices[0]="";
200
- items[id].choicesVal[0]="";
201
- items[id].choicesDep[0]=new Array();
202
- }
203
- else
204
- {
205
- items[id].choices.splice($(this).attr("i"),1);
206
- items[id].choicesVal.splice($(this).attr("i"),1);
207
- items[id].choicesDep.splice($(this).attr("i"),1);
208
- }
209
- if (items[id].ftype=="fcheck")
210
- {
211
- if (items[id].choiceSelected.length==1)
212
- items[id].choiceSelected[0]="";
213
- else
214
- items[id].choiceSelected.splice($(this).attr("i"),1);
215
- }
216
- editItem(id);
217
- reloadItems();
218
- });
219
- $(".choice_add").click(function(){
220
- items[id].choices.splice($(this).attr("i")*1+1,0,"");
221
- items[id].choicesVal.splice($(this).attr("i")*1+1,0,"");
222
- items[id].choicesDep.splice($(this).attr("i")*1+1,0,new Array());
223
- if (items[id].ftype=="fcheck")
224
- items[id].choiceSelected.splice($(this).attr("i")*1+1,0,false);
225
- editItem(id);
226
- reloadItems();
227
- });
228
- $(".choice_text").keyup(function(){
229
- if (items[id].choices[$(this).attr("i")] == items[id].choicesVal[$(this).attr("i")])
230
- {
231
- $("#"+$(this).attr("id")+"V"+$(this).attr("i")).val($(this).val());
232
- items[id].choicesVal[$(this).attr("i")]= $(this).val();
233
- }
234
- items[id].choices[$(this).attr("i")]= $(this).val();
235
- reloadItems();
236
- });
237
- $(".choice_value").keyup(function(){
238
- items[id].choicesVal[$(this).attr("i")]= $(this).val();
239
- reloadItems();
240
- });
241
- $(".choice_radio").click(function(){
242
- if ($(this).is(':checked'))
243
- items[id].choiceSelected = items[id].choicesVal[$(this).attr("i")];
244
- reloadItems();
245
- });
246
- $(".choice_select").click(function(){
247
- if ($(this).is(':checked'))
248
- items[id].choiceSelected = items[id].choicesVal[$(this).attr("i")];
249
- reloadItems();
250
- });
251
- $(".choice_check").click(function(){
252
- if ($(this).is(':checked'))
253
- items[id].choiceSelected[$(this).attr("i")] = true;
254
- else
255
- items[id].choiceSelected[$(this).attr("i")] = false;
256
- reloadItems();
257
- });
258
- $("#sUserhelp").keyup(function(){
259
- items[id].userhelp = $(this).val();
260
- reloadItems();
261
- });
262
- $("#sUserhelpTooltip").click(function(){
263
- items[id].userhelpTooltip = $(this).is(':checked');
264
- reloadItems();
265
- });
266
- $("#sCsslayout").keyup(function(){
267
- items[id].csslayout = $(this).val();
268
- reloadItems();
269
- });
270
- $('.equalTo').each(function(){
271
- var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
272
- for (var i=0;i<items.length;i++)
273
- if ((items[i].ftype=="ftext" || items[i].ftype=="femail" || items[i].ftype=="fpassword") && (items[i].name != $(this).attr("dname")))
274
- str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].title)+'</option>';
275
- $(this).html(str);
276
- });
277
- $('.dependencies').each(function(){
278
- var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
279
- for (var i=0;i<items.length;i++)
280
- if (items[i].name != $(this).attr("dname"))
281
- str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].title)+'</option>';
282
- $(this).html(str);
283
- });
284
- $('.dependencies').change(function(){
285
- items[id].choicesDep[$(this).attr("i")][$(this).attr("j")] = $(this).val();
286
- reloadItems();
287
- });
288
- $(".choice_removeDep").click(function(){
289
- if (items[id].choices.length==1)
290
- items[id].choicesDep[$(this).attr("i")][0]="";
291
- else
292
- items[id].choicesDep[$(this).attr("i")].splice($(this).attr("j"),1);
293
- editItem(id);
294
- reloadItems();
295
- });
296
- $(".choice_addDep").click(function(){
297
- items[id].choicesDep[$(this).attr("i")].splice($(this).attr("j")*1+1,0,"");
298
- editItem(id);
299
- reloadItems();
300
- });
301
- };
302
- editForm = function() {
303
- $('#tabs-3').html(theForm.showAllSettings());
304
- itemSelected = -1;
305
- $("#fTitle").keyup(function(){
306
- theForm.title = $(this).val();
307
- reloadItems();
308
- });
309
- $("#fDescription").keyup(function(){
310
- theForm.description = $(this).val();
311
- reloadItems();
312
- });
313
- $("#fLayout").change(function(){
314
- theForm.formlayout = $(this).val();
315
- reloadItems();
316
- });
317
-
318
- };
319
- removeItem = function(index) {
320
- items.splice(index,1);
321
- for (var i=0;i<items.length;i++)
322
- items[i].index = i;
323
- $('#tabs').tabs("option", "active", 0);
324
- reloadItems();
325
- }
326
- reloadItems = function() {
327
- for (var i=0;i<showSettings.formlayoutList.length;i++)
328
- $("#fieldlist"+opt.identifier).removeClass(showSettings.formlayoutList[i].id);
329
- $("#fieldlist"+opt.identifier).addClass(theForm.formlayout);
330
- $("#formheader"+opt.identifier).html(theForm.display());
331
- $("#fieldlist"+opt.identifier).html("");
332
- if (parseInt(itemSelected)==-1)
333
- $(".fform").addClass("ui-selected");
334
- else
335
- $(".fform").removeClass("ui-selected");
336
- for (var i=0;i<items.length;i++)
337
- {
338
- items[i].index = i;
339
- $("#fieldlist"+opt.identifier).append(items[i].display());
340
- if (i==itemSelected)
341
- $("#field"+opt.identifier+"-"+i).addClass("ui-selected");
342
- else
343
- $("#field"+opt.identifier+"-"+i).removeClass("ui-selected");
344
- $(".fields").mouseover(function() {
345
- $(this).addClass("ui-over");
346
- }).mouseout(function(){
347
- $(this).removeClass("ui-over")
348
- }).click(function(){
349
- editItem($(this).attr("id").replace("field"+opt.identifier+"-",""));
350
- $(this).siblings().removeClass("ui-selected");
351
- $(this).addClass("ui-selected");
352
- });
353
- $(".field").focus(function(){
354
- $(this).blur();
355
- });
356
- $("#field"+opt.identifier+"-"+i+" .remove").click(function(){
357
- removeItem($(this).parent().attr("id").replace("field"+opt.identifier+"-",""));
358
- });
359
- }
360
- if ($("#fieldlist"+opt.identifier).html() == "")
361
- $("#saveForm").css("display","none");
362
- else
363
- $("#saveForm").css("display","none"); // changed "inline" to "none"
364
- $(".fform").mouseover(function() {
365
- $(this).addClass("ui-over");
366
- }).mouseout(function(){
367
- $(this).removeClass("ui-over")
368
- }).click(function(){
369
- $('#tabs').tabs("option", "active", 2);
370
- editForm();
371
- $(this).siblings().removeClass("ui-selected");
372
- $(this).addClass("ui-selected");
373
- });
374
- ffunct.saveData("form_structure");
375
- //email list
376
- var str = "";
377
- for (var i=0;i<items.length;i++)
378
- if (items[i].ftype=="femail")
379
- str += '<option value="'+items[i].name+'" '+((items[i].name == $('#cu_user_email_field').attr("def"))?"selected":"")+'>'+(items[i].title)+'</option>';
380
- $('#cu_user_email_field').html(str);
381
- //field list for paypal request
382
- if (($('#request_cost').length > 0) && ($('#request_cost').is('select')))
383
- {
384
- var str = "";
385
- for (var i=0;i<items.length;i++)
386
- str += '<option value="'+items[i].name+'" '+((items[i].name == $('#request_cost').attr("def"))?"selected":"")+'>'+items[i].name+'('+(items[i].title)+')</option>';
387
- $('#request_cost').html(str);
388
- }
389
- //request amount list
390
- if ($('#paypal_price_field').length > 0)
391
- {
392
- var str = '<option value="" '+(('' == $('#paypal_price_field').attr("def"))?"selected":"")+'> ---- No ---- </option>';
393
- for (var i=0;i<items.length;i++)
394
- str += '<option value="'+items[i].name+'" '+((items[i].name == $('#paypal_price_field').attr("def"))?"selected":"")+'>'+(items[i].title)+'</option>';
395
- $('#paypal_price_field').html(str);
396
- }
397
- }
398
- function htmlDecode(value){
399
- if(/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test(value))value=$('<div/>').html(value).text();return value;
400
- };
401
- function htmlEncode(value){
402
- value = $('<div/>').text(value).html()
403
- value = value.replace(/"/g, "&quot;");;
404
- return value;
405
- }
406
- function showHideDep(){
407
- function inArray(needle, haystack) {
408
- for(var i = 0; i < haystack.length; i++) {
409
- if(haystack[i] == needle) return true;
410
- }
411
- return false;
412
- }
413
- function removeFromArray(needle, haystack) {
414
- for(var i = 0; i < haystack.length; i++) {
415
- if(haystack[i] == needle)
416
- {
417
- haystack.splice(i,1);
418
- i--;
419
- }
420
- }
421
- return haystack;
422
- }
423
- var used = new Array();
424
- var hideArray = new Array();
425
- $(".depItem").each(function() {
426
- var item = $(this);
427
- try {
428
- if ((item.parents("#fieldlist"+opt.identifier).length==1) && item.attr("dep") && item.attr("dep")!="" )
429
- {
430
- var d = item.attr("dep").split(",");
431
- for (i=0;i<d.length;i++)
432
- {
433
- if (d[i]!="") d[i] = d[i]+opt.identifier;
434
- if (d[i]!="" && !inArray(d[i],used) )//&& !inArray(d[i],hideArray)
435
- {
436
- try {
437
- if ((item.is(':checked') || item.is(':selected') ) && (!inArray( ((item.hasClass("field"))?item.attr("id"):item.parents(".field").attr("id")) ,hideArray)) )
438
- {
439
- $("#"+d[i]).parents(".fields").css("display","");
440
- $("#"+d[i]).parents(".fields").find(".field").each(function(){if (!$(this).hasClass("ignorepb"))$(this).removeClass("ignore");});
441
- used[used.length] = d[i];
442
- removeFromArray(d[i],hideArray);
443
- }
444
- else
445
- {
446
- $("#"+d[i]).parents(".fields").css("display","none");
447
- $("#"+d[i]).parents(".fields").find(".field").each(function(){$(this).addClass("ignore");});
448
- hideArray[hideArray.length] = d[i];
449
- }
450
- }catch(e){}
451
- }
452
- }
453
- }
454
- }catch(e){}
455
- });
456
- }
457
- reloadItemsPublic = function() {
458
- for (var i=0;i<showSettings.formlayoutList.length;i++)
459
- $("#fieldlist"+opt.identifier).removeClass(showSettings.formlayoutList[i].id);
460
- $("#fieldlist"+opt.identifier).html("").addClass(theForm.formlayout);
461
- $("#formheader"+opt.identifier).html(theForm.show());
462
- var page = 0;
463
- $("#fieldlist"+opt.identifier).append('<div class="pb'+page+' pbreak" page="'+page+'"></div>');
464
- var itemsDates = new Array();
465
- for (var i=0;i<items.length;i++)
466
- {
467
- items[i].index = i;
468
- if (items[i].ftype=="fPageBreak")
469
- {
470
- page++;
471
- $("#fieldlist"+opt.identifier).append('<div class="pb'+page+' pbreak" page="'+page+'"></div>');
472
- }
473
- else
474
- {
475
- $("#fieldlist"+opt.identifier+" .pb"+page).append(items[i].show());
476
- if (items[i].predefinedClick)
477
- {
478
- var cl = $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("class")+" predefinedClick";
479
- $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("class",cl);
480
- $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("predefined",items[i].predefined);
481
- }
482
- if (items[i].userhelpTooltip)
483
- {
484
- var uh = $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).parents(".fields");
485
- uh.find(".uh").css("display","none");
486
- if (uh.find(".uh").text()!="")
487
- uh.attr("uh",uh.find(".uh").text());
488
- }
489
- }
490
- $(".fields").mouseover(function() {
491
- $(this).addClass("ui-over");
492
- }).mouseout(function(){
493
- $(this).removeClass("ui-over")
494
- }).click(function(){
495
- editItem($(this).attr("id").replace("field"+opt.identifier+"-",""));
496
- $(this).siblings().removeClass("ui-selected");
497
- $(this).addClass("ui-selected");
498
- });
499
-
500
- if (items[i].ftype=="fdate")
501
- itemsDates[itemsDates.length] = items[i];
502
- }
503
- if (page>0)
504
- {
505
- $("#fieldlist"+opt.identifier+" .pb"+page).addClass("pbEnd");
506
- $("#fieldlist"+opt.identifier+" .pbreak").find(".field").addClass("ignore").addClass("ignorepb");
507
- $("#fieldlist"+opt.identifier+" .pb0").find(".field").removeClass("ignore").removeClass("ignorepb");
508
- $("#fieldlist"+opt.identifier+" .pbreak").each(function(index) {
509
- var code = $(this).html();
510
- var bSubmit = '';
511
- if (index == page)
512
- {
513
- if ($("#cpcaptchalayer"+opt.identifier).html())
514
- {
515
- code += '<div class="fields cpfieldcaptcha" id="fieldcaptcha'+opt.identifier+'">'+$("#cpcaptchalayer"+opt.identifier).html()+'</div>';
516
- $("#cpcaptchalayer"+opt.identifier).html("");
517
- }
518
- if ($("#cp_subbtn"+opt.identifier).html())
519
- bSubmit = '<div class="pbSubmit">'+$("#cp_subbtn"+opt.identifier).html()+'</div>';
520
- }
521
- $(this).html('<fieldset><legend>'+opt.messages.page+' '+(index+1)+' '+opt.messages.of+' '+(page+1)+'</legend>'+code+'<div class="pbPrevious">'+opt.messages.previous+'</div><div class="pbNext">'+opt.messages.next+'</div>'+bSubmit+'<div class="clearer"></div></fieldset>');
522
- });
523
- $(".pbPrevious,.pbNext").bind("click", function() {
524
- if ($(this).parents("form").valid())
525
- {
526
- var page = parseInt($(this).parents(".pbreak").attr("page"));
527
- (($(this).hasClass("pbPrevious"))?page--:page++);
528
- $("#fieldlist"+opt.identifier+" .pbreak").css("display","none");
529
- $("#fieldlist"+opt.identifier+" .pbreak").find(".field").addClass("ignore").addClass("ignorepb");
530
-
531
- $("#fieldlist"+opt.identifier+" .pb"+page).css("display","block");
532
- $("#fieldlist"+opt.identifier+" .pb"+page).find(".field").removeClass("ignore").removeClass("ignorepb");
533
- showHideDep();
534
- }
535
- return false;
536
- });
537
- }
538
- else
539
- {
540
- if ($("#cpcaptchalayer"+opt.identifier).html())
541
- {
542
- $("#fieldlist"+opt.identifier+" .pb"+page).append('<div class="fields cpfieldcaptcha" id="fieldcaptcha'+opt.identifier+'">'+$("#cpcaptchalayer"+opt.identifier).html()+'</div>');
543
- $("#cpcaptchalayer"+opt.identifier).html("");
544
- }
545
- if ($("#cp_subbtn"+opt.identifier).html())
546
- $("#fieldlist"+opt.identifier+" .pb"+page).append('<div class="pbSubmit">'+$("#cp_subbtn"+opt.identifier).html()+'</div>');
547
- }
548
- $(".pbSubmit").bind("click", function() {
549
- $(this).parents("#fieldlist"+opt.identifier).parents("form").submit();
550
- });
551
- $("#fieldlist"+opt.identifier+" .predefinedClick").bind("click", function() {
552
- if ($(this).attr("predefined") == $(this).val())
553
- $(this).val("");
554
- });
555
- $("#fieldlist"+opt.identifier+" .predefinedClick").blur("click", function() {
556
- if ($(this).val()=="")
557
- $(this).val($(this).attr("predefined"));
558
- });
559
- if (i>0)
560
- {
561
- for (var k=0;k<itemsDates.length;k++)
562
- {
563
- if (itemsDates[k].showDropdown)
564
- $( "#"+itemsDates[k].name ).datepicker({changeMonth: true,changeYear: true,yearRange: itemsDates[k].dropdownRange,dateFormat: itemsDates[k].dformat.replace(/yyyy/g,"yy")});
565
- else
566
- $( "#"+itemsDates[k].name ).datepicker({ dateFormat: itemsDates[k].dformat.replace(/yyyy/g,"yy")});
567
- $( "#"+itemsDates[k].name ).datepicker( "option", "minDate", itemsDates[k].minDate );
568
- $( "#"+itemsDates[k].name ).datepicker( "option", "maxDate", itemsDates[k].maxDate );
569
- $( "#"+itemsDates[k].name ).datepicker( "option", "defaultDate", itemsDates[k].defaultDate );
570
- }
571
- //$(".depItem").each(function() {
572
- showHideDep();
573
- //});
574
- $.validator.addMethod("dateddmmyyyy", function(value, element) {
575
- return this.optional(element) || /^(?:[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])[\/\-](?:[1-9]|0[1-9]|1[0-2])[\/\-]\d{4}$/.test(value);
576
- });
577
-
578
- $.validator.addMethod("datemmddyyyy", function(value, element) {
579
- return this.optional(element) || /^(?:[1-9]|0[1-9]|1[0-2])[\/\-](?:[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])[\/\-]\d{4}$/.test(value);
580
- });//{required: true, range: [11, 22]}
581
-
582
-
583
-
584
- $(".depItemSel,.depItem").bind("change", function() {
585
- showHideDep();
586
- });
587
- try {
588
- $( "#fbuilder"+opt.identifier ).tooltip({show: false,hide:false,tooltipClass:"uh-tooltip",position: { my: "left top", at: "left bottom", collision: "none" },items: "[uh]",content: function (){return $(this).attr("uh");} });
589
- } catch(e){}
590
-
591
- }
592
- for (var i=0;i<items.length;i++)
593
- items[i].after_show();
594
- }
595
- var showSettings= {
596
- sizeList:new Array({id:"small",name:"Small"},{id:"medium",name:"Medium"},{id:"large",name:"Large"}),
597
- layoutList:new Array({id:"one_column",name:"One Column"},{id:"two_column",name:"Two Column"},{id:"three_column",name:"Three Column"},{id:"side_by_side",name:"Side by Side"}),
598
- formlayoutList:new Array({id:"top_aligned",name:"Top Aligned"},{id:"left_aligned",name:"Left Aligned"},{id:"right_aligned",name:"Right Aligned"}),
599
- showTitle: function(f,v) {
600
- var str = '<label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+v+'</textarea>';
601
- if (v=="Page Break") str = "";
602
- return '<label>Field Type: '+getNameByIdFromType(f)+'</label><br /><br />'+str;
603
- },
604
- showName: function(v1,v2) {
605
- return '<div><label>Short label (optional) [<a class="helpfbuilder" text="The short label is used at title for the column when exporting the form data to CSV files.\n\nIf the short label is empty then, the field label will be used for the CSV file.">help?</a>] :</label><input class="large" name="sShortlabel" id="sShortlabel" value="'+v2+'" /></div>'+
606
- '<div><label>Field tag for the message (optional):</label><input readonly="readonly" class="large" name="sNametag" id="sNametag" value="&lt;%'+v1+'%&gt;" />'+
607
- '<input style="display:none" readonly="readonly" class="large" name="sName" id="sName" value="'+v1+'" /></div>';
608
- },
609
- showPredefined: function(v,c) {
610
- return '<div><label>Predefined Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+v+'</textarea><br /><input type="checkbox" name="sPredefinedClick" id="sPredefinedClick" '+((c)?"checked":"")+' value="1" > Hide predefined value on click.</div>';
611
- },
612
- showEqualTo: function(v,name) {
613
- return '<div><label>Equal to [<a class="helpfbuilder" text="Use this field to create password confirmation field or email confirmation fields.\n\nSpecify this setting ONLY into the confirmation field, not in the original field.">help?</a>]</label><br /><select class="equalTo" name="sEqualTo" id="sEqualTo" dvalue="'+v+'" dname="'+name+'"></select></div>';
614
- },
615
- showRequired: function(v) {
616
- return '<div><input type="checkbox" name="sRequired" id="sRequired" '+((v)?"checked":"")+'><label>Required</label></div>';
617
- },
618
- showSize: function(v) {
619
- var str = "";
620
- for (var i=0;i<this.sizeList.length;i++)
621
- str += '<option value="'+this.sizeList[i].id+'" '+((this.sizeList[i].id==v)?"selected":"")+'>'+this.sizeList[i].name+'</option>';
622
- return '<label>Field Size</label><br /><select name="sSize" id="sSize">'+str+'</select>';
623
- },
624
- showLayout: function(v) {
625
- var str = "";
626
- for (var i=0;i<this.layoutList.length;i++)
627
- str += '<option value="'+this.layoutList[i].id+'" '+((this.layoutList[i].id==v)?"selected":"")+'>'+this.layoutList[i].name+'</option>';
628
- return '<label>Field Layout</label><br /><select name="sLayout" id="sLayout">'+str+'</select>';
629
- },
630
- showUserhelp: function(v,c) {
631
- return '<div><label>Instructions for User</label><textarea class="large" name="sUserhelp" id="sUserhelp">'+v+'</textarea><br /><input type="checkbox" name="sUserhelpTooltip" id="sUserhelpTooltip" '+((c)?"checked":"")+' value="1" > Show as floating tooltip.</div>';
632
- },
633
- showCsslayout: function(v) {
634
- return '<label>Additional CSS Class</label><input class="large" name="sCsslayout" id="sCsslayout" value="'+v+'" />';
635
- }
636
- };
637
- var fform=function(){};
638
- $.extend(fform.prototype,{
639
- title:"Untitled Form",
640
- description:"This is my form. Please fill it out. It's awesome!",
641
- formlayout:"top_aligned",
642
- display:function(){
643
- return '<div class="fform" id="field">'+(this.title!=''?'<h1>'+this.title+'</h1>':'')+(this.description!=''?'<span>'+this.description+'</span>':'')+'</div>';
644
- },
645
- show:function(){
646
- var tmpstr = '';
647
- if (this.title != '')
648
- tmpstr += '<h1>'+this.title+'</h1>';
649
- if (this.description != '')
650
- tmpstr += '<span>'+this.description+'</span>';
651
- return '<div class="fform" id="field">'+tmpstr+'</div>';
652
- },
653
- showAllSettings:function(){
654
- var str = "";
655
- for (var i=0;i<showSettings.formlayoutList.length;i++)
656
- str += '<option value="'+showSettings.formlayoutList[i].id+'" '+((showSettings.formlayoutList[i].id==this.formlayout)?"selected":"")+'>'+showSettings.formlayoutList[i].name+'</option>';
657
- return '<div><label>Form Name</label><input class="large" name="fTitle" id="fTitle" value="'+htmlEncode(this.title)+'" /></div><div><label>Description</label><textarea class="large" name="fDescription" id="fDescription">'+this.description+'</textarea></div><div><label>Label Placement</label><br /><select name="fLayout" id="fLayout">'+str+'</select></div>';
658
- }
659
-
660
- });
661
- var theForm = new fform();
662
- var ffields=function(){};
663
- $.extend(ffields.prototype, {
664
- name:"",
665
- shortlabel:"",
666
- index:-1,
667
- ftype:"",
668
- userhelp:"",
669
- userhelpTooltip:false,
670
- csslayout:"",
671
- init:function(){
672
- },
673
- after_show:function(){},
674
- showSpecialData:function(){
675
- if(typeof this.showSpecialDataInstance != 'undefined')
676
- return this.showSpecialDataInstance();
677
- else
678
- return "";
679
- },
680
- showEqualTo:function(){
681
- if(typeof this.equalTo != 'undefined')
682
- return showSettings.showEqualTo(this.equalTo,this.name);
683
- else
684
- return "";
685
- },
686
- showPredefined:function(){
687
- if(typeof this.predefined != 'undefined')
688
- return showSettings.showPredefined(this.predefined,this.predefinedClick);
689
- else
690
- return "";
691
- },
692
- showRequired:function(){
693
- if(typeof this.required != 'undefined')
694
- return showSettings.showRequired(this.required);
695
- else
696
- return "";
697
- },
698
- showSize:function(){
699
- if(typeof this.size != 'undefined')
700
- return showSettings.showSize(this.size);
701
- else
702
- return "";
703
- },
704
- showLayout:function(){
705
- if(typeof this.layout != 'undefined')
706
- return showSettings.showLayout(this.layout);
707
- else
708
- return "";
709
- },
710
- showRange:function(){
711
- if(typeof this.min != 'undefined')
712
- return this.showRangeIntance();
713
- else
714
- return "";
715
- },
716
- showFormat:function(){
717
- if(typeof this.dformat != 'undefined')
718
- try {
719
- return this.showFormatIntance();
720
- } catch(e) {return "";}
721
- else
722
- return "";
723
- },
724
- showChoice:function(){
725
- if(typeof this.choices != 'undefined')
726
- return this.showChoiceIntance();
727
- else
728
- return "";
729
- },
730
- showUserhelp:function(){
731
- return ((this.ftype!="fPageBreak")?showSettings.showUserhelp(this.userhelp,this.userhelpTooltip):"");
732
- },
733
- showCsslayout:function(){
734
- return ((this.ftype!="fPageBreak")?showSettings.showCsslayout(this.csslayout):"");
735
- },
736
- showAllSettings:function(){
737
- return this.showTitle()+this.showName()+this.showSize()+this.showLayout()+this.showFormat()+this.showRange()+this.showRequired()+this.showSpecialData()+this.showEqualTo()+this.showPredefined()+this.showChoice()+this.showUserhelp()+this.showCsslayout();
738
- },
739
- showTitle:function(){
740
- return showSettings.showTitle(this.ftype,this.title);
741
- },
742
- showName:function(){
743
- return ((this.ftype!="fPageBreak")?showSettings.showName(this.name,this.shortlabel):"");
744
- },
745
- display:function(){
746
- return 'Not available yet';
747
- },
748
- show:function(){
749
- return 'Not available yet';
750
- },
751
- toJSON:function(){
752
- str = '';
753
- $.each( this, function(i, n){
754
- if (typeof n!="function")
755
- {
756
- if (str!="")
757
- str += ",";
758
- str += '"'+i+'":'+n ;
759
- }
760
- });
761
- return str;
762
- }
763
- });
764
- var ftext=function(){};
765
- $.extend(ftext.prototype,ffields.prototype,{
766
- title:"Untitled",
767
- ftype:"ftext",
768
- predefined:"",
769
- predefinedClick:false,
770
- required:false,
771
- size:"medium",
772
- minlength:"",
773
- maxlength:"",
774
- equalTo:"",
775
- display:function(){
776
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
777
- },
778
- show:function(){
779
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+htmlEncode(this.maxlength)+'" '+((this.equalTo!="")?"equalTo=\"#"+htmlEncode(this.equalTo+opt.identifier)+"\"":"" )+' class="field '+this.size+((this.required)?" required":"")+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
780
- },
781
- showSpecialDataInstance: function() {
782
- return '<div class="column"><label>Min length/characters</label><br /><input name="sMinlength" id="sMinlength" value="'+this.minlength+'"></div><div class="column"><label>Max length/characters</label><br /><input name="sMaxlength" id="sMaxlength" value="'+this.maxlength+'"></div><div class="clearer"></div>';
783
- }
784
- });
785
- var facceptance=function(){};
786
- $.extend(facceptance.prototype,ffields.prototype,{
787
- title:"Accept terms and conditions",
788
- ftype:"facceptance",
789
- value:"I accept",
790
- required:true,
791
- url:"",
792
- message:"",
793
- display:function(){
794
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><div class="dfield"><input class="field" disabled="true" type="checkbox"/> '+this.title+((this.required)?"*":"")+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
795
- },
796
- show:function(){
797
- //return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+htmlEncode(this.maxlength)+'" '+((this.equalTo!="")?"equalTo=\"#"+htmlEncode(this.equalTo+opt.identifier)+"\"":"" )+' class="field '+this.size+((this.required)?" required":"")+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
798
- var me = this,
799
- dlg = '',
800
- label = me.title;
801
-
802
- if(!/^\s*$/.test(me.url))
803
- {
804
- label = '<a href="'+htmlEncode($.trim(me.url))+'" target="_blank">'+label+'</a>';
805
- }
806
- else if(!/^\s*$/.test(me.message))
807
- {
808
- label = '<a href="javascript:void(0);" class="cff-open-dlg">'+label+'</a>';
809
- dlg += '<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+me.message+'</div></div>'
810
- }
811
- return '<div class="fields '+me.csslayout+' cff-checkbox-field" id="field'+me.identifier+'-'+me.index+'"><div class="dfield">'+
812
- '<div class="one_column"><label><input name="'+me.name+'" id="'+me.name+'" class="field '+((this.required)?" required":"")+'" value="'+htmlEncode(me.value)+'" vt="'+htmlEncode((/^\s*$/.test(me.value)) ? me.title : me.value)+'" type="checkbox" /> <span>'+
813
- htmlDecode( label )+''+((me.required)?'<span class="r">*</span>':'')+
814
- '</span></label></div>'+
815
- dlg+
816
- '</div><div class="clearer"></div></div>';
817
-
818
- },
819
- after_show:function()
820
- {
821
- $(document).on('click','.cff-open-dlg', function(){
822
- var dlg = $(this).closest('.fields').find('.cff-dialog'), w = dlg.data('width'), h=dlg.data('height');
823
- dlg.removeClass('hide');
824
-
825
- if('undefined' == typeof w) w = Math.min($(this).closest('form').width(), $(window).width(), dlg.width());
826
- if('undefined' == typeof h) h = Math.min($(this).closest('form').height(), $(window).height(), dlg.height());
827
-
828
- dlg.data('width',w);
829
- dlg.data('height',h);
830
-
831
- dlg.css({'width': w+'px', 'height': h+'px', 'margin-top': (-1*h/2)+'px', 'margin-left': (-1*w/2)+'px'});
832
- });
833
- $(document).on('click','.cff-close-dlg', function(){$(this).closest('.cff-dialog').addClass('hide');});
834
- },
835
- showSpecialDataInstance: function() {
836
- return '<div><label>Value</label><input class="large" type="text" name="sValue" id="sValue" value="'+htmlEncode(this.value)+'"></div><div><label>URL to the Consent and Acknowledgement page</label><input class="large" type="text" name="sURL" id="sURL" value="'+htmlEncode(this.url)+'"></div><div><label>- or - enter the Consent and Acknowledgement text</label><textarea class="large" name="sMessage" id="sMessage" style="height:150px;">'+this.message+'</textarea></div>';
837
- }
838
- });
839
- var fpassword=function(){};
840
- $.extend(fpassword.prototype,ffields.prototype,{
841
- title:"Untitled",
842
- ftype:"fpassword",
843
- predefined:"",
844
- predefinedClick:false,
845
- required:false,
846
- size:"medium",
847
- minlength:"",
848
- maxlength:"",
849
- equalTo:"",
850
- display:function(){
851
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
852
- },
853
- show:function(){
854
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
855
- },
856
- showSpecialDataInstance: function() {
857
- return 'Not available in free version';
858
- }
859
- });
860
- var femail=function(){};
861
- $.extend(femail.prototype,ffields.prototype,{
862
- title:"Email",
863
- ftype:"femail",
864
- predefined:"",
865
- predefinedClick:false,
866
- required:false,
867
- size:"medium",
868
- equalTo:"",
869
- display:function(){
870
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="email" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
871
- },
872
- show:function(){
873
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+((this.equalTo!="")?"equalTo=\"#"+htmlEncode(this.equalTo+opt.identifier)+"\"":"" )+' class="field email '+this.size+((this.required)?" required":"")+'" type="email" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
874
- },
875
- showSpecialDataInstance: function() {
876
- var str = "";
877
- return str;
878
- }
879
- });
880
- var fnumber=function(){};
881
- $.extend(fnumber.prototype,ffields.prototype,{
882
- title:"Number",
883
- ftype:"fnumber",
884
- predefined:"",
885
- predefinedClick:false,
886
- required:false,
887
- size:"small",
888
- min:"",
889
- max:"",
890
- dformat:"digits",
891
- formats:new Array("digits","number"),
892
- display:function(){
893
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
894
- },
895
- show:function(){
896
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
897
- },
898
- showFormatIntance: function() {;
899
- return '<div>Not available in free version</div>';
900
- },
901
- showRangeIntance: function() {
902
- return 'Not available in free version';
903
- }
904
- });
905
- var fdate=function(){};
906
- $.extend(fdate.prototype,ffields.prototype,{
907
- title:"Date",
908
- ftype:"fdate",
909
- predefined:"",
910
- predefinedClick:false,
911
- size:"medium",
912
- required:false,
913
- dformat:"mm/dd/yyyy",
914
- showDropdown:false,
915
- dropdownRange:"-10:+10",
916
- minDate:"",
917
- maxDate:"",
918
- defaultDate:"",
919
- formats:new Array("mm/dd/yyyy","dd/mm/yyyy"),
920
- display:function(){
921
- return '';
922
- },
923
- show:function(){
924
- return '';
925
- },
926
- showFormatIntance: function() {
927
- return '<div>Not available in free version</div>';
928
- },
929
- showSpecialDataInstance: function() {
930
- return 'Not available in free version';
931
- }
932
- });
933
- var ftextarea=function(){};
934
- $.extend(ftextarea.prototype,ffields.prototype,{
935
- title:"Untitled",
936
- ftype:"ftextarea",
937
- predefined:"",
938
- predefinedClick:false,
939
- required:false,
940
- size:"medium",
941
- minlength:"",
942
- maxlength:"",
943
- display:function(){
944
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><textarea class="field disabled '+this.size+'">'+this.predefined+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
945
- },
946
- show:function(){
947
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><textarea id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+htmlEncode(this.maxlength)+'" class="field '+this.size+((this.required)?" required":"")+'">'+this.predefined+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
948
- },
949
- showSpecialDataInstance: function() {
950
- return '<div class="column"><label>Min length/characters</label><br /><input name="sMinlength" id="sMinlength" value="'+this.minlength+'"></div><div class="column"><label>Max length/characters</label><br /><input name="sMaxlength" id="sMaxlength" value="'+this.maxlength+'"></div><div class="clearer"></div>';
951
- }
952
- });
953
- var ffile=function(){};
954
- $.extend(ffile.prototype,ffields.prototype,{
955
- title:"Untitled",
956
- ftype:"ffile",
957
- required:false,
958
- size:"medium",
959
- display:function(){
960
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
961
- },
962
- show:function(){
963
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
964
- }
965
- });
966
- var fSectionBreak=function(){};
967
- $.extend(fSectionBreak.prototype,ffields.prototype,{
968
- title:"Section Break",
969
- ftype:"fSectionBreak",
970
- userhelp:"A description of the section goes here.",
971
- display:function(){
972
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
973
- },
974
- show:function(){
975
- return '<div class="fields '+this.csslayout+' section_breaks" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
976
- }
977
- });
978
- var fPageBreak=function(){};
979
- $.extend(fPageBreak.prototype,ffields.prototype,{
980
- title:"Page Break",
981
- ftype:"fPageBreak",
982
- display:function(){
983
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
984
- },
985
- show:function(){
986
- return '<div class="fields '+this.csslayout+' section_breaks" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
987
- }
988
- });
989
- var fPhone=function(){};
990
- $.extend(fPhone.prototype,ffields.prototype,{
991
- title:"Phone",
992
- ftype:"fPhone",
993
- required:false,
994
- dformat:"### ### ####",
995
- predefined:"888 888 8888",
996
- display:function(){
997
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
998
- },
999
- show:function(){
1000
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1001
- },
1002
- showFormatIntance: function() {
1003
- return '<div>Not available in free version</div>';
1004
- }
1005
- });
1006
- var fCommentArea=function(){};
1007
- $.extend(fCommentArea.prototype,ffields.prototype,{
1008
- title:"Comments here",
1009
- ftype:"fCommentArea",
1010
- userhelp:"A description of the section goes here.",
1011
- display:function(){
1012
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1013
- },
1014
- show:function(){
1015
- return '<div class="fields '+this.csslayout+' comment_area" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1016
- }
1017
- });
1018
- var fcheck=function(){};
1019
- $.extend(fcheck.prototype,ffields.prototype,{
1020
- title:"Check All That Apply",
1021
- ftype:"fcheck",
1022
- layout:"one_column",
1023
- required:false,
1024
- showDep:false,
1025
- init:function(){
1026
- },
1027
- display:function(){
1028
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1029
- },
1030
- show:function(){
1031
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1032
- },
1033
- showChoiceIntance: function() {
1034
- return '<div class="choicesSet '+((this.showDep)?"show":"hide")+'">Not available in free version<div class="clearer"></div></div>'+str+'</div>';
1035
- }
1036
- });
1037
- var fradio=function(){};
1038
- $.extend(fradio.prototype,ffields.prototype,{
1039
- title:"Select a Choice",
1040
- ftype:"fradio",
1041
- layout:"one_column",
1042
- required:false,
1043
- choiceSelected:null,
1044
- showDep:false,
1045
- init:function(){
1046
- },
1047
- display:function(){
1048
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
1049
- },
1050
- show:function(){
1051
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
1052
- var str = "";
1053
- if (!(typeof(this.choicesDep) != "undefined" && this.choicesDep !== null))
1054
- {
1055
- this.choicesDep = new Array();
1056
- for (var i=0;i<this.choices.length;i++)
1057
- this.choicesDep[i] = new Array();
1058
- }
1059
- for (var i=0;i<this.choices.length;i++)
1060
- {
1061
- var classDep = "",attrDep = "";
1062
- var d = this.choicesDep;
1063
- if (d[i].length>0)
1064
- {
1065
- classDep = " depItem";
1066
- for (var j=0;j<d[i].length;j++)
1067
- {
1068
- attrDep += ","+d[i][j];
1069
- }
1070
- }
1071
- str += '<div class="'+this.layout+'"><input name="'+this.name+'" id="'+this.name+'" '+((classDep!="")?"dep=\""+attrDep+"\"":"")+' class="field depItem group '+((this.required)?" required":"")+'" value="'+htmlEncode(this.choicesVal[i])+'" type="radio" i="'+i+'" '+((this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> <span>'+this.choices[i]+'</span></div>';
1072
- }
1073
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
1074
- },
1075
- showChoiceIntance: function() {
1076
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
1077
- var l = this.choices;
1078
- var lv = this.choicesVal;
1079
- var v = this.choiceSelected;
1080
- if (!(typeof(this.choicesDep) != "undefined" && this.choicesDep !== null))
1081
- {
1082
- this.choicesDep = new Array();
1083
- for (var i=0;i<l.length;i++)
1084
- this.choicesDep[i] = new Array();
1085
- }
1086
- var d = this.choicesDep;
1087
- var str = "";
1088
- for (var i=0;i<l.length;i++)
1089
- {
1090
- str += '<div class="choicesEdit"><input class="choice_radio" i="'+i+'" type="radio" '+((this.choiceSelected==lv[i])?"checked":"")+' name="choice_radio" /><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'+htmlEncode(l[i])+'"/><input class="choice_value" i="'+i+'" type="text" name="sChoice'+this.name+'V'+i+'" id="sChoice'+this.name+'V'+i+'" value="'+htmlEncode(lv[i])+'"/><a class="choice_add ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another choice."></a><a class="choice_remove ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this choice."></a></div>';
1091
- for (var j=0;j<d[i].length;j++)
1092
- str += '<div class="choicesEditDep">If selected show: <select class="dependencies" i="'+i+'" j="'+j+'" dname="'+this.name+'" dvalue="'+d[i][j]+'" ></select><a class="choice_addDep ui-icon ui-icon-circle-plus" i="'+i+'" j="'+j+'" title="Add another dependency."></a><a class="choice_removeDep ui-icon ui-icon-circle-minus" i="'+i+'" j="'+j+'" title="Delete this dependency."></a></div>';
1093
- if (d[i].length==0)
1094
- str += '<div class="choicesEditDep">If selected show: <select class="dependencies" i="'+i+'" j="'+d[i].length+'" dname="'+this.name+'" dvalue="" ></select><a class="choice_addDep ui-icon ui-icon-circle-plus" i="'+i+'" j="'+d[i].length+'" title="Add another dependency."></a><a class="choice_removeDep ui-icon ui-icon-circle-minus" i="'+i+'" j="'+d[i].length+'" title="Delete this dependency."></a></div>';
1095
- }
1096
- return '<div class="choicesSet '+((this.showDep)?"show":"hide")+'"><label>Choices</label> <a class="helpfbuilder dep" text="Dependencies are used to show/hide other fields depending of the option selected in this field.">help?</a> <a href="" class="showHideDependencies">'+((this.showDep)?"Hide":"Show")+' Dependencies</a><div><div class="t">Text</div><div class="t">Value</div><div class="clearer"></div></div>'+str+'</div>';
1097
- }
1098
- });
1099
- var fdropdown=function(){};
1100
- $.extend(fdropdown.prototype,ffields.prototype,{
1101
- title:"Select a Choice",
1102
- ftype:"fdropdown",
1103
- size:"medium",
1104
- required:false,
1105
- choiceSelected:"",
1106
- showDep:false,
1107
- init:function(){
1108
- },
1109
- display:function(){
1110
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
1111
- return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1112
- },
1113
- show:function(){
1114
- return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1115
- },
1116
- showChoiceIntance: function() {
1117
- return '<div class="choicesSet '+((this.showDep)?"show":"hide")+'">Not available in free version<div class="clearer"></div></div>'+str+'</div>';
1118
- }
1119
- });
1120
- if (!opt.pub)
1121
- {
1122
- $("#fieldlist"+opt.identifier).sortable({
1123
- start: function(event, ui) {
1124
- var start_pos = ui.item.index();
1125
- ui.item.data('start_pos', start_pos);
1126
- },
1127
- stop: function(event, ui) {
1128
- var end_pos = parseInt(ui.item.index());
1129
- var start_pos = parseInt(ui.item.data('start_pos'));
1130
- var tmp = items[start_pos];
1131
- if (end_pos > start_pos)
1132
- {
1133
- for (var i = start_pos; i<end_pos; i++)
1134
- items[i] = items[i+1];
1135
- }
1136
- else
1137
- {
1138
- for (var i = start_pos; i>end_pos; i--)
1139
- items[i] = items[i-1];
1140
- }
1141
- items[end_pos] = tmp;
1142
-
1143
-
1144
- reloadItems();
1145
- }
1146
- });
1147
- }
1148
- if (!opt.pub)
1149
- {
1150
- $('#tabs').tabs({activate: function(event, ui) {
1151
- if ($(this).tabs( "option", "active" )!=1)
1152
- {
1153
- $(".fields").removeClass("ui-selected");
1154
- itemSelected = -2;
1155
- if ($(this).tabs( "option", "active" )==2)
1156
- {
1157
- $(".fform").addClass("ui-selected");
1158
- editForm();
1159
- }
1160
- else
1161
- $(".fform").removeClass("ui-selected");
1162
- }
1163
- else
1164
- {
1165
- $(".fform").removeClass("ui-selected");
1166
- if (itemSelected<0)
1167
- $('#tabs-2').html('<b>No Field Selected</b><br />Please click on a field in the form preview on the right to change its properties.');
1168
- }
1169
- }
1170
- });
1171
- }
1172
- loadtmp = function(p)
1173
- {
1174
-
1175
- if ( d = $.parseJSON(p))
1176
- {
1177
- if (d.length==2)
1178
- {
1179
- items = new Array();
1180
- for (var i=0;i<d[0].length;i++)
1181
- {
1182
- var obj = eval("new "+d[0][i].ftype+"();");
1183
- obj = $.extend(obj,d[0][i]);
1184
- obj.name = obj.name+opt.identifier;
1185
- items[items.length] = obj;
1186
- }
1187
- theForm = new fform();
1188
- theForm = $.extend(theForm,d[1][0]);
1189
- if (opt.pub)
1190
- reloadItemsPublic();
1191
- else
1192
- reloadItems();
1193
- }
1194
- }
1195
- }
1196
- var ffunct = {
1197
- getItems: function() {
1198
- return items;
1199
- },
1200
- addItem: function(id) {
1201
- var obj = eval("new "+id+"();")
1202
- obj.init();
1203
- var n = 0;
1204
- for (var i=0;i<items.length;i++)
1205
- {
1206
- n1 = parseInt(items[i].name.replace(/fieldname/g,""));
1207
- if (n1>n)
1208
- n = n1;
1209
- }
1210
- $.extend(obj,{name:"fieldname"+(n+1)});
1211
- items[items.length] = obj;
1212
- reloadItems();
1213
- },
1214
- saveData:function(f){
1215
- if (f!="")
1216
- $("#"+f).val("["+ $.stringifyXX(items,false)+",["+ $.stringifyXX(theForm,false)+"]]");
1217
- else
1218
- {
1219
- $.ajax({
1220
- type: "POST",
1221
- url: "process.php?act=save",
1222
- data: "items="+ $.stringifyXX(items,true)+"&theForm="+ $.stringifyXX(theForm,true),
1223
- dataType: "json",
1224
- success: function (result) {
1225
- alert("The form has been saved!!!");
1226
- }
1227
- });
1228
- }
1229
- },
1230
- loadData:function(f){
1231
-
1232
- if (f!="")
1233
- loadtmp($("#"+f).val());
1234
- else
1235
- {
1236
- $.ajax({async:false,
1237
- url: "process.php?act=load",
1238
- success: function (result) {
1239
- loadtmp(result.toString());
1240
- }
1241
- });
1242
- }
1243
- },
1244
- removeItem: removeItem,
1245
- editItem:editItem
1246
- }
1247
- this.fBuild = ffunct;
1248
- return this;
1249
- }
1250
-
1251
- var fcount = 1;
1252
- var fnum = "_"+fcount;
1253
- while (10>fcount || eval("typeof cp_contactformtoemail_fbuilder_config"+fnum+" != 'undefined'"))
1254
- {
1255
- try {
1256
- var cp_contactformtoemail_fbuilder_config = eval("cp_contactformtoemail_fbuilder_config"+fnum);
1257
- var f = $("#fbuilder"+fnum).CFTEfbuilder($.parseJSON(cp_contactformtoemail_fbuilder_config.obj));
1258
- f.fBuild.loadData("form_structure"+fnum);
1259
- $("#cp_contactformtoemail_pform"+fnum).validate({
1260
- ignore:".ignore",
1261
- errorElement: "div",
1262
- errorPlacement: function(e, element) {
1263
- if (element.hasClass('group'))
1264
- element = element.parent();
1265
- e.insertBefore(element);
1266
- e.addClass('message'); // add a class to the wrapper
1267
- e.css('position', 'absolute');
1268
- e.css('left',0 );
1269
- e.css('top',element.parent().outerHeight(true));
1270
- }
1271
- });
1272
- $( document ).trigger( 'showHideDepEvent', fnum );
1273
- } catch (e) {}
1274
- fcount++;
1275
- fnum = "_"+fcount;
1276
- }
1277
- })(jQuery);
1278
- /** jQuery.holdReady(false); */
1279
- });
1
+ jQuery(function(){var n;(n=jQuery).extend({stringifyXX:function(r){encodeParam=function(n,r){return r?(n=n.replace(/&/g,"%26"),encodeURI(n)):n},enc=function(n){return n=(n=n.replace(/\\/g,"\\\\")).replace(/\"/g,'\\"')};var e=typeof r;if("object"!=e||null===r)return"string"==e&&(r='"'+r+'"'),encodeParam(String(r));var t,c,i=[],o=r&&r.constructor==Array;for(t in r)"function"!=(e=typeof(c=r[t]))&&("string"==e?c='"'+enc(c)+'"':"object"==e&&null!==c&&(c=n.stringifyXX(c)),i.push((o?"":'"'+t+'":')+String(c)));return encodeParam(o?"[":"{")+String(i)+(o?"]":"}")}})});
2
+ jQuery(window).on("load",function(){!function($){$.fn.CFTEfbuilder=function(options){var opt=$.extend({},{typeList:new Array({id:"ftext",name:"Single Line"},{id:"fnumber",name:"Number"},{id:"femail",name:"Email"},{id:"fdate",name:"Date Time"},{id:"ftextarea",name:"Text Area"},{id:"fcurrency",name:"Currency"},{id:"fcheck",name:"Checkboxes"},{id:"fradio",name:"Radio Buttons"},{id:"fdropdown",name:"Dropdown"},{id:"ffile",name:"Upload File"},{id:"fpassword",name:"Password"},{id:"fPhone",name:"Phone field"},{id:"fCommentArea",name:"Instruct. Text"},{id:"fhidden",name:"Hidden"},{id:"fSectionBreak",name:"Section break"},{id:"fPageBreak",name:"Page break"},{id:"fsummary",name:"Summary"},{id:"fMedia",name:"Media"},{id:"fButton",name:"Button"},{id:"fhtml",name:"HTML content"},{id:"facceptance",name:"Accept / GDPR"},{id:"category",name:"Container Controls"},{id:"ffieldset",name:"Fieldset"},{id:"fdiv",name:"Div"},{id:"category",name:"Form Controls with Datasource Connection"},{id:"ftextds",name:"Line Text DS"},{id:"femailds",name:"Email DS"},{id:"ftextareads",name:"Text Area DS"},{id:"fcheckds",name:"Checkboxes DS"},{id:"fradiods",name:"Radio Btns DS"},{id:"fPhoneds",name:"Phone DS"},{id:"fdropdownds",name:"Dropdown DS"},{id:"fhiddends",name:"Hidden DS"},{id:"fnumberds",name:"Number DS"},{id:"fcurrencyds",name:"Currency DS"}),pub:!1,identifier:"",title:""},options,!0);if(opt.pub&&(opt.messages=$.extend({previous:"Previous",next:"Next",page:"Page",of:"of",required:"This field is required.",email:"Please enter a valid email address.",datemmddyyyy:"Please enter a valid date with this format(mm/dd/yyyy)",dateddmmyyyy:"Please enter a valid date with this format(dd/mm/yyyy)",number:"Please enter a valid number.",digits:"Please enter only digits.",maxlength:$.validator.format("Please enter no more than {0} characters"),minlength:$.validator.format("Please enter at least {0} characters."),equalTo:"Please enter the same value again.",max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},opt.messages),opt.messages.max=$.validator.format(opt.messages.max),opt.messages.min=$.validator.format(opt.messages.min),$.extend($.validator.messages,opt.messages)),getNameByIdFromType=function(e){for(var i=0;i<opt.typeList.length;i++)if(opt.typeList[i].id==e)return opt.typeList[i].name;return""},!opt.pub){for(var i=0;i<opt.typeList.length;i++)"category"==opt.typeList[i].id?$("#tabs-1").append('<div style="clear:both;"></div><br /><div class="category-description">'+opt.typeList[i].name+"</div><hr />"):$("#tabs-1").append('<div class="button width40 '+(i>5&&20!=i||i%2==1?"n":"itemForm")+'" id="'+opt.typeList[i].id+'">'+opt.typeList[i].name+"</div>");$("#tabs-1").append('<div class="clearer"></div>')}opt.pub||$(".button").button();var items=new Array,itemSelected=-2;function htmlDecode(e){return/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/gi.test(e)&&(e=$("<div/>").html(e).text()),e}function htmlEncode(e){return e=(e=$("<div/>").text(e).html()).replace(/"/g,"&quot;")}function showHideDep(){function e(e,i){for(var t=0;t<i.length;t++)if(i[t]==e)return!0;return!1}function t(e,i){for(var t=0;t<i.length;t++)i[t]==e&&(i.splice(t,1),t--);return i}var s=new Array,a=new Array;$(".depItem").each(function(){var n=$(this);try{if(1==n.parents("#fieldlist"+opt.identifier).length&&n.attr("dep")&&""!=n.attr("dep")){var l=n.attr("dep").split(",");for(i=0;i<l.length;i++)if(""!=l[i]&&(l[i]=l[i]+opt.identifier),""!=l[i]&&!e(l[i],s))try{!n.is(":checked")&&!n.is(":selected")||e(n.hasClass("field")?n.attr("id"):n.parents(".field").attr("id"),a)?($("#"+l[i]).parents(".fields").css("display","none"),$("#"+l[i]).parents(".fields").find(".field").each(function(){$(this).addClass("ignore")}),a[a.length]=l[i]):($("#"+l[i]).parents(".fields").css("display",""),$("#"+l[i]).parents(".fields").find(".field").each(function(){$(this).hasClass("ignorepb")||$(this).removeClass("ignore")}),s[s.length]=l[i],t(l[i],a))}catch(e){}}}catch(e){}})}editItem=function(e){opt.pub||$("#tabs").tabs("option","active",1);try{$("#tabs-2").html(items[e].showAllSettings())}catch(e){}itemSelected=e,$(".helpfbuilder").click(function(){alert($(this).attr("text"))}),$("#sValue").bind("keyup",function(){items[e].value=$(this).val(),reloadItems()}),$("#sURL").bind("keyup",function(){items[e].url=$(this).val(),reloadItems()}),$("#sMessage").bind("keyup",function(){items[e].message=$(this).val(),reloadItems()}),$("#sMinDate").change(function(){items[e].minDate=$(this).val(),reloadItems()}),$("#sMaxDate").change(function(){items[e].maxDate=$(this).val(),reloadItems()}),$("#sDefaultDate").change(function(){items[e].defaultDate=$(this).val(),reloadItems()}),$("#sTitle").keyup(function(){var i=$(this).val();items[e].title=i.replace(/\n/g,"<br />"),reloadItems()}),$("#sName").keyup(function(){items[e].name=$(this).val(),reloadItems()}),$("#sShortlabel").keyup(function(){items[e].shortlabel=$(this).val(),reloadItems()}),$("#sPredefined").keyup(function(){items[e].predefined=$(this).val(),reloadItems()}),$("#sPredefinedClick").click(function(){items[e].predefinedClick=$(this).is(":checked"),reloadItems()}),$("#sEq").keyup(function(){items[e].eq=$(this).val(),reloadItems()}),$("#sSuffix").keyup(function(){items[e].suffix=$(this).val(),reloadItems()}),$("#sPrefix").keyup(function(){items[e].prefix=$(this).val(),reloadItems()}),$("#sDecimalSymbol").keyup(function(){items[e].decimalsymbol=$(this).val(),reloadItems()}),$("#sGroupingSymbol").keyup(function(){items[e].groupingsymbol=$(this).val(),reloadItems()}),$("#sDropdownRange").keyup(function(){items[e].dropdownRange=$(this).val(),reloadItems()}),$("#sRequired").click(function(){items[e].required=$(this).is(":checked"),reloadItems()}),$("#sReadOnly").click(function(){items[e].readonly=$(this).is(":checked"),reloadItems()}),$("#sShowDropdown").click(function(){items[e].showDropdown=$(this).is(":checked"),$(this).is(":checked")?$("#divdropdownRange").css("display",""):$("#divdropdownRange").css("display","none"),reloadItems()}),$("#sSize").change(function(){items[e].size=$(this).val(),reloadItems()}),$("#sFormat").change(function(){items[e].dformat=$(this).val(),reloadItems()}),$("#sLayout").change(function(){items[e].layout=$(this).val(),reloadItems()}),$("#sMin").change(function(){items[e].min=$(this).val(),reloadItems()}),$("#sMax").change(function(){items[e].max=$(this).val(),reloadItems()}),$("#sMinlength").change(function(){items[e].minlength=$(this).val(),reloadItems()}),$("#sMaxlength").change(function(){items[e].maxlength=$(this).val(),reloadItems()}),$("#sEqualTo").change(function(){items[e].equalTo=$(this).val(),reloadItems()}),$(".showHideDependencies").click(function(){return items[e].showDep?($(this).parent().removeClass("show"),$(this).parent().addClass("hide"),$(this).html("Show Dependencies"),items[e].showDep=!1):($(this).parent().addClass("show"),$(this).parent().removeClass("hide"),$(this).html("Hide Dependencies"),items[e].showDep=!0),!1}),$(".choice_remove").click(function(){1==items[e].choices.length?(items[e].choices[0]="",items[e].choicesVal[0]="",items[e].choicesDep[0]=new Array):(items[e].choices.splice($(this).attr("i"),1),items[e].choicesVal.splice($(this).attr("i"),1),items[e].choicesDep.splice($(this).attr("i"),1)),"fcheck"==items[e].ftype&&(1==items[e].choiceSelected.length?items[e].choiceSelected[0]="":items[e].choiceSelected.splice($(this).attr("i"),1)),editItem(e),reloadItems()}),$(".choice_add").click(function(){items[e].choices.splice(1*$(this).attr("i")+1,0,""),items[e].choicesVal.splice(1*$(this).attr("i")+1,0,""),items[e].choicesDep.splice(1*$(this).attr("i")+1,0,new Array),"fcheck"==items[e].ftype&&items[e].choiceSelected.splice(1*$(this).attr("i")+1,0,!1),editItem(e),reloadItems()}),$(".choice_text").keyup(function(){items[e].choices[$(this).attr("i")]==items[e].choicesVal[$(this).attr("i")]&&($("#"+$(this).attr("id")+"V"+$(this).attr("i")).val($(this).val()),items[e].choicesVal[$(this).attr("i")]=$(this).val()),items[e].choices[$(this).attr("i")]=$(this).val(),reloadItems()}),$(".choice_value").keyup(function(){items[e].choicesVal[$(this).attr("i")]=$(this).val(),reloadItems()}),$(".choice_radio").click(function(){$(this).is(":checked")&&(items[e].choiceSelected=items[e].choicesVal[$(this).attr("i")]),reloadItems()}),$(".choice_select").click(function(){$(this).is(":checked")&&(items[e].choiceSelected=items[e].choicesVal[$(this).attr("i")]),reloadItems()}),$(".choice_check").click(function(){$(this).is(":checked")?items[e].choiceSelected[$(this).attr("i")]=!0:items[e].choiceSelected[$(this).attr("i")]=!1,reloadItems()}),$("#sUserhelp").keyup(function(){items[e].userhelp=$(this).val(),reloadItems()}),$("#sUserhelpTooltip").click(function(){items[e].userhelpTooltip=$(this).is(":checked"),reloadItems()}),$("#sCsslayout").keyup(function(){items[e].csslayout=$(this).val(),reloadItems()}),$(".equalTo").each(function(){for(var e='<option value="" '+(""==$(this).attr("dvalue")?"selected":"")+"></option>",i=0;i<items.length;i++)"ftext"!=items[i].ftype&&"femail"!=items[i].ftype&&"fpassword"!=items[i].ftype||items[i].name==$(this).attr("dname")||(e+='<option value="'+items[i].name+'" '+(items[i].name==$(this).attr("dvalue")?"selected":"")+">"+items[i].title+"</option>");$(this).html(e)}),$(".dependencies").each(function(){for(var e='<option value="" '+(""==$(this).attr("dvalue")?"selected":"")+"></option>",i=0;i<items.length;i++)items[i].name!=$(this).attr("dname")&&(e+='<option value="'+items[i].name+'" '+(items[i].name==$(this).attr("dvalue")?"selected":"")+">"+items[i].title+"</option>");$(this).html(e)}),$(".dependencies").change(function(){items[e].choicesDep[$(this).attr("i")][$(this).attr("j")]=$(this).val(),reloadItems()}),$(".choice_removeDep").click(function(){1==items[e].choices.length?items[e].choicesDep[$(this).attr("i")][0]="":items[e].choicesDep[$(this).attr("i")].splice($(this).attr("j"),1),editItem(e),reloadItems()}),$(".choice_addDep").click(function(){items[e].choicesDep[$(this).attr("i")].splice(1*$(this).attr("j")+1,0,""),editItem(e),reloadItems()})},editForm=function(){$("#tabs-3").html(theForm.showAllSettings()),itemSelected=-1,$("#fTitle").keyup(function(){theForm.title=$(this).val(),reloadItems()}),$("#fDescription").keyup(function(){theForm.description=$(this).val(),reloadItems()}),$("#fLayout").change(function(){theForm.formlayout=$(this).val(),reloadItems()})},removeItem=function(e){items.splice(e,1);for(var i=0;i<items.length;i++)items[i].index=i;$("#tabs").tabs("option","active",0),reloadItems()},reloadItems=function(){for(var e=0;e<showSettings.formlayoutList.length;e++)$("#fieldlist"+opt.identifier).removeClass(showSettings.formlayoutList[e].id);$("#fieldlist"+opt.identifier).addClass(theForm.formlayout),$("#formheader"+opt.identifier).html(theForm.display()),$("#fieldlist"+opt.identifier).html(""),-1==parseInt(itemSelected)?$(".fform").addClass("ui-selected"):$(".fform").removeClass("ui-selected");for(e=0;e<items.length;e++)items[e].index=e,$("#fieldlist"+opt.identifier).append(items[e].display()),e==itemSelected?$("#field"+opt.identifier+"-"+e).addClass("ui-selected"):$("#field"+opt.identifier+"-"+e).removeClass("ui-selected"),$(".fields").mouseover(function(){$(this).addClass("ui-over")}).mouseout(function(){$(this).removeClass("ui-over")}).click(function(){editItem($(this).attr("id").replace("field"+opt.identifier+"-","")),$(this).siblings().removeClass("ui-selected"),$(this).addClass("ui-selected")}),$(".field").focus(function(){$(this).blur()}),$("#field"+opt.identifier+"-"+e+" .remove").click(function(){removeItem($(this).parent().attr("id").replace("field"+opt.identifier+"-",""))});$("#fieldlist"+opt.identifier).html(),$("#saveForm").css("display","none"),$(".fform").mouseover(function(){$(this).addClass("ui-over")}).mouseout(function(){$(this).removeClass("ui-over")}).click(function(){$("#tabs").tabs("option","active",2),editForm(),$(this).siblings().removeClass("ui-selected"),$(this).addClass("ui-selected")}),ffunct.saveData("form_structure");var i="";for(e=0;e<items.length;e++)"femail"==items[e].ftype&&(i+='<option value="'+items[e].name+'" '+(items[e].name==$("#cu_user_email_field").attr("def")?"selected":"")+">"+items[e].title+"</option>");if($("#cu_user_email_field").html(i),$("#request_cost").length>0&&$("#request_cost").is("select")){for(i="",e=0;e<items.length;e++)i+='<option value="'+items[e].name+'" '+(items[e].name==$("#request_cost").attr("def")?"selected":"")+">"+items[e].name+"("+items[e].title+")</option>";$("#request_cost").html(i)}if($("#paypal_price_field").length>0){for(i='<option value="" '+(""==$("#paypal_price_field").attr("def")?"selected":"")+"> ---- No ---- </option>",e=0;e<items.length;e++)i+='<option value="'+items[e].name+'" '+(items[e].name==$("#paypal_price_field").attr("def")?"selected":"")+">"+items[e].title+"</option>";$("#paypal_price_field").html(i)}},reloadItemsPublic=function(){for(var e=0;e<showSettings.formlayoutList.length;e++)$("#fieldlist"+opt.identifier).removeClass(showSettings.formlayoutList[e].id);$("#fieldlist"+opt.identifier).html("").addClass(theForm.formlayout),$("#formheader"+opt.identifier).html(theForm.show());var i=0;$("#fieldlist"+opt.identifier).append('<div class="pb'+i+' pbreak" page="'+i+'"></div>');var t=new Array;for(e=0;e<items.length;e++){if(items[e].index=e,"fPageBreak"==items[e].ftype)i++,$("#fieldlist"+opt.identifier).append('<div class="pb'+i+' pbreak" page="'+i+'"></div>');else{if($("#fieldlist"+opt.identifier+" .pb"+i).append(items[e].show()),items[e].predefinedClick){var s=$("#fieldlist"+opt.identifier+" .pb"+i).find("#"+items[e].name).attr("class")+" predefinedClick";$("#fieldlist"+opt.identifier+" .pb"+i).find("#"+items[e].name).attr("class",s),$("#fieldlist"+opt.identifier+" .pb"+i).find("#"+items[e].name).attr("predefined",items[e].predefined)}if(items[e].userhelpTooltip){var a=$("#fieldlist"+opt.identifier+" .pb"+i).find("#"+items[e].name).parents(".fields");a.find(".uh").css("display","none"),""!=a.find(".uh").text()&&a.attr("uh",a.find(".uh").text())}}$(".fields").mouseover(function(){$(this).addClass("ui-over")}).mouseout(function(){$(this).removeClass("ui-over")}).click(function(){editItem($(this).attr("id").replace("field"+opt.identifier+"-","")),$(this).siblings().removeClass("ui-selected"),$(this).addClass("ui-selected")}),"fdate"==items[e].ftype&&(t[t.length]=items[e])}if(i>0?($("#fieldlist"+opt.identifier+" .pb"+i).addClass("pbEnd"),$("#fieldlist"+opt.identifier+" .pbreak").find(".field").addClass("ignore").addClass("ignorepb"),$("#fieldlist"+opt.identifier+" .pb0").find(".field").removeClass("ignore").removeClass("ignorepb"),$("#fieldlist"+opt.identifier+" .pbreak").each(function(e){var t=$(this).html(),s="";e==i&&($("#cpcaptchalayer"+opt.identifier).html()&&(t+='<div class="fields cpfieldcaptcha" id="fieldcaptcha'+opt.identifier+'">'+$("#cpcaptchalayer"+opt.identifier).html()+"</div>",$("#cpcaptchalayer"+opt.identifier).html("")),$("#cp_subbtn"+opt.identifier).html()&&(s='<div class="pbSubmit">'+$("#cp_subbtn"+opt.identifier).html()+"</div>")),$(this).html("<fieldset><legend>"+opt.messages.page+" "+(e+1)+" "+opt.messages.of+" "+(i+1)+"</legend>"+t+'<div class="pbPrevious">'+opt.messages.previous+'</div><div class="pbNext">'+opt.messages.next+"</div>"+s+'<div class="clearer"></div></fieldset>')}),$(".pbPrevious,.pbNext").bind("click",function(){if($(this).parents("form").valid()){var e=parseInt($(this).parents(".pbreak").attr("page"));$(this).hasClass("pbPrevious")?e--:e++,$("#fieldlist"+opt.identifier+" .pbreak").css("display","none"),$("#fieldlist"+opt.identifier+" .pbreak").find(".field").addClass("ignore").addClass("ignorepb"),$("#fieldlist"+opt.identifier+" .pb"+e).css("display","block"),$("#fieldlist"+opt.identifier+" .pb"+e).find(".field").removeClass("ignore").removeClass("ignorepb"),showHideDep()}return!1})):($("#cpcaptchalayer"+opt.identifier).html()&&($("#fieldlist"+opt.identifier+" .pb"+i).append('<div class="fields cpfieldcaptcha" id="fieldcaptcha'+opt.identifier+'">'+$("#cpcaptchalayer"+opt.identifier).html()+"</div>"),$("#cpcaptchalayer"+opt.identifier).html("")),$("#cp_subbtn"+opt.identifier).html()&&$("#fieldlist"+opt.identifier+" .pb"+i).append('<div class="pbSubmit">'+$("#cp_subbtn"+opt.identifier).html()+"</div>")),$(".pbSubmit").bind("click",function(){$(this).parents("#fieldlist"+opt.identifier).parents("form").submit()}),$("#fieldlist"+opt.identifier+" .predefinedClick").bind("click",function(){$(this).attr("predefined")==$(this).val()&&$(this).val("")}),$("#fieldlist"+opt.identifier+" .predefinedClick").blur("click",function(){""==$(this).val()&&$(this).val($(this).attr("predefined"))}),e>0){for(var n=0;n<t.length;n++)t[n].showDropdown?$("#"+t[n].name).datepicker({changeMonth:!0,changeYear:!0,yearRange:t[n].dropdownRange,dateFormat:t[n].dformat.replace(/yyyy/g,"yy")}):$("#"+t[n].name).datepicker({dateFormat:t[n].dformat.replace(/yyyy/g,"yy")}),$("#"+t[n].name).datepicker("option","minDate",t[n].minDate),$("#"+t[n].name).datepicker("option","maxDate",t[n].maxDate),$("#"+t[n].name).datepicker("option","defaultDate",t[n].defaultDate);showHideDep(),$.validator.addMethod("dateddmmyyyy",function(e,i){return this.optional(i)||/^(?:[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])[\/\-](?:[1-9]|0[1-9]|1[0-2])[\/\-]\d{4}$/.test(e)}),$.validator.addMethod("datemmddyyyy",function(e,i){return this.optional(i)||/^(?:[1-9]|0[1-9]|1[0-2])[\/\-](?:[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])[\/\-]\d{4}$/.test(e)}),$(".depItemSel,.depItem").bind("change",function(){showHideDep()});try{$("#fbuilder"+opt.identifier).tooltip({show:!1,hide:!1,tooltipClass:"uh-tooltip",position:{my:"left top",at:"left bottom",collision:"none"},items:"[uh]",content:function(){return $(this).attr("uh")}})}catch(e){}}for(e=0;e<items.length;e++)items[e].after_show()};var showSettings={sizeList:new Array({id:"small",name:"Small"},{id:"medium",name:"Medium"},{id:"large",name:"Large"}),layoutList:new Array({id:"one_column",name:"One Column"},{id:"two_column",name:"Two Column"},{id:"three_column",name:"Three Column"},{id:"side_by_side",name:"Side by Side"}),formlayoutList:new Array({id:"top_aligned",name:"Top Aligned"},{id:"left_aligned",name:"Left Aligned"},{id:"right_aligned",name:"Right Aligned"}),showTitle:function(e,i){var t='<label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+i+"</textarea>";return"Page Break"==i&&(t=""),"<label>Field Type: "+getNameByIdFromType(e)+"</label><br /><br />"+t},showName:function(e,i){return'<div><label>Short label (optional) [<a class="helpfbuilder" text="The short label is used at title for the column when exporting the form data to CSV files.\n\nIf the short label is empty then, the field label will be used for the CSV file.">help?</a>] :</label><input class="large" name="sShortlabel" id="sShortlabel" value="'+i+'" /></div><div><label>Field tag for the message (optional):</label><input readonly="readonly" class="large" name="sNametag" id="sNametag" value="&lt;%'+e+'%&gt;" /><input style="display:none" readonly="readonly" class="large" name="sName" id="sName" value="'+e+'" /></div>'},showPredefined:function(e,i){return'<div><label>Predefined Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+e+'</textarea><br /><input type="checkbox" name="sPredefinedClick" id="sPredefinedClick" '+(i?"checked":"")+' value="1" > Hide predefined value on click.</div>'},showEqualTo:function(e,i){return'<div><label>Equal to [<a class="helpfbuilder" text="Use this field to create password confirmation field or email confirmation fields.\n\nSpecify this setting ONLY into the confirmation field, not in the original field.">help?</a>]</label><br /><select class="equalTo" name="sEqualTo" id="sEqualTo" dvalue="'+e+'" dname="'+i+'"></select></div>'},showRequired:function(e){return'<div><input type="checkbox" name="sRequired" id="sRequired" '+(e?"checked":"")+"><label>Required</label></div>"},showSize:function(e){for(var i="",t=0;t<this.sizeList.length;t++)i+='<option value="'+this.sizeList[t].id+'" '+(this.sizeList[t].id==e?"selected":"")+">"+this.sizeList[t].name+"</option>";return'<label>Field Size</label><br /><select name="sSize" id="sSize">'+i+"</select>"},showLayout:function(e){for(var i="",t=0;t<this.layoutList.length;t++)i+='<option value="'+this.layoutList[t].id+'" '+(this.layoutList[t].id==e?"selected":"")+">"+this.layoutList[t].name+"</option>";return'<label>Field Layout</label><br /><select name="sLayout" id="sLayout">'+i+"</select>"},showUserhelp:function(e,i){return'<div><label>Instructions for User</label><textarea class="large" name="sUserhelp" id="sUserhelp">'+e+'</textarea><br /><input type="checkbox" name="sUserhelpTooltip" id="sUserhelpTooltip" '+(i?"checked":"")+' value="1" > Show as floating tooltip.</div>'},showCsslayout:function(e){return'<label>Additional CSS Class</label><input class="large" name="sCsslayout" id="sCsslayout" value="'+e+'" />'}},fform=function(){};$.extend(fform.prototype,{title:"Untitled Form",description:"This is my form. Please fill it out. It's awesome!",formlayout:"top_aligned",display:function(){return'<div class="fform" id="field">'+(""!=this.title?"<h1>"+this.title+"</h1>":"")+(""!=this.description?"<span>"+this.description+"</span>":"")+"</div>"},show:function(){var e="";return""!=this.title&&(e+="<h1>"+this.title+"</h1>"),""!=this.description&&(e+="<span>"+this.description+"</span>"),'<div class="fform" id="field">'+e+"</div>"},showAllSettings:function(){for(var e="",i=0;i<showSettings.formlayoutList.length;i++)e+='<option value="'+showSettings.formlayoutList[i].id+'" '+(showSettings.formlayoutList[i].id==this.formlayout?"selected":"")+">"+showSettings.formlayoutList[i].name+"</option>";return'<div><label>Form Name</label><input class="large" name="fTitle" id="fTitle" value="'+htmlEncode(this.title)+'" /></div><div><label>Description</label><textarea class="large" name="fDescription" id="fDescription">'+this.description+'</textarea></div><div><label>Label Placement</label><br /><select name="fLayout" id="fLayout">'+e+"</select></div>"}});var theForm=new fform,ffields=function(){};$.extend(ffields.prototype,{name:"",shortlabel:"",index:-1,ftype:"",userhelp:"",userhelpTooltip:!1,csslayout:"",init:function(){},after_show:function(){},showSpecialData:function(){return void 0!==this.showSpecialDataInstance?this.showSpecialDataInstance():""},showEqualTo:function(){return void 0!==this.equalTo?showSettings.showEqualTo(this.equalTo,this.name):""},showPredefined:function(){return void 0!==this.predefined?showSettings.showPredefined(this.predefined,this.predefinedClick):""},showRequired:function(){return void 0!==this.required?showSettings.showRequired(this.required):""},showSize:function(){return void 0!==this.size?showSettings.showSize(this.size):""},showLayout:function(){return void 0!==this.layout?showSettings.showLayout(this.layout):""},showRange:function(){return void 0!==this.min?this.showRangeIntance():""},showFormat:function(){if(void 0===this.dformat)return"";try{return this.showFormatIntance()}catch(e){return""}},showChoice:function(){return void 0!==this.choices?this.showChoiceIntance():""},showUserhelp:function(){return"fPageBreak"!=this.ftype?showSettings.showUserhelp(this.userhelp,this.userhelpTooltip):""},showCsslayout:function(){return"fPageBreak"!=this.ftype?showSettings.showCsslayout(this.csslayout):""},showAllSettings:function(){return this.showTitle()+this.showName()+this.showSize()+this.showLayout()+this.showFormat()+this.showRange()+this.showRequired()+this.showSpecialData()+this.showEqualTo()+this.showPredefined()+this.showChoice()+this.showUserhelp()+this.showCsslayout()},showTitle:function(){return showSettings.showTitle(this.ftype,this.title)},showName:function(){return"fPageBreak"!=this.ftype?showSettings.showName(this.name,this.shortlabel):""},display:function(){return"Not available yet"},show:function(){return"Not available yet"},toJSON:function(){return str="",$.each(this,function(e,i){"function"!=typeof i&&(""!=str&&(str+=","),str+='"'+e+'":'+i)}),str}});var ftext=function(){};$.extend(ftext.prototype,ffields.prototype,{title:"Untitled",ftype:"ftext",predefined:"",predefinedClick:!1,required:!1,size:"medium",minlength:"",maxlength:"",equalTo:"",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'"><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+this.minlength+'" maxlength="'+htmlEncode(this.maxlength)+'" '+(""!=this.equalTo?'equalTo="#'+htmlEncode(this.equalTo+opt.identifier)+'"':"")+' class="field '+this.size+(this.required?" required":"")+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},showSpecialDataInstance:function(){return'<div class="column"><label>Min length/characters</label><br /><input name="sMinlength" id="sMinlength" value="'+this.minlength+'"></div><div class="column"><label>Max length/characters</label><br /><input name="sMaxlength" id="sMaxlength" value="'+this.maxlength+'"></div><div class="clearer"></div>'}});var facceptance=function(){};$.extend(facceptance.prototype,ffields.prototype,{title:"Accept terms and conditions",ftype:"facceptance",value:"I accept",required:!0,url:"",message:"",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><div class="dfield"><input class="field" disabled="true" type="checkbox"/> '+this.title+(this.required?"*":"")+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},show:function(){var e=this,i="",t=e.title;return/^\s*$/.test(e.url)?/^\s*$/.test(e.message)||(t='<a href="javascript:void(0);" class="cff-open-dlg">'+t+"</a>",i+='<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+e.message+"</div></div>"):t='<a href="'+htmlEncode($.trim(e.url))+'" target="_blank">'+t+"</a>",'<div class="fields '+e.csslayout+' cff-checkbox-field" id="field'+e.identifier+"-"+e.index+'"><div class="dfield"><div class="one_column"><label><input name="'+e.name+'" id="'+e.name+'" class="field '+(this.required?" required":"")+'" value="'+htmlEncode(e.value)+'" vt="'+htmlEncode(/^\s*$/.test(e.value)?e.title:e.value)+'" type="checkbox" /> <span>'+htmlDecode(t)+(e.required?'<span class="r">*</span>':"")+"</span></label></div>"+i+'</div><div class="clearer"></div></div>'},after_show:function(){$(document).on("click",".cff-open-dlg",function(){var e=$(this).closest(".fields").find(".cff-dialog"),i=e.data("width"),t=e.data("height");e.removeClass("hide"),void 0===i&&(i=Math.min($(this).closest("form").width(),$(window).width(),e.width())),void 0===t&&(t=Math.min($(this).closest("form").height(),$(window).height(),e.height())),e.data("width",i),e.data("height",t),e.css({width:i+"px",height:t+"px","margin-top":-1*t/2+"px","margin-left":-1*i/2+"px"})}),$(document).on("click",".cff-close-dlg",function(){$(this).closest(".cff-dialog").addClass("hide")})},showSpecialDataInstance:function(){return'<div><label>Value</label><input class="large" type="text" name="sValue" id="sValue" value="'+htmlEncode(this.value)+'"></div><div><label>URL to the Consent and Acknowledgement page</label><input class="large" type="text" name="sURL" id="sURL" value="'+htmlEncode(this.url)+'"></div><div><label>- or - enter the Consent and Acknowledgement text</label><textarea class="large" name="sMessage" id="sMessage" style="height:150px;">'+this.message+"</textarea></div>"}});var fpassword=function(){};$.extend(fpassword.prototype,ffields.prototype,{title:"Untitled",ftype:"fpassword",predefined:"",predefinedClick:!1,required:!1,size:"medium",minlength:"",maxlength:"",equalTo:"",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},showSpecialDataInstance:function(){return"Not available in free version"}});var femail=function(){};$.extend(femail.prototype,ffields.prototype,{title:"Email",ftype:"femail",predefined:"",predefinedClick:!1,required:!1,size:"medium",equalTo:"",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="email" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'"><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+(""!=this.equalTo?'equalTo="#'+htmlEncode(this.equalTo+opt.identifier)+'"':"")+' class="field email '+this.size+(this.required?" required":"")+'" type="email" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},showSpecialDataInstance:function(){return""}});var fnumber=function(){};$.extend(fnumber.prototype,ffields.prototype,{title:"Number",ftype:"fnumber",predefined:"",predefinedClick:!1,required:!1,size:"small",min:"",max:"",dformat:"digits",formats:new Array("digits","number"),display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},showFormatIntance:function(){return"<div>Not available in free version</div>"},showRangeIntance:function(){return"Not available in free version"}});var fdate=function(){};$.extend(fdate.prototype,ffields.prototype,{title:"Date",ftype:"fdate",predefined:"",predefinedClick:!1,size:"medium",required:!1,dformat:"mm/dd/yyyy",showDropdown:!1,dropdownRange:"-10:+10",minDate:"",maxDate:"",defaultDate:"",formats:new Array("mm/dd/yyyy","dd/mm/yyyy"),display:function(){return""},show:function(){return""},showFormatIntance:function(){return"<div>Not available in free version</div>"},showSpecialDataInstance:function(){return"Not available in free version"}});var ftextarea=function(){};$.extend(ftextarea.prototype,ffields.prototype,{title:"Untitled",ftype:"ftextarea",predefined:"",predefinedClick:!1,required:!1,size:"medium",minlength:"",maxlength:"",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield"><textarea class="field disabled '+this.size+'">'+this.predefined+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'"><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield"><textarea id="'+this.name+'" name="'+this.name+'" minlength="'+this.minlength+'" maxlength="'+htmlEncode(this.maxlength)+'" class="field '+this.size+(this.required?" required":"")+'">'+this.predefined+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},showSpecialDataInstance:function(){return'<div class="column"><label>Min length/characters</label><br /><input name="sMinlength" id="sMinlength" value="'+this.minlength+'"></div><div class="column"><label>Max length/characters</label><br /><input name="sMaxlength" id="sMaxlength" value="'+this.maxlength+'"></div><div class="clearer"></div>'}});var ffile=function(){};$.extend(ffile.prototype,ffields.prototype,{title:"Untitled",ftype:"ffile",required:!1,size:"medium",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'}});var fSectionBreak=function(){};$.extend(fSectionBreak.prototype,ffields.prototype,{title:"Section Break",ftype:"fSectionBreak",userhelp:"A description of the section goes here.",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+' section_breaks" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'}});var fPageBreak=function(){};$.extend(fPageBreak.prototype,ffields.prototype,{title:"Page Break",ftype:"fPageBreak",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+' section_breaks" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'}});var fPhone=function(){};$.extend(fPhone.prototype,ffields.prototype,{title:"Phone",ftype:"fPhone",required:!1,dformat:"### ### ####",predefined:"888 888 8888",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},showFormatIntance:function(){return"<div>Not available in free version</div>"}});var fCommentArea=function(){};$.extend(fCommentArea.prototype,ffields.prototype,{title:"Comments here",ftype:"fCommentArea",userhelp:"A description of the section goes here.",display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+' comment_area" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'}});var fcheck=function(){};$.extend(fcheck.prototype,ffields.prototype,{title:"Check All That Apply",ftype:"fcheck",layout:"one_column",required:!1,showDep:!1,init:function(){},display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},showChoiceIntance:function(){return'<div class="choicesSet '+(this.showDep?"show":"hide")+'">Not available in free version<div class="clearer"></div></div>'+str+"</div>"}});var fradio=function(){};$.extend(fradio.prototype,ffields.prototype,{title:"Select a Choice",ftype:"fradio",layout:"one_column",required:!1,choiceSelected:null,showDep:!1,init:function(){},display:function(){return'<div class="fields" id="field'+opt.identifier+"-"+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},show:function(){this.choicesVal=void 0!==this.choicesVal&&null!==this.choicesVal?this.choicesVal:this.choices.slice(0);var e="";if(void 0===this.choicesDep||null===this.choicesDep){this.choicesDep=new Array;for(var i=0;i<this.choices.length;i++)this.choicesDep[i]=new Array}for(i=0;i<this.choices.length;i++){var t="",s="",a=this.choicesDep;if(a[i].length>0){t=" depItem";for(var n=0;n<a[i].length;n++)s+=","+a[i][n]}e+='<div class="'+this.layout+'"><input name="'+this.name+'" id="'+this.name+'" '+(""!=t?'dep="'+s+'"':"")+' class="field depItem group '+(this.required?" required":"")+'" value="'+htmlEncode(this.choicesVal[i])+'" type="radio" i="'+i+'" '+(this.choicesVal[i]==this.choiceSelected?"checked":"")+"/> <span>"+this.choices[i]+"</span></div>"}return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'"><label>'+this.title+(this.required?"*":"")+'</label><div class="dfield">'+e+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>'},showChoiceIntance:function(){this.choicesVal=void 0!==this.choicesVal&&null!==this.choicesVal?this.choicesVal:this.choices.slice(0);var e=this.choices,i=this.choicesVal;this.choiceSelected;if(void 0===this.choicesDep||null===this.choicesDep){this.choicesDep=new Array;for(var t=0;t<e.length;t++)this.choicesDep[t]=new Array}var s=this.choicesDep,a="";for(t=0;t<e.length;t++){a+='<div class="choicesEdit"><input class="choice_radio" i="'+t+'" type="radio" '+(this.choiceSelected==i[t]?"checked":"")+' name="choice_radio" /><input class="choice_text" i="'+t+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'+htmlEncode(e[t])+'"/><input class="choice_value" i="'+t+'" type="text" name="sChoice'+this.name+"V"+t+'" id="sChoice'+this.name+"V"+t+'" value="'+htmlEncode(i[t])+'"/><a class="choice_add ui-icon ui-icon-circle-plus" i="'+t+'" title="Add another choice."></a><a class="choice_remove ui-icon ui-icon-circle-minus" i="'+t+'" title="Delete this choice."></a></div>';for(var n=0;n<s[t].length;n++)a+='<div class="choicesEditDep">If selected show: <select class="dependencies" i="'+t+'" j="'+n+'" dname="'+this.name+'" dvalue="'+s[t][n]+'" ></select><a class="choice_addDep ui-icon ui-icon-circle-plus" i="'+t+'" j="'+n+'" title="Add another dependency."></a><a class="choice_removeDep ui-icon ui-icon-circle-minus" i="'+t+'" j="'+n+'" title="Delete this dependency."></a></div>';0==s[t].length&&(a+='<div class="choicesEditDep">If selected show: <select class="dependencies" i="'+t+'" j="'+s[t].length+'" dname="'+this.name+'" dvalue="" ></select><a class="choice_addDep ui-icon ui-icon-circle-plus" i="'+t+'" j="'+s[t].length+'" title="Add another dependency."></a><a class="choice_removeDep ui-icon ui-icon-circle-minus" i="'+t+'" j="'+s[t].length+'" title="Delete this dependency."></a></div>')}return'<div class="choicesSet '+(this.showDep?"show":"hide")+'"><label>Choices</label> <a class="helpfbuilder dep" text="Dependencies are used to show/hide other fields depending of the option selected in this field.">help?</a> <a href="" class="showHideDependencies">'+(this.showDep?"Hide":"Show")+' Dependencies</a><div><div class="t">Text</div><div class="t">Value</div><div class="clearer"></div></div>'+a+"</div>"}});var fdropdown=function(){};$.extend(fdropdown.prototype,ffields.prototype,{title:"Select a Choice",ftype:"fdropdown",size:"medium",required:!1,choiceSelected:"",showDep:!1,init:function(){},display:function(){return this.choicesVal=void 0!==this.choicesVal&&null!==this.choicesVal?this.choicesVal:this.choices.slice(0),'<div class="fields" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},show:function(){return'<div class="fields '+this.csslayout+'" id="field'+opt.identifier+"-"+this.index+'">Not available in free version<div class="clearer"></div></div>'},showChoiceIntance:function(){return'<div class="choicesSet '+(this.showDep?"show":"hide")+'">Not available in free version<div class="clearer"></div></div>'+str+"</div>"}}),opt.pub||$("#fieldlist"+opt.identifier).sortable({start:function(e,i){var t=i.item.index();i.item.data("start_pos",t)},stop:function(e,i){var t=parseInt(i.item.index()),s=parseInt(i.item.data("start_pos")),a=items[s];if(t>s)for(var n=s;n<t;n++)items[n]=items[n+1];else for(n=s;n>t;n--)items[n]=items[n-1];items[t]=a,reloadItems()}}),opt.pub||$("#tabs").tabs({activate:function(e,i){1!=$(this).tabs("option","active")?($(".fields").removeClass("ui-selected"),itemSelected=-2,2==$(this).tabs("option","active")?($(".fform").addClass("ui-selected"),editForm()):$(".fform").removeClass("ui-selected")):($(".fform").removeClass("ui-selected"),itemSelected<0&&$("#tabs-2").html("<b>No Field Selected</b><br />Please click on a field in the form preview on the right to change its properties."))}}),loadtmp=function(p){if((d=$.parseJSON(p))&&2==d.length){items=new Array;for(var i=0;i<d[0].length;i++){var obj=eval("new "+d[0][i].ftype+"();");obj=$.extend(obj,d[0][i]),obj.name=obj.name+opt.identifier,items[items.length]=obj}theForm=new fform,theForm=$.extend(theForm,d[1][0]),opt.pub?reloadItemsPublic():reloadItems()}};var ffunct={getItems:function(){return items},addItem:function(id){var obj=eval("new "+id+"();");obj.init();for(var n=0,i=0;i<items.length;i++)n1=parseInt(items[i].name.replace(/fieldname/g,"")),n1>n&&(n=n1);$.extend(obj,{name:"fieldname"+(n+1)}),items[items.length]=obj,reloadItems()},saveData:function(e){""!=e?$("#"+e).val("["+$.stringifyXX(items,!1)+",["+$.stringifyXX(theForm,!1)+"]]"):$.ajax({type:"POST",url:"process.php?act=save",data:"items="+$.stringifyXX(items,!0)+"&theForm="+$.stringifyXX(theForm,!0),dataType:"json",success:function(e){alert("The form has been saved!!!")}})},loadData:function(e){""!=e?loadtmp($("#"+e).val()):$.ajax({async:!1,url:"process.php?act=load",success:function(e){loadtmp(e.toString())}})},removeItem:removeItem,editItem:editItem};return this.fBuild=ffunct,this};for(var fcount=1,fnum="_"+fcount;10>fcount||eval("typeof cp_contactformtoemail_fbuilder_config"+fnum+" != 'undefined'");){try{var cp_contactformtoemail_fbuilder_config=eval("cp_contactformtoemail_fbuilder_config"+fnum),f=$("#fbuilder"+fnum).CFTEfbuilder($.parseJSON(cp_contactformtoemail_fbuilder_config.obj));f.fBuild.loadData("form_structure"+fnum),$("#cp_contactformtoemail_pform"+fnum).validate({ignore:".ignore",errorElement:"div",errorPlacement:function(e,i){i.hasClass("group")&&(i=i.parent()),e.insertBefore(i),e.addClass("message"),e.css("position","absolute"),e.css("left",0),e.css("top",i.parent().outerHeight(!0))}}),$(document).trigger("showHideDepEvent",fnum)}catch(e){}fcount++,fnum="_"+fcount}}(jQuery)});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/fbuilderf.jquery.original.js ADDED
@@ -0,0 +1,1326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function(){
2
+ (function($) {
3
+ $.extend({
4
+
5
+ stringifyXX : function stringifyXX(obj) {
6
+ encodeParam = function(param,urlp) {
7
+ if (urlp)
8
+ {
9
+ param = param.replace(/&/g, "%26");
10
+ return encodeURI(param);
11
+ }
12
+ else
13
+ return param;
14
+ }
15
+ enc = function(param) {
16
+ param = param.replace(/\\/g, "\\\\");
17
+ param = param.replace(/\"/g, "\\\"");
18
+
19
+ return param;
20
+ }
21
+ var t = typeof (obj);
22
+ if (t != "object" || obj === null) {
23
+ // simple data type
24
+ if (t == "string") obj = '"' + obj + '"';
25
+ return encodeParam(String(obj));
26
+ } else {
27
+ // recurse array or object
28
+ var n, v, json = [], arr = (obj && obj.constructor == Array);
29
+
30
+ for (n in obj) {
31
+ //alert(n+"-----------"+obj[n]);
32
+ v = obj[n];
33
+ t = typeof(v);
34
+ if (t!="function")
35
+ //if (obj.hasOwnProperty(n))
36
+ {
37
+ if (t == "string") v = '"' + enc(v) + '"'; else if (t == "object" && v !== null) v = $.stringifyXX(v);
38
+ json.push((arr ? "" : '"' + n + '":') + String(v));
39
+ }
40
+ }
41
+ return encodeParam(arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
42
+ }
43
+ }
44
+ });
45
+ })(jQuery);
46
+ });
47
+
48
+ /** jQuery.holdReady( true ); */
49
+ jQuery(window).on('load', function(){
50
+ (function($) {
51
+ $.fn.CFTEfbuilder = function(options){
52
+ var opt = $.extend({},
53
+ {
54
+ typeList:new Array({id:"ftext",name:"Single Line"},{id:"fnumber",name:"Number"},{id:"femail",name:"Email"},{id:"fdate",name:"Date Time"},{id:"ftextarea",name:"Text Area"},{id:"fcurrency",name:"Currency"},{id:"fcheck",name:"Checkboxes"},{id:"fradio",name:"Radio Buttons"},{id:"fdropdown",name:"Dropdown"},{id:"ffile",name:"Upload File"},{id:"fpassword",name:"Password"},{id:"fPhone",name:"Phone field"},{id:"fCommentArea",name:"Instruct. Text"},{id:"fhidden",name:"Hidden"},{id:"fSectionBreak",name:"Section break"},{id:"fPageBreak",name:"Page break"},{id:"fsummary",name:"Summary"},{id:"fMedia",name:"Media"},{id:"fButton",name:"Button"},{id:"fhtml",name:"HTML content"},{id:"facceptance",name:"Accept / GDPR"},{id:"category",name:"Container Controls"},{id:"ffieldset",name:"Fieldset"},{id:"fdiv",name:"Div"},{id:"category",name:"Form Controls with Datasource Connection"},{id:"ftextds",name:"Line Text DS"},{id:"femailds",name:"Email DS"},{id:"ftextareads",name:"Text Area DS"},{id:"fcheckds",name:"Checkboxes DS"},{id:"fradiods",name:"Radio Btns DS"},{id:"fPhoneds",name:"Phone DS"},{id:"fdropdownds",name:"Dropdown DS"},{id:"fhiddends",name:"Hidden DS"},{id:"fnumberds",name:"Number DS"},{id:"fcurrencyds",name:"Currency DS"}),
55
+ pub:false,
56
+ identifier:"",
57
+ title:""
58
+ },options, true);
59
+ if (opt.pub)
60
+ {
61
+ opt.messages = $.extend({
62
+ previous: "Previous",
63
+ next: "Next",
64
+ page: "Page",
65
+ of: "of",
66
+ required: "This field is required.",
67
+ email: "Please enter a valid email address.",
68
+ datemmddyyyy: "Please enter a valid date with this format(mm/dd/yyyy)",
69
+ dateddmmyyyy: "Please enter a valid date with this format(dd/mm/yyyy)",
70
+ number: "Please enter a valid number.",
71
+ digits: "Please enter only digits.",
72
+ maxlength: $.validator.format("Please enter no more than {0} characters"),
73
+ minlength: $.validator.format("Please enter at least {0} characters."),
74
+ equalTo: "Please enter the same value again.",
75
+ max: $.validator.format("Please enter a value less than or equal to {0}."),
76
+ min: $.validator.format("Please enter a value greater than or equal to {0}.")
77
+ },opt.messages);
78
+ opt.messages.max = $.validator.format(opt.messages.max);
79
+ opt.messages.min = $.validator.format(opt.messages.min);
80
+ $.extend($.validator.messages, opt.messages);
81
+ }
82
+ getNameByIdFromType = function(id){
83
+ for (var i=0;i<opt.typeList.length;i++)
84
+ if (opt.typeList[i].id == id)
85
+ return opt.typeList[i].name;
86
+ return "";
87
+ }
88
+ if (!opt.pub)
89
+ {
90
+ for (var i=0;i<opt.typeList.length;i++)
91
+ {
92
+ if (opt.typeList[i].id=="category")
93
+ $("#tabs-1").append('<div style="clear:both;"></div><br /><div class="category-description">'+opt.typeList[i].name+'</div><hr />');
94
+ else
95
+ $("#tabs-1").append('<div class="button width40 '+(((i>5 && i!=20) || (i%2==1))?"n":"itemForm")+'" id="'+opt.typeList[i].id+'">'+opt.typeList[i].name+'</div>');
96
+ }
97
+ $("#tabs-1").append('<div class="clearer"></div>');
98
+ }
99
+ if (!opt.pub) $( ".button").button();
100
+ var items = new Array();
101
+ var itemSelected = -2;
102
+ editItem = function(id) {
103
+ if (!opt.pub) $('#tabs').tabs("option", "active", 1);
104
+ try { $('#tabs-2').html(items[id].showAllSettings()); } catch (e) {}
105
+ itemSelected = id;
106
+ $(".helpfbuilder").click(function(){
107
+ alert($(this).attr("text"));
108
+ });
109
+ $("#sValue").bind("keyup",function(){
110
+ items[id].value = $(this).val();
111
+ reloadItems();
112
+ });
113
+ $("#sURL").bind("keyup",function(){
114
+ items[id].url = $(this).val();
115
+ reloadItems();
116
+ });
117
+ $("#sMessage").bind("keyup",function(){
118
+ items[id].message = $(this).val();
119
+ reloadItems();
120
+ });
121
+ $("#sMinDate").change(function(){
122
+ items[id].minDate = $(this).val();
123
+ reloadItems();
124
+ });
125
+ $("#sMaxDate").change(function(){
126
+ items[id].maxDate = $(this).val();
127
+ reloadItems();
128
+ });
129
+ $("#sDefaultDate").change(function(){
130
+ items[id].defaultDate = $(this).val();
131
+ reloadItems();
132
+ });
133
+ $("#sTitle").keyup(function(){
134
+ var str = $(this).val();
135
+ items[id].title = str.replace(/\n/g,"<br />");
136
+ reloadItems();
137
+ });
138
+ $("#sName").keyup(function(){
139
+ items[id].name = $(this).val();
140
+ reloadItems();
141
+ });
142
+ $("#sShortlabel").keyup(function(){
143
+ items[id].shortlabel = $(this).val();
144
+ reloadItems();
145
+ });
146
+ $("#sPredefined").keyup(function(){
147
+ items[id].predefined = $(this).val();
148
+ reloadItems();
149
+ });
150
+ $("#sPredefinedClick").click(function(){
151
+ items[id].predefinedClick = $(this).is(':checked');
152
+ reloadItems();
153
+ });
154
+ $("#sEq").keyup(function(){
155
+ items[id].eq = $(this).val();
156
+ reloadItems();
157
+ });
158
+ $("#sSuffix").keyup(function(){
159
+ items[id].suffix = $(this).val();
160
+ reloadItems();
161
+ });
162
+ $("#sPrefix").keyup(function(){
163
+ items[id].prefix = $(this).val();
164
+ reloadItems();
165
+ });
166
+ $("#sDecimalSymbol").keyup(function(){
167
+ items[id].decimalsymbol = $(this).val();
168
+ reloadItems();
169
+ });
170
+ $("#sGroupingSymbol").keyup(function(){
171
+ items[id].groupingsymbol = $(this).val();
172
+ reloadItems();
173
+ });
174
+ $("#sDropdownRange").keyup(function(){
175
+ items[id].dropdownRange = $(this).val();
176
+ reloadItems();
177
+ });
178
+ $("#sRequired").click(function(){
179
+ items[id].required = $(this).is(':checked');
180
+ reloadItems();
181
+ });
182
+ $("#sReadOnly").click(function(){
183
+ items[id].readonly = $(this).is(':checked');
184
+ reloadItems();
185
+ });
186
+ $("#sShowDropdown").click(function(){
187
+ items[id].showDropdown = $(this).is(':checked');
188
+ if ($(this).is(':checked'))
189
+ $("#divdropdownRange").css("display","");
190
+ else
191
+ $("#divdropdownRange").css("display","none");
192
+ reloadItems();
193
+ });
194
+ $("#sSize").change(function(){
195
+ items[id].size = $(this).val();
196
+ reloadItems();
197
+ });
198
+ $("#sFormat").change(function(){
199
+ items[id].dformat = $(this).val();
200
+ reloadItems();
201
+ });
202
+ $("#sLayout").change(function(){
203
+ items[id].layout = $(this).val();
204
+ reloadItems();
205
+ });
206
+ $("#sMin").change(function(){
207
+ items[id].min = $(this).val();
208
+ reloadItems();
209
+ });
210
+ $("#sMax").change(function(){
211
+ items[id].max = $(this).val();
212
+ reloadItems();
213
+ });
214
+ $("#sMinlength").change(function(){
215
+ items[id].minlength = $(this).val();
216
+ reloadItems();
217
+ });
218
+ $("#sMaxlength").change(function(){
219
+ items[id].maxlength = $(this).val();
220
+ reloadItems();
221
+ });
222
+ $("#sEqualTo").change(function(){
223
+ items[id].equalTo = $(this).val();
224
+ reloadItems();
225
+ });
226
+ $(".showHideDependencies").click(function(){
227
+ if (items[id].showDep)
228
+ {
229
+ $(this).parent().removeClass("show");
230
+ $(this).parent().addClass("hide");
231
+ $(this).html("Show Dependencies");
232
+ items[id].showDep = false;
233
+ }
234
+ else
235
+ {
236
+ $(this).parent().addClass("show");
237
+ $(this).parent().removeClass("hide");
238
+ $(this).html("Hide Dependencies");
239
+ items[id].showDep = true;
240
+ }
241
+ return false;
242
+ });
243
+ $(".choice_remove").click(function(){
244
+ if (items[id].choices.length==1)
245
+ {
246
+ items[id].choices[0]="";
247
+ items[id].choicesVal[0]="";
248
+ items[id].choicesDep[0]=new Array();
249
+ }
250
+ else
251
+ {
252
+ items[id].choices.splice($(this).attr("i"),1);
253
+ items[id].choicesVal.splice($(this).attr("i"),1);
254
+ items[id].choicesDep.splice($(this).attr("i"),1);
255
+ }
256
+ if (items[id].ftype=="fcheck")
257
+ {
258
+ if (items[id].choiceSelected.length==1)
259
+ items[id].choiceSelected[0]="";
260
+ else
261
+ items[id].choiceSelected.splice($(this).attr("i"),1);
262
+ }
263
+ editItem(id);
264
+ reloadItems();
265
+ });
266
+ $(".choice_add").click(function(){
267
+ items[id].choices.splice($(this).attr("i")*1+1,0,"");
268
+ items[id].choicesVal.splice($(this).attr("i")*1+1,0,"");
269
+ items[id].choicesDep.splice($(this).attr("i")*1+1,0,new Array());
270
+ if (items[id].ftype=="fcheck")
271
+ items[id].choiceSelected.splice($(this).attr("i")*1+1,0,false);
272
+ editItem(id);
273
+ reloadItems();
274
+ });
275
+ $(".choice_text").keyup(function(){
276
+ if (items[id].choices[$(this).attr("i")] == items[id].choicesVal[$(this).attr("i")])
277
+ {
278
+ $("#"+$(this).attr("id")+"V"+$(this).attr("i")).val($(this).val());
279
+ items[id].choicesVal[$(this).attr("i")]= $(this).val();
280
+ }
281
+ items[id].choices[$(this).attr("i")]= $(this).val();
282
+ reloadItems();
283
+ });
284
+ $(".choice_value").keyup(function(){
285
+ items[id].choicesVal[$(this).attr("i")]= $(this).val();
286
+ reloadItems();
287
+ });
288
+ $(".choice_radio").click(function(){
289
+ if ($(this).is(':checked'))
290
+ items[id].choiceSelected = items[id].choicesVal[$(this).attr("i")];
291
+ reloadItems();
292
+ });
293
+ $(".choice_select").click(function(){
294
+ if ($(this).is(':checked'))
295
+ items[id].choiceSelected = items[id].choicesVal[$(this).attr("i")];
296
+ reloadItems();
297
+ });
298
+ $(".choice_check").click(function(){
299
+ if ($(this).is(':checked'))
300
+ items[id].choiceSelected[$(this).attr("i")] = true;
301
+ else
302
+ items[id].choiceSelected[$(this).attr("i")] = false;
303
+ reloadItems();
304
+ });
305
+ $("#sUserhelp").keyup(function(){
306
+ items[id].userhelp = $(this).val();
307
+ reloadItems();
308
+ });
309
+ $("#sUserhelpTooltip").click(function(){
310
+ items[id].userhelpTooltip = $(this).is(':checked');
311
+ reloadItems();
312
+ });
313
+ $("#sCsslayout").keyup(function(){
314
+ items[id].csslayout = $(this).val();
315
+ reloadItems();
316
+ });
317
+ $('.equalTo').each(function(){
318
+ var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
319
+ for (var i=0;i<items.length;i++)
320
+ if ((items[i].ftype=="ftext" || items[i].ftype=="femail" || items[i].ftype=="fpassword") && (items[i].name != $(this).attr("dname")))
321
+ str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].title)+'</option>';
322
+ $(this).html(str);
323
+ });
324
+ $('.dependencies').each(function(){
325
+ var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
326
+ for (var i=0;i<items.length;i++)
327
+ if (items[i].name != $(this).attr("dname"))
328
+ str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].title)+'</option>';
329
+ $(this).html(str);
330
+ });
331
+ $('.dependencies').change(function(){
332
+ items[id].choicesDep[$(this).attr("i")][$(this).attr("j")] = $(this).val();
333
+ reloadItems();
334
+ });
335
+ $(".choice_removeDep").click(function(){
336
+ if (items[id].choices.length==1)
337
+ items[id].choicesDep[$(this).attr("i")][0]="";
338
+ else
339
+ items[id].choicesDep[$(this).attr("i")].splice($(this).attr("j"),1);
340
+ editItem(id);
341
+ reloadItems();
342
+ });
343
+ $(".choice_addDep").click(function(){
344
+ items[id].choicesDep[$(this).attr("i")].splice($(this).attr("j")*1+1,0,"");
345
+ editItem(id);
346
+ reloadItems();
347
+ });
348
+ };
349
+ editForm = function() {
350
+ $('#tabs-3').html(theForm.showAllSettings());
351
+ itemSelected = -1;
352
+ $("#fTitle").keyup(function(){
353
+ theForm.title = $(this).val();
354
+ reloadItems();
355
+ });
356
+ $("#fDescription").keyup(function(){
357
+ theForm.description = $(this).val();
358
+ reloadItems();
359
+ });
360
+ $("#fLayout").change(function(){
361
+ theForm.formlayout = $(this).val();
362
+ reloadItems();
363
+ });
364
+
365
+ };
366
+ removeItem = function(index) {
367
+ items.splice(index,1);
368
+ for (var i=0;i<items.length;i++)
369
+ items[i].index = i;
370
+ $('#tabs').tabs("option", "active", 0);
371
+ reloadItems();
372
+ }
373
+ reloadItems = function() {
374
+ for (var i=0;i<showSettings.formlayoutList.length;i++)
375
+ $("#fieldlist"+opt.identifier).removeClass(showSettings.formlayoutList[i].id);
376
+ $("#fieldlist"+opt.identifier).addClass(theForm.formlayout);
377
+ $("#formheader"+opt.identifier).html(theForm.display());
378
+ $("#fieldlist"+opt.identifier).html("");
379
+ if (parseInt(itemSelected)==-1)
380
+ $(".fform").addClass("ui-selected");
381
+ else
382
+ $(".fform").removeClass("ui-selected");
383
+ for (var i=0;i<items.length;i++)
384
+ {
385
+ items[i].index = i;
386
+ $("#fieldlist"+opt.identifier).append(items[i].display());
387
+ if (i==itemSelected)
388
+ $("#field"+opt.identifier+"-"+i).addClass("ui-selected");
389
+ else
390
+ $("#field"+opt.identifier+"-"+i).removeClass("ui-selected");
391
+ $(".fields").mouseover(function() {
392
+ $(this).addClass("ui-over");
393
+ }).mouseout(function(){
394
+ $(this).removeClass("ui-over")
395
+ }).click(function(){
396
+ editItem($(this).attr("id").replace("field"+opt.identifier+"-",""));
397
+ $(this).siblings().removeClass("ui-selected");
398
+ $(this).addClass("ui-selected");
399
+ });
400
+ $(".field").focus(function(){
401
+ $(this).blur();
402
+ });
403
+ $("#field"+opt.identifier+"-"+i+" .remove").click(function(){
404
+ removeItem($(this).parent().attr("id").replace("field"+opt.identifier+"-",""));
405
+ });
406
+ }
407
+ if ($("#fieldlist"+opt.identifier).html() == "")
408
+ $("#saveForm").css("display","none");
409
+ else
410
+ $("#saveForm").css("display","none"); // changed "inline" to "none"
411
+ $(".fform").mouseover(function() {
412
+ $(this).addClass("ui-over");
413
+ }).mouseout(function(){
414
+ $(this).removeClass("ui-over")
415
+ }).click(function(){
416
+ $('#tabs').tabs("option", "active", 2);
417
+ editForm();
418
+ $(this).siblings().removeClass("ui-selected");
419
+ $(this).addClass("ui-selected");
420
+ });
421
+ ffunct.saveData("form_structure");
422
+ //email list
423
+ var str = "";
424
+ for (var i=0;i<items.length;i++)
425
+ if (items[i].ftype=="femail")
426
+ str += '<option value="'+items[i].name+'" '+((items[i].name == $('#cu_user_email_field').attr("def"))?"selected":"")+'>'+(items[i].title)+'</option>';
427
+ $('#cu_user_email_field').html(str);
428
+ //field list for paypal request
429
+ if (($('#request_cost').length > 0) && ($('#request_cost').is('select')))
430
+ {
431
+ var str = "";
432
+ for (var i=0;i<items.length;i++)
433
+ str += '<option value="'+items[i].name+'" '+((items[i].name == $('#request_cost').attr("def"))?"selected":"")+'>'+items[i].name+'('+(items[i].title)+')</option>';
434
+ $('#request_cost').html(str);
435
+ }
436
+ //request amount list
437
+ if ($('#paypal_price_field').length > 0)
438
+ {
439
+ var str = '<option value="" '+(('' == $('#paypal_price_field').attr("def"))?"selected":"")+'> ---- No ---- </option>';
440
+ for (var i=0;i<items.length;i++)
441
+ str += '<option value="'+items[i].name+'" '+((items[i].name == $('#paypal_price_field').attr("def"))?"selected":"")+'>'+(items[i].title)+'</option>';
442
+ $('#paypal_price_field').html(str);
443
+ }
444
+ }
445
+ function htmlDecode(value){
446
+ if(/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test(value))value=$('<div/>').html(value).text();return value;
447
+ };
448
+ function htmlEncode(value){
449
+ value = $('<div/>').text(value).html()
450
+ value = value.replace(/"/g, "&quot;");;
451
+ return value;
452
+ }
453
+ function showHideDep(){
454
+ function inArray(needle, haystack) {
455
+ for(var i = 0; i < haystack.length; i++) {
456
+ if(haystack[i] == needle) return true;
457
+ }
458
+ return false;
459
+ }
460
+ function removeFromArray(needle, haystack) {
461
+ for(var i = 0; i < haystack.length; i++) {
462
+ if(haystack[i] == needle)
463
+ {
464
+ haystack.splice(i,1);
465
+ i--;
466
+ }
467
+ }
468
+ return haystack;
469
+ }
470
+ var used = new Array();
471
+ var hideArray = new Array();
472
+ $(".depItem").each(function() {
473
+ var item = $(this);
474
+ try {
475
+ if ((item.parents("#fieldlist"+opt.identifier).length==1) && item.attr("dep") && item.attr("dep")!="" )
476
+ {
477
+ var d = item.attr("dep").split(",");
478
+ for (i=0;i<d.length;i++)
479
+ {
480
+ if (d[i]!="") d[i] = d[i]+opt.identifier;
481
+ if (d[i]!="" && !inArray(d[i],used) )//&& !inArray(d[i],hideArray)
482
+ {
483
+ try {
484
+ if ((item.is(':checked') || item.is(':selected') ) && (!inArray( ((item.hasClass("field"))?item.attr("id"):item.parents(".field").attr("id")) ,hideArray)) )
485
+ {
486
+ $("#"+d[i]).parents(".fields").css("display","");
487
+ $("#"+d[i]).parents(".fields").find(".field").each(function(){if (!$(this).hasClass("ignorepb"))$(this).removeClass("ignore");});
488
+ used[used.length] = d[i];
489
+ removeFromArray(d[i],hideArray);
490
+ }
491
+ else
492
+ {
493
+ $("#"+d[i]).parents(".fields").css("display","none");
494
+ $("#"+d[i]).parents(".fields").find(".field").each(function(){$(this).addClass("ignore");});
495
+ hideArray[hideArray.length] = d[i];
496
+ }
497
+ }catch(e){}
498
+ }
499
+ }
500
+ }
501
+ }catch(e){}
502
+ });
503
+ }
504
+ reloadItemsPublic = function() {
505
+ for (var i=0;i<showSettings.formlayoutList.length;i++)
506
+ $("#fieldlist"+opt.identifier).removeClass(showSettings.formlayoutList[i].id);
507
+ $("#fieldlist"+opt.identifier).html("").addClass(theForm.formlayout);
508
+ $("#formheader"+opt.identifier).html(theForm.show());
509
+ var page = 0;
510
+ $("#fieldlist"+opt.identifier).append('<div class="pb'+page+' pbreak" page="'+page+'"></div>');
511
+ var itemsDates = new Array();
512
+ for (var i=0;i<items.length;i++)
513
+ {
514
+ items[i].index = i;
515
+ if (items[i].ftype=="fPageBreak")
516
+ {
517
+ page++;
518
+ $("#fieldlist"+opt.identifier).append('<div class="pb'+page+' pbreak" page="'+page+'"></div>');
519
+ }
520
+ else
521
+ {
522
+ $("#fieldlist"+opt.identifier+" .pb"+page).append(items[i].show());
523
+ if (items[i].predefinedClick)
524
+ {
525
+ var cl = $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("class")+" predefinedClick";
526
+ $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("class",cl);
527
+ $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).attr("predefined",items[i].predefined);
528
+ }
529
+ if (items[i].userhelpTooltip)
530
+ {
531
+ var uh = $("#fieldlist"+opt.identifier+" .pb"+page).find("#"+items[i].name).parents(".fields");
532
+ uh.find(".uh").css("display","none");
533
+ if (uh.find(".uh").text()!="")
534
+ uh.attr("uh",uh.find(".uh").text());
535
+ }
536
+ }
537
+ $(".fields").mouseover(function() {
538
+ $(this).addClass("ui-over");
539
+ }).mouseout(function(){
540
+ $(this).removeClass("ui-over")
541
+ }).click(function(){
542
+ editItem($(this).attr("id").replace("field"+opt.identifier+"-",""));
543
+ $(this).siblings().removeClass("ui-selected");
544
+ $(this).addClass("ui-selected");
545
+ });
546
+
547
+ if (items[i].ftype=="fdate")
548
+ itemsDates[itemsDates.length] = items[i];
549
+ }
550
+ if (page>0)
551
+ {
552
+ $("#fieldlist"+opt.identifier+" .pb"+page).addClass("pbEnd");
553
+ $("#fieldlist"+opt.identifier+" .pbreak").find(".field").addClass("ignore").addClass("ignorepb");
554
+ $("#fieldlist"+opt.identifier+" .pb0").find(".field").removeClass("ignore").removeClass("ignorepb");
555
+ $("#fieldlist"+opt.identifier+" .pbreak").each(function(index) {
556
+ var code = $(this).html();
557
+ var bSubmit = '';
558
+ if (index == page)
559
+ {
560
+ if ($("#cpcaptchalayer"+opt.identifier).html())
561
+ {
562
+ code += '<div class="fields cpfieldcaptcha" id="fieldcaptcha'+opt.identifier+'">'+$("#cpcaptchalayer"+opt.identifier).html()+'</div>';
563
+ $("#cpcaptchalayer"+opt.identifier).html("");
564
+ }
565
+ if ($("#cp_subbtn"+opt.identifier).html())
566
+ bSubmit = '<div class="pbSubmit">'+$("#cp_subbtn"+opt.identifier).html()+'</div>';
567
+ }
568
+ $(this).html('<fieldset><legend>'+opt.messages.page+' '+(index+1)+' '+opt.messages.of+' '+(page+1)+'</legend>'+code+'<div class="pbPrevious">'+opt.messages.previous+'</div><div class="pbNext">'+opt.messages.next+'</div>'+bSubmit+'<div class="clearer"></div></fieldset>');
569
+ });
570
+ $(".pbPrevious,.pbNext").bind("click", function() {
571
+ if ($(this).parents("form").valid())
572
+ {
573
+ var page = parseInt($(this).parents(".pbreak").attr("page"));
574
+ (($(this).hasClass("pbPrevious"))?page--:page++);
575
+ $("#fieldlist"+opt.identifier+" .pbreak").css("display","none");
576
+ $("#fieldlist"+opt.identifier+" .pbreak").find(".field").addClass("ignore").addClass("ignorepb");
577
+
578
+ $("#fieldlist"+opt.identifier+" .pb"+page).css("display","block");
579
+ $("#fieldlist"+opt.identifier+" .pb"+page).find(".field").removeClass("ignore").removeClass("ignorepb");
580
+ showHideDep();
581
+ }
582
+ return false;
583
+ });
584
+ }
585
+ else
586
+ {
587
+ if ($("#cpcaptchalayer"+opt.identifier).html())
588
+ {
589
+ $("#fieldlist"+opt.identifier+" .pb"+page).append('<div class="fields cpfieldcaptcha" id="fieldcaptcha'+opt.identifier+'">'+$("#cpcaptchalayer"+opt.identifier).html()+'</div>');
590
+ $("#cpcaptchalayer"+opt.identifier).html("");
591
+ }
592
+ if ($("#cp_subbtn"+opt.identifier).html())
593
+ $("#fieldlist"+opt.identifier+" .pb"+page).append('<div class="pbSubmit">'+$("#cp_subbtn"+opt.identifier).html()+'</div>');
594
+ }
595
+ $(".pbSubmit").bind("click", function() {
596
+ $(this).parents("#fieldlist"+opt.identifier).parents("form").submit();
597
+ });
598
+ $("#fieldlist"+opt.identifier+" .predefinedClick").bind("click", function() {
599
+ if ($(this).attr("predefined") == $(this).val())
600
+ $(this).val("");
601
+ });
602
+ $("#fieldlist"+opt.identifier+" .predefinedClick").blur("click", function() {
603
+ if ($(this).val()=="")
604
+ $(this).val($(this).attr("predefined"));
605
+ });
606
+ if (i>0)
607
+ {
608
+ for (var k=0;k<itemsDates.length;k++)
609
+ {
610
+ if (itemsDates[k].showDropdown)
611
+ $( "#"+itemsDates[k].name ).datepicker({changeMonth: true,changeYear: true,yearRange: itemsDates[k].dropdownRange,dateFormat: itemsDates[k].dformat.replace(/yyyy/g,"yy")});
612
+ else
613
+ $( "#"+itemsDates[k].name ).datepicker({ dateFormat: itemsDates[k].dformat.replace(/yyyy/g,"yy")});
614
+ $( "#"+itemsDates[k].name ).datepicker( "option", "minDate", itemsDates[k].minDate );
615
+ $( "#"+itemsDates[k].name ).datepicker( "option", "maxDate", itemsDates[k].maxDate );
616
+ $( "#"+itemsDates[k].name ).datepicker( "option", "defaultDate", itemsDates[k].defaultDate );
617
+ }
618
+ //$(".depItem").each(function() {
619
+ showHideDep();
620
+ //});
621
+ $.validator.addMethod("dateddmmyyyy", function(value, element) {
622
+ return this.optional(element) || /^(?:[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])[\/\-](?:[1-9]|0[1-9]|1[0-2])[\/\-]\d{4}$/.test(value);
623
+ });
624
+
625
+ $.validator.addMethod("datemmddyyyy", function(value, element) {
626
+ return this.optional(element) || /^(?:[1-9]|0[1-9]|1[0-2])[\/\-](?:[1-9]|0[1-9]|1[0-9]|2[0-9]|3[0-1])[\/\-]\d{4}$/.test(value);
627
+ });//{required: true, range: [11, 22]}
628
+
629
+
630
+
631
+ $(".depItemSel,.depItem").bind("change", function() {
632
+ showHideDep();
633
+ });
634
+ try {
635
+ $( "#fbuilder"+opt.identifier ).tooltip({show: false,hide:false,tooltipClass:"uh-tooltip",position: { my: "left top", at: "left bottom", collision: "none" },items: "[uh]",content: function (){return $(this).attr("uh");} });
636
+ } catch(e){}
637
+
638
+ }
639
+ for (var i=0;i<items.length;i++)
640
+ items[i].after_show();
641
+ }
642
+ var showSettings= {
643
+ sizeList:new Array({id:"small",name:"Small"},{id:"medium",name:"Medium"},{id:"large",name:"Large"}),
644
+ layoutList:new Array({id:"one_column",name:"One Column"},{id:"two_column",name:"Two Column"},{id:"three_column",name:"Three Column"},{id:"side_by_side",name:"Side by Side"}),
645
+ formlayoutList:new Array({id:"top_aligned",name:"Top Aligned"},{id:"left_aligned",name:"Left Aligned"},{id:"right_aligned",name:"Right Aligned"}),
646
+ showTitle: function(f,v) {
647
+ var str = '<label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+v+'</textarea>';
648
+ if (v=="Page Break") str = "";
649
+ return '<label>Field Type: '+getNameByIdFromType(f)+'</label><br /><br />'+str;
650
+ },
651
+ showName: function(v1,v2) {
652
+ return '<div><label>Short label (optional) [<a class="helpfbuilder" text="The short label is used at title for the column when exporting the form data to CSV files.\n\nIf the short label is empty then, the field label will be used for the CSV file.">help?</a>] :</label><input class="large" name="sShortlabel" id="sShortlabel" value="'+v2+'" /></div>'+
653
+ '<div><label>Field tag for the message (optional):</label><input readonly="readonly" class="large" name="sNametag" id="sNametag" value="&lt;%'+v1+'%&gt;" />'+
654
+ '<input style="display:none" readonly="readonly" class="large" name="sName" id="sName" value="'+v1+'" /></div>';
655
+ },
656
+ showPredefined: function(v,c) {
657
+ return '<div><label>Predefined Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+v+'</textarea><br /><input type="checkbox" name="sPredefinedClick" id="sPredefinedClick" '+((c)?"checked":"")+' value="1" > Hide predefined value on click.</div>';
658
+ },
659
+ showEqualTo: function(v,name) {
660
+ return '<div><label>Equal to [<a class="helpfbuilder" text="Use this field to create password confirmation field or email confirmation fields.\n\nSpecify this setting ONLY into the confirmation field, not in the original field.">help?</a>]</label><br /><select class="equalTo" name="sEqualTo" id="sEqualTo" dvalue="'+v+'" dname="'+name+'"></select></div>';
661
+ },
662
+ showRequired: function(v) {
663
+ return '<div><input type="checkbox" name="sRequired" id="sRequired" '+((v)?"checked":"")+'><label>Required</label></div>';
664
+ },
665
+ showSize: function(v) {
666
+ var str = "";
667
+ for (var i=0;i<this.sizeList.length;i++)
668
+ str += '<option value="'+this.sizeList[i].id+'" '+((this.sizeList[i].id==v)?"selected":"")+'>'+this.sizeList[i].name+'</option>';
669
+ return '<label>Field Size</label><br /><select name="sSize" id="sSize">'+str+'</select>';
670
+ },
671
+ showLayout: function(v) {
672
+ var str = "";
673
+ for (var i=0;i<this.layoutList.length;i++)
674
+ str += '<option value="'+this.layoutList[i].id+'" '+((this.layoutList[i].id==v)?"selected":"")+'>'+this.layoutList[i].name+'</option>';
675
+ return '<label>Field Layout</label><br /><select name="sLayout" id="sLayout">'+str+'</select>';
676
+ },
677
+ showUserhelp: function(v,c) {
678
+ return '<div><label>Instructions for User</label><textarea class="large" name="sUserhelp" id="sUserhelp">'+v+'</textarea><br /><input type="checkbox" name="sUserhelpTooltip" id="sUserhelpTooltip" '+((c)?"checked":"")+' value="1" > Show as floating tooltip.</div>';
679
+ },
680
+ showCsslayout: function(v) {
681
+ return '<label>Additional CSS Class</label><input class="large" name="sCsslayout" id="sCsslayout" value="'+v+'" />';
682
+ }
683
+ };
684
+ var fform=function(){};
685
+ $.extend(fform.prototype,{
686
+ title:"Untitled Form",
687
+ description:"This is my form. Please fill it out. It's awesome!",
688
+ formlayout:"top_aligned",
689
+ display:function(){
690
+ return '<div class="fform" id="field">'+(this.title!=''?'<h1>'+this.title+'</h1>':'')+(this.description!=''?'<span>'+this.description+'</span>':'')+'</div>';
691
+ },
692
+ show:function(){
693
+ var tmpstr = '';
694
+ if (this.title != '')
695
+ tmpstr += '<h1>'+this.title+'</h1>';
696
+ if (this.description != '')
697
+ tmpstr += '<span>'+this.description+'</span>';
698
+ return '<div class="fform" id="field">'+tmpstr+'</div>';
699
+ },
700
+ showAllSettings:function(){
701
+ var str = "";
702
+ for (var i=0;i<showSettings.formlayoutList.length;i++)
703
+ str += '<option value="'+showSettings.formlayoutList[i].id+'" '+((showSettings.formlayoutList[i].id==this.formlayout)?"selected":"")+'>'+showSettings.formlayoutList[i].name+'</option>';
704
+ return '<div><label>Form Name</label><input class="large" name="fTitle" id="fTitle" value="'+htmlEncode(this.title)+'" /></div><div><label>Description</label><textarea class="large" name="fDescription" id="fDescription">'+this.description+'</textarea></div><div><label>Label Placement</label><br /><select name="fLayout" id="fLayout">'+str+'</select></div>';
705
+ }
706
+
707
+ });
708
+ var theForm = new fform();
709
+ var ffields=function(){};
710
+ $.extend(ffields.prototype, {
711
+ name:"",
712
+ shortlabel:"",
713
+ index:-1,
714
+ ftype:"",
715
+ userhelp:"",
716
+ userhelpTooltip:false,
717
+ csslayout:"",
718
+ init:function(){
719
+ },
720
+ after_show:function(){},
721
+ showSpecialData:function(){
722
+ if(typeof this.showSpecialDataInstance != 'undefined')
723
+ return this.showSpecialDataInstance();
724
+ else
725
+ return "";
726
+ },
727
+ showEqualTo:function(){
728
+ if(typeof this.equalTo != 'undefined')
729
+ return showSettings.showEqualTo(this.equalTo,this.name);
730
+ else
731
+ return "";
732
+ },
733
+ showPredefined:function(){
734
+ if(typeof this.predefined != 'undefined')
735
+ return showSettings.showPredefined(this.predefined,this.predefinedClick);
736
+ else
737
+ return "";
738
+ },
739
+ showRequired:function(){
740
+ if(typeof this.required != 'undefined')
741
+ return showSettings.showRequired(this.required);
742
+ else
743
+ return "";
744
+ },
745
+ showSize:function(){
746
+ if(typeof this.size != 'undefined')
747
+ return showSettings.showSize(this.size);
748
+ else
749
+ return "";
750
+ },
751
+ showLayout:function(){
752
+ if(typeof this.layout != 'undefined')
753
+ return showSettings.showLayout(this.layout);
754
+ else
755
+ return "";
756
+ },
757
+ showRange:function(){
758
+ if(typeof this.min != 'undefined')
759
+ return this.showRangeIntance();
760
+ else
761
+ return "";
762
+ },
763
+ showFormat:function(){
764
+ if(typeof this.dformat != 'undefined')
765
+ try {
766
+ return this.showFormatIntance();
767
+ } catch(e) {return "";}
768
+ else
769
+ return "";
770
+ },
771
+ showChoice:function(){
772
+ if(typeof this.choices != 'undefined')
773
+ return this.showChoiceIntance();
774
+ else
775
+ return "";
776
+ },
777
+ showUserhelp:function(){
778
+ return ((this.ftype!="fPageBreak")?showSettings.showUserhelp(this.userhelp,this.userhelpTooltip):"");
779
+ },
780
+ showCsslayout:function(){
781
+ return ((this.ftype!="fPageBreak")?showSettings.showCsslayout(this.csslayout):"");
782
+ },
783
+ showAllSettings:function(){
784
+ return this.showTitle()+this.showName()+this.showSize()+this.showLayout()+this.showFormat()+this.showRange()+this.showRequired()+this.showSpecialData()+this.showEqualTo()+this.showPredefined()+this.showChoice()+this.showUserhelp()+this.showCsslayout();
785
+ },
786
+ showTitle:function(){
787
+ return showSettings.showTitle(this.ftype,this.title);
788
+ },
789
+ showName:function(){
790
+ return ((this.ftype!="fPageBreak")?showSettings.showName(this.name,this.shortlabel):"");
791
+ },
792
+ display:function(){
793
+ return 'Not available yet';
794
+ },
795
+ show:function(){
796
+ return 'Not available yet';
797
+ },
798
+ toJSON:function(){
799
+ str = '';
800
+ $.each( this, function(i, n){
801
+ if (typeof n!="function")
802
+ {
803
+ if (str!="")
804
+ str += ",";
805
+ str += '"'+i+'":'+n ;
806
+ }
807
+ });
808
+ return str;
809
+ }
810
+ });
811
+ var ftext=function(){};
812
+ $.extend(ftext.prototype,ffields.prototype,{
813
+ title:"Untitled",
814
+ ftype:"ftext",
815
+ predefined:"",
816
+ predefinedClick:false,
817
+ required:false,
818
+ size:"medium",
819
+ minlength:"",
820
+ maxlength:"",
821
+ equalTo:"",
822
+ display:function(){
823
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
824
+ },
825
+ show:function(){
826
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+htmlEncode(this.maxlength)+'" '+((this.equalTo!="")?"equalTo=\"#"+htmlEncode(this.equalTo+opt.identifier)+"\"":"" )+' class="field '+this.size+((this.required)?" required":"")+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
827
+ },
828
+ showSpecialDataInstance: function() {
829
+ return '<div class="column"><label>Min length/characters</label><br /><input name="sMinlength" id="sMinlength" value="'+this.minlength+'"></div><div class="column"><label>Max length/characters</label><br /><input name="sMaxlength" id="sMaxlength" value="'+this.maxlength+'"></div><div class="clearer"></div>';
830
+ }
831
+ });
832
+ var facceptance=function(){};
833
+ $.extend(facceptance.prototype,ffields.prototype,{
834
+ title:"Accept terms and conditions",
835
+ ftype:"facceptance",
836
+ value:"I accept",
837
+ required:true,
838
+ url:"",
839
+ message:"",
840
+ display:function(){
841
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><div class="dfield"><input class="field" disabled="true" type="checkbox"/> '+this.title+((this.required)?"*":"")+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
842
+ },
843
+ show:function(){
844
+ //return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+htmlEncode(this.maxlength)+'" '+((this.equalTo!="")?"equalTo=\"#"+htmlEncode(this.equalTo+opt.identifier)+"\"":"" )+' class="field '+this.size+((this.required)?" required":"")+'" type="text" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
845
+ var me = this,
846
+ dlg = '',
847
+ label = me.title;
848
+
849
+ if(!/^\s*$/.test(me.url))
850
+ {
851
+ label = '<a href="'+htmlEncode($.trim(me.url))+'" target="_blank">'+label+'</a>';
852
+ }
853
+ else if(!/^\s*$/.test(me.message))
854
+ {
855
+ label = '<a href="javascript:void(0);" class="cff-open-dlg">'+label+'</a>';
856
+ dlg += '<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+me.message+'</div></div>'
857
+ }
858
+ return '<div class="fields '+me.csslayout+' cff-checkbox-field" id="field'+me.identifier+'-'+me.index+'"><div class="dfield">'+
859
+ '<div class="one_column"><label><input name="'+me.name+'" id="'+me.name+'" class="field '+((this.required)?" required":"")+'" value="'+htmlEncode(me.value)+'" vt="'+htmlEncode((/^\s*$/.test(me.value)) ? me.title : me.value)+'" type="checkbox" /> <span>'+
860
+ htmlDecode( label )+''+((me.required)?'<span class="r">*</span>':'')+
861
+ '</span></label></div>'+
862
+ dlg+
863
+ '</div><div class="clearer"></div></div>';
864
+
865
+ },
866
+ after_show:function()
867
+ {
868
+ $(document).on('click','.cff-open-dlg', function(){
869
+ var dlg = $(this).closest('.fields').find('.cff-dialog'), w = dlg.data('width'), h=dlg.data('height');
870
+ dlg.removeClass('hide');
871
+
872
+ if('undefined' == typeof w) w = Math.min($(this).closest('form').width(), $(window).width(), dlg.width());
873
+ if('undefined' == typeof h) h = Math.min($(this).closest('form').height(), $(window).height(), dlg.height());
874
+
875
+ dlg.data('width',w);
876
+ dlg.data('height',h);
877
+
878
+ dlg.css({'width': w+'px', 'height': h+'px', 'margin-top': (-1*h/2)+'px', 'margin-left': (-1*w/2)+'px'});
879
+ });
880
+ $(document).on('click','.cff-close-dlg', function(){$(this).closest('.cff-dialog').addClass('hide');});
881
+ },
882
+ showSpecialDataInstance: function() {
883
+ return '<div><label>Value</label><input class="large" type="text" name="sValue" id="sValue" value="'+htmlEncode(this.value)+'"></div><div><label>URL to the Consent and Acknowledgement page</label><input class="large" type="text" name="sURL" id="sURL" value="'+htmlEncode(this.url)+'"></div><div><label>- or - enter the Consent and Acknowledgement text</label><textarea class="large" name="sMessage" id="sMessage" style="height:150px;">'+this.message+'</textarea></div>';
884
+ }
885
+ });
886
+ var fpassword=function(){};
887
+ $.extend(fpassword.prototype,ffields.prototype,{
888
+ title:"Untitled",
889
+ ftype:"fpassword",
890
+ predefined:"",
891
+ predefinedClick:false,
892
+ required:false,
893
+ size:"medium",
894
+ minlength:"",
895
+ maxlength:"",
896
+ equalTo:"",
897
+ display:function(){
898
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
899
+ },
900
+ show:function(){
901
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
902
+ },
903
+ showSpecialDataInstance: function() {
904
+ return 'Not available in free version';
905
+ }
906
+ });
907
+ var femail=function(){};
908
+ $.extend(femail.prototype,ffields.prototype,{
909
+ title:"Email",
910
+ ftype:"femail",
911
+ predefined:"",
912
+ predefinedClick:false,
913
+ required:false,
914
+ size:"medium",
915
+ equalTo:"",
916
+ display:function(){
917
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="email" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
918
+ },
919
+ show:function(){
920
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+((this.equalTo!="")?"equalTo=\"#"+htmlEncode(this.equalTo+opt.identifier)+"\"":"" )+' class="field email '+this.size+((this.required)?" required":"")+'" type="email" value="'+htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
921
+ },
922
+ showSpecialDataInstance: function() {
923
+ var str = "";
924
+ return str;
925
+ }
926
+ });
927
+ var fnumber=function(){};
928
+ $.extend(fnumber.prototype,ffields.prototype,{
929
+ title:"Number",
930
+ ftype:"fnumber",
931
+ predefined:"",
932
+ predefinedClick:false,
933
+ required:false,
934
+ size:"small",
935
+ min:"",
936
+ max:"",
937
+ dformat:"digits",
938
+ formats:new Array("digits","number"),
939
+ display:function(){
940
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
941
+ },
942
+ show:function(){
943
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
944
+ },
945
+ showFormatIntance: function() {;
946
+ return '<div>Not available in free version</div>';
947
+ },
948
+ showRangeIntance: function() {
949
+ return 'Not available in free version';
950
+ }
951
+ });
952
+ var fdate=function(){};
953
+ $.extend(fdate.prototype,ffields.prototype,{
954
+ title:"Date",
955
+ ftype:"fdate",
956
+ predefined:"",
957
+ predefinedClick:false,
958
+ size:"medium",
959
+ required:false,
960
+ dformat:"mm/dd/yyyy",
961
+ showDropdown:false,
962
+ dropdownRange:"-10:+10",
963
+ minDate:"",
964
+ maxDate:"",
965
+ defaultDate:"",
966
+ formats:new Array("mm/dd/yyyy","dd/mm/yyyy"),
967
+ display:function(){
968
+ return '';
969
+ },
970
+ show:function(){
971
+ return '';
972
+ },
973
+ showFormatIntance: function() {
974
+ return '<div>Not available in free version</div>';
975
+ },
976
+ showSpecialDataInstance: function() {
977
+ return 'Not available in free version';
978
+ }
979
+ });
980
+ var ftextarea=function(){};
981
+ $.extend(ftextarea.prototype,ffields.prototype,{
982
+ title:"Untitled",
983
+ ftype:"ftextarea",
984
+ predefined:"",
985
+ predefinedClick:false,
986
+ required:false,
987
+ size:"medium",
988
+ minlength:"",
989
+ maxlength:"",
990
+ display:function(){
991
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><textarea class="field disabled '+this.size+'">'+this.predefined+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
992
+ },
993
+ show:function(){
994
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><textarea id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+htmlEncode(this.maxlength)+'" class="field '+this.size+((this.required)?" required":"")+'">'+this.predefined+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
995
+ },
996
+ showSpecialDataInstance: function() {
997
+ return '<div class="column"><label>Min length/characters</label><br /><input name="sMinlength" id="sMinlength" value="'+this.minlength+'"></div><div class="column"><label>Max length/characters</label><br /><input name="sMaxlength" id="sMaxlength" value="'+this.maxlength+'"></div><div class="clearer"></div>';
998
+ }
999
+ });
1000
+ var ffile=function(){};
1001
+ $.extend(ffile.prototype,ffields.prototype,{
1002
+ title:"Untitled",
1003
+ ftype:"ffile",
1004
+ required:false,
1005
+ size:"medium",
1006
+ display:function(){
1007
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1008
+ },
1009
+ show:function(){
1010
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1011
+ }
1012
+ });
1013
+ var fSectionBreak=function(){};
1014
+ $.extend(fSectionBreak.prototype,ffields.prototype,{
1015
+ title:"Section Break",
1016
+ ftype:"fSectionBreak",
1017
+ userhelp:"A description of the section goes here.",
1018
+ display:function(){
1019
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1020
+ },
1021
+ show:function(){
1022
+ return '<div class="fields '+this.csslayout+' section_breaks" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1023
+ }
1024
+ });
1025
+ var fPageBreak=function(){};
1026
+ $.extend(fPageBreak.prototype,ffields.prototype,{
1027
+ title:"Page Break",
1028
+ ftype:"fPageBreak",
1029
+ display:function(){
1030
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1031
+ },
1032
+ show:function(){
1033
+ return '<div class="fields '+this.csslayout+' section_breaks" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1034
+ }
1035
+ });
1036
+ var fPhone=function(){};
1037
+ $.extend(fPhone.prototype,ffields.prototype,{
1038
+ title:"Phone",
1039
+ ftype:"fPhone",
1040
+ required:false,
1041
+ dformat:"### ### ####",
1042
+ predefined:"888 888 8888",
1043
+ display:function(){
1044
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1045
+ },
1046
+ show:function(){
1047
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1048
+ },
1049
+ showFormatIntance: function() {
1050
+ return '<div>Not available in free version</div>';
1051
+ }
1052
+ });
1053
+ var fCommentArea=function(){};
1054
+ $.extend(fCommentArea.prototype,ffields.prototype,{
1055
+ title:"Comments here",
1056
+ ftype:"fCommentArea",
1057
+ userhelp:"A description of the section goes here.",
1058
+ display:function(){
1059
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1060
+ },
1061
+ show:function(){
1062
+ return '<div class="fields '+this.csslayout+' comment_area" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1063
+ }
1064
+ });
1065
+ var fcheck=function(){};
1066
+ $.extend(fcheck.prototype,ffields.prototype,{
1067
+ title:"Check All That Apply",
1068
+ ftype:"fcheck",
1069
+ layout:"one_column",
1070
+ required:false,
1071
+ showDep:false,
1072
+ init:function(){
1073
+ },
1074
+ display:function(){
1075
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1076
+ },
1077
+ show:function(){
1078
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1079
+ },
1080
+ showChoiceIntance: function() {
1081
+ return '<div class="choicesSet '+((this.showDep)?"show":"hide")+'">Not available in free version<div class="clearer"></div></div>'+str+'</div>';
1082
+ }
1083
+ });
1084
+ var fradio=function(){};
1085
+ $.extend(fradio.prototype,ffields.prototype,{
1086
+ title:"Select a Choice",
1087
+ ftype:"fradio",
1088
+ layout:"one_column",
1089
+ required:false,
1090
+ choiceSelected:null,
1091
+ showDep:false,
1092
+ init:function(){
1093
+ },
1094
+ display:function(){
1095
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'"><div class="arrow ui-icon ui-icon-play "></div><div class="remove ui-icon ui-icon-trash "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
1096
+ },
1097
+ show:function(){
1098
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
1099
+ var str = "";
1100
+ if (!(typeof(this.choicesDep) != "undefined" && this.choicesDep !== null))
1101
+ {
1102
+ this.choicesDep = new Array();
1103
+ for (var i=0;i<this.choices.length;i++)
1104
+ this.choicesDep[i] = new Array();
1105
+ }
1106
+ for (var i=0;i<this.choices.length;i++)
1107
+ {
1108
+ var classDep = "",attrDep = "";
1109
+ var d = this.choicesDep;
1110
+ if (d[i].length>0)
1111
+ {
1112
+ classDep = " depItem";
1113
+ for (var j=0;j<d[i].length;j++)
1114
+ {
1115
+ attrDep += ","+d[i][j];
1116
+ }
1117
+ }
1118
+ str += '<div class="'+this.layout+'"><input name="'+this.name+'" id="'+this.name+'" '+((classDep!="")?"dep=\""+attrDep+"\"":"")+' class="field depItem group '+((this.required)?" required":"")+'" value="'+htmlEncode(this.choicesVal[i])+'" type="radio" i="'+i+'" '+((this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> <span>'+this.choices[i]+'</span></div>';
1119
+ }
1120
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
1121
+ },
1122
+ showChoiceIntance: function() {
1123
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
1124
+ var l = this.choices;
1125
+ var lv = this.choicesVal;
1126
+ var v = this.choiceSelected;
1127
+ if (!(typeof(this.choicesDep) != "undefined" && this.choicesDep !== null))
1128
+ {
1129
+ this.choicesDep = new Array();
1130
+ for (var i=0;i<l.length;i++)
1131
+ this.choicesDep[i] = new Array();
1132
+ }
1133
+ var d = this.choicesDep;
1134
+ var str = "";
1135
+ for (var i=0;i<l.length;i++)
1136
+ {
1137
+ str += '<div class="choicesEdit"><input class="choice_radio" i="'+i+'" type="radio" '+((this.choiceSelected==lv[i])?"checked":"")+' name="choice_radio" /><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'+htmlEncode(l[i])+'"/><input class="choice_value" i="'+i+'" type="text" name="sChoice'+this.name+'V'+i+'" id="sChoice'+this.name+'V'+i+'" value="'+htmlEncode(lv[i])+'"/><a class="choice_add ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another choice."></a><a class="choice_remove ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this choice."></a></div>';
1138
+ for (var j=0;j<d[i].length;j++)
1139
+ str += '<div class="choicesEditDep">If selected show: <select class="dependencies" i="'+i+'" j="'+j+'" dname="'+this.name+'" dvalue="'+d[i][j]+'" ></select><a class="choice_addDep ui-icon ui-icon-circle-plus" i="'+i+'" j="'+j+'" title="Add another dependency."></a><a class="choice_removeDep ui-icon ui-icon-circle-minus" i="'+i+'" j="'+j+'" title="Delete this dependency."></a></div>';
1140
+ if (d[i].length==0)
1141
+ str += '<div class="choicesEditDep">If selected show: <select class="dependencies" i="'+i+'" j="'+d[i].length+'" dname="'+this.name+'" dvalue="" ></select><a class="choice_addDep ui-icon ui-icon-circle-plus" i="'+i+'" j="'+d[i].length+'" title="Add another dependency."></a><a class="choice_removeDep ui-icon ui-icon-circle-minus" i="'+i+'" j="'+d[i].length+'" title="Delete this dependency."></a></div>';
1142
+ }
1143
+ return '<div class="choicesSet '+((this.showDep)?"show":"hide")+'"><label>Choices</label> <a class="helpfbuilder dep" text="Dependencies are used to show/hide other fields depending of the option selected in this field.">help?</a> <a href="" class="showHideDependencies">'+((this.showDep)?"Hide":"Show")+' Dependencies</a><div><div class="t">Text</div><div class="t">Value</div><div class="clearer"></div></div>'+str+'</div>';
1144
+ }
1145
+ });
1146
+ var fdropdown=function(){};
1147
+ $.extend(fdropdown.prototype,ffields.prototype,{
1148
+ title:"Select a Choice",
1149
+ ftype:"fdropdown",
1150
+ size:"medium",
1151
+ required:false,
1152
+ choiceSelected:"",
1153
+ showDep:false,
1154
+ init:function(){
1155
+ },
1156
+ display:function(){
1157
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
1158
+ return '<div class="fields" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1159
+ },
1160
+ show:function(){
1161
+ return '<div class="fields '+this.csslayout+'" id="field'+opt.identifier+'-'+this.index+'">Not available in free version<div class="clearer"></div></div>';
1162
+ },
1163
+ showChoiceIntance: function() {
1164
+ return '<div class="choicesSet '+((this.showDep)?"show":"hide")+'">Not available in free version<div class="clearer"></div></div>'+str+'</div>';
1165
+ }
1166
+ });
1167
+ if (!opt.pub)
1168
+ {
1169
+ $("#fieldlist"+opt.identifier).sortable({
1170
+ start: function(event, ui) {
1171
+ var start_pos = ui.item.index();
1172
+ ui.item.data('start_pos', start_pos);
1173
+ },
1174
+ stop: function(event, ui) {
1175
+ var end_pos = parseInt(ui.item.index());
1176
+ var start_pos = parseInt(ui.item.data('start_pos'));
1177
+ var tmp = items[start_pos];
1178
+ if (end_pos > start_pos)
1179
+ {
1180
+ for (var i = start_pos; i<end_pos; i++)
1181
+ items[i] = items[i+1];
1182
+ }
1183
+ else
1184
+ {
1185
+ for (var i = start_pos; i>end_pos; i--)
1186
+ items[i] = items[i-1];
1187
+ }
1188
+ items[end_pos] = tmp;
1189
+
1190
+
1191
+ reloadItems();
1192
+ }
1193
+ });
1194
+ }
1195
+ if (!opt.pub)
1196
+ {
1197
+ $('#tabs').tabs({activate: function(event, ui) {
1198
+ if ($(this).tabs( "option", "active" )!=1)
1199
+ {
1200
+ $(".fields").removeClass("ui-selected");
1201
+ itemSelected = -2;
1202
+ if ($(this).tabs( "option", "active" )==2)
1203
+ {
1204
+ $(".fform").addClass("ui-selected");
1205
+ editForm();
1206
+ }
1207
+ else
1208
+ $(".fform").removeClass("ui-selected");
1209
+ }
1210
+ else
1211
+ {
1212
+ $(".fform").removeClass("ui-selected");
1213
+ if (itemSelected<0)
1214
+ $('#tabs-2').html('<b>No Field Selected</b><br />Please click on a field in the form preview on the right to change its properties.');
1215
+ }
1216
+ }
1217
+ });
1218
+ }
1219
+ loadtmp = function(p)
1220
+ {
1221
+
1222
+ if ( d = $.parseJSON(p))
1223
+ {
1224
+ if (d.length==2)
1225
+ {
1226
+ items = new Array();
1227
+ for (var i=0;i<d[0].length;i++)
1228
+ {
1229
+ var obj = eval("new "+d[0][i].ftype+"();");
1230
+ obj = $.extend(obj,d[0][i]);
1231
+ obj.name = obj.name+opt.identifier;
1232
+ items[items.length] = obj;
1233
+ }
1234
+ theForm = new fform();
1235
+ theForm = $.extend(theForm,d[1][0]);
1236
+ if (opt.pub)
1237
+ reloadItemsPublic();
1238
+ else
1239
+ reloadItems();
1240
+ }
1241
+ }
1242
+ }
1243
+ var ffunct = {
1244
+ getItems: function() {
1245
+ return items;
1246
+ },
1247
+ addItem: function(id) {
1248
+ var obj = eval("new "+id+"();")
1249
+ obj.init();
1250
+ var n = 0;
1251
+ for (var i=0;i<items.length;i++)
1252
+ {
1253
+ n1 = parseInt(items[i].name.replace(/fieldname/g,""));
1254
+ if (n1>n)
1255
+ n = n1;
1256
+ }
1257
+ $.extend(obj,{name:"fieldname"+(n+1)});
1258
+ items[items.length] = obj;
1259
+ reloadItems();
1260
+ },
1261
+ saveData:function(f){
1262
+ if (f!="")
1263
+ $("#"+f).val("["+ $.stringifyXX(items,false)+",["+ $.stringifyXX(theForm,false)+"]]");
1264
+ else
1265
+ {
1266
+ $.ajax({
1267
+ type: "POST",
1268
+ url: "process.php?act=save",
1269
+ data: "items="+ $.stringifyXX(items,true)+"&theForm="+ $.stringifyXX(theForm,true),
1270
+ dataType: "json",
1271
+ success: function (result) {
1272
+ alert("The form has been saved!!!");
1273
+ }
1274
+ });
1275
+ }
1276
+ },
1277
+ loadData:function(f){
1278
+
1279
+ if (f!="")
1280
+ loadtmp($("#"+f).val());
1281
+ else
1282
+ {
1283
+ $.ajax({async:false,
1284
+ url: "process.php?act=load",
1285
+ success: function (result) {
1286
+ loadtmp(result.toString());
1287
+ }
1288
+ });
1289
+ }
1290
+ },
1291
+ removeItem: removeItem,
1292
+ editItem:editItem
1293
+ }
1294
+ this.fBuild = ffunct;
1295
+ return this;
1296
+ }
1297
+
1298
+ var fcount = 1;
1299
+ var fnum = "_"+fcount;
1300
+ while (10>fcount || eval("typeof cp_contactformtoemail_fbuilder_config"+fnum+" != 'undefined'"))
1301
+ {
1302
+ try {
1303
+ var cp_contactformtoemail_fbuilder_config = eval("cp_contactformtoemail_fbuilder_config"+fnum);
1304
+ var f = $("#fbuilder"+fnum).CFTEfbuilder($.parseJSON(cp_contactformtoemail_fbuilder_config.obj));
1305
+ f.fBuild.loadData("form_structure"+fnum);
1306
+ $("#cp_contactformtoemail_pform"+fnum).validate({
1307
+ ignore:".ignore",
1308
+ errorElement: "div",
1309
+ errorPlacement: function(e, element) {
1310
+ if (element.hasClass('group'))
1311
+ element = element.parent();
1312
+ e.insertBefore(element);
1313
+ e.addClass('message'); // add a class to the wrapper
1314
+ e.css('position', 'absolute');
1315
+ e.css('left',0 );
1316
+ e.css('top',element.parent().outerHeight(true));
1317
+ }
1318
+ });
1319
+ $( document ).trigger( 'showHideDepEvent', fnum );
1320
+ } catch (e) {}
1321
+ fcount++;
1322
+ fnum = "_"+fcount;
1323
+ }
1324
+ })(jQuery);
1325
+ /** jQuery.holdReady(false); */
1326
+ });