@@ -717,12 +717,15 @@ | |||
<resource file="${basedir}/resources/commit_changes_16x16.png" /> | |||
<resource file="${basedir}/resources/commit_merge_16x16.png" /> | |||
<resource file="${basedir}/resources/commit_divide_16x16.png" /> | |||
<resource file="${basedir}/resources/star_16x16.png" /> | |||
<resource file="${basedir}/resources/blank.png" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_es.properties" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ja.properties" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_ko.properties" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_nl.properties" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_pl.properties" /> | |||
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp_pt_BR.properties" /> | |||
<class name="com.gitblit.client.GitblitManagerLauncher" /> | |||
<classfilter> |
@@ -1715,6 +1715,7 @@ public class GitBlit implements ServletContextListener { | |||
} | |||
model.HEAD = JGitUtils.getHEADRef(r); | |||
model.availableRefs = JGitUtils.getAvailableHeadTargets(r); | |||
model.sparkleshareId = JGitUtils.getSparkleshareId(r); | |||
r.close(); | |||
if (model.origin != null && model.origin.startsWith("file://")) { |
@@ -170,7 +170,7 @@ public class PagesServlet extends HttpServlet { | |||
content = JGitUtils.getStringContent(r, tree, resource, encodings).getBytes( | |||
Constants.ENCODING); | |||
} else { | |||
content = JGitUtils.getByteContent(r, tree, resource); | |||
content = JGitUtils.getByteContent(r, tree, resource, false); | |||
} | |||
response.setContentType(contentType); | |||
} catch (Exception e) { |
@@ -55,6 +55,8 @@ public class IndicatorsRenderer extends JPanel implements TableCellRenderer, Ser | |||
private final ImageIcon federatedIcon; | |||
private final ImageIcon forkIcon; | |||
private final ImageIcon sparkleshareIcon; | |||
public IndicatorsRenderer() { | |||
super(new FlowLayout(FlowLayout.RIGHT, 1, 0)); | |||
@@ -67,6 +69,7 @@ public class IndicatorsRenderer extends JPanel implements TableCellRenderer, Ser | |||
frozenIcon = new ImageIcon(getClass().getResource("/cold_16x16.png")); | |||
federatedIcon = new ImageIcon(getClass().getResource("/federated_16x16.png")); | |||
forkIcon = new ImageIcon(getClass().getResource("/commit_divide_16x16.png")); | |||
sparkleshareIcon = new ImageIcon(getClass().getResource("/star_16x16.png")); | |||
} | |||
@Override | |||
@@ -80,6 +83,11 @@ public class IndicatorsRenderer extends JPanel implements TableCellRenderer, Ser | |||
if (value instanceof RepositoryModel) { | |||
StringBuilder tooltip = new StringBuilder(); | |||
RepositoryModel model = (RepositoryModel) value; | |||
if (model.isSparkleshared()) { | |||
JLabel icon = new JLabel(sparkleshareIcon); | |||
tooltip.append(Translation.get("gb.isSparkleshared")).append("<br/>"); | |||
add(icon); | |||
} | |||
if (model.isFork()) { | |||
JLabel icon = new JLabel(forkIcon); | |||
tooltip.append(Translation.get("gb.isFork")).append("<br/>"); |
@@ -82,6 +82,7 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel | |||
public transient boolean isCollectingGarbage; | |||
public Date lastGC; | |||
public String sparkleshareId; | |||
public RepositoryModel() { | |||
this("", "", "", new Date(0)); | |||
@@ -176,6 +177,10 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel | |||
return !accessRestriction.atLeast(AccessRestrictionType.VIEW); | |||
} | |||
public boolean isSparkleshared() { | |||
return !StringUtils.isEmpty(sparkleshareId); | |||
} | |||
public RepositoryModel cloneAs(String cloneName) { | |||
RepositoryModel clone = new RepositoryModel(); | |||
clone.originRepository = name; | |||
@@ -193,6 +198,7 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel | |||
clone.useTickets = useTickets; | |||
clone.skipSizeCalculation = skipSizeCalculation; | |||
clone.skipSummaryMetrics = skipSummaryMetrics; | |||
clone.sparkleshareId = sparkleshareId; | |||
return clone; | |||
} | |||
} |
@@ -380,7 +380,7 @@ public class IssueUtils { | |||
String issuePath = getIssuePath(issueId); | |||
RevTree tree = JGitUtils.getCommit(repository, GB_ISSUES).getTree(); | |||
byte[] content = JGitUtils | |||
.getByteContent(repository, tree, issuePath + "/" + attachment.id); | |||
.getByteContent(repository, tree, issuePath + "/" + attachment.id, false); | |||
attachment.content = content; | |||
attachment.size = content.length; | |||
return attachment; |
@@ -537,7 +537,7 @@ public class JGitUtils { | |||
* @param path | |||
* @return content as a byte [] | |||
*/ | |||
public static byte[] getByteContent(Repository repository, RevTree tree, final String path) { | |||
public static byte[] getByteContent(Repository repository, RevTree tree, final String path, boolean throwError) { | |||
RevWalk rw = new RevWalk(repository); | |||
TreeWalk tw = new TreeWalk(repository); | |||
tw.setFilter(PathFilterGroup.createFromStrings(Collections.singleton(path))); | |||
@@ -572,7 +572,9 @@ public class JGitUtils { | |||
} | |||
} | |||
} catch (Throwable t) { | |||
error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name()); | |||
if (throwError) { | |||
error(t, repository, "{0} can't find {1} in tree {2}", path, tree.name()); | |||
} | |||
} finally { | |||
rw.dispose(); | |||
tw.release(); | |||
@@ -591,7 +593,7 @@ public class JGitUtils { | |||
* @return UTF-8 string content | |||
*/ | |||
public static String getStringContent(Repository repository, RevTree tree, String blobPath, String... charsets) { | |||
byte[] content = getByteContent(repository, tree, blobPath); | |||
byte[] content = getByteContent(repository, tree, blobPath, true); | |||
if (content == null) { | |||
return null; | |||
} | |||
@@ -1584,7 +1586,7 @@ public class JGitUtils { | |||
*/ | |||
public static List<SubmoduleModel> getSubmodules(Repository repository, RevTree tree) { | |||
List<SubmoduleModel> list = new ArrayList<SubmoduleModel>(); | |||
byte [] blob = getByteContent(repository, tree, ".gitmodules"); | |||
byte [] blob = getByteContent(repository, tree, ".gitmodules", false); | |||
if (blob == null) { | |||
return list; | |||
} | |||
@@ -1734,4 +1736,18 @@ public class JGitUtils { | |||
} | |||
return success; | |||
} | |||
/** | |||
* Reads the sparkleshare id, if present, from the repository. | |||
* | |||
* @param repository | |||
* @return an id or null | |||
*/ | |||
public static String getSparkleshareId(Repository repository) { | |||
byte[] content = getByteContent(repository, null, ".sparkleshare", false); | |||
if (content == null) { | |||
return null; | |||
} | |||
return StringUtils.decodeString(content); | |||
} | |||
} |
@@ -440,4 +440,5 @@ gb.sslCertificateGeneratedRestart = Successfully generated new server SSL certif | |||
gb.validity = validity | |||
gb.siteName = site name | |||
gb.siteNameDescription = short, descriptive name of your server | |||
gb.excludeFromActivity = exclude from activity page | |||
gb.excludeFromActivity = exclude from activity page | |||
gb.isSparkleshared = repository is Sparkleshared |
@@ -109,7 +109,7 @@ public class RawPage extends WebPage { | |||
switch (type) { | |||
case 2: | |||
// image blobs | |||
byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath); | |||
byte[] image = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true); | |||
response.setContentType("image/" + extension.toLowerCase()); | |||
response.setContentLength(image.length); | |||
try { | |||
@@ -120,7 +120,7 @@ public class RawPage extends WebPage { | |||
break; | |||
case 3: | |||
// binary blobs (download) | |||
byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath); | |||
byte[] binary = JGitUtils.getByteContent(r, commit.getTree(), blobPath, true); | |||
response.setContentLength(binary.length); | |||
response.setContentType("application/octet-stream"); | |||
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\""); |
@@ -52,7 +52,7 @@ | |||
</div> | |||
</div> | |||
<div class="span7"> | |||
<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> | |||
<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> | |||
<span wicket:id="originRepository">[origin repository]</span> | |||
</div> | |||
</div> |
@@ -246,6 +246,14 @@ public abstract class RepositoryPage extends BasePage { | |||
} | |||
} | |||
// show sparkleshare folder icon | |||
if (model.isSparkleshared()) { | |||
add(WicketUtils.newImage("repositoryIcon", "folder_star_32x32.png", | |||
getString("gb.isSparkleshared"))); | |||
} else { | |||
add(WicketUtils.newClearPixel("repositoryIcon").setVisible(false)); | |||
} | |||
if (getRepositoryModel().isBare) { | |||
add(new Label("workingCopyIndicator").setVisible(false)); | |||
} else { |
@@ -38,6 +38,7 @@ | |||
<div class="pull-right" style="text-align:right;padding-right:15px;"> | |||
<span wicket:id="repositoryLinks"></span> | |||
<div> | |||
<img class="inlineIcon" wicket:id="sparkleshareIcon" /> | |||
<img class="inlineIcon" wicket:id="frozenIcon" /> | |||
<img class="inlineIcon" wicket:id="federatedIcon" /> | |||
@@ -87,6 +87,12 @@ public class ProjectRepositoryPanel extends BasePanel { | |||
add(forkFrag); | |||
} | |||
if (entry.isSparkleshared()) { | |||
add(WicketUtils.newImage("sparkleshareIcon", "star_16x16.png", localizer.getString("gb.isSparkleshared", parent))); | |||
} else { | |||
add(WicketUtils.newClearPixel("sparkleshareIcon").setVisible(false)); | |||
} | |||
add(new BookmarkablePageLink<Void>("tickets", TicketsPage.class, pp).setVisible(entry.useTickets)); | |||
add(new BookmarkablePageLink<Void>("docs", DocsPage.class, pp).setVisible(entry.useDocs)); | |||
@@ -89,7 +89,7 @@ | |||
<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> | |||
<td class="hidden-phone"><span class="list" wicket:id="repositoryDescription">[repository description]</span></td> | |||
<td class="hidden-tablet hidden-phone author"><span wicket:id="repositoryOwner">[repository owner]</span></td> | |||
<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> | |||
<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> | |||
<td><span wicket:id="repositoryLastChange">[last change]</span></td> | |||
<td class="hidden-phone" style="text-align: right;padding-right:15px;"><span style="font-size:0.8em;" wicket:id="repositorySize">[repository size]</span></td> | |||
<td class="rightAlign"> |
@@ -233,6 +233,13 @@ public class RepositoriesPanel extends BasePanel { | |||
.setEscapeModelStrings(false)); | |||
} | |||
if (entry.isSparkleshared()) { | |||
row.add(WicketUtils.newImage("sparkleshareIcon", "star_16x16.png", | |||
getString("gb.isSparkleshared"))); | |||
} else { | |||
row.add(WicketUtils.newClearPixel("sparkleshareIcon").setVisible(false)); | |||
} | |||
if (entry.isFork()) { | |||
row.add(WicketUtils.newImage("forkIcon", "commit_divide_16x16.png", | |||
getString("gb.isFork"))); |