- { name: 'realm.salesforce.orgId', defaultValue: 0 }\r
- { name: 'realm.windows.defaultDomain', defaultValue: ' ' }\r
- { name: 'realm.windows.backingUserService', defaultValue: 'users.conf' }\r
- - { name: 'web.activityDurationChoices', defaultValue: '7 14 21 28' }\r
+ - { name: 'web.activityDuration', defaultValue: 7 }\r
+ - { name: 'web.activityDurationChoices', defaultValue: '1 3 7 14 21 28' }\r
- { name: 'web.activityCacheDays', defaultValue: 14 }\r
- { name: 'web.allowAppCloneLinks', defaultValue: 'true' }\r
- { name: 'web.forceDefaultLocale', defaultValue: ' ' }\r
#\r
# SPACE-DELIMITED\r
# SINCE 1.3.0\r
-web.activityDurationChoices = 7 14 21 28\r
+web.activityDurationChoices = 1 3 7 14 21 28\r
\r
# The number of days of commits to cache in memory for the dashboard, activity,\r
# and project pages. A value of 0 will disable all caching and will parse commits\r
gb.starred = starred
gb.owned = owned
gb.starredAndOwned = starred & owned
-gb.reviewPatchset = review {0} patchset {1}
\ No newline at end of file
+gb.reviewPatchset = review {0} patchset {1}
+gb.todaysActivityStats = today / {1} commits by {2} authors
+gb.todaysActivityNone = today / none
+gb.noActivityToday = there has been no activity today
\ No newline at end of file
parameters = new PageParameters(params);\r
if (parameters.containsKey(parameter)) {\r
isSelected = params.getString(parameter).equals(value);\r
- if (isSelected) {\r
- // already selected, so remove this enables toggling\r
- parameters.remove(parameter);\r
- } else {\r
- // set the new selection value\r
- setParameter(parameter, value);\r
- }\r
+ // set the new selection value\r
+ setParameter(parameter, value);\r
} else {\r
// not currently selected\r
isSelected = false;\r
}\r
}\r
\r
- private void setParameter(String parameter, String value) {\r
+ protected void setParameter(String parameter, String value) {\r
if (!StringUtils.isEmpty(parameter)) {\r
if (StringUtils.isEmpty(value)) {\r
this.parameters.remove(parameter);\r
return displayText;\r
}\r
}\r
+ \r
+ public static class DropDownToggleItem extends DropDownMenuItem {\r
+ \r
+ private static final long serialVersionUID = 1L;\r
+\r
+ /**\r
+ * Toggle Menu Item constructor that preserves aggregate parameters.\r
+ * \r
+ * @param displayText\r
+ * @param parameter\r
+ * @param value\r
+ */\r
+ public DropDownToggleItem(String displayText, String parameter, String value,\r
+ PageParameters params) {\r
+ super(displayText, parameter, value, params);\r
+ if (isSelected) {\r
+ // already selected, so remove this enables toggling\r
+ parameters.remove(parameter);\r
+ }\r
+ }\r
+ }\r
}
\ No newline at end of file
}\r
\r
public static int getDaysBack(PageParameters params) {\r
- return params.getInt("db", 7);\r
+ return params.getInt("db", 0);\r
}\r
\r
public static String getUsername(PageParameters params) {\r
// parameters\r
int daysBack = WicketUtils.getDaysBack(params);\r
if (daysBack < 1) {\r
- daysBack = 14;\r
+ daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
}\r
String objectId = WicketUtils.getObject(params);\r
\r
List<Activity> recentActivity = ActivityUtils.getRecentActivity(models, \r
daysBack, objectId, getTimeZone());\r
\r
+ String headerPattern;\r
+ if (daysBack == 1) {\r
+ // today\r
+ if (recentActivity.size() == 0) {\r
+ headerPattern = getString("gb.todaysActivityNone");\r
+ } else {\r
+ headerPattern = getString("gb.todaysActivityStats");\r
+ }\r
+ } else {\r
+ // multiple days\r
+ if (recentActivity.size() == 0) {\r
+ headerPattern = getString("gb.recentActivityNone");\r
+ } else {\r
+ headerPattern = getString("gb.recentActivityStats");\r
+ }\r
+ }\r
+ \r
if (recentActivity.size() == 0) {\r
// no activity, skip graphs and activity panel\r
- add(new Label("subheader", MessageFormat.format(getString("gb.recentActivityNone"),\r
+ add(new Label("subheader", MessageFormat.format(headerPattern,\r
daysBack)));\r
add(new Label("activityPanel"));\r
} else {\r
int totalAuthors = uniqueAuthors.size();\r
\r
// add the subheader with stat numbers\r
- add(new Label("subheader", MessageFormat.format(getString("gb.recentActivityStats"),\r
+ add(new Label("subheader", MessageFormat.format(headerPattern,\r
daysBack, totalCommits, totalAuthors)));\r
\r
// create the activity charts\r
// quiet or no starred repositories\r
if (repositories.size() == 0) {\r
if (UserModel.ANONYMOUS.equals(user)) {\r
- activityFragment.add(new Label("digests", MessageFormat.format(getString("gb.noActivity"), daysBack))); \r
+ if (daysBack == 1) {\r
+ activityFragment.add(new Label("digests", getString("gb.noActivityToday")));\r
+ } else {\r
+ activityFragment.add(new Label("digests", MessageFormat.format(getString("gb.noActivity"), daysBack)));\r
+ }\r
} else {\r
activityFragment.add(new LinkPanel("digests", null, getString("gb.findSomeRepositories"), RepositoriesPage.class));\r
}\r
} else {\r
- activityFragment.add(new Label("digests", MessageFormat.format(getString("gb.noActivity"), daysBack)));\r
+ if (daysBack == 1) {\r
+ activityFragment.add(new Label("digests", getString("gb.noActivityToday")));\r
+ } else {\r
+ activityFragment.add(new Label("digests", MessageFormat.format(getString("gb.noActivity"), daysBack)));\r
+ }\r
}\r
} else {\r
// show daily commit digest feed\r
}\r
}\r
\r
- frag.add(new Label("feedheader", MessageFormat.format(getString("gb.recentActivityStats"),\r
+ String headerPattern;\r
+ if (daysBack == 1) {\r
+ // today\r
+ if (totalCommits == 0) {\r
+ headerPattern = getString("gb.todaysActivityNone");\r
+ } else {\r
+ headerPattern = getString("gb.todaysActivityStats");\r
+ }\r
+ } else {\r
+ // multiple days\r
+ if (totalCommits == 0) {\r
+ headerPattern = getString("gb.recentActivityNone");\r
+ } else {\r
+ headerPattern = getString("gb.recentActivityStats");\r
+ }\r
+ }\r
+ frag.add(new Label("feedheader", MessageFormat.format(headerPattern,\r
daysBack, totalCommits, authorMetrics.size())));\r
\r
// build google charts\r
// parameters\r
int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params);\r
if (daysBack < 1) {\r
- daysBack = 7;\r
+ daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
}\r
Calendar c = Calendar.getInstance();\r
c.add(Calendar.DATE, -1*daysBack);\r
}\r
int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params);\r
if (daysBack < 1) {\r
- daysBack = 7;\r
+ daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
}\r
// reset the daysback parameter so that we have a complete project\r
// repository list. the recent activity will be built up by the\r
// reflog utils.\r
- params.put("db", 0);\r
+ params.remove("db");\r
\r
List<RepositoryModel> repositories = getRepositories(params);\r
Collections.sort(repositories, new Comparator<RepositoryModel>() {\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.PageRegistration;\r
import com.gitblit.wicket.PageRegistration.DropDownMenuItem;\r
+import com.gitblit.wicket.PageRegistration.DropDownToggleItem;\r
import com.gitblit.wicket.SessionlessForm;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.panels.GravatarImage;\r
List<String> sets = new ArrayList<String>(setMap.keySet());\r
Collections.sort(sets);\r
for (String set : sets) {\r
- filters.add(new DropDownMenuItem(MessageFormat.format("{0} ({1})", set,\r
+ filters.add(new DropDownToggleItem(MessageFormat.format("{0} ({1})", set,\r
setMap.get(set).get()), "set", set, params));\r
}\r
// divider\r
List<TeamModel> teams = new ArrayList<TeamModel>(user.teams);\r
Collections.sort(teams);\r
for (TeamModel team : teams) {\r
- filters.add(new DropDownMenuItem(MessageFormat.format("{0} ({1})", team.name,\r
+ filters.add(new DropDownToggleItem(MessageFormat.format("{0} ({1})", team.name,\r
team.repositories.size()), "team", team.name, params));\r
}\r
// divider\r
for (String expression : expressions) {\r
if (!StringUtils.isEmpty(expression)) {\r
addedExpression = true;\r
- filters.add(new DropDownMenuItem(null, "x", expression, params));\r
+ filters.add(new DropDownToggleItem(null, "x", expression, params));\r
}\r
}\r
// if we added any custom expressions, add a divider\r
if (daysBack < 1) {\r
daysBack = 7;\r
}\r
- PageParameters clonedParams;;\r
+ PageParameters clonedParams;\r
if (params == null) {\r
clonedParams = new PageParameters();\r
} else {\r
List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();\r
Set<Integer> choicesSet = new TreeSet<Integer>(GitBlit.getIntegers(Keys.web.activityDurationChoices));\r
if (choicesSet.isEmpty()) {\r
- choicesSet.addAll(Arrays.asList(7, 14, 28, 60, 90, 180));\r
+ choicesSet.addAll(Arrays.asList(1, 3, 7, 14, 21, 28));\r
}\r
List<Integer> choices = new ArrayList<Integer>(choicesSet);\r
Collections.sort(choices);\r
String lastDaysPattern = getString("gb.lastNDays");\r
for (Integer db : choices) {\r
- String txt = MessageFormat.format(lastDaysPattern, db);\r
- items.add(new DropDownMenuItem(txt, "db", db.toString(), clonedParams));\r
+ if (db == 1) {\r
+ items.add(new DropDownMenuItem(getString("gb.time.today"), "db", db.toString(), clonedParams));\r
+ } else {\r
+ String txt = MessageFormat.format(lastDaysPattern, db);\r
+ items.add(new DropDownMenuItem(txt, "db", db.toString(), clonedParams));\r
+ }\r
}\r
items.add(new DropDownMenuItem());\r
return items;\r