/* FILE ARCHIVED ON 9:11:06 Jan 17, 2009 AND RETRIEVED FROM THE AN OPENWAYBACK INSTANCE ON 20:48:51 May 5, 2024. JAVASCRIPT APPENDED BY OPENWAYBACK, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /** * JavaScript functions for CFC e-Giving system donor form * * @category CFCe * @package e-Giving * @author Dave Stevenson * @copyright 2008 Dave Stevenson, Global Impact * @license https://webarchive.library.unt.edu/eot2008/20090117091106/http://opensource.org/licenses/gpl-license.php GNU Public License * @version SVN: $Id$ * @link https://webarchive.library.unt.edu/eot2008/20090117091106/http://trac.globalimpact.net/wiki/systems/eGiving * @see https://webarchive.library.unt.edu/eot2008/20090117091106/http://www.cfcnca.org/common.js */ /** * toggle donor form CENTCOM extra fields visibility * * @returns null */ function CENTCOMTRVisibility () { // only do this for CFCO if (CFC == '0995') { if (eid('Command1').checked) return MSIE ? eid('CENTCOMTR').style.display = 'block' : eid('CENTCOMTR').style.visibility = 'visible'; MSIE ? eid('CENTCOMTR').style.display = 'none' : eid('CENTCOMTR').style.visibility = 'collapse'; eid('Post').value = ''; eid('DeployedUSA').checked = false; } } /** * CFCO: update CAPO selector options * * @returns null */ function CAPOSelectorUpdate () { var command; for (var i = 0; i < document.DonorForm.Command.length; i++) document.DonorForm.Command[i].checked ? command = document.DonorForm.Command[i].value : 0; var structure = eval(command); eid('CAPOSelector').options.length = 0; var i = 0; eid('CAPOSelector').options[i++] = new Option("---", ""); for (var s in structure) { eid('CAPOSelector').options[i] = new Option(structure[s], s); eid('CAPO').value == s ? eid('CAPOSelector').options[i++].selected = true : i++; } } /** * update unit selector options, filtering based on text entered in text input * * @param string v = CFCNCA: value of UnitText input element * * @returns null */ function UnitSelectorUpdate (v, c) { // CFCO if (CFC == '0995') { eid('UnitSelector').options.length = 0; var i = 0; eid('UnitSelector').options[i++] = new Option("---", "") for (var u in units) { if (u.substr(0,3) == eid('CAPO').value) { eid('UnitSelector').options[i] = new Option(u + " " + units[u], u); eid('UnitID').value == u ? eid('UnitSelector').options[i++].selected = true : i++; } } if (eid('UnitSelector').length == 2) { eid('UnitSelector').options[1].selected = true; UnitTextSet(); } } // CFCNCA else { eid('UnitSelector').options.length = 0; if (eid('UnitText').value.length > 2) { var i = 0; for (var u in units) if (u.match(v) || units[u].toLowerCase().match(v.toLowerCase())) eid('UnitSelector').options[i++] = new Option(u + " " + units[u], u); eid('UnitSelector').size = eid('UnitSelector').options.length > 10 ? 10 : eid('UnitSelector').length; } eid('UnitDiv').style.display = eid('UnitSelector').options.length > 0 ? 'block' : 'none'; } } /** * CFCNCA unit selector: set input values based on selected unit option * @param boolean? x = (2008-03-06 Dave's note: the blurb below appears to explain it, but I honestly don't remember what x is for... it doesn't appear to ever be used) * when selector has only one option, onchange won't work, so we must use an onclick trigger instead... * but if the selector has a scrollbar we must ignore the onclick trigger, otherwise clicking the scrollbar * will trigger the behavior and close the selector * * @returns null */ function UnitTextSet (x) { if (CFC == '0990' && x && eid('UnitSelector').options.length > 10) return; var t = eid('UnitSelector').options[eid('UnitSelector').selectedIndex].text; eid('UnitID').value = eid('UnitSelector').value; eid('UnitName').value = t.substr(8, t.length); if (eid('UnitText')) eid('UnitText').value = eid('UnitSelector').options[eid('UnitSelector').selectedIndex].text; if (eid('UnitDiv')) eid('UnitDiv').style.display = 'none'; } /** * unit help alert box * * @returns null */ function unitHelpAlert () { var a = "To select your reporting unit, simply click into the text input box labeled \"Reporting Unit\", and start typing! "; a += "Once you have entered three or more characters, the system will begin searching for matching office/department names or matching CFCNCA reporting numbers.\n\n"; a += "Reporting units whose names or numbers match the pattern of the text you've entered will be shown in a selector list appearing below the text input box you are typing in. "; a += "Each successive keystroke further refines the results in the selector list. Use your mouse to scroll through and choose your reporting unit from the list.\n\n"; a += "If you are having trouble locating your reporting unit using this method, it may be that the name of your reporting unit "; a += "is stored in our database using slightly different naming convention than you're used to. "; a += "You can also try looking up your reporting unit by its CFCNCA reporting number.\n\n"; a += "If you cannot find your reporting unit by name and do not know what reporting number to use, "; a += "please contact your keyworker or the CFCNCA Help Desk for assistance."; alert(a); if (confirm("Are you experiencing accessibility problems with this selector?\n\nIf so, click 'OK'. Otherwise click 'Cancel'.")) accessifyUnitSelector(); } /** * make unit selector accessible (508 compliance) * * @returns null */ function accessifyUnitSelector () { eid('UnitSelectBtn').style.display = 'inline'; var a = "A button labeled 'Select' has been added to the right of the reporting unit selector, and the selector is now navigable using the keyboard.\n\n"; a += "After typing in the \"Reporting Unit\" text input box, press Tab to focus on the reporting unit selector.\n\n"; a += "When you have highlighted the option you would like to select, press Tab to focus on the 'Select' button, and press Enter to trigger the selection."; eid('UnitSelector').onchange = ''; eid('UnitSelector').onclick = ''; alert(a); }