]> source.dussan.org Git - gitblit.git/commitdiff
Added placeholder for Admin links on main page.
authorJames Moger <james.moger@gitblit.com>
Wed, 6 Apr 2011 21:25:23 +0000 (17:25 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 6 Apr 2011 21:25:23 +0000 (17:25 -0400)
Added placeholder for Admin links on main page.
Dynamically add ticgit link to nav links, if ticgit branch is
discovered.
Settings refinements.

14 files changed:
gitblit.properties
resources/gitblit.css
src/com/gitblit/GitBlitServer.java
src/com/gitblit/wicket/RepositoryPage.java
src/com/gitblit/wicket/pages/DiffPage.html
src/com/gitblit/wicket/pages/RepositoriesPage.html
src/com/gitblit/wicket/pages/RepositoriesPage.java
src/com/gitblit/wicket/pages/TicGitPage.html
src/com/gitblit/wicket/pages/TicGitTicketPage.java
src/com/gitblit/wicket/panels/AdminLinksPanel.html [new file with mode: 0644]
src/com/gitblit/wicket/panels/AdminLinksPanel.java [new file with mode: 0644]
src/com/gitblit/wicket/panels/PageFooter.java
src/com/gitblit/wicket/panels/PageLinksPanel.html
src/com/gitblit/wicket/panels/PageLinksPanel.java

index 560515a1948d479929f590e7336b185074ea349f..b7a879b791c3931648513b8d5469414402d6ea61 100644 (file)
@@ -1,7 +1,10 @@
 #\r
-# GIT Servlet Settings\r
+# Git Servlet Settings\r
 #\r
 \r
+# Allow push/pull over http/https with JGit servlet\r
+allowPushPull = true\r
+\r
 # Base folder for repositories\r
 # Use forward slashes on Windows!!\r
 repositoriesFolder = c:/projects/git\r
@@ -20,8 +23,8 @@ cloneUrl = https://localhost/git/
 # Authentication Settings\r
 #\r
 \r
-# Require authentication for http push/pull of git repositories\r
-authenticateAccess = true\r
+# Require authentication for http/https push/pull access of git repositories\r
+authenticatePushPull = true\r
 \r
 # Simple user realm file to authenticate users for push/pull\r
 realmFile = users.properties\r
@@ -42,16 +45,16 @@ adminRoles = *
 debug = true\r
 tempFolder = temp\r
 log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS}  %-20.20c{1}  %m%n\r
-# Aggressive garbage collection will run the collector on every generated page\r
-# this slows down page generation but improves heap consumption \r
-aggressiveGC = true\r
+# Aggressive heap management will run the garbage collector on every generated\r
+# page.  This slows down page generation but improves heap consumption. \r
+aggressiveHeapManagement = true\r
 \r
 #\r
 # Git:Blit UI Settings\r
 #\r
 siteName = Repositories\r
 allowAdministration = true\r
-indexMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own GIT repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, and <a href="http://jcommander.org">JCommander</a>.\r
+repositoriesMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own Git repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, and <a href="http://jcommander.org">JCommander</a>.\r
 \r
 # Date and Time formats\r
 timestampFormat = h:mm a\r
index 96815bd5a76dee7d7ed0ab67e6daf06597244d6f..675a25858b11f710aeab102921b2ecdf93d2b185 100644 (file)
@@ -63,6 +63,10 @@ img.activityGraph {
        padding: 8px;\r
 }\r
 \r
