FELIX-1988 Apply 7.services.patch by Valentin Valchev (thanks) with the following change: make readTemplateFile method of AbstractWebConsole protected for use by extending plugins and fix a minor issue in the services.js script preventing mutliple service details to be opened at the same time
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@911278 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/resources/res/lib/support.js b/webconsole/src/main/resources/res/lib/support.js
index 2310b3e..86e7620 100644
--- a/webconsole/src/main/resources/res/lib/support.js
+++ b/webconsole/src/main/resources/res/lib/support.js
@@ -60,7 +60,7 @@
/* automatically executed on load */
$(document).ready(function() {
// init table-sorter tables - only once!
- var tables = $('table.tablesorter');
+ var tables = $('table.tablesorter:not(.noauto)');
if (tables.size() > 0) tables.tablesorter();
// init navigation
@@ -80,9 +80,33 @@
initStaticWidgets();
});
+/* A helper function, used together with tablesorter, when the cells contains mixed text and links. As example:
+
+ elem.tablesorter({
+ headers: {
+ 0: {textExtraction: mixedLinksExtraction},
+ 2: {sorter: false}
+ }
+ });
+*/
+function mixedLinksExtraction(node) {
+ var l = node.getElementsByTagName('a');
+ return l && l.length > 0 ? l[0].innerHTML : node.innerHTML;
+};
+
+/* Java-like MessageFormat method. Usage:
+ 'hello {0}'.msgFormat('world')
+*/
+String.prototype.msgFormat = function(/* variable arguments*/) {
+ var i=0; var s=this;
+ while(i<arguments.length) s=s.replace('{'+i+'}',arguments[i++]);
+ return s;
+}
+
+
/* replacement for confirm() method, needs 'action' parameter to work.
* if action is not set - then default confirm() method is used. */
-function Xconfirm(text, action, title) {
+function Xconfirm(/* String */text, /* Callback function */action, /* String */title) {
if (!$.isFunction(action)) return confirm(text);
if (title === undefined) title = "";
@@ -101,7 +125,7 @@
});
return false;
}
-function Xalert(text, title) {
+function Xalert(/* String */text, /* String */title) {
if (!$.isFunction(action)) return alert(text);
if (title === undefined) title = "";