Calculated Fields Form - Version 1.0.263

Version Description

  • Fixes another conflict with the Speed Booster Pack plugin.
  • Includes a new operation to access easier to the fields, for example to assign a value to the slider field: fieldname1, enter as part of the equation getField(1).setVal(50);
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Calculated Fields Form
Version 1.0.263
Comparing to
See all releases

Code changes from version 1.0.235 to 1.0.263

Files changed (49) hide show
  1. README.txt +49 -34
  2. changelog.txt +151 -0
  3. cp_calculatedfieldsf_free.php +2 -2
  4. css/style.css +5 -2
  5. css/stylepublic.css +6 -2
  6. inc/cpcff_admin_int.inc.php +11 -8
  7. inc/cpcff_amp.inc.php +23 -5
  8. inc/cpcff_banner.inc.php +9 -2
  9. inc/cpcff_install_uninstall.inc.php +16 -87
  10. inc/cpcff_main.inc.php +47 -5
  11. inc/cpcff_public_int.inc.php +1 -1
  12. js/cp_calculatedfieldsf_gutenberg.js +127 -124
  13. js/fbuilder-pro-admin.jquery.js +0 -1
  14. js/fbuilder-pro-public.jquery.js +210 -95
  15. js/fields-admin/02_fbuilder.fcurrency.js +20 -19
  16. js/fields-admin/04_fbuilder.fdate.js +22 -12
  17. js/fields-admin/06_fbuilder.fcheck.js +3 -3
  18. js/fields-admin/07_fbuilder.fradio.js +11 -5
  19. js/fields-admin/08_fbuilder.fdropdown.js +3 -3
  20. js/fields-admin/28_fbuilder.fcontainer.js +10 -11
  21. js/fields-admin/fbuilder.fcalculated.js +1 -1
  22. js/fields-public/01_fbuilder.ftext.js +4 -3
  23. js/fields-public/02_fbuilder.fcurrency.js +14 -8
  24. js/fields-public/02_fbuilder.fnumber.js +5 -3
  25. js/fields-public/02_fbuilder.fslider.js +1 -1
  26. js/fields-public/03_fbuilder.femail.js +4 -3
  27. js/fields-public/04_fbuilder.fdate.js +119 -106
  28. js/fields-public/05_fbuilder.ftextarea.js +4 -3
  29. js/fields-public/06_fbuilder.fcheck.js +16 -14
  30. js/fields-public/07_fbuilder.fradio.js +25 -19
  31. js/fields-public/08_fbuilder.fdropdown.js +7 -6
  32. js/fields-public/09_fbuilder.ffile.js +1 -1
  33. js/fields-public/10_fbuilder.fpassword.js +7 -6
  34. js/fields-public/11_fbuilder.fphone.js +4 -3
  35. js/fields-public/12_fbuilder.fcommentarea.js +4 -4
  36. js/fields-public/13_fbuilder.fhidden.js +2 -2
  37. js/fields-public/14_fbuilder.fsectionbreak.js +3 -3
  38. js/fields-public/15_fbuilder.fpagebreak.js +2 -2
  39. js/fields-public/16_fbuilder.fsummary.js +10 -8
  40. js/fields-public/28_fbuilder.fcontainer.js +3 -3
  41. js/fields-public/29_fbuilder.ffieldset.fc.js +2 -2
  42. js/fields-public/30_fbuilder.fdiv.fc.js +2 -2
  43. js/fields-public/31_fbuilder.fmedia.js +7 -7
  44. js/fields-public/32_fbuilder.fbutton.js +19 -19
  45. js/fields-public/34_fbuilder.fhtml.js +4 -4
  46. js/fields-public/36_fbuilder.acceptance.js +6 -5
  47. js/fields-public/fbuilder.fcalculated.js +16 -11
  48. templates/11/style.css +2 -0
  49. templates/12/style.css +2 -1
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: codepeople
3
  Donate link: http://cff.dwbooster.com
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
- Tested up to: 4.9
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -114,9 +114,11 @@ The plugin has two additional (commercial) versions: **Premium** and **Developer
114
  * Includes the DropBox Integration add-on to copy or move the uploaded files to a DropBox account.
115
  * Includes the ip2location add-on to identify the users data from the ip2location databases. Requires PHP 5.3 and over.
116
  * Includes the "Google Places" add-on that allows integrate the input fields with the Google Places API to autocomplete the addresses entered by the users.
 
117
  * Includes the "Signature" add-on to convert some form fields in "Signature" fields, allowing the users to sign with the mouse or directly in the touchscreens.
118
  * Includes the "iCal" add-on for sending the users an iCal file as part of the confirmation email after the form submission to be imported into most popular calendars like Outlook and Google Calendar.
119
  * Includes the "WebMerge" add-on to integrate the forms with the WebMerge Service, and generate PDF and Office documents at runtime with the information collected by the forms.
 
120
  * Includes the "MailChimp" add-on to add new members to the MailChimp Service using the data collected by the form.
121
  * Includes the "Emma" add-on to add new members to the Emma Service using the data collected by the form.
122
  * Includes the "Twilio" add-on for sending notification messages (SMS) when the forms are submitted.
@@ -368,6 +370,12 @@ The "Google Places" add-on allows to integrate the input fields with the Google
368
 
