=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetDataElementCategoryOptionCombosAction.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetDataElementCategoryOptionCombosAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/GetDataElementCategoryOptionCombosAction.java 2010-09-23 03:14:24 +0000 @@ -0,0 +1,91 @@ +package org.hisp.dhis.reportexcel.item.action; + +/* + * Copyright (c) 2004-2010, 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 java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.reportexcel.DataElementGroupOrder; +import org.hisp.dhis.reportexcel.ReportExcelCategory; +import org.hisp.dhis.reportexcel.ReportExcelService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Tran Thanh Tri + * @version $Id$ + */ +public class GetDataElementCategoryOptionCombosAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private ReportExcelService reportService; + + public void setReportService( ReportExcelService reportService ) + { + this.reportService = reportService; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + public List dataElementCategoryOptionCombos; + + public List getDataElementCategoryOptionCombos() + { + return dataElementCategoryOptionCombos; + } + + @Override + public String execute() + throws Exception + { + ReportExcelCategory report = (ReportExcelCategory) reportService.getReportExcel( id ); + + DataElementGroupOrder dataElementGroupOrder = report.getDataElementOrders().iterator().next(); + + DataElement de = dataElementGroupOrder.getDataElements().iterator().next(); + + dataElementCategoryOptionCombos = new ArrayList( de.getCategoryCombo() + .getOptionCombos() ); + + 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-09-22 07:30:22 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-09-23 03:14:24 +0000 @@ -350,6 +350,13 @@ scope="prototype"> + + + + - + /dhis-web-excel-reporting/report/ajax/responseReportGroups.vm @@ -222,13 +222,7 @@ listDataElementGroupOrder.action?id=${id} - - - - /dhis-web-excel-reporting/responseDataElementOrder.vm - - + /main.vm @@ -401,9 +395,13 @@ listReportExcelItemAction.action?reportId=${reportId} F_EXCEL_REPORT_ADMINISTRATION + + + + /dhis-web-excel-reporting/report/ajax/jsonDataElementCategoryOptionCombos.vm - === added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/ajax/jsonDataElementCategoryOptionCombos.vm' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/ajax/jsonDataElementCategoryOptionCombos.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/ajax/jsonDataElementCategoryOptionCombos.vm 2010-09-23 03:14:24 +0000 @@ -0,0 +1,9 @@ +#set( $size = $dataElementCategoryOptionCombos.size() ) +{ "dataElementCategoryOptionCombos": [ +#foreach( $de in $dataElementCategoryOptionCombos ) + { + "id": $!{de.id}, + "name": "$!encoder.jsEncode( ${de.name} )" + }#if( $velocityCount < $size ),#end +#end +] } === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm 2010-09-08 10:40:26 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm 2010-09-23 03:14:24 +0000 @@ -5,8 +5,9 @@ deExpressionValidator = validation( 'dataelement-form', function(){ updateDeExpression(); }); - + #if(!$reportExcel.isCategory()) remoteValidate( jQuery( "#dataelement textarea[id=formula]"), '../dhis-web-commons-ajax-json/getExpressionText.action' ); + #end }); @@ -30,11 +31,14 @@ $i18n.getString( 'plus' ) $i18n.getString( 'minus' ) - + + #if(!$reportExcel.isCategory()) + #end + #if(!$reportExcel.isCategory()) $i18n.getString( "description" ) @@ -43,6 +47,7 @@
+ #end

@@ -65,11 +70,18 @@ function deExpressionBuilderForm() { + #if($reportExcel.isCategory()) + getDataElementCategoryOptionCombos(); + #else loadDataElementGroups("#dataelement select[id=groupSelect]") ; + #end setFieldValue( 'dataelement textarea[id=formula]', getFieldValue('expression') ); - - showPopupWindowById( 'dataelement', 800, 400 ); + #if(!$reportExcel.isCategory()) + showPopupWindowById( 'dataelement', 800, 400 ); + #else + showPopupWindowById( 'dataelement', 800, 320 ); + #end } function getDataElements( id, target ) @@ -86,5 +98,19 @@ loadCategoryOptionComboByDE( id, targetId ); } + function getDataElementCategoryOptionCombos() + { + jQuery.postJSON('getDataElementCategoryOptionCombos.action' + , {id:$reportExcel.id} + , function( json ){ + var select = jQuery("#dataelement select[id=elementSelect]"); + select.empty(); + jQuery.each( json.dataElementCategoryOptionCombos, function(i, item ){ + select.append( "" ); + }); + + }); + } + === removed file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseDataElementOrder.vm' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseDataElementOrder.vm 2009-09-17 07:12:56 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseDataElementOrder.vm 1970-01-01 00:00:00 +0000 @@ -1,13 +0,0 @@ - - - $dataElementGroupOrder.name - $dataElementGroupOrder.code - - #foreach( $dataElement in $dataElementGroupOrder.dataElements ) - - $dataElement.id - $encoder.xmlEncode( $dataElement.name ) - - #end - - \ No newline at end of file