1//navigation.js 2var False = false; 3var True = true; 4var isIE = false; 5if (navigator.userAgent.match(/msie/i) || navigator.userAgent.match(/trident/i)) { 6 isIE = true; 7} 8// set to true when you want to refresh the whole page // 9var refresh = false; 10var findAPITries = 0; 11if (typeof (isMobile) === 'undefined') { 12 var isMobile = { 13 Android: function () { 14 return navigator.userAgent.match(/Android/i); 15 }, 16 BlackBerry: function () { 17 return navigator.userAgent.match(/BlackBerry/i); 18 }, 19 iOS: function () { 20 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 21 }, 22 Opera: function () { 23 return navigator.userAgent.match(/Opera Mini/i); 24 }, 25 Windows: function () { 26 return navigator.userAgent.match(/IEMobile/i); 27 }, 28 any: function () { 29 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 30 } 31 }; 32} 33 34function menuControl(item, image, source) { 35 //alert("test"); 36 //alert(image +" "+ source); 37 38 if (item.style.display != 'block') { 39 item.style.display = 'block'; 40 image.src = source + "/minus.gif"; 41 } else { 42 item.style.display = 'none'; 43 image.src = source + "/plus.gif"; 44 } 45} 46 47var calendarEvidence = false; 48var initActivity = function (course) { 49 var submitBtn = 'login_' + course; 50 var uploadedFile = 'file_' + course; 51 52 var hasDate = ($('#CalendarEvidence').length > 0); 53 if (hasDate) { 54 setInterval(function () { 55 if ($('#CalendarEvidence').val() !== '') { 56 calendarEvidence = true; 57 // Have to comment out, it was disabling the submit button even when there is minimum number of file submitted and while selecting the date it was disabling the button. 58 // ticket 64333 59 //if ($('#file_' + course).length > 0) { 60 // if ($('#file_' + course).val() !== '' && $(this).val() !== '' ) { 61 // $('#login_' + course).removeProp('disabled'); 62 // } else { 63 // $('#login_' + course).prop('disabled', 'true'); 64 // } 65 //} else { 66 // $('#login_' + course).removeProp('disabled'); 67 //} 68 } else { 69 calendarEvidence = false; 70 //this for attestation evidence file upload - line 88 in learnerview.js 71 var isDisabled; 72 if ($('button.submit-doc') != undefined) { 73 isDisabled = $('button.submit-doc').prop('disabled'); 74 if (isDisabled) 75 $('#login_' + course).prop('disabled', 'true'); 76 } 77 else 78 $('#login_' + course).prop('disabled', 'true'); 79 } 80 }, 1000); 81 } 82 $('#TextEvidence_' + course).on('keyup', function () { 83 if ($('#file_' + course).length > 0) { 84 if ($('#file_' + course).val() !== '' && $(this).val() !== '') { 85 $('#login_' + course).removeProp('disabled'); 86 $('#login_' + course).removeAttr('disabled'); 87 } else { 88 $('#login_' + course).prop('disabled', 'true'); 89 } 90 } else { 91 if ($(this).val() !== '') { 92 $('#login_' + course).removeProp('disabled'); 93 $('#login_' + course).removeAttr('disabled'); 94 } else { 95 $('#login_' + course).prop('disabled', 'true'); 96 } 97 } 98 }); 99 $('#login_' + course).prop('disabled', true); 100 //if (hasDate) { 101 // $('#CalendarEvidence').change(function () { 102 // if ($('#file_' + course).length >0){ 103 // if ($('#file_' + course).val() !== '' && $(this).val() !=='') { 104 // $('#login_' + course).removeProp('disabled'); 105 // } 106 // } else { 107 // if ($(this).val() !== '') { 108 // $('#login_' + course).removeProp('disabled'); 109 // } 110 // } 111 // });
112 //} 113 114 $('#file_' + course).change(function () { 115 if ($('#TextEvidence_' + course).length > 0) { 116 if ($('#TextEvidence_' + course).val() !== '' && $(this).val() !== '') { 117 $('#login_' + course).removeProp('disabled'); 118 $('#login_' + course).removeAttr('disabled'); 119 } else { 120 $('#login_' + course).prop('disabled', 'true'); 121 } 122 } else { 123 if (!hasDate) { 124 if ($(this).val() !== '') { 125 $('#login_' + course).removeProp('disabled'); 126 $('#login_' + course).removeAttr('disabled'); 127 } else { 128 $('#login_' + course).prop('disabled', 'true'); 129 } 130 } else { 131 if ($(this).val() !== '' && calendarEvidence === true) { 132 $('#login_' + course).removeProp('disabled'); 133 $('#login_' + course).removeAttr('disabled'); 134 } else { 135 $('#login_' + course).prop('disabled', 'true'); 136 } 137 } 138 } 139 140 141 }); 142}; 143 144var initSec; 145var showing; 146 147// Passess // 148/* commented out until somebody figures out what it should actually do 149$(document).ready(function () { 150 if (programid && $('.PurchaseCoursePasses').length === 0) { 151 152 $.ajax(baseUrl + "TilesHandlers/BuyPass.ashx", { 153 async: true, 154 error: function (e) { 155 console.log(e); 156 console.log('failed'); 157 }, 158 data: { 'type': 'tile', 'programID': programid } 159 }).done(function (data) { 160 if (data.buyPass_Tile) { 161 console.log(data.buyPass_Tile.BuyPassTitle); 162 var button = $('<button type="button" class="btn btn-primary btn-lg pass" style="margin-top:5px"><i class="fa fa-ticket"> ' + data.buyPass_Tile.BuyPassTitle + '</i></button>'); 163 button.on('click', function () { 164 window.location.href = baseUrl + 'Student/eCommerce/purchasecoursepasses.aspx'; 165 }) 166 $('.logo_login_bar').before(button); 167 } 168 }); 169 } 170 171}); 172*/ 173 174function showSec(section, position) { 175 //alert("section=" + section + " position=" + position + " currsection=" + currSection); 176 //alert(position); 177 scoPreReq = completionList[position - 2]; 178 //alert(scoPreReq); 179 if (scoPreReq != '0') { 180 if (sec_1.style.display == 'block') { 181 initSec = sec_1; 182 } 183 if (section.style.display != 'block') { 184 if (initSec == sec_1) { 185 186 if (eval('img_' + currSection) != "undefined") { 187 img = eval('img_' + currSection); 188 img.src = "images/uploaded/mb/geds_topic_unselected.gif"; 189 } 190 td = eval('td_' + currSection); 191 td.className = "topicmenu"; 192 initSec.style.display = 'none'; 193 section.style.display = 'block'; 194 currSection = position; 195 196 if (eval('img_' + currSection) != "undefined") { 197 img = eval('img_' + currSection); 198 img.src = "images/uploaded/mb/geds_topic_selected.gif"; 199 } 200 td = eval('td_' + currSection); 201 td.className = "topicmenusel"; 202 initSec = section; 203 if (actionList[position - 1] == 0 || actionList[position - 1] == 1) { 204 completionList[position - 1] = 1; 205 } 206 } else { 207 initSec.style.display = 'none'; 208 section.style.display = 'block'; 209 initSec = section; 210 if (eval('img_' + currSection) != "undefined") { 211 img = eval('img_' + currSection); 212 img.src = "images/uploaded/mb/geds_topic_unselected.gif"; 213 } 214 td = eval('td_' + currSection); 215 td.className = "topicmenu"; 216 currSection = position; 217 img = eval('img_' + currSection); 218 if (eval('img_' + currSection) != "undefined") { 219 img = eval('img_' + currSection); 220 img.src = "images/uploaded/mb/geds_topic_selected.gif"; 221 } 222 td = eval('td_' + currSection); 223 td.className = "topicmenusel"; 224 if (actionList[position - 1] == 0 || actionList[position - 1] == 1) { 225 completionList[position - 1] = 1; 226 } 227 } 228 } 229 } else { 230 alert("you have not yet completed the pre-requisite for this section"); 231 } 232 if (currSection > 1) { 233 showPrevious(); 234 } else { 235 hidePrevious(); 236 } 237 if (currSection < preReqList.length) { 238 showNext(); 239 } else { 240 hideNext(); 241 } 242} 243 244function showBarSec(section, position) { 245 //alert("section=" + section + " position=" + position + " currsection=" + currSection); 246 //alert(position); 247 scoPreReq = completionList[position - 2]; 248 //alert(scoPreReq); 249 if (scoPreReq != '0') { 250 if (sec_1.style.display == 'block') { 251 initSec = sec_1; 252 } 253 if (section.style.display != 'block') { 254 if (initSec == sec_1) { 255 256 257 td = eval('td_' + currSection); 258 td.className = "bartopicmenu"; 259 initSec.style.display = 'none'; 260 section.style.display = 'block'; 261 currSection = position; 262 263 264 td = eval('td_' + currSection); 265 td.className = "bartopicmenusel"; 266 initSec = section; 267 if (actionList[position - 1] == 0 || actionList[position - 1] == 1) { 268 completionList[position - 1] = 1; 269 } 270 } else { 271 initSec.style.display = 'none'; 272 section.style.display = 'block'; 273 initSec = section; 274 275 td = eval('td_' + currSection); 276 td.className = "bartopicmenu"; 277 currSection = position; 278 279 td = eval('td_' + currSection); 280 td.className = "bartopicmenusel"; 281 if (actionList[position - 1] == 0 || actionList[position - 1] == 1) { 282 completionList[position - 1] = 1; 283 } 284 } 285 } 286 } else { 287 alert("you have not yet completed the pre-requisite for this section"); 288 } 289 if (currSection > 1) { 290 showPrevious(); 291 } else { 292 hidePrevious(); 293 } 294 if (currSection < preReqList.length) { 295 showNext(); 296 } else { 297 hideNext(); 298 } 299} 300 301function enableNextSection() { 302 var tab = eval("tab_" + (currSection + 1)); 303 tab.style.color = "green"; 304 if (currSection < preReqList.length) { next.style.color = 'green'; } 305 306} 307 308function hideShowMenu() { 309 if (nav.style.display == 'block') { 310 nav.style.display = 'none';
311 // menuHideShow.innerHTML = 'SHOW MENU   '; 312 } else { 313 nav.style.display = 'block'; 314 // menuHideShow.innerHTML = ' HIDE MENU  '; 315 } 316} 317 318function nextSection() { 319 //alert(preReqList); 320 if (preReqList.length > 1) { 321 322 if (sec_1.style.display == 'block') { 323 initSec = sec_1; 324 } 325 scoPreReq = completionList[currSection - 1]; 326 if (scoPreReq != 0) { 327 if (currSection < preReqList.length) { 328 hide = eval('sec_' + currSection); 329 hide.style.display = 'none'; 330 img = eval('img_' + currSection); 331 img.src = "images/uploaded/mb/geds_topic_unselected.gif"; 332 td = eval('td_' + currSection); 333 td.className = "topicmenu"; 334 tempSection = currSection + 1; 335 tempSection = eval('sec_' + tempSection); 336 tempSection.style.display = 'block'; 337 initSec = tempSection; 338 var Obj = document.getElementById("previous"); 339 if (Obj != null) { 340 previous.style.display = 'block'; 341 previousButton.style.display = 'block'; 342 previous.style.cursor = 'hand'; 343 } 344 currSection = currSection + 1; 345 img = eval('img_' + currSection); 346 img.src = "images/uploaded/mb/geds_topic_selected.gif"; 347 td = eval('td_' + currSection); 348 td.className = "topicmenusel"; 349 if (document.next) { 350 if (currSection == preReqList.length) { 351 next.style.color = 'black'; 352 next.style.cursor = 'auto'; 353 } 354 } 355 if (actionList[currSection - 1] == 0 || actionList[currSection - 1] == 1) { 356 completionList[currSection - 1] = 1; 357 } 358 } 359 } else { 360 alert("you have not yet completed the pre-requisite for this section"); 361 } 362 363 } 364 if (document.previous) { 365 if (currSection > 1) { 366 showPrevious(); 367 } else { 368 hidePrevious(); 369 } 370 if (currSection < preReqList.length) { 371 showNext(); 372 } else { 373 hideNext(); 374 } 375 } 376} 377 378function previousSection() { 379 if (currSection > 1) { 380 //alert("previous section"); 381 hide = eval('sec_' + currSection); 382 hide.style.display = 'none'; 383 384 tempSection = currSection - 1; 385 tempSection = eval('sec_' + tempSection); 386 tempSection.style.display = 'block'; 387 388 img = eval('img_' + currSection); 389 img.src = "images/uploaded/mb/geds_topic_unselected.gif"; 390 391 td = eval('td_' + currSection); 392 td.className = "topicmenu"; 393 394 initSec = tempSection; 395 currSection = currSection - 1; 396 397 td = eval('td_' + currSection); 398 td.className = "topicmenusel"; 399 400 img = eval('img_' + currSection); 401 img.src = "images/uploaded/mb/geds_topic_selected.gif"; 402 var Obj = document.getElementById("previous"); 403 if (currSection == 1) { 404 if (Obj != null) { 405 previous.style.display = "none"; 406 previousButton.style.display = "none"; 407 //previous.style.cursor='auto'; 408 } 409 } 410 if (currSection < preReqList.length) { 411 //next.style.color='green'; 412 next.style.cursor = 'hand'; 413 } 414 } 415 if (currSection > 1) { 416 showPrevious(); 417 } else { 418 hidePrevious(); 419 } 420 if (currSection < preReqList.length) { 421 showNext(); 422 } else { 423 hideNext(); 424 } 425} 426 427function showPrevious() { 428 var Obj = document.getElementById("previous"); 429 430 if (Obj != null) { 431 previous.style.display = 'block'; 432 previousButton.style.display = 'block'; 433 } 434 stopMedia(); 435} 436 437function hidePrevious() { 438 var Obj = document.getElementById("previous"); 439 440 if (Obj != null) { 441 previous.style.display = 'none'; 442 previousButton.style.display = 'none'; 443 } 444 stopMedia();
445} 446 447function showNext() { 448 if (document.next) { 449 next.style.display = 'block'; 450 nextButton.style.display = 'block'; 451 } 452} 453 454function stopMedia() { 455 var winMediaObj = document.getElementById("mediaPlayer"); 456 if (winMediaObj != null) { 457 winMediaObj.Pause(); 458 } 459 460 var quckTimeMediaObj = document.getElementById("quicktime"); 461 if (quckTimeMediaObj != null) { 462 quckTimeMediaObj.stop(); 463 } 464 465 var flashObj = document.getElementById("flashAsset"); 466 if (flashObj != null) { 467 flashObj.StopPlay(); 468 } 469} 470 471function hideNext() { 472 if (document.next) { 473 next.style.display = 'none'; 474 nextButton.style.display = 'none'; 475 } 476} 477 478function editSco(vform) { 479 sco = vform.scoid.value; 480 var url = "EditSco.aspx?id=" + sco; 481 window.open(url, 'Fullscreen' + sco, "width=" + (screen.width - 100) + ",height=" + (screen.height - 100) + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0,top=10,left=10"); 482 history.back(); 483} 484 485function editMetadata(vform) { 486 sco = vform.scoid.value; 487 var url = "EditScoMetadata.aspx?id=" + sco; 488 window.open(url, 'Fullscreen', "width=" + (screen.width - 100) + ",height=" + (screen.height - 100) + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0,top=10,left=10"); 489 history.back(); 490} 491 492function editContent(vform) { 493 sco = vform.scoid.value; 494 var url = "EditScoContent.aspx?id=" + sco; 495 window.open(url, 'Fullscreen', "width=" + (screen.width - 100) + ",height=" + (screen.height - 100) + ",channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=1,toolbar=0,top=10,left=10"); 496 history.back(); 497} 498 499function hideAdvanced(button, panel) { 500 if (panel.style.display == "none") { 501 panel.style.display = "block"; 502 button.innerText = "Hide Advanced"; 503 } else { 504 panel.style.display = "none"; 505 button.innerText = "Show Advanced"; 506 } 507} 508 509var navToShow = null; 510var the_timer; 511 512function display(menu) { 513 //alert("test " + menu); 514 if (navToShow == null) { 515 516 navToShow = eval(menu + '_menu'); 517 navToShow.style.display = "block"; 518 } else { 519 clearTimeout(the_timer); 520 navToShow.style.display = "none"; 521 navToShow = eval(menu + '_menu'); 522 navToShow.style.display = "block"; 523 } 524 //alert("test " + menu); 525} 526 527function hideMenu() { 528 if (navToShow != null) { 529 navToShow.style.display = "none"; 530 } 531} 532 533function startTimer() { 534 the_timer = setTimeout("hideMenu()", 300); 535} 536 537/*********************buy passes*************************/ 538 539var newwindow = null; 540var assessmentWindow = null; 541var courseid; 542 543var buyPass = function (passID, allowCoupons, cartType) { 544 //change, if allow coupons, stop and ask for coupon 545 allowCoupons = "False";//changed to not allow pass coupons anymore, to remove this section completely after confirmed 546 if (allowCoupons == "True") { 547 if ($('#modalAccessCode').length === 0) 548 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 549 $('#modalAccessCode').html(''); 550 551 var modalHTML = '<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="True" style="display:;">' + 552 '<div class="modal-dialog modal-md">' + 553 '<div class="modal-content">' + 554 '<div class="modal-body" id="accessModalBodyDiv">
554' + 555 '<div class="controls" id="scope">' + 556 '<div class="form-group">' + 557 '<div id="msg" class="alert " role="alert" style="display:;">' + Nomenclature.translate('If you have a coupon please enter below') + '</div>' + 558 '<input type="text" placeholder="' + Nomenclature.translate('Enter Coupon') + '" runat="server" id="CouponTxt" class="form-control" style="margin:0px 0px 10px 0px;" aria-label="Enter Coupon" />' + 559 '<button id="Check_button" onclick="validateAndApplyCouponForPass(\'' + passID + '\');" class="btn btn-default pull-right">' + Nomenclature.translate('Purchase') + '</buton>' + 560 '</div>' + 561 '<div id="CouponAlert" class="alert " role="alert" style="display:;"></div>' + 562 '</div>' + 563 '</div>' + 564 '</div>' + 565 '</div>'; 566 567 $("#modalAccessCode").append(modalHTML); 568 $('#accessModal').modal('show', { show: true, keyboard: false }); 569 $('#modalAccessCode').css("display", "block"); 570 $('#modalAccessCode').addClass('modal-open'); 571 } 572 else { 573 574 if (cartType == "external") 575 purchaseExternal(response.url, title, response.price, response.marqueeElement, response.cartURL); 576 else 577 parent.location = 'Student/eCommerce/AddToCart.aspx?ItemID=' + passID + '&Type=Pass '; 578 } 579}; 580 581function validateAndApplyCouponForPass(passID) { 582 //var data1 = { code: code, domainID: domainID }; 583 var url = baseUrl + 'Student/eCommerce/Coupons.ashx'; 584 var coupon = $('#CouponTxt').val(); 585 if (coupon == '') 586 parent.location = 'Student/eCommerce/AddToCart.aspx?ItemID=' + passID + '&Type=Pass '; 587 588 var result; 589 $.ajax( 590 { 591 url: url, 592 type: 'POST', 593 dataType: "json", 594 data: { coupon: coupon, passID: passID, op: "redeemCouponForPass" }, 595 async: false, 596 success: function (data) { 597 if (data) { 598 if (data.success == 'true' || data.success == 'True' || data.success == true) { 599 parent.location.href = parent.location.href; 600 //$('#modalAccessCode').css("display", "block"); 601 } 602 else { 603 $('#CouponAlert').html(data.message); 604 $('#CouponAlert').css('display', 'block'); 605 } 606 } 607 }, 608 error: function (data) { 609 if (data.isValid == 'false' || data.isValid == 'FALSE') { 610 $('#CouponAlert').html('Error..'); 611 $('#CouponAlert').css('display', 'block'); 612 //console.log('Error in access code' + '! ' + code); 613 } 614 } 615 }); 616 return result; 617} 618 619var showPass = function (passid, purchased) { 620 621 $.ajax({
622 url: 'student/eCommerce/UserPasses.ashx', 623 data: { 624 op: 'getPassDetails', 625 passID: passid 626 }, 627 success: function (data) { 628 /* 629 {"PassID":"d94253b2-2af1-47b8-ad76-5d6193dcacd6", 630 "Code":"12364", 631 "Name":"Pass for Webinar Purchase", 632 "Description":"Pass for Webinar Purchase", 633 "ExpirationUnit":"days", 634 "ExpirationNumber":"30", 635 "ExpirationMode":"AfterPurchase", 636 "ExpirationDate":"", 637 "HasStartDate":"False", 638 "StartDate":"", 639 "Price":"0.10", 640 "altPricesJson":[[]], 641 "activities":[ 642 {"courseID":"be63abfc-121c-466d-91f3-353bc765a3ba", 643 "description":"Elearning Course 26th April - 1", 644 "code":"Elearning Course 26th April - 1" 645 }]} 646 647 */ 648 649 var activities = ''; 650 var metadatas = ''; 651 var expTime = data.ExpirationNumber; 652 var expDate = data.ExpirationDate; 653 var expFormat = data.ExpirationUnit; 654 var tempMode = data.ExpirationMode.split(/(?=[A-Z])/); 655 var expMode = ""; 656 if (expDate === '') { 657 $.each(tempMode, function () { 658 expMode += this.toLowerCase() + ' '; 659 }); 660 } else { 661 expMode = new Date(expDate).toLocaleDateString(); 662 } 663 var startdate = (data.StartDate != '') ? '<div><label>Starts :</label> ' + ((dateFormat !== "") ? new Date(data.StartDate).toString(dateFormat.replaceAll('m', 'M')) : data.StartDate.split(' ')[0]) + '</div>' : ''; 664 var price = data.Price; 665 666 var expiration = (expDate == '') ? 'Expires ' + expTime + ' ' + expFormat + ' ' + expMode : 667 'Expires on ' + expMode; 668 669 //metadata for pass, please review 670 $.each(data.metadata, function () { 671 metadatas += '<div><b>' + this.name + '</b>:'; 672 var val = ""; 673 $.each(this.values, function () { 674 if (val.length > 0) 675 val += ","; 676 val += this; 677 }) 678 679 metadatas += '<span>' + val + '</span></div>'; 680 }) 681 682 683 $.each(data.activities, function () { 684 activities += '<tr style="list-style-type:none;"><td><b>' + this.title + '</b></td>' + 685 '<td>' + this.code + '</td>' + 686 '<td style="word-wrap:break-word;">' + this.description + '</td>' + 687 '</tr>'; 688 }) 689 if ($('#modalAccessCode').length === 0) 690 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 691 $('#modalAccessCode').html(''); 692 var purchaseButton = (purchased) ? '' : '<button id="Check_button" onclick="buyPass(\'' + data.PassID + '\',\'' + data.AllowCoupons + `\' );" class="btn btn-default pull-right">${Nomenclature.translate("Purchase")}</buton>`; 693 var modalHTML = '<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="True"">' + 694 '<div class="modal-dialog modal-lg">' + 695 '<div class="modal-content">' + 696 '<div class="modal-header">' + 697 '<h1 class="modal-title" style="display:inline-block;">' + data.Name + '</h1><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' + 698 699 '</div>' + 700 '<div class="modal-body" id="accessModalBodyDiv">
700' + 701 '<h2>' + data.Code + '</h2>' + 702 '<p class="description" style="margin-top:20px;">' + data.Description + '</p>' + 703 startdate + 704 '<div><label>Price :</label> ' + price + '</div>' + 705 '<div style="margin:0px 0px 10px 0px"><i>*' + expiration + '</i></div>' + 706 '<div style="margin:0px 0px 10px 0px"><i>' + metadatas + '</i></div>' + 707 '<h3>Activities included in this Pass</h3>' + 708 '<table class="table table-striped;"><thead><tr><th>Title</th><th>Code</th><th>Description</th></tr></thead><tbody>' + activities + '</tbody></table>' + 709 '<div class="controls" id="scope">' + 710 '<div class="form-group tc-btn-group">' + 711 purchaseButton + 712 '<button id="Close_button" data-dismiss="modal" data-bs-dismiss="modal" class="btn btn-default pull-right" tabindex="0" aria-label="Close">Close</button>' + 713 714 '</div>' + 715 '<div id="AccessCodeAlert" class="alert " role="alert" style="display:;"></div>' + 716 '</div>' + 717 '</div>' + 718 '</div>' + 719 '</div>'; 720 721 $("#modalAccessCode").append(modalHTML); 722 723 $('#accessModal').modal('show', { show: true, keyboard: false }); 724 $('#modalAccessCode').css("display", "block"); 725 $('#modalAccessCode').addClass('modal-open'); 726 }, 727 error: function (e) { 728 console.log(e); 729 } 730 }); 731 732} 733 734/*********************access codes*************************/ 735 736var redeemCodeFromCatalogue = function (domainID, courseID, studentID, callback, title, type, b, active, el) { 737 if ($('#modalAccessCode').length === 0) 738 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 739 $('#modalAccessCode').html(''); 740 741 var modalHTML = '<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="True">' + 742 '<div class="modal-dialog modal-lg">' + 743 '<div class="modal-content">' + 744 '<div class="modal-body" id="accessModalBodyDiv">
744' + 745 '<div class="controls" id="scope">' + 746 '<div class="form-group">' + 747 '<input type="text" placeholder="Enter Access Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/>' + 748 '<button id="Check_button" onclick="checkAccessCodeInCatalogue(\'' + domainID + '\',\'' + courseID + '\',\'' + studentID + '\',\'' + callback + '\',\'' + title + '\',\'' + type + '\',' + b + ',\'' + active + '\',\'' + el + '\');" class="btn btn-default pull-right">Check Access Code</buton>' + 749 '</div>' + 750 '<div id="AccessCodeAlert" class="alert" role="alert"></div>' + 751 '</div>' + 752 '</div>' + 753 '</div>' + 754 '</div>'; 755 756 $("#modalAccessCode").append(modalHTML); 757 758 $('#accessModal').modal('show', { show: true, keyboard: false }); 759 $('#modalAccessCode').css("display", "block"); 760 $('#modalAccessCode').addClass('modal-open'); 761} 762 763function AccessCodeModal(domainID, courseID, learningPathID, attempt, height, width, modal, title, returnUrl, call, studentID) { 764 if ($('#modalAccessCode').length === 0) 765 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 766 $('#modalAccessCode').html(''); 767 768 var modalHTML = `<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="True" style="display:;"> 769 <div class="modal-dialog modal-lg"> 770 <div class="modal-content"> 771 <div class="modal-body" id="accessModalBodyDiv"> 772 <div class="controls" id="scope"> 773 <div class="form-group"> 774 <input type="text" aria-label="Enter Access Code" placeholder="Enter Access Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/> 775 <button id="Check_button" onclick="checkAccessCode('${domainID}','${courseID}','${learningPathID}','${attempt}','${height}','${width}','${modal}','${title}','${returnUrl}','${call}','${studentID}');" class="btn btn-default pull-right">Check Access Code</button> 776 </div> 777 <div id="AccessCodeAlert" class="alert " role="alert" style="display:;"></div> 778 </div> 779 </div> 780 </div> 781 </div> 782 </div>`; 783 784 $("#modalAccessCode").append(modalHTML); 785 786 $('#accessModal').modal('show', { show: true, keyboard: false }); 787 $('#modalAccessCode').css("display", "block"); 788 $('#modalAccessCode').addClass('modal-open'); 789}; 790 791var checkAccessCodeInCatalogue = function (domainID, courseID, studentID, callback, title, type, b, active, el) { 792 var code = document.getElementById("CodeTxt"); 793 var type = "course"; 794 var result = validateRegistrationCode(code.value, domainID, 'course', courseID, studentID); 795 //var result = true; 796 if (result == true) { 797 $("#Check_button").attr("data-dismiss", "modal"); 798 799 //OpenExpressStart = function (baseurl, courseID, programID, title, type, el, enrolled) 800 //AddToCartNoFastStart(\'' + baseUrl + '\',\'' + this.id + '\',\'' + this.programID + '\',\'' + this.title + '\',\'' + this.type + '\', this, false,\'available\')"' 801 var cb = eval(callback); 802 if (callback === 'AddToCartNoFastStart') { 803 cb(baseUrl, courseID, domainID, title, type, $(el), false, 'available'); 804 } else { 805 cb(baseUrl, courseID, domainID, title, type, $(el), b); 806 } 807 } 808 else { 809 openAccessModal(false); 810 } 811 return false; 812} 813 814function checkAccessCode(domainID, courseID, learningPathID, attempt, height, width, modal, title, returnUrl, call, studentID) { 815 var code = document.getElementById("CodeTxt"); 816 var type = "course"; 817 var result = validateRegistrationCode(code.value, domainID, 'course', courseID, studentID); 818 if (result == true) { 819 $("#Check_button").attr("data-dismiss", "modal"); 820 launchEnterClassrooom(courseID, domainID, learningPathID, attempt, height, width, modal, title, returnUrl, call, fullscreen) 821 822 } 823 else { 824 openAccessModal(false); 825 } 826 return false; 827} 828 829function openAccessModal(isvalid) { 830 if (isvalid) { 831 $("#AccessCodeAlert").html("Access Code is Valid."); 832 $("#AccessCodeAlert").attr("class", "alert-success"); 833 $("#AccessCodeAlert").css("display", "block"); 834 $("#Check_button").value('Continue'); 835 $("#Check_button").attr('Onclick', 'closePopUp()'); 836 837 } else { 838 $("#accessModal").modal({ 839 backdrop: 'static', 840 keyboard: false 841 }); 842 $("#AccessCodeAlert").attr("class", "alert-danger"); 843 $("#AccessCodeAlert").css("display", "block"); 844 $("#AccessCodeAlert").html("Access Code is InValid."); 845 } 846} 847 848var closePopUp = function () { 849 $("#accessModal").modal('hide'); 850} 851 852function AccessCodeModalforLink(link, domainID, courseID, studentID) { 853 if ($('#modalAccessCode').length === 0) 854 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 855 $('#modalAccessCode').html(''); 856 //$('.modal.learning-activity-feedback .modal-body').html(''); 857 858 var modalHTML = `<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="true"> 859 <div class="modal-dialog modal-lg"> 860 <div class="modal-content"> 861 <div class="modal-body" id="accessModalBodyDiv"> 862 <div class="controls" id="scope"> 863 <div class="form-group"> 864 <input aria-label="Enter Access Code" type="text" placeholder="Enter Access Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/> 865 <button id="Check_button" onclick="LinkcheckAccessCode('${link}','${domainID}','${courseID}','${studentID}');return false;" class="btn btn-default pull-right">Check Access Code</button> 866 </div> 867 <div id="AccessCodeAlert" class="alert" role="alert"></div> 868 </div> 869 </div> 870 </div> 871 </div> 872 </div>`; 873 874 875 $("#modalAccessCode").append(modalHTML); 876 //$('.modal.learning-activity-feedback .modal-body').append(spinner); 877 //$('#formhtml').append(dom); 878 $('#accessModal').modal('show', { show: true, keyboard: false }); 879 $('#modalAccessCode').css("display", "block"); 880 $('#modalAccessCode').addClass('modal-open'); 881 return false; 882}; 883 884//function AccessCodeModalforAccessedcourse(link, domainID, courseID, studentID) { 885// if ($('#modalAccessCode').length === 0) 886// $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 887// $('#modalAccessCode').html(''); 888// //$('.modal.learning-activity-feedback .modal-body').html(''); 889 890function AccessCodeModalFaststart(baseUrl, courseID, domainID, title, type, el, active) { 891 if ($('#modalAccessCode').length === 0) 892 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 893 $('#modalAccessCode').html(''); 894 //$('.modal.learning-activity-feedback .modal-body').html(''); 895 896 var modalHTML = '<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="True">' + 897 '<div class="modal-dialog modal-lg">' + 898 '<div class="modal-content">' + 899 '<div class="modal-body" id="accessModalBodyDiv">
899' + 900 '<div class="controls" id="scope">' + 901 '<div class="form-group" id="faststartAccesscode">' + 902 '<input aria-label="Enter Access Code" type="text" placeholder="Enter Access Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/>' 903 '</div>' + 904 '<div id="AccessCodeAlert" class="alert " role="alert"></div>' + 905 '</div>' + 906 '</div>' + 907 '</div>' + 908 '</div>'; 909 910 911 $("#modalAccessCode").append(modalHTML); 912 var button1 = "<button id='faststartAccesscode_button' class='btn btn-default pull-right'>Check Access Code</button>"; 913 914 $("div #faststartAccesscode").append(button1); 915 916 $("#faststartAccesscode_button").click(function () { checkAccessCodeCatalogue(el, baseUrl, courseID, domainID, title, type, active, ''); }); 917 $('#accessModal').modal('show', { show: true, keyboard: false }); 918 $('#modalAccessCode').css("display", "block"); 919 $('#modalAccessCode').addClass('modal-open'); 920 return false; 921}; 922 923function LinkcheckAccessCode(link, domainID, courseID, studentID) { 924 event.stopPropagation(); 925 var code = document.getElementById("CodeTxt"); 926 var type = "course"; 927 var result = validateRegistrationCode(code.value, domainID, 'course', courseID, studentID); 928 if (result == true) { 929 $("#Check_button").attr("data-dismiss", "modal"); 930 window.location.href = link; 931 } 932 else { 933 openAccessModal(false); 934 } 935 return false; 936} 937 938var checkAccessCodeCatalogue = function (el, baseurl, courseID, domainID, title, type, isenrolled, studentID) { 939 var code = document.getElementById("CodeTxt"); 940 var type = "course"; 941 var result = validateRegistrationCode(code.value, domainID, 'course', courseID, studentID); 942 //var result = true; 943 if (result == true) { 944 $("#faststartAccesscode_button").attr("data-dismiss", "modal"); 945 OpenExpressStart(baseurl, courseID, domainID, title, type, $(el), isenrolled, ''); 946 } 947 else { 948 openAccessModal(false); 949 } 950 return false; 951} 952 953function AccessCodeModalforOpenModal(baseUrl, courseID, domainID, title, fastaction, backbtn, type, returnurl, studentID) { 954 955 if ($('#modalAccessCode').length === 0) { 956 $('body').append('<div id="modalAccessCode"></div>'); 957 }; 958 959 $('#modalAccessCode').html(`<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="true"> 960 <div class="modal-dialog modal-md"> 961 <div class="modal-content"> 962 <div class="modal-body" id="accessModalBodyDiv"> 963 <div class="controls" id="scope"> 964 <div class="form-group"> 965 <input type="text" placeholder="Enter Access Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/> 966 <button id="Check_button" onclick="openModalaccesscode('${baseUrl}','${courseID}','${domainID}','${title}','${fastaction}','${backbtn}','${type}','${returnurl}','${studentID}');" class="btn btn-default pull-right">Check Access Code</button> 967 </div> 968 <div id="AccessCodeAlert" class="alert " role="alert" style="display:;"></div> 969 </div> 970 </div> 971 </div> 972 </div> 973 </div>`); 974 975 $('#accessModal').modal('show', { show: true, keyboard: false }); 976 $('#modalAccessCode').addClass('modal-open'); 977}; 978 979function AccessCodeModalforCatalogCategory(baseUrl, courseID, domainID, returnurl) { 980 981 if ($('#modalAccessCode').length === 0) 982 $('body').append('<div id="modalAccessCode" style="display:none"></div>'); 983 $('#modalAccessCode').html(''); 984 //$('.modal.learning-activity-feedback .modal-body').html(''); 985 var modalHTML = '<div id="accessModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="accessModalLabel" aria-hidden="True" style="display:;">' + 986 '<div class="modal-dialog modal-md">' + 987 '<div class="modal-content">' + 988 '<div class="modal-body" id="accessModalBodyDiv">
988' + 989 '<div class="controls" id="scope">' + 990 '<div class="form-group">' + 991 '<input type="text" placeholder="Enter Access Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/>' + 992 '<button id="Check_button" onclick="LinkcheckAccessCode(\'' + baseUrl + '\',\'' + domainID + '\',\'' + courseID + '\');" class="btn btn-default pull-right">Check Access Code</buton>' + 993 '</div>' + 994 '<div id="AccessCodeAlert" class="alert " role="alert" style="display:;"></div>' + 995 '</div>' + 996 '</div>' + 997 '</div>' + 998 '</div>'; 999 $("#modalAccessCode").append(modalHTML); 1000 //$('.modal.learning-activity-feedback .modal-body').append(spinner); 1001 //$('#formhtml').append(dom); 1002 $('#accessModal').modal('show', { show: true, keyboard: false }); 1003 $('#modalAccessCode').css("display", "block"); 1004 $('#modalAccessCode').addClass('modal-open'); 1005}; 1006 1007function openModalaccesscode(baseurl, courseID, programID, title, fastaction, entermode, backbtn, type, returnUrl, studentID) { 1008 var code = document.getElementById("CodeTxt"); 1009 var type = "course"; 1010 var result = validateRegistrationCode(code.value, programID, 'course', courseID, studentID); 1011 if (result == true) { 1012 openModal(baseurl, courseID, programID, title, fastaction, entermode, backbtn, type, returnUrl) 1013 } 1014 else { 1015 openAccessModal(false); 1016 } 1017 return false; 1018} 1019 1020/*********************attendance codes*************************/ 1021 1022var attendanceCodeForCatalogPage = function (domainID, courseID, studentID, callback, title, type, b, active, el) { 1023 1024 if ($('#modalAttendanceCode').length === 0) 1025 $('body').append('<div id="modalAttendanceCode" style="display:none"></div>'); 1026 $('#modalAttendanceCode').html(''); 1027 1028 var modalHTML = '<div id="AttendanceCodeModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="attendanceModalLabel" aria-hidden="True" style="display:;" width>' + 1029 '<div class="modal-dialog modal-md">' + 1030 '<div class="modal-content">' + 1031 '<div class="modal-body" id="attendanceModalBodyDiv">
1031' + 1032 '<div class="controls" id="scope">' + 1033 '<div class="form-group">' + 1034 '<input type="text" placeholder="Enter Attendance Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/>' + 1035 '<button id="Check_button" onclick="checkAttendanceCodeInCatalogue(\'' + domainID + '\',\'' + courseID + '\',\'' + studentID + '\',\'' + callback + '\',\'' + title + '\',\'' + type + '\',' + b + ',\'' + active + '\',\'' + el + '\');" class="btn btn-default pull-right">Check Attendance Code</buton>' + 1036 '</div>' + 1037 '<div id="AttendanceCodeAlert" class="alert " role="alert" style="display:none;">In-Valid Attendance Code.</div>' + 1038 '</div>' + 1039 '</div>' + 1040 '</div>' + 1041 '</div>'; 1042 1043 $("#modalAttendanceCode").append(modalHTML); 1044 1045 $('#AttendanceCodeModal').modal('show', { show: true, keyboard: false }); 1046 $('#modalAttendanceCode').css("display", "block"); 1047 $('#modalAttendanceCode').addClass('modal-open'); 1048 1049} 1050 1051var checkAttendanceCodeInCatalogue = function (domainID, courseID, studentID, callback, title, type, b, active, el) { 1052 // var code = document.getElementById("CodeTxt"); 1053 var type = "course"; 1054 var result = checkAttendanceCode('', domainID, courseID, 'true'); 1055 //var result = true; 1056 1057 if (typeof (result) != 'undefined') { 1058 if (result.isValid == 'True' || result.isValid == true || result.isValid == 'true') { 1059 // $("#Check_button").attr("data-dismiss", "modal"); 1060 1061 //OpenExpressStart = function (baseurl, courseID, programID, title, type, el, enrolled) 1062 //AddToCartNoFastStart(\'' + baseUrl + '\',\'' + this.id + '\',\'' + this.programID + '\',\'' + this.title + '\',\'' + this.type + '\', this, false,\'available\')"' 1063 var cb = eval(callback); 1064 if (callback === 'AddToCartNoFastStart') { 1065 cb(baseUrl, courseID, domainID, title, type, $(el), false, 'available'); 1066 } else { 1067 cb(baseUrl, courseID, domainID, title, type, $(el), b); 1068 } 1069 } 1070 else { 1071 $("#AttendanceCodeModal #AttendanceCodeAlert").css("display", "block"); 1072 $("#AttendanceCodeModal #AttendanceCodeAlert").text(result.message); 1073 } 1074 } 1075 return false; 1076} 1077 1078var attendanceCodeCatalogueXsl = function (baseurl, courseID, programID, title, type, el, enrolled, lp) { 1079 1080 if ($('#modalAttendanceCode').length === 0) 1081 $('body').append('<div id="modalAttendanceCode" style="display:none"></div>'); 1082 $('#modalAttendanceCode').html(''); 1083 1084 var modalHTML = '<div id="AttendanceCodeModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="attendanceModalLabel" aria-hidden="True" style="display:;" width>' + 1085 '<div class="modal-dialog modal-md">' + 1086 '<div class="modal-content">' + 1087 '<div class="modal-body" id="attendanceModalBodyDiv">
1087' + 1088 '<div class="controls" id="scope">' + 1089 '<div class="form-group">' + 1090 '<input type="text" placeholder="Enter Attendance Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/>' + 1091 '<button id="Check_button" onclick="checkAttendanceCodeForCatalougeXsl(\'' + baseUrl + '\',\'' + courseID + '\',\'' + programID + '\',\'' + title + '\',\'' + type + '\',\'' + el + '\',\'' + enrolled + '\',\'' + lp + '\');return false;" class="btn btn-default pull-right">Check Attendance Code</buton>' + 1092 '</div>' + 1093 '<div id="AttendanceCodeAlert" class="alert " role="alert" style="display:none;">In-Valid Attendance Code.</div>' + 1094 '</div>' + 1095 '</div>' + 1096 '</div>' + 1097 '</div>'; 1098 1099 $("#modalAttendanceCode").append(modalHTML); 1100 1101 $('#AttendanceCodeModal').modal('show', { show: true, keyboard: false }); 1102 $('#modalAttendanceCode').css("display", "block"); 1103 $('#modalAttendanceCode').addClass('modal-open'); 1104} 1105 1106var checkAttendanceCodeForCatalougeXsl = function (baseurl, courseID, domainID, title, type, el, enrolled, lp) { 1107 var type = "course"; 1108 var result = checkAttendanceCode('', domainID, courseID, 'true'); 1109 if (typeof (result) != 'undefined') { 1110 if (result.isValid == true) { 1111 OpenEnrollingCourse(baseurl, courseID, domainID, title, type, el, enrolled, lp); 1112 } 1113 else { 1114 $("#AttendanceCodeModal #AttendanceCodeAlert").css("display", "block"); 1115 $("#AttendanceCodeModal #AttendanceCodeAlert").text(result.message); 1116 } 1117 } 1118 return false; 1119} 1120 1121function AttendanceCodeModal(baseUrl, domainID, courseID, lpId) { 1122 if ($('#modalAttendanceCode').length === 0) 1123 $('body').append('<div id="modalAttendanceCode" style="display:none"></div>'); 1124 $('#modalAttendanceCode').html(''); 1125 var modalHTML = '<div id="AttendanceCodeModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="attendanceModalLabel" aria-hidden="True" style="display:;" width>' + 1126 '<div class="modal-dialog modal-md">' + 1127 '<div class="modal-content">' + 1128 '<div class="modal-body" id="attendanceModalBodyDiv">
1128' + 1129 '<div class="controls" id="scope">' + 1130 '<div class="form-group">' + 1131 '<input type="text" placeholder="Enter Attendance Code" runat="server" id="CodeTxt" class="form-control" style="margin:0px 0px 10px 0px;"/>' + 1132 '<button id="Check_button" onclick="checkAttendanceCode(\'' + baseUrl + '\',\'' + domainID + '\',\'' + courseID + '\');" class="btn btn-default pull-right">Check Attendance Code</buton>' + 1133 '</div>' + 1134 //' <div id="validCoupon" class="hidden"> <hr />'+ 1135 // '<h3>PIN Successful</h3>'+ 1136 //'<p>This is a PIN for <span id="validfor_course"></span>. If this is not the course you wish to take, please stop here and check with your Distributor.</p>'+ 1137 //'<p><input type="checkbox" name="confirm_pin_use" id="confirm_pin_use" onclick="activate_pin_continue();" /><span id="validfor_course_confirm"></span> is the course I wish to take.</p>'+ 1138 //'</div>'+ 1139 '<div id="AttendanceCodeAlert" class="alert " role="alert" style="display:none;">In-Valid Attendance Code.</div>'; 1140 if (lpId != 'undefined' && lpId != '') 1141 modalHTML += '<input type="hidden" id="LpID" value="' + lpId + '" />'; 1142 1143 modalHTML += '</div>' + 1144 '</div>' + 1145 '</div>' + 1146 '</div>'; 1147 1148 $("#modalAttendanceCode").append(modalHTML); 1149 1150 $('#AttendanceCodeModal').modal('show', { show: true, keyboard: false }); 1151 $('#modalAttendanceCode').css("display", "block"); 1152 $('#modalAttendanceCode').addClass('modal-open'); 1153}; 1154 1155function checkAttendanceCode(baseUrl, domainID, CourseID, EnrollBtn) { 1156 var Code_value = $("#AttendanceCodeModal #CodeTxt").val(); 1157 var LPId = ''; 1158 // check if the page is a learning path 1159 if (typeof (isLP) !== 'undefined' && isLP) { 1160 LPId = getParameterByName('id'); 1161 } else { 1162 LPId = $("#AttendanceCodeModal #LpID").val(); 1163 } 1164 1165 console.log("Code=" + Code_value); 1166 var result = false; 1167 $.ajax({
1168 url: "Student/eCommerce/ValidateCoupon.ashx", 1169 dataType: "json", 1170 async: false, 1171 data: { 1172 coupon: Code_value, 1173 op: 'ApplyAttendanceCode', 1174 courseID: CourseID 1175 }, 1176 error: function () { }, 1177 success: function (data) { 1178 if (data) { 1179 if (typeof (EnrollBtn) == 'undefined' || EnrollBtn == "") { 1180 console.log("data.isValid = " + data.isValid); 1181 if (data.isValid === 'true' || data.isValid === 'True') { 1182 var activity_cart_URL = baseUrl + '/Student/eCommerce/AddToCart.aspx?ItemID=' + data.courseID + '&Type=Course&back=catalogue' + '&coupon=' + Code_value; 1183 //if (Operation == 'ApplyAttendanceCode') { 1184 if (LPId != 'undefined' && LPId != '') { 1185 if (location.href.indexOf("MyLP.aspx") >= 0) 1186 activity_cart_URL = baseUrl + '/Student/MyLP.aspx?id=' + LPId; 1187 else 1188 activity_cart_URL = baseUrl + '/Student/MyCourse.aspx?id=' + LPId; 1189 1190 } else 1191 activity_cart_URL = baseUrl + '/Student/MyCourse.aspx?id=' + data.courseID; 1192 // } 1193 console.log("activity_cart_URL = " + activity_cart_URL); 1194 window.location.href = activity_cart_URL; 1195 } else { 1196 1197 if ((data.isValid === 'false' || data.isValid === 'False')) { 1198 $("#AttendanceCodeModal #AttendanceCodeAlert").css("display", "block"); 1199 $("#AttendanceCodeModal #AttendanceCodeAlert").text(data.LearnerInstruction); 1200 } 1201 else 1202 $("#AttendanceCodeModal #AttendanceCodeAlert").css("display", "block"); 1203 } 1204 } 1205 else { 1206 result = data; 1207 // return result; 1208 } 1209 } 1210 } 1211 }); 1212 1213 return result; 1214} 1215 1216function validateRegistrationCode(code, domainID, type, courseID, studentID) { 1217 //var data1 = { code: code, domainID: domainID }; 1218 //var baseurl = baseUrl + 'ValidateAccessCodeHandler.ashx'; 1219 var result; 1220 $.ajax( 1221 { 1222 url: baseUrl + 'ValidateAccessCodeHandler.ashx', 1223 type: 'POST', 1224 dataType: "json", 1225 data: { 1226 Accesscode: code, 1227 domain: domainID, 1228 type: type, 1229 Course: courseID, 1230 StudentID: studentID 1231 }, 1232 async: false, 1233 success: function (data) { 1234 if (data) { 1235 if (data.isValid == 'true' || data.isValid == 'True') { 1236 //window.alert('Access code is valid.'); 1237 // showPopup(true); 1238 result = true; 1239 } 1240 else { 1241 result = false; 1242 } 1243 1244 } 1245 }, 1246 error: function (data) { 1247 if (data.isValid == 'false' || data.isValid == 'FALSE') { 1248 1249 console.log('Error in access code' + '! ' + code); 1250 } 1251 } 1252 }); 1253 return result; 1254} 1255 1256/*********************launch a course window and watch for it to close*************************/ 1257 1258function ReenrollandReviewModal(courseID, domainID, learningPathID, attempt, height, width, modal, title, returnUrl, call, studentID, hasAccesscode, baseUrl, type, mapID, authenticationType) { 1259 if ($('#modalAccessCode').length === 0) 1260 $('body').append('<div id="modalRenrollandReview" style="display:none"></div>'); 1261 $('#modalAccessCode').html(''); 1262 1263 var modalHTML = '<div id="RenrollandReviewmodal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="RenrollandRevieModalLabel" aria-hidden="True" style="display:;">' + 1264 '<div class="modal-dialog modal-md">' + 1265 '<div class="modal-content">' + 1266 '<div class="modal-header" style="height:45px;">' + 1267 '<h4 class="modal-title">You have completed this course. Would you like to review the completed content or start a new enrollment? </h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' + 1268 '</div>' + 1269 '<div class="modal-body" id="RenrollandRevieModalBodyDiv">
1269' + 1270 '<div class="controls" id="scope">' + 1271 '<div class="form-group">' + 1272 '<button id="start-enrollment_button" onclick="OpenEnrollingCourse(\'' + baseUrl + '\',\'' + courseID + '\',\'' + domainID + '\',\'' + title + '\',\'' + authenticationType + '\',\'this\',\'true\',\'' + mapID + '\');return false;" class="btn btn-default pull-right" style="margin-left:0.5em;">Start new enrollment</buton>' + 1273 '<button id="Review_button" onclick="reviewCourse(\'' + courseID + '\',\'' + domainID + '\',\'' + learningPathID + '\',\'' + attempt + '\',\'' + height + '\',\'' + width + '\',\'' + modal + '\',\'' + title + '\',\'' + returnUrl + '\',\'' + call + '\',\'' + studentID + '\');return false;" class="btn btn-default pull-right" style="margin-left:0.5em;">Review completed content</buton>' + 1274 '</div>' + 1275 '</div>' + 1276 '</div>' + 1277 '</div>' + 1278 '</div>'; 1279 1280 $("#modalAccessCode").append(modalHTML); 1281 $('#RenrollandReviewmodal').modal('show', { show: true, keyboard: false }); 1282 $('#modalAccessCode').css("display", "block"); 1283 $('#modalAccessCode').addClass('modal-open'); 1284 $('.activity-modal').modal('hide'); 1285}; 1286 1287function reviewCourse(courseID, domainID, learningPathID, attempt, height, width, modal, title, returnUrl, call, studentID, hasAccesscode, baseUrl, type, mapID) { 1288 if (hasAccesscode == 'true') 1289 AccessCodeModal(domainID, courseID, learningPathID, attempt, height, width, modal, title, returnUrl); 1290 else 1291 launchEnterClassrooom(courseID, domainID, learningPathID, attempt, height, width, modal, title, returnUrl); 1292 1293} 1294 1295//enter classroom opener that works with Firefox 1296function launchEnterClassrooom(courseID, programID, learningPathID, attempt, height = 600, width = 800, modal, title = ' ', returnUrl, call, fullscreen,proctered) { 1297 TC.currentCourse = courseID; 1298 1299 if (browser_type.indexOf('Safari') >= 0) { 1300 console.log('safari bug fix'); 1301 // $('body').css('position', 'fixed'); 1302 } 1303 1304 if (typeof (isLP) !== 'undefined' && isLP && typeof (lastAccessed) == 'undefined') 1305 lastAccessed = courseID; 1306 let margin = ""; 1307 let fs = false; 1308 if ((typeof (courseFullScreen) !== 'undefined' && courseFullScreen === true) || (typeof (fullscreen) !== 'undefined' && fullscreen && fullscreen.toLowerCase() === 'true')) { 1309 height = $(window).innerHeight() + 'px'; 1310 width = $(document).innerWidth() + 'px'; 1311 //height = "99vh"; 1312 //width = "90%"; 1313 margin = 'margin:0px !important;'; 1314 fs = true; 1315 } else { 1316 width = width + 'px'; 1317 height = height + 'px'; 1318 }; 1319 1320 //PLEASE MIND THE PARAMETER CASE 1321 //PLEASE GO TO ENTERCLASSROOM NOT VIEWCOURSE!!! < Check out the passive aggressive explanation marks. Must be serious. 1322 1323 var redirectURL = baseUrl + "Student/Course/EnterClassroom.aspx?Modal=true&CourseID=" + courseID + "&ProgramID=" + programID + "&Attempt=" + attempt; 1324 if (typeof (call) != 'undefined' && call) 1325 redirectURL += "&hasDisclaimer=1"; 1326 if (learningPathID.length > 0) 1327 redirectURL += "&lpID=" + learningPathID; 1328 1329 //open the course in a new tab or a new window depending on how the user has the browser set 1330 if (modal === 'DefaultBrowserSettings') { 1331 courseid = courseID; 1332 if (newwindow !== null && !newwindow.closed) { 1333 newwindow.location.href = redirectURL; 1334 } else { 1335 1336 newwindow = window.open(redirectURL, 'CourseWindow'); 1337 } 1338 //if(!isLP) 1339 interval = setInterval("checkParentWindow(false,'" + courseID + "')", 5000); 1340 try { 1341 $("#myModalDisc").modal('hide'); 1342 $("#myModalDisc").remove(); 1343 } 1344 catch (e) { } 1345 } 1346 else if (modal === 'ModalWindow') { 1347 try { 1348 $("#myModalDisc").modal('hide'); 1349 $("#myModalDisc").remove(); 1350 } 1351 catch (e) { } 1352 var mobile = (isMobile.any() !== null) ? "width:99%;" : ""; 1353 1354 // remove the modal if it exists 1355 console.log("tryhing to append the modal");
1356 $('#myModal').remove(); 1357 1358 const isResponsiveEmbed = !isIE && mobile === ''; 1359 1360 const iframe = `<iframe 1361 data-id="${courseID}" 1362 id="viewCourseModal" 1363 ${isResponsiveEmbed ? 'style="width:100%;" class="responsive-embed-item" scrolling="auto" tabindex="1"' : 'height="100%" width="100%"'} 1364 allowFullScreen="true" 1365 webkitallowfullscreen="true" 1366 mozallowfullscreen="true" 1367 name="viewCourse" 1368 frameborder="0" 1369 ></iframe>`; 1370 1371 const modalHtml = `<div 1372 aria-modal="true" 1373 class="modal fade course" 1374 id="myModal" 1375 tabindex="-1" 1376 role="dialog" 1377 aria-hidden="true" 1378 data-modalid="launch-classroom-modal" 1379 > 1380 <div class="modal-dialog modal-fullheight modal-lg ${fs || mobile ? 'modal-fullscreen' : ''}"> 1381 <div class="modal-content course_${courseID}"> 1382 <div class="modal-header header_${courseID}" style="height:45px;"> 1383 <h4 class="modal-title">${title.replace('&', '&') }</h4> 1384 <button type="button" class="${fs || mobile ? 'btn btn-default ms-auto' : 'btn-close'}" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close">${fs || mobile ? Nomenclature.translate('Close') : ''}</button> 1385 </div> 1386 <div class="modal-body"> 1387 ${iframe} 1388 </div> 1389 </div> 1390 </div> 1391 </div>`; 1392 $("body").append(modalHtml); 1393 1394 $('#myModal').modal('show', { show: true, keyboard: false, backdrop: 'static' }); 1395 1396 $('.modal.course iframe').wrap('<div class="coursemodule"></div>'); 1397 1398 if (browser_type.indexOf('Fire') >= 0) 1399 setTimeout(function () { $('#myModal').removeClass('in'); $('#myModal').removeClass('fade'); $('#myModal .modal-body').css('padding', '0px'); }, 1000); 1400 1401 $("#viewCourseModal").attr('src', redirectURL); 1402 1403 $('#myModal').on('hidden.bs.modal', function () { 1404 1405 // If the identity snapshot module flagged a camera permission denial, 1406 // skip LMSFinish and parent page refresh — the course was never started. 1407 if (window._identitySnapshotCameraDenied === true) { 1408 console.log('navigation.js: Skipping LMSFinish/refresh — camera permission was denied'); 1409 $('#myModal').remove(); 1410 $('.modal-backdrop').remove(); 1411 $('body').removeClass('modal-open'); 1412 return; 1413 } 1414 1415 var w = $('#viewCourseModal')[0].contentWindow; 1416 try { 1417 w.config.modalclose = true; 1418 // w.config.finished = true; 1419 try { 1420 w.API.LMSFinish(); 1421 } catch (e) { 1422 try { 1423 w.API.ajaxTerminate(); 1424 } catch (e) { 1425 } 1426 } 1427 } catch (e) { } 1428 1429 /*$('#myModal').modal('hide'); - on('hidden.bs.modal' - fires when modal is closed already */ 1430 1431 //this causes problems when you Enroll (enroll.aspx) , then go to list of courses,enter course then close it.It goes back to enroll in course.I have removed history back 1432 if (typeof (isLP) == 'undefined') { 1433 setTimeout(function () { 1434 if (typeof (learningPathID) !== 'undefined' && learningPathID !== '') 1435 courseID = learningPathID; 1436 $('#myModal').remove(); 1437 1438 if (returnUrl && returnUrl != null && returnUrl.length > 0 && window.location.href.indexOf('MyCourse') < 0 && returnUrl.toLowerCase().indexOf('browsecat') < 0) { 1439 window.location.href = returnUrl; 1440 } else { 1441 var url = window.location.href; 1442 var path = window.location.pathname; 1443 switch (true) { 1444 case url.indexOf('MyLearningActivities.aspx') >= 0: 1445 {
1446 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1447 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + window.location.href; 1448 } 1449 else { 1450 url = baseUrl + 'Student/MyLearningActivities.aspx'; 1451 } 1452 } 1453 1454 break; 1455 case url.indexOf('Catalogue') >= 0: 1456 { 1457 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1458 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; 1459 } 1460 else { 1461 url = window.location.href; 1462 } 1463 } 1464 break; 1465 case url.indexOf('type=lp') >= 0: url = url; 1466 break; 1467 case url.indexOf('MyCourses.aspx') >= 0: 1468 { 1469 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1470 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; 1471 } 1472 else { 1473 url = baseUrl + 'Student/MyCourses.aspx'; 1474 } 1475 } 1476 break; 1477 //default: if (redirectToDetailsPage !== 'undefined' && redirectToDetailsPage) url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; else url = window.location.href; url = url.replace('&start=true', ''); 1478 1479 case typeof (TC.Catalogue) !== 'undefined': 1480 { 1481 if (typeof (TC.Catalogue.settings) !== 'undefined') { 1482 if (TC.Catalogue.settings.RedirectToDetailsPage) 1483 url = 'Student/MyCourse.aspx?id=' + courseID; 1484 else 1485 url = window.location.href; 1486 } else { 1487 url = window.location.href; 1488 } 1489 1490 } 1491 break; 1492 default: url = window.location.href; url = url.replace('&start=true', ''); 1493 break; 1494 } 1495 window.location.href = url; 1496 }//window.location.href + '&returnUrl=' + returnUrl; 1497 }, 2000);//parent.history.back(); 1498 } else { 1499 $('#myModal .modal-dialog').remove(); 1500 $('#myModal').remove(); 1501 //$('#myModal .modal-dialog').remove(); 1502 console.log('navigation.js::launchEnterClassrooom() - call TC.checkLPStatus(1)'); 1503 TC.checkLPStatus(); 1504 $('body').removeClass('modal-open'); 1505 //setTimeout(function () { TC.checkLPStatus(); }, 1000); 1506 1507 } 1508 }); 1509 } 1510 else {//open in a new window/tab 1511 courseid = courseID; 1512 if (newwindow !== null) { 1513 newwindow.location.href = redirectURL; 1514 } else { 1515 newwindow = window.open(redirectURL, 'CourseWindow', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1516 } 1517 1518 $("#myModalDisc, #myModal").modal('hide').remove(); 1519 // 1520 if (typeof (isLP) == 'undefined') { 1521 interval = setInterval(function () { 1522 var url = window.location.href; 1523 var path = window.location.pathname; 1524 if (typeof (returnUrl) !== 'undefined' && returnUrl !== "") { 1525 url = returnUrl; 1526 } 1527 else if (typeof (learningPathID) !== 'undefined' && learningPathID !== "") {
1528 baseUrl + 'Student/MyCourse.aspx?id=' + learningPathID + '&ProgramID=' + programID + '&returnUrl=' + url; 1529 } else { 1530 switch (true) { 1531 case url.indexOf('MyLearningActivities.aspx') >= 0: 1532 { 1533 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1534 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + window.location.href; 1535 } 1536 else { 1537 url = baseUrl + 'Student/MyLearningActivities.aspx'; 1538 } 1539 } 1540 break; 1541 case url.indexOf('type=lp') >= 0: url = baseUrl + 'Student/MyCourse.aspx?id=' + learningPathID + '&ProgramID=' + programID + '&returnUrl=' + url; 1542 break; 1543 case url.indexOf('Catalogue') >= 0: 1544 { 1545 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1546 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; 1547 } 1548 else { 1549 url = window.location.href 1550 } 1551 } 1552 break; 1553 case url.indexOf('MyCourses.aspx') >= 0: 1554 { 1555 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1556 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; 1557 } 1558 else { 1559 url = baseUrl + 'Student/MyCourses.aspx'; 1560 } 1561 } 1562 break; 1563 case typeof (TC.Catalogue) !== 'undefined': 1564 { 1565 if (typeof (TC.Catalogue.settings) !== 'undefined') { 1566 if (TC.Catalogue.settings.RedirectToDetailsPage) 1567 url = 'Student/MyCourse.aspx?id=' + courseID; 1568 else 1569 url = window.location.href; 1570 } else { 1571 url = window.location.href; 1572 } 1573 1574 } 1575 break; 1576 default: if (redirectToDetailsPage !== 'undefined' && redirectToDetailsPage) url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; else url = window.location.href; url = url.replace('&start=true', ''); 1577 // default:url = window.location.href; url = url.replace('&start=true', ''); 1578 break; 1579 } 1580 } 1581 checkParentWindow(url, courseID) 1582 }, 5000); 1583 } else { 1584 interval = setInterval(function () { 1585 if (newwindow.closed) { 1586 newwindow = null; 1587 clearInterval(interval); 1588 if (typeof (ajaxTerminate) !== 'undefined') { 1589 try { 1590 ajaxTerminate("mycourse"); 1591 } catch (e) { } 1592 } 1593 console.log('navigation.js::launchEnterClassrooom() - call TC.checkLPStatus(2)'); 1594 TC.checkLPStatus(); 1595 } 1596 }, 5000); 1597 } 1598 } 1599 1600 return false; 1601} 1602 1603//enter classroom opener that works with Firefox 1604function launchEnterAssessment(courseID, programID, learningPathID, attempt, height = 600, width = 800, modal, title = " ", returnUrl) { 1605 //PLEASE MIND THE PARAMETER CASE 1606 //PLEASE GO TO ENTERCLASSROOM NOT VIEWCOURSE!!! 1607 var redirectURL = baseUrl + "Student/Course/EnterClassroom.aspx?CourseID=" + courseID + "&AssessmentID=" + courseID + "&ProgramID=" + programID + "&Attempt=" + attempt; 1608 if (learningPathID.length > 0) 1609 redirectURL += "&lpID=" + learningPathID; 1610
1611 //open the course in a new tab or a new window depending on how the user has the browser set 1612 if (modal === 'DefaultBrowserSettings') { 1613 courseid = courseID; 1614 if (bookmark.getBK('openAssessment') !== 'true') { 1615 if (assessmentWindow !== null) { 1616 assessmentWindow.location.href = redirectURL; 1617 } else { 1618 assessmentWindow = window.open(redirectURL, 'Test'); 1619 newwindow = assessmentWindow; 1620 bookmark.setBK('openAssessment', true); 1621 } 1622 } 1623 } 1624 else if (modal === 'ModalWindow') { 1625 const modalHtml = `<div class="modal fade course" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-modalid="launch-assesment-modal"> 1626 <div class="modal-dialog ${isMobile.iOS() ? 'modal-fullheight modal-fullscreen' : 'modal-fullheight modal-lg'}"> 1627 <div class="modal-content"> 1628 <div class="modal-header"> 1629 <h4 class="modal-title">${title}</h4> 1630 <button type="button" class="${isMobile.iOS() ? 'btn btn-default ms-auto' : 'btn-close'}" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close">${isMobile.iOS() ? Nomenclature.translate('Close') : ''}</button> 1631 </div> 1632 <div class="modal-body"> 1633 <iframe id="viewCourseModal" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewCourse" frameborder="0"></iframe> 1634 </div> 1635 </div> 1636 </div> 1637 </div>`; 1638 1639 $("body").append(modalHtml); 1640 1641 $('#myModal').modal('show', { show: true, keyboard: false }); 1642 if (isMobile.iOS()) { 1643 $('.modal.course iframe').css('height', '100%'); 1644 } else { 1645 $('.modal.course iframe').css('height', height); 1646 } 1647 if (browser_type.indexOf('Fire') >= 0) 1648 setTimeout(function () { $('#myModal').removeClass('in'); $('#myModal').removeClass('fade'); $('#myModal .modal-body').css('padding', '0px'); }, 1000); 1649 $('.modal.course iframe').css('display', 'none'); 1650 $('.modal.course iframe').css('margin', '0 auto'); 1651 $('.modal.course iframe').wrap('<div class="coursemodule" style="height:100%;"></div>'); 1652 1653 $("#viewCourseModal").attr('src', redirectURL); 1654 $('.modal.course iframe').css('display', 'block'); 1655 $('#myModal').unbind('click'); 1656 $('.modal-header .btn-close').on('click', function () { 1657 var w = $(".modal.course iframe")[0].contentWindow; 1658 try { 1659 w.config.modalclose = true; 1660 // w.config.finished = true; 1661 try { 1662 w.API.LMSFinish(); 1663 } catch (e) { 1664 try { 1665 w.API.Terminate(); 1666 } catch (e) { 1667 } 1668 } 1669 } catch (e) { } 1670 1671 $("#viewCourseModal").attr('src', ''); 1672 $('#myModal').modal('hide'); 1673 // $('#myModal').delay(5500).remove(); 1674 1675 //this causes problems when you Enroll (enroll.aspx) , then go to list of courses,enter course then close it.It goes back to enroll in course.I have removed history back 1676 setTimeout(function () { 1677 $('#myModal').remove(); 1678 if (returnUrl && returnUrl.length > 0) 1679 window.location.href = returnUrl; 1680 1681 }, 1000);//parent.history.back(); 1682 1683 }); 1684 1685 /* $('#myModal').on('click', function () { 1686 var w = $("iframe")[0].contentWindow; 1687 w.config.finished = true; 1688 try { 1689 w.API.LMSFinish(); 1690 } catch (e) { 1691 try { 1692 w.API.Terminate(); 1693 } catch (e) { 1694 } 1695 } 1696 1697 $('.modal.course iframe').attr('src', ''); 1698 window.location.href = window.location.href; 1699 });*/ 1700 1701 } 1702 else { 1703 courseid = courseID; 1704 //if (bookmark.getBK('openAssessment') !== 'true') { 1705 if (assessmentWindow !== null) { 1706 assessmentWindow = window.open(redirectURL, 'Test', 'fullscreen=ye
1706s,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1707 } else { 1708 assessmentWindow = window.open(redirectURL, 'Test', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1709 newwindow = assessmentWindow; 1710 setTimeout(function () { bookmark.setBK('openAssessment', true); }, 1000); 1711 1712 } 1713 // } else { 1714 // window.alert('You already have this test open in another window. Close the window to open the test.') 1715 // } 1716 setTimeout(function () { 1717 if (assessmentWindow) { 1718 assessmentWindow.onbeforeunload = function () { 1719 assessmentWindow = null; 1720 bookmark.clearBK('openAssessment'); 1721 } 1722 } 1723 }, 500); 1724 1725 1726 // newwindow = window.open(redirectURL, '_blank', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1727 interval = setInterval( 1728 function () { 1729 checkParentWindow(); 1730 }, 5000); 1731 } 1732 1733 return false; 1734} 1735 1736//enter classroom opener for new type of assessments 1737function launchEnterQuiz(courseID, programID, attempt, height = 600, width = 800, modal, title = " ", returnUrl) { 1738 //PLEASE MIND THE PARAMETER CASE 1739 //PLEASE GO TO ENTERCLASSROOM NOT VIEWCOURSE!!! 1740 var redirectURL = baseUrl + "Student/Course/ViewCourse.aspx?CourseID=" + courseID + "&AssessmentID=" + courseID + "&ProgramID=" + programID + "&Attempt=" + attempt; 1741 if (learningPathID.length > 0) 1742 redirectURL += "&lpID=" + learningPathID; 1743 1744 //open the course in a new tab or a new window depending on how the user has the browser set 1745 if (modal === 'DefaultBrowserSettings') { 1746 courseid = courseID; 1747 if (bookmark.getBK('openAssessment') !== 'true') { 1748 if (assessmentWindow !== null) { 1749 assessmentWindow.location.href = redirectURL; 1750 } else { 1751 assessmentWindow = window.open(redirectURL, 'Test'); 1752 newwindow = assessmentWindow; 1753 bookmark.setBK('openAssessment', true); 1754 } 1755 } 1756 } 1757 else if (modal === 'ModalWindow') { 1758 const modalHtml = `<div class="modal fade course" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-modalid="launch-quiz-modal"> 1759 <div class="modal-dialog ${isMobile.iOS() ? 'modal-fullheight modal-fullscreen' : 'modal-fullheight modal-lg'}"> 1760 <div class="modal-content"> 1761 <div class="modal-header"> 1762 <h4 class="modal-title">${title}</h4> 1763 <button type="button" class="${isMobile.iOS() ? 'btn btn-default ms-auto' : 'btn-close'}" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close">${isMobile.iOS() ? Nomenclature.translate('Close') : ''}</button> 1764 </div> 1765 <div class="modal-body"> 1766 <iframe id="viewCourseModal" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewCourse" frameborder="0"></iframe> 1767 </div> 1768 </div> 1769 </div> 1770 </div>`; 1771 1772 $("body").append(modalHtml); 1773 1774 $('#myModal').modal('show', { show: true, keyboard: false }); 1775 if (isMobile.iOS()) { 1776 $('.modal.course iframe').css('height', '100%'); 1777 } else { 1778 $('.modal.course iframe').css('height', height); 1779 } 1780 if (browser_type.indexOf('Fire') >= 0) 1781 setTimeout(function () { $('#myModal').removeClass('in'); $('#myModal').removeClass('fade'); $('#myModal .modal-body').css('padding', '0px'); }, 1000); 1782 $('.modal.course iframe').css('display', 'none'); 1783 $('.modal.course iframe').css('margin', '0 auto'); 1784 $('.modal.course iframe').wrap('<div class="coursemodule" style="height:100%;"></div>'); 1785 1786 $("#viewCourseModal").attr('src', redirectURL); 1787 $('.modal.course iframe').css('display', 'block');
1788 $('#myModal').unbind('click'); 1789 $('.modal-header .btn-close').on('click', function () { 1790 var w = $(".modal.course iframe")[0].contentWindow; 1791 try { 1792 w.config.modalclose = true; 1793 // w.config.finished = true; 1794 try { 1795 w.API.LMSFinish(); 1796 } catch (e) { 1797 try { 1798 w.API.Terminate(); 1799 } catch (e) { 1800 } 1801 } 1802 } catch (e) { } 1803 1804 $("#viewCourseModal").attr('src', ''); 1805 $('#myModal').modal('hide'); 1806 // $('#myModal').delay(5500).remove(); 1807 1808 //this causes problems when you Enroll (enroll.aspx) , then go to list of courses,enter course then close it.It goes back to enroll in course.I have removed history back 1809 setTimeout(function () { 1810 $('#myModal').remove(); 1811 if (returnUrl && returnUrl.length > 0) 1812 window.location.href = returnUrl; 1813 1814 }, 1000);//parent.history.back(); 1815 1816 }); 1817 1818 /* $('#myModal').on('click', function () { 1819 var w = $("iframe")[0].contentWindow; 1820 w.config.finished = true; 1821 try { 1822 w.API.LMSFinish(); 1823 } catch (e) { 1824 try { 1825 w.API.Terminate(); 1826 } catch (e) { 1827 } 1828 } 1829 1830 $('.modal.course iframe').attr('src', ''); 1831 window.location.href = window.location.href; 1832 });*/ 1833 1834 } 1835 else { 1836 courseid = courseID; 1837 //if (bookmark.getBK('openAssessment') !== 'true') { 1838 if (assessmentWindow !== null) { 1839 assessmentWindow = window.open(redirectURL, 'Test', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1840 } else { 1841 assessmentWindow = window.open(redirectURL, 'Test', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1842 newwindow = assessmentWindow; 1843 setTimeout(function () { bookmark.setBK('openAssessment', true); }, 1000); 1844 1845 } 1846 // } else { 1847 // window.alert('You already have this test open in another window. Close the window to open the test.') 1848 // } 1849 setTimeout(function () { 1850 if (assessmentWindow) { 1851 assessmentWindow.onbeforeunload = function () { 1852 assessmentWindow = null; 1853 bookmark.clearBK('openAssessment'); 1854 } 1855 } 1856 }, 500); 1857 1858 1859 // newwindow = window.open(redirectURL, '_blank', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 1860 interval = setInterval( 1861 function () { 1862 checkParentWindow(); 1863 }, 5000); 1864 } 1865 1866 return false; 1867} 1868 1869//redirect user to lp details page by clicking upon moreinfo 1870function moreInfoButtonRedirection(courseID, programID, DisclaimerProcessed) { 1871 $("#myModalDisc").modal('hide'); 1872 $("#myModalDisc").remove(); 1873 $("#myModal").modal('hide'); 1874 $("#myModal").remove(); 1875 1876 var url = window.location.href; 1877 var path = window.location.pathname; 1878 if (typeof (courseID) !== 'undefined' && courseID !== "") { 1879 switch (true) { 1880 case url.indexOf('MyLearningActivities.aspx') >= 0: 1881 { 1882 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1883 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + window.location.href; 1884 } 1885 else { 1886 url = baseUrl + 'Student/MyLearningActivities.aspx'; 1887 } 1888 } 1889 break; 1890 case url.indexOf('type=lp') >
1890= 0: url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; 1891 break; 1892 case url.indexOf('Catalogue') >= 0: 1893 { 1894 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1895 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; 1896 } 1897 else { 1898 url = window.location.href 1899 } 1900 } 1901 break; 1902 case url.indexOf('MyCourses.aspx') >= 0: 1903 { 1904 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1905 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; 1906 } 1907 else { 1908 url = baseUrl + 'Student/MyCourses.aspx'; 1909 } 1910 } 1911 break; 1912 default: if (redirectToDetailsPage !== 'undefined' && redirectToDetailsPage) url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; else url = window.location.href; url = url.replace('&start=true', ''); 1913 // default:url = window.location.href; url = url.replace('&start=true', ''); 1914 break; 1915 } 1916 } 1917 window.location.href = url; 1918} 1919 1920//redirect user to lp details page by clicking upon moreinfo 1921function moreInfoButtonRedirection(courseID, programID, DisclaimerProcessed) { 1922 $("#myModalDisc").modal('hide'); 1923 $("#myModalDisc").remove(); 1924 $("#myModal").modal('hide'); 1925 $("#myModal").remove(); 1926 1927 var url = window.location.href; 1928 var path = window.location.pathname; 1929 if (typeof (courseID) !== 'undefined' && courseID !== "") { 1930 switch (true) { 1931 case url.indexOf('MyLearningActivities.aspx') >= 0: 1932 { 1933 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1934 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + window.location.href; 1935 } 1936 else { 1937 url = baseUrl + 'Student/MyLearningActivities.aspx'; 1938 } 1939 } 1940 break; 1941 case url.indexOf('type=lp') >= 0: url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; 1942 break; 1943 case url.indexOf('Catalogue') >= 0: 1944 { 1945 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1946 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; 1947 } 1948 else { 1949 url = window.location.href 1950 } 1951 } 1952 break; 1953 case url.indexOf('MyCourses.aspx') >= 0: 1954 { 1955 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 1956 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; 1957 } 1958 else { 1959 url = baseUrl + 'Student/MyCourses.aspx'; 1960 } 1961 } 1962 break; 1963 default: if (redirectToDetailsPage !== 'undefined' && redirectToDetailsPage) url = baseUrl + 'Student/MyCourse.aspx?id='
1963+ courseID + '&ProgramID=' + programID + '&DisclaimerProcessed=' + DisclaimerProcessed + '&returnUrl=' + url; else url = window.location.href; url = url.replace('&start=true', ''); 1964 // default:url = window.location.href; url = url.replace('&start=true', ''); 1965 break; 1966 } 1967 } 1968 window.location.href = url; 1969} 1970 1971function closeModalCourse() { 1972 $('#myModal').trigger("click"); 1973} 1974 1975function exitCourse() { 1976 $('#myModal').trigger("click"); 1977} 1978 1979function checkParentWindow(url, courseid) { 1980 if (assessmentWindow) { 1981 if (assessmentWindow.closed) { 1982 bookmark.clearBK('openAssessment'); 1983 } 1984 } 1985 1986 if (newwindow) { 1987 if (!newwindow.closed) { 1988 1989 } else { 1990 if (typeof (ajaxTerminate) !== 'undefined') { 1991 try { 1992 ajaxTerminate("mycourse"); 1993 } catch (e) { } 1994 } 1995 clearInterval(interval); 1996 if (bookmark) { 1997 var xx = bookmark.setBK("challenge", "false"); 1998 } 1999 //reload the parent page when the course page closed 2000 //append the courseid to the parent page url for processing if completed 2001 2002 var reloadUrl = window.location.href; 2003 2004 if (typeof (isLP) === 'undefined' || !isLP) { 2005 if (typeof (url) === 'undefined' || url === false) { 2006 if (!url && typeof (courseid) !== 'undefined') { 2007 if (typeof (TC.Catalogue.settings) !== 'undefined') { 2008 if (typeof (TC.Catalogue.settings.RedirectToDetailsPage) !== 'undefined' && TC.Catalogue.settings.RedirectToDetailsPage) { 2009 window.location.href = 'Student/MyCourse.aspx?id=' + courseid; 2010 } else { 2011 window.location.href = reloadUrl; 2012 } 2013 } 2014 } else { 2015 let inlineFB = $('.Submitted-False.Feedback.Inline'); 2016 if (inlineFB.length > 0) { 2017 inlineFB.trigger('click'); 2018 } else { 2019 window.location.href = url; 2020 } 2021 } 2022 2023 } 2024 else { 2025 if (typeof (TC.Catalogue) !== 'undefined' && typeof (TC.Catalogue.settings) !== 'undefined') { 2026 if (TC.Catalogue.settings.RedirectToDetailsPage) 2027 window.location.href = 'Student/MyCourse.aspx?id=' + courseid; 2028 else 2029 window.location = reloadUrl; 2030 } else { 2031 let inlineFB = $('.Submitted-False.Feedback.Inline'); 2032 if (inlineFB.length > 0) { 2033 inlineFB.trigger('click'); 2034 } else { 2035 window.location.href = url; 2036 } 2037 2038 2039 } 2040 } 2041 2042 } else { 2043 console.log('navigation.js::checkParentWindow() - call TC.checkLPStatus()'); 2044 TC.checkLPStatus(); 2045 CheckClosedCourseStatus(); 2046 } 2047 } 2048 } 2049} 2050 2051var CheckClosedCourseStatus = function () { 2052 $.ajax({
2053 url: baseUrl + "Student/GetUserFeedbackRequired.ashx", 2054 dataType: "text", 2055 async: false, 2056 cache: false, 2057 data: { "id": courseid } 2058 }).done(function (data) { 2059 if (data == 'true') { 2060 if (browser_type.indexOf("Chrome") > -1) { 2061 window.open(baseUrl + 'Student/CourseFeedback.aspx?CourseID=' + courseid, 'courseFeedback', 'width=1284,height=600,location=0,toolbar=yes,scrollbars=yes,resizable=yes,status=0,menubar=0'); 2062 } else { 2063 window.open(baseUrl + 'Student/CourseFeedback.aspx?CourseID=' + courseid, 'courseFeedback', 'width=1284,height=600,location=0,toolbar=1,scrollbars=1,resizable=1,status=0,menubar=0'); 2064 } 2065 } 2066 }); 2067} 2068 2069//used in xsl\browse_courses.xsl, template match="Course" mode="Search" ?? is that one used or we can remove it 2070function launchEnterClassrooomFromRoot(courseID, programID, height, width) { 2071 url = "Student/Course/EnterClassroom.aspx?CourseID=" + courseID + "&ProgramID=" + programID; 2072 2073 if (newwindow !== null) { 2074 newwindow.location.href = url; 2075 } else { 2076 newwindow = window.open(url, 'CourseWindow', 'fullscreen=yes,scrollbars=1,width=' + width + ',height=' + height); 2077 } 2078 2079 interval = setInterval("checkParentWindow()", 5000); 2080 return false; 2081} 2082 2083function launchEnterClassrooomLP(courseID, programID, learningPathID, height, width) { 2084 var agt = navigator.userAgent.toLowerCase(); 2085 if (agt.indexOf('gecko') != -1) { 2086 url = "Student/Course/EnterClassroom.aspx?CourseID=" + courseID + "&ProgramID=" + programID + "&lpID=" + learningPathID; 2087 } 2088 else if (agt.indexOf('msie') != -1) { 2089 url = "../Student/Course/EnterClassroom.aspx?CourseID=" + courseID + "&ProgramID=" + programID + "&lpID=" + learningPathID; 2090 } 2091 //alert(url); 2092 if (newwindow !== null) { 2093 newwindow.location.href = url; 2094 } else { 2095 newwindow = window.open(url, 'CourseWindow', 'fullscreen=yes,scrollbars=1,width=' + width + ',height=' + height); 2096 2097 } 2098 interval = setInterval("checkParentWindow()", 5000); 2099 return false; 2100} 2101 2102//popup ViewSample for a course 2103var sampleWindow = null; 2104function launchCourseSample(baseURL, courseID) { 2105 url = baseURL + "Student/Sample/ViewSample.aspx?CourseID=" + courseID; 2106 //alert(url); 2107 if (sampleWindow !== null) { 2108 sampleWindow.location.href = url; 2109 } else { 2110 sampleWindow = window.open(url, 'CourseWindow', 'fullscreen=yes,scrollbars=1'); 2111 } 2112 setTimeout(function () { 2113 if (sampleWindow) { 2114 sampleWindow.onbeforeunload = function () { 2115 sampleWindow = null; 2116 //bookmark.clearBK('openAssessment'); 2117 } 2118 } 2119 }, 500); 2120 return false; 2121} 2122 2123//popup ViewSample for a course 2124var previewWindow = null; 2125function launchCoursePreview(baseURL, courseID) { 2126 2127 var height = 600; 2128 var width = 800; 2129 2130 2131 url = baseURL + "Student/Preview/ViewCourse.aspx?CourseID=" + courseID; 2132 //alert(url); 2133 if (previewWindow !== null) { 2134 previewWindow.location.href = url; 2135 } else { 2136 previewWindow = window.open(url, 'CourseWindow', 'fullscreen=yes,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 2137 } 2138 2139 setTimeout(function () { 2140 if (previewWindow) { 2141 previewWindow.onbeforeunload = function () { 2142 previewWindow = null; 2143 //bookmark.clearBK('openAssessment'); 2144 } 2145 } 2146 }, 500); 2147 2148 return false; 2149} 2150 2151//popup survey directly from open, use this for anon survey 2152var surveyWindow = null; 2153function launchSurvey(baseURL, courseID, programID) { 2154 2155 var height = 600; 2156 var width = 800; 2157 2158 2159 url = baseURL + "Student/CourseFeedback.aspx?CourseID=" + courseID + "&ProgramID=" + programID + "&modal=true"; 2160 //alert(url); 2161 if (surveyWindow !== null) { 2162 surveyWindow.location.href = url; 2163 } else { 2164 surveyWindow = window.open(url, 'CourseWindow', 'fullscreen=ye
2164s,scrollbars=1,width=' + width + 'px,height=' + height + 'px,resizable=1'); 2165 } 2166 2167 setTimeout(function () { 2168 if (surveyWindow) { 2169 surveyWindow.onbeforeunload = function () { 2170 surveyWindow = null; 2171 //bookmark.clearBK('openAssessment'); 2172 } 2173 } 2174 }, 500); 2175 2176 return false; 2177} 2178 2179//Smarandita;please change and/or move it where appropriate 2180function getWorkbookList() { 2181 if (API) { 2182 workbook_list = API.GetValue("cmi.workbooks._list"); 2183 } 2184}; 2185 2186//preview courses shared by a rule into the domain 2187function openPreview(ruleID) { 2188 2189 var url = 'Admin/PreviewMatchingCourses.aspx?RuleID=' + ruleID; 2190 var panelhtml = "<iframe id='previewContentFrame' class='contentFrame' style='height:100%;width:100%' frameborder='0' src='" + url + "' />"; 2191 2192 const modal = `<div class="modal fade out" id="AdminActionModal" data-modalid="openPreview-modal" tabindex="-1" role="dialog" aria-labelledby="AdminActionModalLabel" aria-hidden="false"> 2193 <div class="modal-dialog modal-fullheight modal-lg"> 2194 <div class="modal-content"> 2195 <div class="modal-header"> 2196 <h4 class="modal-title" id="PreviewRule" translate="true">Preview</h4> 2197 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 2198 </div> 2199 <div class="modal-body spinner" id="AdminActionModalBody"> 2200 ${panelhtml} 2201 </div> 2202 </div> 2203 </div> 2204 </div>`; 2205 $('body').append(modal); 2206 $(modal).modal('show'); 2207 return false; 2208} 2209 2210function openPreviewCategoryRule(ruleID, categoryID, domainID) { 2211 2212 var url = 'Admin/Catalogue/CategoryMatchingCourses.aspx?modal=true&ruleID=' + ruleID + '&programID=' + domainID + '&id=' + categoryID; 2213 var panelhtml = "<iframe id='previewContentFrame' class='contentFrame' style='height:100%;width:100%' frameborder='0' src='" + url + "' />"; 2214 var modal = '<div class="modal fade out" id="AdminActionModal" data-modalid="openPreviewCategoryRule-modal" tabindex="-1" role="dialog" aria-labelledby="AdminActionModalLabel" aria-hidden="false">' + 2215 '<div class="modal-dialog" style="width:95%;height:80%;">' + 2216 '<div class="modal-content" style="width:100%;height:100%;">' + 2217 '<div class="modal-header">' + 2218 '<a class="pull-right close-fa" data-dismiss="modal" data-bs-dismiss="modal">' + 2219 '<i class="fa fa-times-circle"></i>' + 2220 '<span class="sr-only">Close</span>' + 2221 '</a>' + 2222 '<h4 class="modal-title" id="PreviewRule" translate="true">Preview</h4>' + 2223 '</div>' + 2224 '<div class="modal-body spinner" id="AdminActionModalBody" style="width:100%;height:90%;">' + 2225 panelhtml + 2226 '</div>' + 2227 '<div class="modal-footer">' + 2228 '</div>' + 2229 '</div>' + 2230 '</div>' + 2231 '</div>'; 2232 $('body').append(modal); 2233 $(modal).modal('show'); 2234 return false; 2235} 2236 2237function openPreviewUsers(ruleID, type, programID) { 2238 var url = 'ProgramMgr/PreviewMatchingUsers.aspx?RuleID=' + ruleID + '&RuleType=' + type + '&ProgramID=' + programID; 2239 2240 2241 $("body").append('<div class="modal fade course" data-modalid="openPreviewUsers-modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog" style="height:700px!important; width:700px!important;"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">Preview Rule Users</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><iframe id="previewContentFrame" class="contentFrame" style="height:700px!important; width:650px!important;" frameborder="0" src="' + url + '" /></div></div></div></div>'); 2242 $('#myModal').modal('show', { show: true, keyboard: false }); 2243 //$('.modal.course iframe').css('height', '700px'); 2244 $('.modal.course iframe').css('display', 'block'); 2245 $('.modal-header .btn-close').on('click', function () { 2246 var w = $(".modal.course iframe")[0].contentWindow;
2247 $('#myModal').modal('hide'); 2248 setTimeout(function () { $('#myModal').remove(); }, 1000) 2249 }); 2250 return false; 2251} 2252 2253function openPreviewGroupRulesUsers(courseID, programID, matchAll, groupID) { 2254 2255 var url = 'ProgramMgr/PreviewMatchingUsers.aspx?CourseID=' + courseID + '&ProgramID=' + programID + '&all=' + matchAll + '&groupID=' + groupID; 2256 2257 if ($('#myModal1').length) { 2258 $('#previewContentFrame').prop('src', 'about:blank');//to prevent seeing the previous loaded data when closing and opening again with a different url 2259 $('#myModal1 .modal-body').removeClass('off'); 2260 // 2261 setTimeout(function () { 2262 $('#previewContentFrame').prop('src', url); 2263 //var onclick = "openHelpModalFooter(\'url\'); return false;"; 2264 //$('#myModal1 .modal-footer #helpLink').prop('onclick', onclick); 2265 }, 100); 2266 } 2267 else 2268 $("body").append('<div class="modal fade course" data-modalid="openPreviewGroupRulesUsers-modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog" style="height:700px!important; width:700px!important;"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">Preview Rule Users</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><iframe id="previewContentFrame" class="contentFrame" style="height:700px!important; width:650px!important;" frameborder="0" src="' + url + '" /></div></div></div></div>'); 2269 $('#myModal1').modal('show', { show: true, keyboard: false }); 2270 $('#previewContentFrame').load(function () { 2271 if ($(this).contents()[0].URL.indexOf('blank') < 0) { 2272 $('#myModal1 .modal-body').addClass('off'); 2273 } 2274 }); 2275 //$('.modal.course iframe').css('height', '700px'); 2276 $('.modal.course iframe').css('display', 'block'); 2277 return false; 2278} 2279 2280function openPreviewRuleUsers(fieldID, fieldValue, programID) { 2281 2282 2283 var url = 'ProgramMgr/PreviewMatchingUsers.aspx?FieldID=' + fieldID + '&FieldValues=' + encodeURIComponent(fieldValue) + '&ProgramID=' + programID; 2284 var Exporturl = 'ProgramMgr/PreviewMatchingUsersExport.aspx?FieldID=' + fieldID + '&FieldValues=' + encodeURIComponent(fieldValue) + '&ProgramID=' + programID; 2285 2286 2287 $("body").append('<div class="modal fade course" data-modalid="openPreviewRuleUsers-modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">' + 2288 '<div class="modal-dialog modal-lg modal-fullheight">' + 2289 ' <div class="modal-content">' + 2290 ' <div class="modal-header">' + 2291 ' <h4 class="modal-title">Preview Rule Users</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' + 2292 ' </div>' + 2293 ' <div class="modal-body">' + 2294 ' <iframe id="previewContentFrame" class="contentFrame" height="100%" width="100%" frameborder="0" src="' + url + '" />' + 2295 ' </div>' + 2296 ' <div>' + 2297 ' <input type="button" value="Export" style="width:60px;color: rgb(255, 255, 255); background-color: rgb(83, 163, 198); border-color: rgb(83, 163, 198); margin: 2px 0px; border: 1px solid transparent;border-radius: 4px;" class="export" onclick="window.open(\'' + baseUrl + '/' + Exporturl + '&export=true\')" />' + 2298 ' </div>' + 2299 ' </div>' + 2300 '</div>' + 2301 '</div>'); 2302 $('#myModal').modal('show', { show: true, keyboard: false }); 2303 //$('.modal.course iframe').css('height', '700px'); 2304 $('.modal.course iframe').css('display', 'block'); 2305 $('.modal-header .btn-close').on('click', function () { 2306 var w = $(".modal.course iframe")[0].contentWindow; 2307 $('#myModal').modal('hide'); 2308 setTimeout(function () { $('#myModal').remove(); }, 1000) 2309 }); 2310 return false; 2311} 2312 2313function openPreviewAllRulesUsers(courseID, programID, tabID, matchAll) { 2314 2315 var url = 'ProgramMgr/PreviewMatchingUsers.aspx?CourseID=' + courseID + '&ProgramID=' + programID + '&TabID=' + tabID + '&all=' + matchAll; 2316 2317 if ($('#myModal1').length) { 2318 $('#previewContentFrame').prop('src', 'about:blank');//to prevent seeing the previous loaded data when closing and opening again with a different url
2319 $('#myModal1 .modal-body').removeClass('off'); 2320 // 2321 setTimeout(function () { 2322 $('#previewContentFrame').prop('src', url); 2323 //var onclick = "openHelpModalFooter(\'url\'); return false;"; 2324 //$('#myModal1 .modal-footer #helpLink').prop('onclick', onclick); 2325 }, 100); 2326 } 2327 else 2328 $("body").append('<div class="modal fade course" data-modalid="openPreviewAllRulesUsers-modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog" style="height:700px!important; width:700px!important;"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">Preview Rule Users</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><iframe id="previewContentFrame" class="contentFrame" style="height:700px!important; width:650px!important;" frameborder="0" src="' + url + '" /></div></div></div></div>'); 2329 $('#myModal1').modal('show', { show: true, keyboard: false }); 2330 $('#previewContentFrame').load(function () { 2331 if ($(this).contents()[0].URL.indexOf('blank') < 0) { 2332 $('#myModal1 .modal-body').addClass('off'); 2333 } 2334 }); 2335 //$('.modal.course iframe').css('height', '700px'); 2336 $('.modal.course iframe').css('display', 'block'); 2337 return false; 2338} 2339 2340//it is not used for now S.P. 2341function openPreviewAllAnnouncementRulesUsers(courseID, programID, matchAll, matchExcludeAll) { 2342 var url = 'ProgramMgr/PreviewMatchingUsers.aspx?CourseID=' + courseID + '&ProgramID=' + programID + '&TabID=' + tabID + '&all=' + matchAll; 2343 2344 if ($('#myModal1').length) { 2345 $('#previewContentFrame').prop('src', 'about:blank');//to prevent seeing the previous loaded data when closing and opening again with a different url 2346 $('#myModal1 .modal-body').removeClass('off'); 2347 // 2348 setTimeout(function () { 2349 $('#previewContentFrame').prop('src', url); 2350 //var onclick = "openHelpModalFooter(\'url\'); return false;"; 2351 //$('#myModal1 .modal-footer #helpLink').prop('onclick', onclick); 2352 }, 100); 2353 } 2354 else 2355 $("body").append('<div class="modal fade course" data-modalid="openPreviewAllAnnouncementRulesUsers-modal" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog" style="height:700px!important; width:700px!important;"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">Preview Rule Users</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><iframe id="previewContentFrame" class="contentFrame" style="height:700px!important; width:650px!important;" frameborder="0" src="' + url + '" /></div></div></div></div>'); 2356 $('#myModal1').modal('show', { show: true, keyboard: false }); 2357 $('#previewContentFrame').load(function () { 2358 if ($(this).contents()[0].URL.indexOf('blank') < 0) { 2359 $('#myModal1 .modal-body').addClass('off'); 2360 } 2361 }); 2362 //$('.modal.course iframe').css('height', '700px'); 2363 $('.modal.course iframe').css('display', 'block'); 2364 return false; 2365} 2366 2367function openPreviewMembershipRuleUsers(fieldsValues, ruleDomainID, ruleParentDomainID) { 2368 const url = 'ProgramMgr/PreviewMatchingMembershipUsers.aspx?vals=' + encodeURIComponent(fieldsValues) + '&rdid=' + ruleDomainID + '&did=' + programID; 2369 2370 $("body").append(`<div class="modal fade course" data-modalid="openPreviewMembershipRuleUsers-modal" id="myModal" tabindex="-1" role="dialog" > 2371 <div class="modal-dialog modal-fullheight modal-lg"> 2372 <div class="modal-content"> 2373 <div class="modal-header"> 2374 <h4 class="modal-title">${Nomenclature.translate('Preview Rule Users')}</h4> 2375 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 2376 </div> 2377 <div class="modal-body">
2378 <iframe id="previewContentFrame" class="contentFrame" frameborder="0" src="${url}" /> 2379 </div> 2380 <div> 2381 <button type="button" class="export"> 2382 <span aria-hidden="true">${Nomenclature.translate('Export')}</span> 2383 </button> 2384 </div> 2385 </div> 2386 </div> 2387 </div>`); 2388 $('#myModal').modal('show', { show: true, keyboard: false }).on('hidden.bs.modal', function () { 2389 $(this).remove(); 2390 }); 2391 2392 return false; 2393}; 2394 2395var updateCohort = function (el) { 2396 if ($(el).find(":selected").val()) { 2397 LMS.cohortSelected = $(el).find(":selected").val(); 2398 2399 const $parent = $(el).parent(); 2400 const $allButtons = $parent.find('.btn.cohort.details, .btn.cohort.fast-start, .btn.enrol-disabled'); 2401 2402 if (LMS.cohortSelected !== "") { 2403 $allButtons.prop('disabled', false).removeClass('disabled btn-disabled'); 2404 } else { 2405 $allButtons.prop('disabled', true).addClass('disabled'); 2406 $parent.find('.btn.enrol-disabled').addClass('btn-disabled'); 2407 }; 2408 }; 2409};
2410 2411var buildCohorts = function (courseID) { 2412 var dd = $('#cohortDD_' + courseID + ' option'); 2413 var cohorts = [] 2414 2415 $.each(dd, function () { 2416 cohorts.push({ CohortID: this.id, CohortName: $(this).text() }); 2417 }); 2418 return cohorts; 2419}; 2420 2421// called from catalogue 2422var OpenExpressStart = function (baseurl, courseID, programID, title, type, el, enrolled, mapid, disclaimer, fullscreen) { 2423 2424 if (typeof (isLP) !== 'undefined' && isLP) { 2425 let actPanel = $('#activitypanel_' + courseID); 2426 if (actPanel.length > 0) { 2427 let objPanel = (actPanel.closest('.activity-group').length > 0) ? actPanel.closest('.activity-group').data().activitygroupid 2428 : (actPanel.closest('.active.in').length > 0) ? actPanel.closest('.active.in').data().activitygroupid : ''; 2429 2430 if (objPanel !== '') 2431 location.hash = objPanel; 2432 } 2433 } 2434 2435 let fromDisclaimer = (typeof (disclaimer) !== 'undefined') ? disclaimer : false; 2436 let certificationAttempt = (typeof (el) !== 'undefined' && el !== null && $(el).length > 0 && typeof ($(el).data().attempt) !== 'undefined') ? $(el).data().attempt : 0; 2437 if (typeof (el) !== 'undefined' && el) { 2438 var cog = $(el).find('i'); 2439 if (cog.length > 0) 2440 cog.remove(); 2441 } 2442 if (typeof (enrolled) !== 'undefined' && enrolled !== true && enrolled !== 'True' && $(el).hasClass('cohort')) { 2443 if (!$(el).hasClass('disabled') && !$(el).hasClass('details')) { 2444 $('#cohortModal').remove(); 2445 LMS.cohortSelected = null; 2446 if ($('#cohortDD_' + courseID + ' option').length > 0) { 2447 var cohorts = buildCohorts(courseID); 2448 } else { 2449 var cohorts = ($(el).data('cohorts').cohorts) ? $(el).data('cohorts').cohorts : null; 2450 } 2451 2452 if (cohorts !== null && cohorts.length > 0) { 2453 const cohortDD = $('<select class="cohort form-select"></select>'); 2454 var optionNone = $(`<option id="" value="">${Nomenclature.translate('Please Select Cohort')}</option>`); 2455 cohortDD.append(optionNone); 2456 $.each(cohorts, function () { 2457 var option = $('<option id="' + this.CohortID + '" value="' + this.CohortID + '">' + this.CohortName + '</option>'); 2458 cohortDD.append(option); 2459 $('button.cohort').removeClass('disabled'); 2460 }) 2461 cohortDD.on('change', function () { 2462 LMS.cohortSelected = $(this).find(":selected").val(); 2463 console.log(LMS.cohortSelected); 2464 }); 2465 2466 $("body").append(`<div class="modal fade course" id="cohortModal" tabindex="-1" role="dialog"> 2467 <div class="modal-dialog modal-dialog-centered modal-lg"> 2468 <div class="modal-content"> 2469 <div class="modal-header"> 2470 <h4 class="modal-title">${title || 'Cohort'}</h4> 2471 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 2472 </div> 2473 <div class="modal-body"> 2474 <div style="margin:10px;"> 2475 <div class="form-group mb-3"> 2476 <label for="cohort" class="form-label">${Nomenclature.translate('Select a cohort')}:</label> 2477 ${cohortDD[0].outerHTML} 2478 </div> 2479 2480 <button type="button" class="btn btn-default cohort" id="cohortModalStartBtn">${Nomenclature.translate('Start')}</button> 2481 </div> 2482 </div> 2483 </div> 2484 </div> 2485 </div>`); 2486 2487 2488 const btn = $('#cohortModal #cohortModalStartBtn'); 2489 btn.on('click', function () { 2490 if (LMS.cohortSelected !== null && LMS.cohortSelected !== "") { 2491 cohortEnroll(courseID, programID, type, LMS.cohortSelected, title, el, null, null, fullscreen); 2492 $('#cohortModal').modal('hide'); 2493 return false; 2494 }; 2495 }); 2496 2497 $('#cohortModal').modal('show'); 2498 } 2499 } else { 2500 if (!$(el).hasClass('disabled') && $(el).hasClass('details')) 2501 cohortEnroll(courseID, programID, type, LMS.cohortSelected, title, el, null, null, fullscreen); 2502 return false; 2503 } 2504 } else { 2505 if ($(el).length > 0) 2506 $(el).prepend('<i id="loaderIcon" class="fa fa-gear fa-spin" style="margin-right:5px;"></i>'); 2507 setTimeout(function () { 2508 cohortEnroll(courseID, programID, type, null, title, el, mapid, fromDisclaimer, fullscreen); 2509 }, 800); 2510 2511 return false; 2512 } 2513 // 2514 return false; 2515} 2516 2517//clicked on the enrollment or purchase button for an item in the catalog; returns the options available for the user 2518var cohortEnroll = function (courseID, programID, type, cohortID, title, el, mapid, disclaimer, fullscreen) {
2519 let certificationAttempt = (typeof (el) !== 'undefined' && el !== null && $(el).length > 0 && typeof ($(el).data().attempt) !== 'undefined') ? $(el).data().attempt : 0; 2520 2521 if (typeof (el) !== 'undefined' && el) { 2522 var cog = $(el).find('.fa-gear'); 2523 } else { 2524 var cog = null; 2525 } 2526 // 2527 if (cohortID === null) { 2528 cohortID = LMS.cohortSelected; 2529 } 2530 // 2531 var inLP = (typeof (mapid) !== 'undefined' && mapid) ? mapid : ''; 2532 $.ajax({//check if the user is enrolled; if not, how the user can enroll 2533 url: baseUrl + "Student/Course/DoExpressStart.ashx", 2534 dataType: "json", 2535 async: false, 2536 button: cog, 2537 cache: false, 2538 mapid: inLP, 2539 data: { 2540 "CourseID": courseID, 2541 "ProgramID": programID, 2542 "Type": type, 2543 "mapID": inLP, 2544 "CohortID": cohortID, 2545 op: "checkexpressstartaction", 2546 disclaimer: disclaimer 2547 }, 2548 error: function (data, text, error) { 2549 console.log('data', data, 'text', text); 2550 // 2551 if (this.button !== null) { 2552 this.button.removeClass('fa-spin'); 2553 this.button.removeClass('fa-gear'); 2554 this.button.addClass('fa-exclamation-circle'); 2555 } 2556 // 2557 showError(text); 2558 } 2559 }).done(function (data) { 2560 if (this.button !== null) 2561 this.button.remove(); 2562 if (data) { 2563 var response = data;//eval("[" + data + "]")[0]; 2564 var s = response.success; 2565 var m = response.message; 2566 if (s == false || s == "false") { 2567 launchExpressStartReason(m, title); 2568 } 2569 else { 2570 var a = response.action; 2571 var h = response.height; 2572 var w = response.width; 2573 var openin = response.modal; 2574 var fullscreen = (typeof (response.openInScreenSize) !== 'undefined' && response.openInScreenSize == 'True') ? 'True' : 'False'; 2575 if (a === 'enterWDisclaimer') { 2576 // call this 2577 //openModal = function (baseurl, courseID, programID, title, fastaction, entermode, backbtn, type, returnUrl, activityCount, buttonType) 2578 openModal(baseUrl, courseID, programID, '', true, '', '', type, '', this.mapid, ''); 2579 } 2580 if (a == "enter") { 2581 //launchEnterClassrooomLP(courseID, programID, learningPathID, height, width) 2582 if (this.mapid) { 2583 launchEnterClassrooom(courseID, programID, this.mapid, certificationAttempt, h, w, openin, title, '', '', fullscreen) 2584 // launchEnterClassrooomLP(courseID, programID, this.mapid, '1', h, w, openin, title); 2585 } else { 2586 launchEnterClassrooom(courseID, programID, '', certificationAttempt, h, w, openin, title, '', '', fullscreen); 2587 } 2588 } 2589 if (a == "enterActivity") { 2590 launchEnterActivity(courseID, programID, '', certificationAttempt, title, type); 2591 } 2592 else if (a == "goto") { 2593 let u; 2594 2595 let from = (inLP) ? `&from=${$('html').data().pagetitle}|${inLP}` : ''; 2596 let last = getParameterByName('lastPageTitle'); 2597 if (inLP) { 2598 // in a learning path 2599 last = (last !== '') ? `&lastPageTitle=${last}` : ''; 2600 } else { 2601 last = `&lastPageTitle=${$('html').data().pagetitle}|${$('html').data().pageid}`; 2602 } 2603 if (response.url.toLowerCase().indexOf('login') < 0) { 2604 u = response.url + '&returnUrl=' + encodeURIComponent(location.href.split('&returnUrl')[0]) + from + last; 2605 } else { 2606 u = response.url + from; 2607 } 2608 if (typeof (disclaimer) !== 'undefined' && disclaimer === true) { 2609 window.location = u + '&DisclaimerProcessed=true'; 2610 } else { 2611 window.location = u; 2612 } 2613 2614 } 2615 else if (a == "buy") {//user can purchase the course, add to shopping cart if external or send to the shopping cart page if using the LMS shopping cart 2616 if (response.url.indexOf('.ashx') >
2616= 0) //external cart 2617 purchaseExternal(response.url, title, response.price, response.marqueeElement, response.cartURL); 2618 else 2619 window.location = response.url;//internal shopping cart 2620 } 2621 else if (a == "token") {//user can redeem a course token, ask for the token 2622 if (!$("#tokenModal").length) { 2623 $("body").append(`<div class="modal fade course" id="tokenModal" tabindex="-1" role="dialog"> 2624 <div class="modal-dialog modal-dialog-centered"> 2625 <div class="modal-content"> 2626 <div class="modal-header"> 2627 <h4 class="modal-title">${title || Nomenclature.translate('Redeem')}</h4> 2628 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 2629 </div> 2630 <div class="modal-body"> 2631 <div class="token-container" style="margin: 10px;"> 2632 <div class="form-group mb-3"> 2633 <label for="token" class="form-label"> 2634 ${Nomenclature.translate('Enter Token')}: 2635 </label> 2636 <input class="form-control" type="text" id="token" /> 2637 </div> 2638 <button type="button" class="btn btn-default tokenModal-submit-btn cohort"> 2639 ${Nomenclature.translate('Submit')} 2640 </button> 2641 </div> 2642 </div> 2643 </div> 2644 </div> 2645 </div>`); 2646 2647 $("#tokenModal").on('hidden.bs.modal', function () { 2648 $('#activityReEnrollAlert #loaderIcon').parent().prop('disabled', false); 2649 $('#activityReEnrollAlert #loaderIcon').remove(); 2650 }); 2651 2652 var pageFastStart = "unknown"; 2653 if (typeof (TC.Catalogue) !== 'undefined' && typeof (TC.Catalogue.settings) !== 'undefined' && typeof (TC.Catalogue.settings.AllowFastStart) !== 'undefined') { 2654 if (!TC.Catalogue.settings.AllowFastStart) 2655 pageFastStart = "false"; 2656 } 2657 2658 //tokenContainer.append(cohortDD); 2659 const btn = $('#tokenModal .tokenModal-submit-btn'); 2660 var mapID = this.mapid; 2661 btn.on('click', function () { 2662 var tokenValue = $('#token').val().trim(); 2663 if (!tokenValue) { 2664 return; 2665 }; 2666 $.ajax({
2667 url: baseUrl + "Student/Course/DoExpressStart.ashx", 2668 dataType: "json", 2669 async: false, 2670 cache: false, 2671 data: { 2672 "CourseID": courseID, 2673 "ProgramID": programID, 2674 "Type": type, 2675 "mapID": mapID, 2676 "CohortID": cohortID, 2677 "PageFastStart": pageFastStart, 2678 token: tokenValue, 2679 op: "enrollwithtoken" 2680 }, 2681 error: function (jqXHR) { 2682 $('#tokenModal').modal('hide'); 2683 bootbox.alert('Failed to redeem the token! Error: ' + jqXHR.responseText); 2684 } 2685 }).done(function (data) { 2686 if (data && data.success) { 2687 $('#tokenModal').modal('hide'); 2688 if (data.action == "enter") { 2689 launchEnterClassrooom(courseID, programID, '', certificationAttempt, h, w, openin, title); 2690 } 2691 if (data.action == "enterActivity") { 2692 launchEnterActivity(courseID, programID, '', certificationAttempt, title, type); 2693 } 2694 else if (data.action == "goto") { 2695 window.location = data.url; 2696 } 2697 } 2698 else { 2699 bootbox.alert('Failed to redeem the token! Error: ' + data.message); 2700 } 2701 }); 2702 }); 2703 }; 2704 2705 $('#tokenModal').modal('show'); 2706 } 2707 else if (a == "globalTokens") {//user can redeem global tokens, show the confirmation dialog; redeem tokens and enter course if confirmed 2708 //var globalTokensValue = response.globalTokensValue; 2709 var mapID = this.mapid; 2710 bootbox.confirm(m, function (result) { 2711 //console.log('This was logged in the callback: ' + result); 2712 if (result === true) { 2713 $.ajax({
2714 url: baseUrl + "Student/Course/DoExpressStart.ashx", 2715 dataType: "json", 2716 async: false, 2717 cache: false, 2718 data: { 2719 "CourseID": courseID, 2720 "ProgramID": programID, 2721 "Type": type, 2722 "mapID": mapID, 2723 "CohortID": cohortID, 2724 op: "enrollwithglobaltokens" 2725 }, 2726 error: function (jqXHR) { 2727 bootbox.alert('Failed to redeem the global tokens! Error: ' + jqXHR.responseText); 2728 } 2729 }).done(function (data) { 2730 if (data && data.success) { 2731 if (data.action == "enter") { 2732 launchEnterClassrooom(courseID, programID, '', '0', h, w, openin, title); 2733 } 2734 if (data.action == "enterActivity") { 2735 launchEnterActivity(courseID, programID, '', '0', title, type); 2736 } 2737 else if (data.action == "goto") { 2738 window.location = data.url; 2739 } 2740 } 2741 else { 2742 bootbox.alert('Failed to redeem the global tokens! Error: ' + data.message); 2743 } 2744 }); 2745 } 2746 }); 2747 } 2748 else if (a == "couponOnly") {//user can redeem a 100 % coupon only , ask for the coupon 2749 if ($("#couponModal").length > 0) { 2750 $("#couponModal").remove(); 2751 } 2752 if ($("#couponModal").length == 0) { 2753 var couponModal = $('<div class="modal fade course" id="couponModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">' + 2754 '<div class="modal-dialog" style="margin-top:auto!important;height:300px!important; width:500px!important;">' + 2755 '<div class="modal-content">' + 2756 '<div class="modal-header" style="height:45px;">' + 2757 2758 '<h4 class="modal-title">' + title + '</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' + 2759 '</div>' + 2760 '<div class="modal-body">' + 2761 '</div>' + 2762 '</div>' + 2763 '</div>' + 2764 '</div>'); 2765 // 2766 $("body").append(couponModal); 2767 //
2768 var couponContainer = $('<div style="width:400px;margin:50px auto;"></div>'); 2769 couponContainer.append('<label>Enter Coupon:</label><input type = "text" id="coupon" value=""></input>'); 2770 //tokenContainer.append(cohortDD); 2771 var btn = $('<button type="button" style="btn btn-default disabled cohort">Submit</button>'); 2772 var lpid = this.mapid; 2773 btn.on('click', function () { 2774 var couponValue = $('#coupon').val(); 2775 $.ajax({ 2776 url: baseUrl + "Student/eCommerce/ValidateCoupon.ashx", 2777 dataType: "json", 2778 async: false, 2779 cache: false, 2780 data: { 2781 "courseID": courseID, 2782 "domainID": programID, 2783 "Type": type, 2784 "mapID": lpid, 2785 "CohortID": cohortID, 2786 coupon: couponValue, 2787 op: "RedeemFullCouponCodeEnroll" 2788 }, 2789 error: function (jqXHR) { 2790 $('#couponModal').modal('hide'); 2791 bootbox.alert('Failed to redeem the coupon! Error: ' + jqXHR.responseText); 2792 $(`.panel[data-id='${courseID}'] button.enter`).removeAttr('disabled').removeProp('disabled'); 2793 $(`.panel[data-id='${courseID}'] button.enter i.fa`).remove(); 2794 } 2795 }).done(function (data) { 2796 if (data && data.success) { 2797 $('#couponModal').modal('hide'); 2798 if (data.action == "enter") { 2799 launchEnterClassrooom(courseID, programID, '', certificationAttempt, h, w, openin, title); 2800 } 2801 if (data.action == "enterActivity") { 2802 launchEnterActivity(courseID, programID, '', certificationAttempt, title, type); 2803 } 2804 else if (data.action == "goto") { 2805 window.location = data.url; 2806 } 2807 } 2808 else { 2809 bootbox.alert('Failed to redeem the coupon! Error: ' + data.LearnerInstruction); 2810 2811 $(`.panel[data-id='${courseID}'] button.enter`).removeAttr('disabled').removeProp('disabled'); 2812 $(`.panel[data-id='${courseID}'] button.enter i.fa`).remove(); 2813 } 2814 }); 2815 }); 2816 couponContainer.append(btn); 2817 $("#couponModal .modal-body").append(couponContainer); 2818 } 2819 // 2820 $('#coupon').val(''); 2821 $('#couponModal').modal('show'); 2822 } 2823 } 2824 } 2825 return false; 2826 }); 2827 return false; 2828} 2829 2830//using an externa shopping cart, add the item in the shopping cart (either redirect inside AddToCart or directly to handler for ASHP) 2831var purchaseExternal = function (url, title, price, marqueeElement, cartURL) { 2832 $.ajax({
2833 url: url, 2834 dataType: "json", 2835 async: false, 2836 cache: false, 2837 // data: { "pid": courseID, "ProgramID": programID, "ptype": type, "q": qtyValue, op: "additemtoshoppingcart" }, 2838 //data: { "cid": courseID, "did": programID, "type": type, "qty": qtyValue, op: "additemtoshoppingcart" }, 2839 error: function (jqXHR) { 2840 bootbox.alert('Failed to add to cart! Error: ' + jqXHR.responseText); 2841 } 2842 }).done(function (data) { 2843 if (data && data.success) { 2844 if (data.url) 2845 window.location = data.url; 2846 //if the external shopping cart handler returns to refresh the cart, call the function to do that (shoudl not be hard-coded to ASHP) 2847 if (data.checkCart === true) 2848 TC.checkCart(); 2849 //if not redirecting to another page, show the added to cart confirmation modal 2850 $('#singleBuyModal').remove(); 2851 // if ($("#singleBuyModal").length == 0) { 2852 var singleBuyModal = $('<div class="modal fade purchase-alert" id="singleBuyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">' + 2853 '<div class="modal-dialog" style="margin-top:auto!important;height:500px!important; width:500px!important;">' + 2854 '<div class="modal-content">' + 2855 '<div class="modal-header" style="height:45px;">' + 2856 '<h4 class="modal-title">Added to Cart</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' + 2857 '</div>' + 2858 '<div class="modal-body">' + 2859 '<div>Your Item was added to the cart</div>' + 2860 '<div class="purchase-item">' + 2861 ((typeof (marqueeElement) !== 'undefined') ? ('<span class="marquee_wrap"><img src=\"' + marqueeElement + '" class=\"marquee\"></span>') : '') + 2862 '<div class="purchase-title">' + title + '</div>' + 2863 '<div class="purchase-price">' + price + '</div>' + 2864 '<div class="purchase-quantity">Quantity: 1</div>' + 2865 '</div>' + 2866 '<div><button type="button" class="btn btn-default" data-dismiss="modal" data-bs-dismiss="modal">Continue Shopping</button> <a class="btn btn-default" href="' + cartURL + '">Continue to Cart</a></div>' + 2867 '</div>' + 2868 //'<button id=\"wizardClearButton\" type=\"button\" class=\"button btn btn-default clear\" value=\"Continue\" title=\"Continue Shopping\" onclick=\"parent.location = \'Student/Catalogue/BrowseCatalogue.aspx\';\" >Continue Shopping</button>' + 2869 //'<button id=\"wizardNextButton\" type=\"button\" class=\"button btn btn-default next\" onclick=\"parent.location = "Student/MyLearningActivities.aspx";\">Checkout</button>' + 2870 //'</div>' + 2871 '</div>' + 2872 '</div>' + 2873 '</div>'); 2874 //} 2875 // 2876 $("body").append(singleBuyModal); 2877 $('#singleBuyModal').modal('show'); 2878 } 2879 else { 2880 bootbox.alert('Failed to add to cart! Error: ' + data.message); 2881 } 2882 }); 2883}; 2884 2885var OpenEnrollingCourse = function (baseurl, courseID, programID, title, type, el, enrolled, lp) { 2886 console.log(baseurl + " " + courseID + " " + programID + " " + title + " " + type); 2887 // 2888 if (typeof (lp) === 'undefined') { 2889 // let's see if we can get the lp from the breadcrumbs 2890 let mapid = getParameterByName('mapID'); 2891 if (mapid !== '') { 2892 lp = mapid; 2893 } 2894 } 2895 if (enrolled !== true && enrolled !== 'True' && $(el).hasClass('cohort')) { 2896 if (LMS.cohortSelected !== null && LMS.cohortSelected !== "") 2897 // OpenExpressStart(baseurl, courseID, programID, title, type, el, enrolled, lp, false); 2898 enrollCoursNoFastStart(baseurl, courseID, programID, type, LMS.cohortSelected, title, lp, el, true); 2899 2900 } else { 2901 enrollCoursNoFastStart(baseurl, courseID, programID, type, null, title, lp, el, true); 2902 //OpenExpressStart(baseurl, courseID, programID, title, type, el, enrolled, lp, false); 2903 } 2904 return false; 2905} 2906 2907/// this needs to change 2908var enrollCoursNoFastStart = function (baseurl, courseID, programID, type, cohort, title, lp, btn, fs) {
2909 let certificationAttempt = (typeof (el) !== 'undefined' && el !== null && typeof ($(el).data().attempt) !== 'undefined') ? $(el).data().attempt : 0; 2910 let disclaimer = (typeof (btn) !== 'undefined' && btn && $(btn).data().disclaimer === 'True') ? true : false; 2911 if (typeof (btn) !== 'undefined' && btn) { 2912 $(btn).prop('disabled', true); 2913 $(btn).prepend('<i class="fa fa-gear fa-spin" id="loaderIcon" style="margin-right:5px;"></i>'); 2914 } 2915 let faststart = (typeof (fs) !== 'undefined' && fs === true) ? fs : false; 2916 var inLP = (typeof (lp) !== 'undefined' && lp) ? lp : false; 2917 setTimeout(function () { 2918 $.ajax({ 2919 url: baseurl + "Student/EnrollInCourse.ashx", 2920 async: false, 2921 cache: false, 2922 mapid: inLP, 2923 button: btn, 2924 eventdata: { 2925 baseurl: baseurl, 2926 disclaimer: disclaimer, 2927 courseid: courseID, 2928 programid: programID, 2929 type: type, 2930 cohort: cohort, 2931 lpid: inLP, 2932 faststart: faststart 2933 }, 2934 data: { 2935 "CourseID": courseID, 2936 "ProgramID": programID, 2937 "Type": type, 2938 "CohortID": cohort, 2939 "mapID": inLP, 2940 "redirectToDetailsPage": redirectToDetailsPage 2941 } 2942 }).done(function (result) { 2943 if (result) { 2944 var s = result.success; 2945 var m = result.message; 2946 if (s == false || s == "false") { 2947 var a = result.action; 2948 if (a == "goto") { 2949 window.location = result.url; 2950 } 2951 launchExpressStartReason(m, title); 2952 if (typeof (this.button) !== 'undefined') { 2953 $(this.button).find('.fa-gear').remove(); 2954 } 2955 } 2956 else { 2957 var a = result.action; 2958 var h = result.height; 2959 var w = result.width; 2960 var openin = result.modal; 2961 if (a === 'enter' && this.eventdata.faststart === true) { 2962 if (this.mapid) { 2963 launchEnterClassrooom(courseID, programID, this.mapid, certificationAttempt, h, w, openin, title, '', '') 2964 // launchEnterClassrooomLP(courseID, programID, this.mapid, '1', h, w, openin, title); 2965 } else { 2966 launchEnterClassrooom(courseID, programID, '', certificationAttempt, h, w, openin, title); 2967 } 2968 } 2969 if (a == "enter" && this.eventdata.faststart === false) { 2970 // don't enter this is method is only for when a catalogue page has fast start turned off// 2971 if (typeof (this.button) !== 'undefined') { 2972 $(this.button).removeProp('disabled'); 2973 $(this.button).removeAttr('disabled'); 2974 $(this.button).find('.fa-gear').remove(); 2975 $(this.button).text(Nomenclature.translate('Start')); 2976 $(this.button).data().enrollment = 'enrolled'; 2977 $(this.button).data().status = 'Active'; 2978 2979 $(this.button).removeProp('onclick'); 2980 let data = { 2981 2982 baseurl: this.eventdata.baseurl, 2983 courseid: this.eventdata.courseid, 2984 programid: this.eventdata.programid, 2985 lpid: this.eventdata.lpid, 2986 type: this.eventdata.type, 2987 cohort: this.eventdata.cohort, 2988 2989 }; 2990 /// now we need to bind the new event to the button /// 2991 $(this.button).on('click', data, function (e) { 2992 console.log(e.data); 2993 let disclaimer = ($(this).data().disclaimer === 'True') ? true : false; 2994 if (disclaimer) { 2995 openModal(e.data.baseurl, e.data.courseid, e.data.programid, '', true, null, null, e.data.type, null, e.data.lpid, null); 2996 //openModal = function (baseurl, courseID, programID, title, fastaction, entermode, backbtn, type, returnUrl, activityCount, buttonType) 2997 } else { 2998 OpenExpressStart(e.data.baseurl, e.data.courseid, e.data.programid, '', e.data.type, this, true, e.data.lpid, false); 2999 } 3000 }); 3001 } 3002 3003 } 3004 if (a == "goto") { 3005 window.location = result.url; 3006 } 3007 else if (a == "buy") 3008 window.location = result.url; 3009 else if (a == "showMsg") { 3010 launchExpressStartReason(m, title); 3011 } 3012 else if (a == "seriesEnrollmentRequired") { 3013 seriesEnrollmentWizard.show('LPActivityEquivalencie
3013sSelection', courseID, userID, result.url, true, true, false); 3014 $('#LPActivityEquivalenciesSelection').modal('toggle'); 3015 } 3016 else if (a == "token") {//user can redeem a course token, ask for the token 3017 if ($("#tokenModal").length == 0) { 3018 3019 $("body").append(`<div class="modal fade course" id="tokenModal" tabindex="-1" role="dialog"> 3020 <div class="modal-dialog modal-dialog-centered"> 3021 <div class="modal-content"> 3022 <div class="modal-header"> 3023 <h4 class="modal-title">${title || Nomenclature.translate('Redeem')}</h4> 3024 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 3025 </div> 3026 <div class="modal-body"> 3027 <div class="token-container" style="margin: 10px;"> 3028 <div class="form-group mb-3"> 3029 <label for="token" class="form-label"> 3030 ${Nomenclature.translate('Enter Token')}: 3031 </label> 3032 <input class="form-control" type="text" id="token" /> 3033 </div> 3034 <button type="button" class="btn btn-default tokenModal-submit-btn cohort"> 3035 ${Nomenclature.translate('Submit')} 3036 </button> 3037 </div> 3038 </div> 3039 </div> 3040 </div> 3041 </div>`); 3042 3043 $("#tokenModal").on('hidden.bs.modal', function () { 3044 $('#activityReEnrollAlert #loaderIcon').parent().prop('disabled', false); 3045 $('#activityReEnrollAlert #loaderIcon').remove(); 3046 }); 3047 3048 //tokenContainer.append(cohortDD); 3049 const btn = $('#tokenModal .tokenModal-submit-btn'); 3050 var mapID = this.mapid; 3051 btn.on('click', function () { 3052 var tokenValue = $('#token').val().trim(); 3053 3054 if (!tokenValue) { 3055 return; 3056 }; 3057 $.ajax({
3058 url: baseUrl + "Student/Course/DoExpressStart.ashx", 3059 dataType: "json", 3060 async: false, 3061 cache: false, 3062 data: { 3063 "CourseID": courseID, 3064 "ProgramID": programID, 3065 "Type": type, 3066 "mapID": mapID, 3067 "CohortID": cohort, 3068 "PageFastStart": "false", 3069 token: tokenValue, 3070 op: "enrollwithtoken" 3071 }, 3072 error: function (jqXHR) { 3073 $('#tokenModal').modal('hide'); 3074 bootbox.alert('Failed to redeem the token! Error: ' + jqXHR.responseText); 3075 } 3076 }).done(function (data) { 3077 if (data && data.success) { 3078 var h = data.height; 3079 var w = data.width; 3080 var openin = data.modal; 3081 $('#tokenModal').modal('hide'); 3082 if (data.action == "enter") { 3083 launchEnterClassrooom(courseID, programID, '', '0', h, w, openin, title); 3084 } 3085 if (data.action == "enterActivity") { 3086 launchEnterActivity(courseID, programID, '', '0', title, type); 3087 } 3088 else if (data.action == "goto") { 3089 window.location = data.url; 3090 } 3091 } 3092 else { 3093 bootbox.alert('Failed to redeem the token! Error: ' + data.message); 3094 $(`.panel[data-id='${courseID}] button.enter`).removeAttr('disabled').removeProp('disabled'); 3095 } 3096 }); 3097 }); 3098 }; 3099 3100 $('#tokenModal').modal('show'); 3101 } 3102 else if (a == "globalTokens") {//user can redeem global tokens, show the confirmation dialog; redeem tokens and enter course if confirmed 3103 //var globalTokensValue = response.globalTokensValue; 3104 var mapID = this.mapid; 3105 bootbox.confirm(m, function (result) { 3106 //console.log('This was logged in the callback: ' + result); 3107 if (result === true) { 3108 $.ajax({
3109 url: baseUrl + "Student/Course/DoExpressStart.ashx", 3110 dataType: "json", 3111 async: false, 3112 cache: false, 3113 data: { 3114 "CourseID": courseID, 3115 "ProgramID": programID, 3116 "Type": type, 3117 "mapID": mapID, 3118 "CohortID": cohort, 3119 "PageFastStart": "false", 3120 op: "enrollwithglobaltokens" 3121 }, 3122 error: function (jqXHR) { 3123 bootbox.alert('Failed to redeem the global tokens! Error: ' + jqXHR.responseText); 3124 } 3125 }).done(function (data) { 3126 if (data && data.success) { 3127 var h = data.height; 3128 var w = data.width; 3129 var openin = data.modal; 3130 if (data.action == "enter") { 3131 launchEnterClassrooom(courseID, programID, '', '0', h, w, openin, title); 3132 } 3133 if (data.action == "enterActivity") { 3134 launchEnterActivity(courseID, programID, '', '0', title, type); 3135 } 3136 else if (data.action == "goto") { 3137 window.location = data.url; 3138 } 3139 } 3140 else { 3141 bootbox.alert('Failed to redeem the global tokens! Error: ' + data.message); 3142 } 3143 }); 3144 } 3145 }); 3146 } 3147 else if (a == "couponOnly") {//user can redeem a 100 % coupon only , ask for the coupon 3148 if ($('#couponModal').length > 1) { 3149 $('#couponModal').remove(); 3150 } 3151 if ($("#couponModal").length == 0) { 3152 var couponModal = $('<div class="modal fade course" id="couponModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">' + 3153 '<div class="modal-dialog" style="margin-top:auto!important;height:300px!important; width:500px!important;">' + 3154 '<div class="modal-content">' + 3155 '<div class="modal-header" style="height:45px;">' + 3156 '<h4 class="modal-title">' + title + '</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' + 3157 '</div>' + 3158 '<div class="modal-body">' + 3159 '</div>' + 3160 '</div>' + 3161 '</div>' + 3162 '</div>'); 3163 // 3164 $("body").append(couponModal); 3165 //
3166 var couponContainer = $('<div style="width:400px;margin:50px auto;"></div>'); 3167 couponContainer.append('<label>Enter Coupon:</label><input type = "text" id="coupon" value=""></input>'); 3168 //tokenContainer.append(cohortDD); 3169 var btn = $('<button type="button" style="btn btn-default disabled cohort">Submit</button>'); 3170 var lpid = ""; 3171 try { 3172 lpid = e.data.lpid; 3173 } 3174 catch { } 3175 3176 btn.on('click', function () { 3177 var couponValue = $('#coupon').val(); 3178 $.ajax({ 3179 url: baseUrl + "Student/eCommerce/ValidateCoupon.ashx", 3180 dataType: "json", 3181 async: false, 3182 cache: false, 3183 data: { 3184 "courseID": courseID, 3185 "domainID": programID, 3186 "Type": type, 3187 "mapID": lpid, 3188 "CohortID": cohort, 3189 coupon: couponValue, 3190 op: "RedeemFullCouponCodeEnroll" 3191 }, 3192 error: function (jqXHR) { 3193 $('#couponModal').modal('hide'); 3194 bootbox.alert('Failed to redeem the coupon! Error: ' + jqXHR.responseText); 3195 3196 $(`.panel[data-id='${courseID}'] button.enter`).removeAttr('disabled').removeProp('disabled'); 3197 $(`.panel[data-id='${courseID}'] button.enter i.fa`).remove(); 3198 } 3199 }).done(function (data) { 3200 if (data && data.success) { 3201 $('#couponModal').modal('hide'); 3202 if (data.ButtonURL !== "" && data.ButtonText != "") { 3203 3204 bootbox.confirm({ 3205 title: data.ButtonText, 3206 message: data.LearnerInstruction, 3207 buttons: { 3208 confirm: { 3209 label: '<i class="fa fa-check"></i> ' + data.ButtonText 3210 } 3211 }, 3212 callback: function (result) { 3213 if (result == true) 3214 window.location = data.ButtonURL; 3215 } 3216 }); 3217 } 3218 } 3219 else { 3220 bootbox.alert(`${Nomenclature.translate('Failed to redeem the coupon!')} Error: ` + data.LearnerInstruction); 3221 $(`.panel[data-id='${courseID}'] button.enter`).removeAttr('disabled').removeProp('disabled'); 3222 $(`.panel[data-id='${courseID}'] button.enter i.fa`).remove(); 3223 } 3224 }); 3225 }); 3226 couponContainer.append(btn); 3227 $("#couponModal .modal-body").append(couponContainer); 3228 } 3229 // 3230 $('#coupon').val(''); 3231 $('#couponModal').modal('show'); 3232 } 3233 } 3234 } 3235 return false; 3236 }); 3237 }, 500); 3238} 3239 3240 3241var chooseCohort = function (baseurl, courseID, programID, title, type, el, enrolled, backMode) { 3242 var btn = $(el); 3243}; 3244 3245var AddToCartNoFastStart = function (baseurl, courseID, programID, title, type, el, enrolled, backMode) { 3246 console.log("navigation.js::AddToCartNoFastStart - baseUrl: " + baseurl + ", courseID: " + courseID + ", programID: " + programID + ", type: " + type); 3247 // 3248 if (enrolled !== true && enrolled !== 'True' && $(el).hasClass('cohort')) { 3249 if (LMS.cohortSelected !== null && LMS.cohortSelected !== "") 3250 parent.location = baseurl + 'Student/eCommerce/AddToCart.aspx?ItemID=' + courseID + '&Type=' + type + '&back=' + backMode + '&ProgramID=' + programID + '&CohortID=' + LMS.cohortSelected; 3251 } else { 3252 parent.location = baseurl + 'Student/eCommerce/AddToCart.aspx?ItemID=' + courseID + '&Type=' + type + '&back=' + backMode + '&ProgramID=' + programID; 3253 } 3254 return false; 3255} 3256 3257/////////////////////////////////// 3258//popup window, ask how many and if they want one code or multiples 3259//make it go to doaddtocart handler, then decide what custom cart 3260//#97802: passes with active volume discounts get a promo modal built from the live 3261//threshold config (Student/eCommerce/PassVolumePricing.ashx); everything else - and 3262//any fetch failure or malformed response - falls back to the plain quantity modal. 3263var AddToCartForOthers = function (baseurl, courseID, programID, title, type, el, backMode) { 3264 console.log(baseurl + " " + courseID + " " + programID + " " + type);
3265 ////////////////////////////// 3266 if ((type || '').toString().toLowerCase() === 'pass') { 3267 $.ajax({ 3268 url: baseurl + "Student/eCommerce/PassVolumePricing.ashx", 3269 dataType: "json", 3270 cache: false, 3271 timeout: 8000, 3272 data: { "ItemID": courseID } 3273 }).done(function (data) { 3274 try { 3275 if (data && data.success && data.enabled && data.thresholds && data.thresholds.length) { 3276 buildPassVolumePromoModal(baseurl, courseID, programID, title, type, data); 3277 } else { 3278 buildAddToCartForOthersModal(baseurl, courseID, programID, title, type); 3279 } 3280 } catch (e) { 3281 console.warn('Pass volume promo failed, falling back to the plain quantity modal', e); 3282 buildAddToCartForOthersModal(baseurl, courseID, programID, title, type); 3283 } 3284 }).fail(function () { 3285 buildAddToCartForOthersModal(baseurl, courseID, programID, title, type); 3286 }); 3287 return false; 3288 } 3289 buildAddToCartForOthersModal(baseurl, courseID, programID, title, type); 3290 return false; 3291} 3292 3293//shared add-to-cart call for both modal flavours: qty -> DoAddToCart, then the same 3294//redirect/confirm behaviour the modal has always had 3295var doAddToCartForOthers = function (baseurl, courseID, programID, type, qtyValue) { 3296 $.ajax({
3297 url: baseurl + "Student/eCommerce/DoAddToCart.ashx", 3298 dataType: "json", 3299 async: false, 3300 cache: false, 3301 data: { 3302 "ItemID": courseID, 3303 "ProgramID": programID, 3304 "type": type, 3305 "Quantity": qtyValue, 3306 op: "purchaseForOthers" 3307 }, 3308 error: function (jqXHR) { 3309 $('#multipleBuyModal').modal('hide'); 3310 bootbox.alert({ 3311 message: `${Nomenclature.translate('Failed to add to cart!')} Error: ` + jqXHR.responseText, 3312 closeButton: false 3313 }); 3314 } 3315 }).done(function (data) { 3316 if (data && data.success) { 3317 if (data.url) 3318 window.location = data.url; 3319 else if (data.checkCart === true)//if the external shopping cart handler returns to refresh the cart, call the function to do that (shoudl not be hard-coded to ASHP) 3320 TC.checkCart(); 3321 else {//if not redirecting to another page, show the added to cart confirmation modal 3322 var popupBody = $('#multipleBuyModal .modal-body'); 3323 var wizardDiv = $("<div style='max-width: 600px; margin: 50px auto;' />"); 3324 wizardDiv.append(`<span>${Nomenclature.translate('Your Item was added to the cart')}</span><br/>`); 3325 popupBody.empty(); 3326 popupBody.append(wizardDiv); 3327 } 3328 } 3329 else { 3330 bootbox.alert(`${Nomenclature.translate('Failed to add to cart!')} Error: ` + data.message); 3331 } 3332 }); 3333} 3334 3335//plain quantity modal: the default when a pass has no active discounts (and the only 3336//option for non-pass types). Same historic flow - free quantity + Add to cart - 3337//with the #97802 restyle: footer button that stays disabled until a valid quantity 3338var buildAddToCartForOthersModal = function (baseurl, courseID, programID, title, type) { 3339 $('#multipleBuyModal').remove(); 3340 let purchaseText = Nomenclature.translate(`Purchase for others`); 3341 var multipleBuyModal = $(`<div class="modal fade" id="multipleBuyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 3342 <div class="modal-dialog"> 3343 <div class="modal-content"> 3344 <div class="modal-header"> 3345 <h4 class="modal-title">${purchaseText}</h4> 3346 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 3347 </div> 3348 <div class="modal-body"> 3349 </div> 3350 <div class="modal-footer"> 3351 </div> 3352 </div> 3353 </div> 3354 </div>`); 3355 $("body").append(multipleBuyModal); 3356 3357 var labelContainer = $('<p class="mb-3"></p>'); 3358 labelContainer.append(document.createTextNode(Nomenclature.translate(`Purchase for others the ${type}`) + ' ')); 3359 labelContainer.append($('<b></b>').text(title)); 3360
3361 var qtyContainer = $('<div class="mb-3"></div>'); 3362 var qtyLabel = $(`<label class="form-label" for="qty"></label>`).text(Nomenclature.translate('Quantity')); 3363 var qtyInput = $('<input class="form-control" title="Quantity" type="number" id="qty" min="1" value="" style="max-width:120px" />'); 3364 qtyContainer.append(qtyLabel); 3365 qtyContainer.append(qtyInput); 3366 3367 var addBtn = $('<button type="button" class="btn btn-primary" disabled></button>').text(Nomenclature.translate('Add to cart')); 3368 qtyInput.on('input', function () { 3369 var qtyValue = parseInt($(this).val(), 10); 3370 addBtn.prop('disabled', !(qtyValue >= 1)); 3371 }); 3372 addBtn.on('click', function () { 3373 var qtyValue = parseInt($('#qty').val(), 10); 3374 if (qtyValue >= 1) 3375 doAddToCartForOthers(baseurl, courseID, programID, type, qtyValue); 3376 }); 3377 3378 $("#multipleBuyModal .modal-body").append(labelContainer); 3379 $("#multipleBuyModal .modal-body").append(qtyContainer); 3380 $("#multipleBuyModal .modal-footer").append(addBtn); 3381 3382 $('#multipleBuyModal').modal('show'); 3383} 3384 3385//#97802: styles for the volume-discount promo modal, injected once so the modal works 3386//from any page (MyPass, catalogue cards) without touching the served stylesheets 3387var injectPassVolumePromoStyles = function () { 3388 if (document.getElementById('passVolumePromoStyles')) 3389 return; 3390 var css = ` 3391#multipleBuyModal .pass-volume-intro { margin: 0 0 14px; color: #555; } 3392#multipleBuyModal .seat-options { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; } 3393#multipleBuyModal .seat-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin-bottom: 8px; border: 1px solid #d8d8d8; border-radius: 6px; cursor: pointer; font-weight: normal; } 3394#multipleBuyModal .seat-option:hover { border-color: #337ab7; } 3395#multipleBuyModal .seat-option.selected { border-color: #337ab7; background: #f0f7ff; } 3396#multipleBuyModal .seat-option input[type="radio"] { margin: 0; flex: 0 0 auto; } 3397#multipleBuyModal .seat-count { flex: 1 1 auto; font-weight: 600; } 3398#multipleBuyModal .seat-count .seat-title-note { display: block; font-weight: normal; color: #777; font-size: .92em; } 3399#multipleBuyModal .seat-custom-input { display: inline-block; } 3400#multipleBuyModal .seat-custom-input input { width: 100px; display: inline-block; padding: 4px 8px; height: auto; } 3401#multipleBuyModal .seat-custom-limits { display: block; margin-top: 2px; color: #777; font-size: .85em; font-weight: normal; } 3402#multipleBuyModal .seat-price-col { margin-left: auto; flex: 0 0 auto; text-align: right; } 3403#multipleBuyModal .seat-price { display: block; font-weight: 600; } 3404#multipleBuyModal .seat-discount { display: inline-block; margin-top: 2px; padding: 1px 8px; border-radius: 10px; background: #2e7d32; color: #fff; font-size: .85em; font-weight: 700; } 3405#multipleBuyModal .modal-footer { text-align: right; } 3406@media (max-width: 480px) { 3407 #multipleBuyModal .seat-option { flex-wrap: wrap; } 3408 #multipleBuyModal .seat-price-col { flex-basis: 100%; margin-left: 26px; text-align: left; } 3409}`; 3410 $('<style id="passVolumePromoStyles" type="text/css"></style>').text(css).appendTo('head'); 3411} 3412 3413//#97802: promo modal for a pass with active volume discounts. Texts come from the 3414//pass's promo settings with translated defaults; every price/percent is computed 3415//server-side (single-purchase semantics), and admin-editable strings are inserted 3416//via .text() so they can never break or inject markup 3417var buildPassVolumePromoModal = function (baseurl, courseID, programID, title, type, data) { 3418 injectPassVolumePromoStyles(); 3419 $('#multipleBuyModal').remove(); 3420 3421 var settings = (data && data.settings) || {}; 3422 var modalTitle = settings.title || Nomenclature.translate('Purchase for others'); 3423 var introText = settings.intro || Nomenclature.translate('The more seats you purchase, the more you save.'); 3424 var buttonText = settings.buttonText || Nomenclature.translate('Add to cart'); 3425 //optional custom-quantity bounds (#97802); absent/invalid = no limit 3426 var customQtyMin = parseInt(settings.customQtyMin, 10); 3427 if (!(customQtyMin >= 1)) customQtyMin = null; 3428 var customQtyMax = parseInt(settings.customQtyMax, 10); 3429 if (!(customQtyMax >= 1)) customQtyMax = null; 3430 var symbol = (data && data.currencySymbol) || ''; 3431 var fmtMoney = function (amount) { 3432 var n = Number(amount); 3433 if (!isFinite(n)) return '';
3434 return symbol + n.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 2 }); 3435 }; 3436 var seatWord = function (n) { return Nomenclature.translate(n === 1 ? 'seat' : 'seats'); }; 3437 3438 var multipleBuyModal = $(`<div class="modal fade" id="multipleBuyModal" tabindex="-1" role="dialog" aria-labelledby="passVolumeModalTitle" aria-hidden="true"> 3439 <div class="modal-dialog pass-volume-dialog"> 3440 <div class="modal-content"> 3441 <div class="modal-header"> 3442 <h4 class="modal-title" id="passVolumeModalTitle"></h4> 3443 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 3444 </div> 3445 <div class="modal-body"> 3446 <p class="pass-volume-intro"></p> 3447 <ul class="seat-options" role="radiogroup" aria-labelledby="passVolumeModalTitle"></ul> 3448 </div> 3449 <div class="modal-footer"> 3450 </div> 3451 </div> 3452 </div> 3453 </div>`); 3454 multipleBuyModal.find('.modal-title').text(modalTitle); 3455 multipleBuyModal.find('.pass-volume-intro').text(introText); 3456 $("body").append(multipleBuyModal); 3457 3458 var list = multipleBuyModal.find('.seat-options'); 3459 var continueBtn = $('<button type="button" class="btn btn-primary" disabled></button>').text(buttonText); 3460 multipleBuyModal.find('.modal-footer').append(continueBtn); 3461 3462 var chosenQty = null; 3463 var updateContinue = function () { continueBtn.prop('disabled', !(chosenQty >= 1)); }; 3464 3465 $.each(data.thresholds, function (i, row) { 3466 var qty = row ? parseInt(row.qty, 10) : 0; 3467 if (!(qty >= 1)) return; 3468 var label = $('<label class="seat-option"></label>'); 3469 var radio = $('<input type="radio" name="passVolumeOption" />').val(qty); 3470 var countSpan = $('<span class="seat-count"></span>').text(qty.toLocaleString() + ' ' + seatWord(qty)); 3471 //a threshold title that is not just restating the seat count shows as a note 3472 if (row.title && !/^\s*\d[\d,\s]*\s+seats?\s*$/i.test(row.title)) 3473 countSpan.append($('<span class="seat-title-note"></span>').text(row.title)); 3474 if (row.description) 3475 label.attr('title', row.description); 3476 var priceCol = $('<span class="seat-price-col"></span>'); 3477 var priceText = fmtMoney(row.total); 3478 if (priceText) 3479 priceCol.append($('<span class="seat-price"></span>').text(priceText)); 3480 var pct = parseInt(row.percentOff, 10); 3481 if (pct > 0) 3482 priceCol.append($('<span class="seat-discount"></span>').text(pct + '% ' + Nomenclature.translate('OFF'))); 3483 label.append(radio).append(countSpan).append(priceCol); 3484 list.append($('<li></li>').append(label)); 3485 }); 3486 3487 //custom-quantity option: a radio that unlocks its number input; the price and 3488 //effective discount are quoted live by the same endpoint 3489 var customRadio = null; 3490 var customInput = null; 3491 var customPrice = null; 3492 var customDiscount = null; 3493 var quoteTimer = null; 3494 if (settings.showCustomQty !== false) { 3495 var customLabel = $('<label class="seat-option seat-option-custom"></label>'); 3496 customRadio = $('<input type="radio" name="passVolumeOption" value="custom" />'); 3497 var customCount = $('<span class="seat-count"></span>').text(Nomenclature.translate('Custom quantity')); 3498 var inputWrap = $('<span class="seat-custom-input"></span>'); 3499 customInput = $('<input class="form-control" type="number" step="1" disabled />').attr('title', Nomenclature.translate('Quantity')); 3500 customInput.attr('min', customQtyMin || 1); 3501 if (customQtyMax) customInput.attr('max', customQtyMax); 3502 inputWrap.append(customInput); 3503 //configured bounds shown as a hint under the input (#97802), not as a placeholder 3504 if (customQtyMin || customQtyMax) { 3505 var limitsText = customQtyMin ? Nomenclature.translate('min.') + ' ' + customQtyMin : ''; 3506 if (customQtyMax) limitsText += (limitsText ? ' · ' : '') + Nomenclature.translate('max.') + ' ' + customQtyMax; 3507 inputWrap.append($('<span class="seat-custom-limits"></span>').text(limitsText)); 3508 } 3509 var customCol = $('<span class="seat-price-col"></span>'); 3510 customPrice = $('<span class="seat-price"></span>'); 3511 customDiscount = $('<span class="seat-discount" style="display:none"></span>');
3512 customCol.append(customPrice).append(customDiscount); 3513 customLabel.append(customRadio).append(customCount).append(inputWrap).append(customCol); 3514 list.append($('<li></li>').append(customLabel)); 3515 } 3516 3517 var refreshCustomQuote = function () { 3518 if (!customRadio || !customRadio.is(':checked')) return; 3519 var qty = parseInt(customInput.val(), 10); 3520 var outOfRange = (customQtyMin && qty < customQtyMin) || (customQtyMax && qty > customQtyMax); 3521 if (!(qty >= 1) || outOfRange) { 3522 customPrice.text(''); 3523 customDiscount.hide(); 3524 chosenQty = null; 3525 updateContinue(); 3526 return; 3527 } 3528 $.ajax({ 3529 url: baseurl + "Student/eCommerce/PassVolumePricing.ashx", 3530 dataType: "json", 3531 cache: false, 3532 timeout: 8000, 3533 data: { "ItemID": courseID, "Quantity": qty } 3534 }).done(function (resp) { 3535 if (!customRadio.is(':checked')) return;//selection moved on meanwhile 3536 if (resp && resp.success && resp.quote && parseInt(resp.quote.qty, 10) === qty) { 3537 customPrice.text(fmtMoney(resp.quote.total)); 3538 var pct = parseInt(resp.quote.percentOff, 10); 3539 if (pct > 0) 3540 customDiscount.text(pct + '% ' + Nomenclature.translate('OFF')).show(); 3541 else 3542 customDiscount.hide(); 3543 chosenQty = qty; 3544 } else { 3545 customPrice.text(''); 3546 customDiscount.hide(); 3547 chosenQty = null; 3548 } 3549 updateContinue(); 3550 }).fail(function () { 3551 if (!customRadio.is(':checked')) return; 3552 customPrice.text(''); 3553 customDiscount.hide(); 3554 chosenQty = null; 3555 updateContinue(); 3556 }); 3557 }; 3558 3559 list.on('change', 'input[name="passVolumeOption"]', function () { 3560 var selected = $(this); 3561 list.find('.seat-option').removeClass('selected'); 3562 selected.closest('.seat-option').addClass('selected'); 3563 if (selected.val() === 'custom') { 3564 customInput.prop('disabled', false).trigger('focus'); 3565 refreshCustomQuote(); 3566 } else { 3567 if (customInput) customInput.prop('disabled', true); 3568 chosenQty = parseInt(selected.val(), 10); 3569 updateContinue(); 3570 } 3571 }); 3572 3573 if (customInput) { 3574 customInput.on('input', function () { 3575 clearTimeout(quoteTimer); 3576 quoteTimer = setTimeout(refreshCustomQuote, 350); 3577 }); 3578 //clamp to the configured bounds when the user leaves the field (spinner arrows 3579 //are already limited by the min/max attributes); out-of-range while typing just 3580 //clears the quote and keeps Continue disabled 3581 customInput.on('change', function () { 3582 var qty = parseInt(customInput.val(), 10); 3583 if (qty >= 1) { 3584 var clamped = qty; 3585 if (customQtyMin && clamped < customQtyMin) clamped = customQtyMin; 3586 if (customQtyMax && clamped > customQtyMax) clamped = customQtyMax; 3587 if (clamped !== qty) customInput.val(clamped); 3588 } 3589 refreshCustomQuote(); 3590 }); 3591 } 3592 3593 continueBtn.on('click', function () { 3594 if (chosenQty >= 1) 3595 doAddToCartForOthers(baseurl, courseID, programID, type, chosenQty); 3596 }); 3597 3598 $('#multipleBuyModal').modal('show'); 3599} 3600 3601var AddToCartExternal = function (baseurl, courseID, programID, title, type, el, enrolled, backMode) { 3602 var cohortID = ""; 3603 if (enrolled !== true && enrolled !== 'True' && $(el).hasClass('cohort')) { 3604 if (LMS.cohortSelected !== null && LMS.cohortSelected !== "") 3605 cohortID = LMS.cohortSelected; 3606 } 3607 cohortEnroll(courseID, programID, type, cohortID, title, el, null) 3608} 3609 3610//enter classroom opener that works with Firefox 3611function launchExpressStartReason(reason, title) { 3612 bootbox.alert({ 3613 title: title, 3614 message: reason, 3615 size: 'large', 3616 buttons: { 3617 ok: { 3618 label: "Close", 3619 className: 'btn-info' 3620 } 3621 },
3622 closeButton: false 3623 }); 3624 3625 return false; 3626}; 3627 3628//enter classroom opener that works with Firefox 3629function launchExpressStartActivityModal(reason, title) { 3630 if (!height) { 3631 var height = 600; 3632 } 3633 if (!width) { 3634 var width = 800; 3635 } 3636 3637 const modalHtml = `<div class="modal fade course" data-modalid="launch-expressStartActivity-modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 3638 <div class="modal-dialog" style="${isMobile.iOS() ? 'margin-top:0px!important;height:95%!important; width:95%!important;' : `height:${height}px!important; width:${width}px!important;`}"> 3639 <div class="modal-content"> 3640 <div class="modal-header"> 3641 <h4 class="modal-title">${title}</h4> 3642 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 3643 </div> 3644 <div class="modal-body"> 3645 <iframe allowtransparency="true" style="${isMobile.iOS() ? 'height:100%;background-repeat:no-repeat;background-position: center;' : `height:${height}px;width:${width}px;background-repeat:no-repeat;background-position: center;`}" id="viewCourseModal" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewCourse" frameborder="0"></iframe> 3646 </div> 3647 </div> 3648 </div> 3649 </div>`; 3650 3651 $("body").append(modalHtml); 3652 $('#myModal').modal('show', { show: true, keyboard: false }); 3653 if (isMobile.iOS()) { 3654 $('.modal.course iframe').css('height', '100%'); 3655 } else { 3656 $('.modal.course iframe').css('height', height); 3657 } 3658 $('.modal.course iframe').css('display', 'none'); 3659 $('.modal.course iframe').css('margin', '0 auto'); 3660 $('.modal.course iframe').wrap('<div class="coursemodule"><span>' + reason + '</span></div>'); 3661 if (browser_type.indexOf('Fire') >= 0) 3662 setTimeout(function () { $('#myModal').removeClass('in'); $('#myModal').removeClass('fade'); $('#myModal .modal-body').css('padding', '0px'); }, 1000); 3663 //$("#viewCourseModal").attr('src', redirectURL); 3664 $('.modal.course iframe').css('display', 'block'); 3665 $('#myModal').unbind('click'); 3666 $('.modal-header .btn-close').on('click', function () { 3667 var w = $(".modal.course iframe")[0].contentWindow; 3668 3669 //$("#viewCourseModal").attr('src', ''); 3670 $('#myModal').modal('hide');//parent.history.back(); 3671 setTimeout(function () { $('#myModal').remove(); }, 1000) 3672 }); 3673 return false; 3674} 3675 3676//commented because it overrides by the folowing function with the same name. 3677//var openModal = function (baseurl, courseID, programID, title, fastaction, entermode, backbtn, type, returnUrl, learningpathID, buttonType) { 3678 3679// // var redirectURL = baseurl + "Student/Disclaimer.aspx?courseID=" + courseID + "&programID=" + programID + "&fastaction=" + fastaction + "&entermode=" + entermode + "&backbutton=" + backbtn + "&type=" + type; 3680// var redirectURL = baseurl + "Student/Disclaimer.aspx?courseID=" + courseID + "&programID=" + programID + "&fastaction=" + fastaction + "&entermode=" + entermode + "&learningpathID=" + learningpathID + "&backbutton=" + backbtn + "&type=" + type + "&buttonType=" + buttonType; 3681 3682// $("body").append('<div class="modal fade course" id="myModalDisc" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog" style="height:800px!important; width:800px!important;"><div class="modal-content"><div class="modal-header"><h4 class="modal-title">' + title + '</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"><iframe id="viewDisclaimerModal" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewDisclaimer" frameborder="0" height="800" width="800" /></div></div></div></div>'); 3683// $('#myModalDisc').modal('show', { show: true, keyboard: false }); 3684 3685 3686// // $('.modal.course iframe').css('display', 'none'); 3687// // $('.modal.course iframe').css('margin', '0 auto'); 3688// if (browser_type.indexOf('Fire') >= 0)
3689// setTimeout(function () { $('#myModalDisc').removeClass('in'); $('#myModalDisc').removeClass('fade'); $('#myModalDisc .modal-body').css('padding', '0px'); }, 1000); 3690// $("#viewDisclaimerModal").attr('src', redirectURL); 3691// $('.modal.course iframe').css('display', 'block'); 3692// $('#myModalDisc').unbind('click'); 3693 3694// $('.modal-header .btn-close').on('click', function () { 3695// var w = $(".modal.course iframe")[0].contentWindow; 3696 3697// $("#viewDisclaimerModal").attr('src', ''); 3698// $('#myModalDisc').modal('hide'); 3699 3700// setTimeout(function () { 3701// $('#myModalDisc').remove(); 3702// if (returnUrl && returnUrl.length > 0) 3703// window.location.href = returnUrl; 3704// }, 1000); 3705 3706// }); 3707// return false; 3708//} 3709 3710var openModal = function (baseurl, courseID, programID, title, fastaction, entermode, backbtn, type, returnUrl, activityCount, buttonType) { 3711 /// for testing localally 3712 3713 3714 if (typeof (activityCount) !== 'undefined' && activityCount.length == 36) 3715 var redirectURL = baseurl + "Student/Disclaimer.aspx?modal=true&courseID=" + courseID + "&programID=" + programID + "&fastaction=" + fastaction + "&entermode=" + entermode + "&learningpathID=" + activityCount + "&backbutton=" + backbtn + "&type=" + type + "&buttonType=" + buttonType; 3716 else 3717 var redirectURL = baseurl + "Student/Disclaimer.aspx?modal=true&courseID=" + courseID + "&programID=" + programID + "&fastaction=" + fastaction + "&entermode=" + entermode + "&backbutton=" + backbtn + "&type=" + type + "&activityCount=" + activityCount + "&buttonType=" + buttonType; 3718 //window.location = response; 3719 var mobile = (isMobile.any() !== null) ? "width:95%;" : "";
3720 let closeButton = (location.href.indexOf('ContentPage.aspx') >= 0) ? '<button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button>' : ''; 3721 3722 const modalObject = $(`<div class="modal fade" data-modalid="openModal" id="myModal" runat="server" tabindex="-1" role="dialog"> 3723 <div class="modal-dialog modal-fullheight modal-lg"> 3724 <div class="modal-content course_${courseID}"> 3725 <div class="modal-header header_${courseID}"> 3726 <h4 class="modal-title">${title || 'Modal'}</h4> 3727 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 3728 </div> 3729 <div class="modal-body"> 3730 <iframe id="viewDisclaimerModal" src="${redirectURL}" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewDisclaimerModal" frameborder="0" height="100%" width="100%" /> 3731 </div> 3732 </div> 3733 </div> 3734 </div>`); 3735 3736 $("body").append(modalObject); 3737 3738 modalObject.modal({ show: true, keyboard: false }).on('hidden.bs.modal', function () { 3739 $(this).remove();
3740 if (location.href.indexOf('ContentPage.aspx') < 0) { 3741 /// don't refresh page if they close the disclaimer 3742 if (returnUrl && returnUrl.length > 0) 3743 window.location.href = returnUrl;//window.location.href + '&returnUrl=' + returnUrl; 3744 } 3745 }); 3746 3747 if (browser_type.indexOf('Fire') >= 0) 3748 setTimeout(function () { $('#myModal').removeClass('in'); $('#myModal').removeClass('fade'); $('#myModal .modal-body').css('padding', '0px'); }, 1000); 3749 3750 return false; 3751} 3752 3753//enter classroom opener that works with Firefox 3754function launchEnterActivity(courseID, programID, learningPathID, attempt, title, type) { 3755 if (location.href.indexOf('MyLearningActivities.aspx') >= 0) 3756 $('#activity_' + courseID).remove(); 3757 if ($('#activity_' + courseID).length === 0) { 3758 if (browser_type.indexOf('Safari') >= 0) { 3759 console.log('safari bug fix'); 3760 } 3761 if (!title) { 3762 var title = " "; 3763 } 3764 //PLEASE MIND THE PARAMETER CASE 3765 var redirectURL = baseUrl + "Student/MyCourse.aspx?modal=true&id=" + courseID + "&ProgramID=" + programID + "&popup=true&Attempt=" + attempt; 3766 if (learningPathID.length > 0) 3767 redirectURL += "&lpID=" + learningPathID; 3768 3769 try { 3770 $("#myModalDisc").modal('hide'); 3771 $("#myModalDisc").remove(); 3772 3773 $("#myModal").modal('hide'); 3774 $("#myModal").remove(); 3775 3776 } 3777 catch (e) { } 3778 3779 $('#myActivityModal').remove(); 3780 if (isMobile.iOS()) { 3781 $("body").append('<div class="modal fade course ' + type + '" data-modalid="launch-enterAtivity-modal" id="myActivityModal" data-id="' + courseID + '" tabindex="-1" role="dialog" aria-labelledby="myActivityModalLabel" aria-hidden="true"><div class="modal-dialog" style="margin-top:0px!important;height:95%!important; width:100%!important;"><div class="modal-content" style="height:90%"><div class="modal-header" style="height:45px;"><h4 class="modal-title" id="myModalLabel">' + title + '</h4><button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button></div><div class="modal-body" style="height:100%;"><iframe id="viewActivityModal" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewActivity" frameborder="0" height="100%" width="100%"></iframe></div></div></div></div>'); 3782 } else { 3783 var h = Math.floor($(window).height() * .80); 3784 var w = Math.floor($(window).width() * .75); 3785 $("body").append(`<div class="modal fade course ${type}" id="myActivityModal" data-modalid="launch-enterAtivity-modal" data-id="${courseID}" tabindex="-1" role="dialog" aria-labelledby="myActivityModalLabel" aria-hidden="true"> 3786 <div class="modal-dialog modal-lg modal-fullheight"> 3787 <div class="modal-content"> 3788 <div class="modal-header"> 3789 <h4 class="modal-title" id="myModalLabel">${title}</h4> 3790 <button type="button" class="btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="Close"></button> 3791 </div> 3792 <div class="modal-body"> 3793 <iframe id="viewActivityModal" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" name="viewActivity" frameborder="0" height="100%" width="100%"></iframe> 3794 </div> 3795 </div> 3796 </div> 3797 </div>`); 3798 } 3799 if (typeof (isLP) !== 'undefined' && isLP) { 3800 $('#myActivityModal').on('hidden.bs.modal', function () { 3801 let activity = $(this).data().id; 3802 console.log('navigation.js::launchEnterActivity() - call TC.checkLPStatus()'); 3803 TC.checkLPStatus(); 3804 }); 3805 } 3806 3807 $('#myActivityModal').modal('show', { show: true, keyboard: false }); 3808 3809 3810 if (isMobile.iOS()) { 3811 $('.modal.course iframe').css('height', '100%'); 3812 } else { 3813 $('.modal.course iframe').css('height', '100%'); 3814 } 3815 $('.modal.course iframe').css('display', 'none'); 3816 $('.modal.course iframe').css('margin', '0 auto'); 3817 $('.modal.course iframe').wrap('<div class="coursemodule" style="height:100%;"></div>'); 3818 if (browser_type.indexOf('Fire') >= 0) 3819 setTimeout(function () { $('#myActivityModal').removeClass('in'); $('#myActivityModal').removeClass('fade'); $('#myActivityModal .modal-body').css('padding', '0px'); }, 1000); 3820 $("#viewActivityModal").attr('src', redirectURL); 3821 $('.modal.course iframe').css('display', 'block'); 3822 3823 //$("#myActivityModal").on("shown.bs.modal", function () { 3824 // $('h1.page_title').remove(); 3825 //}); 3826 $('h1.page_title').remove(); 3827 $('#myActivityModal').unbind('click'); 3828 3829 3830 $('.modal-header .btn-close').on('click', function () { 3831 $('#myActivityModal').modal('hide'); 3832 // refresh the catalogue when an activity is closed 3833 // check the lp status instead of refreshing 3834 //if (isLP) { 3835 // TC.checkLPStatus();
3836 //} else { 3837 3838 setTimeout(function () { 3839 if (typeof (learningPathID) !== 'undefined' && learningPathID !== '') 3840 courseID = learningPathID; 3841 $('#myActivityModal').remove(); 3842 //if (returnUrl && returnUrl != null && returnUrl.length > 0 && window.location.href.indexOf('MyCourse') < 0) { 3843 // window.location.href = returnUrl; 3844 //} else { 3845 var url = window.location.href; 3846 var path = window.location.pathname; 3847 switch (true) { 3848 case url.indexOf('MyLearningActivities.aspx') >= 0: 3849 { 3850 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 3851 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + window.location.href; 3852 } 3853 else { 3854 url = baseUrl + 'Student/MyLearningActivities.aspx'; 3855 } 3856 } 3857 3858 break; 3859 case url.indexOf('Catalogue') >= 0: 3860 { 3861 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 3862 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; 3863 } 3864 else { 3865 url = window.location.href; 3866 } 3867 } 3868 break; 3869 case url.indexOf('type=lp') >= 0: url = url; 3870 break; 3871 case url.indexOf('MyCourses.aspx') >= 0: 3872 { 3873 if (redirectToDetailsPage == 'undefined' || redirectToDetailsPage) { 3874 url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; 3875 } 3876 else { 3877 url = baseUrl + 'Student/MyCourses.aspx'; 3878 } 3879 } 3880 break; 3881 //default: if (redirectToDetailsPage !== 'undefined' && redirectToDetailsPage) url = baseUrl + 'Student/MyCourse.aspx?id=' + courseID + '&ProgramID=' + programID + '&returnUrl=' + url; else url = window.location.href; url = url.replace('&start=true', ''); 3882 3883 3884 default: url = window.location.href; url = url.replace('&start=true', ''); 3885 break; 3886 } 3887 window.location.href = url; 3888 // }//window.location.href + '&returnUrl=' + returnUrl; 3889 }, 2000); 3890 3891 //} 3892 }); 3893 3894 } 3895 else { 3896 $('#activity_' + courseID).modal('show'); 3897 } 3898} 3899 3900function ScriptSelfSignOff(CourseID, DomainID, CourseType, CertiAttempt) { 3901 3902 var result = false; 3903 $.ajax({
3904 url: "Student/DoEnrollInCourse.ashx", 3905 dataType: "json", 3906 async: false, 3907 data: { 3908 type: CourseType, 3909 op: 'accessiblityscriptcompletion', 3910 cid: CourseID, 3911 did: DomainID, 3912 attept: CertiAttempt 3913 }, 3914 error: function () { 3915 $("#ErrorMessage").css("display", "block"); 3916 }, 3917 success: function (data) { 3918 if (data) { 3919 if (data.isSuccess === 'ok' || data.isSuccess === 'Ok') { 3920 var activity_cart_URL = baseUrl + '/Student/MyCourse.aspx?id=' + CourseID; 3921 window.location.href = activity_cart_URL; 3922 } else { 3923 $("#ErrorMessage").css("display", "block"); 3924 } 3925 } 3926 } 3927 3928 }); 3929 return result; 3930} 3931 3932 3933/// Form values change checking 3934if (typeof (TC) === 'undefined') 3935 TC = {}; 3936 3937if (typeof (closeMessage) === 'undefined') { 3938 var closeMessage = function () { 3939 // canClose = confirm("You have unsaved changes.") 3940 3941 return true;//canClose; 3942 } 3943} 3944 3945TC.formWatch = { 3946 3947 changed: false, 3948 subBtn: { 3949 el: null, 3950 id: null, 3951 clicked: false 3952 }, 3953 init: function (btn) { 3954 canClose = true; 3955 this.subBtn.el = $(btn); 3956 this.subBtn.id = $(btn).prop('id'); 3957 console.log('subBtn id: ' + this.subBtn.id); 3958 if (typeof (formSaved) === 'undefined') { 3959 if (typeof (isPostBack) !== 'undefined') { 3960 if (isPostBack === 'False' /*|| (typeof (checkformWatch) !== 'undefined' && checkformWatch == 'true')*/) { 3961 this.subBtn.el.prop('disabled', 'true'); 3962 } else { 3963 this.subBtn.el.removeProp('disabled'); 3964 this.subBtn.el.removeAttr('disabled'); 3965 TC.formWatch.changed = true; 3966 canClose = false; 3967 } 3968 } 3969 3970 //can't show a custom dialog at onbeforunload, return false with setting the text to show is all that can be done 3971 window.onbeforeunload = function () { 3972 if (TC.formWatch.changed === true//things changed on the page 3973 && TC.formWatch.subBtn.clicked === false//not clicked the submit button used when initializing 3974 && (typeof (checkformWatch) !== 'undefined' && checkformWatch == 'true')//page is set to watch for changes 3975 && (typeof (isPostBack) === 'undefined' || isPostBack === 'False')//is not PostBack 3976 ) { 3977 //console.log('unload with changes!'); 3978 // 3979 return false; 3980 } 3981 } 3982 3983 this.subBtn.el.on('click', function () { 3984 TC.formWatch.subBtn.clicked = true; 3985 canClose = true; 3986 }); 3987 3988 $(':input').on('input', function () { 3989 console.log(':input input!'); 3990 if (TC.formWatch.changed === false) { 3991 TC.formWatch.enable(); 3992 TC.formWatch.changed = true; 3993 canClose = false; 3994 } 3995 }); 3996 3997 //need this for date controls when a date is selected not added by hand; there is no input event in that case, but a change 3998 $(':input').on('change', function () { 3999 console.log('input change!'); 4000 if (TC.formWatch.changed === false) { 4001 TC.formWatch.enable(); 4002 TC.formWatch.changed = true; 4003 canClose = false; 4004 } 4005 }); 4006 4007 $('button[type="submit"]').on('mousedown', function () { 4008 //TC.formWatch.changed = true; 4009 //if (this.id.toLowerCase() !== 'backbutton') 4010 if (this.id?.toLowerCase() === TC.formWatch.subBtn.id?.toLowerCase())//only if clicked on the initialized submit button 4011 TC.formWatch.subBtn.clicked = true; 4012 }); 4013 4014 $('input[type=checkbox]').on('click', function () { 4015 console.log('input[type=checkbox] click!'); 4016 if (TC.formWatch.changed === false) { 4017 TC.formWatch.enable(); 4018 TC.formWatch.changed = true; 4019 canClose = false; 4020 } 4021 }); 4022 4023 $('.checkbox').on('click', function () { 4024 console.log('.checkbox click!'); 4025 if (TC.formWatch.changed === false) { 4026 TC.formWatch.enable(); 4027 TC.formWatch.changed = true; 4028 canClose = false; 4029 } 4030 }); 4031 4032 $('textarea').on('input', function () { 4033 console.log('textarea input!'); 4034 if (TC.formWatch.changed === false) { 4035 TC.formWatch.enable(); 4036 TC.formWatch.changed = true; 4037 canClose = false; 4038 } 4039 }); 4040 } 4041 }, 4042 enable: function () { 4043 canClose = false; 4044 this.subBtn.el.removeProp('disabled'); 4045 this.subBtn.el.removeAttr('disabled'); 4046 } 4047} 4048
4049//$(document).ready(function () { 4050// if (window.location.href.indexOf('Registrar/ViewTranscript_v2.aspx') >= 0) { 4051// $.getScript('responsive/js/badges/badges.js', function () { 4052// TC.LearnerBadges.loadBadges('#badges', learnerid, 'admin'); 4053// }) 4054// } 4055//}); 4056 4057var showError = function (t) { 4058 bootbox.alert({ 4059 message: 'There has been an issue starting this course. Details: ' + t, 4060 closeButton: false 4061 }); 4062}; 4063 4064var doLPRollupRefresh = function (lpid, uid, returnURL) { 4065 $('#refreshLPSpan').hide(); 4066 $.ajax({ 4067 url: baseUrl + "/Student/MyLPHandler.ashx", 4068 async: false, 4069 cache: false, 4070 data: { "lpid": lpid, "uid": uid, "op": "doLPRollup" } 4071 }).done(function (result) { 4072 if (result) { 4073 var s = result.result; 4074 var m = result.error; 4075 if (s == false || s == "false") { 4076 bootbox.alert('Failed to rollup the learning path'); 4077 } 4078 else { 4079 // bootbox.alert('rolled up the learning path'); 4080 window.location = returnURL; 4081 } 4082 } 4083 return false; 4084 }); 4085}; 4086 4087var doCertRefresh = function (cid, uid, rid) { 4088 $('#refreshLPSpan').hide(); 4089 $.ajax({
4090 url: baseUrl + "/Student/StudentLOHandler.ashx", 4091 async: false, 4092 cache: false, 4093 data: { "learnerID": uid, "learningObjectID": cid, "rid": rid, "op": "doCertRefresh" } 4094 }).done(function (result) { 4095 if (result) { 4096 var s = result.result; 4097 var m = result.error; 4098 if (s == false || s == "false") { 4099 bootbox.alert({ 4100 message: 'Failed to clear certificate.', 4101 closeButton: false 4102 }); 4103 } 4104 else { 4105 bootbox.alert({ 4106 message: 'Certificate cleared.', 4107 closeButton: false 4108 }); 4109 } 4110 } 4111 return false; 4112 }); 4113} 4114 4115$(document).ready(function () { 4116 // let's add an and after each rule row 4117 $.each($('div.rule-grouping'), function () { 4118 let rules = $(this).find('tr'); 4119 let multirule = $(this).find('.multi-rule-matching'); 4120 if (rules.length < 3) { 4121 multirule.hide(); 4122 } 4123 4124 }); 4125 $.each($('table.rules-table tr ul'), function () { 4126 let rules = $(this).find('li'); 4127 $.each(rules, function (index) { 4128 if (index < rules.length - 1) 4129 $("<li style='list-style-type:none;padding-left:20px;'>and</li>").insertAfter($(this)); 4130 }); 4131 4132 }); 4133 4134 $(document).on('click', '#submenu .nav a', function (e) { 4135 e.preventDefault(); 4136 const url = $(this).attr('href'); 4137 const overlay = `<div class="overlay" style="height:100%;width:100%;position:absolute;background-color:rgba(39,39,39,0.5);z-index:9999;top:0;"><div class="dash-loader"></div> </div>`; 4138 $('body').append(overlay).css('position', 'relative').css('overflow', 'hidden').css('pointer-events', 'none'); 4139 window.location = url; 4140 }); 4141}); 4142 4143
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.