dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24367
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11931: bugfixes for assignedPrograms filtering
------------------------------------------------------------
revno: 11931
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-05 15:22:42 +0200
message:
bugfixes for assignedPrograms filtering
added:
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importEvents.vm
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java
--
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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java 2013-09-05 13:09:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java 2013-09-05 13:22:42 +0000
@@ -70,6 +70,7 @@
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -321,6 +322,7 @@
Set<OrganisationUnit> userOrganisationUnits = new HashSet<OrganisationUnit>();
Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
Set<Program> programs = new HashSet<Program>();
+ Map<String, List<Program>> programAssociations = new HashMap<String, List<Program>>();
List<Program> userPrograms;
if ( type == null )
@@ -332,8 +334,6 @@
userPrograms = new ArrayList<Program>( programService.getProgramsByCurrentUser( type ) );
}
- Map<String, List<Program>> programAssociations = new HashMap<String, List<Program>>();
-
if ( currentUserService.currentUserIsSuper() && currentUser.getOrganisationUnits().isEmpty() )
{
userOrganisationUnits.addAll( organisationUnitService.getRootOrganisationUnits() );
@@ -369,8 +369,16 @@
if ( userPrograms.contains( program ) )
{
organisationUnits.add( organisationUnit );
- programs.addAll( ouPrograms );
- programAssociations.put( organisationUnit.getUid(), ouPrograms );
+ programs.add( program );
+
+ if ( programAssociations.get( organisationUnit.getUid() ) != null )
+ {
+ programAssociations.get( organisationUnit.getUid() ).add( program );
+ }
+ else
+ {
+ programAssociations.put( organisationUnit.getUid(), Arrays.asList( program ) );
+ }
}
}
}
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importEvents.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importEvents.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importEvents.vm 2013-09-05 13:22:42 +0000
@@ -0,0 +1,78 @@
+
+<h3>$i18n.getString( "import_summary" )</h3>
+
+<h4>$i18n.getString( "import_total_count" )</h4>
+<table>
+<col width="110">
+<col width="110">
+<tr>
+ <th>$i18n.getString( "type" )</th>
+ <th style="text-align:center">$i18n.getString( "count" )</th>
+</tr>
+<tr>
+ <td>$i18n.getString( "imported" )</td>
+ <td style="text-align:center">$!importSummaries.imported</td>
+</tr>
+<tr>
+ <td>$i18n.getString( "updated" )</td>
+ <td style="text-align:center">$!importSummaries.updated</td>
+</tr>
+<tr>
+ <td>$i18n.getString( "ignored" )</td>
+ <td style="text-align:center">$!importSummaries.ignored</td>
+</tr>
+</table>
+
+#foreach( $summary in $importSummaries.importSummaries )
+
+<h4>$i18n.getString( "import_count" )</h4>
+#if( $summary.dataValueCount )
+<table>
+<col width="110">
+<col width="110">
+<tr>
+ <th>$i18n.getString( "type" )</th>
+ <th style="text-align:center">$i18n.getString( "count" )</th>
+</tr>
+<tr>
+ <td>$i18n.getString( "imported" )</td>
+ <td style="text-align:center">${summary.dataValueCount.imported}</td>
+</tr>
+<tr>
+ <td>$i18n.getString( "updated" )</td>
+ <td style="text-align:center">${summary.dataValueCount.updated}</td>
+</tr>
+<tr>
+ <td>$i18n.getString( "ignored" )</td>
+ <td style="text-align:center">${summary.dataValueCount.ignored}</td>
+</tr>
+</table>
+#else
+<p>$i18n.getString( "no_data_values_found" )</p>
+#end
+
+#if( $summary.status == 'ERROR' )
+<h4 style="color: red;">$i18n.getString( "error" )</h4>
+$summary.description
+#else
+<h4>$i18n.getString( "conflicts" )</h4>
+#if( $summary.conflicts.size() > 0 )
+<table>
+<col width="110">
+<col width="110">
+<tr>
+ <th>$i18n.getString( "element" )</th>
+ <th>$i18n.getString( "description" )</th>
+</tr>
+#foreach( $conflict in $summary.conflicts )
+<tr>
+ <td>${conflict.object}</td>
+ <td>$encoder.htmlEncode( $conflict.value )</td>
+</tr>
+#end
+</table>
+#else
+<p>$i18n.getString( "no_conflicts_found" )</p>
+#end
+#end
+#end