]> source.dussan.org Git - archiva.git/commitdiff
add archivaVersion in js/tmpl url loading to prevent browser cache issue when users...
authorOlivier Lamy <olamy@apache.org>
Mon, 30 Jan 2012 14:57:39 +0000 (14:57 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 30 Jan 2012 14:57:39 +0000 (14:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1237694 13f79535-47bb-0310-9956-ffa450edef68

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

index a3cad210a66d83d0554851df95dd91a44f635e41..62a42ad6df4088a556ec20084bec04aa2729b22c 100644 (file)
 
 
 <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>
index bfd0c8fb8de6718a3715891f9c65ad463c56de71..f9aec9d6553c5a5b7d5b40f4c0d3a0f82790e325 100644 (file)
  * 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
index 7be5da42692e46622265a0310ff2ca73c8ec1fb0..0e89557bf7741cdb6edb314a1b6383bab9a2af58 100644 (file)
@@ -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
index e61cf04ec4f217a424ce58e1e467328602cdbeac..d1453bae0aec217e7b1b669f31cd969a6b04966c 100644 (file)
  * 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) {