← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7457: store partial OUWT responses in sessionStorage

 

------------------------------------------------------------
revno: 7457
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-29 18:31:11 +0300
message:
  store partial OUWT responses in sessionStorage
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.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	2012-06-29 15:11:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2012-06-29 15:31:11 +0000
@@ -97,6 +97,11 @@
 
             organisationUnits = JSON.parse( localStorage["organisationUnits"] );
 
+            if(sessionStorage["organisationUnits"] !== undefined)
+            {
+                $.extend(organisationUnits, JSON.parse( sessionStorage["organisationUnits"] ))
+            }
+
             selection.sync();
             subtree.reloadTree();
 
@@ -648,6 +653,15 @@
                 function ( data, textStatus, jqXHR )
                     {
                         // load additional organisationUnits into sessionStorage
+                        if(sessionStorage["organisationUnits"] === undefined)
+                        {
+                            sessionStorage["organisationUnits"] = JSON.stringify( data.organisationUnits );
+                        } else {
+                            units = JSON.parse( sessionStorage["organisationUnits"] );
+                            $.extend(units, data.organisationUnits);
+                            sessionStorage["organisationUnits"] = JSON.stringify( units );
+                        }
+
                         $.extend(organisationUnits, data.organisationUnits);
                         createChildren( parentTag, parent );
                     }