From 45018e30d3eac6a58fb5ac22f69a9c7480d8a675 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 26 Mar 2012 20:47:04 +0000 Subject: [PATCH] load all external librairies tru require js git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1305570 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/index.html | 43 ++++++++----------- .../src/main/webapp/js/archiva/i18nload.js | 38 ---------------- .../src/main/webapp/js/archiva/main.js | 7 ++- .../src/main/webapp/js/archiva/search.js | 4 +- .../src/main/webapp/js/archiva/utils.js | 12 ++++++ .../src/main/webapp/js/startup.js | 7 +-- 6 files changed, 38 insertions(+), 73 deletions(-) delete mode 100644 archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js 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 2bbe2b921..9957610c6 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 @@ -12,7 +12,6 @@ - Apache Archiva @@ -57,12 +56,25 @@ "jquery": "jquery-1.7.2", "jquery_tmpl": "jquery.tmpl", "utils": "archiva/utils", - "jquery_ui": "jquery-ui-1.8.16.custom.min" + "jquery_ui": "jquery-ui-1.8.16.custom.min", + "jquery_cookie": "jquery.cookie.1.0.0", + "bootstrap": "bootstrap.2.0.2", + "choosen": "chosen.jquery-0.9.7", + "jquery_validate": "jquery.validate-1.9.0", + "jquery_json": "jquery.json-2.3.min", + "knockout.simpleGrid": "knockout.simpleGrid", + "knockout": "knockout-2.0.0.debug", + "knockout.sortable": "knockout-sortable" } + // file upload dependencies + //.script("jquery.iframe-transport-1.4.js").wait() + //.script("jquery.fileupload-5.10.0.js").wait() + //.script("jquery.fileupload-ip-1.0.6.js").wait() + //.script("jquery.fileupload-ui-6.6.3.js" ).wait() }); - require(['domReady','startup','jquery'], function (domReady) { + require(['domReady','jquery','i18n','startup'], function (domReady) { domReady.withResources(function () { - + loadi18n(); $.ajax( { url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(), @@ -74,9 +86,10 @@ require.config({ baseUrl: "js/", + urlArgs: "_="+new Date().getTime(), "paths": { - "redback": buildLoadJsUrl("redback/redback.js"), - "i18nLoad": buildLoadJsUrl("archiva/i18nload.js") + "redback": buildLoadJsUrl("redback/redback.js") + } }); @@ -89,14 +102,6 @@ }; $LAB.setGlobalDefaults(options); $LAB - //.script(buildLoadJsUrl("jquery.tmpl.js")).wait() - //.script(buildLoadJsUrl("archiva/utils.js")).wait() - .script(buildLoadJsUrl("archiva/i18nload.js")).wait() - .script("jquery.cookie.1.0.0.js").wait() - .script("knockout-2.0.0.debug.js").wait() - //.script("jquery-ui-1.8.16.custom.min.js").wait() - .script("jquery.validate-1.9.0.js").wait() - .script("jquery.json-2.3.min.js").wait() .script(buildLoadJsUrl("archiva/main-tmpl.js")).wait() .script(buildLoadJsUrl("archiva/general-admin.js")) .script(buildLoadJsUrl("archiva/repositories.js")).wait() @@ -104,19 +109,9 @@ .script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait() .script(buildLoadJsUrl("redback/operation.js")).wait() .script(buildLoadJsUrl("archiva/repository-groups.js")).wait() - .script(buildLoadJsUrl("archiva/search.js")).wait() .script(buildLoadJsUrl("redback/redback-tmpl.js")).wait() - .script("chosen.jquery-0.9.7.js" ) - .script("bootstrap.2.0.2.js" ) - .script(buildLoadJsUrl("knockout.simpleGrid.js")) - .script(buildLoadJsUrl("knockout-sortable.js")) - //.script("jquery.iframe-transport-1.4.js").wait() - //.script("jquery.fileupload-5.10.0.js").wait() - //.script("jquery.fileupload-ip-1.0.6.js").wait() - //.script("jquery.fileupload-ui-6.6.3.js" ).wait() .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() diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js deleted file mode 100644 index 5ff8c072c..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -$(function() { - // load i18n resources from rest call - - - - var browserLang = usedLang(); - $.log("use browserLang:"+browserLang); - // -- archiva - // load default - //loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources", {cache:false, mode: 'map',encoding:'utf-8'}); - - var options = { - cache:false, - mode: 'map', - encoding:'utf-8' - }; - loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang,options ); - -}); \ No newline at end of file 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 47d637d4d..52796ee18 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,10 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -require( ["order!jquery" ,"order!redback/redback","jquery_ui"], -function($) { +require( ["order!jquery","jquery_ui","jquery_cookie","bootstrap","order!archiva/search", + "jquery_validate","jquery_json","order!knockout","order!redback/redback"], +function() { -$(function() { // define a container object with various datas window.archivaModel = {}; @@ -340,6 +340,5 @@ $(function() { } startArchivaApplication(); -}) }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index aef73d32d..d96572168 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -16,7 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -$(function() { +define("search",["jquery","i18n","jquery_tmpl","choosen","order!knockout","knockout.simpleGrid"], function() { + + //----------------------------------------- // browse part 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 a50040f2f..2f4a9031f 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 @@ -19,6 +19,18 @@ define("utils",["jquery","i18n","jquery_tmpl"], function() { + loadi18n=function(){ + var browserLang = usedLang(); + $.log("use browserLang:"+browserLang); + + var options = { + cache:false, + mode: 'map', + encoding:'utf-8' + }; + loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang,options ); + } + /** * log message in the console */ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/startup.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/startup.js index ed271646c..40844f6cc 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/startup.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/startup.js @@ -17,7 +17,7 @@ * under the License. */ -require(["jquery","i18n","js/archiva/utils.js"], +require(["jquery","utils"], function() { @@ -33,9 +33,4 @@ function() { dataType: 'json' }); - - - - - }); \ No newline at end of file -- 2.39.5