PageSourceSearch

https://ccdi.ca/scripts/20240816_nregform.js

js ccdi.ca collected 2026-10-02 03:51:59 UTC 14,976 bytes, 354 lines download raw bytes

1var ccdi_payment_success = 'https://ccdi.ca/thank-you';
2var ccdi_remote = 'https://portal.ccdi.ca';
3var langcode = 0;
4var ce_eventid = 0;
5var ce_div = '';
6var submitted = false;
7var ce_forminfo = {"invited":"", "regtype":"","price":0.00,"taxes":[],"total":0.00,"province":"Ontario", "lang":"en"};
8var iin = {"previous":["Previous","Précédent"],"next":["Next","Suivant"],"required":["is a required field and cannot be left blank.","est un champ obligatoire et ne peut pas être laissé vide."],
9		"error":["Sorry an error occured. Please try again later.","Désolé, une erreur s'est produite. Veuillez réessayer plus tard."], 
10		"regtype":["Please select the type of registration that is most appropriate for you","Veuillez sélectionner le type d'inscription qui vous convient le mieux" ],
11		"general":["General Public","Grand public"], "ip":["CCDI Individual Practitioner","Praticien·ne individuel·le du CCDI"], "partner":["Employer Partner","Employeur Affilié"], "guest":["Invited Guest","Invité"],
12		"student" :["Student","Étudiant-e"], "senior" :["Senior","Personne âgée"], "nonprofit":["Non-Profit","Sans but lucratif"],
13		
14		"invitedby":["Invited By (email)","Invité par (email)"],"price":["Price","Prix"],
15		"closed":["This COPE is not currently open for registration.","Ce COPE n'est pas ouvert actuellement aux inscriptions."],
16		"email":["A valid email address is required.","Une adresse email valide est exigée."],
17		"complete":["Complete Registration","Enregistrement complet"],
18		"nameoncard":["Name on Card","Nom sur la carte"],
19		"cardnumber":["Card Number","Numéro de Carte"],
20		"billingpc":["Billing Postal Code","Code postal de facturation"],
21		"securitycode":["Security Code","Code de sécurité"],
22		"paymentinfo":["Payment Information","Informations de paiement"],
23		"summarytitle":["Registration Summary","Résumé de l'inscription"],
24		"errcardname":["Name on Card is a required field.","Le nom sur la carte est un champ obligatoire"],
25		"errcardnumber":["Card Number is a required field.","Le numéro de carte est un champ obligatoire"],
26		"errcardcode":["Security Code is a required field.","Le code de sécurité est un champ obligatoire"],
27		"registrationfor":["Registration for", "Inscription pour"],
28		
29		"emailextra":["If you are an employee of a <a href=\"https://ccdi.ca/employers/\" target=\"blank\">CCDI Employer Partner</a> organization, please enter your work email address.",
30		"Si vous êtes un·e employé·e <a href=\"https://ccdi.ca/employeurs/\" target=\"blank\">d’unemployeur affilié au CCDI</a>, veuillez saisir votre adresse courriel professionnelle."],
31		
32		"regtypeextra":["If you are an employee of a <a href=\"https://ccdi.ca/employers/\" target=\"blank\">CCDI Employer Partner</a> organization, please select \"Employer Partner\"",
33		"Si vous êtes un·e employé·e <a href=\"https://ccdi.ca/employeurs/\" target=\"blank\">d’unemployeur affilié au CCDI</a>, veuillez sélectionner \"Employeur affilié\""],
34		
35		"yesoption":["Yes","Oui"], "nooption":["No","Non"], "expirymonth":["Expiry Month","Mois d'expiration"], "expiryyear":["Expiry Year","Année d'expiration"],
36		"preamble":["While our payment platforms accept most major credit cards, please note that it does not support American Express cards or corporate cards. You are advised to utilize other major cards in order to make payments successfully on this platform.",
37			"Bien que nos plates-formes de paiement acceptent la plupart des principales cartes de crédit, veuillez noter qu'elles ne prennent pas en charge les cartes American Express ou les cartes d'entreprise. Il est conseillé d'utiliser d'autres cartes principales afin d'effectuer des paiements avec succès sur cette plate-forme."]};
38
39var ce_ed = {};		
40			
41function ce_loadData(ID){
42	ce_div = '#'+ID;
43	$.getJSON(ccdi_remote+"/neaj?act=event&id="+ce_eventid, function (data) {
44		if(data.result){
45				ce_ed = data;
46				langcode = ce_ed.langcode;
47				if(langcode==1){
48					ce_forminfo.lang = "fr";
49				}else{
50					ce_forminfo.lang = "en";
51				}
52				ce_displayForm();
53		}else{
54				$(ce_div).html("<p><strong>"+data.message+"</strong></p>");	
55		}
56	});
57}			
58
59function ce_displayForm(){
60	var astr = '<div class="ccdi_web_container">';
61	astr += '<div class="ccdi_web_row ccdi_web_title">Registration for '+ce_ed.title+'</div>';
62	for(var n =0;n<ce_ed.fields.length;n++){
63		var fr = ce_ed.fields[n];
64		astr += '<div class="ccdi_web_row ccdi_field"><label class="ccdi_web_label" for="ccdi_web_field_'+fr.id+'">';
65		if(fr.req){
66			astr += "<strong>"+fr.label+" *</strong></label><br>";
67		}else{
68			astr += fr.label+"</label><br>";
69		}
70		if(fr.type=="CITY"||fr.type=="EMAIL"||fr.type=="FIRSTNAME"||fr.type=="LASTNAME"||fr.type=="STREET"||fr.type=="POSTALCODE"||fr.type=="TEXT"){
71			if(fr.type=="EMAIL"){
72			  astr += iin.emailextra[langcode]+'<br>';
73			}
74			astr += '<input type="text" id="ccdi_web_field_'+fr.id+'" value="'+fr.value+'">';
75			
76			
77		}
78		if(fr.type=="RADIO"){
79			
80			for(var p=0;p<fr.options.length;p++){
81				astr += '<label style="line-height:1;">';
82				astr += '<input type="radio" name="ccdi_web_field_'+fr.id+'" value="'+fr.options[p].value+'"> '+fr.options[p].value+'</label>';
83			}
84		
85		
86		}
87		if(fr.type=="SELECT"){
88			astr += '<select id="ccdi_web_field_'+fr.id+'">';
89			for(var p=0;p<fr.options.length;p++){
90				astr += '<option value="'+fr.options[p].value+'"';
91				if(fr.value==fr.options[p].value){
92					astr +=' SELECTED';
93				}
94				astr += '>'+fr.options[p].value+'</option>';
95			}
96			astr += '</select>';
97		}
98		if(fr.type=="MULTITEXT"){
99			astr += '<textarea id="ccdi_web_field_'+fr.id+'" cols="40" rows="4">'+fr.value+'</textarea>';
100		}
101		if(fr.type=="YESNO"){
102			astr += '<select id="ccdi_web_field_'+fr.id+'">';
103			if(fr.value=="Yes"){
104				astr += '<option value="Yes" SELECTED>'+iin.yesoption[langcode]+'</option><option value="No">'+iin.nooption[langcode]+'</option>';
105			}else{
106				astr += '<option value="Yes">'+iin.yesoption[langcode]+'</option><option value="No" SELECTED>'+iin.nooption[langcode]+'</option>';
107				
108			}
109			astr += '</select>';
110		}
111		if(fr.type=="PROVINCE"){
112			astr += '<select id="ccdi_web_field_'+fr.id+'">';
113			for(var p=0;p<fr.options.length;p++){
114				astr += '<option value="'+fr.options[p].id+'"';
115				if(fr.value==fr.options[p].id){
116					astr +=' SELECTED';
117				}
118				astr += '>'+fr.options[p].name+'</option>';
119			}
120			astr += '</select>';
121		}
122		astr += '</div>';
123	}
124	astr += '<div class="ccdi_web_row">&nbsp;</div>';
125	astr += '<div class="ccdi_web_row"><label for="regtype"><strong>'+iin.regtype[langcode]+' *</strong></label>';
126	astr += iin.regtypeextra[langcode]+'<br>&nbsp;<br>';
127	
128
129	if(ce_forminfo.regtype==""){
130		ce_forminfo.regtype = "PARTNER";
131	}
132	for(var n=0;n<ce_ed.regtypes.length;n++){
133			astr += '<label style="line-height:1;"><input type="radio" name="ccdi_web_regtype" value="'+ce_ed.regtypes[n].type+'" onchange="ce_updateType()"';
134			if(ce_forminfo.regtype==ce_ed.regtypes[n].type){
135		   		ce_forminfo.price = ce_ed.regtypes[n].price;
136				astr += " CHECKED";
137			}
138			astr +='>';
139			if(ce_ed.regtypes[n].type=="GENERAL"){
140				astr += iin.general[langcode];
141			}
142			if(ce_ed.regtypes[n].type=="INDIVIDUAL"){
143				astr += iin.ip[langcode];
144			}
145			if(ce_ed.regtypes[n].type=="PARTNER"){
146				astr += iin.partner[langcode];
147			}
148			if(ce_ed.regtypes[n].type=="GUEST"){
149				astr += iin.guest[langcode];
150			}
151			if(ce_ed.regtypes[n].type=="STUDENT"){
152				astr += iin.student[langcode];
153			}
154			if(ce_ed.regtypes[n].type=="SENIOR"){
155				astr += iin.senior[langcode];
156			}
157			if(ce_ed.regtypes[n].type=="NONPROFIT"){
158				astr += iin.nonprofit[langcode];
159			}			
160			astr += '</label>';
161	}
162	astr += '</div>';
163	if(ce_forminfo.regtype=="GUEST"){
164		astr += '<div class="ccdi_web_row" id="ccdi_web_guestrow">';
165  }else{
166	astr += '<div class="ccdi_web_row" id="ccdi_web_guestrow" style="display:none;">';
167   }
168	astr += '<label for="guestinvite">'+iin.invitedby[langcode]+'</label><br>';
169	astr +='<input type="text" id="guestinvite" value=""></div>';
170	
171	astr += '<div class="ccdi_web_row">&nbsp;</div>';
172	astr += '<div class="ccdi_web_row">'+iin.price[langcode]+'<br>$<span id="ccdi_web_pricedisplay">'+ce_forminfo.price.toFixed(2)+'</span></div>';
173	astr += '<div class="ccdi_web_row">&nbsp;</div>';
174	astr += '<div class="ccdi_web_row"><input type="button" value="'+iin.next[langcode]+' >>" onclick="ce_validateForm()"></div>';
175	astr += '</div>';
176	$(ce_div).html(astr);	
177}
178
179function ce_validateForm(){
180	var te = "";
181	for(var n =0;n<ce_ed.fields.length;n++){
182		var fr = ce_ed.fields[n];
183		if(fr.type=="RADIO"){
184		  fr.value = $('input[name="ccdi_web_field_'+fr.id+'"]:checked').val();
185		}else{
186		  fr.value = $('#ccdi_web_field_'+fr.id).val();
187		}
188		if(fr.req){
189			if(fr.value==null||fr.value.length<1){
190				alert(fr.label+" "+iin.required[langcode]);
191				$('#ccdi_web_field_'+fr.id).focus();
192				return;
193			}
194		}
195		if(fr.type=="EMAIL"){
196			te = fr.value;
197			if(fr.value.indexOf("@")==-1){
198				alert(iin.email[langcode]);
199				$('#ccdi_web_field_'+fr.id).focus();
200				return;
201			}
202			if(fr.value.indexOf(".")==-1){
203				alert(iin.email[langcode]);
204				$('#ccdi_web_field_'+fr.id).focus();
205				return;
206			}			
207		}
208		if(fr.type=="PROVINCE"){
209			ce_forminfo.province = fr.value;
210		}
211	}
212	ce_forminfo.invited = $('#guestinvite').val();
213	if(ce_forminfo.regtype=="PARTNER"){
214		$.getJSON(ccdi_remote+"/neaj?act=verifypartner&email="+te+"&lang="+ce_forminfo.lang, function (data) {
215			if(data.result){
216				ce_loadTaxes();
217		}else{
218				alert(data.message);
219		}
220	});
221	}else{
222		ce_loadTaxes();	
223		
224	}	
225}
226
227function ce_loadTaxes(){
228	$.getJSON(ccdi_remote+"/neaj?act=taxes&province="+encodeURIComponent(ce_forminfo.province)+"&price="+ce_forminfo.price, function (data) {
229		if(data.result){
230			ce_forminfo.taxes = data.taxes;
231			ce_forminfo.total = ce_forminfo.price;
232			for(var n=0;n<ce_forminfo.taxes.length;n++){
233				ce_forminfo.total = ce_forminfo.total + ce_forminfo.taxes[n].amount;
234			}
235			ce_confirmationForm()
236		}
237	});
238}
239
240function ce_confirmationForm(){
241	var astr = '<div class="ccdi_web_container">';
242	astr += '<div class="ccdi_web_row">'+iin.summarytitle[langcode]+'</div>';
243	astr += '<div class="ccdi_web_row">&nbsp;</div>';
244	astr += '<div class="ccdi_web_row"><em>'+iin.registrationfor[langcode]+'</em> : '+ce_ed.title+'</div>';
245	for(var n =0;n<ce_ed.fields.length;n++){
246		var fr = ce_ed.fields[n];
247		astr += '<div class="ccdi_web_row"><em>'+fr.label+'</em> : ';
248		astr += fr.value+'</div>';
249	}		
250	
251
252	
253	if(ce_forminfo.total>0){
254		  astr += '<div class="ccdi_web_row">&nbsp;</div>';
255			astr += '<div id="paymentinfo">';
256		}else{
257			astr += '<div style="display:none;">';
258		}
259	 astr +='<div class="ccdi_web_row"><strong>'+iin.paymentinfo[langcode]+'</strong>';
260	  astr +='<p>'+iin.preamble[langcode]+'</p>';
261	  astr +='</div>'
262	  
263	 astr +='<div class="ccdi_web_row"><label for="cw_nameoncard">'+iin.nameoncard[langcode]+'</label><br><input type="text" id="cw_nameoncard"></div>';
264	
265	 astr +='<div class="ccdi_web_row"><label for="cw_cardnumber">'+iin.cardnumber[langcode]+'</label><br><input type="text" id="cw_cardnumber"></div>';
266	 
267	 astr += '<div class="ccdi_web_row"><label for="cw_postalcode">'+iin.billingpc[langcode]+'</label><br><input type="text" id="cw_postalcode"></div>';
268	 
269	 astr +='<div class="ccdi_web_row"><label for="cw_expirymonth">'+iin.expirymonth[langcode]+'</label><br><select id="cw_expirymonth">';
270	 astr += '<option>01<option>02<option>03<option>04<option>05<option>06<option>07<option>08<option>09<option>10<option>11<option>12';
271	 astr +='</select></div>';
272	 astr +='<div class="ccdi_web_row"><label for="cw_expiryyear">'+iin.expiryyear[langcode]+'</label><br><select id="cw_expiryyear">';
273	 astr += '<option value="23">2023<option value="24">2024<option value="25">2025';
274	 astr += '<option value="26">2026<option value="27">2027<option value="28">2028<option value="29">2029<option value="30">2030<option value="31">2031';
275	 astr += '<option value="32">2032<option value="33">2033<option value="34">2034';
276	 astr +='</select></div>';
277	 astr +='<div class="ccdi_web_row"><label for="cw_ver">'+iin.securitycode[langcode]+'</label><br><input type="text" id="cw_ver"></div>';
278	 
279	 astr += '<div class="ccdi_web_row">Subtotal $'+ce_forminfo.price.toFixed(2)+'</div>';
280	 for(var n=0;n<ce_forminfo.taxes.length;n++){
281	    astr += '<div class="ccdi_web_row">'+ce_forminfo.taxes[n].name+' $'+ce_forminfo.taxes[n].amount.toFixed(2)+'</div>';	
282	 }
283	 astr += '<div class="ccdi_web_row">Total $'+ce_forminfo.total.toFixed(2)+'</div>';
284	 astr += '<div class="ccdi_web_row">&nbsp;</div></div>';
285	 astr +='<div class="ccdi_web_row">';	
286	 astr += '<input type="button" value="'+iin.previous[langcode]+'" id="ccdi_web_payment" onclick="ce_displayForm()">';
287	 astr += '</div>'; 
288	 astr += '<div class="ccdi_web_row">&nbsp;</div>';
289	 astr +='<div class="ccdi_web_row">';	
290	 astr += '<input type="button" value="'+iin.complete[langcode]+'" id="ccdi_web_payment" onclick="ce_processRegistration()">';
291	 astr += '</div>';
292	
293	$(ce_div).html(astr);	
294	
295}
296
297function ce_processRegistration(){
298    if(submitted) return;
299	var formdata = "act=pr&evt="+ce_eventid+"&regtype="+ce_forminfo.regtype+"&lang="+ce_forminfo.lang+"&invited="+encodeURIComponent(ce_forminfo.invited);
300	for(var n =0;n<ce_ed.fields.length;n++){
301		 formdata += "&f"+ce_ed.fields[n].id+"="+encodeURIComponent(ce_ed.fields[n].value)
302	}
303	if(ce_forminfo.total>0){
304		  if($('#cw_nameoncard').val().length<1){
305		  	alert(iin.nameoncard[langcode]+" "+iin.required[langcode]);
306		  	return;
307		  }
308		  if($('#cw_cardnumber').val().length<1){
309		  	alert(iin.cardnumber[langcode]+" "+iin.required[langcode]);
310		  	return;
311		  }
312		  if($('#cw_ver').val().length<1){
313		  	alert(iin.securitycode[langcode]+" "+iin.required[langcode]);
314		  	return;
315		  }
316			formdata += "&ccname="+encodeURIComponent($('#cw_nameoncard').val());
317			formdata += "&cnum="+encodeURIComponent($('#cw_cardnumber').val());
318			formdata += "&cexpmonth="+encodeURIComponent($('#cw_expirymonth').val());
319			formdata += "&cexpyear="+encodeURIComponent($('#cw_expiryyear').val());
320			formdata += "&cver="+encodeURIComponent($('#cw_ver').val());
321			formdata += "&ccpc="+encodeURIComponent($('#cw_postalcode').val());
322			
323	}
324	submitted = true;
325	$.getJSON(ccdi_remote+"/neaj?"+formdata, function (data) {
326			if(data.result){
327				self.location = ccdi_payment_success;
328			}else{
329				if(data.message.length>2){
330					alert(data.message);
331				}else{			
332					alert(iin.error[langcode]);
333				}
334				submitted = false;
335			}
336		});
337}
338
339
340function ce_updateType(){
341   var rv = document.querySelector("[name=ccdi_web_regtype]:checked").value;
342   ce_forminfo.regtype = rv;
343   for(var n=0;n<ce_ed.regtypes.length;n++){
344      if(ce_ed.regtypes[n].type==ce_forminfo.regtype){
345      	ce_forminfo.price = ce_ed.regtypes[n].price;
346      	$('#ccdi_web_pricedisplay').text(ce_forminfo.price.toFixed(2));
347      }	
348  }
349  if(ce_forminfo.regtype=="GUEST"){
350  	$('#ccdi_web_guestrow').show();
351  }else{
352  	$('#ccdi_web_guestrow').hide();
353  }
354}

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.