summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/wicket')
-rw-r--r--src/com/gitblit/wicket/AuthorizationStrategy.java24
-rw-r--r--src/com/gitblit/wicket/BasePage.java16
-rw-r--r--src/com/gitblit/wicket/GitBlitWebApp.java58
-rw-r--r--src/com/gitblit/wicket/GitBlitWebApp.properties4
-rw-r--r--src/com/gitblit/wicket/GitBlitWebSession.java14
-rw-r--r--src/com/gitblit/wicket/LinkPanel.java11
-rw-r--r--src/com/gitblit/wicket/LoginPage.java9
-rw-r--r--src/com/gitblit/wicket/RepositoryPage.java105
-rw-r--r--src/com/gitblit/wicket/WicketUtils.java49
-rw-r--r--src/com/gitblit/wicket/models/PathModel.java33
-rw-r--r--src/com/gitblit/wicket/models/RefModel.java28
-rw-r--r--src/com/gitblit/wicket/models/RepositoryModel.java4
-rw-r--r--src/com/gitblit/wicket/models/TicketModel.java32
-rw-r--r--src/com/gitblit/wicket/models/UserModel.java33
-rw-r--r--src/com/gitblit/wicket/pages/BlobDiffPage.java23
-rw-r--r--src/com/gitblit/wicket/pages/BlobPage.java24
-rw-r--r--src/com/gitblit/wicket/pages/CommitDiffPage.java29
-rw-r--r--src/com/gitblit/wicket/pages/CommitPage.java51
-rw-r--r--src/com/gitblit/wicket/pages/DocsPage.java18
-rw-r--r--src/com/gitblit/wicket/pages/EditRepositoryPage.java39
-rw-r--r--src/com/gitblit/wicket/pages/EditUserPage.java36
-rw-r--r--src/com/gitblit/wicket/pages/HistoryPage.java27
-rw-r--r--src/com/gitblit/wicket/pages/LogPage.java29
-rw-r--r--src/com/gitblit/wicket/pages/MarkdownPage.java15
-rw-r--r--src/com/gitblit/wicket/pages/PatchPage.java14
-rw-r--r--src/com/gitblit/wicket/pages/RawPage.java7
-rw-r--r--src/com/gitblit/wicket/pages/RepositoriesPage.java15
-rw-r--r--src/com/gitblit/wicket/pages/SearchPage.java31
-rw-r--r--src/com/gitblit/wicket/pages/SummaryPage.java42
-rw-r--r--src/com/gitblit/wicket/pages/TagPage.java15
-rw-r--r--src/com/gitblit/wicket/pages/TicketPage.java11
-rw-r--r--src/com/gitblit/wicket/pages/TicketsPage.java14
-rw-r--r--src/com/gitblit/wicket/pages/TreePage.java48
-rw-r--r--src/com/gitblit/wicket/panels/BasePanel.java8
-rw-r--r--src/com/gitblit/wicket/panels/BranchesPanel.java27
-rw-r--r--src/com/gitblit/wicket/panels/CommitHeaderPanel.java5
-rw-r--r--src/com/gitblit/wicket/panels/CommitLegendPanel.java11
-rw-r--r--src/com/gitblit/wicket/panels/HistoryPanel.java40
-rw-r--r--src/com/gitblit/wicket/panels/LogPanel.java44
-rw-r--r--src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java14
-rw-r--r--src/com/gitblit/wicket/panels/RefsPanel.java16
-rw-r--r--src/com/gitblit/wicket/panels/RepositoriesPanel.java91
-rw-r--r--src/com/gitblit/wicket/panels/SearchPanel.java34
-rw-r--r--src/com/gitblit/wicket/panels/TagsPanel.java43
-rw-r--r--src/com/gitblit/wicket/panels/UsersPanel.java16
45 files changed, 801 insertions, 456 deletions
diff --git a/src/com/gitblit/wicket/AuthorizationStrategy.java b/src/com/gitblit/wicket/AuthorizationStrategy.java
index 892153ec..42d25225 100644
--- a/src/com/gitblit/wicket/AuthorizationStrategy.java
+++ b/src/com/gitblit/wicket/AuthorizationStrategy.java
@@ -25,7 +25,8 @@ import com.gitblit.Keys;
import com.gitblit.wicket.models.UserModel;
import com.gitblit.wicket.pages.RepositoriesPage;
-public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements IUnauthorizedComponentInstantiationListener {
+public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements
+ IUnauthorizedComponentInstantiationListener {
public AuthorizationStrategy() {
}
@@ -34,16 +35,16 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp
@Override
protected boolean isPageAuthorized(Class pageClass) {
if (BasePage.class.isAssignableFrom(pageClass)) {
- boolean authenticateView = GitBlit.self().settings().getBoolean(Keys.web.authenticateViewPages, true);
- boolean authenticateAdmin = GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, true);
- boolean allowAdmin = GitBlit.self().settings().getBoolean(Keys.web.allowAdministration, true);
-
- GitBlitWebSession session = GitBlitWebSession.get();
+ boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
+ boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
+ boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);
+
+ GitBlitWebSession session = GitBlitWebSession.get();
if (authenticateView && !session.isLoggedIn()) {
// authentication required
return false;
}
-
+
UserModel user = session.getUser();
if (pageClass.isAnnotationPresent(AdminPage.class)) {
// admin page
@@ -51,7 +52,7 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp
if (authenticateAdmin) {
// authenticate admin
if (user != null) {
- return user.canAdmin();
+ return user.canAdmin;
}
return false;
} else {
@@ -59,7 +60,7 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp
return true;
}
} else {
- //admin prohibited
+ // admin prohibited
return false;
}
}
@@ -71,10 +72,11 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp
public void onUnauthorizedInstantiation(Component component) {
if (component instanceof BasePage) {
GitBlitWebSession session = GitBlitWebSession.get();
- if (!session.isLoggedIn())
+ if (!session.isLoggedIn()) {
throw new RestartResponseAtInterceptPageException(LoginPage.class);
- else
+ } else {
throw new RestartResponseAtInterceptPageException(RepositoriesPage.class);
+ }
}
}
}
diff --git a/src/com/gitblit/wicket/BasePage.java b/src/com/gitblit/wicket/BasePage.java
index d88ad404..2e4adfe3 100644
--- a/src/com/gitblit/wicket/BasePage.java
+++ b/src/com/gitblit/wicket/BasePage.java
@@ -57,22 +57,25 @@ public abstract class BasePage extends WebPage {
add(new Label("title", getServerName()));
}
// header
- String siteName = GitBlit.self().settings().getString(Keys.web.siteName, Constants.NAME);
+ String siteName = GitBlit.getString(Keys.web.siteName, Constants.NAME);
if (siteName == null || siteName.trim().length() == 0) {
siteName = Constants.NAME;
}
add(new Label("siteName", siteName));
- add(new LinkPanel("repositoryName", null, repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("repositoryName", null, repositoryName, SummaryPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
add(new Label("pageName", pageName));
// Feedback panel for info, warning, and non-fatal error messages
add(new FeedbackPanel("feedback"));
// footer
- if (GitBlit.self().settings().getBoolean(Keys.web.authenticateViewPages, true) || GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, true)) {
+ if (GitBlit.getBoolean(Keys.web.authenticateViewPages, true)
+ || GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {
if (GitBlitWebSession.get().isLoggedIn()) {
// logout
- add(new LinkPanel("userPanel", null, getString("gb.logout") + " " + GitBlitWebSession.get().getUser().toString(), LogoutPage.class));
+ add(new LinkPanel("userPanel", null, getString("gb.logout") + " "
+ + GitBlitWebSession.get().getUser().toString(), LogoutPage.class));
} else {
// login
add(new LinkPanel("userPanel", null, getString("gb.login"), LoginPage.class));
@@ -81,7 +84,7 @@ public abstract class BasePage extends WebPage {
add(new Label("userPanel", ""));
}
add(new Label("gbVersion", "v" + Constants.VERSION));
- if (GitBlit.self().settings().getBoolean(Keys.web.aggressiveHeapManagement, false)) {
+ if (GitBlit.getBoolean(Keys.web.aggressiveHeapManagement, false)) {
System.gc();
}
}
@@ -108,7 +111,8 @@ public abstract class BasePage extends WebPage {
}
protected TimeZone getTimeZone() {
- return GitBlit.self().settings().getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
+ return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get()
+ .getTimezone() : TimeZone.getDefault();
}
protected String getServerName() {
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.java b/src/com/gitblit/wicket/GitBlitWebApp.java
index 85a5bb55..f78bb0da 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.java
+++ b/src/com/gitblit/wicket/GitBlitWebApp.java
@@ -20,6 +20,7 @@ import org.apache.wicket.Page;
import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
+import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;
@@ -52,7 +53,8 @@ public class GitBlitWebApp extends WebApplication {
super.init();
// Setup page authorization mechanism
- boolean useAuthentication = GitBlit.self().settings().getBoolean(Keys.web.authenticateViewPages, false) || GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, false);
+ boolean useAuthentication = GitBlit.getBoolean(Keys.web.authenticateViewPages, false)
+ || GitBlit.getBoolean(Keys.web.authenticateAdminPages, false);
if (useAuthentication) {
AuthorizationStrategy authStrategy = new AuthorizationStrategy();
getSecuritySettings().setAuthorizationStrategy(authStrategy);
@@ -60,41 +62,48 @@ public class GitBlitWebApp extends WebApplication {
}
// Grab Browser info (like timezone, etc)
- if (GitBlit.self().settings().getBoolean(Keys.web.useClientTimezone, false)) {
+ if (GitBlit.getBoolean(Keys.web.useClientTimezone, false)) {
getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
}
// setup the standard gitweb-ish urls
- mount(new MixedParamUrlCodingStrategy("/summary", SummaryPage.class, new String[] { "r" }));
- mount(new MixedParamUrlCodingStrategy("/log", LogPage.class, new String[] { "r", "h" }));
- mount(new MixedParamUrlCodingStrategy("/tags", TagsPage.class, new String[] { "r" }));
- mount(new MixedParamUrlCodingStrategy("/branches", BranchesPage.class, new String[] { "r" }));
- mount(new MixedParamUrlCodingStrategy("/commit", CommitPage.class, new String[] { "r", "h" }));
- mount(new MixedParamUrlCodingStrategy("/tag", TagPage.class, new String[] { "r", "h" }));
- mount(new MixedParamUrlCodingStrategy("/tree", TreePage.class, new String[] { "r", "h", "f" }));
- mount(new MixedParamUrlCodingStrategy("/blob", BlobPage.class, new String[] { "r", "h", "f" }));
- mount(new MixedParamUrlCodingStrategy("/raw", RawPage.class, new String[] { "r", "h", "f" }));
- mount(new MixedParamUrlCodingStrategy("/blobdiff", BlobDiffPage.class, new String[] { "r", "h", "f" }));
- mount(new MixedParamUrlCodingStrategy("/commitdiff", CommitDiffPage.class, new String[] { "r", "h" }));
- mount(new MixedParamUrlCodingStrategy("/patch", PatchPage.class, new String[] { "r", "h", "f" }));
- mount(new MixedParamUrlCodingStrategy("/history", HistoryPage.class, new String[] { "r", "h", "f" }));
- mount(new MixedParamUrlCodingStrategy("/search", SearchPage.class, new String[] { }));
+ mount("/summary", SummaryPage.class, "r");
+ mount("/log", LogPage.class, "r", "h");
+ mount("/tags", TagsPage.class, "r");
+ mount("/branches", BranchesPage.class, "r");
+ mount("/commit", CommitPage.class, "r", "h");
+ mount("/tag", TagPage.class, "r", "h");
+ mount("/tree", TreePage.class, "r", "h", "f");
+ mount("/blob", BlobPage.class, "r", "h", "f");
+ mount("/raw", RawPage.class, "r", "h", "f");
+ mount("/blobdiff", BlobDiffPage.class, "r", "h", "f");
+ mount("/commitdiff", CommitDiffPage.class, "r", "h");
+ mount("/patch", PatchPage.class, "r", "h", "f");
+ mount("/history", HistoryPage.class, "r", "h", "f");
+ mount("/search", SearchPage.class);
// setup ticket urls
- mount(new MixedParamUrlCodingStrategy("/tickets", TicketsPage.class, new String[] { "r" }));
- mount(new MixedParamUrlCodingStrategy("/ticket", TicketPage.class, new String[] { "r", "h", "f" }));
+ mount("/tickets", TicketsPage.class, "r");
+ mount("/ticket", TicketPage.class, "r", "h", "f");
// setup the markdown urls
- mount(new MixedParamUrlCodingStrategy("/docs", DocsPage.class, new String[] { "r" }));
- mount(new MixedParamUrlCodingStrategy("/markdown", MarkdownPage.class, new String[] { "r", "h", "f" }));
-
+ mount("/docs", DocsPage.class, "r");
+ mount("/markdown", MarkdownPage.class, "r", "h", "f");
+
// setup login/logout urls, if we are using authentication
if (useAuthentication) {
- mount(new MixedParamUrlCodingStrategy("/login", LoginPage.class, new String[] {}));
- mount(new MixedParamUrlCodingStrategy("/logout", LogoutPage.class, new String[] {}));
+ mount("/login", LoginPage.class);
+ mount("/logout", LogoutPage.class);
}
}
+ private void mount(String location, Class<? extends WebPage> clazz, String... parameters) {
+ if (parameters == null) {
+ parameters = new String[] {};
+ }
+ mount(new MixedParamUrlCodingStrategy(location, clazz, parameters));
+ }
+
@Override
public Class<? extends Page> getHomePage() {
return RepositoriesPage.class;
@@ -107,8 +116,9 @@ public class GitBlitWebApp extends WebApplication {
@Override
public final String getConfigurationType() {
- if (GitBlit.self().isDebugMode())
+ if (GitBlit.self().isDebugMode()) {
return Application.DEVELOPMENT;
+ }
return Application.DEPLOYMENT;
}
diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties
index 0c4c350f..45e4503b 100644
--- a/src/com/gitblit/wicket/GitBlitWebApp.properties
+++ b/src/com/gitblit/wicket/GitBlitWebApp.properties
@@ -38,7 +38,6 @@ gb.tickets = tickets
gb.pageFirst = first
gb.pagePrevious prev
gb.pageNext = next
-gb.parent = parent
gb.head = HEAD
gb.blame = blame
gb.login = Login
@@ -67,18 +66,15 @@ gb.missingUsername = Missing Username
gb.edit = edit
gb.searchTypeTooltip = Select Search Type
gb.searchTooltip = Search Git:Blit
-gb.rename = rename
gb.delete = delete
gb.docs = docs
gb.accessRestriction = access restriction
gb.name = name
-gb.description = description
gb.enableTickets = enable tickets
gb.enableDocs = enable docs
gb.save = save
gb.showRemoteBranches = show remote branches
gb.editUsers = edit users
-gb.password = password
gb.confirmPassword = confirm password
gb.restrictedRepositories = restricted repositories
gb.canAdmin can admin
diff --git a/src/com/gitblit/wicket/GitBlitWebSession.java b/src/com/gitblit/wicket/GitBlitWebSession.java
index d39a25d8..6488695d 100644
--- a/src/com/gitblit/wicket/GitBlitWebSession.java
+++ b/src/com/gitblit/wicket/GitBlitWebSession.java
@@ -28,11 +28,11 @@ public final class GitBlitWebSession extends WebSession {
private static final long serialVersionUID = 1L;
- protected TimeZone timezone = null;
+ protected TimeZone timezone;
- private UserModel user = null;
-
- private String errorMessage = null;
+ private UserModel user;
+
+ private String errorMessage;
public GitBlitWebSession(Request request) {
super(request);
@@ -51,7 +51,7 @@ public final class GitBlitWebSession extends WebSession {
if (user == null) {
return false;
}
- return user.canAdmin();
+ return user.canAdmin;
}
public UserModel getUser() {
@@ -72,11 +72,11 @@ public final class GitBlitWebSession extends WebSession {
}
return timezone;
}
-
+
public void cacheErrorMessage(String message) {
this.errorMessage = message;
}
-
+
public String clearErrorMessage() {
String msg = errorMessage;
errorMessage = null;
diff --git a/src/com/gitblit/wicket/LinkPanel.java b/src/com/gitblit/wicket/LinkPanel.java
index 0909ec33..2700cf86 100644
--- a/src/com/gitblit/wicket/LinkPanel.java
+++ b/src/com/gitblit/wicket/LinkPanel.java
@@ -31,15 +31,18 @@ public class LinkPanel extends Panel {
private final IModel<String> labelModel;
- public LinkPanel(String wicketId, String linkCssClass, String label, Class<? extends WebPage> clazz) {
+ public LinkPanel(String wicketId, String linkCssClass, String label,
+ Class<? extends WebPage> clazz) {
this(wicketId, linkCssClass, new Model<String>(label), clazz, null);
}
-
- public LinkPanel(String wicketId, String linkCssClass, String label, Class<? extends WebPage> clazz, PageParameters parameters) {
+
+ public LinkPanel(String wicketId, String linkCssClass, String label,
+ Class<? extends WebPage> clazz, PageParameters parameters) {
this(wicketId, linkCssClass, new Model<String>(label), clazz, parameters);
}
- public LinkPanel(String wicketId, String linkCssClass, IModel<String> model, Class<? extends WebPage> clazz, PageParameters parameters) {
+ public LinkPanel(String wicketId, String linkCssClass, IModel<String> model,
+ Class<? extends WebPage> clazz, PageParameters parameters) {
super(wicketId);
this.labelModel = model;
Link<Void> link = null;
diff --git a/src/com/gitblit/wicket/LoginPage.java b/src/com/gitblit/wicket/LoginPage.java
index af1a23d8..87108787 100644
--- a/src/com/gitblit/wicket/LoginPage.java
+++ b/src/com/gitblit/wicket/LoginPage.java
@@ -39,7 +39,7 @@ public class LoginPage extends WebPage {
public LoginPage(PageParameters params) {
super(params);
- add(new Label("title", GitBlit.self().settings().getString(Keys.web.siteName, Constants.NAME)));
+ add(new Label("title", GitBlit.getString(Keys.web.siteName, Constants.NAME)));
add(new Label("name", Constants.NAME));
Form<Void> loginForm = new LoginForm("loginForm");
@@ -69,13 +69,14 @@ public class LoginPage extends WebPage {
char[] password = LoginPage.this.password.getObject().toCharArray();
UserModel user = GitBlit.self().authenticate(username, password);
- if (user == null)
+ if (user == null) {
error("Invalid username or password!");
- else
+ } else {
loginUser(user);
+ }
}
}
-
+
private void loginUser(UserModel user) {
if (user != null) {
// Set the user into the session
diff --git a/src/com/gitblit/wicket/RepositoryPage.java b/src/com/gitblit/wicket/RepositoryPage.java
index ed77c5c7..9d5253f0 100644
--- a/src/com/gitblit/wicket/RepositoryPage.java
+++ b/src/com/gitblit/wicket/RepositoryPage.java
@@ -21,6 +21,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.apache.wicket.Component;
import org.apache.wicket.PageParameters;
@@ -64,9 +65,9 @@ public abstract class RepositoryPage extends BasePage {
protected final String repositoryName;
protected final String objectId;
- private transient Repository r = null;
+ private transient Repository r;
- private RepositoryModel m = null;
+ private RepositoryModel m;
private final Logger logger = LoggerFactory.getLogger(RepositoryPage.class);
@@ -96,13 +97,18 @@ public abstract class RepositoryPage extends BasePage {
Repository r = getRepository();
RepositoryModel model = getRepositoryModel();
-
+
// standard page links
- add(new BookmarkablePageLink<Void>("summary", SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
- add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
- add(new BookmarkablePageLink<Void>("branches", BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
- add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
- add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new BookmarkablePageLink<Void>("summary", SummaryPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new BookmarkablePageLink<Void>("log", LogPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new BookmarkablePageLink<Void>("branches", BranchesPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new BookmarkablePageLink<Void>("tags", TagsPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new BookmarkablePageLink<Void>("tree", TreePage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
// per-repository extra page links
List<String> extraPageLinks = new ArrayList<String>();
@@ -118,15 +124,18 @@ public abstract class RepositoryPage extends BasePage {
}
final boolean showAdmin;
- if (GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, true)) {
- boolean allowAdmin = GitBlit.self().settings().getBoolean(Keys.web.allowAdministration, false);
+ if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {
+ boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
} else {
- showAdmin = GitBlit.self().settings().getBoolean(Keys.web.allowAdministration, false);
+ showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
}
-
+
// Conditionally add edit link
- if (showAdmin || GitBlitWebSession.get().isLoggedIn() && (model.owner != null && model.owner.equalsIgnoreCase(GitBlitWebSession.get().getUser().getUsername()))) {
+ if (showAdmin
+ || GitBlitWebSession.get().isLoggedIn()
+ && (model.owner != null && model.owner.equalsIgnoreCase(GitBlitWebSession.get()
+ .getUser().username))) {
extraPageLinks.add("edit");
}
@@ -138,13 +147,17 @@ public abstract class RepositoryPage extends BasePage {
String extra = item.getModelObject();
if (extra.equals("tickets")) {
item.add(new Label("extraSeparator", " | "));
- item.add(new LinkPanel("extraLink", null, getString("gb.tickets"), TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ item.add(new LinkPanel("extraLink", null, getString("gb.tickets"),
+ TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
} else if (extra.equals("docs")) {
item.add(new Label("extraSeparator", " | "));
- item.add(new LinkPanel("extraLink", null, getString("gb.docs"), DocsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ item.add(new LinkPanel("extraLink", null, getString("gb.docs"), DocsPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
} else if (extra.equals("edit")) {
item.add(new Label("extraSeparator", " | "));
- item.add(new LinkPanel("extraLink", null, getString("gb.edit"), EditRepositoryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ item.add(new LinkPanel("extraLink", null, getString("gb.edit"),
+ EditRepositoryPage.class, WicketUtils
+ .newRepositoryParameter(repositoryName)));
}
}
};
@@ -190,9 +203,10 @@ public abstract class RepositoryPage extends BasePage {
protected RepositoryModel getRepositoryModel() {
if (m == null) {
- RepositoryModel model = GitBlit.self().getRepositoryModel(GitBlitWebSession.get().getUser(), repositoryName);
+ RepositoryModel model = GitBlit.self().getRepositoryModel(
+ GitBlitWebSession.get().getUser(), repositoryName);
if (model == null) {
- error("Unauthorized access for repository " + repositoryName, true);
+ error("Unauthorized access for repository " + repositoryName, true);
return null;
}
m = model;
@@ -203,7 +217,8 @@ public abstract class RepositoryPage extends BasePage {
protected RevCommit getCommit() {
RevCommit commit = JGitUtils.getCommit(r, objectId);
if (commit == null) {
- error(MessageFormat.format("Failed to find commit \"{0}\" in {1} for {2} page!", objectId, repositoryName, getPageName()), true);
+ error(MessageFormat.format("Failed to find commit \"{0}\" in {1} for {2} page!",
+ objectId, repositoryName, getPageName()), true);
}
return commit;
}
@@ -217,29 +232,32 @@ public abstract class RepositoryPage extends BasePage {
if (substituteRegex) {
Map<String, String> map = new HashMap<String, String>();
// global regex keys
- if (GitBlit.self().settings().getBoolean(Keys.regex.global, false)) {
- for (String key : GitBlit.self().settings().getAllKeys(Keys.regex.global)) {
+ if (GitBlit.getBoolean(Keys.regex.global, false)) {
+ for (String key : GitBlit.getAllKeys(Keys.regex.global)) {
if (!key.equals(Keys.regex.global)) {
String subKey = key.substring(key.lastIndexOf('.') + 1);
- map.put(subKey, GitBlit.self().settings().getString(key, ""));
+ map.put(subKey, GitBlit.getString(key, ""));
}
}
}
// repository-specific regex keys
- List<String> keys = GitBlit.self().settings().getAllKeys(Keys.regex._ROOT + "." + repositoryName.toLowerCase());
+ List<String> keys = GitBlit.getAllKeys(Keys.regex._ROOT + "."
+ + repositoryName.toLowerCase());
for (String key : keys) {
String subKey = key.substring(key.lastIndexOf('.') + 1);
- map.put(subKey, GitBlit.self().settings().getString(key, ""));
+ map.put(subKey, GitBlit.getString(key, ""));
}
- for (String key : map.keySet()) {
- String definition = map.get(key).trim();
+ for (Entry<String, String> entry : map.entrySet()) {
+ String definition = entry.getValue().trim();
String[] chunks = definition.split("!!!");
if (chunks.length == 2) {
html = html.replaceAll(chunks[0], chunks[1]);
} else {
- logger.warn(key + " improperly formatted. Use !!! to separate match from replacement: " + definition);
+ logger.warn(entry.getKey()
+ + " improperly formatted. Use !!! to separate match from replacement: "
+ + definition);
}
}
}
@@ -248,9 +266,11 @@ public abstract class RepositoryPage extends BasePage {
protected abstract String getPageName();
- protected Component createPersonPanel(String wicketId, PersonIdent identity, SearchType searchType) {
- boolean showEmail = GitBlit.self().settings().getBoolean(Keys.web.showEmailAddresses, false);
- if (!showEmail || StringUtils.isEmpty(identity.getName()) || StringUtils.isEmpty(identity.getEmailAddress())) {
+ protected Component createPersonPanel(String wicketId, PersonIdent identity,
+ SearchType searchType) {
+ boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);
+ if (!showEmail || StringUtils.isEmpty(identity.getName())
+ || StringUtils.isEmpty(identity.getEmailAddress())) {
String value = identity.getName();
if (StringUtils.isEmpty(value)) {
if (showEmail) {
@@ -260,17 +280,23 @@ public abstract class RepositoryPage extends BasePage {
}
}
Fragment partial = new Fragment(wicketId, "partialPersonIdent", this);
- LinkPanel link = new LinkPanel("personName", "list", value, SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType));
+ LinkPanel link = new LinkPanel("personName", "list", value, SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType));
setPersonSearchTooltip(link, value, searchType);
partial.add(link);
return partial;
} else {
Fragment fullPerson = new Fragment(wicketId, "fullPersonIdent", this);
- LinkPanel nameLink = new LinkPanel("personName", "list", identity.getName(), SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, identity.getName(), searchType));
+ LinkPanel nameLink = new LinkPanel("personName", "list", identity.getName(),
+ SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
+ identity.getName(), searchType));
setPersonSearchTooltip(nameLink, identity.getName(), searchType);
fullPerson.add(nameLink);
- LinkPanel addressLink = new LinkPanel("personAddress", "list", "<" + identity.getEmailAddress() + ">", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, identity.getEmailAddress(), searchType));
+ LinkPanel addressLink = new LinkPanel("personAddress", "list", "<"
+ + identity.getEmailAddress() + ">", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId,
+ identity.getEmailAddress(), searchType));
setPersonSearchTooltip(addressLink, identity.getEmailAddress(), searchType);
fullPerson.add(addressLink);
return fullPerson;
@@ -331,7 +357,7 @@ public abstract class RepositoryPage extends BasePage {
return WicketUtils.newPathParameter(repositoryName, objectId, path);
}
- class SearchForm extends StatelessForm<Void> {
+ private static class SearchForm extends StatelessForm<Void> {
private static final long serialVersionUID = 1L;
private final String repositoryName;
@@ -343,9 +369,10 @@ public abstract class RepositoryPage extends BasePage {
public SearchForm(String id, String repositoryName) {
super(id);
this.repositoryName = repositoryName;
- DropDownChoice<SearchType> searchType = new DropDownChoice<SearchType>("searchType", Arrays.asList(SearchType.values()));
+ DropDownChoice<SearchType> searchType = new DropDownChoice<SearchType>("searchType",
+ Arrays.asList(SearchType.values()));
searchType.setModel(searchTypeModel);
- add(searchType.setVisible(GitBlit.self().settings().getBoolean(Keys.web.showSearchTypeSelection, false)));
+ add(searchType.setVisible(GitBlit.getBoolean(Keys.web.showSearchTypeSelection, false)));
TextField<String> searchBox = new TextField<String>("searchBox", searchBoxModel);
add(searchBox);
}
@@ -363,11 +390,13 @@ public abstract class RepositoryPage extends BasePage {
for (SearchType type : SearchType.values()) {
if (searchString.toLowerCase().startsWith(type.name().toLowerCase() + ":")) {
searchType = type;
- searchString = searchString.substring(type.name().toLowerCase().length() + 1).trim();
+ searchString = searchString.substring(type.name().toLowerCase().length() + 1)
+ .trim();
break;
}
}
- setResponsePage(SearchPage.class, WicketUtils.newSearchParameter(repositoryName, null, searchString, searchType));
+ setResponsePage(SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, null, searchString, searchType));
}
}
}
diff --git a/src/com/gitblit/wicket/WicketUtils.java b/src/com/gitblit/wicket/WicketUtils.java
index 3da990ba..ac31488c 100644
--- a/src/com/gitblit/wicket/WicketUtils.java
+++ b/src/com/gitblit/wicket/WicketUtils.java
@@ -117,7 +117,8 @@ public class WicketUtils {
return newImage(wicketId, "file_h_16x16.png");
} else if (filename.endsWith(".sln")) {
return newImage(wicketId, "file_vs_16x16.png");
- } else if (filename.endsWith(".csv") || filename.endsWith(".xls") || filename.endsWith(".xlsx")) {
+ } else if (filename.endsWith(".csv") || filename.endsWith(".xls")
+ || filename.endsWith(".xlsx")) {
return newImage(wicketId, "file_excel_16x16.png");
} else if (filename.endsWith(".doc") || filename.endsWith(".docx")) {
return newImage(wicketId, "file_word_16x16.png");
@@ -135,7 +136,7 @@ public class WicketUtils {
return newImage(wicketId, "file_settings_16x16.png");
}
- List<String> mdExtensions = GitBlit.self().settings().getStrings(Keys.web.markdownExtensions);
+ List<String> mdExtensions = GitBlit.getStrings(Keys.web.markdownExtensions);
for (String ext : mdExtensions) {
if (filename.endsWith('.' + ext.toLowerCase())) {
return newImage(wicketId, "file_world_16x16.png");
@@ -183,40 +184,50 @@ public class WicketUtils {
return new PageParameters("r=" + repositoryName + ",h=" + objectId);
}
- public static PageParameters newPathParameter(String repositoryName, String objectId, String path) {
+ public static PageParameters newPathParameter(String repositoryName, String objectId,
+ String path) {
if (StringUtils.isEmpty(path)) {
return newObjectParameter(repositoryName, objectId);
}
return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path);
}
- public static PageParameters newLogPageParameter(String repositoryName, String objectId, int pageNumber) {
+ public static PageParameters newLogPageParameter(String repositoryName, String objectId,
+ int pageNumber) {
if (pageNumber <= 1) {
return newObjectParameter(repositoryName, objectId);
}
return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",page=" + pageNumber);
}
- public static PageParameters newHistoryPageParameter(String repositoryName, String objectId, String path, int pageNumber) {
+ public static PageParameters newHistoryPageParameter(String repositoryName, String objectId,
+ String path, int pageNumber) {
if (pageNumber <= 1) {
return newObjectParameter(repositoryName, objectId);
}
- return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path + ",page=" + pageNumber);
+ return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path
+ + ",page=" + pageNumber);
}
- public static PageParameters newBlobDiffParameter(String repositoryName, String baseCommitId, String commitId, String path) {
- return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",f=" + path + ",hb=" + baseCommitId);
+ public static PageParameters newBlobDiffParameter(String repositoryName, String baseCommitId,
+ String commitId, String path) {
+ return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",f=" + path + ",hb="
+ + baseCommitId);
}
- public static PageParameters newSearchParameter(String repositoryName, String commitId, String search, SearchType type) {
+ public static PageParameters newSearchParameter(String repositoryName, String commitId,
+ String search, SearchType type) {
if (StringUtils.isEmpty(commitId)) {
return new PageParameters("r=" + repositoryName + ",s=" + search + ",st=" + type.name());
}
- return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",s=" + search + ",st=" + type.name());
+ return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",s=" + search
+ + ",st=" + type.name());
}
- public static PageParameters newSearchParameter(String repositoryName, String commitId, String search, SearchType type, int pageNumber) {
- return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",s=" + search + ",st=" + type.name() + ",page=" + pageNumber);
+ public static PageParameters newSearchParameter(String repositoryName, String commitId,
+ String search, SearchType type, int pageNumber) {
+ return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",s=" + search
+ + ",st=" + type.name() + ",page=" + pageNumber);
}
public static String getRepositoryName(PageParameters params) {
@@ -244,21 +255,23 @@ public class WicketUtils {
}
public static int getPage(PageParameters params) {
- return params.getInt("page", 1); // index from 1
+ // index from 1
+ return params.getInt("page", 1);
}
-
+
public static String getUsername(PageParameters params) {
return params.getString("user", "");
}
public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {
- DateFormat df = new SimpleDateFormat(GitBlit.self().settings().getString(Keys.web.datestampShortFormat, "MM/dd/yy"));
+ String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");
+ DateFormat df = new SimpleDateFormat(format);
if (timeZone != null) {
df.setTimeZone(timeZone);
}
String dateString = df.format(date);
String title = TimeUtils.timeAgo(date);
- if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000l) {
+ if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
String tmp = dateString;
dateString = title;
title = tmp;
@@ -270,7 +283,9 @@ public class WicketUtils {
}
public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone) {
- DateFormat df = new SimpleDateFormat(GitBlit.self().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy h:mm a z"));
+ String format = GitBlit.getString(Keys.web.datetimestampLongFormat,
+ "EEEE, MMMM d, yyyy h:mm a z");
+ DateFormat df = new SimpleDateFormat(format);
if (timeZone != null) {
df.setTimeZone(timeZone);
}
diff --git a/src/com/gitblit/wicket/models/PathModel.java b/src/com/gitblit/wicket/models/PathModel.java
index b9a47bf1..2edc96c9 100644
--- a/src/com/gitblit/wicket/models/PathModel.java
+++ b/src/com/gitblit/wicket/models/PathModel.java
@@ -49,12 +49,26 @@ public class PathModel implements Serializable, Comparable<PathModel> {
if (basePath.lastIndexOf('/') > -1) {
parentPath = basePath.substring(0, basePath.lastIndexOf('/'));
}
- PathModel model = new PathModel("..", parentPath, 0, 0040000, commitId);
+ PathModel model = new PathModel("..", parentPath, 0, 40000, commitId);
model.isParentPath = true;
return model;
}
@Override
+ public int hashCode() {
+ return commitId.hashCode() + path.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof PathModel) {
+ PathModel other = (PathModel) o;
+ return this.path.equals(other.path);
+ }
+ return super.equals(o);
+ }
+
+ @Override
public int compareTo(PathModel o) {
boolean isTree = isTree();
boolean otherTree = o.isTree();
@@ -69,14 +83,25 @@ public class PathModel implements Serializable, Comparable<PathModel> {
}
public static class PathChangeModel extends PathModel {
-
+
private static final long serialVersionUID = 1L;
-
+
public final ChangeType changeType;
- public PathChangeModel(String name, String path, long size, int mode, String commitId, ChangeType type) {
+ public PathChangeModel(String name, String path, long size, int mode, String commitId,
+ ChangeType type) {
super(name, path, size, mode, commitId);
this.changeType = type;
}
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return super.equals(o);
+ }
}
}
diff --git a/src/com/gitblit/wicket/models/RefModel.java b/src/com/gitblit/wicket/models/RefModel.java
index ab445931..e0831f5a 100644
--- a/src/com/gitblit/wicket/models/RefModel.java
+++ b/src/com/gitblit/wicket/models/RefModel.java
@@ -27,9 +27,9 @@ import com.gitblit.utils.JGitUtils;
public class RefModel implements Serializable, Comparable<RefModel> {
private static final long serialVersionUID = 1L;
- final String displayName;
- transient Ref ref;
- final RevCommit commit;
+ public final String displayName;
+ public final RevCommit commit;
+ public transient Ref ref;
public RefModel(String displayName, Ref ref, RevCommit commit) {
this.displayName = displayName;
@@ -41,18 +41,10 @@ public class RefModel implements Serializable, Comparable<RefModel> {
return JGitUtils.getCommitDate(commit);
}
- public String getDisplayName() {
- return displayName;
- }
-
public String getName() {
return ref.getName();
}
- public RevCommit getCommit() {
- return commit;
- }
-
public ObjectId getCommitId() {
return commit.getId();
}
@@ -71,6 +63,20 @@ public class RefModel implements Serializable, Comparable<RefModel> {
}
@Override
+ public int hashCode() {
+ return getCommitId().hashCode() + getName().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof RefModel) {
+ RefModel other = (RefModel) o;
+ return getName().equals(other.getName());
+ }
+ return super.equals(o);
+ }
+
+ @Override
public int compareTo(RefModel o) {
return getDate().compareTo(o.getDate());
}
diff --git a/src/com/gitblit/wicket/models/RepositoryModel.java b/src/com/gitblit/wicket/models/RepositoryModel.java
index b12f4a9d..575e64a5 100644
--- a/src/com/gitblit/wicket/models/RepositoryModel.java
+++ b/src/com/gitblit/wicket/models/RepositoryModel.java
@@ -23,6 +23,8 @@ import com.gitblit.Constants.AccessRestrictionType;
public class RepositoryModel implements Serializable {
private static final long serialVersionUID = 1L;
+
+ // field names are reflectively mapped in EditRepository page
public String name;
public String description;
public String owner;
@@ -49,7 +51,7 @@ public class RepositoryModel implements Serializable {
this.lastChange = lastchange;
this.accessRestriction = AccessRestrictionType.NONE;
}
-
+
@Override
public String toString() {
return name;
diff --git a/src/com/gitblit/wicket/models/TicketModel.java b/src/com/gitblit/wicket/models/TicketModel.java
index b5cd6894..b661c19a 100644
--- a/src/com/gitblit/wicket/models/TicketModel.java
+++ b/src/com/gitblit/wicket/models/TicketModel.java
@@ -51,7 +51,7 @@ public class TicketModel implements Serializable, Comparable<TicketModel> {
String[] chunks = name.split("_");
if (chunks.length == 3) {
- date = new Date(Long.parseLong(chunks[0]) * 1000l);
+ date = new Date(Long.parseLong(chunks[0]) * 1000L);
title = chunks[1].replace('-', ' ');
}
}
@@ -71,18 +71,46 @@ public class TicketModel implements Serializable, Comparable<TicketModel> {
public Comment(String filename, String content) throws ParseException {
String[] chunks = filename.split("_", -1);
- this.date = new Date(Long.parseLong(chunks[1]) * 1000l);
+ this.date = new Date(Long.parseLong(chunks[1]) * 1000L);
this.author = chunks[2];
this.text = content;
}
@Override
+ public int hashCode() {
+ return text.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof Comment) {
+ Comment other = (Comment) o;
+ return text.equals(other.text);
+ }
+ return super.equals(o);
+ }
+
+ @Override
public int compareTo(Comment o) {
return date.compareTo(o.date);
}
}
@Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof TicketModel) {
+ TicketModel other = (TicketModel) o;
+ return id.equals(other.id);
+ }
+ return super.equals(o);
+ }
+
+ @Override
public int compareTo(TicketModel o) {
return date.compareTo(o.date);
}
diff --git a/src/com/gitblit/wicket/models/UserModel.java b/src/com/gitblit/wicket/models/UserModel.java
index e60b4dac..1181ee15 100644
--- a/src/com/gitblit/wicket/models/UserModel.java
+++ b/src/com/gitblit/wicket/models/UserModel.java
@@ -23,35 +23,16 @@ public class UserModel implements Serializable {
private static final long serialVersionUID = 1L;
- private String username;
- private String password;
- private boolean canAdmin = false;
- private List<String> repositories = new ArrayList<String>();
+ // field names are reflectively mapped in EditUser page
+ public String username;
+ public String password;
+ public boolean canAdmin;
+ public final List<String> repositories = new ArrayList<String>();
public UserModel(String username) {
this.username = username;
}
- public String getUsername() {
- return username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public void canAdmin(boolean value) {
- canAdmin = value;
- }
-
- public boolean canAdmin() {
- return canAdmin;
- }
-
public boolean canAccessRepository(String repositoryName) {
return canAdmin || repositories.contains(repositoryName);
}
@@ -65,10 +46,6 @@ public class UserModel implements Serializable {
repositories.add(name.toLowerCase());
}
- public List<String> getRepositories() {
- return repositories;
- }
-
@Override
public String toString() {
return username;
diff --git a/src/com/gitblit/wicket/pages/BlobDiffPage.java b/src/com/gitblit/wicket/pages/BlobDiffPage.java
index 06cf219e..aae41ba4 100644
--- a/src/com/gitblit/wicket/pages/BlobDiffPage.java
+++ b/src/com/gitblit/wicket/pages/BlobDiffPage.java
@@ -41,27 +41,34 @@ public class BlobDiffPage extends RepositoryPage {
Repository r = getRepository();
RevCommit commit = getCommit();
-
- DiffOutputType diffType = DiffOutputType.forName(GitBlit.self().settings().getString(Keys.web.diffStyle, DiffOutputType.GITBLIT.name()));
+
+ DiffOutputType diffType = DiffOutputType.forName(GitBlit.getString(Keys.web.diffStyle,
+ DiffOutputType.GITBLIT.name()));
String diff;
if (StringUtils.isEmpty(baseObjectId)) {
// use first parent
diff = JGitUtils.getCommitDiff(r, commit, blobPath, diffType);
- add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
} else {
// base commit specified
RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
diff = JGitUtils.getCommitDiff(r, baseCommit, commit, blobPath, diffType);
- add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId, blobPath)));
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
+ WicketUtils.newBlobDiffParameter(repositoryName, baseObjectId, objectId,
+ blobPath)));
}
-
- add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
- add(new BookmarkablePageLink<Void>("commitDiffLink", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
+
+ add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
+ add(new BookmarkablePageLink<Void>("commitDiffLink", CommitDiffPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
// diff page links
add(new Label("blameLink", getString("gb.blame")));
- add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
+ add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
diff --git a/src/com/gitblit/wicket/pages/BlobPage.java b/src/com/gitblit/wicket/pages/BlobPage.java
index c425186f..23244c0a 100644
--- a/src/com/gitblit/wicket/pages/BlobPage.java
+++ b/src/com/gitblit/wicket/pages/BlobPage.java
@@ -45,24 +45,27 @@ public class BlobPage extends RepositoryPage {
if (blobPath.lastIndexOf('.') > -1) {
extension = blobPath.substring(blobPath.lastIndexOf('.') + 1).toLowerCase();
}
-
+
// see if we should redirect to the markdown page
- for (String ext : GitBlit.self().settings().getStrings(Keys.web.markdownExtensions)) {
+ for (String ext : GitBlit.getStrings(Keys.web.markdownExtensions)) {
if (ext.equals(extension)) {
setResponsePage(MarkdownPage.class, params);
return;
}
}
-
+
// standard blob view
Repository r = getRepository();
RevCommit commit = getCommit();
// blob page links
add(new Label("blameLink", getString("gb.blame")));
- add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
- add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
- add(new BookmarkablePageLink<Void>("headLink", BlobPage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, blobPath)));
+ add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
+ add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(
+ repositoryName, objectId, blobPath)));
+ add(new BookmarkablePageLink<Void>("headLink", BlobPage.class,
+ WicketUtils.newPathParameter(repositoryName, Constants.HEAD, blobPath)));
add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
@@ -70,13 +73,13 @@ public class BlobPage extends RepositoryPage {
// Map the extensions to types
Map<String, Integer> map = new HashMap<String, Integer>();
- for (String ext : GitBlit.self().settings().getStrings(Keys.web.prettyPrintExtensions)) {
+ for (String ext : GitBlit.getStrings(Keys.web.prettyPrintExtensions)) {
map.put(ext.toLowerCase(), 1);
}
- for (String ext : GitBlit.self().settings().getStrings(Keys.web.imageExtensions)) {
+ for (String ext : GitBlit.getStrings(Keys.web.imageExtensions)) {
map.put(ext.toLowerCase(), 2);
}
- for (String ext : GitBlit.self().settings().getStrings(Keys.web.binaryExtensions)) {
+ for (String ext : GitBlit.getStrings(Keys.web.binaryExtensions)) {
map.put(ext.toLowerCase(), 3);
}
@@ -108,7 +111,8 @@ public class BlobPage extends RepositoryPage {
add(c);
} else {
// plain text
- Label blobLabel = new Label("blobText", JGitUtils.getRawContentAsString(r, commit, blobPath));
+ Label blobLabel = new Label("blobText", JGitUtils.getRawContentAsString(r, commit,
+ blobPath));
WicketUtils.setCssClass(blobLabel, "plainprint");
add(blobLabel);
}
diff --git a/src/com/gitblit/wicket/pages/CommitDiffPage.java b/src/com/gitblit/wicket/pages/CommitDiffPage.java
index d7d54bb5..81ee520a 100644
--- a/src/com/gitblit/wicket/pages/CommitDiffPage.java
+++ b/src/com/gitblit/wicket/pages/CommitDiffPage.java
@@ -45,7 +45,8 @@ public class CommitDiffPage extends RepositoryPage {
Repository r = getRepository();
RevCommit commit = getCommit();
- DiffOutputType diffType = DiffOutputType.forName(GitBlit.self().settings().getString(Keys.web.diffStyle, DiffOutputType.GITBLIT.name()));
+ DiffOutputType diffType = DiffOutputType.forName(GitBlit.getString(Keys.web.diffStyle,
+ DiffOutputType.GITBLIT.name()));
String diff = JGitUtils.getCommitDiff(r, commit, diffType);
List<String> parents = new ArrayList<String>();
@@ -59,10 +60,13 @@ public class CommitDiffPage extends RepositoryPage {
if (parents.size() == 0) {
add(new Label("parentLink", "none"));
} else {
- add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitDiffPage.class, newCommitParameter(parents.get(0))));
+ add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8),
+ CommitDiffPage.class, newCommitParameter(parents.get(0))));
}
- add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
- add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
+ add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
@@ -72,7 +76,7 @@ public class CommitDiffPage extends RepositoryPage {
ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<PathChangeModel> item) {
final PathChangeModel entry = item.getModelObject();
@@ -82,15 +86,20 @@ public class CommitDiffPage extends RepositoryPage {
item.add(changeType);
if (entry.isTree()) {
- item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", null, entry.path, TreePage.class,
+ newPathParameter(entry.path)));
} else {
- item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class,
+ newPathParameter(entry.path)));
}
- item.add(new BookmarkablePageLink<Void>("patch", PatchPage.class, newPathParameter(entry.path)));
- item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));
+ item.add(new BookmarkablePageLink<Void>("patch", PatchPage.class,
+ newPathParameter(entry.path)));
+ item.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
+ newPathParameter(entry.path)));
item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
- item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, newPathParameter(entry.path)));
+ item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
+ newPathParameter(entry.path)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/pages/CommitPage.java b/src/com/gitblit/wicket/pages/CommitPage.java
index 140a2738..1a8f7c3c 100644
--- a/src/com/gitblit/wicket/pages/CommitPage.java
+++ b/src/com/gitblit/wicket/pages/CommitPage.java
@@ -61,10 +61,14 @@ public class CommitPage extends RepositoryPage {
add(new Label("parentLink", "none"));
add(new Label("commitdiffLink", getString("gb.commitdiff")));
} else {
- add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class, newCommitParameter(parents.get(0))));
- add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", this, null), CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
+ add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class,
+ newCommitParameter(parents.get(0))));
+ add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff",
+ this, null), CommitDiffPage.class, WicketUtils.newObjectParameter(
+ repositoryName, objectId)));
}
- add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));
+ add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId)));
add(new CommitHeaderPanel("commitHeader", repositoryName, c));
@@ -72,17 +76,22 @@ public class CommitPage extends RepositoryPage {
// author
add(createPersonPanel("commitAuthor", c.getAuthorIdent(), SearchType.AUTHOR));
- add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(), getTimeZone()));
+ add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(),
+ getTimeZone()));
// committer
add(createPersonPanel("commitCommitter", c.getCommitterIdent(), SearchType.COMMITTER));
- add(WicketUtils.createTimestampLabel("commitCommitterDate", c.getCommitterIdent().getWhen(), getTimeZone()));
+ add(WicketUtils.createTimestampLabel("commitCommitterDate",
+ c.getCommitterIdent().getWhen(), getTimeZone()));
add(new Label("commitId", c.getName()));
- add(new LinkPanel("commitTree", "list", c.getTree().getName(), TreePage.class, newCommitParameter()));
+ add(new LinkPanel("commitTree", "list", c.getTree().getName(), TreePage.class,
+ newCommitParameter()));
add(new BookmarkablePageLink<Void>("treeLink", TreePage.class, newCommitParameter()));
- add(new ExternalLink("zipLink", DownloadZipServlet.asLink(getRequest().getRelativePathPrefixToContextRoot(), repositoryName, objectId, null)).setVisible(GitBlit.self().settings().getBoolean(Keys.web.allowZipDownloads, true)));
+ add(new ExternalLink("zipLink", DownloadZipServlet.asLink(getRequest()
+ .getRelativePathPrefixToContextRoot(), repositoryName, objectId, null))
+ .setVisible(GitBlit.getBoolean(Keys.web.allowZipDownloads, true)));
// Parent Commits
ListDataProvider<String> parentsDp = new ListDataProvider<String>(parents);
@@ -91,9 +100,12 @@ public class CommitPage extends RepositoryPage {
public void populateItem(final Item<String> item) {
String entry = item.getModelObject();
- item.add(new LinkPanel("commitParent", "list", entry, CommitPage.class, newCommitParameter(entry)));
- item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, newCommitParameter(entry)));
- item.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class, newCommitParameter(entry)));
+ item.add(new LinkPanel("commitParent", "list", entry, CommitPage.class,
+ newCommitParameter(entry)));
+ item.add(new BookmarkablePageLink<Void>("view", CommitPage.class,
+ newCommitParameter(entry)));
+ item.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class,
+ newCommitParameter(entry)));
}
};
add(parentsView);
@@ -101,12 +113,12 @@ public class CommitPage extends RepositoryPage {
addFullText("fullMessage", c.getFullMessage(), true);
// changed paths list
- List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
+ List<PathChangeModel> paths = JGitUtils.getFilesInCommit(r, c);
add(new CommitLegendPanel("commitLegend", paths));
ListDataProvider<PathChangeModel> pathsDp = new ListDataProvider<PathChangeModel>(paths);
DataView<PathChangeModel> pathsView = new DataView<PathChangeModel>("changedPath", pathsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<PathChangeModel> item) {
final PathChangeModel entry = item.getModelObject();
@@ -115,15 +127,20 @@ public class CommitPage extends RepositoryPage {
setChangeTypeTooltip(changeType, entry.changeType);
item.add(changeType);
if (entry.isTree()) {
- item.add(new LinkPanel("pathName", null, entry.path, TreePage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", null, entry.path, TreePage.class,
+ newPathParameter(entry.path)));
} else {
- item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class,
+ newPathParameter(entry.path)));
}
- item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, newPathParameter(entry.path)));
- item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));
+ item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class,
+ newPathParameter(entry.path)));
+ item.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
+ newPathParameter(entry.path)));
item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
- item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, newPathParameter(entry.path)));
+ item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
+ newPathParameter(entry.path)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/pages/DocsPage.java b/src/com/gitblit/wicket/pages/DocsPage.java
index 96fffcaa..32b208a8 100644
--- a/src/com/gitblit/wicket/pages/DocsPage.java
+++ b/src/com/gitblit/wicket/pages/DocsPage.java
@@ -40,30 +40,34 @@ public class DocsPage extends RepositoryPage {
super(params);
Repository r = getRepository();
- List<String> extensions = GitBlit.self().settings().getStrings(Keys.web.markdownExtensions);
+ List<String> extensions = GitBlit.getStrings(Keys.web.markdownExtensions);
List<PathModel> paths = JGitUtils.getDocuments(r, extensions);
final ByteFormat byteFormat = new ByteFormat();
add(new Label("header", getString("gb.docs")));
-
+
// documents list
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
DataView<PathModel> pathsView = new DataView<PathModel>("document", pathsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<PathModel> item) {
PathModel entry = item.getModelObject();
item.add(WicketUtils.newImage("docIcon", "file_world_16x16.png"));
item.add(new Label("docSize", byteFormat.format(entry.size)));
- item.add(new LinkPanel("docName", "list", entry.name, BlobPage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("docName", "list", entry.name, BlobPage.class,
+ newPathParameter(entry.path)));
// links
- item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
- item.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
+ item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
+ .newPathParameter(repositoryName, entry.commitId, entry.path)));
+ item.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils
+ .newPathParameter(repositoryName, entry.commitId, entry.path)));
item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
- item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
+ item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils
+ .newPathParameter(repositoryName, entry.commitId, entry.path)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
index ffacec5d..2b5cb999 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -51,8 +51,8 @@ public class EditRepositoryPage extends BasePage {
private final boolean isCreate;
- private boolean isAdmin = false;
-
+ private boolean isAdmin;
+
public EditRepositoryPage() {
// create constructor
super();
@@ -72,7 +72,7 @@ public class EditRepositoryPage extends BasePage {
protected void setupPage(final RepositoryModel repositoryModel) {
// ensure this user can create or edit this repository
checkPermissions(repositoryModel);
-
+
List<String> repositoryUsers = new ArrayList<String>();
if (isCreate) {
super.setupPage("", getString("gb.newRepository"));
@@ -85,8 +85,11 @@ public class EditRepositoryPage extends BasePage {
}
final String oldName = repositoryModel.name;
- final Palette<String> usersPalette = new Palette<String>("users", new ListModel<String>(repositoryUsers), new CollectionModel<String>(GitBlit.self().getAllUsernames()), new ChoiceRenderer<String>("", ""), 10, false);
- CompoundPropertyModel<RepositoryModel> model = new CompoundPropertyModel<RepositoryModel>(repositoryModel);
+ final Palette<String> usersPalette = new Palette<String>("users", new ListModel<String>(
+ repositoryUsers), new CollectionModel<String>(GitBlit.self().getAllUsernames()),
+ new ChoiceRenderer<String>("", ""), 10, false);
+ CompoundPropertyModel<RepositoryModel> model = new CompoundPropertyModel<RepositoryModel>(
+ repositoryModel);
Form<RepositoryModel> form = new Form<RepositoryModel>("editForm", model) {
private static final long serialVersionUID = 1L;
@@ -112,7 +115,8 @@ public class EditRepositoryPage extends BasePage {
ok |= c == vc;
}
if (!ok) {
- error(MessageFormat.format("Illegal character ''{0}'' in repository name!", c));
+ error(MessageFormat.format(
+ "Illegal character ''{0}'' in repository name!", c));
return;
}
}
@@ -135,7 +139,8 @@ public class EditRepositoryPage extends BasePage {
repositoryUsers.add(users.next());
}
// ensure the owner is added to the user list
- if (repositoryModel.owner != null && !repositoryUsers.contains(repositoryModel.owner)) {
+ if (repositoryModel.owner != null
+ && !repositoryUsers.contains(repositoryModel.owner)) {
repositoryUsers.add(repositoryModel.owner);
}
GitBlit.self().setRepositoryUsers(repositoryModel, repositoryUsers);
@@ -152,8 +157,10 @@ public class EditRepositoryPage extends BasePage {
// field names reflective match RepositoryModel fields
form.add(new TextField<String>("name").setEnabled(isCreate || isAdmin));
form.add(new TextField<String>("description"));
- form.add(new DropDownChoice<String>("owner", GitBlit.self().getAllUsernames()).setEnabled(GitBlitWebSession.get().canAdmin()));
- form.add(new DropDownChoice<AccessRestrictionType>("accessRestriction", Arrays.asList(AccessRestrictionType.values()), new AccessRestrictionRenderer()));
+ form.add(new DropDownChoice<String>("owner", GitBlit.self().getAllUsernames())
+ .setEnabled(GitBlitWebSession.get().canAdmin()));
+ form.add(new DropDownChoice<AccessRestrictionType>("accessRestriction", Arrays
+ .asList(AccessRestrictionType.values()), new AccessRestrictionRenderer()));
form.add(new CheckBox("isFrozen"));
form.add(new CheckBox("useTickets"));
form.add(new CheckBox("useDocs"));
@@ -162,7 +169,7 @@ public class EditRepositoryPage extends BasePage {
add(form);
}
-
+
/**
* Unfortunately must repeat part of AuthorizaitonStrategy here because that
* mechanism does not take PageParameters into consideration, only page
@@ -171,8 +178,8 @@ public class EditRepositoryPage extends BasePage {
* Repository Owners should be able to edit their repository.
*/
private void checkPermissions(RepositoryModel model) {
- boolean authenticateAdmin = GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, true);
- boolean allowAdmin = GitBlit.self().settings().getBoolean(Keys.web.allowAdministration, true);
+ boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
+ boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, true);
GitBlitWebSession session = GitBlitWebSession.get();
UserModel user = session.getUser();
@@ -185,22 +192,22 @@ public class EditRepositoryPage extends BasePage {
}
if (isCreate) {
// Create Repository
- if (!user.canAdmin()) {
+ if (!user.canAdmin) {
// Only Administrators May Create
error("Only an administrator may create a repository", true);
}
} else {
// Edit Repository
- if (user.canAdmin()) {
+ if (user.canAdmin) {
// Admins can edit everything
isAdmin = true;
return;
} else {
- if (!model.owner.equalsIgnoreCase(user.getUsername())) {
+ if (!model.owner.equalsIgnoreCase(user.username)) {
// User is not an Admin nor Owner
error("Only an administrator or the owner may edit a repository", true);
}
- }
+ }
}
}
} else {
diff --git a/src/com/gitblit/wicket/pages/EditUserPage.java b/src/com/gitblit/wicket/pages/EditUserPage.java
index c772df55..1127ffb7 100644
--- a/src/com/gitblit/wicket/pages/EditUserPage.java
+++ b/src/com/gitblit/wicket/pages/EditUserPage.java
@@ -72,7 +72,8 @@ public class EditUserPage extends BasePage {
} else {
super.setupPage("", getString("gb.edit"));
}
- final Model<String> confirmPassword = new Model<String>(StringUtils.isEmpty(userModel.getPassword()) ? "" : userModel.getPassword());
+ final Model<String> confirmPassword = new Model<String>(
+ StringUtils.isEmpty(userModel.password) ? "" : userModel.password);
CompoundPropertyModel<UserModel> model = new CompoundPropertyModel<UserModel>(userModel);
List<String> repos = new ArrayList<String>();
@@ -82,8 +83,10 @@ public class EditUserPage extends BasePage {
repos.add(repo);
}
}
- final String oldName = userModel.getUsername();
- final Palette<String> repositories = new Palette<String>("repositories", new ListModel<String>(userModel.getRepositories()), new CollectionModel<String>(repos), new ChoiceRenderer<String>("", ""), 10, false);
+ final String oldName = userModel.username;
+ final Palette<String> repositories = new Palette<String>("repositories",
+ new ListModel<String>(userModel.repositories), new CollectionModel<String>(repos),
+ new ChoiceRenderer<String>("", ""), 10, false);
Form<UserModel> form = new Form<UserModel>("editForm", model) {
private static final long serialVersionUID = 1L;
@@ -95,7 +98,7 @@ public class EditUserPage extends BasePage {
*/
@Override
protected void onSubmit() {
- String username = userModel.getUsername();
+ String username = userModel.username;
if (StringUtils.isEmpty(username)) {
error("Please enter a username!");
return;
@@ -107,28 +110,31 @@ public class EditUserPage extends BasePage {
return;
}
}
- if (!userModel.getPassword().equals(confirmPassword.getObject())) {
+ if (!userModel.password.equals(confirmPassword.getObject())) {
error("Passwords do not match!");
return;
}
- String password = userModel.getPassword();
- if (!password.toUpperCase().startsWith(Crypt.__TYPE) && !password.toUpperCase().startsWith(MD5.__TYPE)) {
+ String password = userModel.password;
+ if (!password.toUpperCase().startsWith(Crypt.__TYPE)
+ && !password.toUpperCase().startsWith(MD5.__TYPE)) {
// This is a plain text password.
// Check length.
- int minLength = GitBlit.self().settings().getInteger(Keys.realm.minPasswordLength, 5);
+ int minLength = GitBlit.getInteger(Keys.realm.minPasswordLength, 5);
if (minLength < 4) {
minLength = 4;
}
if (password.trim().length() < minLength) {
- error(MessageFormat.format("Password is too short. Minimum length is {0} characters.", minLength));
+ error(MessageFormat.format(
+ "Password is too short. Minimum length is {0} characters.",
+ minLength));
return;
}
-
+
// Optionally store the password MD5 digest.
- String type = GitBlit.self().settings().getString(Keys.realm.passwordStorage, "md5");
+ String type = GitBlit.getString(Keys.realm.passwordStorage, "md5");
if (type.equalsIgnoreCase("md5")) {
// store MD5 digest of password
- userModel.setPassword(MD5.digest(userModel.getPassword()));
+ userModel.password = MD5.digest(userModel.password);
}
}
@@ -147,7 +153,8 @@ public class EditUserPage extends BasePage {
setRedirect(false);
if (isCreate) {
// create another user
- info(MessageFormat.format("New user ''{0}'' successfully created.", userModel.getUsername()));
+ info(MessageFormat.format("New user ''{0}'' successfully created.",
+ userModel.username));
setResponsePage(EditUserPage.class);
} else {
// back to home
@@ -161,7 +168,8 @@ public class EditUserPage extends BasePage {
PasswordTextField passwordField = new PasswordTextField("password");
passwordField.setResetPassword(false);
form.add(passwordField);
- PasswordTextField confirmPasswordField = new PasswordTextField("confirmPassword", confirmPassword);
+ PasswordTextField confirmPasswordField = new PasswordTextField("confirmPassword",
+ confirmPassword);
confirmPasswordField.setResetPassword(false);
form.add(confirmPasswordField);
form.add(new CheckBox("canAdmin"));
diff --git a/src/com/gitblit/wicket/pages/HistoryPage.java b/src/com/gitblit/wicket/pages/HistoryPage.java
index 290bb68b..e4f8f8d0 100644
--- a/src/com/gitblit/wicket/pages/HistoryPage.java
+++ b/src/com/gitblit/wicket/pages/HistoryPage.java
@@ -32,17 +32,30 @@ public class HistoryPage extends RepositoryPage {
int prevPage = Math.max(0, pageNumber - 1);
int nextPage = pageNumber + 1;
- HistoryPanel history = new HistoryPanel("historyPanel", repositoryName, objectId, path, getRepository(), -1, pageNumber - 1);
+ HistoryPanel history = new HistoryPanel("historyPanel", repositoryName, objectId, path,
+ getRepository(), -1, pageNumber - 1);
boolean hasMore = history.hasMore();
add(history);
- add(new BookmarkablePageLink<Void>("firstPageTop", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("prevPageTop", HistoryPage.class, WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("nextPageTop", HistoryPage.class, WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage)).setEnabled(hasMore));
+ add(new BookmarkablePageLink<Void>("firstPageTop", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, path))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("prevPageTop", HistoryPage.class,
+ WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("nextPageTop", HistoryPage.class,
+ WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage))
+ .setEnabled(hasMore));
- add(new BookmarkablePageLink<Void>("firstPageBottom", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("prevPageBottom", HistoryPage.class, WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("nextPageBottom", HistoryPage.class, WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage)).setEnabled(hasMore));
+ add(new BookmarkablePageLink<Void>("firstPageBottom", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, path))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("prevPageBottom", HistoryPage.class,
+ WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("nextPageBottom", HistoryPage.class,
+ WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage))
+ .setEnabled(hasMore));
}
diff --git a/src/com/gitblit/wicket/pages/LogPage.java b/src/com/gitblit/wicket/pages/LogPage.java
index fbc54b95..2554f7d6 100644
--- a/src/com/gitblit/wicket/pages/LogPage.java
+++ b/src/com/gitblit/wicket/pages/LogPage.java
@@ -30,17 +30,30 @@ public class LogPage extends RepositoryPage {
int pageNumber = WicketUtils.getPage(params);
int prevPage = Math.max(0, pageNumber - 1);
int nextPage = pageNumber + 1;
- LogPanel logPanel = new LogPanel("logPanel", repositoryName, objectId, getRepository(), -1, pageNumber - 1);
+ LogPanel logPanel = new LogPanel("logPanel", repositoryName, objectId, getRepository(), -1,
+ pageNumber - 1);
boolean hasMore = logPanel.hasMore();
add(logPanel);
- add(new BookmarkablePageLink<Void>("firstPageTop", LogPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("prevPageTop", LogPage.class, WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("nextPageTop", LogPage.class, WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage)).setEnabled(hasMore));
-
- add(new BookmarkablePageLink<Void>("firstPageBottom", LogPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("prevPageBottom", LogPage.class, WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("nextPageBottom", LogPage.class, WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage)).setEnabled(hasMore));
+ add(new BookmarkablePageLink<Void>("firstPageTop", LogPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("prevPageTop", LogPage.class,
+ WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("nextPageTop", LogPage.class,
+ WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage))
+ .setEnabled(hasMore));
+
+ add(new BookmarkablePageLink<Void>("firstPageBottom", LogPage.class,
+ WicketUtils.newObjectParameter(repositoryName, objectId))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("prevPageBottom", LogPage.class,
+ WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("nextPageBottom", LogPage.class,
+ WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage))
+ .setEnabled(hasMore));
}
@Override
diff --git a/src/com/gitblit/wicket/pages/MarkdownPage.java b/src/com/gitblit/wicket/pages/MarkdownPage.java
index 1ee61da4..d62c4330 100644
--- a/src/com/gitblit/wicket/pages/MarkdownPage.java
+++ b/src/com/gitblit/wicket/pages/MarkdownPage.java
@@ -30,7 +30,7 @@ import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
public class MarkdownPage extends RepositoryPage {
-
+
public MarkdownPage(PageParameters params) {
super(params);
@@ -41,11 +41,14 @@ public class MarkdownPage extends RepositoryPage {
// markdown page links
add(new Label("blameLink", getString("gb.blame")));
- add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));
- add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));
- add(new BookmarkablePageLink<Void>("headLink", MarkdownPage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, markdownPath)));
+ add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));
+ add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(
+ repositoryName, objectId, markdownPath)));
+ add(new BookmarkablePageLink<Void>("headLink", MarkdownPage.class,
+ WicketUtils.newPathParameter(repositoryName, Constants.HEAD, markdownPath)));
- // Read raw markdown content and transform it to html
+ // Read raw markdown content and transform it to html
String markdownText = JGitUtils.getRawContentAsString(r, commit, markdownPath);
String htmlText;
try {
@@ -54,7 +57,7 @@ public class MarkdownPage extends RepositoryPage {
error(p.getMessage());
htmlText = markdownText;
}
-
+
// Add the html to the page
add(new Label("markdownText", htmlText).setEscapeModelStrings(false));
}
diff --git a/src/com/gitblit/wicket/pages/PatchPage.java b/src/com/gitblit/wicket/pages/PatchPage.java
index 9d032cad..02e4d386 100644
--- a/src/com/gitblit/wicket/pages/PatchPage.java
+++ b/src/com/gitblit/wicket/pages/PatchPage.java
@@ -37,7 +37,7 @@ public class PatchPage extends WebPage {
redirectToInterceptPage(new RepositoriesPage());
return;
}
-
+
final String repositoryName = WicketUtils.getRepositoryName(params);
final String baseObjectId = WicketUtils.getBaseObjectId(params);
final String objectId = WicketUtils.getObject(params);
@@ -56,14 +56,12 @@ public class PatchPage extends WebPage {
redirectToInterceptPage(new RepositoriesPage());
return;
}
-
- String patch;
- if (StringUtils.isEmpty(baseObjectId)) {
- patch = JGitUtils.getCommitPatch(r, commit, blobPath);
- } else {
- RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId);
- patch = JGitUtils.getCommitPatch(r, baseCommit, commit, blobPath);
+
+ RevCommit baseCommit = null;
+ if (!StringUtils.isEmpty(baseObjectId)) {
+ baseCommit = JGitUtils.getCommit(r, baseObjectId);
}
+ String patch = JGitUtils.getCommitPatch(r, baseCommit, commit, blobPath);
add(new Label("patchText", patch));
r.close();
}
diff --git a/src/com/gitblit/wicket/pages/RawPage.java b/src/com/gitblit/wicket/pages/RawPage.java
index 944bb2cb..acda03af 100644
--- a/src/com/gitblit/wicket/pages/RawPage.java
+++ b/src/com/gitblit/wicket/pages/RawPage.java
@@ -59,10 +59,10 @@ public class RawPage extends WebPage {
// Map the extensions to types
Map<String, Integer> map = new HashMap<String, Integer>();
- for (String ext : GitBlit.self().settings().getStrings(Keys.web.imageExtensions)) {
+ for (String ext : GitBlit.getStrings(Keys.web.imageExtensions)) {
map.put(ext.toLowerCase(), 2);
}
- for (String ext : GitBlit.self().settings().getStrings(Keys.web.binaryExtensions)) {
+ for (String ext : GitBlit.getStrings(Keys.web.binaryExtensions)) {
map.put(ext.toLowerCase(), 3);
}
@@ -89,7 +89,8 @@ public class RawPage extends WebPage {
add(c);
} else {
// plain text
- Label blobLabel = new Label("rawText", JGitUtils.getRawContentAsString(r, commit, blobPath));
+ Label blobLabel = new Label("rawText", JGitUtils.getRawContentAsString(r, commit,
+ blobPath));
WicketUtils.setCssClass(blobLabel, "plainprint");
add(blobLabel);
}
diff --git a/src/com/gitblit/wicket/pages/RepositoriesPage.java b/src/com/gitblit/wicket/pages/RepositoriesPage.java
index 792fd954..2bb818da 100644
--- a/src/com/gitblit/wicket/pages/RepositoriesPage.java
+++ b/src/com/gitblit/wicket/pages/RepositoriesPage.java
@@ -41,14 +41,14 @@ public class RepositoriesPage extends BasePage {
setupPage("", "");
final boolean showAdmin;
- if (GitBlit.self().settings().getBoolean(Keys.web.authenticateAdminPages, true)) {
- boolean allowAdmin = GitBlit.self().settings().getBoolean(Keys.web.allowAdministration, false);
+ if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {
+ boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
// authentication requires state and session
setStatelessHint(false);
} else {
- showAdmin = GitBlit.self().settings().getBoolean(Keys.web.allowAdministration, false);
- if (GitBlit.self().settings().getBoolean(Keys.web.authenticateViewPages, false)) {
+ showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
+ if (GitBlit.getBoolean(Keys.web.authenticateViewPages, false)) {
// authentication requires state and session
setStatelessHint(false);
} else {
@@ -64,7 +64,7 @@ public class RepositoriesPage extends BasePage {
}
// Load the markdown welcome message
- String messageSource = GitBlit.self().settings().getString(Keys.web.repositoriesMessage, "gitblit");
+ String messageSource = GitBlit.getString(Keys.web.repositoriesMessage, "gitblit");
String message = "<br/>";
if (messageSource.equalsIgnoreCase("gitblit")) {
// Read default welcome message
@@ -94,9 +94,10 @@ public class RepositoriesPage extends BasePage {
}
}
}
- Component repositoriesMessage = new Label("repositoriesMessage", message).setEscapeModelStrings(false);
+ Component repositoriesMessage = new Label("repositoriesMessage", message)
+ .setEscapeModelStrings(false);
add(repositoriesMessage);
- add(new RepositoriesPanel("repositoriesPanel", showAdmin, getAccessRestrictions()));
+ add(new RepositoriesPanel("repositoriesPanel", showAdmin, getAccessRestrictions()));
add(new UsersPanel("usersPanel", showAdmin).setVisible(showAdmin));
}
}
diff --git a/src/com/gitblit/wicket/pages/SearchPage.java b/src/com/gitblit/wicket/pages/SearchPage.java
index 730d32d6..b12beee3 100644
--- a/src/com/gitblit/wicket/pages/SearchPage.java
+++ b/src/com/gitblit/wicket/pages/SearchPage.java
@@ -24,29 +24,42 @@ import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.SearchPanel;
public class SearchPage extends RepositoryPage {
-
+
public SearchPage(PageParameters params) {
super(params);
String value = WicketUtils.getSearchString(params);
String type = WicketUtils.getSearchType(params);
SearchType searchType = SearchType.forName(type);
-
+
int pageNumber = WicketUtils.getPage(params);
int prevPage = Math.max(0, pageNumber - 1);
int nextPage = pageNumber + 1;
- SearchPanel search = new SearchPanel("searchPanel", repositoryName, objectId, value, searchType, getRepository(), -1, pageNumber - 1);
+ SearchPanel search = new SearchPanel("searchPanel", repositoryName, objectId, value,
+ searchType, getRepository(), -1, pageNumber - 1);
boolean hasMore = search.hasMore();
add(search);
- add(new BookmarkablePageLink<Void>("firstPageTop", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("prevPageTop", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType, prevPage)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("nextPageTop", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType, nextPage)).setEnabled(hasMore));
+ add(new BookmarkablePageLink<Void>("firstPageTop", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("prevPageTop", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
+ prevPage)).setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("nextPageTop", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
+ nextPage)).setEnabled(hasMore));
- add(new BookmarkablePageLink<Void>("firstPageBottom", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("prevPageBottom", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType, prevPage)).setEnabled(pageNumber > 1));
- add(new BookmarkablePageLink<Void>("nextPageBottom", SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType, nextPage)).setEnabled(hasMore));
+ add(new BookmarkablePageLink<Void>("firstPageBottom", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))
+ .setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("prevPageBottom", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
+ prevPage)).setEnabled(pageNumber > 1));
+ add(new BookmarkablePageLink<Void>("nextPageBottom", SearchPage.class,
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,
+ nextPage)).setEnabled(hasMore));
}
diff --git a/src/com/gitblit/wicket/pages/SummaryPage.java b/src/com/gitblit/wicket/pages/SummaryPage.java
index f1c76fc5..835b344a 100644
--- a/src/com/gitblit/wicket/pages/SummaryPage.java
+++ b/src/com/gitblit/wicket/pages/SummaryPage.java
@@ -60,12 +60,12 @@ public class SummaryPage extends RepositoryPage {
int numCommitsDef = 20;
int numRefsDef = 5;
- int numberCommits = GitBlit.self().settings().getInteger(Keys.web.summaryCommitCount, numCommitsDef);
+ int numberCommits = GitBlit.getInteger(Keys.web.summaryCommitCount, numCommitsDef);
if (numberCommits <= 0) {
numberCommits = numCommitsDef;
}
- int numberRefs = GitBlit.self().settings().getInteger(Keys.web.summaryRefsCount, numRefsDef);
+ int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, numRefsDef);
if (numberRefs <= 0) {
numberRefs = numRefsDef;
}
@@ -73,7 +73,7 @@ public class SummaryPage extends RepositoryPage {
Repository r = getRepository();
List<Metric> metrics = null;
Metric metricsTotal = null;
- if (GitBlit.self().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
+ if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
metrics = JGitUtils.getDateMetrics(r);
metricsTotal = metrics.remove(0);
}
@@ -82,40 +82,48 @@ public class SummaryPage extends RepositoryPage {
add(new Label("repositoryDescription", getRepositoryModel().description));
add(new Label("repositoryOwner", getRepositoryModel().owner));
- add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r), getTimeZone()));
+ add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r),
+ getTimeZone()));
if (metricsTotal == null) {
add(new Label("repositoryStats", ""));
} else {
- add(new Label("repositoryStats", MessageFormat.format("{0} commits and {1} tags in {2}", metricsTotal.count, metricsTotal.tag, TimeUtils.duration(metricsTotal.duration))));
+ add(new Label("repositoryStats", MessageFormat.format(
+ "{0} commits and {1} tags in {2}", metricsTotal.count, metricsTotal.tag,
+ TimeUtils.duration(metricsTotal.duration))));
}
List<String> repositoryUrls = new ArrayList<String>();
- if (GitBlit.self().settings().getBoolean(Keys.git.enableGitServlet, true)) {
+ if (GitBlit.getBoolean(Keys.git.enableGitServlet, true)) {
AccessRestrictionType accessRestriction = getRepositoryModel().accessRestriction;
switch (accessRestriction) {
case NONE:
add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
break;
case PUSH:
- add(WicketUtils.newImage("accessRestrictionIcon", "lock_go_16x16.png", getAccessRestrictions().get(accessRestriction)));
+ add(WicketUtils.newImage("accessRestrictionIcon", "lock_go_16x16.png",
+ getAccessRestrictions().get(accessRestriction)));
break;
case CLONE:
- add(WicketUtils.newImage("accessRestrictionIcon", "lock_pull_16x16.png", getAccessRestrictions().get(accessRestriction)));
+ add(WicketUtils.newImage("accessRestrictionIcon", "lock_pull_16x16.png",
+ getAccessRestrictions().get(accessRestriction)));
break;
case VIEW:
- add(WicketUtils.newImage("accessRestrictionIcon", "shield_16x16.png", getAccessRestrictions().get(accessRestriction)));
+ add(WicketUtils.newImage("accessRestrictionIcon", "shield_16x16.png",
+ getAccessRestrictions().get(accessRestriction)));
break;
default:
add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
}
- HttpServletRequest req = ((WebRequest) getRequestCycle().getRequest()).getHttpServletRequest();
+ HttpServletRequest req = ((WebRequest) getRequestCycle().getRequest())
+ .getHttpServletRequest();
StringBuilder sb = new StringBuilder();
sb.append(req.getScheme());
sb.append("://");
sb.append(req.getServerName());
- if ((req.getScheme().equals("http") && req.getServerPort() != 80) || (req.getScheme().equals("https") && req.getServerPort() != 443)) {
+ if ((req.getScheme().equals("http") && req.getServerPort() != 80)
+ || (req.getScheme().equals("https") && req.getServerPort() != 443)) {
sb.append(":" + req.getServerPort());
}
sb.append(Constants.GIT_SERVLET_PATH);
@@ -126,7 +134,8 @@ public class SummaryPage extends RepositoryPage {
}
repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName));
- add(new Label("repositoryCloneUrl", StringUtils.flattenStrings(repositoryUrls, "<br/>")).setEscapeModelStrings(false));
+ add(new Label("repositoryCloneUrl", StringUtils.flattenStrings(repositoryUrls, "<br/>"))
+ .setEscapeModelStrings(false));
add(new LogPanel("commitsPanel", repositoryName, null, r, numberCommits, 0));
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs));
@@ -142,12 +151,15 @@ public class SummaryPage extends RepositoryPage {
}
private void insertActivityGraph(List<Metric> metrics) {
- if (metrics.size() > 0 && GitBlit.self().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
+ if ((metrics != null) && (metrics.size() > 0)
+ && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
IChartData data = getChartData(metrics);
- ChartProvider provider = new ChartProvider(new Dimension(400, 100), ChartType.LINE, data);
+ ChartProvider provider = new ChartProvider(new Dimension(400, 100), ChartType.LINE,
+ data);
ChartAxis dateAxis = new ChartAxis(ChartAxisType.BOTTOM);
- dateAxis.setLabels(new String[] { metrics.get(0).name, metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
+ dateAxis.setLabels(new String[] { metrics.get(0).name,
+ metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name });
provider.addAxis(dateAxis);
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT);
diff --git a/src/com/gitblit/wicket/pages/TagPage.java b/src/com/gitblit/wicket/pages/TagPage.java
index 81cf1290..ff02b7bc 100644
--- a/src/com/gitblit/wicket/pages/TagPage.java
+++ b/src/com/gitblit/wicket/pages/TagPage.java
@@ -48,16 +48,21 @@ public class TagPage extends RepositoryPage {
if (tagRef == null) {
// point to commit
- add(new LinkPanel("commit", "title", c.getShortMessage(), CommitPage.class, newCommitParameter()));
- add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName())));
+ add(new LinkPanel("commit", "title", c.getShortMessage(), CommitPage.class,
+ newCommitParameter()));
+ add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class,
+ newCommitParameter(c.getName())));
} else {
// TODO commit or tree or blob?
- add(new LinkPanel("commit", "title", tagRef.getDisplayName(), CommitPage.class, newCommitParameter()));
- add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName())));
+ add(new LinkPanel("commit", "title", tagRef.displayName, CommitPage.class,
+ newCommitParameter()));
+ add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class,
+ newCommitParameter(c.getName())));
}
add(createPersonPanel("tagAuthor", c.getAuthorIdent(), SearchType.AUTHOR));
- add(WicketUtils.createTimestampLabel("tagDate", c.getAuthorIdent().getWhen(), getTimeZone()));
+ add(WicketUtils
+ .createTimestampLabel("tagDate", c.getAuthorIdent().getWhen(), getTimeZone()));
addFullText("fullMessage", c.getFullMessage(), true);
}
diff --git a/src/com/gitblit/wicket/pages/TicketPage.java b/src/com/gitblit/wicket/pages/TicketPage.java
index 393d99fc..9c8c3926 100644
--- a/src/com/gitblit/wicket/pages/TicketPage.java
+++ b/src/com/gitblit/wicket/pages/TicketPage.java
@@ -52,13 +52,15 @@ public class TicketPage extends RepositoryPage {
ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);
DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<Comment> item) {
final Comment entry = item.getModelObject();
- item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone()));
+ item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession
+ .get().getTimezone()));
item.add(new Label("commentAuthor", entry.author.toLowerCase()));
- item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false));
+ item.add(new Label("commentText", prepareComment(entry.text))
+ .setEscapeModelStrings(false));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
@@ -74,6 +76,7 @@ public class TicketPage extends RepositoryPage {
private String prepareComment(String comment) {
String html = StringUtils.escapeForHtml(comment, false);
html = StringUtils.breakLinesForHtml(comment).trim();
- return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "<a href=\"/commit/" + repositoryName + "/$1\">commit $1</a>");
+ return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "<a href=\"/commit/"
+ + repositoryName + "/$1\">commit $1</a>");
}
}
diff --git a/src/com/gitblit/wicket/pages/TicketsPage.java b/src/com/gitblit/wicket/pages/TicketsPage.java
index 74607e39..2832385c 100644
--- a/src/com/gitblit/wicket/pages/TicketsPage.java
+++ b/src/com/gitblit/wicket/pages/TicketsPage.java
@@ -39,21 +39,25 @@ public class TicketsPage extends RepositoryPage {
List<TicketModel> tickets = JGitUtils.getTickets(getRepository());
// header
- add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
+ newRepositoryParameter()));
ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<TicketModel> item) {
final TicketModel entry = item.getModelObject();
Label stateLabel = new Label("ticketState", entry.state);
WicketUtils.setTicketCssClass(stateLabel, entry.state);
item.add(stateLabel);
- item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));
- item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30)));
- item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
+ item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession
+ .get().getTimezone()));
+ item.add(new Label("ticketHandler", StringUtils.trimString(
+ entry.handler.toLowerCase(), 30)));
+ item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(
+ entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/pages/TreePage.java b/src/com/gitblit/wicket/pages/TreePage.java
index 10da7eb3..761b82e0 100644
--- a/src/com/gitblit/wicket/pages/TreePage.java
+++ b/src/com/gitblit/wicket/pages/TreePage.java
@@ -53,9 +53,13 @@ public class TreePage extends RepositoryPage {
List<PathModel> paths = JGitUtils.getFilesInPath(r, path, commit);
// tree page links
- add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)));
- add(new BookmarkablePageLink<Void>("headLink", TreePage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, path)));
- add(new ExternalLink("zipLink", DownloadZipServlet.asLink(getRequest().getRelativePathPrefixToContextRoot(), repositoryName, objectId, path)).setVisible(GitBlit.self().settings().getBoolean(Keys.web.allowZipDownloads, true)));
+ add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, path)));
+ add(new BookmarkablePageLink<Void>("headLink", TreePage.class,
+ WicketUtils.newPathParameter(repositoryName, Constants.HEAD, path)));
+ add(new ExternalLink("zipLink", DownloadZipServlet.asLink(getRequest()
+ .getRelativePathPrefixToContextRoot(), repositoryName, objectId, path))
+ .setVisible(GitBlit.getBoolean(Keys.web.allowZipDownloads, true)));
add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
@@ -71,7 +75,7 @@ public class TreePage extends RepositoryPage {
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);
DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<PathModel> item) {
PathModel entry = item.getModelObject();
@@ -80,33 +84,49 @@ public class TreePage extends RepositoryPage {
// parent .. path
item.add(WicketUtils.newBlankImage("pathIcon"));
item.add(new Label("pathSize", ""));
- item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", null, entry.name, TreePage.class,
+ newPathParameter(entry.path)));
item.add(new Label("pathLinks", ""));
} else {
if (entry.isTree()) {
// folder/tree link
item.add(WicketUtils.newImage("pathIcon", "folder_16x16.png"));
item.add(new Label("pathSize", ""));
- item.add(new LinkPanel("pathName", "list", entry.name, TreePage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", "list", entry.name, TreePage.class,
+ newPathParameter(entry.path)));
// links
Fragment links = new Fragment("pathLinks", "treeLinks", this);
- links.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
- links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
- links.add(new ExternalLink("zip", DownloadZipServlet.asLink(getRequest().getRelativePathPrefixToContextRoot(), repositoryName, objectId, entry.path)).setVisible(GitBlit.self().settings().getBoolean(Keys.web.allowZipDownloads, true)));
+ links.add(new BookmarkablePageLink<Void>("tree", TreePage.class,
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
+ links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
+ links.add(new ExternalLink("zip", DownloadZipServlet.asLink(getRequest()
+ .getRelativePathPrefixToContextRoot(), repositoryName, objectId,
+ entry.path)).setVisible(GitBlit.getBoolean(
+ Keys.web.allowZipDownloads, true)));
item.add(links);
} else {
// blob link
item.add(WicketUtils.getFileImage("pathIcon", entry.name));
item.add(new Label("pathSize", byteFormat.format(entry.size)));
- item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class, newPathParameter(entry.path)));
+ item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class,
+ newPathParameter(entry.path)));
// links
Fragment links = new Fragment("pathLinks", "blobLinks", this);
- links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
- links.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
- links.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));
- links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));
+ links.add(new BookmarkablePageLink<Void>("view", BlobPage.class,
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
+ links.add(new BookmarkablePageLink<Void>("raw", RawPage.class, WicketUtils
+ .newPathParameter(repositoryName, entry.commitId, entry.path)));
+ links.add(new BookmarkablePageLink<Void>("blame", BlobPage.class)
+ .setEnabled(false));
+ links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, entry.commitId,
+ entry.path)));
item.add(links);
}
}
diff --git a/src/com/gitblit/wicket/panels/BasePanel.java b/src/com/gitblit/wicket/panels/BasePanel.java
index a527833f..02789fb4 100644
--- a/src/com/gitblit/wicket/panels/BasePanel.java
+++ b/src/com/gitblit/wicket/panels/BasePanel.java
@@ -37,7 +37,8 @@ public abstract class BasePanel extends Panel {
}
protected TimeZone getTimeZone() {
- return GitBlit.self().settings().getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
+ return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get()
+ .getTimezone() : TimeZone.getDefault();
}
protected void setPersonSearchTooltip(Component component, String value, SearchType searchType) {
@@ -48,7 +49,7 @@ public abstract class BasePanel extends Panel {
}
}
- public class JavascriptEventConfirmation extends AttributeModifier {
+ public static class JavascriptEventConfirmation extends AttributeModifier {
private static final long serialVersionUID = 1L;
@@ -57,7 +58,8 @@ public abstract class BasePanel extends Panel {
}
protected String newValue(final String currentValue, final String replacementValue) {
- String prefix = "var conf = confirm('" + replacementValue + "'); " + "if (!conf) return false; ";
+ String prefix = "var conf = confirm('" + replacementValue + "'); "
+ + "if (!conf) return false; ";
String result = prefix;
if (currentValue != null) {
result = prefix + currentValue;
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java
index 70fc5ba4..357c7c2c 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -43,7 +43,8 @@ public class BranchesPanel extends BasePanel {
private static final long serialVersionUID = 1L;
- public BranchesPanel(String wicketId, final RepositoryModel model, Repository r, final int maxCount) {
+ public BranchesPanel(String wicketId, final RepositoryModel model, Repository r,
+ final int maxCount) {
super(wicketId);
// branches
@@ -61,31 +62,38 @@ public class BranchesPanel extends BasePanel {
if (maxCount > 0) {
// summary page
// show branches page link
- add(new LinkPanel("branches", "title", new StringResourceModel("gb.branches", this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
+ add(new LinkPanel("branches", "title", new StringResourceModel("gb.branches", this,
+ null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
} else {
// branches page
// show repository summary page link
- add(new LinkPanel("branches", "title", model.name, SummaryPage.class, WicketUtils.newRepositoryParameter(model.name)));
+ add(new LinkPanel("branches", "title", model.name, SummaryPage.class,
+ WicketUtils.newRepositoryParameter(model.name)));
}
ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<RefModel> item) {
final RefModel entry = item.getModelObject();
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), getTimeZone()));
- item.add(new LinkPanel("branchName", "list name", StringUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newObjectParameter(model.name, entry.getName())));
+ item.add(new LinkPanel("branchName", "list name", StringUtils.trimString(
+ entry.displayName, 28), LogPage.class, WicketUtils.newObjectParameter(
+ model.name, entry.getName())));
// only show branch type on the branches page
boolean remote = entry.getName().startsWith(Constants.R_REMOTES);
- item.add(new Label("branchType", remote ? getString("gb.remote") : getString("gb.local")).setVisible(maxCount <= 0));
+ item.add(new Label("branchType", remote ? getString("gb.remote")
+ : getString("gb.local")).setVisible(maxCount <= 0));
- item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newObjectParameter(model.name, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(model.name, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
+ .newObjectParameter(model.name, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
+ .newObjectParameter(model.name, entry.getName())));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
@@ -95,7 +103,8 @@ public class BranchesPanel extends BasePanel {
if (branches.size() < maxCount || maxCount <= 0) {
add(new Label("allBranches", "").setVisible(false));
} else {
- add(new LinkPanel("allBranches", "link", new StringResourceModel("gb.allBranches", this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
+ add(new LinkPanel("allBranches", "link", new StringResourceModel("gb.allBranches",
+ this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
}
}
}
diff --git a/src/com/gitblit/wicket/panels/CommitHeaderPanel.java b/src/com/gitblit/wicket/panels/CommitHeaderPanel.java
index 68cd4a99..cb80321a 100644
--- a/src/com/gitblit/wicket/panels/CommitHeaderPanel.java
+++ b/src/com/gitblit/wicket/panels/CommitHeaderPanel.java
@@ -28,8 +28,9 @@ public class CommitHeaderPanel extends BasePanel {
public CommitHeaderPanel(String id, String repositoryName, RevCommit c) {
super(id);
- add(new LinkPanel("shortmessage", "title", c.getShortMessage(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, c.getName())));
- add(new Label("commitid", "(" + c.getName().substring(0, 8) + ")"));
+ add(new LinkPanel("shortmessage", "title", c.getShortMessage(), CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, c.getName())));
+ add(new Label("commitid", "(" + c.getName().substring(0, 8) + ")"));
add(new Label("author", c.getAuthorIdent().getName()));
add(WicketUtils.createDateLabel("date", c.getAuthorIdent().getWhen(), getTimeZone()));
}
diff --git a/src/com/gitblit/wicket/panels/CommitLegendPanel.java b/src/com/gitblit/wicket/panels/CommitLegendPanel.java
index 417241b9..ee81c695 100644
--- a/src/com/gitblit/wicket/panels/CommitLegendPanel.java
+++ b/src/com/gitblit/wicket/panels/CommitLegendPanel.java
@@ -38,8 +38,9 @@ public class CommitLegendPanel extends Panel {
public CommitLegendPanel(String id, List<PathChangeModel> paths) {
super(id);
- final Map<ChangeType, AtomicInteger> stats = JGitUtils.getChangedPathsStats(paths);
- ListDataProvider<ChangeType> legendDp = new ListDataProvider<ChangeType>(new ArrayList<ChangeType>(stats.keySet()));
+ final Map<ChangeType, AtomicInteger> stats = JGitUtils.getChangedPathsStats(paths);
+ ListDataProvider<ChangeType> legendDp = new ListDataProvider<ChangeType>(
+ new ArrayList<ChangeType>(stats.keySet()));
DataView<ChangeType> legendsView = new DataView<ChangeType>("legend", legendDp) {
private static final long serialVersionUID = 1L;
@@ -50,8 +51,8 @@ public class CommitLegendPanel extends Panel {
WicketUtils.setChangeTypeCssClass(changeType, entry);
item.add(changeType);
int count = stats.get(entry).intValue();
- String description = "";
- switch(entry) {
+ String description = "";
+ switch (entry) {
case ADD:
description = MessageFormat.format(getString("gb.filesAdded"), count);
break;
@@ -67,7 +68,7 @@ public class CommitLegendPanel extends Panel {
case RENAME:
description = MessageFormat.format(getString("gb.filesRenamed"), count);
break;
- }
+ }
item.add(new Label("description", description));
}
};
diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java
index 7a8f9b28..d65b02c7 100644
--- a/src/com/gitblit/wicket/panels/HistoryPanel.java
+++ b/src/com/gitblit/wicket/panels/HistoryPanel.java
@@ -51,12 +51,13 @@ public class HistoryPanel extends BasePanel {
private static final long serialVersionUID = 1L;
- private boolean hasMore = false;
+ private boolean hasMore;
- public HistoryPanel(String wicketId, final String repositoryName, final String objectId, final String path, Repository r, int limit, int pageOffset) {
+ public HistoryPanel(String wicketId, final String repositoryName, final String objectId,
+ final String path, Repository r, int limit, int pageOffset) {
super(wicketId);
boolean pageResults = limit <= 0;
- int itemsPerPage = GitBlit.self().settings().getInteger(Keys.web.itemsPerPage, 50);
+ int itemsPerPage = GitBlit.getInteger(Keys.web.itemsPerPage, 50);
if (itemsPerPage <= 1) {
itemsPerPage = 50;
}
@@ -77,7 +78,8 @@ public class HistoryPanel extends BasePanel {
List<RevCommit> commits;
if (pageResults) {
// Paging result set
- commits = JGitUtils.getRevLog(r, objectId, path, pageOffset * itemsPerPage, itemsPerPage);
+ commits = JGitUtils.getRevLog(r, objectId, path, pageOffset * itemsPerPage,
+ itemsPerPage);
} else {
// Fixed size result set
commits = JGitUtils.getRevLog(r, objectId, path, 0, limit);
@@ -95,7 +97,7 @@ public class HistoryPanel extends BasePanel {
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<RevCommit> item) {
final RevCommit entry = item.getModelObject();
@@ -105,7 +107,9 @@ public class HistoryPanel extends BasePanel {
// author search link
String author = entry.getAuthorIdent().getName();
- LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author, SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, author, SearchType.AUTHOR));
+ LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,
+ SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
+ author, SearchType.AUTHOR));
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
item.add(authorLink);
@@ -118,7 +122,9 @@ public class HistoryPanel extends BasePanel {
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimShortLog(shortMessage);
- LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));
+ LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject",
+ trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
+ repositoryName, entry.getName()));
if (!shortMessage.equals(trimmedMessage)) {
WicketUtils.setHtmlTooltip(shortlog, shortMessage);
}
@@ -128,14 +134,20 @@ public class HistoryPanel extends BasePanel {
if (isTree) {
Fragment links = new Fragment("historyLinks", "treeLinks", this);
- links.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
- links.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ links.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
+ links.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getName())));
item.add(links);
} else {
Fragment links = new Fragment("historyLinks", "blobLinks", this);
- links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.getName(), path)));
- links.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
- links.add(new BookmarkablePageLink<Void>("difftocurrent", BlobDiffPage.class, WicketUtils.newBlobDiffParameter(repositoryName, entry.getName(), objectId, path)).setEnabled(counter > 0));
+ links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils
+ .newPathParameter(repositoryName, entry.getName(), path)));
+ links.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ links.add(new BookmarkablePageLink<Void>("difftocurrent", BlobDiffPage.class,
+ WicketUtils.newBlobDiffParameter(repositoryName, entry.getName(),
+ objectId, path)).setEnabled(counter > 0));
item.add(links);
}
@@ -157,7 +169,9 @@ public class HistoryPanel extends BasePanel {
// more
if (commits.size() == limit) {
// show more
- add(new LinkPanel("moreHistory", "link", new StringResourceModel("gb.moreHistory", this, null), HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)));
+ add(new LinkPanel("moreHistory", "link", new StringResourceModel(
+ "gb.moreHistory", this, null), HistoryPage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, path)));
} else {
// no more
add(new Label("moreHistory", "").setVisible(false));
diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java
index c774f8ed..b321917c 100644
--- a/src/com/gitblit/wicket/panels/LogPanel.java
+++ b/src/com/gitblit/wicket/panels/LogPanel.java
@@ -46,13 +46,14 @@ import com.gitblit.wicket.pages.TreePage;
public class LogPanel extends BasePanel {
private static final long serialVersionUID = 1L;
-
- private boolean hasMore = false;
- public LogPanel(String wicketId, final String repositoryName, final String objectId, Repository r, int limit, int pageOffset) {
+ private boolean hasMore;
+
+ public LogPanel(String wicketId, final String repositoryName, final String objectId,
+ Repository r, int limit, int pageOffset) {
super(wicketId);
boolean pageResults = limit <= 0;
- int itemsPerPage = GitBlit.self().settings().getInteger(Keys.web.itemsPerPage, 50);
+ int itemsPerPage = GitBlit.getInteger(Keys.web.itemsPerPage, 50);
if (itemsPerPage <= 1) {
itemsPerPage = 50;
}
@@ -68,24 +69,26 @@ public class LogPanel extends BasePanel {
}
// inaccurate way to determine if there are more commits.
- // works unless commits.size() represents the exact end.
+ // works unless commits.size() represents the exact end.
hasMore = commits.size() >= itemsPerPage;
// header
if (pageResults) {
// shortlog page
// show repository summary page link
- add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
} else {
// summary page
// show shortlog page link
- add(new LinkPanel("header", "title", new StringResourceModel("gb.log", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("header", "title", new StringResourceModel("gb.log", this, null),
+ LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
}
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<RevCommit> item) {
final RevCommit entry = item.getModelObject();
@@ -95,7 +98,9 @@ public class LogPanel extends BasePanel {
// author search link
String author = entry.getAuthorIdent().getName();
- LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author, SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, author, SearchType.AUTHOR));
+ LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,
+ SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
+ author, SearchType.AUTHOR));
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
item.add(authorLink);
@@ -105,11 +110,13 @@ public class LogPanel extends BasePanel {
} else {
item.add(WicketUtils.newBlankImage("commitIcon"));
}
-
+
// short message
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimShortLog(shortMessage);
- LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));
+ LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject",
+ trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
+ repositoryName, entry.getName()));
if (!shortMessage.equals(trimmedMessage)) {
WicketUtils.setHtmlTooltip(shortlog, shortMessage);
}
@@ -117,9 +124,12 @@ public class LogPanel extends BasePanel {
item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));
- item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
@@ -139,7 +149,9 @@ public class LogPanel extends BasePanel {
// more
if (commits.size() == limit) {
// show more
- add(new LinkPanel("moreLogs", "link", new StringResourceModel("gb.moreLogs", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("moreLogs", "link", new StringResourceModel("gb.moreLogs",
+ this, null), LogPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
} else {
// no more
add(new Label("moreLogs", "").setVisible(false));
@@ -147,7 +159,7 @@ public class LogPanel extends BasePanel {
}
}
}
-
+
public boolean hasMore() {
return hasMore;
}
diff --git a/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
index d4ce4426..2693cc2b 100644
--- a/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
+++ b/src/com/gitblit/wicket/panels/PathBreadcrumbsPanel.java
@@ -33,9 +33,10 @@ public class PathBreadcrumbsPanel extends Panel {
private static final long serialVersionUID = 1L;
- private final String ROOT = "--ROOT--";
+ private static final String ROOT = "--ROOT--";
- public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName, final String objectId) {
+ public PathBreadcrumbsPanel(String id, final String repositoryName, String pathName,
+ final String objectId) {
super(id);
List<BreadCrumb> crumbs = new ArrayList<BreadCrumb>();
crumbs.add(new BreadCrumb("[" + repositoryName + "]", ROOT, false));
@@ -47,8 +48,8 @@ public class PathBreadcrumbsPanel extends Panel {
for (int i = 0; i < paths.length; i++) {
String path = paths[i];
sb.append(path);
- crumbs.add(new BreadCrumb(path, sb.toString(), (i == (paths.length - 1))));
- sb.append("/");
+ crumbs.add(new BreadCrumb(path, sb.toString(), i == (paths.length - 1)));
+ sb.append('/');
}
}
@@ -63,7 +64,8 @@ public class PathBreadcrumbsPanel extends Panel {
item.add(new Label("pathLink", entry.name));
item.add(new Label("pathSeparator", "").setVisible(false));
} else {
- item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, objectId, path)));
+ item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class,
+ WicketUtils.newPathParameter(repositoryName, objectId, path)));
item.add(new Label("pathSeparator", "/"));
}
}
@@ -71,7 +73,7 @@ public class PathBreadcrumbsPanel extends Panel {
add(pathsView);
}
- private class BreadCrumb implements Serializable {
+ private static class BreadCrumb implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/src/com/gitblit/wicket/panels/RefsPanel.java b/src/com/gitblit/wicket/panels/RefsPanel.java
index 63042806..b6e4b0bb 100644
--- a/src/com/gitblit/wicket/panels/RefsPanel.java
+++ b/src/com/gitblit/wicket/panels/RefsPanel.java
@@ -39,7 +39,8 @@ public class RefsPanel extends Panel {
private static final long serialVersionUID = 1L;
- public RefsPanel(String id, final String repositoryName, RevCommit c, Map<ObjectId, List<String>> refs) {
+ public RefsPanel(String id, final String repositoryName, RevCommit c,
+ Map<ObjectId, List<String>> refs) {
super(id);
List<String> refNames = refs.get(c.getId());
if (refNames == null) {
@@ -57,19 +58,24 @@ public class RefsPanel extends Panel {
Component c = null;
if (entry.startsWith(Constants.R_HEADS)) {
// local head
- c = new LinkPanel("refName", null, entry.substring(Constants.R_HEADS.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+ c = new LinkPanel("refName", null, entry.substring(Constants.R_HEADS.length()),
+ LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
WicketUtils.setCssClass(c, "headRef");
} else if (entry.startsWith(Constants.R_REMOTES)) {
// remote head
- c = new LinkPanel("refName", null, entry.substring(Constants.R_REMOTES.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+ c = new LinkPanel("refName", null,
+ entry.substring(Constants.R_REMOTES.length()), LogPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry));
WicketUtils.setCssClass(c, "remoteRef");
} else if (entry.startsWith(Constants.R_TAGS)) {
// tag
- c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()), TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+ c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()),
+ TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
WicketUtils.setCssClass(c, "tagRef");
} else {
// other
- c = new LinkPanel("refName", null, entry, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
+ c = new LinkPanel("refName", null, entry, CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry));
WicketUtils.setCssClass(c, "otherRef");
}
WicketUtils.setHtmlTooltip(c, entry);
diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
index 12f6152d..a566b595 100644
--- a/src/com/gitblit/wicket/panels/RepositoriesPanel.java
+++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.java
@@ -57,7 +57,8 @@ public class RepositoriesPanel extends BasePanel {
private static final long serialVersionUID = 1L;
- public RepositoriesPanel(String wicketId, final boolean showAdmin, final Map<AccessRestrictionType, String> accessRestrictionTranslations) {
+ public RepositoriesPanel(String wicketId, final boolean showAdmin,
+ final Map<AccessRestrictionType, String> accessRestrictionTranslations) {
super(wicketId);
final UserModel user = GitBlitWebSession.get().getUser();
@@ -68,12 +69,12 @@ public class RepositoriesPanel extends BasePanel {
adminLinks.add(new BookmarkablePageLink<Void>("newRepository", EditRepositoryPage.class));
add(adminLinks.setVisible(showAdmin));
- if (GitBlit.self().settings().getString(Keys.web.repositoryListType, "flat").equalsIgnoreCase("grouped")) {
+ if (GitBlit.getString(Keys.web.repositoryListType, "flat").equalsIgnoreCase("grouped")) {
Map<String, List<RepositoryModel>> groups = new HashMap<String, List<RepositoryModel>>();
for (RepositoryModel model : models) {
String rootPath = StringUtils.getRootPath(model.name);
if (StringUtils.isEmpty(rootPath)) {
- rootPath = GitBlit.self().settings().getString(Keys.web.repositoryRootGroupName, " ");
+ rootPath = GitBlit.getString(Keys.web.repositoryRootGroupName, " ");
}
if (!groups.containsKey(rootPath)) {
groups.put(rootPath, new ArrayList<RepositoryModel>());
@@ -95,7 +96,7 @@ public class RepositoriesPanel extends BasePanel {
DataView<RepositoryModel> dataView = new DataView<RepositoryModel>("row", dp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
@Override
protected void onBeforeRender() {
@@ -117,28 +118,34 @@ public class RepositoriesPanel extends BasePanel {
if (entry.hasCommits) {
// Existing repository
PageParameters pp = WicketUtils.newRepositoryParameter(entry.name);
- row.add(new LinkPanel("repositoryName", "list", entry.name, SummaryPage.class, pp));
- row.add(new LinkPanel("repositoryDescription", "list", entry.description, SummaryPage.class, pp));
+ row.add(new LinkPanel("repositoryName", "list", entry.name, SummaryPage.class,
+ pp));
+ row.add(new LinkPanel("repositoryDescription", "list", entry.description,
+ SummaryPage.class, pp));
} else {
// New repository
- row.add(new Label("repositoryName", entry.name + "<span class='empty'>(empty)</span>").setEscapeModelStrings(false));
+ row.add(new Label("repositoryName", entry.name
+ + "<span class='empty'>(empty)</span>").setEscapeModelStrings(false));
row.add(new Label("repositoryDescription", entry.description));
}
if (entry.useTickets) {
- row.add(WicketUtils.newImage("ticketsIcon", "bug_16x16.png", getString("gb.tickets")));
+ row.add(WicketUtils.newImage("ticketsIcon", "bug_16x16.png",
+ getString("gb.tickets")));
} else {
row.add(WicketUtils.newBlankImage("ticketsIcon"));
}
if (entry.useDocs) {
- row.add(WicketUtils.newImage("docsIcon", "book_16x16.png", getString("gb.docs")));
+ row.add(WicketUtils
+ .newImage("docsIcon", "book_16x16.png", getString("gb.docs")));
} else {
row.add(WicketUtils.newBlankImage("docsIcon"));
}
if (entry.isFrozen) {
- row.add(WicketUtils.newImage("frozenIcon", "cold_16x16.png", getString("gb.isFrozen")));
+ row.add(WicketUtils.newImage("frozenIcon", "cold_16x16.png",
+ getString("gb.isFrozen")));
} else {
row.add(WicketUtils.newClearPixel("frozenIcon").setVisible(false));
}
@@ -147,13 +154,16 @@ public class RepositoriesPanel extends BasePanel {
row.add(WicketUtils.newBlankImage("accessRestrictionIcon"));
break;
case PUSH:
- row.add(WicketUtils.newImage("accessRestrictionIcon", "lock_go_16x16.png", accessRestrictionTranslations.get(entry.accessRestriction)));
+ row.add(WicketUtils.newImage("accessRestrictionIcon", "lock_go_16x16.png",
+ accessRestrictionTranslations.get(entry.accessRestriction)));
break;
case CLONE:
- row.add(WicketUtils.newImage("accessRestrictionIcon", "lock_pull_16x16.png", accessRestrictionTranslations.get(entry.accessRestriction)));
+ row.add(WicketUtils.newImage("accessRestrictionIcon", "lock_pull_16x16.png",
+ accessRestrictionTranslations.get(entry.accessRestriction)));
break;
case VIEW:
- row.add(WicketUtils.newImage("accessRestrictionIcon", "shield_16x16.png", accessRestrictionTranslations.get(entry.accessRestriction)));
+ row.add(WicketUtils.newImage("accessRestrictionIcon", "shield_16x16.png",
+ accessRestrictionTranslations.get(entry.accessRestriction)));
break;
default:
row.add(WicketUtils.newBlankImage("accessRestrictionIcon"));
@@ -166,10 +176,13 @@ public class RepositoriesPanel extends BasePanel {
row.add(lastChangeLabel);
WicketUtils.setCssClass(lastChangeLabel, TimeUtils.timeAgoCss(entry.lastChange));
- boolean showOwner = user != null && user.getUsername().equalsIgnoreCase(entry.owner);
+ boolean showOwner = user != null && user.username.equalsIgnoreCase(entry.owner);
if (showAdmin) {
- Fragment repositoryLinks = new Fragment("repositoryLinks", "repositoryAdminLinks", this);
- repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository", EditRepositoryPage.class, WicketUtils.newRepositoryParameter(entry.name)));
+ Fragment repositoryLinks = new Fragment("repositoryLinks",
+ "repositoryAdminLinks", this);
+ repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository",
+ EditRepositoryPage.class, WicketUtils
+ .newRepositoryParameter(entry.name)));
Link<Void> deleteLink = new Link<Void>("deleteRepository") {
private static final long serialVersionUID = 1L;
@@ -184,16 +197,21 @@ public class RepositoriesPanel extends BasePanel {
((RepositoriesProvider) dp).remove(entry);
}
} else {
- error(MessageFormat.format("Failed to delete repository ''{0}''!", entry));
+ error(MessageFormat.format("Failed to delete repository ''{0}''!",
+ entry));
}
}
};
- deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format("Delete repository \"{0}\"?", entry)));
+ deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
+ "Delete repository \"{0}\"?", entry)));
repositoryLinks.add(deleteLink);
row.add(repositoryLinks);
} else if (showOwner) {
- Fragment repositoryLinks = new Fragment("repositoryLinks", "repositoryOwnerLinks", this);
- repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository", EditRepositoryPage.class, WicketUtils.newRepositoryParameter(entry.name)));
+ Fragment repositoryLinks = new Fragment("repositoryLinks",
+ "repositoryOwnerLinks", this);
+ repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository",
+ EditRepositoryPage.class, WicketUtils
+ .newRepositoryParameter(entry.name)));
row.add(repositoryLinks);
} else {
row.add(new Label("repositoryLinks"));
@@ -220,11 +238,11 @@ public class RepositoriesPanel extends BasePanel {
}
}
- private class GroupRepositoryModel extends RepositoryModel {
+ private static class GroupRepositoryModel extends RepositoryModel {
private static final long serialVersionUID = 1L;
- int count = 0;
+ int count;
GroupRepositoryModel(String name, int count) {
super(name, "", "", new Date(0));
@@ -241,7 +259,8 @@ public class RepositoriesPanel extends BasePanel {
repository, description, owner, date;
}
- protected OrderByBorder newSort(String wicketId, SortBy field, SortableDataProvider<?> dp, final DataView<?> dataView) {
+ protected OrderByBorder newSort(String wicketId, SortBy field, SortableDataProvider<?> dp,
+ final DataView<?> dataView) {
return new OrderByBorder(wicketId, field.name(), dp) {
private static final long serialVersionUID = 1L;
@@ -252,7 +271,7 @@ public class RepositoriesPanel extends BasePanel {
};
}
- private class RepositoriesProvider extends ListDataProvider<RepositoryModel> {
+ private static class RepositoriesProvider extends ListDataProvider<RepositoryModel> {
private static final long serialVersionUID = 1L;
@@ -279,7 +298,8 @@ public class RepositoriesPanel extends BasePanel {
}
} else if (index < (getData().size() - 1)) {
// not last element. check next element for group match.
- if (getData().get(index - 1) instanceof GroupRepositoryModel && getData().get(index + 1) instanceof GroupRepositoryModel) {
+ if (getData().get(index - 1) instanceof GroupRepositoryModel
+ && getData().get(index + 1) instanceof GroupRepositoryModel) {
// repository is sandwiched by group headers so this
// repository is the only element in the group. remove
// group.
@@ -304,9 +324,11 @@ public class RepositoriesPanel extends BasePanel {
}
}
- private class SortableRepositoriesProvider extends SortableDataProvider<RepositoryModel> {
+ private static class SortableRepositoriesProvider extends SortableDataProvider<RepositoryModel> {
+
private static final long serialVersionUID = 1L;
- private List<RepositoryModel> list = null;
+
+ private List<RepositoryModel> list;
protected SortableRepositoriesProvider(List<RepositoryModel> list) {
this.list = list;
@@ -319,8 +341,9 @@ public class RepositoriesPanel extends BasePanel {
@Override
public int size() {
- if (list == null)
+ if (list == null) {
return 0;
+ }
return list.size();
}
@@ -339,8 +362,9 @@ public class RepositoriesPanel extends BasePanel {
Collections.sort(list, new Comparator<RepositoryModel>() {
@Override
public int compare(RepositoryModel o1, RepositoryModel o2) {
- if (asc)
+ if (asc) {
return o1.lastChange.compareTo(o2.lastChange);
+ }
return o2.lastChange.compareTo(o1.lastChange);
}
});
@@ -348,8 +372,9 @@ public class RepositoriesPanel extends BasePanel {
Collections.sort(list, new Comparator<RepositoryModel>() {
@Override
public int compare(RepositoryModel o1, RepositoryModel o2) {
- if (asc)
+ if (asc) {
return o1.name.compareTo(o2.name);
+ }
return o2.name.compareTo(o1.name);
}
});
@@ -357,8 +382,9 @@ public class RepositoriesPanel extends BasePanel {
Collections.sort(list, new Comparator<RepositoryModel>() {
@Override
public int compare(RepositoryModel o1, RepositoryModel o2) {
- if (asc)
+ if (asc) {
return o1.owner.compareTo(o2.owner);
+ }
return o2.owner.compareTo(o1.owner);
}
});
@@ -366,8 +392,9 @@ public class RepositoriesPanel extends BasePanel {
Collections.sort(list, new Comparator<RepositoryModel>() {
@Override
public int compare(RepositoryModel o1, RepositoryModel o2) {
- if (asc)
+ if (asc) {
return o1.description.compareTo(o2.description);
+ }
return o2.description.compareTo(o1.description);
}
});
diff --git a/src/com/gitblit/wicket/panels/SearchPanel.java b/src/com/gitblit/wicket/panels/SearchPanel.java
index 51244cf8..8c63c423 100644
--- a/src/com/gitblit/wicket/panels/SearchPanel.java
+++ b/src/com/gitblit/wicket/panels/SearchPanel.java
@@ -43,12 +43,13 @@ public class SearchPanel extends BasePanel {
private static final long serialVersionUID = 1L;
- private boolean hasMore = false;
+ private boolean hasMore;
- public SearchPanel(String wicketId, final String repositoryName, final String objectId, final String value, SearchType searchType, Repository r, int limit, int pageOffset) {
+ public SearchPanel(String wicketId, final String repositoryName, final String objectId,
+ final String value, SearchType searchType, Repository r, int limit, int pageOffset) {
super(wicketId);
boolean pageResults = limit <= 0;
- int itemsPerPage = GitBlit.self().settings().getInteger(Keys.web.itemsPerPage, 50);
+ int itemsPerPage = GitBlit.getInteger(Keys.web.itemsPerPage, 50);
if (itemsPerPage <= 1) {
itemsPerPage = 50;
}
@@ -59,7 +60,8 @@ public class SearchPanel extends BasePanel {
List<RevCommit> commits;
if (pageResults) {
// Paging result set
- commits = JGitUtils.searchRevlogs(r, objectId, value, searchType, pageOffset * itemsPerPage, itemsPerPage);
+ commits = JGitUtils.searchRevlogs(r, objectId, value, searchType, pageOffset
+ * itemsPerPage, itemsPerPage);
} else {
// Fixed size result set
commits = JGitUtils.searchRevlogs(r, objectId, value, searchType, 0, limit);
@@ -70,12 +72,14 @@ public class SearchPanel extends BasePanel {
hasMore = commits.size() >= itemsPerPage;
// header
- add(new LinkPanel("header", "title", commit == null ? "":commit.getShortMessage(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, commit == null ? "":commit.getName())));
+ add(new LinkPanel("header", "title", commit == null ? "" : commit.getShortMessage(),
+ CommitPage.class, WicketUtils.newObjectParameter(repositoryName,
+ commit == null ? "" : commit.getName())));
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
DataView<RevCommit> searchView = new DataView<RevCommit>("commit", dp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<RevCommit> item) {
final RevCommit entry = item.getModelObject();
@@ -85,7 +89,9 @@ public class SearchPanel extends BasePanel {
// author search link
String author = entry.getAuthorIdent().getName();
- LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author, SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId, author, SearchType.AUTHOR));
+ LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,
+ SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,
+ author, SearchType.AUTHOR));
setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
item.add(authorLink);
@@ -98,8 +104,9 @@ public class SearchPanel extends BasePanel {
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimShortLog(shortMessage);
- // TODO highlight matches
- LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));
+ LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject",
+ trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
+ repositoryName, entry.getName()));
if (!shortMessage.equals(trimmedMessage)) {
WicketUtils.setHtmlTooltip(shortlog, shortMessage);
}
@@ -107,9 +114,12 @@ public class SearchPanel extends BasePanel {
item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));
- item.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/panels/TagsPanel.java b/src/com/gitblit/wicket/panels/TagsPanel.java
index d63069fe..1d8eec7d 100644
--- a/src/com/gitblit/wicket/panels/TagsPanel.java
+++ b/src/com/gitblit/wicket/panels/TagsPanel.java
@@ -49,17 +49,19 @@ public class TagsPanel extends BasePanel {
if (maxCount > 0) {
// summary page
// show tags page link
- add(new LinkPanel("header", "title", new StringResourceModel("gb.tags", this, null), TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("header", "title", new StringResourceModel("gb.tags", this, null),
+ TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
} else {
// tags page
// show repository summary page link
- add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
+ WicketUtils.newRepositoryParameter(repositoryName)));
}
ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);
DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {
private static final long serialVersionUID = 1L;
- int counter = 0;
+ int counter;
public void populateItem(final Item<RefModel> item) {
RefModel entry = item.getModelObject();
@@ -72,8 +74,10 @@ public class TagsPanel extends BasePanel {
} else {
item.add(WicketUtils.newBlankImage("tagIcon"));
}
-
- item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName())));
+
+ item.add(new LinkPanel("tagName", "list name", entry.displayName, CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getCommitId()
+ .getName())));
String message;
if (maxCount > 0) {
message = StringUtils.trimString(entry.getShortLog(), 40);
@@ -81,17 +85,29 @@ public class TagsPanel extends BasePanel {
message = entry.getShortLog();
}
if (entry.isAnnotatedTag()) {
- item.add(new LinkPanel("tagDescription", "list", message, TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId().getName())));
+ item.add(new LinkPanel("tagDescription", "list", message, TagPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getObjectId()
+ .getName())));
Fragment fragment = new Fragment("tagLinks", "annotatedLinks", this);
- fragment.add(new BookmarkablePageLink<Void>("view", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId().getName())).setEnabled(entry.isAnnotatedTag()));
- fragment.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName())));
- fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ fragment.add(new BookmarkablePageLink<Void>("view", TagPage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getObjectId().getName()))
+ .setEnabled(entry.isAnnotatedTag()));
+ fragment.add(new BookmarkablePageLink<Void>("commit", CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getCommitId()
+ .getName())));
+ fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
item.add(fragment);
} else {
- item.add(new LinkPanel("tagDescription", "list", message, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId().getName())));
+ item.add(new LinkPanel("tagDescription", "list", message, CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getObjectId()
+ .getName())));
Fragment fragment = new Fragment("tagLinks", "lightweightLinks", this);
- fragment.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName())));
- fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ fragment.add(new BookmarkablePageLink<Void>("commit", CommitPage.class,
+ WicketUtils.newObjectParameter(repositoryName, entry.getCommitId()
+ .getName())));
+ fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
+ .newObjectParameter(repositoryName, entry.getName())));
item.add(fragment);
}
@@ -103,7 +119,8 @@ public class TagsPanel extends BasePanel {
if (tags.size() < maxCount || maxCount <= 0) {
add(new Label("allTags", "").setVisible(false));
} else {
- add(new LinkPanel("allTags", "link", new StringResourceModel("gb.allTags", this, null), TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("allTags", "link", new StringResourceModel("gb.allTags", this, null),
+ TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
}
}
}
diff --git a/src/com/gitblit/wicket/panels/UsersPanel.java b/src/com/gitblit/wicket/panels/UsersPanel.java
index c227ef94..27bc334b 100644
--- a/src/com/gitblit/wicket/panels/UsersPanel.java
+++ b/src/com/gitblit/wicket/panels/UsersPanel.java
@@ -42,10 +42,11 @@ public class UsersPanel extends BasePanel {
add(adminLinks.setVisible(showAdmin));
final List<String> usernames = GitBlit.self().getAllUsernames();
- DataView<String> usersView = new DataView<String>("userRow", new ListDataProvider<String>(usernames)) {
+ DataView<String> usersView = new DataView<String>("userRow", new ListDataProvider<String>(
+ usernames)) {
private static final long serialVersionUID = 1L;
- private int counter = 0;
-
+ private int counter;
+
@Override
protected void onBeforeRender() {
super.onBeforeRender();
@@ -54,11 +55,13 @@ public class UsersPanel extends BasePanel {
public void populateItem(final Item<String> item) {
final String entry = item.getModelObject();
- LinkPanel editLink = new LinkPanel("username", "list", entry, EditUserPage.class, WicketUtils.newUsernameParameter(entry));
+ LinkPanel editLink = new LinkPanel("username", "list", entry, EditUserPage.class,
+ WicketUtils.newUsernameParameter(entry));
WicketUtils.setHtmlTooltip(editLink, getString("gb.edit") + " " + entry);
item.add(editLink);
Fragment userLinks = new Fragment("userLinks", "userAdminLinks", this);
- userLinks.add(new BookmarkablePageLink<Void>("editUser", EditUserPage.class, WicketUtils.newUsernameParameter(entry)));
+ userLinks.add(new BookmarkablePageLink<Void>("editUser", EditUserPage.class,
+ WicketUtils.newUsernameParameter(entry)));
Link<Void> deleteLink = new Link<Void>("deleteUser") {
private static final long serialVersionUID = 1L;
@@ -73,7 +76,8 @@ public class UsersPanel extends BasePanel {
}
}
};
- deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format("Delete user \"{0}\"?", entry)));
+ deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(
+ "Delete user \"{0}\"?", entry)));
userLinks.add(deleteLink);
item.add(userLinks);