FELIX-1910 Refactored LicenseServlet to use regular URLs to address resources instead of request parameters; ensure bundles are displayed in bundle-name sort order (as intended)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@912361 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/resources/res/ui/license.js b/webconsole/src/main/resources/res/ui/license.js
index f378161..a4aa3a8 100644
--- a/webconsole/src/main/resources/res/ui/license.js
+++ b/webconsole/src/main/resources/res/ui/license.js
@@ -18,9 +18,9 @@
var licenseButtons = false;
var licenseDetails = false;
-function displayBundle(/* String */ bundleId)
+function displayBundle(/* String */ bundleIndex)
{
- var theBundleData = bundleData[bundleId];
+ var theBundleData = bundleData[bundleIndex];
if (!theBundleData)
{
return;
@@ -39,10 +39,18 @@
for (var idx in entry)
{
var descr = entry[idx];
- var jar = descr.jar ? '&jar=' + descr.jar : ''; // inner jar attribute
- var link = pluginRoot + '?bid=' + bundleId + '&url=' + descr.path + jar;
+
+ var link = pluginRoot + "/" + theBundleData.bid;
+ if (descr.jar)
+ {
+ link += descr.jar + "!/"; // inner jar attribute
+ }
+ link += descr.path;
+
buttons += '<a href="' + link + '">' + descr.url + '</a> ';
- if (!firstPage) {
+
+ if (!firstPage)
+ {
firstPage = link;
}
}
@@ -64,7 +72,7 @@
}
$("#licenseLeft a").removeClass('ui-state-default ui-corner-all');
- $("#licenseLeft #" +bundleId).addClass('ui-state-default ui-corner-all');
+ $("#licenseLeft #" +bundleIndex).addClass('ui-state-default ui-corner-all');
$('#licenseButtons a').click(function() {
licenseDetails.load(this.href);
@@ -81,7 +89,7 @@
// render list of bundles
var txt = "";
for(id in bundleData) {
- txt += '<a id="' + id + '" href="javascript:displayBundle(\'' + id + '\')">' + bundleData[id]['title'] + '</a>';
+ txt += '<a id="' + id + '" href="javascript:displayBundle(\'' + id + '\')">' + bundleData[id].title + '</a>';
}
if (txt) {
$("#licenseLeft").html(txt);
@@ -90,5 +98,5 @@
}
// display first element
- for(i in bundleData) {displayBundle(i);break;}
+ displayBundle(0);
});
\ No newline at end of file