← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1912: portalreportform vm with include period option

 

------------------------------------------------------------
revno: 1912
committer: Namrata
branch nick: trunk
timestamp: Mon 2010-08-09 16:03:31 +0530
message:
  portalreportform vm with include period option
modified:
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm	2010-07-06 09:34:47 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/portalReportForm.vm	2010-08-09 10:33:31 +0000
@@ -27,23 +27,49 @@
 				var orgUnitId = ""+$orgUnit.getId();
 			    orgUnitLevels.put(orgUnitId,"$organisationUnitService.getLevelOfOrganisationUnit( $orgUnit )");
 			#end
-			            					
+
+                        function showOrHideDates()
+                        {
+                            var includePeriodChecked = document.getElementById( "includePeriod" ).checked
+                            if(includePeriodChecked==true)
+                            {
+                                jQuery("#lblStartDate").show();
+                                jQuery("#startDate").show();
+                                jQuery("#getStartDate").show();
+                                jQuery("#lblEndDate").show();
+                                jQuery("#endDate").show();
+                                jQuery("#getEndDate").show();
+                            }
+                            else
+                            {
+                                jQuery("#lblStartDate").hide();
+                                jQuery("#startDate").hide();
+                                jQuery("#getStartDate").hide();
+                                jQuery("#lblEndDate").hide();
+                                jQuery("#endDate").hide();
+                                jQuery("#getEndDate").hide();
+                            }
+                        }
 			function formValidations()
-			{			            
+			{
+                                var includePeriodChecked = document.getElementById( "includePeriod" ).checked
 				var reportListIndex = document.reportForm.reportList.selectedIndex;
 				var orgunitIdValue = document.reportForm.ouIDTB.value;
 			    var startDateValue = document.reportForm.startDate.value;
-                var endDateValue = document.reportForm.endDate.value;
+                            var endDateValue = document.reportForm.endDate.value;
            			            
 			    if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
-				else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
-                else if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="") {alert("Please Select Start Date And End Date"); return false;}
-                else if(startDateValue > endDateValue) {alert("Starte Date Is Greater Than End Date"); return false;}
-
-				document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
-				document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
-				
-				document.reportForm.reportLevelTB.value = reportLevels.get(document.reportForm.reportList.options[reportListIndex].value);
+                            else if(orgunitIdValue == null || orgunitIdValue == "") {alert("Please Select OrganisationUnit"); return false;}
+                            else if(includePeriodChecked==true)
+                            {
+                                if(startDateValue == null || startDateValue== "" || endDateValue == null || endDateValue=="")
+                                {   alert("Please Select Start Date And End Date"); return false;}
+                                else if(startDateValue > endDateValue)
+                                {   alert("Start Date Is Greater Than End Date"); return false;}
+                            }
+                            document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
+                            document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
+                            document.reportForm.reportLevelTB.value = reportLevels.get(document.reportForm.reportList.options[reportListIndex].value);
                 
 			    return true;
 			}			
@@ -53,6 +79,9 @@
 		<form id="reportForm" name="reportForm" action="generatePortalReport.action" method="post" onsubmit="return formValidations()" target="_blank">
                     <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>
                         <tr>
+                            <td><input type="checkbox" name="includePeriod" onChange="return showOrHideDates()" id="includePeriod" checked>Report With Specified Period</td>
+                        </tr>
+                        <tr>
                            
                             <td class="NormalB">
                                 Reports :<br />
@@ -72,12 +101,12 @@
                         </tr>
                         <tr>
                             <td class="NormalB">
-                                <label for="startDate">$i18n.getString( 'start_date' ) ($i18n.getString( "format.date.label" ))</label><br/>
+                                <label for="startDate" id="lblStartDate">$i18n.getString( 'start_date' ) ($i18n.getString( "format.date.label" ))</label><br/>
                                 <input type="text" id="startDate" name="startDate" style="width:20em">
                                 <img src="../images/calendar_icon.gif" width="16" height="16" id="getStartDate" cursor: pointer;" title="$i18n.getString( "date_selector" )" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''">
                             </td>
                             <td class="NormalB">
-                                <label for="endDate">$i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label><br />
+                                <label for="endDate" id="lblEndDate">$i18n.getString( 'end_date' ) ($i18n.getString( "format.date.label" ))</label><br />
                                 <input type="text" id="endDate" name="endDate" style="width:20em">
                                 <img src="../images/calendar_icon.gif" width="16" height="16" id="getEndDate" cursor: pointer;" title="$i18n.getString( "date_selector" )" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''">
                             </td>