+div.repositories_message {\r
+       line-height: inherit;\r
+}\r
+\r
 div.header {\r
        background-color: #D2C3AF;\r
        padding: 3px;\r
@@ -176,27 +180,27 @@ div.commit_message {
        border-width: 1px 0px 1px;\r
 }\r
 \r
-div.bug_open {\r
+div.bug_open, span.bug_open {\r
        padding: 2px;\r
        background-color: #800000;\r
        color: white;   \r
        text-align: center;\r
 }\r
 \r
-div.bug_resolved {\r
+div.bug_resolved, span.bug_resolved {\r
        padding: 2px;\r
        background-color: #008000;\r
        color: white;\r
        text-align: center;\r
 }\r
 \r
-div.bug_invalid {\r
+div.bug_invalid, span.bug_invalid {\r
        padding: 2px;\r
        background-color: gray;\r
        text-align: center;\r
 }\r
 \r
-div.bug_hold {\r
+div.bug_hold, span.bug_hold {\r
        padding: 2px;\r
        background-color: orange;\r
        text-align: center;\r
@@ -304,9 +308,9 @@ table.repositories {
 }\r
 \r
 table.repositories th {\r
-       background-color:#000070;\r
+       background-color:#D2C3AF;\r
        padding: 4px;\r
-       border-bottom: 1px solid #bbb;\r
+       border-bottom: 1px solid #808080;\r
 }\r
 \r
 table.repositories td {\r
@@ -314,7 +318,7 @@ table.repositories td {
 }\r
 \r
 table.repositories th a {\r
-       color:#ddd;\r
+       color:black;/*#ddd;*/\r
        text-decoration: none;\r
        font-weight: normal;\r
 }\r
@@ -324,7 +328,8 @@ table.repositories th a:hover {
 }\r
 \r
 table.repositories th.wicket_orderDown a, table.repositories th.wicket_orderUp a {\r
-       color: yellow;\r
+       color: black;\r
+       font-weight: bold;\r
 }\r
 \r
 tr th a { padding-right: 15px; background-position: right; background-repeat:no-repeat; }\r
index ae542e8dac152fd06e2121b210a6344b91344fc8..9991a75d5160a862682be3c8997d89c289cbbcad 100644 (file)
@@ -40,7 +40,6 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.WebAppContext;\r
 import org.eclipse.jgit.http.server.GitServlet;\r
 \r
-\r
 import com.beust.jcommander.JCommander;\r
 import com.beust.jcommander.Parameter;\r
 import com.beust.jcommander.ParameterException;\r
@@ -134,7 +133,7 @@ public class GitBlitServer {
                        Connector httpConnector = createConnector(params.useNIO, params.port);\r
                        connectors.add(httpConnector);\r
                }\r
-               \r
+\r
                if (params.securePort > 0) {\r
                        if (new File("keystore").exists()) {\r
                                Connector secureConnector = createSSLConnector(params.useNIO, params.securePort, params.storePassword);\r
@@ -176,51 +175,58 @@ public class GitBlitServer {
                wicketFilter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, wicketPathSpec);\r
                rootContext.addFilter(wicketFilter, wicketPathSpec, FilterMapping.DEFAULT);\r
 \r
-               // GIT Servlet\r
-               String gitServletPathSpec = "/git/*";\r
-               ServletHolder gitServlet = rootContext.addServlet(GitServlet.class, gitServletPathSpec);\r
-               gitServlet.setInitParameter("base-path", params.repositoriesFolder);\r
-               gitServlet.setInitParameter("export-all", params.exportAll ? "1" : "0");\r
-\r
-               String realmUsers = params.realmFile;\r
-\r
-               // Authentication Realm\r
                Handler handler;\r
-               if (realmUsers != null && new File(realmUsers).exists() && params.authenticateAccess) {\r
-                       List<String> list = StoredSettings.getStrings("gitRoles");\r
-                       String[] roles;\r
-                       if (list.size() == 0) {\r
-                               roles = new String[] { "*" };\r
+\r
+               // Git Servlet\r
+               ServletHolder gitServlet = null;\r
+               String gitServletPathSpec = "/git/*";\r
+               if (StoredSettings.getBoolean("allowPushPull", true)) {\r
+                       gitServlet = rootContext.addServlet(GitServlet.class, gitServletPathSpec);\r
+                       gitServlet.setInitParameter("base-path", params.repositoriesFolder);\r
+                       gitServlet.setInitParameter("export-all", params.exportAll ? "1" : "0");\r
+                       String realmUsers = params.realmFile;\r
+\r
+                       if (realmUsers != null && new File(realmUsers).exists() && params.authenticatePushPull) {\r
+                               // Authenticate Pull/Push\r
+                               List<String> list = StoredSettings.getStrings("gitRoles");\r
+                               String[] roles;\r
+                               if (list.size() == 0) {\r
+                                       roles = new String[] { "*" };\r
+                               } else {\r
+                                       roles = list.toArray(new String[list.size()]);\r
+                               }\r
+                               logger.info("Authentication required for git servlet pull/push access");\r
+                               logger.info("Setting up realm from " + realmUsers);\r
+                               HashLoginService loginService = new HashLoginService(Constants.NAME, realmUsers);\r
+\r
+                               Constraint constraint = new Constraint();\r
+                               constraint.setName("auth");\r
+                               constraint.setAuthenticate(true);\r
+                               constraint.setRoles(roles);\r
+\r
+                               ConstraintMapping mapping = new ConstraintMapping();\r
+                               mapping.setPathSpec(gitServletPathSpec);\r
+                               mapping.setConstraint(constraint);\r
+\r
+                               ConstraintSecurityHandler security = new ConstraintSecurityHandler();\r
+                               security.addConstraintMapping(mapping);\r
+                               for (String role : roles) {\r
+                                       security.addRole(role);\r
+                               }\r
+                               security.setAuthenticator(new BasicAuthenticator());\r
+                               security.setLoginService(loginService);\r
+                               security.setStrict(false);\r
+\r
+                               security.setHandler(rootContext);\r
+\r
+                               handler = security;\r
                        } else {\r
-                               roles = list.toArray(new String[list.size()]);\r
-                       }\r
-                       logger.info("Authentication required for GIT access");\r
-                       logger.info("Setting up realm from " + realmUsers);\r
-                       HashLoginService loginService = new HashLoginService(Constants.NAME, realmUsers);\r
-\r
-                       Constraint constraint = new Constraint();\r
-                       constraint.setName("auth");\r
-                       constraint.setAuthenticate(true);\r
-                       constraint.setRoles(roles);\r
-\r
-                       ConstraintMapping mapping = new ConstraintMapping();\r
-                       mapping.setPathSpec(gitServletPathSpec);\r
-                       mapping.setConstraint(constraint);\r
-\r
-                       ConstraintSecurityHandler security = new ConstraintSecurityHandler();\r
-                       security.addConstraintMapping(mapping);\r
-                       for (String role : roles) {\r
-                               security.addRole(role);\r
+                               // Anonymous Pull/Push\r
+                               logger.info("Setting up anonymous git servlet pull/push access");\r
+                               handler = rootContext;\r
                        }\r
-                       security.setAuthenticator(new BasicAuthenticator());\r
-                       security.setLoginService(loginService);\r
-                       security.setStrict(false);\r
-\r
-                       security.setHandler(rootContext);\r
-\r
-                       handler = security;\r
                } else {\r
-                       logger.info("Setting up anonymous access");\r
+                       logger.info("Git servlet pull/push disabled");\r
                        handler = rootContext;\r
                }\r
 \r
@@ -356,7 +362,7 @@ public class GitBlitServer {
                /*\r
                 * GIT Servlet Parameters\r
                 */\r
-               @Parameter(names = { "--repos" }, description = "GIT Repositories Folder")\r
+               @Parameter(names = { "--repos" }, description = "Git Repositories Folder")\r
                public String repositoriesFolder = StoredSettings.getString("repositoriesFolder", "repos");\r
 \r
                @Parameter(names = { "--exportAll" }, description = "Export All Found Repositories")\r
@@ -365,8 +371,8 @@ public class GitBlitServer {
                /*\r
                 * Authentication Parameters\r
                 */\r
-               @Parameter(names = { "--authenticateAccess" }, description = "Authenticate GIT access")\r
-               public Boolean authenticateAccess = StoredSettings.getBoolean("authenticateAccess", true);\r
+               @Parameter(names = { "--authenticatePushPull" }, description = "Authenticate Git Push/Pull access")\r
+               public Boolean authenticatePushPull = StoredSettings.getBoolean("authenticatePushPull", true);\r
 \r
                @Parameter(names = { "--realm" }, description = "Users Realm Hash File")\r
                public String realmFile = StoredSettings.getString("realmFile", "users.properties");\r
index b4f6fdc320e0a7423ec5833b8d6302ffd4ef0e93..2f2b967657554a49aedd15547af2d4222b6933a9 100644 (file)
@@ -20,13 +20,14 @@ import com.gitblit.wicket.panels.PageHeader;
 import com.gitblit.wicket.panels.PageLinksPanel;\r
 import com.gitblit.wicket.panels.RefsPanel;\r
 \r
-\r
 public abstract class RepositoryPage extends BasePage {\r
 \r
        protected final String repositoryName;\r
        protected final String commitId;\r
        protected String description;\r
 \r
+       private transient Repository r = null;\r
+\r
        public RepositoryPage(PageParameters params, String pageName) {\r
                super(params);\r
                if (!params.containsKey("p")) {\r
@@ -36,23 +37,28 @@ public abstract class RepositoryPage extends BasePage {
                repositoryName = params.getString("p", "");\r
                commitId = params.getString("h", "");\r
 \r
+               Repository r = getRepository();\r
+\r
                add(new PageHeader("pageHeader", repositoryName, "/ " + pageName));\r
-               add(new PageLinksPanel("pageLinks", repositoryName, pageName));\r
+               add(new PageLinksPanel("pageLinks", r, repositoryName, pageName));\r
                setStatelessHint(true);\r
        }\r
 \r
        protected Repository getRepository() {\r
-               ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
-               HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
-               req.getServerName();\r
-\r
-               Repository r = GitBlitWebApp.get().getRepository(req, repositoryName);\r
                if (r == null) {\r
-                       error("Can not load repository " + repositoryName);\r
-                       redirectToInterceptPage(new RepositoriesPage());\r
-                       return null;\r
+                       ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
+                       HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
+                       req.getServerName();\r
+\r
+                       Repository r = GitBlitWebApp.get().getRepository(req, repositoryName);\r
+                       if (r == null) {\r
+                               error("Can not load repository " + repositoryName);\r
+                               redirectToInterceptPage(new RepositoriesPage());\r
+                               return null;\r
+                       }\r
+                       description = JGitUtils.getRepositoryDescription(r);\r
+                       this.r = r;\r
                }\r
-               description = JGitUtils.getRepositoryDescription(r);\r
                return r;\r
        }\r
 \r
@@ -64,22 +70,22 @@ public abstract class RepositoryPage extends BasePage {
                String html = WicketUtils.breakLines(text);\r
                if (substituteRegex) {\r
                        Map<String, String> map = new HashMap<String, String>();\r
-                       // global regex keys                    \r
+                       // global regex keys\r
                        for (String key : StoredSettings.getAllKeys("regex.global")) {\r
                                String subKey = key.substring(key.lastIndexOf('.') + 1);\r
                                map.put(subKey, StoredSettings.getString(key, ""));\r
                        }\r
-                       \r
+\r
                        // repository-specific regex keys\r
                        List<String> keys = StoredSettings.getAllKeys("regex." + repositoryName.toLowerCase());\r
                        for (String key : keys) {\r
                                String subKey = key.substring(key.lastIndexOf('.') + 1);\r
                                map.put(subKey, StoredSettings.getString(key, ""));\r
                        }\r
-                       \r
+\r
                        for (String key : map.keySet()) {\r
                                String definition = map.get(key).trim();\r
-                               String [] chunks = definition.split("!!!");\r
+                               String[] chunks = definition.split("!!!");\r
                                if (chunks.length == 2) {\r
                                        html = html.replaceAll(chunks[0], chunks[1]);\r
                                } else {\r
@@ -91,28 +97,29 @@ public abstract class RepositoryPage extends BasePage {
        }\r
 \r
        protected void addFooter() {\r
+               r.close();\r
                add(new PageFooter("pageFooter", description));\r
        }\r
 \r
        protected PageParameters newRepositoryParameter() {\r
-               return new PageParameters("p=" + repositoryName);       \r
+               return new PageParameters("p=" + repositoryName);\r
        }\r
-       \r
+\r
        protected PageParameters newCommitParameter() {\r
                return newCommitParameter(commitId);\r
        }\r
-       \r
+\r
        protected PageParameters newCommitParameter(String commitId) {\r
                if (commitId == null || commitId.trim().length() == 0) {\r
-                       return newRepositoryParameter();        \r
+                       return newRepositoryParameter();\r
                }\r
                return new PageParameters("p=" + repositoryName + ",h=" + commitId);\r
        }\r
 \r
-       protected PageParameters newPathParameter(String path) {                \r
+       protected PageParameters newPathParameter(String path) {\r
                if (path == null || path.trim().length() == 0) {\r
                        return newCommitParameter();\r
                }\r
                return new PageParameters("p=" + repositoryName + ",h=" + commitId + ",f=" + path);\r
-       }       \r
+       }\r
 }\r
index b7aa03b24dfaa45e7a28424aa76b761ab544bd9d..b001deade45ac93f868edbd5d4c3f1efad8ce29e 100644 (file)
@@ -4,7 +4,7 @@
        <link href="prettify/prettify.css" type="text/css" rel="stylesheet" />\r
        <script type="text/javascript" src="prettify/prettify.js"></script>\r
 </head>\r
-<body onload="prettyPrint()">\r
+<body>\r
        <!-- page header -->\r
        <div wicket:id="pageHeader"></div>\r
 \r
index 0a7b27060f2e3a4c18dfd9487ae0a23ca81881c0..43168bba248605b0e6d4041339f331397c4e04d4 100644 (file)
@@ -2,7 +2,11 @@
 <html xmlns="http://www.w3.org/1999/xhtml" >\r
 <body>\r
        <div wicket:id="pageHeader"></div>\r
-       <div class="repositories_message" wicket:id="indexInclude"></div>       \r
+       \r
+       <div wicket:id="adminPanel"></div>\r
+       \r
+       <div class="repositories_message" wicket:id="repositoriesMessage"></div>\r
+               \r
        <table class="repositories">\r
                <tr>\r
                        <th wicket:id="orderByRepository">Repository</th>\r
index 50bcba28e223a794fca1b7e84e72f65925211fff..4755e415ccb9a4cc08f7fa95ad5dcc1095db9d60 100644 (file)
@@ -22,6 +22,7 @@ import com.gitblit.wicket.GitBlitWebApp;
 import com.gitblit.wicket.LinkPanel;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.models.RepositoryModel;\r
+import com.gitblit.wicket.panels.AdminLinksPanel;\r
 import com.gitblit.wicket.panels.PageFooter;\r
 import com.gitblit.wicket.panels.PageHeader;\r
 \r
@@ -31,7 +32,9 @@ public class RepositoriesPage extends BasePage {
        public RepositoriesPage() {\r
                add(new PageHeader("pageHeader"));\r
 \r
-               add(new Label("indexInclude", StoredSettings.getString("indexMessage", "")).setEscapeModelStrings(false));\r
+               add(new AdminLinksPanel("adminPanel").setVisible(StoredSettings.getBoolean("allowAdministration", false)));\r
+               \r
+               add(new Label("repositoriesMessage", StoredSettings.getString("repositoriesMessage", "")).setEscapeModelStrings(false));\r
 \r
                List<RepositoryModel> rows = GitBlitWebApp.get().getRepositories(getRequest());\r
                DataProvider dp = new DataProvider(rows);\r
index e3b9ed8ec146c166f8eee11770ff5f60ff83ae11..451058d0937d2ec8b53093477a98eb8a43802dad 100644 (file)
@@ -12,7 +12,7 @@
        <table style="width:100%" class="pretty">\r
                <tbody>\r
                        <tr wicket:id="ticket">\r
-                       <td style="padding:0; margin:0;" ><div wicket:id="ticketState"></div></td>\r
+                       <td style="padding:0; margin:0;"><div wicket:id="ticketState"></div></td>\r
                        <td class="date"><span wicket:id="ticketDate"></span></td>\r
                        <td><div wicket:id="ticketHandler"></div></td>\r
                        <td><div wicket:id="ticketTitle"></div></td>\r
index 6390500174ddad19163ee2ca201b7d9171cb644d..c73a3ce5fb69b87985acb4f2fca33590a2ba8f64 100644 (file)
@@ -19,7 +19,7 @@ import com.gitblit.wicket.WicketUtils;
 public class TicGitTicketPage extends RepositoryPage {\r
 \r
        public TicGitTicketPage(PageParameters params) {\r
-               super(params, "ticgit ticket");\r
+               super(params, "ticket");\r
 \r
                final String ticketFolder = params.getString("f", "");\r
 \r
@@ -32,7 +32,21 @@ public class TicGitTicketPage extends RepositoryPage {
                add(new Label("ticketHandler", t.handler));\r
                String openDate = GitBlitWebSession.get().formatDateTimeLong(t.date);\r
                add(new Label("ticketOpenDate", openDate));\r
-               add(new Label("ticketState", t.state));\r
+               Label stateLabel = new Label("ticketState", t.state);\r
+               String css = null;\r
+               if (t.state.equals("open")) {\r
+                       css = "bug_open";\r
+               } else if (t.state.equals("hold")) {\r
+                       css = "bug_hold";\r
+               } else if (t.state.equals("resolved")) {\r
+                       css = "bug_resolved";\r
+               } else if (t.state.equals("invalid")) {\r
+                       css = "bug_invalid";\r
+               }\r
+               if (css != null) {\r
+                       WicketUtils.setCssClass(stateLabel, css);\r
+               }\r
+               add(stateLabel);\r
                add(new Label("ticketTags", flattenStrings(t.tags)));\r
 \r
                ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);\r
diff --git a/src/com/gitblit/wicket/panels/AdminLinksPanel.html b/src/com/gitblit/wicket/panels/AdminLinksPanel.html
new file mode 100644 (file)
index 0000000..5643c84
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">\r
+<wicket:panel>\r
+       <!-- page nav links --> \r
+       <div class="page_nav">\r
+               <span wicket:id="newRepository"></span> | <span wicket:id="newUser"></span>\r
+       </div>  \r
+</wicket:panel>\r
+</html>
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/panels/AdminLinksPanel.java b/src/com/gitblit/wicket/panels/AdminLinksPanel.java
new file mode 100644 (file)
index 0000000..2089f48
--- /dev/null
@@ -0,0 +1,16 @@
+package com.gitblit.wicket.panels;\r
+\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+\r
+public class AdminLinksPanel extends Panel {\r
+\r
+       private static final long serialVersionUID = 1L;\r
+\r
+       public AdminLinksPanel(String id) {\r
+               super(id);\r
+\r
+               add(new Label("newRepository", "new repository"));\r
+               add(new Label("newUser", "new user"));\r
+       }\r
+}
\ No newline at end of file
index b7440e8c83036984835960bf5ac5b449e34fd78c..a6a691ff8d2a10cb1b32c56ba55c662106290df9 100644 (file)
@@ -19,7 +19,7 @@ public class PageFooter extends Panel {
                super(id);              \r
                add(new Label("footerText", description));\r
                add(new Label("gbVersion", "v" + Constants.VERSION));\r
-               if (StoredSettings.getBoolean("aggressiveGC", false)) {\r
+               if (StoredSettings.getBoolean("aggressiveHeapManagement", false)) {\r
                        System.gc();\r
                }\r
        }\r
index 072221feab84e8863483a30492b6fe54da16d454..0aabffc6819c016cbe13c538b75a9e04b0bb7b57 100644 (file)
@@ -3,7 +3,7 @@
 <wicket:panel>\r
        <!-- page nav links --> \r
        <div class="page_nav">\r
-               <span wicket:id="summary"></span> | <span wicket:id="shortlog"></span> | <span wicket:id="branches"></span> | <span wicket:id="tags"></span> | <span wicket:id="tree"></span>\r
+               <span wicket:id="summary"></span> | <span wicket:id="shortlog"></span> | <span wicket:id="branches"></span> | <span wicket:id="tags"></span> | <span wicket:id="tree"></span> <span wicket:id="extra"><span wicket:id="extraSeparator"></span><span wicket:id="extraLink"></span></span>\r
        </div>  \r
 </wicket:panel>\r
 </html>
\ No newline at end of file
index 23f338352de46475a2fe944931bfab4982f335fa..d203426794c400e4e1c414be5b5efbe47ce63bff 100644 (file)
@@ -1,24 +1,32 @@
 package com.gitblit.wicket.panels;\r
 \r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
 import org.apache.wicket.PageParameters;\r
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.panel.Panel;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.eclipse.jgit.lib.Repository;\r
 \r
+import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.wicket.LinkPanel;\r
 import com.gitblit.wicket.pages.BranchesPage;\r
-import com.gitblit.wicket.pages.CommitPage;\r
 import com.gitblit.wicket.pages.ShortLogPage;\r
 import com.gitblit.wicket.pages.SummaryPage;\r
 import com.gitblit.wicket.pages.TagsPage;\r
+import com.gitblit.wicket.pages.TicGitPage;\r
 import com.gitblit.wicket.pages.TreePage;\r
 \r
-\r
 public class PageLinksPanel extends Panel {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       public PageLinksPanel(String id, String repositoryName, String pageName) {\r
+       public PageLinksPanel(String id, Repository r, final String repositoryName, String pageName) {\r
                super(id);\r
+\r
                // summary\r
                if (pageName.equals("summary")) {\r
                        add(new Label("summary", pageName));\r
@@ -32,26 +40,46 @@ public class PageLinksPanel extends Panel {
                } else {\r
                        add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName)));\r
                }\r
-               \r
+\r
                // branches\r
                if (pageName.equals("branches")) {\r
                        add(new Label("branches", pageName));\r
                } else {\r
                        add(new LinkPanel("branches", null, "branches", BranchesPage.class, new PageParameters("p=" + repositoryName)));\r
                }\r
-               \r
+\r
                // tags\r
                if (pageName.equals("tags")) {\r
                        add(new Label("tags", pageName));\r
                } else {\r
                        add(new LinkPanel("tags", null, "tags", TagsPage.class, new PageParameters("p=" + repositoryName)));\r
                }\r
-               \r
+\r
                // tree\r
                if (pageName.equals("tree")) {\r
                        add(new Label("tree", pageName));\r
                } else {\r
                        add(new LinkPanel("tree", null, "tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=HEAD")));\r
-               }               \r
+               }\r
+\r
+               // Add dynamic repository extras\r
+               List<String> extras = new ArrayList<String>();\r
+               if (JGitUtils.getTicGitBranch(r) != null) {\r
+                       extras.add("ticgit");\r
+               }\r
+\r
+               ListDataProvider<String> extrasDp = new ListDataProvider<String>(extras);\r
+               DataView<String> extrasView = new DataView<String>("extra", extrasDp) {\r
+                       private static final long serialVersionUID = 1L;\r
+\r
+                       public void populateItem(final Item<String> item) {\r
+                               String extra = item.getModelObject();\r
+                               if (extra.equals("ticgit")) {\r
+                                       item.add(new Label("extraSeparator", " | "));\r
+                                       item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, new PageParameters("p=" + repositoryName)));\r
+                               }\r
+                       }\r
+               };\r
+               add(extrasView);\r
        }\r
 }
\ No newline at end of file