) throws Exception {
if (offset==null) {
offset = 0;
} else {
if (offset<0 || offset>300) {
throw new UserErrorException("Некорректное значение offset");
}
}
Template tmpl = Template.getTemplate(request);
TrackerFilterEnum defaultFilter = tmpl.getProf().getTrackerMode();
TrackerFilterEnum trackerFilter = TrackerFilterEnum.getByValue(filterAction).or(defaultFilter);
Map<String, Object> params = new HashMap<>();
params.put("offset", offset);
params.put("filter", trackerFilter.getValue());
if (trackerFilter != defaultFilter) {
params.put("addition_query", "&filter=" + trackerFilter.getValue());
} else {
params.put("addition_query", "");
}
params.put("defaultFilter", defaultFilter);
Date startDate;
if (trackerFilter == TrackerFilterEnum.MINE) {
startDate = DateTime.now().minusMonths(6).toDate();
} else {
startDate = DateTime.now().minusDays(1).toDate();
}
int messages = tmpl.getProf().getMessages();
int topics = tmpl.getProf().getTopics();
params.put("topics", topics);
User user = tmpl.getCurrentUser();
params.put("title", makeTitle(trackerFilter, defaultFilter));
if (trackerFilter == TrackerFilterEnum.MINE && !tmpl.isSessionAuthorized()) {
throw new UserErrorException("Not authorized");
}
params.put("msgs", trackerDao.getTrackAll(trackerFilter, user, startDate, topics, offset, messages));
if (tmpl.isModeratorSession() && trackerFilter != TrackerFilterEnum.MINE) {