← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4344: minor javascript fixes

 

------------------------------------------------------------
revno: 4344
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-08-18 09:55:27 +0200
message:
  minor javascript fixes
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js
  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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2011-08-17 16:56:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2011-08-18 07:55:27 +0000
@@ -31,7 +31,7 @@
 
 function Selection()
 {
-    var listenerFunction, multipleSelectionAllowed = false, unselectAllowed = false;
+    var listenerFunction = undefined, multipleSelectionAllowed = false, unselectAllowed = false;
 
     this.setListenerFunction = function( listenerFunction_, skipInitialCall )
     {
@@ -227,7 +227,7 @@
 
             if ( !!selected && $.isArray( selected ) )
             {
-                var idx;
+                var idx = undefined;
 
                 $.each( selected, function( i, item )
                 {
@@ -310,7 +310,7 @@
             return;
         }
 
-        var selected = []
+        var selected = [];
 
         if ( sessionStorage[getTagId( "Selected" )] != null )
         {
@@ -347,9 +347,9 @@
 
     this.findByCode = function()
     {
-        var name = $( '#searchField' ).val()
+        var name = $( '#searchField' ).val();
 
-        var match;
+        var match = undefined;
 
         for ( var ou in organisationUnits )
         {
@@ -382,7 +382,7 @@
         {
             $( '#searchField' ).css( 'background-color', '#ffc5c5' );
         }
-    }
+    };
 }
 
 // -----------------------------------------------------------------------------
@@ -471,7 +471,7 @@
         if ( $( "#" + getTagId( rootId ) ).length < 1 )
         {
             var expand = organisationUnits[rootId];
-            var $parentTag = $( "#" + getTagId( rootId ) );
+//            var $parentTag = $( "#" + getTagId( rootId ) );
             $rootsTag.append( createTreeElementTag( expand ) );
         }
 
@@ -589,9 +589,9 @@
 
         $childTag.attr( "id", getTagId( ou.id ) );
         $childTag.append( " " );
-        $childTag.append( $toggleTag )
+        $childTag.append( $toggleTag );
         $childTag.append( " " );
-        $childTag.append( $linkTag )
+        $childTag.append( $linkTag );
 
         return $childTag;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-08-18 07:04:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-08-18 07:55:27 +0000
@@ -25,7 +25,7 @@
  */
 function updateIndicators()
 {
-    var entryFieldValues = getEntryFieldValues();
+//    var entryFieldValues = getEntryFieldValues();
 
     $( 'input[name="indicator"]' ).each( function( index )
     {

=== 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	2011-08-18 07:04:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-18 07:55:27 +0000
@@ -136,8 +136,7 @@
 
     for( var completeDataSetKey in completeDataSets )
     {
-        var completeDataSet = completeDataSets[completeDataSetKey]
-        console.log(completeDataSet);
+        var completeDataSet = completeDataSets[completeDataSetKey];
 
         $.ajax({
             url: 'registerCompleteDataSet.action',
@@ -322,7 +321,7 @@
     var dataSetId = $( '#selectedDataSetId' ).val();
     var periodId = $( '#selectedPeriodId' ).val();
 
-    var url = 'loadDataSets.action';
+//    var url = 'loadDataSets.action';
 
     $( '#selectedOrganisationUnit' ).val( organisationUnitName );
     $( '#currentOrganisationUnit' ).html( organisationUnitName );
@@ -680,7 +679,7 @@
 
     if(localStorage[KEY_COMPLETEDATASETS] == null)
     {
-        completeDataSets = {}
+        completeDataSets = {};
     } else {
         completeDataSets = JSON.parse(localStorage[KEY_COMPLETEDATASETS]);
     }
@@ -743,9 +742,6 @@
         $.getJSON( 'registerCompleteDataSet.action', params).success(function() {
             clearCompleteDataSetLocally(params);
         }).error( function() {
-
-//            disableUndoButton();
-//            window.alert( i18n_no_response_from_server );
         } );
     }
     else
@@ -770,9 +766,6 @@
         }).error( function()
         {
             clearCompleteDataSetLocally(params);
-
-//            disableCompleteButton();
-//            window.alert( i18n_no_response_from_server );
         } );
     }
 }
@@ -946,8 +939,8 @@
 function StorageManager()
 {
 	var MAX_SIZE = new Number( 2600000 );
-	var MAX_SIZE_FORMS = new Number( 1600000 );
-	var MAX_SIZE_DATA_VALUES = new Number( 500000 );
+//	var MAX_SIZE_FORMS = new Number( 1600000 );
+//	var MAX_SIZE_DATA_VALUES = new Number( 500000 );
 
 	var KEY_FORM_PREFIX = 'form-';
 	var KEY_FORM_VERSIONS = 'formversions';
@@ -973,7 +966,7 @@
 		}
 		
 		return totalSize;
-	}
+	};
 	
 	/**
 	 * Returns the total numbers of characters in stored forms currently in the
@@ -999,7 +992,7 @@
 		}
 		
 		return totalSize;
-	}
+	};
 	
 	/**
 	 * Return the remaining capacity of the local storage in characters, ie.
@@ -1008,7 +1001,7 @@
 	this.remainingStorage = function()
 	{
 		return MAX_SIZE - this.totalSize();
-	}
+	};
 	
 	/**
 	 * Saves the content of a data entry form.
@@ -1044,7 +1037,7 @@
 		* */
 		
 		return true;
-	}
+	};
 	
 	/**
 	 * Gets the content of a data entry form.
@@ -1057,7 +1050,7 @@
 		var id = KEY_FORM_PREFIX + dataSetId;
 		
 		return localStorage[id];
-	}
+	};
 	
 	/**
 	 * Removes a form.
@@ -1067,7 +1060,7 @@
 	this.deleteForm = function( dataSetId )
 	{
 		localStorage.removeItem( dataSetId );
-	}
+	};
 	
 	/**
 	 * Returns an array of the identifiers of all forms.
@@ -1077,7 +1070,6 @@
 	this.getAllForms = function()
 	{
 		var formIds = [];
-		var i = 0;
 		
 		for ( var i = 0; i < localStorage.length; i++ )
 		{
@@ -1092,7 +1084,7 @@
 		}
 		
 		return formIds;
-	}
+	};
 	
 	/**
 	 * Indicates whether a form exists.
@@ -1105,7 +1097,7 @@
 		var id = KEY_FORM_PREFIX + dataSetId;
 		
 		return localStorage[id] != null;
-	}
+	};
 	
 	/**
 	 * Downloads the form for the data set with the given identifier from the 
@@ -1128,8 +1120,8 @@
 				storageManager.saveFormVersion( this.dataSetId, this.formVersion );
 			}
 		} );
-	}
-	
+	};
+
 	/**
 	 * Saves a version for a form.
 	 * 
@@ -1157,7 +1149,7 @@
 		{
 			console.log( 'Max local storage quota reached, ignored form version: ' + dataSetId );
 		}
-	}
+	};
 	
 	/**
 	 * Returns the version of the form of the data set with the given identifier.
@@ -1175,12 +1167,12 @@
 		}
 		
 		return null;
-	}
+	};
 	
 	this.getAllFormVersions = function()
 	{
 		return localStorage[KEY_FORM_VERSIONS] != null ?  JSON.parse( localStorage[KEY_FORM_VERSIONS] ) : null;
-	}
+	};
 	
 	/**
 	 * Saves a data value.
@@ -1210,8 +1202,8 @@
 		{
 			console.log( 'Max local storage quota reached, ignored data value' );
 		}
-	}
-	
+	};
+
 	/**
 	 * Gets the value for the data value with the given arguments, or null if it
 	 * does not exist.
@@ -1234,7 +1226,7 @@
 		}
 
 		return null;
-	}
+	};
 
 	/**
 	 * Removes the wanted dataValue from localStorage.
@@ -1244,7 +1236,7 @@
 	this.clearDataValueJSON = function( dataValue )
 	{
 	    this.clearDataValue( dataValue.dataElementId, dataValue.optionComboId, dataValue.periodId, dataValue.organisationUnitId );
-	}
+	};
 
 	/**
      * Removes the wanted dataValue from localStorage.
@@ -1264,7 +1256,7 @@
 	        delete dataValues[id];
 	        localStorage[KEY_DATAVALUES] = JSON.stringify( dataValues );
 	    }
-	}
+	};
 	
 	/**
 	 * Returns a JSON associative array where the keys are on the form
@@ -1276,7 +1268,7 @@
 	this.getAllDataValues = function()
 	{
 		return localStorage[KEY_DATAVALUES] != null ? JSON.parse( localStorage[KEY_DATAVALUES] ) : null;
-	}
+	};
 	
 	/**
 	 * Supportive method.
@@ -1284,5 +1276,5 @@
 	this.getDataValueIdentifier = function( dataElementId, categoryOptionComboId, periodId, organisationUnitId )
 	{
 		return dataElementId + "-" + categoryOptionComboId + "-" + periodId + "-" + organisationUnitId;
-	}
+	};
 }