dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11996
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3540: CDE cleanup
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 3540 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-05-08 11:39:27 +0200
message:
CDE cleanup
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/css/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/css/cde.css
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2011-05-08 08:06:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2011-05-08 09:38:47 +0000
@@ -60,7 +60,7 @@
implements DataEntryFormService
{
private static final Pattern IDENTIFIER_PATTERN = Pattern.compile( "value\\[(.*)\\].value:value\\[(.*)\\].value" );
- private static final Pattern DATAELEMENT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
+ private static final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
private static final String EMPTY = "";
// ------------------------------------------------------------------------
@@ -124,32 +124,17 @@
public String prepareDataEntryFormForSave( String htmlCode )
{
- // ---------------------------------------------------------------------
- // Buffer to contain the final result.
- // ---------------------------------------------------------------------
-
StringBuffer sb = new StringBuffer();
- // ---------------------------------------------------------------------
- // Pattern to match data elements in the HTML code.
- // ---------------------------------------------------------------------
-
- Pattern patDataElement = Pattern.compile( "(<input.*?)[/]?>" );
- Matcher matDataElement = patDataElement.matcher( htmlCode );
-
- // ---------------------------------------------------------------------
- // Iterate through all matching data element fields.
- // ---------------------------------------------------------------------
-
- boolean result = matDataElement.find();
-
- while ( result )
+ Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode );
+
+ while ( inputMatcher.find() )
{
// -----------------------------------------------------------------
// Get input HTML code (HTML input field code).
// -----------------------------------------------------------------
- String dataElementCode = matDataElement.group( 1 );
+ String dataElementCode = inputMatcher.group( 1 );
// -----------------------------------------------------------------
// Pattern to extract data element name from data element field
@@ -178,51 +163,32 @@
String appendCode = dataElementCode;
appendCode += "/>";
- matDataElement.appendReplacement( sb, appendCode );
+ inputMatcher.appendReplacement( sb, appendCode );
}
-
- // -----------------------------------------------------------------
- // Go to next data entry field
- // -----------------------------------------------------------------
-
- result = matDataElement.find();
}
- // -----------------------------------------------------------------
- // Add remaining code (after the last match), and return formatted code.
- // -----------------------------------------------------------------
+ // ---------------------------------------------------------------------
+ // Add remaining code (after the last match), and return formatted code
+ // ---------------------------------------------------------------------
- matDataElement.appendTail( sb );
+ inputMatcher.appendTail( sb );
return sb.toString();
}
public String prepareDataEntryFormForEdit( String htmlCode )
{
- // ---------------------------------------------------------------------
- // Buffer to contain the final result.
- // ---------------------------------------------------------------------
-
StringBuffer sb = new StringBuffer();
- // ---------------------------------------------------------------------
- // Pattern to match data elements in the HTML code.
- // ---------------------------------------------------------------------
-
- Pattern patDataElement = Pattern.compile( "(<input.*?)[/]?>" );
- Matcher matDataElement = patDataElement.matcher( htmlCode );
-
- // ---------------------------------------------------------------------
- // Iterate through all matching data element fields.
- // ---------------------------------------------------------------------
-
- while ( matDataElement.find() )
+ Matcher inputMatcher = INPUT_PATTERN.matcher( htmlCode );
+
+ while ( inputMatcher.find() )
{
// -----------------------------------------------------------------
// Get input HTML code
// -----------------------------------------------------------------
- String dataElementCode = matDataElement.group( 1 );
+ String dataElementCode = inputMatcher.group( 1 );
// -----------------------------------------------------------------
// Pattern to extract data element ID from data element field
@@ -302,7 +268,7 @@
String appendCode = dataElementCode;
appendCode += "/>";
- matDataElement.appendReplacement( sb, appendCode );
+ inputMatcher.appendReplacement( sb, appendCode );
}
}
@@ -310,7 +276,7 @@
// Add remaining code (after the last match), and return formatted code
// ---------------------------------------------------------------------
- matDataElement.appendTail( sb );
+ inputMatcher.appendTail( sb );
return sb.toString();
}
@@ -338,11 +304,7 @@
StringBuffer sb = new StringBuffer();
- Matcher dataElementMatcher = DATAELEMENT_PATTERN.matcher( htmlCode );
-
- // ---------------------------------------------------------------------
- // Iterate through all matching data element fields
- // ---------------------------------------------------------------------
+ Matcher dataElementMatcher = INPUT_PATTERN.matcher( htmlCode );
Map<Integer, DataElement> dataElementMap = getDataElementMap( dataSet );
@@ -372,16 +334,8 @@
return "Data Element Id :" + dataElementId + " not found in this data set";
}
- // -------------------------------------------------------------
- // Find value type of data element
- // -------------------------------------------------------------
-
String dataElementValueType = dataElement.getType();
- // -------------------------------------------------------------
- // Find existing value of data element in data set
- // -------------------------------------------------------------
-
String dataElementValue = getValue( dataValues, dataElementId, optionComboId );
// -------------------------------------------------------------
@@ -531,8 +485,8 @@
return dataEntryFormStore.listDisctinctDataEntryFormByDataSetIds( dataSetIds );
}
- public Collection<DataEntryForm> getDataEntryForms( final Collection<Integer> identifiers ){
-
+ public Collection<DataEntryForm> getDataEntryForms( final Collection<Integer> identifiers )
+ {
Collection<DataEntryForm> dataEntryForms = getAllDataEntryForms();
return identifiers == null ? dataEntryForms : FilterUtils.filter( dataEntryForms, new Filter<DataEntryForm>()
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-05-08 08:20:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-05-08 09:38:47 +0000
@@ -246,10 +246,7 @@
class="org.hisp.dhis.dataset.action.dataentryform.ViewDataEntryFormAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-dataset/viewDataEntryForm.vm</param>
- <param name="javascripts">
- ../dhis-web-commons/ckeditor/ckeditor.js, ../dhis-web-commons/ckeditor/adapters/jquery.js, javascript/dataEntryForm.js
- </param>
- <param name="stylesheets">css/cde.css</param>
+ <param name="javascripts">../dhis-web-commons/ckeditor/ckeditor.js, ../dhis-web-commons/ckeditor/adapters/jquery.js, javascript/dataEntryForm.js</param>
</action>
<action name="saveDataEntryForm"
=== removed directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/css'
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/css/cde.css'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/css/cde.css 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/css/cde.css 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-table#cde_buttontable {
- width: 100%;
-}
-
-#cde_deletebuttoncell {
- text-align: right;
-}
\ No newline at end of file
=== 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-05-07 22:34:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2011-05-08 09:38:47 +0000
@@ -93,45 +93,32 @@
</tbody>
</table>
- <table width="100%">
- <tr>
- <th>$i18n.getString( "dataentryform_design" )</th>
- </tr>
- <tr>
- <td>
- <div>
- <textarea id="designTextarea" name="designTextarea"></textarea>
- </div>
- </td>
- </tr>
- <tr>
+ <table width="100%">
+ <tr>
+ <th>$i18n.getString( "dataentryform_design" )</th>
+ </tr>
+ <tr>
+ <td><div><textarea id="designTextarea" name="designTextarea"></textarea></div></td>
+ </tr>
+ <tr>
<td>
- <table id="cde_buttontable">
- <tr>
- <td>
- <input type="button" name="save" value="$i18n.getString( 'save' )" onclick="autoSave = true; validateDataEntryForm(); autoSave = '$!autoSave';"/>
- <input type="submit" name="saveClose" value="$i18n.getString( 'save_close' )"/>
- <input type="button" name="cancel" value="$i18n.getString( 'cancel' )" onclick="window.location.href='dataSet.action'"/>
- </td>
- <td id="cde_deletebuttoncell">
- <input type="button" id='delete' name="delete" value="$i18n.getString( 'delete' )" onclick="removeDataEntryForm( '$dataSet.id', '$dataEntryForm.id', '$dataEntryForm.name' )"/>
- <script>
- if(stat == "EDIT")
- {
- enable('delete');
- }
- else
- {
- disable('delete');
- }
- </script>
- </td>
- </tr>
- <tr><td><span id="message"></span></td></tr>
- </table>
- </td>
- </tr>
- </tbody>
+ <input type="button" name="save" value="$i18n.getString( 'save' )" onclick="autoSave = true; validateDataEntryForm(); autoSave = '$!autoSave';"/>
+ <input type="submit" name="saveClose" value="$i18n.getString( 'save_close' )"/>
+ <input type="button" name="cancel" value="$i18n.getString( 'cancel' )" onclick="window.location.href='dataSet.action'"/> <span style="color:#606060">|</span>
+ <input type="button" id='delete' name="delete" value="$i18n.getString( 'delete' )" onclick="removeDataEntryForm( '$dataSet.id', '$dataEntryForm.id', '$dataEntryForm.name' )"/>
+ </td>
+ <script>
+ if(stat == "EDIT")
+ {
+ enable('delete');
+ }
+ else
+ {
+ disable('delete');
+ }
+ </script>
+ </tr>
+ <tr><td><span id="message"></span></td></tr>
</table>
<input type="hidden" name="dataSetIdField" id="dataSetIdField" value="$dataSet.id" />
</form>