blob: 35018d402620f5b4c0821b492834d5b0cb456eb9 [file] [log] [blame]
Felix Meschberger407b3eb2008-06-13 05:28:27 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
Felix Meschbergerd39ce9a2010-02-19 10:09:34 +000018var licenseButtons = false;
19var licenseDetails = false;
20
Felix Meschberger407b3eb2008-06-13 05:28:27 +000021function displayBundle(/* String */ bundleId)
22{
23 var theBundleData = bundleData[bundleId];
24 if (!theBundleData)
25 {
26 return;
27 }
28
29 var title = theBundleData.title;
30
Felix Meschberger407b3eb2008-06-13 05:28:27 +000031 if (licenseButtons) {
32
33 var innerHTML = "";
34 for (var name in theBundleData.files)
35 {
36 var entry = theBundleData.files[name];
37 var buttons = "";
38 for (var idx in entry)
39 {
40 var descr = entry[idx];
Felix Meschbergerd39ce9a2010-02-19 10:09:34 +000041 var jar = descr.jar ? '&jar=' + descr.jar : ''; // inner jar attribute
42 buttons += '<a href="' + pluginRoot + '?bid=' + bundleId + '&url=' + descr.path + jar + '" target="licenseDetails">' + descr.url + '</a> ';
Felix Meschberger407b3eb2008-06-13 05:28:27 +000043 }
44 if (buttons)
45 {
Felix Meschbergerd39ce9a2010-02-19 10:09:34 +000046 // apply i18n
47 name = '__res__' == name ? i18n.resources : i18n.resources_emb.msgFormat( name );
Felix Meschberger407b3eb2008-06-13 05:28:27 +000048 innerHTML += name + ": " + buttons + "<br />";
49 }
50 }
Felix Meschbergerd39ce9a2010-02-19 10:09:34 +000051
52 licenseButtons.html("<h1>" + title + "</h1>" + innerHTML);
Felix Meschberger407b3eb2008-06-13 05:28:27 +000053 }
54
Felix Meschbergerd39ce9a2010-02-19 10:09:34 +000055 licenseDetails.html("");
56 $("#licenseLeft a").removeClass('ui-state-default ui-corner-all');
57 $("#licenseLeft #" +bundleId).addClass('ui-state-default ui-corner-all');
Felix Meschberger407b3eb2008-06-13 05:28:27 +000058}
59
Felix Meschbergerd39ce9a2010-02-19 10:09:34 +000060
61$(document).ready(function() {
62 // init elements cache
63 licenseButtons = $("#licenseButtons");
64 licenseDetails = $("#licenseDetails")
65
66 // render list of bundles
67 var txt = "";
68 for(id in bundleData) {
69 txt += '<a id="' + id + '" href="javascript:displayBundle(\'' + id + '\')">' + bundleData[id]['title'] + '</a>';
70 }
71 if (txt) {
72 $("#licenseLeft").html(txt);
73 } else {
74 $(".statline").html(i18n.status_none);
75 }
76
77 // display first element
78 for(i in bundleData) {displayBundle(i);break;}
79});