← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4706: (wip) Showed details - Organization unit module.

 

------------------------------------------------------------
revno: 4706
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 15:37:54 +0700
message:
  (wip) Showed details - Organization unit module.
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupObject.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupSetObject.vm
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroup.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSet.vm
modified:
  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/javascript/organisationUnit.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroup.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js


--
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/jsonOrganisationUnitGroup.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroup.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroup.vm	2011-09-27 08:37:54 +0000
@@ -0,0 +1,7 @@
+{ "organisationUnitGroup":
+  {
+    "id": "$!{organisationUnitGroup.id}",
+    "name": "$!encoder.jsonEncode( ${organisationUnitGroup.name} )",
+    "memberCount": "$!{organisationUnitGroup.members.size()}"
+  }
+}

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSet.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSet.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitGroupSet.vm	2011-09-27 08:37:54 +0000
@@ -0,0 +1,9 @@
+{ "organisationUnitGroupSet":
+  {
+	"id": "${organisationUnitGroupSet.id}",
+	"name": "$!encoder.jsonEncode( ${organisationUnitGroupSet.name} )",
+	"description": "$!encoder.jsonEncode( ${organisationUnitGroupSet.description} )",
+	"compulsory": "$!{organisationUnitGroupSet.compulsory}",
+	"memberCount": "$!{memberCount}"
+  }
+}
\ No newline at end of file

=== 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	2011-09-14 10:14:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2011-09-27 08:37:54 +0000
@@ -106,8 +106,8 @@
     </action>
 
     <action name="getOrganisationUnitGroup" class="org.hisp.dhis.oum.action.organisationunitgroup.GetOrganisationUnitGroupAction">
-      <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupObject.vm
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonOrganisationUnitGroup.vm
       </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
@@ -166,8 +166,8 @@
     </action>
 
     <action name="getOrganisationUnitGroupSet" class="org.hisp.dhis.oum.action.organisationunitgroupset.GetGroupSetAction">
-      <result name="success" type="velocity-xml">
-        /dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupSetObject.vm
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonOrganisationUnitGroupSet.vm
       </result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js	2011-09-26 09:31:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js	2011-09-27 08:37:54 +0000
