diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index 732ffcbf3..e1c4efb0a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -33,7 +33,7 @@ - + Apache Archiva @@ -66,111 +66,6 @@ - - - -
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/archiva.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/archiva.js new file mode 100644 index 000000000..2342290ee --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/archiva.js @@ -0,0 +1,100 @@ +appendArchivaVersion=function(){ + return "_archivaVersion="+window.archivaRuntimeInfo.version; +} + +timestampNoCache=function(){ + if (window.archivaRuntimeInfo.version.match("SNAPSHOT$")=="SNAPSHOT"){ + return "&archivaTimestamp="+window.archivaRuntimeInfo.timestamp+(window.archivaRuntimeInfo.devMode?"&_="+jQuery.now():""); + } + return ""; +} + +appendTemplateUrl=function(){ + return appendArchivaVersion()+timestampNoCache(); +} + +appendJsNoCacheUrl=function(){ + return appendArchivaVersion()+timestampNoCache(); +} + +$.ajax({ + url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/en", + dataType: 'json', + cache: false, + success:function(data){ + + window.archivaDevMode=data.devMode; + window.archivaJavascriptLog=data.javascriptLog; + window.archivaRuntimeInfo=data; + + requirejs.config({ + baseUrl: "js/", + urlArgs: ""+appendJsNoCacheUrl(), + shim: { + 'sammy':['jquery','jquery.tmpl'], + 'archiva.main':['jquery','sammy','jquery.tmpl'], + 'utils':['jquery','jquery.tmpl'], + 'archiva.templates': ['jquery','jquery.tmpl','utils'], + 'redback.templates': ['jquery','jquery.tmpl','utils'] + }, + paths: { + "i18n":"jquery.i18n.properties-1.0.9", + "jquery": "jquery-1.8.0.min", + "jquery.tmpl": "jquery.tmpl", + "utils": "archiva/utils", + "startup": "archiva/startup", + "jquery.ui": "jquery-ui-1.8.16.custom.min", + "jquery.ui.widget": "jquery.ui.widget-1.8.18", + "jquery.cookie": "jquery.cookie.1.0.0", + "bootstrap": "bootstrap.2.1.0", + "choosen": "chosen.jquery-0.9.8", + "jquery.validate": "jquery.validate-1.9.0", + "jquery.json": "jquery.json-2.3.min", + "knockout": "knockout-2.0.0.debug", + "knockout.simpleGrid": "knockout.simpleGrid", + "knockout.sortable": "knockout-sortable", + "jquery.iframe.transport": "jquery.iframe-transport-1.4", + "jquery.fileupload": "jquery.fileupload-5.10.0", + "jquery.fileupload.ip":"jquery.fileupload-ip-1.0.6", + "jquery.fileupload.ui":"jquery.fileupload-ui-6.6.3", + "tmpl": "tmpl.min", + "prettify": "prettify", + "sammy": "sammy.0.7.1", + "jqueryFileTree": "jqueryFileTree-1.0.1", + "redback": "redback/redback", + "redback.roles": "redback/roles", + "redback.user": "redback/user", + "redback.users": "redback/users", + "redback.templates": "redback/redback-tmpl", + "archiva.general-admin":"archiva/general-admin", + "archiva.templates": "archiva/main-tmpl", + "archiva.repositories": "archiva/repositories", + "archiva.network-proxies": "archiva/network-proxies", + "archiva.proxy-connectors": "archiva/proxy-connectors", + "archiva.repository-groups": "archiva/repository-groups", + "archiva.artifacts-management": "archiva/artifacts-management", + "archiva.search": "archiva/search", + "archiva.main": "archiva/main" + } + }); + + requirejs(['jquery','jquery.tmpl','i18n','sammy','startup','utils','domReady!'], function (domReady) { + loadi18n(function () { + $.ajax({ + url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(), + dataType: 'json', + success:function(data){ + window.archivaDevMode=data.devMode; + window.archivaJavascriptLog=data.javascriptLog; + window.archivaRuntimeInfo=data; + + require(['sammy','jquery','jquery.tmpl','archiva.main','utils','domReady!'],function (domReady) { + startArchivaApplication(); + $("#loadingDiv").hide(); + }) + } + }) + }) + }); + } +}) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js index 4764863f3..72fb7ab98 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main-tmpl.js @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.templates",["jquery.tmpl","utils","text!templates/archiva/menu.html", +require(['jquery',"jquery.tmpl","utils","text!templates/archiva/menu.html", "text!templates/archiva/generics.html", "text!templates/archiva/modal.html", "text!templates/archiva/repositories.html", "text!templates/archiva/search.html", "text!templates/archiva/general-admin.html"], - function(jqueryTmpl,utils,menu,generics,modal,repositories, + function(jquery,jqueryTmpl,utils,menu,generics,modal,repositories, search,general_admin) { var htmlFragment=$("#html-fragments"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index f4f1966af..93299d01b 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.main",["jquery","sammy","jquery.ui","jquery.cookie","bootstrap","archiva.search", +define("archiva.main",["jquery","sammy","jquery.tmpl","jquery.ui","jquery.cookie","bootstrap","archiva.search", "jquery.validate","jquery.json","knockout","redback.templates","archiva.templates", "redback.roles","redback","archiva.general-admin","archiva.repositories", "archiva.network-proxies","archiva.proxy-connectors","archiva.repository-groups","archiva.artifacts-management"], @@ -593,16 +593,5 @@ function() { } - //----------------------------------------- - // extends jquery tmpl to support var def - //----------------------------------------- - - $.extend($.tmpl.tag, { - "var": { - open: "var $1;" - } - }); - - }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 8502354f0..7ae911abb 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -17,7 +17,7 @@ * under the License. */ -define("utils",["jquery","jquery.tmpl","i18n"], function() { +require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) { loadi18n=function(loadCallback){ $.log("loadi18n"); @@ -426,6 +426,16 @@ define("utils",["jquery","jquery.tmpl","i18n"], function() { return this.substring(idx); } + //----------------------------------------- + // extends jquery tmpl to support var def + //----------------------------------------- + $(function() { + $.extend($.tmpl.tag, { + "var": { + open: "var $1;" + } + }); + }); }); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/jquery.tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/jquery.tmpl.js index 7e850f9d0..c10fc8f75 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/jquery.tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/jquery.tmpl.js @@ -7,7 +7,11 @@ * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ -(function( jQuery, undefined ){ + +define("jquery.tmpl",["jquery"], +function() { + +//(function( jQuery, undefined ){ var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /, newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = []; @@ -481,4 +485,8 @@ jQuery.tmpl( null, null, null, this).insertBefore( coll[0] ); jQuery( coll ).remove(); } -})( jQuery ); +//})( jQuery ); + + + +}); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js index a177bc16c..7817e4a89 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/redback/redback-tmpl.js @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -define("redback.templates",["jquery.tmpl","utils","text!templates/redback/user-edit.html", +require(['jquery',"jquery.tmpl","utils","text!templates/redback/user-edit.html", "text!templates/redback/login.html"], - function(jqueryTmpl,utils,useredit, login) { + function(jquery,jqueryTmpl,utils,useredit, login) { var htmlFragment=$("#html-fragments");