From e4e68298c2f55c93dc2464e26a24b119a649e642 Mon Sep 17 00:00:00 2001 From: James Moger Date: Fri, 11 Jan 2013 23:53:32 -0500 Subject: [PATCH] Show indicators for Sparkleshared repositories --- build.xml | 3 +++ resources/folder_star_16x16.png | Bin 0 -> 830 bytes resources/folder_star_32x32.png | Bin 0 -> 1529 bytes resources/star_16x16.png | Bin 0 -> 611 bytes resources/star_32x32.png | Bin 0 -> 1548 bytes src/com/gitblit/GitBlit.java | 1 + src/com/gitblit/PagesServlet.java | 2 +- .../gitblit/client/IndicatorsRenderer.java | 8 ++++++ src/com/gitblit/models/RepositoryModel.java | 6 +++++ src/com/gitblit/utils/IssueUtils.java | 2 +- src/com/gitblit/utils/JGitUtils.java | 24 +++++++++++++++--- .../gitblit/wicket/GitBlitWebApp.properties | 3 ++- src/com/gitblit/wicket/pages/RawPage.java | 4 +-- .../gitblit/wicket/pages/RepositoryPage.html | 2 +- .../gitblit/wicket/pages/RepositoryPage.java | 8 ++++++ .../wicket/panels/ProjectRepositoryPanel.html | 1 + .../wicket/panels/ProjectRepositoryPanel.java | 6 +++++ .../wicket/panels/RepositoriesPanel.html | 2 +- .../wicket/panels/RepositoriesPanel.java | 7 +++++ 19 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 resources/folder_star_16x16.png create mode 100644 resources/folder_star_32x32.png create mode 100644 resources/star_16x16.png create mode 100644 resources/star_32x32.png diff --git a/build.xml b/build.xml index 00885979..200fc91c 100644 --- a/build.xml +++ b/build.xml @@ -717,12 +717,15 @@ + + + diff --git a/resources/folder_star_16x16.png b/resources/folder_star_16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8fdeda0d20115532c96297d9544ef4064f198d GIT binary patch literal 830 zcmV-E1Ht@>P)%Au~nC3 zvt2gVpX==G+|JD64=Cs`XYS10bH4MP^W9-1?KQtmLw8Fv3CkE4U_zN^jMvhe!}^3x zWA>$hvA)gEij`c}^a@BAsURUR_`D&XK)x}yox6oW1-PPy8CP;`0BM?(ya9cx1yVAo z`Im6C=^en?R@Kx^rWQrTaO+jCP(>v%=~wI^xk?*pv@c*RbZ-S)3>X11``HRK!HaIw zw!}m*ru%(v>c@&qt`RM2mx=9`Y2kunrhgLAV2EC&4a`_Q#VRPya}3ekKBoW>htMnl z#V(a%%@F7tgUjteQ604;sa1Ui(446PDz(yn{eoh16FO!GrVt7I*f}ovDh?pKz=Ooh zGe{b8tgjbY$B#i|_@MI=#MX>Hg>jCJP=LUfQF*6}+9Ww8v)f4qTZuHusxYk2jU(s$ z4J`F{6UZqnj*TK1j&~`fH^@QjrzZz8K5L0>>%BZOK$Qc;Dgp21$29yE0(K$t@jk_< zrckvG#gb|H=K>1r_RuUBiLQH70tkl&&$&ksE;ka@L4Ia?6S;dsy!;PZ-Ih z+@S%T6}c8S^!>S-x4G%;3+`5tj0GTel^_v`BBQEpU%2z+tTOuY%<$oxJ=3Y<_m|1} zx3y1sx`x%EUIgcsKkfDXy68MqjqvLe4~StiBLMu%OoH=eQ&m$+eI**Z`(~#8{nv%@ zhU(nXC)fNRREL%&jdcgZ|E+@D`c)^$b#jf|Z~a!}gMS1V07WMfXqlcD+yDRo07*qo IM6N<$f<%>mk^lez literal 0 HcmV?d00001 diff --git a/resources/folder_star_32x32.png b/resources/folder_star_32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..d2a076a9973c08ebf3b1932932d7051398d56fae GIT binary patch literal 1529 zcmV-FwsB)2_a~SpaCls zC|67A_O`I>c6Yn&Zuc^C#{Zm|?xk*N7n*RAKRa{g%=y3b{onupv&=M2JkG($v&s4e(S59eaNIKek!D(*~M@*n4MdG4`~aBLb$-Ez=4ake3QFq0>O{_Y%FE^tu6O z+b6K}1^3JVkfwtxg0CVW5c6stC0S&%5Mo-4^Vrl%R!jrdJkO9Hbp`;%;!2spnEZV( z1GFbk6o$1p1G-E#dD>Y32&amwz<041;eoqCKr<5{K(Ie4x+)3yg@6TG$%-;h1BS(b zq??J%FPe_>2{|9Qa0|$!u==BeQowjnL1WW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)N0_bN|NJn?L%8BfL5D;dVx#tCpJnXH3P=5^w z`O9Elp0pKZy8A&u%ra*_F3l_jHFyIc8~`E52^Mqa6X~QORRV15u0@+AEWGf*@AxKY zkbU(a%~=IRma5HE2}lkzTO}2ggFJE`7>3gz`#LB(f%zVoZgAZk|)xq<5{uEpGsZp|~&1dCDJlu9v@ zNyy*WUtZ5a#H}hazN)cTsw${*1bBNc$k%HzMt)kL3@DKilx0JfQC#ocw{ShOinoy{ zVnJc~D~^{NUBrrkV-&Y-W(B1Hd>kN%=uhdyh7^SR5tC5(_W6~iy=X5dBj08q6LTL2Dl>U_8=nvXp zI2J+!0qE}Rts}mP$cQLt{&dk-MP-iV`obAngsP(43Jq?zbg%kSW9Z;7i#AmS#;^23 zN4xjWr8`dl93|v|=PXk+W`b_JXh9nERdn!91LB4`51=-{fwjI=0y8mV13L zez^x;`trhtsF-UV0#Bj=jK8oR1PFni4hHi4om$z=FPc z$phZb{;uLJ%`c*)8_|yl(w)EUCPU0e5aVRQ?i1H**18N1%fwg-Z!rRMD<#RK0G%si zK^Sf8fHUphpO}b;23{ZkWD9sG`s%!chVjZ*bQXrW1>{>Cu z6#tHCRUK$O55ey1@JjXN4ab@WTTsv!6>3lLor9f68!rW}?tK*wga&=0dGUNrEI9JP zBsH(amtAzoCG}YP_q$b9KBme&AE>?~YgEr(_Yi(xftXG15O-8IL%(6a!g5cwduZ_R zO4NN%voUaJ1&Q1eXKLU5IIWVS>9a*0I8Zam`>D>G->>`l+!u6~57LRI#;`@^wUwAS zQ8oX~hYJkPL>rhLb#HGi>K+XCB}IU;EkI<^>K&#hm_J@MPro}-{T!;VqxxM`KPdu4 yDT79&+&Z8VO|%%rO"); + add(icon); + } if (model.isFork()) { JLabel icon = new JLabel(forkIcon); tooltip.append(Translation.get("gb.isFork")).append("
"); diff --git a/src/com/gitblit/models/RepositoryModel.java b/src/com/gitblit/models/RepositoryModel.java index 5be33a2d..022fd200 100644 --- a/src/com/gitblit/models/RepositoryModel.java +++ b/src/com/gitblit/models/RepositoryModel.java @@ -82,6 +82,7 @@ public class RepositoryModel implements Serializable, Comparable getSubmodules(Repository repository, RevTree tree) { List list = new ArrayList(); - 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); + } } diff --git a/src/com/gitblit/wicket/GitBlitWebApp.properties b/src/com/gitblit/wicket/GitBlitWebApp.properties index 16f76411..dfdf70c2 100644 --- a/src/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/com/gitblit/wicket/GitBlitWebApp.properties @@ -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 \ No newline at end of file +gb.excludeFromActivity = exclude from activity page +gb.isSparkleshared = repository is Sparkleshared \ No newline at end of file diff --git a/src/com/gitblit/wicket/pages/RawPage.java b/src/com/gitblit/wicket/pages/RawPage.java index 7f6ed139..28e8bae2 100644 --- a/src/com/gitblit/wicket/pages/RawPage.java +++ b/src/com/gitblit/wicket/pages/RawPage.java @@ -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 + "\""); diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.html b/src/com/gitblit/wicket/pages/RepositoryPage.html index 63a894da..d49f0188 100644 --- a/src/com/gitblit/wicket/pages/RepositoryPage.html +++ b/src/com/gitblit/wicket/pages/RepositoryPage.html @@ -52,7 +52,7 @@
-
[project title]/[repository name] [page name]
+
[project title]/[repository name] [page name]
[origin repository]
diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java index aac527d7..16087fa6 100644 --- a/src/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/com/gitblit/wicket/pages/RepositoryPage.java @@ -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 { diff --git a/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.html b/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.html index 46781536..9b621d5a 100644 --- a/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.html +++ b/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.html @@ -38,6 +38,7 @@
+ diff --git a/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java b/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java index 50f0d52d..3c9bf7f0 100644 --- a/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java +++ b/src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java @@ -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("tickets", TicketsPage.class, pp).setVisible(entry.useTickets)); add(new BookmarkablePageLink("docs", DocsPage.class, pp).setVisible(entry.useDocs)); diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.html b/src/com/gitblit/wicket/panels/RepositoriesPanel.html index 42f9f1f2..81a4c6eb 100644 --- a/src/com/gitblit/wicket/panels/RepositoriesPanel.html +++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.html @@ -89,7 +89,7 @@ [repository name] [repository description] [repository owner] - + [last change] [repository size] diff --git a/src/com/gitblit/wicket/panels/RepositoriesPanel.java b/src/com/gitblit/wicket/panels/RepositoriesPanel.java index 976c517f..ee5edfce 100644 --- a/src/com/gitblit/wicket/panels/RepositoriesPanel.java +++ b/src/com/gitblit/wicket/panels/RepositoriesPanel.java @@ -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"))); -- 2.39.5