From 0e44acbb2fec928a1606dc60f427a148fff405c9 Mon Sep 17 00:00:00 2001
From: Mohamed Ragab <moragab@gmail.com>
Date: Wed, 02 May 2012 11:15:01 -0400
Subject: [PATCH] Added a script to facilitate setting the proxy host and port and no proxy hosts, and then it concatenates all the java system properties for setting the java proxy configurations and puts the resulting string in an environment variable JAVA_PROXY_CONFIG, modified the scirpts gitblit,  gitblit-ubuntu, and gitblit-centos to source the java-proxy-config.sh script and then include the resulting java proxy configuration in the java command

---
 src/com/gitblit/wicket/PageRegistration.java |   77 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/src/com/gitblit/wicket/PageRegistration.java b/src/com/gitblit/wicket/PageRegistration.java
index f7ddcc5..e8eeaba 100644
--- a/src/com/gitblit/wicket/PageRegistration.java
+++ b/src/com/gitblit/wicket/PageRegistration.java
@@ -49,6 +49,24 @@
 	}
 
 	/**
+	 * Represents a page link to a non-Wicket page. Might be external.
+	 * 
+	 * @author James Moger
+	 * 
+	 */
+	public static class OtherPageLink extends PageRegistration {
+
+		private static final long serialVersionUID = 1L;
+
+		public final String url;
+
+		public OtherPageLink(String translationKey, String url) {
+			super(translationKey, null);
+			this.url = url;
+		}
+	}
+
+	/**
 	 * Represents a DropDownMenu for the topbar
 	 * 
 	 * @author James Moger
@@ -76,17 +94,17 @@
 
 		private static final long serialVersionUID = 1L;
 
+		final PageParameters parameters;
 		final String displayText;
 		final String parameter;
 		final String value;
+		final boolean isSelected;
 
 		/**
 		 * Divider constructor.
 		 */
 		public DropDownMenuItem() {
-			displayText = null;
-			parameter = null;
-			value = null;
+			this(null, null, null, null);
 		}
 
 		/**
@@ -97,9 +115,54 @@
 		 * @param value
 		 */
 		public DropDownMenuItem(String displayText, String parameter, String value) {
+			this(displayText, parameter, value, null);
+		}
+
+		/**
+		 * Standard Menu Item constructor that preserves aggregate parameters.
+		 * 
+		 * @param displayText
+		 * @param parameter
+		 * @param value
+		 */
+		public DropDownMenuItem(String displayText, String parameter, String value,
+				PageParameters params) {
 			this.displayText = displayText;
 			this.parameter = parameter;
 			this.value = value;
+
+			if (params == null) {
+				// no parameters specified
+				parameters = new PageParameters();
+				setParameter(parameter, value);
+				isSelected = false;
+			} else {
+				parameters = new PageParameters(params);
+				if (parameters.containsKey(parameter)) {
+					isSelected = params.getString(parameter).equals(value);
+					if (isSelected) {
+						// already selected, so remove this enables toggling
+						parameters.remove(parameter);
+					} else {
+						// set the new selection value
+						setParameter(parameter, value);
+					}
+				} else {
+					// not currently selected
+					isSelected = false;
+					setParameter(parameter, value);
+				}
+			}
+		}
+
+		private void setParameter(String parameter, String value) {
+			if (!StringUtils.isEmpty(parameter)) {
+				if (StringUtils.isEmpty(value)) {
+					this.parameters.remove(parameter);
+				} else {
+					this.parameters.put(parameter, value);
+				}
+			}
 		}
 
 		public String formatParameter() {
@@ -109,10 +172,18 @@
 			return parameter + "=" + value;
 		}
 
+		public PageParameters getPageParameters() {
+			return parameters;
+		}
+
 		public boolean isDivider() {
 			return displayText == null && value == null && parameter == null;
 		}
 
+		public boolean isSelected() {
+			return isSelected;
+		}
+
 		@Override
 		public int hashCode() {
 			if (isDivider()) {

--
Gitblit v1.9.1