← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2716: Json encoding fix

 

------------------------------------------------------------
revno: 2716
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-01-22 21:56:30 +0100
message:
  Json encoding fix
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonAccessDenied.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombos.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOperands.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java
  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-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.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-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonAccessDenied.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonAccessDenied.vm	2010-05-26 14:45:10 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonAccessDenied.vm	2011-01-22 20:56:30 +0000
@@ -1,4 +1,4 @@
 {
   "response": "error",
-  "message": "$!encoder.jsEncode( $i18n.getString( 'access_denied' ) ) - $!encoder.jsEncode( $i18n.getString( 'access_denied_message' ) )"
+  "message": "$!encoder.jsonEncode( $i18n.getString( 'access_denied' ) ) - $!encoder.jsonEncode( $i18n.getString( 'access_denied_message' ) )"
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombos.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombos.vm	2010-10-14 08:14:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonCategoryOptionCombos.vm	2011-01-22 20:56:30 +0000
@@ -3,7 +3,7 @@
 #foreach( $coc in $categoryOptionCombos )
   {
     "id": $!{coc.id},
-    "name": "$!encoder.jsEncode( ${coc.name} )",
+    "name": "$!encoder.jsonEncode( ${coc.name} )",
 	"default": "$coc.isDefault()"
   }#if( $velocityCount < $size ),#end
 #end

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOperands.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOperands.vm	2011-01-12 11:07:48 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOperands.vm	2011-01-22 20:56:30 +0000
@@ -8,6 +8,8 @@
     "operandName": "$!encoder.jsonEncode( ${operand.operandName} )"
   }#if( $velocityCount < $size ),#end
 #end
-] ,
+]
+#if( $usePaging ),
 	"paging":#parse( "/dhis-web-commons/ajax/jsonPaging.vm" )
+#end
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java	2011-01-13 12:12:41 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java	2011-01-22 20:56:30 +0000
@@ -77,7 +77,7 @@
     }
 
     // -------------------------------------------------------------------------
-    // Output & Input
+    // Input
     // -------------------------------------------------------------------------
 
     private Integer id;
@@ -115,6 +115,22 @@
         this.includeTotals = includeTotals;
     }
 
+    private boolean usePaging = false;
+
+    public boolean isUsePaging()
+    {
+        return usePaging;
+    }
+
+    public void setUsePaging( boolean usePaging )
+    {
+        this.usePaging = usePaging;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
     public List<DataElementOperand> operands;
 
     public List<DataElementOperand> getOperands()
@@ -156,7 +172,7 @@
 
         Collections.sort( operands, new DataElementOperandNameComparator() );
 
-        if ( this.usepaging )
+        if ( usePaging )
         {
             this.paging = createPaging( operands.size() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java	2011-01-20 08:39:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/paging/ActionPagingSupport.java	2011-01-22 20:56:30 +0000
@@ -66,18 +66,6 @@
         return paging;
     }
 
-    protected boolean usepaging;
-
-    public boolean isUsepaging()
-    {
-        return usepaging;
-    }
-
-    public void setUsepaging( boolean usepaging )
-    {
-        this.usepaging = usepaging;
-    }
-
     @SuppressWarnings( "unchecked" )
     private String getCurrentLink()
     {

=== 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	2011-01-13 12:12:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2011-01-22 20:56:30 +0000
@@ -133,7 +133,7 @@
 
 		var key = getFieldValue( "indicator-expression-container input[id=filter]");
 
-		dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {id: id, aggregationOperator: aggregationOperator, usepaging: true, key: key } );	
+		dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {id: id, aggregationOperator: aggregationOperator, usePaging: true, key: key } );	
 
 		checkAggregationOperator();
 	}	

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm	2010-12-10 07:45:59 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/expressionBuilderForm.vm	2011-01-22 20:56:30 +0000
@@ -1,10 +1,10 @@
 <div id="expression-container">
 <form id="expression-form" name="expression-form">
-<table width="750" style="text-align:left">
+<table width="800" style="text-align:left">
 	<colgroup>
 		<col width="250"/>
 		<col width="50"/>
-		<col width="450"/>
+		<col width="500"/>
 	</colgroup>
 	<tr>
 		<th colspan="3">$i18n.getString( "description" )</th>		
@@ -38,7 +38,7 @@
 
 			<select id="dataSetId" name="dataSetId" style="width:450px" onchange="loadDataElements(this.value)"/><br/>
 
-			<select id="dataElementId" name="dataElementId" size="10" style="min-width:450px" ondblclick="insertText( 'expression', this.value, 'aggregationOperator' )"/>
+			<select id="dataElementId" name="dataElementId" size="7" style="min-width:450px" ondblclick="insertText( 'expression', this.value, 'aggregationOperator' )"/>
 			
 		</td>
 	</tr>
@@ -86,7 +86,7 @@
 		loadDataElements( dataSets.val() );
 	});
 }
-	
+
 function getExpressionText()
 {
 	if( hasText('expression') ){
@@ -104,22 +104,21 @@
 		jQuery( "#formulaText").html( '' );
 	}
 }
-	
+
 function insertText( inputAreaName, inputText, radioGroupName )
 {
 	insertTextCommon( inputAreaName, inputText );
 	
 	getExpressionText();
 }
-	
+
 function cleanExpression()
 {
 	checAggregationOperator();
 	
 	getExpressionText();
 }
-	
-	
+
 function insertExpression()
 {
 	var expression = getFieldValue( 'expression-container textarea[id=expression]' );
@@ -142,16 +141,12 @@
 				
 				dialog.dialog( "close" );
 			}
-			
-			
-		});		
-	
+		});
 }
 	
-	jQuery( function(){
-		validation( 'expression-form', insertExpression );
-	});
-
+jQuery( function(){
+	validation( 'expression-form', insertExpression );
+});
 	
 </script>
 
@@ -205,8 +200,4 @@
 	dialog.dialog("open");
 }
 
-
-
 </script>
-
-