← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4707: (wip) Showed details - DataSet module.

 

------------------------------------------------------------
revno: 4707
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 16:10:27 +0700
message:
  (wip) Showed details - DataSet module.
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSectionObject.vm
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.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
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm	2010-12-12 19:49:23 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm	2011-09-27 09:10:27 +0000
@@ -3,6 +3,9 @@
     "id": $!{dataSet.id},
     "name": "$!encoder.jsonEncode( ${dataSet.name} )",
     "shortName": "$!encoder.jsonEncode( ${dataSet.shortName} )",
-    "periodTypeId": "$!{dataSet.periodTypeId}"
+    "periodTypeId": "$!{dataSet.periodTypeId}",
+	"frequency": "$i18n.getString( $!{dataSet.periodType.name} )",
+    "dataElementCount": "$!{dataSet.dataElements.size()}",
+    "dataentryform": #if( $!{dataSet.dataEntryForm} )"$!encoder.jsonEncode( ${dataSet.dataEntryForm.name} )"#end
   }
 }

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonSection.vm	2011-09-27 09:10:27 +0000
@@ -0,0 +1,9 @@
+{ "section":
+  {
+    "id": "$!{section.id}",
+    "name": "$!encoder.jsonEncode( ${section.name} )",
+    "dataSet": "$!encoder.jsonEncode( ${section.dataSet.name} )",
+    "categoryCombo": "$!encoder.jsonEncode( ${categoryCombo.name} )",
+	"dataElementCount": "$!{sectionDataElements.size()}"
+  }
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml	2011-09-18 21:20:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml	2011-09-27 09:10:27 +0000
@@ -63,7 +63,8 @@
     </action>
 
     <action name="getSection" class="org.hisp.dhis.dataset.action.section.GetSectionAction">
-      <result name="success" type="velocity-xml">/dhis-web-maintenance-dataset/responseSectionObject.vm</result>
+      <result name="success" type="velocity-json">
+		/dhis-web-commons/ajax/jsonSection.vm</result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js	2011-08-26 22:00:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js	2011-09-27 09:10:27 +0000
@@ -5,20 +5,15 @@
 
 function showDataSetDetails( dataSetId )
 {
-  var request = new Request();
-  request.setResponseTypeXML( 'dataSet' );
-  request.setCallbackSuccess( dataSetRecieved );
-  request.send( '../dhis-web-commons-ajax/getDataSet.action?id=' + dataSetId );
-}
-
-function dataSetRecieved( dataSetElement )
-{
-  setInnerHTML( 'nameField', getElementValue( dataSetElement, 'name' ) );
-  setInnerHTML( 'frequencyField', getElementValue( dataSetElement, 'frequency' ) );
-  setInnerHTML( 'dataElementCountField', getElementValue( dataSetElement, 'dataElementCount' ) );
-  setInnerHTML( 'dataEntryFormField', getElementValue( dataSetElement, 'dataentryform' ) );
-
-  showDetails();
+	jQuery.post( '../dhis-web-commons-ajax-json/getDataSet.action', 
+		{ id: dataSetId }, function ( json ) {
+		setInnerHTML( 'nameField', json.dataSet.name );
+		setInnerHTML( 'frequencyField', json.dataSet.frequency );
+		setInnerHTML( 'dataElementCountField', json.dataSet.dataElementCount );
+		setInnerHTML( 'dataEntryFormField', json.dataSet.dataentryform );
+
+		showDetails();
+	});
 }
 
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js	2011-08-26 22:00:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js	2011-09-27 09:10:27 +0000
@@ -4,20 +4,14 @@
 
 function showSectionDetails( sectionId )
 {
-  var request = new Request();
-  request.setResponseTypeXML( 'section' );
-  request.setCallbackSuccess( sectionReceived );
-  request.send( 'getSection.action?sectionId=' + sectionId );
-}
-
-function sectionReceived( sectionElement )
-{
-  setInnerHTML( 'nameField', getElementValue( sectionElement, 'name' ) );
-  setInnerHTML( 'dataSetField', getElementValue( sectionElement, 'dataSet' ) );
-  setInnerHTML( 'categoryComboField', getElementValue( sectionElement, 'categoryCombo' ) );
-  setInnerHTML( 'dataElementCountField', getElementValue( sectionElement, 'dataElementCount' ) );  
-
-  showDetails();
+	jQuery.post( 'getSection.action', { sectionId: sectionId }, function ( json ) {
+		setInnerHTML( 'nameField', json.section.name );
+		setInnerHTML( 'dataSetField', json.section.dataSet );
+		setInnerHTML( 'categoryComboField', json.section.categoryCombo );
+		setInnerHTML( 'dataElementCountField', json.section.dataElementCount );  
+		
+		showDetails();
+	});
 }
 
 function sortOrderSubmit() {

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSectionObject.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSectionObject.vm	2010-10-12 08:22:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSectionObject.vm	1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dataSet>
-  <id>$section.id</id>
-  <name>$encoder.xmlEncode( $section.name )</name>
-  <!--title>$encoder.xmlEncode( $section.title )</title-->
-  <dataSet>$encoder.xmlEncode( $section.dataSet.name )</dataSet>  
-  <categoryCombo>$encoder.xmlEncode( $categoryCombo.name )</categoryCombo>
-  <dataElementCount>$sectionDataElements.size()</dataElementCount>  
-</dataSet>
\ No newline at end of file