1/******************************************************************************/ 2/* */ 3/* Snagmaster */ 4 5/* JavaScript File */ 6/* */ 7/** *************************************************************************** */ 8 9// used by checklist registry menu to make sure the menu loaded only once, reset 10// in the clickRegistry() 11var checklistLoaded=false; 12// used by eform registry menu to make sure the menu loaded only once, reset in 13// the clickRegistry() 14var eformLoaded=false; 15// used by contra registry menu to make sure the menu loaded only once,reset in 16// the clickRegistry() 17var contraChargeLoaded=false; 18// used by contra pending menu to make sure the menu loaded only once, reset in 19// the clickRegistry() 20var pendingContraChargeLoaded=false; 21// used by ncr registry menu to make sure the menu loaded only once,reset in the 22// clickRegsitry(); 23var ncrLoaded=false; 24var snagstatusLoaded=false; 25 26 27 28 29 30// GLOBAL FUNCTIONS USED IN AJAX CALLS 31 32function websiteAjaxNotLoggedIn() 33{ 34 const ajaxUnauthorizedMessage = "Unauthorized Request - You are not logged in, you will be redirected to the login page."; 35 alert(ajaxUnauthorizedMessage); 36 // redirect user to login page 37 window.location.href = '/index.jsp'; 38} 39 40function websiteAjaxServerDownOrUpdatingCode() 41{ 42 const ajaxServerDownOrUpdatingMessage = "Please try again in a couple of minutes, if that doesn't work login to the site again."; 43 alert(ajaxServerDownOrUpdatingMessage); 44 // don't redirect the user 45} 46 47 48 49// Dropdown IE hack 50<!--// --><![CDATA[//><!-- 51 52sfHover = function() { 53 // alert("hover function getting called"); 54 var navs=document.getElementById("nav"); 55 if (navs !=null && navs !=undefined){ 56 var sfEls = document.getElementById("nav").getElementsByTagName("LI"); 57 for (var i=0; i<sfEls.length; i++) { 58 sfEls[i].onmouseover=function() { 59 this.className+=" sfhover"; 60 } 61 sfEls[i].onmouseout=function() { 62 this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); 63 } 64 } 65} 66if (window.attachEvent) window.attachEvent("onload", sfHover); 67} 68 69// --><!]]> 70// 71 72 function display_calendar(id,type){ 73 74 75 if (type=='0') 76 show_calendar("document.auditProjectUserPaginationForm.elements['list["+id+"].strActionWhenDate'].value"); 77 else if (type=='1') 78 show_calendar("document.auditProjectUserPaginationForm.elements['list["+id+"].strDateActioned'].value"); 79 80 } 81 82 function gotoproject(dropdown){ 83 84 var projectId = dropdown.options[dropdown.selectedIndex].value; 85 window.location.href = "postChooseProject.do?id="+projectId; 86 87 } 88 89 90 function editProjectRegion(dropdown){ 91 92 var regionId = dropdown.options[dropdown.selectedIndex].value; 93 var projectId = document.getElementById("projectId").value; 94 var forwardType= document.getElementById("fwdType").value; 95 if(forwardType == 'edit'){ 96 window.location.href = "editProjectRegion.do?projectId="+projectId+"®ionId="+regionId; 97 } 98 else if(forwardType == 'add'){ 99 // alert("region id is: "+regionId+"using the action"); 100 window.location.href = "/preAddProject.do?regionId="+regionId; 101 } 102 else{ 103 alert("there is a problem, please go back and try again"); 104 } 105 } 106 107/** 108 * ****************************************START Snag Views Checkbox/Image 109 * toggle*********************************************************** 110 */ 111/*----------------------------------------------------------------------------------------------------------*/ 112/** ***************************************************************************************************************************************** */ 113function hiderDivA() 114 { 115 var i=0 116 while (document.getElementById("divA"+i)!=null){ 117 document.getElementById("divA"+i).style.display='none' 118 i++ 119 } 120 } 121 122 function hiderDivB() 123 { 124 var i=0 125 while (document.getElementById("divB"+i)!=null){ 126 document.getElementById("divB"+i).style.display='none' 127 i++ 128 } 129 } 130 131 function hiderDivC() 132 { 133 var i=0 134 while (document.getElementById("divC"+i)!=null){ 135 document.getElementById("divC"+i).style.display='none' 136 i++ 137 } 138 } 139 140 function hiderDivD() 141 { 142 var i=0 143 while (document.getElementById("divD"+i)!=null){ 144 document.getElementById("divD"+i).style.display='none' 145 i++ 146 } 147 } 148 149 function unHiderDivA() 150 { 151 var j=0 152 while (document.getElementById("divA"+j)!=null){ 153 document.getElementById("divA"+j).style.display='block' 154 j++ 155 } 156 } 157 158 function unHiderDivB() 159 { 160 var j=0 161 while (document.getElementById("divB"+j)!=null){ 162 document.getElementById("divB"+j).style.display='block' 163 j++ 164 } 165 } 166 167 function unHiderDivC() 168 { 169 var j=0 170 while (document.getElementById("divC"+j)!=null){ 171 document.getElementById("divC"+j).style.display='block' 172 j++ 173 } 174 } 175 176 function unHiderDivD() 177 { 178 var j=0 179 while (document.getElementById("divD"+j)!=null){ 180 document.getElementById("divD"+j).style.display='block' 181 j++ 182 } 183 } 184 185 // vd check-pen image stuff, seems to be used by 186 // worksheet_snags_approvals.jsp and worksheet_snags.jsp (not sure these two 187 // jsps are old) 188 function setDivsLarge(element) 189 { 190 var state = (element.checked); 191 if (state == true) { 192 hiderDivB(); 193 hiderDivC(); 194 hiderDivD(); 195 unHiderDivA(); 196 // Uncheck 50% checkbox 197 if(document.getElementById("checkboxSmall")!=null && document.getElementById("checkboxSmall").checked == true){ 198 document.getElementById("checkboxSmall").checked = false 199 } 200 // Uncheck 75% checkbox 201 if(document.getElementById("checkboxMedium")!=null && document.getElementById("checkboxMedium").checked == true){ 202 document.getElementById("checkboxMedium").checked = false 203 }
204 setCookie('detailsize','large',365); 205 } else { 206 unHiderDivB(); // unhide text 207 hiderDivC(); // hide small image 208 hiderDivA(); // hide large image 209 hiderDivD(); // hide medium image 210 setCookie('detailsize','text',365); // set cookie to text 211 212 } 213 214 215 } 216 // vd check-pen image stuff, seems to be used by 217 // worksheet_snags_approvals.jsp and worksheet_snags.jsp (not sure these two 218 // jsps are old) 219 function setDivsMedium(element) 220 { 221 var state = (element.checked); 222 if (state == true) { 223 224 hiderDivB(); 225 hiderDivC(); 226 hiderDivA(); 227 unHiderDivD(); 228 // Uncheck 100% checkbox 229 if(document.getElementById("checkboxLarge")!=null && document.getElementById("checkboxLarge").checked == true){ 230 document.getElementById("checkboxLarge").checked = false 231 } 232 // Uncheck 50% checkbox 233 if(document.getElementById("checkboxSmall")!=null && document.getElementById("checkboxSmall").checked == true){ 234 document.getElementById("checkboxSmall").checked = false 235 } 236 setCookie('detailsize','medium',365); 237 } else { 238 unHiderDivB(); // unhide text 239 hiderDivC(); // hide small image 240 hiderDivA(); // hide large image 241 hiderDivD(); // hide medium image 242 setCookie('detailsize','text',365); // set cookie to text 243 } 244 245 246 247 } 248 // vd check-pen image stuff, seems to be used by 249 // worksheet_snags_approvals.jsp and worksheet_snags.jsp (not sure these two 250 // jsps are old) 251 function setDivsSmall(element) 252 { 253 var state = (element.checked); 254 if (state == true) { 255 256 hiderDivB(); 257 hiderDivA(); 258 hiderDivD(); 259 unHiderDivC(); 260 // Uncheck 100% checkbox 261 if(document.getElementById("checkboxLarge")!=null && document.getElementById("checkboxLarge").checked == true){ 262 document.getElementById("checkboxLarge").checked = false 263 } 264 // Uncheck 75% checkbox 265 if(document.getElementById("checkboxMedium")!=null && document.getElementById("checkboxMedium").checked == true){ 266 document.getElementById("checkboxMedium").checked = false 267 } 268 setCookie('detailsize','small',365); 269 } else { 270 unHiderDivB(); // unhide text 271 hiderDivC(); // hide small image 272 hiderDivA(); // hide large image 273 hiderDivD(); // hide medium image 274 setCookie('detailsize','text',365); // set cookie to text 275 276 } 277 } 278 // vd check-used by snags registry to display pen images 279 function setDivsLarge() 280 { 281 var state = true; 282 if (state == true) { 283 hiderDivB(); 284 hiderDivC(); 285 hiderDivD(); 286 unHiderDivA(); 287 // Uncheck 50% checkbox 288 if(document.getElementById("checkboxSmall")!=null && document.getElementById("checkboxSmall").checked == true){ 289 document.getElementById("checkboxSmall").checked = false 290 } 291 // Uncheck 75% checkbox 292 if(document.getElementById("checkboxMedium")!=null && document.getElementById("checkboxMedium").checked == true){ 293 document.getElementById("checkboxMedium").checked = false 294 } 295 setCookie('detailsize','large',365); 296 } else { 297 unHiderDivB(); // unhide text 298 hiderDivC(); // hide small image 299 hiderDivA(); // hide large image 300 hiderDivD(); // hide medium image 301 setCookie('detailsize','text',365); // set cookie to text 302 303 } 304 305 306 } 307 // vd check-used by snags registry to display pen images 308 function setDivsMedium() 309 { 310 var state = true; 311 if (state == true) { 312 313 hiderDivB(); 314 hiderDivC(); 315 hiderDivA(); 316 unHiderDivD(); 317 // Uncheck 100% checkbox 318 if(document.getElementById("checkboxLarge")!=null && document.getElementById("checkboxLarge").checked == true){ 319 document.getElementById("checkboxLarge").checked = false 320 } 321 // Uncheck 50% checkbox 322 if(document.getElementById("checkboxSmall")!=null && document.getElementById("checkboxSmall").checked == true){ 323 document.getElementById("checkboxSmall").checked = false 324 } 325 setCookie('detailsize','medium',365); 326 } else { 327 unHiderDivB(); // unhide text 328 hiderDivC(); // hide small image 329 hiderDivA(); // hide large image 330 hiderDivD(); // hide medium image 331 setCookie('detailsize','text',365); // set cookie to text 332 } 333 334 335 336 } 337 // vd check-used by snags registry to display pen images 338 function setDivsSmall() 339 { 340 var state = true; 341 if (state == true) { 342 343 hiderDivB(); 344 hiderDivA(); 345 hiderDivD(); 346 unHiderDivC(); 347 // Uncheck 100% checkbox 348 if(document.getElementById("checkboxLarge")!=null && document.getElementById("checkboxLarge").checked == true){ 349 document.getElementById("checkboxLarge").checked = false 350 } 351 // Uncheck 75% checkbox 352 if(document.getElementById("checkboxMedium")!=null && document.getElementById("checkboxMedium").checked == true){ 353 document.getElementById("checkboxMedium").checked = false 354 }
355 setCookie('detailsize','small',365); 356 } else { 357 unHiderDivB(); // unhide text 358 hiderDivC(); // hide small image 359 hiderDivA(); // hide large image 360 hiderDivD(); // hide medium image 361 setCookie('detailsize','text',365); // set cookie to text 362 363 } 364 } 365 366 367/** 368 * ****************************************END Snag Views Checkbox/Image 369 * toggle*********************************************************** 370 */ 371 372/** 373 * ****************************************START check cookie for image/checkbox 374 * on snags views ****************************************** 375 */ 376/*-------------------------------------------------------------------------------------------------------*/ 377/** *************************************************************************************************************************************** */ 378// vd check- this method is only used by worksheet_snags_approval.jsp and 379// worksheet_snags.jsp (these two jsps might be old) 380function checkDetailsCookie() 381{ 382detailsize=getCookie('detailsize'); 383 384if (detailsize!=null && detailsize!="") 385 { 386 if(detailsize.toUpperCase()=='LARGE'){ 387 cbox = document.getElementById('checkboxLarge'); 388 cbox.checked=true; 389 if(cbox!=null){ 390 setDivsLarge(cbox); 391 } 392 } 393 else if(detailsize.toUpperCase()=='SMALL'){ 394 cbox = document.getElementById('checkboxSmall'); 395 cbox.checked=true; 396 if(cbox!=null){ 397 setDivsSmall(cbox); 398 } 399 } 400 else if(detailsize.toUpperCase()=='MEDIUM'){ 401 cbox = document.getElementById('checkboxMedium'); 402 cbox.checked=true; 403 if(cbox!=null){ 404 setDivsMedium(cbox); 405 } 406 } 407 else if(detailsize.toUpperCase()=='TEXT'){ 408 document.getElementById('checkboxLarge').checked = false; 409 document.getElementById('checkboxSmall').checked = false; 410 document.getElementById('checkboxMedium').checked = false; 411 hiderDivD(); 412 hiderDivA(); 413 hiderDivC(); 414 unHiderDivB(); 415 } 416} 417 418} 419 420/** 421 * ****************************************END check cookie for image/checkbox 422 * on snags views ****************************************** 423 */ 424 425 426/** 427 * ****************************************START Generic Cookie 428 * Functions*************************************************************** 429 */ 430/*----------------------------------------------------------------------------------------------------*/ 431/** ************************************************************************************************************************************* */ 432function getCookie(c_name) 433{ 434if (document.cookie.length>0) 435 { 436 c_start=document.cookie.indexOf(c_name + "=") 437 if (c_start!=-1) 438 { 439 c_start=c_start + c_name.length+1 440 c_end=document.cookie.indexOf(";",c_start) 441 if (c_end==-1) c_end=document.cookie.length 442 return unescape(document.cookie.substring(c_start,c_end)) 443 } 444 } 445return "" 446} 447 448function setCookie(c_name,value,expiredays) 449{ 450 451var exdate=new Date() 452exdate.setDate(exdate.getDate()+expiredays) 453document.cookie=c_name+ "=" +escape(value)+ 454((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) 455 456} 457/** 458 * ****************************************END Generic Cookie 459 * Functions***************************************************************** 460 */ 461/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ 462/** 463 * *********************************START 464 * CheckChecked******************************************************************************** 465 */ 466function checkChecked(myCheck){ 467 468 // checks the number of selected checkboxes on the issue page 469 470 var inputArray = document.getElementsByTagName("input"); 471 var total = 0; 472 for (var i = 0; i < inputArray.length; i++) { 473 var theName = inputArray[i].getAttribute("name"); 474 var theType = inputArray[i].getAttribute("type"); 475 476 if (theType != "checkbox") continue; 477 if ((theType == "checkbox") && (inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")){ 478 // alert("Is valid type-test2"); 479 if (inputArray[i].checked==true) 480 { 481 // alert("is checked"); 482 total = total + 1; 483 } 484 else 485 { 486 // alert("is not checked"); 487 } 488 // alert("total:" + total); 489 } 490 } 491 if(total==0){ 492 alert("Please select one or more snags"); 493 return false; 494 } 495 else{ 496 return true; 497 } 498 499 500 501 502 503 504 505 506 507} 508/** 509 * ****************************************END 510 * CheckChecked**************************************************************************** 511 */ 512 513function cryMonkey() { 514 alert("Found Me"); 515} 516 517/** 518 * ****************************************START ShowPic (Change 519 * Image)***************************************************************** 520 */ 521/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ 522/** ************************************************************************************************************************************* */ 523function showPic(whichpic) { 524 if (document.getElementById) { 525 document.getElementById('placeholder').src = whichpic.href; 526 return false; 527 } else { 528 return true; 529 } 530} 531/** 532 * ****************************************END ShowPic (Change 533 * Image)***************************************************************** 534 */ 535 536 537 538function viewPhotos(status){ 539 // alert("help me, im stuck in your computer!!!!"+status); 540 window.location = "http://testsnags.sysnet.co.uk:8080/getPhotosByStatus.do?sid=790&status="+status; 541 542} 543 544function isEmpty(elementValue) { 545 for (var i = 0; i < elementValue.length; i++) { 546 c = elementValue.charAt(i); 547 if ((c != " ") && (c != "/n") && (c != "/t")) { 548 return false; 549 } 550 } 551 return true 552} 553 554// Function to check the validity of an <input type="text"> field or <textarea> 555// old method 556function OLDvalidateTextBox(element) { 557 if ((element.value == null) || (element.value == "") || (isEmpty(element.value))) { 558 return false; 559 } else { 560 return true; 561 } 562} 563 564// Function to check if any checkbox or radio button group is unused 565// old method 566function OLDvalidateElementGroup(groupName) { 567 var elementCounter = 0; 568 var elementGroup = document.getElementsByName(groupName); 569 var groupLength = elementGroup.length; 570 571 for (var i = 0; i < groupLength; i++) { 572 if (!elementGroup[i].checked) { 573 elementCounter++; 574 } 575 } 576 if (elementCounter == groupLength) { 577 return false; 578 } else { 579 return true; 580 } 581} 582 583// Function to validate Select lists 584// old method 585function OLDvalidateSelectLists(listBox) { 586 if ((listBox.options[listBox.selectedIndex].value == "") || (listBox.options[listBox.selectedIndex].value == null)) { 587 return false; 588 589 } else { 590 return true; 591 592 } 593} 594 595// Honking big validation function 596// old method 597function OLDvalidateFormElements(formObj) { 598 // alert("Validation Start"); 599 var numBoxes = 0; 600 var numPasswords = 0; 601 var numChecks = 0; 602 var checkArray = new Array(); 603 var checkArrayCounter = 0; 604 var numRadio = 0; 605 var radioArray = new Array(); 606 var radioArrayCounter = 0; 607 var numButton = 0; 608 var numSubmit = 0; 609 var numAreas = 0; 610 var numSelects = 0; 611 var elementsArray = new Array(); 612 var elementsArrayCounter = 0; 613 614 var invalidElementsArray = new Array; 615 var invalidElementsArrayCounter = 0; 616 617 var optionalArray = new Object(); 618 619 if (!document.getElementById("optional")) { 620 optionalArray.value = ""; 621 } else { 622 optionalArray = document.getElementById("optional"); 623 } 624 625 var msg = ""; 626 627 var inputs = formObj.getElementsByTagName("input"); 628 var textBoxes = formObj.getElementsByTagName("textarea"); 629 var selectLists = formObj.getElementsByTagName("select"); 630 631 for (var i = 0; i < inputs.length; i++) { 632 var inputAttribute = inputs[i].getAttribute("type"); 633 if (!inputs[i].optional) { 634 switch (inputAttribute) { 635 case "text" : 636 numBoxes++; 637 if ((!validateTextBox(inputs[i])) && (optionalArray.value.indexOf(inputs[i].id) == -1)) {
638 invalidElementsArray[invalidElementsArrayCounter] = inputs[i].id; 639 invalidElementsArrayCounter++; 640 } 641 break; 642 case "password" : 643 numPasswords++; 644 if ((!validateTextBox(inputs[i])) && (optionalArray.value.indexOf(inputs[i].id) == -1)) { 645 invalidElementsArray[invalidElementsArrayCounter] = inputs[i].id; 646 invalidElementsArrayCounter++; 647 } 648 break; 649 case "checkbox" : 650 numChecks++; 651 var checkboxGroupName = inputs[i].getAttribute("name"); 652 if (checkboxGroupName != checkArray[checkArrayCounter - 1]) { 653 checkArray[checkArrayCounter] = checkboxGroupName; 654 checkArrayCounter++; 655 } 656 if (!validateElementGroup(checkboxGroupName)) { 657 var checkbox = document.getElementById(inputs[i].id); 658 var groupName = checkbox.getAttribute("name"); 659 if (optionalArray.value.indexOf(groupName) == -1) { 660 if (invalidElementsArray[invalidElementsArrayCounter - 1] != checkbox.id) { 661 invalidElementsArray[invalidElementsArrayCounter] = checkbox.id; 662 invalidElementsArrayCounter++; 663 } 664 } 665 } 666 break; 667 case "radio" : 668 numRadio++; 669 var radioGroupName = inputs[i].getAttribute("name"); 670 if (radioGroupName != radioArray[radioArrayCounter - 1]) { 671 radioArray[radioArrayCounter] = radioGroupName; 672 radioArrayCounter++; 673 } 674 if (!validateElementGroup(radioGroupName)) { 675 var radioButton = document.getElementById(inputs[i].id); 676 var groupName = radioButton.getAttribute("name"); 677 if (optionalArray.value.indexOf(groupName) == -1) { 678 if (invalidElementsArray[invalidElementsArrayCounter - 1] != radioButton.id) { 679 invalidElementsArray[invalidElementsArrayCounter] = radioButton.id; 680 invalidElementsArrayCounter++; 681 } 682 } 683 } 684 break; 685 case "button" : 686 numButton++; 687 break; 688 case "submit" : 689 numSubmit++; 690 break; 691 } 692 } 693 } 694 695 for (var k = 0; k < textBoxes.length; k++) { 696 numAreas++; 697 if ((!validateTextBox(textBoxes[k])) && (optionalArray.value.indexOf(textBoxes[k].id) == -1)) { 698 invalidElementsArray[invalidElementsArrayCounter] = textBoxes[k].id; 699 invalidElementsArrayCounter++; 700 } 701 } 702 703 for (var j = 0; j < selectLists.length; j++) { 704 numSelects++; 705 if ((!validateSelectLists(selectLists[j])) && (optionalArray.value.indexOf(selectLists[j].id) == -1)) { 706 invalidElementsArray[invalidElementsArrayCounter] = selectLists[j].id; 707 invalidElementsArrayCounter++; 708 } 709 } 710 711 if (invalidElementsArray.length == 0) { 712 return true; 713 } else { 714 msg = "There has been a problem with your form: some information was missing.\n\nPlease make changes to the boxes highlighted in red."; 715 for (var p = 0; p < invalidElementsArray.length; p++) { 716 var elle = document.getElementById(invalidElementsArray[p]); 717 if (elle.getAttribute("type") == "checkbox") { 718 elle.className = "goRedBox"; 719 } else { 720 elle.style.borderColor = "#ff0000"; 721 elle.style.color = "#ff0000"; 722 } 723 } 724 alert(msg); 725 return false; 726 } 727} 728// old method 729function OLDbasicEmailCheck() 730{ 731 var eMsg = "Invalid email addresses found, please check all email addresses"; 732 if (document.getElementById) { 733 var inputsArray = document.getElementsByTagName("input"); 734 var addressCount = 0; 735 var addressesArray = new Array(); 736 for (var i = 0; i < inputsArray.length; i++) { 737 if (inputsArray[i].id.indexOf("cc") != -1) { 738 addressesArray[addressCount] = inputsArray[i]; 739 addressCount++; 740 } 741 } 742 743 for (var k = 0; k < addressesArray.length; k++) { 744 if (addressesArray[k].value.indexOf("@") != -1) { 745 alert(eMsg); 746 return false; 747 break; 748 } 749 return true; 750 } 751 } 752} 753// old method 754function OLDverify(formID) { 755 var f = document.getElementById(formID); 756 757 if (f) { 758 return validateFormElements(f); 759 } else { 760 return true; 761 } 762} 763 764/** * END FORM VALIDATION ** */ 765 766function toggleCB(cBox) 767{ 768 var inputArray = document.getElementsByTagName("input"); 769 var state = (cBox.checked); 770 771 for (var i = 0; i < inputArray.length; i++) { 772 var theType = inputArray[i].getAttribute("type"); 773 if (theType == "checkbox") { 774 inputArray[i].checked = state; 775 776 if (state == true) { 777 778 editArray[arrayCounter] = inputArray[i].id; 779 arrayCounter ++; 780 } else { 781 782 editArray.splice(0); 783 arrayCounter = 0; 784 } 785 } 786 } 787 788 implodeToField2(); 789} 790 791var editArray = new Array(); 792var arrayCounter = 0; 793 794function toggleArrayEntry(incoming) 795{ 796 var itsThere = false; 797 var spliceIndex = 0; 798 for (var k = 0; k < editArray.length; k++) { 799 if (editArray[k] == incoming.id) { 800 itsThere = true; 801 spliceIndex = k; 802 } 803 } 804 805 if (itsThere == true) { 806 editArray.splice(spliceIndex, 1); 807 arrayCounter--; 808 } else { 809 editArray[arrayCounter] = incoming.id 810 arrayCounter++; 811 } 812 813 implodeToField(); 814} 815 816function toggleArrayEntry2(incoming) 817{ 818 var itsThere = false; 819 var spliceIndex = 0; 820 for (var k = 0; k < editArray.length; k++) { 821 if (editArray[k] == incoming.id) { 822 itsThere = true; 823 spliceIndex = k; 824 } 825 } 826 827 if (itsThere == true) { 828 editArray.splice(spliceIndex, 1); 829 arrayCounter--; 830 } else { 831 editArray[arrayCounter] = incoming.id 832 arrayCounter++; 833 } 834 835 implodeToField2(); 836} 837 838function toggleAllCheckboxes(cBox) 839{ 840 var inputArray = document.getElementsByTagName("input"); 841 var state = (cBox.checked); 842 var count=0; 843 844 for (var i = 0; i < inputArray.length; i++) { 845 var theName = inputArray[i].getAttribute("name"); 846 var theType = inputArray[i].getAttribute("type"); 847 if (theType != "checkbox") continue; 848 // alert(inputArray[i].id); 849 if ((theType == "checkbox") && ( (inputArray[i].id != "pdfCheckbox") && (inputArray[i].id != "photoCheckbox") && inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")){ 850 // alert("In the if part3"); 851 if (state == true) { 852 inputArray[i].checked = state; 853 editArray[count] = inputArray[i].id; 854 arrayCounter = count+1; 855 count++; 856 } else { 857 inputArray[i].checked = state; 858 editArray.splice(0); 859 arrayCounter = 0; 860 } 861 } 862 else{ 863 // alert("In the else part3"); 864 } 865 // alert("whats happenin"); 866 } 867 // editArray.splice(0, 5);
868 869 implodeToField(); 870} 871 872function toggleAllCheckboxes2(cBox) 873{ 874 var inputArray = document.getElementsByTagName("input"); 875 var state = (cBox.checked); 876 var count=0; 877 878 for (var i = 0; i < inputArray.length; i++) { 879 var theName = inputArray[i].getAttribute("name"); 880 var theType = inputArray[i].getAttribute("type"); 881 if (theType != "checkbox") continue; 882 // alert(inputArray[i].id); 883 if ((theType == "checkbox") && ( (inputArray[i].id != "pdfCheckbox") && (inputArray[i].id != "photoCheckbox") && inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")){ 884 // alert("In the if part3"); 885 if (state == true) { 886 inputArray[i].checked = state; 887 editArray[count] = inputArray[i].id; 888 arrayCounter = count+1; 889 count++; 890 } else { 891 inputArray[i].checked = state; 892 editArray.splice(0); 893 arrayCounter = 0; 894 } 895 } 896 else{ 897 // alert("In the else part3"); 898 } 899 // alert("whats happenin"); 900 } 901 902 903 // editArray.splice(0, 5); 904 implodeToField2(); 905} 906 907function implodeToField() 908{ 909 var targetField = document.getElementById("arrayHolder"); 910 targetField.value = editArray.join("|"); 911 var targetField2 = document.getElementById("arrayHolder2"); 912 targetField2.value = editArray.join("|"); 913 var targetField4 = document.getElementById("arrayHolder4"); 914 targetField4.value = editArray.join("|"); 915 var targetField5 = document.getElementById("arrayHolder5"); 916 targetField5.value = editArray.join("|"); 917 var targetField6 = document.getElementById("arrayHolder6"); 918 targetField6.value = editArray.join("|"); 919 var targetField12 = document.getElementById("arrayHolder12"); 920 targetField12.value = editArray.join("|"); 921 var targetField13 = document.getElementById("arrayHolder13"); 922 targetField13.value = editArray.join("|"); 923 var targetField16 = document.getElementById("arrayHolder16"); 924 targetField16.value = editArray.join("|"); 925} 926 927function implodeToField2() 928{ 929 var targetField6 = document.getElementById("arrayHolder6"); 930 targetField6.value = editArray.join("|"); 931 var targetField7 = document.getElementById("arrayHolder7"); 932 targetField7.value = editArray.join("|"); 933 var targetField8 = document.getElementById("arrayHolder8"); 934 targetField8.value = editArray.join("|"); 935 var targetField9 = document.getElementById("arrayHolder9"); 936 targetField9.value = editArray.join("|"); 937 938 var targetField12 = document.getElementById("arrayHolder12"); 939 targetField12.value = editArray.join("|"); 940 var targetField13 = document.getElementById("arrayHolder13"); 941 targetField13.value = editArray.join("|"); 942 943 944} 945 946function sendToPop(incomingId, secondFormId) 947{ 948 var stringHolder = document.getElementById("arrayHolder"); 949 var secondForm = document.getElementById(secondFormId); 950 var theType = document.getElementById("hType"); 951 var theRequiredField = document.getElementById("reqField"); 952 953 if ((stringHolder.value == "") || (stringHolder.value == null)) { 954 alert("You must select one or more Snags"); 955 return false; 956 } 957 958 stringHolder.value += "|" + incomingId; 959 960 theType.value = "9"; 961 theRequiredField.value = incomingId; 962 963 // spawn("/blank.html"); 964 965 secondForm.submit(); 966} 967 968function sendToPop2(incomingId, thirdFormId) 969{ 970 alert("incomingId=" + incomingId); 971 // OLD was used within search_issue.jsp to submit old multi-delete form 972 // replaced by seachIssueActionSelected on 21/08/2009 973 var stringHolder = document.getElementById("arrayHolder2"); 974 var thirdForm = document.getElementById(thirdFormId); 975 var theType = document.getElementById("hType2"); 976 var theRequiredField = document.getElementById("reqField2"); 977 if ((stringHolder.value == "") || (stringHolder.value == null)) { 978 alert("You must select one or more Snags for deletion"); 979 return false; 980 } 981 stringHolder.value += "|" + incomingId; 982 theType.value = "12"; 983 theRequiredField.value = incomingId; 984 // spawn("/blank.html"); 985 thirdForm.submit(); 986 987} 988 989function sendToPop3(incomingId, fourthFormId, thisValue) 990{ 991 992 var fourthForm = document.getElementById(fourthFormId); 993 var theType = document.getElementById("hType3"); 994 theType.value = "1"; 995 var theStatus = document.getElementById("status3"); 996 var theDisplayNo = document.getElementById("displayNo3");
997 theDisplayNo.value = thisValue; 998 fourthForm.submit(); 999 1000 1001} 1002 1003function searchSnagsActionSelected() 1004{ 1005 // used for submitting different forms within search_snags.jsp 1006 // check that snags have been selected 1007 1008 var inputArray = document.getElementsByTagName("input"); 1009 var total = 0; 1010 for (var i = 0; i < inputArray.length; i++) 1011 { 1012 var theName = inputArray[i].getAttribute("name"); 1013 var theType = inputArray[i].getAttribute("type"); 1014 if (theType != "checkbox") continue; 1015 if ((theType == "checkbox") && (inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")) 1016 { 1017 if (inputArray[i].checked==true) 1018 { 1019 total = total + 1; 1020 } 1021 } 1022 } 1023 if(total==0) 1024 { 1025 alert("Please select one or more snags"); 1026 return false; 1027 } 1028 1029 1030 var dropdownIndex = document.getElementById('selectedAction').selectedIndex; 1031 var dropdownValue = document.getElementById('selectedAction')[dropdownIndex].value; 1032 var submitNameTypeFromJS = document.getElementById("submitNameTypeFromJS"); 1033 if(dropdownValue==4) 1034 { 1035 // mis-issued 1036 submitNameTypeFromJS.value = "Mis-issue Selected"; 1037 // submit the form 1038 var issueForm = document.getElementById("issueForm"); 1039 issueForm.submit(); 1040 } 1041 else if(dropdownValue==5) 1042 { 1043 // reject 1044 submitNameTypeFromJS.value = "Reject Selected"; 1045 // submit the form 1046 var issueForm = document.getElementById("issueForm"); 1047 issueForm.submit(); 1048 } 1049 else if(dropdownValue==6) 1050 { 1051 // close 1052 submitNameTypeFromJS.value = "Close Selected"; 1053 // submit the form 1054 var issueForm = document.getElementById("issueForm"); 1055 issueForm.submit(); 1056 } 1057 else if(dropdownValue==7) 1058 { 1059 // close 1060 submitNameTypeFromJS.value = "Undelete"; 1061 // submit the form 1062 var issueForm = document.getElementById("issueForm"); 1063 issueForm.submit(); 1064 } 1065 else if(dropdownValue==3) 1066 { 1067 // fix - for subbie 1068 submitNameTypeFromJS.value = "Mark as Fixed"; 1069 // submit the form 1070 var issueForm = document.getElementById("issueForm"); 1071 issueForm.submit(); 1072 } 1073 else if(dropdownValue==10) 1074 { 1075 1076 var stringHolder = document.getElementById("arrayHolder6"); 1077 var secondForm = document.getElementById("slySend6"); 1078 var theType = document.getElementById("hType6"); 1079 1080 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1081 alert("You must select one or more Snags to upload a file"); 1082 return false; 1083 } 1084 theType.value = "13"; 1085 secondForm.submit(); 1086 } 1087 else if(dropdownValue==11) 1088 { 1089 // close 1090 submitNameTypeFromJS.value = "Reopen Selected"; 1091 // submit the form 1092 var issueForm = document.getElementById("issueForm"); 1093 issueForm.submit(); 1094 } 1095 1096 1097 1098} 1099 1100function searchSnagsActionSelected(val) 1101{ 1102 // used for submitting different forms within search_snags.jsp 1103 // check that snags have been selected 1104 var inputArray = document.getElementsByTagName("input"); 1105 var total = 0; 1106 for (var i = 0; i < inputArray.length; i++) 1107 { 1108 var theName = inputArray[i].getAttribute("name"); 1109 var theType = inputArray[i].getAttribute("type"); 1110 if (theType != "checkbox") continue; 1111 if ((theType == "checkbox") && (inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")) 1112 { 1113 if (inputArray[i].checked==true) 1114 { 1115 total = total + 1; 1116 } 1117 } 1118 } 1119 if(total==0) 1120 { 1121 alert("Please select one or more snags"); 1122 return; 1123 } 1124 1125 1126 1127 var dropdownValue = val; 1128 var submitNameTypeFromJS = document.getElementById("submitNameTypeFromJS"); 1129 1130 if(dropdownValue==4) 1131 { 1132 // mis-issued 1133 submitNameTypeFromJS.value = "Mis-issue Selected"; 1134 // submit the form 1135 var issueForm = document.getElementById("issueForm"); 1136 issueForm.submit(); 1137 } 1138 else if(dropdownValue==5) 1139 { 1140 // reject 1141 submitNameTypeFromJS.value = "Reject Selected"; 1142 // submit the form 1143 var issueForm = document.getElementById("issueForm"); 1144 issueForm.submit(); 1145 } 1146 else if(dropdownValue==6) 1147 { 1148 // close 1149 submitNameTypeFromJS.value = "Close Selected"; 1150 // submit the form 1151 var issueForm = document.getElementById("issueForm"); 1152 issueForm.submit(); 1153 } 1154 else if(dropdownValue==7) 1155 { 1156 // close 1157 submitNameTypeFromJS.value = "Undelete"; 1158 // submit the form 1159 var issueForm = document.getElementById("issueForm"); 1160 issueForm.submit(); 1161 } 1162 else if(dropdownValue==3) 1163 { 1164 // fix - for subbie 1165 submitNameTypeFromJS.value = "Mark as Fixed"; 1166 // submit the form 1167 var issueForm = document.getElementById("issueForm"); 1168 issueForm.submit(); 1169 } 1170 else if(dropdownValue==10) 1171 { 1172 1173 var stringHolder = document.getElementById("arrayHolder6"); 1174 var secondForm = document.getElementById("slySend6"); 1175 var theType = document.getElementById("hType6"); 1176 1177 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1178 alert("You must select one or more Snags to upload a file"); 1179 return ; 1180 } 1181 theType.value = "13"; 1182 secondForm.submit(); 1183 } 1184 else if(dropdownValue==11) 1185 { 1186 // close 1187 submitNameTypeFromJS.value = "Reopen Selected"; 1188 // submit the form 1189 var issueForm = document.getElementById("issueForm"); 1190 issueForm.submit(); 1191 } 1192 1193 else if(dropdownValue==12) 1194 { 1195 // close 1196 1197 var stringHolder = document.getElementById("arrayHolder12"); 1198 var secondForm = document.getElementById("slySend12"); 1199 1200 var theType = document.getElementById("hType12"); 1201 1202 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1203 alert("You must select one or more Snags to generate a pdf"); 1204 return ; 1205 } 1206 else 1207 { 1208 document.getElementById("isPhoto12").value=1; 1209 secondForm.submit(); 1210 } 1211 1212 } 1213 1214 else if(dropdownValue==13) 1215 { 1216 // close 1217 1218 var stringHolder = document.getElementById("arrayHolder12"); 1219 var secondForm = document.getElementById("slySend12"); 1220 1221 var theType = document.getElementById("hType12"); 1222 1223 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1224 alert("You must select one or more Snags to generate a pdf"); 1225 return ; 1226 } 1227 else 1228 { 1229 document.getElementById("isPhoto12").value=0; 1230 secondForm.submit(); 1231 } 1232 1233 } 1234 1235 else if(dropdownValue==14) 1236 { 1237 // close 1238 1239 var stringHolder = document.getElementById("arrayHolder13"); 1240 var secondForm = document.getElementById("slySend13"); 1241 1242 var theType = document.getElementById("hType13"); 1243 1244 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1245 alert("You must select one or more Snags to generate a pdf"); 1246 return ; 1247 } 1248 else 1249 { 1250 document.getElementById("isPhoto13").value=1; 1251 secondForm.submit(); 1252 } 1253 1254 } 1255 else if(dropdownValue==15) 1256 { 1257 // close 1258 1259 var stringHolder = document.getElementById("arrayHolder13"); 1260 var secondForm = document.getElementById("slySend13"); 1261 1262 var theType = document.getElementById("hType13"); 1263 1264 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1265 alert("You must select one or more Snags to generate a pdf"); 1266 return ; 1267 } 1268 else 1269 { 1270 document.getElementById("isPhoto13").value=0; 1271 secondForm.submit(); 1272 } 1273 1274 } 1275 else if(dropdownValue==16) 1276 { 1277 // close 1278 submitNameTypeFromJS.value = "Signoff Selected"; 1279 // submit the form 1280 var issueForm = document.getElementById("issueForm"); 1281 issueForm.submit(); 1282 } 1283 else if(dropdownValue==17) 1284 { 1285 // close 1286 submitNameTypeFromJS.value = "Signoff Rejected Selected"; 1287 // submit the form 1288 var issueForm = document.getElementById("issueForm"); 1289 issueForm.submit(); 1290 } 1291 1292 1293 1294} 1295function sendToPop7(incomingId, secondFormId) 1296{ 1297 1298 var stringHolder = document.getElementById("arrayHolder7"); 1299 var secondForm = document.getElementById(secondFormId); 1300 var theType = document.getElementById("hType7"); 1301 1302 1303 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1304 alert("You must select one or more Snags"); 1305 return; 1306 } 1307 theType.value = "13"; 1308 // theRequiredField.value = incomingId; 1309 1310 // spawn("/blank.html"); 1311 // alert("String Holder: "+stringHolder.value); 1312 secondForm.submit(); 1313} 1314function searchIssueActionSelected() 1315{ 1316 // used for submitting different forms within search_issue.jsp 1317 var dropdownIndex = document.getElementById('selectedAction').selectedIndex; 1318 var dropdownValue = document.getElementById('selectedAction')[dropdownIndex].value; 1319 // 2 for issue as normal 1320 if(dropdownValue==2) 1321 { 1322 // check that snags have been selected 1323 var inputArray = document.getElementsByTagName("input"); 1324 var total = 0; 1325 for (var i = 0; i < inputArray.length; i++) 1326 { 1327 var theName = inputArray[i].getAttribute("name"); 1328 var theType = inputArray[i].getAttribute("type"); 1329 if (theType != "checkbox") continue; 1330 if ((theType == "checkbox") && (inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")) 1331 { 1332 if (inputArray[i].checked==true) 1333 { 1334 total = total + 1; 1335 } 1336 1337 } 1338 } 1339 if(total==0) 1340 { 1341 alert("Please select one or more snags"); 1342 return ; 1343 } 1344 1345 1346 // submit the main form 1347 var issueForm = document.getElementById("issueForm"); 1348 issueForm.submit(); 1349 1350 } 1351 else if(dropdownValue==8) 1352 { 1353 // multi-edit 1354 // typeAddEditForJS - old and new types of edit (uses lookups or not) 1355 var AddEditType = document.getElementById("typeAddEditForJS").value; 1356 if(AddEditType=="new") 1357 { 1358 var stringHolder = document.getElementById("arrayHolder4"); 1359 var secondForm = document.getElementById("slySend4"); 1360 var theType = document.getElementById("hType4"); 1361 if ((stringHolder.value == "") || (stringHolder.value == null)) 1362 { 1363 alert("You must select one or more Snags"); 1364 return ; 1365 } 1366 theType.value = "13"; 1367 secondForm.submit(); 1368 } 1369 else 1370 { 1371 var stringHolder = document.getElementById("arrayHolder5"); 1372 var secondForm = document.getElementById("slySend5"); 1373 var theType = document.getElementById("hType5"); 1374 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1375 alert("You must select one or more Snags to edit"); 1376 return ; 1377 } 1378 theType.value = "13"; 1379 secondForm.submit(); 1380 } 1381 1382 } 1383 else if(dropdownValue==9) 1384 { 1385 // multi-delete 1386 var stringHolder = document.getElementById("arrayHolder2"); 1387 var thirdForm = document.getElementById("slySend2"); 1388 var theType = document.getElementById("hType2"); 1389 var theRequiredField = document.getElementById("reqField2"); 1390 if ((stringHolder.value == "") || (stringHolder.value == null)) {
1391 alert("You must select one or more Snags for deletion"); 1392 return ; 1393 } 1394 stringHolder.value += "|" + "del"; 1395 theType.value = "12"; 1396 theRequiredField.value = "del"; 1397 thirdForm.submit(); 1398 } 1399 else if(dropdownValue==10) 1400 { 1401 // multi photo upload 1402 var stringHolder = document.getElementById("arrayHolder6"); 1403 var secondForm = document.getElementById("slySend6"); 1404 var theType = document.getElementById("hType6"); 1405 1406 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1407 alert("You must select one or more Snags to upload a file"); 1408 return ; 1409 } 1410 theType.value = "13"; 1411 secondForm.submit(); 1412 } 1413} 1414 1415 1416 1417function searchIssueActionSelected(val) 1418{ 1419 // used for submitting different forms within search_issue.jsp 1420 1421 // 2 for issue as normal 1422 if(val==2) 1423 { 1424 // check that snags have been selected 1425 var inputArray = document.getElementsByTagName("input"); 1426 var total = 0; 1427 for (var i = 0; i < inputArray.length; i++) 1428 { 1429 var theName = inputArray[i].getAttribute("name"); 1430 var theType = inputArray[i].getAttribute("type"); 1431 if (theType != "checkbox") continue; 1432 if ((theType == "checkbox") && (inputArray[i].id != "dontCount") && (inputArray[i].id != "checkboxLarge") && (inputArray[i].id != "checkboxMedium")&&(inputArray[i].id != "checkboxSmall")) 1433 { 1434 if (inputArray[i].checked==true) 1435 { 1436 total = total + 1; 1437 } 1438 1439 } 1440 } 1441 if(total==0) 1442 { 1443 alert("Please select one or more snags"); 1444 return ; 1445 } 1446 1447 1448 // submit the main form 1449 var issueForm = document.getElementById("issueForm"); 1450 issueForm.submit(); 1451 1452 } 1453 else if(val==8) 1454 { 1455 // multi-edit 1456 // typeAddEditForJS - old and new types of edit (uses lookups or not) 1457 var AddEditType = document.getElementById("typeAddEditForJS").value; 1458 if(AddEditType=="new") 1459 { 1460 var stringHolder = document.getElementById("arrayHolder4"); 1461 var secondForm = document.getElementById("slySend4"); 1462 var theType = document.getElementById("hType4"); 1463 if ((stringHolder.value == "") || (stringHolder.value == null)) 1464 { 1465 alert("You must select one or more Snags"); 1466 return ; 1467 } 1468 theType.value = "13"; 1469 secondForm.submit(); 1470 } 1471 else 1472 { 1473 var stringHolder = document.getElementById("arrayHolder5"); 1474 var secondForm = document.getElementById("slySend5"); 1475 var theType = document.getElementById("hType5"); 1476 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1477 alert("You must select one or more Snags to edit"); 1478 return ; 1479 } 1480 theType.value = "13"; 1481 secondForm.submit(); 1482 } 1483 1484 } 1485 else if(val==9) 1486 { 1487 // multi-delete 1488 var stringHolder = document.getElementById("arrayHolder2"); 1489 var thirdForm = document.getElementById("slySend2"); 1490 var theType = document.getElementById("hType2"); 1491 var theRequiredField = document.getElementById("reqField2"); 1492 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1493 alert("You must select one or more Snags for deletion"); 1494 return ; 1495 } 1496 stringHolder.value += "|" + "del"; 1497 theType.value = "12"; 1498 theRequiredField.value = "del"; 1499 thirdForm.submit(); 1500 } 1501 else if(val==10) 1502 { 1503 // multi photo upload 1504 var stringHolder = document.getElementById("arrayHolder6"); 1505 var secondForm = document.getElementById("slySend6"); 1506 var theType = document.getElementById("hType6"); 1507 1508 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1509 alert("You must select one or more Snags to upload a file"); 1510 return ; 1511 } 1512 theType.value = "13"; 1513 secondForm.submit(); 1514 } 1515 else if(val==12) 1516 { 1517 // close 1518 1519 var stringHolder = document.getElementById("arrayHolder12"); 1520 var secondForm = document.getElementById("slySend12"); 1521 1522 var theType = document.getElementById("hType12"); 1523 1524 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1525 alert("You must select one or more Snags to generate a pdf"); 1526 return ; 1527 } 1528 else 1529 { 1530 document.getElementById("isPhoto12").value=1; 1531 secondForm.submit(); 1532 } 1533 1534 } 1535 1536 else if(val==13) 1537 { 1538 // close 1539 1540 var stringHolder = document.getElementById("arrayHolder12"); 1541 var secondForm = document.getElementById("slySend12"); 1542 1543 var theType = document.getElementById("hType12"); 1544 1545 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1546 alert("You must select one or more Snags to generate a pdf"); 1547 return ; 1548 } 1549 else 1550 { 1551 document.getElementById("isPhoto12").value=0; 1552 secondForm.submit(); 1553 } 1554 1555 } 1556 1557 else if(val==14) 1558 { 1559 // close 1560 1561 var stringHolder = document.getElementById("arrayHolder13"); 1562 var secondForm = document.getElementById("slySend13"); 1563 1564 var theType = document.getElementById("hType13"); 1565 1566 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1567 alert("You must select one or more Snags to generate a pdf"); 1568 return ; 1569 } 1570 else 1571 { 1572 document.getElementById("isPhoto13").value=1; 1573 secondForm.submit(); 1574 } 1575 1576 } 1577 else if(val==15) 1578 { 1579 // close 1580 1581 var stringHolder = document.getElementById("arrayHolder13"); 1582 var secondForm = document.getElementById("slySend13"); 1583 1584 var theType = document.getElementById("hType13"); 1585 1586 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1587 alert("You must select one or more Snags to generate a pdf"); 1588 return ; 1589 } 1590 else 1591 { 1592 document.getElementById("isPhoto13").value=0; 1593 secondForm.submit(); 1594 } 1595 1596 } 1597 else if(val==16) 1598 { 1599 // used to set status to on hold 1600 var stringHolder = document.getElementById("arrayHolder16"); 1601 var secondForm = document.getElementById("slySend16"); 1602 var theType = document.getElementById("hType16"); 1603 1604 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1605 alert("You must select one or more Snags"); 1606 return ; 1607 } 1608 theType.value = "13"; 1609 secondForm.submit(); 1610 } 1611 else if(val==17) 1612 { 1613 // used to set status to under review (preissue) 1614 var stringHolder = document.getElementById("arrayHolder16"); 1615 var secondForm = document.getElementById("slySend16"); 1616 var theType = document.getElementById("hType16"); 1617 1618 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1619 alert("You must select one or more Snags"); 1620 return ; 1621 } 1622 theType.value = "14"; 1623 secondForm.submit(); 1624 } 1625 1626} 1627 1628 1629 1630function sendToPop4(incomingId, secondFormId) 1631{ 1632 // OLD was used within search_issue.jsp to submit old multi-edit form - new 1633 // type of edit with lookups 1634 // replaced by seachIssueActionSelected on 21/08/2009 1635 var stringHolder = document.getElementById("arrayHolder4"); 1636 var secondForm = document.getElementById(secondFormId); 1637 var theType = document.getElementById("hType4"); 1638 1639 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1640 alert("You must select one or more Snags"); 1641 return false; 1642 } 1643 theType.value = "13"; 1644 // theRequiredField.value = incomingId; 1645 1646 // spawn("/blank.html"); 1647 // alert("String Holder: "+stringHolder.value); 1648 secondForm.submit(); 1649} 1650 1651function sendToPop5(incomingId, secondFormId) 1652{ 1653 // OLD was used within search_issue.jsp to submit old multi-edit form - old 1654 // type of edit without lookups 1655 // replaced by seachIssueActionSelected on 21/08/2009 1656 var stringHolder = document.getElementById("arrayHolder5"); 1657 var secondForm = document.getElementById(secondFormId); 1658 var theType = document.getElementById("hType5"); 1659 1660 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1661 alert("You must select one or more Snags to edit"); 1662 return false; 1663 } 1664 theType.value = "13"; 1665 // theRequiredField.value = incomingId; 1666 1667 // spawn("/blank.html"); 1668 // alert("String Holder: "+stringHolder.value); 1669 secondForm.submit(); 1670} 1671 1672function sendToPop6(incomingId, secondFormId) 1673{ 1674 // OLD was used within search_issue.jsp to submit old multi-photo upload 1675 // replaced by seachIssueActionSelected on 21/08/2009 1676 var stringHolder = document.getElementById("arrayHolder6"); 1677 var secondForm = document.getElementById(secondFormId); 1678 var theType = document.getElementById("hType6"); 1679 1680 if ((stringHolder.value == "") || (stringHolder.value == null)) { 1681 alert("You must select one or more Snags to upload a file"); 1682 return false; 1683 } 1684 theType.value = "13"; 1685 // theRequiredField.value = incomingId; 1686 1687 // spawn("/blank.html"); 1688 // alert("String Holder: "+stringHolder.value); 1689 secondForm.submit(); 1690} 1691 1692function clearAnyCheckboxes() 1693{ 1694 if (document.getElementById) { 1695 var allInputs = new Array(); 1696 allInputs = document.getElementsByTagName("input"); 1697 1698 var rCount = 0; 1699 1700 var boxArray = new Array(); 1701 1702 for (var i = 0; i < allInputs.length; i++) { 1703 boxArray[rCount] = allInputs[i]; 1704 rCount++; 1705 } 1706 1707 for (var k = 0; k < boxArray.length; k++) { 1708 boxArray[k].checked = false; 1709 } 1710 } 1711} 1712 1713 1714function myfunction() 1715{ 1716 if (editArray.length < 1) { 1717 alert("You must select one or more Snags"); 1718 return false; 1719 } 1720 1721 if (confirm("Are you sure you want to issue these files ?")) { 1722 spawn("test.html"); 1723 return true; 1724 } else { 1725 return false; 1726 } 1727} 1728 1729function pTaskSelector() 1730{ 1731 if (document.getElementById) { 1732 targetField = document.getElementById("goto"); 1733 subSelector = document.getElementById("subject"); 1734 targetField.value = subSelector.options[subSelector.options.selectedIndex].value; 1735 return true; 1736 } 1737} 1738 1739function toggleAddNew(toggleId, targetId) 1740{ 1741 if (document.getElementById) { 1742 theToggle = document.getElementById(toggleId); 1743 theTarget = document.getElementById(targetId); 1744 1745 theToggle.style.display = (theToggle.style.display == "none") ? "block" : "none"; 1746 theTarget.style.display = (theTarget.style.display == "block") ? "none" : "block"; 1747 } 1748} 1749 1750function toggleAllCB(cBox) 1751{ 1752 var inputArray = document.getElementsByTagName("input"); 1753 var state = (cBox.checked); 1754 1755 for (var i = 0; i < inputArray.length; i++) { 1756 var theType = inputArray[i].getAttribute("type"); 1757 if (theType == "checkbox") { 1758 inputArray[i].checked = state; 1759 } 1760 } 1761} 1762 1763function removeSelectedPackages() 1764{ 1765 var theForm = document.getElementById("actionForm"); 1766 var theField = document.getElementById("typeField"); 1767 if (confirm("Really remove the selected packages?")) { 1768 theField.value = 4; 1769 1770 theForm.submit(); 1771 } 1772} 1773 1774function removeContractor(contractorCode, packageCode) 1775{ 1776 if (confirm("Are you sure you want to remove this Contractor?")) { 1777 document.location.href = "/packages?type=5&packageCode=" + packageCode + "&subconcode=" + contractorCode; 1778 } 1779} 1780// old method 1781function OLDconfirmAndIssue(incomingId) 1782{ 1783 if (verify(incomingId) == true) { 1784 // spawn("/blank.html"); 1785 return true; 1786 } else { 1787 return false; 1788 } 1789} 1790// old 1791function OLDcheckLocationsThenVerify(formId) 1792{ 1793 if (checkLocations() == false) { 1794 return false; 1795 } else { 1796 return verify(formId); 1797 } 1798} 1799 1800function checkLocations() 1801{ 1802 var lMsg = "You have changed one or more lexicon title and this will cause printing issues to arise.\n\nAre you sure you want to continue?"; 1803 var eMsg = "Lexicon titles have been reset."; 1804 1805 if (document.getElementById) { 1806 theForm = document.getElementById("editProject"); 1807 1808 loc1 = document.getElementById("loc1").value; 1809 loc2 = document.getElementById("loc2").value; 1810 loc3 = document.getElementById("loc3").value; 1811 loc4 = document.getElementById("loc4").value; 1812 1813 sLoc1 = document.getElementById("storedLoc1").value; 1814 sLoc2 = document.getElementById("storedLoc2").value; 1815 sLoc3 = document.getElementById("storedLoc3").value; 1816 sLoc4 = document.getElementById("storedLoc4").value; 1817 1818 if ((loc1 == sLoc1) && (loc2 == sLoc2) && (loc3 == sLoc3) && (loc4 == sLoc4)) { 1819 return true; 1820 } else { 1821 if (confirm(lMsg)) { 1822 return true; 1823 } else { 1824 alert(eMsg); 1825 theForm.reset(); 1826 return false; 1827 } 1828 } 1829 } 1830} 1831 1832function sendThenClose(form) 1833{ 1834 var theForm = form; 1835 1836 theForm.submit(); 1837 // window.opener.document.location.reload(true); 1838 1839} 1840// old method 1841function OLDcheckSendAndClose(theForm) 1842{ 1843 if (verify(theForm.id) == true) { 1844 theForm.target = window.opener; 1845 theForm.submit(); 1846 window.opener.document.location.reload(true); 1847 self.close(); 1848 } 1849} 1850
1851function confirmThenSend(formId) 1852{ 1853 var cMsg = "Are you sure you want to remove this user?"; 1854 if (document.getElementById) { 1855 var theForm = document.getElementById(formId); 1856 if (confirm(cMsg)) { 1857 return true; 1858 } else { 1859 return false; 1860 } 1861 } 1862} 1863 1864function encode(str) { 1865 var result = ""; 1866 1867 for (i = 0; i < str.length; i++) { 1868 if (str.charAt(i) == " ") result += "+"; 1869 else result += str.charAt(i); 1870 } 1871 1872 return escape(result); 1873} 1874 1875/* 1876 * function columnSort(type, status, sob, snagNumber, projectNumber, 1877 * dateIdentifiedFrom, dateIdentifiedTo, dueDateFrom, dueDateTo, zone, floor, 1878 * flat, room, package, subject, sign, issuedTo, planId, category, sot, 1879 * toSignOff, clientSnagsOnly, raisedBy) { var servletURI = "/Search"; type = 1880 * "type=" + type; status = "status=" + status; sob = "sob=" + sob; snagNumber = 1881 * "SNAGNUMBER=" + snagNumber; projectNumber = "PROJECTNUMBER=" + projectNumber; 1882 * dateIdentifiedFrom = "DATEIDENTIFIEDFROM=" + dateIdentifiedFrom; 1883 * dateIdentifiedTo = "DATEIDENTIFIEDTO=" + dateIdentifiedTo; dateDueFrom = 1884 * "DUEDATEFROM=" + dueDateFrom; dateDueTo = "DUEDATETO=" + dueDateTo; zone = 1885 * "ZONE=" + zone; floor = "FLOOR=" + floor; flat = "FLAT=" + flat; room = 1886 * "ROOM=" + room; package = "PACKAGE=" + package; subject = "SUBJECT=" + 1887 * subject; sign = "SIGN=" + sign; issuedTo = "ISSUEDTO=" + issuedTo; planId = 1888 * "PLANID=" + planId; if(sot=="1")sot="2"; else if(sot=="2")sot="1"; sot = 1889 * "sot=" + sot; category = "CATEGORY=" + category; toSignOff = "TOSIGNOFF=" + 1890 * toSignOff; clientSnagsOnly = "CLIENTSNAGSONLY=" + clientSnagsOnly; raisedBy = 1891 * "RAISEDBY=" + raisedBy; var uriString1 = servletURI + "?" + type + "&" + 1892 * status + "&" + sob + "&"; var uriString2 = snagNumber + "&" + projectNumber + 1893 * "&" + dateIdentifiedFrom + "&" + dateIdentifiedTo + "&" + dateDueFrom + "&"; 1894 * var uriString3 = dateDueTo + "&" + zone + "&" + floor + "&" + flat + "&"; var 1895 * uriString4 = room + "&" + package + "&" + subject + "&" + sign + "&" + 1896 * issuedTo + "&" + planId + "&" + category+"&" + sot + "&" + toSignOff + "&" + 1897 * clientSnagsOnly + "&" + raisedBy; 1898 * 1899 * document.location.href = uriString1 + uriString2 + uriString3 + uriString4; } 1900 */ 1901 1902/* 1903 * function searchPager(type, status, startNumber, sob, snagNumber, 1904 * projectNumber, dateIdentifiedFrom, dateIdentifiedTo, dueDateFrom, dueDateTo, 1905 * zone, floor, flat, room, package, subject, sign, issuedTo, sot, 1906 * closedDateFrom, closedDateTo, planId, category, toSignOff, clientSnagsOnly, 1907 * raisedBy) { var servletURI = "/Search"; type = "type=" + type; status = 1908 * "status=" + status; startNumber = "startNumber=" + startNumber; sob = "sob=" + 1909 * sob; snagNumber = "SNAGNUMBER=" + snagNumber; projectNumber = 1910 * "PROJECTNUMBER=" + projectNumber; dateIdentifiedFrom = "DATEIDENTIFIEDFROM=" + 1911 * dateIdentifiedFrom; dateIdentifiedTo = "DATEIDENTIFIEDTO=" + 1912 * dateIdentifiedTo; dateDueFrom = "DUEDATEFROM=" + dueDateFrom; dateDueTo = 1913 * "DUEDATETO=" + dueDateTo; zone = "ZONE=" + zone; floor = "FLOOR=" + floor; 1914 * flat = "FLAT=" + flat; room = "ROOM=" + room; package = "PACKAGE=" + package; 1915 * subject = "SUBJECT=" + subject; sign = "SIGN=" + sign; issuedTo = "ISSUEDTO=" + 1916 * encode(issuedTo); sot = "sot=" + sot; dateClosedFrom = "DATECLOSEDFROM=" + 1917 * closedDateFrom; dateClosedTo = "DATECLOSEDTO=" + closedDateTo; planId = 1918 * "PLANID=" + planId; category = "CATEGORY=" + category; toSignOff = 1919 * "TOSIGNOFF=" + toSignOff; clientSnagsOnly = "CLIENTSNAGSONLY=" 1920 * +clientSnagsOnly; raisedBy = "RAISEDBY=" + raisedBy; var uriString1 = 1921 * servletURI + "?" + type + "&" + status + "&" + startNumber + "&" + sob + "&"; 1922 * var uriString2 = snagNumber + "&" + projectNumber + "&" + dateIdentifiedFrom + 1923 * "&" + dateIdentifiedTo + "&" + dateDueFrom + "&"; var uriString3 = dateDueTo + 1924 * "&" + zone + "&" + floor + "&" + flat + "&"; var uriString4 = room + "&" + 1925 * package + "&" + subject + "&" + sign + "&" + issuedTo + "&" + sot + "&" + 1926 * dateClosedFrom + "&" + dateClosedTo + "&" + planId + "&" + category + "&" + 1927 * toSignOff + "&" + clientSnagsOnly + "&" + raisedBy; 1928 * 1929 * document.location.href = uriString1 + uriString2 + uriString3 + uriString4; } 1930 */ 1931 1932 1933 1934/* 1935 * function searchPagerDisplayNo(type, status, startNumber, sob, snagNumber, 1936 * projectNumber, dateIdentifiedFrom, dateIdentifiedTo, dueDateFrom, dueDateTo, 1937 * zone, floor, flat, room, package, subject, sign, issuedTo, sot, displayNo, 1938 * closedDateFrom, closedDateTo, planId, category, toSignOff, clientSnagsOnly,
1939 * raisedBy) { var servletURI = "/Search"; type = "type=" + type; status = 1940 * "status=" + status; startNumber = "startNumber=" + "1"; sob = "sob=" + sob; 1941 * snagNumber = "SNAGNUMBER=" + snagNumber; projectNumber = "PROJECTNUMBER=" + 1942 * projectNumber; dateIdentifiedFrom = "DATEIDENTIFIEDFROM=" + 1943 * dateIdentifiedFrom; dateIdentifiedTo = "DATEIDENTIFIEDTO=" + 1944 * dateIdentifiedTo; dateDueFrom = "DUEDATEFROM=" + dueDateFrom; dateDueTo = 1945 * "DUEDATETO=" + dueDateTo; zone = "ZONE=" + zone; floor = "FLOOR=" + floor; 1946 * flat = "FLAT=" + flat; room = "ROOM=" + room; package = "PACKAGE=" + package; 1947 * subject = "SUBJECT=" + subject; sign = "SIGN=" + sign; issuedTo = "ISSUEDTO=" + 1948 * encode(issuedTo); sot = "sot=" + sot; displayNo = "displayNo=" + displayNo; 1949 * dateClosedFrom = "DATECLOSEDFROM=" + closedDateFrom; dateClosedTo = 1950 * "DATECLOSEDTO=" + closedDateTo; planId = "PLANID=" + planId; category = 1951 * "CATEGORY=" + category; toSignOff = "TOSIGNOFF=" + toSignOff; clientSnagsOnly = 1952 * "CLIENTSNAGSONLY=" +clientSnagsOnly; raisedBy = "RAISEDBY=" + raisedBy; 1953 * 1954 * var uriString1 = servletURI + "?" + type + "&" + status + "&" + startNumber + 1955 * "&" + sob + "&"; var uriString2 = snagNumber + "&" + projectNumber + "&" + 1956 * dateIdentifiedFrom + "&" + dateIdentifiedTo + "&" + dateDueFrom + "&"; var 1957 * uriString3 = dateDueTo + "&" + zone + "&" + floor + "&" + flat + "&"; var 1958 * uriString4 = room + "&" + package + "&" + subject + "&" + sign + "&" + 1959 * issuedTo + "&" + sot + "&" + displayNo + "&" + dateClosedFrom + "&" + 1960 * dateClosedTo + "&" + planId + "&" + category + "&" + toSignOff + "&" + 1961 * clientSnagsOnly + "&" + raisedBy; 1962 * 1963 * document.location.href = uriString1 + uriString2 + uriString3 + uriString4; } 1964 */ 1965 1966/* 1967 * function searchPagerDisplayNoInkSearch(type, status, startNumber, sob, 1968 * snagNumber, projectNumber, dateIdentifiedFrom, dateIdentifiedTo, dueDateFrom, 1969 * dueDateTo, zone, floor, flat, room, package, subject, sign, issuedTo, 1970 * displayNo, inkSearchText) { var servletURI = "/Search"; type = "type=" + 1971 * type; status = "status=" + status; startNumber = "startNumber=" + "1"; sob = 1972 * "sob=" + sob; snagNumber = "SNAGNUMBER=" + snagNumber; projectNumber = 1973 * "PROJECTNUMBER=" + projectNumber; dateIdentifiedFrom = "DATEIDENTIFIEDFROM=" + 1974 * dateIdentifiedFrom; dateIdentifiedTo = "DATEIDENTIFIEDTO=" + 1975 * dateIdentifiedTo; dateDueFrom = "DUEDATEFROM=" + dueDateFrom; dateDueTo = 1976 * "DUEDATETO=" + dueDateTo; zone = "ZONE=" + zone; floor = "FLOOR=" + floor; 1977 * flat = "FLAT=" + flat; room = "ROOM=" + room; package = "PACKAGE=" + package; 1978 * subject = "SUBJECT=" + subject; sign = "SIGN=" + sign; issuedTo = "ISSUEDTO=" + 1979 * encode(issuedTo); displayNo = "displayNo=" + displayNo; inkSearchText = 1980 * "inkSearchText=" + inkSearchText; 1981 * 1982 * var uriString1 = servletURI + "?" + type + "&" + status + "&" + startNumber + 1983 * "&" + sob + "&"; var uriString2 = snagNumber + "&" + projectNumber + "&" + 1984 * dateIdentifiedFrom + "&" + dateIdentifiedTo + "&" + dateDueFrom + "&"; var 1985 * uriString3 = dateDueTo + "&" + zone + "&" + floor + "&" + flat + "&"; var 1986 * uriString4 = room + "&" + package + "&" + subject + "&" + sign + "&" + 1987 * issuedTo + "&" + displayNo + "&" + inkSearchText; 1988 * 1989 * document.location.href = uriString1 + uriString2 + uriString3 + uriString4; } 1990 */ 1991 1992function putThisInThere(incomingId, targetId) 1993{ 1994 if (document.getElementById) { 1995 var theSelectah = document.getElementById(incomingId); 1996 var theTarget = document.getElementById(targetId); 1997 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 1998 1999 theTarget.value = theValue; 2000 } 2001} 2002 2003/* 2004 * POP UP WINDOW function spawn(location) { var winName = "gonzo"; var winProps = 2005 * "top=16, left=16, width=500, height=500, toolbar=no, scrollbars=yes, 2006 * status=yes"; var newWin = window.open(location, winName, winProps); 2007 * newWin.focus(); } 2008 * 2009 * function spawn2(location) { var winName = "gonzo"; var winProps = "top=16, 2010 * left=16, width=400, height=500, toolbar=no, scrollbars=yes, status=yes"; var 2011 * newWin = window.open(location, winName, winProps); newWin.focus(); } 2012 * 2013 * function spawn(newLocation) { var winName = "supWindow"; var winProps = 2014 * "top=16, left=16, width=700, height=400, toolbar=no, scrollbars=yes, 2015 * status=yes"; var newWin = window.open(newLocation, winName, winProps); 2016 * newWin.focus(); } 2017 * 2018 * function replaceAll(str,old_str,new_str){ 2019 * 2020 * while(str.indexOf(old_str,0)>-1){ str=str.replace(old_str,new_str); } return
2021 * str; } END POP UP WINDOW 2022 */ 2023 2024 2025 2026/* Toggle hide & show div */ 2027// Mainly used allow the show/hide of faq and filter div's 2028 2029function toggleLayer( whichLayer ) 2030 { 2031 var elem, vis; 2032 if( document.getElementById ) // this is the way the standards work 2033 elem = document.getElementById( whichLayer ); 2034 else if( document.all ) // this is the way old msie versions work 2035 elem = document.all[whichLayer]; 2036 else if( document.layers ) // this is the way nn4 works 2037 elem = document.layers[whichLayer]; 2038 vis = elem.style; 2039 // if the style.display value is blank we try to figure it out here 2040 if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined) 2041 vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; 2042 vis.display = (vis.display==''||vis.display=='block')?'none':'block'; 2043 } 2044 2045 2046function toggleAllLayers (whichLayer1, whichLayer2 , whichLayer3) 2047{ 2048 toggleLayer(whichLayer1); 2049 toggleLayer(whichLayer2); 2050 toggleLayer(whichLayer3); 2051} 2052 2053function toggleAllLayersOne (whichLayer1) 2054{ 2055 toggleLayer(whichLayer1); 2056} 2057 2058 2059/* End Toggle */ 2060 2061/* Used in addUser.jsp */ 2062function validateUserForm(){ 2063 if (document.getElementById("username").value=="") 2064 { 2065 alert("Please fill in the user name first"); 2066 return false; 2067 } 2068 else if (document.getElementById("username").value.indexOf(' ')!=-1) 2069 { 2070 alert("Username must be one word with no spaces"); 2071 return false; 2072 } 2073 else if (document.getElementById("password").value=="") 2074 { 2075 alert("Please fill in the password first"); 2076 return false; 2077 } 2078 else if (document.getElementById("password").value!=document.getElementById("conpass").value) 2079 { 2080 alert("Please reconfirm your password"); 2081 return false; 2082 } 2083 else 2084 return true; 2085 } 2086/* End Used in addUser.jsp */ 2087 2088 2089 2090/* 2091 * new jquery dialogs boxes these can be used throughout the site first one is a 2092 * progress bar to get display when a pdf is gettign created 2093 */ 2094 2095function on_click_DisplayProgressPdf() 2096{ 2097 var htmlPdfModalDialog = "<div id='dialog-form-progress-pdf'><img src='/images/progressbar.gif' height='20' width='350'>"; 2098 htmlPdfModalDialog = htmlPdfModalDialog + "<br />Please wait while your pdf gets created</div>"; 2099 2100 var dlgPdfModal = $(htmlPdfModalDialog); 2101 dlgPdfModal.dialog({ 2102 resizable: false, 2103 height: 200, 2104 width: 400, 2105 modal: true, 2106 buttons: {"Cancel Pdf": function() { dlgPdfModal.dialog( "close" ); }}, 2107 closeOnEscape: false, 2108 open: function() { $(".ui-dialog-titlebar").hide(); } 2109 }) 2110} 2111 2112function onclick_displayUserSettingsDialog(projectTitle, type, roleId,snagCategory1, snagCategory2,projectActivity,checklist, ncr, cc, eform,loc1,loc2,snagsClientSignoffEnabled,document1Enabled,customFormEnabled,checklistEnabled,contraEnabled,snagCategory3,snagCategory4,snagCategory5,snagCategory6) 2113{ 2114 if (snagCategory1 ==null || snagCategory1 =="") 2115 snagCategory1=""; 2116 2117 if (snagCategory2 ==null || snagCategory2=="") 2118 snagCategory2=""; 2119 2120 if (snagCategory3 ==null || snagCategory3=="") 2121 snagCategory3=""; 2122 2123 if (snagCategory4 ==null || snagCategory4=="") 2124 snagCategory4=""; 2125 2126 if (snagCategory5 ==null || snagCategory5=="") 2127 snagCategory5=""; 2128 2129 if (snagCategory6 ==null || snagCategory6=="") 2130 snagCategory6=""; 2131 2132 if (projectActivity ==null || projectActivity=="") 2133 projectActivity=""; 2134 2135 if(ncr ==null || ncr=="") 2136 ncr=""; 2137 if (cc==null || cc=="") 2138 2139 cc=""; 2140 if(eform ==null || eform=="") 2141 eform=""; 2142 2143 2144 if(loc1 ==null || loc1=="") 2145 loc1=""; 2146 if(loc2 ==null || loc2=="") 2147 loc2=""; 2148 2149 projectTitle=projectTitle.replace(/'/g, "'").replace(/"/g, """); 2150 2151 var htmlDialog = 2152 "<div id='dialog-form-list' title='User Settings - " +projectTitle+ "'" + 2153 "<form>" + 2154 "<br />" + 2155 "<div class='accordion' style='max-height:270px; overflow-y:scroll; margin-bottom:0px;'>" + 2156 "<ul class='accordion-inner'>" + 2157 "</li><li id='line18'>" + 2158 "<i class='fas fa-chevron-right'></i>Snags Activity<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff18' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff18' value='0'> Hide</span>" + 2159 "</li><li id='line1'>" + 2160 "<i class='fas fa-chevron-right'></i>Snags By Contractor<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff1' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff1' value='0'> Hide</span>" + 2161 "</li><li id='line2'>" + 2162 "<i class='fas fa-chevron-right'></i>Snags By "+loc1+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff2' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff2' value='0'> Hide</span>" + 2163 "</li><li id='line20'>" + 2164 "<i class='fas fa-chevron-right'></i>Snags By "+loc2+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff20' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff20' value='0'> Hide</span>" + 2165 "</li><li id='line8'>" + 2166 "<i class='fas fa-chevron-right'></i>Drawings<span class='floatRight'><input type='radio' name='onoff8' onclick='saveSettings(this.name)' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff8' value='0'> Hide</span>" + 2167 "</li><li id='line14'>" + 2168 "<i class='fas fa-chevron-right'></i>"+snagCategory1+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff14' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff14' value='0'> Hide</span>" + 2169 "</li><li id='line17'>" + 2170 "<i class='fas fa-chevron-right'></i>"+snagCategory2+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff17' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff17' value='0'> Hide</span>" + 2171 "</li><li id='line23'>" + 2172 "<i class='fas fa-chevron-right'></i>"+snagCategory3+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff23' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff23' value='0'> Hide</span>" + 2173 "</li><li id='line24'>" + 2174 "<i class='fas fa-chevron-right'></i>"+snagCategory4+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff24' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff24' value='0'> Hide</span>" + 2175 "</li><li id='line25'>" + 2176 "<i class='fas fa-chevron-right'></i>
2176"+snagCategory5+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff25' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff25' value='0'> Hide</span>" + 2177 "</li><li id='line26'>" + 2178 "<i class='fas fa-chevron-right'></i>"+snagCategory6+"<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff26' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff26' value='0'> Hide</span>" + 2179 "</li><li id='line9'>" + 2180 "<i class='fas fa-chevron-right'></i>Snagging Progress<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff9' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff9' value='0'> Hide</span>" + 2181 "</li><li id='line10'>" + 2182 "<i class='fas fa-chevron-right'></i>Snags Due<span class='floatRight'><input type='radio' name='onoff10' onclick='saveSettings(this.name)' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff10' value='0'> Hide</span>" + 2183 "</li><li id='line15'>" + 2184 "<i class='fas fa-chevron-right'></i>Snags by Package<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff15' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff15' value='0'> Hide</span>" + 2185 "</li><li id='line11'>" + 2186 "<i class='fas fa-chevron-right'></i>Manager<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff11' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff11' value='0'> Hide</span>" + 2187 "</li><li id='line12'>" + 2188 "<i class='fas fa-chevron-right'></i>TC Activity<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff12' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff12' value='0'> Hide</span>" + 2189 "</li><li id='line13'>" + 2190 "<i class='fas fa-chevron-right'></i>Activity by Location<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff13' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff13' value='0'> Hide</span>" + 2191 "</li><li id='line22'><i class='fas fa-chevron-right'></i>Client<span class='floatRight'><input type='radio' onclick='saveSettings(this.name)' name='onoff22' value='1'> Show <input type='radio' onclick='saveSettings(this.name)' name='onoff22' value='0'> Hide</span>" + 2192 "</li>" + 2193 "</ul></div>" + 2194 "</form>" + 2195 "</div>"; 2196 2197 var txtDialog = $(htmlDialog); 2198 txtDialog.dialog({ 2199 id:"mydialog", 2200 height: "auto", 2201 width: 700, 2202 modal: true, 2203 "closeOnEscape": false, 2204 "open": function(event, ui) { $(".ui-dialog-titlebar-close").hide()}, 2205 buttons: { 2206 2207 /* 2208 * "Save": { text: 'Save', class:'btn btn-success', click: 2209 * function() { saveSettings(); }, }, "Cancel": { text: 'Cancel & 2210 * Close', class:'btn btn-danger', click: function() { 2211 * txtDialog.dialog( "close" ); }, }, 2212 */ 2213 "Close": { 2214 text: 'Close', 2215 class:'btn btn-success', 2216 click: function() { 2217 txtDialog.dialog( "close" ); 2218 location.reload(true); 2219 }, 2220 }, 2221 } 2222 2223 }) 2224 2225 $.ajax({ 2226 url: "/updateUserSetting.do", 2227 type: "POST", 2228 dataType: "xml", 2229 async:true, 2230 data: {"type":"1"}, 2231 success: function(xml){ 2232 2233 // 1: snags by subcontractors 2234 // 2: snags by locations 2235 // 3: custom forms 2236 // 4: document1 2237 // 5: document2 2238 // 6: document3 2239 // 7: defects 2240 // 8: plan 2241 // 9: snags progress 2242 // 10: snags due 2243 // 11:manager 2244 // 12: tc activity 2245 // 13: activity by location 2246 // 14: snags cat1 2247 // 15: package snags 2248 // 16: project progress 2249 // 17: snag cat2 2250 // 18 project activity 2251 // 19 checklist 2252 // 20 snags by loc2 2253 // 21 Contra Charge Analysis 2254 // 22 client 2255 // 23 category3 2256 // 24 category4 2257 // 25 category5 2258 // 26 category6 2259 var onoff1=$(xml).find('onoff1').text(); 2260 var onoff2=$(xml).find('onoff2').text(); 2261 var onoff8=$(xml).find('onoff8').text(); 2262 var onoff9=$(xml).find('onoff9').text(); 2263 var onoff10=$(xml).find('onoff10').text(); 2264 var onoff11=$(xml).find('onoff11').text(); 2265 var onoff12=$(xml).find('onoff12').text(); 2266 var onoff13=$(xml).find('onoff13').text(); 2267 var onoff14=$(xml).find('onoff14').text(); 2268 var onoff15=$(xml).find('onoff15').text(); 2269 var onoff17=$(xml).find('onoff17').text(); 2270 var onoff18=$(xml).find('onoff18').text(); 2271 var onoff20=$(xml).find('onoff20').text(); 2272 var onoff22=$(xml).find('onoff22').text(); 2273 // cat3 2274 var onoff23=$(xml).find('onoff23').text(); 2275 // cat4 2276 var onoff24=$(xml).find('onoff24').text(); 2277 // cat5 2278 var onoff25=$(xml).find('onoff25').text(); 2279 // cat6 2280 var onoff26=$(xml).find('onoff26').text(); 2281 2282 var vis1=$(xml).find('vis1').text(); 2283 var vis2=$(xml).find('vis2').text(); 2284 var vis8=$(xml).find('vis8').text(); 2285 var vis9=$(xml).find('vis9').text(); 2286 var vis10=$(xml).find('vis10').text(); 2287 var vis11=$(xml).find('vis11').text(); 2288 var vis12=$(xml).find('vis12').text(); 2289 var vis13=$(xml).find('vis13').text(); 2290 var vis14=$(xml).find('vis14').text(); 2291 var vis15=$(xml).find('vis15').text(); 2292 var vis17=$(xml).find('vis17').text(); 2293 var vis18=$(xml).find('vis18').text(); 2294 var vis20=$(xml).find('vis20').text(); 2295 2296 var vis22=$(xml).find('vis22').text(); 2297 // cat3 2298 var vis23=$(xml).find('vis23').text(); 2299 // cat4 2300 var vis24=$(xml).find('vis24').text(); 2301 // cat5 2302 var vis25=$(xml).find('vis25').text(); 2303 // cat6 2304 var vis26=$(xml).find('vis26').text(); 2305 2306 $('input[name=onoff1][value="'+onoff1+'"]').prop('checked', true); 2307 $('input[name=onoff2][value="'+onoff2+'"]').prop('checked', true); 2308 $('input[name=onoff8][value="'+onoff8+'"]').prop('checked', true); 2309 $('input[name=onoff9][value="'+onoff9+'"]').prop('checked', true); 2310 $('input[name=onoff10][value="'+onoff10+'"]').prop('checked', true); 2311 $('input[name=onoff11][value="'+onoff11+'"]').prop('checked', true); 2312 $('input[name=onoff12][value="'+onoff12+'"]').prop('checked', true); 2313 $('input[name=onoff13][value="'+onoff13+'"]').prop('checked', true); 2314 $('input[name=onoff14][value="'+onoff14+'"]').prop('checked', true); 2315 $('input[name=onoff15][value="'+onoff15+'"]').prop('checked', true); 2316 $('input[name=onoff17][value="'+onoff17+'"]').prop('checked', true); 2317 $('input[name=onoff18][value="'+onoff18+'"]').prop('checked', true); 2318 $('input[name=onoff20][value="'+onoff20+'"]').prop('checked', true); 2319 $('input[name=onoff22][value="'+onoff22+'"]').prop('checked', true); 2320 $('input[name=onoff23][value="'+onoff23+'"]').prop('checked', true); 2321 $('input[name=onoff24][value="'+onoff24+'"]').prop('checked', true); 2322 $('input[name=onoff25][value="'+onoff25+'"]').prop('checked', true); 2323 $('input[name=onoff26][value="'+onoff26+'"]').prop('checked', true); 2324 2325 var count=0; 2326 if (vis1=="0" || type==2){ 2327 $('li[id=line1]').hide(); 2328 2329 } 2330 if (vis2=="0"){ 2331 $('li[id=line2]').hide(); 2332 2333 } 2334 2335 if (vis8=="0"){ 2336 $('li[id=line8]').hide(); 2337 2338 } 2339 if (vis9=="0"){ 2340 $('li[id=line9]').hide(); 2341 2342 } 2343 if (vis10=="0" || roleId =="9"){ 2344 $('li[id=line10]').hide(); 2345 2346 } 2347 if (vis11=="0" || type==2){ 2348 $('li[id=line11]').hide(); 2349 2350 } 2351 if (vis12=="0" || type==2 || roleId == "9"){ 2352 $('li[id=line12]').hide(); 2353 2354 } 2355 if (vis13=="0"){ 2356 $('li[id=line13]').hide(); 2357 2358 } 2359 if (vis14=="0"){ 2360 $('li[id=line14]').hide(); 2361 2362 } 2363 2364 if (vis15=="0"){ 2365 $('li[id=line15]').hide(); 2366 2367 } 2368 2369 if (vis17=="0"){ 2370 $('li[id=line17]').hide(); 2371 2372 } 2373 2374 if (vis18=="0" || roleId=='5'){ 2375 $('li[id=line18]').hide(); 2376 2377 } 2378 2379 if (vis20=="0"){ 2380 $('li[id=line20]').hide(); 2381 2382 } 2383 2384 if (vis22=="0" || roleId=='3' || snagsClientSignoffEnabled!='1'){ 2385 $('li[id=line22]').hide(); 2386 2387 } 2388 2389 if (vis23=="0"){ 2390 $('li[id=line23]').hide(); 2391 2392 } 2393 if (vis24=="0"){ 2394 $('li[id=line24]').hide(); 2395 } 2396 if (vis25=="0"){ 2397 $('li[id=line25]').hide(); 2398 } 2399 if (vis26=="0"){ 2400 $('li[id=line26]').hide(); 2401 } 2402 2403 // $("#mydialog").animate({ height: 300 }, 500); 2404 $('#mydialog').trigger('autosize.resize'); 2405 2406 } 2407 }); 2408 2409} 2410 2411 function saveSettings(name) 2412 { 2413 2414 var val=$('input[name='+name+']:checked').val(); 2415 /* 2416 * var onoff2=$('input[name=onoff2]:checked').val(); var 2417 * onoff3=$('input[name=onoff3]:checked').val(); var 2418 * onoff4=$('input[name=onoff4]:checked').val(); var 2419 * onoff5=$('input[name=onoff5]:checked').val(); var 2420 * onoff6=$('input[name=onoff6]:checked').val(); var 2421 * onoff7=$('input[name=onoff7]:checked').val(); var 2422 * onoff8=$('input[name=onoff8]:checked').val(); var 2423 * onoff9=$('input[name=onoff9]:checked').val(); var 2424 * onoff10=$('input[name=onoff10]:checked').val(); var 2425 * onoff11=$('input[name=onoff11]:checked').val(); var 2426 * onoff12=$('input[name=onoff12]:checked').val(); var 2427 * onoff13=$('input[name=onoff13]:checked').val(); var 2428 * onoff14=$('input[name=onoff14]:checked').val(); var 2429 * onoff15=$('input[name=onoff15]:checked').val(); var 2430 * onoff16=$('input[name=onoff16]:checked').val(); var 2431 * onoff17=$('input[name=onoff17]:checked').val(); var 2432 * onoff18=$('input[name=onoff18]:checked').val(); var 2433 * onoff19=$('input[name=onoff19]:checked').val(); var 2434 * onoff20=$('input[name=onoff20]:checked').val(); var 2435 * onoff21=$('input[name=onoff21]:checked').val(); 2436 */ 2437 var data = {}; 2438 data[name] = val; 2439 data['type'] = 2; 2440 $.ajax({
2441 url: "/updateUserSetting.do", 2442 type: "POST", 2443 dataType: "xml", 2444 async:true, 2445 data:data, 2446 success: function(xml){ 2447 2448 2449 emailSent=$(xml).find('result').text(); 2450 if (emailSent=="1") 2451 { 2452 2453 // txtDialog.dialog( "close" ); 2454 // location.reload(true); 2455 } 2456 else 2457 { 2458 alert("Unable to update changes"); 2459 } 2460 2461 } 2462 }); 2463 2464} 2465 2466 2467function sendToPop8(incomingId, secondFormId) 2468{ 2469 2470 var stringHolder = document.getElementById("arrayHolder8"); 2471 var secondForm = document.getElementById(secondFormId); 2472 var theType = document.getElementById("hType8"); 2473 2474 if ((stringHolder.value == "") || (stringHolder.value == null)) { 2475 alert("You must select one or more Snags"); 2476 return ; 2477 } 2478 2479 // theRequiredField.value = incomingId; 2480 2481 // spawn("/blank.html"); 2482 // alert("String Holder: "+stringHolder.value); 2483 secondForm.submit(); 2484} 2485 2486function sendToPop14(incomingId, searchFormId) 2487{ 2488 2489 // alert("sendToPop14") 2490 var searchForm = document.getElementById("slySend14"); 2491 2492 // var theType = document.getElementById("hType8"); 2493 // filterSnagNumber
2494 document.getElementById("searchFrmSnagNumber").value=document.getElementById("filterSnagNumber").value; 2495 searchForm.status.value=document.getElementById("id_status").value; 2496 searchForm.SNAGNUMBER.value=document.getElementById("filterSnagNumber").value; 2497 searchForm.DATEIDENTIFIEDFROM.value=document.getElementById("DATEIDENTIFIEDFROM").value; 2498 searchForm.DATEIDENTIFIEDTO.value=document.getElementById("DATEIDENTIFIEDTO").value; 2499 searchForm.DUEDATEFROM.value=document.getElementById("DUEDATEFROM").value; 2500 searchForm.DUEDATETO.value=document.getElementById("DUEDATETO").value; 2501 searchForm.ZONE.value=document.getElementById("ZONE").value; 2502 searchForm.FLOOR.value=document.getElementById("FLOOR").value; 2503 searchForm.FLAT.value=document.getElementById("FLAT").value; 2504 searchForm.ROOM.value=document.getElementById("ROOM").value; 2505 searchForm.ISSUEDTO.value=document.getElementById("issuedTo").value; 2506 searchForm.PACKAGE.value=document.getElementById("PACKAGE").value; 2507 searchForm.SIGN.value=document.getElementById("SIGN").value; 2508 searchForm.CATEGORY.value=document.getElementById("CATEGORY").value; 2509 searchForm.PLANID.value=document.getElementById("PLANID").value; 2510 searchForm.SUBJECT.value=document.getElementById("SUBJECT").value; 2511 2512 if (document.getElementById("id_status").value=='COMPLETE'){ 2513 searchForm.DATECLOSEDFROM.value=document.getElementById("DATECLOSEDFROM").value; 2514 searchForm.DATECLOSEDTO.value=document.getElementById("DATECLOSEDTO").value; 2515 } 2516 else 2517 { 2518 searchForm.DATECLOSEDFROM.value=""; 2519 searchForm.DATECLOSEDTO.value=""; 2520 } 2521 2522 2523 searchForm.TOSIGNOFF.value = document.getElementById("qlhiddenSignOff").value; 2524 searchForm.CLIENTSNAGSONLY.value = document.getElementById("slySend14_clientSnagsOnly").value; 2525 searchForm.RAISEDBY.value=document.getElementById("RAISEDBY").value; 2526 searchForm.submit(); 2527} 2528 2529 2530function clearPop14(incomingId, searchFormId) 2531{ 2532 2533 // alert("sendToPop14") 2534 var searchForm = document.getElementById("slySend14"); 2535 2536 // var theType = document.getElementById("hType8"); 2537 // filterSnagNumber 2538 document.getElementById("filterSnagNumber").value=""; 2539 document.getElementById("id_status").value=""; 2540 document.getElementById("filterSnagNumber").value=""; 2541 document.getElementById("DATEIDENTIFIEDFROM").value=""; 2542 document.getElementById("DATEIDENTIFIEDTO").value=""; 2543 document.getElementById("DUEDATEFROM").value=""; 2544 document.getElementById("DUEDATETO").value=""; 2545 document.getElementById("ZONE").value=""; 2546 document.getElementById("FLOOR").value=""; 2547 document.getElementById("FLAT").value=""; 2548 document.getElementById("ROOM").value=""; 2549 document.getElementById("ISSUEDTO").value=""; 2550 document.getElementById("PACKAGE").value=""; 2551 document.getElementById("SIGN").value=""; 2552 document.getElementById("CATEGORY").value=""; 2553 document.getElementById("PLANID").value=""; 2554 document.getElementById("SUBJECT").value=""; 2555 document.getElementById("DATECLOSEDFROM").value=""; 2556 document.getElementById("DATECLOSEDTO").value=""; 2557 document.getElementById("qlhiddenSignOff").value="N"; 2558 2559 2560 sendToPop14(incomingId, searchFormId); 2561} 2562 2563 2564// Added to allow for a Custom prettyphoto lightbox image viewer layout. 2565 function loadPrettyPhotos(id,snagDetail,total){ 2566 2567 $.ajax({ 2568 url: "/getSnagPhotos.do", 2569 type: "POST", 2570 dataType: "xml", 2571 async:true, 2572 data: {"id":id}, 2573 headers: {"Ajax-User-Agent" : "websiteAjax"}, 2574 statusCode:{ 2575 2576 // call global function that alerts user and 2577 // redirects to login 2578 // page 2579 401: function(){ websiteAjaxNotLoggedIn(); }, 2580 // when updating action files 2581 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 2582 // when the server is stopped 2583 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 2584 }, 2585 success: function(xml){ 2586 var previousHTML=document.getElementById("td_"+id).innerHTML; 2587 var str=""; 2588 2589 $(xml).find("item").each(function(i){ 2590 2591 if (i==0) 2592 str=str+"<a id=\"a_"+id+"\" href=\""+$(this).text()+"\" rel=\"prettyPhoto["+id+"]\" title=\""+$($.parseHTML(snagDetail)).text()+"\"><span class=\"badge rounded-pill text-bg-primary ms-0\"><i class=\"fas fa-camera pe-1\"></i>"+total+"</span></a>"; 2593 else 2594 str=str+"<a href=\""+$(this).text()+"\" rel=\"prettyPhoto["+id+"]\" title=\""+$($.parseHTML(snagDetail)).text()+"\"></a>"; 2595 2596 });
2597 2598 if (str !="") 2599 { 2600 2601 $('#body').addClass("disableClicksScroll"); 2602 document.getElementById("td_"+id).innerHTML=str; 2603 2604 $("a[rel^='prettyPhoto']").prettyPhoto({ 2605 markup: '<div class="pp_pic_holder"> \ 2606 <div class="ppt"> </div> \ 2607 <div class="pp_top"> \ 2608 <div class="pp_left"></div> \ 2609 <div class="pp_middle"></div> \ 2610 <div class="pp_right"></div> \ 2611 </div> \ 2612 <div class="pp_content_container"> \ 2613 <div class="pp_left"> \ 2614 <div class="pp_right"> \ 2615 <div class="pp_content"> \ 2616 <div class="pp_loaderIcon"></div> \ 2617 <div class="pp_fade"> \ 2618 <div class="pp_hoverContainer"> \ 2619 <a class="pp_next" href="#">next</a> \ 2620 <a class="pp_previous" href="#">previous</a> \ 2621 <a class="pp_download" id="downloadLink" href="{path}" download>Download</a>\ 2622 </div> \ 2623 <div id="pp_full_res"></div> \ 2624 <div class="pp_details"> \ 2625 <div class="pp_nav"> \ 2626 <a href="#" class="pp_arrow_previous">Previous</a> \ 2627 <p class="currentTextHolder">0/0</p> \ 2628 <a href="#" class="pp_arrow_next">Next</a> \ 2629 </div> \ 2630 <p class="pp_description"></p> \ 2631 {pp_social} \ 2632 <a class="pp_close" href="#">Close</a> \ 2633 </div> \ 2634 </div> \ 2635 </div> \ 2636 </div> \ 2637 </div> \ 2638 </div> \ 2639 <div class="pp_bottom"> \ 2640 <div class="pp_left"></div> \ 2641 <div class="pp_middle"></div> \ 2642 <div class="pp_right"></div> \ 2643 </div> \ 2644 </div> \ 2645 <div class="pp_overlay"></div>', 2646 social_tools:false, 2647 callback: function(){ 2648 2649 $('#body').removeClass("disableClicksScroll"); 2650 2651 document.getElementById("td_"+id).innerHTML=previousHTML;} 2652 }); 2653 2654 2655 actuateLink(document.getElementById('a_'+id)); 2656 2657 2658 } 2659 2660 2661 } 2662 2663 2664 }); 2665 2666 2667 2668 } 2669 2670 2671 2672 2673 2674 function actuateLink(link) 2675{ 2676 var allowDefaultAction = true; 2677 2678 if (link.click) 2679 { 2680 link.click(); 2681 return; 2682 } 2683 else if (document.createEvent) 2684 { 2685 var e = document.createEvent('MouseEvents'); 2686 e.initEvent( 2687 'click' // event type 2688 ,true // can bubble? 2689 ,true // cancelable? 2690 ); 2691 allowDefaultAction = link.dispatchEvent(e); 2692 } 2693 2694 if (allowDefaultAction) 2695 { 2696 var f = document.createElement('form'); 2697 f.action = link.href; 2698 document.body.appendChild(f); 2699 f.submit(); 2700 } 2701} 2702 2703 2704function saveDashboardOrder(sort1, sort2){ 2705 2706// alert("save"); 2707 2708$.ajax({ 2709 url: "/updateUserSetting.do", 2710 headers: {"Ajax-User-Agent" : "websiteAjax"}, 2711 type: "POST", 2712 dataType: "xml", 2713 async:true, 2714 cache:false, 2715 data: {"type":"3","sort1": sort1,"sort2": sort2}, 2716 statusCode:{ 2717 2718 // call global function that alerts user and redirects 2719 // to login page 2720 401: function(){ websiteAjaxNotLoggedIn(); }, 2721 // when updating action files 2722 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 2723 // when the server is stopped 2724 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 2725 }, 2726 error: function (data) { 2727 2728 console.log('An error occurred.'); 2729 console.log(data); 2730 }, 2731 success: function(xml){ 2732 2733 2734 emailSent=$(xml).find('result').text(); 2735 if (emailSent=="1") 2736 { 2737 // alert("save!"); 2738 } 2739 else 2740 { 2741 // alert("Unable to update changes"); 2742 } 2743 2744 } 2745 }); 2746 2747} 2748 2749// vd changed 28/07/2022, change ajax call to async, and moved code into the 2750// success from dashboard and dashboardsub 2751function getDashboardOrder(){ 2752 2753// var sortData = new Array(2); 2754 2755$.ajax({
2756 url: "/updateUserSetting.do", 2757 headers: {"Ajax-User-Agent" : "websiteAjax"}, 2758 type: "POST", 2759 dataType: "xml", 2760 async:true, 2761 data: {"type":"4"}, 2762 statusCode:{ 2763 2764 // call global function that alerts user and redirects 2765 // to login page 2766 401: function(){ websiteAjaxNotLoggedIn(); }, 2767 // when updating action files 2768 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 2769 // when the server is stopped 2770 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 2771 }, 2772 error: function (data) { 2773 2774 console.log('An error occurred.'); 2775 console.log(data); 2776 }, 2777 success: function(xml){ 2778 2779 var sort1=$(xml).find('sort1').text(); 2780 var sort2=$(xml).find('sort2').text(); 2781 // alert("t2"); 2782 // alert("sort1=" + sort1); 2783 // alert("sort2=" + sort2); 2784 2785 // var result = new Array(2); 2786 // sortData[0] = sort1; 2787 // alert("sortData1=" + sortData[0] + "\n\n\n"); 2788 // sortData[1] = sort2; 2789 2790 // vd 28/07/2022 moved from dashboard.jsp and 2791 // dashboardSub.jsp to avoid returning value back 2792 // so that we can set ajax call async instead sync 2793 var leftColString = sort1; 2794 var rightColString = sort2; 2795 // console.log(leftColString); 2796 // console.log(rightColString); 2797 2798 // loop through left hand column and insert tables 2799 // sortable1 - this is the main div to put them in 2800 if (leftColString && leftColString.length > 0) 2801 { 2802 var leftColSort = leftColString.split(','); 2803 // alert("Left size is " + leftColSort.length); 2804 var currentDivIdLeft; 2805 for (var i=0; i < leftColSort.length; i++) 2806 { 2807 currentDivIdLeft = leftColSort[i]; 2808 if (currentDivIdLeft && currentDivIdLeft.length > 0) 2809 { 2810 if($("#" + leftColSort[i]).length) 2811 { 2812 // console.log("left-i=" + i + "-id="+ 2813 // leftColSort[i]) 2814 // check whether the div exists or 2815 // string in array is empty 2816 2817 $("#" + leftColSort[i]).appendTo($("#sortable1")); 2818 } 2819 } 2820 } 2821 } 2822 2823 2824 // loop throught right hand column and insert tables 2825 // sortable2 - this is the main div to put them in 2826 if (rightColString && rightColString.length > 0) 2827 { 2828 var rightColSort = rightColString.split(','); 2829 // alert("Right size is " + rightColSort.length); 2830 var currentDivIdRight; 2831 for (var i=0; i < rightColSort.length; i++) 2832 { 2833 currentDivIdRight = rightColSort[i]; 2834 if (currentDivIdRight && currentDivIdRight.length > 0) 2835 { 2836 if($("#" + rightColSort[i]).length) 2837 { 2838 // console.log("right-i=" + i + "-id="+ 2839 // rightColSort[i]); 2840 2841 $("#" + rightColSort[i]).appendTo($("#sortable2")); 2842 } 2843 } 2844 } 2845 } 2846 2847 2848 2849 2850 2851 2852 } 2853}); 2854 2855} 2856 2857 2858// Added by dm & fr - bootstrap popover functions - added 12/12/2014 2859// Activates help popover for both input focus and icon hover without the need 2860// for duplication. 2861 2862function addBootstrapPopoverHelp(id, title, content, placement) 2863{ 2864 if($('#' + id).length != 0) 2865 { 2866 $('#' + id).popover({ 2867 title:title, 2868 content: content, 2869 placement: placement, 2870 trigger: 'focus' 2871 }); 2872 } 2873 2874 2875 if($('#' + id + '_I').length != 0) 2876 { 2877 $('#' + id + '_I').popover({ 2878 title:title, 2879 content: content, 2880 placement: placement, 2881 trigger: 'hover' 2882 }); 2883 } 2884 2885} 2886 2887// Added by dm & fr - HTML Content allowed within bootstrap popover functions 2888// Activates Html formatted content within help popover for both input focus and 2889// icon hover without the need for duplication. 2890function addBootstrapPopoverHelpHtml(id, title, content, placement) 2891{ 2892 if($('#' + id).length != 0) 2893 { 2894 $('#' + id).popover({ 2895 html:true, 2896 title:title,
2897 content: content, 2898 placement: placement, 2899 trigger: 'focus' 2900 }); 2901 } 2902 2903 if($('#' + id + '_I').length != 0) 2904 { 2905 $('#' + id + '_I').popover({ 2906 html:true, 2907 title:title, 2908 content: content, 2909 placement: placement, 2910 trigger: 'hover' 2911 }); 2912 } 2913} 2914 2915 2916// Added by fr for multi upload file help 2917 2918 2919function uploadMultipleFiles() { 2920 $('#uploadMultipleFiles, #uploadMultipleFiles_I').popover({ 2921 html: true, 2922 title:'Selecting multiple files', 2923 content: 'Select multiple files by using shift key and selecting the first and last file. Select many individual files by holding down CTRL key (CMD for Mac) and selecting each file.<br><br><strong>Max file size:</strong><br>60mb (Single) / 600mb (Multiple)', 2924 placement:'bottom', 2925 trigger: 'hover' 2926 }) 2927} 2928 2929 2930 2931 2932// OLD FROM QUICK LISTS _ REMOVE LATER 2933// added 12/02/2015 for new signoff 2934function setMenuQuickList() 2935{ 2936 // added 12/02/2015 2937 var element = document.getElementById("qlDDlStatus"); 2938 var text = element.options[element.selectedIndex].text; 2939 if (text=="All To Sign Off") 2940 { 2941 document.getElementById("qlhiddenSignOff").value = "Y"; 2942 } 2943 else 2944 { 2945 document.getElementById("qlhiddenSignOff").value = "N"; 2946 } 2947 2948 document.forms.searchView.submit(); 2949 2950} 2951 2952function sendToPop9(incomingId, secondFormId) 2953{ 2954 var stringHolder = document.getElementById("arrayHolder9"); 2955 var secondForm = document.getElementById(secondFormId); 2956 var theType = document.getElementById("hType9"); 2957 2958 if ((stringHolder.value == "") || (stringHolder.value == null)) { 2959 alert("You must select one or more Snags"); 2960 return ; 2961 } 2962 secondForm.submit(); 2963} 2964 2965 2966 2967 2968// added for Help iFrame launch from includeMenu & includeFoot 2969 2970function loadIframe(iframeName, url) { 2971 $('#myModal').modal(); 2972 var $iframe = $('#' + iframeName); 2973 if ( $iframe.length ) { 2974 $iframe.attr('src',url); 2975 return false; 2976 } 2977 return true; 2978} 2979 2980function checkIsDevice() 2981{ 2982 var isMobile = false; // initiate as false 2983 // device detection 2984 if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) 2985 || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.
2985substr(0,4))) isMobile = true; 2986 return isMobile; 2987} 2988 2989 2990var eformbuttonclicked=0; 2991var inspectionbuttonclicked=0; 2992 2993function getMenuRegistryList(type, level, name, id) { 2994 // console.log(type+" level="+level+" name="+name+" id="+id+" 2995 // active="+eformactive); 2996 // waiting icon for checklist menu 2997 if (type == 'checklist' && level == '1') 2998 { 2999 $("#checklistSpinner").show(); 3000 } 3001 else if (type == 'eform' && level == '1') 3002 { 3003 $("#eformSpinner").show(); 3004 } 3005 // active=0 inactive include all 0s 3006 // action=1 active only 3007 // active=2 include inactive with data >0s 3008 var eformactive; 3009 if (sessionStorage.getItem("eformmenuActive") == "0") { 3010 eformactive = 0; 3011 } else if (sessionStorage.getItem("eformmenuActive") == "1") 3012 eformactive = 1; 3013 else if (sessionStorage.getItem("eformmenuActive") == "2") 3014 eformactive=2; 3015 else 3016 eformactive=1; 3017 3018 // active=0 inactive include all 0s 3019 // action=1 active only 3020 // active=2 include inactive with data >0s 3021 var inspectionactive; 3022 if (sessionStorage.getItem("inspectionmenuActive") == "0") { 3023 inspectionactive = 0; 3024 } else if (sessionStorage.getItem("inspectionmenuActive") == "1") 3025 inspectionactive = 1; 3026 else if (sessionStorage.getItem("inspectionmenuActive") == "2") 3027 inspectionactive = 2; 3028 else 3029 inspectionactive = 1; 3030 3031 var ismobile = checkIsDevice(); 3032 3033 // Removed To BE Issued from Dashboard 3034 $ 3035 .ajax({ 3036 url: "/ajaxMenu.do", 3037 type: "POST", 3038 dataType: "xml", 3039 async: true, 3040 headers: {"Ajax-User-Agent" : "websiteAjax"}, 3041 statusCode: 3042 { 3043 // call global function that alerts user and redirects to 3044 // login page 3045 401: function(){ websiteAjaxNotLoggedIn(); }, 3046 // when updating action files 3047 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 3048 // when the server is stopped 3049 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 3050 }, 3051 data: { 3052 "type": type, 3053 "level": level, 3054 "name": name, 3055 "eformactive": eformactive, 3056 "inspectionactive": inspectionactive 3057 }, 3058 error: function (request, status, error) { 3059 }, 3060 success: function (xml) { 3061 if (type == 'checklist' && level == '1') { 3062 3063 $("#checklistSpinner").hide(); 3064 3065 var checklistmain = $("#checklistRegistryUl"); 3066 var count=0; 3067 3068 // var litracker = $('<li/>').attr("id", 3069 // "checklist_tracker").appendTo(checklistmain); 3070 /* 3071 * var buttontext = ""; if (inspectionactive == 0) { 3072 * buttontext = "Show Active Only"; } else buttontext = 3073 * "Show Inactive"; 3074 * 3075 * var ialinktracker = $('<a/>').attr("href", "#").html("<div 3076 * class='labels'><button id='inspectionbtn' class='btn 3077 * btn-mini buttonClass'>Show Inactive With Data</button><button 3078 * id='inspectionbtn' class='btn btn-mini buttonClass'>" + 3079 * buttontext + "</button></div><div class='linkText'><strong>" + 3080 * $("#registryInspectionName").val() + " Tracker</strong></div>") 3081 * .on("click", function (e) { // first happened if 3082 * ($(e.target).is(":button")) { 3083 * console.log($(e.target).text()); inspectionbuttonclicked = 3084 * 1; if ($(e.target).text()!="Show Inactive With Data"){ 3085 * 3086 * if ($(e.target).text()=="Show Inactive") { 3087 * inspectionactive = 0; } else if 3088 * ($(e.target).text()=="Show Active Only"){ 3089 * inspectionactive = 1; } } else { inspectionactive = 2; } 3090 * sessionStorage.setItem("inspectionmenuActive", 3091 * inspectionactive); } else location.href = 3092 * "/viewInspectionTracker.do"; }).appendTo(litracker); 3093 * 3094 * var lidivider = $('<li/>').attr("id","checklist_divider").appendTo(checklistmain); 3095 * lidivider.addClass('divider'); 3096 */ 3097 // li for checklist totals 3098 var totalli = $('<li/>').attr("id","checklist_totals").attr("class","nav-link mainNavListItemTotals").appendTo(checklistmain); 3099 // html 3100 3101 var totalHtml=""; 3102 3103 if (inspectionactive==2) 3104 totalHtml="TOTALS<span class=\"btn-group\"><button type=\"button\" class=\"btn btn-link\" title=\"Hide inactive inspections\">Incl.Inactive <i id=\"checklistIncludeBtn\" class=\"fas fa-check-square\"></i></button></span>"; 3105 else 3106 totalHtml="TOTALS<span class=\"btn-group\"><button type=\"button\" class=\"btn btn-link\" title=\"Include inactive inspections\">Incl.Inactive <i id=\"checklistIncludeBtn\" class=\"far fa-square\"></i></button></span>"; 3107 var totalidiv1=$('<div/>').attr("class","linkText").attr("style","white-space:nowrap").html(totalHtml).on("click", function (e) { 3108 3109 inspectionbuttonclicked = 1; 3110 3111 if ($("#checklistIncludeBtn").hasClass("far fa-square")){ 3112 3113 inspectionactive = 2; 3114 3115 } 3116 else 3117 { 3118 inspectionactive = 1; 3119 } 3120 $("#checklistIncludeBtn").toggleClass("far fa-square","fas fa-check-square"); 3121 sessionStorage.setItem("inspectionmenuActive", inspectionactive); 3122 3123 }).appendTo(totalli); 3124 var totalidiv1=$('<div/>').attr("class","labels").html("<span class=\"label label-success H\">" + $(xml).find("overallopen").text() + "</span><span class=\"label label-inverse\">" + $(xml).find("overallclosed").text() + "</span><span class=\"label label-info C\">" + $(xml).find("overalltotal").text() + "</span>").appendTo(totalli); 3125 3126 3127 $(xml).find("item").each(function () { 3128 3129 count++; 3130 var liid = "checklist_" + count; 3131 var groupName = $(this).find('name').text(); 3132 // stripScripts($(this).find('name').text()); 3133 groupName = $($.parseHTML(groupName)).text(); 3134 // groupName= 3135 var li = $('<li/>').attr("id", liid).appendTo(checklistmain); 3136 if ($(this).find('type').text() == '1') { 3137 li.addClass('nav-item dropend'); 3138 } 3139 var alink; 3140 var groupnamehtml = "<div class=\"linkText\">" + groupName + "</div><div class=\"labels\"><span class=\"label label-success H\">" + $(this).find('open').text() + "</span><span class=\"label label-inverse\">" + $(this).find('closed').text() + "</span><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3141 if ($(this).find('type').text() == '1') { 3142 alink = $('<a/>').attr("class", "nav-link dropdown-toggle").html(groupnamehtml).appendTo(l
3142i); 3143 3144 if (ismobile == false) { 3145 alink.mouseenter(function (e) { 3146 if (li.find("ul").length == 0) 3147 getMenuRegistryList('checklist', 2, groupName, liid); 3148 3149 }); 3150 } else { 3151 alink.click(function (e) { 3152 3153 e.stopPropagation(); 3154 }); 3155 alink.on({ 3156 'touchstart': function (e) { 3157 e.stopPropagation(); 3158 if (li.find("ul").length == 0) { 3159 e.stopPropagation(); 3160 getMenuRegistryList('checklist', 2, groupName, liid); 3161 } 3162 } 3163 }); 3164 } 3165 } else { 3166 alink = $('<a/>').attr("class", "dropdown-item nav-link single").html(groupnamehtml).appendTo(li); 3167 alink.attr("href", "/inspectionDataRegistry.do?start=0&filterStatus=&inspectionId=" + $(this).find('id').text()); 3168 3169 } 3170 3171 }); 3172 3173 3174 } else if (type == 'checklist' && level == '2') { 3175 3176 if ($(xml).find("item").length > 0) { 3177 var parentli = $("#" + id); 3178 3179 var iul = $('<ul/>').addClass('dropdown-menu pre-scrollable').appendTo(parentli); 3180 $(xml).find("item").each(function () { 3181 3182 var ili = $('<li/>').appendTo(iul); 3183 var namehtml = "<div class=\"linkText\">" + $(this).find('name').text() + "</div><div class=\"labels\"><span class=\"label label-success H\">" + $(this).find('open').text() + "</span><span class=\"label label-inverse\">" + $(this).find('closed').text() + "</span><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3184 var ialink = $('<a/>').attr("class","dropdown-item nav-link single").attr("href", "/inspectionDataRegistry.do?start=0&filterStatus=&inspectionId=" + $(this).find('id').text()).html(namehtml).appendTo(ili); 3185 }); 3186 } 3187 } 3188 if (type == 'eform' && level == '1') { 3189 $("#eformSpinner").hide(); 3190 3191 var eformmain = $('#eformRegistryUl'); 3192 var count = 0; 3193 /* 3194 * var litracker = $('<li/>').attr("id", 3195 * "eform_tracker").appendTo(eformmain); var 3196 * buttontext = ""; if (eformactive == 0) { 3197 * buttontext = "Show Active Only"; } else { 3198 * buttontext = "Show Inactive"; } var ialinktracker = 3199 * $('<a/>').attr("href", "#").html("<div 3200 * class='labels'><button id='eformbtn' class='btn 3201 * btn-mini buttonClass'>Show Inactive With Data</button><button 3202 * id='eformbtn' class='btn btn-mini buttonClass'>" + 3203 * buttontext + "</button></div><div 3204 * class='linkText'><strong>" + 3205 * $("#registryEformName").val() + " Tracker</strong></div>") 3206 * .on("click", function (e) { // first happened // 3207 * console.log("1"); if ($(e.target).is(":button")) { 3208 * eformbuttonclicked = 1; if 3209 * ($(e.target).text()=="Show Inactive") { 3210 * 3211 * eformactive = 0; } else if 3212 * ($(e.target).text()=="Show Active Only"){ 3213 * 3214 * eformactive = 1; } else if 3215 * ($(e.target).text()=="Show Inactive With Data") { 3216 * eformactive=2; } 3217 * sessionStorage.setItem("eformmenuActive", 3218 * eformactive); } else location.href = 3219 * "/customFormTracker.do"; }).appendTo(litracker); 3220 * 3221 * 3222 * var lidivider = $('<li/>').attr("id","eform_divider").appendTo(eformmain); 3223 * lidivider.addClass('divider'); 3224 */ 3225 // li for eform totals 3226 3227 3228 3229 var totalli = $('<li/>').attr("id","eform_totals").attr("class","nav-link mainNavListItemTotals").appendTo(eformmain); 3230 // html 3231 3232 var totalHtml=""; 3233 3234 if (eformactive==2) 3235 totalHtml="TOTALS<span class=\"btn-group\"><button type=\"button\" class=\"btn btn-link\" title=\"Hide inactive forms\">Incl.Inactive <i id=\"eformIncludeBtn\" class=\"fas fa-check-square\"></i></button></span>"; 3236 else 3237 totalHtml="TOTALS<span class=\"btn-group\"><button type=\"button\" class=\"btn btn-link\" title=\"Include inactive forms\">Incl.Inactive <i id=\"eformIncludeBtn\" class=\"far fa-square\"></i></button></span>"; 3238 var totalidiv1=$('<div/>').attr("class","linkText").attr("style","white-space:nowrap").html(totalHtml).on("click", function (e) { 3239 3240 eformbuttonclicked = 1; 3241 3242 if ($("#eformIncludeBtn").hasClass("far fa-square")){ 3243 3244 eformactive = 2; 3245 3246 } 3247 else 3248 { 3249 eformactive = 1; 3250 } 3251 $("#eformIncludeBtn").toggleClass("far fa-square","fas fa-check-square"); 3252 sessionStorage.setItem("eformmenuActive", eformactive); 3253 3254 }).appendTo(totalli); 3255 var totalidiv1=$('<div/>').attr("class","labels").html("<span class=\"label label-success H\">" + $(xml).find("overallopen").text() + "</span><span class=\"label label-inverse\">" + $(xml).find("overallclosed").text() + "</span><span class=\"label label-info C\">" + $(xml).find("overalltotal").text() + "</span>").appendTo(totalli); 3256 3257 $(xml).find("item").each(function () { 3258 count++; 3259 var groupName = $(this).find('name').text(); 3260 3261 var liid = "eform_" + count; 3262 3263 var li = $('<li/>').attr("id", liid).appendTo(eformmain); 3264 if ($(this).find('type').text() == '1') 3265 li.addClass('nav-item dropend'); 3266 3267 var alink; 3268 var groupnamehtml = ""; 3269 var linkstr=""; 3270 // type 1 is group, type 0 is ungrouped custom 3271 // form 3272 // if it's an ungrouped form and it has a hubid 3273 // bigger than 0, then it's a hub level custom 3274 // form, 3275 // need to display hub icon 3276 if ($(this).find('type').text() == '0' && $(this).find('hubId').text() != '0') 3277 groupnamehtml = "<div class=\"linkText\"><span class='iconmoon-share2' alt='HUB' title='Hub level'></span>" + groupName + "</div><div class=\"labels\"><span class=\"label label-success H\">" + $(this).find('open').text() + "</span><span class=\"label label-inverse\">" + $(this).find('closed').text() + "</span><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3278 else 3279 groupnamehtml = "<div class=\"linkText\">" + groupName + "</div><div class=\"labels\"><span class=\"label label-success H\">" + $(this).find('open').text() + "</span><span class=\"label label-inverse\">" + $(this).find('closed').text() + "</span><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3280 if ($(this).find('type').text() == '1') { 3281 alink = $('<a/>').attr("class", "nav-link dropdown-toggle").html(groupnamehtml).appendTo(l
3281i); 3282 if (ismobile == false) { 3283 alink.mouseenter(function (e) { 3284 if (li.find("ul").length == 0) 3285 getMenuRegistryList('eform', 2, groupName, liid); 3286 }); 3287 } else { 3288 3289 alink.click(function (e) { 3290 e.stopPropagation(); 3291 }); 3292 alink.on({ 3293 'touchstart': function (e) { 3294 e.stopPropagation(); 3295 3296 if (li.find("ul").length == 0) { 3297 e.stopPropagation(); 3298 getMenuRegistryList('eform', 2, groupName, liid); 3299 } 3300 } 3301 }); 3302 } 3303 } else { 3304 alink = $('<a/>').attr("class", "dropdown-item nav-link single").html(groupnamehtml).appendTo(li); 3305 // vd added 26/08/2019 hub link for hub 3306 // forms 3307 if ($(this).find('type').text() == '0' && $(this).find('hubId').text() != '0') 3308 alink.attr("href", "/viewHubCustomFormDataFormRegistry.do?start=0&hubFormDefId=" + $(this).find('id').text()); 3309 else 3310 alink.attr("href", "/viewCustomFormDataFormRegistry.do?start=0&formDefId=" + $(this).find('id').text()); 3311 } 3312 }); 3313 3314 } 3315 else if (type == 'eform' && level == '2') { 3316 3317 if ($(xml).find("item").length > 0) { 3318 var parentli = $("#" + id); 3319 var iul = $('<ul/>').addClass('dropdown-menu pre-scrollable').appendTo(parentli); 3320 $(xml).find("item").each(function () { 3321 3322 var ili = $('<li/>').appendTo(iul); 3323 var namehtml = ""; 3324 // if hub id is bigger than 0, then it's a hub level 3325 // custom form, then need to display a hub icon 3326 var linkstr=""; 3327 if ($(this).find('hubId').text() != '0'){ 3328 namehtml = "<div class=\"linkText\"><span class='iconmoon-share2' alt='HUB' title='Hub level'></span>" + $(this).find('name').text() + "</div><div class=\"labels\"><span class=\"label label-success H\">" + $(this).find('open').text() + "</span><span class=\"label label-inverse\">" + $(this).find('closed').text() + "</span><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3329 // hub link for hub forms 3330 linkstr="/viewHubCustomFormDataFormRegistry.do?start=0&hubFormDefId=" + $(this).find('id').text(); 3331 } 3332 else{ 3333 namehtml = "<div class=\"linkText\">" + $(this).find('name').text() + "</div><div class=\"labels\"><span class=\"label label-success H\">" + $(this).find('open').text() + "</span><span class=\"label label-inverse\">" + $(this).find('closed').text() + "</span><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3334 linkstr="/viewCustomFormDataFormRegistry.do?start=0&formDefId=" + $(this).find('id').text(); 3335 } 3336 var ialink = $('<a/>').attr("class","dropdown-item nav-link single").attr("href", linkstr).html(namehtml).appendTo(ili); 3337 }); 3338 } 3339 } else if (type == 'ncr') { 3340 var ncrmainhref = $('#ncrmain'); 3341 var ncrName=$('#ncrmain').text(); 3342 var ncrhtml = "<div class=\"linkText\">"+ncrName+"</div><div class=\"labels\"><span class=\"label label-success H\">" + $(xml).find("open").text() + "</span><span class=\"label label-inverse\">" + $(xml).find("closed").text() + "</span><span class=\"label label-info C\">" + $(xml).find("total").text() + "</span></div>"; 3343 ncrmainhref.html(ncrhtml); 3344 3345 } 3346 3347 else if (type == 'contraCharge' && level=='0') { 3348 3349 3350 3351 var contraChargeMainMenu = $('#contraChargeMainMenu'); 3352 var contraMenuVisible = $(xml).find('contraMenuVisible').text(); 3353 3354 if (contraMenuVisible!='1') 3355 contraChargeMainMenu.hide(); 3356 else if (contraMenuVisible=='1') 3357 contraChargeMainMenu.show(); 3358 } 3359 else if (type == 'contraCharge' && level=='1') { 3360 3361 3362 3363 var contraChargemain = $('#contraChargemain'); 3364 var contraChargemenu = $('#contraChargemenu'); 3365 var count = 0; 3366 if ($(xml).find("item").length > 0) { 3367 if ($("#contraChargemenu").length == 0) { 3368 3369 $('<ul/>
3369').attr("id", "contraChargemenu").appendTo(contraChargemain); 3370 contraChargemenu = $('#contraChargemenu'); 3371 contraChargemenu.addClass('dropdown-menu'); 3372 // second happened 3373 $("#contraChargemenu").on({ 3374 "click": function (e) { 3375 // console.log("2"); 3376 $(this).parent().addClass('open'); 3377 } 3378 }); 3379 var litracker = $('<li/>').appendTo(contraChargemenu); 3380 3381 3382 3383 // lidivider.addClass('divider'); 3384 } 3385 3386 $(xml).find("item").each(function () { 3387 count++; 3388 var name = $(this).find('name').text(); 3389 var eform = $(this).find('eform').text(); 3390 3391 var liid = "contraCharge_" + count; 3392 3393 var li = $('<li/>').attr("id", liid).appendTo(contraChargemenu); 3394 if ($(this).find('type').text() == '1') 3395 li.addClass('nav-item dropend'); 3396 3397 var alink; 3398 var namehtml = ""; 3399 var linkstr=""; 3400 // type 1 is group, type 0 is ungrouped custom 3401 // form 3402 // if it's an ungrouped form and it has a hubid 3403 // bigger than 0, then it's a hub level custom 3404 // form, need to display hub icon 3405 3406 namehtml = "<div class=\"linkText\">" + name + "</div><div class=\"labels\"><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3407 3408 alink = $('<a/>').attr("class", "dropdown-item nav-link single").html(namehtml).appendTo(li); 3409 if (eform=="1") 3410 alink.attr("href", "/viewHubCustomFormDataFormRegistry.do?start=0&hubFormDefId=" + $(this).find('id').text()+"&filterContraCharge=1&noChargeSheet=1&filterStatus=closed"); 3411 else 3412 alink.attr("href", "/viewSnagsRegistryV2.do?start=0&status=COMPSIGNEDOFF&toSignOff=N&contraCharge=1&noChargeSheet=1&contraSubcontractorCode=&bimCode=&contraChargeId=&planId=&snagNumber=&projectNumber=&clientSnagsOnly=N&dateIdentifiedFrom=&dateIdentifiedTo=&dueDateFrom=&dueDateTo=&zone=&floor=&flat=&room=&packageCode=&subject=&sign=&category=&raisedBy=&dateClosedFrom=&dateClosedTo=&category2=&inspectionDataId=&inspectionsId=&inspectionGroup=&issuedTo=&dateFixedFrom=&dateFixedTo=&dateSignedOffFrom=&dateSignedOffTo="); 3413 }); 3414 } 3415 } 3416 else if (type == 'pendingContraCharge' && level=='1') { 3417 3418 3419 3420 var contraChargemain = $('#pendingContraChargemain'); 3421 var contraChargemenu = $('#pendingContraChargemenu'); 3422 var count = 0; 3423 if ($(xml).find("item").length > 0) { 3424 if ($("#pendingContraChargemenu").length == 0) { 3425 3426 $('<ul/>').attr("id", "pendingContraChargemenu").appendTo(contraChargemain); 3427 contraChargemenu = $('#pendingContraChargemenu'); 3428 contraChargemenu.addClass('dropdown-menu'); 3429 // second happened 3430 $("#pendingContraChargemenu").on({ 3431 "click": function (e) { 3432 // console.log("2"); 3433 $(this).parent().addClass('open'); 3434 } 3435 }); 3436 var litracker = $('<li/>').appendTo(contraChargemenu); 3437 3438 3439 3440 // lidivider.addClass('divider'); 3441 } 3442 3443 $(xml).find("item").each(function () { 3444 count++; 3445 var name = $(this).find('name').text(); 3446 var eform = $(this).find('eform').text(); 3447 3448 var liid = "pendingContraCharge_" + count; 3449 3450 var li = $('<li/>').attr("id", liid).appendTo(contraChargemenu); 3451 if ($(this).find('type').text() == '1') 3452 li.addClass('nav-item dropend'); 3453 3454 var alink; 3455 var namehtml = ""; 3456 var linkstr=""; 3457 // type 1 is group, type 0 is ungrouped custom form 3458 // if it's an ungrouped form and it has a hubid 3459 // bigger than 0, then it's a hub level custom form, 3460 // need to display hub icon 3461 3462 namehtml = "<div class=\"linkText\">" + name + "</div><div class=\"labels\"><span class=\"label label-info C\">" + $(this).find('total').text() + "</span></div>"; 3463 3464 alink = $('<a/>').attr("class", "dropdown-item nav-link single").html(namehtml).appendTo(l
3464i); 3465 if (eform=="1") 3466 alink.attr("href", "/viewHubCustomFormDataFormRegistry.do?start=0&hubFormDefId=" + $(this).find('id').text()+"&filterContraCharge=1&noChargeSheet=1&filterStatus=open"); 3467 else 3468 alink.attr("href", "/viewSnagsRegistryV2.do?start=0&status=pendingContras&toSignOff=&contraCharge=1&noChargeSheet=1&contraSubcontractorCode=&bimCode=&contraChargeId=&planId=&snagNumber=&projectNumber=&clientSnagsOnly=N&dateIdentifiedFrom=&dateIdentifiedTo=&dueDateFrom=&dueDateTo=&zone=&floor=&flat=&room=&packageCode=&subject=&sign=&category=&raisedBy=&dateClosedFrom=&dateClosedTo=&category2=&inspectionDataId=&inspectionsId=&inspectionGroup=&issuedTo=&dateFixedFrom=&dateFixedTo=&dateSignedOffFrom=&dateSignedOffTo="); 3469 }); 3470 } 3471 } 3472 3473 else if (type == 'snagstatus') { 3474 3475 $('#menulink_toReview').html("<div class=\"linkText\">"+$('#menulink_toReview').text()+"</div><div class=\"labels\"><span class=\"label label-info toReview\">"+$(xml).find("toReview").text()+"</span></div>"); 3476 $('#menulink_onHold').html("<div class=\"linkText\">"+$('#menulink_onHold').text()+"</div><div class=\"labels\"><span class=\"label label-info onHold\">"+$(xml).find("onHold").text()+"</span></div>"); 3477 $('#menulink_toBeIssued').html("<div class=\"linkText\">"+$('#menulink_toBeIssued').text()+"</div><div class=\"labels\"><span class=\"label label-info toIssue\">"+$(xml).find("toBeIssued").text()+"</span></div>"); 3478 $('#menulink_toFix').html("<div class=\"linkText\">"+$('#menulink_toFix').text()+"</div><div class=\"labels\"><span class=\"label label-info toFix\">"+$(xml).find("toFix").text()+"</span></div>"); 3479 $('#menulink_toClose').html("<div class=\"linkText\">"+$('#menulink_toClose').text()+"</div><div class=\"labels\"><span class=\"label label-info toClose\">"+$(xml).find("toClose").text()+"</span></div>"); 3480 $('#menulink_closed').html("<div class=\"linkText\">"+$('#menulink_closed').text()+"</div><div class=\"labels\"><span class=\"label label-info closed\">"+$(xml).find("closed").text()+"</span></div>"); 3481 $('#menulink_toSignOff').html("<div class=\"linkText\">"+$('#menulink_toSignOff').text()+"</div><div class=\"labels\"><span class=\"label label-info toSignOff\">"+$(xml).find("toSignOff").text()+"</span></div>"); 3482 $('#menulink_signedOff').html("<div class=\"linkText\">"+$('#menulink_signedOff').text()+"</div><div class=\"labels\"><span class=\"label label-info signedOff\">"+$(xml).find("signedOff").text()+"</span></div>"); 3483 $('#menulink_deleted').html("<div class=\"linkText\">"+$('#menulink_deleted').text()+"</div><div class=\"labels\"><span class=\"label label-info deleted\">"+$(xml).find("deleted").text()+"</span></div>"); 3484 $('#menulink_misissued').html("<div class=\"linkText\">"+$('#menulink_misissued').text()+"</div><div class=\"labels\"><span class=\"label label-info misIssued\">"+$(xml).find("misissued").text()+"</span></div>"); 3485 $('#menulink_rejected').html("<div class=\"linkText\">"+$('#menulink_rejected').text()+"</div><div class=\"labels\"><span class=\"label label-info rejected\">"+$(xml).find("rejected").text()+"</span></div>"); 3486 $('#menulink_clientReturned').html("<div class=\"linkText\">"+$('#menulink_clientReturned').text()+"</div><div class=\"labels\"><span class=\"label label-info clientReturns\">"+$(xml).find("clientReturned").text()+"</span></div>"); 3487 } 3488 3489 3490 // alert($('#checklistmenu').html()); 3491 } 3492 }); 3493} 3494 3495 3496 3497function mouseoverRegistry(type){ 3498 3499 if (type=='checklist' && checklistLoaded==false){ 3500 3501 checklistLoaded=true; 3502 $('#'+type+'loading').hide(); 3503 getMenuRegistryList(type,1,""); 3504 } 3505 3506 else if (type=='eform' && eformLoaded==false){ 3507 // console.log("load registry:"+eformLoaded); 3508 3509 eformLoaded=true; 3510 $('#'+type+'loading').hide(); 3511 getMenuRegistryList(type,1,""); 3512 3513 } 3514 else if (type=='contraCharge' && contraChargeLoaded==false){ 3515 // console.log("load registry:"+eformLoaded); 3516 3517 contraChargeLoaded=true; 3518 $('#'+type+'loading').hide(); 3519 getMenuRegistryList(type,1,""); 3520 3521 } 3522 3523 else if (type=='pendingContraCharge' && pendingContraChargeLoaded==false){ 3524 // console.log("load registry:"+eformLoaded); 3525 3526 pendingContraChargeLoaded=true; 3527 3528 $('#'+type+'loading').hide(); 3529 getMenuRegistryList(type,1,""); 3530 3531 } 3532 else if (type=='ncr' && ncrLoaded==false){ 3533 // console.log("load registry:"+eformLoaded); 3534 3535 ncrLoaded=true; 3536 3537 $('#'+type+'loading').hide(); 3538 getMenuRegistryList(type,1,""); 3539 3540 } 3541 3542 else if (type=='snagstatus' && snagstatusLoaded==false){ 3543 // console.log("load registry:"+eformLoaded); 3544 3545 snagstatusLoaded=true; 3546 3547 $('#'+type+'loading').hide(); 3548 getMenuRegistryList(type,1,""); 3549 3550 } 3551} 3552// used by ncr, eform, checklist, contra ajax registry menu 3553// menus are only loaded when user click the menu 3554function clickRegistry(type){ 3555 3556 if (type=='checklist' && checklistLoaded==false){ 3557 3558 checklistLoaded=true; 3559 $('#'+type+'loading').hide(); 3560 // get the list 3561 getMenuRegistryList(type,1,""); 3562 } 3563 else if (type=='eform' && eformLoaded==false){ 3564 3565 eformLoaded=true; 3566 $('#'+type+'loading').hide(); 3567 // get the list 3568 getMenuRegistryList(type,1,""); 3569 3570 } 3571 else if (type=='contraCharge' && contraChargeLoaded==false){ 3572 3573 contraChargeLoaded=true; 3574 $('#'+type+'loading').hide(); 3575 getMenuRegistryList(type,1,""); 3576 3577 } 3578 3579 else if (type=='ncr' && ncrLoaded==false){ 3580 3581 ncrLoaded=true; 3582 $('#'+type+'loading').hide(); 3583 getMenuRegistryList(type,1,""); 3584 3585 } 3586 3587 else if (type=='snagstatus' && snagstatusLoaded==false){ 3588 3589 snagstatusLoaded=true; 3590 3591 getMenuRegistryList(type,1,""); 3592 3593 } 3594 3595} 3596// refresh eform ajax menu, called when user click the show inactive/active 3597// button 3598function refreshEformMenu(){ 3599 getMenuRegistryList('eform',1,""); 3600 3601} 3602// refresh checklist menu, called when user click the show inactive/active 3603// button 3604function refreshInspectionMenu(){ 3605 getMenuRegistryList('checklist',1,""); 3606 3607} 3608 3609// fr added 3610// Toggle radio btn group - Style radio option to look like slider switch - 3611// active class 3612// Used on home & tracker pages. 3613function slideToggleRadioBtn() { 3614 $('.radioBtn .btn').on('click', function() { 3615 $('a').removeClass('active'); 3616 $('a').removeClass('btn-success'); 3617 $(this).toggleClass('active'); 3618 $(this).toggleClass('btn-success'); 3619 }); 3620} 3621 3622 3623// don't delete Test, it's used in add/edit/muledit lookup/location 3624 3625function setlookupBoxes(fish){ 3626 3627 if(fish==1){ 3628 var theSelectah = document.lookupForm.loc1Selector; 3629 var theTarget = document.lookupForm.loc1; 3630 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3631 theTarget.value = theValue; 3632 } 3633 else if(fish==2){ 3634 var theSelectah = document.lookupForm.loc2Selector; 3635 var theTarget = document.lookupForm.loc2; 3636 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3637 theTarget.value = theValue; 3638 } 3639 else if(fish==3){ 3640 var theSelectah = document.lookupForm.loc3Selector; 3641 var theTarget = document.lookupForm.loc3; 3642 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3643 theTarget.value = theValue; 3644 } 3645 else if(fish==4){ 3646 var theSelectah = document.lookupForm.loc4Selector; 3647 var theTarget = document.lookupForm.loc4; 3648 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3649 theTarget.value = theValue; 3650 } 3651 else if(fish==5){ 3652 var theSelectah = document.lookupForm.lookup1Selector; 3653 var theTarget = document.lookupForm.loc1Lookup; 3654 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3655 theTarget.value = theValue; 3656 } 3657 else if(fish==6){ 3658 var theSelectah = document.lookupForm.lookup2Selector; 3659 var theTarget = document.lookupForm.loc2Lookup; 3660 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3661 theTarget.value = theValue; 3662 } 3663 else if(fish==7){ 3664 var theSelectah = document.lookupForm.lookup3Selector; 3665 var theTarget = document.lookupForm.loc3Lookup; 3666 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3667 theTarget.value = theValue; 3668 } 3669 else if(fish==8){
3670 var theSelectah = document.lookupForm.lookup4Selector; 3671 var theTarget = document.lookupForm.loc4Lookup; 3672 var theValue = theSelectah.options[theSelectah.options.selectedIndex].value; 3673 theTarget.value = theValue; 3674 } 3675 3676 } 3677 3678 3679 3680function setUserComments(type, ischecked){ 3681 var calert; 3682 if (ischecked) 3683 calert=1; 3684 else 3685 calert=0; 3686 $.ajax({ 3687 url: "/updateUserSetting.do", 3688 headers: {"Ajax-User-Agent" : "websiteAjax"}, 3689 type: "POST", 3690 dataType: "xml", 3691 async:true, 3692 cache:false, 3693 statusCode:{ 3694 3695 // call global function that alerts user and redirects to login page 3696 401: function(){ websiteAjaxNotLoggedIn(); }, 3697 // when updating action files 3698 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 3699 // when the server is stopped 3700 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 3701 }, 3702 error: function (data) { 3703 3704 console.log('An error occurred.'); 3705 console.log(data); 3706 }, 3707 data: {"type":"6","comment": type,"alert": calert}, 3708 3709 success: function(xml){ 3710 3711 3712 var success=$(xml).find('result').text(); 3713 if (success=="1") 3714 { 3715 3716 } 3717 else 3718 { 3719 alert("Unable to update changes"); 3720 } 3721 3722 } 3723 }); 3724 3725} 3726 3727 3728// // new location load location ddls 3729function getLocationLookups(zone, floor, flat, room) { 3730 // Removed To BE Issued from Dashboard 3731 if (zone!=null && zone!=''){ 3732 3733 3734 if($("#pinpointEnabled").val() == "true") $("#pinpointLinkId").hide(); 3735 3736 3737 $.ajax({
3738 url: "/lookupLookup.do", 3739 headers: {"Ajax-User-Agent" : "websiteAjax"}, 3740 type: "POST", 3741 dataType: "xml", 3742 async: true, 3743 data: { 3744 "zone": zone, 3745 "floor": floor, 3746 "flat": flat, 3747 "room" : room 3748 }, 3749 statusCode:{ 3750 3751 // call global function that alerts user and redirects to login 3752 // page 3753 401: function(){ websiteAjaxNotLoggedIn(); }, 3754 // when updating action files 3755 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 3756 // when the server is stopped 3757 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 3758 }, 3759 error: function (data) { 3760 3761 console.log('An error occurred.'); 3762 console.log(data); 3763 }, 3764 success: function(xml) { 3765 3766 if ($(xml).find("info:eq(0)").text()!='null'){ 3767 $('input[name=loc1Lookup]').val($(xml).find("info:eq(0)").text()); 3768 $('input[name=loc2Lookup]').val($(xml).find("info:eq(1)").text()); 3769 $('input[name=loc3Lookup]').val($(xml).find("info:eq(2)").text()); 3770 $('input[name=loc4Lookup]').val($(xml).find("info:eq(3)").text()); 3771 3772 $('input[name=loc1LookupShow]').val($(xml).find("info:eq(0)").text()); 3773 $('input[name=loc2LookupShow]').val($(xml).find("info:eq(1)").text()); 3774 $('input[name=loc3LookupShow]').val($(xml).find("info:eq(2)").text()); 3775 $('input[name=loc4LookupShow]').val($(xml).find("info:eq(3)").text()); 3776 3777 $('input[name=loc1LookupShow]').css('background-color', '#ccffcc'); 3778 $('input[name=loc2LookupShow]').css('background-color', '#ccffcc'); 3779 $('input[name=loc3LookupShow]').css('background-color', '#ccffcc'); 3780 $('input[name=loc4LookupShow]').css('background-color', '#ccffcc'); 3781 3782 $('input[name=loc1LookupShow]').css('border-color', '#66cc66'); 3783 $('input[name=loc2LookupShow]').css('border-color', '#66cc66'); 3784 $('input[name=loc3LookupShow]').css('border-color', '#66cc66'); 3785 $('input[name=loc4LookupShow]').css('border-color', '#66cc66'); 3786 3787 3788 $('#show').hide(); 3789 $('#submit1').show(); 3790 $('#submit2').show(); 3791 $('#submit3').show(); 3792 $('#or1').css('display', 'inline-block'); 3793 $('#or2').css('display', 'inline-block'); 3794 3795 var planId=$(xml).find("planId").text(); 3796 var locationx=$(xml).find("locationx").text(); 3797 var locationy=$(xml).find("locationy").text(); 3798 3799 // console.log("planId=" + planId); 3800 // console.log("locationx=" + locationx); 3801 // console.log("locationy=" + locationy); 3802 if($("#pinpointEnabled").val() == "true") 3803 { 3804 // console.log("pinpointEnabled=" + true); 3805 if (planId=='null' || planId=='0' ) 3806 { 3807 $("#pinpointLinkId").hide(); 3808 } 3809 // check if pinpoint has been set - update link 3810 // accordingly 3811 else if( $("#pinpointPlanId").val() == planId && $("#pinpointPlanId").val() != "0" && $("#pinpointLocationX").val() != "-1" && $("#pinpointLocationY").val() != "-1" ) 3812 { 3813 // console.log("checking and pinpoint is set"); 3814 // console.log("planId=" + planId); 3815 // console.log("plan from form=" + 3816 // $("#pinpointPlanId").val()); 3817 3818 $("#pinpointLinkId").attr("onclick", "createPinpoint(" + $("#pinpointPlanId").val() + ", " + $("#pinpointLocationX").val() + ", " + $("#pinpointLocationY").val() + ", 1, 1)"); 3819 $("#pinpointLinkId").text("Plan Pinpoint set"); 3820 $("#pinpointLinkId").show(); 3821 } 3822 else if (planId!='null' && planId!='0' && locationx!='-1' && locationy!='-1') 3823 { 3824 // console.log("planId=" + planId); 3825 // console.log("plan from form=" + 3826 // $("#pinpointPlanId").val()); 3827 3828 $("#pinpointX").val("-1"); 3829 $("#pinpointY").val("-1"); 3830 $("#pinpointLocationX").val("-1"); 3831 $("#pinpointLocationY").val("-1"); 3832 $("#pinpointPlanId").val("0"); 3833 3834 $("#pinpointLinkId").attr("onclick", "createPinpoint("+planId+", "+locationx+", "+locationy+", 0, 1);"); 3835 $("#pinpointLinkId").text("Add Plan Pinpoint"); 3836 $("#pinpointLinkId").show(); 3837 } 3838 3839 } 3840 3841 3842 3843 3844 } 3845 else{ 3846 3847 $('input[name=loc1Lookup]').val(""); 3848 $('input[name=loc2Lookup]').val(""); 3849 $('input[name=loc3Lookup]').val(""); 3850 $('input[name=loc4Lookup]').val(""); 3851 3852 $('input[name=loc1LookupShow]').val(""); 3853 $('input[name=loc2LookupShow]').val(""); 3854 $('input[name=loc3LookupShow]').val(""); 3855 $('input[name=loc4LookupShow]').val(""); 3856 3857 3858 $('input[name=loc1LookupShow]').css('background-color', '#ff9999'); 3859 $('input[name=loc2LookupShow]').css('background-color', '#ff9999'); 3860 $('input[name=loc3LookupShow]').css('background-color', '#ff9999'); 3861 $('input[name=loc4LookupShow]').css('background-color', '#ff9999'); 3862 3863 $('input[name=loc1LookupShow]').css('border-color', '#cc6666'); 3864 $('input[name=loc2LookupShow]').css('border-color', '#cc6666'); 3865 $('input[name=loc3LookupShow]').css('border-color', '#cc6666'); 3866 $('input[name=loc4LookupShow]').css('border-color', '#cc6666'); 3867 3868 3869 $('#show').css('display', 'block'); 3870 $('#submit1').hide(); 3871 $('#submit2').hide(); 3872 $('#submit3').hide(); 3873 $('#or1').hide(); 3874 $('#or2').hide(); 3875 } 3876 3877 3878 } 3879 3880 3881 }); 3882 } 3883 3884} 3885 3886// planId is only set in the addSnag 3887function getLocationDDL(type,f,zone,floor,flat, room,planId) { 3888 // Removed To BE Issued from Dashboard 3889 3890 var ddl; 3891 3892 if (f>type){ 3893 if (type=='1'){ 3894 $('select[name=floorList]:eq(0)').find('option').not(':first').remove(); 3895 try{ 3896 $('select[name=floorList]:eq(0)').selectpicker('refresh'); 3897 }catch(e){} 3898 ddl=$('select[name=floorList]:eq(0)'); 3899 3900 if (f>'2'){ 3901 $('select[name=zoneList]:eq(0)').find('option').not(':first').remove(); 3902 try{ 3903 $('select[name=zoneList]:eq(0)').selectpicker('refresh'); 3904 }catch(e){} 3905 } 3906 if (f>'3'){ 3907 $('select[name=roomList]:eq(0)').find('option').not(':first').remove(); 3908 try{ 3909 $('select[name=roomList]:eq(0)').selectpicker('refresh'); 3910 }catch(e){} 3911 } 3912 3913 } 3914 else if (type=='2'){ 3915 $('select[name=zoneList]:eq(0)').find('option').not(':first').remove(); 3916 try{ 3917 $('select[name=zoneList]:eq(0)').selectpicker('refresh'); 3918 }catch(e){} 3919 ddl=$('select[name=zoneList]:eq(0)'); 3920 if (f>'3'){ 3921 $('select[name=roomList]:eq(0)').find('option').not(':first').remove(); 3922 try{ 3923 $('select[name=roomList]:eq(0)').selectpicker('refresh'); 3924 }catch(e){} 3925 } 3926 } 3927 else if (type=='3'){ 3928 ddl=$('select[name=roomList]:eq(0)'); 3929 $('select[name=roomList]:eq(0)').find('option').not(':first').remove(); 3930 try{ 3931 $('select[name=roomList]:eq(0)').selectpicker('refresh'); 3932 }catch(e){} 3933 } 3934 if (typeof planId =='undefined') 3935 { 3936 planId=""; 3937 } 3938 $.ajax({
3939 url: "/addSnagLookup.do", 3940 type: "POST", 3941 dataType: "xml", 3942 async: true, 3943 cache:false, 3944 headers: {"Ajax-User-Agent" : "websiteAjax"}, 3945 statusCode: 3946 { 3947 // call global function that alerts user and redirects to 3948 // login page 3949 401: function(){ websiteAjaxNotLoggedIn(); }, 3950 // when updating action files 3951 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 3952 // when the server is stopped 3953 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 3954 }, 3955 data: { 3956 "incomplete": 1, 3957 "locnumber": type, 3958 "f": f, 3959 "zone":zone, 3960 "floor":floor, 3961 "flat":flat, 3962 "room":room, 3963 "planId":planId 3964 3965 3966 }, 3967 error: function(request, status, error) { 3968 3969 }, 3970 success: function(xml) { 3971 3972 var countitems=$(xml).find("item").length; 3973 $(xml).find("item").each(function() { 3974 3975 ddl.append($('<option>', {value:$(this).text(), text:$(this).text()})); 3976 }); 3977 try{ 3978 ddl.selectpicker('refresh'); 3979 }catch(e){} 3980 3981 3982 3983 var currentddl=parseInt(type); 3984 3985 var totalddl=parseInt(f); 3986 if ((currentddl+1)==totalddl && countitems==1){ 3987 3988 ddl.find("option:eq(1)").prop('selected', true); 3989 ddl.selectpicker('refresh'); 3990 ddl.trigger('change'); 3991 3992 3993 } 3994 else{ 3995 3996 // for dashboard page 3997 if ((currentddl+1)==2) 3998 ddl.val(floor); 3999 else if ((currentddl+1)==3) 4000 ddl.val(flat); 4001 else if ((currentddl+1)==4) 4002 ddl.val(room); 4003 } 4004 } 4005 4006 4007 }); 4008 } 4009 4010} 4011 4012 4013function stripScripts(s) { 4014 var div = document.createElement('div'); 4015 div.innerHTML = s; 4016 var scripts = div.getElementsByTagName('script'); 4017 var i = scripts.length; 4018 while (i--) { 4019 scripts[i].parentNode.removeChild(scripts[i]); 4020 } 4021 return div.innerHTML; 4022 } 4023 4024 4025 4026// vd added 23/05/2019 4027// format email, remove spaces, convert to lower case 4028function formatEmail(emailinput){ 4029 var email=$(emailinput).val(); 4030 // remove spaces 4031 email=email.replace(/ /g,''); 4032 // change to lower case 4033 email=email.toLowerCase(); 4034 $(emailinput).val(email); 4035 4036} 4037// vd added 23/05/2019 4038// validation for textareas 4039function validateEmailWithMultiplePatternRequired(emailinput){ 4040 var emailaddress=$(emailinput).val(); 4041 // remove spaces 4042 emailaddress=emailaddress.replace(/ /g,''); 4043 // change to lower case 4044 emailaddress=emailaddress.toLowerCase(); 4045 $(emailinput).val(emailaddress); 4046 // pattern-allow multiple addresses seperated by ; 4047 // put /^ at the beginning and $/ at the end to change html5 pattern to js 4048 // regex 4049 var pat=/^([a-z0-9'._%+-]+@[a-z0-9.-]+\.[a-z]{2,63};)*([a-z0-9'._%+-]+@[a-z0-9.-]+\.[a-z]{2,63}$)$/; 4050 var result=pat.test(emailaddress) 4051 if (result==false){ 4052 4053 // set custom validity - set the textarea invalid, the text will be 4054 // shown when submit the form 4055 // if it's empty 4056 if (emailaddress=='') 4057 // when the form is submitted, the tooltip will show up with the 4058 // text set here. 4059 emailinput.setCustomValidity('Please fill in this field'); 4060 else 4061 // when the form is submitted, the tooltip will show up with the 4062 // text set here. 4063 emailinput.setCustomValidity('Please match the requested format:eg. [email protected];[email protected]'); 4064 } 4065 else{ 4066 // set custom validity('') - means set the textarea valid, then the 4067 // form can be submitted. 4068 emailinput.setCustomValidity(''); 4069 } 4070 4071} 4072 4073// vd added 30/05/2019
4074// validation for textareas optional 4075function validateEmailWithMultiplePatternOptional(emailinput){ 4076 var emailaddress=$(emailinput).val(); 4077 // remove spaces 4078 emailaddress=emailaddress.replace(/ /g,''); 4079 // change to lower case 4080 emailaddress=emailaddress.toLowerCase(); 4081 $(emailinput).val(emailaddress); 4082 // if email address is not empty, then validate it 4083 if (emailaddress!=""){ 4084 // pattern-allow multiple addresses seperated by ; 4085 // put /^ at the beginning and $/ at the end to change html5 pattern to 4086 // js regex 4087 var pat=/^([a-z0-9'._%+-]+@[a-z0-9.-]+\.[a-z]{2,63};)*([a-z0-9'._%+-]+@[a-z0-9.-]+\.[a-z]{2,63}$)$/; 4088 var result=pat.test(emailaddress) 4089 if (result==false){ 4090 // set custom validity - set the textarea invalid, the text will 4091 // be shown when submit the form 4092 // when the form is submitted, the tooltip will show up with the 4093 // text set here. 4094 emailinput.setCustomValidity('Please match the requested format:eg. [email protected];[email protected]'); 4095 } 4096 else{ 4097 // set custom validity('') - means set the textarea valid, then 4098 // the form can be submitted. 4099 emailinput.setCustomValidity(''); 4100 } 4101 } 4102 // if email address is empty, then set it valid 4103 else{ 4104 emailinput.setCustomValidity(''); 4105 } 4106 4107} 4108 4109// vd added 12/06/2019 4110// validation for javascript prompt 4111function validatePromptEmailWithMultiplePatternRequired(email){ 4112 // remove spaces 4113 email=email.replace(/ /g,''); 4114 // change to lower case 4115 email=email.toLowerCase(); 4116 4117 // pattern-allow multiple addresses seperated by ; 4118 // put /^ at the beginning and $/ at the end to change html5 pattern to js 4119 // regex 4120 var pat=/^([a-z0-9'._%+-]+@[a-z0-9.-]+\.[a-z]{2,63};)*([a-z0-9'._%+-]+@[a-z0-9.-]+\.[a-z]{2,63}$)$/; 4121 var result=pat.test(email) 4122 return result; 4123 4124} 4125 4126// vd added 22/07/2019
4127// remove spaces from a textarea or textbox 4128function removeSpaces(inputobj){ 4129 var inputvalue=$(inputobj).val(); 4130 // remove spaces 4131 inputvalue=inputvalue.replace(/ /g,''); 4132 $(inputobj).val(inputvalue); 4133} 4134 4135 4136// fgr added 23/12/2019 4137// When the user scrolls down 200px from the top of the document, show/hide 4138// sticky footer 4139function scrollFunction() { 4140 if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) { 4141 document.getElementById("stickyFooterId").style.opacity = "1"; 4142 // $("#footer").show() 4143 } else { 4144 document.getElementById("stickyFooterId").style.opacity = "0"; 4145 // $("#footer").hide() 4146 } 4147} 4148 4149// ajax plan button 4150function ajaxSnagsRegistryPlan(){ 4151 var snagsRegistryForm=$("#myForm"); 4152 if ($("#planMenuList").has("li").length==0){ 4153 $.ajax({ 4154 type: "get", 4155 url: "/getSnagsRegistryPlanAjax.do", 4156 headers: {"Ajax-User-Agent" : "websiteAjax"}, 4157 statusCode: 4158 { 4159 // call global function that alerts user and redirects to 4160 // login page 4161 401: function(){ websiteAjaxNotLoggedIn(); }, 4162 // when updating action files 4163 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 4164 // when the server is stopped 4165 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 4166 }, 4167 error: function (data) { 4168 4169 console.log('An error occurred.'); 4170 console.log(data); 4171 }, 4172 success: function (xml) { 4173 $("#planMenuList").html(""); 4174 if ($(xml).find("plan").length>0){ 4175 $("#planMenuList").append("<li><a class=\"dropdown-item\" href=\"#\" onclick=\"downloadPlansWithPinpoint()\"><i class='fas fa-download'></i> Download All</a></li><li><hr class=\"dropdown-divider\"></li>"); 4176 $(xml).find("plan").each(function() { 4177 var name=$(this).find('name').text(); 4178 var id=$(this).find('id').text(); 4179 $("#planMenuList").append("<li><a class=\"dropdown-item\" href=\"/viewSnagsRegistryPlanPinpoint.do?planId="+id+"&status="+$("#id_status").val()+"&type=2\">"+name+"</a></li>"); 4180 }); 4181 } 4182 else{ 4183 $("#planMenuList").dropdown('toggle'); 4184 $("#btn_planMenuList").blur(); 4185 alert("There are no plans."); 4186 } 4187 4188 } 4189 4190 }); 4191 } 4192} 4193 4194 4195 4196// eform menu, search button - load eforms 4197function loadEformsToSelect(eformName) 4198{ 4199 console.log("empty"); 4200 $("#eformMenuSearch").empty(); 4201 var eformactive; 4202 if (sessionStorage.getItem("eformmenuActive") == "0") { 4203 eformactive = 0; 4204 } else if (sessionStorage.getItem("eformmenuActive") == "1") 4205 eformactive = 1; 4206 else if (sessionStorage.getItem("eformmenuActive") == "2") 4207 eformactive=2; 4208 else 4209 eformactive=1; 4210 4211 $ 4212 .ajax({ 4213 url: "/ajaxMenu.do", 4214 type: "POST", 4215 dataType: "xml", 4216 async: true, 4217 headers: {"Ajax-User-Agent" : "websiteAjax"}, 4218 statusCode: 4219 { 4220 // call global function that alerts user and redirects to 4221 // login page 4222 401: function(){ websiteAjaxNotLoggedIn(); }, 4223 // when updating action files 4224 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 4225 // when the server is stopped 4226 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 4227 }, 4228 data: { 4229 "type": 'searchEform', 4230 "eformactive":eformactive 4231 }, 4232 error: function (request, status, error) { 4233 }, 4234 success: function (xml) { 4235 4236 if ($(xml).find("eform").length > 0) { 4237 4238 var eformOptGroup=$('<optgroup/>').attr('label', eformName); 4239 4240 $(xml).find("eform").each(function () { 4241 if ($(this).find('hubId').text()!='0') 4242 { 4243 eformOptGroup 4244 .append($("<option></option>") 4245 .attr("value",'/viewHubCustomFormDataFormRegistry.do?start=0&hubFormDefId='+$(this).find('id').text()) 4246 .attr("data-content","<div class='linkText'><span class='iconmoon-share2' alt='HUB' title='Hub level'></span>"+$(this).find('name').text()+"</div><div class='labels'><span class='label label-success H'>"+$(this).find('open').text()+"</span><span class='label label-inverse'>"+$(this).find('closed').text()+"</span><span class='label label-info C'>"+$(this).find('total').text()+"</span></div>") 4247 .attr("data-tokens",$(this).find('group').text()) 4248 .text($(this).find('name').text())); 4249 } 4250 else 4251 { 4252 eformOptGroup 4253 .append($("<option></option>") 4254 .attr("value",'/viewCustomFormDataFormRegistry.do?start=0&formDefId='+$(this).find('id').text()) 4255 .attr("data-content","<div class='linkText'>"+$(this).find('name').text()+"</div><div class='labels'><span class='label label-success H'>"+$(this).find('open').text()+"</span><span class='label label-inverse'>"+$(this).find('closed').text()+"</span><span class='label label-info C'>"+$(this).find('total').text()+"</span></div>") 4256 .attr("data-tokens",$(this).find('group').text()) 4257 .text($(this).find('name').text())); 4258 4259 } 4260 4261 });
4262 4263 // refresh 4264 $("#eformMenuSearch").append(eformOptGroup); 4265 } 4266 4267 $("#eformMenuSearch").selectpicker('refresh'); 4268 4269 } 4270 4271 }); 4272 4273 4274} 4275 4276// checklist menu, search button - load checklist 4277function loadInspectionsToSelect(inspectionName) 4278{ 4279 // console.log("empty"); 4280 $("#checklistMenuSearch").empty(); 4281 // if ($("#checklistMenuSearch option").length<=1) 4282 // { 4283 var inspectionactive; 4284 if (sessionStorage.getItem("inspectionmenuActive") == "0") { 4285 inspectionactive = 0; 4286 } else if (sessionStorage.getItem("inspectionmenuActive") == "1") 4287 inspectionactive = 1; 4288 else if (sessionStorage.getItem("inspectionmenuActive") == "2") 4289 inspectionactive = 2; 4290 else 4291 inspectionactive = 1; 4292 $ 4293 .ajax({ 4294 url: "/ajaxMenu.do", 4295 type: "POST", 4296 dataType: "xml", 4297 async: true, 4298 headers: {"Ajax-User-Agent" : "websiteAjax"}, 4299 statusCode: 4300 { 4301 // call global function that alerts user and redirects to 4302 // login page 4303 401: function(){ websiteAjaxNotLoggedIn(); }, 4304 // when updating action files 4305 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 4306 // when the server is stopped 4307 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 4308 }, 4309 data: { 4310 "type": 'searchChecklist', 4311 "inspectionactive":inspectionactive 4312 }, 4313 error: function (request, status, error) { 4314 }, 4315 success: function (xml) { 4316 4317 if ($(xml).find("inspection").length > 0) { 4318 4319 var inpsectionOptGroup=$('<optgroup/>').attr('label', inspectionName); 4320 4321 $(xml).find("inspection").each(function () { 4322 4323 inpsectionOptGroup 4324 .append($("<option></option>") 4325 .attr("value",'/inspectionDataRegistry.do?start=0&filterStatus=&inspectionId='+$(this).find('id').text()) 4326 .attr("data-content","<div class='linkText'>"+$(this).find('name').text()+"</div><div class='labels'><span class='label label-success H'>"+$(this).find('open').text()+"</span><span class='label label-inverse'>"+$(this).find('closed').text()+"</span><span class='label label-info C'>"+$(this).find('total').text()+"</span></div>") 4327 .attr("data-tokens",$(this).find('group').text()) 4328 .text($(this).find('name').text())); 4329 4330 }); 4331 4332 $("#checklistMenuSearch").append(inpsectionOptGroup); 4333 4334 } 4335 $("#checklistMenuSearch").selectpicker('refresh'); 4336 4337 } 4338 4339 }); 4340 // } 4341 4342} 4343 4344 4345/* Features modal */ 4346function launchFeaturesModal() { 4347 4348 $.ajax({
4349 url: "/featureGet.do", 4350 type: "POST", 4351 headers: {"Ajax-User-Agent" : "websiteAjax"}, 4352 dataType: "xml", 4353 async: true, 4354 statusCode: 4355 { 4356 // call global function that alerts user and redirects to login page 4357 401: function(){ websiteAjaxNotLoggedIn(); }, 4358 // when updating action files 4359 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 4360 // when the server is stopped 4361 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 4362 }, 4363 error: function (request, status, error) { 4364 // error method gets called first before 401 4365 // alert(request.status); 4366 }, 4367 success: function (xml) { 4368 var html = "<div id='dynamicModal' class='modal modalTableStyle fade' data-bs-backdrop='static' data-bs-keyboard='false' tabindex='-1' aria-labelledby='featureLabel' aria-hidden='true'>"; 4369 html += "<div class='modal-dialog modal-dialog-scrollable'>"; 4370 html += "<div class='modal-content'>"; 4371 html += "<div class='modal-header'>"; 4372 // html += '<a class="close" data-dismiss="modal">×</a>'; 4373 html += "<h3 class='modal-title fs-5' id='featureLabel'><i class='fas fa-star'></i> What's new</h3>" 4374 html += "<button type='button' class='btn-close' data-bs-dismiss='modal' aria-hidden='true'></button>"; 4375 html += "</div>"; 4376 html += "<div class='modal-body'>"; 4377 html += "<ul class='whatsNewModal'>"; 4378 4379 $(xml).find("feature").each(function () { 4380 var id=$(this).find('id').text(); 4381 var title=$(this).find('title').text(); 4382 var desc=$(this).find('desc').text(); 4383 var category=$(this).find('category').text(); 4384 var createdDateTime=$(this).find('createdDateTime').text(); 4385 var updatedDateTime=$(this).find('updatedDateTime').text(); 4386 if (category=="1"){ 4387 html=html+"<li><span class='badge badge-success'>New feature</span>"; 4388 } 4389 else if (category=="2"){ 4390 html=html+"<li><span class='badge badge-info'>Improvement</span>"; 4391 } 4392 else if (category=="3"){ 4393 html=html+"<li><span class='badge badge-warning'>Fix</span>"; 4394 } 4395 html=html+"<span class='whatsNewTitle'>"+title+"</span><span class='whatsNewDesciption'>"+desc+"</span></li>"; 4396 4397 }); 4398 html += "</ul>"; 4399 html += "</div>"; // body 4400 html += "</div>"; // content 4401 html += "</div>"; // dialog 4402 html += "</div>"; // modal 4403 4404 // console.log(html); 4405 $('body').append(html); 4406 $("#dynamicModal").modal(); 4407 $("#dynamicModal").modal('show'); 4408 $('#dynamicModal').on('hidden.bs.modal', function (e) { 4409 $(this).remove(); 4410 4411 $('#modalWhatsNewId').modal('hide'); 4412 $('body').removeClass('modal-open'); 4413 $('.modal-backdrop').remove(); 4414 }); 4415 4416 } 4417 }); 4418 4419} 4420 4421function hideModal() 4422{ 4423 // Using a very general selector - this is because $('#modalDiv').hide 4424 // will remove the modal window but not the mask 4425 $('.modal.in').modal('hide'); 4426} 4427/* Generate Excel options modal */ 4428/* 4429 * Used when creating excel files in the site - both for ones that requires a 4430 * title input and also one that don't will display a message to user if over 4431 * slowMessageTime rows to tell the user it will takes soem time when large 4432 * amounts of rows 4433 */ 4434function launchExcelModal(total, showTitle,slowMessageTime) 4435{ 4436 var mydefer = jQuery.Deferred(); 4437 var html = "<div id='dynamicExcelModal' class='modal modalFormStyle fade' tabindex='-1' role='dialog' aria-labelledby='confirm-modal' aria-hidden='true'>"; 4438 html += "<div class='modal-dialog'>"; 4439 html += "<div class='modal-content'>"; 4440 html += "<div class='modal-header'>"; 4441 html += "<h3>Excel Download</h3>"; 4442 html += "<button type='button' id='myModalCommentCloseBtn' class='btn-close' data-bs-dismiss='modal' aria-label='Close'></button>"; 4443 html += "</div>"; 4444 if (total-slowMessageTime>0) 4445 { 4446 html += "<div class='modal-subHeading'><p><i class='fas fa-clock'></i> Generating Excel from a large selection of data can take time.</p>"; 4447 html += "</div>"; 4448 } 4449 // showTitle==1 then title textbox is needed 4450 if (showTitle==1) 4451 { 4452 html += "<div class='modal-body'>"; 4453 html += "<div class='form-horizontal'>"; 4454 html += "<div class='control-group title'>"; 4455 html += "<label class='help-block' for='excelTitle'>Enter a title for this Excel download <span title='Mandatory field'>*</span>"; 4456 html += "</label>"; 4457 html += "<input type='text' class='form-control maxWidth' id='excelTitleId' placeholder='Title' required>"; 4458 html += "</div>"; 4459 html += "</div>"; 4460 html += "</div>"; 4461 } 4462 html += "<div class='modal-footer'>"; 4463 html += "<button type='button' id='myModalCommentCancelBtn' class='btn btn-danger' data-bs-dismiss='modal' aria-hidden='true' title='Close'>Cancel</button>"; 4464 html += "<input type='submit' class='btn btn-success' id='myModalCommentSubmitBtn' value='Generate Excel'>"; 4465 html += "</div>"; 4466 html += "</div>"; // dialog 4467 html += "</div>"; // footer 4468 html += "</div>"; // modalWindow 4469 4470 4471 $("body").append(html); 4472 //vd changed 29/03/2024 - make sure the html has been appended 4473 $("body").promise().done(function() { 4474 // Once the HTML is rendered and ready, initialize and show the modal 4475 4476 try{ 4477 $("#dynamicExcelModal").modal(); 4478 $("#dynamicExcelModal").modal('show'); 4479 }catch(ex) 4480 {} 4481 4482 // set title box focused when popup is shown 4483 $("#dynamicExcelModal").on("shown.bs.modal", function (e) { 4484 if (showTitle==1) 4485 $("#excelTitleId").focus(); 4486 }); 4487 4488 $("#dynamicExcelModal").on("hidden.bs.modal", function (e) { 4489 $(this).remove(); 4490 4491 $("#generateExcelOptions").modal('hide'); 4492 $("body").removeClass('modal-open'); 4493 $(".modal-backdrop").remove(); 4494 4495 }); 4496 // if title textbox is needed 4497 if (showTitle==1) 4498 { 4499 $("#myModalCommentSubmitBtn").click(function(){ 4500 4501 if ($("#excelTitleId").val()=='') 4502 alert("Please input a title for this Excel download"); 4503 else 4504 { $("#dynamicExcelModal").modal('hide'); 4505 mydefer.resolve($('#excelTitleId').val()); 4506 4507 } 4508 4509 }); 4510 } 4511 else 4512 { 4513 $("#myModalCommentSubmitBtn").click(function(){ 4514 $("#dynamicExcelModal").modal('hide'); 4515 mydefer.resolve(); 4516 }); 4517 } 4518 4519 $("#myModalCommentCancelBtn").click(function(){ 4520 mydefer.reject(); 4521 }); 4522 $("#myModalCommentCloseBtn").click(function(){ 4523 4524 mydefer.reject(); 4525 }); 4526 });
4527 4528 return mydefer.promise(); 4529 4530} 4531// show global spinner 4532function showGlobalSpinner(text) 4533{ 4534 // don't add it twice 4535 if ($("#globalSpinner").length==0) 4536 { 4537 var spinnerHtml="<div id='globalSpinner' class='spinner'>"; 4538 spinnerHtml=spinnerHtml+"<div class='sysnetLoader'></div><br /><br /><p id='p_spinner'>"; 4539 // if text is not empty 4540 if (typeof text != "undefined" && text!="") 4541 // prevent injection 4542 spinnerHtml=spinnerHtml+$($.parseHTML(text)).text(); 4543 // default text 4544 else 4545 spinnerHtml=spinnerHtml+"Please wait....."; 4546 spinnerHtml=spinnerHtml+"</p></div>"; 4547 $("body").append(spinnerHtml); 4548 } 4549 4550} 4551// hide global spinner 4552function hideGlobalSpinner() 4553{ 4554 $("#globalSpinner").remove(); 4555} 4556 4557 4558// launch global confirm show modal 4559function globalConfirm(headingMessage, userMessage,obj){ 4560 4561 var html = "<div id='dynamicGlobalConfirmModalId' class='modal confirmAlert modalTableStyle fade' tabindex='-1' role='dialog' aria-labelledby='confirm-modal' aria-hidden='true'>"; 4562 html += "<div class='modal-dialog'>"; 4563 html += "<div class='modal-content'>"; 4564 html += "<div class='modal-header'>"; 4565 html += "<h3 id='confirmHeadingId' class='confirmHeading'></h3>" 4566 html += "</div>"; 4567 html += "<div class='modal-body'>"; 4568 html += "<div class='modal-subHeading'>"; 4569 html += "<p id='confirmMessageId' class='confirmMessage'></p>"; 4570 html += "</p></div>"; 4571 html += "</div>"; 4572 html += "<div class='modal-footer'>"; 4573 html += "<button type='button' class='btn btn-danger' id='dynamicGlobalConfirmCancelBtn' data-bs-dismiss='modal' aria-hidden='true' title='Close'>Cancel</button>"; 4574 html += "<input type='submit' id='dynamicGlobalConfirmSubmitBtnId' class='btn btn-success' value='Ok'>"; 4575 html += "</div>"; 4576 html += "</div>"; // dialog 4577 html += "</div>"; // footer 4578 html += "</div>"; // modalWindow 4579 4580 $('body').append(html); 4581 4582 // Append confirm messages 4583 $('#confirmHeadingId').append(headingMessage); 4584 $('#confirmMessageId').append(userMessage); 4585 4586 try{ 4587 // Launch Modal 4588 $("#dynamicGlobalConfirmModalId").modal(); 4589 $("#dynamicGlobalConfirmModalId").modal('show'); 4590 }catch(ex) 4591 {} 4592 4593 $("#dynamicGlobalConfirmModalId").on("hidden.bs.modal", function (e) { 4594 $(this).remove(); 4595 }); 4596 4597 $("#dynamicGlobalConfirmSubmitBtnId").click(function(){ 4598 4599 $("#dynamicGlobalConfirmModalId").modal('hide'); 4600 // if it's a href 4601 if ($(obj).is("a")) 4602 location.href=$(obj).attr("href"); 4603 // if it's a input submit or button 4604 else if($(obj).is("input")) 4605 { // $(alink).parents("form").submit(); 4606 $(obj).parents("form").submit(); 4607 } 4608 // if it's a call back function 4609 else{ 4610 obj(); 4611 } 4612 4613 }); 4614 4615 $("#dynamicGlobalConfirmCancelBtnId").click(function(){ 4616 4617 $("#dynamicGlobalConfirmModalId").modal('hide'); 4618 4619 }); 4620 // need to return false to stop it go to the action without clicking buttons 4621 return false; 4622 4623} 4624// gallery 4625function showGlobalPhotoGridModal(type,photoStart,reload) { 4626 // if (photoStart==0) 4627 // $("#allPhotoModalBody").empty(); 4628 4629 // if reload is set to 1, clear/empty everything first 4630 if (reload==1) 4631 { 4632 $("#allPhotoModalBody").empty(); 4633 } 4634 window.scrollTo(0, 0); 4635 var url; 4636 var fileType; 4637 var docType; 4638 var mydata= []; 4639 4640 if (type=="snag") 4641 { url="/getSnagsAllPhotos.do"; 4642 fileType="2"; 4643 docType="1"; 4644 } 4645 else if (type=="ncr") 4646 { 4647 url="/getNcrsAllPhotos.action"; 4648 fileType="2"; 4649 docType="2"; 4650 4651 } 4652 else if (type=="checklist") 4653 { 4654 url="/getInspectionDataAllPhotos.do"; 4655 fileType="2"; 4656 docType="11"; 4657 4658 } 4659 else if (type=="hubEform") 4660 { 4661 url="/getHubCustomFormDataFormAllPhotos.do"; 4662 4663 mydata=$("#eformRegistryForm").serializeArray(); 4664 fileType="2"; 4665 docType="17"; 4666 4667 } 4668 else if (type=="defect") 4669 { 4670 url="/getDefectsAllPhotos.do"; 4671 fileType="2"; 4672 docType="7"; 4673 4674 } 4675 else if (type=="checklistAnswer") 4676 { 4677 var inspectionDataId=$("#inspectionDataId").val(); 4678 var inspectionId=$("#inspectionId").val(); 4679 url="/getInspectionDataAnswerAllPhotos.do?inspectionDataId="+inspectionDataId+"&inspectionId="+inspectionId; 4680 fileType="2"; 4681 docType="11"; 4682 4683 } 4684 else if (type=="hubEformField") 4685 { 4686 url="/getHubCustomFormDataFormFieldAllPhotos.do"; 4687 fileType="2"; 4688 docType="18"; 4689 4690 } 4691 4692 var includePinpoint; 4693 if($("input[name=includePinpoint]:eq(0)").is(":checked")==true) 4694 includePinpoint="1"; 4695 else
4696 includePinpoint="0"; 4697 4698 mydata.push({ name: "photoStart", value: photoStart }); 4699 mydata.push({ name: "includePinpoint", value: includePinpoint }); 4700 4701 if (($("#allPhotoModalBody").children().length == 0 && photoStart == 0) || photoStart > 0 || reload==1) { 4702 4703 // remove view more button, as it will be recreated and added to the 4704 // bottom of photos 4705 4706 if (photoStart > 0) { 4707 $(".loadMoreBtnContainer").remove(); 4708 } 4709 $.ajax({ 4710 type: "get", 4711 url: url, 4712 headers: { 4713 "Sysnet-User-Agent": "websiteAjax" 4714 }, 4715 cache: false, 4716 async: true, 4717 data: mydata, 4718 statusCode: { 4719 4720 // call global function that alerts user and redirects to login 4721 // page 4722 401: function() { 4723 websiteAjaxNotLoggedIn(); 4724 }, 4725 // when updating action files 4726 404: function() { 4727 websiteAjaxServerDownOrUpdatingCode(); 4728 }, 4729 // when the server is stopped 4730 503: function() { 4731 websiteAjaxServerDownOrUpdatingCode(); 4732 } 4733 }, 4734 error: function(data) { 4735 4736 }, 4737 success: function(xml) { 4738 // if no photos returned 4739 if ($(xml).find("photo").length == 0) { 4740 $("<div/>").attr("class", "modal-subHeading").html("<p>Your results list contains no photos to view</p>").appendTo("#allPhotoModalBody"); 4741 } 4742 else { 4743 // in case of view more button, need to get the last date, 4744 // and last grid container 4745 var previousDate = $(".dateBreak").last().text(); 4746 var containerDiv = $(".grid-container").last(); 4747 4748 $(xml).find("photo").each(function() { 4749 var photoFileId = $(this).find("photoId").text(); 4750 var id = $(this).find("id").text(); 4751 var date = $(this).find("date").text(); 4752 var description=$(this).find("description").text(); 4753 var photoLevel=$(this).find("photoLevel").text(); 4754 var itemId=$(this).find("itemId").text(); 4755 if (previousDate != date) { 4756 $("<div/>").attr("class", "dateBreak").html(date).appendTo("#allPhotoModalBody"); 4757 containerDiv = $("<div/>").attr("class", "grid-container").appendTo("#allPhotoModalBody"); 4758 } 4759 4760 if (type=="checklist") 4761 { 4762 if (photoLevel=="1") 4763 docType="11"; 4764 else 4765 { docType="12"; 4766 id=itemId; 4767 } 4768 } 4769 else if (type=="hubEform") 4770 { 4771 if (photoLevel=="1") 4772 docType="17"; 4773 else 4774 { docType="18"; 4775 id=itemId; 4776 } 4777 } 4778 else if (type=="checklistAnswer") 4779 { 4780 docType="12"; 4781 id=itemId; 4782 4783 } 4784 else if (type=="hubEformField") 4785 { 4786 docType="18"; 4787 id=itemId; 4788 4789 } 4790 var alink=$("<a/>", { 4791 rel:"prettyPhoto[pp_fullgal_"+date+"]", 4792 title: description, 4793 href: "/getFilesAll.do?fileType="+fileType+"&docType="+docType+"&id=" + id + "&fileId=" + photoFileId 4794 }).html($("<img/>").attr('src', "/getFilesAll.do?fileType="+fileType+"&docType="+docType+"&id=" + id + "&fileId=" + photoFileId)); 4795 4796 alink.appendTo(containerDiv); 4797 4798 previousDate = date; 4799 }); 4800 4801 // activiate pretty photo 4802 $("a[rel^='prettyPhoto']").prettyPhoto({ 4803 markup: '<div class="pp_pic_holder"> \ 4804 <div class="ppt"> </div> \ 4805 <div class="pp_top"> \ 4806 <div class="pp_left"></div> \ 4807 <div class="pp_middle"></div> \ 4808 <div class="pp_right"></div> \ 4809 </div> \ 4810 <div class="pp_content_container"> \ 4811 <div class="pp_left"> \ 4812 <div class="pp_right"> \ 4813 <div class="pp_content"> \ 4814 <div class="pp_loaderIcon"></div> \ 4815 <div class="pp_fade"> \ 4816 <div class="pp_hoverContainer"> \ 4817 <a class="pp_next" href="#">next</a> \ 4818 <a class="pp_previous" href="#">previous</a> \ 4819 <a class="pp_download" id="downloadLink" href="{path}" download>Download</a>\ 4820 </div> \ 4821 <div id="pp_full_res"></div> \ 4822 <div class="pp_details"> \ 4823 <div class="pp_nav"> \ 4824 <a href="#" class="pp_arrow_previous">Previous</a> \ 4825 <p class="currentTextHolder">0/0</p> \ 4826 <a href="#" class="pp_arrow_next">Next</a> \ 4827 </div> \ 4828 <p class="pp_description"></p> \ 4829 {pp_social} \ 4830 <a class="pp_close" href="#">Close</a> \ 4831 </div> \ 4832 </div> \ 4833 </div> \ 4834 </div> \ 4835 </div> \ 4836 </div> \ 4837 <div class="pp_bottom"> \ 4838 <div class="pp_left"></div> \ 4839 <div class="pp_middle"></div> \ 4840 <div class="pp_right"></div> \ 4841 </div> \ 4842 </div> \ 4843 <div class="pp_overlay"></div>', 4844 social_tools:false 4845 4846 4847 });
4848 // if there are more photos, then show the view more button 4849 var hasMorePhotos = $(xml).find("hasMorePhotos").text(); 4850 4851 if (hasMorePhotos == "1") { 4852 4853 $("<div/>").attr("class", "loadMoreBtnContainer").html("<input type=\"button\" class=\"btn btn-info viewMore\" value=\"View more\" />").appendTo("#allPhotoModalBody"); 4854 $(".loadMoreBtnContainer").on('click', function(e) { 4855 showGlobalPhotoGridModal(type,photoStart + 100); 4856 }); 4857 } 4858 } 4859 4860 } 4861 }); 4862 } 4863} 4864 4865function ajaxSnagCommentsExcel() 4866{ 4867 4868 // disable excel button 4869 $("#btnSnagCommentDownload").addClass("disabled"); 4870 // show spinner 4871 showGlobalSpinner(); 4872 4873 $.ajax({ 4874 type: "get", 4875 url: "/downloadSnagComments.do", 4876 headers: {"Ajax-User-Agent" : "websiteAjax"}, 4877 statusCode:{ 4878 4879 // call global function that alerts user and redirects to login 4880 // page 4881 401: function(){ websiteAjaxNotLoggedIn(); }, 4882 // when updating action files 4883 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 4884 // when the server is stopped 4885 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 4886 }, 4887 error: function (data) { 4888 4889 // console.log('An error occurred.'); 4890 // console.log(data); 4891 hideGlobalSpinner(); 4892 $("#btnSnagCommentDownload").removeClass("disabled"); 4893 }, 4894 success: function (xml) { 4895 // hide spinner 4896 hideGlobalSpinner(); 4897 var url=$(xml).find("excelTempFolderFilename").text(); 4898 if(url!='') 4899 location.href=url; 4900 else 4901 alert("Unable to create the excel"); 4902 // enable excel button 4903 $("#btnSnagCommentDownload").removeClass("disabled"); 4904 4905 } 4906 }); 4907} 4908 4909// launch global confirm show modal 4910function globalAlert(headingMessage, userMessage,callBack){ 4911 4912 var html = "<div id='dynamicGlobalConfirmModalId' class='modal confirmAlert modalTableStyle fade' tabindex='-1' role='dialog' aria-labelledby='confirm-modal' aria-hidden='true'>"; 4913 html += "<div class='modal-dialog'>"; 4914 html += "<div class='modal-content'>"; 4915 html += "<div class='modal-header'>"; 4916 html += "<h3 id='confirmHeadingId' class='confirmHeading'></h3>" 4917 html += "</div>"; 4918 html += "<div class='modal-body'>"; 4919 html += "<div class='modal-subHeading'>"; 4920 html += "<p id='confirmMessageId' class='confirmMessage'></p>"; 4921 html += "</p></div>"; 4922 html += "</div>"; 4923 html += "<div class='modal-footer'>"; 4924 html += "<input type='submit' id='dynamicGlobalConfirmSubmitBtnId' class='btn btn-success' value='Ok'>"; 4925 html += "</div>"; 4926 html += "</div>"; // dialog 4927 html += "</div>"; // footer 4928 html += "</div>"; // modalWindow 4929 4930 $('body').append(html); 4931 4932 // Append confirm messages 4933 $('#confirmHeadingId').append(headingMessage); 4934 $('#confirmMessageId').append(userMessage); 4935 4936 try{ 4937 // Launch Modal 4938 $("#dynamicGlobalConfirmModalId").modal(); 4939 $("#dynamicGlobalConfirmModalId").modal('show'); 4940 }catch(ex){} 4941 4942 $("#dynamicGlobalConfirmModalId").on("hidden.bs.modal", function (e) { 4943 $(this).remove(); 4944 }); 4945 4946 $("#dynamicGlobalConfirmSubmitBtnId").click(function(){ 4947 4948 $("#dynamicGlobalConfirmModalId").modal('hide'); 4949 if (typeof callBack === 'function') 4950 callBack(); 4951 4952 }); 4953 4954 4955 // need to return false to stop it go to the action without clicking buttons 4956 return false; 4957 4958} 4959 4960 4961function globalCheckUploads() 4962{ 4963 4964 var fileInput=$("#files"); 4965 4966 var numberOfFiles=$("#files")[0].files.length; 4967 4968 if (numberOfFiles==0) 4969 { 4970 globalAlert("Upload", "You need to choose at least one file/photo."); 4971 return false; 4972 } 4973 for (var i=0;i<numberOfFiles;i++) 4974 { 4975 var file=$("#files")[0].files[i]; 4976 if (file.name.lastIndexOf(".")<0) 4977 { globalAlert("Upload",file.name+" doesn't have file extension"); 4978 return false; 4979 } 4980 else if (file.size==0) 4981 { 4982 globalAlert("Upload",file.name+" is empty."); 4983 return false; 4984 } 4985 4986 4987 } 4988 if ($("#superseedsExisting").prop("checked")==true) 4989 { 4990 4991 // if superseed exsiting box is ticked, make sure user can only upload 4992 // single file/photo 4993 if (numberOfFiles>1) 4994 { globalAlert("Upload","Please upload one single file only for superseed."); 4995 return false; 4996 } 4997 var file=$("#files")[0].files[0]; 4998 var extension=file.name.substr((file.name.lastIndexOf('.') +1)).toLowerCase(); 4999 5000 // check if any existing file is selected 5001 if ((extension!="jpg" && extension!="jpeg") && $("input[name='fileUploadMultipleActionBean.fileSuperseed']:checked").length==0) 5002 { 5003 globalAlert("Upload","Please choose an existing file (just one) to supersede."); 5004 return false; 5005 } 5006 // check if any existing photo is selected 5007 if ((extension=="jpg" || extension=="jpeg") && $("input[name='fileUploadMultipleActionBean.photoSuperseed']:checked").length==0) 5008 { 5009 globalAlert("Upload","Please choose an existing photo (just one) to supersede."); 5010 return false; 5011 } 5012 5013 } 5014 5015 showGlobalSpinner(); 5016 5017} 5018 5019function createBrowserLogs(errorMsg, url, lineNumber,col,err,currentUrl) 5020{ 5021 // skip plugin errors 5022 if (lineNumber=="0" || lineNumber=="1") 5023 return; 5024 else if (url!=null && url.indexOf("extension")>-1) 5025 return; 5026 else if (url!=null && url.indexOf("prettyPhoto")>-1) 5027 return; 5028 else if (url!=null && url.indexOf("bootstrap-select")>-1) 5029 return; 5030 else if (url!=null && url.indexOf("bootstrap.bundle")>-1) 5031 return; 5032 else if (url!=null && url.indexOf("jquery")>-1) 5033 return; 5034 else if (errorMsg !=null && errorMsg.indexOf("options")>-1) 5035 return; 5036 5037 $.ajax({ 5038 type: "get", 5039 url: "/createBrowserLogs.do", 5040 headers: {"Ajax-User-Agent" : "websiteAjax"}, 5041 async:true, 5042 statusCode:{ 5043 5044 // call global function that alerts user and redirects to login 5045 // page 5046 401: function(){ websiteAjaxNotLoggedIn(); }, 5047 // when updating action files 5048 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 5049 // when the server is stopped 5050 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 5051 }, 5052 data:{"errorMsg":errorMsg,"url":url,"lineNumber":lineNumber,"colNumber":col,"fullError":err,"currentUrl":currentUrl}, 5053 error: function (data) { 5054 5055 5056 5057 }, 5058 success: function (xml) { 5059 5060 5061 } 5062 }); 5063} 5064 5065
5066function ajaxSnagByLocsSubbiesExcel() 5067{ 5068 5069 // disable excel button 5070 $("#btnSnagByLocsSubbiesDownload").addClass("disabled"); 5071 // show spinner 5072 showGlobalSpinner(); 5073 5074 $.ajax({ 5075 type: "get", 5076 url: "/viewSnagsTrackerExcelBySubcontractorLocations.action", 5077 headers: {"Ajax-User-Agent" : "websiteAjax"}, 5078 statusCode:{ 5079 5080 // call global function that alerts user and redirects to login 5081 // page 5082 401: function(){ websiteAjaxNotLoggedIn(); }, 5083 // when updating action files 5084 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 5085 // when the server is stopped 5086 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 5087 }, 5088 error: function (data) { 5089 5090 // console.log('An error occurred.'); 5091 // console.log(data); 5092 hideGlobalSpinner(); 5093 $("#btnSnagByLocsSubbiesDownload").removeClass("disabled"); 5094 }, 5095 success: function (xml) { 5096 // hide spinner 5097 hideGlobalSpinner(); 5098 var url=$(xml).find("excelTempFolderFilename").text(); 5099 if(url!='') 5100 location.href=url; 5101 else 5102 alert("Unable to create the excel"); 5103 // enable excel button 5104 $("#btnSnagByLocsSubbiesDownload").removeClass("disabled"); 5105 5106 } 5107 }); 5108} 5109 5110 5111$(document).ready(function() 5112{ 5113 /* Script to allow Hoz scrolling for use on tables with a large number of columns that req Hoz page scrolling */ 5114 $("#table-scroll").scroll(function(){ 5115 var scroll = this.scrollLeft; 5116 5117 if ( $(this).hasClass('current') ) { 5118 $(this).removeClass('current'); 5119 } else { 5120 $('li a.current').removeClass('current'); 5121 $(this).addClass('current'); 5122 } 5123 5124 if (scroll > 1){ 5125 // console.log("scroll"); 5126 $(".scroll-overlay").css({"border-right": "1px solid var(--mediumBluishGrey)"}); 5127 $(".scroll-overlay").addClass('box'); 5128 } else { 5129 $(".scroll-overlay").css({"border-right": "0px none"}); 5130 $(".scroll-overlay").removeClass('box'); 5131 } 5132 }); 5133}) 5134 5135function ajaxSnagRejectionExcel() 5136{ 5137 5138 // disable excel button 5139 $("#btnSnagRejectionDownload").addClass("disabled"); 5140 // show spinner 5141 showGlobalSpinner(); 5142 5143 $.ajax({ 5144 type: "get", 5145 url: "/downloadSnagRejectionsWithComments.do", 5146 headers: {"Ajax-User-Agent" : "websiteAjax"}, 5147 statusCode:{ 5148 5149 // call global function that alerts user and redirects to login 5150 // page 5151 401: function(){ websiteAjaxNotLoggedIn(); }, 5152 // when updating action files 5153 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 5154 // when the server is stopped 5155 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 5156 }, 5157 error: function (data) { 5158 5159 // console.log('An error occurred.'); 5160 // console.log(data); 5161 hideGlobalSpinner(); 5162 $("#btnSnagRejectionDownload").removeClass("disabled"); 5163 }, 5164 success: function (xml) { 5165 // hide spinner 5166 hideGlobalSpinner(); 5167 var url=$(xml).find("excelTempFolderFilename").text(); 5168 if(url!='') 5169 location.href=url; 5170 else 5171 alert("Unable to create the excel"); 5172 // enable excel button 5173 $("#btnSnagRejectionDownload").removeClass("disabled"); 5174 5175 } 5176 }); 5177} 5178 5179function ajaxSnagWithUnmappedLocationsExcel() 5180{ 5181 5182 // disable excel button 5183 $("#btnSnagWithUnmappedLocationsDownload").addClass("disabled"); 5184 // show spinner 5185 showGlobalSpinner(); 5186 5187 $.ajax({ 5188 type: "get", 5189 url: "/createSnagsWithUnmappedLocationsExport.do", 5190 headers: {"Ajax-User-Agent" : "websiteAjax"}, 5191 statusCode:{ 5192 5193 // call global function that alerts user and redirects to login 5194 // page 5195 401: function(){ websiteAjaxNotLoggedIn(); }, 5196 // when updating action files 5197 404: function(){ websiteAjaxServerDownOrUpdatingCode(); }, 5198 // when the server is stopped 5199 503: function(){ websiteAjaxServerDownOrUpdatingCode(); } 5200 }, 5201 error: function (data) { 5202 5203 // console.log('An error occurred.'); 5204 // console.log(data); 5205 hideGlobalSpinner(); 5206 $("#btnSnagWithUnmappedLocationsDownload").removeClass("disabled"); 5207 }, 5208 success: function (xml) { 5209 // hide spinner 5210 hideGlobalSpinner(); 5211 var url=$(xml).find("excelTempFolderFilename").text(); 5212 if(url!='') 5213 location.href=url; 5214 else 5215 alert("Unable to create the excel"); 5216 // enable excel button 5217 $("#btnSnagWithUnmappedLocationsDownload").removeClass("disabled"); 5218 5219 } 5220 }); 5221} 5222/* End of file */
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.