← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9044: minor fixes to data entry (js cleanup)

 

------------------------------------------------------------
revno: 9044
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-15 12:11:53 +0100
message:
  minor fixes to data entry (js cleanup)
modified:
  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/select.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/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-11-14 17:12:21 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2012-11-15 11:11:53 +0000
@@ -65,6 +65,7 @@
 
 var FORMTYPE_CUSTOM = 'custom';
 var FORMTYPE_SECTION = 'section';
+var FORMTYPE_MULTIORG_SECTION = 'multiorg_section';
 var FORMTYPE_DEFAULT = 'default';
 
 var EVENT_FORM_LOADED = "dhis-web-dataentry-form-loaded";
@@ -249,7 +250,7 @@
                 $( '#sync_button' ).bind( 'click', uploadLocalData );
             }
         } );
-    };
+    }
 
     ( function pushDataValues( array )
     {
@@ -595,21 +596,6 @@
     }
 }
 
-function resetSectionFilters()
-{
-    $( '#selectionBox' ).css( 'height', '93px' );
-    $( '#filterDataSetSectionTr' ).hide();
-    $( '.formSection' ).show();
-}
-
-function clearSectionFilters()
-{
-    $( '#filterDataSetSection' ).children().remove();
-    $( '#selectionBox' ).css( 'height', '93px' );
-    $( '#filterDataSetSectionTr' ).hide();
-    $( '.formSection' ).show();
-}
-
 function filterOnSection()
 {
     var $filterDataSetSection = $( '#filterDataSetSection' );
@@ -741,16 +727,15 @@
 
     var dataSetList = [];
 
-    for ( i in orgUnitDataSets )
-    {
-        var dataSetId = orgUnitDataSets[i];
+    $.each(orgUnitDataSets, function(idx, item) {
+        var dataSetId = orgUnitDataSets[idx];
         var dataSetName = dataSets[dataSetId].name;
 
         var row = [];
         row['id'] = dataSetId;
         row['name'] = dataSetName;
-        dataSetList[i] = row;
-    }
+        dataSetList[idx] = row;
+    });
 
     dataSetList.sort( function( a, b )
     {
@@ -780,11 +765,11 @@
                 found = true;
         });
 
-        if( !found && formType == 'section' )
+        if( !found && formType == FORMTYPE_SECTION )
         {
             filteredDataSetList.push(item);
         }
-    })
+    });
 
     return filteredDataSetList;
 }
@@ -814,15 +799,14 @@
 
     var dataSetValid = false;
 
-    for ( var i in dataSetList )
-    {
-        addOptionById( 'selectedDataSetId', dataSetList[i].id, dataSetList[i].name );
+    $.each(dataSetList, function(idx, item) {
+        addOptionById( 'selectedDataSetId', item.id, item.name );
 
-        if ( dataSetId == dataSetList[i].id )
+        if ( dataSetId == item.id )
         {
             dataSetValid = true;
         }
-    }
+    });
 
     if ( children )
     {
@@ -830,7 +814,7 @@
 
         if( childrenDataSets && childrenDataSets.length > 0 )
         {
-            $('#selectedDataSetId').append('<optgroup label="Childrens DataSets">')
+            $('#selectedDataSetId').append('<optgroup label=' + i18n_childrens_forms + '>');
 
             $.each(childrenDataSets, function(idx, item) {
                 $('<option />').attr('data-multiorg', true).attr('value', item.id).html(item.name).appendTo('#selectedDataSetId');
@@ -1814,7 +1798,7 @@
     /**
      * Saves a version for a form.
      *
-     * @param the identifier of the data set of the form.
+     * @param dataSetId the identifier of the data set of the form.
      * @param formVersion the version of the form.
      */
     this.saveFormVersion = function( dataSetId, formVersion )
@@ -1875,7 +1859,7 @@
                 localStorage[KEY_FORM_VERSIONS] = JSON.stringify( formVersions );
             }
         }
-    }
+    };
 
     this.getAllFormVersions = function()
     {
@@ -2053,7 +2037,7 @@
     /**
      * Removes the given complete data set registration.
      *
-     * @param the complete data set registration as JSON.
+     * @param json the complete data set registration as JSON.
      */
     this.clearCompleteDataSet = function( json )
     {
@@ -2066,7 +2050,7 @@
 
             if ( completeDataSets.length > 0 )
             {
-                localStorage.remoteItem( KEY_COMPLETEDATASETS );
+                localStorage.removeItem( KEY_COMPLETEDATASETS );
             }
             else
             {

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2012-11-12 11:43:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2012-11-15 11:11:53 +0000
@@ -41,6 +41,7 @@
 var i18n_validation_result = '$encoder.jsEscape( $i18n.getString( "validation_result" ) , "'")';
 var i18n_successful_validation = '$encoder.jsEscape( $i18n.getString( "successful_validation" ) , "'")';
 var i18n_no_organisationunit_selected = '$encoder.jsEscape( $i18n.getString( "no_organisationunit_selected" ) , "'")';
+var i18n_childrens_forms = '$encoder.jsEscape( $i18n.getString( "childrens_forms" ) , "'")';
 </script>
 
 <h3>$i18n.getString( "data_entry" ) #openHelp( "dataEntry" )</h3>