Version Description
- Improves the plugin behavior by escaping all field attributes.
- Solves a warning in the CFF WooCommerce add-on (Developer and Platinum versions)
- Fixes a conflict in the CFF - Analytics add-on (Platinum version)
Download this release
Release Info
Developer | codepeople |
Plugin | Calculated Fields Form |
Version | 1.1.87 |
Comparing to | |
See all releases |
Code changes from version 1.1.86 to 1.1.87
- README.txt +8 -10
- changelog.txt +7 -14
- cp_calculatedfieldsf_free.php +2 -2
- js/fbuilder-pro-admin.jquery.js +28 -27
- js/fbuilder-pro-public.jquery.js +9 -6
- js/fields-admin/01_fbuilder.ftext.js +7 -7
- js/fields-admin/02_fbuilder.fcurrency.js +13 -13
- js/fields-admin/02_fbuilder.fnumber.js +9 -9
- js/fields-admin/02_fbuilder.fslider.js +11 -11
- js/fields-admin/03_fbuilder.fcolor.js +2 -2
- js/fields-admin/03_fbuilder.femail.js +5 -5
- js/fields-admin/04_fbuilder.fdate.js +35 -35
- js/fields-admin/05_fbuilder.ftextarea.js +6 -6
- js/fields-admin/06_fbuilder.fcheck.js +5 -5
- js/fields-admin/07_fbuilder.fradio.js +4 -4
- js/fields-admin/08_fbuilder.fdropdown.js +3 -3
- js/fields-admin/09_fbuilder.ffile.js +9 -9
- js/fields-admin/10_fbuilder.fpassword.js +7 -7
- js/fields-admin/11_fbuilder.fphone.js +4 -4
- js/fields-admin/12_fbuilder.fcommentarea.js +1 -1
- js/fields-admin/13_fbuilder.fhidden.js +3 -3
- js/fields-admin/14_fbuilder.fsectionbreak.js +1 -1
- js/fields-admin/15_fbuilder.fpagebreak.js +1 -1
- js/fields-admin/16_fbuilder.fsummary.js +9 -9
- js/fields-admin/29_fbuilder.ffieldset.fc.js +1 -1
- js/fields-admin/30_fbuilder.fdiv.fc.js +1 -1
- js/fields-admin/31_fbuilder.fmedia.js +18 -27
- js/fields-admin/32_fbuilder.fbutton.js +15 -15
- js/fields-admin/34_fbuilder.fhtml.js +9 -9
- js/fields-admin/36_fbuilder.acceptance.js +4 -4
- js/fields-admin/fbuilder.fcalculated.js +85 -85
- js/fields-public/01_fbuilder.ftext.js +10 -10
- js/fields-public/02_fbuilder.fcurrency.js +15 -15
- js/fields-public/02_fbuilder.fnumber.js +12 -12
- js/fields-public/02_fbuilder.fslider.js +42 -42
- js/fields-public/03_fbuilder.fcolor.js +7 -9
- js/fields-public/03_fbuilder.femail.js +10 -10
- js/fields-public/04_fbuilder.fdate.js +110 -111
- js/fields-public/05_fbuilder.ftextarea.js +8 -8
- js/fields-public/06_fbuilder.fcheck.js +41 -41
- js/fields-public/07_fbuilder.fradio.js +37 -37
- js/fields-public/08_fbuilder.fdropdown.js +40 -40
- js/fields-public/09_fbuilder.ffile.js +20 -20
- js/fields-public/10_fbuilder.fpassword.js +13 -13
- js/fields-public/11_fbuilder.fphone.js +23 -23
- js/fields-public/12_fbuilder.fcommentarea.js +4 -4
- js/fields-public/13_fbuilder.fhidden.js +4 -4
- js/fields-public/14_fbuilder.fsectionbreak.js +4 -4
- js/fields-public/15_fbuilder.fpagebreak.js +4 -4
- js/fields-public/16_fbuilder.fsummary.js +37 -37
- js/fields-public/28_fbuilder.fcontainer.js +30 -30
- js/fields-public/29_fbuilder.ffieldset.fc.js +7 -7
- js/fields-public/30_fbuilder.fdiv.fc.js +7 -7
- js/fields-public/31_fbuilder.fmedia.js +30 -30
- js/fields-public/32_fbuilder.fbutton.js +20 -20
- js/fields-public/34_fbuilder.fhtml.js +4 -4
- js/fields-public/36_fbuilder.acceptance.js +9 -9
- js/fields-public/fbuilder.fcalculated.js +194 -194
README.txt
CHANGED
@@ -4,7 +4,7 @@ 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: 6.0
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -965,6 +965,12 @@ A: Please, follow the steps below:
|
|
965 |
|
966 |
== Changelog ==
|
967 |
|
|
|
|
|
|
|
|
|
|
|
|
|
968 |
= 1.1.86 =
|
969 |
|
970 |
* Modifies the template 14.
|
@@ -1022,12 +1028,4 @@ A: Please, follow the steps below:
|
|
1022 |
|
1023 |
= 1.1.78 =
|
1024 |
|
1025 |
-
* Modifies the Handling Files operations module.
|
1026 |
-
|
1027 |
-
= 1.1.77 =
|
1028 |
-
|
1029 |
-
* Modifies the Managing Fields operations module.
|
1030 |
-
* Improves the javascript cache module.
|
1031 |
-
* Fixes minor issues in the DataTable DS Control (Developer and Platinum versions).
|
1032 |
-
* Implements the addRecord, updateRecord, and deleteRecord methods in the RecordSet DS control (Developer and Platinum versions).
|
1033 |
-
* Includes the layout attribute in the PDF Generator add-on to generate the PDF in portrait or landscape mode (Platinum version).
|
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: 6.0
|
7 |
+
Stable tag: 1.1.87
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
965 |
|
966 |
== Changelog ==
|
967 |
|
968 |
+
= 1.1.87 =
|
969 |
+
|
970 |
+
* Improves the plugin behavior by escaping all field attributes.
|
971 |
+
* Solves a warning in the CFF WooCommerce add-on (Developer and Platinum versions)
|
972 |
+
* Fixes a conflict in the CFF - Analytics add-on (Platinum version)
|
973 |
+
|
974 |
= 1.1.86 =
|
975 |
|
976 |
* Modifies the template 14.
|
1028 |
|
1029 |
= 1.1.78 =
|
1030 |
|
1031 |
+
* Modifies the Handling Files operations module.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changelog.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 1.1.86 =
|
4 |
|
5 |
* Modifies the template 14.
|
@@ -447,17 +453,4 @@
|
|
447 |
|
448 |
= 1.1.0 =
|
449 |
|
450 |
-
* Modifies the plugin's design and the accessibility.
|
451 |
-
|
452 |
-
= 1.0.474 =
|
453 |
-
|
454 |
-
* Includes the getReferrer operation in the URL Operations module.
|
455 |
-
* Modifies the cff-gotopage event.
|
456 |
-
* Modifies the loading form animation.
|
457 |
-
* Modifies the RedSys and Bizum add-ons (Platinum version of the plugin).
|
458 |
-
|
459 |
-
= 1.0.473 =
|
460 |
-
|
461 |
-
* Modifies the forms structures.
|
462 |
-
* Fixes a CSS conflict.
|
463 |
-
* Modifies the RedSys and Bizum add-ons (Platinum version of the plugin).
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 1.1.87 =
|
4 |
+
|
5 |
+
* Improves the plugin behavior by escaping all field attributes.
|
6 |
+
* Solves a warning in the CFF WooCommerce add-on (Developer and Platinum versions)
|
7 |
+
* Fixes a conflict in the CFF - Analytics add-on (Platinum version)
|
8 |
+
|
9 |
= 1.1.86 =
|
10 |
|
11 |
* Modifies the template 14.
|
453 |
|
454 |
= 1.1.0 =
|
455 |
|
456 |
+
* Modifies the plugin's design and the accessibility.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.1.
|
7 |
Text Domain: calculated-fields-form
|
8 |
Author: CodePeople
|
9 |
Author URI: https://cff.dwbooster.com
|
@@ -16,7 +16,7 @@ if(!defined('WP_DEBUG') || true != WP_DEBUG)
|
|
16 |
}
|
17 |
|
18 |
// Defining main constants
|
19 |
-
define('CP_CALCULATEDFIELDSF_VERSION', '1.1.
|
20 |
define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
|
21 |
define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
|
22 |
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.1.87
|
7 |
Text Domain: calculated-fields-form
|
8 |
Author: CodePeople
|
9 |
Author URI: https://cff.dwbooster.com
|
16 |
}
|
17 |
|
18 |
// Defining main constants
|
19 |
+
define('CP_CALCULATEDFIELDSF_VERSION', '1.1.87' );
|
20 |
define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
|
21 |
define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
|
22 |
define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
|
js/fbuilder-pro-admin.jquery.js
CHANGED
@@ -27,7 +27,7 @@
|
|
27 |
f.attr( 'target', '_self' ).find( 'input[name="preview"]').remove();
|
28 |
};
|
29 |
|
30 |
-
$.fbuilder[ 'htmlEncode' ] = function(value)
|
31 |
{
|
32 |
value = $('<div/>').text(value).html();
|
33 |
value = value.replace(/&/g, '&')
|
@@ -38,7 +38,7 @@
|
|
38 |
return value;
|
39 |
};
|
40 |
|
41 |
-
|
42 |
{
|
43 |
if(typeof value == 'string')
|
44 |
value = value.replace(/<script\b.*\bscript>/ig, '')
|
@@ -47,7 +47,7 @@
|
|
47 |
return value;
|
48 |
};
|
49 |
|
50 |
-
$.fbuilder[
|
51 |
{
|
52 |
if( /&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test( value ) ) value = $( '<div/>' ).html( value ).text();
|
53 |
return value;
|
@@ -420,8 +420,8 @@
|
|
420 |
{
|
421 |
if( typeof field[ 'display' ] != 'undefined' )
|
422 |
{
|
423 |
-
var e = $(
|
424 |
-
n = $(
|
425 |
as = true; // Call after_show
|
426 |
|
427 |
if( n.find( '.dfield:eq(0)>.fcontainer>.fieldscontainer').length )
|
@@ -488,7 +488,7 @@
|
|
488 |
item.parent = '';
|
489 |
fieldsIndex[ item.name ] = i;
|
490 |
|
491 |
-
|
492 |
if ( i == selected )
|
493 |
{
|
494 |
$("#field-"+i).addClass("ui-selected");
|
@@ -505,24 +505,24 @@
|
|
505 |
// Email fields
|
506 |
if (item.ftype=="femail" || item.ftype=="femailds")
|
507 |
{
|
508 |
-
|
509 |
}
|
510 |
else
|
511 |
{
|
512 |
// Request cost fields
|
513 |
if(!/(femail)|(fdate)|(ffile)|(fpassword)|(fphone)|(fsectionbreak)|(fpagebreak)|(fsummary)|(fcontainer)|(ffieldset)|(fdiv)|(fmedia)|(fbutton)|(fhtml)|(frecordsetds)|(fcommentarea)/i.test(item.ftype))
|
514 |
{
|
515 |
-
|
516 |
}
|
517 |
|
518 |
// Recurrent Payments
|
519 |
if (item.ftype=="fradio" || item.ftype=="fdropdown")
|
520 |
{
|
521 |
-
|
522 |
}
|
523 |
|
524 |
// Times Intervals
|
525 |
-
|
526 |
}
|
527 |
}
|
528 |
|
@@ -564,7 +564,7 @@
|
|
564 |
customstyles:"",
|
565 |
display:function()
|
566 |
{
|
567 |
-
return
|
568 |
},
|
569 |
|
570 |
showAllSettings:function()
|
@@ -578,7 +578,7 @@
|
|
578 |
|
579 |
for ( var i = 0; i< $.fbuilder.showSettings.formlayoutList.length; i++ )
|
580 |
{
|
581 |
-
layout += '<option value="'
|
582 |
}
|
583 |
|
584 |
for ( var i in $.fbuilder.showSettings.formTemplateDic )
|
@@ -599,10 +599,10 @@
|
|
599 |
}
|
600 |
}
|
601 |
|
602 |
-
template += '<option value="'
|
603 |
}
|
604 |
|
605 |
-
str += '<div><label>Form Name</label><input type="text" class="large" name="fTitle" id="fTitle" value="'
|
606 |
|
607 |
if(typeof $.fbuilder.controls[ 'fCalculated' ] != 'undefined')
|
608 |
{
|
@@ -613,7 +613,7 @@
|
|
613 |
|
614 |
str += '<div><label>Form Template</label><select name="fTemplate" id="fTemplate" class="large">'+template+'</select></div><div style="text-align:center;padding:10px 0;"><span id="fTemplateThumbnail">'+thumbnail+'</span><div></div><span id="fTemplateDescription">'+description+'</span></div>'+
|
615 |
'<div><label><input type="checkbox" name="fAnimateForm" id="fAnimateForm" '+( ( this.animate_form ) ? 'CHECKED' : '' )+' /> Animate page breaks in multipage forms, and dependencies</label></div>'+
|
616 |
-
'<div class="cff-editor-container"><label><div class="cff-editor-extend-shrink"></div>Customize Form Design <i>(Enter the CSS rules. <a href="http://cff.dwbooster.com/faq#q82" target="_blank">More information</a>)</i></label><textarea id="fCustomStyles" style="width:100%;height:150px;">'+this.customstyles+'</textarea></div>' ;
|
617 |
|
618 |
return str;
|
619 |
}
|
@@ -852,24 +852,24 @@
|
|
852 |
},
|
853 |
showTitle: function(v)
|
854 |
{
|
855 |
-
return '<label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+v+'</textarea>';
|
856 |
},
|
857 |
showShortLabel: function( v )
|
858 |
{
|
859 |
-
return '<div><label>Short label (optional) [<a class="helpfbuilder" text="The short label is used at title for the column when exporting the form data to CSV files.\n\nIf the short label is empty then, the field label will be used for the CSV file.">help?</a>] :</label><input type="text" class="large" name="sShortlabel" id="sShortlabel" value="'+v+'" /></div>';
|
860 |
},
|
861 |
showName: function( v )
|
862 |
{
|
863 |
-
return '<div><label>Field name, tag for the message:</label><input type="text" readonly="readonly" class="large" name="sNametag" id="sNametag" value="<%'+v+'%>" />'+
|
864 |
-
'<input style="display:none" readonly="readonly" class="large" name="sName" id="sName" value="'+v+'" /></div>';
|
865 |
},
|
866 |
showPredefined: function(v,c)
|
867 |
{
|
868 |
-
return '<div><label>Predefined Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+v+'</textarea><br /><i>It is possible to use another field in the form as predefined value. Ex: fieldname1</i><label><input type="checkbox" name="sPredefinedClick" id="sPredefinedClick" '+((c)?"checked":"")+' value="1" > Use predefined value as placeholder.</label></div>';
|
869 |
},
|
870 |
showEqualTo: function(v,name)
|
871 |
{
|
872 |
-
return '<div><label>Equal to [<a class="helpfbuilder" text="Use this field to create password confirmation field or email confirmation fields.\n\nSpecify this setting ONLY into the confirmation field, not in the original field.">help?</a>]</label><select class="equalTo" name="sEqualTo" id="sEqualTo" dvalue="'+v+'" dname="'+name+'"></select></div>';
|
873 |
},
|
874 |
showAutocomplete: function(v)
|
875 |
{
|
@@ -877,7 +877,7 @@
|
|
877 |
|
878 |
for(var i = 0, h = values.length; i<h; i++)
|
879 |
{
|
880 |
-
options += '<option value="'+values[i]+'" '+(values[i] == v ? 'SELECTED' : '')+'>'+values[i]+'</option>';
|
881 |
}
|
882 |
return '<div><label>Autocomplete</label>'+
|
883 |
'<select class="large" name="sAutocomplete" id="sAutocomplete">'+options+'</select><br><i>The field attribute takes precedence over the form settings.</i></div>';
|
@@ -907,7 +907,7 @@
|
|
907 |
var str = "";
|
908 |
for (var i=0;i<this.sizeList.length;i++)
|
909 |
{
|
910 |
-
str += '<option value="'+this.sizeList[i].id+'" '+((this.sizeList[i].id==v)?"selected":"")+'>'+this.sizeList[i].name+'</option>';
|
911 |
}
|
912 |
return '<label>Field Size</label><select name="sSize" id="sSize">'+str+'</select>';
|
913 |
},
|
@@ -916,17 +916,17 @@
|
|
916 |
var str = "";
|
917 |
for (var i=0;i<this.layoutList.length;i++)
|
918 |
{
|
919 |
-
str += '<option value="'+this.layoutList[i].id+'" '+((this.layoutList[i].id==v)?"selected":"")+'>'+this.layoutList[i].name+'</option>';
|
920 |
}
|
921 |
return '<label>Field Layout</label><select name="sLayout" id="sLayout">'+str+'</select>';
|
922 |
},
|
923 |
showUserhelp: function(v,c,i)
|
924 |
{
|
925 |
-
return '<label>Instructions for User</label><textarea class="large" name="sUserhelp" id="sUserhelp">'+v+'</textarea><label class="column"><input type="checkbox" name="sUserhelpTooltip" id="sUserhelpTooltip" '+((c)?"checked":"")+' value="1" > Show as floating tooltip </label><label class="column"><input type="checkbox" name="sTooltipIcon" id="sTooltipIcon" '+((i)?"checked":"")+' value="1" > Display on icon</label><div class="clearer"></div>';
|
926 |
},
|
927 |
showCsslayout: function(v)
|
928 |
{
|
929 |
-
return '<div><label>Add Css Layout Keywords</label><input type="text" class="large" name="sCsslayout" id="sCsslayout" value="'+v+'" /></div>';
|
930 |
}
|
931 |
};
|
932 |
|
@@ -954,11 +954,12 @@
|
|
954 |
* e -> event name
|
955 |
* l -> element
|
956 |
* f -> function to apply the value
|
|
|
957 |
*/
|
958 |
$(e[i].s).bind(e[i].e, {obj:this, i:e[i]}, function(e){
|
959 |
var v = $(this).val();
|
960 |
if(typeof e.data.i['f'] != 'undefined') v = e.data.i.f($(this));
|
961 |
-
e.data.obj[e.data.i.l] = v;
|
962 |
$.fbuilder.reloadItems( {'field': e.data.obj} );
|
963 |
});
|
964 |
}
|
27 |
f.attr( 'target', '_self' ).find( 'input[name="preview"]').remove();
|
28 |
};
|
29 |
|
30 |
+
$.fbuilder[ 'htmlEncode' ] = window[ 'cff_esc_attr' ] = function(value)
|
31 |
{
|
32 |
value = $('<div/>').text(value).html();
|
33 |
value = value.replace(/&/g, '&')
|
38 |
return value;
|
39 |
};
|
40 |
|
41 |
+
$.fbuilder['sanitize'] = window['cff_sanitize'] = function(value)
|
42 |
{
|
43 |
if(typeof value == 'string')
|
44 |
value = value.replace(/<script\b.*\bscript>/ig, '')
|
47 |
return value;
|
48 |
};
|
49 |
|
50 |
+
$.fbuilder['htmlDecode'] = window['cff_html_decode'] = function(value)
|
51 |
{
|
52 |
if( /&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test( value ) ) value = $( '<div/>' ).html( value ).text();
|
53 |
return value;
|
420 |
{
|
421 |
if( typeof field[ 'display' ] != 'undefined' )
|
422 |
{
|
423 |
+
var e = $('.'+field['name']),
|
424 |
+
n = $(cff_sanitize(field.display())),
|
425 |
as = true; // Call after_show
|
426 |
|
427 |
if( n.find( '.dfield:eq(0)>.fcontainer>.fieldscontainer').length )
|
488 |
item.parent = '';
|
489 |
fieldsIndex[ item.name ] = i;
|
490 |
|
491 |
+
$("#fieldlist").append(cff_sanitize(item.display()));
|
492 |
if ( i == selected )
|
493 |
{
|
494 |
$("#field-"+i).addClass("ui-selected");
|
505 |
// Email fields
|
506 |
if (item.ftype=="femail" || item.ftype=="femailds")
|
507 |
{
|
508 |
+
email_str += '<option value="'+cff_esc_attr(item.name)+'" '+( ( $.inArray( item.name, cu_user_email_field ) != -1 ) ? "selected" : "" )+'>'+cff_esc_attr(item.name+' ('+cff_sanitize(item.title)+')')+'</option>';
|
509 |
}
|
510 |
else
|
511 |
{
|
512 |
// Request cost fields
|
513 |
if(!/(femail)|(fdate)|(ffile)|(fpassword)|(fphone)|(fsectionbreak)|(fpagebreak)|(fsummary)|(fcontainer)|(ffieldset)|(fdiv)|(fmedia)|(fbutton)|(fhtml)|(frecordsetds)|(fcommentarea)/i.test(item.ftype))
|
514 |
{
|
515 |
+
cost_str += '<option value="'+cff_esc_attr(item.name)+'" '+( ( item.name == request_cost ) ? "selected" : "" )+'>'+cff_esc_attr(item.name+'('+cff_sanitize(item.title)+')')+'</option>'
|
516 |
}
|
517 |
|
518 |
// Recurrent Payments
|
519 |
if (item.ftype=="fradio" || item.ftype=="fdropdown")
|
520 |
{
|
521 |
+
recurrent_str += '<option value="'+cff_esc_attr(item.name)+'" '+( ( item.name == paypal_recurrent_field ) ? "selected" : "" )+'>'+cff_esc_attr(item.name+' ('+cff_sanitize(item.title)+')')+'</option>';
|
522 |
}
|
523 |
|
524 |
// Times Intervals
|
525 |
+
interval_fields_str += '<option value="'+cff_esc_attr(item.name)+'" '+( ( item.name == paypal_price_field ) ? "selected" : "" )+'>'+cff_esc_attr(cff_sanitize(item.title))+'</option>';
|
526 |
}
|
527 |
}
|
528 |
|
564 |
customstyles:"",
|
565 |
display:function()
|
566 |
{
|
567 |
+
return cff_sanitize('<div class="fform" id="field"><div class="arrow ui-icon ui-icon-play "></div><h2>'+this.title+'</h2><span>'+this.description+'</span></div>');
|
568 |
},
|
569 |
|
570 |
showAllSettings:function()
|
578 |
|
579 |
for ( var i = 0; i< $.fbuilder.showSettings.formlayoutList.length; i++ )
|
580 |
{
|
581 |
+
layout += '<option value="'+cff_esc_attr($.fbuilder.showSettings.formlayoutList[i].id)+'" '+(($.fbuilder.showSettings.formlayoutList[i].id==this.formlayout)?"selected":"")+'>'+cff_esc_attr($.fbuilder.showSettings.formlayoutList[i].name)+'</option>';
|
582 |
}
|
583 |
|
584 |
for ( var i in $.fbuilder.showSettings.formTemplateDic )
|
599 |
}
|
600 |
}
|
601 |
|
602 |
+
template += '<option value="'+cff_esc_attr($.fbuilder.showSettings.formTemplateDic[i].prefix)+'" ' + selected + '>'+cff_esc_attr($.fbuilder.showSettings.formTemplateDic[i].title)+'</option>';
|
603 |
}
|
604 |
|
605 |
+
str += '<div><label>Form Name</label><input type="text" class="large" name="fTitle" id="fTitle" value="'+cff_esc_attr(this.title)+'" /></div><div><label>Description</label><textarea class="large" name="fDescription" id="fDescription">'+cff_esc_attr(this.description)+'</textarea></div><div><label>Label Placement</label><select name="fLayout" id="fLayout" class="large">'+layout+'</select></div><div><label><input type="checkbox" name="fLoadingAnimation" id="fLoadingAnimation" '+( ( this.loading_animation ) ? 'CHECKED' : '' )+' /> Display loading form animation</label></div><div><label><input type="checkbox" name="fAutocomplete" id="fAutocomplete" '+( ( this.autocomplete ) ? 'CHECKED' : '' )+' /> Enable autocompletion</label></div><div><label><input type="checkbox" name="fPersistence" id="fPersistence" '+( ( this.persistence ) ? 'CHECKED' : '' )+' /> Enable the browser\'s persistence (the data are stored locally on browser)</label></div>';
|
606 |
|
607 |
if(typeof $.fbuilder.controls[ 'fCalculated' ] != 'undefined')
|
608 |
{
|
613 |
|
614 |
str += '<div><label>Form Template</label><select name="fTemplate" id="fTemplate" class="large">'+template+'</select></div><div style="text-align:center;padding:10px 0;"><span id="fTemplateThumbnail">'+thumbnail+'</span><div></div><span id="fTemplateDescription">'+description+'</span></div>'+
|
615 |
'<div><label><input type="checkbox" name="fAnimateForm" id="fAnimateForm" '+( ( this.animate_form ) ? 'CHECKED' : '' )+' /> Animate page breaks in multipage forms, and dependencies</label></div>'+
|
616 |
+
'<div class="cff-editor-container"><label><div class="cff-editor-extend-shrink"></div>Customize Form Design <i>(Enter the CSS rules. <a href="http://cff.dwbooster.com/faq#q82" target="_blank">More information</a>)</i></label><textarea id="fCustomStyles" style="width:100%;height:150px;">'+cff_esc_attr(this.customstyles)+'</textarea></div>' ;
|
617 |
|
618 |
return str;
|
619 |
}
|
852 |
},
|
853 |
showTitle: function(v)
|
854 |
{
|
855 |
+
return '<label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+cff_esc_attr(v)+'</textarea>';
|
856 |
},
|
857 |
showShortLabel: function( v )
|
858 |
{
|
859 |
+
return '<div><label>Short label (optional) [<a class="helpfbuilder" text="The short label is used at title for the column when exporting the form data to CSV files.\n\nIf the short label is empty then, the field label will be used for the CSV file.">help?</a>] :</label><input type="text" class="large" name="sShortlabel" id="sShortlabel" value="'+cff_esc_attr(v)+'" /></div>';
|
860 |
},
|
861 |
showName: function( v )
|
862 |
{
|
863 |
+
return '<div><label>Field name, tag for the message:</label><input type="text" readonly="readonly" class="large" name="sNametag" id="sNametag" value="<%'+cff_esc_attr(v)+'%>" />'+
|
864 |
+
'<input style="display:none" readonly="readonly" class="large" name="sName" id="sName" value="'+cff_esc_attr(v)+'" /></div>';
|
865 |
},
|
866 |
showPredefined: function(v,c)
|
867 |
{
|
868 |
+
return '<div><label>Predefined Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+cff_esc_attr(v)+'</textarea><br /><i>It is possible to use another field in the form as predefined value. Ex: fieldname1</i><label><input type="checkbox" name="sPredefinedClick" id="sPredefinedClick" '+((c)?"checked":"")+' value="1" > Use predefined value as placeholder.</label></div>';
|
869 |
},
|
870 |
showEqualTo: function(v,name)
|
871 |
{
|
872 |
+
return '<div><label>Equal to [<a class="helpfbuilder" text="Use this field to create password confirmation field or email confirmation fields.\n\nSpecify this setting ONLY into the confirmation field, not in the original field.">help?</a>]</label><select class="equalTo" name="sEqualTo" id="sEqualTo" dvalue="'+cff_esc_attr(v)+'" dname="'+cff_esc_attr(name)+'"></select></div>';
|
873 |
},
|
874 |
showAutocomplete: function(v)
|
875 |
{
|
877 |
|
878 |
for(var i = 0, h = values.length; i<h; i++)
|
879 |
{
|
880 |
+
options += '<option value="'+cff_esc_attr(values[i])+'" '+(values[i] == v ? 'SELECTED' : '')+'>'+cff_esc_attr(values[i])+'</option>';
|
881 |
}
|
882 |
return '<div><label>Autocomplete</label>'+
|
883 |
'<select class="large" name="sAutocomplete" id="sAutocomplete">'+options+'</select><br><i>The field attribute takes precedence over the form settings.</i></div>';
|
907 |
var str = "";
|
908 |
for (var i=0;i<this.sizeList.length;i++)
|
909 |
{
|
910 |
+
str += '<option value="'+cff_esc_attr(this.sizeList[i].id)+'" '+((this.sizeList[i].id==v)?"selected":"")+'>'+cff_esc_attr(this.sizeList[i].name)+'</option>';
|
911 |
}
|
912 |
return '<label>Field Size</label><select name="sSize" id="sSize">'+str+'</select>';
|
913 |
},
|
916 |
var str = "";
|
917 |
for (var i=0;i<this.layoutList.length;i++)
|
918 |
{
|
919 |
+
str += '<option value="'+cff_esc_attr(this.layoutList[i].id)+'" '+((this.layoutList[i].id==v)?"selected":"")+'>'+cff_esc_attr(this.layoutList[i].name)+'</option>';
|
920 |
}
|
921 |
return '<label>Field Layout</label><select name="sLayout" id="sLayout">'+str+'</select>';
|
922 |
},
|
923 |
showUserhelp: function(v,c,i)
|
924 |
{
|
925 |
+
return '<label>Instructions for User</label><textarea class="large" name="sUserhelp" id="sUserhelp">'+cff_esc_attr(v)+'</textarea><label class="column"><input type="checkbox" name="sUserhelpTooltip" id="sUserhelpTooltip" '+((c)?"checked":"")+' value="1" > Show as floating tooltip </label><label class="column"><input type="checkbox" name="sTooltipIcon" id="sTooltipIcon" '+((i)?"checked":"")+' value="1" > Display on icon</label><div class="clearer"></div>';
|
926 |
},
|
927 |
showCsslayout: function(v)
|
928 |
{
|
929 |
+
return '<div><label>Add Css Layout Keywords</label><input type="text" class="large" name="sCsslayout" id="sCsslayout" value="'+cff_esc_attr(v)+'" /></div>';
|
930 |
}
|
931 |
};
|
932 |
|
954 |
* e -> event name
|
955 |
* l -> element
|
956 |
* f -> function to apply the value
|
957 |
+
* x -> escape
|
958 |
*/
|
959 |
$(e[i].s).bind(e[i].e, {obj:this, i:e[i]}, function(e){
|
960 |
var v = $(this).val();
|
961 |
if(typeof e.data.i['f'] != 'undefined') v = e.data.i.f($(this));
|
962 |
+
e.data.obj[e.data.i.l] = ('x' in e.data.i && e.data.i.x) ? cff_esc_attr(v) : v;
|
963 |
$.fbuilder.reloadItems( {'field': e.data.obj} );
|
964 |
});
|
965 |
}
|
js/fbuilder-pro-public.jquery.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
$.fbuilder['version'] = '1.1.
|
2 |
$.fbuilder['controls'] = $.fbuilder['controls'] || {};
|
3 |
$.fbuilder['forms'] = $.fbuilder['forms'] || {};
|
4 |
|
5 |
-
$.fbuilder['htmlEncode'] = function(value)
|
6 |
{
|
7 |
return $('<div/>').text(value).html()
|
8 |
.replace(/"/g, """)
|
@@ -10,12 +10,12 @@
|
|
10 |
.replace(/&gt;/g, '>');
|
11 |
};
|
12 |
|
13 |
-
$.fbuilder['htmlDecode'] = function(value)
|
14 |
{
|
15 |
return (/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test(value)) ? $('<div/>').html(value).text() : value;
|
16 |
};
|
17 |
|
18 |
-
$.fbuilder[
|
19 |
{
|
20 |
if(typeof value == 'string')
|
21 |
value = value.replace(/<script\b.*\bscript>/ig, '')
|
@@ -397,7 +397,7 @@
|
|
397 |
{
|
398 |
$(".pb"+page, fieldlist_tag).addClass("pbEnd");
|
399 |
$(".pbreak", fieldlist_tag).each(function(index) {
|
400 |
-
var code =
|
401 |
bSubmit = '';
|
402 |
|
403 |
if (index == page)
|
@@ -406,7 +406,10 @@
|
|
406 |
bSubmit = getSubmitHTML();
|
407 |
}
|
408 |
|
409 |
-
|
|
|
|
|
|
|
410 |
});
|
411 |
}
|
412 |
|
1 |
+
$.fbuilder['version'] = '1.1.87';
|
2 |
$.fbuilder['controls'] = $.fbuilder['controls'] || {};
|
3 |
$.fbuilder['forms'] = $.fbuilder['forms'] || {};
|
4 |
|
5 |
+
$.fbuilder['htmlEncode'] = window['cff_esc_attr'] = function(value)
|
6 |
{
|
7 |
return $('<div/>').text(value).html()
|
8 |
.replace(/"/g, """)
|
10 |
.replace(/&gt;/g, '>');
|
11 |
};
|
12 |
|
13 |
+
$.fbuilder['htmlDecode'] = window['cff_html_decode'] = function(value)
|
14 |
{
|
15 |
return (/&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig.test(value)) ? $('<div/>').html(value).text() : value;
|
16 |
};
|
17 |
|
18 |
+
$.fbuilder['sanitize'] = window['cff_sanitize'] = function(value)
|
19 |
{
|
20 |
if(typeof value == 'string')
|
21 |
value = value.replace(/<script\b.*\bscript>/ig, '')
|
397 |
{
|
398 |
$(".pb"+page, fieldlist_tag).addClass("pbEnd");
|
399 |
$(".pbreak", fieldlist_tag).each(function(index) {
|
400 |
+
var code = '',
|
401 |
bSubmit = '';
|
402 |
|
403 |
if (index == page)
|
406 |
bSubmit = getSubmitHTML();
|
407 |
}
|
408 |
|
409 |
+
$(this).wrapInner('<fieldset></fieldset>')
|
410 |
+
.find('fieldset:eq(0)')
|
411 |
+
.prepend('<legend>'+opt.messages.pageof.replace( /\{\s*\d+\s*\}/, (index+1) ).replace( /\{\s*\d+\s*\}/, (page+1) )+'</legend>')
|
412 |
+
.append(code+'<div class="pbPrevious" tabindex="0">'+opt.messages.previous+'</div><div class="pbNext" tabindex="0">'+opt.messages.next+'</div>'+bSubmit+'<div class="clearer"></div>');
|
413 |
});
|
414 |
}
|
415 |
|
js/fields-admin/01_fbuilder.ftext.js
CHANGED
@@ -26,17 +26,17 @@
|
|
26 |
regExpMssg:"",
|
27 |
display:function()
|
28 |
{
|
29 |
-
return
|
30 |
},
|
31 |
editItemEvents:function()
|
32 |
{
|
33 |
var me = this, evt = [
|
34 |
-
{s:"#sSize",e:"change", l:"size"},
|
35 |
-
{s:"#sMinlength",e:"change keyup", l:"minlength"},
|
36 |
-
{s:"#sMaxlength",e:"change keyup", l:"maxlength"},
|
37 |
{s:"#sRegExp",e:"change keyup", l:"regExp"},
|
38 |
{s:"#sRegExpMssg",e:"change keyup", l:"regExpMssg"},
|
39 |
-
{s:"#sEqualTo",e:"change", l:"equalTo"}
|
40 |
],
|
41 |
items = this.fBuild.getItems();
|
42 |
$('.equalTo').each(function(){
|
@@ -48,7 +48,7 @@
|
|
48 |
items[i].name != $(this).attr("dname")
|
49 |
)
|
50 |
{
|
51 |
-
str += '<option value="'
|
52 |
}
|
53 |
}
|
54 |
$(this).html(str);
|
@@ -57,6 +57,6 @@
|
|
57 |
},
|
58 |
showSpecialDataInstance: function()
|
59 |
{
|
60 |
-
return '<div class="column width50"><label>Min length/characters</label><input type="text" name="sMinlength" id="sMinlength" value="'
|
61 |
}
|
62 |
});
|
26 |
regExpMssg:"",
|
27 |
display:function()
|
28 |
{
|
29 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="text" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
30 |
},
|
31 |
editItemEvents:function()
|
32 |
{
|
33 |
var me = this, evt = [
|
34 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
35 |
+
{s:"#sMinlength",e:"change keyup", l:"minlength", x:1},
|
36 |
+
{s:"#sMaxlength",e:"change keyup", l:"maxlength", x:1},
|
37 |
{s:"#sRegExp",e:"change keyup", l:"regExp"},
|
38 |
{s:"#sRegExpMssg",e:"change keyup", l:"regExpMssg"},
|
39 |
+
{s:"#sEqualTo",e:"change", l:"equalTo", x:1}
|
40 |
],
|
41 |
items = this.fBuild.getItems();
|
42 |
$('.equalTo').each(function(){
|
48 |
items[i].name != $(this).attr("dname")
|
49 |
)
|
50 |
{
|
51 |
+
str += '<option value="'+cff_esc_attr(items[i].name)+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+cff_esc_attr(items[i].title)+'</option>';
|
52 |
}
|
53 |
}
|
54 |
$(this).html(str);
|
57 |
},
|
58 |
showSpecialDataInstance: function()
|
59 |
{
|
60 |
+
return '<div class="column width50"><label>Min length/characters</label><input type="text" name="sMinlength" id="sMinlength" value="'+cff_esc_attr(this.minlength)+'" class="large"></div><div class="column width50"><label>Max length/characters</label><input type="text" name="sMaxlength" id="sMaxlength" value="'+cff_esc_attr(this.maxlength)+'" class="large"></div><div class="clearer"></div><label style="padding-bottom:5px;">Validate against a regular expression <input type="button" onclick="window.open(\'https://cff-bundles.dwbooster.com/product/regexp\');" value="+" title="Resources" /></label><input type="text" name="sRegExp" id="sRegExp" value="'+cff_esc_attr(this.regExp)+'" class="large" /><label>Error message when the regular expression fails</label><input type="text" name="sRegExpMssg" id="sRegExpMssg" value="'+cff_esc_attr(this.regExpMssg)+'" class="large" />';
|
61 |
}
|
62 |
});
|
js/fields-admin/02_fbuilder.fcurrency.js
CHANGED
@@ -72,22 +72,22 @@
|
|
72 |
},
|
73 |
display:function()
|
74 |
{
|
75 |
-
return
|
76 |
},
|
77 |
editItemEvents:function()
|
78 |
{
|
79 |
var f = function(el){return el.is(':checked');},
|
80 |
evt = [
|
81 |
-
{s:"#sSize",e:"change", l:"size"},
|
82 |
-
{s:"#sCurrencySymbol",e:"change keyup", l:"currencySymbol"},
|
83 |
-
{s:"#sCurrencyText",e:"change keyup", l:"currencyText"},
|
84 |
-
{s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator"},
|
85 |
-
{s:"#sCentSeparator",e:"change keyup", l:"centSeparator"},
|
86 |
{s:"#sFormatDynamically",e:"click", l:"formatDynamically",f:f},
|
87 |
{s:"#sTwoDecimals",e:"click", l:"twoDecimals",f:f},
|
88 |
{s:"#sNoCents",e:"click", l:"noCents",f:f},
|
89 |
-
{s:"#sMin",e:"change keyup", l:"min"},
|
90 |
-
{s:"#sMax",e:"change keyup", l:"max"}
|
91 |
];
|
92 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
93 |
},
|
@@ -97,16 +97,16 @@
|
|
97 |
},
|
98 |
showCurrencyFormat: function()
|
99 |
{
|
100 |
-
var str = '<label>Currency Symbol</label><input type="text" name="sCurrencySymbol" id="sCurrencySymbol" value="'
|
101 |
-
str += '<label>Currency</label><input type="text" name="sCurrencyText" id="sCurrencyText" value="'
|
102 |
-
str += '<label>Thousands Separator</label><input type="text" name="sThousandSeparator" id="sThousandSeparator" value="'
|
103 |
-
str += '<label>Cents Separator</label><input type="text" name="sCentSeparator" id="sCentSeparator" value="'
|
104 |
str += '<label><input type="checkbox" name="sNoCents" id="sNoCents" '+( (this.noCents) ? 'CHECKED' : '')+'> Do Not Allow Cents</label>';
|
105 |
str += '<label class="column width50"><input type="checkbox" name="sFormatDynamically" id="sFormatDynamically" '+( (this.formatDynamically) ? 'CHECKED' : '')+'> Format Dynamically to </label><label class="column width50"><input type="checkbox" name="sTwoDecimals" id="sTwoDecimals" '+( (this.twoDecimals) ? 'CHECKED' : '')+'> two decimal places</label><div class="clearer" />';
|
106 |
return str;
|
107 |
},
|
108 |
showRangeIntance: function()
|
109 |
{
|
110 |
-
return '<div><div class="column width50"><label>Min</label><input type="text" name="sMin" id="sMin" value="'
|
111 |
}
|
112 |
});
|
72 |
},
|
73 |
display:function()
|
74 |
{
|
75 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="text" value="'+cff_esc_attr(this.getPredefinedValue())+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
76 |
},
|
77 |
editItemEvents:function()
|
78 |
{
|
79 |
var f = function(el){return el.is(':checked');},
|
80 |
evt = [
|
81 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
82 |
+
{s:"#sCurrencySymbol",e:"change keyup", l:"currencySymbol", x:1},
|
83 |
+
{s:"#sCurrencyText",e:"change keyup", l:"currencyText", x:1},
|
84 |
+
{s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator", x:1},
|
85 |
+
{s:"#sCentSeparator",e:"change keyup", l:"centSeparator", x:1},
|
86 |
{s:"#sFormatDynamically",e:"click", l:"formatDynamically",f:f},
|
87 |
{s:"#sTwoDecimals",e:"click", l:"twoDecimals",f:f},
|
88 |
{s:"#sNoCents",e:"click", l:"noCents",f:f},
|
89 |
+
{s:"#sMin",e:"change keyup", l:"min", x:1},
|
90 |
+
{s:"#sMax",e:"change keyup", l:"max", x:1}
|
91 |
];
|
92 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
93 |
},
|
97 |
},
|
98 |
showCurrencyFormat: function()
|
99 |
{
|
100 |
+
var str = '<label>Currency Symbol</label><input type="text" name="sCurrencySymbol" id="sCurrencySymbol" value="'+cff_esc_attr(this.currencySymbol)+'" class="large">';
|
101 |
+
str += '<label>Currency</label><input type="text" name="sCurrencyText" id="sCurrencyText" value="'+cff_esc_attr(this.currencyText)+'" class="large">';
|
102 |
+
str += '<label>Thousands Separator</label><input type="text" name="sThousandSeparator" id="sThousandSeparator" value="'+cff_esc_attr(this.thousandSeparator)+'" class="large">';
|
103 |
+
str += '<label>Cents Separator</label><input type="text" name="sCentSeparator" id="sCentSeparator" value="'+cff_esc_attr(this.centSeparator)+'" class="large">';
|
104 |
str += '<label><input type="checkbox" name="sNoCents" id="sNoCents" '+( (this.noCents) ? 'CHECKED' : '')+'> Do Not Allow Cents</label>';
|
105 |
str += '<label class="column width50"><input type="checkbox" name="sFormatDynamically" id="sFormatDynamically" '+( (this.formatDynamically) ? 'CHECKED' : '')+'> Format Dynamically to </label><label class="column width50"><input type="checkbox" name="sTwoDecimals" id="sTwoDecimals" '+( (this.twoDecimals) ? 'CHECKED' : '')+'> two decimal places</label><div class="clearer" />';
|
106 |
return str;
|
107 |
},
|
108 |
showRangeIntance: function()
|
109 |
{
|
110 |
+
return '<div><div class="column width50"><label>Min</label><input type="text" name="sMin" id="sMin" value="'+cff_esc_attr(this.min)+'" class="large"></div><div class="column width50"><label>Max</label><input type="text" name="sMax" id="sMax" value="'+cff_esc_attr(this.max)+'" class="large"></div><div class="clearer" style="margin-bottom:10px;">Enter the min/max values as numbers, and not as currencies.<br /><i>It is possible to associate other fields in the form to the attributes "min" and "max". Ex: fieldname1</i></div></div>';
|
111 |
}
|
112 |
});
|
js/fields-admin/02_fbuilder.fnumber.js
CHANGED
@@ -28,23 +28,23 @@
|
|
28 |
formats:new Array("digits","number", "percent"),
|
29 |
display:function()
|
30 |
{
|
31 |
-
return
|
32 |
},
|
33 |
editItemEvents:function()
|
34 |
{
|
35 |
var evt = [
|
36 |
-
{s:"#sSize",e:"change", l:"size"},
|
37 |
{s:"#sFormat",e:"change", l:"dformat", f:function(el){
|
38 |
var v = el.val();
|
39 |
$( '.fnumber-symbols' )[(v == 'digits')?'hide':'show']();
|
40 |
$( '.fnumber-hint' )[(v == 'percent')?'show':'hide']();
|
41 |
return v;
|
42 |
-
}
|
43 |
},
|
44 |
-
{s:"#sMin",e:"change keyup", l:"min"},
|
45 |
-
{s:"#sMax",e:"change keyup", l:"max"},
|
46 |
-
{s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator"},
|
47 |
-
{s:"#sDecimalSymbol",e:"change keyup", l:"decimalSymbol"},
|
48 |
{s:"#sFormatDynamically",e:"click", l:"formatDynamically",f:function(el){return el.is(':checked');}},
|
49 |
];
|
50 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
@@ -58,10 +58,10 @@
|
|
58 |
}
|
59 |
return '<div><label>Number Format</label><select name="sFormat" id="sFormat">'+str+'</select></div>'+
|
60 |
'<div class="fnumber-hint" '+((df != 'percent') ? 'style="display:none;"' : '')+'><i>The field value in the equations would be its decimal representation. Ex. 10% would be 0.1</i></div>'+
|
61 |
-
'<div class="fnumber-symbols" '+((df == 'digits') ? 'style="display:none;"' : '')+'><label>Decimals separator symbol (Ex: 25.20)</label><input type="text" name="sDecimalSymbol" id="sDecimalSymbol" class="large" value="'
|
62 |
},
|
63 |
showRangeIntance: function()
|
64 |
{
|
65 |
-
return '<div class="column width50"><label>Min</label><input type="text" name="sMin" id="sMin" value="'
|
66 |
}
|
67 |
});
|
28 |
formats:new Array("digits","number", "percent"),
|
29 |
display:function()
|
30 |
{
|
31 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="text" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
32 |
},
|
33 |
editItemEvents:function()
|
34 |
{
|
35 |
var evt = [
|
36 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
37 |
{s:"#sFormat",e:"change", l:"dformat", f:function(el){
|
38 |
var v = el.val();
|
39 |
$( '.fnumber-symbols' )[(v == 'digits')?'hide':'show']();
|
40 |
$( '.fnumber-hint' )[(v == 'percent')?'show':'hide']();
|
41 |
return v;
|
42 |
+
}, x:1
|
43 |
},
|
44 |
+
{s:"#sMin",e:"change keyup", l:"min", x:1},
|
45 |
+
{s:"#sMax",e:"change keyup", l:"max", x:1},
|
46 |
+
{s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator", x:1},
|
47 |
+
{s:"#sDecimalSymbol",e:"change keyup", l:"decimalSymbol", x:1},
|
48 |
{s:"#sFormatDynamically",e:"click", l:"formatDynamically",f:function(el){return el.is(':checked');}},
|
49 |
];
|
50 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
58 |
}
|
59 |
return '<div><label>Number Format</label><select name="sFormat" id="sFormat">'+str+'</select></div>'+
|
60 |
'<div class="fnumber-hint" '+((df != 'percent') ? 'style="display:none;"' : '')+'><i>The field value in the equations would be its decimal representation. Ex. 10% would be 0.1</i></div>'+
|
61 |
+
'<div class="fnumber-symbols" '+((df == 'digits') ? 'style="display:none;"' : '')+'><label>Decimals separator symbol (Ex: 25.20)</label><input type="text" name="sDecimalSymbol" id="sDecimalSymbol" class="large" value="'+cff_esc_attr(this.decimalSymbol)+'" /><label>Symbol for grouping thousands (Ex: 3,000,000)</label><input type="text" name="sThousandSeparator" id="sThousandSeparator" class="large" value="'+cff_esc_attr(this.thousandSeparator)+'" /><label><input type="checkbox" name="sFormatDynamically" id="sFormatDynamically" '+( (this.formatDynamically) ? 'CHECKED' : '')+'> Format Dynamically</label></div>';
|
62 |
},
|
63 |
showRangeIntance: function()
|
64 |
{
|
65 |
+
return '<div class="column width50"><label>Min</label><input type="text" name="sMin" id="sMin" value="'+cff_esc_attr(this.min)+'" class="large"></div><div class="column width50"><label>Max</label><input type="text" name="sMax" id="sMax" value="'+cff_esc_attr(this.max)+'" class="large"></div><div class="clearer"><i>It is possible to associate other fields in the form to the attributes "min" and "max". Ex: fieldname1</i></div>';
|
66 |
}
|
67 |
});
|
js/fields-admin/02_fbuilder.fslider.js
CHANGED
@@ -31,16 +31,16 @@
|
|
31 |
maxCaption:"",
|
32 |
display:function()
|
33 |
{
|
34 |
-
return
|
35 |
},
|
36 |
editItemEvents:function()
|
37 |
{
|
38 |
var evt = [
|
39 |
-
{s:"#sSize",e:"change", l:"size"},
|
40 |
{s:"#sTypeValues",e:"click", l:"typeValues", f:function(el){return el.is(':checked');}},
|
41 |
-
{s:"#sMin",e:"change keyup", l:"min"},
|
42 |
-
{s:"#sMax",e:"change keyup", l:"max"},
|
43 |
-
{s:"#sStep",e:"change keyup", l:"step"},
|
44 |
{s:"#sRange",e:"change", l:"range", f:function(el){
|
45 |
var v = el.is(':checked');
|
46 |
$( 'div.range' )[ ( v ) ? 'show' : 'hide' ]();
|
@@ -51,22 +51,22 @@
|
|
51 |
{s:"#sCaption",e:"change keyup", l:"caption"},
|
52 |
{s:"#sMinCaption",e:"change keyup", l:"minCaption"},
|
53 |
{s:"#sMaxCaption",e:"change keyup", l:"maxCaption"},
|
54 |
-
{s:"#sPredefinedMin",e:"change keyup", l:"predefinedMin"},
|
55 |
-
{s:"#sPredefinedMax",e:"change keyup", l:"predefinedMax"},
|
56 |
-
{s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator"},
|
57 |
-
{s:"#sCentSeparator",e:"change keyup", l:"centSeparator"}
|
58 |
];
|
59 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
60 |
},
|
61 |
showRequired: function(){ return '<label><input type="checkbox" name="sTypeValues" id="sTypeValues" '+( (this.typeValues) ? 'CHECKED' : '')+'> Allow to type the values</label>'; },
|
62 |
showPredefined: function()
|
63 |
{
|
64 |
-
return '<div class="no-range" style="display:'+( ( this.range ) ? 'none' : 'block')+';"><label>Predefined Value</label><input type="text" class="large" name="sPredefined" id="sPredefined" value="'
|
65 |
},
|
66 |
showRangeIntance: function()
|
67 |
{
|
68 |
return $.fbuilder.showSettings.showExclude(this.exclude) +
|
69 |
$.fbuilder.showSettings.showReadonly(this.readonly) +
|
70 |
-
'<div><div class="column width30"><label>Min</label><input type="text" name="sMin" id="sMin" value="'
|
71 |
}
|
72 |
});
|
31 |
maxCaption:"",
|
32 |
display:function()
|
33 |
{
|
34 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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+'</label><div class="dfield"><input class="field disabled '+this.size+'" type="text" value="'+( ( !this.range ) ? cff_esc_attr( this.predefined ) : cff_esc_attr( '['+this.predefinedMin+','+this.predefinedMax+']' ) )+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
35 |
},
|
36 |
editItemEvents:function()
|
37 |
{
|
38 |
var evt = [
|
39 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
40 |
{s:"#sTypeValues",e:"click", l:"typeValues", f:function(el){return el.is(':checked');}},
|
41 |
+
{s:"#sMin",e:"change keyup", l:"min", x:1},
|
42 |
+
{s:"#sMax",e:"change keyup", l:"max", x:1},
|
43 |
+
{s:"#sStep",e:"change keyup", l:"step", x:1},
|
44 |
{s:"#sRange",e:"change", l:"range", f:function(el){
|
45 |
var v = el.is(':checked');
|
46 |
$( 'div.range' )[ ( v ) ? 'show' : 'hide' ]();
|
51 |
{s:"#sCaption",e:"change keyup", l:"caption"},
|
52 |
{s:"#sMinCaption",e:"change keyup", l:"minCaption"},
|
53 |
{s:"#sMaxCaption",e:"change keyup", l:"maxCaption"},
|
54 |
+
{s:"#sPredefinedMin",e:"change keyup", l:"predefinedMin", x:1},
|
55 |
+
{s:"#sPredefinedMax",e:"change keyup", l:"predefinedMax", x:2},
|
56 |
+
{s:"#sThousandSeparator",e:"change keyup", l:"thousandSeparator", x:1},
|
57 |
+
{s:"#sCentSeparator",e:"change keyup", l:"centSeparator", x:1}
|
58 |
];
|
59 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
60 |
},
|
61 |
showRequired: function(){ return '<label><input type="checkbox" name="sTypeValues" id="sTypeValues" '+( (this.typeValues) ? 'CHECKED' : '')+'> Allow to type the values</label>'; },
|
62 |
showPredefined: function()
|
63 |
{
|
64 |
+
return '<div class="no-range" style="display:'+( ( this.range ) ? 'none' : 'block')+';"><label>Predefined Value</label><input type="text" class="large" name="sPredefined" id="sPredefined" value="'+cff_esc_attr( this.predefined )+'"></div><div class="range" style="display:'+( ( this.range ) ? 'block' : 'none')+';"><div class="column width50"><label>Predefined Min</label><input type="text" name="sPredefinedMin" id="sPredefinedMin" value="'+cff_esc_attr( this.predefinedMin )+'" class="large"></div><div class="column width50"><label>Predefined Max</label><input type="text" name="sPredefinedMax" id="sPredefinedMax" value="'+cff_esc_attr( this.predefinedMax )+'" class="large"></div></div><div class="clearer" />';
|
65 |
},
|
66 |
showRangeIntance: function()
|
67 |
{
|
68 |
return $.fbuilder.showSettings.showExclude(this.exclude) +
|
69 |
$.fbuilder.showSettings.showReadonly(this.readonly) +
|
70 |
+
'<div><div class="column width30"><label>Min</label><input type="text" name="sMin" id="sMin" value="'+cff_esc_attr(this.min)+'" placeholder="0 by default" class="large"></div><div class="column width30"><label>Max</label><input type="text" name="sMax" id="sMax" value="'+cff_esc_attr(this.max)+'" placeholder="100 by default" class="large"></div><div class="column width30"><label>Step</label><input type="text" name="sStep" id="sStep" value="'+cff_esc_attr(this.step)+'" placeholder="1 by default" class="large"></div><div class="clearer" /></div><div style="margin-bottom:10px;"><i>It is possible to associate other fields in the form with the attributes "min", "max" and "step". Ex: fieldname1</i></div><div><input type="checkbox" name="sRange" id="sRange" '+( ( this.range ) ? 'CHECKED' : '' )+' /> Range slider </div><div><label>Field Caption</label><input class="large" type="text" name="sCaption" id="sCaption" value="'+cff_esc_attr( this.caption )+'"></div><div><label>Min Corner Caption</label><input class="large" type="text" name="sMinCaption" id="sMinCaption" value="'+cff_esc_attr( this.minCaption )+'"></div><div><label>Max Corner Caption</label><input class="large" type="text" name="sMaxCaption" id="sMaxCaption" value="'+cff_esc_attr( this.maxCaption )+'"></div><div><label>Symbol for grouping thousands in the field\'s caption(Ex: 3,000,000)</label><input type="text" name="sThousandSeparator" id="sThousandSeparator" class="large" value="'+cff_esc_attr( this.thousandSeparator )+'" /></div><div><label>Decimals separator symbol (Ex: 25.20)</label><input type="text" name="sCentSeparator" id="sCentSeparator" class="large" value="'+cff_esc_attr( this.centSeparator )+'" /></div>';
|
71 |
}
|
72 |
});
|
js/fields-admin/03_fbuilder.fcolor.js
CHANGED
@@ -20,11 +20,11 @@
|
|
20 |
size:"default",
|
21 |
display:function()
|
22 |
{
|
23 |
-
return
|
24 |
},
|
25 |
editItemEvents:function()
|
26 |
{
|
27 |
-
var me = this, evt = [{s:"#sSize",e:"change", l:"size"}];
|
28 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this,evt);
|
29 |
},
|
30 |
showSize:function()
|
20 |
size:"default",
|
21 |
display:function()
|
22 |
{
|
23 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="color" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
24 |
},
|
25 |
editItemEvents:function()
|
26 |
{
|
27 |
+
var me = this, evt = [{s:"#sSize",e:"change", l:"size", x:1}];
|
28 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this,evt);
|
29 |
},
|
30 |
showSize:function()
|
js/fields-admin/03_fbuilder.femail.js
CHANGED
@@ -24,15 +24,15 @@
|
|
24 |
regExpMssg:"",
|
25 |
display:function()
|
26 |
{
|
27 |
-
return
|
28 |
},
|
29 |
editItemEvents:function()
|
30 |
{
|
31 |
var evt = [
|
32 |
-
{s:"#sSize",e:"change", l:"size"},
|
33 |
{s:"#sRegExp",e:"change keyup", l:"regExp"},
|
34 |
{s:"#sRegExpMssg",e:"change keyup", l:"regExpMssg"},
|
35 |
-
{s:"#sEqualTo",e:"change", l:"equalTo"}
|
36 |
],
|
37 |
items = this.fBuild.getItems();
|
38 |
$('.equalTo').each(function()
|
@@ -45,7 +45,7 @@
|
|
45 |
items[i].name != $(this).attr("dname")
|
46 |
)
|
47 |
{
|
48 |
-
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'
|
49 |
}
|
50 |
}
|
51 |
$(this).html(str);
|
@@ -54,7 +54,7 @@
|
|
54 |
},
|
55 |
showSpecialDataInstance: function()
|
56 |
{
|
57 |
-
var str = '<label style="padding-bottom:5px;">Validate against a regular expression <input type="button" onclick="window.open(\'https://cff-bundles.dwbooster.com/product/regexp\');" value="+" title="Resources" /></label><input type="text" name="sRegExp" id="sRegExp" value="'
|
58 |
|
59 |
$.ajax('admin.php?page=cff-email-validator-submenu').fail(function(a,b,c){
|
60 |
$('.cff-email-validator').html('<a class="button-primary large" href="https://cff-bundles.dwbooster.com/product/email-validator" target="_blank" style="text-align:center;margin-top:10px;">Advanced email validator [+]</a>')
|
24 |
regExpMssg:"",
|
25 |
display:function()
|
26 |
{
|
27 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="text" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
28 |
},
|
29 |
editItemEvents:function()
|
30 |
{
|
31 |
var evt = [
|
32 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
33 |
{s:"#sRegExp",e:"change keyup", l:"regExp"},
|
34 |
{s:"#sRegExpMssg",e:"change keyup", l:"regExpMssg"},
|
35 |
+
{s:"#sEqualTo",e:"change", l:"equalTo", x:1}
|
36 |
],
|
37 |
items = this.fBuild.getItems();
|
38 |
$('.equalTo').each(function()
|
45 |
items[i].name != $(this).attr("dname")
|
46 |
)
|
47 |
{
|
48 |
+
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+cff_esc_attr(items[i].title)+'</option>';
|
49 |
}
|
50 |
}
|
51 |
$(this).html(str);
|
54 |
},
|
55 |
showSpecialDataInstance: function()
|
56 |
{
|
57 |
+
var str = '<label style="padding-bottom:5px;">Validate against a regular expression <input type="button" onclick="window.open(\'https://cff-bundles.dwbooster.com/product/regexp\');" value="+" title="Resources" /></label><input type="text" name="sRegExp" id="sRegExp" value="'+cff_esc_attr(this.regExp)+'" class="large" /><label>Error message when the regular expression fails</label><input type="text" name="sRegExpMssg" id="sRegExpMssg" value="'+cff_esc_attr(this.regExpMssg)+'" class="large" /><div class="cff-email-validator"></div>';
|
58 |
|
59 |
$.ajax('admin.php?page=cff-email-validator-submenu').fail(function(a,b,c){
|
60 |
$('.cff-email-validator').html('<a class="button-primary large" href="https://cff-bundles.dwbooster.com/product/email-validator" target="_blank" style="text-align:center;margin-top:10px;">Advanced email validator [+]</a>')
|
js/fields-admin/04_fbuilder.fdate.js
CHANGED
@@ -55,20 +55,20 @@
|
|
55 |
{
|
56 |
var me = this,
|
57 |
dformat = me.dformat.replace(/\//g, me.dseparator);
|
58 |
-
return
|
59 |
},
|
60 |
editItemEvents:function()
|
61 |
{
|
62 |
var evt = [
|
63 |
-
{s:"#sDropdownRange",e:"keyup", l:"dropdownRange"},
|
64 |
-
{s:"#sSize",e:"change", l:"size"},
|
65 |
-
{s:"#sFormat",e:"change", l:"dformat"},
|
66 |
-
{s:"#sSeparator",e:"change", l:"dseparator"},
|
67 |
-
{s:"[name='sTimeFormat']",e:"change", l:"tformat"},
|
68 |
-
{s:"#sMinDate",e:"change keyup", l:"minDate"},
|
69 |
-
{s:"#sMaxDate",e:"change keyup", l:"maxDate"},
|
70 |
-
{s:"#sInvalidDates",e:"change keyup", l:"invalidDates"},
|
71 |
-
{s:"#sDefaultDate",e:"change keyup", l:"defaultDate"},
|
72 |
{s:"#sShowDropdown",e:"click", l:"showDropdown", f:function(el){
|
73 |
var v = el.is(':checked');
|
74 |
$("#divdropdownRange")[( v ) ? 'show' : 'hide']();
|
@@ -87,13 +87,13 @@
|
|
87 |
{s:"#sAriaAMPMLabel",e:"change keyup", l:"ariaAMPMLabel"},
|
88 |
{s:"#sAriaHourLabel",e:"change keyup", l:"ariaHourLabel"},
|
89 |
{s:"#sAriaMinuteLabel",e:"change keyup", l:"ariaMinuteLabel"},
|
90 |
-
{s:"#sMinHour",e:"change keyup", l:"minHour"},
|
91 |
-
{s:"#sMaxHour",e:"change keyup", l:"maxHour"},
|
92 |
-
{s:"#sMinMinute",e:"change keyup", l:"minMinute"},
|
93 |
-
{s:"#sMaxMinute",e:"change keyup", l:"maxMinute"},
|
94 |
-
{s:"#sStepHour",e:"change keyup", l:"stepHour"},
|
95 |
-
{s:"#sStepMinute",e:"change keyup", l:"stepMinute"},
|
96 |
-
{s:"#sDefaultTime",e:"change keyup", l:"defaultTime"}
|
97 |
];
|
98 |
$(".working_dates input").bind("click", {obj: this}, function(e) {
|
99 |
e.data.obj.working_dates[$(this).val()] = $(this).is(':checked');
|
@@ -108,10 +108,10 @@
|
|
108 |
separatorOpts = "";
|
109 |
|
110 |
for (var i in me.formats)
|
111 |
-
formatOpts += '<option value="'+me.formats[i]+'" '+((me.formats[i]==me.dformat)?"selected":"")+'>'+me.formats[i]+'</option>';
|
112 |
|
113 |
for (var i in me.separators)
|
114 |
-
separatorOpts += '<option value="'+me.separators[i]+'" '+((me.separators[i]==me.dseparator)?"selected":"")+'>'+me.separators[i]+'</option>';
|
115 |
|
116 |
return '<hr></hr><label><input type="checkbox" name="sShowDatepicker" id="sShowDatepicker" '+( ( me.showDatepicker ) ? 'CHECKED' : '' )+' > Show input field for the date</label><div class="width50 column"><label>Date Format</label><select name="sFormat" id="sFormat" class="large">'+formatOpts+'</select></div><div class="width50 column"><label>Parts separator</label><select name="sSeparator" id="sSeparator" class="large">'+separatorOpts+'</select></div><div class="clearer"></div>';
|
117 |
},
|
@@ -121,15 +121,15 @@
|
|
121 |
|
122 |
'<label><input type="checkbox" name="sMondayFirstDay" id="sMondayFirstDay" '+( ( this.mondayFirstDay ) ? 'CHECKED' : '' )+' > Make Monday the first day of the week</label>'+
|
123 |
|
124 |
-
'<label>Default date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: Leave empty for current date.\n\nDate: A Fixed date with the same date format indicated in the "Date Format" drop-down field.\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.">help?</a>]</label><input type="text" class="large" name="sDefaultDate" id="sDefaultDate" value="'
|
125 |
|
126 |
-
'<label>Min date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No min Date.\n\nDate: A Fixed date with the same date format indicated in the "Date Format" drop-down field.\n\nField Name: the name of another date field, Ex: fieldname1\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.">help?</a>]</label><input type="text" class="large" name="sMinDate" id="sMinDate" value="'
|
127 |
|
128 |
-
'<label>Max date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No max Date.\n\nDate: A Fixed date with the same date format indicated in the "Date Format" drop-down field.\n\nField Name: the name of another date field, Ex: fieldname1\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.">help?</a>]</label><input type="text" class="large" name="sMaxDate" id="sMaxDate" value="'
|
129 |
|
130 |
-
'<label>Invalid Dates [<a class="helpfbuilder" text="To define some dates as invalid, enter the dates with the format: mm/dd/yyyy separated by comma; for example: 12/31/2014,02/20/2014 or by hyphen for intervals; for example: 12/20/2014-12/28/2014 ">help?</a>]</label><input type="text" class="large" name="sInvalidDates" id="sInvalidDates" value="'
|
131 |
|
132 |
-
'<label><input type="checkbox" name="sShowDropdown" id="sShowDropdown" '+((this.showDropdown)?"checked":"")+'/> Show Dropdown Year and Month</label><div id="divdropdownRange" style="display:'+((this.showDropdown)?"":"none")+'">Year Range [<a class="helpfbuilder" text="The range of years displayed in the year drop-down: either relative to today\'s year ("-nn:+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn")">help?</a>]: <input type="text" name="sDropdownRange" id="sDropdownRange" value="'
|
133 |
|
134 |
'<div class="working_dates"><label>Selectable dates </label><input name="sWD0" id="sWD0" value="0" type="checkbox" '+((this.working_dates[0])?"checked":"")+'/>Su<input name="sWD1" id="sWD1" value="1" type="checkbox" '+((this.working_dates[1])?"checked":"")+'/>Mo<input name="sWD2" id="sWD2" value="2" type="checkbox" '+((this.working_dates[2])?"checked":"")+'/>Tu<input name="sWD3" id="sWD3" value="3" type="checkbox" '+((this.working_dates[3])?"checked":"")+'/>We<input name="sWD4" id="sWD4" value="4" type="checkbox" '+((this.working_dates[4])?"checked":"")+'/>Th<input name="sWD5" id="sWD5" value="5" type="checkbox" '+((this.working_dates[5])?"checked":"")+'/>Fr<input name="sWD6" id="sWD6" value="6" type="checkbox" '+((this.working_dates[6])?"checked":"")+'/>Sa</div>'+
|
135 |
|
@@ -140,17 +140,17 @@
|
|
140 |
|
141 |
'<label>Time Format</label><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>'+
|
142 |
|
143 |
-
'<label>Default Time HH:mm</label><input type="text" class="large" name="sDefaultTime" id="sDefaultTime" value="'
|
144 |
-
'<div class="width50 column"><label>Min Hour</label><input type="text" class="large" name="sMinHour" id="sMinHour" value="'
|
145 |
-
'<div class="width50 columnr"><label>Min Minutes</label><input type="text" class="large" name="sMinMinute" id="sMinMinute" value="'
|
146 |
-
'<div class="width50 column"><label>Max Hour</label><input type="text" class="large" name="sMaxHour" id="sMaxHour" value="'
|
147 |
-
'<div class="width50 columnr"><label>Max Minutes</label><input type="text" class="large" name="sMaxMinute" id="sMaxMinute" value="'
|
148 |
-
|
149 |
-
'<label>Steps for hours</label><input type="text" class="large" name="sStepHour" id="sStepHour" value="'
|
150 |
-
'<label>Steps for minutes</label><input type="text" class="large" name="sStepMinute" id="sStepMinute" value="'
|
151 |
-
'<label>Label for hours in screen readers</label><input type="text" class="large" name="sAriaHourLabel" id="sAriaHourLabel" value="'
|
152 |
-
'<label>Label for minutes in screen readers</label><input type="text" class="large" name="sAriaMinuteLabel" id="sAriaMinuteLabel" value="'
|
153 |
-
'<label>Label for am/pm component in screen readers</label><input type="text" class="large" name="sAriaAMPMLabel" id="sAriaAMPMLabel" value="'
|
154 |
'</div>'+
|
155 |
'<hr></hr>';
|
156 |
}
|
55 |
{
|
56 |
var me = this,
|
57 |
dformat = me.dformat.replace(/\//g, me.dseparator);
|
58 |
+
return '<div class="fields '+me.name+' '+this.ftype+'" 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="'+cff_esc_attr(me.predefined)+'"/><span class="uh">'+me.userhelp+'</span></div><div class="clearer" /></div>';
|
59 |
},
|
60 |
editItemEvents:function()
|
61 |
{
|
62 |
var evt = [
|
63 |
+
{s:"#sDropdownRange",e:"keyup", l:"dropdownRange", x:1},
|
64 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
65 |
+
{s:"#sFormat",e:"change", l:"dformat", x:1},
|
66 |
+
{s:"#sSeparator",e:"change", l:"dseparator", x:1},
|
67 |
+
{s:"[name='sTimeFormat']",e:"change", l:"tformat", x:1},
|
68 |
+
{s:"#sMinDate",e:"change keyup", l:"minDate", x:1},
|
69 |
+
{s:"#sMaxDate",e:"change keyup", l:"maxDate", x:1},
|
70 |
+
{s:"#sInvalidDates",e:"change keyup", l:"invalidDates", x:1},
|
71 |
+
{s:"#sDefaultDate",e:"change keyup", l:"defaultDate", x:1},
|
72 |
{s:"#sShowDropdown",e:"click", l:"showDropdown", f:function(el){
|
73 |
var v = el.is(':checked');
|
74 |
$("#divdropdownRange")[( v ) ? 'show' : 'hide']();
|
87 |
{s:"#sAriaAMPMLabel",e:"change keyup", l:"ariaAMPMLabel"},
|
88 |
{s:"#sAriaHourLabel",e:"change keyup", l:"ariaHourLabel"},
|
89 |
{s:"#sAriaMinuteLabel",e:"change keyup", l:"ariaMinuteLabel"},
|
90 |
+
{s:"#sMinHour",e:"change keyup", l:"minHour", x:1},
|
91 |
+
{s:"#sMaxHour",e:"change keyup", l:"maxHour", x:1},
|
92 |
+
{s:"#sMinMinute",e:"change keyup", l:"minMinute", x:1},
|
93 |
+
{s:"#sMaxMinute",e:"change keyup", l:"maxMinute", x:1},
|
94 |
+
{s:"#sStepHour",e:"change keyup", l:"stepHour", x:1},
|
95 |
+
{s:"#sStepMinute",e:"change keyup", l:"stepMinute", x:1},
|
96 |
+
{s:"#sDefaultTime",e:"change keyup", l:"defaultTime", x:1}
|
97 |
];
|
98 |
$(".working_dates input").bind("click", {obj: this}, function(e) {
|
99 |
e.data.obj.working_dates[$(this).val()] = $(this).is(':checked');
|
108 |
separatorOpts = "";
|
109 |
|
110 |
for (var i in me.formats)
|
111 |
+
formatOpts += '<option value="'+cff_esc_attr(me.formats[i])+'" '+((me.formats[i]==me.dformat)?"selected":"")+'>'+cff_esc_attr(me.formats[i])+'</option>';
|
112 |
|
113 |
for (var i in me.separators)
|
114 |
+
separatorOpts += '<option value="'+cff_esc_attr(me.separators[i])+'" '+((me.separators[i]==me.dseparator)?"selected":"")+'>'+cff_esc_attr(me.separators[i])+'</option>';
|
115 |
|
116 |
return '<hr></hr><label><input type="checkbox" name="sShowDatepicker" id="sShowDatepicker" '+( ( me.showDatepicker ) ? 'CHECKED' : '' )+' > Show input field for the date</label><div class="width50 column"><label>Date Format</label><select name="sFormat" id="sFormat" class="large">'+formatOpts+'</select></div><div class="width50 column"><label>Parts separator</label><select name="sSeparator" id="sSeparator" class="large">'+separatorOpts+'</select></div><div class="clearer"></div>';
|
117 |
},
|
121 |
|
122 |
'<label><input type="checkbox" name="sMondayFirstDay" id="sMondayFirstDay" '+( ( this.mondayFirstDay ) ? 'CHECKED' : '' )+' > Make Monday the first day of the week</label>'+
|
123 |
|
124 |
+
'<label>Default date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: Leave empty for current date.\n\nDate: A Fixed date with the same date format indicated in the "Date Format" drop-down field.\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.">help?</a>]</label><input type="text" class="large" name="sDefaultDate" id="sDefaultDate" value="'+cff_esc_attr(this.defaultDate)+'" />'+
|
125 |
|
126 |
+
'<label>Min date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No min Date.\n\nDate: A Fixed date with the same date format indicated in the "Date Format" drop-down field.\n\nField Name: the name of another date field, Ex: fieldname1\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.">help?</a>]</label><input type="text" class="large" name="sMinDate" id="sMinDate" value="'+cff_esc_attr(this.minDate)+'" />'+
|
127 |
|
128 |
+
'<label>Max date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No max Date.\n\nDate: A Fixed date with the same date format indicated in the "Date Format" drop-down field.\n\nField Name: the name of another date field, Ex: fieldname1\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today.">help?</a>]</label><input type="text" class="large" name="sMaxDate" id="sMaxDate" value="'+cff_esc_attr(this.maxDate)+'" />'+
|
129 |
|
130 |
+
'<label>Invalid Dates [<a class="helpfbuilder" text="To define some dates as invalid, enter the dates with the format: mm/dd/yyyy separated by comma; for example: 12/31/2014,02/20/2014 or by hyphen for intervals; for example: 12/20/2014-12/28/2014 ">help?</a>]</label><input type="text" class="large" name="sInvalidDates" id="sInvalidDates" value="'+cff_esc_attr(this.invalidDates)+'" />'+
|
131 |
|
132 |
+
'<label><input type="checkbox" name="sShowDropdown" id="sShowDropdown" '+((this.showDropdown)?"checked":"")+'/> Show Dropdown Year and Month</label><div id="divdropdownRange" style="display:'+((this.showDropdown)?"":"none")+'">Year Range [<a class="helpfbuilder" text="The range of years displayed in the year drop-down: either relative to today\'s year ("-nn:+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn")">help?</a>]: <input type="text" name="sDropdownRange" id="sDropdownRange" value="'+cff_esc_attr(this.dropdownRange)+'"/></div>'+
|
133 |
|
134 |
'<div class="working_dates"><label>Selectable dates </label><input name="sWD0" id="sWD0" value="0" type="checkbox" '+((this.working_dates[0])?"checked":"")+'/>Su<input name="sWD1" id="sWD1" value="1" type="checkbox" '+((this.working_dates[1])?"checked":"")+'/>Mo<input name="sWD2" id="sWD2" value="2" type="checkbox" '+((this.working_dates[2])?"checked":"")+'/>Tu<input name="sWD3" id="sWD3" value="3" type="checkbox" '+((this.working_dates[3])?"checked":"")+'/>We<input name="sWD4" id="sWD4" value="4" type="checkbox" '+((this.working_dates[4])?"checked":"")+'/>Th<input name="sWD5" id="sWD5" value="5" type="checkbox" '+((this.working_dates[5])?"checked":"")+'/>Fr<input name="sWD6" id="sWD6" value="6" type="checkbox" '+((this.working_dates[6])?"checked":"")+'/>Sa</div>'+
|
135 |
|
140 |
|
141 |
'<label>Time Format</label><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>'+
|
142 |
|
143 |
+
'<label>Default Time HH:mm</label><input type="text" class="large" name="sDefaultTime" id="sDefaultTime" value="'+cff_esc_attr(this.defaultTime)+'" />'+
|
144 |
+
'<div class="width50 column"><label>Min Hour</label><input type="text" class="large" name="sMinHour" id="sMinHour" value="'+cff_esc_attr(this.minHour)+'" /></div>'+
|
145 |
+
'<div class="width50 columnr"><label>Min Minutes</label><input type="text" class="large" name="sMinMinute" id="sMinMinute" value="'+cff_esc_attr(this.minMinute)+'" /></div>'+
|
146 |
+
'<div class="width50 column"><label>Max Hour</label><input type="text" class="large" name="sMaxHour" id="sMaxHour" value="'+cff_esc_attr(this.maxHour)+'" /></div>'+
|
147 |
+
'<div class="width50 columnr"><label>Max Minutes</label><input type="text" class="large" name="sMaxMinute" id="sMaxMinute" value="'+cff_esc_attr(this.maxMinute)+'" /></div>'+
|
148 |
+
|
149 |
+
'<label>Steps for hours</label><input type="text" class="large" name="sStepHour" id="sStepHour" value="'+cff_esc_attr(this.stepHour)+'" />'+
|
150 |
+
'<label>Steps for minutes</label><input type="text" class="large" name="sStepMinute" id="sStepMinute" value="'+cff_esc_attr(this.stepMinute)+'" />'+
|
151 |
+
'<label>Label for hours in screen readers</label><input type="text" class="large" name="sAriaHourLabel" id="sAriaHourLabel" value="'+cff_esc_attr(this.ariaHourLabel)+'" />'+
|
152 |
+
'<label>Label for minutes in screen readers</label><input type="text" class="large" name="sAriaMinuteLabel" id="sAriaMinuteLabel" value="'+cff_esc_attr(this.ariaMinuteLabel)+'" />'+
|
153 |
+
'<label>Label for am/pm component in screen readers</label><input type="text" class="large" name="sAriaAMPMLabel" id="sAriaAMPMLabel" value="'+cff_esc_attr(this.ariaAMPMLabel)+'" />'+
|
154 |
'</div>'+
|
155 |
'<hr></hr>';
|
156 |
}
|
js/fields-admin/05_fbuilder.ftextarea.js
CHANGED
@@ -24,20 +24,20 @@
|
|
24 |
rows:4,
|
25 |
display:function()
|
26 |
{
|
27 |
-
return
|
28 |
},
|
29 |
editItemEvents:function()
|
30 |
{
|
31 |
var evt = [
|
32 |
-
{s:"#sSize",e:"change", l:"size"},
|
33 |
-
{s:"#sMinlength",e:"change keyup", l:"minlength"},
|
34 |
-
{s:"#sMaxlength",e:"change keyup", l:"maxlength"},
|
35 |
-
{s:"#sRows",e:"change keyup", l:"rows"}
|
36 |
];
|
37 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
38 |
},
|
39 |
showSpecialDataInstance: function()
|
40 |
{
|
41 |
-
return '<div class="column width50"><label>Min length/characters</label><input type="text" name="sMinlength" id="sMinlength" value="'
|
42 |
}
|
43 |
});
|
24 |
rows:4,
|
25 |
display:function()
|
26 |
{
|
27 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><textarea '+((!/^\s*$/.test(this.rows)) ? 'rows='+cff_esc_attr(this.rows) : '' )+' class="field disabled '+this.size+'">'+cff_esc_attr(this.predefined)+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
28 |
},
|
29 |
editItemEvents:function()
|
30 |
{
|
31 |
var evt = [
|
32 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
33 |
+
{s:"#sMinlength",e:"change keyup", l:"minlength", x:1},
|
34 |
+
{s:"#sMaxlength",e:"change keyup", l:"maxlength", x:1},
|
35 |
+
{s:"#sRows",e:"change keyup", l:"rows", x:1}
|
36 |
];
|
37 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this, evt);
|
38 |
},
|
39 |
showSpecialDataInstance: function()
|
40 |
{
|
41 |
+
return '<div class="column width50"><label>Min length/characters</label><input type="text" name="sMinlength" id="sMinlength" value="'+cff_esc_attr(this.minlength)+'" class="large"></div><div class="column width50"><label>Max length/characters</label><input type="text" name="sMaxlength" id="sMaxlength" value="'+cff_esc_attr(this.maxlength)+'" class="large"></div><div class="clearer" /><label>Number of rows</label><input type="text" name="sRows" id="sRows" value="'+cff_esc_attr(this.rows)+'" />';
|
42 |
}
|
43 |
});
|
js/fields-admin/06_fbuilder.fcheck.js
CHANGED
@@ -35,9 +35,9 @@
|
|
35 |
var str = "";
|
36 |
for (var i=0;i<this.choices.length;i++)
|
37 |
{
|
38 |
-
str += '<div class="'+this.layout+'"><input class="field" disabled="true" type="checkbox" '+((this.choiceSelected[i])?"checked":"")+'/> '
|
39 |
}
|
40 |
-
return
|
41 |
},
|
42 |
editItemEvents:function()
|
43 |
{
|
@@ -200,7 +200,7 @@
|
|
200 |
{
|
201 |
if (items[i].name != me.name && items[i].ftype != 'fPageBreak' && items[i].ftype != 'frecordsetds')
|
202 |
{
|
203 |
-
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+(
|
204 |
}
|
205 |
}
|
206 |
$(this).html(str);
|
@@ -220,7 +220,7 @@
|
|
220 |
maxChoices: function()
|
221 |
{
|
222 |
return '<label style="margin-bottom:10px;"><input type="number" name="sMax" value="'+(($.isNumeric(this.max) && 0<=this.max) ? this.max : '')+'" style="max-width:60px;" min="1" /> Maximum number of choices to be ticked.</label>'+
|
223 |
-
'<input type="text" name="sMaxError" class="large" value="'
|
224 |
},
|
225 |
showChoiceIntance: function()
|
226 |
{
|
@@ -241,7 +241,7 @@
|
|
241 |
for (var i=0;i<l.length;i++)
|
242 |
{
|
243 |
str1 = '';
|
244 |
-
str += '<div class="choicesEdit"><input class="choice_check" i="'+i+'" type="checkbox" '+((this.choiceSelected[i])?"checked":"")+'/><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'
|
245 |
j = d[i].length;
|
246 |
if(j)
|
247 |
{
|
35 |
var str = "";
|
36 |
for (var i=0;i<this.choices.length;i++)
|
37 |
{
|
38 |
+
str += '<div class="'+this.layout+'"><input class="field" disabled="true" type="checkbox" '+((this.choiceSelected[i])?"checked":"")+'/> '+cff_html_decode(this.choices[i])+'</div>';
|
39 |
}
|
40 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
41 |
},
|
42 |
editItemEvents:function()
|
43 |
{
|
200 |
{
|
201 |
if (items[i].name != me.name && items[i].ftype != 'fPageBreak' && items[i].ftype != 'frecordsetds')
|
202 |
{
|
203 |
+
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+((typeof items[ i ].title != 'undefined') ? ' (' + cff_esc_attr(items[i].title) + ')' : '') +'</option>';
|
204 |
}
|
205 |
}
|
206 |
$(this).html(str);
|
220 |
maxChoices: function()
|
221 |
{
|
222 |
return '<label style="margin-bottom:10px;"><input type="number" name="sMax" value="'+(($.isNumeric(this.max) && 0<=this.max) ? this.max : '')+'" style="max-width:60px;" min="1" /> Maximum number of choices to be ticked.</label>'+
|
223 |
+
'<input type="text" name="sMaxError" class="large" value="'+cff_esc_attr(cff_html_decode(this.maxError))+'" placeholder="Max choices error messages" />';
|
224 |
},
|
225 |
showChoiceIntance: function()
|
226 |
{
|
241 |
for (var i=0;i<l.length;i++)
|
242 |
{
|
243 |
str1 = '';
|
244 |
+
str += '<div class="choicesEdit"><input class="choice_check" i="'+i+'" type="checkbox" '+((this.choiceSelected[i])?"checked":"")+'/><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'+cff_esc_attr(cff_html_decode(l[i]))+'"/><input class="choice_value" i="'+i+'" type="text" name="sChoice'+this.name+'V'+i+'" id="sChoice'+this.name+'V'+i+'" value="'+cff_esc_attr(cff_html_decode(lv[i]))+'"/><div class="choice-ctrls"><a class="choice_down ui-icon ui-icon-arrowthick-1-s" i="'+i+'" n="'+(l.length-1)+'" title="Down"></a><a class="choice_up ui-icon ui-icon-arrowthick-1-n" i="'+i+'" title="Up"></a><a class="choice_add ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another choice."></a><a class="choice_remove ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this choice."></a></div></div>';
|
245 |
j = d[i].length;
|
246 |
if(j)
|
247 |
{
|
js/fields-admin/07_fbuilder.fradio.js
CHANGED
@@ -33,9 +33,9 @@
|
|
33 |
var str = "";
|
34 |
for (var i=0;i<this.choices.length;i++)
|
35 |
{
|
36 |
-
str += '<div class="'+this.layout+'"><input class="field" disabled="true" type="radio" i="'+i+'" '+(( this.choices[i]+' - '+this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> '
|
37 |
}
|
38 |
-
return
|
39 |
},
|
40 |
editItemEvents:function()
|
41 |
{
|
@@ -183,7 +183,7 @@
|
|
183 |
{
|
184 |
if (items[i].name != me.name && items[i].ftype != 'fPageBreak' && items[i].ftype != 'frecordsetds')
|
185 |
{
|
186 |
-
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+ ( ( typeof items[i].title != 'undefined' ) ? ' (' +
|
187 |
}
|
188 |
}
|
189 |
$(this).html(str);
|
@@ -217,7 +217,7 @@
|
|
217 |
for (var i=0;i<l.length;i++)
|
218 |
{
|
219 |
str1 = '';
|
220 |
-
str += '<div class="choicesEdit"><input class="choice_radio" i="'+i+'" type="radio" '+((this.choiceSelected==l[i]+' - '+lv[i])?"checked":"")+' name="choice_radio" /><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'
|
221 |
j = d[i].length;
|
222 |
if(j)
|
223 |
{
|
33 |
var str = "";
|
34 |
for (var i=0;i<this.choices.length;i++)
|
35 |
{
|
36 |
+
str += '<div class="'+this.layout+'"><input class="field" disabled="true" type="radio" i="'+i+'" '+(( this.choices[i]+' - '+this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> '+cff_html_decode(this.choices[i])+'</div>';
|
37 |
}
|
38 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
39 |
},
|
40 |
editItemEvents:function()
|
41 |
{
|
183 |
{
|
184 |
if (items[i].name != me.name && items[i].ftype != 'fPageBreak' && items[i].ftype != 'frecordsetds')
|
185 |
{
|
186 |
+
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+ ( ( typeof items[i].title != 'undefined' ) ? ' (' + cff_esc_attr(items[i].title) + ')' : '' ) + ' </option>';
|
187 |
}
|
188 |
}
|
189 |
$(this).html(str);
|
217 |
for (var i=0;i<l.length;i++)
|
218 |
{
|
219 |
str1 = '';
|
220 |
+
str += '<div class="choicesEdit"><input class="choice_radio" i="'+i+'" type="radio" '+((this.choiceSelected==l[i]+' - '+lv[i])?"checked":"")+' name="choice_radio" /><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'+cff_esc_attr(cff_html_decode(l[i]))+'"/><input class="choice_value" i="'+i+'" type="text" name="sChoice'+this.name+'V'+i+'" id="sChoice'+this.name+'V'+i+'" value="'+cff_esc_attr(cff_html_decode(lv[i]))+'"/><div class="choice-ctrls"><a class="choice_down ui-icon ui-icon-arrowthick-1-s" i="'+i+'" n="'+(l.length-1)+'" title="Down"></a><a class="choice_up ui-icon ui-icon-arrowthick-1-n" i="'+i+'" title="Up"></a><a class="choice_add ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another choice."></a><a class="choice_remove ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this choice."></a></div></div>';
|
221 |
j = d[i].length;
|
222 |
if(j)
|
223 |
{
|
js/fields-admin/08_fbuilder.fdropdown.js
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
display:function()
|
33 |
{
|
34 |
this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
|
35 |
-
return
|
36 |
},
|
37 |
editItemEvents:function()
|
38 |
{
|
@@ -196,7 +196,7 @@
|
|
196 |
{
|
197 |
if (items[i].name != me.name && items[i].ftype != 'fPageBreak' && items[i].ftype != 'frecordsetds')
|
198 |
{
|
199 |
-
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+( ( typeof items[ i ].title != 'undefined' ) ? ' (' +
|
200 |
}
|
201 |
}
|
202 |
$(this).html(str);
|
@@ -238,7 +238,7 @@
|
|
238 |
str1 = '';
|
239 |
if(typeof og[i] == 'undefined') og[i] = false;
|
240 |
|
241 |
-
str += '<div class="choicesEdit"><input class="choice_select" i="'+i+'" type="radio" '+((this.choiceSelected==l[i]+' - '+lv[i])?"checked":"")+' name="choice_select" /><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'
|
242 |
|
243 |
j = d[i].length;
|
244 |
if(j)
|
32 |
display:function()
|
33 |
{
|
34 |
this.choicesVal = ((typeof(this.choicesVal) != "undefined" && this.choicesVal !== null)?this.choicesVal:this.choices.slice(0));
|
35 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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>'+cff_esc_attr(this.choiceSelected)+'</option></select><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
36 |
},
|
37 |
editItemEvents:function()
|
38 |
{
|
196 |
{
|
197 |
if (items[i].name != me.name && items[i].ftype != 'fPageBreak' && items[i].ftype != 'frecordsetds')
|
198 |
{
|
199 |
+
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+(items[i].name)+( ( typeof items[ i ].title != 'undefined' ) ? ' (' + cff_esc_attr(items[ i ].title) + ')' : '' )+'</option>';
|
200 |
}
|
201 |
}
|
202 |
$(this).html(str);
|
238 |
str1 = '';
|
239 |
if(typeof og[i] == 'undefined') og[i] = false;
|
240 |
|
241 |
+
str += '<div class="choicesEdit"><input class="choice_select" i="'+i+'" type="radio" '+((this.choiceSelected==l[i]+' - '+lv[i])?"checked":"")+' name="choice_select" /><input class="choice_text" i="'+i+'" type="text" name="sChoice'+this.name+'" id="sChoice'+this.name+'" value="'+cff_esc_attr(l[i])+'"/><input class="choice_value" i="'+i+'" type="text" name="sChoice'+this.name+'V'+i+'" id="sChoice'+this.name+'V'+i+'" value="'+cff_esc_attr(lv[i])+'"/><input type="checkbox" name="optgroup" i="'+i+'" '+((og[i]) ? ' CHECKED ' : '' )+' class="choice_optgroup" /><div class="choice-ctrls"><a class="choice_down ui-icon ui-icon-arrowthick-1-s" i="'+i+'" n="'+(l.length-1)+'" title="Down"></a><a class="choice_up ui-icon ui-icon-arrowthick-1-n" i="'+i+'" title="Up"></a><a class="choice_add ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another choice."></a><a class="choice_remove ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this choice."></a></div></div>';
|
242 |
|
243 |
j = d[i].length;
|
244 |
if(j)
|
js/fields-admin/09_fbuilder.ffile.js
CHANGED
@@ -23,23 +23,23 @@
|
|
23 |
thumb_height: '',
|
24 |
display:function()
|
25 |
{
|
26 |
-
return
|
27 |
},
|
28 |
editItemEvents:function()
|
29 |
{
|
30 |
var evt = [
|
31 |
-
{s:"#sSize",e:"change", l:"size"},
|
32 |
-
{s:"#sAccept",e:"change keyup", l:"accept"},
|
33 |
-
{s:"#sUpload_size",e:"change keyup", l:"upload_size"},
|
34 |
-
{s:"#sThumbWidth",e:"change keyup", l:"thumb_width"},
|
35 |
-
{s:"#sThumbHeight",e:"change keyup", l:"thumb_height"},
|
36 |
-
{s:"#sMultiple",e:"click", l:"multiple",f:function(el){return el.is(":checked");}},
|
37 |
-
{s:"#sPreview",e:"click", l:"preview",f:function(el){return el.is(":checked");}}
|
38 |
];
|
39 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this,evt);
|
40 |
},
|
41 |
showSpecialDataInstance: function()
|
42 |
{
|
43 |
-
return '<label>Accept these file extensions [<a class="helpfbuilder" text="Extensions comma separated and without the dot.\n\nExample: jpg,png,gif,pdf">help?</a>]</label><input type="text" name="sAccept" id="sAccept" value="'
|
44 |
}
|
45 |
});
|
23 |
thumb_height: '',
|
24 |
display:function()
|
25 |
{
|
26 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input type="file" disabled class="field '+this.size+'" /><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
27 |
},
|
28 |
editItemEvents:function()
|
29 |
{
|
30 |
var evt = [
|
31 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
32 |
+
{s:"#sAccept",e:"change keyup", l:"accept", x:1},
|
33 |
+
{s:"#sUpload_size",e:"change keyup", l:"upload_size", x:1},
|
34 |
+
{s:"#sThumbWidth",e:"change keyup", l:"thumb_width", x:1},
|
35 |
+
{s:"#sThumbHeight",e:"change keyup", l:"thumb_height", x:1},
|
36 |
+
{s:"#sMultiple",e:"click", l:"multiple",f:function(el){return el.is(":checked");}, x:1},
|
37 |
+
{s:"#sPreview",e:"click", l:"preview",f:function(el){return el.is(":checked");}, x:1}
|
38 |
];
|
39 |
$.fbuilder.controls[ 'ffields' ].prototype.editItemEvents.call(this,evt);
|
40 |
},
|
41 |
showSpecialDataInstance: function()
|
42 |
{
|
43 |
+
return '<label>Accept these file extensions [<a class="helpfbuilder" text="Extensions comma separated and without the dot.\n\nExample: jpg,png,gif,pdf">help?</a>]</label><input type="text" name="sAccept" id="sAccept" value="'+cff_esc_attr(this.accept)+'" class="large"><label>Maximum upload size in kB [<a class="helpfbuilder" text="1024 kB = 1 MB.\n\nThe support for this HTML5 feature may be partially available or not available in some browsers.">help?</a>]</label><input type="text" name="sUpload_size" id="sUpload_size" value="'+cff_esc_attr(this.upload_size)+'" class="large"><label><input type="checkbox" id="sMultiple" name="sMultiple" '+((typeof this.multiple != 'undefined' && this.multiple) ? 'CHECKED' : '')+' /> Upload multiple files</label><hr /><label><input type="checkbox" id="sPreview" name="sPreview" '+((typeof this.preview != 'undefined' && this.preview) ? 'CHECKED' : '')+' /> Show preview of images</label><label>Thumbnail width</label><input type="text" id="sThumbWidth" name="sThumbWidth" value="'+cff_esc_attr(this.thumb_width)+'" class="large" /><label>Thumbnail height</label><input type="text" id="sThumbHeight" name="sThumbHeight" value="'+cff_esc_attr(this.thumb_height)+'" class="large" /><hr />';
|
44 |
}
|
45 |
});
|
js/fields-admin/10_fbuilder.fpassword.js
CHANGED
@@ -24,17 +24,17 @@
|
|
24 |
regExpMssg:"",
|
25 |
display:function()
|
26 |
{
|
27 |
-
return
|
28 |
},
|
29 |
editItemEvents:function()
|
30 |
{
|
31 |
var evt = [
|
32 |
-
{s:"#sSize",e:"change", l:"size"},
|
33 |
-
{s:"#sMinlength",e:"change keyup", l:"minlength"},
|
34 |
-
{s:"#sMaxlength",e:"change keyup", l:"maxlength"},
|
35 |
{s:"#sRegExp",e:"change keyup", l:"regExp"},
|
36 |
{s:"#sRegExpMssg",e:"change keyup", l:"regExpMssg"},
|
37 |
-
{s:"#sEqualTo",e:"change", l:"equalTo"}
|
38 |
],
|
39 |
items = this.fBuild.getItems();
|
40 |
$('.equalTo').each(function()
|
@@ -47,7 +47,7 @@
|
|
47 |
items[i].name != $(this).attr("dname")
|
48 |
)
|
49 |
{
|
50 |
-
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'
|
51 |
}
|
52 |
}
|
53 |
$(this).html(str);
|
@@ -56,6 +56,6 @@
|
|
56 |
},
|
57 |
showSpecialDataInstance: function()
|
58 |
{
|
59 |
-
return '<div class="column width50"><label>Min length/characters</label><input type="text" name="sMinlength" id="sMinlength" value="'
|
60 |
}
|
61 |
});
|
24 |
regExpMssg:"",
|
25 |
display:function()
|
26 |
{
|
27 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="password" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
28 |
},
|
29 |
editItemEvents:function()
|
30 |
{
|
31 |
var evt = [
|
32 |
+
{s:"#sSize",e:"change", l:"size", x:1},
|
33 |
+
{s:"#sMinlength",e:"change keyup", l:"minlength", x:1},
|
34 |
+
{s:"#sMaxlength",e:"change keyup", l:"maxlength", x:1},
|
35 |
{s:"#sRegExp",e:"change keyup", l:"regExp"},
|
36 |
{s:"#sRegExpMssg",e:"change keyup", l:"regExpMssg"},
|
37 |
+
{s:"#sEqualTo",e:"change", l:"equalTo", x:1}
|
38 |
],
|
39 |
items = this.fBuild.getItems();
|
40 |
$('.equalTo').each(function()
|
47 |
items[i].name != $(this).attr("dname")
|
48 |
)
|
49 |
{
|
50 |
+
str += '<option value="'+items[i].name+'" '+((items[i].name == $(this).attr("dvalue"))?"selected":"")+'>'+cff_esc_attr(items[i].title)+'</option>';
|
51 |
}
|
52 |
}
|
53 |
$(this).html(str);
|
56 |
},
|
57 |
showSpecialDataInstance: function()
|
58 |
{
|
59 |
+
return '<div class="column width50"><label>Min length/characters</label><input type="text" name="sMinlength" id="sMinlength" value="'+cff_esc_attr(this.minlength)+'" class="large"></div><div class="column width50"><label>Max length/characters</label><input type="text" name="sMaxlength" id="sMaxlength" value="'+cff_esc_attr(this.maxlength)+'" class="large"></div><div class="clearer"></div><label style="padding-bottom:5px;">Validate against a regular expression <input type="button" onclick="window.open(\'https://cff-bundles.dwbooster.com/product/regexp\');" value="+" title="Resources" /></label><input type="text" name="sRegExp" id="sRegExp" value="'+cff_esc_attr(this.regExp)+'" class="large" /><label>Error message when the regular expression fails</label><input type="text" name="sRegExpMssg" id="sRegExpMssg" value="'+cff_esc_attr(this.regExpMssg)+'" class="large" />';
|
60 |
}
|
61 |
});
|
js/fields-admin/11_fbuilder.fphone.js
CHANGED
@@ -35,9 +35,9 @@
|
|
35 |
for (var i=0;i<tmp.length;i++)
|
36 |
{
|
37 |
if ($.trim(tmp[i])!="")
|
38 |
-
str += '<div class="uh_phone" ><input type="text" class="field disabled" style="width:'+(15*$.trim(tmp[i]).length)+'px" value="'+((tmpv[i])?tmpv[i]:"")+'" maxlength="'+$.trim(tmp[i]).length+'" /><div class="l">'+$.trim(tmp[i])+'</div></div>';
|
39 |
}
|
40 |
-
return
|
41 |
},
|
42 |
editItemEvents:function()
|
43 |
{
|
@@ -66,13 +66,13 @@
|
|
66 |
|
67 |
'<label>Countries</label>'+
|
68 |
'<select name="sCountries" id="sCountries" class="large" multiple size="10">';
|
69 |
-
for(var i in db) output += '<option value="'+i+'" '+(!this.countries.length || this.countries.indexOf(i) != -1 ? 'SELECTED' : '')+'>'+i+'</option>';
|
70 |
output += '</select><br><br>'+
|
71 |
'<input type="button" class="button-secondary large" value="Select all" id="sSelectAll" /><br>'+
|
72 |
|
73 |
'<label>Select country by default</label>'+
|
74 |
'<select name="sDefaultCountry" id="sDefaultCountry" class="large">';
|
75 |
-
for(var i in db) output += '<option value="'+i+'" '+(this.defaultCountry == i ? 'SELECTED' : '')+'>'+i+'</option>';
|
76 |
output += '</select><hr />';
|
77 |
|
78 |
return output;
|
35 |
for (var i=0;i<tmp.length;i++)
|
36 |
{
|
37 |
if ($.trim(tmp[i])!="")
|
38 |
+
str += '<div class="uh_phone" ><input type="text" class="field disabled" style="width:'+(15*$.trim(tmp[i]).length)+'px" value="'+cff_esc_attr((tmpv[i])?tmpv[i]:"")+'" maxlength="'+$.trim(tmp[i]).length+'" /><div class="l">'+$.trim(tmp[i])+'</div></div>';
|
39 |
}
|
40 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
41 |
},
|
42 |
editItemEvents:function()
|
43 |
{
|
66 |
|
67 |
'<label>Countries</label>'+
|
68 |
'<select name="sCountries" id="sCountries" class="large" multiple size="10">';
|
69 |
+
for(var i in db) output += '<option value="'+cff_esc_attr(i)+'" '+(!this.countries.length || this.countries.indexOf(i) != -1 ? 'SELECTED' : '')+'>'+cff_esc_attr(i)+'</option>';
|
70 |
output += '</select><br><br>'+
|
71 |
'<input type="button" class="button-secondary large" value="Select all" id="sSelectAll" /><br>'+
|
72 |
|
73 |
'<label>Select country by default</label>'+
|
74 |
'<select name="sDefaultCountry" id="sDefaultCountry" class="large">';
|
75 |
+
for(var i in db) output += '<option value="'+cff_esc_attr(i)+'" '+(this.defaultCountry == i ? 'SELECTED' : '')+'>'+cff_esc_attr(i)+'</option>';
|
76 |
output += '</select><hr />';
|
77 |
|
78 |
return output;
|
js/fields-admin/12_fbuilder.fcommentarea.js
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
userhelp:"A description of the section goes here.",
|
16 |
display:function()
|
17 |
{
|
18 |
-
return
|
19 |
},
|
20 |
editItemEvents:function()
|
21 |
{
|
15 |
userhelp:"A description of the section goes here.",
|
16 |
display:function()
|
17 |
{
|
18 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer" /></div>';
|
19 |
},
|
20 |
editItemEvents:function()
|
21 |
{
|
js/fields-admin/13_fbuilder.fhidden.js
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
predefined:"",
|
17 |
display:function()
|
18 |
{
|
19 |
-
return
|
20 |
},
|
21 |
editItemEvents:function()
|
22 |
{
|
@@ -24,11 +24,11 @@
|
|
24 |
},
|
25 |
showTitle: function(f)
|
26 |
{
|
27 |
-
return '<div><label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+this.title+'</textarea><span class="uh">The field label is only for the admin section, never for the public page</span></div>';
|
28 |
},
|
29 |
showUserhelp:function(){ return ''; },
|
30 |
showPredefined: function()
|
31 |
{
|
32 |
-
return '<div><label>Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+this.predefined+'</textarea></div>';
|
33 |
}
|
34 |
});
|
16 |
predefined:"",
|
17 |
display:function()
|
18 |
{
|
19 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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+'</label><span class="uh">'+this.predefined+'</span><div class="clearer" /></div>';
|
20 |
},
|
21 |
editItemEvents:function()
|
22 |
{
|
24 |
},
|
25 |
showTitle: function(f)
|
26 |
{
|
27 |
+
return '<div><label>Field Label</label><textarea class="large" name="sTitle" id="sTitle">'+cff_esc_attr(this.title)+'</textarea><span class="uh">The field label is only for the admin section, never for the public page</span></div>';
|
28 |
},
|
29 |
showUserhelp:function(){ return ''; },
|
30 |
showPredefined: function()
|
31 |
{
|
32 |
+
return '<div><label>Value</label><textarea class="large" name="sPredefined" id="sPredefined">'+cff_esc_attr(this.predefined)+'</textarea></div>';
|
33 |
}
|
34 |
});
|
js/fields-admin/14_fbuilder.fsectionbreak.js
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
userhelp:"A description of the section goes here.",
|
16 |
display:function()
|
17 |
{
|
18 |
-
return
|
19 |
},
|
20 |
editItemEvents:function()
|
21 |
{
|
15 |
userhelp:"A description of the section goes here.",
|
16 |
display:function()
|
17 |
{
|
18 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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><div class="section_break"></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer" /></div>';
|
19 |
},
|
20 |
editItemEvents:function()
|
21 |
{
|
js/fields-admin/15_fbuilder.fpagebreak.js
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
ftype:"fPageBreak",
|
15 |
display:function()
|
16 |
{
|
17 |
-
return
|
18 |
},
|
19 |
editItemEvents:function()
|
20 |
{
|
14 |
ftype:"fPageBreak",
|
15 |
display:function()
|
16 |
{
|
17 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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><div class="section_break"></div><label>'+this.title+'</label><span class="uh">'+this.userhelp+'</span><div class="clearer" /></div>';
|
18 |
},
|
19 |
editItemEvents:function()
|
20 |
{
|
js/fields-admin/16_fbuilder.fsummary.js
CHANGED
@@ -18,15 +18,15 @@
|
|
18 |
valueClassname:"summary-field-value",
|
19 |
display:function()
|
20 |
{
|
21 |
-
return
|
22 |
},
|
23 |
editItemEvents:function()
|
24 |
{
|
25 |
var evt = [
|
26 |
-
{s:"#sFields",e:"change keyup", l:"fields"},
|
27 |
-
{s:"#sExcludeEmpty",e:"click", l:"exclude_empty", f:function(el){return el.is(':checked');}},
|
28 |
-
{s:"#sTitleClassname",e:"change keyup", l:"titleClassname"},
|
29 |
-
{s:"#sValueClassname",e:"change keyup", l:"valueClassname"},
|
30 |
{s:"#sPlusBtn",e:"click", l:"fields",f:function(){
|
31 |
var v = $( "#sSelectedField" ).val(),
|
32 |
e = $( "#sFields" ),
|
@@ -48,17 +48,17 @@
|
|
48 |
var str = '',
|
49 |
items = this.fBuild.getItems();
|
50 |
|
51 |
-
str += '<label>Fields to display on summary</label><input type="text" name="sFields" id="sFields" class="large" value="'
|
52 |
'<label>Select field and press the plus button</label><select name="sSelectedField" id="sSelectedField" class="large">';
|
53 |
|
54 |
for(var i=0; i<items.length; i++)
|
55 |
{
|
56 |
-
str += '<option value="'+items[i].name+'">'+( ( typeof items[i].title != 'undefined' ) ?
|
57 |
}
|
58 |
str += '</select><div style="margin-top:10px;"><input type="button" value="+" name="sPlusBtn" id="sPlusBtn" style="padding:3px 10px;" /></div>'+
|
59 |
'<label>Exclude empty fields: <input type="checkbox" id="sExcludeEmpty" name="sExcludeEmpty" '+((this.exclude_empty) ? 'CHECKED' : '')+'/></label>'+
|
60 |
-
'<label>Classname for fields titles</label><input type="text" class="large" name="sTitleClassname" id="sTitleClassname" value="'
|
61 |
-
'<label>Classname for fields values</label><input type="text" class="large" name="sValueClassname" id="sValueClassname" value="'
|
62 |
|
63 |
return str;
|
64 |
}
|
18 |
valueClassname:"summary-field-value",
|
19 |
display:function()
|
20 |
{
|
21 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><span class="field">'+this.fields+'</span></div><div class="clearer" /></div>';
|
22 |
},
|
23 |
editItemEvents:function()
|
24 |
{
|
25 |
var evt = [
|
26 |
+
{s:"#sFields",e:"change keyup", l:"fields", x:1},
|
27 |
+
{s:"#sExcludeEmpty",e:"click", l:"exclude_empty", f:function(el){return el.is(':checked');}, x:1},
|
28 |
+
{s:"#sTitleClassname",e:"change keyup", l:"titleClassname", x:1},
|
29 |
+
{s:"#sValueClassname",e:"change keyup", l:"valueClassname", x:1},
|
30 |
{s:"#sPlusBtn",e:"click", l:"fields",f:function(){
|
31 |
var v = $( "#sSelectedField" ).val(),
|
32 |
e = $( "#sFields" ),
|
48 |
var str = '',
|
49 |
items = this.fBuild.getItems();
|
50 |
|
51 |
+
str += '<label>Fields to display on summary</label><input type="text" name="sFields" id="sFields" class="large" value="'+cff_esc_attr(this.fields)+'">'+
|
52 |
'<label>Select field and press the plus button</label><select name="sSelectedField" id="sSelectedField" class="large">';
|
53 |
|
54 |
for(var i=0; i<items.length; i++)
|
55 |
{
|
56 |
+
str += '<option value="'+items[i].name+'">'+( ( typeof items[i].title != 'undefined' ) ? cff_esc_attr(items[i].title) : '' )+'('+items[i].name+')'+'</option>';
|
57 |
}
|
58 |
str += '</select><div style="margin-top:10px;"><input type="button" value="+" name="sPlusBtn" id="sPlusBtn" style="padding:3px 10px;" /></div>'+
|
59 |
'<label>Exclude empty fields: <input type="checkbox" id="sExcludeEmpty" name="sExcludeEmpty" '+((this.exclude_empty) ? 'CHECKED' : '')+'/></label>'+
|
60 |
+
'<label>Classname for fields titles</label><input type="text" class="large" name="sTitleClassname" id="sTitleClassname" value="'+cff_esc_attr(this.titleClassname)+'">'+
|
61 |
+
'<label>Classname for fields values</label><input type="text" class="large" name="sValueClassname" id="sValueClassname" value="'+cff_esc_attr(this.valueClassname)+'">';
|
62 |
|
63 |
return str;
|
64 |
}
|
js/fields-admin/29_fbuilder.ffieldset.fc.js
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
collapsed:false, // Admin
|
21 |
display:function()
|
22 |
{
|
23 |
-
return
|
24 |
},
|
25 |
editItemEvents:function()
|
26 |
{
|
20 |
collapsed:false, // Admin
|
21 |
display:function()
|
22 |
{
|
23 |
+
return '<div class="fields '+this.name+((this.collapsed) ? ' collapsed' : '')+' '+this.ftype+'" id="field'+this.form_identifier+'-'+this.index+'" title="'+this.name+'"><div class="arrow ui-icon ui-icon-play "></div><div title="Collapse" class="collapse ui-icon ui-icon-folder-collapsed "></div><div title="Uncollapse" class="uncollapse ui-icon ui-icon-folder-open "></div><div title="Delete" class="remove ui-icon ui-icon-trash "></div><div title="Duplicate" class="copy ui-icon ui-icon-copy "></div><div class="dfield"><FIELDSET class="fcontainer">'+( ( !/^\s*$/.test( this.title ) ) ? '<LEGEND>'+cff_esc_attr(this.title)+'</LEGEND>' : '' )+$.fbuilder.controls['fcontainer'].prototype.columnsSticker.call(this)+'<label class="collapsed-label">Collapsed ['+this.name+']</label><div class="fieldscontainer"></div></FIELDSET></div><div class="clearer" /></div>';
|
24 |
},
|
25 |
editItemEvents:function()
|
26 |
{
|
js/fields-admin/30_fbuilder.fdiv.fc.js
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
collapsed:false,
|
19 |
display:function()
|
20 |
{
|
21 |
-
return
|
22 |
},
|
23 |
showTitle:function(){ return ''; },
|
24 |
editItemEvents:function()
|
18 |
collapsed:false,
|
19 |
display:function()
|
20 |
{
|
21 |
+
return '<div class="fields '+this.name+((this.collapsed) ? ' collapsed' : '')+' '+this.ftype+'" id="field'+this.form_identifier+'-'+this.index+'" title="'+this.name+'"><div class="arrow ui-icon ui-icon-play "></div><div title="Collapse" class="collapse ui-icon ui-icon-folder-collapsed "></div><div title="Uncollapse" class="uncollapse ui-icon ui-icon-folder-open "></div><div title="Delete" class="remove ui-icon ui-icon-trash "></div><div title="Duplicate" class="copy ui-icon ui-icon-copy "></div><div class="dfield"><div class="fcontainer">'+$.fbuilder.controls['fcontainer'].prototype.columnsSticker.call(this)+'<label class="collapsed-label">Collapsed ['+this.name+']</label><div class="fieldscontainer"></div></div></div><div class="clearer" /></div>';
|
22 |
},
|
23 |
showTitle:function(){ return ''; },
|
24 |
editItemEvents:function()
|
js/fields-admin/31_fbuilder.fmedia.js
CHANGED
@@ -57,7 +57,7 @@
|
|
57 |
_display_image: function()
|
58 |
{
|
59 |
var d = this.data.image,
|
60 |
-
esc =
|
61 |
a = [],
|
62 |
l = [],
|
63 |
r = '';
|
@@ -66,25 +66,16 @@
|
|
66 |
if( $.trim( d.sHeight ) ) a.push( 'height="'+esc( d.sHeight )+'"' );
|
67 |
if( $.trim( d.sSrc ) ) a.push( 'src="'+esc( d.sSrc )+'"' );
|
68 |
if( $.trim( d.sAlt ) ) a.push( 'alt="'+esc( d.sAlt )+'"' );
|
69 |
-
|
70 |
-
{
|
71 |
-
l.push( 'href="'+esc( d.sLink )+'"' );
|
72 |
-
if( $.trim( d.sTarget ) ) l.push( 'target="'+esc( d.sTarget )+'"' );
|
73 |
-
r = '<a '+l.join( ' ' )+' ><img '+a.join( ' ' )+' /></a>';
|
74 |
-
}
|
75 |
-
else
|
76 |
-
{
|
77 |
-
r = '<img '+a.join( ' ' )+' />';
|
78 |
-
}
|
79 |
|
80 |
return r;
|
81 |
},
|
82 |
_display_audio_video: function( d, isV )
|
83 |
{
|
84 |
-
var esc =
|
85 |
a = [],
|
86 |
s = [],
|
87 |
-
t = ( isV
|
88 |
|
89 |
if( $.trim( d.sWidth ) ) s.push( 'width:'+esc( d.sWidth )+';' );
|
90 |
if( isV && $.trim( d.sHeight ) ) s.push( 'height:'+esc( d.sHeight )+';' );
|
@@ -109,7 +100,7 @@
|
|
109 |
},
|
110 |
display:function()
|
111 |
{
|
112 |
-
return
|
113 |
},
|
114 |
editItemEvents:function()
|
115 |
{
|
@@ -134,7 +125,7 @@
|
|
134 |
});
|
135 |
$("#sControls,#sLoop,#sAutoplay,#sMuted,#sHideDownload").bind("click", {obj: this}, function(e)
|
136 |
{
|
137 |
-
e.data.obj[ 'data' ][ e.data.obj[ 'sMediaType' ] ][ this.id ] = ( this.checked
|
138 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
139 |
});
|
140 |
$("#sWidth,#sHeight,#sSrc,#sSrcAlt,#sPoster,#sAlt,#sLink,#sTarget,#sFallback,#sFigcaption,#sPreload").bind("change keyup", {obj: this}, function(e)
|
@@ -147,7 +138,7 @@
|
|
147 |
},
|
148 |
showSpecialDataInstance: function()
|
149 |
{
|
150 |
-
return this._showMediaList()
|
151 |
},
|
152 |
_showMediaList: function()
|
153 |
{
|
@@ -156,8 +147,8 @@
|
|
156 |
|
157 |
for( var i = 0, h = l.length; i < h; i++ )
|
158 |
{
|
159 |
-
v = l[
|
160 |
-
r += '<label class="column width30"><input type="radio" name="sMediaType" value="'
|
161 |
}
|
162 |
return '<label>Select media type</label>'+r+'<div class="clearer" />';
|
163 |
},
|
@@ -189,11 +180,11 @@
|
|
189 |
_showSettingsBox: function()
|
190 |
{
|
191 |
var d = this.data[ this.sMediaType ];
|
192 |
-
return '<div class="groupBox">'
|
193 |
},
|
194 |
_showSettings_image: function( d )
|
195 |
{
|
196 |
-
var esc =
|
197 |
return '<label>Width</label><input type="text" class="large" name="sWidth" id="sWidth" value="'+esc(d.sWidth)+'">'+
|
198 |
'<label>Height</label><input type="text" class="large" name="sHeight" id="sHeight" value="'+esc(d.sHeight)+'">'+
|
199 |
'<label>Source</label><div><input type="text" style="width:70%;" name="sSrc" id="sSrc" value="'+esc(d.sSrc)+'"><input id="sMediaBtn" type="button" value="Browse" style="width:28%;" /></div>'+
|
@@ -204,7 +195,7 @@
|
|
204 |
},
|
205 |
_showSettings_audio_video: function( d, isV )
|
206 |
{
|
207 |
-
var esc =
|
208 |
r = '<label>Width</label><input type="text" class="large" name="sWidth" id="sWidth" value="'+esc(d.sWidth)+'">';
|
209 |
|
210 |
if( isV )
|
@@ -216,16 +207,16 @@
|
|
216 |
r += '<label>Poster</label><div><input type="text" style="width:70%;" name="sPoster" id="sPoster" value="'+esc(d.sPoster)+'"><input id="sPosterBtn" type="button" value="Browse" style="width:28%;" /></div>';
|
217 |
|
218 |
r += '<label>Alternative Source</label><div><input type="text" style="width:70%;" name="sSrcAlt" id="sSrcAlt" value="'+esc(d.sSrcAlt)+'"><input id="sMediaAltBtn" type="button" value="Browse" style="width:28%;" /></div>'+
|
219 |
-
'<label><input type="checkbox" name="sControls" id="sControls" value="1" '+(
|
220 |
-
'<label><input type="checkbox" name="sLoop" id="sLoop" value="1" '+(
|
221 |
-
'<label><input type="checkbox" name="sAutoplay" id="sAutoplay" value="1" '+(
|
222 |
-
'<label><input type="checkbox" name="sMuted" id="sMuted" value="1" '+(
|
223 |
-
'<label><input type="checkbox" name="sHideDownload" id="sHideDownload" value="1" '+(
|
224 |
var s = '',
|
225 |
l = [ 'none', 'auto', 'metadata' ];
|
226 |
for( var i = 0; i < 3; i++ )
|
227 |
{
|
228 |
-
s += '<option value="'
|
229 |
}
|
230 |
r += '<label>Preload</label><select class="large" name="sPreload" id="sPreload">'+s+'</select>'+
|
231 |
'<label>Fallback Text</label><input type="text" class="large" name="sFallback" id="sFallback" value="'+esc(d.sFallback)+'">'+
|
57 |
_display_image: function()
|
58 |
{
|
59 |
var d = this.data.image,
|
60 |
+
esc = cff_esc_attr,
|
61 |
a = [],
|
62 |
l = [],
|
63 |
r = '';
|
66 |
if( $.trim( d.sHeight ) ) a.push( 'height="'+esc( d.sHeight )+'"' );
|
67 |
if( $.trim( d.sSrc ) ) a.push( 'src="'+esc( d.sSrc )+'"' );
|
68 |
if( $.trim( d.sAlt ) ) a.push( 'alt="'+esc( d.sAlt )+'"' );
|
69 |
+
r = '<img '+a.join( ' ' )+' />';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
return r;
|
72 |
},
|
73 |
_display_audio_video: function( d, isV )
|
74 |
{
|
75 |
+
var esc = cff_esc_attr,
|
76 |
a = [],
|
77 |
s = [],
|
78 |
+
t = ( isV) ? 'video' : 'audio';
|
79 |
|
80 |
if( $.trim( d.sWidth ) ) s.push( 'width:'+esc( d.sWidth )+';' );
|
81 |
if( isV && $.trim( d.sHeight ) ) s.push( 'height:'+esc( d.sHeight )+';' );
|
100 |
},
|
101 |
display:function()
|
102 |
{
|
103 |
+
return '<div class="fields fmark '+this.name+' '+this.ftype+'" 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[ '_display_'+this.sMediaType ]()+'</label><span class="uh">'+this.data[ this.sMediaType ][ 'sFigcaption' ]+'</span><div class="clearer" /></div>';
|
104 |
},
|
105 |
editItemEvents:function()
|
106 |
{
|
125 |
});
|
126 |
$("#sControls,#sLoop,#sAutoplay,#sMuted,#sHideDownload").bind("click", {obj: this}, function(e)
|
127 |
{
|
128 |
+
e.data.obj[ 'data' ][ e.data.obj[ 'sMediaType' ] ][ this.id ] = ( this.checked) ? 1 : 0;
|
129 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
130 |
});
|
131 |
$("#sWidth,#sHeight,#sSrc,#sSrcAlt,#sPoster,#sAlt,#sLink,#sTarget,#sFallback,#sFigcaption,#sPreload").bind("change keyup", {obj: this}, function(e)
|
138 |
},
|
139 |
showSpecialDataInstance: function()
|
140 |
{
|
141 |
+
return this._showMediaList()+this._showSettingsBox();
|
142 |
},
|
143 |
_showMediaList: function()
|
144 |
{
|
147 |
|
148 |
for( var i = 0, h = l.length; i < h; i++ )
|
149 |
{
|
150 |
+
v = cff_esc_attr(l[i]);
|
151 |
+
r += '<label class="column width30"><input type="radio" name="sMediaType" value="'+v+'" '+((this.sMediaType == v) ? 'CHECKED' : '')+' >'+v+'</label>';
|
152 |
}
|
153 |
return '<label>Select media type</label>'+r+'<div class="clearer" />';
|
154 |
},
|
180 |
_showSettingsBox: function()
|
181 |
{
|
182 |
var d = this.data[ this.sMediaType ];
|
183 |
+
return '<div class="groupBox">'+this[ '_showSettings_'+this.sMediaType ]( d )+'</div>';
|
184 |
},
|
185 |
_showSettings_image: function( d )
|
186 |
{
|
187 |
+
var esc = cff_esc_attr;
|
188 |
return '<label>Width</label><input type="text" class="large" name="sWidth" id="sWidth" value="'+esc(d.sWidth)+'">'+
|
189 |
'<label>Height</label><input type="text" class="large" name="sHeight" id="sHeight" value="'+esc(d.sHeight)+'">'+
|
190 |
'<label>Source</label><div><input type="text" style="width:70%;" name="sSrc" id="sSrc" value="'+esc(d.sSrc)+'"><input id="sMediaBtn" type="button" value="Browse" style="width:28%;" /></div>'+
|
195 |
},
|
196 |
_showSettings_audio_video: function( d, isV )
|
197 |
{
|
198 |
+
var esc = cff_esc_attr,
|
199 |
r = '<label>Width</label><input type="text" class="large" name="sWidth" id="sWidth" value="'+esc(d.sWidth)+'">';
|
200 |
|
201 |
if( isV )
|
207 |
r += '<label>Poster</label><div><input type="text" style="width:70%;" name="sPoster" id="sPoster" value="'+esc(d.sPoster)+'"><input id="sPosterBtn" type="button" value="Browse" style="width:28%;" /></div>';
|
208 |
|
209 |
r += '<label>Alternative Source</label><div><input type="text" style="width:70%;" name="sSrcAlt" id="sSrcAlt" value="'+esc(d.sSrcAlt)+'"><input id="sMediaAltBtn" type="button" value="Browse" style="width:28%;" /></div>'+
|
210 |
+
'<label><input type="checkbox" name="sControls" id="sControls" value="1" '+((d.sControls) ? 'CHECKED' : '')+'> Controls</label>'+
|
211 |
+
'<label><input type="checkbox" name="sLoop" id="sLoop" value="1" '+((d.sLoop) ? 'CHECKED' : '')+'> Loop</label>'+
|
212 |
+
'<label><input type="checkbox" name="sAutoplay" id="sAutoplay" value="1" '+((d.sAutoplay) ? 'CHECKED' : '')+'> Autoplay</label>'+
|
213 |
+
'<label><input type="checkbox" name="sMuted" id="sMuted" value="1" '+((d.sMuted) ? 'CHECKED' : '')+'> Muted</label>'+
|
214 |
+
'<label><input type="checkbox" name="sHideDownload" id="sHideDownload" value="1" '+((d.sHideDownload) ? 'CHECKED' : '')+'> Hide the download file control</label>';
|
215 |
var s = '',
|
216 |
l = [ 'none', 'auto', 'metadata' ];
|
217 |
for( var i = 0; i < 3; i++ )
|
218 |
{
|
219 |
+
s += '<option value="'+esc(l[i])+'" '+((l[i] == d.sPreload) ? 'SELECTED' : '')+'>'+esc(l[i])+'</option>';
|
220 |
}
|
221 |
r += '<label>Preload</label><select class="large" name="sPreload" id="sPreload">'+s+'</select>'+
|
222 |
'<label>Fallback Text</label><input type="text" class="large" name="sFallback" id="sFallback" value="'+esc(d.sFallback)+'">'+
|
js/fields-admin/32_fbuilder.fbutton.js
CHANGED
@@ -5,10 +5,10 @@
|
|
5 |
control_category:1
|
6 |
}
|
7 |
);
|
8 |
-
$.fbuilder.controls[
|
9 |
$.extend(
|
10 |
-
$.fbuilder.controls[
|
11 |
-
$.fbuilder.controls[
|
12 |
{
|
13 |
ftype:"fButton",
|
14 |
sType:"button", // button, reset, calculate, print
|
@@ -20,7 +20,7 @@
|
|
20 |
userhelp:"A description of the section goes here.",
|
21 |
display:function()
|
22 |
{
|
23 |
-
return
|
24 |
},
|
25 |
editItemEvents:function()
|
26 |
{
|
@@ -46,34 +46,34 @@
|
|
46 |
}
|
47 |
}
|
48 |
];
|
49 |
-
$.fbuilder.controls[
|
50 |
},
|
51 |
showSpecialDataInstance: function()
|
52 |
{
|
53 |
-
return this._showTypeSettings()
|
54 |
},
|
55 |
_showTypeSettings: function()
|
56 |
{
|
57 |
-
var l = [
|
58 |
r = "", v;
|
59 |
-
for(
|
60 |
{
|
61 |
-
v = l[
|
62 |
-
r += '<label class="column width20"><input type="radio" name="sType" value="'
|
63 |
}
|
64 |
r += '<div class="clear"></div>';
|
65 |
-
r += '<div '+((this.sType != 'calculate') ? 'style="display:none;"' : '')+'><label><input type="checkbox" id="sLoading" '
|
66 |
-
r += '<div '+((this.sType != 'print') ? 'style="display:none;"' : '')+'><label><input type="checkbox" id="sMultipage" '
|
67 |
return '<label>Select button type</label>'+r+'<div class="clearer" />';
|
68 |
},
|
69 |
_showValueSettings: function()
|
70 |
{
|
71 |
-
return '<label>Value</label><input type="text" class="large" name="sValue" id="sValue" value="'
|
72 |
},
|
73 |
_showOnclickSettings: function()
|
74 |
{
|
75 |
-
return '<label>OnClick event</label><textarea class="large" name="sOnclick" id="sOnclick">'+this.sOnclick+'</textarea><div class="clearer"><i>To transform the button into a submit button, enter the onclick event: <b>jQuery(this.form).submit();</b></i></div>'+
|
76 |
-
'<label>OnMouseDown event</label><textarea class="large" name="sOnmousedown" id="sOnmousedown">'+this.sOnmousedown+'</textarea>';
|
77 |
},
|
78 |
showTitle: function(){ return ''; },
|
79 |
showShortLabel: function(){ return ''; }
|
5 |
control_category:1
|
6 |
}
|
7 |
);
|
8 |
+
$.fbuilder.controls['fButton']=function(){};
|
9 |
$.extend(
|
10 |
+
$.fbuilder.controls['fButton'].prototype,
|
11 |
+
$.fbuilder.controls['ffields'].prototype,
|
12 |
{
|
13 |
ftype:"fButton",
|
14 |
sType:"button", // button, reset, calculate, print
|
20 |
userhelp:"A description of the section goes here.",
|
21 |
display:function()
|
22 |
{
|
23 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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><input type="button" disabled value="'+cff_esc_attr(this.sValue)+'"><span class="uh">'+this.userhelp+'</span><div class="clearer" /></div>';
|
24 |
},
|
25 |
editItemEvents:function()
|
26 |
{
|
46 |
}
|
47 |
}
|
48 |
];
|
49 |
+
$.fbuilder.controls['ffields'].prototype.editItemEvents.call(this,evt);
|
50 |
},
|
51 |
showSpecialDataInstance: function()
|
52 |
{
|
53 |
+
return this._showTypeSettings()+this._showValueSettings()+this._showOnclickSettings();
|
54 |
},
|
55 |
_showTypeSettings: function()
|
56 |
{
|
57 |
+
var l = ['calculate', 'print', 'reset', 'button'],
|
58 |
r = "", v;
|
59 |
+
for(var i = 0, h = l.length; i < h; i++)
|
60 |
{
|
61 |
+
v = cff_esc_attr(l[i]);
|
62 |
+
r += '<label class="column width20"><input type="radio" name="sType" value="'+v+'" '+((this.sType == v) ? 'CHECKED' : '')+' >'+v+'</label>';
|
63 |
}
|
64 |
r += '<div class="clear"></div>';
|
65 |
+
r += '<div '+((this.sType != 'calculate') ? 'style="display:none;"' : '')+'><label><input type="checkbox" id="sLoading" '+((this.sLoading) ? 'CHECKED' : '')+' > display "calculation in progress" indicator</label></div>';
|
66 |
+
r += '<div '+((this.sType != 'print') ? 'style="display:none;"' : '')+'><label><input type="checkbox" id="sMultipage" '+((this.sMultipage) ? 'CHECKED' : '')+' > print all pages in multipage form</label></div>';
|
67 |
return '<label>Select button type</label>'+r+'<div class="clearer" />';
|
68 |
},
|
69 |
_showValueSettings: function()
|
70 |
{
|
71 |
+
return '<label>Value</label><input type="text" class="large" name="sValue" id="sValue" value="'+cff_esc_attr(this.sValue)+'" />';
|
72 |
},
|
73 |
_showOnclickSettings: function()
|
74 |
{
|
75 |
+
return '<label>OnClick event</label><textarea class="large" name="sOnclick" id="sOnclick">'+cff_esc_attr(this.sOnclick)+'</textarea><div class="clearer"><i>To transform the button into a submit button, enter the onclick event: <b>jQuery(this.form).submit();</b></i></div>'+
|
76 |
+
'<label>OnMouseDown event</label><textarea class="large" name="sOnmousedown" id="sOnmousedown">'+cff_esc_attr(this.sOnmousedown)+'</textarea>';
|
77 |
},
|
78 |
showTitle: function(){ return ''; },
|
79 |
showShortLabel: function(){ return ''; }
|
js/fields-admin/34_fbuilder.fhtml.js
CHANGED
@@ -5,27 +5,27 @@
|
|
5 |
control_category:1
|
6 |
}
|
7 |
);
|
8 |
-
$.fbuilder.controls[
|
9 |
$.extend(
|
10 |
-
$.fbuilder.controls[
|
11 |
-
$.fbuilder.controls[
|
12 |
{
|
13 |
ftype:"fhtml",
|
14 |
fcontent: "",
|
15 |
display:function()
|
16 |
{
|
17 |
-
return
|
18 |
},
|
19 |
editItemEvents:function()
|
20 |
{
|
21 |
var evt=[{s:"#sContent",e:"change keyup", l:"fcontent"}];
|
22 |
-
$.fbuilder.controls[
|
23 |
|
24 |
// Code Editor
|
25 |
-
if(
|
26 |
{
|
27 |
setTimeout(function(){
|
28 |
-
var htmlEditorSettings = wp.codeEditor.defaultSettings ? _.clone(
|
29 |
htmlEditorSettings.codemirror = _.extend(
|
30 |
{},
|
31 |
htmlEditorSettings.codemirror,
|
@@ -38,7 +38,7 @@
|
|
38 |
htmlEditorSettings['htmlhint']['spec-char-escape'] = false;
|
39 |
htmlEditorSettings['htmlhint']['alt-require'] = false;
|
40 |
htmlEditorSettings['htmlhint']['tag-pair'] = false;
|
41 |
-
editor = wp.codeEditor.initialize(
|
42 |
editor.codemirror.on('change', function(cm){ $('#sContent').val(cm.getValue()).change();});
|
43 |
|
44 |
$('.cff-editor-extend-shrink').on('click', function(){$(this).closest('.cff-editor-container').toggleClass('fullscreen');});
|
@@ -48,7 +48,7 @@
|
|
48 |
},
|
49 |
showContent:function()
|
50 |
{
|
51 |
-
return '<div class="cff-editor-container"><label style="display:block;"><div class="cff-editor-extend-shrink"></div>HTML Content</label><textarea class="large" name="sContent" id="sContent" style="height:150px;">'
|
52 |
},
|
53 |
showAllSettings:function()
|
54 |
{
|
5 |
control_category:1
|
6 |
}
|
7 |
);
|
8 |
+
$.fbuilder.controls['fhtml']=function(){ this.init(); };
|
9 |
$.extend(
|
10 |
+
$.fbuilder.controls['fhtml'].prototype,
|
11 |
+
$.fbuilder.controls['ffields'].prototype,
|
12 |
{
|
13 |
ftype:"fhtml",
|
14 |
fcontent: "",
|
15 |
display:function()
|
16 |
{
|
17 |
+
return '<div class="fields '+this.name+' '+this.ftype+' fhtml" 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/>').html(this.fcontent).find('script,style').remove().end().html()+'<div class="clearer" /></div>';
|
18 |
},
|
19 |
editItemEvents:function()
|
20 |
{
|
21 |
var evt=[{s:"#sContent",e:"change keyup", l:"fcontent"}];
|
22 |
+
$.fbuilder.controls['ffields'].prototype.editItemEvents.call(this,evt);
|
23 |
|
24 |
// Code Editor
|
25 |
+
if('codeEditor' in wp)
|
26 |
{
|
27 |
setTimeout(function(){
|
28 |
+
var htmlEditorSettings = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {}, editor;
|
29 |
htmlEditorSettings.codemirror = _.extend(
|
30 |
{},
|
31 |
htmlEditorSettings.codemirror,
|
38 |
htmlEditorSettings['htmlhint']['spec-char-escape'] = false;
|
39 |
htmlEditorSettings['htmlhint']['alt-require'] = false;
|
40 |
htmlEditorSettings['htmlhint']['tag-pair'] = false;
|
41 |
+
editor = wp.codeEditor.initialize($('#sContent'), htmlEditorSettings);
|
42 |
editor.codemirror.on('change', function(cm){ $('#sContent').val(cm.getValue()).change();});
|
43 |
|
44 |
$('.cff-editor-extend-shrink').on('click', function(){$(this).closest('.cff-editor-container').toggleClass('fullscreen');});
|
48 |
},
|
49 |
showContent:function()
|
50 |
{
|
51 |
+
return '<div class="cff-editor-container"><label style="display:block;"><div class="cff-editor-extend-shrink"></div>HTML Content</label><textarea class="large" name="sContent" id="sContent" style="height:150px;">'+cff_esc_attr(this.fcontent)+'</textarea></div>';
|
52 |
},
|
53 |
showAllSettings:function()
|
54 |
{
|
js/fields-admin/36_fbuilder.acceptance.js
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
display:function()
|
22 |
{
|
23 |
var str = '<div class="one_column"><input class="field" disabled="true" type="checkbox"/> '+this.title+((this.required)?"*":"")+'</div>';
|
24 |
-
return
|
25 |
},
|
26 |
editItemEvents:function()
|
27 |
{
|
@@ -42,15 +42,15 @@
|
|
42 |
showUserhelp: function(){ return ''; },
|
43 |
showValue:function()
|
44 |
{
|
45 |
-
return '<label>Value</label><input class="large" type="text" name="sValue" id="sValue" value="'
|
46 |
},
|
47 |
showURL:function()
|
48 |
{
|
49 |
-
return '<label>URL to the Consent and Acknowledgement page</label><input class="large" type="text" name="sURL" id="sURL" value="'
|
50 |
},
|
51 |
showMessage:function()
|
52 |
{
|
53 |
-
return '<label>- or - enter the Consent and Acknowledgement text</label><textarea class="large" name="sMessage" id="sMessage" style="height:150px;">'+this.message+'</textarea>';
|
54 |
},
|
55 |
showCsslayout:function()
|
56 |
{
|
21 |
display:function()
|
22 |
{
|
23 |
var str = '<div class="one_column"><input class="field" disabled="true" type="checkbox"/> '+this.title+((this.required)?"*":"")+'</div>';
|
24 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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><div class="dfield">'+str+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
25 |
},
|
26 |
editItemEvents:function()
|
27 |
{
|
42 |
showUserhelp: function(){ return ''; },
|
43 |
showValue:function()
|
44 |
{
|
45 |
+
return '<label>Value</label><input class="large" type="text" name="sValue" id="sValue" value="'+cff_esc_attr(this.value)+'">';
|
46 |
},
|
47 |
showURL:function()
|
48 |
{
|
49 |
+
return '<label>URL to the Consent and Acknowledgement page</label><input class="large" type="text" name="sURL" id="sURL" value="'+cff_esc_attr(this.url)+'">';
|
50 |
},
|
51 |
showMessage:function()
|
52 |
{
|
53 |
+
return '<label>- or - enter the Consent and Acknowledgement text</label><textarea class="large" name="sMessage" id="sMessage" style="height:150px;">'+cff_esc_attr(this.message)+'</textarea>';
|
54 |
},
|
55 |
showCsslayout:function()
|
56 |
{
|
js/fields-admin/fbuilder.fcalculated.js
CHANGED
@@ -7,10 +7,10 @@
|
|
7 |
control_category:1
|
8 |
}
|
9 |
);
|
10 |
-
$.fbuilder.controls[
|
11 |
$.extend(
|
12 |
-
$.fbuilder.controls[
|
13 |
-
$.fbuilder.controls[
|
14 |
{
|
15 |
title:"Untitled",
|
16 |
ftype:"fCalculated",
|
@@ -39,7 +39,7 @@
|
|
39 |
display:function()
|
40 |
{
|
41 |
this.init();
|
42 |
-
return
|
43 |
},
|
44 |
editItemEvents:function()
|
45 |
{
|
@@ -59,7 +59,7 @@
|
|
59 |
|
60 |
$("#sEq").bind("change keyup", {obj: this}, function(e)
|
61 |
{
|
62 |
-
if(
|
63 |
{
|
64 |
e.data.obj.eq = $(this).val();
|
65 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
@@ -87,7 +87,7 @@
|
|
87 |
var args = {};
|
88 |
args.code = e.data.obj.eq;
|
89 |
args.fields = cff_form_fields_list;
|
90 |
-
if(
|
91 |
{
|
92 |
args.operations = {};
|
93 |
for(var i in $.fbuilder['modules'])
|
@@ -104,107 +104,107 @@
|
|
104 |
}
|
105 |
this.contentWindow.postMessage(JSON.stringify(args), '*');
|
106 |
}
|
107 |
-
).attr('src', '//fxeditor.dwbooster.com/?open_by=cff'
|
108 |
|
109 |
document.location.href="#cff-advanced-equation-editor";
|
110 |
});
|
111 |
$('.displayWizard').bind("click", {obj: this}, function(e)
|
112 |
{
|
113 |
e.preventDefault();
|
114 |
-
var me = $(
|
115 |
i = me.attr("i");
|
116 |
-
e.data.obj.dependencies[
|
117 |
-
e.data.obj.dependencies[
|
118 |
-
$.fbuilder.editItem(
|
119 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
120 |
});
|
121 |
$('.displayComplexRule').bind("click", {obj: this}, function(e)
|
122 |
{
|
123 |
e.preventDefault();
|
124 |
-
e.data.obj.dependencies[
|
125 |
-
$.fbuilder.editItem(
|
126 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
127 |
});
|
128 |
-
$(
|
129 |
{
|
130 |
var me = $(this),
|
131 |
i = me.attr("i"),
|
132 |
-
o = e.data.obj.dependencies[
|
133 |
|
134 |
o.rule = 'value'+me.val()+$(".cf_dependence_value[i='"+i+"']").val().replace(/'/g, "\'");
|
135 |
o.complex = false;
|
136 |
-
e.data.obj.dependencies[
|
137 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
138 |
});
|
139 |
-
$(
|
140 |
{
|
141 |
var me = $(this),
|
142 |
i = me.attr("i"),
|
143 |
-
o = e.data.obj.dependencies[
|
144 |
|
145 |
o.rule = 'value'+$(".cf_dependence_operator[i='"+i+"']").val()+me.val();
|
146 |
o.complex = false;
|
147 |
-
e.data.obj.dependencies[
|
148 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
149 |
});
|
150 |
-
$(
|
151 |
{
|
152 |
var me = $(this);
|
153 |
-
e.data.obj.dependencies[
|
154 |
-
e.data.obj.dependencies[
|
155 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
156 |
});
|
157 |
-
$(
|
158 |
{
|
159 |
var me = $(this);
|
160 |
-
e.data.obj.dependencies[
|
161 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
162 |
});
|
163 |
-
$(
|
164 |
{
|
165 |
var j = $(this).attr("j");
|
166 |
-
if(
|
167 |
{
|
168 |
-
e.data.obj.dependencies.splice($(this).attr("i")*1+1, 0, { 'rule' : '', 'complex' : false, 'fields' : [''] }
|
169 |
}else
|
170 |
{
|
171 |
-
e.data.obj.dependencies[$(this).attr("i")].fields.splice(
|
172 |
}
|
173 |
|
174 |
-
$.fbuilder.editItem(
|
175 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
176 |
});
|
177 |
-
$(
|
178 |
{
|
179 |
var i = $(this).attr("i"),
|
180 |
j = $(this).attr("j");
|
181 |
|
182 |
-
if(
|
183 |
{
|
184 |
-
if(
|
185 |
{
|
186 |
-
e.data.obj.dependencies[
|
187 |
}else
|
188 |
{
|
189 |
-
e.data.obj.dependencies[
|
190 |
}
|
191 |
}
|
192 |
else
|
193 |
{
|
194 |
-
if(
|
195 |
{
|
196 |
-
e.data.obj.dependencies.splice(
|
197 |
}
|
198 |
else
|
199 |
{
|
200 |
-
e.data.obj.dependencies[
|
201 |
}
|
202 |
}
|
203 |
|
204 |
-
$.fbuilder.editItem(
|
205 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
206 |
});
|
207 |
-
$.fbuilder.controls[
|
208 |
},
|
209 |
showSpecialDataInstance: function()
|
210 |
{
|
@@ -215,7 +215,7 @@
|
|
215 |
// Instance
|
216 |
var me = this;
|
217 |
|
218 |
-
function setOperator(
|
219 |
{
|
220 |
var ops = [
|
221 |
{'text' : 'Equal to', 'value' : '=='},
|
@@ -227,40 +227,40 @@
|
|
227 |
],
|
228 |
r = '';
|
229 |
|
230 |
-
for(
|
231 |
{
|
232 |
-
r += '<option value="'
|
233 |
}
|
234 |
|
235 |
-
return '<select i="'
|
236 |
}
|
237 |
|
238 |
var r = '';
|
239 |
var items = this.fBuild.getItems();
|
240 |
-
$.each(
|
241 |
{
|
242 |
-
if(
|
243 |
{
|
244 |
-
r += '<div class="cff-dependency-rule"><div style="position:relative;"><span style="font-weight:bold;">If value is</span><span class="cf_dependence_edition" i="'+i+'" ><input class="cf_dependence_rule" type="text" i="'+i+'" value="'+o.rule
|
245 |
}
|
246 |
else
|
247 |
{
|
248 |
var operator = '',
|
249 |
value = '';
|
250 |
|
251 |
-
if(
|
252 |
{
|
253 |
-
var re = new RegExp(
|
254 |
-
parts = re.exec(
|
255 |
|
256 |
operator = parts[1];
|
257 |
value = parts[2];
|
258 |
}
|
259 |
|
260 |
-
r += '<div class="cff-dependency-rule"><div style="position:relative;"><span style="font-weight:bold;">If value is</span><span class="cf_dependence_edition" i="'+i+'" >'+setOperator(
|
261 |
}
|
262 |
r += '<div>';
|
263 |
-
$.each(
|
264 |
{
|
265 |
|
266 |
var opt = '<option value=""></option>';
|
@@ -268,7 +268,7 @@
|
|
268 |
{
|
269 |
if (items[k].name != me.name && items[k].ftype != 'fPageBreak' && items[k].ftype != 'frecordsetds')
|
270 |
{
|
271 |
-
opt += '<option value="'+items[k].name+'" '+(
|
272 |
}
|
273 |
}
|
274 |
r += '<div style="position:relative;" class="cff-dependency-item"><span>If rule is valid show:</span> <select class="cf_dependence_field" i="'+i+'" j="'+j+'" >'+opt+'</select><div class="choice-ctrls"><a class="addDep ui-icon ui-icon-circle-plus" i="'+i+'" j="'+j+'" title="Add another dependency."></a><a class="removeDep ui-icon ui-icon-circle-minus" i="'+i+'" j="'+j+'" title="Delete this dependency."></a></div></div>';
|
@@ -292,18 +292,18 @@
|
|
292 |
},
|
293 |
showRangeIntance: function()
|
294 |
{
|
295 |
-
return '<div class="clearer"></div><div class="column width50"><label>Min</label><input type="text" name="sMin" id="sMin" value="'
|
296 |
},
|
297 |
showEqEditor:function(eq)
|
298 |
{
|
299 |
var default_toolbar = "default|mathematical",
|
300 |
me = this,
|
301 |
-
tools = $.fbuilder[
|
302 |
|
303 |
-
$.fbuilder.controls[
|
304 |
setField : function()
|
305 |
{
|
306 |
-
this.setSymbol(
|
307 |
},
|
308 |
setSymbol : function(s)
|
309 |
{
|
@@ -320,70 +320,70 @@
|
|
320 |
$.fbuilder.reloadItems({'field':me});
|
321 |
}
|
322 |
},
|
323 |
-
loadTutorial : function(
|
324 |
{
|
325 |
var parts = toolbar.split('|'),
|
326 |
out = '';
|
327 |
|
328 |
-
if(
|
329 |
{
|
330 |
-
out = '<input type="button" class="eq_btn button-secondary" onclick="window.open(\''
|
331 |
}
|
332 |
-
$('#sEqModuleTutorial').html(
|
333 |
return out;
|
334 |
},
|
335 |
loadToolbarList : function()
|
336 |
{
|
337 |
var out = '<select id="sToolbarList" onchange="'+tools+'.loadToolbar(this.options[this.selectedIndex].value);'+tools+'.loadTutorial(this.options[this.selectedIndex].value);">';
|
338 |
|
339 |
-
if(
|
340 |
{
|
341 |
-
for(
|
342 |
{
|
343 |
-
var module = $.fbuilder[
|
344 |
-
for(
|
345 |
{
|
346 |
-
out += '<option value="'+m+'|'+toolbar+'" '+(
|
347 |
}
|
348 |
}
|
349 |
}
|
350 |
out += '</select>';
|
351 |
return out;
|
352 |
},
|
353 |
-
loadToolbar : function(
|
354 |
{
|
355 |
var parts = toolbar.split('|'),
|
356 |
out = '';
|
357 |
|
358 |
-
if(
|
359 |
{
|
360 |
-
var buttons = $.fbuilder[
|
361 |
if(buttons.length)
|
362 |
{
|
363 |
-
for(
|
364 |
{
|
365 |
-
out += '<input type="button" value="'+buttons[
|
366 |
}
|
367 |
-
this.setTip(
|
368 |
}
|
369 |
else
|
370 |
{
|
371 |
-
this.setTip(
|
372 |
}
|
373 |
}
|
374 |
|
375 |
-
$(
|
376 |
return out;
|
377 |
},
|
378 |
-
setTip : function(
|
379 |
{
|
380 |
-
if(
|
381 |
{
|
382 |
-
$('#sEqTipsContainer').html(
|
383 |
}
|
384 |
else
|
385 |
{
|
386 |
-
$('#sEqTipsContainer').html(
|
387 |
}
|
388 |
}
|
389 |
};
|
@@ -395,21 +395,21 @@
|
|
395 |
var items = this.fBuild.getItems(),
|
396 |
invalidFields = { 'fSectionBreak':1, 'fPageBreak':1, 'fsummary':1, 'ffieldset':1, 'fdiv':1, 'fMedia':1, 'fButton':1, 'fhtml':1, 'ffile':1 };
|
397 |
|
398 |
-
for(
|
399 |
{
|
400 |
-
var item = items[
|
401 |
-
if(
|
402 |
{
|
403 |
-
var fName = item[
|
404 |
-
fTitle = item[
|
405 |
|
406 |
cff_form_fields_list[fName] = {label:fTitle, type:item.ftype};
|
407 |
|
408 |
-
fName = fName.replace(
|
409 |
-
out += '<option value="'
|
410 |
}
|
411 |
}
|
412 |
-
out += '</select><input type="button" value="+" class="eq_btn button-secondary" onclick="'+tools+'.setField();" /></div><label>Operators</label><div style="text-align:center;" class="groupBox"><div style="text-align:left;">'+$.fbuilder.controls[
|
413 |
|
414 |
return out;
|
415 |
}
|
7 |
control_category:1
|
8 |
}
|
9 |
);
|
10 |
+
$.fbuilder.controls['fCalculated']=function(){this.dependencies = [{'rule':'', 'complex':false, 'fields':['']}];};
|
11 |
$.extend(
|
12 |
+
$.fbuilder.controls['fCalculated'].prototype,
|
13 |
+
$.fbuilder.controls['ffields'].prototype,
|
14 |
{
|
15 |
title:"Untitled",
|
16 |
ftype:"fCalculated",
|
39 |
display:function()
|
40 |
{
|
41 |
this.init();
|
42 |
+
return '<div class="fields '+this.name+' '+this.ftype+'" 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"><input class="field disabled '+this.size+'" type="text" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer" /></div>';
|
43 |
},
|
44 |
editItemEvents:function()
|
45 |
{
|
59 |
|
60 |
$("#sEq").bind("change keyup", {obj: this}, function(e)
|
61 |
{
|
62 |
+
if($.inArray(e.keyCode, [16,17,18,27,37,38,39,40]) == -1)
|
63 |
{
|
64 |
e.data.obj.eq = $(this).val();
|
65 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
87 |
var args = {};
|
88 |
args.code = e.data.obj.eq;
|
89 |
args.fields = cff_form_fields_list;
|
90 |
+
if($.fbuilder['modules'])
|
91 |
{
|
92 |
args.operations = {};
|
93 |
for(var i in $.fbuilder['modules'])
|
104 |
}
|
105 |
this.contentWindow.postMessage(JSON.stringify(args), '*');
|
106 |
}
|
107 |
+
).attr('src', '//fxeditor.dwbooster.com/?open_by=cff');
|
108 |
|
109 |
document.location.href="#cff-advanced-equation-editor";
|
110 |
});
|
111 |
$('.displayWizard').bind("click", {obj: this}, function(e)
|
112 |
{
|
113 |
e.preventDefault();
|
114 |
+
var me = $(this),
|
115 |
i = me.attr("i");
|
116 |
+
e.data.obj.dependencies[i].rule = '';
|
117 |
+
e.data.obj.dependencies[i].complex = false;
|
118 |
+
$.fbuilder.editItem(e.data.obj.index);
|
119 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
120 |
});
|
121 |
$('.displayComplexRule').bind("click", {obj: this}, function(e)
|
122 |
{
|
123 |
e.preventDefault();
|
124 |
+
e.data.obj.dependencies[$(this).attr("i")].complex = true;
|
125 |
+
$.fbuilder.editItem(e.data.obj.index);
|
126 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
127 |
});
|
128 |
+
$(".cf_dependence_operator").bind("change", {obj: this}, function(e)
|
129 |
{
|
130 |
var me = $(this),
|
131 |
i = me.attr("i"),
|
132 |
+
o = e.data.obj.dependencies[i];
|
133 |
|
134 |
o.rule = 'value'+me.val()+$(".cf_dependence_value[i='"+i+"']").val().replace(/'/g, "\'");
|
135 |
o.complex = false;
|
136 |
+
e.data.obj.dependencies[me.attr("i")].rule = o.rule;
|
137 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
138 |
});
|
139 |
+
$(".cf_dependence_value").bind("change keyup", {obj: this}, function(e)
|
140 |
{
|
141 |
var me = $(this),
|
142 |
i = me.attr("i"),
|
143 |
+
o = e.data.obj.dependencies[i];
|
144 |
|
145 |
o.rule = 'value'+$(".cf_dependence_operator[i='"+i+"']").val()+me.val();
|
146 |
o.complex = false;
|
147 |
+
e.data.obj.dependencies[me.attr("i")].rule = o.rule;
|
148 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
149 |
});
|
150 |
+
$(".cf_dependence_rule").bind("change keyup", {obj: this}, function(e)
|
151 |
{
|
152 |
var me = $(this);
|
153 |
+
e.data.obj.dependencies[me.attr("i")].rule = me.val();
|
154 |
+
e.data.obj.dependencies[me.attr("i")].complex = true;
|
155 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
156 |
});
|
157 |
+
$(".cf_dependence_field").bind("change", {obj: this}, function(e)
|
158 |
{
|
159 |
var me = $(this);
|
160 |
+
e.data.obj.dependencies[me.attr("i")].fields[me.attr("j")] = me.val();
|
161 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
162 |
});
|
163 |
+
$(".addDep").bind("click", {obj: this}, function(e)
|
164 |
{
|
165 |
var j = $(this).attr("j");
|
166 |
+
if(typeof j == 'undefined')
|
167 |
{
|
168 |
+
e.data.obj.dependencies.splice($(this).attr("i")*1+1, 0, { 'rule' : '', 'complex' : false, 'fields' : [''] });
|
169 |
}else
|
170 |
{
|
171 |
+
e.data.obj.dependencies[$(this).attr("i")].fields.splice(j+1, 0, "")
|
172 |
}
|
173 |
|
174 |
+
$.fbuilder.editItem(e.data.obj.index);
|
175 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
176 |
});
|
177 |
+
$(".removeDep").bind("click", {obj: this}, function(e)
|
178 |
{
|
179 |
var i = $(this).attr("i"),
|
180 |
j = $(this).attr("j");
|
181 |
|
182 |
+
if(typeof j != 'undefined')
|
183 |
{
|
184 |
+
if(e.data.obj.dependencies[i].fields.length != 1)
|
185 |
{
|
186 |
+
e.data.obj.dependencies[i].fields.splice(j, 1);
|
187 |
}else
|
188 |
{
|
189 |
+
e.data.obj.dependencies[i].fields = [''];
|
190 |
}
|
191 |
}
|
192 |
else
|
193 |
{
|
194 |
+
if(e.data.obj.dependencies.length != 1)
|
195 |
{
|
196 |
+
e.data.obj.dependencies.splice(i, 1);
|
197 |
}
|
198 |
else
|
199 |
{
|
200 |
+
e.data.obj.dependencies[0] = { 'rule' : '', 'complex' : false, 'fields' : [''] };
|
201 |
}
|
202 |
}
|
203 |
|
204 |
+
$.fbuilder.editItem(e.data.obj.index);
|
205 |
$.fbuilder.reloadItems({'field':e.data.obj});
|
206 |
});
|
207 |
+
$.fbuilder.controls['ffields'].prototype.editItemEvents.call(this, evt);
|
208 |
},
|
209 |
showSpecialDataInstance: function()
|
210 |
{
|
215 |
// Instance
|
216 |
var me = this;
|
217 |
|
218 |
+
function setOperator(indx, op)
|
219 |
{
|
220 |
var ops = [
|
221 |
{'text' : 'Equal to', 'value' : '=='},
|
227 |
],
|
228 |
r = '';
|
229 |
|
230 |
+
for(var i = 0, h = ops.length; i < h; i++)
|
231 |
{
|
232 |
+
r += '<option value="'+cff_esc_attr(ops[i]['value'])+'" '+((op == ops[i]['value']) ? 'SELECTED' : '')+'>'+ops[i]['text']+'</option>';
|
233 |
}
|
234 |
|
235 |
+
return '<select i="'+cff_esc_attr(indx)+'" class="cf_dependence_operator">'+r+'</select>';
|
236 |
}
|
237 |
|
238 |
var r = '';
|
239 |
var items = this.fBuild.getItems();
|
240 |
+
$.each(this.dependencies, function (i, o)
|
241 |
{
|
242 |
+
if(o.complex)
|
243 |
{
|
244 |
+
r += '<div class="cff-dependency-rule"><div style="position:relative;"><span style="font-weight:bold;">If value is</span><span class="cf_dependence_edition" i="'+i+'" ><input class="cf_dependence_rule" type="text" i="'+i+'" value="'+cff_esc_attr(o.rule)+'" /></span><div class="choice-ctrls"><a class="addDep ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another dependency."></a><a class="removeDep ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this dependency."></a></div><div style="text-align:right;position:relative;"><span style="float:left;">Ex: value==10</span><a href="#" class="displayWizard" i="'+i+'">Edit through wizard</a><br />(The rule entered will lost)</div></div>';
|
245 |
}
|
246 |
else
|
247 |
{
|
248 |
var operator = '',
|
249 |
value = '';
|
250 |
|
251 |
+
if(!/^\s*$/.test(o.rule))
|
252 |
{
|
253 |
+
var re = new RegExp('^value([!=<>]+)(.*)$'),
|
254 |
+
parts = re.exec(o.rule);
|
255 |
|
256 |
operator = parts[1];
|
257 |
value = parts[2];
|
258 |
}
|
259 |
|
260 |
+
r += '<div class="cff-dependency-rule"><div style="position:relative;"><span style="font-weight:bold;">If value is</span><span class="cf_dependence_edition" i="'+i+'" >'+setOperator(i, operator)+' <input type="text" i="'+i+'" class="cf_dependence_value" value="'+cff_esc_attr(value)+'" /></span><div class="choice-ctrls"><a class="addDep ui-icon ui-icon-circle-plus" i="'+i+'" title="Add another dependency."></a><a class="removeDep ui-icon ui-icon-circle-minus" i="'+i+'" title="Delete this dependency."></a></div><div style="text-align:right;"><a i="'+i+'" class="displayComplexRule" href="#">Edit rule manually</a></div></div>';
|
261 |
}
|
262 |
r += '<div>';
|
263 |
+
$.each(o.fields, function(j, v)
|
264 |
{
|
265 |
|
266 |
var opt = '<option value=""></option>';
|
268 |
{
|
269 |
if (items[k].name != me.name && items[k].ftype != 'fPageBreak' && items[k].ftype != 'frecordsetds')
|
270 |
{
|
271 |
+
opt += '<option value="'+items[k].name+'" '+((items[k].name == v) ? 'selected="SELECTED"' : '')+'>'+items[k].name+((typeof items[k].title != 'undefined') ? ' ('+cff_esc_attr(items[k].title)+')' : '')+'</option>';
|
272 |
}
|
273 |
}
|
274 |
r += '<div style="position:relative;" class="cff-dependency-item"><span>If rule is valid show:</span> <select class="cf_dependence_field" i="'+i+'" j="'+j+'" >'+opt+'</select><div class="choice-ctrls"><a class="addDep ui-icon ui-icon-circle-plus" i="'+i+'" j="'+j+'" title="Add another dependency."></a><a class="removeDep ui-icon ui-icon-circle-minus" i="'+i+'" j="'+j+'" title="Delete this dependency."></a></div></div>';
|
292 |
},
|
293 |
showRangeIntance: function()
|
294 |
{
|
295 |
+
return '<div class="clearer"></div><div class="column width50"><label>Min</label><input type="text" name="sMin" id="sMin" value="'+cff_esc_attr(this.min)+'" class="large"></div><div class="column width50"><label>Max</label><input type="text" name="sMax" id="sMax" value="'+cff_esc_attr(this.max)+'" class="large"></div><div class="clearer"></div>';
|
296 |
},
|
297 |
showEqEditor:function(eq)
|
298 |
{
|
299 |
var default_toolbar = "default|mathematical",
|
300 |
me = this,
|
301 |
+
tools = $.fbuilder['objName']+'.fbuilder.controls.fCalculated.tools';
|
302 |
|
303 |
+
$.fbuilder.controls['fCalculated']['tools'] = {
|
304 |
setField : function()
|
305 |
{
|
306 |
+
this.setSymbol($('#sFieldList').val());
|
307 |
},
|
308 |
setSymbol : function(s)
|
309 |
{
|
320 |
$.fbuilder.reloadItems({'field':me});
|
321 |
}
|
322 |
},
|
323 |
+
loadTutorial : function(toolbar)
|
324 |
{
|
325 |
var parts = toolbar.split('|'),
|
326 |
out = '';
|
327 |
|
328 |
+
if($.fbuilder['modules'][parts[0]]['tutorial'])
|
329 |
{
|
330 |
+
out = '<input type="button" class="eq_btn button-secondary" onclick="window.open(\''+$.fbuilder['modules'][parts[0]]['tutorial']+'\');" value="?" title="Tutorial" />';
|
331 |
}
|
332 |
+
$('#sEqModuleTutorial').html(out);
|
333 |
return out;
|
334 |
},
|
335 |
loadToolbarList : function()
|
336 |
{
|
337 |
var out = '<select id="sToolbarList" onchange="'+tools+'.loadToolbar(this.options[this.selectedIndex].value);'+tools+'.loadTutorial(this.options[this.selectedIndex].value);">';
|
338 |
|
339 |
+
if($.fbuilder['modules'])
|
340 |
{
|
341 |
+
for(var m in $.fbuilder['modules'])
|
342 |
{
|
343 |
+
var module = $.fbuilder['modules'][m];
|
344 |
+
for(var toolbar in module['toolbars'])
|
345 |
{
|
346 |
+
out += '<option value="'+m+'|'+toolbar+'" '+((default_toolbar == m+'|'+toolbar) ? 'SELECTED' : '')+'>'+module['toolbars'][toolbar]['label']+'</options>';
|
347 |
}
|
348 |
}
|
349 |
}
|
350 |
out += '</select>';
|
351 |
return out;
|
352 |
},
|
353 |
+
loadToolbar : function(toolbar)
|
354 |
{
|
355 |
var parts = toolbar.split('|'),
|
356 |
out = '';
|
357 |
|
358 |
+
if($.fbuilder['modules'][parts[0]]['toolbars'][parts[1]])
|
359 |
{
|
360 |
+
var buttons = $.fbuilder['modules'][parts[0]]['toolbars'][parts[1]]['buttons'];
|
361 |
if(buttons.length)
|
362 |
{
|
363 |
+
for(var i = 0, h = buttons.length; i < h; i++)
|
364 |
{
|
365 |
+
out += '<input type="button" value="'+cff_esc_attr(buttons[i]['value'])+'" onclick="'+tools+'.setSymbol(\''+buttons[i]['code']+'\');'+tools+'.setTip(\''+buttons[i]['tip']+'\');" class="eq_btn button-secondary" title="'+buttons[i]['value']+'" />';
|
366 |
}
|
367 |
+
this.setTip('');
|
368 |
}
|
369 |
else
|
370 |
{
|
371 |
+
this.setTip('The module is distributed with the <a href="https://cff.dwbooster.com/download" target="_blank">Developer and Platinum versions</a> of the plugin.');
|
372 |
}
|
373 |
}
|
374 |
|
375 |
+
$('#sEqButtonsContainer').html(out);
|
376 |
return out;
|
377 |
},
|
378 |
+
setTip : function(t)
|
379 |
{
|
380 |
+
if(!/^\s*$/.test(t))
|
381 |
{
|
382 |
+
$('#sEqTipsContainer').html(t).show();
|
383 |
}
|
384 |
else
|
385 |
{
|
386 |
+
$('#sEqTipsContainer').html('').hide();
|
387 |
}
|
388 |
}
|
389 |
};
|
395 |
var items = this.fBuild.getItems(),
|
396 |
invalidFields = { 'fSectionBreak':1, 'fPageBreak':1, 'fsummary':1, 'ffieldset':1, 'fdiv':1, 'fMedia':1, 'fButton':1, 'fhtml':1, 'ffile':1 };
|
397 |
|
398 |
+
for(var i in items)
|
399 |
{
|
400 |
+
var item = items[i];
|
401 |
+
if(item['name'] != this.name && typeof invalidFields[item.ftype] == 'undefined')
|
402 |
{
|
403 |
+
var fName = item['name'],
|
404 |
+
fTitle = item['title'];
|
405 |
|
406 |
cff_form_fields_list[fName] = {label:fTitle, type:item.ftype};
|
407 |
|
408 |
+
fName = fName.replace(/'/g, "\'").replace(/"/g, '\"');
|
409 |
+
out += '<option value="'+cff_esc_attr(fName)+'">'+item['name']+((item['title'] && !/^\s*$/.test(item['title'])) ? '('+cff_esc_attr(item['title'])+')' : '')+'</option>';
|
410 |
}
|
411 |
}
|
412 |
+
out += '</select><input type="button" value="+" class="eq_btn button-secondary" onclick="'+tools+'.setField();" /></div><label>Operators</label><div style="text-align:center;" class="groupBox"><div style="text-align:left;">'+$.fbuilder.controls['fCalculated']['tools'].loadToolbarList()+'<span id="sEqModuleTutorial">'+$.fbuilder.controls['fCalculated']['tools'].loadTutorial(default_toolbar)+'</span></div><div id="sEqButtonsContainer" style="margin-top:10px;">'+$.fbuilder.controls['fCalculated']['tools'].loadToolbar(default_toolbar)+'</div><div id="sEqTipsContainer" style="background-color:#DFEFFF;border:1px solid #C2D7EF;padding:5px;margin:5px;display:none;text-align:left;"></div><div style="padding-top:20px;" class="large"><input type="button" class="button-primary large" onclick="window.open(\'https://cff-bundles.dwbooster.com/?category[]=operations\',\'_blank\');" value="More operations [+]" /></div></div><label>Symbol to display at beginning of calculated field</label><input type="text" name="sPrefix" id="sPrefix" class="large" value="'+cff_esc_attr(me.prefix)+'" /><label><input type="checkbox" id="sCurrency" name="sCurrency" '+((me.currency) ? 'CHECKED' : '')+' /> it is a currency</label><label>Symbol to display at the end of calculated field</label><input type="text" name="sSuffix" id="sSuffix" class="large" value="'+cff_esc_attr(me.suffix)+'" /><label>Decimals separator symbol (Ex: 25.20)</label><input type="text" name="sDecimalSymbol" id="sDecimalSymbol" class="large" value="'+cff_esc_attr(me.decimalsymbol)+'" /><label>Symbol for grouping thousands (Ex: 3,000,000)</label><input type="text" name="sGroupingSymbol" id="sGroupingSymbol" class="large" value="'+cff_esc_attr(me.groupingsymbol)+'" />';
|
413 |
|
414 |
return out;
|
415 |
}
|
js/fields-public/01_fbuilder.ftext.js
CHANGED
@@ -18,24 +18,24 @@
|
|
18 |
regExpMssg:"",
|
19 |
show:function()
|
20 |
{
|
21 |
-
this.minlength =
|
22 |
-
this.maxlength =
|
23 |
-
this.equalTo =
|
24 |
this.predefined = this._getAttr('predefined');
|
25 |
-
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 aria-label="'
|
26 |
},
|
27 |
after_show:function()
|
28 |
{
|
29 |
-
if(
|
30 |
{
|
31 |
var parts = this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);
|
32 |
-
this.regExp = (
|
33 |
|
34 |
if(!('pattern' in $.validator.methods))
|
35 |
-
$.validator.addMethod(
|
36 |
{
|
37 |
try{
|
38 |
-
return this.optional(element) || param.test(
|
39 |
}
|
40 |
catch(err){return true;}
|
41 |
}
|
@@ -47,8 +47,8 @@
|
|
47 |
{
|
48 |
raw = raw || false;
|
49 |
no_quotes = no_quotes || false;
|
50 |
-
var e = $(
|
51 |
-
if(
|
52 |
return 0;
|
53 |
}
|
54 |
}
|
18 |
regExpMssg:"",
|
19 |
show:function()
|
20 |
{
|
21 |
+
this.minlength = cff_esc_attr($.trim(this.minlength));
|
22 |
+
this.maxlength = cff_esc_attr($.trim(this.maxlength));
|
23 |
+
this.equalTo = cff_esc_attr($.trim(this.equalTo));
|
24 |
this.predefined = this._getAttr('predefined');
|
25 |
+
return '<div class="fields '+cff_esc_attr(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 aria-label="'+cff_esc_attr(this.title)+'" id="'+this.name+'" name="'+this.name+'"'+((this.minlength.length) ? ' minlength="'+cff_esc_attr(this.minlength)+'"' : '')+((this.maxlength.length) ? ' maxlength="'+cff_esc_attr(this.maxlength)+'"' : '')+((this.equalTo.length) ? ' equalTo="#'+cff_esc_attr(this.equalTo)+this.form_identifier+'"':'')+' class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+' type="text" value="'+cff_esc_attr(this.predefined)+'" autocomplete="'+this.autocomplete+'" /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
26 |
},
|
27 |
after_show:function()
|
28 |
{
|
29 |
+
if(this.regExp != "" && typeof $[ 'validator' ] != 'undefined')
|
30 |
{
|
31 |
var parts = this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);
|
32 |
+
this.regExp = (parts === null) ? new RegExp(this.regExp) : new RegExp(parts[2],parts[4].toLowerCase());
|
33 |
|
34 |
if(!('pattern' in $.validator.methods))
|
35 |
+
$.validator.addMethod('pattern', function(value, element, param)
|
36 |
{
|
37 |
try{
|
38 |
+
return this.optional(element) || param.test(value);
|
39 |
}
|
40 |
catch(err){return true;}
|
41 |
}
|
47 |
{
|
48 |
raw = raw || false;
|
49 |
no_quotes = no_quotes || false;
|
50 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
51 |
+
if(e.length) return $.fbuilder.parseValStr(e.val(), raw, no_quotes);
|
52 |
return 0;
|
53 |
}
|
54 |
}
|
js/fields-public/02_fbuilder.fcurrency.js
CHANGED
@@ -38,7 +38,7 @@
|
|
38 |
e.valid();
|
39 |
if(this.required) e.addClass('required');
|
40 |
},
|
41 |
-
getFormattedValue:function(
|
42 |
{
|
43 |
if(value == '') return value;
|
44 |
var me = this,
|
@@ -50,18 +50,18 @@
|
|
50 |
str = '',
|
51 |
sign = '';
|
52 |
|
53 |
-
if(
|
54 |
{
|
55 |
if(v < 0) sign = '-';
|
56 |
v = ABS(v);
|
57 |
if(this.twoDecimals) v = v.toFixed(2);
|
58 |
parts = v.toString().split(".");
|
59 |
|
60 |
-
for(
|
61 |
{
|
62 |
counter++;
|
63 |
-
str = parts[0][i]
|
64 |
-
if(
|
65 |
}
|
66 |
parts[0] = str;
|
67 |
|
@@ -86,34 +86,34 @@
|
|
86 |
show:function()
|
87 |
{
|
88 |
this.predefined = this._getAttr('predefined');
|
89 |
-
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.numberpad) ? 'inputmode="decimal"' : '')+' aria-label="'
|
90 |
},
|
91 |
after_show:function()
|
92 |
{
|
93 |
var me = this;
|
94 |
-
if(
|
95 |
{
|
96 |
|
97 |
-
$(
|
98 |
-
this.value = me.getFormattedValue(
|
99 |
-
}
|
100 |
}
|
101 |
},
|
102 |
val:function(raw, no_quotes)
|
103 |
{
|
104 |
raw = raw || false;
|
105 |
no_quotes = no_quotes || false;
|
106 |
-
var e = $(
|
107 |
-
if(
|
108 |
{
|
109 |
var v = e.val();
|
110 |
if(raw) return ($.isNumeric(v)) ? v : $.fbuilder.parseValStr(v, raw, no_quotes);
|
111 |
v = $.trim(v);
|
112 |
|
113 |
-
v = v.replace(
|
114 |
-
.replace(
|
115 |
|
116 |
-
return $.fbuilder.parseVal(
|
117 |
}
|
118 |
return 0;
|
119 |
}
|
38 |
e.valid();
|
39 |
if(this.required) e.addClass('required');
|
40 |
},
|
41 |
+
getFormattedValue:function(value)
|
42 |
{
|
43 |
if(value == '') return value;
|
44 |
var me = this,
|
50 |
str = '',
|
51 |
sign = '';
|
52 |
|
53 |
+
if(!isNaN(v))
|
54 |
{
|
55 |
if(v < 0) sign = '-';
|
56 |
v = ABS(v);
|
57 |
if(this.twoDecimals) v = v.toFixed(2);
|
58 |
parts = v.toString().split(".");
|
59 |
|
60 |
+
for(var i = parts[0].length-1; i >= 0; i--)
|
61 |
{
|
62 |
counter++;
|
63 |
+
str = parts[0][i]+str;
|
64 |
+
if(counter%3 == 0 && i != 0) str = ts+str;
|
65 |
}
|
66 |
parts[0] = str;
|
67 |
|
86 |
show:function()
|
87 |
{
|
88 |
this.predefined = this._getAttr('predefined');
|
89 |
+
return '<div class="fields '+cff_esc_attr(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.numberpad) ? 'inputmode="decimal"' : '')+' aria-label="'+cff_esc_attr(this.title)+'" '+((this.readonly)? 'readonly' : '')+' id="'+this.name+'" name="'+this.name+'" class="field cffcurrency '+this.size+((this.required)?" required":"")+'" type="text" value="'+cff_esc_attr((this.formatDynamically) ? this.getFormattedValue(this.predefined) : this.predefined)+'" '+((!/^\s*$/.test(this.min)) ? 'min="'+cff_esc_attr($.fbuilder.parseVal(this._getAttr('min'), this.thousandSeparator, this.centSeparator))+'" ' : '')+((!/^\s*$/.test(this.max)) ? ' max="'+cff_esc_attr($.fbuilder.parseVal(this._getAttr('max'), this.thousandSeparator, this.centSeparator))+'" ' : '')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
90 |
},
|
91 |
after_show:function()
|
92 |
{
|
93 |
var me = this;
|
94 |
+
if(this.formatDynamically)
|
95 |
{
|
96 |
|
97 |
+
$(document).on('change', '[name="'+me.name+'"]', function(){
|
98 |
+
this.value = me.getFormattedValue(this.value);
|
99 |
+
});
|
100 |
}
|
101 |
},
|
102 |
val:function(raw, no_quotes)
|
103 |
{
|
104 |
raw = raw || false;
|
105 |
no_quotes = no_quotes || false;
|
106 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
107 |
+
if(e.length)
|
108 |
{
|
109 |
var v = e.val();
|
110 |
if(raw) return ($.isNumeric(v)) ? v : $.fbuilder.parseValStr(v, raw, no_quotes);
|
111 |
v = $.trim(v);
|
112 |
|
113 |
+
v = v.replace(new RegExp($.fbuilder[ 'escapeSymbol' ](this.currencySymbol), 'g'), '')
|
114 |
+
.replace(new RegExp($.fbuilder[ 'escapeSymbol' ](this.currencyText), 'g'), '');
|
115 |
|
116 |
+
return $.fbuilder.parseVal(v, this.thousandSeparator, this.centSeparator, no_quotes);
|
117 |
}
|
118 |
return 0;
|
119 |
}
|
js/fields-public/02_fbuilder.fnumber.js
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
e.valid();
|
50 |
if(this.required) e.addClass('required');
|
51 |
},
|
52 |
-
getFormattedValue:function(
|
53 |
{
|
54 |
if(value == '') return value;
|
55 |
var ts = this.thousandSeparator,
|
@@ -68,8 +68,8 @@
|
|
68 |
|
69 |
for(var i = parts[0].length-1; i >= 0; i--){
|
70 |
counter++;
|
71 |
-
str = parts[0][i]
|
72 |
-
if(counter%3 == 0 && i != 0) str = ts
|
73 |
|
74 |
}
|
75 |
parts[0] = str;
|
@@ -87,29 +87,29 @@
|
|
87 |
},
|
88 |
show:function()
|
89 |
{
|
90 |
-
var _type = (
|
91 |
this.predefined = this._getAttr('predefined');
|
92 |
-
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 '+((this.numberpad) ? 'inputmode="decimal"' : '')+' aria-label="'
|
93 |
},
|
94 |
after_show:function()
|
95 |
{
|
96 |
var me = this;
|
97 |
|
98 |
-
if(
|
99 |
{
|
100 |
-
$(
|
101 |
-
this.value = me.getFormattedValue(
|
102 |
-
}
|
103 |
}
|
104 |
},
|
105 |
val:function(raw,no_quotes)
|
106 |
{
|
107 |
raw = raw || false;
|
108 |
no_quotes = no_quotes || false;
|
109 |
-
var e = $(
|
110 |
-
if(
|
111 |
{
|
112 |
-
var v = $.trim(
|
113 |
if(raw) return ($.isNumeric(v) && this.thousandSeparator != '.') ? v : $.fbuilder.parseValStr(v, raw, no_quotes);
|
114 |
v = $.fbuilder.parseVal(v, this.thousandSeparator, this.decimalSymbol, no_quotes);
|
115 |
return (this.dformat == 'percent') ? v/100 : v;
|
49 |
e.valid();
|
50 |
if(this.required) e.addClass('required');
|
51 |
},
|
52 |
+
getFormattedValue:function(value)
|
53 |
{
|
54 |
if(value == '') return value;
|
55 |
var ts = this.thousandSeparator,
|
68 |
|
69 |
for(var i = parts[0].length-1; i >= 0; i--){
|
70 |
counter++;
|
71 |
+
str = parts[0][i]+str;
|
72 |
+
if(counter%3 == 0 && i != 0) str = ts+str;
|
73 |
|
74 |
}
|
75 |
parts[0] = str;
|
87 |
},
|
88 |
show:function()
|
89 |
{
|
90 |
+
var _type = (this.dformat == 'digits' || (this.dformat != 'percent' && /^$/.test(this.thousandSeparator) && /^\s*(\.\s*)?$/.test(this.decimalSymbol))) ? 'number' : 'text';
|
91 |
this.predefined = this._getAttr('predefined');
|
92 |
+
return '<div class="fields '+cff_esc_attr(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 '+((this.numberpad) ? 'inputmode="decimal"' : '')+' aria-label="'+cff_esc_attr(this.title)+'" id="'+this.name+'" name="'+this.name+'" '+((!/^\s*$/.test(this.min)) ? 'min="'+cff_esc_attr($.fbuilder.parseVal(this._getAttr('min'), this.thousandSeparator, this.decimalSymbol))+'" ' : '')+((!/^\s*$/.test(this.max)) ? ' max="'+cff_esc_attr($.fbuilder.parseVal(this._getAttr('max'), this.thousandSeparator, this.decimalSymbol))+'" ' : '')+' class="field '+this.dformat+((this.dformat == 'percent') ? ' number' : '')+' '+this.size+((this.required)?" required":"")+'" type="'+_type+'" value="'+cff_esc_attr((this.formatDynamically) ? this.getFormattedValue(this.predefined) : this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
93 |
},
|
94 |
after_show:function()
|
95 |
{
|
96 |
var me = this;
|
97 |
|
98 |
+
if((me.formatDynamically && me.dformat != 'digits') || me.dformat == 'percent')
|
99 |
{
|
100 |
+
$(document).on('change', '[name="'+me.name+'"]', function(){
|
101 |
+
this.value = me.getFormattedValue(this.value);
|
102 |
+
});
|
103 |
}
|
104 |
},
|
105 |
val:function(raw,no_quotes)
|
106 |
{
|
107 |
raw = raw || false;
|
108 |
no_quotes = no_quotes || false;
|
109 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
110 |
+
if(e.length)
|
111 |
{
|
112 |
+
var v = $.trim(e.val());
|
113 |
if(raw) return ($.isNumeric(v) && this.thousandSeparator != '.') ? v : $.fbuilder.parseValStr(v, raw, no_quotes);
|
114 |
v = $.fbuilder.parseVal(v, this.thousandSeparator, this.decimalSymbol, no_quotes);
|
115 |
return (this.dformat == 'percent') ? v/100 : v;
|
js/fields-public/02_fbuilder.fslider.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Slider",
|
7 |
ftype:"fslider",
|
@@ -24,29 +24,29 @@
|
|
24 |
caption:"{0}",
|
25 |
_setThousandsSeparator : function(v)
|
26 |
{
|
27 |
-
v = $.fbuilder.parseVal(
|
28 |
-
if(
|
29 |
{
|
30 |
v = v.toString();
|
31 |
var parts = v.toString().split("."),
|
32 |
counter = 0,
|
33 |
str = '';
|
34 |
|
35 |
-
for(
|
36 |
{
|
37 |
counter++;
|
38 |
str = parts[0][i] + str;
|
39 |
-
if(
|
40 |
|
41 |
}
|
42 |
parts[0] = str;
|
43 |
|
44 |
-
if(
|
45 |
{
|
46 |
-
parts[
|
47 |
}
|
48 |
|
49 |
-
return parts.join(
|
50 |
}
|
51 |
else
|
52 |
{
|
@@ -56,7 +56,7 @@
|
|
56 |
_setFieldValue:function(nochange)
|
57 |
{
|
58 |
var me = this;
|
59 |
-
if(
|
60 |
{
|
61 |
var values = $('#'+me.name+'_slider').slider('values'),
|
62 |
vl = values[0], vr = values[1],
|
@@ -95,7 +95,7 @@
|
|
95 |
this._setHndl('min');
|
96 |
this._setHndl('max');
|
97 |
this._setHndl('step');
|
98 |
-
this.centSeparator = (
|
99 |
},
|
100 |
show:function()
|
101 |
{
|
@@ -104,10 +104,10 @@
|
|
104 |
{
|
105 |
function component(c)
|
106 |
{
|
107 |
-
var min =
|
108 |
-
max =
|
109 |
-
step =
|
110 |
-
predefined =
|
111 |
(c == 'left') ? me.predefinedMin :
|
112 |
((c == 'right') ? me.predefinedMax : me.predefined)
|
113 |
),
|
@@ -130,17 +130,17 @@
|
|
130 |
timeoutId = setTimeout(function(){
|
131 |
if(v != undefined)
|
132 |
{
|
133 |
-
v = $.fbuilder.parseVal(
|
134 |
if(isNaN(v)) v = 0;
|
135 |
}
|
136 |
if(v1 != undefined)
|
137 |
{
|
138 |
-
v1 = $.fbuilder.parseVal(
|
139 |
if(isNaN(v1)) v1 = 0;
|
140 |
}
|
141 |
if(v2 != undefined)
|
142 |
{
|
143 |
-
v2 = $.fbuilder.parseVal(
|
144 |
if(isNaN(v2)) v2 = 0;
|
145 |
}
|
146 |
$('#'+me.name+'_slider').slider(
|
@@ -149,7 +149,7 @@
|
|
149 |
);
|
150 |
me._setFieldValue();}, t);
|
151 |
});
|
152 |
-
return '<div class="slider-type-'+c+'-component"><input aria-label="'
|
153 |
};
|
154 |
|
155 |
var str = '';
|
@@ -160,11 +160,11 @@
|
|
160 |
return str;
|
161 |
};
|
162 |
me.predefined = (/^\s*$/.test(me.predefined)) ? me.min : me._toNumber(me._getAttr('predefined'));
|
163 |
-
return '<div class="fields '+me.csslayout+' '+me.name+' cff-slider-field" id="field'+me.form_identifier+'-'+me.index+'">'+
|
164 |
'<label for="'+me.name+'">'+me.title+'</label>'+
|
165 |
'<div class="dfield slider-container">'+
|
166 |
typeValuesComponents()+
|
167 |
-
'<input id="'+me.name+'" name="'+me.name+'" class="field" type="hidden" value="'
|
168 |
'<div id="'+me.name+'_slider" class="slider '+me.size+'"></div>'+
|
169 |
'<div class="corner-captions '+me.size+'">'+
|
170 |
'<span class="left-corner">'+me.minCaption+'</span>'+
|
@@ -182,7 +182,7 @@
|
|
182 |
try{
|
183 |
var e = $('[id="'+this.name+'_slider"]'), c = this.val(), r = false;
|
184 |
if(ignore) v = 0;
|
185 |
-
e.slider(
|
186 |
if($.isArray(c)){if(c[0] < v){c[0] = v; r = true;}}
|
187 |
else if(c < v){c = v; r = true;}
|
188 |
if(r) this.setVal(c);
|
@@ -195,7 +195,7 @@
|
|
195 |
try{
|
196 |
var e = $('[id="'+this.name+'_slider"]'), c = this.val(), r = false;
|
197 |
if(ignore) v = 100;
|
198 |
-
e.slider(
|
199 |
if($.isArray(c)){if(v < c[1]){c[1] = v; r = true;}}
|
200 |
else if(v < c){c = v; r = true;}
|
201 |
if(r) this.setVal(c);
|
@@ -223,7 +223,7 @@
|
|
223 |
{
|
224 |
try{
|
225 |
if(ignore) v = 1;
|
226 |
-
$('[id="'+this.name+'_slider"]').slider(
|
227 |
}
|
228 |
catch(err){}
|
229 |
},
|
@@ -240,44 +240,44 @@
|
|
240 |
me.set_min_caption(opt.min);
|
241 |
me.set_max_caption(opt.max);
|
242 |
|
243 |
-
if(
|
244 |
{
|
245 |
-
var _min = Math.min(
|
246 |
-
_max = Math.min(
|
247 |
-
opt[
|
248 |
}
|
249 |
-
else opt[
|
250 |
|
251 |
opt['disabled'] = me.readonly;
|
252 |
|
253 |
-
opt[
|
254 |
-
return function(
|
255 |
{
|
256 |
-
if(
|
257 |
-
if(
|
258 |
e._setFieldValue();
|
259 |
}
|
260 |
-
}
|
261 |
-
$(
|
262 |
me._setFieldValue();
|
263 |
-
$(
|
264 |
},
|
265 |
val:function(raw)
|
266 |
{
|
267 |
try{
|
268 |
raw = raw || false;
|
269 |
-
var e = $(
|
270 |
-
return (
|
271 |
}
|
272 |
catch(err){return 0;}
|
273 |
},
|
274 |
-
setVal:function(
|
275 |
{
|
276 |
try{ v = JSON.parse(v); }catch(err){}
|
277 |
try{
|
278 |
-
$(
|
279 |
$('#'+this.name+'_slider').slider((($.isArray(v)) ? 'values' : 'value'), v);
|
280 |
this._setFieldValue(nochange);
|
281 |
-
}catch(
|
282 |
}
|
283 |
});
|
1 |
+
$.fbuilder.controls['fslider'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fslider'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Slider",
|
7 |
ftype:"fslider",
|
24 |
caption:"{0}",
|
25 |
_setThousandsSeparator : function(v)
|
26 |
{
|
27 |
+
v = $.fbuilder.parseVal(v, this.thousandSeparator, this.centSeparator);
|
28 |
+
if(!isNaN(v))
|
29 |
{
|
30 |
v = v.toString();
|
31 |
var parts = v.toString().split("."),
|
32 |
counter = 0,
|
33 |
str = '';
|
34 |
|
35 |
+
for(var i = parts[0].length-1; i >= 0; i--)
|
36 |
{
|
37 |
counter++;
|
38 |
str = parts[0][i] + str;
|
39 |
+
if(counter%3 == 0 && i != 0) str = this.thousandSeparator + str;
|
40 |
|
41 |
}
|
42 |
parts[0] = str;
|
43 |
|
44 |
+
if(typeof parts[1] != 'undefined' && parts[1].length == 1)
|
45 |
{
|
46 |
+
parts[1] += '0';
|
47 |
}
|
48 |
|
49 |
+
return parts.join(this.centSeparator);
|
50 |
}
|
51 |
else
|
52 |
{
|
56 |
_setFieldValue:function(nochange)
|
57 |
{
|
58 |
var me = this;
|
59 |
+
if(me.range)
|
60 |
{
|
61 |
var values = $('#'+me.name+'_slider').slider('values'),
|
62 |
vl = values[0], vr = values[1],
|
95 |
this._setHndl('min');
|
96 |
this._setHndl('max');
|
97 |
this._setHndl('step');
|
98 |
+
this.centSeparator = (/^\s*$/.test(this.centSeparator)) ? '.' : $.trim(this.centSeparator);
|
99 |
},
|
100 |
show:function()
|
101 |
{
|
104 |
{
|
105 |
function component(c)
|
106 |
{
|
107 |
+
var min = cff_esc_attr(me.min),
|
108 |
+
max = cff_esc_attr(me.max),
|
109 |
+
step = cff_esc_attr(me.step),
|
110 |
+
predefined = cff_esc_attr(
|
111 |
(c == 'left') ? me.predefinedMin :
|
112 |
((c == 'right') ? me.predefinedMax : me.predefined)
|
113 |
),
|
130 |
timeoutId = setTimeout(function(){
|
131 |
if(v != undefined)
|
132 |
{
|
133 |
+
v = $.fbuilder.parseVal(v, me.thousandSeparator, me.centSeparator);
|
134 |
if(isNaN(v)) v = 0;
|
135 |
}
|
136 |
if(v1 != undefined)
|
137 |
{
|
138 |
+
v1 = $.fbuilder.parseVal(v1, me.thousandSeparator, me.centSeparator);
|
139 |
if(isNaN(v1)) v1 = 0;
|
140 |
}
|
141 |
if(v2 != undefined)
|
142 |
{
|
143 |
+
v2 = $.fbuilder.parseVal(v2, me.thousandSeparator, me.centSeparator);
|
144 |
if(isNaN(v2)) v2 = 0;
|
145 |
}
|
146 |
$('#'+me.name+'_slider').slider(
|
149 |
);
|
150 |
me._setFieldValue();}, t);
|
151 |
});
|
152 |
+
return '<div class="slider-type-'+c+'-component"><input aria-label="'+cff_esc_attr(me.title)+'" id="'+me.name+'_component_'+c+'" class="large" type="text" value="'+cff_esc_attr(predefined)+'" '+((me.readonly) ? 'readonly' : '')+' /></div>';
|
153 |
};
|
154 |
|
155 |
var str = '';
|
160 |
return str;
|
161 |
};
|
162 |
me.predefined = (/^\s*$/.test(me.predefined)) ? me.min : me._toNumber(me._getAttr('predefined'));
|
163 |
+
return '<div class="fields '+cff_esc_attr(me.csslayout)+' '+me.name+' cff-slider-field" id="field'+me.form_identifier+'-'+me.index+'">'+
|
164 |
'<label for="'+me.name+'">'+me.title+'</label>'+
|
165 |
'<div class="dfield slider-container">'+
|
166 |
typeValuesComponents()+
|
167 |
+
'<input id="'+me.name+'" name="'+me.name+'" class="field" type="hidden" value="'+cff_esc_attr(me.predefined)+'"/>'+
|
168 |
'<div id="'+me.name+'_slider" class="slider '+me.size+'"></div>'+
|
169 |
'<div class="corner-captions '+me.size+'">'+
|
170 |
'<span class="left-corner">'+me.minCaption+'</span>'+
|
182 |
try{
|
183 |
var e = $('[id="'+this.name+'_slider"]'), c = this.val(), r = false;
|
184 |
if(ignore) v = 0;
|
185 |
+
e.slider('option', 'min', v);
|
186 |
if($.isArray(c)){if(c[0] < v){c[0] = v; r = true;}}
|
187 |
else if(c < v){c = v; r = true;}
|
188 |
if(r) this.setVal(c);
|
195 |
try{
|
196 |
var e = $('[id="'+this.name+'_slider"]'), c = this.val(), r = false;
|
197 |
if(ignore) v = 100;
|
198 |
+
e.slider('option', 'max', v);
|
199 |
if($.isArray(c)){if(v < c[1]){c[1] = v; r = true;}}
|
200 |
else if(v < c){c = v; r = true;}
|
201 |
if(r) this.setVal(c);
|
223 |
{
|
224 |
try{
|
225 |
if(ignore) v = 1;
|
226 |
+
$('[id="'+this.name+'_slider"]').slider("option", "step", v);
|
227 |
}
|
228 |
catch(err){}
|
229 |
},
|
240 |
me.set_min_caption(opt.min);
|
241 |
me.set_max_caption(opt.max);
|
242 |
|
243 |
+
if(me.range)
|
244 |
{
|
245 |
+
var _min = Math.min(Math.max(me._getAttr('predefinedMin'), opt.min), opt.max),
|
246 |
+
_max = Math.min(Math.max(me._getAttr('predefinedMax'), opt.min), opt.max);
|
247 |
+
opt['values'] = [_min, _max];
|
248 |
}
|
249 |
+
else opt['value'] = Math.min(Math.max(me._getAttr('predefined'), opt.min), opt.max);
|
250 |
|
251 |
opt['disabled'] = me.readonly;
|
252 |
|
253 |
+
opt['slide'] = opt['stop'] = (function(e){
|
254 |
+
return function(event, ui)
|
255 |
{
|
256 |
+
if(typeof ui.value != 'undefined') $(this).slider('value', ui.value);
|
257 |
+
if(typeof ui.values != 'undefined') $(this).slider('values', ui.values);
|
258 |
e._setFieldValue();
|
259 |
}
|
260 |
+
})(me);
|
261 |
+
$('#'+this.name+'_slider').slider(opt);
|
262 |
me._setFieldValue();
|
263 |
+
$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){ $('#'+me.name+'_slider').slider(opt); me._setFieldValue(); });
|
264 |
},
|
265 |
val:function(raw)
|
266 |
{
|
267 |
try{
|
268 |
raw = raw || false;
|
269 |
+
var e = $('[id="' + this.name + '"]:not(.ignore)');
|
270 |
+
return (e.length) ? ((raw) ? e.val() : JSON.parse(e.val())) : 0;
|
271 |
}
|
272 |
catch(err){return 0;}
|
273 |
},
|
274 |
+
setVal:function(v, nochange)
|
275 |
{
|
276 |
try{ v = JSON.parse(v); }catch(err){}
|
277 |
try{
|
278 |
+
$('[name="'+this.name+'"]').val(v);
|
279 |
$('#'+this.name+'_slider').slider((($.isArray(v)) ? 'values' : 'value'), v);
|
280 |
this._setFieldValue(nochange);
|
281 |
+
}catch(err){}
|
282 |
}
|
283 |
});
|
js/fields-public/03_fbuilder.fcolor.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"fcolor",
|
@@ -13,17 +13,15 @@
|
|
13 |
show:function()
|
14 |
{
|
15 |
this.predefined = this._getAttr('predefined');
|
16 |
-
return '<div class="fields '+this.csslayout+' '+this.name+' cff-color-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 aria-label="'
|
17 |
-
},
|
18 |
-
after_show:function()
|
19 |
-
{
|
20 |
},
|
|
|
21 |
val:function(raw, no_quotes)
|
22 |
{
|
23 |
raw = raw || false;
|
24 |
no_quotes = no_quotes || false;
|
25 |
-
var e = $(
|
26 |
-
if(
|
27 |
return 0;
|
28 |
}
|
29 |
}
|
1 |
+
$.fbuilder.controls['fcolor']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fcolor'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"fcolor",
|
13 |
show:function()
|
14 |
{
|
15 |
this.predefined = this._getAttr('predefined');
|
16 |
+
return '<div class="fields '+cff_esc_attr(this.csslayout)+' '+this.name+' cff-color-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 aria-label="'+cff_esc_attr(this.title)+'" id="'+this.name+'" name="'+this.name+'"'+' class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+' type="color" value="'+cff_esc_attr(this.predefined)+'" /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
|
|
|
|
|
|
17 |
},
|
18 |
+
after_show:function(){},
|
19 |
val:function(raw, no_quotes)
|
20 |
{
|
21 |
raw = raw || false;
|
22 |
no_quotes = no_quotes || false;
|
23 |
+
var e = $('[id="' + this.name + '"]:not(.ignore)');
|
24 |
+
if(e.length) return $.fbuilder.parseValStr(e.val(), raw, no_quotes);
|
25 |
return 0;
|
26 |
}
|
27 |
}
|
js/fields-public/03_fbuilder.femail.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Email",
|
7 |
ftype:"femail",
|
@@ -17,20 +17,20 @@
|
|
17 |
show:function()
|
18 |
{
|
19 |
this.predefined = this._getAttr('predefined');
|
20 |
-
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 aria-label="'
|
21 |
},
|
22 |
after_show:function()
|
23 |
{
|
24 |
-
if(
|
25 |
{
|
26 |
var parts = this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);
|
27 |
-
this.regExp = (
|
28 |
|
29 |
if(!('pattern' in $.validator.methods))
|
30 |
-
$.validator.addMethod(
|
31 |
{
|
32 |
try{
|
33 |
-
return this.optional(element) || param.test(
|
34 |
}
|
35 |
catch(err){return true;}
|
36 |
}
|
@@ -42,8 +42,8 @@
|
|
42 |
{
|
43 |
raw = raw || false;
|
44 |
no_quotes = no_quotes || false;
|
45 |
-
var e = $(
|
46 |
-
if(
|
47 |
return 0;
|
48 |
}
|
49 |
}
|
1 |
+
$.fbuilder.controls['femail'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['femail'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Email",
|
7 |
ftype:"femail",
|
17 |
show:function()
|
18 |
{
|
19 |
this.predefined = this._getAttr('predefined');
|
20 |
+
return '<div class="fields '+cff_esc_attr(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 aria-label="'+cff_esc_attr(this.title)+'" id="'+this.name+'" name="'+this.name+'" '+((this.equalTo!="")?"equalTo=\"#"+cff_esc_attr(this.equalTo+this.form_identifier)+"\"":"")+' class="field email '+this.size+((this.required)?" required":"")+'" type="email" value="'+cff_esc_attr(this.predefined)+'" '+((this.readonly)?'readonly':'')+' autocomplete="'+this.autocomplete+'" /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
21 |
},
|
22 |
after_show:function()
|
23 |
{
|
24 |
+
if(this.regExp != "" && typeof $['validator'] != 'undefined')
|
25 |
{
|
26 |
var parts = this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);
|
27 |
+
this.regExp = (parts === null) ? new RegExp(this.regExp) : new RegExp(parts[2],parts[4].toLowerCase());
|
28 |
|
29 |
if(!('pattern' in $.validator.methods))
|
30 |
+
$.validator.addMethod('pattern', function(value, element, param)
|
31 |
{
|
32 |
try{
|
33 |
+
return this.optional(element) || param.test(value);
|
34 |
}
|
35 |
catch(err){return true;}
|
36 |
}
|
42 |
{
|
43 |
raw = raw || false;
|
44 |
no_quotes = no_quotes || false;
|
45 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
46 |
+
if(e.length) return $.fbuilder.parseValStr(e.val(), raw, no_quotes);
|
47 |
return 0;
|
48 |
}
|
49 |
}
|
js/fields-public/04_fbuilder.fdate.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Date",
|
7 |
ftype:"fdate",
|
@@ -57,7 +57,7 @@
|
|
57 |
var me = this,
|
58 |
f = function(){
|
59 |
me.set_dateTime();
|
60 |
-
$(
|
61 |
};
|
62 |
|
63 |
$(document).off('change', '#'+me.name+'_date').on('change', '#'+me.name+'_date', function(){f();});
|
@@ -66,7 +66,7 @@
|
|
66 |
$(document).off('change', '#'+me.name+'_ampm').on('change', '#'+me.name+'_ampm', function(){f();});
|
67 |
|
68 |
$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){
|
69 |
-
setTimeout(
|
70 |
});
|
71 |
},
|
72 |
_validateDate: function(d)
|
@@ -79,12 +79,12 @@
|
|
79 |
|
80 |
d = d || n.datepicker('getDate');
|
81 |
|
82 |
-
if(
|
83 |
-
if(
|
84 |
{
|
85 |
-
for(
|
86 |
{
|
87 |
-
if(
|
88 |
}
|
89 |
}
|
90 |
|
@@ -95,22 +95,22 @@
|
|
95 |
|
96 |
if((_mi != null && d < _mi) || (_ma != null && _ma < d)) return false;
|
97 |
}
|
98 |
-
catch(
|
99 |
return true;
|
100 |
},
|
101 |
_validateTime : function()
|
102 |
{
|
103 |
var i = this;
|
104 |
-
if(
|
105 |
{
|
106 |
var n = i.name,
|
107 |
h = $('#'+n+'_hours').val(),
|
108 |
m = $('#'+n+'_minutes').val();
|
109 |
-
if(
|
110 |
{
|
111 |
var x = $('#'+n+'_ampm').val()
|
112 |
-
if(
|
113 |
-
if(
|
114 |
}
|
115 |
if(
|
116 |
h < i.minHour ||
|
@@ -124,35 +124,35 @@
|
|
124 |
init:function()
|
125 |
{
|
126 |
var me = this,
|
127 |
-
_checkValue = function(
|
128 |
{
|
129 |
-
v = parseInt(
|
130 |
-
v = (
|
131 |
return Math.min(Math.max(v,min),max);
|
132 |
};
|
133 |
|
134 |
// Date
|
135 |
me.dformat = me.dformat.replace(/\//g, me.dseparator);
|
136 |
-
me.invalidDates = me.invalidDates.replace(
|
137 |
-
if(
|
138 |
-
if(
|
139 |
{
|
140 |
-
var dateRegExp = new RegExp(
|
141 |
counter = 0,
|
142 |
-
dates = me.invalidDates.split(
|
143 |
me.invalidDates = [];
|
144 |
-
for(
|
145 |
{
|
146 |
-
var range = dates[
|
147 |
-
if(
|
148 |
{
|
149 |
-
var fromD = new Date(
|
150 |
-
toD = new Date(
|
151 |
-
while(
|
152 |
{
|
153 |
-
me.invalidDates[
|
154 |
-
var tmp = new Date(
|
155 |
-
tmp.setDate(
|
156 |
fromD = tmp;
|
157 |
counter++;
|
158 |
|
@@ -160,11 +160,11 @@
|
|
160 |
}
|
161 |
else
|
162 |
{
|
163 |
-
for(
|
164 |
{
|
165 |
-
if(
|
166 |
{
|
167 |
-
me.invalidDates[
|
168 |
counter++;
|
169 |
}
|
170 |
}
|
@@ -173,12 +173,12 @@
|
|
173 |
}
|
174 |
|
175 |
// Time
|
176 |
-
me.minHour = _checkValue(
|
177 |
-
me.maxHour = _checkValue(
|
178 |
-
me.minMinute = _checkValue(
|
179 |
-
me.maxMinute = _checkValue(
|
180 |
-
me.stepHour = _checkValue(
|
181 |
-
me.stepMinute = _checkValue(
|
182 |
|
183 |
// Set handles
|
184 |
me._setHndl('minDate');
|
@@ -190,16 +190,16 @@
|
|
190 |
str = '',
|
191 |
i = 0,
|
192 |
h,
|
193 |
-
from = (
|
194 |
-
to = (
|
195 |
|
196 |
-
while(
|
197 |
{
|
198 |
-
if(
|
199 |
-
str += '<option value="'
|
200 |
i++;
|
201 |
}
|
202 |
-
return '<select id="'+me.name+'_hours" name="'+me.name+'_hours" class="hours-component" aria-label="'
|
203 |
},
|
204 |
get_minutes:function()
|
205 |
{
|
@@ -210,33 +210,33 @@
|
|
210 |
n = (me.minHour == me.maxHour)?me.minMinute : 0,
|
211 |
x = (me.minHour == me.maxHour)?me.maxMinute : 59;
|
212 |
|
213 |
-
while(
|
214 |
{
|
215 |
-
if(
|
216 |
-
str += '<option value="'
|
217 |
i++;
|
218 |
}
|
219 |
-
return '<select id="'+me.name+'_minutes" name="'+me.name+'_minutes" class="minutes-component" aria-label="'
|
220 |
},
|
221 |
get_ampm:function()
|
222 |
{
|
223 |
var str = '';
|
224 |
-
if(
|
225 |
{
|
226 |
-
return '<select id="'+this.name+'_ampm" class="ampm-component" aria-label="'
|
227 |
}
|
228 |
return str;
|
229 |
},
|
230 |
set_dateTime:function(nochange)
|
231 |
{
|
232 |
var me = this,
|
233 |
-
str = $(
|
234 |
-
e = $(
|
235 |
-
if(
|
236 |
{
|
237 |
-
str += ' '+$(
|
238 |
-
str += ':'+$(
|
239 |
-
if(
|
240 |
}
|
241 |
e.val(str);
|
242 |
if(!nochange) e.change();
|
@@ -269,55 +269,55 @@
|
|
269 |
firstDay: (me.mondayFirstDay ? 1 : 0),
|
270 |
disabled: me.readonly
|
271 |
},
|
272 |
-
dp = $(
|
273 |
-
dd = (me.defaultDate != "") ? me.defaultDate : (
|
274 |
|
275 |
-
dp.click(
|
276 |
-
if(me.showDropdown
|
277 |
p = $.extend(p, {beforeShowDay:function(d){return [me._validateDate(d), ""];}});
|
278 |
if(me.defaultDate != "") p.defaultDate = me.defaultDate;
|
279 |
dp.datepicker(p);
|
280 |
-
if(!me.predefinedClick || !!init == false)dp.datepicker(
|
281 |
-
if(!me._validateDate()) dp.datepicker(
|
282 |
},
|
283 |
set_DefaultTime : function()
|
284 |
{
|
285 |
var me = this,
|
286 |
-
_setValue = function(
|
287 |
{
|
288 |
-
v = Math.min(
|
289 |
-
v = (
|
290 |
-
$(
|
291 |
};
|
292 |
|
293 |
-
if(
|
294 |
{
|
295 |
var parts, time = {}, tmp = 0, max_minutes = 59;
|
296 |
-
if(
|
297 |
{
|
298 |
-
time[
|
299 |
-
time[
|
300 |
}
|
301 |
else
|
302 |
{
|
303 |
var d = new Date();
|
304 |
-
time[
|
305 |
-
time[
|
306 |
}
|
307 |
|
308 |
-
time[
|
309 |
-
if(time[
|
310 |
-
if(me.maxHour <= time[
|
311 |
|
312 |
_setValue(
|
313 |
me.name+'_hours',
|
314 |
-
(
|
315 |
-
(
|
316 |
);
|
317 |
|
318 |
-
_setValue(
|
319 |
|
320 |
-
$(
|
321 |
}
|
322 |
},
|
323 |
show:function()
|
@@ -330,18 +330,18 @@
|
|
330 |
disabled = '',
|
331 |
date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required && me.showDatepicker)?' required': '');
|
332 |
|
333 |
-
if(
|
334 |
-
if(
|
335 |
else{ date_tag_type = 'hidden'; disabled='disabled';}
|
336 |
-
if(
|
337 |
this.predefined = this._getAttr('predefined');
|
338 |
-
return '<div class="fields '+me.csslayout+' '+n+' cff-date-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+n+'_date">'+me.title+''+((me.required)?"<span class='r'>*</span>":"")+(
|
339 |
},
|
340 |
after_show:function()
|
341 |
{
|
342 |
var me = this,
|
343 |
date_format = 'date'+me.dformat.replace(/[^a-z]/ig,""),
|
344 |
-
validator = function(
|
345 |
{
|
346 |
try
|
347 |
{
|
@@ -352,13 +352,13 @@
|
|
352 |
if(i != null) return this.optional(e) || (i._validateDate() && (new RegExp(o.r)).test(v) && i._validateTime());
|
353 |
return true;
|
354 |
}
|
355 |
-
catch(
|
356 |
{
|
357 |
return false;
|
358 |
}
|
359 |
};
|
360 |
|
361 |
-
if(!(date_format in $.validator.methods)) $.validator.addMethod(date_format, validator
|
362 |
|
363 |
me.set_DefaultDate(true);
|
364 |
me.set_DefaultTime();
|
@@ -370,51 +370,51 @@
|
|
370 |
raw = raw || false;
|
371 |
no_quotes = no_quotes || false;
|
372 |
var me = this,
|
373 |
-
e = $(
|
374 |
o = me._get_regexp();
|
375 |
|
376 |
-
if(
|
377 |
{
|
378 |
var v = e.val();
|
379 |
if(raw) return $.fbuilder.parseValStr(v, raw, no_quotes);
|
380 |
|
381 |
v = $.trim(e.val());
|
382 |
-
var re = new RegExp(
|
383 |
-
d = re.exec(
|
384 |
h = 0,
|
385 |
m = 0,
|
386 |
date;
|
387 |
|
388 |
-
if(
|
389 |
{
|
390 |
-
if(
|
391 |
-
if(
|
392 |
-
if(
|
393 |
{
|
394 |
-
var am = d[
|
395 |
-
if(am == 'pm' && h < 12
|
396 |
if(am == 'am' && h == 12) h -= 12;
|
397 |
}
|
398 |
-
switch(
|
399 |
{
|
400 |
case 'yyyy/dd/mm':
|
401 |
-
date = new Date(
|
402 |
break;
|
403 |
case 'yyyy/mm/dd':
|
404 |
-
date = new Date(
|
405 |
break;
|
406 |
case 'dd/mm/yyyy':
|
407 |
-
date = new Date(
|
408 |
break;
|
409 |
case 'mm/dd/yyyy':
|
410 |
-
date = new Date(
|
411 |
break;
|
412 |
}
|
413 |
|
414 |
if(isFinite(date))
|
415 |
{
|
416 |
-
if(
|
417 |
-
else return Math.ceil(
|
418 |
}
|
419 |
else if(!me.showDatepicker && me.showTimepicker)
|
420 |
return (h*3600000+m*60000)/86400000;
|
@@ -422,16 +422,16 @@
|
|
422 |
}
|
423 |
return 0;
|
424 |
},
|
425 |
-
setVal:function(
|
426 |
{
|
427 |
try
|
428 |
{
|
429 |
v = $.trim(v)
|
430 |
-
.replace(
|
431 |
-
.split(
|
432 |
if(this.showDatepicker)
|
433 |
{
|
434 |
-
this.defaultDate = v[
|
435 |
this.set_DefaultDate();
|
436 |
}
|
437 |
if(this.showTimepicker)
|
@@ -445,8 +445,7 @@
|
|
445 |
}
|
446 |
this.set_dateTime(nochange);
|
447 |
}
|
448 |
-
catch(
|
449 |
-
{}
|
450 |
}
|
451 |
}
|
452 |
);
|
1 |
+
$.fbuilder.controls['fdate'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fdate'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Date",
|
7 |
ftype:"fdate",
|
57 |
var me = this,
|
58 |
f = function(){
|
59 |
me.set_dateTime();
|
60 |
+
$('#'+me.name+'_date').valid();
|
61 |
};
|
62 |
|
63 |
$(document).off('change', '#'+me.name+'_date').on('change', '#'+me.name+'_date', function(){f();});
|
66 |
$(document).off('change', '#'+me.name+'_ampm').on('change', '#'+me.name+'_ampm', function(){f();});
|
67 |
|
68 |
$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){
|
69 |
+
setTimeout(function(){me.set_DefaultDate(true); me.set_DefaultTime(); me.set_dateTime();},500);
|
70 |
});
|
71 |
},
|
72 |
_validateDate: function(d)
|
79 |
|
80 |
d = d || n.datepicker('getDate');
|
81 |
|
82 |
+
if(d === null || !w[d.getDay()]) return false;
|
83 |
+
if(i !== null)
|
84 |
{
|
85 |
+
for(var j = 0, h = i.length; j < h; j++)
|
86 |
{
|
87 |
+
if(d.getDate() == i[j].getDate() && d.getMonth() == i[j].getMonth() && d.getFullYear() == i[j].getFullYear()) return false;
|
88 |
}
|
89 |
}
|
90 |
|
95 |
|
96 |
if((_mi != null && d < _mi) || (_ma != null && _ma < d)) return false;
|
97 |
}
|
98 |
+
catch(_err){return false;}
|
99 |
return true;
|
100 |
},
|
101 |
_validateTime : function()
|
102 |
{
|
103 |
var i = this;
|
104 |
+
if(i.showTimepicker)
|
105 |
{
|
106 |
var n = i.name,
|
107 |
h = $('#'+n+'_hours').val(),
|
108 |
m = $('#'+n+'_minutes').val();
|
109 |
+
if(i.tformat == 12)
|
110 |
{
|
111 |
var x = $('#'+n+'_ampm').val()
|
112 |
+
if(x == 'pm' && h != 12) h = h*1+12;
|
113 |
+
if(x == 'am' && h == 12) h = 0;
|
114 |
}
|
115 |
if(
|
116 |
h < i.minHour ||
|
124 |
init:function()
|
125 |
{
|
126 |
var me = this,
|
127 |
+
_checkValue = function(v, min, max)
|
128 |
{
|
129 |
+
v = parseInt(v);
|
130 |
+
v = (isNaN(v)) ? max : v;
|
131 |
return Math.min(Math.max(v,min),max);
|
132 |
};
|
133 |
|
134 |
// Date
|
135 |
me.dformat = me.dformat.replace(/\//g, me.dseparator);
|
136 |
+
me.invalidDates = me.invalidDates.replace(/\s+/g, '');
|
137 |
+
if(me.dropdownRange.indexOf(':') == -1) me.dropdownRange = '-10:+10';
|
138 |
+
if(!/^\s*$/.test(me.invalidDates))
|
139 |
{
|
140 |
+
var dateRegExp = new RegExp(/^\d{1,2}\/\d{1,2}\/\d{4}$/),
|
141 |
counter = 0,
|
142 |
+
dates = me.invalidDates.split(',');
|
143 |
me.invalidDates = [];
|
144 |
+
for(var i = 0, h = dates.length; i < h; i++)
|
145 |
{
|
146 |
+
var range = dates[i].split('-');
|
147 |
+
if(range.length == 2 && range[0].match(dateRegExp) != null && range[1].match(dateRegExp) != null)
|
148 |
{
|
149 |
+
var fromD = new Date(range[0]),
|
150 |
+
toD = new Date(range[1]);
|
151 |
+
while(fromD <= toD)
|
152 |
{
|
153 |
+
me.invalidDates[counter] = fromD;
|
154 |
+
var tmp = new Date(fromD.valueOf());
|
155 |
+
tmp.setDate(tmp.getDate()+1);
|
156 |
fromD = tmp;
|
157 |
counter++;
|
158 |
|
160 |
}
|
161 |
else
|
162 |
{
|
163 |
+
for(var j = 0, k = range.length; j < k; j++)
|
164 |
{
|
165 |
+
if(range[j].match(dateRegExp) != null)
|
166 |
{
|
167 |
+
me.invalidDates[counter] = new Date(range[j]);
|
168 |
counter++;
|
169 |
}
|
170 |
}
|
173 |
}
|
174 |
|
175 |
// Time
|
176 |
+
me.minHour = _checkValue(me.minHour, 0, 23);
|
177 |
+
me.maxHour = _checkValue(me.maxHour, 0, 23);
|
178 |
+
me.minMinute = _checkValue(me.minMinute, 0, 59);
|
179 |
+
me.maxMinute = _checkValue(me.maxMinute, 0, 59);
|
180 |
+
me.stepHour = _checkValue(me.stepHour, 1, Math.max(1, (me.maxHour - me.minHour)+1));
|
181 |
+
me.stepMinute = _checkValue(me.stepMinute, 1, Math.max(1, (me.maxMinute - me.minMinute)+1));
|
182 |
|
183 |
// Set handles
|
184 |
me._setHndl('minDate');
|
190 |
str = '',
|
191 |
i = 0,
|
192 |
h,
|
193 |
+
from = (me.tformat == 12) ? 1 : me.minHour,
|
194 |
+
to = (me.tformat == 12) ? 12 : me.maxHour;
|
195 |
|
196 |
+
while((h = from+me.stepHour * i) <= to)
|
197 |
{
|
198 |
+
if(h < 10) h = '0'+''+h;
|
199 |
+
str += '<option value="'+h+'">'+h+'</option>';
|
200 |
i++;
|
201 |
}
|
202 |
+
return '<select id="'+me.name+'_hours" name="'+me.name+'_hours" class="hours-component" aria-label="'+cff_esc_attr(me.ariaHourLabel)+'" '+((me.readonly) ? 'DISABLED' : '')+'>'+str+'</select>:';
|
203 |
},
|
204 |
get_minutes:function()
|
205 |
{
|
210 |
n = (me.minHour == me.maxHour)?me.minMinute : 0,
|
211 |
x = (me.minHour == me.maxHour)?me.maxMinute : 59;
|
212 |
|
213 |
+
while((m = n+me.stepMinute * i) <= x)
|
214 |
{
|
215 |
+
if(m < 10) m = '0'+''+m;
|
216 |
+
str += '<option value="'+m+'">'+m+'</option>';
|
217 |
i++;
|
218 |
}
|
219 |
+
return '<select id="'+me.name+'_minutes" name="'+me.name+'_minutes" class="minutes-component" aria-label="'+cff_esc_attr(me.ariaMinuteLabel)+'" '+((me.readonly) ? 'DISABLED' : '')+'>'+str+'</select>';
|
220 |
},
|
221 |
get_ampm:function()
|
222 |
{
|
223 |
var str = '';
|
224 |
+
if(this.tformat == 12)
|
225 |
{
|
226 |
+
return '<select id="'+this.name+'_ampm" class="ampm-component" aria-label="'+cff_esc_attr(this.ariaAMPMLabel)+'" '+((this.readonly) ? 'DISABLED' : '')+'><option value="am">am</option><option value="pm">pm</option></select>';
|
227 |
}
|
228 |
return str;
|
229 |
},
|
230 |
set_dateTime:function(nochange)
|
231 |
{
|
232 |
var me = this,
|
233 |
+
str = $('#'+me.name+'_date').val(),
|
234 |
+
e = $('#'+me.name);
|
235 |
+
if(me.showTimepicker)
|
236 |
{
|
237 |
+
str += ' '+$('#'+me.name+'_hours').val();
|
238 |
+
str += ':'+$('#'+me.name+'_minutes').val();
|
239 |
+
if($('#'+me.name+'_ampm').length) str += $('#'+me.name+'_ampm').val();
|
240 |
}
|
241 |
e.val(str);
|
242 |
if(!nochange) e.change();
|
269 |
firstDay: (me.mondayFirstDay ? 1 : 0),
|
270 |
disabled: me.readonly
|
271 |
},
|
272 |
+
dp = $("#"+me.name+"_date"),
|
273 |
+
dd = (me.defaultDate != "") ? me.defaultDate : ((me.predefined != "") ? me.predefined : new Date());
|
274 |
|
275 |
+
dp.click(function(){ $(document).click(); $(this).focus(); });
|
276 |
+
if(me.showDropdown) p = $.extend(p,{changeMonth: true,changeYear: true,yearRange: me.dropdownRange});
|
277 |
p = $.extend(p, {beforeShowDay:function(d){return [me._validateDate(d), ""];}});
|
278 |
if(me.defaultDate != "") p.defaultDate = me.defaultDate;
|
279 |
dp.datepicker(p);
|
280 |
+
if(!me.predefinedClick || !!init == false)dp.datepicker("setDate", dd);
|
281 |
+
if(!me._validateDate()) dp.datepicker("setDate", '');
|
282 |
},
|
283 |
set_DefaultTime : function()
|
284 |
{
|
285 |
var me = this,
|
286 |
+
_setValue = function(f, v, m)
|
287 |
{
|
288 |
+
v = Math.min(v*1, m*1);
|
289 |
+
v = (v < 10) ? 0+''+v : v;
|
290 |
+
$('#'+f+' [value="'+v+'"]').prop('selected', true);
|
291 |
};
|
292 |
|
293 |
+
if(me.showTimepicker)
|
294 |
{
|
295 |
var parts, time = {}, tmp = 0, max_minutes = 59;
|
296 |
+
if((parts = /(\d{1,2}):(\d{1,2})\s*([ap]m)?/gi.exec(me.defaultTime)) != null)
|
297 |
{
|
298 |
+
time['hour'] = parts[1]*1+((parts.length == 4 && /pm/i.test(parts[3]) && parts[1] != 12) ? 12 : 0);
|
299 |
+
time['minute'] = parts[2];
|
300 |
}
|
301 |
else
|
302 |
{
|
303 |
var d = new Date();
|
304 |
+
time['hour'] = d.getHours();
|
305 |
+
time['minute'] = d.getMinutes();
|
306 |
}
|
307 |
|
308 |
+
time['hour'] = Math.min(Math.max(time['hour'], me.minHour), me.maxHour);
|
309 |
+
if(time['hour'] <= me.minHour) time['minute'] = Math.max(time['minute'],me.minMinute);
|
310 |
+
if(me.maxHour <= time['hour']) time['minute'] = Math.min(time['minute'],me.maxMinute);
|
311 |
|
312 |
_setValue(
|
313 |
me.name+'_hours',
|
314 |
+
(me.tformat == 12) ? ((time['hour'] > 12) ? time['hour'] - 12 : ((time['hour'] == 0) ? 12 : time['hour'])) : time['hour'],
|
315 |
+
(me.tformat == 12) ? 12 : me.maxHour
|
316 |
);
|
317 |
|
318 |
+
_setValue(me.name+'_minutes', time['minute'], (time['hour'] == me.maxHour) ? me.maxMinute : 59);
|
319 |
|
320 |
+
$('#'+me.name+'_ampm'+' [value="'+((time['hour'] < 12) ? 'am' : 'pm')+'"]').prop('selected', true);
|
321 |
}
|
322 |
},
|
323 |
show:function()
|
330 |
disabled = '',
|
331 |
date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required && me.showDatepicker)?' required': '');
|
332 |
|
333 |
+
if(me.predefinedClick) attr = 'placeholder';
|
334 |
+
if(me.showDatepicker) format_label.push(me.dformat);
|
335 |
else{ date_tag_type = 'hidden'; disabled='disabled';}
|
336 |
+
if(me.showTimepicker) format_label.push('HH:mm');
|
337 |
this.predefined = this._getAttr('predefined');
|
338 |
+
return '<div class="fields '+cff_esc_attr(me.csslayout)+' '+n+' cff-date-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+n+'_date">'+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="'+cff_esc_attr(me.predefined)+'"/><input aria-label="'+cff_esc_attr(me.title)+'" id="'+n+'_date" name="'+n+'_date" class="'+date_tag_class+' date-component" type="'+date_tag_type+'" '+attr+'="'+cff_esc_attr(me.predefined)+'" '+disabled+(me.disableKeyboardOnMobile ? ' inputmode="none"' : '')+' />'+((me.showTimepicker) ? ' '+me.get_hours()+me.get_minutes()+' '+me.get_ampm() : '')+'<span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
|
339 |
},
|
340 |
after_show:function()
|
341 |
{
|
342 |
var me = this,
|
343 |
date_format = 'date'+me.dformat.replace(/[^a-z]/ig,""),
|
344 |
+
validator = function(v, e)
|
345 |
{
|
346 |
try
|
347 |
{
|
352 |
if(i != null) return this.optional(e) || (i._validateDate() && (new RegExp(o.r)).test(v) && i._validateTime());
|
353 |
return true;
|
354 |
}
|
355 |
+
catch(er)
|
356 |
{
|
357 |
return false;
|
358 |
}
|
359 |
};
|
360 |
|
361 |
+
if(!(date_format in $.validator.methods)) $.validator.addMethod(date_format, validator);
|
362 |
|
363 |
me.set_DefaultDate(true);
|
364 |
me.set_DefaultTime();
|
370 |
raw = raw || false;
|
371 |
no_quotes = no_quotes || false;
|
372 |
var me = this,
|
373 |
+
e = $('[id="'+me.name+'"]:not(.ignore)'),
|
374 |
o = me._get_regexp();
|
375 |
|
376 |
+
if(e.length)
|
377 |
{
|
378 |
var v = e.val();
|
379 |
if(raw) return $.fbuilder.parseValStr(v, raw, no_quotes);
|
380 |
|
381 |
v = $.trim(e.val());
|
382 |
+
var re = new RegExp('('+o.r+')?(\\s*(\\d{1,2})[:\\.](\\d{1,2})\\s*([amp]{2})?)?'),
|
383 |
+
d = re.exec(v),
|
384 |
h = 0,
|
385 |
m = 0,
|
386 |
date;
|
387 |
|
388 |
+
if(d)
|
389 |
{
|
390 |
+
if(typeof d[6] != 'undefined') h = d[6]*1;
|
391 |
+
if(typeof d[7] != 'undefined') m = d[7]*1;
|
392 |
+
if(typeof d[8] != 'undefined')
|
393 |
{
|
394 |
+
var am = d[8].toLowerCase();
|
395 |
+
if(am == 'pm' && h < 12) h += 12;
|
396 |
if(am == 'am' && h == 12) h -= 12;
|
397 |
}
|
398 |
+
switch(o.d)
|
399 |
{
|
400 |
case 'yyyy/dd/mm':
|
401 |
+
date = new Date(d[2], (d[4] * 1 - 1), d[3], h, m, 0, 0);
|
402 |
break;
|
403 |
case 'yyyy/mm/dd':
|
404 |
+
date = new Date(d[2], (d[3] * 1 - 1), d[4], h, m, 0, 0);
|
405 |
break;
|
406 |
case 'dd/mm/yyyy':
|
407 |
+
date = new Date(d[4], (d[3] * 1 - 1), d[2], h, m, 0, 0);
|
408 |
break;
|
409 |
case 'mm/dd/yyyy':
|
410 |
+
date = new Date(d[4], (d[2] * 1 - 1), d[3], h, m, 0, 0);
|
411 |
break;
|
412 |
}
|
413 |
|
414 |
if(isFinite(date))
|
415 |
{
|
416 |
+
if(me.showTimepicker) return date.valueOf()/86400000;
|
417 |
+
else return Math.ceil(date.valueOf()/86400000);
|
418 |
}
|
419 |
else if(!me.showDatepicker && me.showTimepicker)
|
420 |
return (h*3600000+m*60000)/86400000;
|
422 |
}
|
423 |
return 0;
|
424 |
},
|
425 |
+
setVal:function(v, nochange)
|
426 |
{
|
427 |
try
|
428 |
{
|
429 |
v = $.trim(v)
|
430 |
+
.replace(/\s+/g, ' ')
|
431 |
+
.split(' ');
|
432 |
if(this.showDatepicker)
|
433 |
{
|
434 |
+
this.defaultDate = v[0];
|
435 |
this.set_DefaultDate();
|
436 |
}
|
437 |
if(this.showTimepicker)
|
445 |
}
|
446 |
this.set_dateTime(nochange);
|
447 |
}
|
448 |
+
catch(err){}
|
|
|
449 |
}
|
450 |
}
|
451 |
);
|
js/fields-public/05_fbuilder.ftextarea.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"ftextarea",
|
@@ -16,17 +16,17 @@
|
|
16 |
rows:4,
|
17 |
show:function()
|
18 |
{
|
19 |
-
this.minlength =
|
20 |
-
this.maxlength =
|
21 |
this.predefined = this._getAttr('predefined');
|
22 |
-
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 aria-label="'
|
23 |
},
|
24 |
val:function(raw, no_quotes)
|
25 |
{
|
26 |
raw = raw || false;
|
27 |
no_quotes = no_quotes || false;
|
28 |
-
var e = $(
|
29 |
-
if(
|
30 |
return 0;
|
31 |
}
|
32 |
}
|
1 |
+
$.fbuilder.controls['ftextarea'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['ftextarea'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"ftextarea",
|
16 |
rows:4,
|
17 |
show:function()
|
18 |
{
|
19 |
+
this.minlength = cff_esc_attr($.trim(this.minlength));
|
20 |
+
this.maxlength = cff_esc_attr($.trim(this.maxlength));
|
21 |
this.predefined = this._getAttr('predefined');
|
22 |
+
return '<div class="fields '+cff_esc_attr(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 aria-label="'+cff_esc_attr(this.title)+'" '+((!/^\s*$/.test(this.rows)) ? 'rows='+this.rows : '')+' id="'+this.name+'" name="'+this.name+'"'+((this.minlength.length) ? ' minlength="'+cff_esc_attr(this.minlength)+'"' : '')+((this.maxlength.length) ? ' maxlength="'+cff_esc_attr(this.maxlength)+'"' : '')+' class="field '+this.size+((this.required)?" required":"")+'" '+((this.readonly)?'readonly':'')+' autocomplete="'+this.autocomplete+'">'+((!this.predefinedClick) ? this.predefined : '')+'</textarea><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
23 |
},
|
24 |
val:function(raw, no_quotes)
|
25 |
{
|
26 |
raw = raw || false;
|
27 |
no_quotes = no_quotes || false;
|
28 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
29 |
+
if(e.length) return $.fbuilder.parseValStr(e.val().replace(/[\n\r]+/g, ' '), raw, no_quotes);
|
30 |
return 0;
|
31 |
}
|
32 |
}
|
js/fields-public/06_fbuilder.fcheck.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Check All That Apply",
|
7 |
ftype:"fcheck",
|
@@ -20,24 +20,24 @@
|
|
20 |
var str = "",
|
21 |
classDep;
|
22 |
|
23 |
-
if (
|
24 |
this.choicesDep = new Array();
|
25 |
|
26 |
for (var i=0, h=this.choices.length; i<h; i++)
|
27 |
{
|
28 |
-
if(
|
29 |
this.choicesDep[i] = $.grep(this.choicesDep[i],function(n){ return n != ""; });
|
30 |
else
|
31 |
this.choicesDep[i] = [];
|
32 |
|
33 |
-
classDep = (this.choicesDep[
|
34 |
|
35 |
-
str += '<div class="'+this.layout+'"><label for="'+this.name+'_cb'+i+'"><input aria-label="'
|
36 |
(this.onoff ? '<span class="cff-switch"></span>': '') +
|
37 |
'<span>'+
|
38 |
-
|
39 |
}
|
40 |
-
return '<div class="fields '+this.csslayout+(this.onoff ? ' cff-switch-container' : '')+' '+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+'<div class="clearer"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
41 |
},
|
42 |
enable_disable:function()
|
43 |
{
|
@@ -57,59 +57,59 @@
|
|
57 |
if(0 < m.max)
|
58 |
$('[id*="'+m.name+'"]').rules('add',{maxlength:m.max, messages:{maxlength:m.maxError}});
|
59 |
},
|
60 |
-
showHideDep:function(
|
61 |
{
|
62 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
63 |
var me = this,
|
64 |
-
item = $(
|
65 |
form_identifier = me.form_identifier,
|
66 |
-
isHidden = (typeof toHide[
|
67 |
result = [];
|
68 |
|
69 |
try
|
70 |
{
|
71 |
item.each(function(i,e){
|
72 |
-
if(
|
73 |
{
|
74 |
var checked = e.checked;
|
75 |
-
for(
|
76 |
{
|
77 |
if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
|
78 |
var dep = me.choicesDep[i][j]+form_identifier;
|
79 |
-
if(
|
80 |
{
|
81 |
-
if(
|
82 |
{
|
83 |
-
delete toShow[
|
84 |
-
if(
|
85 |
-
delete toShow[
|
86 |
}
|
87 |
|
88 |
-
if(
|
89 |
{
|
90 |
-
$(
|
91 |
-
$(
|
92 |
-
toHide[
|
93 |
}
|
94 |
}
|
95 |
else
|
96 |
{
|
97 |
-
delete toHide[
|
98 |
-
if(
|
99 |
-
toShow[
|
100 |
-
toShow[
|
101 |
if(!(dep in hiddenByContainer))
|
102 |
{
|
103 |
-
$(
|
104 |
-
$(
|
105 |
}
|
106 |
}
|
107 |
-
if($.inArray(dep,result) == -1) result.push(
|
108 |
}
|
109 |
}
|
110 |
});
|
111 |
}
|
112 |
-
catch(
|
113 |
return result;
|
114 |
},
|
115 |
val:function(raw, no_quotes)
|
@@ -117,12 +117,12 @@
|
|
117 |
raw = raw || false;
|
118 |
no_quotes = no_quotes || false;
|
119 |
var v, me = this, m = me.merge && !raw,
|
120 |
-
e = $('[id*="'
|
121 |
|
122 |
if(!m) v = [];
|
123 |
-
if(
|
124 |
{
|
125 |
-
e.each(
|
126 |
var t = (m) ? $.fbuilder.parseVal(this.value) : $.fbuilder.parseValStr((raw == 'vt') ? this.getAttribute('vt') : this.value, raw, no_quotes);
|
127 |
if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
|
128 |
if(m) v = (v)?v+t:t;
|
@@ -131,24 +131,24 @@
|
|
131 |
}
|
132 |
return (typeof v == 'object' && typeof v['length'] !== 'undefined') ? v : ((v) ? (($.isNumeric(v)) ? v : '"'+v+'"') : 0);
|
133 |
},
|
134 |
-
setVal:function(
|
135 |
{
|
136 |
_default = _default || false;
|
137 |
nochange = nochange || false;
|
138 |
|
139 |
var t, n = this.name, c = 0, e;
|
140 |
-
if(
|
141 |
-
$(
|
142 |
-
for(
|
143 |
{
|
144 |
t = (new String(v[i])).replace(/(['"])/g, "\\$1");
|
145 |
if(0 < this.max && c+1 == this.max) break;
|
146 |
if(_default) e = $('[id*="'+n+'"][vt="'+t+'"]');
|
147 |
if(!_default || !e.length) e = $('[id*="'+n+'"][value="'+t+'"]');
|
148 |
-
if(e.length) e.prop(
|
149 |
}
|
150 |
this.enable_disable();
|
151 |
-
if(!nochange) $(
|
152 |
},
|
153 |
setChoices:function(choices)
|
154 |
{
|
@@ -167,7 +167,7 @@
|
|
167 |
return (typeof y == 'number') ? 'fieldname'+parseInt(y) : y;
|
168 |
}) : x;
|
169 |
}
|
170 |
-
|
171 |
}
|
172 |
var html = me.show(),
|
173 |
e = $('.'+me.name),
|
1 |
+
$.fbuilder.controls['fcheck']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fcheck'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Check All That Apply",
|
7 |
ftype:"fcheck",
|
20 |
var str = "",
|
21 |
classDep;
|
22 |
|
23 |
+
if (typeof this.choicesDep == "undefined" || this.choicesDep == null)
|
24 |
this.choicesDep = new Array();
|
25 |
|
26 |
for (var i=0, h=this.choices.length; i<h; i++)
|
27 |
{
|
28 |
+
if(typeof this.choicesDep[i] != 'undefined')
|
29 |
this.choicesDep[i] = $.grep(this.choicesDep[i],function(n){ return n != ""; });
|
30 |
else
|
31 |
this.choicesDep[i] = [];
|
32 |
|
33 |
+
classDep = (this.choicesDep[i].length) ? 'depItem': '';
|
34 |
|
35 |
+
str += '<div class="'+this.layout+'"><label for="'+this.name+'_cb'+i+'"><input aria-label="'+cff_esc_attr(this.choices[i])+'" name="'+this.name+'[]" id="'+this.name+'_cb'+i+'" class="field '+classDep+' group '+((this.required)?" required":"")+'" value="'+cff_esc_attr(this.choicesVal[i])+'" vt="'+cff_esc_attr((this.toSubmit == 'text') ? this.choices[i] : this.choicesVal[i])+'" type="checkbox" '+(this.readonly ? ' onclick="return false;" ' : '')+((this.choiceSelected[i])?"checked":"")+'/> '+
|
36 |
(this.onoff ? '<span class="cff-switch"></span>': '') +
|
37 |
'<span>'+
|
38 |
+
cff_html_decode(this.choices[i])+'</span></label></div>';
|
39 |
}
|
40 |
+
return '<div class="fields '+cff_esc_attr(this.csslayout)+(this.onoff ? ' cff-switch-container' : '')+' '+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+'<div class="clearer"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
41 |
},
|
42 |
enable_disable:function()
|
43 |
{
|
57 |
if(0 < m.max)
|
58 |
$('[id*="'+m.name+'"]').rules('add',{maxlength:m.max, messages:{maxlength:m.maxError}});
|
59 |
},
|
60 |
+
showHideDep:function(toShow, toHide, hiddenByContainer, interval)
|
61 |
{
|
62 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
63 |
var me = this,
|
64 |
+
item = $('input[id*="'+me.name+'"]'),
|
65 |
form_identifier = me.form_identifier,
|
66 |
+
isHidden = (typeof toHide[me.name] != 'undefined' || typeof hiddenByContainer[me.name] != 'undefined'),
|
67 |
result = [];
|
68 |
|
69 |
try
|
70 |
{
|
71 |
item.each(function(i,e){
|
72 |
+
if(typeof me.choicesDep[i] != 'undefined' && me.choicesDep[i].length)
|
73 |
{
|
74 |
var checked = e.checked;
|
75 |
+
for(var j = 0, k = me.choicesDep[i].length; j < k; j++)
|
76 |
{
|
77 |
if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
|
78 |
var dep = me.choicesDep[i][j]+form_identifier;
|
79 |
+
if(isHidden || !checked)
|
80 |
{
|
81 |
+
if(typeof toShow[dep] != 'undefined')
|
82 |
{
|
83 |
+
delete toShow[dep]['ref'][me.name+'_'+i];
|
84 |
+
if($.isEmptyObject(toShow[dep]['ref']))
|
85 |
+
delete toShow[dep];
|
86 |
}
|
87 |
|
88 |
+
if(typeof toShow[dep] == 'undefined')
|
89 |
{
|
90 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').hide();
|
91 |
+
$('[id*="'+dep+'"]:not(.ignore)').addClass('ignore');
|
92 |
+
toHide[dep] = {};
|
93 |
}
|
94 |
}
|
95 |
else
|
96 |
{
|
97 |
+
delete toHide[dep];
|
98 |
+
if(typeof toShow[dep] == 'undefined')
|
99 |
+
toShow[dep] = { 'ref': {}};
|
100 |
+
toShow[dep]['ref'][me.name+'_'+i] = 1;
|
101 |
if(!(dep in hiddenByContainer))
|
102 |
{
|
103 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').fadeIn(interval || 0);
|
104 |
+
$('[id*="'+dep+'"].ignore').removeClass('ignore');
|
105 |
}
|
106 |
}
|
107 |
+
if($.inArray(dep,result) == -1) result.push(dep);
|
108 |
}
|
109 |
}
|
110 |
});
|
111 |
}
|
112 |
+
catch(e){ }
|
113 |
return result;
|
114 |
},
|
115 |
val:function(raw, no_quotes)
|
117 |
raw = raw || false;
|
118 |
no_quotes = no_quotes || false;
|
119 |
var v, me = this, m = me.merge && !raw,
|
120 |
+
e = $('[id*="'+me.name+'"]:checked:not(.ignore)');
|
121 |
|
122 |
if(!m) v = [];
|
123 |
+
if(e.length)
|
124 |
{
|
125 |
+
e.each(function(){
|
126 |
var t = (m) ? $.fbuilder.parseVal(this.value) : $.fbuilder.parseValStr((raw == 'vt') ? this.getAttribute('vt') : this.value, raw, no_quotes);
|
127 |
if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
|
128 |
if(m) v = (v)?v+t:t;
|
131 |
}
|
132 |
return (typeof v == 'object' && typeof v['length'] !== 'undefined') ? v : ((v) ? (($.isNumeric(v)) ? v : '"'+v+'"') : 0);
|
133 |
},
|
134 |
+
setVal:function(v, nochange, _default)
|
135 |
{
|
136 |
_default = _default || false;
|
137 |
nochange = nochange || false;
|
138 |
|
139 |
var t, n = this.name, c = 0, e;
|
140 |
+
if(!$.isArray(v)) v = [v];
|
141 |
+
$('[id*="'+n+'"]').prop('checked', false);
|
142 |
+
for(var i in v)
|
143 |
{
|
144 |
t = (new String(v[i])).replace(/(['"])/g, "\\$1");
|
145 |
if(0 < this.max && c+1 == this.max) break;
|
146 |
if(_default) e = $('[id*="'+n+'"][vt="'+t+'"]');
|
147 |
if(!_default || !e.length) e = $('[id*="'+n+'"][value="'+t+'"]');
|
148 |
+
if(e.length) e.prop('checked', true);
|
149 |
}
|
150 |
this.enable_disable();
|
151 |
+
if(!nochange) $('[id*="'+n+'"]').change();
|
152 |
},
|
153 |
setChoices:function(choices)
|
154 |
{
|
167 |
return (typeof y == 'number') ? 'fieldname'+parseInt(y) : y;
|
168 |
}) : x;
|
169 |
}
|
170 |
+
);
|
171 |
}
|
172 |
var html = me.show(),
|
173 |
e = $('.'+me.name),
|
js/fields-public/07_fbuilder.fradio.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Select a Choice",
|
7 |
ftype:"fradio",
|
@@ -21,28 +21,28 @@
|
|
21 |
str = "",
|
22 |
classDep = "";
|
23 |
|
24 |
-
if (
|
25 |
this.choicesDep = new Array();
|
26 |
|
27 |
for (var i=0;i<l;i++)
|
28 |
{
|
29 |
-
if(
|
30 |
this.choicesDep[i] = $.grep(this.choicesDep[i],function(n){ return n != ""; });
|
31 |
else
|
32 |
this.choicesDep[i] = [];
|
33 |
|
34 |
-
if(
|
35 |
classDep = 'depItem';
|
36 |
}
|
37 |
|
38 |
for (var i=0;i<l;i++)
|
39 |
{
|
40 |
-
str += '<div class="'+this.layout+'"><label for="'+this.name+'_rb'+i+'"><input aria-label="'
|
41 |
(this.onoff ? '<span class="cff-switch"></span>': '') +
|
42 |
-
'<span>'
|
43 |
}
|
44 |
|
45 |
-
return '<div class="fields '+this.csslayout+(this.onoff ? ' cff-switch-container' : '')+' '+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+'<div class="clearer"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
46 |
},
|
47 |
after_show: function()
|
48 |
{
|
@@ -60,80 +60,80 @@
|
|
60 |
});
|
61 |
}
|
62 |
},
|
63 |
-
showHideDep:function(
|
64 |
{
|
65 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
66 |
var me = this,
|
67 |
-
item = $(
|
68 |
form_identifier = me.form_identifier,
|
69 |
-
isHidden = (
|
70 |
result = [];
|
71 |
|
72 |
try
|
73 |
{
|
74 |
item.each(function(i,e){
|
75 |
-
if(
|
76 |
{
|
77 |
var checked = e.checked;
|
78 |
-
for(
|
79 |
{
|
80 |
if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
|
81 |
var dep = me.choicesDep[i][j]+form_identifier;
|
82 |
if(isHidden || !checked)
|
83 |
{
|
84 |
-
if(typeof toShow[
|
85 |
{
|
86 |
-
delete toShow[
|
87 |
-
if(
|
88 |
-
delete toShow[
|
89 |
}
|
90 |
|
91 |
-
if(
|
92 |
{
|
93 |
-
$(
|
94 |
-
$(
|
95 |
-
toHide[
|
96 |
}
|
97 |
}
|
98 |
else
|
99 |
{
|
100 |
-
delete toHide[
|
101 |
-
if(
|
102 |
-
toShow[
|
103 |
-
toShow[
|
104 |
if(!(dep in hiddenByContainer))
|
105 |
{
|
106 |
-
$(
|
107 |
-
$(
|
108 |
}
|
109 |
}
|
110 |
-
if($.inArray(dep,result) == -1) result.push(
|
111 |
}
|
112 |
}
|
113 |
});
|
114 |
}
|
115 |
-
catch(
|
116 |
return result;
|
117 |
},
|
118 |
val:function(raw, no_quotes)
|
119 |
{
|
120 |
raw = raw || false;
|
121 |
no_quotes = no_quotes || false;
|
122 |
-
var e = $(
|
123 |
-
if(
|
124 |
return 0;
|
125 |
},
|
126 |
-
setVal:function(
|
127 |
{
|
128 |
_default = _default || false;
|
129 |
nochange = nochange || false;
|
130 |
|
131 |
var t = (new String(v)).replace(/(['"])/g, "\\$1"), n = this.name, e;
|
132 |
-
$(
|
133 |
if(_default) e = $('[id*="'+n+'"][vt="'+t+'"]');
|
134 |
if(!_default || !e.length) e = $('[id*="'+n+'"][value="'+t+'"]');
|
135 |
-
if(e.length) e.prop(
|
136 |
-
if(!nochange) $(
|
137 |
},
|
138 |
setChoices:function(choices)
|
139 |
{
|
@@ -151,7 +151,7 @@
|
|
151 |
return (typeof y == 'number') ? 'fieldname'+parseInt(y) : y;
|
152 |
}) : x;
|
153 |
}
|
154 |
-
|
155 |
}
|
156 |
var html = this.show(),
|
157 |
e = $('.'+this.name),
|
1 |
+
$.fbuilder.controls['fradio']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fradio'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Select a Choice",
|
7 |
ftype:"fradio",
|
21 |
str = "",
|
22 |
classDep = "";
|
23 |
|
24 |
+
if (typeof this.choicesDep == "undefined" || this.choicesDep == null)
|
25 |
this.choicesDep = new Array();
|
26 |
|
27 |
for (var i=0;i<l;i++)
|
28 |
{
|
29 |
+
if(typeof this.choicesDep[i] != 'undefined')
|
30 |
this.choicesDep[i] = $.grep(this.choicesDep[i],function(n){ return n != ""; });
|
31 |
else
|
32 |
this.choicesDep[i] = [];
|
33 |
|
34 |
+
if(this.choicesDep[i].length)
|
35 |
classDep = 'depItem';
|
36 |
}
|
37 |
|
38 |
for (var i=0;i<l;i++)
|
39 |
{
|
40 |
+
str += '<div class="'+this.layout+'"><label for="'+this.name+'_rb'+i+'"><input aria-label="'+cff_esc_attr(this.choices[i])+'" name="'+this.name+'" id="'+this.name+'_rb'+i+'" class="field '+classDep+' group '+((this.required)?" required":"")+'" value="'+cff_esc_attr(this.choicesVal[i])+'" vt="'+cff_esc_attr((this.toSubmit=='text') ? this.choices[i] : this.choicesVal[i])+'" type="radio" '+(this.readonly ? ' onclick="return false;" ' : '')+((this.choices[i]+' - '+this.choicesVal[i]==this.choiceSelected)?"checked":"")+'/> '+
|
41 |
(this.onoff ? '<span class="cff-switch"></span>': '') +
|
42 |
+
'<span>'+cff_html_decode(this.choices[i])+'</span></label></div>';
|
43 |
}
|
44 |
|
45 |
+
return '<div class="fields '+cff_esc_attr(this.csslayout)+(this.onoff ? ' cff-switch-container' : '')+' '+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+'<div class="clearer"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
46 |
},
|
47 |
after_show: function()
|
48 |
{
|
60 |
});
|
61 |
}
|
62 |
},
|
63 |
+
showHideDep:function(toShow, toHide, hiddenByContainer, interval)
|
64 |
{
|
65 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
66 |
var me = this,
|
67 |
+
item = $('input[id*="'+me.name+'"]'),
|
68 |
form_identifier = me.form_identifier,
|
69 |
+
isHidden = (typeof toHide[me.name] != 'undefined' || typeof hiddenByContainer[me.name] != 'undefined'),
|
70 |
result = [];
|
71 |
|
72 |
try
|
73 |
{
|
74 |
item.each(function(i,e){
|
75 |
+
if(typeof me.choicesDep[i] != 'undefined' && me.choicesDep[i].length)
|
76 |
{
|
77 |
var checked = e.checked;
|
78 |
+
for(var j = 0, k = me.choicesDep[i].length; j < k; j++)
|
79 |
{
|
80 |
if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
|
81 |
var dep = me.choicesDep[i][j]+form_identifier;
|
82 |
if(isHidden || !checked)
|
83 |
{
|
84 |
+
if(typeof toShow[dep] != 'undefined')
|
85 |
{
|
86 |
+
delete toShow[dep]['ref'][me.name+'_'+i];
|
87 |
+
if($.isEmptyObject(toShow[dep]['ref']))
|
88 |
+
delete toShow[dep];
|
89 |
}
|
90 |
|
91 |
+
if(typeof toShow[dep] == 'undefined')
|
92 |
{
|
93 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').hide();
|
94 |
+
$('[id*="'+dep+'"]:not(.ignore)').addClass('ignore');
|
95 |
+
toHide[dep] = {};
|
96 |
}
|
97 |
}
|
98 |
else
|
99 |
{
|
100 |
+
delete toHide[dep];
|
101 |
+
if(typeof toShow[dep] == 'undefined')
|
102 |
+
toShow[dep] = { 'ref': {}};
|
103 |
+
toShow[dep]['ref'][me.name+'_'+i] = 1;
|
104 |
if(!(dep in hiddenByContainer))
|
105 |
{
|
106 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').fadeIn(interval || 0);
|
107 |
+
$('[id*="'+dep+'"].ignore').removeClass('ignore');
|
108 |
}
|
109 |
}
|
110 |
+
if($.inArray(dep,result) == -1) result.push(dep);
|
111 |
}
|
112 |
}
|
113 |
});
|
114 |
}
|
115 |
+
catch(e){ }
|
116 |
return result;
|
117 |
},
|
118 |
val:function(raw, no_quotes)
|
119 |
{
|
120 |
raw = raw || false;
|
121 |
no_quotes = no_quotes || false;
|
122 |
+
var e = $('[id*="' + this.name + '"]:not(.ignore):checked');
|
123 |
+
if(e.length) return $.fbuilder.parseValStr((raw == 'vt') ? e.attr('vt') : e.val(), raw, no_quotes);
|
124 |
return 0;
|
125 |
},
|
126 |
+
setVal:function(v, nochange, _default)
|
127 |
{
|
128 |
_default = _default || false;
|
129 |
nochange = nochange || false;
|
130 |
|
131 |
var t = (new String(v)).replace(/(['"])/g, "\\$1"), n = this.name, e;
|
132 |
+
$('[id*="'+n+'"]').prop('checked', false);
|
133 |
if(_default) e = $('[id*="'+n+'"][vt="'+t+'"]');
|
134 |
if(!_default || !e.length) e = $('[id*="'+n+'"][value="'+t+'"]');
|
135 |
+
if(e.length) e.prop('checked', true);
|
136 |
+
if(!nochange) $('[id*="'+n+'"]').change();
|
137 |
},
|
138 |
setChoices:function(choices)
|
139 |
{
|
151 |
return (typeof y == 'number') ? 'fieldname'+parseInt(y) : y;
|
152 |
}) : x;
|
153 |
}
|
154 |
+
);
|
155 |
}
|
156 |
var html = this.show(),
|
157 |
e = $('.'+this.name),
|
js/fields-public/08_fbuilder.fdropdown.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Select a Choice",
|
7 |
ftype:"fdropdown",
|
@@ -26,17 +26,17 @@
|
|
26 |
classDep = '',
|
27 |
str = '';
|
28 |
|
29 |
-
if (
|
30 |
this.choicesDep = new Array();
|
31 |
|
32 |
for (var i=0;i<l;i++)
|
33 |
{
|
34 |
-
if(
|
35 |
this.choicesDep[i] = $.grep(this.choicesDep[i],function(n){ return n != ""; });
|
36 |
else
|
37 |
this.choicesDep[i] = [];
|
38 |
|
39 |
-
if(
|
40 |
classDep = 'depItem';
|
41 |
}
|
42 |
|
@@ -45,17 +45,17 @@
|
|
45 |
if(og[i])
|
46 |
{
|
47 |
if(op_o) str += '</optgroup>';
|
48 |
-
str += '<optgroup label="'
|
49 |
op_o = true;
|
50 |
}
|
51 |
else
|
52 |
{
|
53 |
-
str += '<option '+((this.choiceSelected == c[i]+' - '+cv[i])?"selected":"")+' '+(
|
54 |
}
|
55 |
}
|
56 |
if(op_o) str += '</optgroup>';
|
57 |
-
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>'+
|
58 |
-
'<div class="dfield"><select aria-label="'
|
59 |
},
|
60 |
after_show:function()
|
61 |
{
|
@@ -79,72 +79,72 @@
|
|
79 |
$(document).ready(function(){if('select2' in $.fn) $('#'+me.name).select2({'dropdownParent':$('#'+me.name).next('.cff-select2-container')});});
|
80 |
}
|
81 |
},
|
82 |
-
showHideDep:function(
|
83 |
{
|
84 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
85 |
var me = this,
|
86 |
-
item = $(
|
87 |
form_identifier = me.form_identifier,
|
88 |
-
isHidden = (
|
89 |
result = [];
|
90 |
|
91 |
try
|
92 |
{
|
93 |
-
if(
|
94 |
{
|
95 |
var selected = [];
|
96 |
$(item).find(':selected').each(function(){selected.push($(this).data('i'));});
|
97 |
|
98 |
-
for(
|
99 |
{
|
100 |
-
if(
|
101 |
{
|
102 |
-
for(
|
103 |
{
|
104 |
if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
|
105 |
var dep = me.choicesDep[i][j]+form_identifier;
|
106 |
-
if(
|
107 |
{
|
108 |
-
if(
|
109 |
{
|
110 |
-
delete toShow[
|
111 |
-
if(
|
112 |
-
delete toShow[
|
113 |
}
|
114 |
|
115 |
-
if(
|
116 |
{
|
117 |
-
$(
|
118 |
-
$(
|
119 |
-
toHide[
|
120 |
}
|
121 |
}
|
122 |
else
|
123 |
{
|
124 |
-
delete toHide[
|
125 |
-
if(
|
126 |
-
toShow[
|
127 |
-
toShow[
|
128 |
if(!(dep in hiddenByContainer))
|
129 |
{
|
130 |
-
$(
|
131 |
-
$(
|
132 |
}
|
133 |
}
|
134 |
-
if($.inArray(dep,result) == -1) result.push(
|
135 |
}
|
136 |
}
|
137 |
}
|
138 |
}
|
139 |
}
|
140 |
-
catch(
|
141 |
return result;
|
142 |
},
|
143 |
val:function(raw, no_quotes)
|
144 |
{
|
145 |
raw = raw || false;
|
146 |
no_quotes = no_quotes || false;
|
147 |
-
var e = $(
|
148 |
v,
|
149 |
m = this.multiple,
|
150 |
g = this.merge && !raw;
|
@@ -161,20 +161,20 @@
|
|
161 |
}
|
162 |
return (typeof v == 'object' && typeof v['length'] !== 'undefined') ? v : ((v) ? (($.isNumeric(v)) ? v : '"'+v+'"') : 0);
|
163 |
},
|
164 |
-
setVal:function(
|
165 |
{
|
166 |
_default = _default || false;
|
167 |
nochange = nochange || false;
|
168 |
-
if(
|
169 |
var t, e, n = this.name, selector;
|
170 |
for(var i in v)
|
171 |
{
|
172 |
t = (new String(v[i])).replace(/(['"])/g, "\\$1");
|
173 |
if(_default) e = $('[id="'+n+'"] OPTION[vt="'+t+'"]');
|
174 |
if(!_default || !e.length) e = $('[id="'+n+'"] OPTION[value="'+t+'"]');
|
175 |
-
if(e.length) e.prop(
|
176 |
}
|
177 |
-
if(!nochange) $(
|
178 |
},
|
179 |
setChoices:function(choices)
|
180 |
{
|
@@ -194,7 +194,7 @@
|
|
194 |
return (typeof y == 'number') ? 'fieldname'+parseInt(y) : y;
|
195 |
}) : x;
|
196 |
}
|
197 |
-
|
198 |
}
|
199 |
if('optgroup' in choices && $.isArray(choices.optgroup)) me.optgroup = choices.optgroup;
|
200 |
var html = me.show(),
|
1 |
+
$.fbuilder.controls['fdropdown']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fdropdown'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Select a Choice",
|
7 |
ftype:"fdropdown",
|
26 |
classDep = '',
|
27 |
str = '';
|
28 |
|
29 |
+
if (typeof this.choicesDep == "undefined" || this.choicesDep == null)
|
30 |
this.choicesDep = new Array();
|
31 |
|
32 |
for (var i=0;i<l;i++)
|
33 |
{
|
34 |
+
if(typeof this.choicesDep[i] != 'undefined' && (typeof og[i] == 'undefined' || !og[i]))
|
35 |
this.choicesDep[i] = $.grep(this.choicesDep[i],function(n){ return n != ""; });
|
36 |
else
|
37 |
this.choicesDep[i] = [];
|
38 |
|
39 |
+
if(this.choicesDep[i].length && (typeof og[i] == 'undefined' || !og[i]))
|
40 |
classDep = 'depItem';
|
41 |
}
|
42 |
|
45 |
if(og[i])
|
46 |
{
|
47 |
if(op_o) str += '</optgroup>';
|
48 |
+
str += '<optgroup label="'+cff_esc_attr(c[i])+'">';
|
49 |
op_o = true;
|
50 |
}
|
51 |
else
|
52 |
{
|
53 |
+
str += '<option '+((this.choiceSelected == c[i]+' - '+cv[i])?"selected":"")+' '+((classDep != '') ? 'class="'+classDep+'"' : '')+' value="'+cff_esc_attr(cv[i])+'" vt="'+cff_esc_attr((this.toSubmit=='text') ? c[i] : cv[i])+'" data-i="'+i+'">'+cff_esc_attr(c[i])+'</option>';
|
54 |
}
|
55 |
}
|
56 |
if(op_o) str += '</optgroup>';
|
57 |
+
return '<div class="fields '+cff_esc_attr(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>'+
|
58 |
+
'<div class="dfield"><select aria-label="'+cff_esc_attr(this.title)+'" 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>';
|
59 |
},
|
60 |
after_show:function()
|
61 |
{
|
79 |
$(document).ready(function(){if('select2' in $.fn) $('#'+me.name).select2({'dropdownParent':$('#'+me.name).next('.cff-select2-container')});});
|
80 |
}
|
81 |
},
|
82 |
+
showHideDep:function(toShow, toHide, hiddenByContainer, interval)
|
83 |
{
|
84 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
85 |
var me = this,
|
86 |
+
item = $('#'+me.name+'.depItemSel'),
|
87 |
form_identifier = me.form_identifier,
|
88 |
+
isHidden = (typeof toHide[me.name] != 'undefined' || typeof hiddenByContainer[me.name] != 'undefined'),
|
89 |
result = [];
|
90 |
|
91 |
try
|
92 |
{
|
93 |
+
if(item.length)
|
94 |
{
|
95 |
var selected = [];
|
96 |
$(item).find(':selected').each(function(){selected.push($(this).data('i'));});
|
97 |
|
98 |
+
for(var i = 0, h = me.choices.length; i < h; i++)
|
99 |
{
|
100 |
+
if(typeof me.choicesDep[i] != 'undefined' && me.choicesDep[i].length)
|
101 |
{
|
102 |
+
for(var j = 0, k = me.choicesDep[i].length; j < k; j++)
|
103 |
{
|
104 |
if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
|
105 |
var dep = me.choicesDep[i][j]+form_identifier;
|
106 |
+
if(isHidden || $.inArray(i,selected) == -1)
|
107 |
{
|
108 |
+
if(typeof toShow[dep] != 'undefined')
|
109 |
{
|
110 |
+
delete toShow[dep]['ref'][me.name+'_'+i];
|
111 |
+
if($.isEmptyObject(toShow[dep]['ref']))
|
112 |
+
delete toShow[dep];
|
113 |
}
|
114 |
|
115 |
+
if(typeof toShow[dep] == 'undefined')
|
116 |
{
|
117 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').hide();
|
118 |
+
$('[id*="'+dep+'"]:not(.ignore)').addClass('ignore');
|
119 |
+
toHide[dep] = {};
|
120 |
}
|
121 |
}
|
122 |
else
|
123 |
{
|
124 |
+
delete toHide[dep];
|
125 |
+
if(typeof toShow[dep] == 'undefined')
|
126 |
+
toShow[dep] = { 'ref': {}};
|
127 |
+
toShow[dep]['ref'][me.name+'_'+i] = 1;
|
128 |
if(!(dep in hiddenByContainer))
|
129 |
{
|
130 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').fadeIn(interval || 0);
|
131 |
+
$('[id*="'+dep+'"].ignore').removeClass('ignore');
|
132 |
}
|
133 |
}
|
134 |
+
if($.inArray(dep,result) == -1) result.push(dep);
|
135 |
}
|
136 |
}
|
137 |
}
|
138 |
}
|
139 |
}
|
140 |
+
catch(e){}
|
141 |
return result;
|
142 |
},
|
143 |
val:function(raw, no_quotes)
|
144 |
{
|
145 |
raw = raw || false;
|
146 |
no_quotes = no_quotes || false;
|
147 |
+
var e = $('[id="'+this.name+'"]:not(.ignore) option:selected'),
|
148 |
v,
|
149 |
m = this.multiple,
|
150 |
g = this.merge && !raw;
|
161 |
}
|
162 |
return (typeof v == 'object' && typeof v['length'] !== 'undefined') ? v : ((v) ? (($.isNumeric(v)) ? v : '"'+v+'"') : 0);
|
163 |
},
|
164 |
+
setVal:function(v, nochange, _default)
|
165 |
{
|
166 |
_default = _default || false;
|
167 |
nochange = nochange || false;
|
168 |
+
if(!$.isArray(v)) v = [v];
|
169 |
var t, e, n = this.name, selector;
|
170 |
for(var i in v)
|
171 |
{
|
172 |
t = (new String(v[i])).replace(/(['"])/g, "\\$1");
|
173 |
if(_default) e = $('[id="'+n+'"] OPTION[vt="'+t+'"]');
|
174 |
if(!_default || !e.length) e = $('[id="'+n+'"] OPTION[value="'+t+'"]');
|
175 |
+
if(e.length) e.prop('selected', true);
|
176 |
}
|
177 |
+
if(!nochange) $('[id="'+n+'"]').change();
|
178 |
},
|
179 |
setChoices:function(choices)
|
180 |
{
|
194 |
return (typeof y == 'number') ? 'fieldname'+parseInt(y) : y;
|
195 |
}) : x;
|
196 |
}
|
197 |
+
);
|
198 |
}
|
199 |
if('optgroup' in choices && $.isArray(choices.optgroup)) me.optgroup = choices.optgroup;
|
200 |
var html = me.show(),
|
js/fields-public/09_fbuilder.ffile.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"ffile",
|
@@ -22,10 +22,10 @@
|
|
22 |
},
|
23 |
show:function()
|
24 |
{
|
25 |
-
this.accept =
|
26 |
-
this.upload_size =
|
27 |
|
28 |
-
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 aria-label="'
|
29 |
},
|
30 |
after_show:function()
|
31 |
{
|
@@ -34,12 +34,12 @@
|
|
34 |
if(!('accept' in $.validator.methods))
|
35 |
$.validator.addMethod("accept", function(value, element, param)
|
36 |
{
|
37 |
-
if(
|
38 |
else{
|
39 |
param = typeof param === "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
|
40 |
-
var regExpObj = new RegExp(".("
|
41 |
-
for(
|
42 |
-
if(
|
43 |
return true;
|
44 |
}
|
45 |
});
|
@@ -47,23 +47,23 @@
|
|
47 |
if(!('upload_size' in $.validator.methods))
|
48 |
$.validator.addMethod("upload_size", function(value, element,params)
|
49 |
{
|
50 |
-
if(
|
51 |
else{
|
52 |
var total = 0;
|
53 |
-
for(
|
54 |
-
total += element.files[
|
55 |
-
return (
|
56 |
}
|
57 |
});
|
58 |
|
59 |
-
$(
|
60 |
var h = this.files.length, n = 0;
|
61 |
-
$(
|
62 |
$('[id="'+me.name+'_patch"]').remove();
|
63 |
if(1 <= h)
|
64 |
{
|
65 |
var filesContainer = $('<span class="files-list"></span>');
|
66 |
-
for(
|
67 |
{
|
68 |
(function(i, file){
|
69 |
if(me.preview && file.type.match('image.*') && 'FileReader' in window)
|
@@ -82,7 +82,7 @@
|
|
82 |
else if(1 < h){filesContainer.append($('<span>').text((n ? ', ' : '')+file.name));n++;}
|
83 |
})(i, this.files[i]);
|
84 |
}
|
85 |
-
$(
|
86 |
}
|
87 |
});
|
88 |
|
@@ -92,8 +92,8 @@
|
|
92 |
{
|
93 |
raw = raw || false;
|
94 |
no_quotes = no_quotes || false;
|
95 |
-
var e = $(
|
96 |
-
if(
|
97 |
{
|
98 |
if(raw) result = e[0].files;
|
99 |
else
|
1 |
+
$.fbuilder.controls['ffile'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['ffile'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"ffile",
|
22 |
},
|
23 |
show:function()
|
24 |
{
|
25 |
+
this.accept = cff_esc_attr($.trim(this.accept));
|
26 |
+
this.upload_size = cff_esc_attr($.trim(this.upload_size));
|
27 |
|
28 |
+
return '<div class="fields '+cff_esc_attr(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 aria-label="'+cff_esc_attr(this.title)+'" 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' : '')+' /><div id="'+this.name+'_clearer" class="cff-file-clearer"></div>'+((this._patch) ? '<input type="hidden" id="'+this.name+'_patch" name="'+this.name+'_patch" value="1" />' : '')+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
29 |
},
|
30 |
after_show:function()
|
31 |
{
|
34 |
if(!('accept' in $.validator.methods))
|
35 |
$.validator.addMethod("accept", function(value, element, param)
|
36 |
{
|
37 |
+
if(this.optional(element)) return true;
|
38 |
else{
|
39 |
param = typeof param === "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
|
40 |
+
var regExpObj = new RegExp(".("+param+")$", "i");
|
41 |
+
for(var i = 0, h = element.files.length; i < h; i++)
|
42 |
+
if(!element.files[i].name.match(regExpObj)) return false;
|
43 |
return true;
|
44 |
}
|
45 |
});
|
47 |
if(!('upload_size' in $.validator.methods))
|
48 |
$.validator.addMethod("upload_size", function(value, element,params)
|
49 |
{
|
50 |
+
if(this.optional(element)) return true;
|
51 |
else{
|
52 |
var total = 0;
|
53 |
+
for(var i = 0, h = element.files.length; i < h; i++)
|
54 |
+
total += element.files[i].size/1024;
|
55 |
+
return (total <= params);
|
56 |
}
|
57 |
});
|
58 |
|
59 |
+
$('#'+me.name).change(function(){
|
60 |
var h = this.files.length, n = 0;
|
61 |
+
$(this).siblings('span.files-list').remove();
|
62 |
$('[id="'+me.name+'_patch"]').remove();
|
63 |
if(1 <= h)
|
64 |
{
|
65 |
var filesContainer = $('<span class="files-list"></span>');
|
66 |
+
for(var i = 0; i < h; i++)
|
67 |
{
|
68 |
(function(i, file){
|
69 |
if(me.preview && file.type.match('image.*') && 'FileReader' in window)
|
82 |
else if(1 < h){filesContainer.append($('<span>').text((n ? ', ' : '')+file.name));n++;}
|
83 |
})(i, this.files[i]);
|
84 |
}
|
85 |
+
$('#'+this.id+'_clearer').after(filesContainer);
|
86 |
}
|
87 |
});
|
88 |
|
92 |
{
|
93 |
raw = raw || false;
|
94 |
no_quotes = no_quotes || false;
|
95 |
+
var e = $("[id='"+this.name+"']:not(.ignore)"), result = '', separator = '';
|
96 |
+
if(e.length)
|
97 |
{
|
98 |
if(raw) result = e[0].files;
|
99 |
else
|
js/fields-public/10_fbuilder.fpassword.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"fpassword",
|
@@ -16,24 +16,24 @@
|
|
16 |
regExpMssg:"",
|
17 |
show:function()
|
18 |
{
|
19 |
-
this.minlength =
|
20 |
-
this.maxlength =
|
21 |
-
this.equalTo =
|
22 |
this.predefined = this._getAttr('predefined');
|
23 |
-
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 aria-label="'
|
24 |
},
|
25 |
after_show:function()
|
26 |
{
|
27 |
-
if(
|
28 |
{
|
29 |
var parts = this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);
|
30 |
-
this.regExp = (
|
31 |
|
32 |
if(!('pattern' in $.validator.methods))
|
33 |
-
$.validator.addMethod(
|
34 |
{
|
35 |
try{
|
36 |
-
return this.optional(element) || param.test(
|
37 |
}
|
38 |
catch(err){return true;}
|
39 |
}
|
@@ -45,8 +45,8 @@
|
|
45 |
{
|
46 |
raw = raw || false;
|
47 |
no_quotes = no_quotes || false;
|
48 |
-
var e = $(
|
49 |
-
if(
|
50 |
return 0;
|
51 |
}
|
52 |
}
|
1 |
+
$.fbuilder.controls['fpassword'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fpassword'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"fpassword",
|
16 |
regExpMssg:"",
|
17 |
show:function()
|
18 |
{
|
19 |
+
this.minlength = cff_esc_attr($.trim(this.minlength));
|
20 |
+
this.maxlength = cff_esc_attr($.trim(this.maxlength));
|
21 |
+
this.equalTo = cff_esc_attr($.trim(this.equalTo));
|
22 |
this.predefined = this._getAttr('predefined');
|
23 |
+
return '<div class="fields '+cff_esc_attr(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 aria-label="'+cff_esc_attr(this.title)+'" id="'+this.name+'" name="'+this.name+'"'+((this.minlength.length) ? ' minlength="'+cff_esc_attr(this.minlength)+'"' : '')+((this.maxlength.length) ? ' maxlength="'+cff_esc_attr(this.maxlength)+'"' : '')+((this.equalTo.length) ? ' equalTo="#'+this.equalTo+this.form_identifier+'"' : '')+' class="field '+this.size+((this.required)?" required":"")+'" type="password" autocomplete="new-password" value="'+cff_esc_attr(this.predefined)+'"/><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
|
24 |
},
|
25 |
after_show:function()
|
26 |
{
|
27 |
+
if(this.regExp != "" && typeof $['validator'] != 'undefined')
|
28 |
{
|
29 |
var parts = this.regExp.match(/(\/)(.*)(\/)([gimy]{0,4})$/i);
|
30 |
+
this.regExp = (parts === null) ? new RegExp(this.regExp) : new RegExp(parts[2],parts[4].toLowerCase());
|
31 |
|
32 |
if(!('pattern' in $.validator.methods))
|
33 |
+
$.validator.addMethod('pattern', function(value, element, param)
|
34 |
{
|
35 |
try{
|
36 |
+
return this.optional(element) || param.test(value);
|
37 |
}
|
38 |
catch(err){return true;}
|
39 |
}
|
45 |
{
|
46 |
raw = raw || false;
|
47 |
no_quotes = no_quotes || false;
|
48 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
49 |
+
if(e.length) return $.fbuilder.parseValStr(e.val(), raw, no_quotes);
|
50 |
return 0;
|
51 |
}
|
52 |
}
|
js/fields-public/11_fbuilder.fphone.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Phone",
|
7 |
ftype:"fPhone",
|
@@ -27,7 +27,7 @@
|
|
27 |
var str = "",
|
28 |
tmp = me.dformat.split(/\s/),
|
29 |
tmpv = me.predefined.split(/\s/),
|
30 |
-
attr = (
|
31 |
c = 0;
|
32 |
|
33 |
for (var i=0;i<tmpv.length;i++)
|
@@ -43,7 +43,7 @@
|
|
43 |
str += '<div class="uh_phone"><select id="'+me.name+'_'+c+'" name="'+me.name+'_'+c+'" class="field">';
|
44 |
if(!me.countries.length) me.countries = Object.keys(db);
|
45 |
for(var i in me.countries)
|
46 |
-
str += '<option value="'+db[me.countries[i]]+'" '+(me.defaultCountry == me.countries[i] ? 'SELECTED' : ''
|
47 |
str += '</select></div>';
|
48 |
c++;
|
49 |
}
|
@@ -52,12 +52,12 @@
|
|
52 |
{
|
53 |
if ($.trim(tmp[i])!="")
|
54 |
{
|
55 |
-
str += '<div class="uh_phone" ><input aria-label="'
|
56 |
}
|
57 |
c++;
|
58 |
}
|
59 |
|
60 |
-
return '<div class="fields '+me.csslayout+' '+me.name+' cff-phone-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+me.name+'">'+me.title+''+((me.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="hidden" id="'+me.name+'" name="'+me.name+'" class="field" />'+str+'<div class="clearer"></div><span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
|
61 |
},
|
62 |
after_show: function()
|
63 |
{
|
@@ -67,42 +67,42 @@
|
|
67 |
if(!('phone' in $.validator.methods))
|
68 |
$.validator.addMethod("phone", function(value, element)
|
69 |
{
|
70 |
-
if(
|
71 |
else return /^\+{0,1}\d*$/.test(value);
|
72 |
});
|
73 |
|
74 |
-
for (var i = 0, h = tmp.length+(me.countryComponent ? 1 : 0); i < h; i++
|
75 |
{
|
76 |
-
$(
|
77 |
var v = '';
|
78 |
$('[id*="'+me.name+'_"]').each(function(){v+=$(this).val();});
|
79 |
-
$(
|
80 |
-
}
|
81 |
-
if(
|
82 |
{
|
83 |
-
$('#'+me.name+'_'+i).bind(
|
84 |
-
var e = $(
|
85 |
-
if(
|
86 |
{
|
87 |
e.change();
|
88 |
-
$(
|
89 |
}
|
90 |
-
}
|
91 |
}
|
92 |
}
|
93 |
-
$(
|
94 |
},
|
95 |
val:function(raw, no_quotes)
|
96 |
{
|
97 |
raw = raw || true;
|
98 |
no_quotes = no_quotes || false;
|
99 |
-
var e = $(
|
100 |
p = $.fbuilder.parseValStr(e.val(), raw, no_quotes);
|
101 |
|
102 |
-
if(
|
103 |
return 0;
|
104 |
},
|
105 |
-
setVal:function(
|
106 |
{
|
107 |
v = (new String(v)).replace(/^\s+/, '').replace(/\s+$/, '');
|
108 |
if(v.length)
|
@@ -120,7 +120,7 @@
|
|
120 |
|
121 |
if(c != null)
|
122 |
{
|
123 |
-
for(
|
124 |
$('[id="'+this.name+'_'+(i-1)+'"]').val(c[i]);
|
125 |
}
|
126 |
else $('input[id*="'+this.name+'_"]:eq(0)').val(v);
|
1 |
+
$.fbuilder.controls['fPhone']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fPhone'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Phone",
|
7 |
ftype:"fPhone",
|
27 |
var str = "",
|
28 |
tmp = me.dformat.split(/\s/),
|
29 |
tmpv = me.predefined.split(/\s/),
|
30 |
+
attr = (typeof me.predefinedClick != 'undefined' && me.predefinedClick) ? 'placeholder' : 'value',
|
31 |
c = 0;
|
32 |
|
33 |
for (var i=0;i<tmpv.length;i++)
|
43 |
str += '<div class="uh_phone"><select id="'+me.name+'_'+c+'" name="'+me.name+'_'+c+'" class="field">';
|
44 |
if(!me.countries.length) me.countries = Object.keys(db);
|
45 |
for(var i in me.countries)
|
46 |
+
str += '<option value="'+db[me.countries[i]]+'" '+(me.defaultCountry == me.countries[i] ? 'SELECTED' : '')+'>'+(me.toDisplay == 'iso' ? me.countries[i] : db[me.countries[i]])+'</option>';
|
47 |
str += '</select></div>';
|
48 |
c++;
|
49 |
}
|
52 |
{
|
53 |
if ($.trim(tmp[i])!="")
|
54 |
{
|
55 |
+
str += '<div class="uh_phone" ><input aria-label="'+cff_esc_attr(me.title)+'" type="text" id="'+me.name+'_'+c+'" name="'+me.name+'_'+c+'" class="field '+((i==0 && !me.countryComponent) ? ' phone ' : ' digits ')+((me.required) ? ' required ' : '')+'" size="'+$.trim(tmp[i]).length+'" '+attr+'="'+((tmpv[i])?tmpv[i]:"")+'" maxlength="'+$.trim(tmp[i]).length+'" minlength="'+$.trim(tmp[i]).length+'" '+((me.readonly)?'readonly':'')+' /><div class="l">'+$.trim(tmp[i])+'</div></div>';
|
56 |
}
|
57 |
c++;
|
58 |
}
|
59 |
|
60 |
+
return '<div class="fields '+cff_esc_attr(me.csslayout)+' '+me.name+' cff-phone-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+me.name+'">'+me.title+''+((me.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="hidden" id="'+me.name+'" name="'+me.name+'" class="field" />'+str+'<div class="clearer"></div><span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
|
61 |
},
|
62 |
after_show: function()
|
63 |
{
|
67 |
if(!('phone' in $.validator.methods))
|
68 |
$.validator.addMethod("phone", function(value, element)
|
69 |
{
|
70 |
+
if(this.optional(element)) return true;
|
71 |
else return /^\+{0,1}\d*$/.test(value);
|
72 |
});
|
73 |
|
74 |
+
for (var i = 0, h = tmp.length+(me.countryComponent ? 1 : 0); i < h; i++)
|
75 |
{
|
76 |
+
$('#'+me.name+'_'+i).bind('change', function(){
|
77 |
var v = '';
|
78 |
$('[id*="'+me.name+'_"]').each(function(){v+=$(this).val();});
|
79 |
+
$('#'+me.name).val(v).change();
|
80 |
+
});
|
81 |
+
if(i+1 < h)
|
82 |
{
|
83 |
+
$('#'+me.name+'_'+i).bind('keyup', { 'next': i+1 }, function(evt){
|
84 |
+
var e = $(this);
|
85 |
+
if(e.val().length == e.attr('maxlength'))
|
86 |
{
|
87 |
e.change();
|
88 |
+
$('#'+me.name+'_'+evt.data.next).focus();
|
89 |
}
|
90 |
+
});
|
91 |
}
|
92 |
}
|
93 |
+
$('#'+me.name+'_0').change();
|
94 |
},
|
95 |
val:function(raw, no_quotes)
|
96 |
{
|
97 |
raw = raw || true;
|
98 |
no_quotes = no_quotes || false;
|
99 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)'),
|
100 |
p = $.fbuilder.parseValStr(e.val(), raw, no_quotes);
|
101 |
|
102 |
+
if(e.length) return ($.isNumeric(p) && !no_quotes) ? '"'+p+'"' : p;
|
103 |
return 0;
|
104 |
},
|
105 |
+
setVal:function(v)
|
106 |
{
|
107 |
v = (new String(v)).replace(/^\s+/, '').replace(/\s+$/, '');
|
108 |
if(v.length)
|
120 |
|
121 |
if(c != null)
|
122 |
{
|
123 |
+
for(var i = c.length-1; 0<i; i--)
|
124 |
$('[id="'+this.name+'_'+(i-1)+'"]').val(c[i]);
|
125 |
}
|
126 |
else $('input[id*="'+this.name+'_"]:eq(0)').val(v);
|
js/fields-public/12_fbuilder.fcommentarea.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Comments here",
|
7 |
ftype:"fCommentArea",
|
8 |
userhelp:"A description of the section goes here.",
|
9 |
show:function()
|
10 |
{
|
11 |
-
|
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",
|
7 |
ftype:"fCommentArea",
|
8 |
userhelp:"A description of the section goes here.",
|
9 |
show:function()
|
10 |
{
|
11 |
+
return '<div class="fields '+cff_esc_attr(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
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
ftype:"fhidden",
|
7 |
title:"",
|
@@ -9,7 +9,7 @@
|
|
9 |
show:function()
|
10 |
{
|
11 |
this.predefined = this._getAttr('predefined');
|
12 |
-
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="'
|
13 |
}
|
14 |
}
|
15 |
);
|
1 |
+
$.fbuilder.controls['fhidden']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fhidden'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
ftype:"fhidden",
|
7 |
title:"",
|
9 |
show:function()
|
10 |
{
|
11 |
this.predefined = this._getAttr('predefined');
|
12 |
+
return '<div class="fields '+cff_esc_attr(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="'+cff_esc_attr(this.predefined)+'" class="field" /></div></div>';
|
13 |
}
|
14 |
}
|
15 |
);
|
js/fields-public/14_fbuilder.fsectionbreak.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Section Break",
|
7 |
ftype:"fSectionBreak",
|
8 |
userhelp:"A description of the section goes here.",
|
9 |
show:function()
|
10 |
{
|
11 |
-
|
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",
|
7 |
ftype:"fSectionBreak",
|
8 |
userhelp:"A description of the section goes here.",
|
9 |
show:function()
|
10 |
{
|
11 |
+
return '<div class="fields '+cff_esc_attr(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[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Page Break",
|
7 |
ftype:"fPageBreak",
|
8 |
show:function()
|
9 |
{
|
10 |
-
|
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 '+cff_esc_attr(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
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Summary",
|
7 |
ftype:"fsummary",
|
@@ -14,17 +14,17 @@
|
|
14 |
{
|
15 |
var me = this;
|
16 |
if('string' != typeof me.fields) return;
|
17 |
-
var p = $.trim(
|
18 |
l = p.length;
|
19 |
-
if(
|
20 |
{
|
21 |
-
var str = '<div class="fields '+me.csslayout+' '+me.name+' cff-summary-field" id="field'+me.form_identifier+'-'+me.index+'">'+(
|
22 |
-
for(
|
23 |
{
|
24 |
-
if(
|
25 |
{
|
26 |
-
p[
|
27 |
-
str += '<div ref="'+p[i]+me.form_identifier+'" class="cff-summary-item"><span class="'+me.titleClassname+' cff-summary-title"></span><span class="'+me.valueClassname+' cff-summary-value"></span></div>';
|
28 |
}
|
29 |
}
|
30 |
str += '</div></div>';
|
@@ -35,41 +35,41 @@
|
|
35 |
after_show: function(){
|
36 |
var me = this;
|
37 |
if('string' != typeof me.fields) return;
|
38 |
-
var p = $.trim(me.fields.replace(
|
39 |
l = p.length;
|
40 |
|
41 |
-
if(
|
42 |
{
|
43 |
-
for(
|
44 |
{
|
45 |
-
if(
|
46 |
{
|
47 |
-
p[
|
48 |
-
me.fieldsArray.push(
|
49 |
-
$(
|
50 |
}
|
51 |
}
|
52 |
-
$(
|
53 |
{
|
54 |
me.update();
|
55 |
});
|
56 |
|
57 |
-
$(
|
58 |
}
|
59 |
},
|
60 |
update:function()
|
61 |
{
|
62 |
-
for (
|
63 |
{
|
64 |
-
var i = this.fieldsArray[
|
65 |
-
e = $(
|
66 |
-
tt = $(
|
67 |
|
68 |
-
if(
|
69 |
{
|
70 |
-
var l = $(
|
71 |
-
.closest(
|
72 |
-
.find(
|
73 |
.clone()
|
74 |
.find('.r,.dformat')
|
75 |
.remove()
|
@@ -81,11 +81,11 @@
|
|
81 |
e.each(
|
82 |
function(){
|
83 |
var e = $(this);
|
84 |
-
if(
|
85 |
{
|
86 |
return;
|
87 |
}
|
88 |
-
else if(
|
89 |
{
|
90 |
var vt = [];
|
91 |
e.find('option:selected').each(function(){vt.push($(this).attr('vt'));});
|
@@ -93,13 +93,13 @@
|
|
93 |
}
|
94 |
else
|
95 |
{
|
96 |
-
if(
|
97 |
{
|
98 |
-
v.push(
|
99 |
}
|
100 |
else
|
101 |
{
|
102 |
-
var d = $(
|
103 |
if(d.length)
|
104 |
{
|
105 |
if(d.is(':disabled'))
|
@@ -118,8 +118,8 @@
|
|
118 |
}
|
119 |
else
|
120 |
{
|
121 |
-
var c = $(
|
122 |
-
v.push(
|
123 |
}
|
124 |
}
|
125 |
}
|
@@ -127,10 +127,10 @@
|
|
127 |
}
|
128 |
);
|
129 |
v = v.join(', ');
|
130 |
-
tt.find(
|
131 |
-
tt.find(
|
132 |
|
133 |
-
if(
|
134 |
{
|
135 |
tt.hide();
|
136 |
}
|
1 |
+
$.fbuilder.controls['fsummary'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fsummary'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Summary",
|
7 |
ftype:"fsummary",
|
14 |
{
|
15 |
var me = this;
|
16 |
if('string' != typeof me.fields) return;
|
17 |
+
var p = $.trim(me.fields.replace(/\,+/g, ',')).split(','),
|
18 |
l = p.length;
|
19 |
+
if(l)
|
20 |
{
|
21 |
+
var str = '<div class="fields '+cff_esc_attr(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+'">';
|
22 |
+
for(var i = 0; i < l; i++)
|
23 |
{
|
24 |
+
if(!/^\s*$/.test(p[i]))
|
25 |
{
|
26 |
+
p[i] = $.trim(p[i]);
|
27 |
+
str += '<div ref="'+p[i]+me.form_identifier+'" class="cff-summary-item"><span class="'+cff_esc_attr(me.titleClassname)+' cff-summary-title"></span><span class="'+cff_esc_attr(me.valueClassname)+' cff-summary-value"></span></div>';
|
28 |
}
|
29 |
}
|
30 |
str += '</div></div>';
|
35 |
after_show: function(){
|
36 |
var me = this;
|
37 |
if('string' != typeof me.fields) return;
|
38 |
+
var p = $.trim(me.fields.replace(/\,+/g, ',')).split(','),
|
39 |
l = p.length;
|
40 |
|
41 |
+
if(l)
|
42 |
{
|
43 |
+
for(var i = 0; i < l; i++)
|
44 |
{
|
45 |
+
if(!/^\s*$/.test(p[i]))
|
46 |
{
|
47 |
+
p[i] = $.trim(p[i]);
|
48 |
+
me.fieldsArray.push(p[i]+me.form_identifier);
|
49 |
+
$(document).on('change', '[id*="'+p[i]+me.form_identifier+'"]', function(){ me.update(); });
|
50 |
}
|
51 |
}
|
52 |
+
$(document).on('showHideDepEvent', function(evt, form_identifier)
|
53 |
{
|
54 |
me.update();
|
55 |
});
|
56 |
|
57 |
+
$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){ setTimeout(function(){ me.update(); }, 10); });
|
58 |
}
|
59 |
},
|
60 |
update:function()
|
61 |
{
|
62 |
+
for (var j = 0, k = this.fieldsArray.length; j < k; j++)
|
63 |
{
|
64 |
+
var i = this.fieldsArray[j],
|
65 |
+
e = $('[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]'),
|
66 |
+
tt = $('[ref="'+i+'"]');
|
67 |
|
68 |
+
if(e.length && tt.length)
|
69 |
{
|
70 |
+
var l = $('[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]')
|
71 |
+
.closest('.fields')
|
72 |
+
.find('label:first')
|
73 |
.clone()
|
74 |
.find('.r,.dformat')
|
75 |
.remove()
|
81 |
e.each(
|
82 |
function(){
|
83 |
var e = $(this);
|
84 |
+
if(/(checkbox|radio)/i.test(e.attr('type')) && !e.is(':checked'))
|
85 |
{
|
86 |
return;
|
87 |
}
|
88 |
+
else if(e[0].tagName == 'SELECT')
|
89 |
{
|
90 |
var vt = [];
|
91 |
e.find('option:selected').each(function(){vt.push($(this).attr('vt'));});
|
93 |
}
|
94 |
else
|
95 |
{
|
96 |
+
if(e.attr('vt'))
|
97 |
{
|
98 |
+
v.push(e.attr('vt'));
|
99 |
}
|
100 |
else
|
101 |
{
|
102 |
+
var d = $('[id="'+i+'_date"]');
|
103 |
if(d.length)
|
104 |
{
|
105 |
if(d.is(':disabled'))
|
118 |
}
|
119 |
else
|
120 |
{
|
121 |
+
var c = $('[id="'+i+'_caption"]');
|
122 |
+
v.push((c.length && !/^\s*$/.test(c.html())) ? c.html() : e.val());
|
123 |
}
|
124 |
}
|
125 |
}
|
127 |
}
|
128 |
);
|
129 |
v = v.join(', ');
|
130 |
+
tt.find('.cff-summary-title')[(/^\s*$/.test(t)) ? 'hide' : 'show']().html(t);
|
131 |
+
tt.find('.cff-summary-value').html(v);
|
132 |
|
133 |
+
if(e.hasClass('ignore') || (this.exclude_empty && v == ''))
|
134 |
{
|
135 |
tt.hide();
|
136 |
}
|
js/fields-public/28_fbuilder.fcontainer.js
CHANGED
@@ -1,62 +1,62 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
-
$.fbuilder.controls[
|
3 |
fields:[],
|
4 |
columns:1,
|
5 |
rearrange: 0,
|
6 |
after_show: function()
|
7 |
{
|
8 |
-
var e = $(
|
9 |
-
for(
|
10 |
{
|
11 |
-
f = $(
|
12 |
-
if(
|
13 |
{
|
14 |
-
f.addClass(
|
15 |
-
if(
|
16 |
}
|
17 |
-
f.appendTo(
|
18 |
}
|
19 |
},
|
20 |
-
showHideDep:function(
|
21 |
{
|
22 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
23 |
var me = this,
|
24 |
-
isHidden = (
|
25 |
fId,
|
26 |
result = [];
|
27 |
|
28 |
-
for(
|
29 |
{
|
30 |
-
if(!/fieldname/i.test(me.fields[
|
31 |
-
fId = me.fields[
|
32 |
-
if(
|
33 |
{
|
34 |
-
if(
|
35 |
-
if(
|
36 |
{
|
37 |
-
hiddenByContainer[
|
38 |
|
39 |
-
if(
|
40 |
{
|
41 |
-
$(
|
42 |
-
$(
|
43 |
-
result.push(
|
44 |
}
|
45 |
}
|
46 |
}
|
47 |
else
|
48 |
{
|
49 |
-
if(
|
50 |
{
|
51 |
-
delete hiddenByContainer[
|
52 |
-
if(
|
53 |
{
|
54 |
-
delete hiddenByContainer[
|
55 |
-
if(
|
56 |
{
|
57 |
-
$(
|
58 |
-
$(
|
59 |
-
result.push(
|
60 |
}
|
61 |
}
|
62 |
}
|
1 |
+
$.fbuilder.controls['fcontainer'] = function(){};
|
2 |
+
$.fbuilder.controls['fcontainer'].prototype = {
|
3 |
fields:[],
|
4 |
columns:1,
|
5 |
rearrange: 0,
|
6 |
after_show: function()
|
7 |
{
|
8 |
+
var e = $('#'+this.name), f;
|
9 |
+
for(var i = 0, h = this.fields.length; i < h; i++)
|
10 |
{
|
11 |
+
f = $('[id*="'+this.fields[i]+this.form_identifier+'"]').closest('.fields').detach();
|
12 |
+
if(this.columns > 1)
|
13 |
{
|
14 |
+
f.addClass('column'+this.columns);
|
15 |
+
if(i%this.columns == 0 && !this.rearrange) f.css('clear', 'left');
|
16 |
}
|
17 |
+
f.appendTo(e);
|
18 |
}
|
19 |
},
|
20 |
+
showHideDep:function(toShow, toHide, hiddenByContainer, interval)
|
21 |
{
|
22 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
23 |
var me = this,
|
24 |
+
isHidden = (typeof toHide[me.name] != 'undefined' || typeof hiddenByContainer[me.name] != 'undefined'),
|
25 |
fId,
|
26 |
result = [];
|
27 |
|
28 |
+
for(var i = 0, h = me.fields.length; i < h; i++)
|
29 |
{
|
30 |
+
if(!/fieldname/i.test(me.fields[i])) continue;
|
31 |
+
fId = me.fields[i]+me.form_identifier;
|
32 |
+
if(isHidden)
|
33 |
{
|
34 |
+
if(typeof hiddenByContainer[fId] == 'undefined') hiddenByContainer[fId] = {};
|
35 |
+
if(typeof hiddenByContainer[fId][me.name] == 'undefined')
|
36 |
{
|
37 |
+
hiddenByContainer[fId][me.name] = {};
|
38 |
|
39 |
+
if(typeof toHide[fId] == 'undefined')
|
40 |
{
|
41 |
+
$('[id*="'+fId+'"],.'+fId).closest('.fields').hide();
|
42 |
+
$('[id*="'+fId+'"]:not(.ignore)').addClass('ignore');
|
43 |
+
result.push(fId);
|
44 |
}
|
45 |
}
|
46 |
}
|
47 |
else
|
48 |
{
|
49 |
+
if(typeof hiddenByContainer[fId] != 'undefined')
|
50 |
{
|
51 |
+
delete hiddenByContainer[fId][me.name];
|
52 |
+
if($.isEmptyObject(hiddenByContainer[fId]))
|
53 |
{
|
54 |
+
delete hiddenByContainer[fId];
|
55 |
+
if(typeof toHide[fId] == 'undefined')
|
56 |
{
|
57 |
+
$('[id*="'+fId+'"],.'+fId).closest('.fields').fadeIn(interval || 0);
|
58 |
+
$('[id*="'+fId+'"].ignore').removeClass('ignore');
|
59 |
+
result.push(fId);
|
60 |
}
|
61 |
}
|
62 |
}
|
js/fields-public/29_fbuilder.ffieldset.fc.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"ffieldset",
|
@@ -12,17 +12,17 @@
|
|
12 |
rearrange: 0,
|
13 |
show:function()
|
14 |
{
|
15 |
-
return '<div class="fields '+this.csslayout+' '+this.name+' cff-container-field '+((this.collapsible) ? 'cff-collapsible'+((this.defaultCollapsed) ? ' cff-collapsed' : '') : '')+'" id="field'+this.form_identifier+'-'+this.index+'"><FIELDSET>'+(
|
16 |
},
|
17 |
after_show: function()
|
18 |
{
|
19 |
var me = this;
|
20 |
-
$.fbuilder.controls[
|
21 |
if(me.collapsible) $('.'+me.name+'>fieldset>legend').bind('click', function(){$(this).closest('.cff-collapsible').toggleClass('cff-collapsed');});
|
22 |
},
|
23 |
-
showHideDep:function(
|
24 |
{
|
25 |
-
return $.fbuilder.controls[
|
26 |
}
|
27 |
}
|
28 |
);
|
1 |
+
$.fbuilder.controls['ffieldset']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['ffieldset'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"ffieldset",
|
12 |
rearrange: 0,
|
13 |
show:function()
|
14 |
{
|
15 |
+
return '<div class="fields '+cff_esc_attr(this.csslayout)+' '+this.name+' cff-container-field '+((this.collapsible) ? 'cff-collapsible'+((this.defaultCollapsed) ? ' cff-collapsed' : '') : '')+'" id="field'+this.form_identifier+'-'+this.index+'"><FIELDSET>'+((!/^\s*$/.test(this.title)) ? '<LEGEND>'+this.title+'</LEGEND>' : '')+'<div id="'+this.name+'"></div></FIELDSET><div class="clearer"></div></div>';
|
16 |
},
|
17 |
after_show: function()
|
18 |
{
|
19 |
var me = this;
|
20 |
+
$.fbuilder.controls['fcontainer'].prototype.after_show.call(this);
|
21 |
if(me.collapsible) $('.'+me.name+'>fieldset>legend').bind('click', function(){$(this).closest('.cff-collapsible').toggleClass('cff-collapsed');});
|
22 |
},
|
23 |
+
showHideDep:function(toShow, toHide, hiddenByContainer)
|
24 |
{
|
25 |
+
return $.fbuilder.controls['fcontainer'].prototype.showHideDep.call(this, toShow, toHide, hiddenByContainer);
|
26 |
}
|
27 |
}
|
28 |
);
|
js/fields-public/30_fbuilder.fdiv.fc.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
ftype:"fdiv",
|
7 |
fields:[],
|
@@ -9,15 +9,15 @@
|
|
9 |
rearrange: 0,
|
10 |
show:function()
|
11 |
{
|
12 |
-
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>';
|
13 |
},
|
14 |
after_show: function()
|
15 |
{
|
16 |
-
$.fbuilder.controls[
|
17 |
},
|
18 |
-
showHideDep:function(
|
19 |
{
|
20 |
-
return $.fbuilder.controls[
|
21 |
}
|
22 |
}
|
23 |
);
|
1 |
+
$.fbuilder.controls['fdiv']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fdiv'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
ftype:"fdiv",
|
7 |
fields:[],
|
9 |
rearrange: 0,
|
10 |
show:function()
|
11 |
{
|
12 |
+
return '<div class="fields '+cff_esc_attr(this.csslayout)+' '+this.name+' cff-container-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'"></div><div class="clearer"></div></div>';
|
13 |
},
|
14 |
after_show: function()
|
15 |
{
|
16 |
+
$.fbuilder.controls['fcontainer'].prototype.after_show.call(this);
|
17 |
},
|
18 |
+
showHideDep:function(toShow, toHide, hiddenByContainer)
|
19 |
{
|
20 |
+
return $.fbuilder.controls['fcontainer'].prototype.showHideDep.call(this, toShow, toHide, hiddenByContainer);
|
21 |
}
|
22 |
}
|
23 |
);
|
js/fields-public/31_fbuilder.fmedia.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
ftype:"fMedia",
|
7 |
sMediaType:"image", // image, audio, video
|
@@ -47,59 +47,59 @@
|
|
47 |
_show_image: function()
|
48 |
{
|
49 |
var d = this.data.image,
|
50 |
-
esc =
|
51 |
a = [],
|
52 |
l = [],
|
53 |
r = '';
|
54 |
|
55 |
-
if(
|
56 |
-
if(
|
57 |
-
if(
|
58 |
-
if(
|
59 |
-
if(
|
60 |
{
|
61 |
-
l.push(
|
62 |
-
if(
|
63 |
-
r = '<a '+l.join(
|
64 |
}
|
65 |
else
|
66 |
{
|
67 |
-
r = '<img '+a.join(
|
68 |
}
|
69 |
|
70 |
return r;
|
71 |
},
|
72 |
-
_show_audio_video: function(
|
73 |
{
|
74 |
-
var esc =
|
75 |
a = [],
|
76 |
s = [],
|
77 |
-
t = (
|
78 |
|
79 |
-
if(
|
80 |
-
if(
|
81 |
-
if(
|
82 |
-
if(
|
83 |
-
if(
|
84 |
-
if(
|
85 |
-
if(
|
86 |
-
if(
|
87 |
-
if(
|
88 |
-
a.push(
|
89 |
|
90 |
-
return '<'+t+' '+a.join(' ')+' style="'+s.join(' ')+'">'+(($.trim(d.sSrcAlt)) ? '<source src="'+esc(d.sSrcAlt)+'" />' : ''
|
91 |
},
|
92 |
_show_audio: function()
|
93 |
{
|
94 |
-
return this._show_audio_video(
|
95 |
},
|
96 |
_show_video: function()
|
97 |
{
|
98 |
-
return this._show_audio_video(
|
99 |
},
|
100 |
show:function()
|
101 |
{
|
102 |
-
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[
|
103 |
}
|
104 |
}
|
105 |
);
|
1 |
+
$.fbuilder.controls['fMedia']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fMedia'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
ftype:"fMedia",
|
7 |
sMediaType:"image", // image, audio, video
|
47 |
_show_image: function()
|
48 |
{
|
49 |
var d = this.data.image,
|
50 |
+
esc = cff_esc_attr,
|
51 |
a = [],
|
52 |
l = [],
|
53 |
r = '';
|
54 |
|
55 |
+
if($.trim(d.sWidth)) a.push('width="'+esc(d.sWidth)+'"');
|
56 |
+
if($.trim(d.sHeight)) a.push('height="'+esc(d.sHeight)+'"');
|
57 |
+
if($.trim(d.sSrc)) a.push('src="'+esc(d.sSrc)+'"');
|
58 |
+
if($.trim(d.sAlt)) a.push('alt="'+esc(d.sAlt)+'"');
|
59 |
+
if($.trim(d.sLink))
|
60 |
{
|
61 |
+
l.push('href="'+esc(d.sLink)+'"');
|
62 |
+
if($.trim(d.sTarget)) l.push('target="'+esc(d.sTarget)+'"');
|
63 |
+
r = '<a '+l.join(' ')+' ><img '+a.join(' ')+' /></a>';
|
64 |
}
|
65 |
else
|
66 |
{
|
67 |
+
r = '<img '+a.join(' ')+' />';
|
68 |
}
|
69 |
|
70 |
return r;
|
71 |
},
|
72 |
+
_show_audio_video: function(d, isV)
|
73 |
{
|
74 |
+
var esc = cff_esc_attr,
|
75 |
a = [],
|
76 |
s = [],
|
77 |
+
t = (isV) ? 'video' : 'audio' ;
|
78 |
|
79 |
+
if($.trim(d.sWidth)) s.push('width:'+esc(d.sWidth)+';');
|
80 |
+
if(isV && $.trim(d.sHeight)) s.push('height:'+esc(d.sHeight)+';');
|
81 |
+
if(isV && $.trim(d.sPoster)) a.push('poster="'+esc(d.sPoster)+'"');
|
82 |
+
if($.trim(d.sSrc)) a.push('src="'+esc(d.sSrc)+'"');
|
83 |
+
if(d.sAutoplay) a.push('autoplay');
|
84 |
+
if(d.sControls) a.push('controls');
|
85 |
+
if(d.sLoop) a.push('loop');
|
86 |
+
if(d.sMuted) a.push('muted');
|
87 |
+
if(d.sHideDownload) a.push('controlsList="nodownload"');
|
88 |
+
a.push('preload="'+esc(d.sPreload)+'"');
|
89 |
|
90 |
+
return '<'+t+' '+a.join(' ')+' style="'+s.join(' ')+'">'+(($.trim(d.sSrcAlt)) ? '<source src="'+esc(d.sSrcAlt)+'" />' : '')+'<p>'+d.sFallback+'</p></'+t+'>';
|
91 |
},
|
92 |
_show_audio: function()
|
93 |
{
|
94 |
+
return this._show_audio_video(this.data.audio, false);
|
95 |
},
|
96 |
_show_video: function()
|
97 |
{
|
98 |
+
return this._show_audio_video(this.data.video, true);
|
99 |
},
|
100 |
show:function()
|
101 |
{
|
102 |
+
return '<div class="fields '+cff_esc_attr(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>';
|
103 |
}
|
104 |
}
|
105 |
);
|
js/fields-public/32_fbuilder.fbutton.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
ftype:"fButton",
|
7 |
sType:"button",
|
@@ -13,25 +13,25 @@
|
|
13 |
userhelp:"A description of the section goes here.",
|
14 |
show:function()
|
15 |
{
|
16 |
-
var esc =
|
17 |
type = this.sType,
|
18 |
clss = '';
|
19 |
|
20 |
-
if(
|
21 |
{
|
22 |
type = 'button';
|
23 |
clss = 'calculate-button';
|
24 |
}
|
25 |
-
if(
|
26 |
{
|
27 |
type = 'button';
|
28 |
}
|
29 |
-
else if(
|
30 |
{
|
31 |
clss = 'reset-button';
|
32 |
}
|
33 |
|
34 |
-
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(
|
35 |
},
|
36 |
after_show:function()
|
37 |
{
|
@@ -40,10 +40,10 @@
|
|
40 |
$('#'+this.name).click(
|
41 |
function()
|
42 |
{
|
43 |
-
var e = $(
|
44 |
-
if(
|
45 |
{
|
46 |
-
var items = $.fbuilder[
|
47 |
if(me.sLoading)
|
48 |
{
|
49 |
f.find('.cff-processing-form').remove();
|
@@ -54,7 +54,7 @@
|
|
54 |
{
|
55 |
if(me.sLoading) e.closest('#fbuilder').find('.cff-processing-form').remove();
|
56 |
$(document).off('equationsQueueEmpty');
|
57 |
-
for(var i = 0, h = items.length; i < h; i++
|
58 |
{
|
59 |
if(items[i].ftype == 'fsummary')
|
60 |
{
|
@@ -64,20 +64,20 @@
|
|
64 |
}
|
65 |
});
|
66 |
|
67 |
-
$.fbuilder[
|
68 |
}
|
69 |
-
if(
|
70 |
{
|
71 |
setTimeout(
|
72 |
function()
|
73 |
{
|
74 |
-
var id = f.attr(
|
75 |
f.validate().resetForm();
|
76 |
f.find(':data(manually)').removeData('manually');
|
77 |
-
$.fbuilder[
|
78 |
|
79 |
-
var page = parseInt(
|
80 |
-
if(
|
81 |
{
|
82 |
$.fbuilder.forms[fid]['currentPage'] = 0;
|
83 |
$("#fieldlist"+fid+" .pbreak").css("display","none");
|
@@ -94,7 +94,7 @@
|
|
94 |
}
|
95 |
}
|
96 |
if(f.data('evalequations')*1)
|
97 |
-
$.fbuilder['calculator'].defaultCalc(
|
98 |
},
|
99 |
50
|
100 |
);
|
@@ -106,7 +106,7 @@
|
|
106 |
PRINTFORM(me.sMultipage);
|
107 |
}
|
108 |
}
|
109 |
-
|
110 |
}
|
111 |
}
|
112 |
);
|
1 |
+
$.fbuilder.controls['fButton']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fButton'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
ftype:"fButton",
|
7 |
sType:"button",
|
13 |
userhelp:"A description of the section goes here.",
|
14 |
show:function()
|
15 |
{
|
16 |
+
var esc = cff_esc_attr,
|
17 |
type = this.sType,
|
18 |
clss = '';
|
19 |
|
20 |
+
if(this.sType == 'calculate')
|
21 |
{
|
22 |
type = 'button';
|
23 |
clss = 'calculate-button';
|
24 |
}
|
25 |
+
if(this.sType == 'print')
|
26 |
{
|
27 |
type = 'button';
|
28 |
}
|
29 |
+
else if(this.sType == 'reset')
|
30 |
{
|
31 |
clss = 'reset-button';
|
32 |
}
|
33 |
|
34 |
+
return '<div class="fields '+esc(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+'" /><span class="uh">'+this.userhelp+'</span><div class="clearer"></div></div>';
|
35 |
},
|
36 |
after_show:function()
|
37 |
{
|
40 |
$('#'+this.name).click(
|
41 |
function()
|
42 |
{
|
43 |
+
var e = $(this), f = e.closest('form'), fid = me.form_identifier;
|
44 |
+
if(e.hasClass('calculate-button'))
|
45 |
{
|
46 |
+
var items = $.fbuilder['forms'][fid].getItems();
|
47 |
if(me.sLoading)
|
48 |
{
|
49 |
f.find('.cff-processing-form').remove();
|
54 |
{
|
55 |
if(me.sLoading) e.closest('#fbuilder').find('.cff-processing-form').remove();
|
56 |
$(document).off('equationsQueueEmpty');
|
57 |
+
for(var i = 0, h = items.length; i < h; i++)
|
58 |
{
|
59 |
if(items[i].ftype == 'fsummary')
|
60 |
{
|
64 |
}
|
65 |
});
|
66 |
|
67 |
+
$.fbuilder['calculator'].defaultCalc('#'+e.closest('form').attr('id'), false);
|
68 |
}
|
69 |
+
if(e.hasClass('reset-button'))
|
70 |
{
|
71 |
setTimeout(
|
72 |
function()
|
73 |
{
|
74 |
+
var id = f.attr('id');
|
75 |
f.validate().resetForm();
|
76 |
f.find(':data(manually)').removeData('manually');
|
77 |
+
$.fbuilder['showHideDep']({ 'formIdentifier' : fid });
|
78 |
|
79 |
+
var page = parseInt(e.closest('.pbreak').attr('page'));
|
80 |
+
if(page)
|
81 |
{
|
82 |
$.fbuilder.forms[fid]['currentPage'] = 0;
|
83 |
$("#fieldlist"+fid+" .pbreak").css("display","none");
|
94 |
}
|
95 |
}
|
96 |
if(f.data('evalequations')*1)
|
97 |
+
$.fbuilder['calculator'].defaultCalc('#'+id, false);
|
98 |
},
|
99 |
50
|
100 |
);
|
106 |
PRINTFORM(me.sMultipage);
|
107 |
}
|
108 |
}
|
109 |
+
);
|
110 |
}
|
111 |
}
|
112 |
);
|
js/fields-public/34_fbuilder.fhtml.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
ftype:"fhtml",
|
7 |
fcontent:"",
|
@@ -10,7 +10,7 @@
|
|
10 |
var content = this.fcontent;
|
11 |
content = content.replace(/\(\s*document\s*\)\.one\(\s*['"]showHideDepEvent['"]/ig,
|
12 |
'(window).one("showHideDepEvent"');
|
13 |
-
return '<div class="fields '+this.csslayout+' '+this.name+' cff-html-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'" class="dfield">'+content+'</div><div class="clearer"></div></div>';
|
14 |
}
|
15 |
}
|
16 |
);
|
1 |
+
$.fbuilder.controls['fhtml']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fhtml'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
ftype:"fhtml",
|
7 |
fcontent:"",
|
10 |
var content = this.fcontent;
|
11 |
content = content.replace(/\(\s*document\s*\)\.one\(\s*['"]showHideDepEvent['"]/ig,
|
12 |
'(window).one("showHideDepEvent"');
|
13 |
+
return '<div class="fields '+cff_esc_attr(this.csslayout)+' '+this.name+' cff-html-field" id="field'+this.form_identifier+'-'+this.index+'"><div id="'+this.name+'" class="dfield">'+content+'</div><div class="clearer"></div></div>';
|
14 |
}
|
15 |
}
|
16 |
);
|
js/fields-public/36_fbuilder.acceptance.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Accept terms and conditions",
|
7 |
ftype:"facceptance",
|
@@ -18,18 +18,18 @@
|
|
18 |
|
19 |
if(!/^\s*$/.test(me.url))
|
20 |
{
|
21 |
-
label = '<a href="'
|
22 |
}
|
23 |
else if(!/^\s*$/.test(me.message))
|
24 |
{
|
25 |
label = '<a href="javascript:void(0);" class="cff-open-dlg">'+label+'</a>';
|
26 |
dlg += '<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+me.message+'</div></div>'
|
27 |
}
|
28 |
-
return '<div class="fields '+me.csslayout+(this.onoff ? ' cff-switch-container' : '')+' '+me.name+' cff-checkbox-field" id="field'+me.form_identifier+'-'+me.index+'"><div class="dfield">'+
|
29 |
-
'<div class="one_column"><label for="'+me.name+'"><input aria-label="'
|
30 |
(this.onoff ? '<span class="cff-switch"></span>': '') +
|
31 |
'<span>'+
|
32 |
-
|
33 |
'</span></label></div>'+dlg+'<span class="uh"></span></div><div class="clearer"></div></div>';
|
34 |
},
|
35 |
after_show:function()
|
@@ -53,9 +53,9 @@
|
|
53 |
raw = raw || false;
|
54 |
no_quotes = no_quotes || false;
|
55 |
var e = $('[id="'+this.name+'"]:checked:not(.ignore)');
|
56 |
-
if(
|
57 |
{
|
58 |
-
var t = $.fbuilder.parseValStr(
|
59 |
if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
|
60 |
}
|
61 |
return (t) ? (($.isNumeric(t) && !no_quotes) ? t : '"'+t+'"') : 0;
|
1 |
+
$.fbuilder.controls['facceptance']=function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['facceptance'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Accept terms and conditions",
|
7 |
ftype:"facceptance",
|
18 |
|
19 |
if(!/^\s*$/.test(me.url))
|
20 |
{
|
21 |
+
label = '<a href="'+cff_esc_attr($.trim(me.url))+'" target="_blank">'+label+'</a>';
|
22 |
}
|
23 |
else if(!/^\s*$/.test(me.message))
|
24 |
{
|
25 |
label = '<a href="javascript:void(0);" class="cff-open-dlg">'+label+'</a>';
|
26 |
dlg += '<div class="cff-dialog hide"><span class="cff-close-dlg"></span><div class="cff-dialog-content">'+me.message+'</div></div>'
|
27 |
}
|
28 |
+
return '<div class="fields '+cff_esc_attr(me.csslayout)+(this.onoff ? ' cff-switch-container' : '')+' '+me.name+' cff-checkbox-field" id="field'+me.form_identifier+'-'+me.index+'"><div class="dfield">'+
|
29 |
+
'<div class="one_column"><label for="'+me.name+'"><input aria-label="'+cff_esc_attr(me.title)+'" name="'+me.name+'" id="'+me.name+'" class="field required" value="'+cff_esc_attr(me.value)+'" vt="'+cff_esc_attr((/^\s*$/.test(me.value)) ? me.title : me.value)+'" type="checkbox" /> '+
|
30 |
(this.onoff ? '<span class="cff-switch"></span>': '') +
|
31 |
'<span>'+
|
32 |
+
cff_html_decode(label)+''+((me.required)?'<span class="r">*</span>':'')+
|
33 |
'</span></label></div>'+dlg+'<span class="uh"></span></div><div class="clearer"></div></div>';
|
34 |
},
|
35 |
after_show:function()
|
53 |
raw = raw || false;
|
54 |
no_quotes = no_quotes || false;
|
55 |
var e = $('[id="'+this.name+'"]:checked:not(.ignore)');
|
56 |
+
if(e.length)
|
57 |
{
|
58 |
+
var t = $.fbuilder.parseValStr(e[0].value, raw, no_quotes);
|
59 |
if(!$.isNumeric(t)) t = t.replace(/^"/,'').replace(/"$/,'');
|
60 |
}
|
61 |
return (t) ? (($.isNumeric(t) && !no_quotes) ? t : '"'+t+'"') : 0;
|
js/fields-public/fbuilder.fcalculated.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
$.fbuilder.controls[
|
2 |
$.extend(
|
3 |
-
$.fbuilder.controls[
|
4 |
-
$.fbuilder.controls[
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"fCalculated",
|
@@ -15,7 +15,7 @@
|
|
15 |
prefix:"",
|
16 |
decimalsymbol:".",
|
17 |
groupingsymbol:"",
|
18 |
-
dependencies:[
|
19 |
readonly:true,
|
20 |
currency:false,
|
21 |
noEvalIfManual:true,
|
@@ -29,7 +29,7 @@
|
|
29 |
show:function()
|
30 |
{
|
31 |
this.predefined = this._getAttr('predefined');
|
32 |
-
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;' : ''
|
33 |
},
|
34 |
after_show:function()
|
35 |
{
|
@@ -37,52 +37,52 @@
|
|
37 |
var me = this,
|
38 |
dependencies = [];
|
39 |
|
40 |
-
$.each(
|
41 |
{
|
42 |
-
d.rule = d.rule.replace(
|
43 |
-
if(
|
44 |
|
45 |
var fields = [];
|
46 |
-
$.each(
|
47 |
-
if(
|
48 |
{
|
49 |
-
fields.push(
|
50 |
}
|
51 |
});
|
52 |
|
53 |
-
if(
|
54 |
-
dependencies.push(
|
55 |
}
|
56 |
}
|
57 |
});
|
58 |
|
59 |
me.dependencies = dependencies;
|
60 |
var eq = me.eq;
|
61 |
-
eq = eq.replace(/\n/g, ' ').replace(/fieldname(\d+)/g, "fieldname$1"+me.form_identifier).replace(
|
62 |
|
63 |
-
if(
|
64 |
{
|
65 |
-
$.fbuilder.calculator.addEquation(
|
66 |
}
|
67 |
|
68 |
// Events
|
69 |
-
var e = $(
|
70 |
|
71 |
e.bind(
|
72 |
'calcualtedfield_changed',
|
73 |
{obj: me},
|
74 |
-
function(
|
75 |
-
if(
|
76 |
{
|
77 |
$.fbuilder.showHideDep(
|
78 |
{
|
79 |
'formIdentifier' : evt.data.obj.form_identifier,
|
80 |
'fieldIdentifier': evt.data.obj.name
|
81 |
}
|
82 |
-
|
83 |
}
|
84 |
}
|
85 |
-
|
86 |
if(!me.readonly)
|
87 |
{
|
88 |
if(me.noEvalIfManual) e.data('manually', 1);
|
@@ -93,7 +93,7 @@
|
|
93 |
e.data('manually') &&
|
94 |
e.data('manually') == 1 &&
|
95 |
me.formatDynamically
|
96 |
-
|
97 |
{
|
98 |
var v = me.val();
|
99 |
this.value = $.fbuilder.calculator.format(v, me.configuration());
|
@@ -106,40 +106,40 @@
|
|
106 |
|
107 |
$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){e.removeData('manually');});
|
108 |
},
|
109 |
-
showHideDep: function(
|
110 |
{
|
111 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
112 |
var me = this,
|
113 |
result = [];
|
114 |
|
115 |
-
if($.fbuilder[
|
116 |
{
|
117 |
-
var item = $(
|
118 |
identifier = me.form_identifier,
|
119 |
-
isHidden= (
|
120 |
d, n, dep,
|
121 |
clearRef = function(id){
|
122 |
-
if(
|
123 |
{
|
124 |
-
delete toShow[
|
125 |
-
if(
|
126 |
-
delete toShow[
|
127 |
}
|
128 |
},
|
129 |
hideField = function(id){
|
130 |
-
$(
|
131 |
-
$(
|
132 |
-
toHide[
|
133 |
};
|
134 |
|
135 |
try
|
136 |
{
|
137 |
-
d = item.attr(
|
138 |
-
if(
|
139 |
else d = [];
|
140 |
|
141 |
-
n = item.attr(
|
142 |
-
if(
|
143 |
else n = [];
|
144 |
|
145 |
if(isHidden)
|
@@ -148,32 +148,32 @@
|
|
148 |
d = [];
|
149 |
}
|
150 |
|
151 |
-
for (
|
152 |
{
|
153 |
if(!/fieldname/i.test(d[i])) continue;
|
154 |
dep = d[i]+identifier;
|
155 |
-
delete toHide[
|
156 |
-
if(
|
157 |
-
toShow[
|
158 |
-
toShow[
|
159 |
if(!(dep in hiddenByContainer))
|
160 |
{
|
161 |
-
$(
|
162 |
-
$(
|
163 |
}
|
164 |
-
if($.inArray(dep,result) == -1) result.push(
|
165 |
}
|
166 |
|
167 |
-
for (
|
168 |
{
|
169 |
if(!/fieldname/i.test(n[i])) continue;
|
170 |
dep = n[i]+identifier;
|
171 |
clearRef(dep);
|
172 |
if (
|
173 |
-
typeof toShow[
|
174 |
-
typeof toHide[
|
175 |
) hideField(dep);
|
176 |
-
if($.inArray(dep,result) == -1) result.push(
|
177 |
}
|
178 |
}
|
179 |
catch(e){}
|
@@ -184,17 +184,17 @@
|
|
184 |
{
|
185 |
raw = raw || false;
|
186 |
no_quotes = no_quotes || false;
|
187 |
-
var e = $(
|
188 |
-
if(
|
189 |
{
|
190 |
var v = e.val();
|
191 |
if(raw) return $.fbuilder.parseValStr(v, raw, no_quotes);
|
192 |
-
v = $.trim(
|
193 |
|
194 |
-
v = v.replace(
|
195 |
-
.replace(
|
196 |
|
197 |
-
return $.fbuilder.parseVal(
|
198 |
}
|
199 |
return 0;
|
200 |
}
|
@@ -204,53 +204,53 @@
|
|
204 |
/*
|
205 |
* Extend the window object with the methods of obj, the prefix is used to avoid redefine window methods
|
206 |
*/
|
207 |
-
$.fbuilder[
|
208 |
{
|
209 |
-
for(
|
210 |
{
|
211 |
-
window[
|
212 |
{
|
213 |
return function()
|
214 |
{
|
215 |
-
return m.obj[
|
216 |
};
|
217 |
})({ "method_name" : method, 'obj' : obj });
|
218 |
}
|
219 |
};
|
220 |
|
221 |
// Calculate Field code
|
222 |
-
$.fbuilder[
|
223 |
{
|
224 |
// Used to validate the equations results
|
225 |
var validators = [];
|
226 |
|
227 |
// Loading available modules
|
228 |
-
if(
|
229 |
{
|
230 |
-
var modules = $.fbuilder[
|
231 |
-
for(
|
232 |
{
|
233 |
-
if(
|
234 |
{
|
235 |
-
modules[
|
236 |
}
|
237 |
|
238 |
-
if(
|
239 |
{
|
240 |
-
validators.push(
|
241 |
}
|
242 |
}
|
243 |
}
|
244 |
|
245 |
// Private function to validate the equation results
|
246 |
-
_validate_result = function(
|
247 |
{
|
248 |
-
if(
|
249 |
{
|
250 |
var h = validators.length;
|
251 |
-
while(
|
252 |
{
|
253 |
-
if(
|
254 |
{
|
255 |
return true;
|
256 |
}
|
@@ -265,23 +265,23 @@
|
|
265 |
};
|
266 |
|
267 |
// Private function, the variable names in the equations are replaced by its values, return the equation result or false if error
|
268 |
-
_calculate = function(
|
269 |
{
|
270 |
-
var e = $.fbuilder['forms'][suffix].getItem(
|
271 |
__ME__ = e.val();
|
272 |
|
273 |
if($('#'+e.name).data('manually') == 1) return __ME__;
|
274 |
|
275 |
var _match,
|
276 |
-
field_regexp = new RegExp(
|
277 |
|
278 |
$.fbuilder['currentFormId'] = $.fbuilder['forms'][suffix].formId;
|
279 |
-
eq = '('
|
280 |
-
while (
|
281 |
{
|
282 |
-
var field = $.fbuilder[
|
283 |
v = '';
|
284 |
-
if(
|
285 |
{
|
286 |
if(_match[3] && _match[3] == '|n')
|
287 |
{
|
@@ -290,16 +290,16 @@
|
|
290 |
else
|
291 |
{
|
292 |
v = field.val((_match[3]) ? ((_match[3] == '|v') ? 'vt' : ((_match[3] == '|r') ? true : false)) : false);
|
293 |
-
if(
|
294 |
-
else if(
|
295 |
}
|
296 |
}
|
297 |
-
eq = eq.replace(
|
298 |
}
|
299 |
try
|
300 |
{
|
301 |
-
var r = eval(
|
302 |
-
return (
|
303 |
}
|
304 |
catch(e)
|
305 |
{
|
@@ -308,21 +308,21 @@
|
|
308 |
}
|
309 |
};
|
310 |
|
311 |
-
_checkValueThrowingEquation = function(
|
312 |
{
|
313 |
-
if(
|
314 |
-
if(
|
315 |
else
|
316 |
{
|
317 |
-
if(
|
318 |
{
|
319 |
-
t.removeAttr(
|
320 |
-
obj.Calculate(
|
321 |
return;
|
322 |
}
|
323 |
-
t.attr(
|
324 |
}
|
325 |
-
t.attr(
|
326 |
};
|
327 |
|
328 |
// The public object
|
@@ -346,97 +346,97 @@
|
|
346 |
if(form_identifier in this.pendings) return this.pendings[form_identifier];
|
347 |
return 0;
|
348 |
},
|
349 |
-
addEquation : function(
|
350 |
{
|
351 |
var equation_result = $('[id="'+fieldObj.name+'"]');
|
352 |
if(equation_result.length)
|
353 |
{
|
354 |
var form = equation_result[0].form,
|
355 |
equationObj, field,
|
356 |
-
regexp = new RegExp(
|
357 |
match;
|
358 |
|
359 |
-
if(
|
360 |
var i, j=-1, h = form.equations.length;
|
361 |
|
362 |
// Avoid insert the equation multiple times to the form
|
363 |
-
for(
|
364 |
{
|
365 |
-
if(
|
366 |
-
if(
|
367 |
}
|
368 |
|
369 |
// The equation hasn't been inserted previously
|
370 |
-
if(
|
371 |
{
|
372 |
/* conf attribute only for compatibility */
|
373 |
equationObj = {'result':fieldObj.name, 'resultField':fieldObj, 'equation':equation, 'conf':fieldObj.configuration(), 'dep':dependencies, 'identifier':form_identifier};
|
374 |
form.equations.splice(i, 0, equationObj);
|
375 |
-
while (
|
376 |
{
|
377 |
-
field = $.fbuilder[
|
378 |
-
if(
|
379 |
{
|
380 |
-
if(
|
381 |
-
field.usedInEquations.push(
|
382 |
}
|
383 |
-
equation = equation.replace(
|
384 |
}
|
385 |
}
|
386 |
}
|
387 |
|
388 |
},
|
389 |
-
enqueueEquation : function(
|
390 |
{
|
391 |
-
if(
|
392 |
-
this.queued_equations[
|
393 |
-
var queue = this.queued_equations[
|
394 |
|
395 |
-
for(
|
396 |
{
|
397 |
f = -1;
|
398 |
-
for(
|
399 |
{
|
400 |
-
if(
|
401 |
-
if(
|
402 |
}
|
403 |
-
if(
|
404 |
{
|
405 |
-
queue.splice(j, 0, equations[
|
406 |
}
|
407 |
}
|
408 |
},
|
409 |
-
getDepList : function(
|
410 |
{
|
411 |
var list = [], // Fields that comply the rules
|
412 |
list_h = []; // Fields that don't comply the rules
|
413 |
|
414 |
// The value is correct and the field has dependencies
|
415 |
-
if(
|
416 |
{
|
417 |
-
for(
|
418 |
{
|
419 |
try
|
420 |
{
|
421 |
// Get the rule and evaluate
|
422 |
var rule = eval(dependencies[i].rule.replace(/value\|r/gi, values.raw).replace(/value/gi, values.value));
|
423 |
-
$.each(
|
424 |
{
|
425 |
-
if(
|
426 |
{
|
427 |
-
if(
|
428 |
{
|
429 |
var k = $.inArray(e, list_h);
|
430 |
while(k != -1)
|
431 |
{
|
432 |
-
list_h.splice(
|
433 |
k = $.inArray(e, list_h);
|
434 |
}
|
435 |
-
if(
|
436 |
}
|
437 |
else
|
438 |
{
|
439 |
-
if(
|
440 |
}
|
441 |
}
|
442 |
});
|
@@ -450,71 +450,71 @@
|
|
450 |
}
|
451 |
}
|
452 |
|
453 |
-
$('[id="'+calculated_field+'"]').attr(
|
454 |
return list.length || list_h.length;
|
455 |
},
|
456 |
|
457 |
-
defaultCalc : function(
|
458 |
{
|
459 |
var dep = false;
|
460 |
form = $(form);
|
461 |
|
462 |
// The form exists and has equations
|
463 |
-
if(
|
464 |
{
|
465 |
-
var fSec = form.attr('id').match(
|
466 |
if(enqueued)
|
467 |
{
|
468 |
-
this.processQueue(
|
469 |
}
|
470 |
-
else if(
|
471 |
{
|
472 |
-
this.queued_equations[
|
473 |
-
this.processQueue(
|
474 |
}
|
475 |
-
$(
|
476 |
}
|
477 |
},
|
478 |
|
479 |
-
Calculate : function (
|
480 |
{
|
481 |
-
if(
|
482 |
var id = field.id.replace(/_[cr]b\d+$/i,''),
|
483 |
-
fSec = id.match(
|
484 |
item,
|
485 |
me = this;
|
486 |
|
487 |
-
if(
|
488 |
{
|
489 |
-
fSec = (
|
490 |
-
item = $.fbuilder[
|
491 |
-
if(
|
492 |
{
|
493 |
-
me.enqueueEquation(
|
494 |
-
me.processQueue(
|
495 |
}
|
496 |
}
|
497 |
},
|
498 |
-
processQueue : function(
|
499 |
{
|
500 |
-
if(
|
501 |
this.processing_queue[fSec] = true;
|
502 |
|
503 |
-
if(
|
504 |
{
|
505 |
-
var queue = this.queued_equations[
|
506 |
-
while(
|
507 |
{
|
508 |
eq_obj = queue.shift();
|
509 |
$.fbuilder['currentEq'] = eq_obj;
|
510 |
-
var field = $(
|
511 |
-
result = _calculate(
|
512 |
bk = field.data('bk');
|
513 |
|
514 |
-
field.val(
|
515 |
if(bk != field.val())
|
516 |
{
|
517 |
-
field.trigger(
|
518 |
field.change();
|
519 |
}
|
520 |
field.data('bk',field.val());
|
@@ -524,32 +524,32 @@
|
|
524 |
this.processing_queue[fSec] = false;
|
525 |
if(!this.thereIsPending(fSec)) $(document).trigger('equationsQueueEmpty', [fSec]);
|
526 |
},
|
527 |
-
format : function(
|
528 |
{
|
529 |
config = $.extend({}, config);
|
530 |
-
if(
|
531 |
{
|
532 |
var symbol = '', isNumeric = false;
|
533 |
-
if(
|
534 |
{
|
535 |
isNumeric = true;
|
536 |
-
if(
|
537 |
-
var parts = value.toString().replace(
|
538 |
counter = 0,
|
539 |
str = '';
|
540 |
|
541 |
if(config.groupingsymbol)
|
542 |
{
|
543 |
-
for(
|
544 |
counter++;
|
545 |
-
str = parts[0][i]
|
546 |
-
if(
|
547 |
|
548 |
}
|
549 |
parts[0] = str;
|
550 |
}
|
551 |
if(!('decimalsymbol' in config)) config.decimalsymbol = '.';
|
552 |
-
value = parts.join(
|
553 |
}
|
554 |
|
555 |
if(config.currency && !isNumeric)
|
@@ -558,24 +558,24 @@
|
|
558 |
delete config.suffix;
|
559 |
}
|
560 |
|
561 |
-
if(
|
562 |
{
|
563 |
if(!config.currency)
|
564 |
{
|
565 |
-
value = symbol
|
566 |
symbol = '';
|
567 |
}
|
568 |
-
value = config.prefix
|
569 |
}
|
570 |
|
571 |
-
if(
|
572 |
|
573 |
value = symbol+value;
|
574 |
}
|
575 |
return value;
|
576 |
},
|
577 |
|
578 |
-
unformat : function(
|
579 |
{
|
580 |
var escapeSymbol = $.fbuilder.escapeSymbol;
|
581 |
|
@@ -588,26 +588,26 @@
|
|
588 |
{
|
589 |
var c = eq[i].resultField.configuration(); // Configuration object
|
590 |
|
591 |
-
if(
|
592 |
{
|
593 |
-
v = v.replace(
|
594 |
}
|
595 |
|
596 |
-
if(
|
597 |
{
|
598 |
-
v = v.replace(
|
599 |
}
|
600 |
|
601 |
-
if(
|
602 |
{
|
603 |
-
if(
|
604 |
{
|
605 |
-
v = v.replace(
|
606 |
}
|
607 |
|
608 |
-
if(
|
609 |
{
|
610 |
-
v = v.replace(
|
611 |
}
|
612 |
}
|
613 |
}
|
@@ -619,27 +619,27 @@
|
|
619 |
var obj = new CalcFieldClss();
|
620 |
|
621 |
// Associate events to the document for throw the corresponding equations
|
622 |
-
$(
|
623 |
{
|
624 |
// If evalequations = 0 the equations shouldn't be evaluated dynamically
|
625 |
-
var t = $(
|
626 |
-
f = t.closest(
|
627 |
-
evalequations = f.attr(
|
628 |
-
evalequationsevent = f.attr(
|
629 |
|
630 |
if(
|
631 |
typeof evalequations != 'undefined' &&
|
632 |
evalequations*1 == 0 &&
|
633 |
(
|
634 |
-
!(t.hasClass('codepeoplecalculatedfield'
|
635 |
-
(t.hasClass('codepeoplecalculatedfield'
|
636 |
-
|
637 |
)
|
638 |
{
|
639 |
return;
|
640 |
}
|
641 |
|
642 |
-
if(
|
643 |
{
|
644 |
if('undefined' != typeof evalequationsevent && evalequationsevent*1 == 1)
|
645 |
{
|
@@ -647,16 +647,16 @@
|
|
647 |
}
|
648 |
// The key out of range
|
649 |
if(evt.keyCode && (evt.keyCode >= 33 && evt.keyCode <= 40)) return;
|
650 |
-
_checkValueThrowingEquation(
|
651 |
}
|
652 |
else
|
653 |
{
|
654 |
-
if(
|
655 |
(
|
656 |
(
|
657 |
-
t.prop(
|
658 |
-
/(text|number|email|password)/.test(t.attr(
|
659 |
-
t.prop(
|
660 |
) &&
|
661 |
evt.type != 'change'
|
662 |
)
|
@@ -664,12 +664,12 @@
|
|
664 |
{
|
665 |
return;
|
666 |
}
|
667 |
-
obj.Calculate(
|
668 |
}
|
669 |
});
|
670 |
|
671 |
//Associate an event to the document waiting for the showHideDepEvent and recalculate all equations
|
672 |
-
$(document).on(
|
673 |
{
|
674 |
// If evalequations = 0 the equations shouldn't be evaluated dynamically
|
675 |
var f, evalequations, first_time;
|
@@ -680,14 +680,14 @@
|
|
680 |
{
|
681 |
first_time = (typeof f.data('first_time') == 'undefined');
|
682 |
f.data('first_time', 0);
|
683 |
-
evalequations = f.data(
|
684 |
-
if(
|
685 |
{
|
686 |
-
if(first_time) obj.defaultCalc(
|
687 |
-
else obj.defaultCalc(
|
688 |
}
|
689 |
}
|
690 |
});
|
691 |
return obj; // Return the public object
|
692 |
}
|
693 |
-
|
1 |
+
$.fbuilder.controls['fCalculated'] = function(){};
|
2 |
$.extend(
|
3 |
+
$.fbuilder.controls['fCalculated'].prototype,
|
4 |
+
$.fbuilder.controls['ffields'].prototype,
|
5 |
{
|
6 |
title:"Untitled",
|
7 |
ftype:"fCalculated",
|
15 |
prefix:"",
|
16 |
decimalsymbol:".",
|
17 |
groupingsymbol:"",
|
18 |
+
dependencies:[{'rule' : '', 'complex' : false, 'fields' : [''] }],
|
19 |
readonly:true,
|
20 |
currency:false,
|
21 |
noEvalIfManual:true,
|
29 |
show:function()
|
30 |
{
|
31 |
this.predefined = this._getAttr('predefined');
|
32 |
+
return '<div class="fields '+cff_esc_attr(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 aria-label="'+cff_esc_attr(this.title)+'" id="'+this.name+'" name="'+this.name+'" '+((this.readonly) ? ' readonly ' : '')+' '+((!/^\s*$/.test(this.min)) ? 'min="'+cff_esc_attr($.fbuilder.parseVal(this._getAttr('min'), this.thousandSeparator, this.decimalSymbol))+'" ' : '')+((!/^\s*$/.test(this.max)) ? ' max="'+cff_esc_attr($.fbuilder.parseVal(this._getAttr('max'), this.thousandSeparator, this.decimalSymbol))+'" ' : '')+' class="codepeoplecalculatedfield field '+this.size+((this.required)?" required":"")+'" type="'+((this.hidefield) ? 'hidden' : 'text')+'" value="'+cff_esc_attr(this.predefined)+'" />'+((!this.hidefield) ? '<span class="uh">'+this.userhelp+'</span>' : '')+'</div><div class="clearer"></div></div>';
|
33 |
},
|
34 |
after_show:function()
|
35 |
{
|
37 |
var me = this,
|
38 |
dependencies = [];
|
39 |
|
40 |
+
$.each(me.dependencies, function(i, d)
|
41 |
{
|
42 |
+
d.rule = d.rule.replace(/^\s+/, '').replace(/\s+$/, '');
|
43 |
+
if(d.rule != '' && d.fields.length){
|
44 |
|
45 |
var fields = [];
|
46 |
+
$.each(d.fields, function(j, f){
|
47 |
+
if(f != '')
|
48 |
{
|
49 |
+
fields.push(f);
|
50 |
}
|
51 |
});
|
52 |
|
53 |
+
if(fields.length){
|
54 |
+
dependencies.push({ 'rule' : d.rule, 'fields' : fields });
|
55 |
}
|
56 |
}
|
57 |
});
|
58 |
|
59 |
me.dependencies = dependencies;
|
60 |
var eq = me.eq;
|
61 |
+
eq = eq.replace(/\n/g, ' ').replace(/fieldname(\d+)/g, "fieldname$1"+me.form_identifier).replace(/form_identifier/g, '\''+this['form_identifier']+'\'').replace(/;\s*\)/g, ')').replace(/;\s*$/, '');
|
62 |
|
63 |
+
if(!/^\s*$/.test(eq))
|
64 |
{
|
65 |
+
$.fbuilder.calculator.addEquation(me, eq, dependencies, me.form_identifier);
|
66 |
}
|
67 |
|
68 |
// Events
|
69 |
+
var e = $('[id="'+me.name+'"]');
|
70 |
|
71 |
e.bind(
|
72 |
'calcualtedfield_changed',
|
73 |
{obj: me},
|
74 |
+
function(evt){
|
75 |
+
if($.fbuilder['calculator'].getDepList(evt.data.obj.name, {value: evt.data.obj.val(), raw: evt.data.obj.val(true)}, evt.data.obj.dependencies))
|
76 |
{
|
77 |
$.fbuilder.showHideDep(
|
78 |
{
|
79 |
'formIdentifier' : evt.data.obj.form_identifier,
|
80 |
'fieldIdentifier': evt.data.obj.name
|
81 |
}
|
82 |
+
);
|
83 |
}
|
84 |
}
|
85 |
+
).on('keyup', function(){
|
86 |
if(!me.readonly)
|
87 |
{
|
88 |
if(me.noEvalIfManual) e.data('manually', 1);
|
93 |
e.data('manually') &&
|
94 |
e.data('manually') == 1 &&
|
95 |
me.formatDynamically
|
96 |
+
)
|
97 |
{
|
98 |
var v = me.val();
|
99 |
this.value = $.fbuilder.calculator.format(v, me.configuration());
|
106 |
|
107 |
$('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){e.removeData('manually');});
|
108 |
},
|
109 |
+
showHideDep: function(toShow, toHide, hiddenByContainer, interval)
|
110 |
{
|
111 |
if(typeof hiddenByContainer == 'undefined') hiddenByContainer = {};
|
112 |
var me = this,
|
113 |
result = [];
|
114 |
|
115 |
+
if($.fbuilder['calculator'].getDepList(me.name, {value: me.val(), raw: me.val(true)}, me.dependencies))
|
116 |
{
|
117 |
+
var item = $('#'+me.name),
|
118 |
identifier = me.form_identifier,
|
119 |
+
isHidden= (typeof toHide[me.name] != 'undefined' || typeof hiddenByContainer[me.name] != 'undefined'),
|
120 |
d, n, dep,
|
121 |
clearRef = function(id){
|
122 |
+
if(typeof toShow[id] != 'undefined')
|
123 |
{
|
124 |
+
delete toShow[id]['ref'][me.name];
|
125 |
+
if($.isEmptyObject(toShow[id]['ref']))
|
126 |
+
delete toShow[id];
|
127 |
}
|
128 |
},
|
129 |
hideField = function(id){
|
130 |
+
$('[id*="'+id+'"],.'+id).closest('.fields').hide();
|
131 |
+
$('[id*="'+id+'"]:not(.ignore)').addClass('ignore');
|
132 |
+
toHide[id] = {};
|
133 |
};
|
134 |
|
135 |
try
|
136 |
{
|
137 |
+
d = item.attr('dep');
|
138 |
+
if(typeof d != 'undefined' && !/^\s*$/.test(d)) d = d.split(',');
|
139 |
else d = [];
|
140 |
|
141 |
+
n = item.attr('notdep');
|
142 |
+
if(typeof n != 'undefined' && !/^\s*$/.test(n)) n = n.split(',');
|
143 |
else n = [];
|
144 |
|
145 |
if(isHidden)
|
148 |
d = [];
|
149 |
}
|
150 |
|
151 |
+
for (i=0; i<d.length; i++)
|
152 |
{
|
153 |
if(!/fieldname/i.test(d[i])) continue;
|
154 |
dep = d[i]+identifier;
|
155 |
+
delete toHide[dep];
|
156 |
+
if(typeof toShow[dep] == 'undefined')
|
157 |
+
toShow[dep] = { 'ref': {}};
|
158 |
+
toShow[dep]['ref'][me.name] = 1;
|
159 |
if(!(dep in hiddenByContainer))
|
160 |
{
|
161 |
+
$('[id*="'+dep+'"],.'+dep).closest('.fields').fadeIn(interval || 0);
|
162 |
+
$('[id*="'+dep+'"].ignore').removeClass('ignore');
|
163 |
}
|
164 |
+
if($.inArray(dep,result) == -1) result.push(dep);
|
165 |
}
|
166 |
|
167 |
+
for (i=0; i<n.length; i++)
|
168 |
{
|
169 |
if(!/fieldname/i.test(n[i])) continue;
|
170 |
dep = n[i]+identifier;
|
171 |
clearRef(dep);
|
172 |
if (
|
173 |
+
typeof toShow[dep] == 'undefined' &&
|
174 |
+
typeof toHide[dep] == 'undefined'
|
175 |
) hideField(dep);
|
176 |
+
if($.inArray(dep,result) == -1) result.push(dep);
|
177 |
}
|
178 |
}
|
179 |
catch(e){}
|
184 |
{
|
185 |
raw = raw || false;
|
186 |
no_quotes = no_quotes || false;
|
187 |
+
var e = $('[id="'+this.name+'"]:not(.ignore)');
|
188 |
+
if(e.length)
|
189 |
{
|
190 |
var v = e.val();
|
191 |
if(raw) return $.fbuilder.parseValStr(v, raw, no_quotes);
|
192 |
+
v = $.trim(v);
|
193 |
|
194 |
+
v = v.replace(new RegExp($.fbuilder['escapeSymbol'](this.prefix), 'g'), '')
|
195 |
+
.replace(new RegExp($.fbuilder['escapeSymbol'](this.suffix), 'g'), '');
|
196 |
|
197 |
+
return $.fbuilder.parseVal(v, this.groupingsymbol, this.decimalsymbol, no_quotes);
|
198 |
}
|
199 |
return 0;
|
200 |
}
|
204 |
/*
|
205 |
* Extend the window object with the methods of obj, the prefix is used to avoid redefine window methods
|
206 |
*/
|
207 |
+
$.fbuilder['extend_window'] = function(prefix, obj)
|
208 |
{
|
209 |
+
for(method in obj)
|
210 |
{
|
211 |
+
window[prefix+method] = (function(m)
|
212 |
{
|
213 |
return function()
|
214 |
{
|
215 |
+
return m.obj[m.method_name].apply(m.obj, arguments);
|
216 |
};
|
217 |
})({ "method_name" : method, 'obj' : obj });
|
218 |
}
|
219 |
};
|
220 |
|
221 |
// Calculate Field code
|
222 |
+
$.fbuilder['calculator'] = (function()
|
223 |
{
|
224 |
// Used to validate the equations results
|
225 |
var validators = [];
|
226 |
|
227 |
// Loading available modules
|
228 |
+
if(typeof $.fbuilder['modules'] != 'undefined')
|
229 |
{
|
230 |
+
var modules = $.fbuilder['modules'];
|
231 |
+
for(var module in modules)
|
232 |
{
|
233 |
+
if(typeof modules[module]['callback'] != 'undefined')
|
234 |
{
|
235 |
+
modules[module]['callback']();
|
236 |
}
|
237 |
|
238 |
+
if(typeof modules[module]['validator'] != 'undefined')
|
239 |
{
|
240 |
+
validators.push(modules[module]['validator']);
|
241 |
}
|
242 |
}
|
243 |
}
|
244 |
|
245 |
// Private function to validate the equation results
|
246 |
+
_validate_result = function(v)
|
247 |
{
|
248 |
+
if(validators.length)
|
249 |
{
|
250 |
var h = validators.length;
|
251 |
+
while(h--)
|
252 |
{
|
253 |
+
if(validators[h](v))
|
254 |
{
|
255 |
return true;
|
256 |
}
|
265 |
};
|
266 |
|
267 |
// Private function, the variable names in the equations are replaced by its values, return the equation result or false if error
|
268 |
+
_calculate = function(eq, suffix, __ME__)
|
269 |
{
|
270 |
+
var e = $.fbuilder['forms'][suffix].getItem(__ME__),
|
271 |
__ME__ = e.val();
|
272 |
|
273 |
if($('#'+e.name).data('manually') == 1) return __ME__;
|
274 |
|
275 |
var _match,
|
276 |
+
field_regexp = new RegExp('(fieldname\\d+'+suffix+')(_[cr]b\\d+)?(\\|[rnv])?([\\D\\b])','i');
|
277 |
|
278 |
$.fbuilder['currentFormId'] = $.fbuilder['forms'][suffix].formId;
|
279 |
+
eq = '('+eq+')';
|
280 |
+
while (_match = field_regexp.exec(eq))
|
281 |
{
|
282 |
+
var field = $.fbuilder['forms'][suffix].getItem(_match[1]),
|
283 |
v = '';
|
284 |
+
if(field)
|
285 |
{
|
286 |
if(_match[3] && _match[3] == '|n')
|
287 |
{
|
290 |
else
|
291 |
{
|
292 |
v = field.val((_match[3]) ? ((_match[3] == '|v') ? 'vt' : ((_match[3] == '|r') ? true : false)) : false);
|
293 |
+
if(typeof v == 'object' && typeof window.JSON != 'undefined') v = JSON.stringify(v);
|
294 |
+
else if($.isNumeric(v)) v = '('+v+')';
|
295 |
}
|
296 |
}
|
297 |
+
eq = eq.replace(_match[0], v+''+_match[4]); // Replace the variable name by value
|
298 |
}
|
299 |
try
|
300 |
{
|
301 |
+
var r = eval(eq.replace(/^\(/, '').replace(/\)$/, '').replace(/\b__ME__\b/g, __ME__)); // Evaluate the final equation
|
302 |
+
return (typeof r != 'undefined' && _validate_result(r)) ? r : false;
|
303 |
}
|
304 |
catch(e)
|
305 |
{
|
308 |
}
|
309 |
};
|
310 |
|
311 |
+
_checkValueThrowingEquation = function(t)
|
312 |
{
|
313 |
+
if(typeof t.attr('data-timeout') != 'undefined') clearTimeout(t.attr('data-timeout'));
|
314 |
+
if(typeof t.attr('data-previousvalue') == 'undefined') t.attr('data-previousvalue', t.val());
|
315 |
else
|
316 |
{
|
317 |
+
if(t.val() == t.attr('data-previousvalue'))
|
318 |
{
|
319 |
+
t.removeAttr('data-timeout');
|
320 |
+
obj.Calculate(t[0]);
|
321 |
return;
|
322 |
}
|
323 |
+
t.attr('data-previousvalue', t.val());
|
324 |
}
|
325 |
+
t.attr('data-timeout', setTimeout(_checkValueThrowingEquation, 500, t));
|
326 |
};
|
327 |
|
328 |
// The public object
|
346 |
if(form_identifier in this.pendings) return this.pendings[form_identifier];
|
347 |
return 0;
|
348 |
},
|
349 |
+
addEquation : function(fieldObj, equation, dependencies, form_identifier)
|
350 |
{
|
351 |
var equation_result = $('[id="'+fieldObj.name+'"]');
|
352 |
if(equation_result.length)
|
353 |
{
|
354 |
var form = equation_result[0].form,
|
355 |
equationObj, field,
|
356 |
+
regexp = new RegExp('(fieldname\\d+)_'),
|
357 |
match;
|
358 |
|
359 |
+
if(typeof form.equations == 'undefined') form['equations'] = [];
|
360 |
var i, j=-1, h = form.equations.length;
|
361 |
|
362 |
// Avoid insert the equation multiple times to the form
|
363 |
+
for(i = 0 ; i < h; i++)
|
364 |
{
|
365 |
+
if(form.equations[i].result == fieldObj.name) break;
|
366 |
+
if(form.equations[i].equation.match(fieldObj.name)){ j = i; break; }
|
367 |
}
|
368 |
|
369 |
// The equation hasn't been inserted previously
|
370 |
+
if(i == h || j != -1)
|
371 |
{
|
372 |
/* conf attribute only for compatibility */
|
373 |
equationObj = {'result':fieldObj.name, 'resultField':fieldObj, 'equation':equation, 'conf':fieldObj.configuration(), 'dep':dependencies, 'identifier':form_identifier};
|
374 |
form.equations.splice(i, 0, equationObj);
|
375 |
+
while (match = regexp.exec(equation))
|
376 |
{
|
377 |
+
field = $.fbuilder['forms'][form_identifier].getItem(match[1]+form_identifier);
|
378 |
+
if(field)
|
379 |
{
|
380 |
+
if(typeof field.usedInEquations == 'undefined') field.usedInEquations = [];
|
381 |
+
field.usedInEquations.push(equationObj);
|
382 |
}
|
383 |
+
equation = equation.replace(new RegExp(match[0], 'g'), '');
|
384 |
}
|
385 |
}
|
386 |
}
|
387 |
|
388 |
},
|
389 |
+
enqueueEquation : function(form_identifier, equations)
|
390 |
{
|
391 |
+
if(typeof this.queued_equations[form_identifier] == 'undefined')
|
392 |
+
this.queued_equations[form_identifier] = [];
|
393 |
+
var queue = this.queued_equations[form_identifier], f;
|
394 |
|
395 |
+
for(var i = 0, h = equations.length; i < h; i++)
|
396 |
{
|
397 |
f = -1;
|
398 |
+
for(var j = 0, k = queue.length; j < k; j++)
|
399 |
{
|
400 |
+
if(queue[j].result == equations[i].result) break;
|
401 |
+
if(queue[j].equation.match(equations[i].result)){ f = j; break; }
|
402 |
}
|
403 |
+
if(j == k || f != -1)
|
404 |
{
|
405 |
+
queue.splice(j, 0, equations[i]);
|
406 |
}
|
407 |
}
|
408 |
},
|
409 |
+
getDepList : function(calculated_field, values, dependencies) // Get the list of dependent fields
|
410 |
{
|
411 |
var list = [], // Fields that comply the rules
|
412 |
list_h = []; // Fields that don't comply the rules
|
413 |
|
414 |
// The value is correct and the field has dependencies
|
415 |
+
if(values.value !== false && dependencies.length)
|
416 |
{
|
417 |
+
for(var i = 0, h = dependencies.length; i < h; i++)
|
418 |
{
|
419 |
try
|
420 |
{
|
421 |
// Get the rule and evaluate
|
422 |
var rule = eval(dependencies[i].rule.replace(/value\|r/gi, values.raw).replace(/value/gi, values.value));
|
423 |
+
$.each(dependencies[i].fields, function(j, e)
|
424 |
{
|
425 |
+
if(e != '')
|
426 |
{
|
427 |
+
if(rule)
|
428 |
{
|
429 |
var k = $.inArray(e, list_h);
|
430 |
while(k != -1)
|
431 |
{
|
432 |
+
list_h.splice(k, 1);
|
433 |
k = $.inArray(e, list_h);
|
434 |
}
|
435 |
+
if($.inArray(e, list) == -1) list.push(e);
|
436 |
}
|
437 |
else
|
438 |
{
|
439 |
+
if($.inArray(e, list) == -1) list_h.push(e);
|
440 |
}
|
441 |
}
|
442 |
});
|
450 |
}
|
451 |
}
|
452 |
|
453 |
+
$('[id="'+calculated_field+'"]').attr('dep', list.join(',')).attr('notdep', list_h.join(','));
|
454 |
return list.length || list_h.length;
|
455 |
},
|
456 |
|
457 |
+
defaultCalc : function(form, enqueued) // Evaluate all equations in form
|
458 |
{
|
459 |
var dep = false;
|
460 |
form = $(form);
|
461 |
|
462 |
// The form exists and has equations
|
463 |
+
if(form.length)
|
464 |
{
|
465 |
+
var fSec = form.attr('id').match(/_\d+$/)[0];
|
466 |
if(enqueued)
|
467 |
{
|
468 |
+
this.processQueue(fSec);
|
469 |
}
|
470 |
+
else if(typeof form[0].equations != 'undefined')
|
471 |
{
|
472 |
+
this.queued_equations[fSec] = form[0].equations.slice(0);
|
473 |
+
this.processQueue(fSec);
|
474 |
}
|
475 |
+
$(form).trigger('cpcff_default_calc');
|
476 |
}
|
477 |
},
|
478 |
|
479 |
+
Calculate : function (field)
|
480 |
{
|
481 |
+
if(field.id == undefined) return;
|
482 |
var id = field.id.replace(/_[cr]b\d+$/i,''),
|
483 |
+
fSec = id.match(/(_\d+)?_\d+$/),
|
484 |
item,
|
485 |
me = this;
|
486 |
|
487 |
+
if(fSec)
|
488 |
{
|
489 |
+
fSec = (typeof fSec[1] != 'undefined') ? fSec[1] : fSec[0];
|
490 |
+
item = $.fbuilder['forms'][fSec].getItem(id);
|
491 |
+
if(item && typeof item['usedInEquations'] != 'undefined')
|
492 |
{
|
493 |
+
me.enqueueEquation(fSec, item.usedInEquations);
|
494 |
+
me.processQueue(fSec);
|
495 |
}
|
496 |
}
|
497 |
},
|
498 |
+
processQueue : function(fSec)
|
499 |
{
|
500 |
+
if(fSec in this.processing_queue && this.processing_queue[fSec]) return;
|
501 |
this.processing_queue[fSec] = true;
|
502 |
|
503 |
+
if(typeof this.queued_equations[fSec] != 'undefined')
|
504 |
{
|
505 |
+
var queue = this.queued_equations[fSec], eq_obj;
|
506 |
+
while(queue.length)
|
507 |
{
|
508 |
eq_obj = queue.shift();
|
509 |
$.fbuilder['currentEq'] = eq_obj;
|
510 |
+
var field = $('[id="'+eq_obj.result+'"]'),
|
511 |
+
result = _calculate(eq_obj.equation, eq_obj.identifier, eq_obj.result),
|
512 |
bk = field.data('bk');
|
513 |
|
514 |
+
field.val((result !== false) ? this.format(result, eq_obj.resultField.configuration()) : '');
|
515 |
if(bk != field.val())
|
516 |
{
|
517 |
+
field.trigger('calcualtedfield_changed');
|
518 |
field.change();
|
519 |
}
|
520 |
field.data('bk',field.val());
|
524 |
this.processing_queue[fSec] = false;
|
525 |
if(!this.thereIsPending(fSec)) $(document).trigger('equationsQueueEmpty', [fSec]);
|
526 |
},
|
527 |
+
format : function(value, config)
|
528 |
{
|
529 |
config = $.extend({}, config);
|
530 |
+
if(!/^\s*$/.test(value))
|
531 |
{
|
532 |
var symbol = '', isNumeric = false;
|
533 |
+
if($.isNumeric(value) && !/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)/.test(value))
|
534 |
{
|
535 |
isNumeric = true;
|
536 |
+
if(value < 0) symbol = '-';
|
537 |
+
var parts = value.toString().replace("-", "").split("."),
|
538 |
counter = 0,
|
539 |
str = '';
|
540 |
|
541 |
if(config.groupingsymbol)
|
542 |
{
|
543 |
+
for(var i = parts[0].length-1; i >= 0; i--){
|
544 |
counter++;
|
545 |
+
str = parts[0][i]+str;
|
546 |
+
if(counter%3 == 0 && i != 0) str = config.groupingsymbol+str;
|
547 |
|
548 |
}
|
549 |
parts[0] = str;
|
550 |
}
|
551 |
if(!('decimalsymbol' in config)) config.decimalsymbol = '.';
|
552 |
+
value = parts.join(config.decimalsymbol);
|
553 |
}
|
554 |
|
555 |
if(config.currency && !isNumeric)
|
558 |
delete config.suffix;
|
559 |
}
|
560 |
|
561 |
+
if(config.prefix)
|
562 |
{
|
563 |
if(!config.currency)
|
564 |
{
|
565 |
+
value = symbol+value;
|
566 |
symbol = '';
|
567 |
}
|
568 |
+
value = config.prefix+value;
|
569 |
}
|
570 |
|
571 |
+
if(config.suffix) value += config.suffix;
|
572 |
|
573 |
value = symbol+value;
|
574 |
}
|
575 |
return value;
|
576 |
},
|
577 |
|
578 |
+
unformat : function(field)
|
579 |
{
|
580 |
var escapeSymbol = $.fbuilder.escapeSymbol;
|
581 |
|
588 |
{
|
589 |
var c = eq[i].resultField.configuration(); // Configuration object
|
590 |
|
591 |
+
if(c.prefix && !/^\s*$/.test(c.prefix))
|
592 |
{
|
593 |
+
v = v.replace(new RegExp("^"+escapeSymbol(c.prefix)), '');
|
594 |
}
|
595 |
|
596 |
+
if(c.suffix && !/^\s*$/.test(c.suffix))
|
597 |
{
|
598 |
+
v = v.replace(new RegExp(escapeSymbol(c.suffix)+"$"), '');
|
599 |
}
|
600 |
|
601 |
+
if(!/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)/.test(v))
|
602 |
{
|
603 |
+
if(c.groupingsymbol && !/^\s*$/.test(c.groupingsymbol))
|
604 |
{
|
605 |
+
v = v.replace(new RegExp(escapeSymbol(c.groupingsymbol), 'g'), '');
|
606 |
}
|
607 |
|
608 |
+
if(c.decimalsymbol && !/^\s*$/.test(c.decimalsymbol))
|
609 |
{
|
610 |
+
v = v.replace(new RegExp(escapeSymbol(c.decimalsymbol), 'g'), '.');
|
611 |
}
|
612 |
}
|
613 |
}
|
619 |
var obj = new CalcFieldClss();
|
620 |
|
621 |
// Associate events to the document for throw the corresponding equations
|
622 |
+
$(document).on('keyup change blur', '[id="fbuilder"] :input', function(evt)
|
623 |
{
|
624 |
// If evalequations = 0 the equations shouldn't be evaluated dynamically
|
625 |
+
var t = $(evt.target),
|
626 |
+
f = t.closest('form'),
|
627 |
+
evalequations = f.attr('data-evalequations'),
|
628 |
+
evalequationsevent = f.attr('data-evalequationsevent');
|
629 |
|
630 |
if(
|
631 |
typeof evalequations != 'undefined' &&
|
632 |
evalequations*1 == 0 &&
|
633 |
(
|
634 |
+
!(t.hasClass('codepeoplecalculatedfield') && evt.type == 'change') ||
|
635 |
+
(t.hasClass('codepeoplecalculatedfield') && t.data('manually') == 1)
|
636 |
+
)
|
637 |
)
|
638 |
{
|
639 |
return;
|
640 |
}
|
641 |
|
642 |
+
if(evt.type == 'keyup')
|
643 |
{
|
644 |
if('undefined' != typeof evalequationsevent && evalequationsevent*1 == 1)
|
645 |
{
|
647 |
}
|
648 |
// The key out of range
|
649 |
if(evt.keyCode && (evt.keyCode >= 33 && evt.keyCode <= 40)) return;
|
650 |
+
_checkValueThrowingEquation(t);
|
651 |
}
|
652 |
else
|
653 |
{
|
654 |
+
if(/*t.hasClass('depItem') ||*/
|
655 |
(
|
656 |
(
|
657 |
+
t.prop('tagName') == 'INPUT' &&
|
658 |
+
/(text|number|email|password)/.test(t.attr('type').toLowerCase()) ||
|
659 |
+
t.prop('tagName') == 'TEXTAREA'
|
660 |
) &&
|
661 |
evt.type != 'change'
|
662 |
)
|
664 |
{
|
665 |
return;
|
666 |
}
|
667 |
+
obj.Calculate(t[0]);
|
668 |
}
|
669 |
});
|
670 |
|
671 |
//Associate an event to the document waiting for the showHideDepEvent and recalculate all equations
|
672 |
+
$(document).on('showHideDepEvent', function(evt, form_identifier)
|
673 |
{
|
674 |
// If evalequations = 0 the equations shouldn't be evaluated dynamically
|
675 |
var f, evalequations, first_time;
|
680 |
{
|
681 |
first_time = (typeof f.data('first_time') == 'undefined');
|
682 |
f.data('first_time', 0);
|
683 |
+
evalequations = f.data('evalequations');
|
684 |
+
if(typeof evalequations == 'undefined' || evalequations*1 == 1)
|
685 |
{
|
686 |
+
if(first_time) obj.defaultCalc('#'+f.attr('id'));
|
687 |
+
else obj.defaultCalc('#'+f.attr('id'), true);
|
688 |
}
|
689 |
}
|
690 |
});
|
691 |
return obj; // Return the public object
|
692 |
}
|
693 |
+
)();
|