369
  [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#google-places-addon "Google Places add-on")
370
 
 
 
 
 
 
 
371
  = Signature add-on - Only available in the Platinum version of the plugin =
372
 
373
  The "Signature" add-on converts the selected fields in "Signature" fields, allowing the users to sign with the mouse or directly in the touchscreens.
@@ -388,6 +396,12 @@ The "WebMerge" add-on integrates the forms with the WebMerge Service, and genera
388
 
389
  The "WebMerge" add-on may be used to instegrate the form with the Silverpop service (today IBM Watson Campaign Automation) [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#silverpop-integration "Silverpop integration")
390
 
 
 
 
 
 
 
391
  = MailChimp add-on - Only available in the Platinum version of the plugin =
392
 
393
  Includes the "MailChimp" add-on to integrate the forms with the MailChimp Service to add new members to the lists.
@@ -878,60 +892,61 @@ A: Please, visit the following entry in our technical blog:
878
 
879
  == Changelog ==
880
 
881
- = 1.0.235 =
882
 
883
- * Modifies the operations: ROUND, CEIL and FLOOR for accepting a second parameter (optional) and rounding the number in multiples of second parameter.
884
- * Modifies the appearance of the forms builder settings in the free version of the plugin.
885
- * The fields' tags to insert into the results shortcodes (paid versions of the plugin) accept a new set of attributes for taking more control about how and whe to include the fields (if_value_is_greater_than, if_value_is_greater_than_or_equal_to, if_value_is_less_than, if_value_is_less_than_or_equal_to, if_value_is, if_value_is_not, if_value_like and if_value_unlike)
886
 
887
- = 1.0.234 =
888
 
889
- * Modifies the code to be compatible with older versions of PHP.
890
 
891
- = 1.0.233 =
892
 
893
- * Fixes an issue generating the revisions table.
 
 
894
 
895
- = 1.0.232 =
896
 
897
- * Includes the revisions module to create different revisions of the forms when they are updated.
898
- * Modifies the code that generates the forms to prevent that uncaugth javascript errors in the webpage affect the forms.
899
 
900
- = 1.0.231 =
901
 
902
- * Fixes an issue in the fields validation.
 
 
 
 
903
 
904
- = 1.0.230 =
905
 
906
- * Validates the values in currency fields.
907
- * Improves the validations in the other controls.
908
- * Improves the code to load the forms in the AMP pages.
909
 
910
- = 1.0.229 =
911
 
912
- * Fixes an issue with dependencies.
 
 
913
 
914
- = 1.0.228 =
915
 
916
- * Modifies the way that the forms builder is loaded to prevent that uncaugth javascript errors can affect it.
917
- * Allows to define a new attribute in the forms shortcode to define the duration of the tooltips on mobiles devices. For example: [CP_CALCULATED_FIELDS id="1" tooltip_duration="10000"], in mobiles devices the tooltip will be displayed for 10 seconds, and then, it will be hidden. The number is defined in milliseconds 10000 is the equivalent to 10 seconds.
918
- * Displays a gif animated when the form is being submitted to allow the users know that it is being processed (Professional, Developer and Platinum versions)
919
 
920
- = 1.0.227 =
921
 
922
- * Fixes an issue with the dependencies.
923
- * Fixes an issue with the filtering conditions in RecordSet fields (Developer and Platinum versions of the plugin).
924
 
925
- = 1.0.226 =
926
 
927
- * Includes two new options in the Form Settings tab for controlling when the equations are evaluated, with the onchage events, or with the onchange and keyup events (the new options give more control over the form's performance).
928
- * Includes the form's id and name in the Forms Builder to facilitate identify the form.
929
- * Allows to configure the form to not capture the users' ip addresses (Professional, Developer and Platinum versions).
930
- * Fixes an issue accepting .rar files with the Uploads add-on(Platinum version).
931
- * Allows to select groups by default in the MailChimp add-on(Platinum version).
932
 
933
  == Upgrade Notice ==
934
 
935
- = 1.0.235 =
936
 
937
  Important note: If you are using the Professional version don't update via the WP dashboard but using your personal update link. Contact us if you need further information: http://cff.dwbooster.com/contact-us
3
  Donate link: http://cff.dwbooster.com
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
+ Tested up to: 5.0
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
114
  * Includes the DropBox Integration add-on to copy or move the uploaded files to a DropBox account.
115
  * Includes the ip2location add-on to identify the users data from the ip2location databases. Requires PHP 5.3 and over.
116
  * Includes the "Google Places" add-on that allows integrate the input fields with the Google Places API to autocomplete the addresses entered by the users.
117
+ * Includes the "Autocomplete Places" add-on that allows integrate the input fields with the Photon API to autocomplete the addresses entered by the users.
118
  * Includes the "Signature" add-on to convert some form fields in "Signature" fields, allowing the users to sign with the mouse or directly in the touchscreens.
119
  * Includes the "iCal" add-on for sending the users an iCal file as part of the confirmation email after the form submission to be imported into most popular calendars like Outlook and Google Calendar.
120
  * Includes the "WebMerge" add-on to integrate the forms with the WebMerge Service, and generate PDF and Office documents at runtime with the information collected by the forms.
121
+ * Includes the "PrintFriendly" add-on to integrate the forms with the PrintFriendly API for generating PDF files after forms submissions, and attach the resulting files to the notification emails.
122
  * Includes the "MailChimp" add-on to add new members to the MailChimp Service using the data collected by the form.
123
  * Includes the "Emma" add-on to add new members to the Emma Service using the data collected by the form.
124
  * Includes the "Twilio" add-on for sending notification messages (SMS) when the forms are submitted.
370
 
371
  [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#google-places-addon "Google Places add-on")
372
 
373
+ = Autocomplete Places add-on - Only available in the Platinum version of the plugin =
374
+
375
+ The "Autocomplete Places" add-on allows to integrate the input fields with the Photon API to autocomplete the addresses entered by the users.
376
+
377
+ [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#autocomplete-places-addon "Autocomplete Places add-on")
378
+
379
  = Signature add-on - Only available in the Platinum version of the plugin =
380
 
381
  The "Signature" add-on converts the selected fields in "Signature" fields, allowing the users to sign with the mouse or directly in the touchscreens.
396
 
397
  The "WebMerge" add-on may be used to instegrate the form with the Silverpop service (today IBM Watson Campaign Automation) [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#silverpop-integration "Silverpop integration")
398
 
399
+ = PrintFriendly add-on - Only available in the Platinum version of the plugin =
400
+
401
+ The "PrintFriendly" add-on integrates the forms with the PrintFriendly API for generating PDF files after the forms submissions, and attach the resulting files to the notification emails.
402
+
403
+ [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#printfriendly-addon "PrintFriendly add-on")
404
+
405
  = MailChimp add-on - Only available in the Platinum version of the plugin =
406
 
407
  Includes the "MailChimp" add-on to integrate the forms with the MailChimp Service to add new members to the lists.
892
 
893
  == Changelog ==
894
 
895
+ = 1.0.263 =
896
 
897
+ * Fixes another conflict with the Speed Booster Pack plugin.
898
+ * Includes a new operation to access easier to the fields, for example to assign a value to the slider field: fieldname1, enter as part of the equation getField(1).setVal(50);
 
899
 
900
+ = 1.0.262 =
901
 
902
+ * Fixes a conflict with the new version of Gutenberg.
903
 
904
+ = 1.0.261 =
905
 
906
+ * Allows read the raw values of every field in the form.
907
+ * Fixes a conflict with some themes that apply a max-width css rule to the form's fields.
908
+ * Fixes a conflict with the Speed Booster Pack plugin.
909
 
910
+ = 1.0.260 =
911
 
912
+ * Fixes an issue in the controls: radio button, checkbox and dropdown.
 
913
 
914
+ = 1.0.259 =
915
 
916
+ * Fixes an issue in the date/time fields that allows select by default an invalid time.
917
+ * Suppports other plugins for managing the AMP versions of pages.
918
+ * Includes other minor changes.
919
+ * Modifies the iCal add-on (Platinum version of plugin)
920
+ * Includes the PrintFriendly add-on (Platinum version of plugin)
921
 
922
+ = 1.0.258 =
923
 
924
+ * Allows to use the Acceptance fields into the equations.
925
+ * Modifies the selector to the tag with the price of the product to replace in the CFF - WooCommerce add-on (Developer and Platinum versions of the plugin)
926
+ * Allows to use other special constants like: submissiondate_mmddyyyy, submissiondate_ddmmyyyy, and ipaddress, in the integration with WebHooks URLs (Developer and Platinum versions of the plugin) and the WebMerge add-on (the Platinum version of the plugin).
927
 
928
+ = 1.0.257 =
929
 
930
+ * Modifies the date/time field doing the time components more coherents, and fixes an issue in the field's validation. Applies the styles for errors to the time components.
931
+ * Applies different class names to the different components in the slider fields to take total control to their visual appearance.
932
+ * Categorizes the add-ons for grouping them in the settings page of the plugin (Developer and Platinum versions of the plugin).
933
 
934
+ = 1.0.256 =
935
 
936
+ * Fixes an issue with Date/Time fields in multi-pages forms. In multi-pages forms if the date/time field is the first one in the page, the datepicker dialog was displayed by default, now this behavior has been solved.
937
+ * Includes the Autocomplete Places add-on, alternative to the Google Places add-on but using the Photon API (Distributed with the Platinum version of the plugin)
 
938
 
939
+ = 1.0.255 =
940
 
941
+ * Fixes an issue with No Cents attribute in the currency fields.
 
942
 
943
+ = 1.0.254 =
944
 
945
+ * Fixes an issue with the values of the checkbox fields when its used the modifier |r in the equations.
946
+ * Fixes an issue in the tags replacements in the thank you pages and notifiation emails (Professional, Developer and Platinum versions)
 
 
 
947
 
948
  == Upgrade Notice ==
949
 
950
+ = 1.0.263 =
951
 
952
  Important note: If you are using the Professional version don't update via the WP dashboard but using your personal update link. Contact us if you need further information: http://cff.dwbooster.com/contact-us
changelog.txt CHANGED
@@ -1,5 +1,156 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.235 =
4
 
5
  * Modifies the operations: ROUND, CEIL and FLOOR for accepting a second parameter (optional) and rounding the number in multiples of second parameter.
1
  == Changelog ==
2
 
3
+ = 1.0.263 =
4
+
5
+ * Fixes another conflict with the Speed Booster Pack plugin.
6
+ * Includes a new operation to access easier to the fields, for example to assign a value to the slider field: fieldname1, enter as part of the equation getField(1).setVal(50);
7
+
8
+ = 1.0.262 =
9
+
10
+ * Fixes a conflict with the new version of Gutenberg.
11
+
12
+ = 1.0.261 =
13
+
14
+ * Allows read the raw values of every field in the form.
15
+ * Fixes a conflict with some themes that apply a max-width css rule to the form's fields.
16
+ * Fixes a conflict with the Speed Booster Pack plugin.
17
+
18
+ = 1.0.260 =
19
+
20
+ * Fixes an issue in the controls: radio button, checkbox and dropdown.
21
+
22
+ = 1.0.259 =
23
+
24
+ * Fixes an issue in the date/time fields that allows select by default an invalid time.
25
+ * Suppports other plugins for managing the AMP versions of pages.
26
+ * Includes other minor changes.
27
+ * Modifies the iCal add-on (Platinum version of plugin)
28
+ * Includes the PrintFriendly add-on (Platinum version of plugin)
29
+
30
+ = 1.0.258 =
31
+
32
+ * Allows to use the Acceptance fields into the equations.
33
+ * Modifies the selector to the tag with the price of the product to replace in the CFF - WooCommerce add-on (Developer and Platinum versions of the plugin)
34
+ * Allows to use other special constants like: submissiondate_mmddyyyy, submissiondate_ddmmyyyy, and ipaddress, in the integration with WebHooks URLs (Developer and Platinum versions of the plugin) and the WebMerge add-on (the Platinum version of the plugin).
35
+
36
+ = 1.0.257 =
37
+
38
+ * Modifies the date/time field doing the time components more coherents, and fixes an issue in the field's validation. Applies the styles for errors to the time components.
39
+ * Applies different class names to the different components in the slider fields to take total control to their visual appearance.
40
+ * Categorizes the add-ons for grouping them in the settings page of the plugin (Developer and Platinum versions of the plugin).
41
+
42
+ = 1.0.256 =
43
+
44
+ * Fixes an issue with Date/Time fields in multi-pages forms. In multi-pages forms if the date/time field is the first one in the page, the datepicker dialog was displayed by default, now this behavior has been solved.
45
+ * Includes the Autocomplete Places add-on, alternative to the Google Places add-on but using the Photon API (Distributed with the Platinum version of the plugin)
46
+
47
+ = 1.0.255 =
48
+
49
+ * Fixes an issue with No Cents attribute in the currency fields.
50
+
51
+ = 1.0.254 =
52
+
53
+ * Fixes an issue with the values of the checkbox fields when its used the modifier |r in the equations.
54
+ * Fixes an issue in the tags replacements in the thank you pages and notifiation emails (Professional, Developer and Platinum versions)
55
+
56
+ = 1.0.253 =
57
+
58
+ * Modifies the currency fields to allow configure them for accepting only the whole part of value and for disabling the cents.
59
+ * Modifies the template 11.
60
+ * Allows to include the Instruct. Text fields in the thank you pages and notification emails (Professional, Developer and Platinum versions of the plugin).
61
+
62
+ = 1.0.252 =
63
+
64
+ * Fixes an issue in the public forms when the general texts are entered with apostrophes, escaping them.
65
+ * Includes new actions and filters.
66
+ * Modifies the code of the plugin to prevent an issue caused with a bug in the isNumeric method of jQuery, present in previous versions of the framework that are still used in many distributions of WordPress.
67
+ * Fixes an issue with the block tags in the notification emails and thank you pages when are associated to DropDown fields configured as multi-select (Professional, Developer and Platinum versions of the plugin).
68
+
69
+ = 1.0.251 =
70
+
71
+ * Modifies the Date/Time control to allow the use of other date formats, as well as the symbol to use as separator between the dates' components.
72
+ * Fixes an issue with the paddings in the Template 11.
73
+ * Modifies the WooCommerce add-on in the Developer and Platinum versions of the plugin, to include a pair of javascript variables with global scope: woocommerce_cpcff_product and woocommerce_cpcff_product_price for the product's id and price, respectively.
74
+
75
+ = 1.0.250 =
76
+
77
+ * Hides the promotion banner for the majority of roles and fixes a conflict between the promotion banner and the Gutenberg editor.
78
+ * Modifies the PayPal Pro add-on (Platinum version of the plugin)
79
+
80
+ = 1.0.249 =
81
+
82
+ * Fixes an issue in the AMP pages when the AMP Takeover option is enabled in the AMPforWP plugin.
83
+ * Fixes an issue in the MailChimp add-on allowing to access to more than 10 lists in Mailchimp (Platinum version of the plugin).
84
+
85
+ = 1.0.248 =
86
+
87
+ * Modifies the integration with the Guetenberg editor, replacing the deprecated methods with the new ones.
88
+ * Includes a new attribute in the PayPal settings for prompting (or not) the buyer's shipping address.
89
+
90
+ = 1.0.247 =
91
+
92
+ * Manages the browser's history to allow moving between the different pages of the multi-pages forms with the next/back buttons on the browser.
93
+ * Modifies the WooCommerce add-on (in the Developer and Platinum versions of the plugin) to pre-fill the fields in the form for the weight, length, width and heigth of product.
94
+
95
+ = 1.0.246 =
96
+
97
+ * Improves the drag and drop of fields into the forms builder.
98
+ * Allows create dependencies with the Section Break controls.
99
+ * Removes obsolete texts from the interface of plugin.
100
+ * Improves the Users Permissions add-on distributed with the Developer and Platinum versions of the plugin.
101
+ * Modifies the data-source controls in the Developer and Platinum versions of the plugin, implementing the connection to databases using PDO, allowing to read the data from multiple database engines, like: MySQL, Postgresql, MSSQL Server, SQLite, and many others.
102
+
103
+ = 1.0.245 =
104
+
105
+ * Modifies the currency and number controls to not apply the format to the default values when corresponding the checkbox is unticked.
106
+ * Solves some issues with the dependencies.
107
+ * Solves some accessibility issues, like labels without 'for' attributes or multiple elements with the same id.
108
+
109
+ = 1.0.244 =
110
+
111
+ * Fixes an issue with themes that include Bootstrap.
112
+ * Fixes an issue with the forms' previews when the classic option is selected for loading the plugin's resources.
113
+
114
+ = 1.0.243 =
115
+
116
+ * Modifies the Summary control to solve an issue when are left the fields in blank.
117
+ * Modifies the AMP versions of forms, and forms' previews to solve an issue with other plugins and themes like DIVI.
118
+
119
+ = 1.0.242 =
120
+
121
+ * Fixes an issue with a column in the plugin's database.
122
+
123
+ = 1.0.241 =
124
+
125
+ * Fixes an issue in the equations, when the values of fields include backslash symbols.
126
+
127
+ = 1.0.240 =
128
+
129
+ * Includes a new attribute in Radio Buttons and Radio Buttons DS fields to allow tick/untick the choices (similar to the checkboxes), or preserve the radio buttons default behavior.
130
+ * The plugin tries to extract numbers from the fields values to be used in the equations. This update allows to use a modifier with the fields' names in the equations to use the fields' values without processing. Ex: fieldname1|r (|r for raw)
131
+
132
+ = 1.0.239 =
133
+
134
+ * Removes some notices generated in the use of dbDelta function.
135
+ * Fixes another issue cloning the forms.
136
+
137
+ = 1.0.238 =
138
+
139
+ * Removes a notice when a form is cloned.
140
+
141
+ = 1.0.237 =
142
+
143
+ * Modifies the create table queries in the plugin's core and add-ons to reduce and optimize the database's queries.
144
+ * Fixes a little issue with the currency and number fields that not allows clear the fields' values.
145
+ * Fixes an issue with the attribute: if_value_is_not in the fields' tags of notification emails and thank you pages.
146
+
147
+ = 1.0.236 =
148
+
149
+ * Prevents possible conflicts with other plugins in the forms preview.
150
+ * Allows edit the forms submissions from the Messages section (Professional, Developer and Platinum versions of the plugin).
151
+ * Supports nested shortcodes into the content of the shortcodes: [CP_CALCULATED_FIELDS_RESULT] and [CP_CALCULATED_FIELDS_RESULT_LIST] (Professional, Developer and Platinum versions of the plugin).
152
+ * Modifies the Signature add-on, allowing to load the signature fields in the forms preview, and fixes an issue displaying the signature images in the messages section (Platinum version).
153
+
154
  = 1.0.235 =
155
 
156
  * Modifies the operations: ROUND, CEIL and FLOOR for accepting a second parameter (optional) and rounding the number in multiples of second parameter.
cp_calculatedfieldsf_free.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
- Version: 1.0.235
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
@@ -20,7 +20,7 @@ require_once 'inc/cpcff_session.inc.php';
20
  if( !defined('DOING_AJAX') ) CP_SESSION::session_start();
21
 
22
  // Defining main constants
23
- define('CP_CALCULATEDFIELDSF_VERSION', '1.0.235' );
24
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
25
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
26
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
+ Version: 1.0.263
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
20
  if( !defined('DOING_AJAX') ) CP_SESSION::session_start();
21
 
22
  // Defining main constants
23
+ define('CP_CALCULATEDFIELDSF_VERSION', '1.0.263' );
24
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
25
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
26
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
css/style.css CHANGED
@@ -7,6 +7,7 @@
7
  .ctrlsColumn.expanded{min-width:380px;width:75%;position:absolute;}
8
  .ctrlsColumn .expand-shrink{float:right;margin:8px 5px 0px 0px;cursor:pointer;}
9
  .dashboardColumn{ width:calc(100% - 400px); }
 
10
  .width50{width:48%}
11
  .width20{width:24%}
12
  .width40{width:40%}
@@ -45,7 +46,7 @@
45
  .addComplexRule{cursor:pointer;}
46
  .cf_dependence_rule{width:calc( 100% - 100px );width:-webkit-calc( 100% - 100px );width:-moz-calc( 100% - 100px );width:-o-calc( 100% - 100px );}
47
 
48
- .choice-ctrls{float:right;margin-top:5px;}
49
  .choice-ctrls *{float:left;cursor:pointer;}
50
 
51
  .calc_dependent{width:150px;}
@@ -188,4 +189,6 @@ a.helpfbuilder{font-size:80%;text-decoration:underline;color:#00f;cursor:pointer
188
  #metabox_basic_settings1 * ,
189
  #metabox_basic_settings2 * ,
190
  #metabox_basic_settings3 * ,
191
- #metabox_basic_settings4 * {color:#bfbdbd91 !important;pointer-events: none !important;}
 
 
7
  .ctrlsColumn.expanded{min-width:380px;width:75%;position:absolute;}
8
  .ctrlsColumn .expand-shrink{float:right;margin:8px 5px 0px 0px;cursor:pointer;}
9
  .dashboardColumn{ width:calc(100% - 400px); }
10
+ .width100{width:100%}
11
  .width50{width:48%}
12
  .width20{width:24%}
13
  .width40{width:40%}
46
  .addComplexRule{cursor:pointer;}
47
  .cf_dependence_rule{width:calc( 100% - 100px );width:-webkit-calc( 100% - 100px );width:-moz-calc( 100% - 100px );width:-o-calc( 100% - 100px );}
48
 
49
+ .choice-ctrls{float:right;/* margin-top:5px; */}
50
  .choice-ctrls *{float:left;cursor:pointer;}
51
 
52
  .calc_dependent{width:150px;}
189
  #metabox_basic_settings1 * ,
190
  #metabox_basic_settings2 * ,
191
  #metabox_basic_settings3 * ,
192
+ #metabox_basic_settings4 * {color:#bfbdbd91 !important;pointer-events: none !important;}
193
+ .cff-addons-category{display:inline-block;font-weight:bold;text-transform:capitalize;border-bottom:1px solid #eee;margin-bottom:10px;padding-bottom:5px;}
194
+ .cff-addons-category:not(:first-child){margin-top:20px;}
css/stylepublic.css CHANGED
@@ -9,12 +9,13 @@
9
  #fbuilder input[type="date"],
10
  #fbuilder input[type="datetime"],
11
  #fbuilder input[type="email"],
 
12
  #fbuilder input[type="number"],
13
  #fbuilder input[type="search"],
14
  #fbuilder input[type="time"],
15
  #fbuilder input[type="url"],
16
  #fbuilder textarea,
17
- #fbuilder select {width:auto;display:inline-block;}
18
 
19
  #fbuilder .small{width:25% !important;}
20
  #fbuilder .medium{width:50% !important;}
@@ -72,7 +73,10 @@
72
  #fbuilder .right_aligned .comment_area.fields label,
73
  #fbuilder .right_aligned .cff-html-field .dfield{width:100%;clear:both;}
74
 
75
- #fbuilder .cpefb_error{border:1px solid red;color:red !important;}
 
 
 
76
  #fbuilder .top_aligned .fields label.cpefb_error,.left_aligned .fields label.cpefb_error,.right_aligned .fields label.cpefb_error{display:block;border:0px;color:#f00;float:none;}
77
 
78
  #fbuilder div.cpefb_error{background:#FDF9E5;border:1px solid #f00;opacity:0.9;margin-top:7px;position:relative;padding:0px 5px;z-index:1000;}
9
  #fbuilder input[type="date"],
10
  #fbuilder input[type="datetime"],
11
  #fbuilder input[type="email"],
12
+ #fbuilder input[type="password"],
13
  #fbuilder input[type="number"],
14
  #fbuilder input[type="search"],
15
  #fbuilder input[type="time"],
16
  #fbuilder input[type="url"],
17
  #fbuilder textarea,
18
+ #fbuilder select {width:auto;display:inline-block;max-width:none;}
19
 
20
  #fbuilder .small{width:25% !important;}
21
  #fbuilder .medium{width:50% !important;}
73
  #fbuilder .right_aligned .comment_area.fields label,
74
  #fbuilder .right_aligned .cff-html-field .dfield{width:100%;clear:both;}
75
 
76
+ #fbuilder .cpefb_error,
77
+ #fbuilder .cpefb_error+select,
78
+ #fbuilder .cpefb_error+select+select,
79
+ #fbuilder .cpefb_error+select+select+select{border:1px solid red;color:red !important;}
80
  #fbuilder .top_aligned .fields label.cpefb_error,.left_aligned .fields label.cpefb_error,.right_aligned .fields label.cpefb_error{display:block;border:0px;color:#f00;float:none;}
81
 
82
  #fbuilder div.cpefb_error{background:#FDF9E5;border:1px solid #f00;opacity:0.9;margin-top:7px;position:relative;padding:0px 5px;z-index:1000;}
inc/cpcff_admin_int.inc.php CHANGED
@@ -126,13 +126,6 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
126
  f.fBuild.addItem($calculatedfieldsfQuery(this).attr("id"));
127
  });
128
 
129
- $calculatedfieldsfQuery( ".itemForm" ).draggable({revert1: "invalid",helper: "clone",cursor: "move"});
130
- $calculatedfieldsfQuery( "#fbuilder" ).droppable({
131
- accept: ".button",
132
- drop: function( event, ui ) {
133
- f.fBuild.addItem(ui.draggable.attr("id"));
134
- }
135
- });
136
  jQuery("#metabox_basic_settings0,#metabox_basic_settings1,#metabox_basic_settings2,#metabox_basic_settings3,#metabox_basic_settings4")
137
  .click( function(){
138
  if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
@@ -476,7 +469,17 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
476
  </select>
477
  </td>
478
  </tr>
479
-
 
 
 
 
 
 
 
 
 
 
480
  </table>
481
 
482
  </div>
126
  f.fBuild.addItem($calculatedfieldsfQuery(this).attr("id"));
127
  });
128
 
 
 
 
 
 
 
 
129
  jQuery("#metabox_basic_settings0,#metabox_basic_settings1,#metabox_basic_settings2,#metabox_basic_settings3,#metabox_basic_settings4")
130
  .click( function(){
131
  if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
469
  </select>
470
  </td>
471
  </tr>
472
+ <tr valign="top">
473
+ <th scope="row"><?php _e( 'Paypal prompt buyers for shipping address', 'calculated-fields-form' ); ?></th>
474
+ <td>
475
+ <?php $paypal_address = $form_obj->get_option('paypal_address', 1); ?>
476
+ <select name="paypal_address">
477
+ <option value="1" <?php if($paypal_address == 1) print 'SELECTED'; ?>><?php _e('Do not prompt for an address', 'calculated-fields-form'); ?></option>
478
+ <option value="0" <?php if($paypal_address == 0) print 'SELECTED'; ?>><?php _e('Prompt for an address, but do not require one', 'calculated-fields-form'); ?></option>
479
+ <option value="2" <?php if($paypal_address == 2) print 'SELECTED'; ?>><?php _e('Prompt for an address and require one', 'calculated-fields-form'); ?></option>
480
+ </select>
481
+ </td>
482
+ </tr>
483
  </table>
484
 
485
  </div>
inc/cpcff_amp.inc.php CHANGED
@@ -86,7 +86,21 @@ if(!class_exists('CPCFF_AMP'))
86
  $message = $this->_main_obj->public_form($atts);
87
  $message = preg_replace('/<form\s+/i', '<form target="_parent" ', $message, 1);
88
  ob_start();
89
- wp_footer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  $message .= ob_get_contents();
91
  ob_end_clean();
92
  }
@@ -112,10 +126,14 @@ if(!class_exists('CPCFF_AMP'))
112
  */
113
  public function is_amp()
114
  {
115
- if( function_exists('ampforwp_is_amp_endpoint') ) return ampforwp_is_amp_endpoint();
116
- elseif( function_exists('is_amp_endpoint') )
117
  {
118
- if(defined('AMP_QUERY_VAR')) return is_amp_endpoint();
 
 
 
 
119
  }
120
  return false;
121
  } // End is_amp
@@ -140,7 +158,7 @@ if(!class_exists('CPCFF_AMP'))
140
 
141
  if(empty($height)) $height = 500;
142
 
143
- $url .= '&cff-form-height='.$height;
144
 
145
  // Fixing the isseu with the origin policy in the amp-iframes
146
  if(preg_match('/^https:\/\/www\./i', $url)) $url = preg_replace('/^https:\/\/www\./i', 'https://', $url);
86
  $message = $this->_main_obj->public_form($atts);
87
  $message = preg_replace('/<form\s+/i', '<form target="_parent" ', $message, 1);
88
  ob_start();
89
+
90
+ if(
91
+ function_exists('wp_print_styles') &&
92
+ function_exists('wp_print_scripts')
93
+ )
94
+ {
95
+ wp_print_styles();
96
+ wp_print_scripts();
97
+ do_action('cpcff_footer');
98
+ }
99
+ else
100
+ {
101
+ wp_footer();
102
+ }
103
+
104
  $message .= ob_get_contents();
105
  ob_end_clean();
106
  }
126
  */
127
  public function is_amp()
128
  {
129
+ if(!empty($_REQUEST['isamp'])) return true;
130
+ if(empty($_GET['non-amp']))
131
  {
132
+ if( function_exists('ampforwp_is_amp_endpoint') ) return ampforwp_is_amp_endpoint();
133
+ elseif( function_exists('is_amp_endpoint') )
134
+ {
135
+ if(defined('AMP_QUERY_VAR')) return is_amp_endpoint();
136
+ }
137
  }
138
  return false;
139
  } // End is_amp
158
 
159
  if(empty($height)) $height = 500;
160
 
161
+ $url .= '&cff-form-height='.$height.'&non-amp=1';
162
 
163
  // Fixing the isseu with the origin policy in the amp-iframes
164
  if(preg_match('/^https:\/\/www\./i', $url)) $url = preg_replace('/^https:\/\/www\./i', 'https://', $url);
inc/cpcff_banner.inc.php CHANGED
@@ -11,8 +11,15 @@ if(!function_exists( 'codepeople_add_promote_banner' ))
11
  function codepeople_add_promote_banner($wp_admin_bar)
12
  {
13
  global $codepeople_promote_banner_plugins;
14
-
15
- if( empty($codepeople_promote_banner_plugins) || !is_admin() ) return;
 
 
 
 
 
 
 
16
 
17
  // Take action over the banner
18
  if(
11
  function codepeople_add_promote_banner($wp_admin_bar)
12
  {
13
  global $codepeople_promote_banner_plugins;
14
+ if(
15
+ empty($codepeople_promote_banner_plugins) ||
16
+ !is_admin() ||
17
+ !current_user_can( 'manage_options' ) ||
18
+ (
19
+ function_exists( 'is_gutenberg_page' ) &&
20
+ is_gutenberg_page()
21
+ )
22
+ ) return;
23
 
24
  // Take action over the banner
25
  if(
inc/cpcff_install_uninstall.inc.php CHANGED
@@ -89,13 +89,15 @@ if(!class_exists('CPCFF_INSTALLER'))
89
  */
90
  private static function _db_structure()
91
  {
 
 
92
  global $wpdb;
93
  $charset_collate = $wpdb->get_charset_collate();
94
- $charset_collate_column = preg_replace('/default/i', ' ', $charset_collate);
 
95
 
96
  // Posts table
97
- $table_name = $wpdb->prefix.CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX;
98
- $sql = "CREATE TABLE IF NOT EXISTS ".$table_name." (
99
  id mediumint(9) NOT NULL AUTO_INCREMENT,
100
  formid INT NOT NULL,
101
  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
@@ -106,26 +108,9 @@ if(!class_exists('CPCFF_INSTALLER'))
106
  paid INT DEFAULT 0 NOT NULL,
107
  UNIQUE KEY id (id)
108
  ) $charset_collate;";
109
- $result = $wpdb->query($sql);
110
-
111
- // Alters the posts table for compatibility with old versions of the plugin
112
- $alterate_columns = array(
113
- 'data' => "mediumtext $charset_collate_column",
114
- 'paypal_post' => "mediumtext $charset_collate_column",
115
- 'ipaddr' => "VARCHAR(41) $charset_collate_column DEFAULT \"\" NOT NULL"
116
- );
117
-
118
- $sql = "ALTER TABLE `".$table_name."`";
119
- $separator = "";
120
- foreach( $alterate_columns as $column_name => $column_structure )
121
- {
122
- $sql .= $separator." MODIFY `".$column_name."` ".$column_structure;
123
- $separator = ",";
124
- }
125
- $wpdb->query($sql);
126
 
127
  // Discounts table
128
- $sql = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix.CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX." (
129
  id mediumint(9) NOT NULL AUTO_INCREMENT,
130
  form_id mediumint(9) NOT NULL DEFAULT 1,
131
  code VARCHAR(250) DEFAULT '' NOT NULL,
@@ -135,17 +120,12 @@ if(!class_exists('CPCFF_INSTALLER'))
135
  used int(10) unsigned NOT NULL DEFAULT 0,
136
  UNIQUE KEY id (id)
137
  ) $charset_collate;";
138
- $wpdb->query($sql);
139
 
140
  // Forms structures table
141
- $table_name = $wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE;
142
- $sql = "CREATE TABLE IF NOT EXISTS $table_name (
143
  id mediumint(9) NOT NULL AUTO_INCREMENT,
144
-
145
  form_name VARCHAR(250) DEFAULT '' NOT NULL,
146
-
147
  form_structure mediumtext,
148
-
149
  fp_from_email VARCHAR(250) DEFAULT '' NOT NULL,
150
  fp_destination_emails TEXT,
151
  fp_subject VARCHAR(250) DEFAULT '' NOT NULL,
@@ -153,17 +133,14 @@ if(!class_exists('CPCFF_INSTALLER'))
153
  fp_return_page VARCHAR(250) DEFAULT '' NOT NULL,
154
  fp_message mediumtext,
155
  fp_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
156
-
157
  cu_enable_copy_to_user VARCHAR(10) DEFAULT '' NOT NULL,
158
  cu_user_email_field TEXT DEFAULT '' NOT NULL,
159
  cu_subject VARCHAR(250) DEFAULT '' NOT NULL,
160
  cu_message mediumtext,
161
  cu_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
162
  fp_emailfrommethod VARCHAR(10) DEFAULT '' NOT NULL,
163
-
164
  enable_paypal_option_yes VARCHAR(250) DEFAULT '' NOT NULL,
165
  enable_paypal_option_no VARCHAR(250) DEFAULT '' NOT NULL,
166
-
167
  vs_use_validation VARCHAR(10) DEFAULT '' NOT NULL,
168
  vs_text_is_required VARCHAR(250) DEFAULT '' NOT NULL,
169
  vs_text_is_email VARCHAR(250) DEFAULT '' NOT NULL,
@@ -177,7 +154,6 @@ if(!class_exists('CPCFF_INSTALLER'))
177
  vs_text_previousbtn VARCHAR(250) DEFAULT '' NOT NULL,
178
  vs_text_nextbtn VARCHAR(250) DEFAULT '' NOT NULL,
179
  vs_all_texts text DEFAULT '' NOT NULL,
180
-
181
  enable_paypal varchar(10) DEFAULT '' NOT NULL,
182
  enable_submit varchar(10) DEFAULT '' NOT NULL,
183
  paypal_notiemails varchar(10) DEFAULT '' NOT NULL,
@@ -193,7 +169,7 @@ if(!class_exists('CPCFF_INSTALLER'))
193
  paypal_identify_prices varchar(20) DEFAULT '' NOT NULL ,
194
  paypal_zero_payment varchar(10) DEFAULT '' NOT NULL ,
195
  paypal_base_amount VARCHAR(250),
196
-
197
  cv_enable_captcha VARCHAR(20) DEFAULT '' NOT NULL,
198
  cv_width VARCHAR(20) DEFAULT '' NOT NULL,
199
  cv_height VARCHAR(20) DEFAULT '' NOT NULL,
@@ -206,71 +182,24 @@ if(!class_exists('CPCFF_INSTALLER'))
206
  cv_background VARCHAR(20) DEFAULT '' NOT NULL,
207
  cv_border VARCHAR(20) DEFAULT '' NOT NULL,
208
  cv_text_enter_valid_captcha VARCHAR(200) DEFAULT '' NOT NULL,
209
-
210
  UNIQUE KEY id (id)
211
  ) $charset_collate;";
212
- $wpdb->query($sql);
213
-
214
- // Alters the forms table for compatibility with old versions of the plugin
215
- $alterate_columns = array(
216
- 'form_structure' => "mediumtext $charset_collate_column",
217
- 'fp_message' => "mediumtext $charset_collate_column",
218
- 'cu_message' => "mediumtext $charset_collate_column"
219
- );
220
-
221
- $sql = "ALTER TABLE `".$table_name."`";
222
- $separator = "";
223
- foreach( $alterate_columns as $column_name => $column_structure )
224
- {
225
- $sql .= $separator." MODIFY `".$column_name."` ".$column_structure;
226
- $separator = ",";
227
- }
228
- $wpdb->query($sql);
229
-
230
- $columns = $wpdb->get_results("SHOW columns FROM `".$table_name."`");
231
- $columns_list = array();
232
- foreach( $columns as $column )
233
- $columns_list[] = $column->Field;
234
-
235
- $new_columns = array(
236
- 'fp_emailfrommethod' => "varchar(10) $charset_collate_column NOT NULL default ''",
237
- 'paypal_notiemails' => "varchar(20) $charset_collate_column NOT NULL default ''",
238
- 'enable_submit' => "varchar(10) $charset_collate_column NOT NULL default ''",
239
- 'vs_text_submitbtn' => "varchar(250) $charset_collate_column NOT NULL default ''",
240
- 'vs_text_previousbtn' => "varchar(250) $charset_collate_column NOT NULL default ''",
241
- 'vs_text_nextbtn' => "varchar(250) $charset_collate_column NOT NULL default ''",
242
- 'vs_all_texts' => "text $charset_collate_column NOT NULL default ''",
243
- 'cache' => "text $charset_collate_column DEFAULT '' NOT NULL",
244
- 'enable_paypal_option_yes' => "varchar(250) $charset_collate_column DEFAULT '' NOT NULL",
245
- 'enable_paypal_option_no' => "varchar(250) $charset_collate_column DEFAULT '' NOT NULL",
246
- 'paypal_base_amount' => "varchar(250) $charset_collate_column",
247
- 'paypal_recurrent_setup' => "varchar(25) $charset_collate_column",
248
- 'paypal_recurrent_setup_days' => "varchar(25) $charset_collate_column"
249
- );
250
- $sql = "";
251
- $separator = "ALTER TABLE `".$table_name."`";
252
- foreach( $new_columns as $column_name => $column_structure )
253
- {
254
- if( !in_array( $column_name, $columns_list ) )
255
- {
256
- $sql .= $separator." ADD `".$column_name."` ".$column_structure;
257
- $separator = ",";
258
- }
259
- }
260
- if(!empty($sql)) $wpdb->query($sql);
261
-
262
- // Insert the predefined forms into the forms table
263
- self::_predefined_forms();
264
 
265
  // Revisions table
266
- $sql = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE." (
267
  id mediumint(9) NOT NULL AUTO_INCREMENT,
268
  formid mediumint(9) NOT NULL,
269
  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
270
  revision longtext NOT NULL,
271
  UNIQUE KEY id (id)
272
  ) $charset_collate;";
273
- $wpdb->query($sql);
 
 
 
 
 
274
  } // End _db_structure
275
 
276
  /**
89
  */
90
  private static function _db_structure()
91
  {
92
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
93
+
94
  global $wpdb;
95
  $charset_collate = $wpdb->get_charset_collate();
96
+
97
+ $db_queries = array();
98
 
99
  // Posts table
100
+ $db_queries[] = "CREATE TABLE ".$wpdb->prefix.CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX." (
 
101
  id mediumint(9) NOT NULL AUTO_INCREMENT,
102
  formid INT NOT NULL,
103
  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
108
  paid INT DEFAULT 0 NOT NULL,
109
  UNIQUE KEY id (id)
110
  ) $charset_collate;";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  // Discounts table
113
+ $db_queries[] = "CREATE TABLE ".$wpdb->prefix.CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX." (
114
  id mediumint(9) NOT NULL AUTO_INCREMENT,
115
  form_id mediumint(9) NOT NULL DEFAULT 1,
116
  code VARCHAR(250) DEFAULT '' NOT NULL,
120
  used int(10) unsigned NOT NULL DEFAULT 0,
121
  UNIQUE KEY id (id)
122
  ) $charset_collate;";
 
123
 
124
  // Forms structures table
125
+ $db_queries[] = "CREATE TABLE ".$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE." (
 
126
  id mediumint(9) NOT NULL AUTO_INCREMENT,
 
127
  form_name VARCHAR(250) DEFAULT '' NOT NULL,
 
128
  form_structure mediumtext,
 
129
  fp_from_email VARCHAR(250) DEFAULT '' NOT NULL,
130
  fp_destination_emails TEXT,
131
  fp_subject VARCHAR(250) DEFAULT '' NOT NULL,
133
  fp_return_page VARCHAR(250) DEFAULT '' NOT NULL,
134
  fp_message mediumtext,
135
  fp_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
 
136
  cu_enable_copy_to_user VARCHAR(10) DEFAULT '' NOT NULL,
137
  cu_user_email_field TEXT DEFAULT '' NOT NULL,
138
  cu_subject VARCHAR(250) DEFAULT '' NOT NULL,
139
  cu_message mediumtext,
140
  cu_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
141
  fp_emailfrommethod VARCHAR(10) DEFAULT '' NOT NULL,
 
142
  enable_paypal_option_yes VARCHAR(250) DEFAULT '' NOT NULL,
143
  enable_paypal_option_no VARCHAR(250) DEFAULT '' NOT NULL,
 
144
  vs_use_validation VARCHAR(10) DEFAULT '' NOT NULL,
145
  vs_text_is_required VARCHAR(250) DEFAULT '' NOT NULL,
146
  vs_text_is_email VARCHAR(250) DEFAULT '' NOT NULL,
154
  vs_text_previousbtn VARCHAR(250) DEFAULT '' NOT NULL,
155
  vs_text_nextbtn VARCHAR(250) DEFAULT '' NOT NULL,
156
  vs_all_texts text DEFAULT '' NOT NULL,
 
157
  enable_paypal varchar(10) DEFAULT '' NOT NULL,
158
  enable_submit varchar(10) DEFAULT '' NOT NULL,
159
  paypal_notiemails varchar(10) DEFAULT '' NOT NULL,
169
  paypal_identify_prices varchar(20) DEFAULT '' NOT NULL ,
170
  paypal_zero_payment varchar(10) DEFAULT '' NOT NULL ,
171
  paypal_base_amount VARCHAR(250),
172
+ paypal_address TINYINT DEFAULT 1 NOT NULL,
173
  cv_enable_captcha VARCHAR(20) DEFAULT '' NOT NULL,
174
  cv_width VARCHAR(20) DEFAULT '' NOT NULL,
175
  cv_height VARCHAR(20) DEFAULT '' NOT NULL,
182
  cv_background VARCHAR(20) DEFAULT '' NOT NULL,
183
  cv_border VARCHAR(20) DEFAULT '' NOT NULL,
184
  cv_text_enter_valid_captcha VARCHAR(200) DEFAULT '' NOT NULL,
185
+ cache text DEFAULT '' NOT NULL,
186
  UNIQUE KEY id (id)
187
  ) $charset_collate;";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
 
189
  // Revisions table
190
+ $db_queries[] = "CREATE TABLE ".$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE." (
191
  id mediumint(9) NOT NULL AUTO_INCREMENT,
192
  formid mediumint(9) NOT NULL,
193
  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
194
  revision longtext NOT NULL,
195
  UNIQUE KEY id (id)
196
  ) $charset_collate;";
197
+
198
+ dbDelta($db_queries); // Running the queries
199
+
200
+ // Insert the predefined forms into the forms table
201
+ self::_predefined_forms();
202
+
203
  } // End _db_structure
204
 
205
  /**
inc/cpcff_main.inc.php CHANGED
@@ -109,6 +109,9 @@ if(!class_exists('CPCFF_MAIN'))
109
  // Run the initialization code of widgets
110
  add_action( 'widgets_init', array($this, 'widgets_init'), 1 );
111
 
 
 
 
112
  } // End __construct
113
 
114
  /**
@@ -296,7 +299,7 @@ if(!class_exists('CPCFF_MAIN'))
296
  */
297
  public function gutenberg_editor()
298
  {
299
- wp_enqueue_script( 'cp_calculatedfieldsf_gutenberg_editor', plugins_url('/js/cp_calculatedfieldsf_gutenberg.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH), array('wp-blocks', 'wp-element'));
300
  } // End gutenberg_editor
301
 
302
  /**
@@ -380,9 +383,32 @@ if(!class_exists('CPCFF_MAIN'))
380
  {
381
  if(isset($atts['shortcode_atts']))
382
  {
 
 
 
 
 
 
 
 
 
383
  $message = $this->public_form($atts['shortcode_atts']);
384
  ob_start();
385
- wp_footer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  $message .= ob_get_contents();
387
  ob_end_clean();
388
  $page_title = (!empty($atts['page_title'])) ? $atts['page_title'] : '';
@@ -593,14 +619,14 @@ if(!class_exists('CPCFF_MAIN'))
593
  {
594
  if(!isset($this->_forms[$id])) $this->_forms[$id] = new CPCFF_FORM($id);
595
  $cloned_form = $this->_forms[$id]->clone_form();
596
- if($clone_form)
597
  {
598
  /**
599
  * Passes as parameter the original form's id, and the new form's id
600
  */
601
- do_action( 'cpcff_clone_form', $id, $clone_form->get_id());
602
  }
603
- return $clone_form;
604
  } // End clone_form
605
 
606
  /*********************************** PRIVATE METHODS ********************************************/
@@ -823,5 +849,21 @@ if(!class_exists('CPCFF_MAIN'))
823
  <?php
824
  }
825
  } // End _public_resources
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
  } // End CPCFF_MAIN
827
  }
109
  // Run the initialization code of widgets
110
  add_action( 'widgets_init', array($this, 'widgets_init'), 1 );
111
 
112
+ // Fix different troubleshoots
113
+ $this->troubleshoots();
114
+
115
  } // End __construct
116
 
117
  /**
299
  */
300
  public function gutenberg_editor()
301
  {
302
+ wp_enqueue_script( 'cp_calculatedfieldsf_gutenberg_editor', plugins_url('/js/cp_calculatedfieldsf_gutenberg.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH));
303
  } // End gutenberg_editor
304
 
305
  /**
383
  {
384
  if(isset($atts['shortcode_atts']))
385
  {
386
+ global $wp_scripts;
387
+ try
388
+ {
389
+ foreach($wp_scripts->registered as $registered)
390
+ {
391
+ wp_dequeue_script($registered->handle);
392
+ }
393
+
394
+ } catch(Exception $err){}
395
  $message = $this->public_form($atts['shortcode_atts']);
396
  ob_start();
397
+
398
+ if(
399
+ function_exists('wp_print_styles') &&
400
+ function_exists('wp_print_scripts')
401
+ )
402
+ {
403
+ wp_print_styles();
404
+ wp_print_scripts();
405
+ do_action('cpcff_footer');
406
+ }
407
+ else
408
+ {
409
+ wp_footer();
410
+ }
411
+
412
  $message .= ob_get_contents();
413
  ob_end_clean();
414
  $page_title = (!empty($atts['page_title'])) ? $atts['page_title'] : '';
619
  {
620
  if(!isset($this->_forms[$id])) $this->_forms[$id] = new CPCFF_FORM($id);
621
  $cloned_form = $this->_forms[$id]->clone_form();
622
+ if($cloned_form)
623
  {
624
  /**
625
  * Passes as parameter the original form's id, and the new form's id
626
  */
627
+ do_action( 'cpcff_clone_form', $id, $cloned_form->get_id());
628
  }
629
+ return $cloned_form;
630
  } // End clone_form
