felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvalc...@apache.org
Subject svn commit: r1169749 - in /felix/trunk/webconsole/src/main: java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java resources/res/ui/configurationrender.js
Date Mon, 12 Sep 2011 14:00:50 GMT
Author: vvalchev
Date: Mon Sep 12 14:00:50 2011
New Revision: 1169749

URL: http://svn.apache.org/viewvc?rev=1169749&view=rev
Log:
Fixed FELIX-3014 : Have a way to "deep link" to a particular tab within Configuration Status
https://issues.apache.org/jira/browse/FELIX-3014

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
    felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.js

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java?rev=1169749&r1=1169748&r2=1169749&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
Mon Sep 12 14:00:50 2011
@@ -19,6 +19,7 @@ package org.apache.felix.webconsole.inte
 
 import java.io.*;
 import java.net.URL;
+import java.net.URLEncoder;
 import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.util.*;
@@ -218,7 +219,7 @@ public class ConfigurationRender extends
             {
                 final String label = desc.label;
                 final String title = desc.title;
-                pw.print("<li><a href='" + pluginRoot + label + ".nfo'>" + title
+ "</a></li>" );
+                pw.print("<li><a href='" + pluginRoot + URLEncoder.encode(label)
+ ".nfo'>" + title + "</a></li>" );
             }
         }
         pw.println("</ul> <!-- end tabs on top -->");

Modified: felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.js
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.js?rev=1169749&r1=1169748&r2=1169749&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.js (original)
+++ felix/trunk/webconsole/src/main/resources/res/ui/configurationrender.js Mon Sep 12 14:00:50
2011
@@ -14,6 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+var _tabs = false;
+
 function pad(value) {
 	if ( value < 10 ) {
 		return "0" + value;
@@ -21,6 +23,20 @@ function pad(value) {
 	return "" + value;
 }
 
+function setSelectedTab() {
+	var anchor =  window.location.hash;
+	if (anchor) {
+		anchor = pluginRoot + '/' + anchor.substring(1) + '.nfo';
+		_tabs.find('ul > li > a').each( function(index, element) {
+			if (anchor == $(element).data('href.tabs')) {
+				_tabs.tabs('select', index);
+				return false;
+			}
+			return true;
+		});
+	}
+}
+
 function downloadDump(ext) {
 	var now = new Date();
 	var name = "configuration-status-" + now.getUTCFullYear() + pad(now.getUTCMonth() + 1) +
pad(now.getUTCDate()) + "-" + pad(now.getUTCHours()) + pad(now.getUTCMinutes()) + pad(now.getUTCSeconds())
+ ".";
@@ -28,6 +44,7 @@ function downloadDump(ext) {
 }
 
 $(document).ready(function() {
+	$(window).bind( 'hashchange', setSelectedTab);
 	var dlg = $('#waitDlg').dialog({
 		modal    : true,
 		autoOpen : false,
@@ -36,11 +53,13 @@ $(document).ready(function() {
 		closeOnEscape: false
 	});
 
-	$('#tabs').tabs({ajaxOptions: {
+	_tabs = $('#tabs').tabs({ajaxOptions: {
 		beforeSend : function() { dlg.dialog('open') },
-		complete   : function() { dlg.dialog('close')}
+		complete   : function() { dlg.dialog('close')},
 	}}).tabs('paging');
 
+	setTimeout(setSelectedTab, 1000);
+
 	$('.downloadTxt').click(function() { downloadDump('txt')});
 	$('.downloadZip').click(function() { downloadDump('zip')});
 });
\ No newline at end of file



Mime
View raw message