dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11986
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3536: Removed unnecessary and poorly implemented function for showing data elements by id, name or shor...
------------------------------------------------------------
revno: 3536
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-05-08 00:34:06 +0200
message:
Removed unnecessary and poorly implemented function for showing data elements by id, name or shortname in custom form designer
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.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 2011-05-07 18:58:19 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2011-05-07 22:34:06 +0000
@@ -141,7 +141,6 @@
{
dataElementCode = dataElementCode.replace( "input", "select" );
dataElementCode = dataElementCode.replaceAll( "value=\".*?\"", "" );
- dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
}
else
{
@@ -169,11 +168,7 @@
maxValue = String.valueOf( minMaxDataElement.getMax() );
}
- // -------------------------------------------------------------
- // Remove placeholder view attribute from input field
- // -------------------------------------------------------------
-
- dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" );
+ dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" ); // For backwards compatibility
// -------------------------------------------------------------
// Insert title info
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java 2011-05-07 21:24:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java 2011-05-07 22:34:06 +0000
@@ -54,7 +54,6 @@
implements Action
{
private static final Pattern IDENTIFIER_PATTERN = Pattern.compile( "value\\[(.*)\\].value:value\\[(.*)\\].value" );
- private static final Pattern VIEWBY_PATTERN = Pattern.compile( "view=\"@@(.*)@@\"" );
// -------------------------------------------------------------------------
// Dependencies
@@ -145,19 +144,11 @@
dataEntryForm = dataSet.getDataEntryForm();
- if ( dataEntryForm != null )
- {
- dataEntryValue = prepareDataEntryFormForEdit( dataEntryForm.getHtmlCode() );
- }
- else
- {
- dataEntryValue = "";
- }
-
+ dataEntryValue = dataEntryForm != null ? prepareDataEntryFormForEdit( dataEntryForm.getHtmlCode() ) : "";
+
autoSave = (Boolean) userSettingService.getUserSetting( UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM, false );
- operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getFullOperands( dataSet
- .getDataElements() ) );
+ operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getFullOperands( dataSet.getDataElements() ) );
Collections.sort( operands, new DataElementOperandNameComparator() );
@@ -165,8 +156,8 @@
}
/**
- * Prepares the data entry form code by injecting the dataElement name for
- * each entry field.
+ * Prepares the data entry form code by injecting the dataElement name and
+ * and title for each entry field.
*
* @param htmlCode HTML code of the data entry form.
* @return HTML code for the data entry form injected with data element names.
@@ -204,8 +195,6 @@
Matcher dataElementMatcher = IDENTIFIER_PATTERN.matcher( dataElementCode );
- Matcher viewByMatcher = VIEWBY_PATTERN.matcher( dataElementCode );
-
if ( dataElementMatcher.find() && dataElementMatcher.groupCount() > 0 )
{
// -------------------------------------------------------------
@@ -223,27 +212,11 @@
// Insert name of data element in output code
// -------------------------------------------------------------
- String displayValue = "No Such DataElement Exists";
+ String displayValue = "Data element does not exist";
if ( dataElement != null )
{
- displayValue = dataElement.getShortName();
-
- if ( viewByMatcher.find() && viewByMatcher.groupCount() > 0 )
- {
- String viewByVal = viewByMatcher.group( 1 );
-
- if ( viewByVal.equalsIgnoreCase( "deid" ) )
- {
- displayValue = String.valueOf( dataElement.getId() );
- }
- else if ( viewByVal.equalsIgnoreCase( "dename" ) )
- {
- displayValue = dataElement.getName();
- }
- }
-
- displayValue += " - " + optionComboName;
+ displayValue = dataElement.getShortName() + " " + optionComboName;
if ( dataElementCode.contains( "value=\"\"" ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js 2011-04-27 08:32:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js 2011-05-07 22:34:06 +0000
@@ -56,11 +56,7 @@
var params = 'name=' + document.getElementById( 'nameField' ).value;
- if(stat == "ADD")
- {
-
- }
- else
+ if(stat == "EDIT")
{
params += '&dataEntryFormId=' + dataEntryFormId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2011-04-27 08:32:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2011-05-07 22:34:06 +0000
@@ -25,7 +25,7 @@
function timedCount() {
validateDataEntryForm();
- t = setTimeout("timedCount()", 20000);// 1000 -> 1s
+ t = setTimeout("timedCount()", 20000); // ms
byId('message').style.display = 'none';
}
@@ -41,7 +41,6 @@
function insertDataElement() {
var oEditor = $("#designTextarea").ckeditorGet();
- var viewByValue = getFieldValue('viewBySelector');
var json = JSON.parse(jQuery("#json_" + selected).val());
@@ -51,36 +50,26 @@
var optionComboName = json.optionCombo.name;
var optionComboId = json.optionCombo.id;
- if (viewByValue == "deid")
- dispName = "[ " + dataElementId;
- else if (viewByValue == "deshortname")
- dispName = "[ " + json.dataElement.shortName;
- else
- dispName = "[ " + json.dataElement.name;
-
- var titleValue = "-- " + dataElementId + ". " + dataElementName + " "
- + optionComboId + ". " + optionComboName + " (" + dataElementType
- + ") --";
-
- var displayName = dispName + " - " + optionComboName + " ]";
+ var titleValue = dataElementId + " - " + dataElementName + " - "
+ + optionComboId + " - " + optionComboName + " - " + dataElementType;
+
+ var displayName = "[ " + dataElementName + " " + optionComboName + " ]";
var dataEntryId = "value[" + dataElementId + "].value:value["
+ optionComboId + "].value";
var boolDataEntryId = "value[" + dataElementId + "].value:value["
+ optionComboId + "].value";
- viewByValue = "@@" + viewByValue + "@@";
-
var id = "";
var html = "";
if (dataElementType == "bool") {
id = boolDataEntryId;
- html = "<input title=\"" + titleValue + "\" view=\"" + viewByValue
+ html = "<input title=\"" + titleValue
+ "\" value=\"" + displayName + "\" id=\"" + boolDataEntryId
+ "\" style=\"width:4em;text-align:center\"/>";
} else {
id = dataEntryId;
- html = "<input title=\"" + titleValue + "\" view=\"" + viewByValue
+ html = "<input title=\"" + titleValue
+ "\" value=\"" + displayName + "\" id=\"" + dataEntryId
+ "\" style=\"width:4em;text-align:center\"/>";
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2011-04-28 13:26:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2011-05-07 22:34:06 +0000
@@ -20,8 +20,10 @@
var t;
var timer_is_on = 0;
+ #if( $dataEntryForm )
stat = "EDIT";
dataEntryFormId = $dataEntryForm.id;
+ #end
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "dataentryform_confirm_delete" ) , "'" )';
var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'" )';
@@ -151,13 +153,7 @@
<table>
<tr>
<td>
- <b>$i18n.getString( "view_as" )</b><br>
- <select name="viewBySelector" id="viewBySelector" style="width:150px">
- <option value="deid">$i18n.getString( "id" )</option>
- <option value="dename">$i18n.getString( "name" )</option>
- <option value="deshortname" selected>$i18n.getString( "short_name" )</option>
- </select>
- <input type="button" value="Insert" onclick="insertDataElement()"/>
+ <input type="button" value="Insert" onclick="insertDataElement()" style="width:120px"/>
</td>
<td>
<span id="message_"></span>