dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26847
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13294: include username in appcache, makes the browser re-download all assets if user is changed. becaus...
------------------------------------------------------------
revno: 13294
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-12-18 09:26:45 +0100
message:
include username in appcache, makes the browser re-download all assets if user is changed. because of the way appcache works, the user still have to refresh again after assets have been loaded (appcache will first use whats local, then download any updates)
added:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/appcache/
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/appcache/AppCacheAction.java
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache
--
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-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2013-12-04 16:39:38 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2013-12-18 08:26:45 +0000
@@ -128,9 +128,8 @@
<param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_DELETE</param>
</action>
- <action name="cacheManifest" class="org.hisp.dhis.commons.action.NoAction">
- <result name="success" type="velocity-cache-manifest">/dhis-web-caseentry/cacheManifest.vm
- </result>
+ <action name="cacheManifest" class="org.hisp.dhis.appcache.AppCacheAction">
+ <result name="success" type="velocity-cache-manifest">/dhis-web-caseentry/cacheManifest.vm</result>
</action>
<action name="getProgramMetaData"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm 2013-10-17 06:57:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm 2013-12-18 08:26:45 +0000
@@ -1,5 +1,6 @@
CACHE MANIFEST
-# 2.14-SNAPSHOT V1
+# 2.14-SNAPSHOT V2
+# appcache for user: $username
NETWORK:
*
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm 2013-11-21 13:15:22 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm 2013-12-18 08:26:45 +0000
@@ -1,5 +1,6 @@
CACHE MANIFEST
-# 2.14-SNAPSHOT V2
+# 2.14-SNAPSHOT V3
+# appcache for user: $username
NETWORK:
*
=== added directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/appcache'
=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/appcache/AppCacheAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/appcache/AppCacheAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/appcache/AppCacheAction.java 2013-12-18 08:26:45 +0000
@@ -0,0 +1,62 @@
+package org.hisp.dhis.appcache;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class AppCacheAction implements Action
+{
+ private CurrentUserService currentUserService;
+
+ @Autowired
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private String username;
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ @Override
+ public String execute() throws Exception
+ {
+ username = currentUserService.getCurrentUsername();
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2013-10-25 19:53:21 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2013-12-18 08:26:45 +0000
@@ -605,4 +605,6 @@
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
+ <bean id="org.hisp.dhis.appcache.AppCacheAction" class="org.hisp.dhis.appcache.AppCacheAction" />
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2013-10-30 12:51:03 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2013-12-18 08:26:45 +0000
@@ -294,7 +294,7 @@
<!-- TODO give i18n its own namespace and move cacheManifest action to dhis-web-commons package -->
- <action name="cacheManifest" class="org.hisp.dhis.commons.action.NoAction">
+ <action name="cacheManifest" class="org.hisp.dhis.appcache.AppCacheAction">
<result name="success" type="velocity-cache-manifest">/cacheManifest.vm</result>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache 2013-10-17 06:57:37 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache 2013-12-18 08:26:45 +0000
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# 2.14-SNAPSHOT V1
+# 2.14-SNAPSHOT V2
CACHE:
../mobile/index