// // JS Module file for: Home // $Id$ // var RAMPSModule = new Class( { Implements: [Events,Options], Extends: RAMPSCore, mouseX: 0, mouseY: 0, initialize: function(options) { this.parent(options); this.initHelperSys(); $(document.body).addEvent('mousemove',function(event){ mouseX = event.page.x; mouseY = event.page.y; }); if( $('checkAll') ) { $('checkAll').addEvent('click', function() { var state = $('checkAll').get('checked'); $$('input.phcfChecks').each( function(element) { if( state ) { element.set('checked', true); } else { element.set('checked', false); } }); }); } }, /** * Wrapper to ensure that the warnings are shown in PERF **/ checkValidation: function() { if( $('100Oblig_warning') ) { var stopSubmission = false; // // Ok, we're on the write page // 3 cases to test: 100Oblig, 60Date, 100Date if( $('100Oblig_warning').get('html').test("true") ) { if( !confirm("The date entered for the expected date of 100% obligation does not comply with statutory requirements. Are you sure this is correct?")) { stopSubmission=true; } } if( $('60Date_warning').get('html').test("true") ) { if( !confirm("The date entered for the expected date of 50% or 60% expenditure does not comply with statutory requirements. Are you sure this is correct?")) { stopSubmission=true; } } if( $('100Date_warning').get('html').test("true") ) { if( !confirm("The date entered for the expected date of 100% expenditure does not comply with statutory requirements. Are you sure this is correct?")) { stopSubmission=true; } } if( stopSubmission == false ) { return true; } else { return false; } } else { return true; } }, /** * Send an ajax call and determine if we need to pop any warnings * @param String The elementID of the field, minus "ram_exp" **/ checkValidDate: function(fieldId) { var fqName = "ram_exp"+fieldId; var warningBox = fieldId+"_warning"; if( $(fqName) ) { this.SimpleAjax("ajax.do?cmd=doCheckValidDate&typeCheck="+fieldId+"&date="+escape( $(fqName).get('value')), warningBox ); } }, /** * Clones a work activity from the Quick List on the Final Submit page **/ cloneWorkActivity: function() { $$('input.activityRadios').each(function(item) { if( $(item).get('checked') ) { activityId = $(item).get('value'); $('activityId').set('value',activityId); if( RAMPS.getCurrentBrowser().test('ie')) { alert("IE sucks"); } else { $('cloneForm').submit(); } } }); }, /** * On the Work activity page with BLIs, highlight the row that the user is hitting * @param rowId ElementID of the row to highlight **/ highlightRow: function(rowId) { // // Take highlighting away first $$('td.highlightableRow').each(function(el) { $(el).removeClass('highlight'); }); $(rowId).addClass('highlight'); }, togglePHCFActivity:function(elementObj,pageLoad) { var selected = elementObj.value; if( selected.test("Project") ) { // // Hide the Geocenter dialog $('scatteredSites').setStyle('display','none'); $('scatteredSitesText').setStyle('display','none'); // // Select all of the building list checkboxes if(pageLoad!=true) { $$('input.buildingCheckboxen').each(function(checkbox) { checkbox.set('checked',true); }); } // // Hide the building list $('theBuildingList').setStyle('display','none'); $('buildingListText').setStyle('display','none'); $('buildingListHeader').setStyle('display','none'); } else if( selected.test("Approximate") ) { // // Hide the Geocenter dialog $('scatteredSites').setStyle('display','none'); $('scatteredSitesText').setStyle('display','none'); // // de-Select all of the building list checkboxes if(pageLoad!=true) { $$('input.buildingCheckboxen').each(function(checkbox) { checkbox.set('checked',false); }); } // // Show the building list //if( !$('projectTypeNon').checked ) { $('theBuildingList').setStyle('display','block') $('buildingListText').setStyle('display','block'); $('buildingListHeader').setStyle('display','block'); // } } else { // // Hide the building list $('theBuildingList').setStyle('display','none'); $('buildingListText').setStyle('display','none'); // // Pop the Geocenter dialog // if( !$('projectTypeNon').checked ) { $('scatteredSites').setStyle('display','block'); $('scatteredSitesText').setStyle('display','block'); // } } }, recurseTreeNodes: function(element,findClass) { var treeNode = element.getParent(); if( treeNode == null ) { return false; } else { if( treeNode.get('class') == findClass ) { // // Turn on the error textd var errorSpan = (treeNode.get('id')+'-Error'); $(errorSpan).setStyle('display','inline'); return true; } else { this.recurseTreeNodes(treeNode,findClass); } } }, change_list: function( state, city, div_id, section, isNew ) { var xml_request = 'ajax.do?cmd=do' + section + 'List&state=' + state + '&city=' + city + '&isNew=' + isNew; this.AjaxRequest(xml_request, div_id, ''); }, change_page: function( div_id, section, page ) { var xml_request = 'ajax.do?cmd=do' + section + 'Page&page=' + page; this.AjaxRequest(xml_request, div_id, ''); }, change_fund_num: function( div_id, num ) { var xml_request = 'ajax.do?cmd=doGetFundingSources&agency=' + num; this.AjaxRequest(xml_request, div_id, ''); }, changeCity: function(state, city, city_div_id, list_div_id, section, isNew) { this.change_list(state, city, city_div_id, section + "City", isNew); this.change_list(state, city, list_div_id, section, isNew); }, changeFirstChoice: function(first) { this.options.firstBuildingSelection = first; if( first=='Other') { $('secondSelection').set('html', ''); $('otherTextBox').setStyle('display',''); $('systemsDialog').setStyle('display',''); this.centerElement('systemsDialog'); } else { $('secondSelection').set('html', ''); $('otherTextBox').setStyle('display','none'); var xml_request = 'ajax.do?cmd=doSecondSelections&first=' + first; this.AjaxRequest(xml_request, 'secondSelection', 'systemsDialog'); // // center the dialog this.centerElement('systemsDialog'); } }, update_validation_status: function( div_id ) { var xml_request = 'resources/jsp/common/ajaxValidationStatus.jsp'; this.AjaxRequest(xml_request, div_id, '', 'ajaxLoader'); }, update_rampsreport_status: function( div_id ) { var xml_request = 'resources/jsp/content/adminPages/ajaxRampsReport.jsp'; this.AjaxRequest(xml_request, div_id, '', 'ajaxLoader'); }, update_nepareport_status: function( div_id ) { var xml_request = 'resources/jsp/content/nepaReportDownload.jsp'; this.AjaxRequest(xml_request, div_id, '', 'ajaxLoader'); }, update_data_export_status: function( div_id ) { var xml_request = 'resources/jsp/common/ajaxDataExportStatus.jsp'; this.AjaxRequest(xml_request, div_id, '', 'ajaxLoader'); }, updateAnnualStatementStatus: function( div_id ) { var xml_request = 'resources/jsp/content/ajax/annualStatementImport.jsp'; this.AjaxRequest(xml_request, div_id, '', 'ajaxLoader'); }, updateTextTipsLoadStatus: function( div_id ) { var xml_request = 'resources/jsp/content/ajax/texttipsLoadStatus.jsp'; this.AjaxRequest(xml_request, div_id, '', 'ajaxLoader'); }, switchGroupTabs: function( input ) { if( input.test("hasProgram") || input.test("false") ) { $('hasProgramD').setStyle('display', 'block'); $('hasProgram').addClass('current'); $('noProgramD').setStyle('display', 'none'); $('noProgram').removeClass('current'); } else if( input.test("noProgram") || input.test("true") ) { $('hasProgramD').setStyle('display', 'none'); $('hasProgram').removeClass('current'); $('noProgramD').setStyle('display', 'block'); $('noProgram').addClass('current'); } }, findHUDIDAjax: function() { var userId = $('findHUDID').get('value'); var xml_request = "ajax.do?cmd=doUserSearch&userId="+userId; this.AjaxRequest(xml_request, 'groupUserList', ''); }, /** * Toggles the "Energy Efficient Measures" inputs on the * Build/Unit Information part of Performance reporting */ toggleBuildingType: function() { ['projectTypeNew','projectTypeRehab','projectTypeComm','projectTypeInfra'].each( function(el) { if( $(el).checked ) { if( $(el).get('value').test("Rehab") ) { $('overallRehab').setStyle('display','block'); $('unitsRehabPlanned').setStyle('display','block'); $('unitsRehabinputPlanned').setStyle('display','block'); $('unitsStartedRehab').setStyle('display','block'); $('unitsStartedRehabinput').setStyle('display','block'); $('unitsCompletedRehab').setStyle('display','block'); $('unitsCompletedRehabinput').setStyle('display','block'); // Turn off New $('overallNew').setStyle('display','none'); $('unitsNewPlanned').setStyle('display','none'); $('unitsNewinputPlanned').setStyle('display','none'); $('unitsStartedNew').setStyle('display','none'); $('unitsStartedNewinput').setStyle('display','none'); $('newStartInput').set('value','0'); $('unitsCompletedNew').setStyle('display','none'); $('unitsCompletedNewinput').setStyle('display','none'); $('newCompleteInput').set('value','0'); // Turn off CFP $('unitsCFPPlanned').setStyle('display','none'); $('unitsCFPinputPlanned').setStyle('display','none'); $('unitsStartedCFP').setStyle('display','none'); $('unitsStartedCFPinput').setStyle('display','none'); $('cfpStartInput').set('value','0'); $('unitsCompletedCFP').setStyle('display','none'); $('unitsCompletedCFPinput').setStyle('display','none'); $('cfpCompleteInput').set('value','0'); // Turn off II $('unitsIIPlanned').setStyle('display','none'); $('unitsIIinputPlanned').setStyle('display','none'); $('unitsStartedII').setStyle('display','none'); $('unitsStartedIIinput').setStyle('display','none'); $('iiStartInput').set('value','0'); $('unitsCompletedII').setStyle('display','none'); $('unitsCompletedIIinput').setStyle('display','none'); $('iiCompleteInput').set('value','0'); } else if( $(el).get('value').test("Community") ) { $('unitsCFPPlanned').setStyle('display','block'); $('unitsCFPinputPlanned').setStyle('display','block'); $('unitsStartedCFP').setStyle('display','block'); $('unitsStartedCFPinput').setStyle('display','block'); $('unitsCompletedCFP').setStyle('display','block'); $('unitsCompletedCFPinput').setStyle('display','block'); // Turn off Rehab $('overallRehab').setStyle('display','none'); $('unitsRehabPlanned').setStyle('display','none'); $('unitsRehabinputPlanned').setStyle('display','none'); $('unitsStartedRehab').setStyle('display','none'); $('unitsStartedRehabinput').setStyle('display','none'); $('rehabStartInput').set('value','0'); $('unitsCompletedRehab').setStyle('display','none'); $('unitsCompletedRehabinput').setStyle('display','none'); $('rehabCompleteInput').set('value','0'); // Turn off New $('overallNew').setStyle('display','none'); $('unitsNewPlanned').setStyle('display','none'); $('unitsNewinputPlanned').setStyle('display','none'); $('unitsStartedNew').setStyle('display','none'); $('unitsStartedNewinput').setStyle('display','none'); $('newStartInput').set('value','0'); $('unitsCompletedNew').setStyle('display','none'); $('unitsCompletedNewinput').setStyle('display','none'); $('newCompleteInput').set('value','0'); // Turn off II $('unitsIIPlanned').setStyle('display','none'); $('unitsIIinputPlanned').setStyle('display','none'); $('unitsStartedII').setStyle('display','none'); $('unitsStartedIIinput').setStyle('display','none'); $('iiStartInput').set('value','0'); $('unitsCompletedII').setStyle('display','none'); $('unitsCompletedIIinput').setStyle('display','none'); $('iiCompleteInput').set('value','0'); } else if( $(el).get('value').test("Infrastructure") ) { $('unitsIIPlanned').setStyle('display','block'); $('unitsIIinputPlanned').setStyle('display','block'); $('unitsStartedII').setStyle('display','block'); $('unitsStartedIIinput').setStyle('display','block'); $('unitsCompletedII').setStyle('display','block'); $('unitsCompletedIIinput').setStyle('display','block'); // Turn off Rehab $('overallRehab').setStyle('display','none'); $('unitsRehabPlanned').setStyle('display','none'); $('unitsRehabinputPlanned').setStyle('display','none'); $('unitsStartedRehab').setStyle('display','none'); $('unitsStartedRehabinput').setStyle('display','none'); $('rehabStartInput').set('value','0'); $('unitsCompletedRehab').setStyle('display','none'); $('unitsCompletedRehabinput').setStyle('display','none'); $('rehabCompleteInput').set('value','0'); // Turn off CFP $('unitsCFPPlanned').setStyle('display','none'); $('unitsCFPinputPlanned').setStyle('display','none'); $('unitsStartedCFP').setStyle('display','none'); $('unitsStartedCFPinput').setStyle('display','none'); $('cfpStartInput').set('value','0'); $('unitsCompletedCFP').setStyle('display','none'); $('unitsCompletedCFPinput').setStyle('display','none'); $('cfpCompleteInput').set('value','0'); // Turn off New $('overallNew').setStyle('display','none'); $('unitsNewPlanned').setStyle('display','none'); $('unitsNewinputPlanned').setStyle('display','none'); $('unitsStartedNew').setStyle('display','none'); $('unitsStartedNewinput').setStyle('display','none'); $('newStartInput').set('value','0'); $('unitsCompletedNew').setStyle('display','none'); $('unitsCompletedNewinput').setStyle('display','none'); $('newCompleteInput').set('value','0'); } else { $('overallNew').setStyle('display','block'); $('unitsNewPlanned').setStyle('display','block'); $('unitsNewinputPlanned').setStyle('display','block'); $('unitsStartedNew').setStyle('display','block'); $('unitsStartedNewinput').setStyle('display','block'); $('unitsCompletedNew').setStyle('display','block'); $('unitsCompletedNewinput').setStyle('display','block'); // Turn off Rehab $('overallRehab').setStyle('display','none'); $('unitsRehabPlanned').setStyle('display','none'); $('unitsRehabinputPlanned').setStyle('display','none'); $('unitsStartedRehab').setStyle('display','none'); $('unitsStartedRehabinput').setStyle('display','none'); $('rehabStartInput').set('value','0'); $('unitsCompletedRehab').setStyle('display','none'); $('unitsCompletedRehabinput').setStyle('display','none'); $('rehabCompleteInput').set('value','0'); // Turn off CFP $('unitsCFPPlanned').setStyle('display','none'); $('unitsCFPinputPlanned').setStyle('display','none'); $('unitsStartedCFP').setStyle('display','none'); $('unitsStartedCFPinput').setStyle('display','none'); $('cfpStartInput').set('value','0'); $('unitsCompletedCFP').setStyle('display','none'); $('unitsCompletedCFPinput').setStyle('display','none'); $('cfpCompleteInput').set('value','0'); // Turn off II $('unitsIIPlanned').setStyle('display','none'); $('unitsIIinputPlanned').setStyle('display','none'); $('unitsStartedII').setStyle('display','none'); $('unitsStartedIIinput').setStyle('display','none'); $('iiStartInput').set('value','0'); $('unitsCompletedII').setStyle('display','none'); $('unitsCompletedIIinput').setStyle('display','none'); $('iiCompleteInput').set('value','0'); } } }); }, togglePHCFBuildingType: function() { ['projectTypeNew','projectTypeRehab','projectTypeNon'].each( function(el) { if( $(el).checked ) { if( $(el).get('value').test("Rehab") ) { $('rehabTable').setStyle('display','block'); $('nonProjectText').setStyle('display', 'none'); $('newlyDevelopedTable').setStyle("display",'none'); $('nondwellingTable').setStyle("display",'none'); $('buildingInfoQuestion').setStyle('display','block'); $('buildingInfoInstruction').setStyle('display','block'); } else if( $(el).get('value').test("New") ) { $('newlyDevelopedTable').setStyle("display",'block'); $('rehabTable').setStyle('display','none'); $('nondwellingTable').setStyle("display",'none'); $('nonProjectText').setStyle('display', 'none'); $('buildingInfoQuestion').setStyle('display','block'); $('buildingInfoInstruction').setStyle('display','block'); } else if( $(el).get('value').test("Non") ) { $('newlyDevelopedTable').setStyle("display",'none'); $('rehabTable').setStyle('display','none'); $('nondwellingTable').setStyle("display",'block'); $('nonProjectText').setStyle('display', 'none'); $('buildingInfoQuestion').setStyle('display','none'); $('buildingInfoInstruction').setStyle('display','none'); $('scatteredSites').setStyle('display','none'); $('scatteredSitesText').setStyle('display','none'); $('theBuildingList').setStyle('display','none'); $('buildingListText').setStyle('display','none'); } else { $('newlyDevelopedTable').setStyle("display",'none'); $('rehabTable').setStyle('display','none'); $('nondwellingTable').setStyle("display",'none'); $('nonProjectText').setStyle('display', 'block'); // // More changes $('buildingInfoQuestion').setStyle('display','none'); $('buildingInfoInstruction').setStyle('display','none'); $('scatteredSites').setStyle('display','none'); $('scatteredSitesText').setStyle('display','none'); $('theBuildingList').setStyle('display','none'); $('buildingListText').setStyle('display','none'); } } }); }, submitCoreActivityForm: function() { $('coreActivityForm').set('action','awardList.do'); $('cmd').set('value','doCoreProjectList'); $('coreActivityForm').submit(); }, editProjectSubmit: function() { $('cmd').set('value','doContinue'); $('gobacktolast').set('value','true'); $('perfFlowForm').submit(); }, openBuildingSystemDialog:function(checkbox) { var theCheckbox = $(checkbox); if( theCheckbox.checked ) { if( theCheckbox.get('id') == "id9" ) { $('otherText').setStyle('display','block'); $('otherTextBox').setStyle('display','block'); } else { $('systemsDialog').setStyle('display','block'); RAMPS.centerElement('systemsDialog'); } } else { if(confirm("Are you sure you want to remove all applied options for this selection?")) { // // Do the delete if( theCheckbox.get('id') == "id9" ) { $('otherText').setStyle('display','none'); $('otherTextBox').setStyle('display','none'); $('theTextarea').set('value', ''); } } else { checkbox.checked = true; } } }, openDialogShortCut: function() { $('systemsDialog').setStyle('display','block'); RAMPS.centerElement('systemsDialog'); }, closeDialog: function() { $('systemsDialog').setStyle('display','none'); }, closePopupDialog: function(dialogName) { $(dialogName).setStyle('display','none'); }, /** * Open or close teh "Other" dialogs on the FundingInfo section of Core Activity */ changeFundingType: function() { var selectedType = $('ram_fundType').get('value'); if( selectedType.test("Other Recovery Act Funds") ) { $('OtherAgencyText').setStyle('display',''); $('otherArraAganceList').setStyle('display',''); $('OtherProgramText').setStyle('display',''); $('otherArraProgramList').setStyle('display',''); } else { $('OtherAgencyText').setStyle('display','none'); $('otherArraAganceList').setStyle('display','none'); $('OtherProgramText').setStyle('display','none'); $('otherArraProgramList').setStyle('display','none'); } }, checkProjectPlanRadio: function(item) { isChecked = $(item).get('checked'); if(isChecked) { if(item=='newDevRadio') { RAMPS.toggleDivs( ['newDev'], ['rehabDiv','cfp','ii'] ); } else if( item =='rehabRadio') { RAMPS.toggleDivs( ['rehabDiv'], ['newDev','cfp','ii'] ); } else if( item=='cfpRadio') { RAMPS.toggleDivs( ['cfp'], ['rehabDiv','newDev','ii'] ); } else if( item=='iiRadio') { RAMPS.toggleDivs( ['ii'], ['rehabDiv','cfp','newDev'] ); } else if( item=='nonDevRadio') { RAMPS.toggleDivs( ['skip'], ['newDev','rehabDiv','cfp','ii'] ); } else if( item=='otherRadio') { RAMPS.toggleDivs( ['skip'], ['newDev','rehabDiv','cfp','ii'] ); } else if( item=='demoRadio') { RAMPS.toggleDivs( ['skip'], ['newDev','rehabDiv','cfp','ii'] ); } else { } } }, expandAllAccordion: function() { $$('div.accordionElement').each(function(item) { $(item).setStyle('display','block'); $(item).setStyle('visibility','visible'); }); }, showTextTip: function(screenId, labelId) { $('texttipDialog').set('html', ''); var xml_request = 'ajax.do?cmd=doTextTip&screenId=' + screenId + '&labelId=' + labelId; this.AjaxRequest(xml_request, 'texttipDialog', ''); // // center the dialog this.hangElementToEdge('texttipDialog', mouseX, mouseY); }, showActionWindow: function(id){ $(id).setStyle('display','block'); RAMPS.centerElement(id); }, hideActionWindow: function(id){ $(id).setStyle('display','none'); } });