Eliminated most session usage.
1 files added
14 files modified
| | |
| | | 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.
|
| | |
| | | # 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
|
| | | #
|
| | |
| | | package com.gitblit.wicket;
|
| | |
|
| | | import java.util.TimeZone;
|
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | protected TimeZone getTimeZone() {
|
| | | return StoredSettings.getBoolean("useClientTimezone", false) ? GitBlitWebSession.get().getTimezone() : TimeZone.getDefault();
|
| | | }
|
| | | |
| | | protected String getServerName() {
|
| | | ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();
|
| | | HttpServletRequest req = servletWebRequest.getHttpServletRequest();
|
| | |
| | | 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;
|
| | | 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 {
|
| | |
|
| | |
| | | timezone = TimeZone.getDefault();
|
| | | }
|
| | | 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() {
|
| | |
| | | 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;
|
| | | }
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | 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()));
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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));
|
| | |
| | | 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 {
|
| | |
| | |
|
| | | 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);
|
| | | }
|
| | |
| | | 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);
|
New file |
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
|
| | |
| | | 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())));
|
| | |
|
| | |
| | |
|
| | | 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;
|
| | |
| | |
|
| | | 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;
|
| | |
| | | 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;
|
| | |
|
| | |
| | | if (itemsPerPage <= 1) {
|
| | | itemsPerPage = 50;
|
| | | }
|
| | | |
| | |
|
| | | final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);
|
| | | List<RevCommit> commits;
|
| | | if (pageResults) {
|
| | |
| | | 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));
|
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | 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;
|
| | |
| | | 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");
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
| | |
|
| | | 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;
|
| | |
|
| | |
| | | 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) {
|
| | |
| | | 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);
|
| | |
| | |
|
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | | } |