<mkdir dir="${project.build.dir}" />\r
<javac srcdir="${basedir}/src" destdir="${project.build.dir}">\r
<include name="com/gitblit/Build.java" />\r
+ <include name="com/gitblit/Constants.java" />\r
</javac>\r
<java classpath="${project.build.dir}" classname="com.gitblit.Build" />\r
\r
</path>\r
<javac destdir="${project.build.dir}">\r
<src path="${basedir}/src" />\r
+ <src path="${basedir}/contrib" />\r
<classpath refid="master-classpath" />\r
</javac>\r
<copy todir="${project.build.dir}">\r
#\r
\r
# Allow push/pull over http/https with JGit servlet\r
-allowPushPull = true\r
+git.allowPushPull = true\r
\r
# Base folder for repositories\r
# Use forward slashes on Windows!!\r
-repositoriesFolder = c:/projects/git\r
+git.repositoriesFolder = c:/projects/git\r
\r
# Export all repositories\r
# if false, each exported repository must have a .git/git-daemon-export-ok file\r
-exportAll = true\r
+git.exportAll = true\r
\r
# Search repositories folder for nested repositories\r
-nestedRepositories = true\r
+git.nestedRepositories = true\r
\r
# The root clone url\r
-cloneUrl = https://localhost/git/\r
+git.cloneUrl = https://localhost/git/\r
\r
#\r
# Authentication Settings\r
#\r
\r
# Require authentication for http/https push/pull access of git repositories\r
-authenticatePushPull = true\r
+git.authenticate = true\r
\r
# Require authentication to see the web ui\r
-authenticateWebUI = true\r
+web.authenticate = true\r
\r
-# Simple user realm file to authenticate users for push/pull\r
-realmFile = users.properties\r
+# Simple user realm file to authenticate users\r
+server.realmFile = users.properties\r
\r
#\r
# Server Settings\r
#\r
-debugMode = true\r
-tempFolder = temp\r
-log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n\r
+server.debugMode = true\r
+server.tempFolder = temp\r
+server.log4jPattern = %-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n\r
\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
+server.aggressiveHeapManagement = true\r
\r
#\r
# Git:Blit UI Settings\r
#\r
-siteName =\r
+web.siteName =\r
\r
# If authenticateWebUI=true, users with "admin" role can create repositories,\r
# create users, and edit repository metadata (owner, description, etc)\r
#\r
# If authenticateWebUI=false, any user can execute the aforementioned functions. \r
-allowAdministration = true\r
+web.allowAdministration = true\r
\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
+# This is the message display above the repositories table.\r
+# This can point to a file with HTML content.\r
+web.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
# Use the client timezone when formatting dates.\r
# This uses AJAX to determine the browser's timezone and enables Wicket \r
# session management for the connection.\r
-useClientTimezone = false\r
+web.useClientTimezone = false\r
\r
# Date and Time formats\r
-timestampFormat = h:mm a\r
-\r
-datestampShortFormat = yyyy-MM-dd\r
-datestampLongFormat = EEEE, MMMM d, yyyy\r
-\r
-datetimestampShortFormat = yyyy-MM-dd h:mm a z\r
-datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z\r
+web.datestampShortFormat = yyyy-MM-dd\r
+web.datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z\r
\r
# Generates a line graph of repository activity over time on the Summary page.\r
# This is a real-time graph so generation may be expensive. \r
-generateActivityGraph = true\r
+web.generateActivityGraph = true\r
\r
# The number of commits to display on the summary page\r
# Value must exceed 0 else default of 20 is used\r
-summaryCommitCount = 20\r
+web.summaryCommitCount = 20\r
\r
# The number of tags/heads to display on the summary page\r
# Value must exceed 0 else default of 5 is used\r
-summaryRefsCount = 5\r
+web.summaryRefsCount = 5\r
\r
# The number of commits to show on each page of a Log\r
# Value must exceed 0 else default of 50 is used\r
-logPageCommitCount = 50\r
+web.logPageCommitCount = 50\r
\r
# Registered extensions for google-code-prettify\r
-prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb\r
+web.prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb\r
\r
# Image extensions\r
-imageExtensions = bmp jpg gif png \r
+web.imageExtensions = bmp jpg gif png \r
\r
# Registered extensions for binary blobs\r
-binaryExtensions = jar pdf tar.gz zip\r
+web.binaryExtensions = jar pdf tar.gz zip\r
\r
# Example global regex substitutions\r
regex.global.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://somehost/bug/$3">Bug-Id: $3</a>\r
regex.global.changeid = \\b(Change-Id:\\s*)([A-Za-z0-9]*)\\b!!!<a href="http://somehost/changeid/$2">Change-Id: $2</a>\r
\r
# Example per-repository regex substitutions overrides global\r
-regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a>\r
+#regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a>\r
\r
# Enable ticgit viewer for all repositories (checks for ticgit branch)\r
ticgit.global = false\r
\r
# Enable ticgit viewer for specified repository (checks for ticgit branch)\r
-ticgit.myrepository = true\r
-ticgit.ticgit = true\r
+#ticgit.myrepository = true\r
\r
#\r
# Jetty Settings\r
#\r
\r
# use NIO connectors. If false, socket connectors will be used.\r
-useNio = true\r
+server.useNio = true\r
\r
# Standard http port to serve. <= 0 disables this connector.\r
-httpPort = 0\r
+server.httpPort = 0\r
\r
# Secure/SSL https port to serve. <= 0 disables this connector.\r
-httpsPort = 443\r
+server.httpsPort = 443\r
\r
# Password for SSL keystore (keystore password and certificate password must match)\r
-storePassword = dosomegit\r
+server.storePassword = dosomegit\r
\r
# Port for shutdown monitor to listen on.\r
-shutdownPort = 8081\r
+server.shutdownPort = 8081\r
--- /dev/null
+/SettingKeys.java
+/Keys.java
import java.io.BufferedInputStream;\r
import java.io.ByteArrayOutputStream;\r
import java.io.File;\r
+import java.io.FileInputStream;\r
import java.io.IOException;\r
import java.io.InputStream;\r
import java.io.RandomAccessFile;\r
import java.net.URL;\r
import java.security.MessageDigest;\r
import java.security.NoSuchAlgorithmException;\r
+import java.text.MessageFormat;\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.List;\r
+import java.util.Properties;\r
\r
public class Build {\r
\r
public static void main(String... args) {\r
runtime();\r
compiletime();\r
+ buildSettingKeys();\r
}\r
\r
public static void runtime() {\r
downloadFromMaven(MavenObject.JUNIT);\r
}\r
\r
+ public static void buildSettingKeys() {\r
+ Properties properties = new Properties();\r
+ try {\r
+ properties.load(new FileInputStream(Constants.PROPERTIES_FILE));\r
+ } catch (Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+ List<String> keys = new ArrayList<String>(properties.stringPropertyNames());\r
+ Collections.sort(keys);\r
+\r
+ StringBuilder sb = new StringBuilder();\r
+ sb.append("package com.gitblit;\n");\r
+ sb.append("\n");\r
+ sb.append("/*\n");\r
+ sb.append(" * This class is auto-generated from the properties file.\n");\r
+ sb.append(" * Do not version control!\n");\r
+ sb.append(" */\n");\r
+ sb.append("public final class Keys {\n");\r
+ sb.append("\n");\r
+ for (String key : keys) {\r
+ sb.append(MessageFormat.format("\tpublic static final String {0} = \"{1}\";\n\n", key.replace('.', '_'), key));\r
+ }\r
+ sb.append("}");\r
+ try {\r
+ File file = new File("src/com/gitblit/Keys.java");\r
+ file.delete();\r
+ RandomAccessFile raf = new RandomAccessFile(file, "rw");\r
+ raf.writeBytes(sb.toString());\r
+ raf.close();\r
+ } catch (Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+ }\r
+\r
/**\r
* Download a file from a Maven repository.\r
* \r
public static final MavenObject WICKET_EXT = new MavenObject("Apache Wicket Extensions", "org/apache/wicket", "wicket-extensions", "1.4.17", "01111d0dbffdc425581b006a43864c22797ce72a");\r
\r
public static final MavenObject WICKET_AUTH_ROLES = new MavenObject("Apache Wicket Auth Roles", "org/apache/wicket", "wicket-auth-roles", "1.4.17", "86d20ff32f62d3026213ff11a78555da643bc676");\r
- \r
+\r
public static final MavenObject JUNIT = new MavenObject("JUnit", "junit", "junit", "3.8.2", "07e4cde26b53a9a0e3fe5b00d1dbbc7cc1d46060");\r
\r
public final String name;\r
public final static String NAME = "Git:Blit";\r
\r
public final static String VERSION = "0.0.1";\r
- \r
+\r
public final static String ADMIN_ROLE = "admin";\r
- \r
+\r
public final static String PULL_ROLE = "pull";\r
- \r
+\r
public final static String PUSH_ROLE = "push";\r
\r
+ public final static String PROPERTIES_FILE = "gitblit.properties";\r
+\r
public static String getGitBlitVersion() {\r
return NAME + " v" + VERSION;\r
}\r
- \r
+\r
public static String getJGitVersion() {\r
return "JGit 0.11.3";\r
}\r
}\r
\r
private GitBlit() {\r
- repositories = new File(StoredSettings.getString("repositoriesFolder", "repos"));\r
- exportAll = StoredSettings.getBoolean("exportAll", true);\r
+ repositories = new File(StoredSettings.getString(Keys.git_repositoriesFolder, "repos"));\r
+ exportAll = StoredSettings.getBoolean(Keys.git_exportAll, true);\r
repositoryResolver = new FileResolver(repositories, exportAll);\r
- debugMode = StoredSettings.getBoolean("debugMode", false);\r
+ debugMode = StoredSettings.getBoolean(Keys.server_debugMode, false);\r
}\r
- \r
+\r
public boolean isDebugMode() {\r
return debugMode;\r
}\r
userCookie.setPath("/");\r
response.addCookie(userCookie);\r
}\r
- \r
+\r
public List<String> getRepositoryList() {\r
- return JGitUtils.getRepositoryList(repositories, exportAll, StoredSettings.getBoolean("nestedRepositories", true));\r
+ return JGitUtils.getRepositoryList(repositories, exportAll, StoredSettings.getBoolean(Keys.git_nestedRepositories, true));\r
}\r
\r
public List<RepositoryModel> getRepositories(Request request) {\r
}\r
if (jc != null) {\r
jc.usage();\r
- System.out.println("\nExample:\n java -server -Xmx1024M -jar go-git-go.jar --repos c:\\git --port 80 --securePort 443");\r
+ System.out.println("\nExample:\n java -server -Xmx1024M -jar gitblit.jar --repos c:\\git --port 80 --securePort 443");\r
}\r
System.exit(0);\r
}\r
private static void start(Params params) {\r
// instantiate GitBlit\r
GitBlit.self();\r
- \r
- PatternLayout layout = new PatternLayout(StoredSettings.getString("log4jPattern", "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n"));\r
+\r
+ PatternLayout layout = new PatternLayout(StoredSettings.getString(Keys.server_log4jPattern, "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n"));\r
org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger();\r
rootLogger.addAppender(new ConsoleAppender(layout));\r
\r
String osversion = System.getProperty("os.version");\r
logger.info("Running on " + osname + " (" + osversion + ")");\r
\r
- if (StoredSettings.getBoolean("debugMode", false)) {\r
+ if (StoredSettings.getBoolean(Keys.server_debugMode, false)) {\r
logger.warn("DEBUG Mode");\r
}\r
\r
// Git Servlet\r
ServletHolder gitServlet = null;\r
String gitServletPathSpec = "/git/*";\r
- if (StoredSettings.getBoolean("allowPushPull", true)) {\r
+ if (StoredSettings.getBoolean(Keys.git_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
}\r
- \r
+\r
// Login Service\r
LoginService loginService = null;\r
String realmUsers = params.realmFile;\r
GitBlit.self().setLoginService(jettyLoginService);\r
loginService = jettyLoginService;\r
}\r
- \r
+\r
// Determine what handler to use\r
Handler handler;\r
if (gitServlet != null) {\r
public Boolean stop = false;\r
\r
@Parameter(names = { "--temp" }, description = "Server temp folder")\r
- public String temp = StoredSettings.getString("tempFolder", "temp");\r
+ public String temp = StoredSettings.getString(Keys.server_tempFolder, "temp");\r
\r
/*\r
* GIT Servlet Parameters\r
*/\r
@Parameter(names = { "--repos" }, description = "Git Repositories Folder")\r
- public String repositoriesFolder = StoredSettings.getString("repositoriesFolder", "repos");\r
+ public String repositoriesFolder = StoredSettings.getString(Keys.git_repositoriesFolder, "repos");\r
\r
@Parameter(names = { "--exportAll" }, description = "Export All Found Repositories")\r
- public Boolean exportAll = StoredSettings.getBoolean("exportAll", true);\r
+ public Boolean exportAll = StoredSettings.getBoolean(Keys.git_exportAll, true);\r
\r
/*\r
* Authentication Parameters\r
*/\r
@Parameter(names = { "--authenticatePushPull" }, description = "Authenticate Git Push/Pull access")\r
- public Boolean authenticatePushPull = StoredSettings.getBoolean("authenticatePushPull", true);\r
+ public Boolean authenticatePushPull = StoredSettings.getBoolean(Keys.git_authenticate, true);\r
\r
@Parameter(names = { "--realm" }, description = "Users Realm Hash File")\r
- public String realmFile = StoredSettings.getString("realmFile", "users.properties");\r
+ public String realmFile = StoredSettings.getString(Keys.server_realmFile, "users.properties");\r
\r
/*\r
* JETTY Parameters\r
*/\r
@Parameter(names = { "--nio" }, description = "Use NIO Connector else use Socket Connector.")\r
- public Boolean useNIO = StoredSettings.getBoolean("useNio", true);\r
+ public Boolean useNIO = StoredSettings.getBoolean(Keys.server_useNio, true);\r
\r
@Parameter(names = "--port", description = "HTTP port for to serve. (port <= 0 will disable this connector)")\r
- public Integer port = StoredSettings.getInteger("httpPort", 80);\r
+ public Integer port = StoredSettings.getInteger(Keys.server_httpPort, 80);\r
\r
@Parameter(names = "--securePort", description = "HTTPS port to serve. (port <= 0 will disable this connector)")\r
- public Integer securePort = StoredSettings.getInteger("httpsPort", 443);\r
+ public Integer securePort = StoredSettings.getInteger(Keys.server_httpsPort, 443);\r
\r
@Parameter(names = "--storePassword", description = "Password for SSL (https) keystore.")\r
- public String storePassword = StoredSettings.getString("storePassword", "");\r
+ public String storePassword = StoredSettings.getString(Keys.server_storePassword, "");\r
\r
@Parameter(names = "--shutdownPort", description = "Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)")\r
- public Integer shutdownPort = StoredSettings.getInteger("shutdownPort", 8081);\r
+ public Integer shutdownPort = StoredSettings.getInteger(Keys.server_shutdownPort, 8081);\r
\r
}\r
}
\ No newline at end of file
\r
public interface ILoginService {\r
\r
- User authenticate(String username, char [] password);\r
- \r
- User authenticate(char [] cookie);\r
+ User authenticate(String username, char[] password);\r
+\r
+ User authenticate(char[] cookie);\r
}\r
public JettyLoginService(String realmFile) {\r
super(Constants.NAME, realmFile);\r
}\r
- \r
+\r
@Override\r
public User authenticate(String username, char[] password) {\r
UserIdentity identity = login(username, new String(password));\r
}\r
\r
@Override\r
- public User authenticate(char [] cookie) {\r
+ public User authenticate(char[] cookie) {\r
// TODO cookie login\r
return null;\r
}\r
List<String> keys = new ArrayList<String>();\r
Properties props = read();\r
for (Object o : props.keySet()) {\r
- String key = o.toString().toLowerCase(); \r
+ String key = o.toString().toLowerCase();\r
if (key.startsWith(startingWith)) {\r
keys.add(key);\r
}\r
}\r
\r
private static synchronized Properties read() {\r
- File file = new File("gitblit.properties");\r
+ File file = new File(Constants.PROPERTIES_FILE);\r
if (file.exists() && (file.lastModified() > lastread)) {\r
try {\r
properties = new Properties();\r
- properties.load(new FileInputStream("gitblit.properties"));\r
+ properties.load(new FileInputStream(Constants.PROPERTIES_FILE));\r
lastread = file.lastModified();\r
} catch (FileNotFoundException f) {\r
} catch (Throwable t) {\r
r.close();\r
assertTrue("No changed paths found!", paths.size() > 0);\r
}\r
- \r
+\r
public void testCommitDiff() throws Exception {\r
Repository r = getRepository();\r
RevCommit commit = JGitUtils.getCommit(r, Constants.HEAD);\r
import org.eclipse.jgit.diff.RawText;\r
\r
public class HtmlDiffFormatter extends DiffFormatter {\r
- \r
+\r
private final OutputStream os;\r
\r
public HtmlDiffFormatter(OutputStream os) {\r
}\r
return null;\r
}\r
- \r
+\r
public static String getCommitPatch(Repository r, RevCommit commit) {\r
return getCommitPatch(r, commit);\r
}\r
- \r
+\r
public static String getCommitPatch(Repository r, RevCommit commit, String path) {\r
try {\r
final RevWalk rw = new RevWalk(r);\r
}\r
return ago;\r
}\r
- \r
+\r
public static String leftPad(String input, int length, char pad) {\r
if (input.length() < length) {\r
StringBuilder sb = new StringBuilder();\r
}\r
return input;\r
}\r
- \r
+\r
public static String rightPad(String input, int length, char pad) {\r
if (input.length() < length) {\r
StringBuilder sb = new StringBuilder();\r
sb.append(input);\r
for (int i = 0, len = length - input.length(); i < len; i++) {\r
sb.append(pad);\r
- } \r
+ }\r
return sb.toString();\r
}\r
return input;\r
}\r
- \r
+\r
public static String escapeForHtml(String inStr, boolean changeSpace) {\r
StringBuffer retStr = new StringBuffer();\r
int i = 0;\r
\r
@Override\r
public void onUnauthorizedInstantiation(Component component) {\r
- if (component instanceof BasePage) { \r
- GitBlitWebSession session = GitBlitWebSession.get(); \r
+ if (component instanceof BasePage) {\r
+ GitBlitWebSession session = GitBlitWebSession.get();\r
if (!session.isLoggedIn())\r
throw new RestartResponseAtInterceptPageException(LoginPage.class);\r
else\r
return false;\r
User user = session.getUser();\r
if (pageClass.isAnnotationPresent(AdminPage.class)) {\r
- \r
+\r
}\r
return true;\r
}\r
import org.slf4j.LoggerFactory;\r
\r
import com.gitblit.Constants;\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.wicket.pages.SummaryPage;\r
\r
public BasePage(PageParameters params) {\r
super(params);\r
}\r
- \r
+\r
protected void setupPage(String repositoryName, String pageName) {\r
if (repositoryName != null && repositoryName.trim().length() > 0) {\r
add(new Label("title", getServerName() + " - " + repositoryName));\r
add(new Label("title", getServerName()));\r
}\r
// header\r
- String siteName = StoredSettings.getString("siteName", Constants.NAME);\r
+ String siteName = StoredSettings.getString(Keys.web_siteName, Constants.NAME);\r
if (siteName == null || siteName.trim().length() == 0) {\r
siteName = Constants.NAME;\r
}\r
add(new Label("siteName", siteName));\r
add(new LinkPanel("repositoryName", null, repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
add(new Label("pageName", pageName));\r
- \r
+\r
// footer\r
User user = null;\r
- if (StoredSettings.getBoolean("authenticateWebUI", true)) {\r
+ if (StoredSettings.getBoolean(Keys.web_authenticate, true)) {\r
user = GitBlitWebSession.get().getUser();\r
add(new Label("userText", "Logout " + user.toString()));\r
} else {\r
add(new Label("userText", ""));\r
}\r
add(new Label("gbVersion", "v" + Constants.VERSION));\r
- if (StoredSettings.getBoolean("aggressiveHeapManagement", false)) {\r
+ if (StoredSettings.getBoolean(Keys.server_aggressiveHeapManagement, false)) {\r
System.gc();\r
}\r
}\r
- \r
+\r
protected TimeZone getTimeZone() {\r
- return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();\r
+ return StoredSettings.getBoolean(Keys.web_useClientTimezone, false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();\r
}\r
- \r
+\r
protected String getServerName() {\r
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
return req.getServerName();\r
}\r
- \r
+\r
public void error(String message, Throwable t) {\r
super.error(message);\r
logger.error(message, t);\r
import org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy;\r
\r
import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.wicket.pages.BlobDiffPage;\r
import com.gitblit.wicket.pages.BlobPage;\r
super.init();\r
\r
// Setup page authorization mechanism\r
- if (StoredSettings.getBoolean("authenticateWebUI", false)) {\r
+ if (StoredSettings.getBoolean(Keys.web_authenticate, false)) {\r
AuthorizationStrategy authStrategy = new AuthorizationStrategy();\r
getSecuritySettings().setAuthorizationStrategy(authStrategy);\r
getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);\r
}\r
\r
// Grab Browser info (like timezone, etc)\r
- if (StoredSettings.getBoolean("useClientTimezone", false)) {\r
+ if (StoredSettings.getBoolean(Keys.web_useClientTimezone, false)) {\r
getRequestCycleSettings().setGatherExtendedBrowserInfo(true);\r
}\r
\r
}\r
\r
public String getCloneUrl(String repositoryName) {\r
- return StoredSettings.getString("cloneUrl", "https://localhost/git/") + repositoryName;\r
+ return StoredSettings.getString(Keys.git_cloneUrl, "https://localhost/git/") + repositoryName;\r
}\r
\r
public static GitBlitWebApp get() {\r
private static final long serialVersionUID = 1L;\r
\r
protected TimeZone timezone = null;\r
- \r
+\r
private User user = null;\r
\r
public GitBlitWebSession(Request request) {\r
super.invalidate();\r
user = null;\r
}\r
- \r
+\r
public boolean isLoggedIn() {\r
return user != null;\r
}\r
- \r
+\r
public boolean canAdmin() {\r
if (user == null) {\r
- return false; \r
+ return false;\r
}\r
return user.canAdmin();\r
}\r
- \r
+\r
public User getUser() {\r
return user;\r
}\r
- \r
+\r
public void setUser(User user) {\r
this.user = user;\r
}\r
}\r
if (linkCssClass != null) {\r
link.add(new SimpleAttributeModifier("class", linkCssClass));\r
- } \r
+ }\r
link.add(new Label("label", labelModel));\r
add(link);\r
}\r
loginForm.add(new FeedbackPanel("feedback"));\r
add(loginForm);\r
}\r
- \r
+\r
protected String getServerName() {\r
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
@Override\r
public void onSubmit() {\r
String username = LoginPage.this.username.getObject();\r
- char [] password = LoginPage.this.password.getObject().toCharArray();\r
+ char[] password = LoginPage.this.password.getObject().toCharArray();\r
\r
User user = GitBlit.self().authenticate(username, password);\r
if (user == null)\r
// Set Cookie\r
WebResponse response = (WebResponse) getRequestCycle().getResponse();\r
GitBlit.self().setCookie(response, user);\r
- \r
+\r
// track user object so that we do not have to continue\r
// re-authenticating on each request.\r
session.setUser(user);\r
}\r
\r
protected void addRefs(Repository r, RevCommit c) {\r
- add(new RefsPanel("refsPanel", repositoryName, c, JGitUtils.getAllRefs(r)));\r
+ add(new RefsPanel("refsPanel", repositoryName, c, JGitUtils.getAllRefs(r)));\r
}\r
\r
protected void addFullText(String wicketId, String text, boolean substituteRegex) {\r
import com.gitblit.Constants;\r
\r
public class User {\r
- \r
+\r
private String username;\r
- private char [] password;\r
+ private String cookie;\r
private boolean canAdmin = false;\r
private boolean canClone = false;\r
private boolean canPush = false;\r
- \r
- public User(String username, char [] password) {\r
+\r
+ public User(String username, char[] password) {\r
this.username = username;\r
- this.password = password;\r
+ this.cookie = Build.getSHA1((Constants.NAME + username + new String(password)).getBytes());\r
}\r
- \r
+\r
public void canAdmin(boolean value) {\r
canAdmin = value;\r
}\r
- \r
+\r
public boolean canAdmin() {\r
return canAdmin;\r
}\r
public void canClone(boolean value) {\r
canClone = value;\r
}\r
- \r
+\r
public boolean canClone() {\r
return canClone;\r
}\r
- \r
+\r
public void canPush(boolean value) {\r
canPush = value;\r
}\r
- \r
+\r
public boolean canPush() {\r
return canPush;\r
}\r
\r
public String getCookie() {\r
- return Build.getSHA1((Constants.NAME + username + new String(password)).getBytes());\r
+ return cookie;\r
}\r
- \r
+\r
public String toString() {\r
return username;\r
}\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.eclipse.jgit.lib.Constants;\r
\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.Utils;\r
\r
public static String breakLines(String string) {\r
return string.replace("\r", "<br/>").replace("\n", "<br/>");\r
}\r
- \r
+\r
public static void setTicketCssClass(Component container, String state) {\r
String css = null;\r
if (state.equals("open")) {\r
setCssClass(container, css);\r
}\r
}\r
- \r
+\r
public static String flattenStrings(List<String> values) {\r
StringBuilder sb = new StringBuilder();\r
for (String value : values) {\r
}\r
return sb.toString().trim();\r
}\r
- \r
+\r
public static void setAlternatingBackground(Component c, int i) {\r
String clazz = i % 2 == 0 ? "dark" : "light";\r
setCssClass(c, clazz);\r
}\r
- \r
+\r
public static Label createAuthorLabel(String wicketId, String author) {\r
Label label = new Label(wicketId, author);\r
WicketUtils.setHtmlTitle(label, author);\r
public static String trimShortLog(String string) {\r
return trimString(string, 60);\r
}\r
- \r
+\r
public static String trimString(String value, int max) {\r
if (value.length() <= max) {\r
return value;\r
}\r
return value.substring(0, max - 3) + "...";\r
}\r
- \r
+\r
public static PageParameters newRepositoryParameter(String repositoryName) {\r
return new PageParameters("r=" + repositoryName);\r
}\r
}\r
return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path);\r
}\r
- \r
+\r
public static PageParameters newLogPageParameter(String repositoryName, String objectId, int pageNumber) {\r
if (pageNumber <= 1) {\r
return newObjectParameter(repositoryName, objectId);\r
}\r
return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",page=" + pageNumber);\r
}\r
- \r
+\r
public static String getRepositoryName(PageParameters params) {\r
return params.getString("r", "");\r
}\r
}\r
\r
public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));\r
+ DateFormat df = new SimpleDateFormat(StoredSettings.getString(Keys.web_datestampShortFormat, "MM/dd/yy"));\r
if (timeZone != null) {\r
df.setTimeZone(timeZone);\r
}\r
WicketUtils.setHtmlTitle(label, title);\r
return label;\r
}\r
- \r
+\r
public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampLongFormat", "EEEE, MMMM d, yyyy h:mm a z"));\r
+ DateFormat df = new SimpleDateFormat(StoredSettings.getString(Keys.web_datetimestampLongFormat, "EEEE, MMMM d, yyyy h:mm a z"));\r
if (timeZone != null) {\r
df.setTimeZone(timeZone);\r
}\r
\r
import com.gitblit.utils.JGitUtils;\r
\r
-\r
public class PathModel implements Serializable, Comparable<PathModel> {\r
\r
private static final long serialVersionUID = 1L;\r
- \r
+\r
public final String name;\r
public final String path;\r
public final long size;\r
- public final int mode;\r
+ public final int mode;\r
public final String commitId;\r
public boolean isParentPath;\r
- \r
+\r
public PathModel(String name, String path, long size, int mode, String commitId) {\r
this.name = name;\r
this.path = path;\r
this.mode = mode;\r
this.commitId = commitId;\r
}\r
- \r
+\r
public boolean isTree() {\r
return JGitUtils.isTreeFromMode(mode);\r
}\r
- \r
+\r
public static PathModel getParentPath(String basePath, String commitId) {\r
String parentPath = null;\r
if (basePath.lastIndexOf('/') > -1) {\r
\r
import com.gitblit.utils.JGitUtils;\r
\r
-\r
public class RefModel implements Serializable, Comparable<RefModel> {\r
\r
private static final long serialVersionUID = 1L;\r
public String getName() {\r
return ref.getName();\r
}\r
- \r
+\r
public RevCommit getCommit() {\r
return commit;\r
}\r
public ObjectId getObjectId() {\r
return ref.getObjectId();\r
}\r
- \r
+\r
public boolean isAnnotatedTag() {\r
// ref.isPeeled() ??\r
return !getCommitId().equals(getObjectId());\r
}\r
- \r
+\r
@Override\r
public int compareTo(RefModel o) {\r
return getDate().compareTo(o.getDate());\r
if (chunks.length == 3) {\r
date = new Date(Long.parseLong(chunks[0]) * 1000l);\r
title = chunks[1].replace('-', ' ');\r
- } \r
+ }\r
}\r
\r
public static class Comment implements Serializable, Comparable<Comment> {\r
- \r
+\r
private static final long serialVersionUID = 1L;\r
- \r
+\r
public String text;\r
public String author;\r
public Date date;\r
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
\r
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));\r
- \r
+\r
add(new Label("diffText", diff).setEscapeModelStrings(false));\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.diff");\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.panels.PathBreadcrumbsPanel;\r
\r
-\r
public class BlobPage extends RepositoryPage {\r
\r
public BlobPage(PageParameters params) {\r
\r
// Map the extensions to types\r
Map<String, Integer> map = new HashMap<String, Integer>();\r
- for (String ext : StoredSettings.getStrings("prettyPrintExtensions")) {\r
+ for (String ext : StoredSettings.getStrings(Keys.web_prettyPrintExtensions)) {\r
map.put(ext.toLowerCase(), 1);\r
}\r
- for (String ext : StoredSettings.getStrings("imageExtensions")) {\r
+ for (String ext : StoredSettings.getStrings(Keys.web_imageExtensions)) {\r
map.put(ext.toLowerCase(), 2);\r
}\r
- for (String ext : StoredSettings.getStrings("binaryExtensions")) {\r
+ for (String ext : StoredSettings.getStrings(Keys.web_binaryExtensions)) {\r
map.put(ext.toLowerCase(), 3);\r
}\r
\r
add(blobLabel);\r
}\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.view");\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.panels.BranchesPanel;\r
\r
-\r
public class BranchesPage extends RepositoryPage {\r
\r
public BranchesPage(PageParameters params) {\r
\r
add(new BranchesPanel("branchesPanel", repositoryName, getRepository(), -1));\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.branches");\r
\r
Repository r = getRepository();\r
RevCommit commit = JGitUtils.getCommit(r, objectId);\r
- String diff = JGitUtils.getCommitDiff(r, commit, true); \r
- \r
+ String diff = JGitUtils.getCommitDiff(r, commit, true);\r
+\r
List<String> parents = new ArrayList<String>();\r
if (commit.getParentCount() > 0) {\r
for (RevCommit parent : commit.getParents()) {\r
parents.add(parent.name());\r
}\r
}\r
- \r
+\r
// commit page links\r
if (parents.size() == 0) {\r
add(new Label("parentLink", "none"));\r
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
\r
// changed paths list\r
- List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
+ List<PathModel> paths = JGitUtils.getFilesInCommit(r, commit);\r
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);\r
DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {\r
private static final long serialVersionUID = 1L;\r
} else {\r
item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));\r
}\r
- \r
+\r
item.add(new BookmarkablePageLink<Void>("patch", PatchPage.class, newPathParameter(entry.path)));\r
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));\r
item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));\r
add(pathsView);\r
add(new Label("diffText", diff).setEscapeModelStrings(false));\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.commitdiff");\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.PathModel;\r
\r
-\r
public class CommitPage extends RepositoryPage {\r
\r
public CommitPage(PageParameters params) {\r
\r
Repository r = getRepository();\r
RevCommit c = JGitUtils.getCommit(r, objectId);\r
- \r
+\r
List<String> parents = new ArrayList<String>();\r
if (c.getParentCount() > 0) {\r
for (RevCommit parent : c.getParents()) {\r
parents.add(parent.name());\r
}\r
}\r
- \r
+\r
// commit page links\r
if (parents.size() == 0) {\r
add(new Label("parentLink", "none"));\r
add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", this, null), CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
}\r
add(new BookmarkablePageLink<Void>("patchLink", PatchPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
- \r
+\r
add(new LinkPanel("shortlog", "title", c.getShortMessage(), CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, objectId)));\r
- \r
+\r
addRefs(r, c);\r
\r
add(new Label("commitAuthor", JGitUtils.getDisplayName(c.getAuthorIdent())));\r
addFullText("fullMessage", c.getFullMessage(), true);\r
\r
// changed paths list\r
- List<PathModel> paths = JGitUtils.getFilesInCommit(r, c);\r
+ List<PathModel> paths = JGitUtils.getFilesInCommit(r, c);\r
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);\r
DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {\r
private static final long serialVersionUID = 1L;\r
} else {\r
item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));\r
}\r
- \r
+\r
item.add(new BookmarkablePageLink<Void>("diff", BlobDiffPage.class, newPathParameter(entry.path)));\r
item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));\r
item.add(new BookmarkablePageLink<Void>("blame", BlobPage.class).setEnabled(false));\r
};\r
add(pathsView);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.commit");\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.WicketUtils;\r
\r
-\r
public class PatchPage extends WebPage {\r
\r
public PatchPage(PageParameters params) {\r
redirectToInterceptPage(new RepositoriesPage());\r
}\r
final String repositoryName = WicketUtils.getRepositoryName(params);\r
- final String objectId = WicketUtils.getObject(params); \r
+ final String objectId = WicketUtils.getObject(params);\r
final String blobPath = WicketUtils.getPath(params);\r
\r
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
String patch = JGitUtils.getCommitPatch(r, commit, blobPath);\r
add(new Label("patchText", patch));\r
r.close();\r
- } \r
+ }\r
}\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.WicketUtils;\r
\r
-\r
public class RawPage extends WebPage {\r
\r
public RawPage(PageParameters params) {\r
redirectToInterceptPage(new RepositoriesPage());\r
}\r
final String repositoryName = WicketUtils.getRepositoryName(params);\r
- final String objectId = WicketUtils.getObject(params); \r
+ final String objectId = WicketUtils.getObject(params);\r
final String blobPath = WicketUtils.getPath(params);\r
\r
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
\r
// Map the extensions to types\r
Map<String, Integer> map = new HashMap<String, Integer>();\r
- for (String ext : StoredSettings.getStrings("imageExtensions")) {\r
+ for (String ext : StoredSettings.getStrings(Keys.web_imageExtensions)) {\r
map.put(ext.toLowerCase(), 2);\r
}\r
- for (String ext : StoredSettings.getStrings("binaryExtensions")) {\r
+ for (String ext : StoredSettings.getStrings(Keys.web_binaryExtensions)) {\r
map.put(ext.toLowerCase(), 3);\r
}\r
\r
add(blobLabel);\r
}\r
r.close();\r
- } \r
+ }\r
}\r
import org.apache.wicket.model.Model;\r
\r
import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.Utils;\r
import com.gitblit.wicket.BasePage;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.RepositoryModel;\r
\r
-\r
public class RepositoriesPage extends BasePage {\r
\r
public RepositoriesPage() {\r
super();\r
setupPage("", "");\r
- \r
+\r
boolean showAdmin = false;\r
- if (StoredSettings.getBoolean("authenticateWebUI", true)) {\r
- boolean allowAdmin = StoredSettings.getBoolean("allowAdministration", false);\r
- showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin(); \r
+ if (StoredSettings.getBoolean(Keys.web_authenticate, true)) {\r
+ boolean allowAdmin = StoredSettings.getBoolean(Keys.web_allowAdministration, false);\r
+ showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();\r
} else {\r
- showAdmin = StoredSettings.getBoolean("allowAdministration", false);\r
+ showAdmin = StoredSettings.getBoolean(Keys.web_allowAdministration, false);\r
}\r
- \r
+\r
Fragment adminLinks = new Fragment("adminPanel", "adminLinks", this);\r
adminLinks.add(new BookmarkablePageLink<Void>("newRepository", RepositoriesPage.class));\r
- adminLinks.add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class)); \r
+ adminLinks.add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class));\r
add(adminLinks.setVisible(showAdmin));\r
- \r
- add(new Label("repositoriesMessage", StoredSettings.getString("repositoriesMessage", "")).setEscapeModelStrings(false));\r
+\r
+ add(new Label("repositoriesMessage", StoredSettings.getString(Keys.web_repositoriesMessage, "")).setEscapeModelStrings(false));\r
\r
List<RepositoryModel> rows = GitBlit.self().getRepositories(getRequest());\r
DataProvider dp = new DataProvider(rows);\r
import com.codecommit.wicket.ChartProvider;\r
import com.codecommit.wicket.ChartType;\r
import com.codecommit.wicket.IChartData;\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.GitBlitWebApp;\r
\r
public SummaryPage(PageParameters params) {\r
super(params);\r
- \r
+\r
int numCommitsDef = 20;\r
int numRefsDef = 5;\r
- \r
- int numberCommits = StoredSettings.getInteger("summaryCommitCount", numCommitsDef);\r
+\r
+ int numberCommits = StoredSettings.getInteger(Keys.web_summaryCommitCount, numCommitsDef);\r
if (numberCommits <= 0) {\r
numberCommits = numCommitsDef;\r
}\r
\r
- int numberRefs = StoredSettings.getInteger("summaryRefsCount", numRefsDef);\r
+ int numberRefs = StoredSettings.getInteger(Keys.web_summaryRefsCount, numRefsDef);\r
if (numberRefs <= 0) {\r
numberRefs = numRefsDef;\r
}\r
- \r
- Repository r = getRepository(); \r
+\r
+ Repository r = getRepository();\r
List<Metric> metrics = JGitUtils.getDateMetrics(r);\r
- \r
+\r
long numberOfCommits = 0;\r
for (Metric m : metrics) {\r
numberOfCommits += m.count;\r
// repository description\r
add(new Label("repositoryDescription", description));\r
add(new Label("repositoryOwner", JGitUtils.getRepositoryOwner(r)));\r
- \r
+\r
add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r), getTimeZone()));\r
add(new Label("repositoryCloneUrl", GitBlitWebApp.get().getCloneUrl(repositoryName)));\r
\r
add(new LogPanel("commitsPanel", repositoryName, null, r, numberCommits, 0));\r
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs));\r
add(new BranchesPanel("branchesPanel", repositoryName, r, numberRefs));\r
- \r
+\r
// Display an activity line graph\r
insertActivityGraph(metrics);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.summary");\r
}\r
\r
private void insertActivityGraph(List<Metric> metrics) {\r
- if (StoredSettings.getBoolean("generateActivityGraph", true)) { \r
+ if (StoredSettings.getBoolean(Keys.web_generateActivityGraph, true)) {\r
IChartData data = getChartData(metrics);\r
\r
ChartProvider provider = new ChartProvider(new Dimension(400, 80), ChartType.LINE, data);\r
\r
add(new Chart("commitsChart", provider));\r
} else {\r
- add(new ContextImage("commitsChart", "blank.png")); \r
+ add(new ContextImage("commitsChart", "blank.png"));\r
}\r
}\r
\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.RefModel;\r
\r
-\r
public class TagPage extends RepositoryPage {\r
\r
public TagPage(PageParameters params) {\r
super(params);\r
\r
- Repository r = getRepository(); \r
+ Repository r = getRepository();\r
List<RefModel> tags = JGitUtils.getTags(r, -1);\r
RevCommit c = JGitUtils.getCommit(r, objectId);\r
- \r
+\r
RefModel tagRef = null;\r
// determine tag\r
- for (RefModel tag:tags) {\r
+ for (RefModel tag : tags) {\r
if (tag.getName().equals(objectId) || tag.getObjectId().getName().equals(objectId)) {\r
tagRef = tag;\r
break;\r
if (tagRef == null) {\r
// point to commit\r
add(new LinkPanel("commit", "title", c.getShortMessage(), CommitPage.class, newCommitParameter()));\r
- add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName()))); \r
+ add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName())));\r
} else {\r
// TODO commit or tree or blob?\r
add(new LinkPanel("commit", "title", tagRef.getDisplayName(), CommitPage.class, newCommitParameter()));\r
add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName())));\r
- } \r
- \r
+ }\r
+\r
add(new Label("tagAuthor", JGitUtils.getDisplayName(c.getAuthorIdent())));\r
add(WicketUtils.createTimestampLabel("tagDate", c.getAuthorIdent().getWhen(), getTimeZone()));\r
\r
addFullText("fullMessage", c.getFullMessage(), true);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.tag");\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.panels.TagsPanel;\r
\r
-\r
public class TagsPage extends RepositoryPage {\r
\r
public TagsPage(PageParameters params) {\r
super(params);\r
- \r
+\r
add(new TagsPanel("tagsPanel", repositoryName, getRepository(), -1));\r
- \r
+\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.tags");\r
};\r
add(ticketsView);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.ticgit");\r
};\r
add(commentsView);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.ticket");\r
\r
private String prepareComment(String comment) {\r
String html = Utils.escapeForHtml(comment, false);\r
- html = WicketUtils.breakLines(comment).trim(); \r
+ html = WicketUtils.breakLines(comment).trim();\r
return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "<a href=\"/commit/" + repositoryName + "/$1\">commit $1</a>");\r
}\r
}\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.panels.PathBreadcrumbsPanel;\r
\r
-\r
public class TreePage extends RepositoryPage {\r
\r
public TreePage(PageParameters params) {\r
add(new Label("historyLink", getString("gb.history")));\r
add(new BookmarkablePageLink<Void>("headLink", TreePage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, basePath)));\r
\r
-\r
add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
\r
// breadcrumbs\r
- add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, basePath, objectId)); \r
+ add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, basePath, objectId));\r
if (basePath != null && basePath.trim().length() > 0) {\r
paths.add(0, PathModel.getParentPath(basePath, objectId));\r
}\r
\r
final ByteFormat byteFormat = new ByteFormat();\r
- \r
- // changed paths list \r
+\r
+ // changed paths list\r
ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);\r
DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {\r
private static final long serialVersionUID = 1L;\r
// folder/tree link\r
item.add(new Label("pathSize", ""));\r
item.add(new LinkPanel("pathName", null, entry.name, TreePage.class, newPathParameter(entry.path)));\r
- \r
+\r
// links\r
Fragment links = new Fragment("pathLinks", "treeLinks", this);\r
links.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));\r
// blob link\r
item.add(new Label("pathSize", byteFormat.format(entry.size)));\r
item.add(new LinkPanel("pathName", "list", entry.name, BlobPage.class, newPathParameter(entry.path)));\r
- \r
+\r
// links\r
Fragment links = new Fragment("pathLinks", "blobLinks", this);\r
links.add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, entry.commitId, entry.path)));\r
};\r
add(pathsView);\r
}\r
- \r
+\r
@Override\r
protected String getPageName() {\r
return getString("gb.tree");\r
\r
import org.apache.wicket.markup.html.panel.Panel;\r
\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.wicket.GitBlitWebSession;\r
\r
}\r
\r
protected TimeZone getTimeZone() {\r
- return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();\r
+ return StoredSettings.getBoolean(Keys.web_useClientTimezone, false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();\r
}\r
}\r
// show repository summary page link\r
add(new LinkPanel("branches", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
}\r
- \r
+\r
ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {\r
private static final long serialVersionUID = 1L;\r
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), getTimeZone()));\r
\r
item.add(new LinkPanel("branchName", "list name", WicketUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
- \r
+\r
// only show branch type on the branches page\r
boolean remote = entry.getName().startsWith(Constants.R_REMOTES);\r
- item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")).setVisible(maxCount <= 0));\r
- \r
+ item.add(new Label("branchType", remote ? getString("gb.remote") : getString("gb.local")).setVisible(maxCount <= 0));\r
+\r
item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
+import com.gitblit.Keys;\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.CommitDiffPage;\r
+import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TreePage;\r
public LogPanel(String wicketId, final String repositoryName, String objectId, Repository r, int limit, int pageOffset) {\r
super(wicketId);\r
boolean pageResults = limit <= 0;\r
- int itemsPerPage = StoredSettings.getInteger("logPageCommitCount", 50);\r
+ int itemsPerPage = StoredSettings.getInteger(Keys.web_logPageCommitCount, 50);\r
if (itemsPerPage <= 1) {\r
itemsPerPage = 50;\r
}\r
// Get the repository ticgit setting\r
boolean checkTicgit = StoredSettings.getBoolean("ticgit.global", false);\r
checkTicgit |= StoredSettings.getBoolean(MessageFormat.format("ticgit.{0}", repositoryName), false);\r
- \r
+\r
// Add dynamic repository extras\r
List<String> extras = new ArrayList<String>();\r
if (checkTicgit && JGitUtils.getTicGitBranch(r) != null) {\r
String key = knownPages.get(wicketId);\r
String linkName = getString(key);\r
if (linkName.equals(pageName)) {\r
- Component c = get(wicketId); \r
+ Component c = get(wicketId);\r
if (c != null) {\r
c.setEnabled(false);\r
}\r
import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.TagPage;\r
\r
-\r
public class RefsPanel extends Panel {\r
\r
private static final long serialVersionUID = 1L;\r
refNames = new ArrayList<String>();\r
}\r
Collections.sort(refNames);\r
-// refNames.remove(Constants.HEAD);\r
- \r
+ // refNames.remove(Constants.HEAD);\r
+\r
ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames);\r
DataView<String> refsView = new DataView<String>("ref", refsDp) {\r
private static final long serialVersionUID = 1L;\r
+\r
public void populateItem(final Item<String> item) {\r
String entry = item.getModelObject();\r
Component c = null;\r