← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4452: bugfix for ff 3.6, window.console is not available

 

------------------------------------------------------------
revno: 4452
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-08-26 09:59:03 +0200
message:
  bugfix for ff 3.6, window.console is not available
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.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/javascripts/dhis2/dhis2.util.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js	2011-08-24 12:04:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.util.js	2011-08-26 07:59:03 +0000
@@ -85,13 +85,13 @@
 }
 
 /**
- * If the console object is undefined, just ignore all calls to console.log.
- * (this is a fix for IE8).
+ * Define a window.log object, and output to console.log if it exists.
+ * (this is a fix for IE8 and FF 3.6).
  */
-if ( !console )
+window.log = function()
 {
-    console = {};
-    console.log = function( str )
+    if ( this.console )
     {
-    };
-}
+        console.log( Array.prototype.slice.call( arguments ) );
+    }
+};

=== 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-25 09:02:12 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-08-26 07:59:03 +0000
@@ -68,7 +68,7 @@
 
     $( '#orgUnitTree' ).one( 'ouwtLoaded', function()
     {
-        console.log( 'Ouwt loaded' );
+        log( 'Ouwt loaded' );
         loadMetaData();
     } );
 
@@ -153,7 +153,7 @@
 	
 	        selection.responseReceived(); // Notify that meta data is loaded
 	        $( '#loaderSpan' ).hide();
-	        console.log( 'Meta-data loaded' );
+	        log( 'Meta-data loaded' );
 	
 	        updateForms();
 	    } 
@@ -185,7 +185,7 @@
         var key = array[0];
         var value = completeDataSets[key];
 
-        console.log( 'Uploaded complete data set: ' + key + ', with value: ' + value );
+        log( 'Uploaded complete data set: ' + key + ', with value: ' + value );
 
         $.ajax( {
             url: 'registerCompleteDataSet.action',
@@ -194,7 +194,7 @@
             cache: false,
             success: function( data, textStatus, jqXHR )
             {
-                console.log( 'Successfully saved complete dataset with value: ' + value );
+                log( 'Successfully saved complete dataset with value: ' + value );
                 storageManager.clearCompleteDataSet( value );
                 ( array = array.slice( 1 ) ).length && pushCompleteDataSets( array );
 
@@ -230,7 +230,7 @@
         var key = array[0];
         var value = dataValues[key];
 
-        console.log( 'Uploaded data value: ' + key + ', with value: ' + value );
+        log( 'Uploaded data value: ' + key + ', with value: ' + value );
 
         $.ajax( {
             url: 'saveValue.action',
@@ -240,7 +240,7 @@
             success: function( data, textStatus, jqXHR )
             {
                 storageManager.clearDataValueJSON( value );
-                console.log( 'Successfully saved data value with value: ' + value );
+                log( 'Successfully saved data value with value: ' + value );
                 ( array = array.slice( 1 ) ).length && pushDataValues( array );
 
                 if ( array.length < 1 && completeDataSetsArray.length > 0 )
@@ -351,7 +351,7 @@
 {
     if ( storageManager.formExists( dataSetId ) )
     {
-        console.log( 'Loading form locally: ' + dataSetId );
+        log( 'Loading form locally: ' + dataSetId );
 
         var html = storageManager.getForm( dataSetId );
 
@@ -361,7 +361,7 @@
     }
     else
     {
-        console.log( 'Loading form remotely: ' + dataSetId );
+        log( 'Loading form remotely: ' + dataSetId );
 
         $( '#contentDiv' ).load( 'loadForm.action', {
             dataSetId : dataSetId
@@ -373,10 +373,10 @@
 {
 	if ( dataElements[dataElementId] != null )
 	{
-		return dataElements[dataElementId].type
+		return dataElements[dataElementId].type;
 	}
 	
-	console.log( 'Data element not present in data set, falling back to default type: ' + dataElementId );	
+	log( 'Data element not present in data set, falling back to default type: ' + dataElementId );	
 	return DEFAULT_TYPE;
 }
 
@@ -387,7 +387,7 @@
 		return dataElements[dataElementId].name;
 	}
 	
-	console.log( 'Data element present in data set, falling back to default name: ' + dataElementId );
+	log( 'Data element present in data set, falling back to default name: ' + dataElementId );
 	return DEFAULT_NAME;	
 }
 
@@ -971,11 +971,11 @@
         if ( dataSets[localId] == null )
         {
             storageManager.deleteForm( localId );
-            console.log( 'Deleted locally stored form: ' + localId );
+            log( 'Deleted locally stored form: ' + localId );
         }
     }
 
-    console.log( 'Purged local forms' );
+    log( 'Purged local forms' );
 }
 
 function updateExistingLocalForms()
@@ -1102,10 +1102,10 @@
         {
             localStorage[id] = html;
 
-            console.log( 'Successfully stored form: ' + dataSetId );
+            log( 'Successfully stored form: ' + dataSetId );
         } catch ( e )
         {
-            console.log( 'Max local storage quota reached, ignored form: ' + dataSetId );
+            log( 'Max local storage quota reached, ignored form: ' + dataSetId );
             return false;
         }
 
@@ -1113,7 +1113,7 @@
         {
             this.deleteForm( dataSetId );
 
-            console.log( 'Max local storage quota for forms reached, ignored form: ' + dataSetId );
+            log( 'Max local storage quota for forms reached, ignored form: ' + dataSetId );
             return false;
         }
 
@@ -1231,10 +1231,10 @@
         {
             localStorage[KEY_FORM_VERSIONS] = JSON.stringify( formVersions );
 
-            console.log( 'Successfully stored form version: ' + dataSetId );
+            log( 'Successfully stored form version: ' + dataSetId );
         } catch ( e )
         {
-            console.log( 'Max local storage quota reached, ignored form version: ' + dataSetId );
+            log( 'Max local storage quota reached, ignored form version: ' + dataSetId );
         }
     };
 
@@ -1285,10 +1285,10 @@
         {
             localStorage[KEY_DATAVALUES] = JSON.stringify( dataValues );
 
-            console.log( 'Successfully stored data value' );
+            log( 'Successfully stored data value' );
         } catch ( e )
         {
-            console.log( 'Max local storage quota reached, ignored data value' );
+            log( 'Max local storage quota reached, ignored data value' );
         }
     };