1/*File for common javascript*/ 2var COMMON = (function () { 3 4 return { 5 getListing: function(type,cb){ 6 $.get(base_url + 'index.php/common/get-listing?&type=' + type, function (response) { 7 return cb(response); 8 }); 9 }, 10 addVimeoVideoUploadDropzone: function (dropzoneId, inputId) { 11 var dropzone = new Dropzone(dropzoneId, { 12 url: base_url + 'index.php/job/vimeo-video-upload', 13 uploadMultiple: false, 14 maxFilesize: 500, 15 clickable: true, 16 autoProcessQueue: true, 17 addRemoveLinks: true, 18 createImageThumbnails: false, 19 previewTemplate: '<div class="hide"></div>', 20 acceptedFiles: '.mp4' , 21 params: {app_id: (document.getElementById('app_id')) ? document.getElementById('app_id').value : 0, _csrf: csrf, show_link:'yes' }, 22 init: function () { 23 this.on("sending", function (file, xhr, formaData) { 24 $(dropzoneId).parent().find('.dropzone-error').hide(); 25 $(dropzoneId).parent().find('.dropzone-container').html('Uploading file ... '); 26 }); 27 this.on("uploadprogress", function (file, progress, bytesSent) { 28 $(dropzoneId).parent().find('.dropzone-container').html('Uploading file ... ' + Math.ceil(progress)); 29 }); 30 this.on("success", function (file) { 31 $(dropzoneId).parent().find('.dropzone-error').hide(); 32 $(inputId).val(file.xhr.response); 33 $(dropzoneId).parent().find(' .dropzone-container').html('Upload finished successfully!'); 34 $('#notification-video_url').change(); 35 36 }); 37 this.on("error", function (file, message) { 38 $(dropzoneId).parent().find('.dropzone-error').html(message).show(); 39 }); 40 } 41 }); 42 }, 43 }; 44 45}(document, window)); 46 47$(document).ready(function(){ 48 if (window.NotificationConfig && typeof PubNub !== 'undefined') { 49 try { 50 var nc = window.NotificationConfig; 51 var pubnub = new PubNub({ 52 publishKey: nc.pubnubPublishKey, 53 subscribeKey: nc.pubnubSubscribeKey, 54 uuid: nc.userId 55 }); 56 pubnub.subscribe({ 57 channels: [nc.userChannelName], 58 withPresence: false 59 }); 60 pubnub.addListener({ 61 message: function (event) { 62 var message = event.message; 63 if (message && message.text && message.text.type === 'force_logout') { 64 alert(message.text.title + ': ' + message.text.text); 65 setTimeout(function () { 66 window.location.reload(); 67 }, 5000); 68 } 69 } 70 }); 71 } catch (e) { 72 console.error(e); 73 } 74 } 75 76 COMMON.addVimeoVideoUploadDropzone('#dropzone_vimeo_video_upload_hall_url', '#application-video_popup_hall_url'); 77 78 $('#pm_email').on('blur', function() { 79 var re = /([A-Z0-9a-z_-][^@])+?@[^$#<>?]+?\.[\w]{2,4}/.test(this.value); 80 if(!re) { 81 $("#save_email_forward").attr("disabled","disabled"); 82 $('#pm_email_error').show(); 83 } else { 84 $("#save_email_forward").removeAttr("disabled"); 85 $('#pm_email_error').hide(); 86 } 87 isFieldValEmail("#tl_email"); 88 isFieldValEmail("#poc_email"); 89 checkMultiValidEmails("#support_rps"); 90 }); 91 92 $('#tl_email').on('blur', function() { 93 var re = /([A-Z0-9a-z_-][^@])+?@[^$#<>?]+?\.[\w]{2,4}/.test(this.value); 94 if(!re) { 95 $("#save_email_forward").attr("disabled","disabled"); 96 $('#tl_email_error').show(); 97 } else { 98 $("#save_email_forward").removeAttr("disabled"); 99 $('#tl_email_error').hide(); 100 } 101 isFieldValEmail("#pm_email"); 102 isFieldValEmail("#poc_email");
103 checkMultiValidEmails("#support_rps"); 104 }); 105 106 $('#poc_email').on('blur', function() { 107 var re = /([A-Z0-9a-z_-][^@])+?@[^$#<>?]+?\.[\w]{2,4}/.test(this.value); 108 if(!re) { 109 $("#save_email_forward").attr("disabled","disabled"); 110 $('#poc_email_error').show(); 111 } else { 112 $("#save_email_forward").removeAttr("disabled"); 113 $('#poc_email_error').hide(); 114 } 115 isFieldValEmail("#tl_email"); 116 isFieldValEmail("#poc_email"); 117 checkMultiValidEmails("#support_rps"); 118 }); 119 120 $('#support_rps').on('blur', function() { 121 checkMultiValidEmails("#support_rps"); 122 isFieldValEmail("#tl_email"); 123 isFieldValEmail("#pm_email"); 124 isFieldValEmail("#poc_email"); 125 }); 126 127 function isFieldValEmail(id){ 128 var is_valid = /([A-Z0-9a-z_-][^@])+?@[^$#<>?]+?\.[\w]{2,4}/.test($(id).val()); 129 if (!is_valid){ 130 $("#save_email_forward").attr("disabled","disabled"); 131 }else{ 132 $("#save_email_forward").removeAttr("disabled"); 133 } 134 } 135 136 function checkMultiValidEmails(id){ 137 var emailList = $(id).val(); 138 var emails = emailList.replace(/\s/g,'').split(","); 139 var valid = true; 140 var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 141 142 for (var i = 0; i < emails.length; i++) { 143 if( emails[i] == "" || ! regex.test(emails[i])){ 144 valid = false; 145 } 146 } 147 148 if (!valid){ 149 $("#save_email_forward").attr("disabled","disabled"); 150 $('#support_rps_error').show(); 151 }else{ 152 $("#save_email_forward").removeAttr("disabled"); 153 $('#support_rps_error').hide(); 154 } 155 } 156 157 $('input[name="Application[enable_form_builder_v2]"]').change(function () { 158 159 if($('input[name="Application[enable_form_builder_v2]"]').is(":checked")){ 160 console.log('true'); 161 if (window.confirm('Are you sure you want to delete old registration form fields as they will not recover again?')) { 162 // enable_payment_v2 is permanently enabled (hidden); do not toggle it off. 163 164 // $('#application-enable_edit_profile_v2').bootstrapToggle('enable'); 165 $('#application-enable_edit_profile_v2').bootstrapToggle('on'); 166 // $('#application-enable_edit_profile_v2').bootstrapToggle('disable'); 167 168 // $('#application-enable_editprofile').bootstrapToggle('enable'); 169 $('#application-enable_editprofile').bootstrapToggle('off'); 170 // $('#application-enable_editprofile').bootstrapToggle('disable'); 171 }else{ 172 // $('#application-enable_edit_profile_v2').bootstrapToggle('enable'); 173 $('#application-enable_edit_profile_v2').bootstrapToggle('off'); 174 // $('#application-enable_edit_profile_v2').bootstrapToggle('disable'); 175 176 // $('#application-enable_editprofile').bootstrapToggle('enable'); 177 $('#application-enable_editprofile').bootstrapToggle('on'); 178 // $('#application-enable_editprofile').bootstrapToggle('disable'); 179 180 $('#application-enable_form_builder_v2').bootstrapToggle('off'); 181 } 182 183 }else{ 184 // enable_payment_v2 is permanently enabled (hidden); do not toggle it off. 185 // $('#application-enable_edit_profile_v2').bootstrapToggle('enable'); 186 $('#application-enable_edit_profile_v2').bootstrapToggle('off'); 187 // $('#application-enable_edit_profile_v2').bootstrapToggle('disable'); 188 189 // $('#application-enable_editprofile').bootstrapToggle('enable'); 190 $('#application-enable_editprofile').bootstrapToggle('on'); 191 // $('#application-enable_editprofile').bootstrapToggle('disable'); 192 } 193 }); 194 195}); 196 197function showInternalPrivacyNoticePopup(param){ 198 if(param=='download_selected_users'){
199 $('#internal-privacy-notice-download-link').attr('href',`javascript:APP_SETTINGS.getSelectedUserIds('download_users')`); 200 }else if(param=='download_selected_webinars'){ 201 $('#internal-privacy-notice-download-link').attr('href',`javascript:APP_SETTINGS.getSelectedWebinarIds('download_selected_webinars')`); 202 } 203 else{ 204 $('#internal-privacy-notice-download-link').attr('href',param); 205 } 206 $('#internal-privacy-notice').modal('show'); 207} 208 209function showInternalPrivacyNoticePopupForAllUsers(param){ 210 211 212 $.get(base_url + 'index.php/user/get-all-users-count', function (response) { 213 214 $("#calculating-users-batches-progress").addClass("hide"); 215 216 var response_arr = response.split("#"); 217 218 var total_recs = parseInt(response_arr[0]); 219 var per_page_items = parseInt(response_arr[1]); 220 221 var app_id = $("#app_id").val(); 222 223 var download_buttons_chunk_html = ''; 224 225 if(total_recs > per_page_items){ 226 227 var download_buttons_count = total_recs / per_page_items; 228 229 var j = 1; 230 231 download_buttons_chunk_html += "Note: The download file size of all users is quite large that is why the result has been divided into batches. But, you can still download the complete user report by clicking the Download All button.<br/><br/>"; 232 233 for(i=0;i<download_buttons_count;i++){ 234 download_buttons_chunk_html += "<a class='btn btn-success' style='margin: 5px;' href='"+ base_url +"index.php/user/"+app_id+"/download?page="+j+"'>Download - Batch " + j + "</a>" ; 235 j++; 236 } 237 238 if(download_buttons_chunk_html.length > 0){ 239 download_buttons_chunk_html = download_buttons_chunk_html.replace('undefined',''); 240 $("#download_urls_chunk").html(download_buttons_chunk_html); 241 } 242 } 243 $("#internal-privacy-notice-download-link-all-users").attr("href",param); 244 245 246 }).fail(function() { 247 alert("Unable to get registration form, please try again."); 248 }); 249 250 251 $('#internal-privacy-notice-all-users').modal('show'); 252} 253 254function closeInternalPrivacyNoticePopup(){ 255 $('#internal-privacy-notice').modal('hide'); 256} 257 258function showFieldsForBoothRep(ele){ 259 var selectedVal = $(ele).val(); 260 if (selectedVal == 3){ 261 $("#application-_newuser-form .boothrep-fields").removeClass("hide"); 262 }else{ 263 $("#application-_newuser-form .boothrep-fields").addClass("hide"); 264 } 265} 266 267$(document).ready(function() 268{ 269 $('#generate_attendee_certificates').on('shown.bs.modal', function () { 270 $('#certificate_success_alert').addClass('hidden'); 271 $('#generate_attendee_certificates_form .btn-primary').removeAttr('disabled'); 272 }) 273}) 274 275function startProcessingAttendeeCertificates() { 276 var formId = $("#generate_attendee_certificates_form"); 277 $(formId).removeData('validator'); 278 $(formId).removeData('unobtrusiveValidation'); 279 var validationRules = { 280 'certificate_attendee_email_list': "required", 281 'alert_email_addresses': "required" 282 }; 283 284 $("#generate_attendee_certificates_form").validate({ 285 rules: validationRules 286 }); 287 288 if ($('#generate_attendee_certificates_form').valid()) // check if form is valid 289 { 290 $('#generate_attendee_certificates_form .btn-primary').prop('disabled', true); 291 var formData = new FormData($('#generate_attendee_certificates_form')[0]); 292 $.ajax({ 293 type: 'POST', 294 // url: base_url + 'index.php/certificate-generation/generate-attendee-certificates/', 295 url: base_url + 'index.php/certificate-setting/generate-attendee-certificates/', 296 data: formData, 297 contentType: false, 298 processData: false, 299 success: function (data) { 300 data = JSON.parse(data); 301 $('#certificate_success_alert').removeClass('alert-success'); 302 $('#certificate_success_alert').removeClass('alert-error'); 303 $('#popup-message').text(data.message); 304 305 if (data.status === true) { 306 $('#certificate_success_alert').addClass('alert-success'); 307 } else { 308 $('#certificate_success_alert').addClass('alert-error'); 309 } 310 311 $('#certificate_success_alert').removeClass('hidden'); 312 $("#generate_attendee_certificates_form")[0].reset(); 313 314 }, 315 error: function (data) { // if error occurred 316 console.error(data); 317 $("#generate_attendee_certificates_form")[0].reset(); 318 }, 319 dataType: 'html' 320 }); 321 } else { 322 return; 323 } 324} 325 326function generateIndividualAttendeeCertificate(userid, apikey, language) { 327 $('#LoadingBar').css('display','block'); 328 $.ajax({ 329 type: 'POST', 330 url: base_url + 'index.php/certificate-generation/download-certificates/?access_key=' + apikey, 331 data: { 332 user_id: userid, 333 language: language, 334 is_generated_from_backend: true 335 }, 336 success: function (response) { 337 if (response) { 338 response = JSON.parse(response); 339 if (response.status == true) { 340 var title_certificate=''; 341 if(response.label.title_certificate){ 342 title_certificate=response.label.title_certificate; 343 }else{ 344 title_certificate='Certificates'; 345 } 346 $('#LoadingBar').css('display','none'); 347 $("#generate_attendee_certificates_individual").attr('data-user', userid); 348 $("#generate_attendee_certificates_individual").attr('data-apikey', apikey); 349 $("#generate_attendee_certificates_individual .modal-title").html(title_certificate); 350 $("#generate_attendee_certificates_individual .modal-body").html(response.data); 351 $("#generate_attendee_certificates_individual").modal(); 352 } else { 353 console.error(response) 354 } 355 } 356 $('#LoadingBar').css('display','none'); 357 }, 358 error: function (data) { // if error occurred 359 console.error(data); 360 $('#LoadingBar').css('display','none'); 361 } 362 }); 363} 364 365 366$(document).on("click", "#email_certificates", function () { 367 var userid = $("#generate_attendee_certificates_individual").attr('data-user'); 368 var apikey = $("#generate_attendee_certificates_individual").attr('data-apikey'); 369 var list = ""; 370 $('.certificate-block input[type=checkbox]:checked').each(function () { 371 list += "" + $(this).val() + ","; 372 }); 373 if(userid) { 374 $.ajax({ 375 type: 'POST', 376 url: base_url + 'index.php/certificate-generation/email-certificates/?access_key=' + apikey, 377 data: { 378 user_id: userid, 379 list: list, 380 is_generated_from_backend: true 381 }, 382 success: function (response) { 383 if (response) { 384 response = JSON.parse(response); 385 if (response.status == true) { 386 alert(response.data); 387 } else { 388 console.error(response) 389 } 390 } 391 }, 392 error: function (data) { // if error occurred 393 console.error(data); 394 } 395 }); 396 } 397}); 398 399$(document).on("click", "#delete_certificates", function () { 400 401 if(confirm("Are you sure to delete generated certificates. Please select OK to continue or Cancel to abort the certificates deletion process")) { 402 var userid = $("#generate_attendee_certificates_individual").attr('data-user'); 403 var apikey = $("#generate_attendee_certificates_individual").attr('data-apikey'); 404 if(userid) { 405 $.ajax({ 406 type: 'POST', 407 url: base_url + 'index.php/certificate-generation/delete-certificates/?access_key=' + apikey, 408 data: { 409 user_id: userid, 410 is_generated_from_backend: true 411 }, 412 success: function (response) { 413 if (response) { 414 response = JSON.parse(response); 415 if (response.status == true) { 416 alert("Certificates Deleted successfully"); 417 $('#generate_attendee_certificates_individual .close[type="button"]').trigger('click'); 418 } else { 419 console.error(response) 420 } 421 } 422 }, 423 error: function (data) { // if error occurred 424 console.error(data); 425 } 426 }); 427 } 428 } 429}); 430function checkGroupTool() { 431 var grpTool = $('#show_enable_group_registrations').val(); 432 if(grpTool=='yes') { 433 $('.is_show').show(); 434 }else{ 435 $('.is_show').hide(); 436 } 437} 438function verifyCardOnHold(current,userid,url) { 439 if(confirm('Are you sure that you want to capture funds?')){ 440 console.log(url); 441 $(current).hide(); 442 furl= 'https://'+url + '/en/form/capturePayment'; 443 if(userid) { 444 $.ajax({ 445 type: 'POST', 446 url: base_url + 'index.php/stripe', 447 data: { 448 user_id: userid, 449 url: furl, 450 }, 451 success: function (response) { 452 if (response) { 453 response = JSON.parse(response); 454 if (response.status == true) { 455 message = '<div class="col-md-12" style="z-index: 9999"><div class="alert alert-success" role="alert">Successfully Captured</div></div>'; 456 $('#user-listing').before(message); 457 $('.alert').fadeOut(4000); 458 } else { 459 message = '<div class="col-md-12"><div class="alert alert-error" role="alert">Failed</div></div>'; 460 $('#user-listing').before(message); 461 $('.alert').fadeOut(4000); 462 } 463 } 464 }, 465 error: function (data) { // if error occurred 466 console.error(data); 467 } 468 }); 469 } 470 } 471}
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.