dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04545
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1524: add missing file in excel reporting
------------------------------------------------------------
revno: 1524
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Tue 2010-03-02 12:43:25 +0700
message:
add missing file in excel reporting
added:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java
dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.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-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-01-22 05:09:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-03-02 05:43:25 +0000
@@ -43,6 +43,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.customvalue.CustomValue;
import org.hisp.dhis.customvalue.CustomValueService;
import org.hisp.dhis.dataelement.CalculatedDataElement;
@@ -68,8 +70,12 @@
public class DefaultDataEntryScreenManager
implements DataEntryScreenManager
{
+ private static final Log log = LogFactory.getLog( DefaultDataEntryScreenManager.class );
+
private static final String DEFAULT_FORM = "defaultform";
+
private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform";
+
private static final String EMPTY = "";
// -------------------------------------------------------------------------
@@ -98,7 +104,7 @@
}
private DataElementCategoryService categoryService;
-
+
public void setCategoryService( DataElementCategoryService categoryService )
{
this.categoryService = categoryService;
@@ -144,13 +150,13 @@
return true;
}
}
-
+
return false;
}
public String getScreenType( DataSet dataSet )
{
- return hasMultiDimensionalDataElement( dataSet ) ? MULTI_DIMENSIONAL_FORM : DEFAULT_FORM;
+ return hasMultiDimensionalDataElement( dataSet ) ? MULTI_DIMENSIONAL_FORM : DEFAULT_FORM;
}
public Collection<Integer> getAllCalculatedDataElements( DataSet dataSet )
@@ -187,7 +193,7 @@
if ( !cde.isSaved() )
{
calculatedDataElementMap.put( cde, dataElementService.getDataElementFactors( cde ) );
- }
+ }
}
}
@@ -239,11 +245,12 @@
factor = factorMap.get( operandId );
String dataElementIdString = operandId.substring( 0, operandId.indexOf( SEPARATOR ) );
- String optionComboIdString = operandId.substring( operandId.indexOf( SEPARATOR ) + 1, operandId.length() );
+ String optionComboIdString = operandId.substring( operandId.indexOf( SEPARATOR ) + 1, operandId
+ .length() );
DataElement element = dataElementService.getDataElement( Integer.parseInt( dataElementIdString ) );
- DataElementCategoryOptionCombo optionCombo = categoryService
- .getDataElementCategoryOptionCombo( Integer.parseInt( optionComboIdString ) );
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( Integer
+ .parseInt( optionComboIdString ) );
dataValue = dataValueService.getDataValue( organisationUnit, element, period, optionCombo );
@@ -303,12 +310,11 @@
// ---------------------------------------------------------------------
Pattern identifierPattern = Pattern.compile( "value\\[(.*)\\].value:value\\[(.*)\\].value" );
-
+
// ---------------------------------------------------------------------
// Iterate through all matching data element fields
- // ---------------------------------------------------------------------
+ // ---------------------------------------------------------------------
-
while ( dataElementMatcher.find() )
{
// -----------------------------------------------------------------
@@ -329,7 +335,14 @@
int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) );
DataElement dataElement = dataElementService.getDataElement( dataElementId );
-
+
+ if ( dataElement == null )
+ {
+ log.error( "Data Element exits in data entry form but not in this Data Set: " + dataElementId );
+
+ return "This data element not exits in data set: " + dataElementId;
+ }
+
// -------------------------------------------------------------
// Find type of data element
// -------------------------------------------------------------
@@ -365,8 +378,9 @@
// -------------------------------------------------------------
boolean customValueExists = customValuesExists( customValues, dataElementId, optionComboId );
-
- if ( dataElement.getType().equals( VALUE_TYPE_BOOL ) || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists ) )
+
+ if ( dataElement.getType().equals( VALUE_TYPE_BOOL )
+ || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists) )
{
dataElementCode = dataElementCode.replace( "input", "select" );
dataElementCode = dataElementCode.replaceAll( "value=\".*?\"", "" );
@@ -407,7 +421,8 @@
dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
// -------------------------------------------------------------
- // Insert title information - Data element id, name, type, min, max
+ // Insert title information - Data element id, name, type, min,
+ // max
// -------------------------------------------------------------
if ( dataElementCode.contains( "title=\"\"" ) )
@@ -581,7 +596,7 @@
// ---------------------------------------------------------------------
Map<Integer, DataElement> dataElementMap = getDataElementMap( dataSet );
-
+
while ( dataElementMatcher.find() )
{
// -----------------------------------------------------------------
@@ -601,13 +616,15 @@
int dataElementId = Integer.parseInt( identifierMatcher.group( 1 ) );
int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) );
- DataElement dataElement = dataElementMap.get( dataElementId ); //dataElementService.getDataElement( dataElementId );
-
- if( dataElement==null )
+ DataElement dataElement = dataElementMap.get( dataElementId ); // dataElementService.getDataElement(
+ // dataElementId
+ // );
+
+ if ( dataElement == null )
{
- throw new RuntimeException("Data Element Id: " + dataElementId + " not found");
+ throw new RuntimeException( "Data Element Id: " + dataElementId + " not found" );
}
-
+
// -------------------------------------------------------------
// Find value type of data element
// -------------------------------------------------------------
@@ -643,8 +660,9 @@
// -------------------------------------------------------------
boolean customValueExists = customValuesExists( customValues, dataElementId, optionComboId );
-
- if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists ) )
+
+ if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL )
+ || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists) )
{
dataElementCode = dataElementCode.replace( "input", "select" );
dataElementCode = dataElementCode.replaceAll( "value=\".*?\"", "" );
@@ -683,7 +701,8 @@
dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
// -------------------------------------------------------------
- // Insert title information - Data element id, name, type, min, max
+ // Insert title information - Data element id, name, type, min,
+ // max
// -------------------------------------------------------------
if ( dataElementCode.contains( "title=\"\"" ) )
@@ -802,7 +821,7 @@
dataElementMatcher.appendReplacement( sb, appendCode );
}
}
-
+
dataElementMatcher.appendTail( sb );
return sb.toString();
@@ -816,19 +835,21 @@
* Tests whether the given Collection of CustomValues contains a CustomValue
* with the given data element identifier and category option combo id.
*/
- private boolean customValuesExists( Collection<CustomValue> customValues, int dataElementId, int categoryOptionComboId )
+ private boolean customValuesExists( Collection<CustomValue> customValues, int dataElementId,
+ int categoryOptionComboId )
{
for ( CustomValue customValue : customValues )
{
- if ( dataElementId == customValue.getDataElement().getId() && categoryOptionComboId == customValue.getOptionCombo().getId() )
+ if ( dataElementId == customValue.getDataElement().getId()
+ && categoryOptionComboId == customValue.getOptionCombo().getId() )
{
return true;
}
}
-
+
return false;
}
-
+
/**
* Returns the value of the DataValue in the Collection of DataValues with
* the given data element identifier and category option combo id.
@@ -837,7 +858,8 @@
{
for ( DataValue dataValue : dataValues )
{
- if ( dataValue.getDataElement().getId() == dataElementId && dataValue.getOptionCombo().getId() == categoryOptionComboId )
+ if ( dataValue.getDataElement().getId() == dataElementId
+ && dataValue.getOptionCombo().getId() == categoryOptionComboId )
{
return dataValue.getValue();
}
@@ -845,7 +867,7 @@
return EMPTY;
}
-
+
/**
* Returns the value of the DataValue in the Collection of DataValues with
* the given data element identifier.
@@ -859,10 +881,10 @@
return dataValue.getValue();
}
}
-
+
return EMPTY;
}
-
+
/**
* Returns a Map of all DataElements in the given DataSet where the key is
* the DataElement identifier and the value is the DataElement.
@@ -870,12 +892,12 @@
private Map<Integer, DataElement> getDataElementMap( DataSet dataSet )
{
Map<Integer, DataElement> map = new HashMap<Integer, DataElement>();
-
+
for ( DataElement element : dataSet.getDataElements() )
{
map.put( element.getId(), element );
}
-
+
return map;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml 2010-02-25 09:05:59 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml 2010-03-02 05:43:25 +0000
@@ -10,7 +10,7 @@
</parent>
<artifactId>dhis-web-excel-reporting</artifactId>
- <packaging>jar</packaging>
+ <packaging>war</packaging>
<name>DHIS Web Excel Reporting</name>
<build>
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg'
Binary files dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg 2010-03-02 05:43:25 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm 2010-02-25 02:41:20 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm 2010-03-02 05:43:25 +0000
@@ -37,8 +37,8 @@
<a href="openUpdateOrgnisationUnitGroupListingReport.action?id=$report.id" title="$i18n.getString( 'organisation_unit_group' )"><img src="images/group_1.jpg"/></a>
<a href="organisationUnitAtLevels.action?id=$report.id" title="$i18n.getString( 'set_organisationunit_group_level' )"><img src="images/organisationunitlevel.png" alt="$i18n.getString( 'set_organisationunit_group_level' )"/></a>
#end
- #if($report.isCategory())
- <a href="listDataElementGroupOrder.action?id=$report.id" title="$i18n.getString( 'dataelement_groups' )"><img src="images/group.jpg"/></a>
+ #if($report.isCategory())
+ <a href="listDataElementGroupOrder.action?id=$report.id" title="$i18n.getString( 'dataelement_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'dataelement_groups' )"/></a>
#end
#if($report.isPeriodColumnListing())