631
 
632
  /*********************************** PRIVATE METHODS ********************************************/
849
  <?php
850
  }
851
  } // End _public_resources
852
+
853
+ /** TROUBLESHOOTS SECTION **/
854
+ private function troubleshoots()
855
+ {
856
+ if(!$this->_is_admin)
857
+ {
858
+ // Solves a conflict caused by the "Speed Booster Pack" plugin
859
+ add_filter('option_sbp_settings', 'CPCFF_MAIN::speed_booster_pack_troubleshoot');
860
+ }
861
+ } // End troubleshoots
862
+
863
+ public static function speed_booster_pack_troubleshoot($option)
864
+ {
865
+ if(is_array($option) && isset($option['jquery_to_footer'])) unset($option['jquery_to_footer']);
866
+ return $option;
867
+ } // End speed_booster_pack_troubleshoot
868
  } // End CPCFF_MAIN
869
  }
inc/cpcff_public_int.inc.php CHANGED
@@ -49,7 +49,7 @@ if( !empty( $form_data ) )
49
  ?>
50
  <form name="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" id="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" action="?" method="post" enctype="multipart/form-data" class="<?php
51
  if(!empty($form_data[1][0]) && !empty($form_data[1][0]->persistence)) echo ' persist-form';
52
- if(!empty($atts) && !empty($atts['class'])) echo ' '.$atts['class'];
53
  ?>"><input type="hidden" name="cp_calculatedfieldsf_id" value="<?php echo $id; ?>" /><pre style="display:none;"><!--noptimize--><script>form_structure_<?php echo CPCFF_MAIN::$form_counter; ?>=<?php print str_replace( array( "\n", "\r" ), " ", ((version_compare(CP_CFF_PHPVERSION,"5.3.0")>=0)?json_encode($form_data, JSON_HEX_QUOT|JSON_HEX_TAG):json_encode($form_data)) ); ?>;</script><!--/noptimize--></pre>
54
  <div id="fbuilder">
55
  <div id="fbuilder_<?php echo CPCFF_MAIN::$form_counter; ?>">
49
  ?>
50
  <form name="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" id="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" action="?" method="post" enctype="multipart/form-data" class="<?php
51
  if(!empty($form_data[1][0]) && !empty($form_data[1][0]->persistence)) echo ' persist-form';
52
+ if(!empty($atts) && !empty($atts['class'])) echo ' '.esc_attr($atts['class']);
53
  ?>"><input type="hidden" name="cp_calculatedfieldsf_id" value="<?php echo $id; ?>" /><pre style="display:none;"><!--noptimize--><script>form_structure_<?php echo CPCFF_MAIN::$form_counter; ?>=<?php print str_replace( array( "\n", "\r" ), " ", ((version_compare(CP_CFF_PHPVERSION,"5.3.0")>=0)?json_encode($form_data, JSON_HEX_QUOT|JSON_HEX_TAG):json_encode($form_data)) ); ?>;</script><!--/noptimize--></pre>
54
  <div id="fbuilder">
55
  <div id="fbuilder_<?php echo CPCFF_MAIN::$form_counter; ?>">
js/cp_calculatedfieldsf_gutenberg.js CHANGED
@@ -1,144 +1,147 @@
1
- ( function( blocks, element ) {
2
- var el = element.createElement,
3
- source = blocks.source,
4
- InspectorControls = blocks.InspectorControls,
5
- category = {slug:'cp-calculated-fields-form', title : 'Calculated Fields Form'};
 
6
 
7
- /* Plugin Category */
8
- blocks.getCategories().push({slug: 'cpcff', title: 'Calculated Fields Form'});
9
 
10
- /* ICONS */
11
- const iconCPCFF = el('img', { width: 20, height: 20, src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAGdJREFUOI1jnHnk3X8GKgAmahhCVYNYGBgYGDq3PqLIkHJvOeq5iHHQBTYLjIEcTuXecgydWx8xMDISNqDMSw7VIHTAyMjAcKdVH68hKtUX4Wzqew0d/P+PaiMhQLVYGw1swmDwZREAIzIpNydZa8YAAAAASUVORK5CYII=" } );
12
 
13
- const iconCPCFFV = el('img', { width: 20, height: 20, src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAIhJREFUOI1jnHnk3X8GKgAmahhCVYNYkDlp1oIkaZ519D2cjeEi5aqLDMpVF3FqxiWP1Wt32/RxGoRLDmcYYbMVn0txGnS3TR9Fo3LVRbwuZcEpg2YYPkPwuohUgNcgmHfQvUmSQehhQsgwvIFNjBhegwglSGwAI9YIxQ4ueRSDkPMOqWDwFSMAJOI0MlfsCoEAAAAASUVORK5CYII=" } );
14
 
15
- /* Form's shortcode */
16
- blocks.registerBlockType( 'cpcff/form-shortcode', {
17
- title: 'Insert CFF',
18
- icon: iconCPCFF,
19
- category: 'cpcff',
20
- supports: {
21
- customClassName: false,
22
- className: false
23
- },
24
- attributes: {
25
- shortcode : {
26
- type : 'string',
27
- source : 'text',
28
- default: '[CP_CALCULATED_FIELDS id=""]'
29
- }
30
- },
31
 
32
- edit: function( props ) {
33
- var focus = props.focus;
34
- return [
35
- !!focus && el(
36
- InspectorControls,
37
- {
38
- key: 'cpcff_inspector'
39
- },
40
- [
41
- el(
42
- 'span',
43
  {
44
- key: 'cpcff_inspector_help',
45
- style:{fontStyle: 'italic'}
46
  },
47
- 'If you need help: '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ),
49
- el(
50
- 'a',
51
  {
52
- key : 'cpcff_inspector_help_link',
53
- href : 'https://cff.dwbooster.com/documentation#insertion-page',
54
- target : '_blank'
55
- },
56
- 'CLICK HERE'
57
- ),
58
- ]
59
- ),
60
- el('textarea',
61
- {
62
- key: 'cpcff_form_shortcode',
63
- value: props.attributes.shortcode,
64
- onChange: function(evt){
65
- props.setAttributes({shortcode: evt.target.value});
66
- },
67
- style: {width:"100%", resize: "vertical"}
68
- }
69
- )
70
- ];
71
- },
72
 
73
- save: function( props ) {
74
- return props.attributes.shortcode;
75
- }
76
- });
77
 
78
- /* variable shortcode */
79
- blocks.registerBlockType( 'cpcff/variable-shortcode', {
80
- title: 'Create var from POST, GET, SESSION, or COOKIES',
81
- icon: iconCPCFFV,
82
- category: 'cpcff',
83
- supports: {
84
- customClassName: false,
85
- className: false
86
- },
87
- attributes: {
88
- shortcode : {
89
- type : 'string',
90
- source : 'text',
91
- default: '[CP_CALCULATED_FIELDS_VAR name=""]'
92
- }
93
- },
94
 
95
- edit: function( props ) {
96
- var focus = props.focus;
97
- return [
98
- !!focus && el(
99
- InspectorControls,
100
- {
101
- key: 'cpcff_inspector'
102
- },
103
- [
104
- el(
105
- 'span',
106
  {
107
- key: 'cpcff_inspector_help',
108
- style:{fontStyle: 'italic'}
109
  },
110
- 'If you need help: '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  ),
112
  el(
113
- 'a',
114
  {
115
- key : 'cpcff_inspector_help_link',
116
- href : 'https://cff.dwbooster.com/documentation#javascript-variables',
117
- target : '_blank'
118
- },
119
- 'CLICK HERE'
 
 
120
  )
121
- ]
122
- ),
123
- el(
124
- 'textarea',
125
- {
126
- key: 'cpcff_variable_shortcode',
127
- value: props.attributes.shortcode,
128
- onChange: function(evt){
129
- props.setAttributes({shortcode: evt.target.value});
130
- },
131
- style: {width:"100%", resize: "vertical"}
132
- }
133
- )
134
- ];
135
- },
136
 
137
- save: function( props ) {
138
- return props.attributes.shortcode;
139
- }
140
- });
141
- } )(
142
- window.wp.blocks,
143
- window.wp.element
 
 
144
  );
1
+ jQuery(function()
2
+ {
3
+ (function( blocks, element ) {
4
+ var el = element.createElement,
5
+ InspectorControls = wp.editor.InspectorControls,
6
+ category = {slug:'cp-calculated-fields-form', title : 'Calculated Fields Form'};
7
 
8
+ /* Plugin Category */
9
+ blocks.getCategories().push({slug: 'cpcff', title: 'Calculated Fields Form'});
10
 
11
+ /* ICONS */
12
+ const iconCPCFF = el('img', { width: 20, height: 20, src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAGdJREFUOI1jnHnk3X8GKgAmahhCVYNYGBgYGDq3PqLIkHJvOeq5iHHQBTYLjIEcTuXecgydWx8xMDISNqDMSw7VIHTAyMjAcKdVH68hKtUX4Wzqew0d/P+PaiMhQLVYGw1swmDwZREAIzIpNydZa8YAAAAASUVORK5CYII=" } );
13
 
14
+ const iconCPCFFV = el('img', { width: 20, height: 20, src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAIhJREFUOI1jnHnk3X8GKgAmahhCVYNYkDlp1oIkaZ519D2cjeEi5aqLDMpVF3FqxiWP1Wt32/RxGoRLDmcYYbMVn0txGnS3TR9Fo3LVRbwuZcEpg2YYPkPwuohUgNcgmHfQvUmSQehhQsgwvIFNjBhegwglSGwAI9YIxQ4ueRSDkPMOqWDwFSMAJOI0MlfsCoEAAAAASUVORK5CYII=" } );
15
 
16
+ /* Form's shortcode */
17
+ blocks.registerBlockType( 'cpcff/form-shortcode', {
18
+ title: 'Insert CFF',
19
+ icon: iconCPCFF,
20
+ category: 'cpcff',
21
+ supports: {
22
+ customClassName: false,
23
+ className: false
24
+ },
25
+ attributes: {
26
+ shortcode : {
27
+ type : 'string',
28
+ source : 'text',
29
+ default: '[CP_CALCULATED_FIELDS id=""]'
30
+ }
31
+ },
32
 
33
+ edit: function( props ) {
34
+ var focus = props.isSelected;
35
+ return [
36
+ !!focus && el(
37
+ InspectorControls,
 
 
 
 
 
 
38
  {
39
+ key: 'cpcff_inspector'
 
40
  },
41
+ [
42
+ el(
43
+ 'span',
44
+ {
45
+ key: 'cpcff_inspector_help',
46
+ style:{fontStyle: 'italic'}
47
+ },
48
+ 'If you need help: '
49
+ ),
50
+ el(
51
+ 'a',
52
+ {
53
+ key : 'cpcff_inspector_help_link',
54
+ href : 'https://cff.dwbooster.com/documentation#insertion-page',
55
+ target : '_blank'
56
+ },
57
+ 'CLICK HERE'
58
+ )
59
+ ]
60
  ),
61
+ el('textarea',
 
62
  {
63
+ key: 'cpcff_form_shortcode',
64
+ value: props.attributes.shortcode,
65
+ onChange: function(evt){
66
+ props.setAttributes({shortcode: evt.target.value});
67
+ },
68
+ style: {width:"100%", resize: "vertical"}
69
+ }
70
+ )
71
+ ];
72
+ },
 
 
 
 
 
 
 
 
 
 
73
 
74
+ save: function( props ) {
75
+ return props.attributes.shortcode;
76
+ }
77
+ });
78
 
79
+ /* variable shortcode */
80
+ blocks.registerBlockType( 'cpcff/variable-shortcode', {
81
+ title: 'Create var from POST, GET, SESSION, or COOKIES',
82
+ icon: iconCPCFFV,
83
+ category: 'cpcff',
84
+ supports: {
85
+ customClassName: false,
86
+ className: false
87
+ },
88
+ attributes: {
89
+ shortcode : {
90
+ type : 'string',
91
+ source : 'text',
92
+ default: '[CP_CALCULATED_FIELDS_VAR name=""]'
93
+ }
94
+ },
95
 
96
+ edit: function( props ) {
97
+ var focus = props.isSelected;
98
+ return [
99
+ !!focus && el(
100
+ InspectorControls,
 
 
 
 
 
 
101
  {
102
+ key: 'cpcff_inspector'
 
103
  },
104
+ [
105
+ el(
106
+ 'span',
107
+ {
108
+ key: 'cpcff_inspector_help',
109
+ style:{fontStyle: 'italic'}
110
+ },
111
+ 'If you need help: '
112
+ ),
113
+ el(
114
+ 'a',
115
+ {
116
+ key : 'cpcff_inspector_help_link',
117
+ href : 'https://cff.dwbooster.com/documentation#javascript-variables',
118
+ target : '_blank'
119
+ },
120
+ 'CLICK HERE'
121
+ )
122
+ ]
123
  ),
124
  el(
125
+ 'textarea',
126
  {
127
+ key: 'cpcff_variable_shortcode',
128
+ value: props.attributes.shortcode,
129
+ onChange: function(evt){
130
+ props.setAttributes({shortcode: evt.target.value});
131
+ },
132
+ style: {width:"100%", resize: "vertical"}
133
+ }
134
  )
135
+ ];
136
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
+ save: function( props ) {
139
+ return props.attributes.shortcode;
140
+ }
141
+ });
142
+ } )(
143
+ window.wp.blocks,
144
+ window.wp.element
145
+ );
146
+ }
147
  );
js/fbuilder-pro-admin.jquery.js CHANGED
@@ -578,7 +578,6 @@
578
  'items': '.fields',
579
  'placeholder': 'ui-state-highlight',
580
  'tolerance': 'pointer',
581
- 'cursorAt': { 'top': 5, 'left': 5 },
582
  'update': function( event, ui )
583
  {
584
  var i, h = items.length;
578
  'items': '.fields',
579
  'placeholder': 'ui-state-highlight',
580
  'tolerance': 'pointer',
 
581
  'update': function( event, ui )
582
  {
583
  var i, h = items.length;
js/fbuilder-pro-public.jquery.js CHANGED
@@ -21,12 +21,13 @@
21
  return value.replace(/([\^\$\-\.\,\[\]\(\)\/\\\*\?\+\!\{\}])/g, "\\$1");
22
  };
23
 
24
- $.fbuilder[ 'parseValStr' ] = function( value )
25
  {
 
26
  if( typeof value == 'undefined' || value == null ) value = '';
27
  /* value = $.trim( value.replace(/'/g, "\\'").replace( /\$/g, '\\$').replace(/"/g, '\\"') ); */
28
- value = $.trim( value.replace(/'/g, "\\'").replace(/"/g, '\\"') );
29
- return ($.isNumeric(value) ) ? value*1 : '"' + value + '"';
30
  };
31
 
32
  $.fbuilder[ 'parseVal' ] = function( value, thousandSeparator, decimalSymbol )
@@ -166,44 +167,19 @@
166
  $( '#fieldlist'+opt.identifier).find(".pbPrevious,.pbNext").bind("keyup", function(evt){
167
  if(evt.which == 13 || evt.which == 32) $(this).click();
168
  }).bind("click", {'identifier' : opt.identifier}, function(evt){
169
- var identifier = evt.data.identifier;
170
- if ( ($(this).hasClass("pbPrevious")) || (($(this).hasClass("pbNext")) && $(this).closest("form").valid()) )
171
- {
172
- var page = parseInt($(this).parents(".pbreak").attr("page"));
173
-
174
- (($(this).hasClass("pbPrevious"))?page--:page++);
175
- $("#fieldlist"+identifier+" .pbreak").css("display","none");
176
- $("#fieldlist"+identifier+" .pbreak").find(".field").addClass("ignorepb");
177
 
178
- $("#fieldlist"+identifier+" .pb"+page).css("display","block");
179
- $("#fieldlist"+identifier+" .pb"+page).find(".field").removeClass("ignorepb");
180
- if ($("#fieldlist"+identifier+" .pb"+page).find(".fields").length>0)
181
  {
182
- try
183
- {
184
- var ffocusable = $("#fieldlist"+identifier+" .pb"+page).find(":focusable"),
185
- _wScrollTop = $(window).scrollTop(),
186
- _viewportHeight = $(window).height(),
187
- _scrollTop = $("#fieldlist"+identifier+" .pb"+page).closest('form').offset().top;
188
-
189
- if( ffocusable.length )
190
- {
191
- ffocusable[0].focus();
192
- }
193
-
194
- if(_scrollTop < _wScrollTop || (_wScrollTop+_viewportHeight)<_scrollTop )
195
- {
196
- $( 'html, body' ).animate({scrollTop: _scrollTop}, 50);
197
- }
198
- }
199
- catch(e){}
200
  }
201
- }
202
- else
203
- {
204
- $(this).closest("form").validate().focusInvalid();
205
- }
206
- return false;
207
  });
208
  }
209
  else
@@ -271,7 +247,8 @@
271
  });
272
  try
273
  {
274
- $( "#fbuilder"+opt.identifier ).tooltip({show: false,hide:false,tooltipClass:"uh-tooltip",position: { my: "left top", at: "left bottom+5", collision: "none" },items: "[uh]",content: function (){return $(this).attr("uh");}, open: function( evt, ui ){ try{ if(window.matchMedia("screen and (max-width: 640px)").matches){
 
275
  var duration = ('undefined' != typeof tooltip_duration && /^\d+$/.test(tooltip_duration)) ? tooltip_duration : 3000;
276
  setTimeout( function(){$(ui.tooltip).hide('fade'); }, duration);
277
  }}catch( err ){}} });
@@ -317,9 +294,10 @@
317
  hiddenByContainer : {},
318
  getItem: function( name )
319
  {
 
320
  for( var i in items )
321
  {
322
- if( items[ i ].name == name )
323
  {
324
  return items[ i ];
325
  }
@@ -390,11 +368,16 @@
390
  return 'Not available yet';
391
  },
392
  after_show:function(){},
393
- val:function(){
 
394
  var e = $( "[id='" + this.name + "']:not(.ignore)" );
395
  if( e.length )
396
  {
397
- return $.fbuilder.parseVal( $.trim( e.val() ) );
 
 
 
 
398
  }
399
  return 0;
400
  },
@@ -404,77 +387,209 @@
404
  }
405
  });
406
 
407
- $.fbuilder[ 'showHideDep' ] = function( configObj )
 
 
408
  {
409
- /**
410
- * If isNotFirstTime is defined, the equations associated to the fields should be inserted in the queue of equations
411
- */
412
- var process_items = function( items, isNotFirstTime )
413
  {
414
- for( var i = 0, h = items.length; i < h; i++ )
415
- {
416
- if( typeof items[ i ] == 'string' ) items[i] = $.fbuilder[ 'forms' ][ identifier ].getItem( items[i] );
417
- if( isNotFirstTime && items[i] && items[i].usedInEquations ) $.fbuilder[ 'calculator' ].enqueueEquation( identifier, items[i].usedInEquations );
418
- if( typeof items[ i ][ 'showHideDep' ] != 'undefined' )
419
- {
420
- var list = items[ i ][ 'showHideDep' ]( toShow, toHide, hiddenByContainer );
421
- if( typeof list != 'undefined' && list.length )
422
- process_items( list, true );
423
- }
424
- }
 
 
425
  };
426
 
427
- if( typeof configObj[ 'formIdentifier' ] !== 'undefined' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  {
429
- var identifier = configObj[ 'formIdentifier' ];
 
 
 
 
 
 
 
 
 
430
 
431
- if( typeof $.fbuilder[ 'forms' ][ identifier ] != 'undefined' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
  {
433
- var toShow = $.fbuilder[ 'forms' ][ identifier ][ 'toShow' ],
434
- toHide = $.fbuilder[ 'forms' ][ identifier ][ 'toHide' ],
435
- hiddenByContainer = $.fbuilder[ 'forms' ][ identifier ][ 'hiddenByContainer' ],
436
- items = (typeof configObj[ 'fieldItentifier' ] != 'undefined' ) ? [ $.fbuilder[ 'forms' ][ identifier ].getItem(configObj[ 'fieldItentifier' ]) ] : $.fbuilder[ 'forms' ][ identifier ].getItems();
 
 
437
 
438
- process_items( items );
 
 
 
439
 
440
- if( typeof configObj[ 'throwEvent' ] == 'undefined' || configObj[ 'throwEvent' ] )
441
- {
442
- $( document ).trigger( 'showHideDepEvent', $.fbuilder[ 'forms' ][ identifier ][ 'formId' ] );
 
443
  }
 
444
  }
445
  }
446
- }; // End showHideDep
 
 
 
 
 
 
447
 
448
- // Load default values
449
- $.fbuilder[ 'cpcff_load_defaults' ] = function( o )
 
 
 
 
450
  {
451
- var $ = fbuilderjQuery,
452
- id,
453
- item,
454
- form_data,
455
- form_obj;
 
 
 
 
 
 
 
 
 
 
 
456
 
457
- if( typeof cpcff_default != 'undefined' )
458
  {
459
- id = o.identifier.replace( /[^\d]/g, '' );
460
- if( typeof cpcff_default[ id ] != 'undefined' )
 
 
 
 
 
 
461
  {
462
- form_data = cpcff_default[ id ];
463
- id = '_'+id;
464
- form_obj = $.fbuilder[ 'forms' ][ id ];
 
 
465
 
466
- for( var field_id in form_data )
467
- {
468
- item = form_obj.getItem( field_id+id );
469
- if( typeof item[ 'setVal' ] != 'undefined' ) item.setVal( form_data[ field_id ] );
470
- }
 
 
 
471
 
472
- $.fbuilder.showHideDep(
473
- {
474
- 'formIdentifier' : o.identifier,
475
- 'throwEvent' : true
476
- }
477
- );
 
 
 
 
 
 
 
478
  }
 
 
 
 
 
 
 
479
  }
480
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  return value.replace(/([\^\$\-\.\,\[\]\(\)\/\\\*\?\+\!\{\}])/g, "\\$1");
22
  };
23
 
24
+ $.fbuilder[ 'parseValStr' ] = function( value, raw )
25
  {
26
+ raw = raw || false;
27
  if( typeof value == 'undefined' || value == null ) value = '';
28
  /* value = $.trim( value.replace(/'/g, "\\'").replace( /\$/g, '\\$').replace(/"/g, '\\"') ); */
29
+ value = $.trim( value.replace(/\\/g, "\\\\") ).replace(/'/g, "\\'").replace(/"/g, '\\"');
30
+ return ($.isNumeric(value)) ? ((raw) ? value : value*1) : '"' + value + '"';
31
  };
32
 
33
  $.fbuilder[ 'parseVal' ] = function( value, thousandSeparator, decimalSymbol )
167
  $( '#fieldlist'+opt.identifier).find(".pbPrevious,.pbNext").bind("keyup", function(evt){
168
  if(evt.which == 13 || evt.which == 32) $(this).click();
169
  }).bind("click", {'identifier' : opt.identifier}, function(evt){
170
+ var _from = $(this).closest('.pbreak').attr('page')*1,
171
+ _to = _from+(($(this).hasClass("pbPrevious")) ? -1 : 1),
172
+ _p;
 
 
 
 
 
173
 
174
+ _p = $.fbuilder['goToPage'](
 
 
175
  {
176
+ 'formIdentifier' : evt.data.identifier,
177
+ 'from' : _from,
178
+ 'to' : _to
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
+ );
181
+ if(_p == _to) $.fbuilder.setBrowserHistory();
182
+ return false;
 
 
 
183
  });
184
  }
185
  else
247
  });
248
  try
249
  {
250
+ $.widget.bridge('uitooltip', $.ui.tooltip);
251
+ $( "#fbuilder"+opt.identifier ).uitooltip({show: false,hide:false,tooltipClass:"uh-tooltip",position: { my: "left top", at: "left bottom+5", collision: "none" },items: "[uh]",content: function (){return $(this).attr("uh");}, open: function( evt, ui ){ try{ if(window.matchMedia("screen and (max-width: 640px)").matches){
252
  var duration = ('undefined' != typeof tooltip_duration && /^\d+$/.test(tooltip_duration)) ? tooltip_duration : 3000;
253
  setTimeout( function(){$(ui.tooltip).hide('fade'); }, duration);
254
  }}catch( err ){}} });
294
  hiddenByContainer : {},
295
  getItem: function( name )
296
  {
297
+ var regExp = new RegExp('('+name+'_)|(fieldname'+name+'_)', i);
298
  for( var i in items )
299
  {
300
+ if( items[ i ].name == name || regExp.test(items[ i ].name))
301
  {
302
  return items[ i ];
303
  }
368
  return 'Not available yet';
369
  },
370
  after_show:function(){},
371
+ val:function(raw){
372
+ raw = raw || false;
373
  var e = $( "[id='" + this.name + "']:not(.ignore)" );
374
  if( e.length )
375
  {
376
+ var v = e.val();
377
+ if(raw) return $.fbuilder.parseValStr(v, raw);
378
+
379
+ v = $.trim(v);
380
+ return ($.isNumeric(v)) ? $.fbuilder.parseVal(v) : $.fbuilder.parseValStr(v);
381
  }
382
  return 0;
383
  },
387
  }
388
  });
389
 
390
+ $.fbuilder[ 'setBrowserHistory' ] = function(replace)
391
+ {
392
+ if('history' in window)
393
  {
394
+ var bookmark = '#',
395
+ separator = '';
396
+ for(var formId in $.fbuilder.forms)
 
397
  {
398
+ bookmark += separator+'f'+formId.replace(/[^\d]/g,'')+'p'+($.fbuilder.forms[formId]['currentPage'] || 0);
399
+ separator = '|';
400
+ }
401
+ history[(replace) ? 'replaceState' : 'pushState']({}, document.title, bookmark);
402
+ }
403
+ }; // End setBrowserHistory
404
+
405
+ $.fbuilder[ 'manageHistory' ] = function(state)
406
+ {
407
+ var bookmark = (document.URL.split('#').length > 1) ? document.URL.split('#')[1] : null,
408
+ _match, _form, _to, setHistoryEntry = false,
409
+ _goToPage = function(config){
410
+
411
  };
412
 
413
+ if(bookmark)
414
+ {
415
+ while(_match = bookmark.match(/f(\d+)p(\d+)\|?/))
416
+ {
417
+ _form = '_'+_match[1];
418
+ _to = _match[2]*1;
419
+ if(
420
+ !(_form in $.fbuilder.forms) || // Form exists
421
+ !('currentPage' in $.fbuilder.forms[_form]) || // Next/Prev buttons has been pressed previously
422
+ _to != $.fbuilder['goToPage'](
423
+ {
424
+ 'formIdentifier' : _form,
425
+ 'from' : 0,
426
+ 'to' : _to
427
+ }
428
+ )
429
+ ) setHistoryEntry = true;
430
+ bookmark = bookmark.replace(_match[0],'');
431
+ }
432
+ }
433
+ else
434
+ {
435
+ for(_form in $.fbuilder.forms)
436
  {
437
+ if('currentPage' in $.fbuilder.forms[_form])
438
+ $.fbuilder['goToPage'](
439
+ {
440
+ 'formIdentifier' : _form,'from' : 0, 'to' : 0
441
+ }
442
+ );
443
+ }
444
+ }
445
+ if(setHistoryEntry) $.fbuilder.setBrowserHistory(true);
446
+ }; // End manageHistory
447
 
448
+ $.fbuilder[ 'goToPage' ] = function( configObj )
449
+ {
450
+ if(
451
+ 'formIdentifier' in configObj &&
452
+ 'from' in configObj &&
453
+ 'to' in configObj
454
+ )
455
+ {
456
+ var identifier = configObj['formIdentifier'],
457
+ _from = configObj['from']*1,
458
+ _to = configObj['to']*1,
459
+ direction = (_from < _to) ? 1 : -1,
460
+ formObj = $('[id="'+$.fbuilder.forms[identifier].formId+'"]'),
461
+ pageObj, i = _from;
462
+
463
+ while(i != _to)
464
+ {
465
+ $(".pbreak:not(.pb"+i+")",formObj).find(".field").addClass("ignorepb");
466
+ $(".pb"+i,formObj).find(".field").removeClass("ignorepb");
467
+ if(direction == 1 && !formObj.valid()) break;
468
+ i += direction;
469
+ }
470
+ $.fbuilder.forms[identifier]['currentPage'] = i;
471
+ $(".pbreak:not(.pb"+i+")",formObj).hide().find(".field").addClass("ignorepb");
472
+ pageObj = $(".pbreak.pb"+i,formObj);
473
+ pageObj.show().find(".field").removeClass("ignorepb");
474
+
475
+ if(i == _to)
476
+ {
477
+ if ($(".fields",pageObj).length>0)
478
  {
479
+ try
480
+ {
481
+ var ffocusable = pageObj.find(":focusable"),
482
+ _wScrollTop = $(window).scrollTop(),
483
+ _viewportHeight = $(window).height(),
484
+ _scrollTop = formObj.offset().top;
485
 
486
+ if( ffocusable.length && !ffocusable.first().hasClass('hasDatepicker'))
487
+ {
488
+ ffocusable[0].focus();
489
+ }
490
 
491
+ if(_scrollTop < _wScrollTop || (_wScrollTop+_viewportHeight)<_scrollTop )
492
+ {
493
+ $( 'html, body' ).animate({scrollTop: _scrollTop}, 50);
494
+ }
495
  }
496
+ catch(e){}
497
  }
498
  }
499
+ else
500
+ {
501
+ formObj.validate().focusInvalid();
502
+ }
503
+ return i;
504
+ }
505
+ }; // End goToPage
506
 
507
+ $.fbuilder[ 'showHideDep' ] = function( configObj )
508
+ {
509
+ /**
510
+ * If isNotFirstTime is defined, the equations associated to the fields should be inserted in the queue of equations
511
+ */
512
+ var process_items = function( items, isNotFirstTime )
513
  {
514
+ for( var i = 0, h = items.length; i < h; i++ )
515
+ {
516
+ if( typeof items[ i ] == 'string' ) items[i] = $.fbuilder[ 'forms' ][ identifier ].getItem( items[i] );
517
+ if( isNotFirstTime && items[i] && items[i].usedInEquations ) $.fbuilder[ 'calculator' ].enqueueEquation( identifier, items[i].usedInEquations );
518
+ if( typeof items[ i ][ 'showHideDep' ] != 'undefined' )
519
+ {
520
+ var list = items[ i ][ 'showHideDep' ]( toShow, toHide, hiddenByContainer );
521
+ if( typeof list != 'undefined' && list.length )
522
+ process_items( list, true );
523
+ }
524
+ }
525
+ };
526
+
527
+ if( typeof configObj[ 'formIdentifier' ] !== 'undefined' )
528
+ {
529
+ var identifier = configObj[ 'formIdentifier' ];
530
 
531
+ if( typeof $.fbuilder[ 'forms' ][ identifier ] != 'undefined' )
532
  {
533
+ var toShow = $.fbuilder[ 'forms' ][ identifier ][ 'toShow' ],
534
+ toHide = $.fbuilder[ 'forms' ][ identifier ][ 'toHide' ],
535
+ hiddenByContainer = $.fbuilder[ 'forms' ][ identifier ][ 'hiddenByContainer' ],
536
+ items = (typeof configObj[ 'fieldItentifier' ] != 'undefined' ) ? [ $.fbuilder[ 'forms' ][ identifier ].getItem(configObj[ 'fieldItentifier' ].replace(/_[cr]b\d+$/i, '')) ] : $.fbuilder[ 'forms' ][ identifier ].getItems();
537
+
538
+ process_items( items );
539
+
540
+ if( typeof configObj[ 'throwEvent' ] == 'undefined' || configObj[ 'throwEvent' ] )
541
  {
542
+ $( document ).trigger( 'showHideDepEvent', $.fbuilder[ 'forms' ][ identifier ][ 'formId' ] );
543
+ }
544
+ }
545
+ }
546
+ }; // End showHideDep
547
 
548
+ // Load default values
549
+ $.fbuilder[ 'cpcff_load_defaults' ] = function( o )
550
+ {
551
+ var $ = fbuilderjQuery,
552
+ id,
553
+ item,
554
+ form_data,
555
+ form_obj;
556
 
557
+ if( typeof cpcff_default != 'undefined' )
558
+ {
559
+ id = o.identifier.replace( /[^\d]/g, '' );
560
+ if( typeof cpcff_default[ id ] != 'undefined' )
561
+ {
562
+ form_data = cpcff_default[ id ];
563
+ id = '_'+id;
564
+ form_obj = $.fbuilder[ 'forms' ][ id ];
565
+
566
+ for( var field_id in form_data )
567
+ {
568
+ item = form_obj.getItem( field_id+id );
569
+ if( typeof item[ 'setVal' ] != 'undefined' ) item.setVal( form_data[ field_id ] );
570
  }
571
+
572
+ $.fbuilder.showHideDep(
573
+ {
574
+ 'formIdentifier' : o.identifier,
575
+ 'throwEvent' : true
576
+ }
577
+ );
578
  }
579
+ }
580
+ };
581
+
582
+ // Read history
583
+ window.addEventListener('popstate', function(){
584
+ try
585
+ {
586
+ // Solves an issue with the datepicker if it is opened and back/next buttons in browser are pressed
587
+ $(".ui-datepicker").hide();
588
+ $.fbuilder.manageHistory();
589
+ }
590
+ catch(err){}
591
+ });
592
+
593
+ $(window).on('load', function(){
594
+ $.fbuilder.manageHistory();
595
+ });
js/fields-admin/02_fbuilder.fcurrency.js CHANGED
@@ -21,24 +21,25 @@
21
  currencyText:"USD",
22
  thousandSeparator:",",
23
  centSeparator:".",
 
24
  min:"",
25
  max:"",
26
  formatDynamically:false,
27
  getPredefinedValue:function()
28
  {
 
 
29
 
30
- this.centSeparator = $.trim(this.centSeparator);
31
- if( /^\s*$/.test( this.centSeparator ) )
32
- {
33
- this.centSeparator = '.';
34
- }
35
 
36
- var v = $.trim( this.predefined );
37
 
38
- v = v.replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.currencySymbol), 'g' ), '' )
39
- .replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.currencyText), 'g' ), '' );
40
 
