created panels for logs, tags, and branches.
8 files added
13 files deleted
26 files modified
| | |
| | | package com.gitblit.wicket;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.apache.wicket.Component;
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.WebPage;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | |
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.Utils;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | |
|
| | |
|
| | | public abstract class BasePage extends WebPage {
|
| | |
|
| | |
| | | ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();
|
| | | HttpServletRequest req = servletWebRequest.getHttpServletRequest();
|
| | | return req.getServerName();
|
| | | }
|
| | |
|
| | | protected Label createAuthorLabel(String wicketId, String author) {
|
| | | Label label = new Label(wicketId, author);
|
| | | WicketUtils.setHtmlTitle(label, author);
|
| | | return label;
|
| | | }
|
| | |
|
| | | protected Label createDateLabel(String wicketId, Date date) {
|
| | | Label label = new Label(wicketId, GitBlitWebSession.get().formatDate(date));
|
| | | WicketUtils.setCssClass(label, Utils.timeAgoCss(date));
|
| | | WicketUtils.setHtmlTitle(label, Utils.timeAgo(date));
|
| | | return label;
|
| | | }
|
| | |
|
| | | protected Label createShortlogDateLabel(String wicketId, Date date) {
|
| | | String dateString = GitBlitWebSession.get().formatDate(date);
|
| | | String title = Utils.timeAgo(date);
|
| | | if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000l) {
|
| | | dateString = title;
|
| | | title = GitBlitWebSession.get().formatDate(date);
|
| | | }
|
| | | Label label = new Label(wicketId, dateString);
|
| | | WicketUtils.setCssClass(label, Utils.timeAgoCss(date));
|
| | | WicketUtils.setHtmlTitle(label, title);
|
| | | return label;
|
| | | }
|
| | |
|
| | | protected void setAlternatingBackground(Component c, int i) {
|
| | | String clazz = i % 2 == 0 ? "dark" : "light";
|
| | | WicketUtils.setCssClass(c, clazz);
|
| | | }
|
| | |
|
| | | protected String trimShortLog(String string) {
|
| | | return trimString(string, 60);
|
| | | }
|
| | | |
| | | protected String trimString(String value, int max) {
|
| | | if (value.length() <= max) {
|
| | | return value;
|
| | | }
|
| | | return value.substring(0, max - 3) + "...";
|
| | | }
|
| | |
|
| | | public void error(String message, Throwable t) {
|
| | |
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.DiffPage;
|
| | | import com.gitblit.wicket.pages.RepositoriesPage;
|
| | | import com.gitblit.wicket.pages.ShortLogPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TagPage;
|
| | | import com.gitblit.wicket.pages.TagsPage;
|
| | |
| | |
|
| | | // setup the standard gitweb-ish urls
|
| | | mount(new MixedParamUrlCodingStrategy("/summary", SummaryPage.class, new String[] { "p" }));
|
| | | mount(new MixedParamUrlCodingStrategy("/shortlog", ShortLogPage.class, new String[] { "p", "h" }));
|
| | | mount(new MixedParamUrlCodingStrategy("/shortlog", LogPage.class, new String[] { "p", "h" }));
|
| | | mount(new MixedParamUrlCodingStrategy("/tags", TagsPage.class, new String[] { "p" }));
|
| | | mount(new MixedParamUrlCodingStrategy("/branches", BranchesPage.class, new String[] { "p" }));
|
| | | mount(new MixedParamUrlCodingStrategy("/commit", CommitPage.class, new String[] { "p", "h" }));
|
| | |
| | | gb.branches = branches
|
| | | gb.patch = patch
|
| | | gb.diff = diff
|
| | | gb.shortlog = shortlog
|
| | | gb.more = more
|
| | | gb.allTags = all tags
|
| | | gb.allBranches = all branches
|
| | | gb.log = log
|
| | | gb.moreLogs = more commits...
|
| | | gb.allTags = all tags...
|
| | | gb.allBranches = all branches...
|
| | | gb.summary = summary
|
| | | gb.ticket = ticket
|
| | | gb.newRepository = new repository
|
| | |
| | | redirectToInterceptPage(new RepositoriesPage());
|
| | | }
|
| | | repositoryName = params.getString("p", "");
|
| | | commitId = params.getString("h", "");
|
| | | commitId = params.getString("h", "HEAD");
|
| | |
|
| | | Repository r = getRepository();
|
| | |
|
| | |
| | | }
|
| | |
|
| | | protected PageParameters newRepositoryParameter() {
|
| | | return new PageParameters("p=" + repositoryName);
|
| | | return WicketUtils.newRepositoryParameter(repositoryName);
|
| | | }
|
| | |
|
| | | protected PageParameters newCommitParameter() {
|
| | | return newCommitParameter(commitId);
|
| | | return WicketUtils.newCommitParameter(repositoryName, commitId);
|
| | | }
|
| | |
|
| | | protected PageParameters newCommitParameter(String commitId) {
|
| | | if (commitId == null || commitId.trim().length() == 0) {
|
| | | return newRepositoryParameter();
|
| | | }
|
| | | return new PageParameters("p=" + repositoryName + ",h=" + commitId);
|
| | | return WicketUtils.newCommitParameter(repositoryName, commitId);
|
| | | }
|
| | |
|
| | | protected PageParameters newPathParameter(String path) {
|
| | | if (path == null || path.trim().length() == 0) {
|
| | | return newCommitParameter();
|
| | | }
|
| | | return new PageParameters("p=" + repositoryName + ",h=" + commitId + ",f=" + path);
|
| | | return WicketUtils.newPathParameter(repositoryName, commitId, path);
|
| | | }
|
| | | }
|
| | |
| | | package com.gitblit.wicket;
|
| | |
|
| | | import java.text.DateFormat;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.TimeZone;
|
| | |
|
| | | import org.apache.wicket.Component;
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.behavior.SimpleAttributeModifier;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | |
|
| | | import com.gitblit.StoredSettings;
|
| | | import com.gitblit.utils.Utils;
|
| | |
|
| | | public class WicketUtils {
|
| | |
|
| | |
| | | }
|
| | | return sb.toString().trim();
|
| | | }
|
| | | |
| | | public static void setAlternatingBackground(Component c, int i) {
|
| | | String clazz = i % 2 == 0 ? "dark" : "light";
|
| | | setCssClass(c, clazz);
|
| | | }
|
| | | |
| | | public static Label createAuthorLabel(String wicketId, String author) {
|
| | | Label label = new Label(wicketId, author);
|
| | | WicketUtils.setHtmlTitle(label, author);
|
| | | return label;
|
| | | }
|
| | |
|
| | | public static String trimShortLog(String string) {
|
| | | return trimString(string, 60);
|
| | | }
|
| | | |
| | | public static String trimString(String value, int max) {
|
| | | if (value.length() <= max) {
|
| | | return value;
|
| | | }
|
| | | return value.substring(0, max - 3) + "...";
|
| | | }
|
| | | |
| | | public static PageParameters newRepositoryParameter(String repositoryName) {
|
| | | return new PageParameters("p=" + repositoryName);
|
| | | }
|
| | |
|
| | | public static PageParameters newCommitParameter(String repositoryName, String commitId) {
|
| | | if (commitId == null || commitId.trim().length() == 0) {
|
| | | return newRepositoryParameter(repositoryName);
|
| | | }
|
| | | return new PageParameters("p=" + repositoryName + ",h=" + commitId);
|
| | | }
|
| | |
|
| | | public static PageParameters newPathParameter(String repositoryName, String commitId, String path) {
|
| | | if (path == null || path.trim().length() == 0) {
|
| | | return newCommitParameter(repositoryName, commitId);
|
| | | }
|
| | | return new PageParameters("p=" + repositoryName + ",h=" + commitId + ",f=" + path);
|
| | | }
|
| | | |
| | | public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | DateFormat df = new SimpleDateFormat(StoredSettings.getString("datestampShortFormat", "MM/dd/yy"));
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | }
|
| | | String dateString = df.format(date);
|
| | | String title = Utils.timeAgo(date);
|
| | | if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000l) {
|
| | | String tmp = dateString;
|
| | | dateString = title;
|
| | | title = tmp;
|
| | | }
|
| | | Label label = new Label(wicketId, dateString);
|
| | | WicketUtils.setCssClass(label, Utils.timeAgoCss(date));
|
| | | WicketUtils.setHtmlTitle(label, title);
|
| | | return label;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public boolean isAnnotatedTag() {
|
| | | return ref.isPeeled();
|
| | | // ref.isPeeled() ??
|
| | | return !getCommitId().equals(getObjectId());
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | <div wicket:id="breadcrumbs">[breadcrumbs]</div>
|
| | |
|
| | | <!-- blob content -->
|
| | | <pre wicket:id="blobText">[blob content]</pre>
|
| | | <pre style="border:0px;" wicket:id="blobText">[blob content]</pre>
|
| | |
|
| | | </body>
|
| | | </wicket:extend>
|
| | |
| | | <!-- page nav links -->
|
| | | <div wicket:id="pageLinks">[page links]</div>
|
| | |
|
| | | <!-- shortlog --> |
| | | <div style="margin-top:5px;" class="header" wicket:id="summary">[header]</div> |
| | | <table class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="branch">
|
| | | <td class="date"><span wicket:id="branchDate">[branch date]</span></td>
|
| | | <td><div wicket:id="branchName">[branch name]</div></td>
|
| | | <td><div wicket:id="branchType">[branch type]</div></td>
|
| | | <td class="rightAlign"><span wicket:id="branchLinks">[branch links]</span></td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table> |
| | | <!-- branches --> |
| | | <div style="margin-top:5px;" wicket:id="branchesPanel">[branches panel]</div>
|
| | |
|
| | | </wicket:extend>
|
| | | </body>
|
| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | 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.Constants;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.Utils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.panels.BranchLinksPanel;
|
| | | import com.gitblit.wicket.panels.BranchesPanel;
|
| | |
|
| | |
|
| | | public class BranchesPage extends RepositoryPage {
|
| | |
| | | public BranchesPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | Repository r = getRepository();
|
| | | List<RefModel> branches = new ArrayList<RefModel>();
|
| | | branches.addAll(JGitUtils.getLocalBranches(r, -1));
|
| | | branches.addAll(JGitUtils.getRemoteBranches(r, -1));
|
| | |
|
| | | // shortlog
|
| | | add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
|
| | |
|
| | | ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
|
| | | DataView<RefModel> branchView = new DataView<RefModel>("branch", branchesDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RefModel> item) {
|
| | | final RefModel entry = item.getModelObject();
|
| | | String date;
|
| | | if (entry.getDate() != null) {
|
| | | date = Utils.timeAgo(entry.getDate());
|
| | | } else {
|
| | | date = "";
|
| | | }
|
| | | Label branchDateLabel = new Label("branchDate", date);
|
| | | item.add(branchDateLabel);
|
| | | WicketUtils.setCssClass(branchDateLabel, Utils.timeAgoCss(entry.getDate()));
|
| | |
|
| | | item.add(new LinkPanel("branchName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));
|
| | |
|
| | | boolean remote = entry.getName().startsWith(Constants.R_REMOTES);
|
| | | item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")));
|
| | | |
| | | item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));
|
| | | |
| | | String clazz = counter % 2 == 0 ? "dark" : "light";
|
| | | WicketUtils.setCssClass(item, clazz);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(branchView);
|
| | | add(new BranchesPanel("branchesPanel", repositoryName, getRepository(), -1));
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | <table class="pretty">
|
| | | <tr wicket:id="changedPath">
|
| | | <td class="path"><span wicket:id="pathName">[commit path]</span></td>
|
| | | <td><span wicket:id="pathLinks">[path links]</span></td>
|
| | | <td>
|
| | | <div class="link">
|
| | | <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="history"><wicket:message key="gb.history"></wicket:message></a>
|
| | | </div>
|
| | | </td>
|
| | | </tr>
|
| | | </table>
|
| | |
|
| | |
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | 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.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.panels.PathLinksPanel;
|
| | |
|
| | |
|
| | | public class CommitPage extends RepositoryPage {
|
| | |
| | | }
|
| | | add(new Label("patchLink", getString("gb.patch")));
|
| | |
|
| | | add(new LinkPanel("shortlog", "title", c.getShortMessage(), ShortLogPage.class, newRepositoryParameter()));
|
| | | add(new LinkPanel("shortlog", "title", c.getShortMessage(), LogPage.class, newRepositoryParameter()));
|
| | |
|
| | | addRefs(r, c);
|
| | |
|
| | |
| | | } else {
|
| | | item.add(new LinkPanel("pathName", "list", entry.path, BlobPage.class, newPathParameter(entry.path)));
|
| | | }
|
| | | item.add(new PathLinksPanel("pathLinks", repositoryName, entry));
|
| | | String clazz = counter % 2 == 0 ? "dark" : "light";
|
| | | WicketUtils.setCssClass(item, clazz);
|
| | | |
| | | item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, newPathParameter(entry.path)));
|
| | | item.add(new BookmarkablePageLink<Void>("view", BlobPage.class, newPathParameter(entry.path)));
|
| | | item.add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));
|
| | |
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
New file |
| | |
| | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| | | <html xmlns="http://www.w3.org/1999/xhtml" |
| | | xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" |
| | | xml:lang="en" |
| | | lang="en"> |
| | |
|
| | | <body>
|
| | | <wicket:extend>
|
| | |
|
| | | <!-- page nav links --> |
| | | <div wicket:id="pageLinks">[page links]</div>
|
| | |
|
| | | <!-- log -->
|
| | | <div style="margin-top:5px;" wicket:id="logPanel">[log panel]</div>
|
| | | |
| | | </wicket:extend>
|
| | | </body>
|
| | | </html> |
New file |
| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | |
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.panels.LogPanel;
|
| | |
|
| | |
|
| | | public class LogPage extends RepositoryPage {
|
| | |
|
| | | public LogPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | add(new LogPanel("logPanel", repositoryName, getRepository(), 100, true));
|
| | | }
|
| | | |
| | | @Override
|
| | | protected String getPageName() {
|
| | | return getString("gb.log");
|
| | | }
|
| | | }
|
| | |
| | | </div>
|
| | | </div>
|
| | |
|
| | | <!-- shortlog -->
|
| | | <div class="header" wicket:id="shortlog">[shortlog header]</div> |
| | | <table style="width:100%" class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="commit">
|
| | | <td class="date"><span wicket:id="commitDate">[commit date]</span></td>
|
| | | <td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>
|
| | | <td><div wicket:id="commitShortMessage">[commit short message]</div></td>
|
| | | <td class="rightAlign"><div wicket:id="commitRefs">[commit refs]</div></td>
|
| | | <td class="rightAlign"><span wicket:id="commitLinks">[commit links]</span></td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table> |
| | | <div class="pager" wicket:id="shortlogMore">[more shortlogs]</div>
|
| | | <!-- commits -->
|
| | | <div wicket:id="commitsPanel">[commits panel]</div> |
| | |
|
| | | <!-- Open Branches Body -->
|
| | | <!-- branches -->
|
| | | <div style="width:400px; float:left;">
|
| | | <!-- heads -->
|
| | | <div class="header" wicket:id="branches">[branches header]</div> |
| | | <table style="width:100%" class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="branch">
|
| | | <td class="date"><span wicket:id="branchDate">[branch date]</span></td>
|
| | | <td><div wicket:id="branchName">[branch name]</div></td>
|
| | | <td class="rightAlign"><span wicket:id="branchLinks">[branch links]</span></td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table>
|
| | | <div class="pager" wicket:id="allBranches">[all branches]</div>
|
| | | <!-- Close Branches Body -->
|
| | | <div wicket:id="branchesPanel">[branches panel]</div>
|
| | | </div>
|
| | |
|
| | | <!-- Open Tags body -->
|
| | | <div style="margin-left:405px;">
|
| | | <!-- tags -->
|
| | | <div class="header" wicket:id="tags">[tags header]</div> |
| | | <table style="width:100%" class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="tag">
|
| | | <td class="date"><span wicket:id="tagDate">[tag date]</span></td>
|
| | | <td><b><div wicket:id="tagName">[tag name]</div></b></td>
|
| | | <td><div wicket:id="tagDescription">[tag description]</div></td>
|
| | | <td class="rightAlign"><span wicket:id="tagLinks">[tag links]</span></td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table>
|
| | | <div class="pager" wicket:id="allTags">[all tags]</div> |
| | | <!-- Close Tags Body -->
|
| | | <div style="margin-left:405px;">
|
| | | <div wicket:id="tagsPanel">[tags panel]</div>
|
| | | </div>
|
| | |
|
| | | </wicket:extend>
|
| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.awt.Dimension;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.image.ContextImage;
|
| | | 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.ObjectId;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.codecommit.wicket.AbstractChartData;
|
| | | import com.codecommit.wicket.Chart;
|
| | |
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.Metric;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.panels.AnnotatedTagLinksPanel;
|
| | | import com.gitblit.wicket.panels.BranchLinksPanel;
|
| | | import com.gitblit.wicket.panels.RefsPanel;
|
| | | import com.gitblit.wicket.panels.ShortLogLinksPanel;
|
| | | import com.gitblit.wicket.panels.TagLinksPanel;
|
| | | import com.gitblit.wicket.panels.BranchesPanel;
|
| | | import com.gitblit.wicket.panels.LogPanel;
|
| | | import com.gitblit.wicket.panels.TagsPanel;
|
| | |
|
| | | public class SummaryPage extends RepositoryPage {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | Repository r = getRepository();
|
| | | final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);
|
| | |
|
| | | String owner = JGitUtils.getRepositoryOwner(r);
|
| | | GitBlitWebSession session = GitBlitWebSession.get();
|
| | |
| | | add(new Label("repositoryLastChange", lastchange));
|
| | | add(new Label("repositoryCloneUrl", cloneurl));
|
| | |
|
| | | // shortlog
|
| | | add(new LinkPanel("shortlog", "title", getString("gb.shortlog"), ShortLogPage.class, newRepositoryParameter()));
|
| | |
|
| | | List<RevCommit> commits = JGitUtils.getRevLog(r, numberCommits);
|
| | | ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
|
| | | DataView<RevCommit> shortlogView = new DataView<RevCommit>("commit", dp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RevCommit> item) {
|
| | | RevCommit entry = item.getModelObject();
|
| | | Date date = JGitUtils.getCommitDate(entry);
|
| | |
|
| | | item.add(createShortlogDateLabel("commitDate", date));
|
| | |
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | item.add(createAuthorLabel("commitAuthor", author));
|
| | |
|
| | | String shortMessage = entry.getShortMessage();
|
| | | String trimmedMessage = trimShortLog(shortMessage);
|
| | | LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, newCommitParameter(entry.getName()));
|
| | | if (!shortMessage.equals(trimmedMessage)) {
|
| | | WicketUtils.setHtmlTitle(shortlog, shortMessage);
|
| | | }
|
| | | item.add(shortlog);
|
| | |
|
| | | item.add(new RefsPanel("commitRefs", entry, allRefs));
|
| | |
|
| | | item.add(new ShortLogLinksPanel("commitLinks", repositoryName, entry.getName()));
|
| | |
|
| | | setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(shortlogView);
|
| | | if (commits.size() < numberCommits) {
|
| | | add(new Label("shortlogMore", "").setVisible(false));
|
| | | } else {
|
| | | add(new LinkPanel("shortlogMore", "link", getString("gb.more") + "...", ShortLogPage.class, newRepositoryParameter()));
|
| | | }
|
| | |
|
| | | // tags
|
| | | List<RefModel> tags = JGitUtils.getTags(r, numberRefs);
|
| | | add(new LinkPanel("tags", "title", getString("gb.tags"), TagsPage.class, newRepositoryParameter()));
|
| | |
|
| | | ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);
|
| | | DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RefModel> item) {
|
| | | final RefModel entry = item.getModelObject();
|
| | |
|
| | | item.add(createDateLabel("tagDate", entry.getDate()));
|
| | |
|
| | | item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getCommitId().getName())));
|
| | |
|
| | | if (entry.isAnnotatedTag()) {
|
| | | // annotated tag
|
| | | item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName())));
|
| | | item.add(new AnnotatedTagLinksPanel("tagLinks", repositoryName, entry));
|
| | | } else {
|
| | | // simple tag on commit object
|
| | | item.add(new Label("tagDescription", ""));
|
| | | item.add(new TagLinksPanel("tagLinks", repositoryName, entry));
|
| | | }
|
| | |
|
| | | setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(tagView);
|
| | | if (tags.size() < numberRefs) {
|
| | | add(new Label("allTags", "").setVisible(false));
|
| | | } else {
|
| | | add(new LinkPanel("allTags", "link", getString("gb.allTags") + "...", TagsPage.class, newRepositoryParameter()));
|
| | | }
|
| | |
|
| | | // branches
|
| | | List<RefModel> branches = new ArrayList<RefModel>();
|
| | | branches.addAll(JGitUtils.getLocalBranches(r, numberRefs));
|
| | | branches.addAll(JGitUtils.getRemoteBranches(r, numberRefs));
|
| | | Collections.sort(branches);
|
| | | Collections.reverse(branches);
|
| | | if (numberRefs > 0 && branches.size() > numberRefs) {
|
| | | branches = new ArrayList<RefModel>(branches.subList(0, numberRefs));
|
| | | }
|
| | |
|
| | | add(new LinkPanel("branches", "title", getString("gb.branches"), BranchesPage.class, newRepositoryParameter()));
|
| | |
|
| | | ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
|
| | | DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RefModel> item) {
|
| | | final RefModel entry = item.getModelObject();
|
| | |
|
| | | item.add(createDateLabel("branchDate", entry.getDate()));
|
| | |
|
| | | item.add(new LinkPanel("branchName", "list name", trimString(entry.getDisplayName(), 28), ShortLogPage.class, newCommitParameter(entry.getName())));
|
| | |
|
| | | item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));
|
| | |
|
| | | setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(branchesView);
|
| | | if (branches.size() < numberRefs) {
|
| | | add(new Label("allBranches", "").setVisible(false));
|
| | | } else {
|
| | | add(new LinkPanel("allBranches", "link", getString("gb.allBranches") + "...", BranchesPage.class, newRepositoryParameter()));
|
| | | }
|
| | | add(new LogPanel("commitsPanel", repositoryName, r, numberCommits, false));
|
| | | add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs));
|
| | | add(new BranchesPanel("branchesPanel", repositoryName, r, numberRefs));
|
| | |
|
| | | // Display an activity line graph
|
| | | insertActivityGraph(r);
|
| | |
| | | <!-- page nav links -->
|
| | | <div wicket:id="pageLinks">[page links]</div>
|
| | |
|
| | | <!-- shortlog --> |
| | | <div style="margin-top:5px;" class="header" wicket:id="summary">[header]</div> |
| | | <table class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="tag">
|
| | | <td class="date"><span wicket:id="tagDate">[tag date]</span></td>
|
| | | <td><b><div wicket:id="tagName">[tag name]</div></b></td>
|
| | | <td><div wicket:id="tagDescription">[tag description]</div></td>
|
| | | <td class="rightAlign"><span wicket:id="tagLinks">[tag links]</span></td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table> |
| | | <!-- tags panel -->
|
| | | <div style="margin-top:5px;" wicket:id="tagsPanel">[tags panel]</div>
|
| | |
|
| | | </wicket:extend>
|
| | | </body>
|
| | |
| | | package com.gitblit.wicket.pages;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | 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.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.models.RefModel;
|
| | | import com.gitblit.wicket.panels.AnnotatedTagLinksPanel;
|
| | | import com.gitblit.wicket.panels.TagLinksPanel;
|
| | | import com.gitblit.wicket.panels.TagsPanel;
|
| | |
|
| | |
|
| | | public class TagsPage extends RepositoryPage {
|
| | |
|
| | | public TagsPage(PageParameters params) {
|
| | | super(params);
|
| | | Repository r = getRepository();
|
| | | List<RefModel> tags = JGitUtils.getTags(r, -1);
|
| | |
|
| | | // shortlog
|
| | | add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
|
| | | add(new TagsPanel("tagsPanel", repositoryName, getRepository(), -1));
|
| | |
|
| | | ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);
|
| | | DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RefModel> item) {
|
| | | final RefModel entry = item.getModelObject();
|
| | | item.add(createDateLabel("tagDate", entry.getDate()));
|
| | |
|
| | | item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, newCommitParameter(entry.getObjectId().getName())));
|
| | |
|
| | | if (entry.isAnnotatedTag()) {
|
| | | // annotated tag
|
| | | item.add(new LinkPanel("tagDescription", "list subject", entry.getShortLog(), TagPage.class, newCommitParameter(entry.getObjectId().getName())));
|
| | | item.add(new AnnotatedTagLinksPanel("tagLinks", repositoryName, entry));
|
| | | } else {
|
| | | // simple tag on commit object
|
| | | item.add(new Label("tagDescription", ""));
|
| | | item.add(new TagLinksPanel("tagLinks", repositoryName, entry));
|
| | | }
|
| | |
|
| | | setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(tagView);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | <div wicket:id="pageLinks">[page links]</div>
|
| | |
|
| | | <!-- header -->
|
| | | <div style="margin-top:5px;" class="header" wicket:id="summary">[header]</div>
|
| | | <div style="margin-top:5px;" class="header" wicket:id="header">[header]</div>
|
| | |
|
| | | <!-- tickets -->
|
| | | <table style="width:100%" class="pretty">
|
| | |
| | | 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.utils.TicGitTicket;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.RepositoryPage;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | |
| | | public TicGitPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | Repository r = getRepository();
|
| | | List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(r);
|
| | | List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(getRepository());
|
| | |
|
| | | // shortlog
|
| | | add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
|
| | | // header
|
| | | add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
|
| | |
|
| | | ListDataProvider<TicGitTicket> ticketsDp = new ListDataProvider<TicGitTicket>(tickets);
|
| | | DataView<TicGitTicket> ticketsView = new DataView<TicGitTicket>("ticket", ticketsDp) {
|
| | |
| | | Label stateLabel = new Label("ticketState", entry.state);
|
| | | WicketUtils.setTicketCssClass(stateLabel, entry.state);
|
| | | item.add(stateLabel);
|
| | | item.add(createDateLabel("ticketDate", entry.date));
|
| | | item.add(new Label("ticketHandler", trimString(entry.handler, 30)));
|
| | | item.add(new LinkPanel("ticketTitle", null, trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));
|
| | | item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));
|
| | | item.add(new Label("ticketHandler", WicketUtils.trimString(entry.handler, 30)));
|
| | | item.add(new LinkPanel("ticketTitle", null, WicketUtils.trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));
|
| | |
|
| | | setAlternatingBackground(item, counter);
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | |
| | | <tbody>
|
| | | <tr wicket:id="comment">
|
| | | <td class="date"><span wicket:id="commentDate">[comment date]</span></td>
|
| | | <td><b><div wicket:id="commentAuthor">[comment author]</div></b></td>
|
| | | <td class="author"><span wicket:id="commentAuthor">[comment author]</span></td>
|
| | | <td><div wicket:id="commentText">[comment text]</div></td>
|
| | | </tr>
|
| | | </tbody>
|
| | |
| | |
|
| | | public void populateItem(final Item<Comment> item) {
|
| | | final Comment entry = item.getModelObject();
|
| | | item.add(createDateLabel("commentDate", entry.date));
|
| | | item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone()));
|
| | | item.add(new Label("commentAuthor", entry.author));
|
| | | item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false));
|
| | | setAlternatingBackground(item, counter);
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.apache.wicket.markup.html.panel.Panel;
|
| | |
|
| | | import com.gitblit.wicket.pages.RepositoriesPage;
|
| | |
|
| | | public class AdminLinksPanel extends BasePanel {
|
| | | public class AdminLinksPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
New file |
| | |
| | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| | | <html xmlns="http://www.w3.org/1999/xhtml" |
| | | xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" |
| | | xml:lang="en" |
| | | lang="en"> |
| | |
|
| | | <body>
|
| | | <wicket:panel>
|
| | |
|
| | | <!-- header -->
|
| | | <div class="header" wicket:id="branches">[branches header]</div> |
| | | |
| | | <table style="width:100%;" class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="branch">
|
| | | <td class="date"><span wicket:id="branchDate">[branch date]</span></td>
|
| | | <td><span wicket:id="branchName">[branch name]</span></td>
|
| | | <td><span wicket:id="branchType">[branch type]</span></td>
|
| | | <td class="rightAlign">
|
| | | <div class="link">
|
| | | <a wicket:id="log"><wicket:message key="gb.log"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>
|
| | | </div> |
| | | </td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table> |
| | |
|
| | | <div wicket:id="allBranches">[all branches]</div> |
| | | |
| | | <!-- spacer -->
|
| | | <div style="padding:5px;"></div>
|
| | | </wicket:panel>
|
| | | </body>
|
| | | </html> |
New file |
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | 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;
|
| | | import org.apache.wicket.model.StringResourceModel;
|
| | | 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;
|
| | | import com.gitblit.wicket.pages.BranchesPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class BranchesPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public BranchesPanel(String wicketId, final String repositoryName, Repository r, final int maxCount) {
|
| | | super(wicketId);
|
| | |
|
| | | // branches
|
| | | List<RefModel> branches = new ArrayList<RefModel>();
|
| | | branches.addAll(JGitUtils.getLocalBranches(r, maxCount));
|
| | | branches.addAll(JGitUtils.getRemoteBranches(r, maxCount));
|
| | | Collections.sort(branches);
|
| | | Collections.reverse(branches);
|
| | | if (maxCount > 0 && branches.size() > maxCount) {
|
| | | branches = new ArrayList<RefModel>(branches.subList(0, maxCount));
|
| | | }
|
| | |
|
| | | if (maxCount > 0) {
|
| | | // summary page
|
| | | // show branches page link
|
| | | add(new LinkPanel("branches", "title", new StringResourceModel("gb.branches", this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | } else {
|
| | | // branches page
|
| | | // show repository summary page link
|
| | | add(new LinkPanel("branches", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | | |
| | | ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
|
| | | DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RefModel> item) {
|
| | | final RefModel entry = item.getModelObject();
|
| | |
|
| | | item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));
|
| | |
|
| | | item.add(new LinkPanel("branchName", "list name", WicketUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | | |
| | | // only show branch type on the branches page
|
| | | boolean remote = entry.getName().startsWith(Constants.R_REMOTES);
|
| | | item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")).setVisible(maxCount <= 0));
|
| | | |
| | | item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | | item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | |
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(branchesView);
|
| | | if (branches.size() < maxCount || maxCount <= 0) {
|
| | | add(new Label("allBranches", "").setVisible(false));
|
| | | } else {
|
| | | add(new LinkPanel("allBranches", "link", new StringResourceModel("gb.allBranches", this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| | | <html xmlns="http://www.w3.org/1999/xhtml" |
| | | xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" |
| | | xml:lang="en" |
| | | lang="en"> |
| | |
|
| | | <body>
|
| | | <wicket:panel>
|
| | |
|
| | | <!-- header --> |
| | | <div class="header" wicket:id="header">[log header]</div>
|
| | | |
| | | <table style="width:100%" class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="commit">
|
| | | <td class="date"><span wicket:id="commitDate">[commit date]</span></td>
|
| | | <td class="author"><span wicket:id="commitAuthor">[commit author]</span></td>
|
| | | <td><div wicket:id="commitShortMessage">[commit short message]</div></td>
|
| | | <td class="rightAlign"><div wicket:id="commitRefs">[commit refs]</div></td> |
| | | <td class="rightAlign"><div class="link">
|
| | | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="diff"><wicket:message key="gb.diff"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a>
|
| | | </div>
|
| | | </td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table> |
| | | <div class="pager" wicket:id="pageLogs">[pager]</div>
|
| | | <div wicket:id="moreLogs">[more...]</div>
|
| | | |
| | | <!-- spacer -->
|
| | | <div style="padding:5px;"></div>
|
| | | </wicket:panel>
|
| | | </body>
|
| | | </html> |
New file |
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | 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.navigation.paging.PagingNavigator;
|
| | | 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.apache.wicket.model.StringResourceModel;
|
| | | import org.eclipse.jgit.lib.ObjectId;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | 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.DiffPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class LogPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public LogPanel(String wicketId, final String repositoryName, Repository r, int maxCount, boolean showPager) {
|
| | | super(wicketId);
|
| | |
|
| | | final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);
|
| | | List<RevCommit> commits = JGitUtils.getRevLog(r, maxCount);
|
| | |
|
| | | // header
|
| | | if (showPager) {
|
| | | // shortlog page
|
| | | // show repository summary page link
|
| | | add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName))); |
| | | } else {
|
| | | // summary page
|
| | | // show shortlog page link
|
| | | add(new LinkPanel("header", "title", new StringResourceModel("gb.log", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | |
|
| | | ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);
|
| | | DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RevCommit> item) {
|
| | | final RevCommit entry = item.getModelObject();
|
| | | final Date date = JGitUtils.getCommitDate(entry);
|
| | |
|
| | | item.add(WicketUtils.createDateLabel("commitDate", date, GitBlitWebSession.get().getTimezone()));
|
| | |
|
| | | String author = entry.getAuthorIdent().getName();
|
| | | item.add(WicketUtils.createAuthorLabel("commitAuthor", author));
|
| | |
|
| | | String shortMessage = entry.getShortMessage();
|
| | | String trimmedMessage = WicketUtils.trimShortLog(shortMessage);
|
| | | LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName()));
|
| | | if (!shortMessage.equals(trimmedMessage)) {
|
| | | WicketUtils.setHtmlTitle(shortlog, shortMessage);
|
| | | }
|
| | | item.add(shortlog);
|
| | |
|
| | | item.add(new RefsPanel("commitRefs", entry, allRefs));
|
| | |
|
| | | item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | | item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | | item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | |
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(logView);
|
| | |
|
| | | // determine to show pager, more, or neither
|
| | | if (maxCount <= 0) {
|
| | | // no display limit
|
| | | add(new Label("moreLogs", "").setVisible(false));
|
| | | add(new Label("pageLogs", "").setVisible(false));
|
| | | } else {
|
| | | if (commits.size() == maxCount) {
|
| | |
|
| | | }
|
| | | if (showPager) {
|
| | | // paging
|
| | | add(new Label("moreLogs", "").setVisible(false));
|
| | | if (commits.size() == maxCount) {
|
| | | // show pager
|
| | | logView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT);
|
| | | add(new PagingNavigator("pageLogs", logView));
|
| | | } else {
|
| | | // nothing to page
|
| | | add(new Label("pageLogs", "").setVisible(false));
|
| | | }
|
| | | } else {
|
| | | // more
|
| | | add(new Label("pageLogs", "").setVisible(false));
|
| | | if (commits.size() == maxCount) {
|
| | | // show more
|
| | | add(new LinkPanel("moreLogs", "link", new StringResourceModel("gb.moreLogs", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | } else {
|
| | | // no more
|
| | | add(new Label("moreLogs", "").setVisible(false));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | <wicket:panel>
|
| | | <!-- page nav links -->
|
| | | <div class="page_nav">
|
| | | <a wicket:id="summary"><wicket:message key="gb.summary"></wicket:message></a> | <a wicket:id="shortlog"><wicket:message key="gb.shortlog"></wicket:message></a> | <a wicket:id="branches"><wicket:message key="gb.branches"></wicket:message></a> | <a wicket:id="tags"><wicket:message key="gb.tags"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> <span wicket:id="extra"><span wicket:id="extraSeparator"></span><span wicket:id="extraLink"></span></span>
|
| | | <a wicket:id="summary"><wicket:message key="gb.summary"></wicket:message></a> | <a wicket:id="log"><wicket:message key="gb.log"></wicket:message></a> | <a wicket:id="branches"><wicket:message key="gb.branches"></wicket:message></a> | <a wicket:id="tags"><wicket:message key="gb.tags"></wicket:message></a> | <a wicket:id="tree"><wicket:message key="gb.tree"></wicket:message></a> <span wicket:id="extra"><span wicket:id="extraSeparator"></span><span wicket:id="extraLink"></span></span>
|
| | | </div>
|
| | | </wicket:panel>
|
| | | </html> |
| | |
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.wicket.Component;
|
| | | import org.apache.wicket.PageParameters;
|
| | | 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.utils.JGitUtils;
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.BranchesPage;
|
| | | import com.gitblit.wicket.pages.ShortLogPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TagsPage;
|
| | | import com.gitblit.wicket.pages.TicGitPage;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class PageLinksPanel extends BasePanel {
|
| | | public class PageLinksPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | |
| | |
|
| | | {
|
| | | put("summary", "gb.summary");
|
| | | put("shortlog", "gb.shortlog");
|
| | | put("log", "gb.log");
|
| | | put("branches", "gb.branches");
|
| | | put("tags", "gb.tags");
|
| | | put("tree", "gb.tree");
|
| | |
| | | super(id);
|
| | |
|
| | | // summary
|
| | | add(new BookmarkablePageLink<Void>("summary", SummaryPage.class, new PageParameters("p=" + repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("branches", BranchesPage.class, new PageParameters("p=" + repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("tags", TagsPage.class, new PageParameters("p=" + repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=HEAD")));
|
| | | add(new BookmarkablePageLink<Void>("summary", SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("branches", BranchesPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | |
|
| | | // Add dynamic repository extras
|
| | | List<String> extras = new ArrayList<String>();
|
| | |
| | | String extra = item.getModelObject();
|
| | | if (extra.equals("ticgit")) {
|
| | | item.add(new Label("extraSeparator", " | "));
|
| | | item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, new PageParameters("p=" + repositoryName)));
|
| | | item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | | }
|
| | | };
|
| | |
| | | String linkName = getString(key);
|
| | | if (linkName.equals(pageName)) {
|
| | | Component c = get(wicketId);
|
| | | if (c != null) {
|
| | | c.setEnabled(false);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | 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.ListDataProvider;
|
| | |
|
| | | import com.gitblit.wicket.LinkPanel;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | | public class PathBreadcrumbsPanel extends Panel {
|
| | |
| | | parameters += ",f=" + path;
|
| | | }
|
| | |
|
| | | item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, new PageParameters(parameters)));
|
| | | item.add(new LinkPanel("pathLink", null, entry.name, TreePage.class, WicketUtils.newPathParameter(repositoryName, commitId, path)));
|
| | | item.add(new Label("pathSeparator", entry.isLeaf ? "" : "/"));
|
| | | }
|
| | | };
|
New file |
| | |
| | | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
| | | <html xmlns="http://www.w3.org/1999/xhtml" |
| | | xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" |
| | | xml:lang="en" |
| | | lang="en"> |
| | |
|
| | | <body>
|
| | | <wicket:panel>
|
| | |
|
| | | <!-- tags -->
|
| | | <div class="header" wicket:id="header">[tags header]</div> |
| | | <table style="width:100%" class="pretty">
|
| | | <tbody>
|
| | | <tr wicket:id="tag">
|
| | | <td class="date"><span wicket:id="tagDate">[tag date]</span></td>
|
| | | <td><b><span wicket:id="tagName">[tag name]</span></b></td>
|
| | | <td><span wicket:id="tagDescription">[tag description]</span></td>
|
| | | <td class="rightAlign">
|
| | | <div class="link">
|
| | | <a wicket:id="view"><wicket:message key="gb.view"></wicket:message></a> | <a wicket:id="commit"><wicket:message key="gb.commit"></wicket:message></a> | <a wicket:id="log"><wicket:message key="gb.log"></wicket:message></a>
|
| | | </div>
|
| | | </td>
|
| | | </tr>
|
| | | </tbody>
|
| | | </table>
|
| | | |
| | | <div wicket:id="allTags">[all tags]</div> |
| | | |
| | | <!-- spacer -->
|
| | | <div style="padding:5px;"></div>
|
| | | </wicket:panel>
|
| | | </body>
|
| | | </html> |
New file |
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | 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;
|
| | | 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;
|
| | | import com.gitblit.wicket.pages.CommitPage;
|
| | | import com.gitblit.wicket.pages.LogPage;
|
| | | import com.gitblit.wicket.pages.SummaryPage;
|
| | | import com.gitblit.wicket.pages.TagPage;
|
| | | import com.gitblit.wicket.pages.TagsPage;
|
| | |
|
| | | public class TagsPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public TagsPanel(String wicketId, final String repositoryName, Repository r, final int maxCount) {
|
| | | super(wicketId);
|
| | |
|
| | | // header
|
| | | List<RefModel> tags = JGitUtils.getTags(r, maxCount);
|
| | | if (maxCount > 0) {
|
| | | // summary page
|
| | | // show tags page link
|
| | | add(new LinkPanel("header", "title", new StringResourceModel("gb.tags", this, null), TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | } else {
|
| | | // tags page
|
| | | // show repository summary page link
|
| | | add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | |
|
| | | ListDataProvider<RefModel> tagsDp = new ListDataProvider<RefModel>(tags);
|
| | | DataView<RefModel> tagView = new DataView<RefModel>("tag", tagsDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | |
|
| | | public void populateItem(final Item<RefModel> item) {
|
| | | RefModel entry = item.getModelObject();
|
| | |
|
| | | item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));
|
| | |
|
| | | item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getCommitId().getName())));
|
| | | String message;
|
| | | if (maxCount > 0) {
|
| | | message = WicketUtils.trimString(entry.getShortLog(), 40);
|
| | | } else {
|
| | | message = entry.getShortLog();
|
| | | }
|
| | | if (entry.isAnnotatedTag()) {
|
| | | item.add(new LinkPanel("tagDescription", "list subject", message, TagPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())));
|
| | | } else {
|
| | | item.add(new LinkPanel("tagDescription", "list subject", message, CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())));
|
| | | }
|
| | | item.add(new BookmarkablePageLink<Void>("view", TagPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())).setEnabled(entry.isAnnotatedTag()));
|
| | | item.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getCommitId().getName())));
|
| | | item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
|
| | |
|
| | | WicketUtils.setAlternatingBackground(item, counter);
|
| | | counter++;
|
| | | }
|
| | | };
|
| | | add(tagView);
|
| | | if (tags.size() < maxCount || maxCount <= 0) {
|
| | | add(new Label("allTags", "").setVisible(false));
|
| | | } else {
|
| | | add(new LinkPanel("allTags", "link", new StringResourceModel("gb.allTags", this, null), TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.apache.wicket.markup.html.panel.Panel;
|
| | |
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.pages.BlobPage;
|
| | |
|
| | |
|
| | | public class TreeBlobLinksPanel extends BasePanel {
|
| | | public class TreeBlobLinksPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public TreeBlobLinksPanel(String id, String repositoryName, PathModel path) {
|
| | | super(id);
|
| | | add(new BookmarkablePageLink<Void>("view", BlobPage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path)));
|
| | | add(new BookmarkablePageLink<Void>("raw", BlobPage.class, new PageParameters()).setEnabled(false));
|
| | | add(new BookmarkablePageLink<Void>("history", BlobPage.class, new PageParameters()).setEnabled(false));
|
| | | add(new BookmarkablePageLink<Void>("view", BlobPage.class, WicketUtils.newPathParameter(repositoryName, path.commitId, path.path)));
|
| | | add(new BookmarkablePageLink<Void>("raw", BlobPage.class).setEnabled(false));
|
| | | add(new BookmarkablePageLink<Void>("history", BlobPage.class).setEnabled(false));
|
| | | }
|
| | | } |
| | |
| | | package com.gitblit.wicket.panels;
|
| | |
|
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.apache.wicket.markup.html.panel.Panel;
|
| | |
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.PathModel;
|
| | | import com.gitblit.wicket.pages.TreePage;
|
| | |
|
| | |
|
| | | public class TreeLinksPanel extends BasePanel {
|
| | | public class TreeLinksPanel extends Panel {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public TreeLinksPanel(String id, String repositoryName, PathModel path) {
|
| | | super(id);
|
| | | add(new BookmarkablePageLink<Void>("tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=" + path.commitId + ",f=" + path.path)));
|
| | | add(new BookmarkablePageLink<Void>("history", TreePage.class, new PageParameters()).setEnabled(false));
|
| | | add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newPathParameter(repositoryName, path.commitId, path.path)));
|
| | | add(new BookmarkablePageLink<Void>("history", TreePage.class).setEnabled(false));
|
| | | }
|
| | | } |
| | |
| | | font-size: inherit;
|
| | | }
|
| | |
|
| | | div.link em, div.link span em {
|
| | | font-style: normal;
|
| | | font-family: inherit;
|
| | | font-size: inherit;
|
| | | }
|
| | |
|
| | | div.page_header {
|
| | | height: 25px;
|
| | | padding: 5px;
|
| | |
| | | text-decoration: underline;
|
| | | }
|
| | |
|
| | | div.page_nav em {
|
| | | font-style: normal;
|
| | | }
|
| | |
|
| | | div.page_nav2 {
|
| | | padding: 2px 5px 7px 5px;
|
| | | }
|