From: James Moger Date: Sun, 17 Apr 2011 16:06:29 +0000 (-0400) Subject: Rename ticgit integration to tickets. X-Git-Tag: v0.5.0~81 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9802a766a28bfcb0ae01494ebfa1cbeb11e71809;p=gitblit.git Rename ticgit integration to tickets. The current ticgit implementation is based on ticgit.net, a BSD implementation for C#. Jeff Welling advises using commit bf57b032e030bd16a7b2 (2009-01-27) from ticgit as the last MIT licensed commit. A more complete implementation will be based on this version of the original Ruby sources. It remains unclear if I will support using the "ticgit" branch name or not. I purposefully haven't looked at any of the GPL improvements by Jeff, but I can see from the readme at GitHub that he has renamed the branch to "ticgit-ng" which I have no plans on supporting as I do not want to taint GitBlit with GPL code. --- diff --git a/gitblit.properties b/gitblit.properties index a4828108..93183eb7 100644 --- a/gitblit.properties +++ b/gitblit.properties @@ -103,11 +103,11 @@ regex.global.changeid = \\b(Change-Id:\\s*)([A-Za-z0-9]*)\\b!!!Bug-Id: $3 -# Enable ticgit pages for all repositories (if ticgit branch is present) -ticgit.global = false +# Enable tickets pages for all repositories (if ticgit branch is present) +tickets.global = false -# Enable ticgit pages for specified repository (if ticgit branch is present) -#ticgit.myrepository = true +# Enable tickets pages for specified repository (if ticgit branch is present) +#tickets.myrepository = true # # Server Settings diff --git a/src/com/gitblit/tests/JGitUtilsTest.java b/src/com/gitblit/tests/JGitUtilsTest.java index c77aaaf1..b6b497f0 100644 --- a/src/com/gitblit/tests/JGitUtilsTest.java +++ b/src/com/gitblit/tests/JGitUtilsTest.java @@ -17,7 +17,7 @@ import org.eclipse.jgit.storage.file.FileRepository; import com.gitblit.utils.JGitUtils; import com.gitblit.wicket.models.PathModel; import com.gitblit.wicket.models.RefModel; -import com.gitblit.wicket.models.TicGitTicket; +import com.gitblit.wicket.models.TicketModel; public class JGitUtilsTest extends TestCase { @@ -72,9 +72,9 @@ public class JGitUtilsTest extends TestCase { public void testTicGit() throws Exception { Repository r = new FileRepository(new File(repositoriesFolder, "ticgit") + "/" + Constants.DOT_GIT); - RefModel ticgit = JGitUtils.getTicGitBranch(r); + RefModel ticgit = JGitUtils.getTicketsBranch(r); assertTrue("Ticgit branch does not exist!", ticgit != null); - List tickets = JGitUtils.getTicGitTickets(r); + List tickets = JGitUtils.getTickets(r); assertTrue("No tickets found!", tickets.size() > 0); r.close(); } diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index 7128f722..075ad81b 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -46,8 +46,8 @@ import org.slf4j.LoggerFactory; import com.gitblit.wicket.models.Metric; import com.gitblit.wicket.models.PathModel; import com.gitblit.wicket.models.RefModel; -import com.gitblit.wicket.models.TicGitTicket; -import com.gitblit.wicket.models.TicGitTicket.Comment; +import com.gitblit.wicket.models.TicketModel; +import com.gitblit.wicket.models.TicketModel.Comment; public class JGitUtils { @@ -614,12 +614,12 @@ public class JGitUtils { return metrics; } - public static RefModel getTicGitBranch(Repository r) { + public static RefModel getTicketsBranch(Repository r) { RefModel ticgitBranch = null; try { // search for ticgit branch in local heads for (RefModel ref : getLocalBranches(r, -1)) { - if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) { + if (ref.getDisplayName().endsWith("ticgit")) { ticgitBranch = ref; break; } @@ -628,7 +628,7 @@ public class JGitUtils { // search for ticgit branch in remote heads if (ticgitBranch == null) { for (RefModel ref : getRemoteBranches(r, -1)) { - if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) { + if (ref.getDisplayName().endsWith("ticgit")) { ticgitBranch = ref; break; } @@ -640,18 +640,18 @@ public class JGitUtils { return ticgitBranch; } - public static List getTicGitTickets(Repository r) { - RefModel ticgitBranch = getTicGitBranch(r); + public static List getTickets(Repository r) { + RefModel ticgitBranch = getTicketsBranch(r); List paths = getFilesInPath(r, null, ticgitBranch.getCommit()); - List tickets = new ArrayList(); + List tickets = new ArrayList(); for (PathModel ticketFolder : paths) { if (ticketFolder.isTree()) { try { - TicGitTicket t = new TicGitTicket(ticketFolder.name); + TicketModel t = new TicketModel(ticketFolder.name); readTicketContents(r, ticgitBranch, t); tickets.add(t); } catch (Throwable t) { - LOGGER.error("Failed to get a ticgit ticket!", t); + LOGGER.error("Failed to get a ticket!", t); } } } @@ -660,24 +660,24 @@ public class JGitUtils { return tickets; } - public static TicGitTicket getTicGitTicket(Repository r, String ticketFolder) { - RefModel ticgitBranch = getTicGitBranch(r); - if (ticgitBranch != null) { + public static TicketModel getTicket(Repository r, String ticketFolder) { + RefModel ticketsBranch = getTicketsBranch(r); + if (ticketsBranch != null) { try { - TicGitTicket ticket = new TicGitTicket(ticketFolder); - readTicketContents(r, ticgitBranch, ticket); + TicketModel ticket = new TicketModel(ticketFolder); + readTicketContents(r, ticketsBranch, ticket); return ticket; } catch (Throwable t) { - LOGGER.error("Failed to get ticgit ticket " + ticketFolder, t); + LOGGER.error("Failed to get ticket " + ticketFolder, t); } } return null; } - private static void readTicketContents(Repository r, RefModel ticgitBranch, TicGitTicket ticket) { - List ticketFiles = getFilesInPath(r, ticket.name, ticgitBranch.getCommit()); + private static void readTicketContents(Repository r, RefModel ticketsBranch, TicketModel ticket) { + List ticketFiles = getFilesInPath(r, ticket.name, ticketsBranch.getCommit()); for (PathModel file : ticketFiles) { - String content = getRawContentAsString(r, ticgitBranch.getCommit(), file.path).trim(); + String content = getRawContentAsString(r, ticketsBranch.getCommit(), file.path).trim(); if (file.name.equals("TICKET_ID")) { ticket.id = content; } else if (file.name.equals("TITLE")) { @@ -707,10 +707,10 @@ public class JGitUtils { Collections.sort(ticket.comments); } - public static String getTicGitContent(Repository r, String filePath) { - RefModel ticgitBranch = getTicGitBranch(r); - if (ticgitBranch != null) { - return getRawContentAsString(r, ticgitBranch.getCommit(), filePath); + public static String getTicketContent(Repository r, String filePath) { + RefModel ticketsBranch = getTicketsBranch(r); + if (ticketsBranch != null) { + return getRawContentAsString(r, ticketsBranch.getCommit(), filePath); } return ""; } diff --git a/src/com/gitblit/wicket/GitBlitWebApp.java b/src/com/gitblit/wicket/GitBlitWebApp.java index 28f62625..74057c99 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.java +++ b/src/com/gitblit/wicket/GitBlitWebApp.java @@ -25,8 +25,8 @@ import com.gitblit.wicket.pages.RepositoriesPage; import com.gitblit.wicket.pages.SummaryPage; import com.gitblit.wicket.pages.TagPage; import com.gitblit.wicket.pages.TagsPage; -import com.gitblit.wicket.pages.TicGitPage; -import com.gitblit.wicket.pages.TicGitTicketPage; +import com.gitblit.wicket.pages.TicketsPage; +import com.gitblit.wicket.pages.TicketPage; import com.gitblit.wicket.pages.TreePage; public class GitBlitWebApp extends WebApplication { @@ -63,9 +63,9 @@ public class GitBlitWebApp extends WebApplication { mount(new MixedParamUrlCodingStrategy("/patch", PatchPage.class, new String[] { "r", "h", "f" })); mount(new MixedParamUrlCodingStrategy("/history", HistoryPage.class, new String[] { "r", "h", "f" })); - // setup ticgit urls - mount(new MixedParamUrlCodingStrategy("/ticgit", TicGitPage.class, new String[] { "r" })); - mount(new MixedParamUrlCodingStrategy("/ticgittkt", TicGitTicketPage.class, new String[] { "r", "h", "f" })); + // setup ticket urls + mount(new MixedParamUrlCodingStrategy("/tickets", TicketsPage.class, new String[] { "r" })); + mount(new MixedParamUrlCodingStrategy("/ticket", TicketPage.class, new String[] { "r", "h", "f" })); // setup login/logout urls, if we are using authentication if (useAuthentication) { diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties index 033742eb..331fc294 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp.properties @@ -34,7 +34,7 @@ gb.ticket = ticket gb.newRepository = new repository gb.newUser = new user gb.commitdiff = commitdiff -gb.ticgit = ticgit +gb.tickets = tickets gb.pageFirst = first gb.pagePrevious prev gb.pageNext = next diff --git a/src/com/gitblit/wicket/models/TicGitTicket.java b/src/com/gitblit/wicket/models/TicGitTicket.java deleted file mode 100644 index 6bbb7be0..00000000 --- a/src/com/gitblit/wicket/models/TicGitTicket.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gitblit.wicket.models; - -import java.io.Serializable; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class TicGitTicket implements Serializable, Comparable { - - private static final long serialVersionUID = 1L; - - public String id; - public String name; - public String title; - public String state; - public Date date; - public String handler; - public String milestone; - public String email; - public String author; - public List comments; - public List tags; - - public TicGitTicket() { - state = "open"; - comments = new ArrayList(); - tags = new ArrayList(); - } - - public TicGitTicket(String ticketName) throws ParseException { - state = ""; - name = ticketName; - comments = new ArrayList(); - tags = new ArrayList(); - - String[] chunks = name.split("_"); - if (chunks.length == 3) { - date = new Date(Long.parseLong(chunks[0]) * 1000l); - title = chunks[1].replace('-', ' '); - } - } - - public static class Comment implements Serializable, Comparable { - - private static final long serialVersionUID = 1L; - - public String text; - public String author; - public Date date; - - public Comment(String text, Date date) { - this.text = text; - this.date = date; - } - - public Comment(String filename, String content) throws ParseException { - String[] chunks = filename.split("_", -1); - this.date = new Date(Long.parseLong(chunks[1]) * 1000l); - this.author = chunks[2]; - this.text = content; - } - - @Override - public int compareTo(Comment o) { - return date.compareTo(o.date); - } - } - - @Override - public int compareTo(TicGitTicket o) { - return date.compareTo(o.date); - } -} diff --git a/src/com/gitblit/wicket/models/TicketModel.java b/src/com/gitblit/wicket/models/TicketModel.java new file mode 100644 index 00000000..39f3c902 --- /dev/null +++ b/src/com/gitblit/wicket/models/TicketModel.java @@ -0,0 +1,74 @@ +package com.gitblit.wicket.models; + +import java.io.Serializable; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class TicketModel implements Serializable, Comparable { + + private static final long serialVersionUID = 1L; + + public String id; + public String name; + public String title; + public String state; + public Date date; + public String handler; + public String milestone; + public String email; + public String author; + public List comments; + public List tags; + + public TicketModel() { + state = "open"; + comments = new ArrayList(); + tags = new ArrayList(); + } + + public TicketModel(String ticketName) throws ParseException { + state = ""; + name = ticketName; + comments = new ArrayList(); + tags = new ArrayList(); + + String[] chunks = name.split("_"); + if (chunks.length == 3) { + date = new Date(Long.parseLong(chunks[0]) * 1000l); + title = chunks[1].replace('-', ' '); + } + } + + public static class Comment implements Serializable, Comparable { + + private static final long serialVersionUID = 1L; + + public String text; + public String author; + public Date date; + + public Comment(String text, Date date) { + this.text = text; + this.date = date; + } + + public Comment(String filename, String content) throws ParseException { + String[] chunks = filename.split("_", -1); + this.date = new Date(Long.parseLong(chunks[1]) * 1000l); + this.author = chunks[2]; + this.text = content; + } + + @Override + public int compareTo(Comment o) { + return date.compareTo(o.date); + } + } + + @Override + public int compareTo(TicketModel o) { + return date.compareTo(o.date); + } +} diff --git a/src/com/gitblit/wicket/pages/TicGitPage.html b/src/com/gitblit/wicket/pages/TicGitPage.html deleted file mode 100644 index eb74b125..00000000 --- a/src/com/gitblit/wicket/pages/TicGitPage.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - -
[page links]
- - -
[header]
- - - - - - - - - - - -
[ticket state]
[ticket date]
[ticket handler]
[ticket title]
- -
- - \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TicGitPage.java b/src/com/gitblit/wicket/pages/TicGitPage.java deleted file mode 100644 index a03ee607..00000000 --- a/src/com/gitblit/wicket/pages/TicGitPage.java +++ /dev/null @@ -1,54 +0,0 @@ -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 com.gitblit.utils.JGitUtils; -import com.gitblit.utils.StringUtils; -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.TicGitTicket; - -public class TicGitPage extends RepositoryPage { - - public TicGitPage(PageParameters params) { - super(params); - - List tickets = JGitUtils.getTicGitTickets(getRepository()); - - // header - add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter())); - - ListDataProvider ticketsDp = new ListDataProvider(tickets); - DataView ticketsView = new DataView("ticket", ticketsDp) { - private static final long serialVersionUID = 1L; - int counter = 0; - - public void populateItem(final Item item) { - final TicGitTicket entry = item.getModelObject(); - Label stateLabel = new Label("ticketState", entry.state); - WicketUtils.setTicketCssClass(stateLabel, entry.state); - item.add(stateLabel); - item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone())); - item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30))); - item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name))); - - WicketUtils.setAlternatingBackground(item, counter); - counter++; - } - }; - add(ticketsView); - } - - @Override - protected String getPageName() { - return getString("gb.ticgit"); - } -} diff --git a/src/com/gitblit/wicket/pages/TicGitTicketPage.html b/src/com/gitblit/wicket/pages/TicGitTicketPage.html deleted file mode 100644 index 56e29804..00000000 --- a/src/com/gitblit/wicket/pages/TicGitTicketPage.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -
[page links]
- - -
[ticket title]
- - - - - - - - -
ticket id[ticket id]
assigned[ticket title]
open date[ticket open date]
state[ticket state]
tags[ticket tags]
- - -
comments
- - - - - - - - - -
[comment author]
- [comment date] -
[comment text]
- -
- - \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TicGitTicketPage.java b/src/com/gitblit/wicket/pages/TicGitTicketPage.java deleted file mode 100644 index b4c9cf55..00000000 --- a/src/com/gitblit/wicket/pages/TicGitTicketPage.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gitblit.wicket.pages; - -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.utils.StringUtils; -import com.gitblit.wicket.GitBlitWebSession; -import com.gitblit.wicket.RepositoryPage; -import com.gitblit.wicket.WicketUtils; -import com.gitblit.wicket.models.TicGitTicket; -import com.gitblit.wicket.models.TicGitTicket.Comment; - -public class TicGitTicketPage extends RepositoryPage { - - public TicGitTicketPage(PageParameters params) { - super(params); - - final String ticketFolder = WicketUtils.getPath(params); - - Repository r = getRepository(); - TicGitTicket t = JGitUtils.getTicGitTicket(r, ticketFolder); - - add(new Label("ticketTitle", t.title)); - add(new Label("ticketId", t.id)); - add(new Label("ticketHandler", t.handler.toLowerCase())); - add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone())); - Label stateLabel = new Label("ticketState", t.state); - WicketUtils.setTicketCssClass(stateLabel, t.state); - add(stateLabel); - add(new Label("ticketTags", StringUtils.flattenStrings(t.tags))); - - ListDataProvider commentsDp = new ListDataProvider(t.comments); - DataView commentsView = new DataView("comment", commentsDp) { - private static final long serialVersionUID = 1L; - int counter = 0; - - public void populateItem(final Item item) { - final Comment entry = item.getModelObject(); - item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone())); - item.add(new Label("commentAuthor", entry.author.toLowerCase())); - item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false)); - WicketUtils.setAlternatingBackground(item, counter); - counter++; - } - }; - add(commentsView); - } - - @Override - protected String getPageName() { - return getString("gb.ticket"); - } - - private String prepareComment(String comment) { - String html = StringUtils.escapeForHtml(comment, false); - html = StringUtils.breakLinesForHtml(comment).trim(); - return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "commit $1"); - } -} diff --git a/src/com/gitblit/wicket/pages/TicketPage.html b/src/com/gitblit/wicket/pages/TicketPage.html new file mode 100644 index 00000000..56e29804 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TicketPage.html @@ -0,0 +1,42 @@ + + + + + + + +
[page links]
+ + +
[ticket title]
+ + + + + + + + +
ticket id[ticket id]
assigned[ticket title]
open date[ticket open date]
state[ticket state]
tags[ticket tags]
+ + +
comments
+ + + + + + + + + +
[comment author]
+ [comment date] +
[comment text]
+ +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TicketPage.java b/src/com/gitblit/wicket/pages/TicketPage.java new file mode 100644 index 00000000..1cfa8090 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TicketPage.java @@ -0,0 +1,64 @@ +package com.gitblit.wicket.pages; + +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.utils.StringUtils; +import com.gitblit.wicket.GitBlitWebSession; +import com.gitblit.wicket.RepositoryPage; +import com.gitblit.wicket.WicketUtils; +import com.gitblit.wicket.models.TicketModel; +import com.gitblit.wicket.models.TicketModel.Comment; + +public class TicketPage extends RepositoryPage { + + public TicketPage(PageParameters params) { + super(params); + + final String ticketFolder = WicketUtils.getPath(params); + + Repository r = getRepository(); + TicketModel t = JGitUtils.getTicket(r, ticketFolder); + + add(new Label("ticketTitle", t.title)); + add(new Label("ticketId", t.id)); + add(new Label("ticketHandler", t.handler.toLowerCase())); + add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone())); + Label stateLabel = new Label("ticketState", t.state); + WicketUtils.setTicketCssClass(stateLabel, t.state); + add(stateLabel); + add(new Label("ticketTags", StringUtils.flattenStrings(t.tags))); + + ListDataProvider commentsDp = new ListDataProvider(t.comments); + DataView commentsView = new DataView("comment", commentsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final Comment entry = item.getModelObject(); + item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone())); + item.add(new Label("commentAuthor", entry.author.toLowerCase())); + item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false)); + WicketUtils.setAlternatingBackground(item, counter); + counter++; + } + }; + add(commentsView); + } + + @Override + protected String getPageName() { + return getString("gb.ticket"); + } + + private String prepareComment(String comment) { + String html = StringUtils.escapeForHtml(comment, false); + html = StringUtils.breakLinesForHtml(comment).trim(); + return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "commit $1"); + } +} diff --git a/src/com/gitblit/wicket/pages/TicketsPage.html b/src/com/gitblit/wicket/pages/TicketsPage.html new file mode 100644 index 00000000..eb74b125 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TicketsPage.html @@ -0,0 +1,30 @@ + + + + + + + +
[page links]
+ + +
[header]
+ + + + + + + + + + + +
[ticket state]
[ticket date]
[ticket handler]
[ticket title]
+ +
+ + \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/TicketsPage.java b/src/com/gitblit/wicket/pages/TicketsPage.java new file mode 100644 index 00000000..865b8bf8 --- /dev/null +++ b/src/com/gitblit/wicket/pages/TicketsPage.java @@ -0,0 +1,54 @@ +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 com.gitblit.utils.JGitUtils; +import com.gitblit.utils.StringUtils; +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.TicketModel; + +public class TicketsPage extends RepositoryPage { + + public TicketsPage(PageParameters params) { + super(params); + + List tickets = JGitUtils.getTickets(getRepository()); + + // header + add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter())); + + ListDataProvider ticketsDp = new ListDataProvider(tickets); + DataView ticketsView = new DataView("ticket", ticketsDp) { + private static final long serialVersionUID = 1L; + int counter = 0; + + public void populateItem(final Item item) { + final TicketModel entry = item.getModelObject(); + Label stateLabel = new Label("ticketState", entry.state); + WicketUtils.setTicketCssClass(stateLabel, entry.state); + item.add(stateLabel); + item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone())); + item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30))); + item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicketPage.class, newPathParameter(entry.name))); + + WicketUtils.setAlternatingBackground(item, counter); + counter++; + } + }; + add(ticketsView); + } + + @Override + protected String getPageName() { + return getString("gb.tickets"); + } +} diff --git a/src/com/gitblit/wicket/panels/HistoryPanel.java b/src/com/gitblit/wicket/panels/HistoryPanel.java index 236e077b..e7878838 100644 --- a/src/com/gitblit/wicket/panels/HistoryPanel.java +++ b/src/com/gitblit/wicket/panels/HistoryPanel.java @@ -93,6 +93,7 @@ public class HistoryPanel extends BasePanel { item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs)); + // TODO links for folder item.add(new BookmarkablePageLink("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()))); item.add(new BookmarkablePageLink("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()))); item.add(new BookmarkablePageLink("difftocurrent", BlobDiffPage.class, WicketUtils.newPathParameter(repositoryName, entry.getName(), path)).setEnabled(counter > 0)); diff --git a/src/com/gitblit/wicket/panels/PageLinksPanel.java b/src/com/gitblit/wicket/panels/PageLinksPanel.java index 18cfad62..f8824db5 100644 --- a/src/com/gitblit/wicket/panels/PageLinksPanel.java +++ b/src/com/gitblit/wicket/panels/PageLinksPanel.java @@ -24,7 +24,7 @@ import com.gitblit.wicket.pages.BranchesPage; 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.TicketsPage; import com.gitblit.wicket.pages.TreePage; public class PageLinksPanel extends Panel { @@ -41,7 +41,7 @@ public class PageLinksPanel extends Panel { put("branches", "gb.branches"); put("tags", "gb.tags"); put("tree", "gb.tree"); - put("ticgit", "gb.ticgit"); + put("tickets", "gb.tickets"); } }; @@ -55,14 +55,14 @@ public class PageLinksPanel extends Panel { add(new BookmarkablePageLink("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); add(new BookmarkablePageLink("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName))); - // Get the repository ticgit setting - boolean checkTicgit = GitBlit.self().settings().getBoolean(Keys.ticgit.global, false); - checkTicgit |= GitBlit.self().settings().getBoolean(MessageFormat.format(Keys.ticgit._ROOT + ".{0}", repositoryName), false); + // Get the repository tickets setting + boolean checkTicgit = GitBlit.self().settings().getBoolean(Keys.tickets.global, false); + checkTicgit |= GitBlit.self().settings().getBoolean(MessageFormat.format(Keys.tickets._ROOT + ".{0}", repositoryName), false); // Add dynamic repository extras List extras = new ArrayList(); - if (checkTicgit && JGitUtils.getTicGitBranch(r) != null) { - extras.add("ticgit"); + if (checkTicgit && JGitUtils.getTicketsBranch(r) != null) { + extras.add("tickets"); } ListDataProvider extrasDp = new ListDataProvider(extras); @@ -71,9 +71,9 @@ public class PageLinksPanel extends Panel { public void populateItem(final Item item) { String extra = item.getModelObject(); - if (extra.equals("ticgit")) { + if (extra.equals("tickets")) { item.add(new Label("extraSeparator", " | ")); - item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, WicketUtils.newRepositoryParameter(repositoryName))); + item.add(new LinkPanel("extraLink", null, "tickets", TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); } } };