41
- v = $.fbuilder.parseVal( v, this.thousandSeparator, this.centSeparator );
42
 
43
  if( !isNaN( v ) )
44
  {
@@ -47,21 +48,18 @@
47
  counter = 0,
48
  str = '';
49
 
50
- if( !/^\s*$/.test( this.thousandSeparator ) )
51
  {
52
  for( var i = parts[0].length-1; i >= 0; i--){
53
  counter++;
54
  str = parts[0][i] + str;
55
- if( counter%3 == 0 && i != 0 ) str = this.thousandSeparator + str;
56
 
57
  }
58
  parts[0] = str;
59
  }
60
- if( typeof parts[ 1 ] != 'undefined' && parts[ 1 ].length == 1 )
61
- {
62
- parts[ 1 ] += '0';
63
- }
64
- return this.currencySymbol+parts.join( this.centSeparator )+this.currencyText;
65
  }
66
  else
67
  {
@@ -74,13 +72,15 @@
74
  },
75
  editItemEvents:function()
76
  {
77
- var evt = [
 
78
  {s:"#sSize",e:"change", l:"size"},
79
  {s:"#sCurrencySymbol",e:"change keyup", l:"currencySymbol"},
80
  {s:"#sCurrencyText",e:"change keyup", l:"currencyText"},
81
  {s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator"},
82
  {s:"#sCentSeparator",e:"change keyup", l:"centSeparator"},
83
- {s:"#sFormatDynamically",e:"click", l:"formatDynamically",f:function(el){return el.is(':checked');}},
 
84
  {s:"#sMin",e:"change keyup", l:"min"},
85
  {s:"#sMax",e:"change keyup", l:"max"}
86
  ];
@@ -96,7 +96,8 @@
96
  str += '<div><label>Currency</label><br /><input type="text" name="sCurrencyText" id="sCurrencyText" value="'+$.fbuilder.htmlEncode(this.currencyText)+'" class="large"></div>';
97
  str += '<div><label>Thousands Separator</label><br /><input type="text" name="sThousandSeparator" id="sThousandSeparator" value="'+$.fbuilder.htmlEncode(this.thousandSeparator)+'" class="large"></div>';
98
  str += '<div><label>Cents Separator</label><br /><input type="text" name="sCentSeparator" id="sCentSeparator" value="'+$.fbuilder.htmlEncode(this.centSeparator)+'" class="large"></div>';
99
- str += '<div><label>Format Dynamically</label><br /><input type="checkbox" name="sFormatDynamically" id="sFormatDynamically" '+( (this.formatDynamically) ? 'CHECKED' : '')+'></div>';
 
100
  return str;
101
  },
102
  showRangeIntance: function()
21
  currencyText:"USD",
22
  thousandSeparator:",",
23
  centSeparator:".",
24
+ noCents: false,
25
  min:"",
26
  max:"",
27
  formatDynamically:false,
28
  getPredefinedValue:function()
29
  {
30
+ var me = this,
31
+ v = $.trim( me.predefined );
32
 
33
+ if(me.predefinedClick || !me.formatDynamically) return v;
34
+
35
+ me.centSeparator = $.trim(me.centSeparator);
36
+ if( /^\s*$/.test( me.centSeparator ) ) me.centSeparator = '.';
 
37
 
 
38
 
39
+ v = v.replace( new RegExp( $.fbuilder[ 'escape_symbol' ](me.currencySymbol), 'g' ), '' )
40
+ .replace( new RegExp( $.fbuilder[ 'escape_symbol' ](me.currencyText), 'g' ), '' );
41
 
42
+ v = $.fbuilder.parseVal( v, me.thousandSeparator, me.centSeparator );
43
 
44
  if( !isNaN( v ) )
45
  {
48
  counter = 0,
49
  str = '';
50
 
51
+ if( !/^\s*$/.test( me.thousandSeparator ) )
52
  {
53
  for( var i = parts[0].length-1; i >= 0; i--){
54
  counter++;
55
  str = parts[0][i] + str;
56
+ if( counter%3 == 0 && i != 0 ) str = me.thousandSeparator + str;
57
 
58
  }
59
  parts[0] = str;
60
  }
61
+ if( typeof parts[ 1 ] != 'undefined' && parts[ 1 ].length == 1 ) parts[ 1 ] += '0';
62
+ return this.currencySymbol+((this.noCents) ? parts[0] : parts.join(this.centSeparator))+this.currencyText;
 
 
 
63
  }
64
  else
65
  {
72
  },
73
  editItemEvents:function()
74
  {
75
+ var f = function(el){return el.is(':checked');},
76
+ evt = [
77
  {s:"#sSize",e:"change", l:"size"},
78
  {s:"#sCurrencySymbol",e:"change keyup", l:"currencySymbol"},
79
  {s:"#sCurrencyText",e:"change keyup", l:"currencyText"},
80
  {s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator"},
81
  {s:"#sCentSeparator",e:"change keyup", l:"centSeparator"},
82
+ {s:"#sFormatDynamically",e:"click", l:"formatDynamically",f:f},
83
+ {s:"#sNoCents",e:"click", l:"noCents",f:f},
84
  {s:"#sMin",e:"change keyup", l:"min"},
85
  {s:"#sMax",e:"change keyup", l:"max"}
86
  ];
96
  str += '<div><label>Currency</label><br /><input type="text" name="sCurrencyText" id="sCurrencyText" value="'+$.fbuilder.htmlEncode(this.currencyText)+'" class="large"></div>';
97
  str += '<div><label>Thousands Separator</label><br /><input type="text" name="sThousandSeparator" id="sThousandSeparator" value="'+$.fbuilder.htmlEncode(this.thousandSeparator)+'" class="large"></div>';
98
  str += '<div><label>Cents Separator</label><br /><input type="text" name="sCentSeparator" id="sCentSeparator" value="'+$.fbuilder.htmlEncode(this.centSeparator)+'" class="large"></div>';
99
+ str += '<div><label><input type="checkbox" name="sNoCents" id="sNoCents" '+( (this.noCents) ? 'CHECKED' : '')+'> Do Not Allow Cents</label><br /></div>';
100
+ str += '<div><label><input type="checkbox" name="sFormatDynamically" id="sFormatDynamically" '+( (this.formatDynamically) ? 'CHECKED' : '')+'> Format Dynamically</label><br /></div>';
101
  return str;
102
  },
103
  showRangeIntance: function()
js/fields-admin/04_fbuilder.fdate.js CHANGED
@@ -17,6 +17,7 @@
17
  size:"medium",
18
  required:false,
19
  dformat:"mm/dd/yyyy",
 
20
  tformat:"24",
21
  showDropdown:false,
22
  dropdownRange:"-10:+10",
@@ -39,11 +40,14 @@
39
  defaultTime:"",
40
  working_dates:[true,true,true,true,true,true,true],
41
 
42
- formats:new Array("mm/dd/yyyy","dd/mm/yyyy"),
 
43
 
44
  display:function()
45
  {
46
- return '<div class="fields '+this.name+'" id="field'+this.form_identifier+'-'+this.index+'" title="'+this.name+'"><div class="arrow ui-icon ui-icon-play "></div><div title="Delete" class="remove ui-icon ui-icon-trash "></div><div title="Duplicate" class="copy ui-icon ui-icon-copy "></div><label>'+this.title+''+((this.required)?"*":"")+' ('+this.dformat+')</label><div class="dfield"><input class="field disabled '+this.size+'" type="text" value="'+$.fbuilder.htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
 
 
47
  },
48
  editItemEvents:function()
49
  {
@@ -51,6 +55,7 @@
51
  {s:"#sDropdownRange",e:"keyup", l:"dropdownRange"},
52
  {s:"#sSize",e:"change", l:"size"},
53
  {s:"#sFormat",e:"change", l:"dformat"},
 
54
  {s:"[name='sTimeFormat']",e:"change", l:"tformat"},
55
  {s:"#sMinDate",e:"change keyup", l:"minDate"},
56
  {s:"#sMaxDate",e:"change keyup", l:"maxDate"},
@@ -85,12 +90,17 @@
85
  },
86
  showFormatIntance: function()
87
  {
88
- var str = "";
89
- for (var i=0;i<this.formats.length;i++)
90
- {
91
- str += '<option value="'+this.formats[i]+'" '+((this.formats[i]==this.dformat)?"selected":"")+'>'+this.formats[i]+'</option>';
92
- }
93
- return '<hr></hr><div><input type="checkbox" name="sShowDatepicker" id="sShowDatepicker" '+( ( this.showDatepicker ) ? 'CHECKED' : '' )+' > <label>Show input field for the date</label></div><div><label>Date Format</label><br /><select name="sFormat" id="sFormat">'+str+'</select></div>';
 
 
 
 
 
94
  },
95
  showSpecialDataInstance: function()
96
  {
@@ -108,10 +118,10 @@
108
  str += '<div class="time-options" '+( ( !this.showTimepicker ) ? 'style="display:none;"': '' )+'>';
109
  str += '<div><label>Time Format</label><br /><label><input type="radio" name="sTimeFormat" id="sTimeFormat" value="24" '+( ( this.tformat == 24 ) ? 'CHECKED' : '' )+' /> 24 hours</label> <label><input type="radio" name="sTimeFormat" id="sTimeFormat" value="12" '+( ( this.tformat == 12 ) ? 'CHECKED' : '' )+' /> 12 hours</label></div>';
110
  str += '<div><label>Default Time HH:mm</label><br /><input class="large" name="sDefaultTime" id="sDefaultTime" value="'+$.fbuilder.htmlEncode(this.defaultTime)+'" /></div>';
111
- str += '<div><label>Min Hour</label><br /><input class="large" name="sMinHour" id="sMinHour" value="'+$.fbuilder.htmlEncode(this.minHour)+'" /></div>';
112
- str += '<div><label>Max Hour</label><br /><input class="large" name="sMaxHour" id="sMaxHour" value="'+$.fbuilder.htmlEncode(this.maxHour)+'" /></div>';
113
- str += '<div><label>Min Minutes</label><br /><input class="large" name="sMinMinute" id="sMinMinute" value="'+$.fbuilder.htmlEncode(this.minMinute)+'" /></div>';
114
- str += '<div><label>Max Minutes</label><br /><input class="large" name="sMaxMinute" id="sMaxMinute" value="'+$.fbuilder.htmlEncode(this.maxMinute)+'" /></div>';
115
 
116
  str += '<div><label>Steps for hours</label><br /><input class="large" name="sStepHour" id="sStepHour" value="'+$.fbuilder.htmlEncode(this.stepHour)+'" /></div>';
117
  str += '<div><label>Steps for minutes</label><br /><input class="large" name="sStepMinute" id="sStepMinute" value="'+$.fbuilder.htmlEncode(this.stepMinute)+'" /></div>';
17
  size:"medium",
18
  required:false,
19
  dformat:"mm/dd/yyyy",
20
+ dseparator:"/",
21
  tformat:"24",
22
  showDropdown:false,
23
  dropdownRange:"-10:+10",
40
  defaultTime:"",
41
  working_dates:[true,true,true,true,true,true,true],
42
 
43
+ formats:['mm/dd/yyyy','dd/mm/yyyy','yyyy/mm/dd','yyyy/dd/mm'],
44
+ separators: ['/','-','.'],
45
 
46
  display:function()
47
  {
48
+ var me = this,
49
+ dformat = me.dformat.replace(/\//g, me.dseparator);
50
+ return '<div class="fields '+me.name+'" id="field'+me.form_identifier+'-'+me.index+'" title="'+me.name+'"><div class="arrow ui-icon ui-icon-play "></div><div title="Delete" class="remove ui-icon ui-icon-trash "></div><div title="Duplicate" class="copy ui-icon ui-icon-copy "></div><label>'+me.title+''+((me.required)?"*":"")+' ('+dformat+')</label><div class="dfield"><input class="field disabled '+me.size+'" type="text" value="'+$.fbuilder.htmlEncode(me.predefined)+'"/><span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
51
  },
52
  editItemEvents:function()
53
  {
55
  {s:"#sDropdownRange",e:"keyup", l:"dropdownRange"},
56
  {s:"#sSize",e:"change", l:"size"},
57
  {s:"#sFormat",e:"change", l:"dformat"},
58
+ {s:"#sSeparator",e:"change", l:"dseparator"},
59
  {s:"[name='sTimeFormat']",e:"change", l:"tformat"},
60
  {s:"#sMinDate",e:"change keyup", l:"minDate"},
61
  {s:"#sMaxDate",e:"change keyup", l:"maxDate"},
90
  },
91
  showFormatIntance: function()
92
  {
93
+ var me = this,
94
+ formatOpts = "",
95
+ separatorOpts = "";
96
+
97
+ for (var i in me.formats)
98
+ formatOpts += '<option value="'+me.formats[i]+'" '+((me.formats[i]==me.dformat)?"selected":"")+'>'+me.formats[i]+'</option>';
99
+
100
+ for (var i in me.separators)
101
+ separatorOpts += '<option value="'+me.separators[i]+'" '+((me.separators[i]==me.dseparator)?"selected":"")+'>'+me.separators[i]+'</option>';
102
+
103
+ return '<hr></hr><div><input type="checkbox" name="sShowDatepicker" id="sShowDatepicker" '+( ( me.showDatepicker ) ? 'CHECKED' : '' )+' > <label>Show input field for the date</label></div><div class="width50 column"><label>Date Format</label><br /><select name="sFormat" id="sFormat" class="width100">'+formatOpts+'</select></div><div class="width50 columnr"><label>Parts separator</label><br /><select name="sSeparator" id="sSeparator" class="width100">'+separatorOpts+'</select></div>';
104
  },
105
  showSpecialDataInstance: function()
106
  {
118
  str += '<div class="time-options" '+( ( !this.showTimepicker ) ? 'style="display:none;"': '' )+'>';
119
  str += '<div><label>Time Format</label><br /><label><input type="radio" name="sTimeFormat" id="sTimeFormat" value="24" '+( ( this.tformat == 24 ) ? 'CHECKED' : '' )+' /> 24 hours</label> <label><input type="radio" name="sTimeFormat" id="sTimeFormat" value="12" '+( ( this.tformat == 12 ) ? 'CHECKED' : '' )+' /> 12 hours</label></div>';
120
  str += '<div><label>Default Time HH:mm</label><br /><input class="large" name="sDefaultTime" id="sDefaultTime" value="'+$.fbuilder.htmlEncode(this.defaultTime)+'" /></div>';
121
+ str += '<div class="width50 column"><label>Min Hour</label><br /><input class="large" name="sMinHour" id="sMinHour" value="'+$.fbuilder.htmlEncode(this.minHour)+'" /></div>';
122
+ str += '<div class="width50 columnr"><label>Min Minutes</label><br /><input class="large" name="sMinMinute" id="sMinMinute" value="'+$.fbuilder.htmlEncode(this.minMinute)+'" /></div>';
123
+ str += '<div class="width50 column"><label>Max Hour</label><br /><input class="large" name="sMaxHour" id="sMaxHour" value="'+$.fbuilder.htmlEncode(this.maxHour)+'" /></div>';
124
+ str += '<div class="width50 columnr"><label>Max Minutes</label><br /><input class="large" name="sMaxMinute" id="sMaxMinute" value="'+$.fbuilder.htmlEncode(this.maxMinute)+'" /></div>';
125
 
126
  str += '<div><label>Steps for hours</label><br /><input class="large" name="sStepHour" id="sStepHour" value="'+$.fbuilder.htmlEncode(this.stepHour)+'" /></div>';
127
  str += '<div><label>Steps for minutes</label><br /><input class="large" name="sStepMinute" id="sStepMinute" value="'+$.fbuilder.htmlEncode(this.stepMinute)+'" /></div>';
js/fields-admin/06_fbuilder.fcheck.js CHANGED
@@ -28,7 +28,7 @@
28
  },
29
  display:function()
30
  {
31
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
32
  var str = "";
33
  for (var i=0;i<this.choices.length;i++)
34
  {
@@ -192,7 +192,7 @@
192
  {
193
  var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
194
  for (var i=0;i<items.length;i++)
195
- if (items[i].name != me.name && items[i].ftype != 'fSectionBreak' && items[i].ftype != 'fPageBreak')
196
  str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+( ( typeof items[ i ].title != 'undefined' ) ? ' (' + items[ i ].title + ')' : '' ) +'</option>';
197
  $(this).html(str);
198
  });
@@ -214,7 +214,7 @@
214
  },
215
  showChoiceIntance: function()
216
  {
217
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
218
  var l = this.choices;
219
  var lv = this.choicesVal;
220
  var v = this.choiceSelected;
28
  },
29
  display:function()
30
  {
31
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
32
  var str = "";
33
  for (var i=0;i<this.choices.length;i++)
34
  {
192
  {
193
  var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
194
  for (var i=0;i<items.length;i++)
195
+ if (items[i].name != me.name && items[i].ftype != 'fPageBreak')
196
  str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+( ( typeof items[ i ].title != 'undefined' ) ? ' (' + items[ i ].title + ')' : '' ) +'</option>';
197
  $(this).html(str);
198
  });
214
  },
215
  showChoiceIntance: function()
216
  {
217
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
218
  var l = this.choices;
219
  var lv = this.choicesVal;
220
  var v = this.choiceSelected;
js/fields-admin/07_fbuilder.fradio.js CHANGED
@@ -17,6 +17,7 @@
17
  toSubmit:'text',
18
  choiceSelected:"",
19
  showDep:false,
 
20
  init:function()
21
  {
22
  this.choices = new Array("First Choice","Second Choice","Third Choice");
@@ -25,7 +26,7 @@
25
  },
26
  display:function()
27
  {
28
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
29
  var str = "";
30
  for (var i=0;i<this.choices.length;i++)
31
  {
@@ -168,13 +169,14 @@
168
  });
169
  var me = this,
170
  items = me.fBuild.getItems(),
171
- evt = [{s:'[name="sToSubmit"]', e:"click", l:"toSubmit"}];
 
172
  $('.dependencies').each(function()
173
  {
174
  var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
175
  for (var i=0;i<items.length;i++)
176
  {
177
- if (items[i].name != me.name && items[i].ftype != 'fSectionBreak' && items[i].ftype != 'fPageBreak')
178
  {
179
  str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+ ( ( typeof items[i].title != 'undefined' ) ? ' (' + items[i].title + ')' : '' ) + ' </option>';
180
  }
@@ -187,9 +189,13 @@
187
  {
188
  return '<div class="choicesSet"><label>Value to Submit</label><br /><div class="column width50"><label><input type="radio" name="sToSubmit" value="text" '+((this.toSubmit == 'text') ? ' CHECKED ' : '')+'/> Choice Text</label></div><div class="column width50"><label><input type="radio" name="sToSubmit" value="value" '+((this.toSubmit == 'value') ? ' CHECKED ' : '')+'/> Choice Value</label></div><div class="clearer"></div></div>';
189
  },
 
 
 
 
190
  showChoiceIntance: function()
191
  {
192
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
193
  var l = this.choices;
194
  var lv = this.choicesVal;
195
  if (!(typeof(this.choicesDep) != "undefined" && this.choicesDep !== null))
@@ -214,6 +220,6 @@
214
  str += '<div class="choicesEditDep"><span>If selected show:</span> <select class="dependencies" i="'+i+'" j="'+d[i].length+'" dname="'+this.name+'" dvalue="" ></select><div class="choice-ctrls"><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></div>';
215
  }
216
  }
217
- 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+this.attributeToSubmit()+'</div>';
218
  }
219
  });
17
  toSubmit:'text',
18
  choiceSelected:"",
19
  showDep:false,
20
+ untickAccepted:true,
21
  init:function()
22
  {
23
  this.choices = new Array("First Choice","Second Choice","Third Choice");
26
  },
27
  display:function()
28
  {
29
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
30
  var str = "";
31
  for (var i=0;i<this.choices.length;i++)
32
  {
169
  });
170
  var me = this,
171
  items = me.fBuild.getItems(),
172
+ evt = [{s:'[name="sToSubmit"]', e:"click", l:"toSubmit"},
173
+ {s:'[name="sUntickAccepted"]',e:"click", l:"untickAccepted",f:function(el){return el.is(':checked');}}];
174
  $('.dependencies').each(function()
175
  {
176
  var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
177
  for (var i=0;i<items.length;i++)
178
  {
179
+ if (items[i].name != me.name && items[i].ftype != 'fPageBreak')
180
  {
181
  str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+ ( ( typeof items[i].title != 'undefined' ) ? ' (' + items[i].title + ')' : '' ) + ' </option>';
182
  }
189
  {
190
  return '<div class="choicesSet"><label>Value to Submit</label><br /><div class="column width50"><label><input type="radio" name="sToSubmit" value="text" '+((this.toSubmit == 'text') ? ' CHECKED ' : '')+'/> Choice Text</label></div><div class="column width50"><label><input type="radio" name="sToSubmit" value="value" '+((this.toSubmit == 'value') ? ' CHECKED ' : '')+'/> Choice Value</label></div><div class="clearer"></div></div>';
191
  },
192
+ allowUntick: function()
193
+ {
194
+ return '<div><label><input type="checkbox" name="sUntickAccepted" '+((this.untickAccepted) ? ' CHECKED ' : '')+'/> Allow Untick Choices</label></div>';
195
+ },
196
  showChoiceIntance: function()
197
  {
198
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
199
  var l = this.choices;
200
  var lv = this.choicesVal;
201
  if (!(typeof(this.choicesDep) != "undefined" && this.choicesDep !== null))
220
  str += '<div class="choicesEditDep"><span>If selected show:</span> <select class="dependencies" i="'+i+'" j="'+d[i].length+'" dname="'+this.name+'" dvalue="" ></select><div class="choice-ctrls"><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></div>';
221
  }
222
  }
223
+ 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+this.attributeToSubmit()+this.allowUntick()+'</div>';
224
  }
225
  });
js/fields-admin/08_fbuilder.fdropdown.js CHANGED
@@ -29,7 +29,7 @@
29
  },
30
  display:function()
31
  {
32
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
33
  return '<div class="fields '+this.name+'" id="field'+this.form_identifier+'-'+this.index+'" title="'+this.name+'"><div class="arrow ui-icon ui-icon-play "></div><div title="Delete" class="remove ui-icon ui-icon-trash "></div><div title="Duplicate" class="copy ui-icon ui-icon-copy "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><select class="field disabled '+this.size+'" ><option>'+this.choiceSelected+'</option></select><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
34
  },
35
  editItemEvents:function()
@@ -192,7 +192,7 @@
192
  var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
193
  for (var i=0;i<items.length;i++)
194
  {
195
- if (items[i].name != me.name && items[i].ftype != 'fSectionBreak' && items[i].ftype != 'fPageBreak')
196
  {
197
  str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+( ( typeof items[ i ].title != 'undefined' ) ? ' (' + items[ i ].title + ')' : '' )+'</option>';
198
  }
@@ -216,7 +216,7 @@
216
  },
217
  showChoiceIntance: function()
218
  {
219
- this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
220
  if(typeof this.optgroup == 'undefined' ) this.optgroup = new Array();
221
 
222
  var l = this.choices,
29
  },
30
  display:function()
31
  {
32
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
33
  return '<div class="fields '+this.name+'" id="field'+this.form_identifier+'-'+this.index+'" title="'+this.name+'"><div class="arrow ui-icon ui-icon-play "></div><div title="Delete" class="remove ui-icon ui-icon-trash "></div><div title="Duplicate" class="copy ui-icon ui-icon-copy "></div><label>'+this.title+''+((this.required)?"*":"")+'</label><div class="dfield"><select class="field disabled '+this.size+'" ><option>'+this.choiceSelected+'</option></select><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
34
  },
35
  editItemEvents:function()
192
  var str = '<option value="" '+(("" == $(this).attr("dvalue"))?"selected":"")+'></option>';
193
  for (var i=0;i<items.length;i++)
194
  {
195
+ if (items[i].name != me.name && items[i].ftype != 'fPageBreak')
196
  {
197
  str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+( ( typeof items[ i ].title != 'undefined' ) ? ' (' + items[ i ].title + ')' : '' )+'</option>';
198
  }
216
  },
217
  showChoiceIntance: function()
218
  {
219
+ this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
220
  if(typeof this.optgroup == 'undefined' ) this.optgroup = new Array();
221
 
222
  var l = this.choices,
js/fields-admin/28_fbuilder.fcontainer.js CHANGED
@@ -12,14 +12,14 @@
12
  },
13
  showShortLabel:function(){ return ''; },
14
  showUserhelp:function(){ return ''; },
15
- showSpecialDataInstance: function()
16
  {
17
  var columns = [1,2,3,4],
18
  cStr = '';
19
  for( var i = 0, h = columns.length; i < h; i++ )
20
- {
21
  cStr += '<option value="'+columns[ i ]+'" '+( ( this.columns == columns[ i ] ) ? 'SELECTED' : '' )+'>'+columns[ i ]+' column'+( ( i ) ? 's' : '' )+'</option>';
22
- }
23
  return '<div><label>Columns</label><br /><select name="sColumns" id="sColumns">' + cStr + '</select><div class="clearer"><span class="uh">Shown in columns the fields into the container.</span></div></div>';
24
  },
25
  remove : function()
@@ -28,9 +28,9 @@
28
  for( var i = this.fields.length - 1, h = 0; i >= h; i-- )
29
  {
30
  this.fBuild.removeItem( fieldsIndex[this.fields[ i ]] );
31
- }
32
  },
33
- duplicateItem: function( currentField, newField )
34
  {
35
  for( var i = 0, h = this.fields.length; i < h; i++ )
36
  {
@@ -53,7 +53,7 @@
53
  return;
54
  }
55
  }
56
- }
57
  this.fields.push( newField );
58
  },