@@ -29,37 +29,32 @@
 
 function showOrganisationUnitDetails( unitId )
 {
-    var request = new Request();
-    request.setResponseTypeXML( 'organisationUnit' );
-    request.setCallbackSuccess( organisationUnitReceived );
-    request.send( '../dhis-web-commons-ajax/getOrganisationUnit.action?id=' + unitId );
-}
-
-function organisationUnitReceived( unitElement )
-{
-    setInnerHTML( 'nameField', getElementValue( unitElement, 'name' ) );
-    setInnerHTML( 'shortNameField', getElementValue( unitElement, 'shortName' ) );
-    setInnerHTML( 'openingDateField', getElementValue( unitElement, 'openingDate' ) );
-
-    var orgUnitCode = getElementValue( unitElement, 'code' );
-    setInnerHTML( 'codeField', orgUnitCode ? orgUnitCode : '[' + none + ']' );
-
-    var closedDate = getElementValue( unitElement, 'closedDate' );
-    setInnerHTML( 'closedDateField', closedDate ? closedDate : '[' + none + ']' );
-
-    var commentValue = getElementValue( unitElement, 'comment' );
-    setInnerHTML( 'commentField', commentValue ? commentValue.replace( /\n/g, '<br>' ) : '[' + none + ']' );
-
-    var active = getElementValue( unitElement, 'active' );
-    setInnerHTML( 'activeField', active == 'true' ? yes : no );
-
-    var url = getElementValue( unitElement, 'url' );
-    setInnerHTML( 'urlField', url ? '<a href="' + url + '">' + url + '</a>' : '[' + none + ']' );
-
-    var lastUpdated = getElementValue( unitElement, 'lastUpdated' );
-    setInnerHTML( 'lastUpdatedField', lastUpdated ? lastUpdated : '[' + none + ']' );
-
-    showDetails();
+    jQuery.post( '../dhis-web-commons-ajax-json/getOrganisationUnit.action',
+		{ id: unitId }, function ( json ) {
+		setInnerHTML( 'nameField', json.organisationUnit.name );
+		setInnerHTML( 'shortNameField', json.organisationUnit.shortName );
+		setInnerHTML( 'openingDateField', json.organisationUnit.openingDate );
+
+		var orgUnitCode = json.organisationUnit.code;
+		setInnerHTML( 'codeField', orgUnitCode ? orgUnitCode : '[' + none + ']' );
+
+		var closedDate = json.organisationUnit.closedDate;
+		setInnerHTML( 'closedDateField', closedDate ? closedDate : '[' + none + ']' );
+
+		var commentValue = json.organisationUnit.comment;
+		setInnerHTML( 'commentField', commentValue ? commentValue.replace( /\n/g, '<br>' ) : '[' + none + ']' );
+
+		var active = json.organisationUnit.active;
+		setInnerHTML( 'activeField', active == 'true' ? yes : no );
+
+		var url = json.organisationUnit.url;
+		setInnerHTML( 'urlField', url ? '<a href="' + url + '">' + url + '</a>' : '[' + none + ']' );
+
+		var lastUpdated = json.organisationUnit.lastUpdated;
+		setInnerHTML( 'lastUpdatedField', lastUpdated ? lastUpdated : '[' + none + ']' );
+
+		showDetails();
+	});
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroup.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroup.js	2010-09-09 09:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroup.js	2011-09-27 08:37:54 +0000
@@ -5,18 +5,13 @@
 
 function showOrganisationUnitGroupDetails( unitId )
 {
-    var request = new Request();
-    request.setResponseTypeXML( 'organisationUnitGroup' );
-    request.setCallbackSuccess( organisationUnitGroupReceived );
-    request.send( 'getOrganisationUnitGroup.action?id=' + unitId );
-}
-
-function organisationUnitGroupReceived( unitGroupElement )
-{
-    setInnerHTML( 'nameField', getElementValue( unitGroupElement, 'name' ) );
-    setInnerHTML( 'memberCountField', getElementValue( unitGroupElement, 'memberCount' ) );
-    
-    showDetails();
+    jQuery.post( 'getOrganisationUnitGroup.action', { id: unitId },
+		function ( json ) {
+			setInnerHTML( 'nameField', json.organisationUnitGroup.name );
+			setInnerHTML( 'memberCountField', json.organisationUnitGroup.memberCount );
+			
+			showDetails();
+	});
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js	2010-12-21 07:10:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js	2011-09-27 08:37:54 +0000
@@ -8,31 +8,18 @@
 
 function showOrganisationUnitGroupSetDetails( groupSetId )
 {
-	var request = new Request();
-    request.setResponseTypeXML( 'organisationUnitGroupSet' );
-    request.setCallbackSuccess( organisationUnitGroupSetReceived );
-    request.send( 'getOrganisationUnitGroupSet.action?id=' + groupSetId );
-}
-
-function organisationUnitGroupSetReceived( unitElement )
-{
-	setInnerHTML( 'nameField', getElementValue( unitElement, 'name' ) );
-    setInnerHTML( 'descriptionField', getElementValue( unitElement, 'description' ) );
-    
-    var compulsory = getElementValue( unitElement, 'compulsory' );
-        
-    if ( compulsory == "true" )
-    {
-    	setInnerHTML( 'compulsoryField', i18n_yes );
-    }
-    else
-    {
-    	setInnerHTML( 'compulsoryField', i18n_no );
-    }
-        
-    setInnerHTML( 'memberCountField', getElementValue( unitElement, 'memberCount' ) );
-    
-    showDetails();
+	jQuery.post( 'getOrganisationUnitGroupSet.action', { id: groupSetId },
+		function ( json ) {
+			setInnerHTML( 'nameField', json.organisationUnitGroupSet.name );
+			setInnerHTML( 'descriptionField', json.organisationUnitGroupSet.description );
+			
+			var compulsory = json.organisationUnitGroupSet.compulsory;
+			
+			setInnerHTML( 'compulsoryField', compulsory == "true" ? i18n_yes : i18n_no );
+			setInnerHTML( 'memberCountField', json.organisationUnitGroupSet.memberCount );
+			
+			showDetails();
+	});
 }
 
 // -----------------------------------------------------------------------------

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupObject.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupObject.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupObject.vm	1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<organisationUnitGroup>
-	<id>$organisationUnitGroup.id</id>
-	<name>$encoder.xmlEncode( $organisationUnitGroup.name )</name>
-	<memberCount>$memberCount</memberCount>
-</organisationUnitGroup>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupSetObject.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupSetObject.vm	2010-02-10 19:12:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/responseOrganisationUnitGroupSetObject.vm	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<organisationUnitGroupSet>
-	<id>$organisationUnitGroupSet.id</id>
-	<name>$encoder.xmlEncode( $organisationUnitGroupSet.name )</name>
-	<description>$encoder.xmlEncode( $organisationUnitGroupSet.description )</description>
-	<compulsory>$organisationUnitGroupSet.compulsory</compulsory>
-	<memberCount>$memberCount</memberCount>
-</organisationUnitGroupSet>
\ No newline at end of file