← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1692: Description for formulaText - Excel Reporting.

 

------------------------------------------------------------
revno: 1692
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-03-25 15:15:35 +0700
message:
  Description for formulaText - Excel Reporting.
added:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/action/
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/action/GetFormulaTextAction.java
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetReportExcelItemAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelitemgroups.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseReportItem.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/style.css


--
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 directory 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression'
=== added directory 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/action'
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/action/GetFormulaTextAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/action/GetFormulaTextAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/expression/action/GetFormulaTextAction.java	2010-03-25 08:15:35 +0000
@@ -0,0 +1,101 @@
+package org.hisp.dhis.reportexcel.expression.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id: GetFormulaTextAction.java 5334 2008-06-04 13:45:41Z larshelg $
+ */
+public class GetFormulaTextAction
+    extends ActionSupport
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ExpressionService expressionService;
+
+    public void setExpressionService( ExpressionService expressionService )
+    {
+        this.expressionService = expressionService;
+    }    
+    
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
+    // Properties
+    // -------------------------------------------------------------------------
+
+    private String formula;
+
+    public void setFormula( String formula )
+    {
+        this.formula = formula;
+    }
+
+    private String formulaText;
+
+    public String getFormulaText()
+    {
+        return formulaText;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        if ( formula != null )
+        {
+            String result = expressionService.expressionIsValid( formula );
+            
+            if ( result.equals( ExpressionService.VALID ) )
+            {
+                formulaText = expressionService.getExpressionDescription( formula );
+            }
+            else
+            {
+                formulaText = i18n.getString( result );
+            }
+        }
+        
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetReportExcelItemAction.java	2009-09-14 15:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetReportExcelItemAction.java	2010-03-25 08:15:35 +0000
@@ -26,6 +26,9 @@
  */
 package org.hisp.dhis.reportexcel.item.action;
 
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.reportexcel.ReportExcel;
 import org.hisp.dhis.reportexcel.ReportExcelItem;
 import org.hisp.dhis.reportexcel.ReportExcelService;
 
@@ -33,26 +36,52 @@
 
 /**
  * @author Tran Thanh Tri
- * @version $Id$
+ * @version $Id GetReportExcelItemAction.java 2010-03-25 02:25:20Z Chau Thu Tran
+ *          $
  */
 
 public class GetReportExcelItemAction
     implements Action
 {
-    // -------------------------------------------
-    // Dependency
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
 
     private ReportExcelService reportService;
 
-    // -------------------------------------------
+    private ExpressionService expressionService;
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    // -------------------------------------------------------------------------
     // Input & Output
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private Integer id;
 
     private ReportExcelItem reportItem;
 
+    private String textualFormula;
+
+    // -------------------------------------------------------------------------
+    // Getters & Setters
+    // -------------------------------------------------------------------------
+
+    public void setExpressionService( ExpressionService expressionService )
+    {
+        this.expressionService = expressionService;
+    }
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    public String getTextualFormula()
+    {
+        return textualFormula;
+    }
+
     public void setReportService( ReportExcelService reportService )
     {
         this.reportService = reportService;
@@ -73,7 +102,18 @@
     {
         reportItem = reportService.getReportExcelItem( id );
 
+        if ( !reportItem.getReportExcel().getReportType().equals( ReportExcel.TYPE.CATEGORY ) )
+        {
+            textualFormula = expressionService.getExpressionDescription( reportItem.getExpression() );
+        }
+        else
+        {
+            String formula = reportItem.getExpression().replaceAll( "[\\[\\]]", "" );
+            int categoryOptionComboId = Integer.parseInt( formula.substring( formula.indexOf( "." ) + 1, formula
+                .length() ) );
+            textualFormula = "*."
+                + dataElementCategoryService.getDataElementCategoryOptionCombo( categoryOptionComboId ).getName();
+        }
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-03-10 07:12:56 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml	2010-03-25 08:15:35 +0000
@@ -335,6 +335,9 @@
 		class="org.hisp.dhis.reportexcel.item.action.GetReportExcelItemAction"
 		scope="prototype">
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
+		<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
+		<property name="dataElementCategoryService"
+			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.reportexcel.item.action.AddReportExcelItemAction"
@@ -397,6 +400,14 @@
 		<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
 	</bean>
 
+	<bean id="org.hisp.dhis.reportexcel.expression.action.GetFormulaTextAction"
+		class="org.hisp.dhis.reportexcel.expression.action.GetFormulaTextAction"
+		scope="prototype">
+		<property name="expressionService">
+			<ref bean="org.hisp.dhis.expression.ExpressionService" />
+		</property>
+	</bean>
+
 	<!-- EXPORT REPORT EXCEL -->
 
 	<bean id="org.hisp.dhis.reportexcel.export.action.SelectFormAction"

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2010-03-24 02:56:06 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2010-03-25 08:15:35 +0000
@@ -216,4 +216,5 @@
 intro_excel_template_management = Upload, rename, search, download and delete the file extension .xls or .xlsx. Users can identify which files are used and unused files to. Automatically, allowing to update excel reporting system when file names which are used to be changed.
 translation_translate		= Translate
 template_using              = File is using
-template_pending            = File is pending
\ No newline at end of file
+template_pending            = File is pending
+expression_not_well_formed 	= Expression is not well formed
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2010-03-08 16:36:21 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2010-03-25 08:15:35 +0000
@@ -458,6 +458,13 @@
 				/dhis-web-excel-reporting/responseDataElementOrder.vm</result>
 		</action>
 
+		<action name="getFormulaText"
+			class="org.hisp.dhis.reportexcel.expression.action.GetFormulaTextAction">
+			<result name="success" type="velocity-xml">
+				/dhis-web-excel-reporting/responseFormulaText.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+		
 		<!-- GENERATE REPORT EXCEL ACTION -->
 
 		<action name="selectExportReportParam"

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelitemgroups.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelitemgroups.vm	2010-03-11 06:27:12 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelitemgroups.vm	2010-03-25 08:15:35 +0000
@@ -17,7 +17,7 @@
 			<th>$i18n.getString('name')</th>
 			<th>$i18n.getString('type')</th>
 			<th>$i18n.getString('period_type')</th>		
-			<th width="110px">$i18n.getString('operations')</th>		
+			<th width="140px">$i18n.getString('operations')</th>		
 		</tr>
 	</thead>
 	<tbody id="list">	

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js	2010-03-11 06:27:12 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js	2010-03-25 08:15:35 +0000
@@ -99,6 +99,10 @@
 	byId( "expression" ).value = getElementValue( xmlObject, 'expression' );
 	byId( "sheetNo" ).value = getElementValue( xmlObject, 'sheetNo' );
 	
+	var formulaName = getElementValue( xmlObject, 'textualFormula' );
+	byId( "formulaDiv").innerHTML = formulaName;
+	byId( "categoryFormulaDiv").innerHTML = formulaName;
+	
 	byId( "reportItemButton" ).onclick = function(e) {
 	
 		validateUpdateReportExcelItem();
@@ -226,13 +230,16 @@
 
 function insertFormulaText( sourceId, targetId ) {
 
-	byId(targetId).value += byId(sourceId).value;
+	var source = byId(sourceId);
+	//byId(targetId).value += source.value;
+	byId(targetId).value = source.value;
+	byId(targetId + "Div").innerHTML = source[source.selectedIndex].text;
 }
 
-function insertOperation( target, value ) {
-
+ function insertOperation( target, value ) {
 	byId(target).value += value;
-}
+	byId(target + "Div").innerHTML += value;
+} 
 
 function selectALL( checked ) {
 
@@ -611,6 +618,9 @@
 	enable("dataElementGroup");
 	enable("availableDataElements");
 	byId("availableDataElements").onchange = function(e){ getOptionCombos() };
+	if(mode=='update'){
+		updateFormulaText( 'formula' );
+	}
 	
 	$("#normal").showAtCenter( true );
 }
@@ -704,6 +714,7 @@
 
 	var dataElementComboId = "[" + byId("availableDataElements").value + "." + byId("optionCombos").value + "]";
 	byId("formula").value += dataElementComboId;
+	updateFormulaText("formula");
 }
 
 /**
@@ -729,9 +740,10 @@
 	list.options.length = 0;
 	list.add( new Option( "ALL", "ALL" ), null );
 	
+	var formula = byId("formulaIndicator").value;
 	for ( id in indicatorGroups )
 	{
-		list.add( new Option( indicatorGroups[id], id ), null );
+		list.add(  new Option( indicatorGroups[id], id ), null );
 	}
 }
 
@@ -759,6 +771,13 @@
 		option.value = "[" + id + "]";
 		option.text = indicatorName;
 		indiatorList.add( option, null );	
+		
+		var formula = byId('formulaIndicator').value;
+		if(formula==option.value){
+			option.selected = true;
+			byId("formulaIndicatorDiv").innerHTML = indicatorName;
+		}
+		
 	}
 }
 
@@ -801,7 +820,7 @@
 	enable( "availableDataElements_" );
 	byId( "availableDataElements_" ).onchange = function(e){ getOptionCombos_() };
 	
-	showDivEffect();
+	//showDivEffect();
 	$( "#category" ).show();	
 }
 
@@ -863,12 +882,40 @@
 		
 		option.value = id ;
 		option.text = name;
-		optionComboList.add( option, null );	
+		optionComboList.add( option, null );
 	}
 }
 
 function insertDataElementId_() {
 
-	var dataElementComboId = "[*." + byId("optionCombos_").value + "]";
-	byId("categoryFormula").value += dataElementComboId;
+	var optionCombo = byId("optionCombos_");
+	var dataElementComboId = "[*." + optionCombo.value + "]";
+	//byId("categoryFormula").value += dataElementComboId;
+	byId("categoryFormula").value = dataElementComboId;
+	byId("categoryFormulaDiv").innerHTML = "*." + optionCombo[optionCombo.selectedIndex].text ;
+}
+
+function clearFormula(formulaFieldName){
+	byId(formulaFieldName).value = '';
+	byId(formulaFieldName + "Div").innerHTML = ''
+}
+// -------------------------------------------------------------------------------
+// Show textFormula
+// -------------------------------------------------------------------------------
+
+function updateFormulaText( formulaFieldName )
+{		
+	var formula = htmlEncode( byId( formulaFieldName ).value );
+	var url = "getFormulaText.action?formula=" + formula;
+	
+	var request = new Request();
+	request.setCallbackSuccess( updateFormulaTextReceived );
+    request.send( url );
+}
+
+function updateFormulaTextReceived( messageElement )
+{
+	byId( "formulaDiv").innerHTML = messageElement;
+	//byId( "formulaIndicatorDiv" ).innerHTML = messageElement;
+	//byId( "categoryFormulaDiv" ).innerHTML = messageElement;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm	2010-03-11 06:27:12 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm	2010-03-25 08:15:35 +0000
@@ -13,7 +13,7 @@
 			</select>
 		</td>
 		<td align="right">		
-			<input type="button" onclick="openAddReportItemForm()" value="$i18n.getString('add')" style="width:150px"/><br>
+			<input type="button" onclick="mode='add'; openAddReportItemForm()" value="$i18n.getString('add')" style="width:150px"/><br>
 			<input type="button" onclick="window.location='listReportExcel.action'" value="$i18n.getString('cancel')" style="width:150px"/><br>
 			<input type="button" onclick="copySelectedReportItemToReport()" value="$i18n.getString('copy_selected_item_to')" style="width:150px"/><br>
 			<input type="button" onclick="copySelectedReportItemToExcelItemGroup()" value="$i18n.getString('copy_selected_item_to_excel_item')" style="width:150px"/><br>
@@ -33,7 +33,7 @@
 			<th>$i18n.getString('column')</th>		
 			<th>$i18n.getString('expression')</th>		
 			<th>$i18n.getString('sheet_no')</th>	
-			<th width="70px">$i18n.getString('operations')</th>		
+			<th width="80px">$i18n.getString('operations')</th>		
 		</tr>
 	</thead>
 	<tbody id="list">	
@@ -48,7 +48,7 @@
 			<td>$encoder.htmlEncode( $reportItem.expression )</td>
 			<td>$encoder.htmlEncode( $reportItem.sheetNo )</td>
 			<td align="center">				
-				<a href="javascript:openUpdateReportItem( '$reportItem.id' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+				<a href="javascript:mode='update'; openUpdateReportItem( '$reportItem.id' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
 				<a href="javascript:translate( 'ReportExcelItem', '$reportItem.id' )" title="$i18n.getString( "translation_translate" )"><img src="../images/i18n.png" alt="$i18n.getString( "translation_translate" )"></a>
 				<a href="javascript:removeItem($reportItem.id, '$reportItem.name','$i18n.getString( 'confirm_delete' )', 'deleteReportExcelItem.action');" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
 			</td>
@@ -153,33 +153,38 @@
 			<th>$i18n.getString( "dataelement" )</th>
 		<tr>
 		<tr valign="top">
-			<td>
-				<textarea id="formula" cols="15" rows="11" style="width:250px; height:180px" wrap="virtual">$encoder.htmlEncode( $formula )</textarea><br>
+			<td height="139">
+				<textarea id="formula" cols="15" rows="5" wrap="virtual" style="width:250px; height:100px" wrap="virtual" onkeyup="updateFormulaText('formula')">$encoder.htmlEncode( $formula )</textarea><br>
 				<a href="#" onclick="insertOperation( 'formula','(' )"><img src="images/left_parent.png" alt="$i18n.getString( 'left_brackets' )"></a>
 				<a href="#" onclick="insertOperation( 'formula',')' )"><img src="images/right_parent.png" alt="$i18n.getString( 'right_brackets' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','*' )"><img src="images/multiply.png" alt="$i18n.getString( 'multiply' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','/' )"><img src="images/divide.png" alt="$i18n.getString( 'divide' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','+' )"><img src="images/plus.png" alt="$i18n.getString( 'plus' )"></a>
-				<a href="#" onclick="insertOperation( 'formula','-' )"><img src="images/minus.png" alt="$i18n.getString( 'minus' )"></a>
-			</td>
-			<td valign="bottom">
+				<a href="#" onclick="insertOperation( 'formula','-' )"><img src="images/minus.png" alt="$i18n.getString( 'minus' )"></a></td>
+			<td rowspan="3" valign="bottom">
 				<input type="button" value="<" onclick="insertDataElementId()"/>
 			</td>
-			<td>	
+			<td rowspan="3">	
 				<select id="dataElementGroup" style="width:500px" onchange="getDataElementsByGroup()"></select>				
 				<select id="availableDataElements" size="11" style="width:500px;" onMouseOut="javascript: hideToolTip();"></select>	
-				<select id="optionCombos" size=4 style="width:500px;"></select>	
+				<select id="optionCombos" size=4 style="width:500px;" ondblclick="insertDataElementId()"></select>	
 			</td>
-		</tr>	
+		</tr>
+		<tr valign="top">
+		  <th>$i18n.getString("description")</th>
+	  </tr>
+		<tr valign="top">
+		  <td class='itemDrescription'><span id='formulaDiv'></span></td>
+	  </tr>
 	</table>	
 	<p>
 	<input type="button" value="$i18n.getString('ok')" onclick="byId('expression').value = byId('formula').value;hideById('normal');" style="width:100px"/>
-	<input type="button" value="$i18n.getString('clean')" onclick="byId('formula').value = ''" style="width:100px"/></p>
+	<input type="button" value="$i18n.getString('clean')" onclick="clearFormula('formula')" style="width:100px"/></p>
 </div>
 <!-- This form use for indicator-->
 
 <div id="indicatorForm" style="position:fixed;display:none;width:800px;z-index:10002;background-color: white;border: medium solid silver;height:300px;padding:20px;">
-	<div id="close" style="position:absolute;top:2px;right:2px;cursor: pointer;color:red;" onclick="$('#indicatorForm').hide();deleteDivEffect();">[x]</div>
+	<div id="close" style="position:absolute;top:2px;right:2px;cursor: pointer;color:red;" onclick="$('#indicatorForm').hide();">[x]</div>
 	<table width="100%">
 		<tr>
 			<th>$i18n.getString( "formula" )</th>
@@ -187,34 +192,41 @@
 			<th>$i18n.getString( "indicator" )</th>
 		<tr>
 		<tr valign="top">
-			<td>
-				<textarea id="formulaIndicator" cols="15" rows="11" style="width:250px; height:180px" wrap="virtual">$encoder.htmlEncode( $formula )</textarea><br>
-				<a href="#" onclick="insertOperation( 'formulaIndicator','(' )"><img src="images/left_parent.png" alt="$i18n.getString( 'left_brackets' )"></a>
+			<td height="103">
+				<textarea id="formulaIndicator" disabled cols="15" rows="5" style="width:250px; height:100px" wrap="virtual">$encoder.htmlEncode( $formula )</textarea><br>
+			<!-- <a href="#" onclick="insertOperation( 'formulaIndicator','(' )"><img src="images/left_parent.png" alt="$i18n.getString( 'left_brackets' )"></a>
 				<a href="#" onclick="insertOperation( 'formulaIndicator',')' )"><img src="images/right_parent.png" alt="$i18n.getString( 'right_brackets' )"></a>
 				<a href="#" onclick="insertOperation( 'formulaIndicator','*' )"><img src="images/multiply.png" alt="$i18n.getString( 'multiply' )"></a>
 				<a href="#" onclick="insertOperation( 'formulaIndicator','/' )"><img src="images/divide.png" alt="$i18n.getString( 'divide' )"></a>
 				<a href="#" onclick="insertOperation( 'formulaIndicator','+' )"><img src="images/plus.png" alt="$i18n.getString( 'plus' )"></a>
 				<a href="#" onclick="insertOperation( 'formulaIndicator','-' )"><img src="images/minus.png" alt="$i18n.getString( 'minus' )"></a>
-			</td>
-			<td valign="bottom">
+			-->		  </td>
+			<td rowspan="3" valign="bottom">
 				<input type="button" value="<" onclick="insertFormulaText('availableIndicators','formulaIndicator')"/>
 			</td>
-			<td>	
-				<select id="indicatorGroups" style="min-width:450px" onchange="filterIndicators()"></select>				
-				<select id="availableIndicators" size="11" style="min-width:450px" ondblclick="insertFormulaText(this.id, 'formulaIndicator');"></select>
-			</td>
+			<td rowspan="3">	
+              <select name="select" id="indicatorGroups" style="min-width:450px" onChange="filterIndicators()">
+              </select>				
+          <select id="availableIndicators" size="11" style="min-width:450px; min-height: 200px" ondblclick="insertFormulaText(this.id, 'formulaIndicator');"></select>		  </td>
 		</tr>
+		<tr valign="top">
+		  <th>$i18n.getString("description")</th>
+	  </tr>
+		<tr valign="top">
+		  <td class='itemDrescription'><span id='formulaIndicatorDiv'></span></td>
+	  </tr>
+
 		
 	</table>	
 	<p>
 	<input type="button" value="$i18n.getString('ok')" onclick="byId('expression').value = byId('formulaIndicator').value;hideById('indicatorForm');" style="width:100px"/>
-	<input type="button" value="$i18n.getString('clean')" onclick="byId('formulaIndicator').value=''" style="width:100px"/></p>
+	<input type="button" value="$i18n.getString('clean')" onclick="clearFormula('formulaIndicator');" style="width:100px"/></p>
 </div>
 
 <!-- This form use for  category report -->
 
 <div id="category" style="position:fixed;display:none;width:800px;z-index:10002;background-color: white;border: medium solid silver;height:300px;padding:20px;">
-	<div id="close" style="position:absolute;top:2px;right:2px;cursor: pointer;color:red;" onclick="$('#category').hide();deleteDivEffect();">[x]</div>
+	<div id="close" style="position:absolute;top:2px;right:2px;cursor: pointer;color:red;" onclick="$('#category').hide();">[x]</div>
 	<table width="100%">
 		<tr>
 			<th>$i18n.getString( "formula" )</th>
@@ -222,28 +234,35 @@
 			<th>$i18n.getString( "dataelement" )</th>
 		<tr>
 		<tr valign="top">
-			<td>
-				<textarea id="categoryFormula" name='categoryFormula' cols="15" rows="11" style="width:250px; height:180px" wrap="virtual">$encoder.htmlEncode( $formula )</textarea><br>
-				<a href="#" onclick="insertOperation( 'formula','(' )"><img src="images/left_parent.png" alt="$i18n.getString( 'left_brackets' )"></a>
+			<td height="139">
+				<textarea id="categoryFormula" disabled name='categoryFormula' cols="15" rows="5" style="width:250px; height:100px" wrap="virtual" onkeypress="updateFormulaText('categoryFormula')">$encoder.htmlEncode( $formula )</textarea><br>
+				<!-- <a href="#" onclick="insertOperation( 'formula','(' )"><img src="images/left_parent.png" alt="$i18n.getString( 'left_brackets' )"></a>
 				<a href="#" onclick="insertOperation( 'formula',')' )"><img src="images/right_parent.png" alt="$i18n.getString( 'right_brackets' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','*' )"><img src="images/multiply.png" alt="$i18n.getString( 'multiply' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','/' )"><img src="images/divide.png" alt="$i18n.getString( 'divide' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','+' )"><img src="images/plus.png" alt="$i18n.getString( 'plus' )"></a>
 				<a href="#" onclick="insertOperation( 'formula','-' )"><img src="images/minus.png" alt="$i18n.getString( 'minus' )"></a>
-			</td>
-			<td valign="bottom">
-				<input type="button" value="<" onclick="insertDataElementId_()"/>
-			</td>
-			<td>	
+			--> </td>
+			<td rowspan="3" valign="bottom">
+				<input type="button" value="<" onclick="insertDataElementId_();"/>
+			</td>
+			<td rowspan="3">	
 				<select id="dataElementGroup_" style="min-width:500px" onchange="getDataElementGroupOrder()"></select>				
-				<select id="availableDataElements_" size="11" style="min-width:500px"></select>	
-				<select id="optionCombos_" size=4 style="min-width:500px"></select>	
+				<select id="availableDataElements_" size="11" style="min-width:500px" onMouseOut="javascript: hideToolTip();"></select>	
+				<select id="optionCombos_" size=4 style="min-width:500px" ondblclick="insertDataElementId_();"></select>	
 			</td>
-		</tr>	
+		</tr>
+		<tr valign="top">
+		  <th>$i18n.getString("description")</th>
+	  </tr>
+		<tr valign="top">
+		  <td class='itemDrescription'><span id='categoryFormulaDiv'></span></td>
+	  </tr>
+		
 	</table>	
 	<p>
 	<input type="button" value="$i18n.getString('ok')" onclick="byId('expression').value = byId('categoryFormula').value ;hideById('category');" style="width:100px"/>
-	<input type="button" value="$i18n.getString('clean')" onclick="byId('categoryFormula').value = ''" style="width:100px"/></p>
+	<input type="button" value="$i18n.getString('clean')" onclick="clearFormula('categoryFormula');" style="width:100px"/></p>
 </div>
 
 <span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10004" onclick="hideById(this.id);"></span>
@@ -254,6 +273,7 @@
 	var reportId = $!reportExcel.id;
 	var sheetNo = "$sheetNo";
 	var reportItemId;
+	var mode = 'add';
 
 	var dataElementGroups = new Object();
 	#foreach( $dataElementGroup in $dataElementGroups )

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseReportItem.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseReportItem.vm	2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseReportItem.vm	2010-03-25 08:15:35 +0000
@@ -8,4 +8,5 @@
 	<column>$reportItem.column</column>
 	<expression>$encoder.xmlEncode( $reportItem.expression )</expression>
 	<sheetNo>$encoder.xmlEncode( $reportItem.sheetNo )</sheetNo>
+	<textualFormula>$encoder.xmlEncode( $textualFormula )</textualFormula>
 </reportItem>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/style.css'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/style.css	2009-12-16 03:37:57 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/style.css	2010-03-25 08:15:35 +0000
@@ -9,10 +9,14 @@
 }
 
 #tooltip {
-    color:#000; font-size:11px; line-height:1.2;
+    color:#00000; font-size:11px; line-height:1.2;
     background-color:#FFFFCC; border:1px solid #667295; 
     width:210px; padding:4px;
 	z-index: 100000;
 	display: none;
 	position:absolute;
+}
+
+.itemDrescription {
+    border:1px solid #667295; 
 }
\ No newline at end of file