← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6185: local vn - Removed popup

 

------------------------------------------------------------
revno: 6185
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-03-06 15:33:14 +0700
message:
  local vn - Removed popup
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByDataSetAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCustomDataSetReportAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByDataSets.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByPeriods.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompleteds.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/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByDataSetAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByDataSetAction.java	2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByDataSetAction.java	2012-03-06 08:33:14 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportsheet.datasetcompleted.action;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,6 @@
 public class ViewCompletedReportByDataSetAction
     implements Action
 {
-
     // -------------------------------------------------------------------------
     // Dependency
     // -------------------------------------------------------------------------

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java	2012-02-03 08:38:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java	2012-03-06 08:33:14 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportsheet.datasetcompleted.action;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,7 +59,6 @@
 public class ViewCompletedReportByPeriodsAction
     implements Action
 {
-
     // -------------------------------------------------------------------------
     // Dependency
     // -------------------------------------------------------------------------
@@ -111,7 +110,7 @@
         this.dataSetId = dataSetId;
     }
 
-    private List<Integer> periodIds;
+    private List<Integer> periodIds = new ArrayList<Integer>();
 
     public void setPeriodIds( List<Integer> periodIds )
     {
@@ -129,13 +128,20 @@
         return organisationUnits;
     }
 
-    private List<Period> periods;
+    private List<Period> periods = new ArrayList<Period>();
 
     public List<Period> getPeriods()
     {
         return periods;
     }
 
+    private Map<String, Integer> completedValues = new HashMap<String, Integer>();
+
+    public Map<String, Integer> getCompletedValues()
+    {
+        return completedValues;
+    }
+
     private DataSet dataSet;
 
     public DataSet getDataSet()
@@ -143,13 +149,6 @@
         return dataSet;
     }
 
