'; sHtml += ''; sHtml += html; sHtml += ' '; sHtml += ''; return sHtml; } // Convert JSON string, or JSON objects, to CSV string // Returns a string, on error a null // function jsonToCsv(JSONData, title, isTabDelimited) { var delim = ',' if (isTabDelimited) { delim = '\t'; } var ReportTitle = 'Orders'; if (typeof (title) != 'undefined') { ReportTitle = title; } var CSV = ''; try { var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData; CSV += ReportTitle + '\r\n\n'; var row = ""; // build the label row for (var index in arrData[0]) { //row += index.replace(/_/g, ' ').replace(/HYPHEN/g, '-').replace(/LEFTPAREN/g, '(').replace(/RIGHTPAREN/g, ')') + ','; row += index.replace(/_/g, ' ') + delim; } row = row.slice(0, -1); //append Label row with line break CSV += row + '\r\n'; //loop is to extract data for each row for (var i = 0; i < arrData.length; i++) { var row = ""; //2nd loop will extract each column and convert it in string comma-separated for (var index in arrData[i]) { if (arrData[i][index] == null) { arrData[i][index] = ''; } row += '"' + decodeURI(arrData[i][index]) + '"' + delim; } row.slice(0, row.length - 1); //add a line break after each row CSV += row + '\r\n'; } } catch (err) { alert("WDFunction: JSON To CSV Error parsing JSON:" + err.message); return null; } if (CSV == '') { alert("WDFunction: JSON To CSV Error Invalid data"); return null; } return CSV; } function isValidDateFunction(val) { try { var d = new Date(val); if (d == 'Invalid Date') { return false; } arrVal = val.split('/'); if (arrVal[0] != (d.getMonth() + 1).toString()) { return false; } if (arrVal[1] != d.getDate().toString()) { return false; } if (arrVal[2] != d.getFullYear().toString()) { return false; } } catch (e) { return false; } return true; } function encodeURIFunction(val) { return encodeURI(val).replace(/\'/g, '%27'); } function decodeURIFunction(val) { return decodeURI(val).replace(/%27/g, '\''); } function guidFunction() { function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } function setPathFunction(path) { $('#wdWebCtrl').scope().setPath(path); } function validateFormFunction(id) { var div = document.getElementById(id); var isErrors = false; var errMessage = ''; if (!div) { alert(id + ' is not a valid div!'); return false; } var elems = null; var fieldName = null; elems = div.getElementsByTagName('input'); for (var i = 0; i < elems.length; i++) { if (elems[i].type != 'file') { elems[i].value = this.trim(elems[i].value); // Check if the field is required. If so, make sure it have a value. if (elems[i].getAttribute('wdrequired')) { $(elems[i]).removeClass('validatorCalloutHighlight'); if (elems[i].value.length == 0 && $(elems[i]).is(':visible')) { $(elems[i]).addClass('validatorCalloutHighlight'); //elems[i].scrollIntoView(); var requiredName = 'Unknown'; if (elems[i].getAttribute('wdfieldname')) { requiredName = eval('wdLanguage.' + elems[i].getAttribute('wdfieldname')); } if (elems[i].getAttribute('wdCustomFieldName')) { requiredName = elems[i].getAttribute('wdCustomFieldName'); } errMessage += '
- ' + requiredName + ' ' + wdLanguage.IsARequiredField; isErrors = true; } } // Check if the field should be a decimal value if (elems[i].getAttribute('wddecimal')) { $(elems[i]).removeClass('validatorCalloutHighlight'); if (elems[i].value.length > 0 && $(elems[i]).is(':visible')) { var val = parseInt(elems[i].value); if (isNaN(val)) { $(elems[i]).addClass('validatorCalloutHighlight'); //elems[i].scrollIntoView(); fieldName = elems[i].getAttribute('wdfieldname'); errMessage += '
- ' + eval('wdLanguage.' + fieldName) + ' ' + wdLanguage.MustBeDecimal; isErrors = true; } } } // Check if the field should be a valid email address if (elems[i].getAttribute('wdemail')) { if ($(elems[i]).is(':visible')) { var val = elems[i].value; if (val.length > 0) { $(elems[i]).removeClass('validatorCalloutHighlight'); if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+$/.test(val)) { $(elems[i]).addClass('validatorCalloutHighlight'); //elems[i].scrollIntoView(); var requiredName = 'Unknown'; if (elems[i].getAttribute('wdfieldname')) { requiredName = eval('wdLanguage.' + elems[i].getAttribute('wdfieldname')); } if (elems[i].getAttribute('wdCustomFieldName')) { requiredName = elems[i].getAttribute('wdCustomFieldName'); } errMessage += '
- ' + eval('wdLanguage.' + requiredName) + ' is not valid.'; isErrors = true; } } } } } } elems = div.getElementsByTagName('textarea'); for (var i = 0; i < elems.length; i++) { elems[i].value = this.trim(elems[i].value); // Check if the field is required. If so, make sure it have a value. if (elems[i].getAttribute('wdrequired')) { $(elems[i]).removeClass('validatorCalloutHighlight'); if (elems[i].value.length == 0 && $(elems[i]).is(':visible')) { $(elems[i]).addClass('validatorCalloutHighlight'); //elems[i].scrollIntoView(); var requiredName = 'Unknown'; fieldName = elems[i].getAttribute('wdfieldname'); if (elems[i].getAttribute('wdfieldname')) { requiredName = eval('wdLanguage.' + fieldName); } if (elems[i].getAttribute('wdCustomFieldName')) { requiredName = elems[i].getAttribute('wdCustomFieldName'); } errMessage += '
- ' + requiredName + ' ' + wdLanguage.IsARequiredField; isErrors = true; } } } elems = div.getElementsByTagName('select'); for (var i = 0; i < elems.length; i++) { // Check if the field is required. If so, make sure it have a value. if (elems[i].getAttribute('wdrequired')) { $(elems[i]).removeClass('validatorCalloutHighlight'); if (elems[i][elems[i].selectedIndex].text.length == 0 && $(elems[i]).is(':visible')) { $(elems[i]).addClass('validatorCalloutHighlight'); //elems[i].scrollIntoView(); fieldName = elems[i].getAttribute('wdfieldname'); errMessage += '
- ' + eval('wdLanguage.' + fieldName) + ' ' + wdLanguage.IsARequiredField; isErrors = true; } } } if (isErrors) { this.showMessage(wdLanguage.Error, wdLanguage.PleaseCorrectTheFollowing + '
' + errMessage); return false; } return true; } function cleanStringFunction(val) { return val.replace(/[^a-z0-9]/gi, ''); } function showBusyFunction() { if (this.busyTimer) { clearTimeout(this.busyTimer); } //this.busyTimer = setTimeout($.proxy(this.displayBusy, this), 1000); $('#wdWebCtrl').scope().showBusy(); } function displayBusyFunction() { $('#wdWebCtrl').scope().showBusy(); } function cancelBusyFunction() { if (this.busyTimer) { clearTimeout(this.busyTimer); } $('.wdBusy').remove(); document.body.style.cursor = 'default'; } function showMessageFunction(title, message, label, top, left, width, modalBodyClass, closeFunction, cancelFunction, backdrop) { $('#wdWebCtrl').scope().showMessage(title, message, label, top, left, width, modalBodyClass, closeFunction, cancelFunction, backdrop); } function showMessageOldFunction(title, message, label, top, left, width, modalBodyClass, closeFunction, cancelFunction, backdrop) { $('#wdWebCtrl').scope().showMessageOld(title, message, label, top, left, width, modalBodyClass, closeFunction, cancelFunction, backdrop); } function showConfirmFunction(title, message, noText, noFunction, yesText, yesFunction, width, modalFooterClass) { $('#wdWebCtrl').scope().showConfirm(title, message, noText, noFunction, yesText, yesFunction, width, modalFooterClass); } function showProcessingFunction(message) { $('#wdWebCtrl').scope().showProcessing(message); } function hideProcessingFunction() { $('#wdWebCtrl').scope().hideProcessing(); } function hideMessageFunction() { $('#wdWebCtrl').scope().hideMessage(); } function showFullScreenFunction(HTML, closeFunction) { $('#wdFullScreenDiv').remove(); $('#wdFullScreenClose').remove(); var $div = $('
'); var $close = $('
').html('X'); $div.append($close); if (typeof (closeFunction) != 'undefined') { $close.on('click', closeFunction); } else { $close.on('click', wdFunctions.hideFullScreen); } $('body').append($div); $('body').append($close); $('#wdFullScreenDiv').html(decodeURI(HTML)); $('#wdFullScreenDiv').fadeIn(); } function hideFullScreenFunction() { $('#wdFullScreenDiv').fadeOut(function () { $('#wdFullScreenDiv').remove(); $('#wdFullScreenClose').remove(); }); } function cleanDropDownsFunction() { var elems = document.getElementsByTagName('select'); for (var i = 0; i < elems.length; i++) { if (typeof (elems[i].options[0].text) != 'undefined') { if (elems[i].options[0].text == '') { elems[i].remove(0); } } } } function toProperCaseFunction(val) { var words = val.split(' '); var results = []; for (var i = 0; i < words.length; i++) { var letter = words[i].charAt(0).toUpperCase(); results.push(letter + words[i].slice(1)); } return results.join(' '); } // all api calls return a status. // this function is used for global error checking. function checkStatusFunction(status) { switch (status) { case 300: wdFunctions.showMessage('Permission', 'Either you\'re account does not have permission to perform this action OR your session has timed out. Please log out and then log back in.'); return false; case 500: wdFunctions.showMessage(wdLanguage.Error, wdLanguage.DefaultErrorMessage); return false; case 501: wdFunctions.hideMessage(); wdFunctions.showMessage(wdLanguage.Error, wdLanguage.SessionTimeoutMessage); return false; default: return true; } } function setFocusFunction(id) { var elem = document.getElementById(id); if (elem) { elem.focus(); } } function nullToStringFunction(val, placeholder) { if (typeof (placeholder) == 'undefined') { placeholder = ''; } if (val == null) { return '' + placeholder; } if (typeof (val) == 'number') { val = val.toString() + placeholder; } if (val.toLowerCase() == 'null') { return '' + placeholder; } return val; } function toXMLFunction(val, placeholder) { if (typeof (placeholder) == 'undefined') { placeholder = ''; } if (val == null) { return '' + placeholder; } if (typeof (val) == 'number') { val = val.toString() + placeholder; } if (typeof (val) == 'string') { if (val.toLowerCase() == 'null') { return '' + placeholder; } } if (typeof (val) == 'boolean') { if (val) { val = 'true'; } else { val = 'false'; } } if (val == undefined) { val = ''; } return val; } function nullToZeroFunction(val) { if (val == null) { return 0; } return val; } function stringToNullFunction(val) { val = trimFunction(val); if (val == '') { return null; } return val; } function trimFunction(inputString) { if (inputString == '') return inputString; // Removes leading and trailing spaces from the passed string. Also removes // consecutive spaces and replaces it with one space. If something besides // a string is passed in (null, custom object, etc.) then return the input. if (typeof inputString != "string") { return inputString; } var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { // Check for spaces at the beginning of the string retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length - 1, retValue.length); while (ch == " ") { // Check for spaces at the end of the string retValue = retValue.substring(0, retValue.length - 1); ch = retValue.substring(retValue.length - 1, retValue.length); } while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ") + 1, retValue.length); // Again, there are two spaces in each of the strings } return retValue; // Return the trimmed string back to the user } function checkEmailFunction(elem) { var email = $(elem).val().toString().trim(); if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) { return true; } else { //wdFunctions.showMessage(wdLanguage.Error, "You have entered an invalid email address!"); //elem.value = ''; return false; } } function formatLocalizedDate(date, includeTime) { if (date == null || date == '') { return null; } if (includeTime === true) { return formatDate(date, getUserDateFormatString() + " " + getUserTimeFormatString()); } else { return formatDate(date, getUserDateFormatString()); } } function formatDate(date, format) { if (wdFunctions.isIE) { return new Date(date).toString(format); } else { return Date.parse(date).toString(format); } } function toSQLDateFormat(date) { if (date == '' || date == null) { return null; } switch (wdUserAccount.DateFormat) { case 0: return date case 1: return date.replace('-', '/'); case 2: return date.replace('.', '/'); case 3: var arrDate = date.split('/'); if (arrDate.length < 3) { return ''; } return arrDate[1] + '/' + arrDate[0] + '/' + arrDate[2]; case 4: var arrDate = date.split('-'); if (arrDate.length < 3) { return ''; } return arrDate[1] + '/' + arrDate[0] + '/' + arrDate[2]; case 5: var arrDate = date.split('.'); if (arrDate.length < 3) { return ''; } return arrDate[1] + '/' + arrDate[0] + '/' + arrDate[2]; case 6: var arrDate = date.split('/'); if (arrDate.length < 3) { return ''; } return arrDate[1] + '/' + arrDate[2] + '/' + arrDate[0]; case 7: var arrDate = date.split('-'); if (arrDate.length < 3) { return ''; } return arrDate[1] + '/' + arrDate[2] + '/' + arrDate[0]; case 8: var arrDate = date.split('.'); if (arrDate.length < 3) { return ''; } return arrDate[1] + '/' + arrDate[2] + '/' + arrDate[0]; default: return date; } } function getUserDateFormatString() { switch (wdUserAccount.DateFormat) { case 0: return "M/d/yyyy"; case 1: return "M-d-yyyy"; case 2: return "M.d.yyyy"; case 3: return "d/M/yyyy"; case 4: return "d-M-yyyy"; case 5: return "d.M.yyyy"; case 6: return "yyyy/M/d"; case 7: return "yyyy-M-d"; case 8: return "yyyy.M.d"; default: return "M/d/yyyy"; } } function getUserTimeFormatString() { switch (wdUserAccount.Is24HourTime) { case 0: return "h:mm tt"; case 1: return "H:mm"; default: return "h:mm tt"; } } } var wdFunctions = new wdFunctions(); function moveProgress() { var dvUploader = document.getElementById('dvUploader'); document.getElementById('dvModalUploader').appendChild(dvUploader); $('#dvUpload').fadeIn(); $('#dvEvents').fadeIn(); } function wdGetCookie(key, isInt) { key = key.toLowerCase() + document.domain.toLocaleLowerCase(); var cookie = document.cookie; var arrCookies = cookie.split('; '); var val = ''; for (var i = 0; i < arrCookies.length; i++) { arrValue = arrCookies[i].split('='); if (arrValue[0] == key) { val = decodeURI(arrValue[1]); } } if (isInt) { val = parseInt(val); if (isNaN(val)) { val = null; } } return val; } function wdSetCookie(key, value) { key = key.toLowerCase() + document.domain.toLocaleLowerCase(); var expires = new Date(); expires.setTime(expires.getTime() + (30 * 24 * 60 * 60 * 1000)); document.cookie = key + '=' + encodeURI(value) + ';expires=' + expires.toUTCString(); } function hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; }

Junior High

Fall Portraits

8th Grade Promotion

Yearbook Groups

Class Group

ID Cards