Intro to Coding with HTML & CSS - LibCal - University of Victoria Libraries .

Html Coding

57 Views

        

<p> Intro to Coding with HTML & CSS -</p><p> LibCal -</p><p> University of Victoria Libraries</p><p>

Skip to Main Content

Rich McCue

Digital Scholarship Commons

");

if (id == "name") {

// dont guess which element to focus - just let the caller set it

} else if (id == "email") {

jQuery("#" + id).focus();

} else if (id > "0") {

jQuery("#q" + id).focus();

}

return false;

}

function refreshPositionInQueue() {

if (queueId == 0) {

return;

}

jQuery.ajax({

url: '/ajax/event/refresh/' + queueId,

type: 'post',

dataType: 'json',

});

}

function toggleHybridRegistrationType() {

var isHybrid = springyCommon.parseInt(jQuery("#is_hybrid").val());

if (isHybrid > 0) {

var registrationType = springyCommon.parseInt(jQuery('input[name="hybrid_registration_type"]:checked').val());

jQuery('#s-lc-multi-seat-physical').toggle(registrationType === springyPage.registrationTypePhysical);

jQuery('#s-lc-multi-seat-online').toggle(registrationType === springyPage.registrationTypeOnline);

jQuery('.s-lc-registration-type-physical').toggle(registrationType === springyPage.registrationTypePhysical);

jQuery('.s-lc-registration-type-online').toggle(registrationType === springyPage.registrationTypeOnline);

jQuery('#s-lc-online-notice').toggle(registrationType === springyPage.registrationTypeOnline);

}

}

function beginRegistration() {

var isHybrid = springyCommon.parseInt(jQuery("#is_hybrid").val());

var registrationType;

var registrationLabel = springyPage.registration;

var multiOptionId = '#reg_multi_pre';

if (isHybrid > 0) {

registrationType = springyCommon.parseInt(jQuery('input[name="hybrid_registration_type"]:checked').val());

if (registrationType === springyPage.registrationTypePhysical) {

multiOptionId = '#physical_multi_pre';

registrationLabel = springyPage.inPersonRegistration;

} else {

multiOptionId = '#online_multi_pre';

registrationLabel = springyPage.onlineRegistration;

}

} else {

registrationType = springyCommon.parseInt(jQuery('input[name="single_registration_type"]').val());

}

var seats = springyCommon.parseInt(jQuery(multiOptionId).val(), 1);

workingAlert();

jQuery("#s-lc-event-sub").prop('disabled', true);

jQuery.ajax({

url: "/ajax/event/begin/3665428",

type: "post",

dataType: "json",

data: {

registrationType: registrationType,

seats: seats,

},

})

.always(function (data) {

stopAlert();

jQuery("#s-lc-event-sub").prop('disabled', false);

})

.done(function(data) {

if (data.redirect) {

window.location = data.redirect;

return false;

}

queueId = data.id;

// pass registration type to the second form on the page

jQuery('input[name="registration_type"]').val(registrationType);

// display things differently if its a full registration or waitlist

if (queueId != "0") {

// full registration

var buttonAdditionalText = '';

if (data.seatsToReserve == 2) {

buttonAdditionalText = " + Guest";

} else if (data.seatsToReserve > 2) {

buttonAdditionalText = " + " + (data.seatsToReserve - 1) + " Guests";

}

var buttonText = 'Register';

var seatsLeft = data.seats - data.seatsTaken;

var seatsLeftString = seatsLeft + ' ' + (seatsLeft == 1 ? "seat\u0020left" : "seats\u0020left");

jQuery("#lc-event-seats-left").html(registrationLabel + ' (' + seatsLeftString + ')');

jQuery("#lc-event-reg-notice").html('Register\u0020now');

jQuery("#s-lc-event-sub, #s-lc-event-asub").text(buttonText + buttonAdditionalText);

jQuery("#s-lc-booking-queue-warning").text(data.warningText).show();

if (data.totalCost > 0) {

var bookingCostInfoText = "This\u0020booking\u0020will\u0020cost\u0020\u007Bamount\u007D.";

var totalCost = bookingCostInfoText.replace("{amount}", springSpace.formatCurrency(data.totalCost));

jQuery("#s-lc-event-registration-cost").html(totalCost).show();

}

} else {

// waiting list

jQuery("#lc-event-seats-left").hide();

var waitingListNotice = 'This\u0020session\u0020is\u0020\u003Cstrong\u003Ealready\u0020full\u003C\/strong\u003E.\u0020Please\u0020enter\u0020your\u0020details\u0020to\u0020be\u0020placed\u0020on\u0020a\u0020waiting\u0020list.' +

'
There\u0020are\u0020currently\u0020\u007Bcount\u007D\u0020registrants\u0020ahead\u0020of\u0020you\u0020on\u0020the\u0020waiting\u0020list.'.replace('{count}', data.waitListCount);

jQuery("#lc-event-reg-notice").html(waitingListNotice);

jQuery("#s-lc-event-sub, #s-lc-event-asub").text('Register\u0020for\u0020Waiting\u0020List');

}

jQuery("#event-pre-registration").hide();

jQuery("#event-registration-form").show().on('change', refreshPositionInQueue);

})

.fail(ajaxErrorHandler);

return false;

}

