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