@@ -56,14 +56,19 @@ siteName = | |||
allowAdministration = true | |||
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>. | |||
# Use the client timezone when formatting dates. | |||
# This uses AJAX to determine the browser's timezone and enables Wicket | |||
# session management for the connection. | |||
useClientTimezone = false | |||
# Date and Time formats | |||
timestampFormat = h:mm a | |||
datestampShortFormat = yyyy-MM-dd | |||
datestampLongFormat = EEEE, MMMM d, yyyy | |||
datetimestampShortFormat = yyyy-MM-dd h:mm a | |||
datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a | |||
datetimestampShortFormat = yyyy-MM-dd h:mm a z | |||
datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a z | |||
# Generates a line graph of repository activity over time on the Summary page. | |||
# This is a real-time graph so generation may be expensive. | |||
@@ -97,6 +102,13 @@ regex.global.changeid = \\b(Change-Id:\\s*)([A-Za-z0-9]*)\\b!!!<a href="http://s | |||
# Example per-repository regex substitutions overrides global | |||
regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a> | |||
# Enable ticgit viewer for all repositories (checks for ticgit branch) | |||
ticgit.global = false | |||
# Enable ticgit viewer for specified repository (checks for ticgit branch) | |||
ticgit.myrepository = true | |||
ticgit.ticgit = true | |||
# | |||
# Jetty Settings | |||
# |
@@ -1,5 +1,7 @@ | |||
package com.gitblit.wicket; | |||
import java.util.TimeZone; | |||
import javax.servlet.http.HttpServletRequest; | |||
import org.apache.wicket.PageParameters; | |||
@@ -48,6 +50,10 @@ public abstract class BasePage extends WebPage { | |||
} | |||
} | |||
protected TimeZone getTimeZone() { | |||
return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault(); | |||
} | |||
protected String getServerName() { | |||
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest(); | |||
HttpServletRequest req = servletWebRequest.getHttpServletRequest(); |
@@ -1,8 +1,5 @@ | |||
package com.gitblit.wicket; | |||
import java.text.DateFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.Date; | |||
import java.util.TimeZone; | |||
import org.apache.wicket.Request; | |||
@@ -10,9 +7,6 @@ import org.apache.wicket.Session; | |||
import org.apache.wicket.protocol.http.WebSession; | |||
import org.apache.wicket.protocol.http.request.WebClientInfo; | |||
import com.gitblit.StoredSettings; | |||
public final class GitBlitWebSession extends WebSession { | |||
private static final long serialVersionUID = 1L; | |||
@@ -38,36 +32,6 @@ public final class GitBlitWebSession extends WebSession { | |||
return timezone; | |||
} | |||
public String formatTime(Date date) { | |||
DateFormat df = new SimpleDateFormat(StoredSettings.getString("timestampFormat", "h:mm a")); | |||
df.setTimeZone(getTimezone()); | |||
return df.format(date); | |||
} | |||
public String formatDate(Date date) { | |||
DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy")); | |||
df.setTimeZone(getTimezone()); | |||
return df.format(date); | |||
} | |||
public String formatDateLong(Date date) { | |||
DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampLongFormat", "EEEE, MMMM d, yyyy")); | |||
df.setTimeZone(getTimezone()); | |||
return df.format(date); | |||
} | |||
public String formatDateTime(Date date) { | |||
DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampShortFormat", "MM/dd/yy h:mm a")); | |||
df.setTimeZone(getTimezone()); | |||
return df.format(date); | |||
} | |||
public String formatDateTimeLong(Date date) { | |||
DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampLongFormat", "EEEE, MMMM d, yyyy h:mm a z")); | |||
df.setTimeZone(getTimezone()); | |||
return df.format(date); | |||
} | |||
public static GitBlitWebSession get() { | |||
return (GitBlitWebSession) Session.get(); | |||
} |
@@ -136,4 +136,16 @@ public class WicketUtils { | |||
WicketUtils.setHtmlTitle(label, title); | |||
return label; | |||
} | |||
public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone) { | |||
DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampLongFormat", "EEEE, MMMM d, yyyy h:mm a z")); | |||
if (timeZone != null) { | |||
df.setTimeZone(timeZone); | |||
} | |||
String dateString = df.format(date); | |||
String title = Utils.timeAgo(date); | |||
Label label = new Label(wicketId, dateString); | |||
WicketUtils.setHtmlTitle(label, title); | |||
return label; | |||
} | |||
} |
@@ -14,7 +14,6 @@ import org.eclipse.jgit.lib.Repository; | |||
import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
@@ -51,12 +50,10 @@ public class CommitPage extends RepositoryPage { | |||
addRefs(r, c); | |||
add(new Label("commitAuthor", JGitUtils.getDisplayName(c.getAuthorIdent()))); | |||
String authorDate = GitBlitWebSession.get().formatDateTimeLong(c.getAuthorIdent().getWhen()); | |||
add(new Label("commitAuthorDate", authorDate)); | |||
add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(), getTimeZone())); | |||
add(new Label("commitCommitter", JGitUtils.getDisplayName(c.getCommitterIdent()))); | |||
String comitterDate = GitBlitWebSession.get().formatDateTimeLong(c.getCommitterIdent().getWhen()); | |||
add(new Label("commitCommitterDate", comitterDate)); | |||
add(WicketUtils.createTimestampLabel("commitCommitterDate", c.getCommitterIdent().getWhen(), getTimeZone())); | |||
add(new Label("commitId", c.getName())); | |||
@@ -18,8 +18,8 @@ import com.codecommit.wicket.IChartData; | |||
import com.gitblit.StoredSettings; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.GitBlitWebApp; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.Metric; | |||
import com.gitblit.wicket.panels.BranchesPanel; | |||
import com.gitblit.wicket.panels.LogPanel; | |||
@@ -51,16 +51,12 @@ public class SummaryPage extends RepositoryPage { | |||
numberOfCommits += m.count; | |||
} | |||
String owner = JGitUtils.getRepositoryOwner(r); | |||
GitBlitWebSession session = GitBlitWebSession.get(); | |||
String lastchange = session.formatDateTimeLong(JGitUtils.getLastChange(r)); | |||
String cloneurl = GitBlitWebApp.get().getCloneUrl(repositoryName); | |||
// repository description | |||
add(new Label("repositoryDescription", description)); | |||
add(new Label("repositoryOwner", owner)); | |||
add(new Label("repositoryLastChange", lastchange)); | |||
add(new Label("repositoryCloneUrl", cloneurl)); | |||
add(new Label("repositoryOwner", JGitUtils.getRepositoryOwner(r))); | |||
add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r), getTimeZone())); | |||
add(new Label("repositoryCloneUrl", GitBlitWebApp.get().getCloneUrl(repositoryName))); | |||
add(new LogPanel("commitsPanel", repositoryName, null, r, numberCommits, 0)); | |||
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs)); |
@@ -6,9 +6,9 @@ import org.eclipse.jgit.lib.Repository; | |||
import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.RepositoryPage; | |||
import com.gitblit.wicket.WicketUtils; | |||
public class TagPage extends RepositoryPage { | |||
@@ -23,8 +23,7 @@ public class TagPage extends RepositoryPage { | |||
add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName()))); | |||
add(new Label("tagAuthor", JGitUtils.getDisplayName(c.getAuthorIdent()))); | |||
String authorDate = GitBlitWebSession.get().formatDateTimeLong(c.getAuthorIdent().getWhen()); | |||
add(new Label("tagDate", authorDate)); | |||
add(WicketUtils.createTimestampLabel("tagDate", c.getAuthorIdent().getWhen(), getTimeZone())); | |||
addFullText("fullMessage", c.getFullMessage(), true); | |||
} |
@@ -27,8 +27,7 @@ public class TicGitTicketPage extends RepositoryPage { | |||
add(new Label("ticketTitle", t.title)); | |||
add(new Label("ticketId", t.id)); | |||
add(new Label("ticketHandler", t.handler)); | |||
String openDate = GitBlitWebSession.get().formatDateTimeLong(t.date); | |||
add(new Label("ticketOpenDate", openDate)); | |||
add(WicketUtils.createTimestampLabel("ticketOpendate", t.date, getTimeZone())); | |||
Label stateLabel = new Label("ticketState", t.state); | |||
WicketUtils.setTicketCssClass(stateLabel, t.state); | |||
add(stateLabel); |
@@ -0,0 +1,21 @@ | |||
package com.gitblit.wicket.panels; | |||
import java.util.TimeZone; | |||
import org.apache.wicket.markup.html.panel.Panel; | |||
import com.gitblit.StoredSettings; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
public abstract class BasePanel extends Panel { | |||
private static final long serialVersionUID = 1L; | |||
public BasePanel(String wicketId) { | |||
super(wicketId); | |||
} | |||
protected TimeZone getTimeZone() { | |||
return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault(); | |||
} | |||
} |
@@ -6,7 +6,6 @@ import java.util.List; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.apache.wicket.markup.html.link.BookmarkablePageLink; | |||
import org.apache.wicket.markup.html.panel.Panel; | |||
import org.apache.wicket.markup.repeater.Item; | |||
import org.apache.wicket.markup.repeater.data.DataView; | |||
import org.apache.wicket.markup.repeater.data.ListDataProvider; | |||
@@ -15,7 +14,6 @@ import org.eclipse.jgit.lib.Constants; | |||
import org.eclipse.jgit.lib.Repository; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.RefModel; | |||
@@ -24,7 +22,7 @@ import com.gitblit.wicket.pages.LogPage; | |||
import com.gitblit.wicket.pages.SummaryPage; | |||
import com.gitblit.wicket.pages.TreePage; | |||
public class BranchesPanel extends Panel { | |||
public class BranchesPanel extends BasePanel { | |||
private static final long serialVersionUID = 1L; | |||
@@ -59,7 +57,7 @@ public class BranchesPanel extends Panel { | |||
public void populateItem(final Item<RefModel> item) { | |||
final RefModel entry = item.getModelObject(); | |||
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), GitBlitWebSession.get().getTimezone())); | |||
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), getTimeZone())); | |||
item.add(new LinkPanel("branchName", "list name", WicketUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()))); | |||
@@ -6,7 +6,6 @@ import java.util.Map; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.apache.wicket.markup.html.link.BookmarkablePageLink; | |||
import org.apache.wicket.markup.html.panel.Panel; | |||
import org.apache.wicket.markup.repeater.Item; | |||
import org.apache.wicket.markup.repeater.data.DataView; | |||
import org.apache.wicket.markup.repeater.data.ListDataProvider; | |||
@@ -17,7 +16,6 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.StoredSettings; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.pages.CommitPage; | |||
@@ -26,7 +24,7 @@ import com.gitblit.wicket.pages.LogPage; | |||
import com.gitblit.wicket.pages.SummaryPage; | |||
import com.gitblit.wicket.pages.TreePage; | |||
public class LogPanel extends Panel { | |||
public class LogPanel extends BasePanel { | |||
private static final long serialVersionUID = 1L; | |||
@@ -37,7 +35,7 @@ public class LogPanel extends Panel { | |||
if (itemsPerPage <= 1) { | |||
itemsPerPage = 50; | |||
} | |||
final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r); | |||
List<RevCommit> commits; | |||
if (pageResults) { | |||
@@ -68,7 +66,7 @@ public class LogPanel extends Panel { | |||
final RevCommit entry = item.getModelObject(); | |||
final Date date = JGitUtils.getCommitDate(entry); | |||
item.add(WicketUtils.createDateLabel("commitDate", date, GitBlitWebSession.get().getTimezone())); | |||
item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone())); | |||
String author = entry.getAuthorIdent().getName(); | |||
item.add(WicketUtils.createAuthorLabel("commitAuthor", author)); |
@@ -1,5 +1,6 @@ | |||
package com.gitblit.wicket.panels; | |||
import java.text.MessageFormat; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
@@ -14,6 +15,7 @@ import org.apache.wicket.markup.repeater.data.DataView; | |||
import org.apache.wicket.markup.repeater.data.ListDataProvider; | |||
import org.eclipse.jgit.lib.Repository; | |||
import com.gitblit.StoredSettings; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
@@ -52,9 +54,13 @@ public class PageLinksPanel extends Panel { | |||
add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
// Get the repository ticgit setting | |||
boolean checkTicgit = StoredSettings.getBoolean("ticgit.global", false); | |||
checkTicgit |= StoredSettings.getBoolean(MessageFormat.format("ticgit.{0}", repositoryName), false); | |||
// Add dynamic repository extras | |||
List<String> extras = new ArrayList<String>(); | |||
if (JGitUtils.getTicGitBranch(r) != null) { | |||
if (checkTicgit && JGitUtils.getTicGitBranch(r) != null) { | |||
extras.add("ticgit"); | |||
} | |||
@@ -6,7 +6,6 @@ import java.util.List; | |||
import java.util.Map; | |||
import org.apache.wicket.Component; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.apache.wicket.markup.html.panel.Panel; | |||
import org.apache.wicket.markup.repeater.Item; | |||
import org.apache.wicket.markup.repeater.data.DataView; | |||
@@ -17,6 +16,7 @@ import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.pages.CommitPage; | |||
import com.gitblit.wicket.pages.LogPage; | |||
import com.gitblit.wicket.pages.TagPage; | |||
@@ -32,7 +32,7 @@ public class RefsPanel extends Panel { | |||
refNames = new ArrayList<String>(); | |||
} | |||
Collections.sort(refNames); | |||
refNames.remove(Constants.HEAD); | |||
// refNames.remove(Constants.HEAD); | |||
ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames); | |||
DataView<String> refsView = new DataView<String>("ref", refsDp) { | |||
@@ -43,22 +43,19 @@ public class RefsPanel extends Panel { | |||
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 Label("refName", entry.substring(Constants.R_HEADS.length())); | |||
WicketUtils.setCssClass(c, "head"); | |||
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 Label("refName", entry.substring(Constants.R_REMOTES.length())); | |||
WicketUtils.setCssClass(c, "ref"); | |||
WicketUtils.setCssClass(c, "remoteRef"); | |||
} else if (entry.startsWith(Constants.R_TAGS)) { | |||
// tag | |||
// c = new BookmarkablePageLink<Void>("refName", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry)); | |||
c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()), TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry)); | |||
//c = new Label("refName", entry.substring(Constants.R_TAGS.length())); | |||
WicketUtils.setCssClass(c, "tag"); | |||
WicketUtils.setCssClass(c, "tagRef"); | |||
} else { | |||
// other | |||
c = new Label("refName", entry); | |||
c = new LinkPanel("refName", null, entry, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry)); | |||
WicketUtils.setCssClass(c, "otherRef"); | |||
} | |||
WicketUtils.setHtmlTitle(c, entry); | |||
item.add(c); |
@@ -4,7 +4,6 @@ import java.util.List; | |||
import org.apache.wicket.markup.html.basic.Label; | |||
import org.apache.wicket.markup.html.link.BookmarkablePageLink; | |||
import org.apache.wicket.markup.html.panel.Panel; | |||
import org.apache.wicket.markup.repeater.Item; | |||
import org.apache.wicket.markup.repeater.data.DataView; | |||
import org.apache.wicket.markup.repeater.data.ListDataProvider; | |||
@@ -12,7 +11,6 @@ import org.apache.wicket.model.StringResourceModel; | |||
import org.eclipse.jgit.lib.Repository; | |||
import com.gitblit.utils.JGitUtils; | |||
import com.gitblit.wicket.GitBlitWebSession; | |||
import com.gitblit.wicket.LinkPanel; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.models.RefModel; | |||
@@ -22,7 +20,7 @@ import com.gitblit.wicket.pages.SummaryPage; | |||
import com.gitblit.wicket.pages.TagPage; | |||
import com.gitblit.wicket.pages.TagsPage; | |||
public class TagsPanel extends Panel { | |||
public class TagsPanel extends BasePanel { | |||
private static final long serialVersionUID = 1L; | |||
@@ -49,7 +47,7 @@ public class TagsPanel extends Panel { | |||
public void populateItem(final Item<RefModel> item) { | |||
RefModel entry = item.getModelObject(); | |||
item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), GitBlitWebSession.get().getTimezone())); | |||
item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), getTimeZone())); | |||
item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName()))); | |||
String message; |
@@ -409,38 +409,45 @@ td.rightAlign { | |||
text-align: right; | |||
} | |||
span .tag, span .head, span .ref { | |||
span .tagRef, span .headRef, span .remoteRef, span .otherRef { | |||
padding: 0px 4px; | |||
margin-right:2px; | |||
font-family: sans-serif; | |||
font-size: 9px; | |||
font-weight: normal; | |||
border: 1px solid; | |||
color: black; | |||
} | |||
span .tag a, span .head a, span .ref a { | |||
span .tagRef a span, span .headRef a span, span .remoteRef a span, span .otherRef a span { | |||
font-size: 9px; | |||
} | |||
span .tagRef a, span .headRef a, span .remoteRef a, span .otherRef a { | |||
text-decoration: none; | |||
color: inherit; | |||
} | |||
span .tag a:hover, span .head a:hover, span .ref a:hover { | |||
span .tagRef a:hover, span .headRef a:hover, span .remoteRef a:hover, span .otherRef a:hover { | |||
color: inherit; | |||
} | |||
span .tag a span, span .head a span, span .ref a span { | |||
font-size: 9px; | |||
span .otherRef { | |||
background-color: #ffaaff; | |||
border-color: #ffccff #ff00ee #ff00ee #ffccff; | |||
} | |||
span .ref { | |||
span .remoteRef { | |||
background-color: #aaaaff; | |||
border-color: #ccccff #0033cc #0033cc #ccccff; | |||
} | |||
span .tag { | |||
span .tagRef { | |||
background-color: #ffffaa; | |||
border-color: #ffffcc #ffee00 #ffee00 #ffffcc; | |||
} | |||
span .head { | |||
span .headRef { | |||
background-color: #aaffaa; | |||
border-color: #ccffcc #00cc33 #00cc33 #ccffcc; | |||
} |