| | |
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.image.Image;
|
| | | import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
| | | import org.eclipse.jgit.lib.Constants;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | | import org.eclipse.jgit.revwalk.RevCommit;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.CacheControl;
|
| | | import com.gitblit.wicket.CacheControl.LastModified;
|
| | | import com.gitblit.wicket.ExternalImage;
|
| | | import com.gitblit.wicket.MarkupProcessor;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.CommitHeaderPanel;
|
| | | import com.gitblit.wicket.panels.PathBreadcrumbsPanel;
|
| | |
| | |
|
| | | Repository r = getRepository();
|
| | | final String blobPath = WicketUtils.getPath(params);
|
| | | String [] encodings = GitBlit.getEncodings();
|
| | | String [] encodings = getEncodings();
|
| | |
|
| | | if (StringUtils.isEmpty(blobPath)) {
|
| | | // blob by objectid
|
| | |
| | | add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class).setEnabled(false));
|
| | | add(new BookmarkablePageLink<Void>("rawLink", RawPage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
|
| | | add(new BookmarkablePageLink<Void>("headLink", BlobPage.class).setEnabled(false));
|
| | | add(new CommitHeaderPanel("commitHeader", objectId));
|
| | | add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));
|
| | | Component c = new Label("blobText", JGitUtils.getStringContent(r, objectId, encodings));
|
| | |
| | | extension = blobPath.substring(blobPath.lastIndexOf('.') + 1).toLowerCase();
|
| | | }
|
| | |
|
| | | // see if we should redirect to the markdown page
|
| | | for (String ext : GitBlit.getStrings(Keys.web.markdownExtensions)) {
|
| | | // see if we should redirect to the doc page
|
| | | MarkupProcessor processor = new MarkupProcessor(app().settings());
|
| | | for (String ext : processor.getMarkupExtensions()) {
|
| | | if (ext.equals(extension)) {
|
| | | setResponsePage(MarkdownPage.class, params);
|
| | | setResponsePage(DocPage.class, params);
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | // manually get commit because it can be null
|
| | | RevCommit commit = JGitUtils.getCommit(r, objectId);
|
| | | RevCommit commit = getCommit();
|
| | |
|
| | | // blob page links
|
| | | add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class,
|
| | |
| | | WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
|
| | | add(new BookmarkablePageLink<Void>("rawLink", RawPage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, objectId, blobPath)));
|
| | | add(new BookmarkablePageLink<Void>("headLink", BlobPage.class,
|
| | | WicketUtils.newPathParameter(repositoryName, Constants.HEAD, blobPath)));
|
| | |
|
| | | add(new CommitHeaderPanel("commitHeader", repositoryName, commit));
|
| | |
|
| | |
| | |
|
| | | // Map the extensions to types
|
| | | Map<String, Integer> map = new HashMap<String, Integer>();
|
| | | for (String ext : GitBlit.getStrings(Keys.web.prettyPrintExtensions)) {
|
| | | for (String ext : app().settings().getStrings(Keys.web.prettyPrintExtensions)) {
|
| | | map.put(ext.toLowerCase(), 1);
|
| | | }
|
| | | for (String ext : GitBlit.getStrings(Keys.web.imageExtensions)) {
|
| | | for (String ext : app().settings().getStrings(Keys.web.imageExtensions)) {
|
| | | map.put(ext.toLowerCase(), 2);
|
| | | }
|
| | | for (String ext : GitBlit.getStrings(Keys.web.binaryExtensions)) {
|
| | | for (String ext : app().settings().getStrings(Keys.web.binaryExtensions)) {
|
| | | map.put(ext.toLowerCase(), 3);
|
| | | }
|
| | |
|