| | |
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.link.ExternalLink;
|
| | | import org.apache.wicket.markup.html.panel.Fragment;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | |
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.MarkdownUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.CacheControl;
|
| | | import com.gitblit.wicket.CacheControl.LastModified;
|
| | | import com.gitblit.wicket.GitBlitWebApp;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.GitblitRedirectException;
|
| | |
| | | import com.gitblit.wicket.PageRegistration.DropDownMenuItem;
|
| | | import com.gitblit.wicket.PageRegistration.DropDownMenuRegistration;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.panels.FilterableRepositoryList;
|
| | |
|
| | | @CacheControl(LastModified.PROJECT)
|
| | | public class ProjectPage extends DashboardPage {
|
| | |
|
| | | List<ProjectModel> projectModels = new ArrayList<ProjectModel>();
|
| | |
| | | return RepositoriesPage.class;
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void setLastModified() {
|
| | | if (getClass().isAnnotationPresent(CacheControl.class)) {
|
| | | CacheControl cacheControl = getClass().getAnnotation(CacheControl.class);
|
| | | switch (cacheControl.value()) {
|
| | | case PROJECT:
|
| | | String projectName = WicketUtils.getProjectName(getPageParameters());
|
| | | if (!StringUtils.isEmpty(projectName)) {
|
| | | ProjectModel project = getProjectModel(projectName);
|
| | | if (project != null) {
|
| | | setLastModified(project.lastChange);
|
| | | }
|
| | | }
|
| | | break;
|
| | | default:
|
| | | super.setLastModified();
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | private void setup(PageParameters params) {
|
| | | setupPage("", "");
|
| | | // check to see if we should display a login message
|
| | |
| | | }
|
| | | int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params);
|
| | | if (daysBack < 1) {
|
| | | daysBack = 7;
|
| | | 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.put("db", 0);
|
| | | params.remove("db");
|
| | |
|
| | | List<RepositoryModel> repositories = getRepositories(params);
|
| | | Collections.sort(repositories, new Comparator<RepositoryModel>() {
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | |
| | | addActivity(user, repositories, daysBack);
|
| | | addActivity(user, repositories, getString("gb.recentActivity"), daysBack);
|
| | |
|
| | | if (repositories.isEmpty()) {
|
| | | add(new Label("repositoryList").setVisible(false));
|
| | | } else {
|
| | | Fragment activeView = createNgList("repositoryList", "repositoryListFragment", "repositoryListCtrl", repositories);
|
| | | add(activeView);
|
| | | FilterableRepositoryList repoList = new FilterableRepositoryList("repositoryList", repositories);
|
| | | repoList.setAllowCreate(user.canCreate(project.name + "/"));
|
| | | add(repoList);
|
| | | }
|
| | | }
|
| | |
|