protected void setupPage(String repositoryName, String pageName) { add(new Label("title", getPageTitle(repositoryName))); String rootLinkUrl = app() .settings() .getString( Keys.web.rootLink, urlFor(GitBlitWebApp.get().getHomePage(), null).toString()); ExternalLink rootLink = new ExternalLink("rootLink", rootLinkUrl); WicketUtils.setHtmlTooltip( rootLink, app().settings().getString(Keys.web.siteName, Constants.NAME)); add(rootLink); // Feedback panel for info, warning, and non-fatal error messages add(new FeedbackPanel("feedback")); add(new Label("gbVersion", "v" + Constants.getVersion())); if (app().settings().getBoolean(Keys.web.aggressiveHeapManagement, false)) { System.gc(); } }
private void setup(PageParameters params) { setupPage("", ""); // check to see if we should display a login message boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true); if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) { authenticationError("Please login"); return; } String userName = WicketUtils.getUsername(params); if (StringUtils.isEmpty(userName)) { throw new GitblitRedirectException(GitBlitWebApp.get().getHomePage()); } UserModel user = app().users().getUserModel(userName); if (user == null) { // construct a temporary user model user = new UserModel(userName); } add(new UserTitlePanel("userTitlePanel", user, user.username)); UserModel sessionUser = GitBlitWebSession.get().getUser(); boolean isMyProfile = sessionUser != null && sessionUser.equals(user); if (isMyProfile) { addPreferences(user); if (app().services().isServingSSH()) { // show the SSH key management tab addSshKeys(user); } else { // SSH daemon is disabled, hide keys tab add(new Label("sshKeysLink").setVisible(false)); add(new Label("sshKeysTab").setVisible(false)); } } else { // visiting user add(new Label("preferencesLink").setVisible(false)); add(new Label("preferencesTab").setVisible(false)); add(new Label("sshKeysLink").setVisible(false)); add(new Label("sshKeysTab").setVisible(false)); } List<RepositoryModel> repositories = getRepositories(params); Collections.sort( repositories, new Comparator<RepositoryModel>() { @Override public int compare(RepositoryModel o1, RepositoryModel o2) { // reverse-chronological sort return o2.lastChange.compareTo(o1.lastChange); } }); final ListDataProvider<RepositoryModel> dp = new ListDataProvider<RepositoryModel>(repositories); DataView<RepositoryModel> dataView = new DataView<RepositoryModel>("repositoryList", dp) { private static final long serialVersionUID = 1L; @Override public void populateItem(final Item<RepositoryModel> item) { final RepositoryModel entry = item.getModelObject(); ProjectRepositoryPanel row = new ProjectRepositoryPanel( "repository", getLocalizer(), this, showAdmin, entry, getAccessRestrictions()); item.add(row); } }; add(dataView); }
public UserPage() { super(); throw new GitblitRedirectException(GitBlitWebApp.get().getHomePage()); }
private void setup(PageParameters params) { setupPage("", ""); // check to see if we should display a login message boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true); if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) { authenticationError("Please login"); return; } String projectName = WicketUtils.getProjectName(params); if (StringUtils.isEmpty(projectName)) { throw new GitblitRedirectException(GitBlitWebApp.get().getHomePage()); } ProjectModel project = getProjectModel(projectName); if (project == null) { throw new GitblitRedirectException(GitBlitWebApp.get().getHomePage()); } add(new Label("projectTitle", project.getDisplayName())); add(new Label("projectDescription", project.description)); String feedLink = SyndicationServlet.asLink( getRequest().getRelativePathPrefixToContextRoot(), projectName, null, 0); add(new ExternalLink("syndication", feedLink)); add( WicketUtils.syndicationDiscoveryLink( SyndicationServlet.getTitle(project.getDisplayName(), null), feedLink)); // project markdown message String pmessage = transformMarkdown(project.projectMarkdown); Component projectMessage = new Label("projectMessage", pmessage) .setEscapeModelStrings(false) .setVisible(pmessage.length() > 0); add(projectMessage); // markdown message above repositories list String rmessage = transformMarkdown(project.repositoriesMarkdown); Component repositoriesMessage = new Label("repositoriesMessage", rmessage) .setEscapeModelStrings(false) .setVisible(rmessage.length() > 0); add(repositoriesMessage); UserModel user = GitBlitWebSession.get().getUser(); if (user == null) { user = UserModel.ANONYMOUS; } int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params); if (daysBack < 1) { daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7); } // reset the daysback parameter so that we have a complete project // repository list. the recent activity will be built up by the // reflog utils. params.remove("db"); List<RepositoryModel> repositories = getRepositories(params); Collections.sort( repositories, new Comparator<RepositoryModel>() { @Override public int compare(RepositoryModel o1, RepositoryModel o2) { // reverse-chronological sort return o2.lastChange.compareTo(o1.lastChange); } }); addActivity(user, repositories, getString("gb.recentActivity"), daysBack); if (repositories.isEmpty()) { add(new Label("repositoryList").setVisible(false)); } else { FilterableRepositoryList repoList = new FilterableRepositoryList("repositoryList", repositories); repoList.setAllowCreate(user.canCreate(project.name + "/")); add(repoList); } }