| | |
| | | put("branches", "gb.branches");
|
| | | put("tags", "gb.tags");
|
| | | put("tree", "gb.tree");
|
| | | put("metrics", "gb.metrics");
|
| | | put("tickets", "gb.tickets");
|
| | | put("edit", "gb.edit");
|
| | | }
|
| | |
| | | add(new BookmarkablePageLink<Void>("tags", TagsPage.class,
|
| | | WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("tree", TreePage.class,
|
| | | WicketUtils.newRepositoryParameter(repositoryName)));
|
| | | add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class,
|
| | | WicketUtils.newRepositoryParameter(repositoryName)));
|
| | |
|
| | | // per-repository extra page links
|
| | |
| | | return commit;
|
| | | }
|
| | |
|
| | | protected String getShortObjectId(String objectId) {
|
| | | return objectId.substring(0, 8);
|
| | | }
|
| | |
|
| | | protected void addRefs(Repository r, RevCommit c) {
|
| | | add(new RefsPanel("refsPanel", repositoryName, c, JGitUtils.getAllRefs(r)));
|
| | | }
|
| | |
|
| | | protected void addFullText(String wicketId, String text, boolean substituteRegex) {
|
| | | String html = StringUtils.breakLinesForHtml(text);
|
| | | String html;
|
| | | if (substituteRegex) {
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | // global regex keys
|
| | | if (GitBlit.getBoolean(Keys.regex.global, false)) {
|
| | | for (String key : GitBlit.getAllKeys(Keys.regex.global)) {
|
| | | if (!key.equals(Keys.regex.global)) {
|
| | | String subKey = key.substring(key.lastIndexOf('.') + 1);
|
| | | map.put(subKey, GitBlit.getString(key, ""));
|
| | | }
|
| | | }
|
| | | }
|
| | | html = substituteText(text);
|
| | | } else {
|
| | | html = StringUtils.breakLinesForHtml(text);
|
| | | }
|
| | | add(new Label(wicketId, html).setEscapeModelStrings(false));
|
| | | }
|
| | |
|
| | | // repository-specific regex keys
|
| | | List<String> keys = GitBlit.getAllKeys(Keys.regex._ROOT + "."
|
| | | + repositoryName.toLowerCase());
|
| | | for (String key : keys) {
|
| | | String subKey = key.substring(key.lastIndexOf('.') + 1);
|
| | | map.put(subKey, GitBlit.getString(key, ""));
|
| | | }
|
| | |
|
| | | for (Entry<String, String> entry : map.entrySet()) {
|
| | | String definition = entry.getValue().trim();
|
| | | String[] chunks = definition.split("!!!");
|
| | | if (chunks.length == 2) {
|
| | | html = html.replaceAll(chunks[0], chunks[1]);
|
| | | } else {
|
| | | logger.warn(entry.getKey()
|
| | | + " improperly formatted. Use !!! to separate match from replacement: "
|
| | | + definition);
|
| | | protected String substituteText(String text) {
|
| | | String html = StringUtils.breakLinesForHtml(text);
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | // global regex keys
|
| | | if (GitBlit.getBoolean(Keys.regex.global, false)) {
|
| | | for (String key : GitBlit.getAllKeys(Keys.regex.global)) {
|
| | | if (!key.equals(Keys.regex.global)) {
|
| | | String subKey = key.substring(key.lastIndexOf('.') + 1);
|
| | | map.put(subKey, GitBlit.getString(key, ""));
|
| | | }
|
| | | }
|
| | | }
|
| | | add(new Label(wicketId, html).setEscapeModelStrings(false));
|
| | |
|
| | | // repository-specific regex keys
|
| | | List<String> keys = GitBlit.getAllKeys(Keys.regex._ROOT + "."
|
| | | + repositoryName.toLowerCase());
|
| | | for (String key : keys) {
|
| | | String subKey = key.substring(key.lastIndexOf('.') + 1);
|
| | | map.put(subKey, GitBlit.getString(key, ""));
|
| | | }
|
| | |
|
| | | for (Entry<String, String> entry : map.entrySet()) {
|
| | | String definition = entry.getValue().trim();
|
| | | String[] chunks = definition.split("!!!");
|
| | | if (chunks.length == 2) {
|
| | | html = html.replaceAll(chunks[0], chunks[1]);
|
| | | } else {
|
| | | logger.warn(entry.getKey()
|
| | | + " improperly formatted. Use !!! to separate match from replacement: "
|
| | | + definition);
|
| | | }
|
| | | }
|
| | | return html;
|
| | | }
|
| | |
|
| | | protected abstract String getPageName();
|