blob: a8cbb1f57010e26d744c7796ebdc8389a92e3344 [file] [log] [blame]
Felix Meschbergerab2b4f02008-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
18function displayBundle(/* String */ bundleId)
19{
20 var theBundleData = bundleData[bundleId];
21 if (!theBundleData)
22 {
23 return;
24 }
25
26 var title = theBundleData.title;
27
28 var licenseButtons = document.getElementById('licenseButtons');
29 if (licenseButtons) {
30
31 var innerHTML = "";
32 for (var name in theBundleData.files)
33 {
34 var entry = theBundleData.files[name];
35 var buttons = "";
36 for (var idx in entry)
37 {
38 var descr = entry[idx];
39 buttons += "<a href='javascript:displayFile(\"" + bundleId + "\", \"" + name + "\", " + idx + ");'"
40 + " >" + descr.url + "</a> ";
41 }
42 if (buttons)
43 {
44 innerHTML += name + ": " + buttons + "<br />";
45 }
46 }
47
48 if (!innerHTML)
49 {
50 innerHTML = "<em>The Bundle contains neither LICENSE nor NOTICE files</em>";
51 }
52
53 licenseButtons.innerHTML = "<h1>" + title + "</h1>" + innerHTML;
54 }
55
56 var licenseDetails = document.getElementById('licenseDetails');
57 if (licenseDetails)
58 {
59 licenseDetails.innerHTML = "";
60 }
61}
62
63function displayFile ( /* String */ bundleId, /* String */ name, /* int */ idx )
64{
65 var theBundleData = bundleData[bundleId];
66 if (!theBundleData)
67 {
68 return;
69 }
70
71 var file = theBundleData.files[name][idx];
72 if (!file)
73 {
74 return;
75 }
76
77 var licenseDetails = document.getElementById('licenseDetails');
78 if (licenseDetails)
79 {
80 licenseDetails.innerHTML = "<h3>" + name + ": " + file.url + "</h3><pre>" + file.data + "</pre>";
81 }
82}