← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6492: Data set report, added information about the user who completed the form if a complete registrati...

 

------------------------------------------------------------
revno: 6492
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-05 15:13:13 +0200
message:
  Data set report, added information about the user who completed the form if a complete registration exists for the current data set, period, org unit.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlUser.vm
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  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/dataset/action/GenerateDataSetReportAction.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/dataSetReport.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderSectionDataSetReportForm.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
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlUser.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlUser.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlUser.vm	2012-04-05 13:13:13 +0000
@@ -0,0 +1,36 @@
+<h3><span id="senderName">$!{user.firstName} $!{user.surname}</span></h3>
+<table>
+<tr>
+<td><label>$i18n.getString( "email" ):</label></td>
+<td><span id="senderEmail">$!{user.email}</span></td>
+</tr>
+<tr>
+<td><label>$i18n.getString( "username" ):</label></td>
+<td><span id="senderUsername">$!{user.userCredentials.username}</span></td>
+</tr>
+<tr>
+<td><label>$i18n.getString( "phone_number" ):</label></td>
+<td><span id="senderPhoneNumber">$!{user.phoneNumber}</span></td>
+</tr>
+#if( $user.organisationUnits && $user.organisationUnits.size() > 0 )
+<tr>
+<td><label>$i18n.getString( "organisation_units" ):</label></td>
+<td><span id="senderOrganisationUnits">
+#set( $unitsNo = $user.organisationUnits.size() )
+#foreach( $unit in $user.organisationUnits )
+${unit.name}#if( $velocityCount < $unitsNo ), #end
+#end
+</span></td>
+</tr>
+#end
+#if( $user.userCredentials.userAuthorityGroups && $user.userCredentials.userAuthorityGroups.size() > 0 )
+<tr>
+<td><label>$i18n.getString( "user_roles" ):</label></td>
+<td><span id="senderUserRoles">
+#set( $rolesNo = $user.userCredentials.userAuthorityGroups.size() )
+#foreach( $role in $user.userCredentials.userAuthorityGroups )
+${role.name}#if( $velocityCount < $rolesNo ), #end
+#end
+</span></td>
+</tr>
+#end
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2012-03-10 10:14:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2012-04-05 13:13:13 +0000
@@ -458,6 +458,19 @@
 
   </package>
 
+  <!-- Common actions HTML -->
+  
+  <package name="dhis-web-commons-ajax-html" extends="dhis-web-commons" namespace="/dhis-web-commons-ajax-html">
+
+    <action name="getUser" class="org.hisp.dhis.commons.action.GetUserAction">
+	  <result name="success" type="velocity">
+        /dhis-web-commons/ajax/htmlUser.vm
+      </result>
+      <param name="onExceptionReturn">plainTextError</param>
+	</action>
+
+  </package>
+
   <!-- Common actions JSON -->
 
   <package name="dhis-web-commons-ajax-json" extends="dhis-web-commons" namespace="/dhis-web-commons-ajax-json">

=== 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-04-04 07:20:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-04-05 13:13:13 +0000
@@ -330,7 +330,10 @@
 surname=Surname
 first_name=First name
 email=E-mail
+username=Username
 phone_number=Phone number
+organisation_units=Organisation units
+user_roles=User roles
 update_user_success=Updated information successfully
 wrong_password=Wrong password
 help_center=Help Center

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2012-03-18 14:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java	2012-04-05 13:13:13 +0000
@@ -36,6 +36,8 @@
 import java.util.List;
 
 import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.dataset.CompleteDataSetRegistration;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.datasetreport.DataSetReportService;
@@ -80,6 +82,13 @@
     {
         this.dataSetService = dataSetService;
     }
+    
+    private CompleteDataSetRegistrationService registrationService;
+
+    public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
+    {
+        this.registrationService = registrationService;
+    }
 
     private PeriodService periodService;
 
@@ -171,6 +180,13 @@
         return selectedPeriod;
     }
 
+    private CompleteDataSetRegistration registration;
+    
+    public CompleteDataSetRegistration getRegistration()
+    {
+        return registration;
+    }
+
     private String customDataEntryFormCode;
 
     public String getCustomDataEntryFormCode()
@@ -211,6 +227,8 @@
         }
         
         String dataSetType = selectedDataSet.getDataSetType();
