- Improve Gerrit change ref decoration in the refs panel (issue 206)\r
- Disable Gson's pretty printing which has a huge performance gain\r
- Properly set application/json content-type on api calls\r
+ - Make days back filter choices a setting\r
+ - Changed default days back filter setting to 7 days\r
- Improved page title\r
- Updated Polish translation\r
- Updated Japanese translation\r
- { name: 'mail.smtps', defaultValue: false }\r
- { name: 'realm.salesforce.backingUserService', defaultValue: 'users.conf' }\r
- { name: 'realm.salesforce.orgId', defaultValue: 0 }\r
+ - { name: 'web.activityDurationChoices', defaultValue: '7 14 28 60 90 180' }\r
- { name: 'web.allowAppCloneLinks', defaultValue: true }\r
- { name: 'web.forceDefaultLocale', defaultValue: ' ' }\r
- { name: 'web.overviewPushCount', defaultValue: 5 }\r
# SINCE 0.5.0 \r
web.generateActivityGraph = true\r
\r
-# The number of days to show on the activity page.\r
-# Value must exceed 0 else default of 14 is used\r
+# The default number of days to show on the activity page.\r
+# Value must exceed 0 else default of 7 is used\r
#\r
# SINCE 0.8.0\r
-web.activityDuration = 14\r
+web.activityDuration = 7\r
+\r
+# Choices for days of activity to display.\r
+#\r
+# SPACE-DELIMITED\r
+# SINCE 1.3.0\r
+web.activityDurationChoices = 7 14 28 60 90 180\r
\r
# The number of commits to display on the summary page\r
# Value must exceed 0 else default of 20 is used\r
public static int getInteger(String key, int defaultValue) {
return self().settings.getInteger(key, defaultValue);
}
+
+ /**
+ * Returns the integer list for the specified key. If the key does not
+ * exist or the value for the key can not be interpreted as an integer, an
+ * empty list is returned.
+ *
+ * @see IStoredSettings.getIntegers(String key)
+ * @param key
+ * @return key value or defaultValue
+ */
+ public static List<Integer> getIntegers(String key) {
+ return self().settings.getIntegers(key);
+ }
/**
* Returns the value in bytes for the specified key. If the key does not
return strings;\r
}\r
\r
+ /**\r
+ * Returns a list of space-separated integers from the specified key.\r
+ * \r
+ * @param name\r
+ * @return list of strings\r
+ */\r
+ public List<Integer> getIntegers(String name) {\r
+ return getIntegers(name, " ");\r
+ }\r
+\r
+ /**\r
+ * Returns a list of integers from the specified key using the specified\r
+ * string separator.\r
+ * \r
+ * @param name\r
+ * @param separator\r
+ * @return list of integers\r
+ */\r
+ public List<Integer> getIntegers(String name, String separator) {\r
+ List<Integer> ints = new ArrayList<Integer>();\r
+ Properties props = getSettings();\r
+ if (props.containsKey(name)) {\r
+ String value = props.getProperty(name);\r
+ List<String> strings = StringUtils.getStringsFromValue(value, separator);\r
+ for (String str : strings) {\r
+ try {\r
+ int i = Integer.parseInt(str);\r
+ ints.add(i);\r
+ } catch (NumberFormatException e) {\r
+ }\r
+ }\r
+ }\r
+ return ints;\r
+ }\r
+ \r
/**\r
* Returns a map of strings from the specified key.\r
* \r
ActivityPage.class);\r
\r
PageParameters currentParameters = getPageParameters();\r
- int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);\r
+ int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
if (currentParameters != null && !currentParameters.containsKey("db")) {\r
currentParameters.put("db", daysBack);\r
}\r
import java.util.List;\r
import java.util.Map;\r
import java.util.Set;\r
+import java.util.TreeSet;\r
import java.util.concurrent.atomic.AtomicInteger;\r
import java.util.regex.Pattern;\r
\r
\r
// remove days back parameter if it is the default value\r
if (params.containsKey("db")\r
- && params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 14)) {\r
+ && params.getInt("db") == GitBlit.getInteger(Keys.web.activityDuration, 7)) {\r
params.remove("db");\r
}\r
return params;\r
\r
protected List<DropDownMenuItem> getTimeFilterItems(PageParameters params) {\r
// days back choices - additive parameters\r
- int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);\r
+ int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);\r
if (daysBack < 1) {\r
- daysBack = 14;\r
+ daysBack = 7;\r
}\r
List<DropDownMenuItem> items = new ArrayList<DropDownMenuItem>();\r
- Set<Integer> choicesSet = new HashSet<Integer>(Arrays.asList(daysBack, 14, 28, 60, 90, 180));\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
+ }\r
List<Integer> choices = new ArrayList<Integer>(choicesSet);\r
Collections.sort(choices);\r
String lastDaysPattern = getString("gb.lastNDays");\r