<resource file="${basedir}/resources/commit_changes_16x16.png" />\r
<resource file="${basedir}/resources/commit_merge_16x16.png" />\r
<resource file="${basedir}/resources/commit_divide_16x16.png" />\r
+ <resource file="${basedir}/resources/star_16x16.png" />\r
<resource file="${basedir}/resources/blank.png" />\r
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />\r
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_es.properties" />\r
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ja.properties" />\r
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ko.properties" />\r
+ <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_nl.properties" />\r
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_pl.properties" />\r
+ <resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_pt_BR.properties" />\r
\r
<class name="com.gitblit.client.GitblitManagerLauncher" />\r
<classfilter>\r
}\r
model.HEAD = JGitUtils.getHEADRef(r);\r
model.availableRefs = JGitUtils.getAvailableHeadTargets(r);\r
+ model.sparkleshareId = JGitUtils.getSparkleshareId(r);\r
r.close();\r
\r
if (model.origin != null && model.origin.startsWith("file://")) {\r
content = JGitUtils.getStringContent(r, tree, resource, encodings).getBytes(\r
Constants.ENCODING);\r
} else {\r
- content = JGitUtils.getByteContent(r, tree, resource);\r
+ content = JGitUtils.getByteContent(r, tree, resource, false);\r
}\r
response.setContentType(contentType);\r
} catch (Exception e) {\r
private final ImageIcon federatedIcon;\r
\r
private final ImageIcon forkIcon;\r
+ \r
+ private final ImageIcon sparkleshareIcon;\r
\r
public IndicatorsRenderer() {\r
super(new FlowLayout(FlowLayout.RIGHT, 1, 0));\r
frozenIcon = new ImageIcon(getClass().getResource("/cold_16x16.png"));\r
federatedIcon = new ImageIcon(getClass().getResource("/federated_16x16.png"));\r
forkIcon = new ImageIcon(getClass().getResource("/commit_divide_16x16.png"));\r
+ sparkleshareIcon = new ImageIcon(getClass().getResource("/star_16x16.png"));\r
}\r
\r
@Override\r
if (value instanceof RepositoryModel) {\r
StringBuilder tooltip = new StringBuilder();\r
RepositoryModel model = (RepositoryModel) value;\r
+ if (model.isSparkleshared()) {\r
+ JLabel icon = new JLabel(sparkleshareIcon);\r
+ tooltip.append(Translation.get("gb.isSparkleshared")).append("<br/>");\r
+ add(icon);\r
+ }\r
if (model.isFork()) {\r
JLabel icon = new JLabel(forkIcon);\r
tooltip.append(Translation.get("gb.isFork")).append("<br/>");\r
\r
public transient boolean isCollectingGarbage;\r
public Date lastGC;\r
+ public String sparkleshareId;\r
\r
public RepositoryModel() {\r
this("", "", "", new Date(0));\r
return !accessRestriction.atLeast(AccessRestrictionType.VIEW);\r
}\r
\r
+ public boolean isSparkleshared() {\r
+ return !StringUtils.isEmpty(sparkleshareId);\r
+ }\r
+ \r
public RepositoryModel cloneAs(String cloneName) {\r
RepositoryModel clone = new RepositoryModel();\r
clone.originRepository = name;\r
clone.useTickets = useTickets;\r
clone.skipSizeCalculation = skipSizeCalculation;\r
clone.skipSummaryMetrics = skipSummaryMetrics;\r
+ clone.sparkleshareId = sparkleshareId; \r
return clone;\r
}\r
}
\ No newline at end of file
String issuePath = getIssuePath(issueId);\r
RevTree tree = JGitUtils.getCommit(repository, GB_ISSUES).getTree();\r
byte[] content = JGitUtils\r
- .getByteContent(repository, tree, issuePath + "/" + attachment.id);\r
+ .getByteContent(repository, tree, issuePath + "/" + attachment.id, false);\r
attachment.content = content;\r
attachment.size = content.length;\r
return attachment;\r
* @param path\r
* @return content as a byte []\r
*/\r
- public static byte[] getByteContent(Repository repository, RevTree tree, final String path) {\r
+ public static byte[] getByteContent(Repository repository, RevTree tree, final String path, boolean throwError) {\r
RevWalk rw = new RevWalk(repository);\r
TreeWalk tw = new TreeWalk(repository);\r
tw.setFilter(PathFilterGroup.createFromStrings(Collections.singleton(path)));\r
}\r
}\r
} catch (Throwable t) {\r
- error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name());\r
+ if (throwError) {\r
+ error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name());\r
+ }\r
} finally {\r
rw.dispose();\r
tw.release();\r
* @return UTF-8 string content\r
*/\r
public static String getStringContent(Repository repository, RevTree tree, String blobPath, String... charsets) {\r
- byte[] content = getByteContent(repository, tree, blobPath);\r
+ byte[] content = getByteContent(repository, tree, blobPath, true);\r
if (content == null) {\r
return null;\r
}\r
*/\r
public static List<SubmoduleModel> getSubmodules(Repository repository, RevTree tree) {\r
List<SubmoduleModel> list = new ArrayList<SubmoduleModel>();\r
- byte [] blob = getByteContent(repository, tree, ".gitmodules");\r
+ byte [] blob = getByteContent(repository, tree, ".gitmodules", false);\r
if (blob == null) {\r
return list;\r
}\r
}\r
return success;\r
}\r
+ \r
+ /**\r
+ * Reads the sparkleshare id, if present, from the repository.\r
+ * \r
+ * @param repository\r
+ * @return an id or null\r
+ */\r
+ public static String getSparkleshareId(Repository repository) {\r
+ byte[] content = getByteContent(repository, null, ".sparkleshare", false);\r
+ if (content == null) {\r
+ return null;\r
+ }\r
+ return StringUtils.decodeString(content);\r
+ }\r
}\r
gb.validity = validity\r
gb.siteName = site name\r
gb.siteNameDescription = short, descriptive name of your server \r
-gb.excludeFromActivity = exclude from activity page
\ No newline at end of file
+gb.excludeFromActivity = exclude from activity page\r
+gb.isSparkleshared = repository is Sparkleshared
\ No newline at end of file
switch (type) {\r
case 2:\r
// image blobs\r
- byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath);\r
+ byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true);\r
response.setContentType("image/" + extension.toLowerCase());\r
response.setContentLength(image.length);\r
try {\r
break;\r
case 3:\r
// binary blobs (download)\r
- byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath);\r
+ byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true);\r
response.setContentLength(binary.length);\r
response.setContentType("application/octet-stream");\r
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");\r
</div>\r
</div>\r
<div class="span7">\r
- <div><span class="project" wicket:id="projectTitle">[project title]</span>/<span class="repository" wicket:id="repositoryName">[repository name]</span> <span class="hidden-phone"><span wicket:id="pageName">[page name]</span></span></div>\r
+ <div><span class="project" wicket:id="projectTitle">[project title]</span>/<img wicket:id="repositoryIcon" style="padding-left: 10px;"></img><span class="repository" wicket:id="repositoryName">[repository name]</span> <span class="hidden-phone"><span wicket:id="pageName">[page name]</span></span></div>\r
<span wicket:id="originRepository">[origin repository]</span>\r
</div>\r
</div>\r
}\r
}\r
\r
+ // show sparkleshare folder icon\r
+ if (model.isSparkleshared()) {\r
+ add(WicketUtils.newImage("repositoryIcon", "folder_star_32x32.png",\r
+ getString("gb.isSparkleshared")));\r
+ } else {\r
+ add(WicketUtils.newClearPixel("repositoryIcon").setVisible(false));\r
+ }\r
+ \r
if (getRepositoryModel().isBare) {\r
add(new Label("workingCopyIndicator").setVisible(false));\r
} else {\r
<div class="pull-right" style="text-align:right;padding-right:15px;">\r
<span wicket:id="repositoryLinks"></span>\r
<div>\r
+ <img class="inlineIcon" wicket:id="sparkleshareIcon" />\r
<img class="inlineIcon" wicket:id="frozenIcon" />\r
<img class="inlineIcon" wicket:id="federatedIcon" />\r
\r
add(forkFrag);\r
}\r
\r
+ if (entry.isSparkleshared()) {\r
+ add(WicketUtils.newImage("sparkleshareIcon", "star_16x16.png", localizer.getString("gb.isSparkleshared", parent)));\r
+ } else {\r
+ add(WicketUtils.newClearPixel("sparkleshareIcon").setVisible(false));\r
+ }\r
+\r
add(new BookmarkablePageLink<Void>("tickets", TicketsPage.class, pp).setVisible(entry.useTickets));\r
add(new BookmarkablePageLink<Void>("docs", DocsPage.class, pp).setVisible(entry.useDocs));\r
\r
<td class="left" style="padding-left:3px;" ><b><span class="repositorySwatch" wicket:id="repositorySwatch"></span></b> <span style="padding-left:3px;" wicket:id="repositoryName">[repository name]</span></td>\r
<td class="hidden-phone"><span class="list" wicket:id="repositoryDescription">[repository description]</span></td>\r
<td class="hidden-tablet hidden-phone author"><span wicket:id="repositoryOwner">[repository owner]</span></td>\r
- <td class="hidden-phone" style="text-align: right;padding-right:10px;"><img class="inlineIcon" wicket:id="forkIcon" /><img class="inlineIcon" wicket:id="ticketsIcon" /><img class="inlineIcon" wicket:id="docsIcon" /><img class="inlineIcon" wicket:id="frozenIcon" /><img class="inlineIcon" wicket:id="federatedIcon" /><img class="inlineIcon" wicket:id="accessRestrictionIcon" /></td>\r
+ <td class="hidden-phone" style="text-align: right;padding-right:10px;"><img class="inlineIcon" wicket:id="sparkleshareIcon" /><img class="inlineIcon" wicket:id="forkIcon" /><img class="inlineIcon" wicket:id="ticketsIcon" /><img class="inlineIcon" wicket:id="docsIcon" /><img class="inlineIcon" wicket:id="frozenIcon" /><img class="inlineIcon" wicket:id="federatedIcon" /><img class="inlineIcon" wicket:id="accessRestrictionIcon" /></td>\r
<td><span wicket:id="repositoryLastChange">[last change]</span></td>\r
<td class="hidden-phone" style="text-align: right;padding-right:15px;"><span style="font-size:0.8em;" wicket:id="repositorySize">[repository size]</span></td>\r
<td class="rightAlign">\r
.setEscapeModelStrings(false));\r
}\r
\r
+ if (entry.isSparkleshared()) {\r
+ row.add(WicketUtils.newImage("sparkleshareIcon", "star_16x16.png",\r
+ getString("gb.isSparkleshared")));\r
+ } else {\r
+ row.add(WicketUtils.newClearPixel("sparkleshareIcon").setVisible(false));\r
+ }\r
+ \r
if (entry.isFork()) {\r
row.add(WicketUtils.newImage("forkIcon", "commit_divide_16x16.png",\r
getString("gb.isFork")));\r