59
  after_show:function()
@@ -70,24 +70,23 @@
70
  {
71
  // Assign the parent
72
  items[ fieldsIndex[ me.fields[ i ] ] ][ 'parent' ] = me.name;
73
-
74
  var f = $( '.' + me.fields[ i ] );
75
  if( f.length )
76
  {
77
  f.detach().appendTo( e );
78
  tmp.push( me.fields[ i ] );
79
  }
80
- }
81
  }
82
  me.fields = tmp;
83
-
84
- e.sortable(
85
  {
86
  'connectWith': '.ui-sortable',
87
  'items': '.fields',
88
  'placeholder': 'ui-state-highlight',
89
  'tolerance': 'pointer',
90
- 'cursorAt': { 'top': 5, 'left': 5 },
91
  'update': function( event, ui )
92
  {
93
  var p = ui.item.parents('.fields');
12
  },
13
  showShortLabel:function(){ return ''; },
14
  showUserhelp:function(){ return ''; },
15
+ showSpecialDataInstance: function()
16
  {
17
  var columns = [1,2,3,4],
18
  cStr = '';
19
  for( var i = 0, h = columns.length; i < h; i++ )
20
+ {
21
  cStr += '<option value="'+columns[ i ]+'" '+( ( this.columns == columns[ i ] ) ? 'SELECTED' : '' )+'>'+columns[ i ]+' column'+( ( i ) ? 's' : '' )+'</option>';
22
+ }
23
  return '<div><label>Columns</label><br /><select name="sColumns" id="sColumns">' + cStr + '</select><div class="clearer"><span class="uh">Shown in columns the fields into the container.</span></div></div>';
24
  },
25
  remove : function()
28
  for( var i = this.fields.length - 1, h = 0; i >= h; i-- )
29
  {
30
  this.fBuild.removeItem( fieldsIndex[this.fields[ i ]] );
31
+ }
32
  },
33
+ duplicateItem: function( currentField, newField )
34
  {
35
  for( var i = 0, h = this.fields.length; i < h; i++ )
36
  {
53
  return;
54
  }
55
  }
56
+ }
57
  this.fields.push( newField );
58
  },
59
  after_show:function()
70
  {
71
  // Assign the parent
72
  items[ fieldsIndex[ me.fields[ i ] ] ][ 'parent' ] = me.name;
73
+
74
  var f = $( '.' + me.fields[ i ] );
75
  if( f.length )
76
  {
77
  f.detach().appendTo( e );
78
  tmp.push( me.fields[ i ] );
79
  }
80
+ }
81
  }
82
  me.fields = tmp;
83
+
84
+ e.sortable(
85
  {
86
  'connectWith': '.ui-sortable',
87
  'items': '.fields',
88
  'placeholder': 'ui-state-highlight',
89
  'tolerance': 'pointer',
 
90
  'update': function( event, ui )
91
  {
92
  var p = ui.item.parents('.fields');
js/fields-admin/fbuilder.fcalculated.js CHANGED
@@ -209,7 +209,7 @@
209
  var opt = '<option value=""></option>';
210
  for (var k=0;k<items.length;k++)
211
  {
212
- if (items[k].name != me.name && items[k].ftype != 'fSectionBreak' && items[k].ftype != 'fPageBreak')
213
  {
214
  opt += '<option value="'+items[k].name+'" '+( ( items[k].name == v ) ? 'selected="SELECTED"' : '' )+'>'+items[k].name+( ( typeof items[ k ].title != 'undefined' ) ? ' (' + items[ k ].title + ')' : '' ) + '</option>';
215
  }
209
  var opt = '<option value=""></option>';
210
  for (var k=0;k<items.length;k++)
211
  {
212
+ if (items[k].name != me.name && items[k].ftype != 'fPageBreak')
213
  {
214
  opt += '<option value="'+items[k].name+'" '+( ( items[k].name == v ) ? 'selected="SELECTED"' : '' )+'>'+items[k].name+( ( typeof items[ k ].title != 'undefined' ) ? ' (' + items[ k ].title + ')' : '' ) + '</option>';
215
  }
js/fields-public/01_fbuilder.ftext.js CHANGED
@@ -21,7 +21,7 @@
21
  this.maxlength = $.fbuilder.htmlEncode($.trim(this.maxlength));
22
  this.equalTo = $.fbuilder.htmlEncode($.trim(this.equalTo));
23
 
24
- return '<div class="fields '+this.csslayout+' cff-text-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'"'+((this.minlength.length) ? ' minlength="'+(this.minlength)+'"' : '')+((this.maxlength.length) ? ' maxlength="'+(this.maxlength)+'"' : '')+((this.equalTo.length) ? ' equalTo="#'+this.equalTo+this.form_identifier+'"':'' )+' class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+' type="text" value="'+$.fbuilder.htmlEncode(this.predefined)+'" /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
25
  },
26
  after_show:function()
27
  {
@@ -42,10 +42,11 @@
42
  $('#'+this.name).rules('add',{'pattern':this.regExp, messages:{'pattern':this.regExpMssg}});
43
  }
44
  },
45
- val:function()
46
  {
 
47
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
48
- if( e.length ) return $.fbuilder.parseValStr( e.val() );
49
  return 0;
50
  }
51
  }
21
  this.maxlength = $.fbuilder.htmlEncode($.trim(this.maxlength));
22
  this.equalTo = $.fbuilder.htmlEncode($.trim(this.equalTo));
23
 
24
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-text-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'"'+((this.minlength.length) ? ' minlength="'+(this.minlength)+'"' : '')+((this.maxlength.length) ? ' maxlength="'+(this.maxlength)+'"' : '')+((this.equalTo.length) ? ' equalTo="#'+this.equalTo+this.form_identifier+'"':'' )+' class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+' type="text" value="'+$.fbuilder.htmlEncode(this.predefined)+'" /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
25
  },
26
  after_show:function()
27
  {
42
  $('#'+this.name).rules('add',{'pattern':this.regExp, messages:{'pattern':this.regExpMssg}});
43
  }
44
  },
45
+ val:function(raw)
46
  {
47
+ raw = raw || false;
48
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
49
+ if( e.length ) return $.fbuilder.parseValStr( e.val(), raw );
50
  return 0;
51
  }
52
  }
js/fields-public/02_fbuilder.fcurrency.js CHANGED
@@ -14,14 +14,17 @@
14
  currencyText:"USD",
15
  thousandSeparator:",",
16
  centSeparator:".",
 
17
  min:"",
18
  max:"",
19
  formatDynamically:false,
20
 
21
  getFormattedValue:function( value )
22
  {
23
- var ts = this.thousandSeparator,
24
- cs = ((cs = $.trim(this.centSeparator)) !== '') ? cs : '.',
 
 
25
  v = $.fbuilder.parseVal(value, ts, cs),
26
  parts = [],
27
  counter = 0,
@@ -48,7 +51,7 @@
48
  }
49
  else parts[ 1 ] = '00';
50
 
51
- return this.currencySymbol+sign+parts.join(cs)+this.currencyText;
52
  }
53
  else
54
  {
@@ -57,7 +60,7 @@
57
  },
58
  show:function()
59
  {
60
- return '<div class="fields '+this.csslayout+' cff-currency-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input '+(( this.readonly )? 'readonly' : '' )+' id="'+this.name+'" name="'+this.name+'" class="field cffcurrency '+this.size+((this.required)?" required":"")+'" type="text" value="'+$.fbuilder.htmlEncode( this.getFormattedValue( this.predefined ) )+'" '+( ( !/^\s*$/.test( this.min) ) ? 'min="'+$.fbuilder.parseVal( this.min, this.thousandSeparator, this.centSeparator )+'" ' : '' )+( ( !/^\s*$/.test( this.max) ) ? ' max="'+$.fbuilder.parseVal( this.max, this.thousandSeparator, this.centSeparator )+'" ' : '' )+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
61
  },
62
  after_show:function()
63
  {
@@ -82,9 +85,9 @@
82
  r;
83
 
84
  e = $.fbuilder['forms'][f[0]].getItem( el.name );
85
- r = new RegExp('^\\s*('+esc(e.currencySymbol)+')?\\s*\\-?\\d+('+esc(e.thousandSeparator)+'\\d{3})*('+e.centSeparator+'\\d+)?\\s*('+esc(e.currencyText)+')?\\s*$','i');
86
 
87
- return this.optional(el) || r.test(v) || $.isNumeric(v);
88
  },
89
  $.validator.messages['currency']
90
  );
@@ -107,12 +110,15 @@
107
  };
108
  }
109
  },
110
- val:function()
111
  {
 
112
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
113
  if( e.length )
114
  {
115
- var v = $.trim( e.val() );
 
 
116
 
117
  v = v.replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.currencySymbol), 'g' ), '' )
118
  .replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.currencyText), 'g' ), '' );
14
  currencyText:"USD",
15
  thousandSeparator:",",
16
  centSeparator:".",
17
+ noCents: false,
18
  min:"",
19
  max:"",
20
  formatDynamically:false,
21
 
22
  getFormattedValue:function( value )
23
  {
24
+ if(value == '') return value;
25
+ var me = this,
26
+ ts = me.thousandSeparator,
27
+ cs = ((cs = $.trim(me.centSeparator)) !== '') ? cs : '.',
28
  v = $.fbuilder.parseVal(value, ts, cs),
29
  parts = [],
30
  counter = 0,
51
  }
52
  else parts[ 1 ] = '00';
53
 
54
+ return me.currencySymbol+sign+((me.noCents)?parts[0]:parts.join(cs))+me.currencyText;
55
  }
56
  else
57
  {
60
  },
61
  show:function()
62
  {
63
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-currency-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input '+(( this.readonly )? 'readonly' : '' )+' id="'+this.name+'" name="'+this.name+'" class="field cffcurrency '+this.size+((this.required)?" required":"")+'" type="text" value="'+$.fbuilder.htmlEncode( (this.formatDynamically) ? this.getFormattedValue( this.predefined ) : this.predefined )+'" '+( ( !/^\s*$/.test( this.min) ) ? 'min="'+$.fbuilder.parseVal( this.min, this.thousandSeparator, this.centSeparator )+'" ' : '' )+( ( !/^\s*$/.test( this.max) ) ? ' max="'+$.fbuilder.parseVal( this.max, this.thousandSeparator, this.centSeparator )+'" ' : '' )+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
64
  },
65
  after_show:function()
66
  {
85
  r;
86
 
87
  e = $.fbuilder['forms'][f[0]].getItem( el.name );
88
+ r = new RegExp('^\\s*('+esc(e.currencySymbol)+')?\\s*\\-?\\d+('+esc(e.thousandSeparator)+'\\d{3})*'+((e.noCents) ? '': '('+e.centSeparator+'\\d+)?')+'\\s*('+esc(e.currencyText)+')?\\s*$','i');
89
 
90
+ return this.optional(el) || r.test(v) || ($.isNumeric(v) && (!e.noCents || v === FLOOR(v)));
91
  },
92
  $.validator.messages['currency']
93
  );
110
  };
111
  }
112
  },
113
+ val:function(raw)
114
  {
115
+ raw = raw || false;
116
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
117
  if( e.length )
118
  {
119
+ var v = e.val();
120
+ if(raw) return ($.isNumeric(v)) ? v : $.fbuilder.parseValStr(v, raw);
121
+ v = $.trim(v);
122
 
123
  v = v.replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.currencySymbol), 'g' ), '' )
124
  .replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.currencyText), 'g' ), '' );
js/fields-public/02_fbuilder.fnumber.js CHANGED
@@ -19,6 +19,7 @@
19
  formats:new Array("digits","number"),
20
  getFormattedValue:function( value )
21
  {
 
22
  var ts = this.thousandSeparator,
23
  ds = ((ds=$.trim(this.decimalSymbol)) !== '') ? ds : '.',
24
  v = $.fbuilder.parseVal(value, ts, ds),
@@ -51,7 +52,7 @@
51
  {
52
  var _type = ( this.dformat == 'digits' || ( /^\s*$/.test( this.thousandSeparator ) && /^\s*\.\s*$/.test( this.decimalSymbol ) ) ) ? 'number' : 'text';
53
 
54
- return '<div class="fields '+this.csslayout+' cff-number-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+( ( !/^\s*$/.test( this.min) ) ? 'min="'+$.fbuilder.parseVal( this.min, this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+( ( !/^\s*$/.test( this.max) ) ? ' max="'+$.fbuilder.parseVal( this.max, this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+' class="field '+this.dformat+' '+this.size+((this.required)?" required":"")+'" type="'+_type+'" value="'+$.fbuilder.htmlEncode(this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
55
  },
56
  after_show:function()
57
  {
@@ -98,13 +99,14 @@
98
  };
99
  }
100
  },
101
- val:function()
102
  {
 
103
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
104
  if( e.length )
105
  {
106
  var v = $.trim( e.val() );
107
- return $.fbuilder.parseVal( v, this.thousandSeparator, this.decimalSymbol );
108
  }
109
  return 0;
110
  }
19
  formats:new Array("digits","number"),
20
  getFormattedValue:function( value )
