1function displayTemplate(componentTypeId,componentId) 2{ 3 //&& typeof componentId== 'undefined' 4 if (document.getElementById('componentEdit'+componentTypeId).innerHTML!="" ) 5 { 6 document.getElementById('componentEdit'+componentTypeId).innerHTML=""; 7 return; 8 } 9 10 var stuff=document.getElementsByTagName("div"); 11 //var stuff=document.getElementById('formComponentEdit'); 12 //alert(stuff); 13 //alert(stuff.length); 14 for(i=0;i<stuff.length;i++) 15 { 16 //alert(stuff[i].name); 17 if(stuff[i].title=="componentEdit") 18 { 19 //alert(stuff[i].name); 20 stuff[i].innerHTML=""; 21 } 22 } 23 document.getElementById('state').innerHTML='Status: loading...'; 24 document.getElementById('state').style.color='rgb(255,0,0)'; 25 26 document.getElementById('componentIdToEdit').value=-1; 27 xml=buildXmlHttp(); 28 xml.onreadystatechange=function() 29 { 30 if(xml.readyState==4) 31 { 32 document.getElementById('componentEdit'+componentTypeId).innerHTML=xml.responseText; 33 //alert(xml.responseText); 34 document.getElementById('state').innerHTML='Status: ok'; 35 document.getElementById('state').style.color=''; 36 changeValidation($('VALIDATIONRULE')); 37 } 38 } 39 if(typeof componentId != 'undefined') 40 { 41 document.getElementById('componentIdToEdit').value=componentId; 42 xml.open('GET','index.php?option=com_rsform&task=components.display&componentType=' + componentTypeId + '&componentId=' + componentId + '&&randomTime=' + Math.random(), true); 43 } 44 else 45 { xml.open('GET','index.php?option=com_rsform&task=components.display&componentType='+componentTypeId+'&randomTime='+Math.random(),true); 46 } 47 xml.send(null); 48 document.getElementById('componentEdit'+componentTypeId).innerHTML=''; 49 50} 51function changeStatusComponent(formId,componentId) 52{ 53 document.getElementById('state').innerHTML='Status: loading...'; 54 document.getElementById('state').style.color='rgb(255,0,0)'; 55 xml=buildXmlHttp(); 56 xml.onreadystatechange=function() 57 { 58 if(xml.readyState==4) 59 { 60 var icon = document.getElementById('currentStatus' + componentId); 61 if(icon.src.match('unpublish.png')) 62 { 63 icon.src = 'components/com_rsform/images/icons/publish.png'; 64 } 65 else 66 { 67 icon.src = 'components/com_rsform/images/icons/unpublish.png'; 68 } 69 if(document.getElementById('FormLayoutAutogenerate').checked==true) generateLayout(formId,'no'); 70 document.getElementById('state').innerHTML='Status: ok'; 71 document.getElementById('state').style.color=''; 72 } 73 } 74 xml.open('GET','index.php?option=com_rsform&task=components.changestatus&componentId='+componentId+'&randomTime='+Math.random(),true); 75 xml.send(null); 76} 77function removeComponent(formId,componentId) 78{ 79 document.getElementById('state').innerHTML='Status: loading...'; 80 document.getElementById('state').style.color='rgb(255,0,0)'; 81 xml=buildXmlHttp(); 82 xml.onreadystatechange=function() 83 { 84 if(xml.readyState==4) 85 { 86 var table=document.getElementById('componentPreview'); 87 var rows=document.getElementsByName('previewComponentId'); 88 for(i=0;i<rows.length;i++) 89 { 90 if(rows[i].value==componentId) 91 { 92 table.deleteRow(i); 93 } 94 } 95 tidyOrder(); 96 if(document.getElementById('FormLayoutAutogenerate').checked==true) generateLayout(formId,'no'); 97 98 document.getElementById('state').innerHTML='Status: ok'; 99 document.getElementById('state').style.color=''; 100 } 101 } 102 xml.open('GET','index.php?option=com_rsform&task=components.remove&componentId='+componentId+'&formId='+formId+'&randomTime='+Math.random(),true); 103 xml.send(null); 104} 105function moveComponentUp(formId,componentId) 106{ 107 document.getElementById('state').innerHTML='Status: loading...'; 108 document.getElementById('state').style.color='rgb(255,0,0)'; 109 xml=buildXmlHttp(); 110 xml.open('GET','index.php?option=com_rsform&task=components.moveup&formId='+formId+'&componentId='+componentId+'&randomTime='+Math.random(),true); 111 xml.send(null); 112 //initForm(formId); 113 var table=document.getElementById('componentPreview'); 114 var rows=document.getElementsByName('previewComponentId'); 115 for(i=0;i<rows.length;i++) 116 { 117 if(rows[i].value==componentId && i>1) 118 { 119 for(j=0;j<table.rows[i].cells.length;j++) 120 { 121 var aux=table.rows[i-1].cells[j].innerHTML; 122 123 table.rows[i-1].deleteCell(j); 124 table.rows[i-1].insertCell(j); 125 126 table.rows[i-1].cells[j].innerHTML=table.rows[i].cells[j].innerHTML; 127 128 table.rows[i].deleteCell(j); 129 table.rows[i].insertCell(j); 130 131 table.rows[i].cells[j].innerHTML=aux; 132 } 133 tidyOrder(); 134 } 135 } 136 137 xml.onreadystatechange=function() 138 { 139 if(xml.readyState==4) 140 { 141 if(document.getElementById('FormLayoutAutogenerate').checked==true) generateLayout(formId,'no'); 142 document.getElementById('state').innerHTML='Status: ok'; 143 document.getElementById('state').style.color=''; 144 } 145 } 146} 147function moveComponentDown(formId,componentId) 148{ 149 document.getElementById('state').innerHTML='Status: loading...'; 150 document.getElementById('state').style.color='rgb(255,0,0)'; 151 xml=buildXmlHttp(); 152 xml.open('GET','index.php?option=com_rsform&task=components.movedown&formId='+formId+'&componentId='+componentId+'&randomTime='+Math.random(),true); 153 xml.send(null); 154 var table=document.getElementById('componentPreview'); 155 var rows=document.getElementsByName('previewComponentId'); 156 //table.style.height+=1; 157 for(i=1;i<rows.length;i++) 158 { 159 if(rows[i].value==componentId && i<table.rows.length-1) 160 { 161 162 for(j=0;j<table.rows[i].cells.length;j++) 163 { 164 /*var aux=table.rows[i].cells[j].innerHTML; 165 table.rows[i].insertCell(j); 166 table.rows[i].cells[j].innerHTML=; 167 */ 168 var aux=table.rows[i].cells[j].innerHTML; 169 table.rows[i].deleteCell(j); 170 table.rows[i].insertCell(j); 171 table.rows[i].cells[j].innerHTML=table.rows[i+1].cells[j].innerHTML; 172 173 table.rows[i+1].deleteCell(j); 174 table.rows[i+1].insertCell(j); 175 table.rows[i+1].cells[j].innerHTML=aux; 176 177 } 178 tidyOrder(); 179 break; 180 } 181 } 182 183 xml.onreadystatechange=function() 184 { 185 if(xml.readyState==4) 186 { 187 if(document.getElementById('FormLayoutAutogenerate').checked==true) generateLayout(formId,'no'); 188 document.getElementById('state').innerHTML='Status: ok'; 189 document.getElementById('state').style.color=''; 190 } 191 } 192} 193function tidyOrder() 194{ 195 document.getElementById('state').innerHTML='Status: loading...'; 196 document.getElementById('state').style.color='rgb(255,0,0)'; 197 var comps=document.getElementsByName('previewComponentId'); 198 199 for(i=1;i<document.getElementById('componentPreview').rows.length;i++) 200 { 201 //alert('ordering['+comps[i].value+']'); 202 var id='ordering['+comps[i].value+']'; 203 var el=document.getElementsByName(id); 204 el[0].value=i; 205 } 206 document.getElementById('state').innerHTML='Status: ok'; 207 document.getElementById('state').style.color=''; 208} 209 210function buildXmlHttp() 211{ 212 var xmlHttp; 213 try 214 { 215 xmlHttp=new XMLHttpRequest(); 216 } 217 catch (e) 218 { 219 try 220 { 221 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 222 } 223 catch (e) 224 { 225 try 226 { 227 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 228 } 229 catch (e) 230 { 231 alert("Your browser does not support AJAX!"); 232 return false;
233 } 234 } 235 } 236 return xmlHttp; 237} 238function saveOrdering(formId) 239{ 240 document.getElementById('state').innerHTML='Status: loading...'; 241 document.getElementById('state').style.color='rgb(255,0,0)'; 242 //alert(document.getElementById('formLayout').value); 243 xml=buildXmlHttp(); 244 //alert(formId); 245 var url = "web_services/saveLayout.php"; 246 var params = "formId="+formId+"&layout="+document.getElementById('formLayout').value; 247 //alert(params); 248 xml.open("POST",url,true); 249 xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 250 xml.setRequestHeader("Content-length", params.length); 251 xml.setRequestHeader("Connection", "close"); 252 xml.send(params); 253 xml.onreadystatechange=function() 254 { 255 if(xml.readyState==4) 256 { 257 document.getElementById('formComponentOrder').submit(); 258 document.getElementById('state').innerHTML='Status: ok'; 259 document.getElementById('state').style.color=''; 260 } 261 } 262} 263function processComponent(componentType) 264{ 265 document.getElementById('state').innerHTML='Status: loading...'; 266 document.getElementById('state').style.color='rgb(255,0,0)'; 267 xml=buildXmlHttp(); 268 var autoLayout=document.getElementById('FormLayoutAutogenerate'); 269 270 271 if(componentType!=9) 272 { 273 if(document.getElementById('componentIdToEdit').value==-1) 274 xml.open('GET','index.php?option=com_rsform&task=components.validate.name&componentName='+document.getElementById('NAME').value+'&formId='+document.getElementById('formId').value+'&componentType='+componentType+'&randomTime='+Math.random(),true); 275 else 276 xml.open('GET','index.php?option=com_rsform&task=components.validate.name&componentName='+document.getElementById('NAME').value+'&formId='+document.getElementById('formId').value+'¤tComponentId='+document.getElementById('componentIdToEdit').value+'&componentType='+componentType+'&randomTime='+Math.random(),true); 277 } 278 279 else 280 { 281 282 if(document.getElementById('componentIdToEdit').value==-1) 283 xml.open('GET','index.php?option=com_rsform&task=components.validate.name&componentName='+document.getElementById('NAME').value+'&formId='+document.getElementById('formId').value+'&componentType='+componentType+'&randomTime='+Math.random()+'&destination='+document.getElementById('DESTINATION').value,true); 284 else 285 xml.open('GET','index.php?option=com_rsform&task=components.validate.name&componentName='+document.getElementById('NAME').value+'&formId='+document.getElementById('formId').value+'¤tComponentId='+document.getElementById('componentIdToEdit').value+'&componentType='+componentType+'&randomTime='+Math.random()+'&destination='+document.getElementById('DESTINATION').value,true); 286 } 287 288 xml.send(null); 289 xml.onreadystatechange=function() 290 { 291 if(xml.readyState==4) 292 { 293 //if(autoLayout.checked==true) 294 // alert('Autolayout is checked'); 295 if(xml.responseText.indexOf('Ok') == -1) 296 alert(xml.responseText); 297 else 298 document.getElementById('formComponentEdit').submit(); 299 document.getElementById('state').innerHTML='Status: ok'; 300 document.getElementById('state').style.color=''; 301 } 302 } 303} 304 305function changeFormAutoGenerateLayout(formId){ 306 document.getElementById('state').innerHTML='Status: loading...'; 307 document.getElementById('state').style.color='rgb(255,0,0)'; 308 var layouts=document.getElementsByName('formLayoutOption'); 309 var layoutName='' 310 for(i=0;i<layouts.length;i++) 311 if(layouts[i].checked) layoutName=layouts[i].value 312 313 314 xml=buildXmlHttp(); 315 xml.onreadystatechange=function() 316 { 317 if(xml.readyState==4) 318 { 319 320//alert(document.getElementById('formLayout').readonly); 321 if(document.getElementById('FormLayoutAutogenerate').checked==true) 322 { 323 document.getElementById('rsform_layout_msg').style.display = 'none'; 324 document.getElementById('formLayout').readOnly=true; 325 } 326 else 327 { 328 document.getElementById('rsform_layout_msg').style.display = ''; 329 document.getElementById('formLayout').readOnly=false; 330 } 331 332 document.getElementById('state').innerHTML='Status: ok'; 333 document.getElementById('state').style.color=''; 334 } 335 } 336 xml.open('GET','index.php?option=com_rsform&task=forms.changeAutoGenerateLayout&formId='+formId+'&randomTime='+Math.random()+'&formLayoutName='+layoutName,true); 337 xml.send(null); 338} 339 340function generateLayout(formId,alert) 341{ 342 document.getElementById('state').innerHTML='Status: loading...'; 343 document.getElementById('state').style.color='rgb(255,0,0)'; 344 if(alert!='no') 345 { 346 var answer=confirm("Pressing the 'Generate layout' button will ERASE your current layout. Are you sure you want to continue?"); 347 if(answer==false) return; 348 } 349 var layoutName=document.getElementById('formLayoutStyle').value; 350 351 /*if(layoutName!='Custom') 352 document.getElementById('formLayout').readOnly=true; 353 else 354 { 355 document.getElementById('formLayout').readOnly=false; 356 return; 357 } 358 */ 359 xml=buildXmlHttp(); 360 xml.onreadystatechange=function() 361 { 362 if(xml.readyState==4) 363 { 364 var text=xml.responseText; 365 text.replace(); 366 document.getElementById('formLayout').value=xml.responseText; 367 document.getElementById('state').innerHTML='Status: ok'; 368 document.getElementById('state').style.color=''; 369 } 370 } 371 xml.open('GET','index.php?option=com_rsform&task=layouts.generate&layout='+layoutName+'&formId='+formId+'&randomTime='+Math.random(),true); 372 xml.send(null); 373} 374 375function saveLayoutName(formId,layoutName) 376{ 377 document.getElementById('formLayoutStyle').value = layoutName; 378 document.getElementById('state').innerHTML='Status: loading...'; 379 document.getElementById('state').style.color='rgb(255,0,0)'; 380 xml=buildXmlHttp(); 381 xml.open('GET','index.php?option=com_rsform&task=layouts.saveLayoutName&formId='+formId+'&randomTime='+Math.random()+'&formLayoutName='+layoutName,true); 382 xml.send(null); 383 xml.onreadystatechange=function() 384 { 385 if(xml.readyState==4) 386 { 387 if(document.getElementById('FormLayoutAutogenerate').checked==true)generateLayout(formId); 388 document.getElementById('state').innerHTML='Status: ok'; 389 document.getElementById('state').style.color=''; 390 } 391 } 392 393 394} 395 396function checkUpdates(session, revision){ 397 xml=buildXmlHttp(); 398 xml.open('GET','index.php',true); 399 xml.send(null); 400 xml.onreadystatechange=function() 401 { 402 if(xml.readyState==4) 403 { 404 checkUpdates = document.getElementById('checkUpdates'); 405 checkUpdates.innerHTML='No New Updates'; 406 checkUpdates.style.className = 'none'; 407 } 408 } 409} 410 411function refreshCaptcha(componentId, captchaPath){ 412 if(!captchaPath) captchaPath = 'index.php?option=com_rsform&task=captcha&componentId=' + componentId; 413 document.getElementById('captcha' + componentId).src = captchaPath + '&' + Math.random(); 414 document.getElementById('captchaTxt' + componentId).value=''; 415 document.getElementById('captchaTxt' + componentId).focus(); 416 417} 418 419 420function submitbutton(pressbutton) { 421 if(isset('tinyMCE')) tinyMCE.execCommand('mceFocus', false,'Thankyou'); 422 if(isset('tinyMCE')) if(tinyMCE.getInstanceById('UserEmailText')!=null) tinyMCE.execCommand('mceFocus', false,'UserEmailText'); 423 if(isset('tinyMCE')) if(tinyMCE.getInstanceById('AdminEmailText')!=null) tinyMCE.execCommand('mceFocus', false,'AdminEmailText'); 424 if(pressbutton!='false')submitform(pressbutton); 425} 426 427 428 429function componentsCopy(formId){
430 loc = 'index.php?option=com_rsform&task=components.copy.screen&formId=' + formId; 431 checks = document.getElementsByName('checks[]'); 432 for(i=0;i<checks.length;i++){ 433 if(checks[i].checked) loc += '&checks[]=' + checks[i].value; 434 } 435 document.location = loc; 436} 437 438function isset(varname) { 439 if(typeof( window[ varname ] ) != "undefined") return true; 440 else return false; 441} 442 443 444 445 446//MAPPINGS// 447 448function updateColumns() 449{ 450 //alert(document.getElementById('rsform_mapping_table')); 451 var currentTable=document.getElementById('rsform_mapping_table').value; 452 //options[document.getElementById('rsform_mapping_table').selectedIndex].value; 453 //alert(currentTable); 454 455 var xmlHttp; 456 try 457 { 458 xmlHttp=new XMLHttpRequest(); 459 } 460 catch (e) 461 { 462 try 463 { 464 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 465 }catch (e) 466 { 467 try 468 { 469 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 470 } 471 catch (e) 472 { 473 alert("Your browser does not support AJAX!"); 474 return false; 475 } 476 } 477 } 478 479 xmlHttp.onreadystatechange=function() 480 { 481 if(xmlHttp.readyState==4) 482 { 483 document.getElementById('rsform_html_mapping_column').innerHTML=xmlHttp.responseText; 484 //document.myForm.time.value=xmlHttp.responseText; 485 } 486 } 487 xmlHttp.open("GET","index.php?option=com_rsform&task=plugin&plugin_task=mappings.getColumns&tableName="+currentTable,true); 488 xmlHttp.send(null); 489} 490function saveMapping(formId) 491{ 492 var currentTable=document.getElementById('rsform_mapping_table')./*options[document.getElementById('rsform_mapping_table').selectedIndex].*/value; 493 var currentColumn=document.getElementById('rsform_mapping_column')./*options[document.getElementById('rsform_mapping_column').selectedIndex].*/value; 494 //var currentComponent=document.getElementById('rsform_mapping_component').options[document.getElementById('rsform_mapping_component').selectedIndex].value; 495 var currentComponent=document.getElementById('rsform_mapping_component').value; 496 var xmlHttp; 497 try 498 { 499 xmlHttp=new XMLHttpRequest(); 500 } 501 catch (e) 502 { 503 try 504 { 505 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 506 }catch (e) 507 { 508 try 509 { 510 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 511 } 512 catch (e) 513 { 514 alert("Your browser does not support AJAX!"); 515 return false; 516 } 517 } 518 } 519 520 xmlHttp.onreadystatechange=function() 521 { 522 if(xmlHttp.readyState==4) 523 { 524 if(xmlHttp.responseText=='1') 525 { 526 alert("You can't add the same mapping twice"); 527 return; 528 } 529 document.getElementById('rsform_html_mappings_table').innerHTML=xmlHttp.responseText; 530 //document.myForm.time.value=xmlHttp.responseText; 531 } 532 } 533 xmlHttp.open("GET","index.php?option=com_rsform&task=plugin&plugin_task=mappings.saveMapping&ComponentId="+currentComponent+"&MappingTable="+currentTable+"&MappingColumn="+currentColumn+"&FormId="+formId,true); 534 xmlHttp.send(null); 535 536} 537function deleteMapping(mappingId,formId) 538{ 539 var xmlHttp; 540 try 541 { 542 xmlHttp=new XMLHttpRequest(); 543 } 544 catch (e) 545 { 546 try 547 { 548 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 549 }catch (e) 550 { 551 try 552 { 553 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 554 } 555 catch (e) 556 { 557 alert("Your browser does not support AJAX!"); 558 return false; 559 } 560 } 561 } 562 563 xmlHttp.onreadystatechange=function() 564 { 565 if(xmlHttp.readyState==4) 566 { 567 if(xmlHttp.responseText=='1') 568 { 569 alert("You can't add the same mapping twice"); 570 return; 571 } 572 document.getElementById('rsform_html_mappings_table').innerHTML=xmlHttp.responseText; 573 //document.myForm.time.value=xmlHttp.responseText; 574 } 575 } 576 xmlHttp.open("GET","index.php?option=com_rsform&task=plugin&plugin_task=mappings.deleteMapping&MappingId="+mappingId+"&FormId="+formId,true); 577 xmlHttp.send(null); 578} 579 580function exportProcess(start, limit, total){ 581 xml=buildXmlHttp(); 582 xml.onreadystatechange=function() 583 { 584 if(xml.readyState==4) 585 { 586 post = xml.responseText; 587 if(post=='END') 588 { 589 document.getElementById('progressBar').style.width = document.getElementById('progressBar').innerHTML = '100%'; 590 document.location = 'index.php?option=com_rsform&task=submissions.export.file&ExportFile=' + document.getElementById('ExportFile').value; 591 } 592 else 593 {
594 document.getElementById('progressBar').style.width = Math.ceil(start*100/total) + '%'; 595 document.getElementById('progressBar').innerHTML = Math.ceil(start*100/total) + '%'; 596 start = start + limit; 597 exportProcess(start, limit, total); 598 } 599 } 600 } 601 602 xml.open('GET','index.php?option=com_rsform&task=submissions.export.process&start=' + start + '&limit=' + limit + '&randomTime=' + Math.random(),true); 603 xml.send(null); 604} 605 606function number_format( number, decimals, dec_point, thousands_sep ) { 607 var n = number, prec = decimals; 608 n = !isFinite(+n) ? 0 : +n; 609 prec = !isFinite(+prec) ? 0 : Math.abs(prec); 610 var sep = (typeof thousands_sep == "undefined") ? ',' : thousands_sep; 611 var dec = (typeof dec_point == "undefined") ? '.' : dec_point; 612 613 var s = (prec > 0) ? n.toFixed(prec) : Math.round(n).toFixed(prec); //fix for IE parseFloat(0.55).toFixed(0) = 0; 614 615 var abs = Math.abs(n).toFixed(prec); 616 var _, i; 617 618 if (abs >= 1000) { 619 _ = abs.split(/\D/); 620 i = _[0].length % 3 || 3; 621 622 _[0] = s.slice(0,i + (n < 0)) + 623 _[0].slice(i).replace(/(\d{3})/g, sep+'$1'); 624 625 s = _.join(dec); 626 } else { 627 s = s.replace('.', dec); 628 } 629 630 return s; 631} 632 633function changeValidation(elem){ 634 if(elem == null) return; 635 if(elem.id == 'VALIDATIONRULE') 636 if(elem.value == 'custom' || elem.value == 'numeric' || elem.value == 'alphanumeric' || elem.value == 'alpha' ) 637 document.getElementById('idVALIDATIONEXTRA').className='showVALIDATIONEXTRA'; 638 else 639 document.getElementById('idVALIDATIONEXTRA').className='hideVALIDATIONEXTRA'; 640}
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.