dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03479
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1166: Fixed validation error in add/update DataElement.
------------------------------------------------------------
revno: 1166
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-12-04 15:09:09 +0100
message:
Fixed validation error in add/update DataElement.
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2009-10-29 10:39:30 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2009-12-04 14:09:09 +0000
@@ -29,6 +29,7 @@
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.datadictionary.DataDictionary;
+import org.hisp.dhis.dataelement.CalculatedDataElement;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -119,6 +120,15 @@
{
return true;
}
+
+ public void deleteCalculatedDataElement( CalculatedDataElement dataElement )
+ {
+ }
+
+ public boolean allowDeleteCalculatedDataElement( CalculatedDataElement dataElement )
+ {
+ return true;
+ }
public void deleteDataElementGroup( DataElementGroup dataElementGroup )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2009-12-04 07:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2009-12-04 14:09:09 +0000
@@ -119,11 +119,11 @@
this.domainType = domainType;
}
- private String type;
+ private String valueType;
- public void setType( String type )
+ public void setValueType( String valueType )
{
- this.type = type;
+ this.valueType = valueType;
}
private String aggregationOperator;
@@ -287,7 +287,7 @@
dataElement.setDescription( description );
dataElement.setActive( true );
dataElement.setDomainType( domainType );
- dataElement.setType( type );
+ dataElement.setType( valueType );
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setCategoryCombo( categoryCombo );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2009-12-04 07:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2009-12-04 14:09:09 +0000
@@ -130,11 +130,11 @@
this.domainType = domainType;
}
- private String type;
+ private String valueType;
- public void setType( String type )
+ public void setValueType( String valueType )
{
- this.type = type;
+ this.valueType = valueType;
}
private String aggregationOperator;
@@ -233,7 +233,7 @@
dataElement.setDescription( description );
dataElement.setActive( active );
dataElement.setDomainType( domainType );
- dataElement.setType( type );
+ dataElement.setType( valueType );
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setCategoryCombo( categoryCombo );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java 2009-12-04 07:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ValidateDataElementAction.java 2009-12-04 14:09:09 +0000
@@ -110,11 +110,11 @@
this.code = code;
}
- private String type;
+ private String valueType;
- public void setType( String type )
+ public void setValueType( String valueType )
{
- this.type = type;
+ this.valueType = valueType;
}
// -------------------------------------------------------------------------
@@ -254,7 +254,7 @@
if ( calculated != null && calculated.equals( "on" ) )
{
- if ( type != null && (!type.equals( DataElement.VALUE_TYPE_INT )) )
+ if ( valueType != null && (!valueType.equals( DataElement.VALUE_TYPE_INT )) )
{
message = i18n.getString( "cde_must_be_number" );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2009-11-03 13:11:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2009-12-04 14:09:09 +0000
@@ -45,9 +45,6 @@
<property name="dataElementService">
<ref bean="org.hisp.dhis.dataelement.DataElementService" />
</property>
- <property name="dataElementCategoryService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
- </property>
</bean>
<bean id="org.hisp.dhis.dd.action.dataelement.ShowAddDataElementForm"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2009-12-04 07:10:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2009-12-04 14:09:09 +0000
@@ -39,7 +39,7 @@
<tr>
<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td>
- <select id="type" name="type" style="min-width:20em">
+ <select id="valueType" name="valueType" style="min-width:20em">
<option value="int" selected="selected">$i18n.getString( "number" )</option>
<option value="string">$i18n.getString( "text" )</option>
<option value="bool">$i18n.getString( "yes_no" )</option>
@@ -225,7 +225,7 @@
</div>
-<p><input type="button" value="$i18n.getString( "add" )" style="width:10em" onclick="submitAddDataElement()"><input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='dataElement.action'" style="width:10em"></p>
+<p><input type="submit" value="$i18n.getString( "add" )" style="width:10em"><input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='dataElement.action'" style="width:10em"></p>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2009-11-07 14:09:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2009-12-04 14:09:09 +0000
@@ -169,7 +169,7 @@
'&shortName=' + getFieldValue( 'shortName' ) +
'&alternativeName=' + getFieldValue( 'alternativeName' ) +
'&code=' + getFieldValue( 'code' ) +
- '&type=' + getSelectValue( 'type' ) +
+ '&valueType=' + getSelectValue( 'valueType' ) +
'&calculated=' + getCheckboxValue( 'calculated' ) +
'&selectedCategoryComboId=' + getSelectValue( 'selectedCategoryComboId' ) +
makeValueString('dataElementIds', getInputValuesByParentId('selectedDataElements', 'dataElementIds'))
@@ -204,6 +204,9 @@
if ( type == 'success' )
{
+ selectAllById( "aggregationLevels" );
+ selectAllById( "dataElementGroupSets" );
+
var form = document.getElementById( 'addDataElementForm' );
form.submit();
}
@@ -273,7 +276,7 @@
{
var checkbox = document.getElementById( checkboxId );
- return ( checkbox.checked ? checkbox.value : null );
+ return ( checkbox != null && checkbox.checked ? checkbox.value : null );
}
/**
@@ -339,6 +342,9 @@
if ( type == 'success' )
{
+ selectAllById( "aggregationLevels" );
+ selectAllById( "dataElementGroupSets" );
+
var form = document.getElementById( 'updateDataElementForm' );
form.submit();
}
@@ -504,19 +510,3 @@
return;
}
-
-function submitAddDataElement()
-{
- selectAllById( "aggregationLevels" );
- selectAllById( "dataElementGroupSets" );
-
- document.getElementById( "addDataElementForm" ).submit();
-}
-
-function submitUpdateDataElement()
-{
- selectAllById( "aggregationLevels" );
- selectAllById( "dataElementGroupSets" );
-
- document.getElementById( "updateDataElementForm" ).submit();
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js 2009-12-04 14:09:09 +0000
@@ -2,9 +2,13 @@
window.onload = function ()
{
var container = byId('selectedDataElements');
- var buttons = container.getElementsByTagName('button');
- for ( var i = 0, button; button = buttons[i]; i++ )
+
+ if ( container != null )
{
- button.onclick = removeCDEDataElement;
+ var buttons = container.getElementsByTagName('button');
+ for ( var i = 0, button; button = buttons[i]; i++ )
+ {
+ button.onclick = removeCDEDataElement;
+ }
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2009-11-07 21:25:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2009-12-04 14:09:09 +0000
@@ -248,7 +248,7 @@
</div>
-<p><input type="button" value="$i18n.getString( "save" )" style="width:10em" onclick="submitUpdateDataElement()"><input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='dataElement.action'" style="width:10em"></p>
+<p><input type="submit" value="$i18n.getString( "save" )" style="width:10em"><input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='dataElement.action'" style="width:10em"></p>
</form>