← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10423: Minor fix for anonymous program.

 

------------------------------------------------------------
revno: 10423
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-26 10:58:41 +0700
message:
  Minor fix for anonymous program.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.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.storage.dom.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js	2013-02-22 03:59:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js	2013-03-26 03:58:41 +0000
@@ -55,32 +55,25 @@
             this.indexer = indexer( this.dbname, this.name );
             if ( callback ) callback.call( this, this, options );
         },
-
-        add: function ( key, obj, callback ) {
-            var key = this.dbname + '.' + this.name + '.' + key;
-            if ( this.indexer.find( key ) == -1 ) this.indexer.add( key );
-            storage.setItem( key, JSON.stringify( obj ) );
-            if ( callback ) callback.call( this, this, obj );
-
-            return this;
-        },
-
-        addAll: function ( keys, objs, callback ) {
+ 
+		 add: function ( key, obj, callback ) {
+			var key = this.dbname + '.' + this.name + '.' + key;
+			if ( this.indexer.find( key ) == -1 ) this.indexer.add( key );
+			storage.setItem( key, JSON.stringify( obj ) );
+		 },
+		 
+		 addAll: function ( keys, objs, callback ) {
             var that = this;
 
-            if ( keys.length == 0 || objs.length == 0 ) {
-                if ( callback ) callback.call( that, that );
+			for( var i in keys)
+			{
+				this.add(keys[i], objs[i]);
+			}
+			
+			if ( callback ) callback.call( that, that );
                 return;
-            }
-
-            var key = keys.pop();
-            var obj = objs.pop();
-
-            this.add( key, obj, function ( store ) {
-                that.addAll( keys, objs, callback );
-            } );
         },
-
+ 
         remove: function ( key, callback ) {
             var key = this.dbname + '.' + this.name + '.' + key;
             this.indexer.remove( key );