+
+        registration = registrationService.getCompleteDataSetRegistration( selectedDataSet, selectedPeriod, selectedOrgunit );
         
         if ( TYPE_CUSTOM.equals( dataSetType ) )
         {

=== 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 19:23:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-04-05 13:13:13 +0000
@@ -203,6 +203,7 @@
     <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
     <property name="dataSetReportService" ref="org.hisp.dhis.datasetreport.DataSetReportService" />
     <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+	<property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
     <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
   </bean>
   	

=== 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-03-30 13:32:44 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2012-04-05 13:13:13 +0000
@@ -206,4 +206,5 @@
 include_cumulative=Include cumulative
 include_regression=Include regression
 print=Print
-reporting_period=Reporting period
\ No newline at end of file
+reporting_period=Reporting period
+completed_by=Completed by
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2012-03-18 14:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2012-04-05 13:13:13 +0000
@@ -67,6 +67,18 @@
 	window.location.href = url;
 }
 
+function setUserInfo( username )
+{
+	$( "#userInfo" ).load( "../dhis-web-commons-ajax-html/getUser.action?username=" + username, function() {
+		$( "#userInfo" ).dialog( {
+	        modal : true,
+	        width : 350,
+	        height : 350,
+	        title : "User"
+	    } );
+	} );	
+}
+
 function showCriteria()
 {
 	$( "#criteria" ).show( "fast" );

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm	2012-03-18 14:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderCustomDataSetReportForm.vm	2012-04-05 13:13:13 +0000
@@ -2,12 +2,14 @@
 <input type="hidden" id="dataSetId" value="${selectedDataSet.id}">
 <input type="hidden" id="periodId" value="${selectedPeriod.externalId}">
 <input type="hidden" id="selectedUnitOnly" value="${selectedUnitOnly}">
+<div id="userInfo" class="page"></div>
 
 <h3>$i18n.getString('reporting_unit'): $encoder.htmlEncode( $selectedOrgunit.name ) &nbsp; $i18n.getString('reporting_period'): $format.formatPeriod( $selectedPeriod )</h3>
 
 <div style="margin-bottom:15px">
 <input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportDataSetReport( 'xls' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportDataSetReport( 'pdf' )" style="width:140px">
+#if( $registration ) &nbsp;<span>$i18n.getString( "completed_by" ): <a href="javascript:setUserInfo( '${registration.storedBy}' )">${registration.storedBy}</a></span>#end
 </div>
 
 <div>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm	2012-03-18 14:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderDefaultDataSetReportForm.vm	2012-04-05 13:13:13 +0000
@@ -2,12 +2,14 @@
 <input type="hidden" id="dataSetId" value="${selectedDataSet.id}">
 <input type="hidden" id="periodId" value="${selectedPeriod.externalId}">
 <input type="hidden" id="selectedUnitOnly" value="${selectedUnitOnly}">
+<div id="userInfo" class="page"></div>
 
 <h3>$encoder.htmlEncode( $selectedOrgunit.name ) - $format.formatPeriod( $selectedPeriod )</h3>
 
 <div style="margin-bottom:15px">
 <input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportDataSetReport( 'xls' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportDataSetReport( 'pdf' )" style="width:140px">
+#if( $registration ) &nbsp;<span>$i18n.getString( "completed_by" ): <a href="javascript:setUserInfo( '${registration.storedBy}' )">${registration.storedBy}</a></span>#end
 </div>
 
 <div>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderSectionDataSetReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderSectionDataSetReportForm.vm	2012-03-18 14:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/renderSectionDataSetReportForm.vm	2012-04-05 13:13:13 +0000
@@ -10,12 +10,14 @@
 <input type="hidden" id="dataSetId" value="${selectedDataSet.id}">
 <input type="hidden" id="periodId" value="${selectedPeriod.externalId}">
 <input type="hidden" id="selectedUnitOnly" value="${selectedUnitOnly}">
+<div id="userInfo" class="page"></div>
 
 <h3>$encoder.htmlEncode( $selectedOrgunit.name ) - $format.formatPeriod( $selectedPeriod )</h3>
 
 <div style="margin-bottom:15px">
 <input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportDataSetReport( 'xls' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportDataSetReport( 'pdf' )" style="width:140px">
+#if( $registration ) &nbsp;<span>$i18n.getString( "completed_by" ): <a href="javascript:setUserInfo( '${registration.storedBy}' )">${registration.storedBy}</a></span>#end
 </div>
 
 #foreach( $grid in $grids )