# Example per-repository regex substitutions overrides global\r
#regex.myrepository.bug = \\b(Bug:)(\\s*[#]?|-){0,1}(\\d+)\\b!!!<a href="http://elsewhere/bug/$3">Bug-Id: $3</a>\r
\r
-# Enable ticgit pages for all repositories (if ticgit branch is present)\r
-ticgit.global = false\r
+# Enable tickets pages for all repositories (if ticgit branch is present)\r
+tickets.global = false\r
\r
-# Enable ticgit pages for specified repository (if ticgit branch is present)\r
-#ticgit.myrepository = true\r
+# Enable tickets pages for specified repository (if ticgit branch is present)\r
+#tickets.myrepository = true\r
\r
#\r
# Server Settings\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.models.TicGitTicket;\r
+import com.gitblit.wicket.models.TicketModel;\r
\r
public class JGitUtilsTest extends TestCase {\r
\r
\r
public void testTicGit() throws Exception {\r
Repository r = new FileRepository(new File(repositoriesFolder, "ticgit") + "/" + Constants.DOT_GIT);\r
- RefModel ticgit = JGitUtils.getTicGitBranch(r);\r
+ RefModel ticgit = JGitUtils.getTicketsBranch(r);\r
assertTrue("Ticgit branch does not exist!", ticgit != null);\r
- List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(r);\r
+ List<TicketModel> tickets = JGitUtils.getTickets(r);\r
assertTrue("No tickets found!", tickets.size() > 0);\r
r.close();\r
}\r
import com.gitblit.wicket.models.Metric;\r
import com.gitblit.wicket.models.PathModel;\r
import com.gitblit.wicket.models.RefModel;\r
-import com.gitblit.wicket.models.TicGitTicket;\r
-import com.gitblit.wicket.models.TicGitTicket.Comment;\r
+import com.gitblit.wicket.models.TicketModel;\r
+import com.gitblit.wicket.models.TicketModel.Comment;\r
\r
public class JGitUtils {\r
\r
return metrics;\r
}\r
\r
- public static RefModel getTicGitBranch(Repository r) {\r
+ public static RefModel getTicketsBranch(Repository r) {\r
RefModel ticgitBranch = null;\r
try {\r
// search for ticgit branch in local heads\r
for (RefModel ref : getLocalBranches(r, -1)) {\r
- if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) {\r
+ if (ref.getDisplayName().endsWith("ticgit")) {\r
ticgitBranch = ref;\r
break;\r
}\r
// search for ticgit branch in remote heads\r
if (ticgitBranch == null) {\r
for (RefModel ref : getRemoteBranches(r, -1)) {\r
- if (ref.getDisplayName().endsWith("ticgit") || ref.getDisplayName().endsWith("ticgit-ng")) {\r
+ if (ref.getDisplayName().endsWith("ticgit")) {\r
ticgitBranch = ref;\r
break;\r
}\r
return ticgitBranch;\r
}\r
\r
- public static List<TicGitTicket> getTicGitTickets(Repository r) {\r
- RefModel ticgitBranch = getTicGitBranch(r);\r
+ public static List<TicketModel> getTickets(Repository r) {\r
+ RefModel ticgitBranch = getTicketsBranch(r);\r
List<PathModel> paths = getFilesInPath(r, null, ticgitBranch.getCommit());\r
- List<TicGitTicket> tickets = new ArrayList<TicGitTicket>();\r
+ List<TicketModel> tickets = new ArrayList<TicketModel>();\r
for (PathModel ticketFolder : paths) {\r
if (ticketFolder.isTree()) {\r
try {\r
- TicGitTicket t = new TicGitTicket(ticketFolder.name);\r
+ TicketModel t = new TicketModel(ticketFolder.name);\r
readTicketContents(r, ticgitBranch, t);\r
tickets.add(t);\r
} catch (Throwable t) {\r
- LOGGER.error("Failed to get a ticgit ticket!", t);\r
+ LOGGER.error("Failed to get a ticket!", t);\r
}\r
}\r
}\r
return tickets;\r
}\r
\r
- public static TicGitTicket getTicGitTicket(Repository r, String ticketFolder) {\r
- RefModel ticgitBranch = getTicGitBranch(r);\r
- if (ticgitBranch != null) {\r
+ public static TicketModel getTicket(Repository r, String ticketFolder) {\r
+ RefModel ticketsBranch = getTicketsBranch(r);\r
+ if (ticketsBranch != null) {\r
try {\r
- TicGitTicket ticket = new TicGitTicket(ticketFolder);\r
- readTicketContents(r, ticgitBranch, ticket);\r
+ TicketModel ticket = new TicketModel(ticketFolder);\r
+ readTicketContents(r, ticketsBranch, ticket);\r
return ticket;\r
} catch (Throwable t) {\r
- LOGGER.error("Failed to get ticgit ticket " + ticketFolder, t);\r
+ LOGGER.error("Failed to get ticket " + ticketFolder, t);\r
}\r
}\r
return null;\r
}\r
\r
- private static void readTicketContents(Repository r, RefModel ticgitBranch, TicGitTicket ticket) {\r
- List<PathModel> ticketFiles = getFilesInPath(r, ticket.name, ticgitBranch.getCommit());\r
+ private static void readTicketContents(Repository r, RefModel ticketsBranch, TicketModel ticket) {\r
+ List<PathModel> ticketFiles = getFilesInPath(r, ticket.name, ticketsBranch.getCommit());\r
for (PathModel file : ticketFiles) {\r
- String content = getRawContentAsString(r, ticgitBranch.getCommit(), file.path).trim();\r
+ String content = getRawContentAsString(r, ticketsBranch.getCommit(), file.path).trim();\r
if (file.name.equals("TICKET_ID")) {\r
ticket.id = content;\r
} else if (file.name.equals("TITLE")) {\r
Collections.sort(ticket.comments);\r
}\r
\r
- public static String getTicGitContent(Repository r, String filePath) {\r
- RefModel ticgitBranch = getTicGitBranch(r);\r
- if (ticgitBranch != null) {\r
- return getRawContentAsString(r, ticgitBranch.getCommit(), filePath);\r
+ public static String getTicketContent(Repository r, String filePath) {\r
+ RefModel ticketsBranch = getTicketsBranch(r);\r
+ if (ticketsBranch != null) {\r
+ return getRawContentAsString(r, ticketsBranch.getCommit(), filePath);\r
}\r
return "";\r
}\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
-import com.gitblit.wicket.pages.TicGitPage;\r
-import com.gitblit.wicket.pages.TicGitTicketPage;\r
+import com.gitblit.wicket.pages.TicketsPage;\r
+import com.gitblit.wicket.pages.TicketPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class GitBlitWebApp extends WebApplication {\r
mount(new MixedParamUrlCodingStrategy("/patch", PatchPage.class, new String[] { "r", "h", "f" }));\r
mount(new MixedParamUrlCodingStrategy("/history", HistoryPage.class, new String[] { "r", "h", "f" }));\r
\r
- // setup ticgit urls\r
- mount(new MixedParamUrlCodingStrategy("/ticgit", TicGitPage.class, new String[] { "r" }));\r
- mount(new MixedParamUrlCodingStrategy("/ticgittkt", TicGitTicketPage.class, new String[] { "r", "h", "f" }));\r
+ // setup ticket urls\r
+ mount(new MixedParamUrlCodingStrategy("/tickets", TicketsPage.class, new String[] { "r" }));\r
+ mount(new MixedParamUrlCodingStrategy("/ticket", TicketPage.class, new String[] { "r", "h", "f" }));\r
\r
// setup login/logout urls, if we are using authentication\r
if (useAuthentication) {\r
gb.newRepository = new repository\r
gb.newUser = new user\r
gb.commitdiff = commitdiff\r
-gb.ticgit = ticgit\r
+gb.tickets = tickets\r
gb.pageFirst = first\r
gb.pagePrevious prev\r
gb.pageNext = next\r
+++ /dev/null
-package com.gitblit.wicket.models;\r
-\r
-import java.io.Serializable;\r
-import java.text.ParseException;\r
-import java.util.ArrayList;\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-public class TicGitTicket implements Serializable, Comparable<TicGitTicket> {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public String id;\r
- public String name;\r
- public String title;\r
- public String state;\r
- public Date date;\r
- public String handler;\r
- public String milestone;\r
- public String email;\r
- public String author;\r
- public List<Comment> comments;\r
- public List<String> tags;\r
-\r
- public TicGitTicket() {\r
- state = "open";\r
- comments = new ArrayList<Comment>();\r
- tags = new ArrayList<String>();\r
- }\r
-\r
- public TicGitTicket(String ticketName) throws ParseException {\r
- state = "";\r
- name = ticketName;\r
- comments = new ArrayList<Comment>();\r
- tags = new ArrayList<String>();\r
-\r
- String[] chunks = name.split("_");\r
- if (chunks.length == 3) {\r
- date = new Date(Long.parseLong(chunks[0]) * 1000l);\r
- title = chunks[1].replace('-', ' ');\r
- }\r
- }\r
-\r
- public static class Comment implements Serializable, Comparable<Comment> {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public String text;\r
- public String author;\r
- public Date date;\r
-\r
- public Comment(String text, Date date) {\r
- this.text = text;\r
- this.date = date;\r
- }\r
-\r
- public Comment(String filename, String content) throws ParseException {\r
- String[] chunks = filename.split("_", -1);\r
- this.date = new Date(Long.parseLong(chunks[1]) * 1000l);\r
- this.author = chunks[2];\r
- this.text = content;\r
- }\r
-\r
- @Override\r
- public int compareTo(Comment o) {\r
- return date.compareTo(o.date);\r
- }\r
- }\r
-\r
- @Override\r
- public int compareTo(TicGitTicket o) {\r
- return date.compareTo(o.date);\r
- }\r
-}\r
--- /dev/null
+package com.gitblit.wicket.models;\r
+\r
+import java.io.Serializable;\r
+import java.text.ParseException;\r
+import java.util.ArrayList;\r
+import java.util.Date;\r
+import java.util.List;\r
+\r
+public class TicketModel implements Serializable, Comparable<TicketModel> {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public String id;\r
+ public String name;\r
+ public String title;\r
+ public String state;\r
+ public Date date;\r
+ public String handler;\r
+ public String milestone;\r
+ public String email;\r
+ public String author;\r
+ public List<Comment> comments;\r
+ public List<String> tags;\r
+\r
+ public TicketModel() {\r
+ state = "open";\r
+ comments = new ArrayList<Comment>();\r
+ tags = new ArrayList<String>();\r
+ }\r
+\r
+ public TicketModel(String ticketName) throws ParseException {\r
+ state = "";\r
+ name = ticketName;\r
+ comments = new ArrayList<Comment>();\r
+ tags = new ArrayList<String>();\r
+\r
+ String[] chunks = name.split("_");\r
+ if (chunks.length == 3) {\r
+ date = new Date(Long.parseLong(chunks[0]) * 1000l);\r
+ title = chunks[1].replace('-', ' ');\r
+ }\r
+ }\r
+\r
+ public static class Comment implements Serializable, Comparable<Comment> {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public String text;\r
+ public String author;\r
+ public Date date;\r
+\r
+ public Comment(String text, Date date) {\r
+ this.text = text;\r
+ this.date = date;\r
+ }\r
+\r
+ public Comment(String filename, String content) throws ParseException {\r
+ String[] chunks = filename.split("_", -1);\r
+ this.date = new Date(Long.parseLong(chunks[1]) * 1000l);\r
+ this.author = chunks[2];\r
+ this.text = content;\r
+ }\r
+\r
+ @Override\r
+ public int compareTo(Comment o) {\r
+ return date.compareTo(o.date);\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public int compareTo(TicketModel o) {\r
+ return date.compareTo(o.date);\r
+ }\r
+}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:extend>\r
-\r
- <!-- page nav links --> \r
- <div wicket:id="pageLinks">[page links]</div>\r
-\r
- <!-- header --> \r
- <div style="margin-top:5px;" class="header" wicket:id="header">[header]</div>\r
- \r
- <!-- tickets --> \r
- <table style="width:100%" class="pretty">\r
- <tbody>\r
- <tr wicket:id="ticket">\r
- <td style="padding:0; margin:0;"><div wicket:id="ticketState">[ticket state]</div></td>\r
- <td class="date"><span wicket:id="ticketDate">[ticket date]</span></td>\r
- <td class="author"><div wicket:id="ticketHandler">[ticket handler]</div></td>\r
- <td><div wicket:id="ticketTitle">[ticket title]</div></td>\r
- </tr>\r
- </tbody>\r
- </table> \r
-\r
-</wicket:extend>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.pages;\r
-\r
-import java.util.List;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
-import com.gitblit.wicket.LinkPanel;\r
-import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.TicGitTicket;\r
-\r
-public class TicGitPage extends RepositoryPage {\r
-\r
- public TicGitPage(PageParameters params) {\r
- super(params);\r
-\r
- List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(getRepository());\r
-\r
- // header\r
- add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
-\r
- ListDataProvider<TicGitTicket> ticketsDp = new ListDataProvider<TicGitTicket>(tickets);\r
- DataView<TicGitTicket> ticketsView = new DataView<TicGitTicket>("ticket", ticketsDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<TicGitTicket> item) {\r
- final TicGitTicket entry = item.getModelObject();\r
- Label stateLabel = new Label("ticketState", entry.state);\r
- WicketUtils.setTicketCssClass(stateLabel, entry.state);\r
- item.add(stateLabel);\r
- item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));\r
- item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30)));\r
- item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));\r
-\r
- WicketUtils.setAlternatingBackground(item, counter);\r
- counter++;\r
- }\r
- };\r
- add(ticketsView);\r
- }\r
-\r
- @Override\r
- protected String getPageName() {\r
- return getString("gb.ticgit");\r
- }\r
-}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:extend>\r
-\r
- <!-- page nav links --> \r
- <div wicket:id="pageLinks">[page links]</div>\r
- \r
- <!-- ticket title -->\r
- <div style="font-size:150%;padding-top:5px;" wicket:id="ticketTitle">[ticket title]</div>\r
- \r
- <!-- ticket info -->\r
- <table class="plain">\r
- <tr><th><wicket:message key="gb.ticketId">ticket id</wicket:message></th><td><span class="sha1" wicket:id="ticketId">[ticket id]</span></td></tr>\r
- <tr><th><wicket:message key="gb.ticketAssigned">assigned</wicket:message></th><td><span wicket:id=ticketHandler>[ticket title]</span></td></tr>\r
- <tr><th><wicket:message key="gb.ticketOpenDate">open date</wicket:message></th><td><span wicket:id="ticketOpenDate">[ticket open date]</span></td></tr>\r
- <tr><th><wicket:message key="gb.ticketState">state</wicket:message></th><td><span wicket:id="ticketState">[ticket state]</span></td></tr>\r
- <tr><th><wicket:message key="gb.tags">tags</wicket:message></th><td><span wicket:id="ticketTags">[ticket tags]</span></td></tr>\r
- </table>\r
- \r
- <!-- comments header -->\r
- <div class="header"><wicket:message key="gb.ticketComments">comments</wicket:message></div>\r
- \r
- <!-- comments -->\r
- <table style="width:100%;" class="comments">\r
- <tbody>\r
- <tr valign="top" wicket:id="comment">\r
- <td><span class="author" wicket:id="commentAuthor">[comment author]</span><br/>\r
- <span class="date" wicket:id="commentDate">[comment date]</span>\r
- </td>\r
- <td><span wicket:id="commentText">[comment text]</span></td>\r
- </tr>\r
- </tbody>\r
- </table>\r
-\r
-</wicket:extend> \r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-package com.gitblit.wicket.pages;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.basic.Label;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.eclipse.jgit.lib.Repository;\r
-\r
-import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
-import com.gitblit.wicket.RepositoryPage;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.models.TicGitTicket;\r
-import com.gitblit.wicket.models.TicGitTicket.Comment;\r
-\r
-public class TicGitTicketPage extends RepositoryPage {\r
-\r
- public TicGitTicketPage(PageParameters params) {\r
- super(params);\r
-\r
- final String ticketFolder = WicketUtils.getPath(params);\r
-\r
- Repository r = getRepository();\r
- TicGitTicket t = JGitUtils.getTicGitTicket(r, ticketFolder);\r
-\r
- add(new Label("ticketTitle", t.title));\r
- add(new Label("ticketId", t.id));\r
- add(new Label("ticketHandler", t.handler.toLowerCase()));\r
- add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone()));\r
- Label stateLabel = new Label("ticketState", t.state);\r
- WicketUtils.setTicketCssClass(stateLabel, t.state);\r
- add(stateLabel);\r
- add(new Label("ticketTags", StringUtils.flattenStrings(t.tags)));\r
-\r
- ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);\r
- DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {\r
- private static final long serialVersionUID = 1L;\r
- int counter = 0;\r
-\r
- public void populateItem(final Item<Comment> item) {\r
- final Comment entry = item.getModelObject();\r
- item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone()));\r
- item.add(new Label("commentAuthor", entry.author.toLowerCase()));\r
- item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false));\r
- WicketUtils.setAlternatingBackground(item, counter);\r
- counter++;\r
- }\r
- };\r
- add(commentsView);\r
- }\r
-\r
- @Override\r
- protected String getPageName() {\r
- return getString("gb.ticket");\r
- }\r
-\r
- private String prepareComment(String comment) {\r
- String html = StringUtils.escapeForHtml(comment, false);\r
- html = StringUtils.breakLinesForHtml(comment).trim();\r
- return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "<a href=\"/commit/" + repositoryName + "/$1\">commit $1</a>");\r
- }\r
-}\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:extend>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks">[page links]</div>\r
+ \r
+ <!-- ticket title -->\r
+ <div style="font-size:150%;padding-top:5px;" wicket:id="ticketTitle">[ticket title]</div>\r
+ \r
+ <!-- ticket info -->\r
+ <table class="plain">\r
+ <tr><th><wicket:message key="gb.ticketId">ticket id</wicket:message></th><td><span class="sha1" wicket:id="ticketId">[ticket id]</span></td></tr>\r
+ <tr><th><wicket:message key="gb.ticketAssigned">assigned</wicket:message></th><td><span wicket:id=ticketHandler>[ticket title]</span></td></tr>\r
+ <tr><th><wicket:message key="gb.ticketOpenDate">open date</wicket:message></th><td><span wicket:id="ticketOpenDate">[ticket open date]</span></td></tr>\r
+ <tr><th><wicket:message key="gb.ticketState">state</wicket:message></th><td><span wicket:id="ticketState">[ticket state]</span></td></tr>\r
+ <tr><th><wicket:message key="gb.tags">tags</wicket:message></th><td><span wicket:id="ticketTags">[ticket tags]</span></td></tr>\r
+ </table>\r
+ \r
+ <!-- comments header -->\r
+ <div class="header"><wicket:message key="gb.ticketComments">comments</wicket:message></div>\r
+ \r
+ <!-- comments -->\r
+ <table style="width:100%;" class="comments">\r
+ <tbody>\r
+ <tr valign="top" wicket:id="comment">\r
+ <td><span class="author" wicket:id="commentAuthor">[comment author]</span><br/>\r
+ <span class="date" wicket:id="commentDate">[comment date]</span>\r
+ </td>\r
+ <td><span wicket:id="commentText">[comment text]</span></td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
+\r
+</wicket:extend> \r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.eclipse.jgit.lib.Repository;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.utils.StringUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.TicketModel;\r
+import com.gitblit.wicket.models.TicketModel.Comment;\r
+\r
+public class TicketPage extends RepositoryPage {\r
+\r
+ public TicketPage(PageParameters params) {\r
+ super(params);\r
+\r
+ final String ticketFolder = WicketUtils.getPath(params);\r
+\r
+ Repository r = getRepository();\r
+ TicketModel t = JGitUtils.getTicket(r, ticketFolder);\r
+\r
+ add(new Label("ticketTitle", t.title));\r
+ add(new Label("ticketId", t.id));\r
+ add(new Label("ticketHandler", t.handler.toLowerCase()));\r
+ add(WicketUtils.createTimestampLabel("ticketOpenDate", t.date, getTimeZone()));\r
+ Label stateLabel = new Label("ticketState", t.state);\r
+ WicketUtils.setTicketCssClass(stateLabel, t.state);\r
+ add(stateLabel);\r
+ add(new Label("ticketTags", StringUtils.flattenStrings(t.tags)));\r
+\r
+ ListDataProvider<Comment> commentsDp = new ListDataProvider<Comment>(t.comments);\r
+ DataView<Comment> commentsView = new DataView<Comment>("comment", commentsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<Comment> item) {\r
+ final Comment entry = item.getModelObject();\r
+ item.add(WicketUtils.createDateLabel("commentDate", entry.date, GitBlitWebSession.get().getTimezone()));\r
+ item.add(new Label("commentAuthor", entry.author.toLowerCase()));\r
+ item.add(new Label("commentText", prepareComment(entry.text)).setEscapeModelStrings(false));\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(commentsView);\r
+ }\r
+\r
+ @Override\r
+ protected String getPageName() {\r
+ return getString("gb.ticket");\r
+ }\r
+\r
+ private String prepareComment(String comment) {\r
+ String html = StringUtils.escapeForHtml(comment, false);\r
+ html = StringUtils.breakLinesForHtml(comment).trim();\r
+ return html.replaceAll("\\bcommit\\s*([A-Za-z0-9]*)\\b", "<a href=\"/commit/" + repositoryName + "/$1\">commit $1</a>");\r
+ }\r
+}\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:extend>\r
+\r
+ <!-- page nav links --> \r
+ <div wicket:id="pageLinks">[page links]</div>\r
+\r
+ <!-- header --> \r
+ <div style="margin-top:5px;" class="header" wicket:id="header">[header]</div>\r
+ \r
+ <!-- tickets --> \r
+ <table style="width:100%" class="pretty">\r
+ <tbody>\r
+ <tr wicket:id="ticket">\r
+ <td style="padding:0; margin:0;"><div wicket:id="ticketState">[ticket state]</div></td>\r
+ <td class="date"><span wicket:id="ticketDate">[ticket date]</span></td>\r
+ <td class="author"><div wicket:id="ticketHandler">[ticket handler]</div></td>\r
+ <td><div wicket:id="ticketTitle">[ticket title]</div></td>\r
+ </tr>\r
+ </tbody>\r
+ </table> \r
+\r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+package com.gitblit.wicket.pages;\r
+\r
+import java.util.List;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.utils.StringUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.LinkPanel;\r
+import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.models.TicketModel;\r
+\r
+public class TicketsPage extends RepositoryPage {\r
+\r
+ public TicketsPage(PageParameters params) {\r
+ super(params);\r
+\r
+ List<TicketModel> tickets = JGitUtils.getTickets(getRepository());\r
+\r
+ // header\r
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));\r
+\r
+ ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);\r
+ DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ int counter = 0;\r
+\r
+ public void populateItem(final Item<TicketModel> item) {\r
+ final TicketModel entry = item.getModelObject();\r
+ Label stateLabel = new Label("ticketState", entry.state);\r
+ WicketUtils.setTicketCssClass(stateLabel, entry.state);\r
+ item.add(stateLabel);\r
+ item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));\r
+ item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30)));\r
+ item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicketPage.class, newPathParameter(entry.name)));\r
+\r
+ WicketUtils.setAlternatingBackground(item, counter);\r
+ counter++;\r
+ }\r
+ };\r
+ add(ticketsView);\r
+ }\r
+\r
+ @Override\r
+ protected String getPageName() {\r
+ return getString("gb.tickets");\r
+ }\r
+}\r
\r
item.add(new RefsPanel("commitRefs", repositoryName, entry, allRefs));\r
\r
+ // TODO links for folder\r
item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
item.add(new BookmarkablePageLink<Void>("commitdiff", CommitDiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));\r
item.add(new BookmarkablePageLink<Void>("difftocurrent", BlobDiffPage.class, WicketUtils.newPathParameter(repositoryName, entry.getName(), path)).setEnabled(counter > 0));\r
import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
-import com.gitblit.wicket.pages.TicGitPage;\r
+import com.gitblit.wicket.pages.TicketsPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class PageLinksPanel extends Panel {\r
put("branches", "gb.branches");\r
put("tags", "gb.tags");\r
put("tree", "gb.tree");\r
- put("ticgit", "gb.ticgit");\r
+ put("tickets", "gb.tickets");\r
}\r
};\r
\r
add(new BookmarkablePageLink<Void>("tags", TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
\r
- // Get the repository ticgit setting\r
- boolean checkTicgit = GitBlit.self().settings().getBoolean(Keys.ticgit.global, false);\r
- checkTicgit |= GitBlit.self().settings().getBoolean(MessageFormat.format(Keys.ticgit._ROOT + ".{0}", repositoryName), false);\r
+ // Get the repository tickets setting\r
+ boolean checkTicgit = GitBlit.self().settings().getBoolean(Keys.tickets.global, false);\r
+ checkTicgit |= GitBlit.self().settings().getBoolean(MessageFormat.format(Keys.tickets._ROOT + ".{0}", repositoryName), false);\r
\r
// Add dynamic repository extras\r
List<String> extras = new ArrayList<String>();\r
- if (checkTicgit && JGitUtils.getTicGitBranch(r) != null) {\r
- extras.add("ticgit");\r
+ if (checkTicgit && JGitUtils.getTicketsBranch(r) != null) {\r
+ extras.add("tickets");\r
}\r
\r
ListDataProvider<String> extrasDp = new ListDataProvider<String>(extras);\r
\r
public void populateItem(final Item<String> item) {\r
String extra = item.getModelObject();\r
- if (extra.equals("ticgit")) {\r
+ if (extra.equals("tickets")) {\r
item.add(new Label("extraSeparator", " | "));\r
- item.add(new LinkPanel("extraLink", null, "ticgit", TicGitPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
+ item.add(new LinkPanel("extraLink", null, "tickets", TicketsPage.class, WicketUtils.newRepositoryParameter(repositoryName)));\r
}\r
}\r
};\r