dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20551
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9420: Codestyle
------------------------------------------------------------
revno: 9420
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-01-02 21:50:36 +0100
message:
Codestyle
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
--
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-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2012-10-10 18:17:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2013-01-02 20:50:36 +0000
@@ -48,8 +48,8 @@
final Pattern IDENTIFIER_PATTERN = Pattern.compile( "(\\d+)-(\\d+)-val" );
final Pattern DATAELEMENT_TOTAL_PATTERN = Pattern.compile( "dataelementid=\"(.*?)\"" );
final Pattern INDICATOR_PATTERN = Pattern.compile( "indicatorid=\"(.*?)\"" );
- final Pattern DYNAMIC_INPUT_PATTERN = Pattern.compile( "(.*?)-(.*?)-dyninput" );
- final Pattern DYNAMIC_SELECT_PATTERN = Pattern.compile( "dynselect=\"(.*?)\"" );
+ final Pattern DYNAMIC_INPUT_PATTERN = Pattern.compile( "(.*?)-(.*?)-dyninput" ); // Random code - category option combo id
+ final Pattern DYNAMIC_SELECT_PATTERN = Pattern.compile( "dynselect=\"(.*?)\"" ); // Category combo id
final Pattern VALUE_TAG_PATTERN = Pattern.compile( "value=\"(.*?)\"", Pattern.DOTALL );
final Pattern TITLE_TAG_PATTERN = Pattern.compile( "title=\"(.*?)\"", Pattern.DOTALL );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2012-12-04 17:33:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2013-01-02 20:50:36 +0000
@@ -70,13 +70,15 @@
var EVENT_FORM_LOADED = "dhis-web-dataentry-form-loaded";
-(function( $ ) {
- $.safeEach = function( arr, fn ) {
- if( arr ) {
+( function( $ ) {
+ $.safeEach = function( arr, fn )
+ {
+ if( arr )
+ {
$.each( arr, fn );
}
};
-})( jQuery );
+} )( jQuery );
/**
* Page init. The order of events is:
@@ -657,11 +659,12 @@
//------------------------------------------------------------------------------
// splits a id based on the multiOrgUnit var
+
function splitFieldId( id )
{
var split = {};
- if( multiOrganisationUnit )
+ if ( multiOrganisationUnit )
{
split.organisationUnitId = id.split( '-' )[0];
split.dataElementId = id.split( '-' )[1];
@@ -757,23 +760,27 @@
{
var dataSetList = [];
- $.safeEach(orgUnits, function(idx, item) {
+ $.safeEach(orgUnits, function( idx, item )
+ {
dataSetList.push.apply( dataSetList, getSortedDataSetList(item) )
- });
+ } );
var filteredDataSetList = [];
- $.safeEach(dataSetList, function(idx, item) {
+ $.safeEach(dataSetList, function( idx, item )
+ {
var formType = dataSets[item.id].type;
var found = false;
- $.safeEach(filteredDataSetList, function(i, el) {
-
- if(item.name == el.name)
+ $.safeEach(filteredDataSetList, function( i, el )
+ {
+ if( item.name == el.name )
+ {
found = true;
- });
+ }
+ } );
- if( !found && formType == FORMTYPE_SECTION )
+ if ( !found && formType == FORMTYPE_SECTION )
{
filteredDataSetList.push(item);
}
@@ -807,14 +814,15 @@
var dataSetValid = false;
- $.safeEach(dataSetList, function(idx, item) {
+ $.safeEach( dataSetList, function( idx, item )
+ {
addOptionById( 'selectedDataSetId', item.id, item.name );
if ( dataSetId == item.id )
{
dataSetValid = true;
}
- });
+ } );
if ( children )
{
@@ -822,13 +830,14 @@
if( childrenDataSets && childrenDataSets.length > 0 )
{
- $('#selectedDataSetId').append('<optgroup label="' + i18n_childrens_forms + '">');
-
- $.safeEach(childrenDataSets, function(idx, item) {
- $('<option />').attr('data-multiorg', true).attr('value', item.id).html(item.name).appendTo('#selectedDataSetId');
- });
-
- $('#selectDataSetId').append('</optgroup>')
+ $( '#selectedDataSetId' ).append( '<optgroup label="' + i18n_childrens_forms + '">' );
+
+ $.safeEach(childrenDataSets, function( idx, item )
+ {
+ $( '<option />' ).attr( 'data-multiorg', true).attr( 'value', item.id).html(item.name).appendTo( '#selectedDataSetId' );
+ } );
+
+ $( '#selectDataSetId' ).append( '</optgroup>' );
}
}
@@ -1552,14 +1561,15 @@
{
var formIds = storageManager.getAllForms();
- $.safeEach(formIds, function(idx, item) {
+ $.safeEach( formIds, function( idx, item )
+ {
if ( dataSets[item] == null )
{
storageManager.deleteForm( item );
storageManager.deleteFormVersion( item );
log( 'Deleted locally stored form: ' + item );
}
- });
+ } );
log( 'Purged local forms' );
}
@@ -1569,7 +1579,8 @@
var formIds = storageManager.getAllForms();
var formVersions = storageManager.getAllFormVersions();
- $.safeEach(formIds, function(idx, item) {
+ $.safeEach( formIds, function( idx, item )
+ {
var remoteVersion = dataSets[item].version;
var localVersion = formVersions[item];
@@ -1577,19 +1588,20 @@
{
storageManager.downloadForm( item, remoteVersion );
}
- });
+ } );
}
function downloadRemoteForms()
{
- $.safeEach(dataSets, function(idx, item) {
+ $.safeEach( dataSets, function( idx, item )
+ {
var remoteVersion = item.version;
if ( !storageManager.formExists( idx ) && !item.skipOffline )
{
storageManager.downloadForm( idx, remoteVersion );
}
- });
+ } );
}
// TODO break if local storage is full