dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01831
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 582: Fixed #423891
------------------------------------------------------------
revno: 582
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Sat 2009-09-05 08:36:59 +0200
message:
Fixed #423891
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/pom.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetCustomValuesAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetSelectedDataElementsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SelectDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editCustomValues.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-maintenance/dhis-web-maintenance-dataset/pom.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/pom.xml 2009-05-25 18:28:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/pom.xml 2009-09-05 06:36:59 +0000
@@ -35,6 +35,10 @@
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
+ <artifactId>dhis-support-system</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hisp.dhis</groupId>
<artifactId>dhis-service-organisationunit</artifactId>
</dependency>
<dependency>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetCustomValuesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetCustomValuesAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetCustomValuesAction.java 2009-09-05 06:36:59 +0000
@@ -192,11 +192,6 @@
customValue.setCustomValue( value );
customValueService.addCustomValue( customValue );
-
- // somehow adding occurs after return SUCCESS. Need to add manually
- // new CustomValue
- customValueIds.add( String.valueOf( customValue.getId() ) );
- customValueNames.add( customValue.getCustomValue() );
}
if ( operation.equalsIgnoreCase( "delete" ) )
@@ -204,31 +199,59 @@
customValue = customValueService.getCustomValue( customValueId );
customValueService.deleteCustomValue( customValue );
}
+
List<CustomValue> customValues = null;
-
+
if ( operation.equalsIgnoreCase( "find" ) )
{
customValues = new ArrayList<CustomValue>( customValueService.findCustomValues( value ) );
- }else
+ }
+ else
{
- customValues = new ArrayList<CustomValue>( customValueService.getCustomValues( dataSet,
- dataElement, dataElementCategoryOptionCombo ) );
+ customValues = new ArrayList<CustomValue>( customValueService.getCustomValues( dataSet, dataElement,
+ dataElementCategoryOptionCombo ) );
}
-
+
Iterator<CustomValue> customValueIterator = customValues.iterator();
- while ( customValueIterator.hasNext() )
- {
- CustomValue customVal = customValueIterator.next();
+ if ( operation.equalsIgnoreCase( "find" ) )
+ {
+ while ( customValueIterator.hasNext() )
+ {
+ CustomValue customVal = customValueIterator.next();
+
+ if ( !customValueNames.contains( customVal.getCustomValue() ) )
+ {
+ customValueIds.add( String.valueOf( customVal.getId() ) );
+ customValueNames.add( customVal.getCustomValue() );
+ }
+ }
+ }
+ else
+ {
+ while ( customValueIterator.hasNext() )
+ {
+ CustomValue customVal = customValueIterator.next();
- customValueIds.add( String.valueOf( customVal.getId() ) );
- customValueNames.add( customVal.getCustomValue() );
+ customValueIds.add( String.valueOf( customVal.getId() ) );
+ customValueNames.add( customVal.getCustomValue() );
+ }
}
if ( operation.equalsIgnoreCase( "delete" ) )
{
customValueIds.remove( String.valueOf( customValue.getId() ) );
customValueNames.remove( customValue.getCustomValue() );
}
+
+ if ( operation.equalsIgnoreCase( "add" ) )
+ {
+ if ( !customValueNames.contains( customValue.getCustomValue() ) )
+ {
+ customValueIds.remove( String.valueOf( customValue.getId() ) );
+ customValueNames.remove( customValue.getCustomValue() );
+ }
+ }
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetSelectedDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetSelectedDataElementsAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/GetSelectedDataElementsAction.java 2009-09-05 06:36:59 +0000
@@ -100,8 +100,6 @@
dataElementList = new ArrayList<DataElement>( dataSet.getDataElements() );
- Collections.sort( dataElementList, dataElementComparator );
-
Collections.sort( dataElementList, dataElementComparator );
displayPropertyHandler.handle( dataElementList );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SelectDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SelectDataElementAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SelectDataElementAction.java 2009-09-05 06:36:59 +0000
@@ -32,10 +32,12 @@
import java.util.Comparator;
import java.util.List;
+import org.apache.commons.collections.CollectionUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.system.filter.StringTypeDataElementPredicate;
import com.opensymphony.xwork2.Action;
@@ -82,6 +84,13 @@
this.dataSetId = dataSetId;
}
+ private boolean typeTextOnly;
+
+ public void setTypeTextOnly( boolean typeTextOnly )
+ {
+ this.typeTextOnly = typeTextOnly;
+ }
+
private List<DataElement> dataElements;
public List<DataElement> getDataElements()
@@ -116,6 +125,11 @@
{
dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
+ if ( typeTextOnly )
+ {
+ CollectionUtils.filter( dataElements, new StringTypeDataElementPredicate() );
+ }
+
Collections.sort( dataElements, dataElementComparator );
displayPropertyHandler.handle( dataElements );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2009-05-20 14:35:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2009-09-05 06:36:59 +0000
@@ -50,7 +50,6 @@
dataentryform_duplicate_names = A data entry form with this name already exists
dataentryform_confirm_delete = Are you sure you want to delete this data entry form?
unable_delete = Unable to delete data entry form
-selectdataelement = Select data element
selectdataelement_insert = Insert
dataelement_count_mismatch = Some of the data elements in the dataset are missing from the custom data entry form, do you want to proceed anyway?
short_name = Short name
@@ -68,7 +67,6 @@
available_sections = Available sections
add_dataset_section = Add dataset section
update_dataset_section = Update dataset section
-select_optioncombo = Select category option combos
edit_section = Edit section
filter = Filter
filter_by_name = Filter by name
@@ -86,10 +84,30 @@
select_all_in_group = Select all in group
unselect_all_in_group = Unselect all in group
unselect_all = Unselect all
-select_customvalue = Select Custom Value
-add_new_custom_value = Add New Custom Value
-delete_custom_value = Delete Custom Value
+add_new_custom_value = Add New
+delete_custom_value = Delete
done_custom_value = Done
+cv_must_be_added = Custom Value Text Must Be Added
+existing_custom_values_for_this_data_element_are_listed = Existing Castom Values for Selected Data Element are Listed
+default_category_selected = Default Category Option is Selected
+duplicates_are_not_allowed = Duplicates are Not Allowed
+first_select_de_and_cc = First Select Data Element and Category Option
+de_must_be_selected_first = Data Element Must be Selected First
+cc_must_be_selected_first = Category Option Must be Selected First
+cv_must_be_selected_first = Custom Value Must be Selected First
+cv_removed = Custom Value Removed
+select_optioncombo = Available Category Options
+available_customvalue = Suggested Custom Values
+manage_custom_values = Manage Custom Value Lists
edit_custom_values = Edit custom values
-manage_custom_values = Manage Custom Value Lists
-available_customvalue = Suggested Custom Values
\ No newline at end of file
+select_customvalue = Selected Custom Values
+selectdataelement = Available Data Elements
+
+help.datasetcustomvalue = Custom Value Help
+help.datasetcustomvalue.content = <b>Purpose</b><br>Custom Values are predefied data entry values. Custom Values appear in the form of a drop down box, where you can select a value from the list for the current Data Element.<p><b>How to manage Custom Values</b><br>You will see four selection areas and number of buttons to manage Custom Values. First box <b>"Available Data Elements"</b> lists all Data Elements for selected Data Set. Second box <b>"Available Category Options"</b> will list Available Category Options upon selection of Data Element from first box. If Data Element has only <b>default</b> Category Option, it will be automatically selected and any Custom Value selected for it will be listed in box four - <b>"Selected Custom Values"</b>. Box three - <b>Suggested Custom Values</b> will list possible values from existing Custom Values as user types new Custom Value text. Adding/Deleting are explained in their respective help content next to control. All actions will produce message, messages are shown at the end of form and their background colour will change depending on failure or success of action. System prevents errors by providing useful messages.
+help.dscv_done_button = <b>Command Done</b>
+help.dscv_done_button.content = <b>"Done"</b> button silently leaves Custom Value Management screen and displays default Data Set page.
+help.dscv_addnew_button = <b>"Add New Command"</b>
+help.dscv_addnew_button.content = <b>"Add New"</b> button adds new Custom Value to the list of Selected Custom Values (box four). While typing new Custom Value text, box three provides possible values for selection. If user finds one of suggested values suitable, he can click on it in box three, value will be copied to new value entry point, clicking Add will save new value. Follow instructions in message pane at the bottom of form.
+help.dscv_delete_button = <b>Delete Command</b>
+help.dscv_delete_button.content = <b>"Delete"</b> button deletes selected Custom Value from particular Data Element. Follow instructions in message pane at the bottom of form
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm 2009-07-07 14:54:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm 2009-09-05 06:36:59 +0000
@@ -40,7 +40,7 @@
<a href="editDataSetForm.action?dataSetId=$dataSet.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
</td>
<td style="text-align:center"#alternate( $mark )>
- <a href="editDataSetFormCustomValues.action?dataSetId=$dataSet.id" title="$i18n.getString( "edit_custom_values" )"><img src="../images/custom_value.png" alt="$i18n.getString( "edit_custom_values" )"></a>
+ <a href="editDataSetFormCustomValues.action?dataSetId=$dataSet.id&typeTextOnly=true" title="$i18n.getString( "edit_custom_values" )"><img src="../images/custom_value.png" alt="$i18n.getString( "edit_custom_values" )"></a>
</td>
<td style="text-align:center"#alternate( $mark )>
<a href="$i18n.getString( "translation_translate" )" title="$i18n.getString( "translation_translate" )" onclick="this.href='javascript:location.href= \'../dhis-web-commons/i18n.action?className=DataSet&objectId=$dataSet.id&returnUrl=\' + location.href'"><img src="../images/i18n.png" alt="$i18n.getString( "translation_translate" )"></a>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editCustomValues.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editCustomValues.vm 2009-06-02 14:50:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editCustomValues.vm 2009-09-05 06:36:59 +0000
@@ -519,9 +519,11 @@
</script>
<script>
+
// -----------------------------------------------------------------------------
// Find Selected DataElement Count in the DataEntryForm
// -----------------------------------------------------------------------------
+
function findDataElementCount()
{
var request = new Request();
@@ -798,88 +800,81 @@
function addNew()
{
-
-if (document.getElementById( 'optionComboSelector' ).selectedIndex==-1 || document.getElementById( 'dataElementSelector' )==-1)
-{
-alert("\nYou must make a selection from the DataElement and ComboOptions panels first.");
-}
- else
- if(document.getElementById( 'newCustomValue' ).value=='')
- {
- alert("\nCustom Value Must be added and should be unique" );
- }
- else
- {
-
- var isDuplicate='false';
- var selectobject=document.getElementById( 'customValueSelector' );
- var newValue = document.getElementById( 'newCustomValue' ).value;
+ if (document.getElementById( 'optionComboSelector' ).selectedIndex==-1 || document.getElementById( 'dataElementSelector' )==-1)
+ {
+ alert("\nYou must make a selection from the DataElement and ComboOptions panels first.");
+ }
+ else if(document.getElementById( 'newCustomValue' ).value=='')
+ {
+ alert("\nCustom Value Must be added and should be unique" );
+ }
+ else
+ {
+ var isDuplicate='false';
+ var selectobject=document.getElementById( 'customValueSelector' );
+ var newValue = document.getElementById( 'newCustomValue' ).value;
for (var i=0; i<selectobject.length; i++)
{
- if(selectobject.options[i].text==newValue)
- {
- isDuplicate='true';
- }
+ if(selectobject.options[i].text==newValue)
+ {
+ isDuplicate='true';
+ }
}
if(isDuplicate=='true')
{
- alert("\nDude, Duplicates are not allowed");
+ alert("\nDude, Duplicates are not allowed");
}
else
{
getCustomValues('add');
}
-
}
}
function remove()
- {
-
- if (document.getElementById( 'dataElementSelector' )==-1)
- {
+{
+ if (document.getElementById( 'dataElementSelector' )==-1)
+ {
alert("\nYou must make a selection from the DataElement panel first.");
- }
- else
- if (document.getElementById( 'optionComboSelector' ).selectedIndex==-1)
- {
+ }
+ else if (document.getElementById( 'optionComboSelector' ).selectedIndex==-1)
+ {
alert("\nYou must make a selection from the ComboOptions panel first.");
- }
- else
- if (document.getElementById( 'customValueSelector' ).selectedIndex==-1)
- {
+ }
+ else if (document.getElementById( 'customValueSelector' ).selectedIndex==-1)
+ {
alert("\nYou must make a selection from the CustomValues panel first.");
- }
- else
- {
- getCustomValues('delete');
- }
+ }
+ else
+ {
+ getCustomValues('delete');
+ }
}
function findSimilar()
- {
-
- if(document.getElementById( 'newCustomValue' ).value.length>1)
- {
- getSuggestedCustomValues('find');
- }
- else
- {
- // Clear the suggestedcustomValue list
- var availableCustomValueList = document.getElementById( 'availableCustomValue' );
- availableCustomValueList.options.length = 0;
- }
- }
+{
+ if(document.getElementById( 'newCustomValue' ).value.length>1)
+ {
+ getSuggestedCustomValues('find');
+ }
+ else
+ {
+ // Clear the suggestedcustomValue list
+ var availableCustomValueList = document.getElementById( 'availableCustomValue' );
+ availableCustomValueList.options.length = 0;
+ }
+}
function setSuggestedCustomValue()
- {
- var availableCustomValue = document.getElementById( 'availableCustomValue' );
- var availableCustomValueSelected = availableCustomValue.options[availableCustomValue.selectedIndex].value;
+{
+ var availableCustomValue = document.getElementById( 'availableCustomValue' );
+ var availableCustomValueSelected = availableCustomValue.options[availableCustomValue.selectedIndex].value;
- document.getElementById( 'newCustomValue' ).value = availableCustomValueSelected;
- }
+ document.getElementById( 'newCustomValue' ).value = availableCustomValueSelected;
+}
+
</script>
<style type="text/css">
@@ -955,16 +950,15 @@
<tbody>
<tr>
<td>
- <button type="button" onclick="remove()">$i18n.getString( "delete_custom_value" )</button>
- </td>
- <td>
- <input type="button"
- onclick="window.location.href='index.action'" value="$i18n.getString( "done_custom_value" )" style="width:12em">
+ <input type="button" onclick="remove()" value="$i18n.getString( "delete_custom_value" )" style="width:10em">
+ <input type="button" onclick="window.location.href='index.action'" value="$i18n.getString( "done_custom_value" )" style="width:10em">
</td>
</tr>
- </tbody>
- </table>
- <div id="message" name="message"> </div>
- <input type="hidden" name="dataSetIdField" id="dataSetIdField" value="$dataSet.id" />
+ </tbody>
+ </table>
+
</body>
-</html>
\ No newline at end of file
+</html>
+
+<div id="message" name="message"> </div>
+<input type="hidden" name="dataSetIdField" id="dataSetIdField" value="$dataSet.id">
Follow ups