web.allowAdministration = true\r
\r
# This is the message display above the repositories table.\r
-# This can point to a file with HTML content.\r
-web.repositoriesMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own Git repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://https://github.com/wicketstuff/core/wiki/GoogleCharts">WicketStuff googlecharts</a>, <a href="http://markdown.tautua.org">MarkdownPapers</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, and <a href="http://jcommander.org">JCommander</a>.\r
+# This can point to a file with Markdown content.\r
+# specifying "gitblit" uses the internal welcome message.\r
+web.repositoriesMessage = gitblit\r
\r
# Use the client timezone when formatting dates.\r
# This uses AJAX to determine the browser's timezone and enables Wicket \r
package com.gitblit.wicket.pages;\r
\r
+import java.io.File;\r
+import java.io.FileReader;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.io.StringWriter;\r
import java.util.Collections;\r
import java.util.Comparator;\r
import java.util.Iterator;\r
import java.util.List;\r
\r
+import org.apache.wicket.Component;\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByBorder;\r
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
import org.apache.wicket.model.IModel;\r
import org.apache.wicket.model.Model;\r
+import org.apache.wicket.resource.ContextRelativeResource;\r
+import org.tautua.markdownpapers.Markdown;\r
\r
import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
+import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.TimeUtils;\r
import com.gitblit.wicket.BasePage;\r
import com.gitblit.wicket.GitBlitWebSession;\r
adminLinks.add(new BookmarkablePageLink<Void>("newUser", RepositoriesPage.class));\r
add(adminLinks.setVisible(showAdmin));\r
\r
- add(new Label("repositoriesMessage", GitBlit.self().settings().getString(Keys.web.repositoriesMessage, "")).setEscapeModelStrings(false));\r
+ // Load the markdown welcome message\r
+ String messageSource = GitBlit.self().settings().getString(Keys.web.repositoriesMessage, "gitblit");\r
+ String message = "";\r
+ if (messageSource.equalsIgnoreCase("gitblit")) {\r
+ // Read default welcome message\r
+ try {\r
+ ContextRelativeResource res = new ContextRelativeResource("/com/gitblit/wicket/resources/welcome.mkd");\r
+ InputStream is = res.getResourceStream().getInputStream();\r
+ InputStreamReader reader = new InputStreamReader(is);\r
+ StringWriter writer = new StringWriter();\r
+ Markdown markdown = new Markdown();\r
+ markdown.transform(reader, writer);\r
+ message = writer.toString().trim();\r
+ reader.close();\r
+ writer.close();\r
+ } catch (Throwable t) {\r
+ message = "Failed to read default welcome message!";\r
+ error(message, t);\r
+ }\r
+ } else {\r
+ // Read user-supplied welcome message\r
+ if (!StringUtils.isEmpty(messageSource)) {\r
+ File file = new File(messageSource);\r
+ if (file.exists()) {\r
+ try {\r
+ FileReader reader = new FileReader(file);\r
+ StringWriter writer = new StringWriter();\r
+ Markdown markdown = new Markdown();\r
+ markdown.transform(reader, writer);\r
+ message = writer.toString().trim();\r
+ reader.close();\r
+ writer.close();\r
+ } catch (Throwable t) {\r
+ message = "Failed to read " + file;\r
+ error(message, t);\r
+ }\r
+ } else {\r
+ message = messageSource + " is not a valid file.";\r
+ }\r
+ }\r
+ }\r
+ Component repositoriesMessage = new Label("repositoriesMessage", message).setEscapeModelStrings(false);\r
+ if (!showAdmin) {\r
+ WicketUtils.setCssStyle(repositoriesMessage, "padding-top:10px");\r
+ }\r
+ add(repositoriesMessage);\r
\r
List<RepositoryModel> rows = GitBlit.self().getRepositories(getRequest());\r
DataProvider dp = new DataProvider(rows);\r