James Moger
2013-06-25 0a44f9b3546f778a5d25c93dde3560703660a206
src/main/java/com/gitblit/wicket/pages/RootPage.java
@@ -52,6 +52,7 @@
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.PageRegistration;
import com.gitblit.wicket.PageRegistration.DropDownMenuItem;
import com.gitblit.wicket.PageRegistration.DropDownToggleItem;
import com.gitblit.wicket.SessionlessForm;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.GravatarImage;
@@ -119,7 +120,7 @@
      // navigation links
      List<PageRegistration> pages = new ArrayList<PageRegistration>();
      if (!authenticateView || (authenticateView && GitBlitWebSession.get().isLoggedIn())) {
         pages.add(new PageRegistration("gb.dashboard", DashboardPage.class,
         pages.add(new PageRegistration(GitBlitWebSession.get().isLoggedIn() ? "gb.myDashboard" : "gb.dashboard", MyDashboardPage.class,
               getRootPageParameters()));
         pages.add(new PageRegistration("gb.repositories", RepositoriesPage.class,
               getRootPageParameters()));
@@ -256,7 +257,7 @@
         List<String> sets = new ArrayList<String>(setMap.keySet());
         Collections.sort(sets);
         for (String set : sets) {
            filters.add(new DropDownMenuItem(MessageFormat.format("{0} ({1})", set,
            filters.add(new DropDownToggleItem(MessageFormat.format("{0} ({1})", set,
                  setMap.get(set).get()), "set", set, params));
         }
         // divider
@@ -268,7 +269,7 @@
         List<TeamModel> teams = new ArrayList<TeamModel>(user.teams);
         Collections.sort(teams);
         for (TeamModel team : teams) {
            filters.add(new DropDownMenuItem(MessageFormat.format("{0} ({1})", team.name,
            filters.add(new DropDownToggleItem(MessageFormat.format("{0} ({1})", team.name,
                  team.repositories.size()), "team", team.name, params));
         }
         // divider
@@ -283,7 +284,7 @@
         for (String expression : expressions) {
            if (!StringUtils.isEmpty(expression)) {
               addedExpression = true;
               filters.add(new DropDownMenuItem(null, "x", expression, params));
               filters.add(new DropDownToggleItem(null, "x", expression, params));
            }
         }
         // if we added any custom expressions, add a divider
@@ -300,17 +301,32 @@
      if (daysBack < 1) {
         daysBack = 7;
      }
      PageParameters clonedParams;
      if (params == null) {
         clonedParams = new PageParameters();
      } else {
         clonedParams = new PageParameters(params);
      }
      if (!clonedParams.containsKey("db")) {
         clonedParams.put("db",  daysBack);
      }
      List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();
      Set<Integer> choicesSet = new TreeSet<Integer>(GitBlit.getIntegers(Keys.web.activityDurationChoices));
      if (choicesSet.isEmpty()) {
          choicesSet.addAll(Arrays.asList(7, 14, 28, 60, 90, 180));
          choicesSet.addAll(Arrays.asList(1, 3, 7, 14, 21, 28));
      }
      List<Integer> choices = new ArrayList<Integer>(choicesSet);
      Collections.sort(choices);
      String lastDaysPattern = getString("gb.lastNDays");
      for (Integer db : choices) {
         String txt = MessageFormat.format(lastDaysPattern, db);
         items.add(new DropDownMenuItem(txt, "db", db.toString(), params));
         if (db == 1) {
            items.add(new DropDownMenuItem(getString("gb.time.today"), "db", db.toString(), clonedParams));
         } else {
            String txt = MessageFormat.format(lastDaysPattern, db);
            items.add(new DropDownMenuItem(txt, "db", db.toString(), clonedParams));
         }
      }
      items.add(new DropDownMenuItem());
      return items;
@@ -511,7 +527,10 @@
         }
         add(new Label("displayName", user.getDisplayName()));
         add(new BookmarkablePageLink<Void>("newRepository",
               EditRepositoryPage.class).setVisible(user.canAdmin() || user.canCreate()));
         add(new BookmarkablePageLink<Void>("myProfile", 
               UserPage.class, WicketUtils.newUsernameParameter(user.username)));