@@ -232,6 +232,15 @@ web.loginMessage = gitblit | |||
# SINCE 0.5.0 | |||
web.repositoriesMessage = gitblit | |||
# Manually set the default timezone to be used by Gitblit for display in the | |||
# web ui. This value is independent of the JVM timezone. Specifying a blank | |||
# value will default to the JVM timezone. | |||
# e.g. America/New_York, US/Pacific, UTC, Europe/Berlin | |||
# | |||
# SINCE 0.9.0 | |||
# RESTART REQUIRED | |||
web.timezone = | |||
# Use the client timezone when formatting dates. | |||
# This uses AJAX to determine the browser's timezone and may require more | |||
# server overhead because a Wicket session is created. All Gitblit pages |
@@ -10,12 +10,14 @@ | |||
#### changes | |||
- block pushes to a repository with a working copy (i.e. non-bare repository) (issue-49) | |||
- web.datetimestampLongFormat from *EEEE, MMMM d, yyyy h:mm a z* to *EEEE, MMMM d, yyyy HH:mm Z* (issue 50) | |||
- expanded commit age coloring from 2 days to 30 days (issue 57) | |||
- Block pushes to a repository with a working copy (i.e. non-bare repository) (issue-49) | |||
- Changed default web.datetimestampLongFormat from *EEEE, MMMM d, yyyy h:mm a z* to *EEEE, MMMM d, yyyy HH:mm Z* (issue 50) | |||
- Expanded commit age coloring from 2 days to 30 days (issue 57) | |||
#### additions | |||
- Allow specifying timezone to use for Gitblit which is independent of both the JVM and the system timezone (issue 54) | |||
**New:** *web.timezone =* | |||
- Added a built-in AJP connector for integrating Gitblit GO into an Apache mod_proxy setup (issue 59) | |||
**New:** *server.ajpPort = 0* | |||
**New:** *server.ajpBindInterface = localhost* | |||
@@ -28,6 +30,7 @@ Push requests to these repositories will be rejected. | |||
#### fixes | |||
- Fixed timezone bug on the activity apge (issue 54) | |||
- Prevent add/edit team with no selected repositories (issue 56) | |||
- Disallow browser autocomplete on add/edit user/team/repository pages | |||
- Fixed username case-sensitivity issues (issue 43) |
@@ -23,16 +23,19 @@ import java.io.InputStream; | |||
import java.io.InputStreamReader; | |||
import java.lang.reflect.Field; | |||
import java.text.MessageFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashSet; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Map.Entry; | |||
import java.util.Set; | |||
import java.util.TimeZone; | |||
import java.util.TreeSet; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
import java.util.concurrent.Executors; | |||
@@ -103,7 +106,7 @@ import com.gitblit.utils.StringUtils; | |||
public class GitBlit implements ServletContextListener { | |||
private static GitBlit gitblit; | |||
private final Logger logger = LoggerFactory.getLogger(GitBlit.class); | |||
private final ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(5); | |||
@@ -132,6 +135,8 @@ public class GitBlit implements ServletContextListener { | |||
private ServerStatus serverStatus; | |||
private MailExecutor mailExecutor; | |||
private TimeZone timezone; | |||
public GitBlit() { | |||
if (gitblit == null) { | |||
@@ -160,6 +165,23 @@ public class GitBlit implements ServletContextListener { | |||
public static boolean isGO() { | |||
return self().settings instanceof FileSettings; | |||
} | |||
/** | |||
* Returns the preferred timezone for the Gitblit instance. | |||
* | |||
* @return a timezone | |||
*/ | |||
public static TimeZone getTimezone() { | |||
if (self().timezone == null) { | |||
String tzid = getString("web.timezone", null); | |||
if (StringUtils.isEmpty(tzid)) { | |||
self().timezone = TimeZone.getDefault(); | |||
return self().timezone; | |||
} | |||
self().timezone = TimeZone.getTimeZone(tzid); | |||
} | |||
return self().timezone; | |||
} | |||
/** | |||
* Returns the boolean value for the specified key. If the key does not | |||
@@ -1767,6 +1789,10 @@ public class GitBlit implements ServletContextListener { | |||
repositoriesFolder = getRepositoriesFolder(); | |||
logger.info("Git repositories folder " + repositoriesFolder.getAbsolutePath()); | |||
repositoryResolver = new FileResolver<Void>(repositoriesFolder, true); | |||
logTimezone("JVM", TimeZone.getDefault()); | |||
logTimezone(Constants.NAME, getTimezone()); | |||
serverStatus = new ServerStatus(isGO()); | |||
String realm = settings.getString(Keys.realm.userService, "users.properties"); | |||
IUserService loginService = null; | |||
@@ -1786,7 +1812,14 @@ public class GitBlit implements ServletContextListener { | |||
} | |||
if (startFederation) { | |||
configureFederation(); | |||
} | |||
} | |||
} | |||
private void logTimezone(String type, TimeZone zone) { | |||
SimpleDateFormat df = new SimpleDateFormat("z Z"); | |||
df.setTimeZone(zone); | |||
String offset = df.format(new Date()); | |||
logger.info(type + " timezone is " + zone.getID() + " (" + offset + ")"); | |||
} | |||
/** |
@@ -408,9 +408,10 @@ public class WicketUtils { | |||
public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) { | |||
String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy"); | |||
DateFormat df = new SimpleDateFormat(format); | |||
if (timeZone != null) { | |||
df.setTimeZone(timeZone); | |||
if (timeZone == null) { | |||
timeZone = GitBlit.getTimezone(); | |||
} | |||
df.setTimeZone(timeZone); | |||
String dateString; | |||
if (date.getTime() == 0) { | |||
dateString = "--"; | |||
@@ -438,9 +439,10 @@ public class WicketUtils { | |||
public static Label createTimeLabel(String wicketId, Date date, TimeZone timeZone) { | |||
String format = GitBlit.getString(Keys.web.timeFormat, "HH:mm"); | |||
DateFormat df = new SimpleDateFormat(format); | |||
if (timeZone != null) { | |||
df.setTimeZone(timeZone); | |||
if (timeZone == null) { | |||
timeZone = GitBlit.getTimezone(); | |||
} | |||
df.setTimeZone(timeZone); | |||
String timeString; | |||
if (date.getTime() == 0) { | |||
timeString = "--"; | |||
@@ -449,7 +451,6 @@ public class WicketUtils { | |||
} | |||
String title = TimeUtils.timeAgo(date); | |||
Label label = new Label(wicketId, timeString); | |||
WicketUtils.setCssClass(label, TimeUtils.timeAgoCss(date)); | |||
if (!StringUtils.isEmpty(title)) { | |||
WicketUtils.setHtmlTooltip(label, title); | |||
} | |||
@@ -459,9 +460,10 @@ public class WicketUtils { | |||
public static Label createDatestampLabel(String wicketId, Date date, TimeZone timeZone) { | |||
String format = GitBlit.getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy"); | |||
DateFormat df = new SimpleDateFormat(format); | |||
if (timeZone != null) { | |||
df.setTimeZone(timeZone); | |||
if (timeZone == null) { | |||
timeZone = GitBlit.getTimezone(); | |||
} | |||
df.setTimeZone(timeZone); | |||
String dateString; | |||
if (date.getTime() == 0) { | |||
dateString = "--"; | |||
@@ -483,7 +485,6 @@ public class WicketUtils { | |||
title = tmp; | |||
} | |||
Label label = new Label(wicketId, dateString); | |||
WicketUtils.setCssClass(label, TimeUtils.timeAgoCss(date)); | |||
if (!StringUtils.isEmpty(title)) { | |||
WicketUtils.setHtmlTooltip(label, title); | |||
} | |||
@@ -494,9 +495,10 @@ public class WicketUtils { | |||
String format = GitBlit.getString(Keys.web.datetimestampLongFormat, | |||
"EEEE, MMMM d, yyyy HH:mm Z"); | |||
DateFormat df = new SimpleDateFormat(format); | |||
if (timeZone != null) { | |||
df.setTimeZone(timeZone); | |||
if (timeZone == null) { | |||
timeZone = GitBlit.getTimezone(); | |||
} | |||
df.setTimeZone(timeZone); | |||
String dateString; | |||
if (date.getTime() == 0) { | |||
dateString = "--"; |
@@ -181,7 +181,7 @@ public abstract class BasePage extends WebPage { | |||
protected TimeZone getTimeZone() { | |||
return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get() | |||
.getTimezone() : TimeZone.getDefault(); | |||
.getTimezone() : GitBlit.getTimezone(); | |||
} | |||
protected String getServerName() { |
@@ -38,7 +38,7 @@ public abstract class BasePanel extends Panel { | |||
protected TimeZone getTimeZone() { | |||
return GitBlit.getBoolean(Keys.web.useClientTimezone, false) ? GitBlitWebSession.get() | |||
.getTimezone() : TimeZone.getDefault(); | |||
.getTimezone() : GitBlit.getTimezone(); | |||
} | |||
protected void setPersonSearchTooltip(Component component, String value, Constants.SearchType searchType) { |