← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5923: Impl first cut of new data mart interface. UI provides period type selection and start / end date...

 

------------------------------------------------------------
revno: 5923
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-02-12 20:23:31 +0100
message:
  Impl first cut of new data mart interface. UI provides period type selection and start / end date for full export.
modified:
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetNotificationsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.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 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2012-02-12 17:11:20 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java	2012-02-12 19:23:31 +0000
@@ -230,7 +230,7 @@
         expressionService.filterInvalidIndicators( indicators );
 
         clock.logTime( "Filtered objects" );
-        notifier.notify( DATAMART, "Loading indicator formulas" );
+        notifier.notify( DATAMART, "Loading indicators" );
 
         // ---------------------------------------------------------------------
         // Explode indicator expressions

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm	2012-02-12 17:11:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm	2012-02-12 19:23:31 +0000
@@ -8,16 +8,18 @@
 
 .notificationTable td {
   padding: 3px;
-}
+}
 </style>
 
+#if( $notifications.size() > 0 )
 <table class="notificationTable">
 <col width="120">
 <col width="380">
 #foreach( $notification in $notifications )
 <tr>
 	<td>${format.formatDateTime( $notification.time )}:</td>
-	<td>${encoder.htmlEncode( $notification.message )} #if( $velocityCount == 1 )&nbsp;<img src='../images/ajax-loader-bar.gif'>#end</td>
+	<td>${encoder.htmlEncode( $notification.message )} #if( $velocityCount == 1 )&nbsp;&nbsp;<img src='../images/ajax-loader-bar.gif'>#end</td>
 </tr>
 #end
-</table>
\ No newline at end of file
+</table>
+#end
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css	2011-12-19 07:37:29 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css	2012-02-12 19:23:31 +0000
@@ -461,7 +461,6 @@
 div.inputCriteria
 {
   position: relative;
-  left: 2px;
   width: 400px; /* Override this */
   height: 400px; /* Override this */
   border: 1px solid #a4d2a3;

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetNotificationsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetNotificationsAction.java	2012-02-12 17:11:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetNotificationsAction.java	2012-02-12 19:23:31 +0000
@@ -27,6 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.hisp.dhis.system.notification.Notification;
@@ -74,13 +75,13 @@
     // Output
     // -------------------------------------------------------------------------
     
-    private List<Notification> notifications;
+    private List<Notification> notifications = new ArrayList<Notification>();
     
     public List<Notification> getNotifications()
     {
         return notifications;
     }
-
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -101,7 +102,7 @@
         {
             notifications = notifier.getNotifications( max );
         }
-            
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-02-12 19:23:31 +0000
@@ -395,7 +395,7 @@
 error=Error
 warning=Warning
 success=Success
-waiting=Please wait...
+waiting=Please wait
 expression_not_well_formed=Expression is not well formed
 locate_by_code=Locate by code
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java	2012-02-12 14:40:54 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java	2012-02-12 19:23:31 +0000
@@ -2,10 +2,13 @@
 
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
+import org.hisp.dhis.period.CalendarPeriodType;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.scheduling.DataMartTask;
 import org.hisp.dhis.system.scheduling.Scheduler;
 import org.hisp.dhis.system.util.DateUtils;
@@ -33,17 +36,17 @@
         this.dataMartTask = dataMartTask;
     }
     
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
 
+    private Set<String> periodType = new HashSet<String>();
+    
+    public void setPeriodType( Set<String> periodType )
+    {
+        this.periodType = periodType;
+    }
+
     private String startDate;
     
     public void setStartDate( String startDate )
@@ -69,11 +72,21 @@
         Date start = DateUtils.getMediumDate( startDate );
         Date end = DateUtils.getMediumDate( endDate );
         
