Browse Source

Login message option. More Bootstrap updates. All docs converted.

tags/v0.7.0
James Moger 12 years ago
parent
commit
8c5d72248c

+ 8
- 0
NOTICE View File

@@ -7,6 +7,14 @@ The Apache Software Foundation (http://www.apache.org/).
This is an aggregated NOTICE file for the projects included
in this distribution or linked to by this distribution.
---------------------------------------------------------------------------
Bootstrap
---------------------------------------------------------------------------
Bootstrap, released under the
Apache Software License, Version 2.0.
http://twitter.github.com/bootstrap
---------------------------------------------------------------------------
google-code-prettify
---------------------------------------------------------------------------

+ 6
- 6
build.xml View File

@@ -196,10 +196,10 @@
<copy todir="${docs.output.dir}">
<!-- Copy selected Gitblit resources -->
<fileset dir="${project.resources.dir}">
<include name="background.png" />
<include name="gitblit.css" />
<include name="bootstrap.130.css" />
<include name="bootstrap.gb.css" />
<include name="markdown.css" />
<include name="gitblt_25.png" />
<include name="gitblt_25_white.png" />
<include name="gitblt-favicon.png" />
<include name="lock_go_16x16.png" />
<include name="lock_pull_16x16.png" />
@@ -425,10 +425,10 @@
<copy todir="${project.site.dir}">
<!-- Copy selected Gitblit resources -->
<fileset dir="${project.resources.dir}">
<include name="background.png" />
<include name="gitblit.css" />
<include name="bootstrap.130.css" />
<include name="bootstrap.gb.css" />
<include name="markdown.css" />
<include name="gitblt_25.png" />
<include name="gitblt_25_white.png" />
<include name="gitblt-favicon.png" />
<include name="lock_go_16x16.png" />
<include name="lock_pull_16x16.png" />

+ 8
- 1
distrib/gitblit.properties View File

@@ -110,7 +110,14 @@ web.showRepositorySizes = true
# SINCE 0.6.0
web.showFederationRegistrations = false
# This is the message display above the repositories table.
# This is the message displayed when *web.authenticateViewPages=true*.
# This can point to a file with Markdown content.
# Specifying "gitblit" uses the internal login message.
#
# SINCE 0.6.1
web.loginMessage = gitblit
# This is the message displayed above the repositories table.
# This can point to a file with Markdown content.
# Specifying "gitblit" uses the internal welcome message.
#

+ 2
- 0
docs/00_index.mkd View File

@@ -28,6 +28,8 @@ Gitblit requires a Java 6 Runtime Environment (JRE) or a Java 6 Development Kit
**%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*
- improved: updated ui with Twitter's Bootstrap CSS toolkit
<br/>**New:** *web.loginMessage = gitblit*
- fixed: Null pointer exception if did not set federation strategy (issue 20)
- fixed: Gitblit GO allows SSL renegotiation if running on Java 1.6.0_22 or later
- added: IUserService.setup(IStoredSettings) for custom user service implementations

+ 1
- 1
docs/02_federation.mkd View File

@@ -175,7 +175,7 @@ By default, federated repositories can not be pushed to, they are read-only by t
## Federation Pull Registration Keys
<table class="text">
<table>
<tr><th>federation.N.url</th>
<td>string</td>
<td>the url of the origin Gitblit instance *(required)*</td>

+ 1
- 0
docs/04_design.mkd View File

@@ -10,6 +10,7 @@
### Bundled Dependencies
The following dependencies are bundled with Gitblit.
- [Bootstrap](http://twitter.github.com/bootstrap) (Apache 2.0)
- [google-code-prettify](http://code.google.com/p/google-code-prettify) (Apache 2.0)
- [Commons Daemon](http://commons.apache.org/daemon) (Apache 2.0)
- magnifying glass search icon courtesy of [Gnome](http://gnome.org) (Creative Commons CC-BY)

+ 2
- 0
docs/04_releases.mkd View File

@@ -3,6 +3,8 @@
### Current Release
**%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*
- improved: updated ui with Twitter's Bootstrap CSS toolkit
<br/>**New:** *web.loginMessage = gitblit*
- fixed: Null pointer exception if did not set federation strategy (issue 20)
- fixed: Gitblit GO allows SSL renegotiation if running on Java 1.6.0_22 or later
- added: IUserService.setup(IStoredSettings) for custom user service implementations

+ 7
- 5
docs/doc_footer.html View File

@@ -1,7 +1,9 @@
</div>
<div style="margin-top:10px" class="page_footer">
<div style="float:right;">{0}</div>
The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.
</div>
</div> <!-- markdown -->
<div style="margin-top:10px" class="page_footer">
<div style="float:right;">{0}</div>
The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.
</div>
</div> <!-- content -->
</div> <!-- container -->
</body>
</html>

+ 17
- 9
docs/doc_header.html View File

@@ -2,7 +2,8 @@
<html>
<head>
<title>Gitblit</title>
<link rel="stylesheet" type="text/css" href="./gitblit.css"/>
<link rel="stylesheet" type="text/css" href="./bootstrap.130.css"/>
<link rel="stylesheet" type="text/css" href="./bootstrap.gb.css"/>
<link rel="stylesheet" type="text/css" href="./markdown.css"/>
<link rel="shortcut icon" type="image/png" href="./gitblt-favicon.png" />
<meta name="ROBOTS" content="INDEX, NOFOLLOW">
@@ -28,12 +29,19 @@
<script type="text/javascript" src="prettify/prettify.js"></script>
<link href="prettify/prettify.css" type="text/css" rel="stylesheet" />
</head>
<body style="width:900px" onload="prettyPrint()">
<div class="page_header">
<a title="gitblit homepage" href="http://gitblit.com/">
<img src="./gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
</a>
<span style="color:black;">{0}</span>
<body style="padding-top:40px;" onload="prettyPrint()">
<div class="topbar">
<div class="fill">
<div class="container">
<a class="brand" href="http://gitblit.com" title="gitblit homepage">
<img src="gitblt_25_white.png" width="79" height="25" alt="gitblit" class="logo"/>
</a>
<ul class="nav">
{1}
</ul>
</div>
</div>
</div>
<div class="page_nav">{1}</div>
<div class="markdown">
<div class="container">
<div class="content">
<div class="markdown">

+ 7
- 5
docs/site_footer.html View File

@@ -1,7 +1,9 @@
</div>
<div style="margin-top:10px" class="page_footer">
<div style="float:right;">{0}</div>
The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.
</div>
</div> <!-- markdown -->
<div style="margin-top:10px" class="page_footer">
<div style="float:right;">{0}</div>
The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.
</div>
</div> <!-- content -->
</div> <!-- container -->
</body>
</html>

+ 21
- 12
docs/site_header.html View File

@@ -2,7 +2,8 @@
<html>
<head>
<title>Gitblit</title>
<link rel="stylesheet" type="text/css" href="./gitblit.css"/>
<link rel="stylesheet" type="text/css" href="./bootstrap.130.css"/>
<link rel="stylesheet" type="text/css" href="./bootstrap.gb.css"/>
<link rel="stylesheet" type="text/css" href="./markdown.css"/>
<link rel="shortcut icon" type="image/png" href="./gitblt-favicon.png" />
<meta name="ROBOTS" content="INDEX">
@@ -33,15 +34,23 @@
<!-- ANALYTICS -->
</head>
<body style="width:900px" onload="prettyPrint()">
<a href="http://github.com/gitblit"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://d3nwyuy0nl342s.cloudfront.net/img/30f550e0d38ceb6ef5b81500c64d970b7fb0f028/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub"></a>
<div class="page_header">
<a title="gitblit homepage" href="http://gitblit.com/">
<img src="./gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/>
</a>
<span style="color:black;">{0}</span>
<!-- Google Plus One -->
<g:plusone></g:plusone>
<body style="padding-top:40px;" onload="prettyPrint()">
<div class="topbar">
<div class="fill">
<div class="container">
<a class="brand" href="http://gitblit.com" title="gitblit homepage">
<img src="gitblt_25_white.png" width="79" height="25" alt="gitblit" class="logo"/>
</a>
<!-- Google Plus One -->
<g:plusone></g:plusone>
<ul class="nav">
{1}
</ul>
</div>
</div>
</div>
<div class="page_nav">{1}</div>
<div class="markdown">
<div class="container">
<div class="content">
<div class="markdown">

+ 31
- 10
resources/bootstrap.gb.css View File

@@ -3,7 +3,7 @@ body, input, select {
}
ul, ol {
margin:0 !important;
margin-bottom: 10px !important;
}
hr {
@@ -77,6 +77,7 @@ pre, code, pre.prettyprint, pre.plainprint {
font-size:12px;
border:0px;
padding: 0;
line-height: 1.35em;
}
table {
@@ -154,6 +155,11 @@ img.inlineIcon {
padding-right: 1px;
}
img.overview {
float:right;
border:1px solid #CCCCCC;
}
div.header, div.commitHeader, table.repositories th {
background-color:#e0e0e0;
background-repeat:repeat-x;
@@ -223,26 +229,41 @@ div.search input {
-webkit-border-radius:0;-moz-border-radius:0x;border-radius:0;
vertical-align: top;
background: url(search-icon.png) no-repeat 4px center;
color: #ddd;
background-color: transparent;
border: 1px solid transparent;
outline: none;
padding: 2px 2px 2px 22px;
text-shadow: none;
margin: 0px;
color: #ddd;
}
div.search input:hover, div.search input:focus {
background: url(search-icon.png) no-repeat 4px center;
color: white;
background-color: transparent;
border: 1px solid transparent;
padding: 2px 2px 2px 22px;
text-shadow: none;
color: #ddd;
border-bottom: 1px solid #ff9900;
outline: none;
}
div.search input:focused {
background: url(search-icon.png) no-repeat 4px center;
div.search input:focus {
color: white;
}
/* div.search input:focused { */
/* background-color: transparent; */
/* border: 1px solid transparent; */
/* padding: 2px 2px 2px 22px; */
/* text-shadow: none; */
/* } */
div.login input:focus {
background-color: rgba(255, 255, 255, 0.6);
text-shadow: none;
color: white;
border-bottom: 1px solid #ff9900;
outline: none;
padding: 0 !important;
}
div.commit_message {

+ 3
- 0
resources/login.mkd View File

@@ -0,0 +1,3 @@
## Please Login
Pleaes enter your credentials to access this Gitblit site.

+ 1
- 1
src/com/gitblit/build/BuildSite.java View File

@@ -91,7 +91,7 @@ public class BuildSite {
System.out.println(MessageFormat.format("Generating site from {0} Markdown Docs in {1} ",
markdownFiles.length, sourceFolder.getAbsolutePath()));
String linkPattern = "<a href=''{0}''>{1}</a>";
String linkPattern = "<li><a href=''{0}''>{1}</a></li>";
StringBuilder sb = new StringBuilder();
for (File file : markdownFiles) {
String documentName = getDocumentName(file);

+ 6
- 0
src/com/gitblit/wicket/AuthorizationStrategy.java View File

@@ -35,6 +35,12 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected boolean isPageAuthorized(Class pageClass) {
if (RepositoriesPage.class.equals(pageClass)) {
// allow all requests to get to the RepositoriesPage with its inline
// authentication form
return true;
}
if (BasePage.class.isAssignableFrom(pageClass)) {
boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);

+ 1
- 1
src/com/gitblit/wicket/GitBlitWebApp.properties View File

@@ -66,7 +66,7 @@ gb.filesRenamed = {0} files renamed
gb.missingUsername = Missing Username
gb.edit = edit
gb.searchTypeTooltip = Select Search Type
gb.searchTooltip = Search Gitblit
gb.searchTooltip = Search {0}
gb.delete = delete
gb.docs = docs
gb.accessRestriction = access restriction

+ 1
- 1
src/com/gitblit/wicket/pages/EditUserPage.java View File

@@ -182,7 +182,7 @@ public class EditUserPage extends RootSubPage {
@Override
public void onSubmit() {
setResponsePage(RepositoriesPage.class);
setResponsePage(UsersPage.class);
}
};
cancel.setDefaultFormProcessing(false);

+ 46
- 22
src/com/gitblit/wicket/pages/RepositoriesPage.java View File

@@ -19,6 +19,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.MessageFormat;
import org.apache.wicket.Component;
import org.apache.wicket.markup.html.basic.Label;
@@ -28,6 +29,7 @@ import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.utils.MarkdownUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.RepositoriesPanel;
@@ -37,23 +39,40 @@ public class RepositoriesPage extends RootPage {
super();
setupPage("", "");
// check to see if we should display a login message
boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {
String messageSource = GitBlit.getString(Keys.web.loginMessage, "gitblit");
String message = readMarkdown(messageSource, "login.mkd");
Component repositoriesMessage = new Label("repositoriesMessage", message);
add(repositoriesMessage.setEscapeModelStrings(false));
add(new Label("repositoriesPanel"));
return;
}
// Load the markdown welcome message
String messageSource = GitBlit.getString(Keys.web.repositoriesMessage, "gitblit");
String message = readMarkdown(messageSource, "welcome.mkd");
Component repositoriesMessage = new Label("repositoriesMessage", message)
.setEscapeModelStrings(false).setVisible(message.length() > 0);
add(repositoriesMessage);
RepositoriesPanel repositories = new RepositoriesPanel("repositoriesPanel", showAdmin,
null, getAccessRestrictions());
// push the panel down if we are hiding the admin controls and the
// welcome message
if (!showAdmin && !repositoriesMessage.isVisible()) {
WicketUtils.setCssStyle(repositories, "padding-top:5px;");
}
add(repositories);
}
private String readMarkdown(String messageSource, String resource) {
String message = "";
if (messageSource.equalsIgnoreCase("gitblit")) {
// Read default welcome message
try {
ContextRelativeResource res = WicketUtils.getResource("welcome.mkd");
InputStream is = res.getResourceStream().getInputStream();
InputStreamReader reader = new InputStreamReader(is);
message = MarkdownUtils.transformMarkdown(reader);
reader.close();
} catch (Throwable t) {
message = "Failed to read default welcome message!";
error(message, t, false);
}
// Read default message
message = readDefaultMarkdown(resource);
} else {
// Read user-supplied welcome message
// Read user-supplied message
if (!StringUtils.isEmpty(messageSource)) {
File file = new File(messageSource);
if (file.exists()) {
@@ -69,16 +88,21 @@ public class RepositoriesPage extends RootPage {
}
}
}
Component repositoriesMessage = new Label("repositoriesMessage", message)
.setEscapeModelStrings(false).setVisible(message.length() > 0);
add(repositoriesMessage);
RepositoriesPanel repositories = new RepositoriesPanel("repositoriesPanel", showAdmin,
null, getAccessRestrictions());
// push the panel down if we are hiding the admin controls and the
// welcome message
if (!showAdmin && !repositoriesMessage.isVisible()) {
WicketUtils.setCssStyle(repositories, "padding-top:5px;");
return message;
}
private String readDefaultMarkdown(String file) {
String message;
try {
ContextRelativeResource res = WicketUtils.getResource(file);
InputStream is = res.getResourceStream().getInputStream();
InputStreamReader reader = new InputStreamReader(is);
message = MarkdownUtils.transformMarkdown(reader);
reader.close();
} catch (Throwable t) {
message = MessageFormat.format("Failed to read default message from {0}!", file);
error(message, t, false);
}
add(repositories);
return message;
}
}

+ 6
- 3
src/com/gitblit/wicket/pages/RepositoryPage.java View File

@@ -136,8 +136,7 @@ public abstract class RepositoryPage extends BasePage {
String extra = item.getModelObject();
PageRegistration pageReg = registeredPages.get(extra);
item.add(new LinkPanel("extraLink", null, getString(pageReg.translationKey),
pageReg.pageClass, WicketUtils.newRepositoryParameter(repositoryName))
/*.setEnabled(!extra.equals(pageWicketId))*/);
pageReg.pageClass, WicketUtils.newRepositoryParameter(repositoryName)));
}
};
add(extrasView);
@@ -385,7 +384,7 @@ public abstract class RepositoryPage extends BasePage {
void setTranslatedAttributes() {
WicketUtils.setHtmlTooltip(get("searchType"), getString("gb.searchTypeTooltip"));
WicketUtils.setHtmlTooltip(get("searchBox"), getString("gb.searchTooltip"));
WicketUtils.setHtmlTooltip(get("searchBox"), MessageFormat.format(getString("gb.searchTooltip"), repositoryName));
WicketUtils.setInputPlaceholder(get("searchBox"), getString("gb.search"));
}
@@ -393,6 +392,10 @@ public abstract class RepositoryPage extends BasePage {
public void onSubmit() {
SearchType searchType = searchTypeModel.getObject();
String searchString = searchBoxModel.getObject();
if (searchString == null) {
// FIXME IE intermittently has no searchString. Wicket bug?
return;
}
for (SearchType type : SearchType.values()) {
if (searchString.toLowerCase().startsWith(type.name().toLowerCase() + ":")) {
searchType = type;

+ 5
- 3
src/com/gitblit/wicket/pages/RootPage.html View File

@@ -19,9 +19,11 @@
</ul>
<form class="pull-right" wicket:id="loginForm">
<input wicket:id="username" class="input-small" type="text" placeholder="Username">
<input wicket:id="password" class="input-small" type="password" placeholder="Password">
<button class="btn primary" type="submit">Sign in</button>
<div class="login">
<input wicket:id="username" class="input-small" type="text" />
<input wicket:id="password" class="input-small" type="password" />
<button class="btn primary" type="submit"><wicket:message key="gb.login"></wicket:message></button>
</div>
</form>
</div>
</div>

+ 7
- 2
src/com/gitblit/wicket/pages/RootPage.java View File

@@ -32,6 +32,7 @@ import com.gitblit.Keys;
import com.gitblit.models.UserModel;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
/**
* Root page is a topbar, navigable page like Repositories, Users, or
@@ -104,8 +105,12 @@ public abstract class RootPage extends BasePage {
}
}
};
loginForm.add(new TextField<String>("username", username));
loginForm.add(new PasswordTextField("password", password));
TextField<String> unameField = new TextField<String>("username", username);
WicketUtils.setInputPlaceholder(unameField, getString("gb.username"));
loginForm.add(unameField);
PasswordTextField pwField = new PasswordTextField("password", password);
WicketUtils.setInputPlaceholder(pwField, getString("gb.password"));
loginForm.add(pwField);
add(loginForm);
if (GitBlit.getBoolean(Keys.web.authenticateViewPages, true)
|| GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {

Loading…
Cancel
Save