allowAdministration = true\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
+# 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
+\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\r
-datetimestampLongFormat = EEEE, MMMM d, yyyy h:mm a\r
+datetimestampShortFormat = yyyy-MM-dd h:mm a z\r
+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
# 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
\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
+\r
#\r
# Jetty Settings\r
#\r
package com.gitblit.wicket;\r
\r
+import java.util.TimeZone;\r
+\r
import javax.servlet.http.HttpServletRequest;\r
\r
import org.apache.wicket.PageParameters;\r
}\r
}\r
\r
+ protected TimeZone getTimeZone() {\r
+ return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();\r
+ }\r
+ \r
protected String getServerName() {\r
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();\r
HttpServletRequest req = servletWebRequest.getHttpServletRequest();\r
package com.gitblit.wicket;\r
\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Date;\r
import java.util.TimeZone;\r
\r
import org.apache.wicket.Request;\r
import org.apache.wicket.protocol.http.WebSession;\r
import org.apache.wicket.protocol.http.request.WebClientInfo;\r
\r
-import com.gitblit.StoredSettings;\r
-\r
-\r
public final class GitBlitWebSession extends WebSession {\r
\r
private static final long serialVersionUID = 1L;\r
return timezone;\r
}\r
\r
- public String formatTime(Date date) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("timestampFormat", "h:mm a"));\r
- df.setTimeZone(getTimezone());\r
- return df.format(date);\r
- }\r
-\r
- public String formatDate(Date date) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));\r
- df.setTimeZone(getTimezone());\r
- return df.format(date);\r
- }\r
-\r
- public String formatDateLong(Date date) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampLongFormat", "EEEE, MMMM d, yyyy"));\r
- df.setTimeZone(getTimezone());\r
- return df.format(date);\r
- }\r
-\r
- public String formatDateTime(Date date) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampShortFormat", "MM/dd/yy h:mm a"));\r
- df.setTimeZone(getTimezone());\r
- return df.format(date);\r
- }\r
-\r
- public String formatDateTimeLong(Date date) {\r
- DateFormat df = new SimpleDateFormat(StoredSettings.getString("datetimestampLongFormat", "EEEE, MMMM d, yyyy h:mm a z"));\r
- df.setTimeZone(getTimezone());\r
- return df.format(date);\r
- }\r
-\r
public static GitBlitWebSession get() {\r
return (GitBlitWebSession) Session.get();\r
}\r
WicketUtils.setHtmlTitle(label, title);\r
return label;\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
+ if (timeZone != null) {\r
+ df.setTimeZone(timeZone);\r
+ }\r
+ String dateString = df.format(date);\r
+ String title = Utils.timeAgo(date);\r
+ Label label = new Label(wicketId, dateString);\r
+ WicketUtils.setHtmlTitle(label, title);\r
+ return label;\r
+ }\r
}\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
import com.gitblit.wicket.WicketUtils;\r
addRefs(r, c);\r
\r
add(new Label("commitAuthor", JGitUtils.getDisplayName(c.getAuthorIdent())));\r
- String authorDate = GitBlitWebSession.get().formatDateTimeLong(c.getAuthorIdent().getWhen());\r
- add(new Label("commitAuthorDate", authorDate));\r
+ add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(), getTimeZone()));\r
\r
add(new Label("commitCommitter", JGitUtils.getDisplayName(c.getCommitterIdent())));\r
- String comitterDate = GitBlitWebSession.get().formatDateTimeLong(c.getCommitterIdent().getWhen());\r
- add(new Label("commitCommitterDate", comitterDate));\r
+ add(WicketUtils.createTimestampLabel("commitCommitterDate", c.getCommitterIdent().getWhen(), getTimeZone()));\r
\r
add(new Label("commitId", c.getName()));\r
\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.GitBlitWebApp;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.Metric;\r
import com.gitblit.wicket.panels.BranchesPanel;\r
import com.gitblit.wicket.panels.LogPanel;\r
numberOfCommits += m.count;\r
}\r
\r
- String owner = JGitUtils.getRepositoryOwner(r);\r
- GitBlitWebSession session = GitBlitWebSession.get();\r
- String lastchange = session.formatDateTimeLong(JGitUtils.getLastChange(r));\r
- String cloneurl = GitBlitWebApp.get().getCloneUrl(repositoryName);\r
-\r
// repository description\r
add(new Label("repositoryDescription", description));\r
- add(new Label("repositoryOwner", owner));\r
- add(new Label("repositoryLastChange", lastchange));\r
- add(new Label("repositoryCloneUrl", cloneurl));\r
+ add(new Label("repositoryOwner", JGitUtils.getRepositoryOwner(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
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
\r
\r
public class TagPage extends RepositoryPage {\r
\r
add(new LinkPanel("tagId", "list", c.getName(), CommitPage.class, newCommitParameter(c.getName())));\r
add(new Label("tagAuthor", JGitUtils.getDisplayName(c.getAuthorIdent())));\r
- String authorDate = GitBlitWebSession.get().formatDateTimeLong(c.getAuthorIdent().getWhen());\r
- add(new Label("tagDate", authorDate));\r
+ add(WicketUtils.createTimestampLabel("tagDate", c.getAuthorIdent().getWhen(), getTimeZone()));\r
\r
addFullText("fullMessage", c.getFullMessage(), true);\r
}\r
add(new Label("ticketTitle", t.title));\r
add(new Label("ticketId", t.id));\r
add(new Label("ticketHandler", t.handler));\r
- String openDate = GitBlitWebSession.get().formatDateTimeLong(t.date);\r
- add(new Label("ticketOpenDate", openDate));\r
+ add(WicketUtils.createTimestampLabel("ticketOpendate", t.date, getTimeZone()));\r
Label stateLabel = new Label("ticketState", t.state);\r
WicketUtils.setTicketCssClass(stateLabel, t.state);\r
add(stateLabel);\r
--- /dev/null
+package com.gitblit.wicket.panels;\r
+\r
+import java.util.TimeZone;\r
+\r
+import org.apache.wicket.markup.html.panel.Panel;\r
+\r
+import com.gitblit.StoredSettings;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+\r
+public abstract class BasePanel extends Panel {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public BasePanel(String wicketId) {\r
+ super(wicketId);\r
+ }\r
+\r
+ protected TimeZone getTimeZone() {\r
+ return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();\r
+ }\r
+}\r
\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\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.GitBlitWebSession;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.RefModel;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
-public class BranchesPanel extends Panel {\r
+public class BranchesPanel extends BasePanel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
public void populateItem(final Item<RefModel> item) {\r
final RefModel entry = item.getModelObject();\r
\r
- item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));\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
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\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
\r
import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.wicket.GitBlitWebSession;\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.SummaryPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
-public class LogPanel extends Panel {\r
+public class LogPanel extends BasePanel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
if (itemsPerPage <= 1) {\r
itemsPerPage = 50;\r
}\r
- \r
+\r
final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);\r
List<RevCommit> commits;\r
if (pageResults) {\r
final RevCommit entry = item.getModelObject();\r
final Date date = JGitUtils.getCommitDate(entry);\r
\r
- item.add(WicketUtils.createDateLabel("commitDate", date, GitBlitWebSession.get().getTimezone()));\r
+ item.add(WicketUtils.createDateLabel("commitDate", date, getTimeZone()));\r
\r
String author = entry.getAuthorIdent().getName();\r
item.add(WicketUtils.createAuthorLabel("commitAuthor", author));\r
package com.gitblit.wicket.panels;\r
\r
+import java.text.MessageFormat;\r
import java.util.ArrayList;\r
import java.util.HashMap;\r
import java.util.List;\r
import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
import org.eclipse.jgit.lib.Repository;\r
\r
+import com.gitblit.StoredSettings;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)));\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
// Add dynamic repository extras\r
List<String> extras = new ArrayList<String>();\r
- if (JGitUtils.getTicGitBranch(r) != null) {\r
+ if (checkTicgit && JGitUtils.getTicGitBranch(r) != null) {\r
extras.add("ticgit");\r
}\r
\r
import java.util.Map;\r
\r
import org.apache.wicket.Component;\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
\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.LogPage;\r
import com.gitblit.wicket.pages.TagPage;\r
\r
refNames = new ArrayList<String>();\r
}\r
Collections.sort(refNames);\r
- refNames.remove(Constants.HEAD);\r
+// refNames.remove(Constants.HEAD);\r
\r
ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames);\r
DataView<String> refsView = new DataView<String>("ref", refsDp) {\r
if (entry.startsWith(Constants.R_HEADS)) {\r
// local head\r
c = new LinkPanel("refName", null, entry.substring(Constants.R_HEADS.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
-// c = new Label("refName", entry.substring(Constants.R_HEADS.length()));\r
- WicketUtils.setCssClass(c, "head");\r
+ WicketUtils.setCssClass(c, "headRef");\r
} else if (entry.startsWith(Constants.R_REMOTES)) {\r
// remote head\r
c = new LinkPanel("refName", null, entry.substring(Constants.R_REMOTES.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
-// c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));\r
- WicketUtils.setCssClass(c, "ref");\r
+ WicketUtils.setCssClass(c, "remoteRef");\r
} else if (entry.startsWith(Constants.R_TAGS)) {\r
// tag\r
-// c = new BookmarkablePageLink<Void>("refName", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()), TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
- //c = new Label("refName", entry.substring(Constants.R_TAGS.length()));\r
- WicketUtils.setCssClass(c, "tag");\r
+ WicketUtils.setCssClass(c, "tagRef");\r
} else {\r
// other\r
- c = new Label("refName", entry);\r
+ c = new LinkPanel("refName", null, entry, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry));\r
+ WicketUtils.setCssClass(c, "otherRef");\r
}\r
WicketUtils.setHtmlTitle(c, entry);\r
item.add(c);\r
\r
import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.link.BookmarkablePageLink;\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.GitBlitWebSession;\r
import com.gitblit.wicket.LinkPanel;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.models.RefModel;\r
import com.gitblit.wicket.pages.TagPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
\r
-public class TagsPanel extends Panel {\r
+public class TagsPanel extends BasePanel {\r
\r
private static final long serialVersionUID = 1L;\r
\r
public void populateItem(final Item<RefModel> item) {\r
RefModel entry = item.getModelObject();\r
\r
- item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));\r
+ item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), getTimeZone()));\r
\r
item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName())));\r
String message;\r
text-align: right;\r
}\r
\r
-span .tag, span .head, span .ref {\r
+span .tagRef, span .headRef, span .remoteRef, span .otherRef { \r
padding: 0px 4px;\r
+ margin-right:2px;\r
font-family: sans-serif;\r
+ font-size: 9px;\r
font-weight: normal;\r
border: 1px solid;\r
color: black;\r
}\r
\r
-span .tag a, span .head a, span .ref a {\r
+span .tagRef a span, span .headRef a span, span .remoteRef a span, span .otherRef a span {\r
+ font-size: 9px;\r
+}\r
+\r
+span .tagRef a, span .headRef a, span .remoteRef a, span .otherRef a {\r
text-decoration: none;\r
color: inherit;\r
}\r
\r
-span .tag a:hover, span .head a:hover, span .ref a:hover {\r
+span .tagRef a:hover, span .headRef a:hover, span .remoteRef a:hover, span .otherRef a:hover {\r
color: inherit;\r
}\r
\r
-span .tag a span, span .head a span, span .ref a span {\r
- font-size: 9px;\r
+span .otherRef {\r
+ background-color: #ffaaff;\r
+ border-color: #ffccff #ff00ee #ff00ee #ffccff;\r
}\r
\r
-span .ref {\r
+span .remoteRef {\r
background-color: #aaaaff;\r
border-color: #ccccff #0033cc #0033cc #ccccff;\r
}\r
\r
-span .tag {\r
+span .tagRef {\r
background-color: #ffffaa;\r
border-color: #ffffcc #ffee00 #ffee00 #ffffcc;\r
}\r
\r
-span .head {\r
+span .headRef {\r
background-color: #aaffaa;\r
border-color: #ccffcc #00cc33 #00cc33 #ccffcc;\r
}
\ No newline at end of file