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/client/EditTeamDialog.java | 90 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 85 insertions(+), 5 deletions(-)
diff --git a/src/com/gitblit/client/EditTeamDialog.java b/src/com/gitblit/client/EditTeamDialog.java
index 4297599..2f9796c 100644
--- a/src/com/gitblit/client/EditTeamDialog.java
+++ b/src/com/gitblit/client/EditTeamDialog.java
@@ -65,9 +65,19 @@
private JTextField teamnameField;
+ private JTextField mailingListsField;
+
private JPalette<String> repositoryPalette;
private JPalette<String> userPalette;
+
+ private JPalette<String> preReceivePalette;
+
+ private JLabel preReceiveInherited;
+
+ private JPalette<String> postReceivePalette;
+
+ private JLabel postReceiveInherited;
private Set<String> teamnames;
@@ -105,16 +115,21 @@
private void initialize(int protocolVersion, TeamModel aTeam) {
teamnameField = new JTextField(aTeam.name == null ? "" : aTeam.name, 25);
+ mailingListsField = new JTextField(aTeam.mailingLists == null ? ""
+ : StringUtils.flattenStrings(aTeam.mailingLists, " "), 50);
+
JPanel fieldsPanel = new JPanel(new GridLayout(0, 1));
fieldsPanel.add(newFieldPanel(Translation.get("gb.teamName"), teamnameField));
+ fieldsPanel.add(newFieldPanel(Translation.get("gb.mailingLists"), mailingListsField));
final Insets _insets = new Insets(5, 5, 5, 5);
repositoryPalette = new JPalette<String>();
userPalette = new JPalette<String>();
+ userPalette.setEnabled(settings.supportsTeamMembershipChanges);
JPanel fieldsPanelTop = new JPanel(new BorderLayout());
fieldsPanelTop.add(fieldsPanel, BorderLayout.NORTH);
-
+
JPanel repositoriesPanel = new JPanel(new BorderLayout()) {
private static final long serialVersionUID = 1L;
@@ -135,11 +150,24 @@
};
usersPanel.add(userPalette, BorderLayout.CENTER);
+ preReceivePalette = new JPalette<String>(true);
+ preReceiveInherited = new JLabel();
+ JPanel preReceivePanel = new JPanel(new BorderLayout(5, 5));
+ preReceivePanel.add(preReceivePalette, BorderLayout.CENTER);
+ preReceivePanel.add(preReceiveInherited, BorderLayout.WEST);
+
+ postReceivePalette = new JPalette<String>(true);
+ postReceiveInherited = new JLabel();
+ JPanel postReceivePanel = new JPanel(new BorderLayout(5, 5));
+ postReceivePanel.add(postReceivePalette, BorderLayout.CENTER);
+ postReceivePanel.add(postReceiveInherited, BorderLayout.WEST);
+
JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP);
panel.addTab(Translation.get("gb.general"), fieldsPanelTop);
panel.addTab(Translation.get("gb.teamMembers"), usersPanel);
panel.addTab(Translation.get("gb.restrictedRepositories"), repositoriesPanel);
-
+ panel.addTab(Translation.get("gb.preReceiveScripts"), preReceivePanel);
+ panel.addTab(Translation.get("gb.postReceiveScripts"), postReceivePanel);
JButton createButton = new JButton(Translation.get("gb.save"));
createButton.addActionListener(new ActionListener() {
@@ -162,7 +190,7 @@
JPanel controls = new JPanel();
controls.add(cancelButton);
controls.add(createButton);
-
+
JPanel centerPanel = new JPanel(new BorderLayout(5, 5)) {
private static final long serialVersionUID = 1L;
@@ -218,11 +246,31 @@
}
team.name = tname;
+ String ml = mailingListsField.getText();
+ if (!StringUtils.isEmpty(ml)) {
+ Set<String> list = new HashSet<String>();
+ for (String address : ml.split("(,|\\s)")) {
+ if (StringUtils.isEmpty(address)) {
+ continue;
+ }
+ list.add(address.toLowerCase());
+ }
+ team.mailingLists.clear();
+ team.mailingLists.addAll(list);
+ }
+
team.repositories.clear();
team.repositories.addAll(repositoryPalette.getSelections());
-
+
team.users.clear();
team.users.addAll(userPalette.getSelections());
+
+ team.preReceiveScripts.clear();
+ team.preReceiveScripts.addAll(preReceivePalette.getSelections());
+
+ team.postReceiveScripts.clear();
+ team.postReceiveScripts.addAll(postReceivePalette.getSelections());
+
return true;
}
@@ -251,7 +299,7 @@
}
repositoryPalette.setObjects(restricted, selected);
}
-
+
public void setUsers(List<String> users, List<String> selected) {
Collections.sort(users);
if (selected != null) {
@@ -260,6 +308,38 @@
userPalette.setObjects(users, selected);
}
+ public void setPreReceiveScripts(List<String> unused, List<String> inherited,
+ List<String> selected) {
+ Collections.sort(unused);
+ if (selected != null) {
+ Collections.sort(selected);
+ }
+ preReceivePalette.setObjects(unused, selected);
+ showInherited(inherited, preReceiveInherited);
+ }
+
+ public void setPostReceiveScripts(List<String> unused, List<String> inherited,
+ List<String> selected) {
+ Collections.sort(unused);
+ if (selected != null) {
+ Collections.sort(selected);
+ }
+ postReceivePalette.setObjects(unused, selected);
+ showInherited(inherited, postReceiveInherited);
+ }
+
+ private void showInherited(List<String> list, JLabel label) {
+ StringBuilder sb = new StringBuilder();
+ if (list != null && list.size() > 0) {
+ sb.append("<html><body><b>INHERITED</b><ul style=\"margin-left:5px;list-style-type: none;\">");
+ for (String script : list) {
+ sb.append("<li>").append(script).append("</li>");
+ }
+ sb.append("</ul></body></html>");
+ }
+ label.setText(sb.toString());
+ }
+
public TeamModel getTeam() {
if (canceled) {
return null;
--
Gitblit v1.9.1