function createFullRegistrationSuccessMessage(isPaymentRequired) {

if (!isPaymentRequired) {

return "Success\u0021\u0020You\u0020have\u0020successfully\u0020registered.\u0020If\u0020you\u0020have\u0020provided\u0020an\u0020email\u0020with\u0020your\u0020registration,\u0020a\u0020confirmation\u0020message\u0020has\u0020been\u0020sent.";

}

return "You\u0020have\u0020been\u0020added\u0020to\u0020the\u0020event\u0020registration\u0020list.\u0020However,\u0020the\u0020registration\u0020process\u0020is\u0020not\u0020complete.\u0020You\u0020will\u0020need\u0020to\u0020make\u0020your\u0020payment\u0020at\u0020the\u0020location\u0020of\u0020the\u0020event.";

}

function createPaymentButtons(data) {

return '' +

'

' + '

' + '

' + "You\u0020have\u0020chosen\u0020to\u0020pay\u0020for\u0020this\u0020event,\u0020\u007Btitle\u007D,\u0020in\u0020person.\u0020\u0020Please\u0020remember\u0020to\u0020pay\u0020on\u0020the\u0020day\u0020this\u0020event\u0020starts.".replace("\u007Btitle\u007D", "Intro\u0020to\u0020Coding\u0020with\u0020HTML\u0020\u0026\u0020CSS") + '

' + '' + '
';

}

function createPostRegistrationSuccessHtml(data) {

var message;

var isPaymentRequired = (data.totalCost > 0);

if (data.fullRegistration) {

message = createFullRegistrationSuccessMessage(isPaymentRequired);

} else {

message = "You\u0020have\u0020successfully\u0020registered\u0020for\u0020the\u0020waiting\u0020list\u0021\u0020You\u0020will\u0020receive\u0020a\u0020confirmation\u0020email\u0020shortly.";

}

var html = "

" + message + "

";

if (data.fullRegistration && isPaymentRequired) {

var costDisplay = springSpace.formatCurrency(data.totalCost);

var costInfo = "This\u0020booking\u0020will\u0020cost\u0020\u007Bamount\u007D.".replace("\u007Bamount\u007D", costDisplay);

html += '

' + costInfo + '

';

}

return html;

}

function submitRegistration() {

jQuery("#lc-s-event-register").find(".form-control").attr("aria-invalid", false);

removeErrors();

if (!bookingFormValidation()) {

// we had an issue validating the booking form - stop registration here

return false;

}

workingAlert();

jQuery("#s-lc-event-sub").prop('disabled', true);

jQuery.ajax({

url: "/ajax/event/submit/3665428",

type: "post",

dataType: "json",

data: {

id: queueId,

formData: jQuery("#lc-s-event-register").serializeJSON(),

},

})

.always(function (data) {

stopAlert();

jQuery("#s-lc-event-sub").prop('disabled', false);

})

.done(function(data) {

jQuery("#lc-s-event-register").hide();

jQuery("#s-lc-event-register-result-message").html(createPostRegistrationSuccessHtml(data)).fadeIn("slow");

jQuery("#s-lc-pay-in-person-button").on("click", onPayInPersonButtonClick);

jQuery("html, body").animate({scrollTop: 0}, "slow");

jQuery("#alert-success-msg").focus();

jQuery("#s-lc-event-register-success-div").show().focus();

})

.fail(ajaxErrorHandler);

return false;

}

function onPayInPersonButtonClick() {

jQuery("#s-lc-pay-buttons-container").hide();

jQuery("#s-lc-pay-in-person-message").show();

}

jQuery(function() {

accessibleIcons();

toggleHybridRegistrationType();

jQuery('input[name="hybrid_registration_type"]').on('change', toggleHybridRegistrationType);

jQuery('#lc-s-event-pre-register').on('submit', beginRegistration);

jQuery("#lc-s-event-register").on("submit", submitRegistration);

jQuery('.s-lc-timezone-change').on('click', springyPublic.showTimezoneModal);

});