21
  {
22
+ if(value == '') return value;
23
  var ts = this.thousandSeparator,
24
  ds = ((ds=$.trim(this.decimalSymbol)) !== '') ? ds : '.',
25
  v = $.fbuilder.parseVal(value, ts, ds),
52
  {
53
  var _type = ( this.dformat == 'digits' || ( /^\s*$/.test( this.thousandSeparator ) && /^\s*\.\s*$/.test( this.decimalSymbol ) ) ) ? 'number' : 'text';
54
 
55
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-number-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+( ( !/^\s*$/.test( this.min) ) ? 'min="'+$.fbuilder.parseVal( this.min, this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+( ( !/^\s*$/.test( this.max) ) ? ' max="'+$.fbuilder.parseVal( this.max, this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+' class="field '+this.dformat+' '+this.size+((this.required)?" required":"")+'" type="'+_type+'" value="'+$.fbuilder.htmlEncode((this.formatDynamically) ? this.getFormattedValue(this.predefined) : this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
56
  },
57
  after_show:function()
58
  {
99
  };
100
  }
101
  },
102
+ val:function(raw)
103
  {
104
+ raw = raw || false;
105
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
106
  if( e.length )
107
  {
108
  var v = $.trim( e.val() );
109
+ return ($.isNumeric(v)) ? v : ((raw) ? $.fbuilder.parseValStr( v, raw) : $.fbuilder.parseVal(v, this.thousandSeparator, this.decimalSymbol));
110
  }
111
  return 0;
112
  }
js/fields-public/02_fbuilder.fslider.js CHANGED
@@ -35,7 +35,7 @@
35
  },
36
  show:function()
37
  {
38
- return '<div class="fields '+this.csslayout+' cff-slider-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+'</label><div class="dfield slider-container"><input id="'+this.name+'" name="'+this.name+'" class="field" type="hidden" value="'+$.fbuilder.htmlEncode( $.trim( this.predefined ) )+'"/><div id="'+this.name+'_slider" class="slider '+this.size+'"></div><div class="corner_captions '+this.size+'"><span class="left-corner">'+this.minCaption+'</span><span class="right-corner" style="float:right;">'+this.maxCaption+'</span></div><div id="'+this.name+'_caption"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
39
  },
40
  set_values:function()
41
  {
35
  },
36
  show:function()
37
  {
38
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-slider-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+'</label><div class="dfield slider-container"><input id="'+this.name+'" name="'+this.name+'" class="field" type="hidden" value="'+$.fbuilder.htmlEncode( $.trim( this.predefined ) )+'"/><div id="'+this.name+'_slider" class="slider '+this.size+'"></div><div class="corner-captions '+this.size+'"><span class="left-corner">'+this.minCaption+'</span><span class="right-corner" style="float:right;">'+this.maxCaption+'</span></div><div id="'+this.name+'_caption" class="slider-caption"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
39
  },
40
  set_values:function()
41
  {
js/fields-public/03_fbuilder.femail.js CHANGED
@@ -13,12 +13,13 @@
13
  equalTo:"",
14
  show:function()
15
  {
16
- return '<div class="fields '+this.csslayout+' cff-email-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+((this.equalTo!="")?"equalTo=\"#"+$.fbuilder.htmlEncode(this.equalTo+this.form_identifier)+"\"":"" )+' class="field email '+this.size+((this.required)?" required":"")+'" type="email" value="'+$.fbuilder.htmlEncode(this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
17
  },
18
- val:function()
19
  {
 
20
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
21
- if( e.length ) return $.fbuilder.parseValStr( e.val() );
22
  return 0;
23
  }
24
  }
13
  equalTo:"",
14
  show:function()
15
  {
16
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-email-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+((this.equalTo!="")?"equalTo=\"#"+$.fbuilder.htmlEncode(this.equalTo+this.form_identifier)+"\"":"" )+' class="field email '+this.size+((this.required)?" required":"")+'" type="email" value="'+$.fbuilder.htmlEncode(this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
17
  },
18
+ val:function(raw)
19
  {
20
+ raw = raw || false;
21
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
22
+ if( e.length ) return $.fbuilder.parseValStr( e.val() , raw);
23
  return 0;
24
  }
25
  }
js/fields-public/04_fbuilder.fdate.js CHANGED
@@ -10,6 +10,7 @@
10
  size:"medium",
11
  required:false,
12
  dformat:"mm/dd/yyyy",
 
13
  tformat:"24",
14
  showDropdown:false,
15
  dropdownRange:"-10:+10",
@@ -30,43 +31,41 @@
30
  defaultDate:"",
31
  defaultTime:"",
32
  working_dates:[true,true,true,true,true,true,true],
33
- formats:new Array("mm/dd/yyyy","dd/mm/yyyy"),
34
  init:function()
35
  {
 
36
  function checkValue( v, min, max )
37
- {
38
- v = parseInt( v );
39
- if( isNaN( v ) ) v = max;
40
- else if( v < min ) v = min;
41
- else if( v > max ) v = max;
42
- return v;
43
- }
44
 
45
- this.minHour = checkValue( this.minHour, 0, 23 );
46
- this.maxHour = checkValue( this.maxHour, 0, 23 );
47
- this.minMinute = checkValue( this.minMinute, 0, 59 );
48
- this.maxMinute = checkValue( this.maxMinute, 0, 59 );
49
- this.stepHour = checkValue( this.stepHour, 1, Math.max( 1, this.maxHour - this.minHour ) );
50
- this.stepMinute = checkValue( this.stepMinute, 1, Math.max( 1, this.maxMinute - this.minMinute ) );
 
51
 
52
- this.invalidDates = this.invalidDates.replace( /\s+/g, '' );
53
- if( !/^\s*$/.test( this.invalidDates ) )
54
  {
55
  var dateRegExp = new RegExp( /^\d{1,2}\/\d{1,2}\/\d{4}$/ ),
56
  counter = 0,
57
- dates = this.invalidDates.split( ',' );
58
- this.invalidDates = [];
59
  for( var i = 0, h = dates.length; i < h; i++ )
60
  {
61
  var range = dates[ i ].split( '-' );
62
-
63
  if( range.length == 2 && range[0].match( dateRegExp ) != null && range[1].match( dateRegExp ) != null )
64
  {
65
  var fromD = new Date( range[ 0 ] ),
66
  toD = new Date( range[ 1 ] );
67
  while( fromD <= toD )
68
  {
69
- this.invalidDates[ counter ] = fromD;
70
  var tmp = new Date( fromD.valueOf() );
71
  tmp.setDate( tmp.getDate() + 1 );
72
  fromD = tmp;
@@ -80,7 +79,7 @@
80
  {
81
  if( range[ j ].match( dateRegExp ) != null )
82
  {
83
- this.invalidDates[ counter ] = new Date( range[ j ] );
84
  counter++;
85
  }
86
  }
@@ -90,79 +89,83 @@
90
  },
91
  get_hours:function()
92
  {
93
- var str = '',
 
94
  i = 0,
95
  h,
96
- from = ( this.tformat == 12 ) ? 1 : this.minHour,
97
- to = ( this.tformat == 12 ) ? 12 : this.maxHour;
98
 
99
- while( ( h = from + this.stepHour * i ) <= to )
100
  {
101
 
102
  if( h < 10 ) h = '0'+''+h;
103
  str += '<option value="' + h + '">' + h + '</option>';
104
  i++;
105
  }
106
- return '<select id="'+this.name+'_hours" name="'+this.name+'_hours">' + str + '</select>:';
107
  },
108
  get_minutes:function()
109
  {
110
- var str = '',
 
111
  i = 0,
112
- m;
 
 
113
 
114
- while( ( m = this.minMinute + this.stepMinute * i ) <= this.maxMinute )
115
  {
116
- if( m < 10 )
117
- {
118
- m = '0'+''+m;
119
- }
120
  str += '<option value="' + m + '">' + m + '</option>';
121
  i++;
122
  }
123
- return '<select id="'+this.name+'_minutes" name="'+this.name+'_minutes">' + str + '</select>';
124
  },
125
  get_ampm:function()
126
  {
127
  var str = '';
128
  if( this.tformat == 12 )
129
  {
130
- return '<select id="'+this.name+'_ampm"><option value="am">am</option><option value="pm">pm</option></select>';
131
  }
132
  return str;
133
  },
134
  set_date_time:function()
135
  {
136
- var str = $( '#'+this.name+'_date' ).val();
137
- if( this.showTimepicker )
 
138
  {
139
- var h = $( '#'+this.name+'_hours' ).val()*1;
140
  str += ' ';
141
- if( this.tformat == 12 )
142
  {
143
  h = (h==12) ? 0 : h;
144
- if( $( '#'+this.name+'_ampm' ).val() == 'pm' ) str += ( h + 12 );
145
  else str += h;
146
  }
147
  else str += h;
148
- str += ':'+$( '#'+this.name+'_minutes' ).val();
149
  }
150
- $( '#'+this.name ).val( str ).change();
151
  },
152
  show:function()
153
  {
154
- var attr = 'value',
 
 
155
  format_label = [],
156
  date_tag_type = 'text',
157
  disabled = '',
158
- date_tag_class = 'field date'+this.dformat.replace(/\//g,"")+' '+this.size+((this.required)?' required': '');
159
 
160
- if( this.predefinedClick ) attr = 'placeholder';
161
- if( this.showDatepicker ) format_label.push(this.dformat);
162
  else{ date_tag_type = 'hidden'; disabled='disabled';}
163
- if( this.showTimepicker ) format_label.push('HH:mm');
164
 
165
- return '<div class="fields '+this.csslayout+' cff-date-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+( (format_label.length) ? ' <span class="dformat">('+format_label.join(' ')+')</span>' : '' )+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" type="hidden" value="'+$.fbuilder.htmlEncode(this.predefined)+'"/><input id="'+this.name+'_date" name="'+this.name+'_date" class="'+date_tag_class+'" type="'+date_tag_type+'" '+attr+'="'+$.fbuilder.htmlEncode(this.predefined)+'" '+disabled+' />'+( ( this.showTimepicker ) ? ' '+this.get_hours()+this.get_minutes()+' '+this.get_ampm() : '' )+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
166
  },
167
  setDefaultDate : function()
168
  {
@@ -181,16 +184,17 @@
181
  if( me.dropdownRange.indexOf( ':' ) == -1 ) me.dropdownRange = '-10:+10';
182
  p = $.extend(p,{changeMonth: true,changeYear: true,yearRange: me.dropdownRange});
183
  }
184
- p = $.extend(p, { beforeShowDay: ( function ( w, i ) { return function( d ){ return me.validateDate( d, w, i ); }; } )( me.working_dates, me.invalidDates ) } );
185
  dp.datepicker(p);
186
  if( !me.predefinedClick ) dp.datepicker( "setDate", dd);
187
- if( !me.validateDate( dp.datepicker( "getDate"), me.working_dates, me.invalidDates)[ 0 ] )
188
  {
189
  dp.datepicker( "setDate", '');
190
  }
191
  },
192
  setDefaultTime : function()
193
  {
 
194
  function setValue( f, v, m )
195
  {
196
  v = Math.min( v*1, m*1 );
@@ -198,10 +202,10 @@
198
  $( '#' + f + ' [value="' + v + '"]' ).prop( 'selected', true );
199
  };
200
 
201
- if( this.showTimepicker )
202
  {
203
  var parts, time = {}, tmp = 0;
204
- if( ( parts = /(\d{1,2}):(\d{1,2})/g.exec( this.defaultTime ) ) != null )
205
  {
206
  time[ 'hour' ] = parts[ 1 ];
207
  time[ 'minute' ] = parts[ 2 ];
@@ -209,18 +213,20 @@
209
  else
210
  {
211
  var d = new Date();
212
- time[ 'hour' ] = d.getHours();
213
  time[ 'minute' ] = d.getMinutes();
 
 
214
  }
215
 
216
  setValue(
217
- this.name+'_hours',
218
- ( this.tformat == 12 ) ? ( ( time[ 'hour' ] > 12 ) ? time[ 'hour' ] - 12 : ( ( time[ 'hour' ] == 0 ) ? 12 : time[ 'hour' ] ) ) : time[ 'hour' ],
219
- ( this.tformat == 12 ) ? 12 : this.maxHour
220
  );
221
 
222
- setValue( this.name+'_minutes', time[ 'minute' ], this.maxMinute );
223
- $( '#'+this.name+'_ampm'+' [value="' + ( ( time[ 'hour' ] < 12 ) ? 'am' : 'pm' ) + '"]' ).prop( 'selected', true );
224
  }
225
  },
226
  setEvents : function()
@@ -241,18 +247,17 @@
241
  validateDate: function( d, w, i )
242
  {
243
  try{
244
- if( d === null ) return [false,""];
245
- if ( !w[ d.getDay()]) return [false,""];
246
  if( i !== null )
247
  {
248
  for( var j = 0, h = i.length; j < h; j++ )
249
  {
250
- if( d.getDate() == i[ j ].getDate() && d.getMonth() == i[ j ].getMonth() && d.getFullYear() == i[ j ].getFullYear() ) return [false,""];
251
  }
252
  }
253
  }
254
  catch( _err ){}
255
- return [true,""];
256
  },
257
  validateTime : function( e, i )
258
  {
@@ -266,71 +271,79 @@
266
  if( $('#'+base+'_ampm').val() == 'pm' && h != 12 ) h = h*1 + 12;
267
  if( $('#'+base+'_ampm').val() == 'am' && h == 12 ) h = 0;
268
  }
269
- if( h < i.minHour || h > i.maxHour ) return false;
 
 
 
 
 
270
  }
271
  return true;
272
  },
273
  after_show:function()
274
  {
275
- var me = this;
276
- var validator = function( v, e )
277
- {
278
-
279
- try
280
  {
281
- var _dp = $.datepicker,
282
- _fb = $.fbuilder,
283
- p = e.name.replace( '_date', '' ).split( '_' ),
284
- _index = ( p.length > 1 ) ? '_'+p[ 1 ] : '',
285
- item = (
286
- typeof _fb[ 'forms' ] != 'undefined' &&
287
- typeof _fb[ 'forms' ][ _index ] != 'undefined'
288
- ) ? _fb[ 'forms' ][ _index ].getItem( p[ 0 ]+'_'+p[ 1 ] ) : null,
289
- inst = _dp._getInst( e ),
290
- minDate = _dp._determineDate( inst, _dp._get( inst, 'minDate'), null),
291
- maxDate = _dp._determineDate(inst, _dp._get(inst, 'maxDate'), null),
292
- dateFormat = _dp._get(inst, 'dateFormat'),
293
- date = _dp.parseDate(dateFormat, v, _dp._getFormatConfig(inst));
294
 
295
- if( item != null )
296
  {
297
- return this.optional( e ) ||
298
- (
299
- ( minDate == null || date >= minDate ) &&
300
- ( maxDate == null || date <= maxDate ) &&
301
- item.validateDate( $( e ).datepicker( 'getDate' ), item.working_dates, item.invalidDates )[ 0 ] &&
302
- item.validateTime( e, item )
303
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  }
305
- return true;
306
- }
307
- catch( er )
308
- {
309
- return false;
310
- }
311
- };
312
 
313
- if(!('dateddmmyyyy' in $.validator.methods)) $.validator.addMethod("dateddmmyyyy", validator );
314
- if(!('datemmddyyyy' in $.validator.methods)) $.validator.addMethod("datemmddyyyy", validator );
315
 
316
  me.setDefaultDate();
317
  me.setDefaultTime();
318
  me.setEvents();
319
  me.set_date_time();
320
  },
321
- val:function()
322
  {
323
- var e = $( '[id="' + this.name + '"]:not(.ignore)' );
 
 
 
324
  if( e.length )
325
  {
326
- var rt;
327
- if( this.dformat == 'yyyy/mm/dd' || this.dformat == 'yyyy/dd/mm' )
 
 
328
  rt = '(\\d{4})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{1,2})';
329
  else
330
  rt = '(\\d{1,2})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{4})';
331
 
332
- var v = $.trim( e.val() ),
333
- re = new RegExp( rt+'(\\s(\\d{1,2})[:\\.](\\d{1,2}))?' ),
334
  d = re.exec( v ),
335
  h = 0,
336
  m = 0,
@@ -341,7 +354,7 @@
341
  if( typeof d[ 5 ] != 'undefined' ) h = d[ 5 ];
342
  if( typeof d[ 6 ] != 'undefined' ) m = d[ 6 ];
343
 
344
- switch( this.dformat )
345
  {
346
  case 'yyyy/dd/mm':
347
  date = new Date( d[ 1 ], ( d[ 3 ] * 1 - 1 ), d[ 2 ], h, m, 0, 0 );
@@ -357,7 +370,7 @@
357
  break;
358
  }
359
 
360
- if( this.showTimepicker )
361
  {
362
  return date.valueOf() / 86400000;
363
  }
10
  size:"medium",
11
  required:false,
12
  dformat:"mm/dd/yyyy",
13
+ dseparator:"/",
14
  tformat:"24",
15
  showDropdown:false,
16
  dropdownRange:"-10:+10",
31
  defaultDate:"",
32
  defaultTime:"",
33
  working_dates:[true,true,true,true,true,true,true],
 
34
  init:function()
35
  {
36
+ var me = this;
37
  function checkValue( v, min, max )
38
+ {
39
+ v = parseInt( v );
40
+ v = ( isNaN( v ) ) ? max : v;
41
+ return Math.min(Math.max(v,min),max);
42
+ }
 
 
43
 
44
+ me.minHour = checkValue( me.minHour, 0, 23 );
45
+ me.maxHour = checkValue( me.maxHour, 0, 23 );
46
+ me.minMinute = checkValue( me.minMinute, 0, 59 );
47
+ me.maxMinute = checkValue( me.maxMinute, 0, 59 );
48
+ me.stepHour = checkValue( me.stepHour, 1, Math.max( 1, me.maxHour - me.minHour ) );
49
+ me.stepMinute = checkValue( me.stepMinute, 1, Math.max( 1, me.maxMinute - me.minMinute ) );
50
+ me.dformat = me.dformat.replace(/\//g, me.dseparator);
51
 
52
+ me.invalidDates = me.invalidDates.replace( /\s+/g, '' );
53
+ if( !/^\s*$/.test( me.invalidDates ) )
54
  {
55
  var dateRegExp = new RegExp( /^\d{1,2}\/\d{1,2}\/\d{4}$/ ),
56
  counter = 0,
57
+ dates = me.invalidDates.split( ',' );
58
+ me.invalidDates = [];
59
  for( var i = 0, h = dates.length; i < h; i++ )
60
  {
61
  var range = dates[ i ].split( '-' );
 
62
  if( range.length == 2 && range[0].match( dateRegExp ) != null && range[1].match( dateRegExp ) != null )
63
  {
64
  var fromD = new Date( range[ 0 ] ),
65
  toD = new Date( range[ 1 ] );
66
  while( fromD <= toD )
67
  {
68
+ me.invalidDates[ counter ] = fromD;
69
  var tmp = new Date( fromD.valueOf() );
70
  tmp.setDate( tmp.getDate() + 1 );
71
  fromD = tmp;
79
  {
80
  if( range[ j ].match( dateRegExp ) != null )
81
  {
82
+ me.invalidDates[ counter ] = new Date( range[ j ] );
83
  counter++;
84
  }
85
  }
89
  },
90
  get_hours:function()
91
  {
92
+ var me = this,
93
+ str = '',
94
  i = 0,
95
  h,
96
+ from = ( me.tformat == 12 ) ? 1 : me.minHour,
97
+ to = ( me.tformat == 12 ) ? 12 : me.maxHour;
98
 
99
+ while( ( h = from + me.stepHour * i ) <= to )
100
  {
101
 
102
  if( h < 10 ) h = '0'+''+h;
103
  str += '<option value="' + h + '">' + h + '</option>';
104
  i++;
105
  }
106
+ return '<select id="'+me.name+'_hours" name="'+me.name+'_hours" class="hours-component">' + str + '</select>:';
107
  },
108
  get_minutes:function()
109
  {
110
+ var me = this,
111
+ str = '',
112
  i = 0,
113
+ m,
114
+ n = (me.minHour == me.maxHour)?me.minMinute : 0,
115
+ x = (me.minHour == me.maxHour)?me.maxMinute : 59;
116
 
117
+ while( ( m = n + me.stepMinute * i ) <= x )
118
  {
119
+ if( m < 10 ) m = '0'+''+m;
 
 
 
120
  str += '<option value="' + m + '">' + m + '</option>';
121
  i++;
122
  }
123
+ return '<select id="'+me.name+'_minutes" name="'+me.name+'_minutes" class="minutes-component">' + str + '</select>';
124
  },
125
  get_ampm:function()
126
  {
127
  var str = '';
128
  if( this.tformat == 12 )
129
  {
130
+ return '<select id="'+this.name+'_ampm" class="ampm-component"><option value="am">am</option><option value="pm">pm</option></select>';
131
  }
132
  return str;
133
  },
134
  set_date_time:function()
135
  {
136
+ var me = this,
137
+ str = $( '#'+me.name+'_date' ).val();
138
+ if( me.showTimepicker )
139
  {
140
+ var h = $( '#'+me.name+'_hours' ).val()*1;
141
  str += ' ';
142
+ if( me.tformat == 12 )
143
  {
144
  h = (h==12) ? 0 : h;
145
+ if( $( '#'+me.name+'_ampm' ).val() == 'pm' ) str += ( h + 12 );
146
  else str += h;
147
  }
148
  else str += h;
149
+ str += ':'+$( '#'+me.name+'_minutes' ).val();
150
  }
151
+ $( '#'+me.name ).val( str ).change();
152
  },
153
  show:function()
154
  {
155
+ var me = this,
156
+ n = me.name,
157
+ attr = 'value',
158
  format_label = [],
159
  date_tag_type = 'text',
160
  disabled = '',
161
+ date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required)?' required': '');
162
 
163
+ if( me.predefinedClick ) attr = 'placeholder';
164
+ if( me.showDatepicker ) format_label.push(me.dformat);
165
  else{ date_tag_type = 'hidden'; disabled='disabled';}
166
+ if( me.showTimepicker ) format_label.push('HH:mm');
167
 
168
+ return '<div class="fields '+me.csslayout+' '+n+' cff-date-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+n+'">'+me.title+''+((me.required)?"<span class='r'>*</span>":"")+( (format_label.length) ? ' <span class="dformat">('+format_label.join(' ')+')</span>' : '' )+'</label><div class="dfield"><input id="'+n+'" name="'+n+'" type="hidden" value="'+$.fbuilder.htmlEncode(me.predefined)+'"/><input id="'+n+'_date" name="'+n+'_date" class="'+date_tag_class+' date-component" type="'+date_tag_type+'" '+attr+'="'+$.fbuilder.htmlEncode(me.predefined)+'" '+disabled+' />'+( ( me.showTimepicker ) ? ' '+me.get_hours()+me.get_minutes()+' '+me.get_ampm() : '' )+'<span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
169
  },
170
  setDefaultDate : function()
171
  {
184
  if( me.dropdownRange.indexOf( ':' ) == -1 ) me.dropdownRange = '-10:+10';
185
  p = $.extend(p,{changeMonth: true,changeYear: true,yearRange: me.dropdownRange});
186
  }
187
+ p = $.extend(p, { beforeShowDay: ( function ( w, i ) { return function( d ){ return [me.validateDate( d, w, i ), ""]; }; } )( me.working_dates, me.invalidDates ) } );
188
  dp.datepicker(p);
189
  if( !me.predefinedClick ) dp.datepicker( "setDate", dd);
190
+ if( !me.validateDate( dp.datepicker( "getDate"), me.working_dates, me.invalidDates) )
191
  {
192
  dp.datepicker( "setDate", '');
193
  }
194
  },
195
  setDefaultTime : function()
196
  {
197
+ var me = this;
198
  function setValue( f, v, m )
199
  {
200
  v = Math.min( v*1, m*1 );
202
  $( '#' + f + ' [value="' + v + '"]' ).prop( 'selected', true );
203
  };
204
 
205
+ if( me.showTimepicker )
206
  {
207
  var parts, time = {}, tmp = 0;
208
+ if( ( parts = /(\d{1,2}):(\d{1,2})/g.exec( me.defaultTime ) ) != null )
209
  {
210
  time[ 'hour' ] = parts[ 1 ];
211
  time[ 'minute' ] = parts[ 2 ];
213
  else
214
  {
215
  var d = new Date();
216
+ time[ 'hour' ] = Math.min(Math.max(d.getHours(), me.minHour), me.maxHour);
217
  time[ 'minute' ] = d.getMinutes();
218
+ if(time[ 'hour' ] == me.minHour) time[ 'minute' ] = Math.max(time['minute'],me.minMinute);
219
+ if(time[ 'hour' ] == me.maxHour) time[ 'minute' ] = Math.min(time['minute'],me.maxMinute);
220
  }
221
 
222
  setValue(
223
+ me.name+'_hours',
224
+ ( me.tformat == 12 ) ? ( ( time[ 'hour' ] > 12 ) ? time[ 'hour' ] - 12 : ( ( time[ 'hour' ] == 0 ) ? 12 : time[ 'hour' ] ) ) : time[ 'hour' ],
225
+ ( me.tformat == 12 ) ? 12 : me.maxHour
226
  );
227
 
228
+ setValue( me.name+'_minutes', time[ 'minute' ], me.maxMinute );
229
+ $( '#'+me.name+'_ampm'+' [value="' + ( ( time[ 'hour' ] < 12 ) ? 'am' : 'pm' ) + '"]' ).prop( 'selected', true );
230
  }
231
  },
232
  setEvents : function()
247
  validateDate: function( d, w, i )
248
  {
249
  try{
250
+ if( d === null || !w[ d.getDay()] ) return false;
 
251
  if( i !== null )
252
  {
253
  for( var j = 0, h = i.length; j < h; j++ )
254
  {
255
+ if( d.getDate() == i[ j ].getDate() && d.getMonth() == i[ j ].getMonth() && d.getFullYear() == i[ j ].getFullYear() ) return false;
256
  }
257
  }
258
  }
259
  catch( _err ){}
260
+ return true;
261
  },
262
  validateTime : function( e, i )
263
  {
271
  if( $('#'+base+'_ampm').val() == 'pm' && h != 12 ) h = h*1 + 12;
272
  if( $('#'+base+'_ampm').val() == 'am' && h == 12 ) h = 0;
273
  }
274
+ if(
275
+ h < i.minHour ||
276
+ i.maxHour < h ||
277
+ (h == i.minHour && m < i.minMinute) ||
278
+ (h == i.maxHour && i.maxMinute < m)
279
+ ) return false;
280
  }
281
  return true;
282
  },
283
  after_show:function()
284
  {
285
+ var me = this,
286
+ date_format = 'date'+me.dformat.replace(/[^a-z]/ig,""),
287
+ validator = function( v, e )
 
 
288
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
289
 
290
+ try
291
  {
292
+ var _dp = $.datepicker,
293
+ _fb = $.fbuilder,
294
+ p = e.name.replace('_date', '').split('_'),
295
+ _index = (p.length > 1) ? '_'+p[ 1 ] : '',
296
+ item = ('forms' in _fb && _index in _fb[ 'forms' ])
297
+ ? _fb[ 'forms' ][ _index ].getItem(p[ 0 ]+'_'+p[ 1 ]) : null,
298
+ inst = _dp._getInst( e ),
299
+ minDate = _dp._determineDate( inst, _dp._get( inst, 'minDate'), null),
300
+ maxDate = _dp._determineDate(inst, _dp._get(inst, 'maxDate'), null),
301
+ dateFormat = _dp._get(inst, 'dateFormat'),
302
+ date = _dp.parseDate(dateFormat, v, _dp._getFormatConfig(inst));
303
+
304
+ if( item != null )
305
+ {
306
+ return this.optional( e ) ||
307
+ (
308
+ ( minDate == null || date >= minDate ) &&
309
+ ( maxDate == null || date <= maxDate ) &&
310
+ item.validateDate( $( e ).datepicker( 'getDate' ), item.working_dates, item.invalidDates ) &&
311
+ item.validateTime( e, item )
312
+ );
313
+ }
314
+ return true;
315
  }
316
+ catch( er )
317
+ {
318
+ return false;
319
+ }
320
+ };
 
 
321
 
322
+ if(!(date_format in $.validator.methods)) $.validator.addMethod(date_format, validator );
 
323
 
324
  me.setDefaultDate();
325
  me.setDefaultTime();
326
  me.setEvents();
327
  me.set_date_time();
328
  },
329
+ val:function(raw)
330
  {
331
+ raw = raw || false;
332
+ var me = this,
333
+ e = $( '[id="' + me.name + '"]:not(.ignore)' ),
334
+ dformat = me.dformat.replace(new RegExp('\\'+me.dseparator, 'g'), '/');
335
  if( e.length )
336
  {
337
+ var v = e.val(), rt;
338
+ if(raw) return $.fbuilder.parseValStr(v, raw);
339
+
340
+ if( dformat == 'yyyy/mm/dd' || dformat == 'yyyy/dd/mm' )
341
  rt = '(\\d{4})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{1,2})';
342
  else
343
  rt = '(\\d{1,2})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{4})';
344
 
345
+ v = $.trim(e.val());
346
+ var re = new RegExp( rt+'(\\s(\\d{1,2})[:\\.](\\d{1,2}))?' ),
347
  d = re.exec( v ),
348
  h = 0,
349
  m = 0,
354
  if( typeof d[ 5 ] != 'undefined' ) h = d[ 5 ];
355
  if( typeof d[ 6 ] != 'undefined' ) m = d[ 6 ];
356
 
357
+ switch( dformat )
358
  {
359
  case 'yyyy/dd/mm':
360
  date = new Date( d[ 1 ], ( d[ 3 ] * 1 - 1 ), d[ 2 ], h, m, 0, 0 );
370
  break;
371
  }
372
 
373
+ if( me.showTimepicker )
374
  {
375
  return date.valueOf() / 86400000;
376
  }
js/fields-public/05_fbuilder.ftextarea.js CHANGED
@@ -15,12 +15,13 @@
15
  rows:4,
16
  show:function()
17
  {
18
- return '<div class="fields '+this.csslayout+' cff-textarea-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><textarea '+((!/^\s*$/.test(this.rows)) ? 'rows='+this.rows : '' )+' id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+$.fbuilder.htmlEncode(this.maxlength)+'" class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+'>'+((!this.predefinedClick) ? this.predefined : '')+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
19
  },
20
- val:function()
21
  {
 
22
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
23
- if( e.length ) return $.fbuilder.parseValStr( e.val().replace( /[\n\r]+/g, ' ') );
24
  return 0;
25
  }
26
  }
15
  rows:4,
16
  show:function()
17
  {
18
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-textarea-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><textarea '+((!/^\s*$/.test(this.rows)) ? 'rows='+this.rows : '' )+' id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+$.fbuilder.htmlEncode(this.maxlength)+'" class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+'>'+((!this.predefinedClick) ? this.predefined : '')+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
19
  },
20
+ val:function(raw)
21
  {
22
+ raw = raw || false;
23
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
24
+ if( e.length ) return $.fbuilder.parseValStr(e.val().replace(/[\n\r]+/g, ' '), raw);
25
  return 0;
26
  }
27
  }
js/fields-public/06_fbuilder.fcheck.js CHANGED
@@ -30,9 +30,9 @@
30
 
31
  classDep = (this.choicesDep[ i ].length) ? 'depItem': '';
32
 
33
- str += '<div class="'+this.layout+'"><label><input name="'+this.name+'[]" id="'+this.name+'" class="field '+classDep+' group '+((this.required)?" required":"")+'" value="'+$.fbuilder.htmlEncode(this.choicesVal[i])+'" vt="'+$.fbuilder.htmlEncode((this.toSubmit == 'text') ? this.choices[i] : this.choicesVal[i])+'" type="checkbox" '+((this.choiceSelected[i])?"checked":"")+'/> <span>'+$.fbuilder.htmlDecode( this.choices[i] )+'</span></label></div>';
34
  }
35
- return '<div class="fields '+this.csslayout+' cff-checkbox-field" id="field'+this.form_identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
36
  },
37
  after_show:function()
38
  {
@@ -52,7 +52,7 @@
52
  showHideDep:function( toShow, toHide, hiddenByContainer )
53
  {
54
  var me = this,
55
- item = $( '[id="'+me.name+'"]' ),
56
  form_identifier = me.form_identifier,
57
  isHidden = (typeof toHide[ me.name ] != 'undefined' || typeof hiddenByContainer[ me.name ] != 'undefined' ),
58
  result = [];
@@ -77,7 +77,7 @@
77
 
78
  if( typeof toShow[ dep ] == 'undefined' )
79
  {
80
- $( '#'+dep ).closest( '.fields' ).hide();
81
  $( '[id*="'+dep+'"]:not(.ignore)' ).addClass( 'ignore' );
82
  toHide[ dep ] = {};
83
  }
@@ -90,7 +90,7 @@
90
  toShow[ dep ][ 'ref' ][ me.name+'_'+i ] = 1;
91
  if(!(dep in hiddenByContainer))
92
  {
93
- $( '#'+dep ).closest( '.fields' ).show();
94
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
95
  }
96
  }
@@ -102,17 +102,19 @@
102
  catch( e ){ }
103
  return result;
104
  },
105
- val:function()
106
  {
107
- var e = $( '[id="' + this.name + '"]:checked:not(.ignore)' ),
108
- v, me = this;
109
- if(!me.merge) v = [];
 
 
110
  if( e.length )
111
  {
112
  e.each( function(){
113
- var t = $.fbuilder[(me.merge)?'parseVal':'parseValStr']( this.value );
114
  if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
115
- if(me.merge) v = (v)?v+t:t;
116
  else v.push(t);
117
  });
118
  }
@@ -122,13 +124,13 @@
122
  {
123
  var t, n = this.name;
124
  if( !$.isArray( v ) ) v = [v];
125
- $( '[id="'+n+'"]' ).prop( 'checked', false );
126
  for( var i in v )
127
  {
128
  t = (new String(v[i])).replace(/(['"])/g, "\\$1");
129
- $( '[id="'+n+'"][vt="'+t+'"],[id="'+n+'"][value="'+t+'"]' ).prop( 'checked', true );
130
  }
131
- $( '[id="'+n+'"]' ).change();
132
  }
133
  }
134
  );
30
 
31
  classDep = (this.choicesDep[ i ].length) ? 'depItem': '';
32
 
33
+ str += '<div class="'+this.layout+'"><label for="'+this.name+'_cb'+i+'"><input name="'+this.name+'[]" id="'+this.name+'_cb'+i+'" class="field '+classDep+' group '+((this.required)?" required":"")+'" value="'+$.fbuilder.htmlEncode(this.choicesVal[i])+'" vt="'+$.fbuilder.htmlEncode((this.toSubmit == 'text') ? this.choices[i] : this.choicesVal[i])+'" type="checkbox" '+((this.choiceSelected[i])?"checked":"")+'/> <span>'+$.fbuilder.htmlDecode( this.choices[i] )+'</span></label></div>';
34
  }
35
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-checkbox-field" id="field'+this.form_identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
36
  },
37
  after_show:function()
38
  {
52
  showHideDep:function( toShow, toHide, hiddenByContainer )
53
  {
54
  var me = this,
55
+ item = $( '[id*="'+me.name+'"]' ),
56
  form_identifier = me.form_identifier,
57
  isHidden = (typeof toHide[ me.name ] != 'undefined' || typeof hiddenByContainer[ me.name ] != 'undefined' ),
58
  result = [];
77
 
78
  if( typeof toShow[ dep ] == 'undefined' )
79
  {
80
+ $( '[id*="'+dep+'"],.'+dep ).closest( '.fields' ).hide();
81
  $( '[id*="'+dep+'"]:not(.ignore)' ).addClass( 'ignore' );
82
  toHide[ dep ] = {};
83
  }
90
  toShow[ dep ][ 'ref' ][ me.name+'_'+i ] = 1;
91
  if(!(dep in hiddenByContainer))
92
  {
93
+ $( '[id*="'+dep+'"],.'+dep ).closest( '.fields' ).show();
94
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
95
  }
96
  }
102
  catch( e ){ }
103
  return result;
104
  },
105
+ val:function(raw)
106
  {
107
+ raw = raw || false;
108
+ var v, me = this, m = me.merge && !raw,
109
+ e = $('[id*="' + me.name + '"]:checked:not(.ignore)');
110
+
111
+ if(!m) v = [];
112
  if( e.length )
113
  {
114
  e.each( function(){
115
+ var t = (m) ? $.fbuilder.parseVal(this.value) : $.fbuilder.parseValStr(this.value, raw);
116
  if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
117
+ if(m) v = (v)?v+t:t;
118
  else v.push(t);
119
  });
120
  }
124
  {
125
  var t, n = this.name;
126
  if( !$.isArray( v ) ) v = [v];
127
+ $( '[id*="'+n+'"]' ).prop( 'checked', false );
128
  for( var i in v )
129
  {
130
  t = (new String(v[i])).replace(/(['"])/g, "\\$1");
131
+ $( '[id*="'+n+'"][vt="'+t+'"],[id*="'+n+'"][value="'+t+'"]' ).prop( 'checked', true );
132
  }
133
+ $( '[id*="'+n+'"]' ).change();
134
  }
135
  }
136
  );
js/fields-public/07_fbuilder.fradio.js CHANGED
@@ -10,6 +10,7 @@
10
  toSubmit:"text",
11
  choiceSelected:"",
12
  showDep:false,
 
13
  show:function()
14
  {
15
  this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
@@ -34,27 +35,31 @@
34
 
35
  for (var i=0;i<l;i++)
36
  {
37
- str += '<div class="'+this.layout+'"><label><input name="'+this.name+'" id="'+this.name+'" class="field '+classDep+' group '+((this.required)?" required":"")+'" value="'+$.fbuilder.htmlEncode(this.choicesVal[i])+'" vt="'+$.fbuilder.htmlEncode((this.toSubmit=='text') ? this.choices[i] : this.choicesVal[i])+'" type="radio" '+((this.choices[i]+' - '+this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> <span>'+$.fbuilder.htmlDecode( this.choices[i] )+'</span></label></div>';
38
  }
39
 
40
- return '<div class="fields '+this.csslayout+' cff-radiobutton-field" id="field'+this.form_identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
41
  },
42
  after_show: function()
43
  {
44
- var n = this.name;
45
- $(document).off('click', '[id*="'+n+'"]').on('click', '[id*="'+n+'"]', function(){
46
- var m = this,
47
- e = $(m);
 
 
 
48
 
49
- $('[id*="'+n+'"]').each(function(){if(m !== this) $(this).data('previous-status', false);});
50
- if(e.data('previous-status')){ m.checked = false; e.change();}
51
- e.data('previous-status', m.checked);
52
- });
 
53
  },
54
  showHideDep:function( toShow, toHide, hiddenByContainer )
55
  {
56
  var me = this,
57
- item = $( '[id="'+me.name+'"]' ),
58
  form_identifier = me.form_identifier,
59
  isHidden = ( typeof toHide[ me.name ] != 'undefined' || typeof hiddenByContainer[ me.name ] != 'undefined' ),
60
  result = [];
@@ -79,7 +84,7 @@
79
 
80
  if( typeof toShow[ dep ] == 'undefined' )
81
  {
82
- $( '#'+dep ).closest( '.fields' ).hide();
83
  $( '[id*="'+dep+'"]:not(.ignore)' ).addClass( 'ignore' );
84
  toHide[ dep ] = {};
85
  }
@@ -92,7 +97,7 @@
92
  toShow[ dep ][ 'ref' ][ me.name+'_'+i ] = 1;
93
  if(!(dep in hiddenByContainer))
94
  {
95
- $( '#'+dep ).closest( '.fields' ).show();
96
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
97
  }
98
  }
@@ -104,18 +109,19 @@
104
  catch( e ){ }
105
  return result;
106
  },
107
- val:function()
108
  {
109
- var e = $( '[id="' + this.name + '"]:not(.ignore):checked' );
110
- if( e.length ) return $.fbuilder.parseValStr( e.val() );
 
111
  return 0;
112
  },
113
  setVal:function( v )
114
  {
115
  var t = (new String(v)).replace(/(['"])/g, "\\$1"), n = this.name;
116
- $( '[id="'+n+'"]' ).prop( 'checked', false );
117
- $( '[id="'+n+'"][vt="'+t+'"],[id="'+n+'"][value="'+t+'"]' ).prop( 'checked', true );
118
- $( '[id="'+n+'"]' ).change();
119
  }
120
  }
121
  );
10
  toSubmit:"text",
11
  choiceSelected:"",
12
  showDep:false,
13
+ untickAccepted:true,
14
  show:function()
15
  {
16
  this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices);
35
 
36
  for (var i=0;i<l;i++)
37
  {
38
+ str += '<div class="'+this.layout+'"><label for="'+this.name+'_rb'+i+'"><input name="'+this.name+'" id="'+this.name+'_rb'+i+'" class="field '+classDep+' group '+((this.required)?" required":"")+'" value="'+$.fbuilder.htmlEncode(this.choicesVal[i])+'" vt="'+$.fbuilder.htmlEncode((this.toSubmit=='text') ? this.choices[i] : this.choicesVal[i])+'" type="radio" '+((this.choices[i]+' - '+this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> <span>'+$.fbuilder.htmlDecode( this.choices[i] )+'</span></label></div>';
39
  }
40
 
41
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-radiobutton-field" id="field'+this.form_identifier+'-'+this.index+'"><label>'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
42
  },
43
  after_show: function()
44
  {
45
+ var me = this,
46
+ n = me.name;
47
+ if(me.untickAccepted)
48
+ {
49
+ $(document).off('click', '[id*="'+n+'"]').on('click', '[id*="'+n+'"]', function(){
50
+ var m = this,
51
+ e = $(m);
52
 
53
+ $('[id*="'+n+'"]').each(function(){if(m !== this) $(this).data('previous-status', false);});
54
+ if(e.data('previous-status')){ m.checked = false; e.change();}
55
+ e.data('previous-status', m.checked);
56
+ });
57
+ }
58
  },
59
  showHideDep:function( toShow, toHide, hiddenByContainer )
60
  {
61
  var me = this,
62
+ item = $( '[id*="'+me.name+'"]' ),
63
  form_identifier = me.form_identifier,
64
  isHidden = ( typeof toHide[ me.name ] != 'undefined' || typeof hiddenByContainer[ me.name ] != 'undefined' ),
65
  result = [];
84
 
85
  if( typeof toShow[ dep ] == 'undefined' )
86
  {
87
+ $( '[id*="'+dep+'"],.'+dep ).closest( '.fields' ).hide();
88
  $( '[id*="'+dep+'"]:not(.ignore)' ).addClass( 'ignore' );
89
  toHide[ dep ] = {};
90
  }
97
  toShow[ dep ][ 'ref' ][ me.name+'_'+i ] = 1;
98
  if(!(dep in hiddenByContainer))
99
  {
100
+ $( '[id*="'+dep+'"],.'+dep ).closest( '.fields' ).show();
101
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
102
  }
103
  }
109
  catch( e ){ }
110
  return result;
111
  },
112
+ val:function(raw)
113
  {
114
+ raw = raw || false;
115
+ var e = $( '[id*="' + this.name + '"]:not(.ignore):checked' );
116
+ if( e.length ) return $.fbuilder.parseValStr( e.val(), raw );
117
  return 0;
118
  },
119
  setVal:function( v )
120
  {
121
  var t = (new String(v)).replace(/(['"])/g, "\\$1"), n = this.name;
122
+ $( '[id*="'+n+'"]' ).prop( 'checked', false );
123
+ $( '[id*="'+n+'"][vt="'+t+'"],[id*="'+n+'"][value="'+t+'"]' ).prop( 'checked', true );
124
+ $( '[id*="'+n+'"]' ).change();
125
  }
126
  }
127
  );
js/fields-public/08_fbuilder.fdropdown.js CHANGED
@@ -53,7 +53,7 @@
53
  }
54
  }
55
  if(op_o) str += '</optgroup>';
56
- return '<div class="fields '+this.csslayout+' cff-dropdown-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label>'+
57
  '<div class="dfield"><select id="'+this.name+'" name="'+this.name+((this.multiple)? '[]':'')+'" class="field '+( ( classDep != '' ) ? ' depItemSel ' : '' )+this.size+((this.required)?' required':'')+'" '+((this.multiple == true)?' multiple="multiple" size="'+((this.vChoices) ? this.vChoices : 1)+'"':'')+'>'+str+'</select><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div><div class="clearer"></div></div>';
58
  },
59
  showHideDep:function( toShow, toHide, hiddenByContainer )
@@ -89,7 +89,7 @@
89
 
90
  if( typeof toShow[ dep ] == 'undefined' )
91
  {
92
- $( '#'+dep ).closest( '.fields' ).hide();
93
  $( '[id*="'+dep+'"]:not(.ignore)' ).addClass( 'ignore' );
94
  toHide[ dep ] = {};
95
  }
@@ -102,7 +102,7 @@
102
  toShow[ dep ][ 'ref' ][ me.name+'_'+i ] = 1;
103
  if(!(dep in hiddenByContainer))
104
  {
105
- $( '#'+dep ).closest( '.fields' ).show();
106
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
107
  }
108
  }
@@ -115,18 +115,19 @@
115
  catch( e ){}
116
  return result;
117
  },
118
- val:function()
119
  {
 
120
  var e = $( '[id="' + this.name + '"]:not(.ignore) option:selected' ),
121
  v,
122
  m = this.multiple,
123
- g = this.merge;
124
 
125
  if(m && !g) v = [];
126
  if(e.length)
127
  {
128
  e.each(function(){
129
- var t = $.fbuilder.parseValStr( this.value );
130
  if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
131
  if(!m || g) v = (v)?v+t:t;
132
  else v.push(t);
53
  }
54
  }
55
  if(op_o) str += '</optgroup>';
56
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-dropdown-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label>'+
57
  '<div class="dfield"><select id="'+this.name+'" name="'+this.name+((this.multiple)? '[]':'')+'" class="field '+( ( classDep != '' ) ? ' depItemSel ' : '' )+this.size+((this.required)?' required':'')+'" '+((this.multiple == true)?' multiple="multiple" size="'+((this.vChoices) ? this.vChoices : 1)+'"':'')+'>'+str+'</select><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div><div class="clearer"></div></div>';
58
  },
59
  showHideDep:function( toShow, toHide, hiddenByContainer )
89
 
90
  if( typeof toShow[ dep ] == 'undefined' )
91
  {
92
+ $( '[id*="'+dep+'"],.'+dep ).closest( '.fields' ).hide();
93
  $( '[id*="'+dep+'"]:not(.ignore)' ).addClass( 'ignore' );
94
  toHide[ dep ] = {};
95
  }
102
  toShow[ dep ][ 'ref' ][ me.name+'_'+i ] = 1;
103
  if(!(dep in hiddenByContainer))
104
  {
105
+ $( '[id*="'+dep+'"],.'+dep ).closest( '.fields' ).show();
106
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
107
  }
108
  }
115
  catch( e ){}
116
  return result;
117
  },
118
+ val:function(raw)
119
  {
120
+ raw = raw || false;
121
  var e = $( '[id="' + this.name + '"]:not(.ignore) option:selected' ),
122
  v,
123
  m = this.multiple,
124
+ g = this.merge && !raw;
125
 
126
  if(m && !g) v = [];
127
  if(e.length)
128
  {
129
  e.each(function(){
130
+ var t = $.fbuilder.parseValStr( this.value, raw );
131
  if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
132
  if(!m || g) v = (v)?v+t:t;
133
  else v.push(t);
js/fields-public/09_fbuilder.ffile.js CHANGED
@@ -15,7 +15,7 @@
15
  this.accept = $.fbuilder.htmlEncode($.trim(this.accept));
16
  this.upload_size = $.fbuilder.htmlEncode($.trim(this.upload_size));
17
 
18
- return '<div class="fields '+this.csslayout+' cff-file-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="file" id="'+this.name+'" name="'+this.name+'[]"'+((this.accept.length) ? ' accept="'+this.accept+'"' : '')+((this.upload_size.length) ? ' upload_size="'+this.upload_size+'"' : '')+' class="field '+this.size+((this.required)?" required":"")+'" '+( ( this.multiple ) ? 'multiple' : '' )+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
19
  },
20
  after_show:function()
21
  {
15
  this.accept = $.fbuilder.htmlEncode($.trim(this.accept));
16
  this.upload_size = $.fbuilder.htmlEncode($.trim(this.upload_size));
17
 
18
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-file-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="file" id="'+this.name+'" name="'+this.name+'[]"'+((this.accept.length) ? ' accept="'+this.accept+'"' : '')+((this.upload_size.length) ? ' upload_size="'+this.upload_size+'"' : '')+' class="field '+this.size+((this.required)?" required":"")+'" '+( ( this.multiple ) ? 'multiple' : '' )+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
19
  },
20
  after_show:function()
21
  {
js/fields-public/10_fbuilder.fpassword.js CHANGED
@@ -1,6 +1,6 @@
1
  $.fbuilder.controls[ 'fpassword' ] = function(){};
2
- $.extend(
3
- $.fbuilder.controls[ 'fpassword' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Untitled",
@@ -14,13 +14,14 @@
14
  equalTo:"",
15
  show:function()
16
  {
17
- return '<div class="fields '+this.csslayout+' cff-password-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+$.fbuilder.htmlEncode(this.maxlength)+'" '+((this.equalTo!="")?"equalTo=\"#"+$.fbuilder.htmlEncode(this.equalTo+this.form_identifier)+"\"":"" )+' class="field '+this.size+((this.required)?" required":"")+'" type="password" value="'+$.fbuilder.htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
18
  },
19
- val:function()
20
  {
 
21
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
22
- if( e.length ) return $.fbuilder.parseValStr( e.val() );
23
  return 0;
24
- }
25
  }
26
  );
1
  $.fbuilder.controls[ 'fpassword' ] = function(){};
2
+ $.extend(
3
+ $.fbuilder.controls[ 'fpassword' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Untitled",
14
  equalTo:"",
15
  show:function()
16
  {
17
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-password-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" minlength="'+(this.minlength)+'" maxlength="'+$.fbuilder.htmlEncode(this.maxlength)+'" '+((this.equalTo!="")?"equalTo=\"#"+$.fbuilder.htmlEncode(this.equalTo+this.form_identifier)+"\"":"" )+' class="field '+this.size+((this.required)?" required":"")+'" type="password" value="'+$.fbuilder.htmlEncode(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
18
  },
19
+ val:function(raw)
20
  {
21
+ raw = raw || false;
22
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
23
+ if( e.length ) return $.fbuilder.parseValStr( e.val(), raw );
24
  return 0;
25
+ }
26
  }
27
  );
js/fields-public/11_fbuilder.fphone.js CHANGED
@@ -33,7 +33,7 @@
33
  }
34
  }
35
 
36
- return '<div class="fields '+this.csslayout+' cff-phone-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="hidden" id="'+this.name+'" name="'+this.name+'" class="field " />'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
37
  },
38
  after_show: function()
39
  {
@@ -70,10 +70,11 @@
70
  }
71
  }
72
  },
73
- val:function()
74
  {
 
75
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
76
- if( e.length ) return $.fbuilder.parseValStr( e.val() );
77
  return 0;
78
  },
79
  setVal:function( v )
33
  }
34
  }
35
 
36
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-phone-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="hidden" id="'+this.name+'" name="'+this.name+'" class="field " />'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
37
  },
38
  after_show: function()
39
  {
70
  }
71
  }
