James Moger
2013-05-15 d8aa8d69ba21d7846a72d51810a9f89f032a5ecb
src/main/java/com/gitblit/wicket/pages/SummaryPage.java
@@ -42,25 +42,21 @@
import org.wicketstuff.googlecharts.MarkerType;
import org.wicketstuff.googlecharts.ShapeMarker;
import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.models.Metric;
import com.gitblit.models.PathModel;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.JGitUtils;
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.BranchesPanel;
import com.gitblit.wicket.panels.DetailedRepositoryUrlPanel;
import com.gitblit.wicket.panels.LinkPanel;
import com.gitblit.wicket.panels.LogPanel;
import com.gitblit.wicket.panels.SparkleShareInvitePanel;
import com.gitblit.wicket.panels.RepositoryUrlPanel;
import com.gitblit.wicket.panels.TagsPanel;
public class SummaryPage extends RepositoryPage {
@@ -127,67 +123,8 @@
      add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class,
            WicketUtils.newRepositoryParameter(repositoryName)));
      List<String> repositoryUrls = new ArrayList<String>();
      AccessPermission accessPermission = null;
      if (GitBlit.getBoolean(Keys.git.enableGitServlet, true)) {
         accessPermission = user.getRepositoryPermission(model).permission;
         AccessRestrictionType accessRestriction = getRepositoryModel().accessRestriction;
         switch (accessRestriction) {
         case NONE:
            add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
            break;
         case PUSH:
            add(WicketUtils.newImage("accessRestrictionIcon", "lock_go_16x16.png",
                  getAccessRestrictions().get(accessRestriction)));
            break;
         case CLONE:
            add(WicketUtils.newImage("accessRestrictionIcon", "lock_pull_16x16.png",
                  getAccessRestrictions().get(accessRestriction)));
            break;
         case VIEW:
            add(WicketUtils.newImage("accessRestrictionIcon", "shield_16x16.png",
                  getAccessRestrictions().get(accessRestriction)));
            break;
         default:
            add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
         }
         // add the Gitblit repository url
         repositoryUrls.add(getRepositoryUrl(getRepositoryModel()));
      } else {
         add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
      }
      repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName, UserModel.ANONYMOUS.equals(user) ? "" : user.username));
      String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? "" : repositoryUrls.remove(0);
      add(new DetailedRepositoryUrlPanel("repositoryPrimaryUrl", getLocalizer(), this, model.name, primaryUrl, accessPermission));
      Component gitDaemonUrlPanel = createGitDaemonUrlPanel("repositoryGitDaemonUrl", user, model);
      if (!StringUtils.isEmpty(primaryUrl) && gitDaemonUrlPanel instanceof DetailedRepositoryUrlPanel) {
         WicketUtils.setCssStyle(gitDaemonUrlPanel, "padding-top: 10px");
      }
      add(gitDaemonUrlPanel);
      String sparkleshareUrl = getSparkleShareInviteUrl(model);
      if (StringUtils.isEmpty(sparkleshareUrl)) {
         add(new Label("repositorySparkleShareInviteUrl").setVisible(false));
      } else {
         Component sparklesharePanel = new SparkleShareInvitePanel("repositorySparkleShareInviteUrl", getLocalizer(), this, sparkleshareUrl, accessPermission);
         WicketUtils.setCssStyle(sparklesharePanel, "padding-top: 10px;");
         add(sparklesharePanel);
      }
      ListDataProvider<String> urls = new ListDataProvider<String>(repositoryUrls);
      DataView<String> otherUrlsView = new DataView<String>("otherUrls", urls) {
         private static final long serialVersionUID = 1L;
         public void populateItem(final Item<String> item) {
            final String url = item.getModelObject();
            item.add(new DetailedRepositoryUrlPanel("otherUrl", getLocalizer(), this, model.name, url));
         }
      };
      add(otherUrlsView);
      add(new RepositoryUrlPanel("repositoryUrlPanel", false, user, model));
      add(new LogPanel("commitsPanel", repositoryName, getRepositoryModel().HEAD, r, numberCommits, 0, getRepositoryModel().showRemoteBranches));
      add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
      add(new BranchesPanel("branchesPanel", getRepositoryModel(), r, numberRefs, false).hideIfEmpty());