← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2351: Work in progress

 

------------------------------------------------------------
revno: 2351
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-12-12 21:39:00 +0100
message:
  Work in progress
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetOrganisationUnitDetailsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitSearch.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.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-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2010-12-10 07:45:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2010-12-12 20:39:00 +0000
@@ -106,7 +106,7 @@
 		checkAggregationOperator();
 		getExpressionText();
 		dialog.dialog("option", "title", "$i18n.getString( 'edit_numerator' )");
-		dialog.dialog( "open");		
+		dialog.dialog("open");		
 	}
 	
 	function indicatorDenominatorForm()

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetOrganisationUnitDetailsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetOrganisationUnitDetailsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetOrganisationUnitDetailsAction.java	2010-12-12 20:39:00 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.oum.action.search;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupSetNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetOrganisationUnitDetailsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitGroupService organisationUnitGroupService;
+
+    public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+    {
+        this.organisationUnitGroupService = organisationUnitGroupService;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnit organisationUnit;
+
+    public OrganisationUnit getOrganisationUnit()
+    {
+        return organisationUnit;
+    }
+    
+    private List<OrganisationUnitGroupSet> groupSets;
+
+    public List<OrganisationUnitGroupSet> getGroupSets()
+    {
+        return groupSets;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        organisationUnit = organisationUnitService.getOrganisationUnit( id );
+        
+        // ---------------------------------------------------------------------
+        // Get group sets
+        // ---------------------------------------------------------------------
+
+        groupSets = new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSets() );
+        
+        Collections.sort( groupSets, new OrganisationUnitGroupSetNameComparator() );
+        
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml	2010-12-12 18:39:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml	2010-12-12 20:39:00 +0000
@@ -323,5 +323,15 @@
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
+	
+	<bean
+		id="org.hisp.dhis.oum.action.search.GetOrganisationUnitDetailsAction"
+		class="org.hisp.dhis.oum.action.search.GetOrganisationUnitDetailsAction"
+		scope="prototype">
+		<property name="organisationUnitGroupService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+		<property name="organisationUnitService"
+			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+	</bean>
 		
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2010-12-12 18:39:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2010-12-12 20:39:00 +0000
@@ -301,6 +301,12 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm</param>
 			<param name="menu">/dhis-web-maintenance-organisationunit/menu.vm</param>
+			<param name="javascripts">javascript/organisationUnitSearch.js</param>
+		</action>
+		
+		<action name="getOrganisationUnitDetails"
+			class="org.hisp.dhis.oum.action.search.GetOrganisationUnitDetailsAction">
+			<result name="success" type="velocity">/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm</result>
 		</action>
 		
 	</package>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitSearch.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitSearch.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitSearch.js	2010-12-12 20:39:00 +0000
@@ -0,0 +1,17 @@
+
+function initOrgUnitDetails()
+{
+	$( "#organisationUnitDetails" ).dialog( {
+		modal:true,
+		autoOpen:false,
+		width:600,
+		height:600
+	} );
+}
+
+function showOrgUnitDetails( id )
+{
+	$( "#organisationUnitDetails" ).load( "getOrganisationUnitDetails.action?id=" + id, function() {
+		$( "#organisationUnitDetails" ).dialog( "open" );
+	} );
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitDetails.vm	2010-12-12 20:39:00 +0000
@@ -0,0 +1,22 @@
+
+<h3>$encoder.htmlEncode( $organisationUnit.name )</h3>
+
+<table>
+
+<tr>
+<td><b>$i18n.getString( "short_name" ):</b></td>
+<td>$encoder.htmlEncode( $organisationUnit.shortName )</td>
+</tr>
+<tr>
+<td><b>$i18n.getString( "code" ):</b></td>
+<td>$encoder.htmlEncode( $organisationUnit.code )</td>
+</tr>
+
+#foreach( $groupSet in $groupSets )
+<tr>
+<td><b>$!encoder.htmlEncode( $groupSet.name ):</b></td>
+<td>$!encoder.htmlEncode( $!organisationUnit.getGroupNameInGroupSet( $groupSet ) )</td>
+</tr>
+#end
+
+</table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm	2010-12-12 19:06:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm	2010-12-12 20:39:00 +0000
@@ -70,7 +70,7 @@
 #foreach( $groupSet in $groupSets )
 <td>$!unit.getGroupNameInGroupSet( $groupSet )</td>
 #end
-<td><a href="#"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a></td>
+<td><a href="#" onclick="showOrgUnitDetails( '${unit.id}' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a></td>
 </tr>
 #end
 </tbody>
@@ -79,8 +79,13 @@
 
 #end
 
+<div id="organisationUnitDetails"></div>
+
 <script type="text/javascript">
-	jQuery(document).ready(function(){	
-		tableSorter( 'listTable' );	
-	});
+
+$( document ).ready( function() {	
+	tableSorter( 'listTable' );	
+	initOrgUnitDetails();
+} );
+
 </script>