You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/01/30 15:57:40 UTC

svn commit: r1237694 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp: index.html js/archiva/main-tmpl.js js/archiva/utils.js js/redback/redback-tmpl.js

Author: olamy
Date: Mon Jan 30 14:57:39 2012
New Revision: 1237694

URL: http://svn.apache.org/viewvc?rev=1237694&view=rev
Log:
add archivaVersion in js/tmpl url loading to prevent browser cache issue when users upgrade version

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html?rev=1237694&r1=1237693&r2=1237694&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html Mon Jan 30 14:57:39 2012
@@ -46,6 +46,12 @@
 
 
 <script type="text/javascript">
+appendArchivaVersion=function(){
+  return "_archivaVersion="+window.archivaRuntimeInfo.version;
+}
+buildLoadJsUrl=function(srcScript){
+  return srcScript+"?"+appendArchivaVersion();
+}
 $.ajax(
   {
     url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo",
@@ -66,37 +72,37 @@ $.ajax(
         };
         $LAB.setGlobalDefaults(options);
         $LAB
-           .script("jquery.tmpl.js").wait()
-           .script("archiva/utils.js").wait()
+           .script(buildLoadJsUrl("jquery.tmpl.js")).wait()
+           .script(buildLoadJsUrl("archiva/utils.js")).wait()
            .script("jquery.i18n.properties-1.0.9.js").wait()
-           .script("archiva/i18nload.js").wait()
+           .script(buildLoadJsUrl("archiva/i18nload.js")).wait()
            .script("jquery.cookie.1.0.0.js").wait()
-           .script("knockout-debug.js").wait()
+           .script(buildLoadJsUrl("knockout-debug.js")).wait()
            .script("jquery-ui-1.8.16.custom.min.js").wait()
-           .script("jquery.validate.js").wait()
+           .script(buildLoadJsUrl("jquery.validate.js")).wait()
            .script("jquery.json-2.3.min.js").wait()
-           .script("archiva/main-tmpl.js").wait()
-           .script("archiva/repositories.js").wait()
-           .script("archiva/network-proxies.js").wait()
-           .script("archiva/proxy-connectors.js").wait()
-           .script("redback/operation.js").wait()
-           .script("redback/redback-tmpl.js").wait()
-           .script("bootstrap-tabs.js")
-           .script("bootstrap-modal.js")
-           .script("bootstrap-alerts.js")
-           .script("bootstrap-dropdown.js")
-           .script("bootstrap-twipsy.js")
-           .script("bootstrap-popover.js")
-           .script("knockout.simpleGrid.js")
-           .script("knockout.mapping-latest.debug.js")
-           .script("redback/user.js").wait()
-           .script("redback/users.js").wait()
-           .script("redback/redback.js").wait()
-           .script("redback/register.js").wait()
-           .script("redback/permission.js").wait()
-           .script("redback/resource.js").wait()
-           .script("redback/roles.js").wait()
-           .script("archiva/main.js");
+           .script(buildLoadJsUrl("archiva/main-tmpl.js")).wait()
+           .script(buildLoadJsUrl("archiva/repositories.js")).wait()
+           .script(buildLoadJsUrl("archiva/network-proxies.js")).wait()
+           .script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait()
+           .script(buildLoadJsUrl("redback/operation.js")).wait()
+           .script(buildLoadJsUrl("redback/redback-tmpl.js")).wait()
+           .script(buildLoadJsUrl("bootstrap-tabs.js"))
+           .script(buildLoadJsUrl("bootstrap-modal.js"))
+           .script(buildLoadJsUrl("bootstrap-alerts.js"))
+           .script(buildLoadJsUrl("bootstrap-dropdown.js"))
+           .script(buildLoadJsUrl("bootstrap-twipsy.js"))
+           .script(buildLoadJsUrl("bootstrap-popover.js"))
+           .script(buildLoadJsUrl("knockout.simpleGrid.js"))
+           //.script("knockout.mapping-latest.debug.js")
+           .script(buildLoadJsUrl("redback/user.js")).wait()
+           .script(buildLoadJsUrl("redback/users.js")).wait()
+           .script(buildLoadJsUrl("redback/redback.js")).wait()
+           .script(buildLoadJsUrl("redback/register.js")).wait()
+           .script(buildLoadJsUrl("redback/permission.js")).wait()
+           .script(buildLoadJsUrl("redback/resource.js")).wait()
+           .script(buildLoadJsUrl("redback/roles.js")).wait()
+           .script(buildLoadJsUrl("archiva/main.js"));
     }
   })
 </script>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js?rev=1237694&r1=1237693&r2=1237694&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js Mon Jan 30 14:57:39 2012
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-require(["text!archiva/templates/menu.html?"+timestampNoCache(),"text!archiva/templates/topbar.html?"+timestampNoCache(),
-          "text!archiva/templates/message.html?"+timestampNoCache(),"text!archiva/templates/modal.html?"+timestampNoCache(),
-          "text!archiva/templates/grids-generics.html?"+timestampNoCache(),
-          "text!archiva/templates/repositories.html?"+timestampNoCache(),
-          "text!archiva/templates/network-proxies.html?"+timestampNoCache(),
-          "text!archiva/templates//proxy-connectors.html?"+timestampNoCache()],
+require(["text!js/archiva/templates/menu.html"+appendTemplateUrl(),
+          "text!js/archiva/templates/topbar.html"+appendTemplateUrl(),
+          "text!js/archiva/templates/message.html?"+appendTemplateUrl(),
+          "text!js/archiva/templates/modal.html?"+appendTemplateUrl(),
+          "text!js/archiva/templates/grids-generics.html?"+appendTemplateUrl(),
+          "text!js/archiva/templates/repositories.html?"+appendTemplateUrl(),
+          "text!js/archiva/templates/network-proxies.html?"+appendTemplateUrl(),
+          "text!js/archiva/templates//proxy-connectors.html?"+appendTemplateUrl()],
   function(menu,topbar,message,modal,grids_generics,repositories,network_proxies,proxies_connectors) {
 
     // template loading

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js?rev=1237694&r1=1237693&r2=1237694&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js Mon Jan 30 14:57:39 2012
@@ -304,5 +304,9 @@ timestampNoCache=function(){
   if (!window.archivaDevMode){
     return "";
   }
-  return "_="+jQuery.now();
+  return "&_="+jQuery.now();
+}
+
+appendTemplateUrl=function(){
+  return "?"+appendArchivaVersion()+timestampNoCache();
 }
\ No newline at end of file

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js?rev=1237694&r1=1237693&r2=1237694&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js Mon Jan 30 14:57:39 2012
@@ -16,11 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-require(["text!redback/templates/user-edit.html?"+timestampNoCache(), "text!redback/templates/user-grids.html?"+timestampNoCache(),
-          "text!redback/templates/login.html?"+timestampNoCache(), "text!redback/templates/register-form.html?"+timestampNoCache(),
-          "text!redback/templates/password-change-form.html?"+timestampNoCache(),
-          "text!redback/templates/user-edit-form.html?"+timestampNoCache(),
-          "text!redback/templates/roles-tmpl.html?"+timestampNoCache()],
+require(["text!js/redback/templates/user-edit.html?"+appendTemplateUrl(),
+          "text!js/redback/templates/user-grids.html?"+appendTemplateUrl(),
+          "text!js/redback/templates/login.html?"+appendTemplateUrl(),
+          "text!js/redback/templates/register-form.html?"+appendTemplateUrl(),
+          "text!js/redback/templates/password-change-form.html?"+appendTemplateUrl(),
+          "text!js/redback/templates/user-edit-form.html?"+appendTemplateUrl(),
+          "text!js/redback/templates/roles-tmpl.html?"+appendTemplateUrl()],
     function(useredit, usergrids, login,register,passwordchange,usereditform,roles) {