dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21815
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10425: Reverted R 10423
------------------------------------------------------------
revno: 10425
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-26 21:32:26 +0100
message:
Reverted R 10423
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-03-26 03:58:41 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.dom.js 2013-03-26 20:32:26 +0000
@@ -55,25 +55,32 @@
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 ) );
- },
-
- 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 ) );
+ if ( callback ) callback.call( this, this, obj );
+
+ return this;
+ },
+
+ addAll: function ( keys, objs, callback ) {
var that = this;
- for( var i in keys)
- {
- this.add(keys[i], objs[i]);
- }
-
- if ( callback ) callback.call( that, that );
+ if ( keys.length == 0 || objs.length == 0 ) {
+ 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 );