# SINCE 0.7.0 \r
web.enableRpcAdministration = false\r
\r
+# Allow Gravatar images to be displayed in Gitblit pages.\r
+#\r
+# SINCE 0.8.0\r
+web.allowGravatar = true\r
+\r
# Allow dynamic zip downloads.\r
#\r
# SINCE 0.5.0 \r
### Current Release\r
**%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%) | [manager](http://code.google.com/p/gitblit/downloads/detail?name=%MANAGER%) | [api](http://code.google.com/p/gitblit/downloads/detail?name=%API%)) based on [%JGIT%][jgit] *released %BUILDDATE%*\r
\r
+- added: optional Gravatar integration \r
+ **New:** *web.allowGravatar = true* \r
+\r
+### Older Releases\r
+\r
+**0.7.0** ([go](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.7.0.zip) | [war](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.7.0.war) | [fedclient](http://code.google.com/p/gitblit/downloads/detail?name=fedclient-0.7.0.zip) | [manager](http://code.google.com/p/gitblit/downloads/detail?name=manager-0.7.0.zip) | [api](http://code.google.com/p/gitblit/downloads/detail?name=gbapi-0.7.0.zip)) based on [JGit 1.1.0 (201109151100-r)][jgit] *released 2011-11-11*\r
+\r
- **security**: fixed security hole when cloning clone-restricted repository with TortoiseGit (issue 28)\r
- improved: updated ui with Twitter's Bootstrap CSS toolkit \r
**New:** *web.loginMessage = gitblit*\r
- updated: MarkdownPapers 1.2.5\r
- updated: Wicket 1.4.19\r
\r
-### Older Releases\r
-\r
**0.6.0** ([go](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.6.0.zip) | [war](http://code.google.com/p/gitblit/downloads/detail?name=gitblit-0.6.0.war) | [fedclient](http://code.google.com/p/gitblit/downloads/detail?name=fedclient-0.6.0.zip)) based on [JGit 1.1.0 (201109151100-r)][jgit] *released 2011-09-27*\r
\r
- added: federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances. This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit. \r
--- /dev/null
+/*\r
+ * Copyright 2011 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.wicket;\r
+\r
+import java.text.MessageFormat;\r
+\r
+import org.apache.wicket.AttributeModifier;\r
+import org.apache.wicket.markup.ComponentTag;\r
+import org.apache.wicket.markup.html.WebComponent;\r
+import org.apache.wicket.model.Model;\r
+import org.eclipse.jgit.lib.PersonIdent;\r
+\r
+import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
+import com.gitblit.utils.StringUtils;\r
+\r
+/**\r
+ * Represents a Gravatar image.\r
+ * \r
+ * @author James Moger\r
+ * \r
+ */\r
+public class GravatarImage extends WebComponent {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ public GravatarImage(String id, PersonIdent person) {\r
+ this(id, person, 0);\r
+ }\r
+ \r
+ public GravatarImage(String id, PersonIdent person, int width) {\r
+ super(id);\r
+ if (width <= 0) {\r
+ width = 60;\r
+ }\r
+ String authorhash = StringUtils.getMD5(person.getEmailAddress().toLowerCase());\r
+ String url = MessageFormat.format("http://www.gravatar.com/avatar/{0}?s={1,number,0}&d=identicon", authorhash, width);\r
+ add(new AttributeModifier("src", true, new Model<String>(url)));\r
+ setVisible(GitBlit.getBoolean(Keys.web.allowGravatar, true));\r
+ }\r
+\r
+ @Override\r
+ protected void onComponentTag(ComponentTag tag) {\r
+ super.onComponentTag(tag);\r
+ checkComponentTag(tag, "img");\r
+ }\r
+\r
+}
\ No newline at end of file
<!-- commit header -->\r
<div wicket:id="commitHeader">[commit header]</div>\r
\r
+ <!-- Author Gravatar -->\r
+ <img style="float:right;vertical-align: top;" wicket:id="authorAvatar" />\r
+ \r
<!-- commit info -->\r
<table class="plain">\r
<tr><th><wicket:message key="gb.refs">refs</wicket:message></th><td><div wicket:id="refsPanel">[references]</div></td></tr>\r
<tr><td><span class="sha1" wicket:id="authorName"></span></td></tr>\r
<tr><td><span class="sha1" wicket:id="authorDate"></span></td></tr>\r
</table>\r
+ <!-- Note Author Gravatar -->\r
+ <img style="vertical-align: top;" wicket:id="noteAuthorAvatar" /> \r
</td>\r
<td class="message"><span class="sha1" wicket:id="noteContent"></span></td>\r
</tr>\r
import com.gitblit.models.GitNote;\r
import com.gitblit.models.PathModel.PathChangeModel;\r
import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.GravatarImage;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.panels.CommitHeaderPanel;\r
import com.gitblit.wicket.panels.CommitLegendPanel;\r
add(createPersonPanel("commitAuthor", c.getAuthorIdent(), Constants.SearchType.AUTHOR));\r
add(WicketUtils.createTimestampLabel("commitAuthorDate", c.getAuthorIdent().getWhen(),\r
getTimeZone()));\r
-\r
+ add(new GravatarImage("authorAvatar", c.getAuthorIdent()));\r
+ \r
// committer\r
add(createPersonPanel("commitCommitter", c.getCommitterIdent(), Constants.SearchType.COMMITTER));\r
add(WicketUtils.createTimestampLabel("commitCommitterDate",\r
item.add(new RefsPanel("refName", repositoryName, Arrays.asList(entry.notesRef)));\r
item.add(createPersonPanel("authorName", entry.notesRef.getAuthorIdent(),\r
Constants.SearchType.AUTHOR));\r
+ item.add(new GravatarImage("noteAuthorAvatar", entry.notesRef.getAuthorIdent()));\r
item.add(WicketUtils.createTimestampLabel("authorDate", entry.notesRef\r
.getAuthorIdent().getWhen(), getTimeZone()));\r
item.add(new Label("noteContent", GitBlit.self().processCommitMessage(\r