72
  },
73
+ val:function(raw)
74
  {
75
+ raw = raw || false;
76
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
77
+ if( e.length ) return $.fbuilder.parseValStr( e.val(), raw );
78
  return 0;
79
  },
80
  setVal:function( v )
js/fields-public/12_fbuilder.fcommentarea.js CHANGED
@@ -1,6 +1,6 @@
1
  $.fbuilder.controls[ 'fCommentArea' ]=function(){};
2
- $.extend(
3
- $.fbuilder.controls[ 'fCommentArea' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Comments here",
@@ -8,7 +8,7 @@
8
  userhelp:"A description of the section goes here.",
9
  show:function()
10
  {
11
- return '<div class="fields '+this.csslayout+' comment_area" id="field'+this.form_identifier+'-'+this.index+'"><label id="'+this.name+'">'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
12
- }
13
  }
14
  );
1
  $.fbuilder.controls[ 'fCommentArea' ]=function(){};
2
+ $.extend(
3
+ $.fbuilder.controls[ 'fCommentArea' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Comments here",
8
  userhelp:"A description of the section goes here.",
9
  show:function()
10
  {
11
+ return '<div class="fields '+this.csslayout+' '+this.name+' comment_area" id="field'+this.form_identifier+'-'+this.index+'"><label id="'+this.name+'">'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
12
+ }
13
  }
14
  );
js/fields-public/13_fbuilder.fhidden.js CHANGED
@@ -8,7 +8,7 @@
8
  predefined:"",
9
  show:function()
10
  {
11
- return '<div class="fields '+this.csslayout+' cff-hidden-field" id="field'+this.form_identifier+'-'+this.index+'" style="padding:0;margin:0;border:0;width:0;height:0;overflow:hidden;"><label for="'+this.name+'">'+this.title+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" type="hidden" value="'+$.fbuilder.htmlEncode(this.predefined)+'" class="field" /></div></div>';
12
  }
13
- }
14
  );
8
  predefined:"",
9
  show:function()
10
  {
11
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-hidden-field" id="field'+this.form_identifier+'-'+this.index+'" style="padding:0;margin:0;border:0;width:0;height:0;overflow:hidden;"><label for="'+this.name+'">'+this.title+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" type="hidden" value="'+$.fbuilder.htmlEncode(this.predefined)+'" class="field" /></div></div>';
12
  }
13
+ }
14
  );
js/fields-public/14_fbuilder.fsectionbreak.js CHANGED
@@ -1,6 +1,6 @@
1
  $.fbuilder.controls[ 'fSectionBreak' ] = function(){};
2
- $.extend(
3
- $.fbuilder.controls[ 'fSectionBreak' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Section Break",
@@ -8,7 +8,7 @@
8
  userhelp:"A description of the section goes here.",
9
  show:function()
10
  {
11
- return '<div class="fields '+this.csslayout+' section_breaks" id="field'+this.form_identifier+'-'+this.index+'"><div class="section_break" id="'+this.name+'" ></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
12
  }
13
  }
14
  );
1
  $.fbuilder.controls[ 'fSectionBreak' ] = function(){};
2
+ $.extend(
3
+ $.fbuilder.controls[ 'fSectionBreak' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Section Break",
8
  userhelp:"A description of the section goes here.",
9
  show:function()
10
  {
11
+ return '<div class="fields '+this.csslayout+' '+this.name+' section_breaks" id="field'+this.form_identifier+'-'+this.index+'"><div class="section_break" id="'+this.name+'" ></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
12
  }
13
  }
14
  );
js/fields-public/15_fbuilder.fpagebreak.js CHANGED
@@ -1,13 +1,13 @@
1
  $.fbuilder.controls[ 'fPageBreak' ]=function(){};
2
  $.extend(
3
- $.fbuilder.controls[ 'fPageBreak' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Page Break",
7
  ftype:"fPageBreak",
8
  show:function()
9
  {
10
- return '<div class="fields '+this.csslayout+' section_breaks" id="field'+this.form_identifier+'-'+this.index+'"><div class="section_break" id="'+this.name+'" ></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
11
  }
12
  }
13
  );
1
  $.fbuilder.controls[ 'fPageBreak' ]=function(){};
2
  $.extend(
3
+ $.fbuilder.controls[ 'fPageBreak' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  title:"Page Break",
7
  ftype:"fPageBreak",
8
  show:function()
9
  {
10
+ return '<div class="fields '+this.csslayout+' '+this.name+' section_breaks" id="field'+this.form_identifier+'-'+this.index+'"><div class="section_break" id="'+this.name+'" ></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
11
  }
12
  }
13
  );
js/fields-public/16_fbuilder.fsummary.js CHANGED
@@ -11,12 +11,13 @@
11
  fieldsArray:[],
12
  show:function()
