PageSourceSearch

https://vpela.org.au/iparts/Events/Events/EventDisplayDisplay.js

js vpela.org.au collected 2026-10-08 09:22:37 UTC 13,371 bytes, 303 lines download raw bytes

1
2//We may have invalid .net validators when we want to submit the page for registering another, so we must ensure 
3//that these validators are reset so they will not still carry their previous error messages and yet be active.
4//As this method is only called AFTER a successful post, it will not interfere with normal validation behavior which would stop posting.
5jQuery(document).ready(function () { ResetValidators(); });
6
7//This method will make validator error messages go away
8function ResetValidators() {
9    if (typeof (Page_Validators) != "undefined") {
10        if (Page_IsValid) return;
11        for (var i = 0; i < Page_Validators.length; i++) {
12            var validator = Page_Validators[i];
13            validator.isvalid = true;
14            ValidatorUpdateDisplay(validator);
15        }
16    }
17}
18
19function Asi_Web_iParts_Events_EventDisplayDisplay(registrationOptionsGridId, selectedRegistrationOptionHiddenId, updateRegistrationOptionButtonId, selectedOptionHiddenId, isTemplate, pageTitleContainer, waitListButtonId, hiddenWaitListChoiceId, cancelAttendeeButtonId, registerButtonId, isStaff, isDeletedId) {
20
21    var RefreshButtonId = null;
22    var SelectedContactId = null; // ID of the hidden control that contains a party id or contact key. Used with register someone else.
23    var AddressId = null; // ID of the hidden control that contains a address id. Used with register someone else.
24    var EditAddressId = null; //same as AddressId but for passing back edited address id.  Used when editing registration+
25    var IsGuestId = null; // ID of hidden control that contains a boolean telling whether we're registering a guest.
26    var RefreshRedirectButtonId = null;
27
28    this.OnLoad = function() {
29        if (isTemplate == 'True' && pageTitleContainer != "") {
30            jQuery("#" + pageTitleContainer + " h2.PanelTitle").addClass("sysicon--before sysicon-event-template");
31        }
32    }
33    // public functions
34    //open the address edit for primary registrant
35    this.RegistantInfoEdit_Clicked = function(editUrl, dialogTitle, clientId) {
36        EditAddressId = clientId;
37        var dialog = ShowDialog(editUrl, null, 1024, 768, dialogTitle, null, 'E', this.RegistrantInfoEdit_Callback, null, false, true, null, null);
38    };
39
40    //callback for registrant address edit
41    this.RegistrantInfoEdit_Callback = function (dialogWindow) {
42        if (typeof (dialogWindow.AddressId) == 'undefined') return;
43        $get(EditAddressId).value = dialogWindow.AddressId;
44        jQuery('#' + EditAddressId).change();
45    };
46
47    //Register button state
48    this.RegisterButtonState = function() {
49        EventDisplayButtonsState();
50        disablePage();
51    }
52
53    //clear any validation errors on page so we can perform submit
54    this.ClearPageValidation = function () {
55        EventDisplayButtonsState();
56        if (typeof(Page_ValidationActive) != "undefined") {
57            Page_ValidationActive = false;          
58        }
59        disablePage();
60    };
61
62    this.ConfirmCancellation = function() {
63        var answer = confirm('Cancelling this registration will also cancel all guest registrations.');
64        if (answer)
65            this.ClearPageValidation();
66        return answer;
67    };
68
69    // edit an event
70    this.EditEvent = function (eventKey, url, refreshButtonId, refreshRedirectButtonId, isTemplate, windowTitle) {
71        if (url == null || url == "") return;
72        if (url.indexOf("?") >= 0)
73            url += "&EventKey=" + eventKey;
74        else
75            url += "?EventKey=" + eventKey;
76        url += "&IsTemplate=" + isTemplate;
77        url += "&IsPopup=True";
78        RefreshButtonId = refreshButtonId;
79        RefreshRedirectButtonId = refreshRedirectButtonId;
80        var dialog = ShowDialog(url, null, "1200", "768", windowTitle, null, "E", null, null, false, false, EventEditOnClose, null);
81
82        // dialog.set_destroyOnClose(true);
83    };
84
85
86    // register someone else
87    this.RegisterSomeoneElse = function (url, selectedContactId, addressId, pageTitle, isGuestClientId, guestAddModeClientId, mode) {
88        EventDisplayButtonsState();
89        SelectedContactId = selectedContactId;
90        AddressId = addressId;
91        IsGuestId = isGuestClientId;
92        if (guestAddModeClientId != null)
93            $(guestAddModeClientId).value = mode;
94        ShowDialog(url, null, 1024, 768, pageTitle, null, 'E', RegisterSomeOneElseCallback, 'ObjectBrowser', false, true);
95    };
96
97    //cancel attendee registration
98    this.CancelAttendee = function() {
99        jQuery("#" + cancelAttendeeButtonId).click();
100    };
101
102    this.ConfirmAttendeeCancellation = function () {
103        var answer = confirm('Cancelling this registration will also cancel all guest registrations.');
104        if (answer)
105            this.CancelAttendee();
106        return answer;
107    };
108
109    this.SingleRegistrationOptionOnClick = function() {
110                var $waitListRadioButton = jQuery("input[name$='WaitListRadioButtons']");
111                if ($waitListRadioButton != null) {
112                    $waitListRadioButton.change(function() {
113                        if (jQuery(this).is(":checked")) {
114                            jQuery("#" + hiddenWaitListChoiceId).val(jQuery(this).val());
115                            jQuery("#" + registerButtonId).click();
116                        }
117                    });
118                }
119    }
120    // a registration option radio button has been clicked
121    this.RegistrationOptionOnClick = function (sender, functionId) {
122        // ensure only the sender radio button is checked
123        jQuery("#" + registrationOptionsGridId + " [type=radio]").removeAttr("checked");
124        sender.checked = true;
125        // send back the id of the option selected so we can focus on it again
126        var $hiddenTxtBox = jQuery('#' + selectedOptionHiddenId);
127        if ($hiddenTxtBox && $hiddenTxtBox.length > 0) {
128            $hiddenTxtBox.val(sender.id);         
129        }
130        // if the selected function hasn't changed then there is nothing to do
131        if ($(selectedRegistrationOptionHiddenId).value == functionId) return;
132        // save the selected function
133        $(selectedRegistrationOptionHiddenId).value = functionId;
134        disablePage();
135        // hunt for any waitlist active division in Telerik grid's current row and show options  
136        var $owningRow = jQuery("#" + sender.id).closest(".rgRow");
137        if ($owningRow != null) {
138            var $waitListDiv = $owningRow.find("div[id$='OptionDivRegistrationFull']");
139            if ($waitListDiv != null && $waitListDiv.is(":visible")) {
140                var $waitListChoiceDiv = $waitListDiv.find("div[id$='OptionDivWaitList']");
141
142                // Display WaitList/Register options box 
143                if ($waitListChoiceDiv != null) {
144                    //now have any choice in options perform the postback click instead
145                    var $waitListRadioButton = $waitListChoiceDiv.find("input[name$='OptionWaitListRadioButtons']");
146                    if ($waitListRadioButton != null) {
147
148                        // Non-staff users can only Waitlist.
149                        var $AddToWaitlistRadioButton = $waitListChoiceDiv.filter(function () {
150                            return this.value === "Waitlist";
151                        });
152                        if ($AddToWaitlistRadioButton != null && isStaff === "False") {
153                            $AddToWaitlistRadioButton.prop("checked", true);
154                            jQuery("#" + hiddenWaitListChoiceId).val($AddToWaitlistRadioButton.val());
155                            jQuery("#" + waitListButtonId).click();
156                            return;
157                        }
158                        
159                        // Give staff users option to Waitlist or Register.
160                        $waitListRadioButton.change(function () {
161                            if (jQuery(this).is(":checked")) {
162                                jQuery("#" + hiddenWaitListChoiceId).val(jQuery(this).val());
163                                jQuery("#" + waitListButtonId).click();
164                            }
165                        });
166                        var $addButton = jQuery("input[id$='AddButton']");
167                        if ($addButton != null) {
168                            $addButton.hide();
169                        }
170                    }
171                }               
172            }
173        }
174        $(updateRegistrationOptionButtonId).click();
175        
176    };
177
178    // private functions
179
180    // called when closing the event edit popup
181    function EventEditOnClose(radWin) {
182        var refresh = false;
183        var redirect = false;
184        if (radWin != null) {
185            if (typeof (radWin.IsDirty) == 'boolean') refresh = radWin.IsDirty;
186            if (radWin.hasOwnProperty("AsiRedirectToLayout") && typeof (radWin.AsiRedirectToLayout) == 'boolean') redirect = radWin.AsiRedirectToLayout;
187        }
188        else {
189            // if for some reason we dont get a rad window then assume we should refresh
190            refresh = true;
191        }
192        if (refresh)
193        {
194            if (redirect && RefreshRedirectButtonId != null) {
195                $(RefreshRedirectButtonId).click();
196            }
196 else if (RefreshButtonId != null) {
197                $(RefreshButtonId).click();
198            }
199        }
200        if (radWin.isDeleted) {
201            $(isDeletedId).value = "true";
202            $(RefreshButtonId).click();
203        }
204    };
205    
206    // called when selecting or creating a contact in the register someone else pop-up
207    function RegisterSomeOneElseCallback(radwindow) {
208        if (AddressId != null) {
209            if (radwindow.addressId != null) {
210                $(AddressId).value = radwindow.addressId;
211            }
212            else {
213                $(AddressId).value = null;
214            }
215        }
216
217        // IsGuestId will be null if we're doing a "non-guest" register someone else
218        if (IsGuestId != null && radwindow.registeredSomeone)
219            $(IsGuestId).value = "true";
220
221        $hiddenWaitListChoice = jQuery("input[id$='HiddenWaitListChoice']");
222        if (radwindow.onWaitList)
223            $hiddenWaitListChoice.val("GuestWaitlist");
224
225        if (SelectedContactId != null) {
226            // Here radWindow is a ContactAccountCreator and we've
227            // just created a new account. Register someone else uses the party id.
228            if (radwindow.newPartyId != null) {
229                $(SelectedContactId).value = radwindow.newPartyId;
230            }
231                // fallback
232            else {
233                $(SelectedContactId).value = null;
234            }
235  
236            document.forms[0].submit();
237        }
238    }
239
240    function EventDisplayButtonsState() {
241        var forms = document.getElementsByTagName('form');
242        for (var i = 0; i < forms.length; i++) {
243            var input = forms[i].getElementsByTagName('input');
244            for (var y = 0; y < input.length; y++) {
245                if (input[y].type == 'button') {
246                    input[y].disabled = 'disabled';
247                }
248            }
249        }
250    }
251        
252}
253
254jQuery(document).ready(function (event) {   
255    if (jQuery("div[id$=_ProgramSessionsCalendar]") !== null) {
256        jQuery('.PersonDisplay').on("click", function (e) {
257            var checkBox = jQuery("#CheckBoxItineraryOnly");
258            if (checkBox !== null && checkBox.is(':checked'))
259                checkBox.prop("checked", false);
260        });
261    }
262});
263
264document.addEventListener('click', function (event) {
265    var target = event.target || event.srcElement;
266    if (target.tagName === 'INPUT' && target.type === 'button') {
267        var dataRegister = target.getAttribute('data-register');
268        if (dataRegister === 'waitlistsomeoneelse') {
269            var inputs = document.querySelectorAll("input[id$='HiddenWaitListChoice']");
270            if (inputs.length > 0) {
271                var hiddenInput = inputs[0];
272                if (hiddenInput.value.trim() === '') {
273                    hiddenInput.value = 'GuestWaitlist';
274                }
275            }
276        }
277    }
278
279    if (target.tagName === 'INPUT' && target.type === 'radio' && (target.value === 'Register' || target.value === 'Waitlist')) {
280        var button = document.querySelector('input[type="submit"][id$="ButtonWaitListChoice"]');
281        if (button) {
282            var hiddenInput = document.querySelector("input[id$='HiddenWaitListChoice']");
283            hiddenInput.value = target.value;
284            button.click();
285        }
286    }
287
288    if (target.tagName === 'INPUT' && target.type === 'submit') {
289        if (target.id.indexOf("_setProxyButton") !== -1) {
290            localStorage.setItem("OBOUserSelected", "true");   
291        }
292    }
293});
294
295window.addEventListener('load', function () {
296    if (localStorage.getItem("OBOUserSelected")) {
297        localStorage.removeItem("OBOUserSelected");
298        var refreshBtn = document.getElementById("OBORefreshButton");
299        if (refreshBtn) {
300            refreshBtn.click();
301        }
302    }
303});

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.