| /******************************************************************************* |
| * Copyright (c) 2014 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://eclipse.org/legal/epl-v10.html |
| * |
| * Edouard Poitras (Eclipse Foundation) - Some modifications |
| *******************************************************************************/ |
| var ajaxObject = AjaxObject(); |
| |
| function AjaxObject () { |
| if (window.XMLHttpRequest) |
| return new XMLHttpRequest(); |
| else if (window.ActiveXObject) |
| return new ActiveXObject('Microsoft.XMLHTTP'); |
| else |
| alert ("Error Creating AjaxObject"); |
| return false; |
| } |
| |
| function whatsThisToggle(i) { |
| var e = document.getElementById(i); |
| var t = e.className; |
| if (t.match('invisible')) { t = t.replace(/invisible/gi, 'visible'); } |
| else { t = t.replace(/visible/gi, 'invisible'); } |
| e.className = t; |
| } |
| |
| function amountCheck() { |
| var a = document.getElementById("amount"); |
| var b = document.getElementById("login"); |
| if (a.value >= 35) { |
| b.disabled=false; |
| b.className = "enabled"; |
| } else { |
| b.disabled=true; |
| b.className = "disabled"; |
| } |
| } |
| function validateForm() { |
| var retVal = true; |
| var fn = document.getElementById("first_name"); |
| var ln = document.getElementById("last_name"); |
| var a = document.getElementById("amount"); |
| var b = document.getElementById("login"); |
| var v = document.getElementById("verify"); |
| var anon = document.getElementById("os1private"); |
| |
| if (parseInt(a.value) >= 35) { |
| if (b.value.length != 0) { |
| if (v.innerHTML.length == 0) { |
| alert("Please verify your Eclipse.org login to continue"); |
| return false; |
| } |
| if (v.innerHTML != "Verified!") { |
| alert ("Your Eclipse.org ID could not be verified. If you have recently created an account, please ensure you have verified your email address." + '\n' + "For donations of $35 dollars or more we require you to provide a valid ID. If you do not wish to provide your Eclipse.org ID please list your name Anonymously."); |
| return false; |
| } |
| } |
| } |
| return retVal; |
| } |
| |
| |
| function isNumeric(input) { |
| var numbers = "01234567890.-"; |
| var singleChar; |
| var retVal = true; |
| if (input.length > 0) { |
| for (i = 0; i < input.length && retVal == true; i++) { |
| singleChar = input.charAt(i); |
| if (numbers.indexOf(singleChar) == -1) { |
| retVal = false; |
| } |
| } |
| } |
| return retVal; |
| } |
| |
| function verifyLogin() { |
| var v = document.getElementById('verify'); |
| var a = document.getElementById('amount'); |
| var login = document.getElementById('login'); |
| if (login.value.length == 0 || parseInt(a.value) < 35) { |
| v.innerHTML = ""; |
| v.removeAttribute("class"); |
| login.value = ""; |
| login.removeAttribute("style"); |
| } |
| |
| var url = "ajaxLogin.php?login=" + login.value.replace('+', '%2B'); |
| ajaxObject.open("GET", url, true); |
| ajaxObject.onreadystatechange = updatePage; |
| ajaxObject.send(null); |
| |
| } |
| |
| function updatePage() { |
| var v = document.getElementById('verify'); |
| var b = document.getElementById('login'); |
| var anon = document.getElementById('os1private'); |
| if (ajaxObject.readyState == 4){ |
| response = ajaxObject.responseText; |
| if (response.indexOf("Verified!") > -1 || b.value.length == 0 || anon.checked) { |
| if (response.indexOf("Verified!") > -1) { |
| v.innerHTML = "Verified!"; |
| v.setAttribute("class", "green"); |
| b.setAttribute("style","border:2px solid green;"); |
| } |
| if (validateForm()) { |
| document.donateForm.submit(); |
| } else { |
| return false; |
| } |
| } |
| else { // Anonymous |
| v.innerHTML = "Invalid Login"; |
| v.setAttribute("class", "red"); |
| b.setAttribute("style","border:2px solid #FF0000;"); |
| validateForm(); |
| } |
| } |
| } |