13
  {
14
- var me = this,
15
- p = $.trim( me.fields.replace( /\,+/g, ',') ).split( ',' ),
 
16
  l = p.length;
17
  if( l )
18
  {
19
- var str = '<div class="fields '+me.csslayout+' cff-summary-field" id="field'+me.form_identifier+'-'+me.index+'">'+( ( !/^\s*$/.test( me.title ) ) ? '<h2>'+me.title+'</h2>': '' )+'<div id="'+me.name+'">';
20
  for( var i = 0; i < l; i++ )
21
  {
22
  if( !/^\s*$/.test( p[ i ] ) )
@@ -31,8 +32,9 @@
31
  }
32
  },
33
  after_show: function(){
34
- var me = this,
35
- p = $.trim(me.fields.replace( /\,+/g, ',') ).split( ',' ),
 
36
  l = p.length;
37
 
38
  if( l )
@@ -43,7 +45,7 @@
43
  {
44
  p[ i ] = $.trim( p[ i ] );
45
  me.fieldsArray.push( p[ i ] + me.form_identifier );
46
- $( document ).on( 'change', '#' + p[ i ] + me.form_identifier, function(){ me.update(); } );
47
  }
48
  }
49
  $( document ).on( 'showHideDepEvent', function( evt, form_identifier )
@@ -59,12 +61,12 @@
59
  for ( var j = 0, k = this.fieldsArray.length; j < k; j++ )
60
  {
61
  var i = this.fieldsArray[ j ],
62
- e = $( '[id="' + i + '"]'),
63
  tt = $( '[ref="' + i + '"]');
64
 
65
  if( e.length && tt.length )
66
  {
67
- var l = $( '#' + i )
68
  .closest( '.fields' )
69
  .find( 'label:first' )
70
  .clone()
11
  fieldsArray:[],
12
  show:function()
13
  {
14
+ var me = this;
15
+ if('string' != typeof me.fields) return;
16
+ var p = $.trim( me.fields.replace( /\,+/g, ',') ).split( ',' ),
17
  l = p.length;
18
  if( l )
19
  {
20
+ var str = '<div class="fields '+me.csslayout+' '+me.name+' cff-summary-field" id="field'+me.form_identifier+'-'+me.index+'">'+( ( !/^\s*$/.test( me.title ) ) ? '<h2>'+me.title+'</h2>': '' )+'<div id="'+me.name+'">';
21
  for( var i = 0; i < l; i++ )
22
  {
23
  if( !/^\s*$/.test( p[ i ] ) )
32
  }
33
  },
34
  after_show: function(){
35
+ var me = this;
36
+ if('string' != typeof me.fields) return;
37
+ var p = $.trim(me.fields.replace( /\,+/g, ',') ).split( ',' ),
38
  l = p.length;
39
 
40
  if( l )
45
  {
46
  p[ i ] = $.trim( p[ i ] );
47
  me.fieldsArray.push( p[ i ] + me.form_identifier );
48
+ $( document ).on( 'change', '[id*="' + p[ i ] + me.form_identifier+'"]', function(){ me.update(); } );
49
  }
50
  }
51
  $( document ).on( 'showHideDepEvent', function( evt, form_identifier )
61
  for ( var j = 0, k = this.fieldsArray.length; j < k; j++ )
62
  {
63
  var i = this.fieldsArray[ j ],
64
+ e = $( '[id="' + i + '"],[id^="' + i + '_rb"],[id^="' + i + '_cb"]'),
65
  tt = $( '[ref="' + i + '"]');
66
 
67
  if( e.length && tt.length )
68
  {
69
+ var l = $( '[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]' )
70
  .closest( '.fields' )
71
  .find( 'label:first' )
72
  .clone()
js/fields-public/28_fbuilder.fcontainer.js CHANGED
@@ -7,7 +7,7 @@
7
  var e = $( '#'+this.name ), f;
8
  for( var i = 0, h = this.fields.length; i < h; i++ )
9
  {
10
- f = $( '#'+this.fields[ i ]+this.form_identifier ).closest( '.fields' ).detach();
11
  if( this.columns > 1 )
12
  {
13
  f.addClass( 'column'+this.columns );
@@ -35,7 +35,7 @@
35
 
36
  if( typeof toHide[ fId ] == 'undefined' )
37
  {
38
- $( '#'+fId ).closest( '.fields' ).hide();
39
  $( '[id*="'+fId+'"]:not(.ignore)' ).addClass( 'ignore' );
40
  result.push( fId );
41
  }
@@ -51,7 +51,7 @@
51
  delete hiddenByContainer[ fId ];
52
  if( typeof toHide[ fId ] == 'undefined' )
53
  {
54
- $( '#'+fId ).closest( '.fields' ).show();
55
  $( '[id*="'+fId+'"].ignore' ).removeClass( 'ignore' );
56
  result.push( fId );
57
  }
7
  var e = $( '#'+this.name ), f;
8
  for( var i = 0, h = this.fields.length; i < h; i++ )
9
  {
10
+ f = $( '[id*="'+this.fields[ i ]+this.form_identifier+'"]' ).closest( '.fields' ).detach();
11
  if( this.columns > 1 )
12
  {
13
  f.addClass( 'column'+this.columns );
35
 
36
  if( typeof toHide[ fId ] == 'undefined' )
37
  {
38
+ $( '[id*="'+fId+'"],.'+fId ).closest( '.fields' ).hide();
39
  $( '[id*="'+fId+'"]:not(.ignore)' ).addClass( 'ignore' );
40
  result.push( fId );
41
  }
51
  delete hiddenByContainer[ fId ];
52
  if( typeof toHide[ fId ] == 'undefined' )
53
  {
54
+ $( '[id*="'+fId+'"],.'+fId ).closest( '.fields' ).show();
55
  $( '[id*="'+fId+'"].ignore' ).removeClass( 'ignore' );
56
  result.push( fId );
57
  }
js/fields-public/29_fbuilder.ffieldset.fc.js CHANGED
@@ -9,7 +9,7 @@
9
  columns:1,
10
  show:function()
11
  {
12
- return '<div class="fields '+this.csslayout+' cff-container-field" id="field'+this.form_identifier+'-'+this.index+'"><FIELDSET id="'+this.name+'">'+( ( !/^\s*$/.test( this.title ) ) ? '<LEGEND>'+this.title+'</LEGEND>' : '' )+'</FIELDSET><div class="clearer"></div></div>';
13
  },
14
  after_show: function()
15
  {
@@ -19,5 +19,5 @@
19
  {
20
  return $.fbuilder.controls[ 'fcontainer' ].prototype.showHideDep.call( this, toShow, toHide, hiddenByContainer );
21
  }
22
- }
23
  );
9
  columns:1,
10
  show:function()
11
  {
12
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-container-field" id="field'+this.form_identifier+'-'+this.index+'"><FIELDSET id="'+this.name+'">'+( ( !/^\s*$/.test( this.title ) ) ? '<LEGEND>'+this.title+'</LEGEND>' : '' )+'</FIELDSET><div class="clearer"></div></div>';
13
  },
14
  after_show: function()
15
  {
19
  {
20
  return $.fbuilder.controls[ 'fcontainer' ].prototype.showHideDep.call( this, toShow, toHide, hiddenByContainer );
21
  }
22
+ }
23
  );
js/fields-public/30_fbuilder.fdiv.fc.js CHANGED
@@ -8,7 +8,7 @@
8
  columns:1,
9
  show:function()
10
  {
11
- return '<div class="fields '+this.csslayout+' cff-container-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'"></div><div class="clearer"></div></div>';
12
  },
13
  after_show: function()
14
  {
@@ -18,5 +18,5 @@
18
  {
19
  return $.fbuilder.controls[ 'fcontainer' ].prototype.showHideDep.call( this, toShow, toHide, hiddenByContainer );
20
  }
21
- }
22
  );
8
  columns:1,
9
  show:function()
10
  {
11
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-container-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'"></div><div class="clearer"></div></div>';
12
  },
13
  after_show: function()
14
  {
18
  {
19
  return $.fbuilder.controls[ 'fcontainer' ].prototype.showHideDep.call( this, toShow, toHide, hiddenByContainer );
20
  }
21
+ }
22
  );
js/fields-public/31_fbuilder.fmedia.js CHANGED
@@ -1,6 +1,6 @@
1
  $.fbuilder.controls[ 'fMedia' ]=function(){};
2
- $.extend(
3
- $.fbuilder.controls[ 'fMedia' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  ftype:"fMedia",
@@ -49,7 +49,7 @@
49
  a = [],
50
  l = [],
51
  r = '';
52
-
53
  if( $.trim( d.sWidth ) ) a.push( 'width="'+esc( d.sWidth )+'"' );
54
  if( $.trim( d.sHeight ) ) a.push( 'height="'+esc( d.sHeight )+'"' );
55
  if( $.trim( d.sSrc ) ) a.push( 'src="'+esc( d.sSrc )+'"' );
@@ -64,7 +64,7 @@
64
  {
65
  r = '<img '+a.join( ' ' )+' />';
66
  }
67
-
68
  return r;
69
  },
70
  _show_audio_video: function( d, isV )
@@ -72,7 +72,7 @@
72
  var esc = $.fbuilder.htmlEncode,
73
  a = [],
74
  t = ( isV ) ? 'video' : 'audio' ;
75
-
76
  if( $.trim( d.sWidth ) ) a.push( 'width="'+esc( d.sWidth )+'"' );
77
  if( isV && $.trim( d.sHeight ) ) a.push( 'height="'+esc( d.sHeight )+'"' );
78
  if( isV && $.trim( d.sPoster ) ) a.push( 'poster="'+esc( d.sPoster )+'"' );
@@ -82,7 +82,7 @@
82
  if( d.sLoop ) a.push( 'loop' );
83
  if( d.sMuted ) a.push( 'muted' );
84
  a.push( 'preload="'+esc( d.sPreload )+'"' );
85
-
86
  return '<'+t+' '+a.join( ' ' )+'>'+( ( $.trim( d.sSrcAlt ) ) ? '<source src="'+esc( d.sSrcAlt )+'" />' : '' )+'<p>'+d.sFallback+'</p></'+t+'>';
87
  },
88
  _show_audio: function()
@@ -95,7 +95,7 @@
95
  },
96
  show:function()
97
  {
98
- return '<div class="fields '+this.csslayout+' cff-media-field" id="field'+this.form_identifier+'-'+this.index+'"><div class="clearer"><div class="field" id="'+this.name+'">'+this[ '_show_'+this.sMediaType]()+'</div></div><span class="uh">'+this.data[ this.sMediaType].sFigcaption+'</span><div class="clearer"></div></div>';
99
  }
100
  }
101
  );
1
  $.fbuilder.controls[ 'fMedia' ]=function(){};
2
+ $.extend(
3
+ $.fbuilder.controls[ 'fMedia' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  ftype:"fMedia",
49
  a = [],
50
  l = [],
51
  r = '';
52
+
53
  if( $.trim( d.sWidth ) ) a.push( 'width="'+esc( d.sWidth )+'"' );
54
  if( $.trim( d.sHeight ) ) a.push( 'height="'+esc( d.sHeight )+'"' );
55
  if( $.trim( d.sSrc ) ) a.push( 'src="'+esc( d.sSrc )+'"' );
64
  {
65
  r = '<img '+a.join( ' ' )+' />';
66
  }
67
+
68
  return r;
69
  },
70
  _show_audio_video: function( d, isV )
72
  var esc = $.fbuilder.htmlEncode,
73
  a = [],
74
  t = ( isV ) ? 'video' : 'audio' ;
75
+
76
  if( $.trim( d.sWidth ) ) a.push( 'width="'+esc( d.sWidth )+'"' );
77
  if( isV && $.trim( d.sHeight ) ) a.push( 'height="'+esc( d.sHeight )+'"' );
78
  if( isV && $.trim( d.sPoster ) ) a.push( 'poster="'+esc( d.sPoster )+'"' );
82
  if( d.sLoop ) a.push( 'loop' );
83
  if( d.sMuted ) a.push( 'muted' );
84
  a.push( 'preload="'+esc( d.sPreload )+'"' );
85
+
86
  return '<'+t+' '+a.join( ' ' )+'>'+( ( $.trim( d.sSrcAlt ) ) ? '<source src="'+esc( d.sSrcAlt )+'" />' : '' )+'<p>'+d.sFallback+'</p></'+t+'>';
87
  },
88
  _show_audio: function()
95
  },
96
  show:function()
97
  {
98
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-media-field" id="field'+this.form_identifier+'-'+this.index+'"><div class="clearer"><div class="field" id="'+this.name+'">'+this[ '_show_'+this.sMediaType]()+'</div></div><span class="uh">'+this.data[ this.sMediaType].sFigcaption+'</span><div class="clearer"></div></div>';
99
  }
100
  }
101
  );
js/fields-public/32_fbuilder.fbutton.js CHANGED
@@ -1,6 +1,6 @@
1
  $.fbuilder.controls[ 'fButton' ]=function(){};
2
- $.extend(
3
- $.fbuilder.controls[ 'fButton' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  ftype:"fButton",
@@ -13,7 +13,7 @@
13
  var esc = function( v ){ v = v.replace( /&lt/g, '&amp;').replace(/"/g, "&quot;").replace( /\n+/g, ' ' ); return v;},
14
  type = this.sType,
15
  clss = '';
16
-
17
  if( this.sType == 'calculate' )
18
  {
19
  type = 'button';
@@ -22,9 +22,9 @@
22
  else if( this.sType == 'reset' )
23
  {
24
  clss = 'reset-button';
25
- }
26
-
27
- return '<div class="fields '+this.csslayout+' cff-button-field" id="field'+this.form_identifier+'-'+this.index+'"><input id="'+this.name+'" type="'+type+'" value="'+esc( this.sValue )+'" class="field '+clss+'" onclick="'+esc( this.sOnclick )+'" /><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
28
  },
29
  after_show:function()
30
  {
@@ -36,24 +36,24 @@
36
  {
37
  var suffix = e.attr( 'id' ).match(/_\d+$/)[0],
38
  items = $.fbuilder[ 'forms' ][ suffix ].getItems();
39
-
40
  $.fbuilder[ 'calculator' ].defaultCalc( '#'+e.closest( 'form' ).attr( 'id' ) );
41
  for(var i = 0, h = items.length; i < h; i++ )
42
  {
43
  if(items[i].ftype == 'fsummary')
44
- {
45
  items[i].update();
46
  }
47
- }
48
  }
49
  if( e.hasClass( 'reset-button' ) )
50
  {
51
- setTimeout(
52
  function()
53
- {
54
  var identifier = e.closest( 'form' ).attr( 'id' ).replace( /cp_calculatedfieldsf_pform/, '' );
55
  $.fbuilder[ 'showHideDep' ]( { 'formIdentifier' : identifier } );
56
-
57
  var page = parseInt( e.closest( '.pbreak' ).attr( 'page' ) );
58
  if( page )
59
  {
@@ -63,17 +63,17 @@
63
  if ($("#fieldlist"+identifier+" .pb0").find(".field").length>0)
64
  {
65
  $("#fieldlist"+identifier+" .pb0").find(".field").removeClass("ignorepb");
66
- try
67
  {
68
  $("#fieldlist"+identifier+" .pb0").find(".field")[0].focus();
69
- }
70
  catch(e){}
71
- }
72
- }
73
- },
74
- 50
75
  );
76
- }
77
  }
78
  );
79
  }
1
  $.fbuilder.controls[ 'fButton' ]=function(){};
2
+ $.extend(
3
+ $.fbuilder.controls[ 'fButton' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  ftype:"fButton",
13
  var esc = function( v ){ v = v.replace( /&lt/g, '&amp;').replace(/"/g, "&quot;").replace( /\n+/g, ' ' ); return v;},
14
  type = this.sType,
15
  clss = '';
16
+
17
  if( this.sType == 'calculate' )
18
  {
19
  type = 'button';
22
  else if( this.sType == 'reset' )
23
  {
24
  clss = 'reset-button';
25
+ }
26
+
27
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-button-field" id="field'+this.form_identifier+'-'+this.index+'"><input id="'+this.name+'" type="'+type+'" value="'+esc( this.sValue )+'" class="field '+clss+'" onclick="'+esc( this.sOnclick )+'" /><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
28
  },
29
  after_show:function()
30
  {
36
  {
37
  var suffix = e.attr( 'id' ).match(/_\d+$/)[0],
38
  items = $.fbuilder[ 'forms' ][ suffix ].getItems();
39
+
40
  $.fbuilder[ 'calculator' ].defaultCalc( '#'+e.closest( 'form' ).attr( 'id' ) );
41
  for(var i = 0, h = items.length; i < h; i++ )
42
  {
43
  if(items[i].ftype == 'fsummary')
44
+ {
45
  items[i].update();
46
  }
47
+ }
48
  }
49
  if( e.hasClass( 'reset-button' ) )
50
  {
51
+ setTimeout(
52
  function()
53
+ {
54
  var identifier = e.closest( 'form' ).attr( 'id' ).replace( /cp_calculatedfieldsf_pform/, '' );
55
  $.fbuilder[ 'showHideDep' ]( { 'formIdentifier' : identifier } );
56
+
57
  var page = parseInt( e.closest( '.pbreak' ).attr( 'page' ) );
58
  if( page )
59
  {
63
  if ($("#fieldlist"+identifier+" .pb0").find(".field").length>0)
64
  {
65
  $("#fieldlist"+identifier+" .pb0").find(".field").removeClass("ignorepb");
66
+ try
67
  {
68
  $("#fieldlist"+identifier+" .pb0").find(".field")[0].focus();
69
+ }
70
  catch(e){}
71
+ }
72
+ }
73
+ },
74
+ 50
75
  );
76
+ }
77
  }
78
  );
79
  }
js/fields-public/34_fbuilder.fhtml.js CHANGED
@@ -1,13 +1,13 @@
1
  $.fbuilder.controls[ 'fhtml' ]=function(){};
2
- $.extend(
3
- $.fbuilder.controls[ 'fhtml' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  ftype:"fhtml",
7
  fcontent:"",
8
  show:function()
9
  {
10
- return '<div class="fields '+this.csslayout+' cff-html-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'" class="dfield">'+$( '<div/>' ).html( this.fcontent ).html()+'</div><div class="clearer"></div></div>';
11
- }
12
  }
13
  );
1
  $.fbuilder.controls[ 'fhtml' ]=function(){};
2
+ $.extend(
3
+ $.fbuilder.controls[ 'fhtml' ].prototype,
4
  $.fbuilder.controls[ 'ffields' ].prototype,
5
  {
6
  ftype:"fhtml",
7
  fcontent:"",
8
  show:function()
9
  {
10
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-html-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'" class="dfield">'+$( '<div/>' ).html( this.fcontent ).html()+'</div><div class="clearer"></div></div>';
11
+ }
12
  }
13
  );
js/fields-public/36_fbuilder.acceptance.js CHANGED
@@ -24,8 +24,8 @@
24
  label = '<a href="javascript:void(0);" class="cff-open-dlg">'+label+'</a>';
25
  dlg += '<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+me.message+'</div></div>'
26
  }
27
- return '<div class="fields '+me.csslayout+' cff-checkbox-field" id="field'+me.form_identifier+'-'+me.index+'"><div class="dfield">'+
28
- '<div class="one_column"><label><input name="'+me.name+'" id="'+me.name+'" class="field required" value="'+$.fbuilder.htmlEncode(me.value)+'" vt="'+$.fbuilder.htmlEncode((/^\s*$/.test(me.value)) ? me.title : me.value)+'" type="checkbox" /> <span>'+
29
  $.fbuilder.htmlDecode( label )+''+((me.required)?'<span class="r">*</span>':'')+
30
  '</span></label></div>'+
31
  dlg+
@@ -47,15 +47,16 @@
47
  });
48
  $(document).on('click','.cff-close-dlg', function(){$(this).closest('.cff-dialog').addClass('hide');});
49
  },
50
- val:function()
51
  {
 
52
  var e = $('[id="'+this.name+'"]:checked:not(.ignore)');
53
  if( e.length )
54
  {
55
- var t = $.fbuilder.parseValStr( e[0].value );
56
  if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
57
  }
58
- return (v) ? (($.isNumeric(v)) ? v : '"'+v+'"') : 0;
59
  }
60
  }
61
  );
24
  label = '<a href="javascript:void(0);" class="cff-open-dlg">'+label+'</a>';
25
  dlg += '<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+me.message+'</div></div>'
26
  }
27
+ return '<div class="fields '+me.csslayout+' '+me.name+' cff-checkbox-field" id="field'+me.form_identifier+'-'+me.index+'"><div class="dfield">'+
28
+ '<div class="one_column"><label for="'+me.name+'"><input name="'+me.name+'" id="'+me.name+'" class="field required" value="'+$.fbuilder.htmlEncode(me.value)+'" vt="'+$.fbuilder.htmlEncode((/^\s*$/.test(me.value)) ? me.title : me.value)+'" type="checkbox" /> <span>'+
29
  $.fbuilder.htmlDecode( label )+''+((me.required)?'<span class="r">*</span>':'')+
30
  '</span></label></div>'+
31
  dlg+
47
  });
48
  $(document).on('click','.cff-close-dlg', function(){$(this).closest('.cff-dialog').addClass('hide');});
49
  },
50
+ val:function(raw)
51
  {
52
+ raw = raw || false;
53
  var e = $('[id="'+this.name+'"]:checked:not(.ignore)');
54
  if( e.length )
55
  {
56
+ var t = $.fbuilder.parseValStr( e[0].value, raw );
57
  if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
58
  }
59
+ return (t) ? (($.isNumeric(t)) ? t : '"'+t+'"') : 0;
60
  }
61
  }
62
  );
js/fields-public/fbuilder.fcalculated.js CHANGED
@@ -18,7 +18,7 @@
18
  hidefield:false,
19
  show:function()
20
  {
21
- return '<div class="fields '+this.csslayout+' cff-calculated-field" id="field'+this.form_identifier+'-'+this.index+'" style="'+((this.hidefield)? 'padding:0;margin:0;border:0;opacity:0;width:0;height:0;overflow:hidden;' : '' )+'"><label>'+this.title+''+( ( this.required ) ? '<span class="r">*</span>' : '' )+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+((this.readonly) ? ' readonly ' : '')+' class="codepeoplecalculatedfield field '+this.size+((this.required)?" required":"")+'" type="'+( ( this.hidefield ) ? 'hidden' : 'text' )+'" value="'+this.predefined+'"/>'+( ( !this.hidefield ) ? '<span class="uh">'+this.userhelp+'</span>' : '' )+'</div><div class="clearer"></div></div>';
22
  },
23
  after_show:function()
24
  {
@@ -94,7 +94,7 @@
94
  }
95
  },
96
  hideField = function(id){
97
- $( '#'+id ).closest( '.fields' ).hide();
98
  $( '[id*="'+id+'"]:not(.ignore)' ).addClass( 'ignore' );
99
  toHide[ id ] = {};
100
  };
@@ -124,7 +124,7 @@
124
  toShow[ dep ][ 'ref' ][ me.name ] = 1;
125
  if(!(dep in hiddenByContainer))
126
  {
127
- $( '#' + dep ).closest( '.fields' ).show();
128
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
129
  }
130
  if($.inArray(dep,result) == -1) result.push( dep );
@@ -145,12 +145,15 @@
145
  }
146
  return result;
147
  },
148
- val : function()
149
  {
 
150
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
151
  if( e.length )
152
  {
153
- var v = $.trim( e.val() );
 
 
154
 
155
  v = v.replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.prefix), 'g' ), '' )
156
  .replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.suffix), 'g' ), '' );
@@ -229,9 +232,11 @@
229
  _calculate = function( eq, suffix, __ME__ )
230
  {
231
  var _match,
232
- field_regexp = new RegExp( '(fieldname\\d+'+suffix+')([\\D\\b])'),
233
  __ME__ = (__ME__) ? $.fbuilder['forms'][suffix].getItem( __ME__ ).val() : '';
234
 
 
 
235
  $.fbuilder['currentFormId'] = $.fbuilder['forms'][suffix].formId;
236
 
237
  eq = '(' + eq + ')';
@@ -242,11 +247,11 @@
242
  v = '';
243
  if( field )
244
  {
245
- v = field.val();
246
- if( $.isNumeric( v ) ) v = '('+v+')';
247
- else if( typeof v == 'object' && typeof window.JSON != 'undefined' ) v = JSON.stringify( v );
248
  }
249
- eq = eq.replace( _match[0], v+''+_match[2] ); // Replace the variable name by value
250
  }
251
  try
252
  {
@@ -405,7 +410,7 @@
405
  Calculate : function ( field )
406
  {
407
  if( field.id == undefined ) return;
408
- var id = field.id,
409
  fSec = id.match( /(_\d+)?_\d+$/ ),
410
  item,
411
  me = this;
18
  hidefield:false,
19
  show:function()
20
  {
21
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-calculated-field" id="field'+this.form_identifier+'-'+this.index+'" style="'+((this.hidefield)? 'padding:0;margin:0;border:0;opacity:0;width:0;height:0;overflow:hidden;' : '' )+'"><label for="'+this.name+'">'+this.title+''+( ( this.required ) ? '<span class="r">*</span>' : '' )+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+((this.readonly) ? ' readonly ' : '')+' class="codepeoplecalculatedfield field '+this.size+((this.required)?" required":"")+'" type="'+( ( this.hidefield ) ? 'hidden' : 'text' )+'" value="'+this.predefined+'"/>'+( ( !this.hidefield ) ? '<span class="uh">'+this.userhelp+'</span>' : '' )+'</div><div class="clearer"></div></div>';
22
  },
23
  after_show:function()
24
  {
94
  }
95
  },
96
  hideField = function(id){
97
+ $( '[id*="'+id+'"],.'+id ).closest( '.fields' ).hide();
98
  $( '[id*="'+id+'"]:not(.ignore)' ).addClass( 'ignore' );
99
  toHide[ id ] = {};
100
  };
124
  toShow[ dep ][ 'ref' ][ me.name ] = 1;
125
  if(!(dep in hiddenByContainer))
126
  {
127
+ $( '[id*="'+dep+'"],.'+dep).closest( '.fields' ).show();
128
  $( '[id*="'+dep+'"].ignore' ).removeClass( 'ignore' );
129
  }
130
  if($.inArray(dep,result) == -1) result.push( dep );
145
  }
146
  return result;
147
  },
148
+ val: function(raw)
149
  {
150
+ raw = raw || false;
151
  var e = $( '[id="' + this.name + '"]:not(.ignore)' );
152
  if( e.length )
153
  {
154
+ var v = e.val();
155
+ if(raw) return $.fbuilder.parseValStr(v, raw);
156
+ v = $.trim( v );
157
 
158
  v = v.replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.prefix), 'g' ), '' )
159
  .replace( new RegExp( $.fbuilder[ 'escape_symbol' ](this.suffix), 'g' ), '' );
232
  _calculate = function( eq, suffix, __ME__ )
233
  {
234
  var _match,
235
+ field_regexp = new RegExp( '(fieldname\\d+'+suffix+')(_[cr]b\\d+)?(\\|r)?([\\D\\b])','i'),
236
  __ME__ = (__ME__) ? $.fbuilder['forms'][suffix].getItem( __ME__ ).val() : '';
237
 
238
+ window['getField'] = $.fbuilder['forms'][suffix].getItem;
239
+
240
  $.fbuilder['currentFormId'] = $.fbuilder['forms'][suffix].formId;
241
 
242
  eq = '(' + eq + ')';
247
  v = '';
248
  if( field )
249
  {
250
+ v = field.val((_match[3]) ? true : false);
251
+ if( typeof v == 'object' && typeof window.JSON != 'undefined' ) v = JSON.stringify( v );
252
+ else if( $.isNumeric( v ) ) v = '('+v+')';
253
  }
254
+ eq = eq.replace( _match[0], v+''+_match[4] ); // Replace the variable name by value
255
  }
256
  try
257
  {
410
  Calculate : function ( field )
411
  {
412
  if( field.id == undefined ) return;
413
+ var id = field.id.replace(/_[cr]b\d+$/i,''),
414
  fSec = id.match( /(_\d+)?_\d+$/ ),
415
  item,
416
  me = this;
templates/11/style.css CHANGED
@@ -38,6 +38,8 @@
38
  font-size: 13px;
39
  margin: 1px 0;
40
  padding: 15px;
 
 
41
  }
42
 
43
  .cp_cff_11 #fbuilder .large {
38
  font-size: 13px;
39
  margin: 1px 0;
40
  padding: 15px;
41
+ height: auto;
42
+ line-height: normal;
43
  }
44
 
45
  .cp_cff_11 #fbuilder .large {
templates/12/style.css CHANGED
@@ -116,7 +116,8 @@
116
  .cp_cff_12 #fbuilder .dfield.slider-container{padding-left: 10px !important; border-radius: 10px; padding-right: 10px !important; padding-top:5px;}
117
  .cp_cff_12 #fbuilder .slider{background: #ececec !important; border-radius: 10px;border:0;height: .3em;}
118
  .cp_cff_12 #fbuilder .ui-slider-range{background: #1795FF;}
119
- .cp_cff_12 #fbuilder .corner_captions{margin-top:10px;}
 
120
 
121
  .cp_cff_12 #fbuilder span.uh{
122
  font-size: 11px;
116
  .cp_cff_12 #fbuilder .dfield.slider-container{padding-left: 10px !important; border-radius: 10px; padding-right: 10px !important; padding-top:5px;}
117
  .cp_cff_12 #fbuilder .slider{background: #ececec !important; border-radius: 10px;border:0;height: .3em;}
118
  .cp_cff_12 #fbuilder .ui-slider-range{background: #1795FF;}
119
+ .cp_cff_12 #fbuilder .corner_captions,
120
+ .cp_cff_12 #fbuilder .corner-captions{margin-top:10px;}
121
 
122
  .cp_cff_12 #fbuilder span.uh{
123
  font-size: 11px;