-    private Map<String, Integer> completedValues;
-
-    public Map<String, Integer> getCompletedValues()
-    {
-        return completedValues;
-    }
-
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -159,16 +158,13 @@
     {
         dataSet = dataSetService.getDataSet( dataSetId );
 
-        organisationUnits = new ArrayList<OrganisationUnit>( selectionTreeManager.getSelectedOrganisationUnits() );
+        organisationUnits = new ArrayList<OrganisationUnit>( selectionTreeManager
+            .getReloadedSelectedOrganisationUnits() );
 
-        periods = new ArrayList<Period>();
+        CompleteDataSetRegistration completeDataSetRegistration = null;
 
         Period period = null;
 
-        CompleteDataSetRegistration completeDataSetRegistration = null;
-
-        completedValues = new HashMap<String, Integer>();
-
         for ( Integer id : periodIds )
         {
             period = periodService.getPeriod( id );
@@ -179,14 +175,18 @@
                 {
                     Collection<DataElement> dataElements = dataSet.getDataElements();
                     Collection<DataValue> values = dataValueService.getDataValues( o, period, dataElements );
+
                     int count = 0;
+
                     for ( DataElement de : dataElements )
                     {
                         int opCount = 1;
+
                         for ( DataElementCategory ca : de.getCategoryCombo().getCategories() )
                         {
                             opCount *= ca.getCategoryOptions().size();
                         }
+
                         count += opCount;
                     }
                     int percent = (values.size() * 100) / count;

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCustomDataSetReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCustomDataSetReportAction.java	2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/datasetcompleted/action/ViewCustomDataSetReportAction.java	2012-03-06 08:33:14 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -52,9 +52,9 @@
 public class ViewCustomDataSetReportAction
     implements Action
 {
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Dependency
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private PeriodService periodService;
 
@@ -64,9 +64,9 @@
 
     private OrganisationUnitService organisationUnitService;
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Input & Output
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private Integer dataSetId;
 
@@ -82,9 +82,9 @@
 
     private OrganisationUnit organisationUnit;
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Getter & Setter
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     public DataSet getDataSet()
     {
@@ -150,9 +150,9 @@
 
         organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId.intValue() );
 
-        Map<String, String> dataValues = new HashMap<String, String>();    
+        Map<String, String> dataValues = new HashMap<String, String>();
         for ( DataElement dataElement : dataSet.getDataElements() )
-        {        
+        {
             DataElementCategoryCombo catCombo = dataElement.getCategoryCombo();
             for ( DataElementCategoryOptionCombo optionCombo : catCombo.getOptionCombos() )
             {
@@ -170,9 +170,9 @@
             }
         }
 
-        // -----------------------------------------------------------------
+        // ---------------------------------------------------------------------
         // Get the custom data entry form if any
-        // -----------------------------------------------------------------
+        // ---------------------------------------------------------------------
 
         DataEntryForm dataEntryForm = dataSet.getDataEntryForm();
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-02-28 08:50:46 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-03-06 08:33:14 +0000
@@ -623,20 +623,20 @@
 
 		<action name="viewCompleteReportByPeriod"
 			class="org.hisp.dhis.reportsheet.datasetcompleted.action.ViewCompletedReportByPeriodsAction">			
-			<result name="success" type="velocity">/popup.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/dataSetCompletedByPeriods.vm</param>			
+			<result name="success" type="velocity">
+				/dhis-web-spreadsheet-reporting/dataSetCompletedByPeriods.vm</result>
 		</action>
 
 		<action name="viewCompleteReportByDataSet"
 			class="org.hisp.dhis.reportsheet.datasetcompleted.action.ViewCompletedReportByDataSetAction">
-			<result name="success" type="velocity">/popup.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/dataSetCompletedByDataSets.vm</param>		
+			<result name="success" type="velocity">
+				/dhis-web-spreadsheet-reporting/dataSetCompletedByDataSets.vm</result>
 		</action>
 
 		<action name="viewCustomDataSetReport"
 			class="org.hisp.dhis.reportsheet.datasetcompleted.action.ViewCustomDataSetReportAction">
-			<result name="success" type="velocity">/popup.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/customDataSetReport.vm</param>			
+			<result name="success" type="velocity">
+				/dhis-web-spreadsheet-reporting/customDataSetReport.vm</result>
 		</action>	
 
 		<!-- PREVIEW REPORT EXCEL ACTION -->

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByDataSets.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByDataSets.vm	2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByDataSets.vm	2012-03-06 08:33:14 +0000
@@ -3,7 +3,7 @@
 		<tr>
 			<th></th>
 		#foreach( $d in $dataSets )
-			<th>$encoder.htmlEncode( $d.name )</th>
+			<th>$!encoder.htmlEncode( $d.name )</th>
 		#end
 		</tr>
 	</thead>

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByPeriods.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByPeriods.vm	2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompletedByPeriods.vm	2012-03-06 08:33:14 +0000
@@ -57,5 +57,4 @@
 			</th>				
 		</tr>		
 	</tfoot>
-</table>
-
+</table>
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompleteds.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompleteds.vm	2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/dataSetCompleteds.vm	2012-03-06 08:33:14 +0000
@@ -1,7 +1,7 @@
 <script>
 	jQuery( function(){
-		var viewByPeriodForm = validation( 'viewByPeriodForm', function( form ){ form.submit()}, function(){ selectAllById( 'selectedPeriods' ) } );
-		var viewByDataSetForm = validation( 'viewByDataSetForm', function( form ){ form.submit()}, function(){ selectAllById( 'selectedDataSets' ) } );
+		var viewByPeriodForm = validation( 'viewByPeriodForm', function( form ){ showCompletedReportByPeriod(); } );
+		var viewByDataSetForm = validation( 'viewByDataSetForm', function( form ){ showCompletedReportByDataSet(); } );
 	});
 </script>
 
@@ -13,41 +13,27 @@
          <li><a href="#view_by_periods"><span>$i18n.getString('view_by') $i18n.getString( "period" )</span></a></li>
          <li><a href="#view_by_datasets"><span>$i18n.getString('view_by') $i18n.getString( "dataset" )</span></a></li>
 	</ul>
-	<!--
-	<div id="bookmark" style="padding:0px">
-		<table width="100%" class="listTable" id="listTable">
-			<tbody id="list">	
-				#foreach( $b in $bookmarks )
-				<tr id="tr${b.id}">
-					<td style="padding:5px">$encoder.htmlEncode( $b.description )</td>
-					<td></td>
-				</tr>
-				#end
-			</tbody>
-		</table>
-	</div>
-	-->
+
 	<div id="view_by_periods" style="padding:0px">
-		<form id="viewByPeriodForm" action="viewCompleteReportByPeriod.action" method="POST" target="_blank">
+		<form id="viewByPeriodForm">
 		<table>
 			<tr>
 				<td>
-					<br>
-					<b>$i18n.getString( "dataset" )</b><br>
-					<select style="width:300px" id="dataSetId" name="dataSetId" onchange="getPeriodsAndOrganisationUnit(this.value)">
-					<option value="">$i18n.getString( "select")</option>
+					<br/><b>$i18n.getString( "dataset" )</b><br/>
+					<select style="width:300px" id="dataSetId" name="dataSetId" onchange="getPeriodsAndOrganisationUnit( this.value );">
+					<option value="">$i18n.getString( "select" )</option>
 					#foreach( $dataSet in $dataSets )
-						<option value="$dataSet.id">$encoder.htmlEncode( $dataSet.name )</option>
+						<option value="$dataSet.id">$!encoder.htmlEncode( $dataSet.name )</option>
 					#end
 					</select>
 				</td>
 			</tr>
 			<tr>
 				<td>
-					<b>$i18n.getString( "period" )</b><br>
+					<b>$i18n.getString( "period" )</b><br/>
 					<table>
 						<tr>
-							<td><select id="availablePeriods" style="width:270px;" multiple size=10" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )"/></td>
+							<td><select id="availablePeriods" style="width:270px;" multiple size="10" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )"/></td>
 							<td style="text-align:center">
 								<input type="button" value="&gt;" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )"><br>
 								<input type="button" value="&lt;" title="$i18n.getString('move_all')" style="width:50px" onclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )"><br>		
@@ -62,7 +48,7 @@
 			<tr>			
 				<td id="organisationUnitSelect">
 					<div style="padding-top:20px;width:400px;" id="organisationUnitContainer">
-						#organisationUnitSelectionTree( false, false, true )
+						#organisationUnitSelectionTree( true, false, true )
 					</div>
 				</td>
 			</tr>
@@ -74,7 +60,7 @@
 	</div>
 
 	<div id="view_by_datasets" style="padding:0px">
-		<form id="viewByDataSetForm" action="viewCompleteReportByDataSet.action" method="POST" target="_blank">
+		<form id="viewByDataSetForm">
 		<table>
 			<tr>				
 				<td>
@@ -118,8 +104,7 @@
 	</div>
 </div>
 
-
-
+<div id="contentDiv"></div>
 
 <script>
 
@@ -139,9 +124,9 @@
 
 function getPeriodsAndOrganisationUnit( id )
 {	
-	if( id != '' )
+	if( id )
 	{
-		jQuery.postJSON("viewByPeriodForm.action",{id:id},function( json ){
+		jQuery.postJSON("viewByPeriodForm.action",{ id:id }, function( json ){
 			var availablePeriods = jQuery( "#view_by_periods #availablePeriods" );
 			availablePeriods.empty();
 			jQuery( "#view_by_periods #selectedPeriods" ).empty();
@@ -176,4 +161,46 @@
 	}
 }
 
+function showCompletedReportByPeriod()
+{
+	lockScreen();
+
+	var url = "viewCompleteReportByPeriod.action?" + getParamString( 'selectedPeriods', 'periodIds' );
+
+	jQuery( "#contentDiv" ).load( url, {
+		dataSetId : getFieldValue( "dataSetId" )
+	}, function ( data ) {
+		unLockScreen();
+		showDialog( 'completed_reports_by_period' );
+	} );
+}
+
+function showCompletedReportByDataSet()
+{
+	lockScreen();
+
+	var url = "viewCompleteReportByDataSet.action?" + getParamString( 'selectedDataSets', 'dataSetIds' );
+
+	jQuery( "#contentDiv" ).load( url, {
+		periodId : getFieldValue( "selectedPeriod" )
+	}, function( data ) {
+		unLockScreen();
+		showDialog( 'completed_reports_by_dataset' );
+	} );
+}
+
+function showDialog( title )
+{
+	jQuery( "#contentDiv" ).dialog
+	( {
+		title: title,
+		maximize: true, 
+		closable: true,
+		modal:false,
+		overlay:{ background:'#000000', opacity:0.1 },
+		width: 1200,
+		height: 500
+	} )
+}
+
 </script>