-        List<Period> periods = new ArrayList<Period>( periodService.getPeriodsBetweenDates( start, end ) );
-        
-        dataMartTask.setPeriods( periods );
-        
-        scheduler.executeTask( dataMartTask );
+        List<Period> periods = new ArrayList<Period>();
+        
+        for ( String type : periodType )
+        {
+            CalendarPeriodType periodType = (CalendarPeriodType) PeriodType.getPeriodTypeByName( type );
+            
+            periods.addAll( periodType.generatePeriods( start, end ) );
+        }
+        
+        if ( periods.size() > 0 )
+        {
+            dataMartTask.setPeriods( periods );
+        
+            scheduler.executeTask( dataMartTask );
+        }
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-02-12 14:40:54 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-02-12 19:23:31 +0000
@@ -248,7 +248,6 @@
 	scope="prototype">
 	<property name="scheduler" ref="scheduler"/>
 	<property name="dataMartTask" ref="dataMartLast12MonthsTask"/>
-	<property name="periodService" ref="org.hisp.dhis.period.PeriodService"/>
   </bean>
   
   <!-- Export -->

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2012-02-12 14:40:54 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2012-02-12 19:23:31 +0000
@@ -405,4 +405,5 @@
 data_mart_management = Data mart management
 start_date = Start date
 end_date = End date
-start_export = Start export
\ No newline at end of file
+start_export = Start export
+period_types = Period types
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js	2012-02-12 17:11:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js	2012-02-12 19:23:31 +0000
@@ -1,20 +1,30 @@
 
 $( document ).ready( function() {
 	datePickerInRange( 'startDate' , 'endDate' );
+	pingNotificationsTimeout();
 } );
 
 function startExport()
 {
-	var url = 'startExport.action';
 	var startDate = $( '#startDate' ).val();
 	var endDate = $( '#endDate' ).val();
 	
-	$.get( url, { startDate:startDate, endDate:endDate }, pingNotifications );
+	var url = 'startExport.action?startDate=' + startDate + '&endDate=' + endDate;
+	
+	$( 'input[name="periodType"]').each( function() {
+		url += "&periodType=" + $( this ).val();
+	} );
+	
+	$.get( url, pingNotifications );
 }
 
 function pingNotifications()
 {
-	$( '#notificationDiv' ).load( '../dhis-web-commons-ajax/getNotifications.action?category=DATAMART' );
-	
-	setTimeout( "pingNotifications()", 2000 );
-}
\ No newline at end of file
+	$( '#notificationDiv' ).load( '../dhis-web-commons-ajax/getNotifications.action?category=DATAMART' );	
+}
+
+function pingNotificationsTimeout()
+{
+	pingNotifications();
+	setTimeout( "pingNotificationsTimeout()", 2000 );
+}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.vm	2012-02-12 17:11:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.vm	2012-02-12 19:23:31 +0000
@@ -1,11 +1,20 @@
 
 <h3>$i18n.getString( "data_mart_management" )</h3>
 
-<div id="critiera" class="inputCriteria" style="width:380px;height:110px;">
+<div id="critiera" class="inputCriteria" style="width:380px;height:170px;">
 <table>
 <col width="120">
 <col width="240">
 <tr>
+	<td>$i18n.getString( "period_types" )</td>
+	<td><label for="monthly">$i18n.getString( "Monthly" )</label><input type="checkbox" id="monthly" name="periodType" value="Monthly" checked="checked">&nbsp;
+		<label for="biMonthly">$i18n.getString( "BiMonthly" )</label><input type="checkbox" id="biMonthly" name="periodType" value="BiMonthly" checked="checked">&nbsp;
+		<label for="quarterly">$i18n.getString( "Quarterly" )</label><input type="checkbox" id="quarterly" name="periodType" value="Quarterly" checked="checked"><br>
+		<label for="sixMonthly">$i18n.getString( "SixMonthly" )</label><input type="checkbox" id="sixMonthly" name="periodType" value="SixMonthly" checked="checked">&nbsp;
+		<label for="yearly">$i18n.getString( "Yearly" )</label><input type="checkbox" id="yearly" name="periodType" value="Yearly" checked="checked"><br><br>
+	</td>
+</tr>
+<tr>
 	<td>$i18n.getString( "start_date" )</td>
 	<td><input type="text" id="startDate" style="width:200px"></td>
 </tr>
@@ -20,4 +29,4 @@
 </table>
 </div>
 
-<div id="notificationDiv"></div>
\ No newline at end of file
+<div id="notificationDiv" class="notifications"></div>
\ No newline at end of file