From fbed929402dbf1afd1d97db193b6271944810708 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 21 Mar 2018 13:44:39 -0400 Subject: [PATCH] (feat) now possible to show events/task for the current year --- NEWS | 3 ++ .../English.lproj/Localizable.strings | 1 + UI/Scheduler/UIxCalFilterPanel.h | 4 +-- UI/Scheduler/UIxCalFilterPanel.m | 6 ++-- UI/Scheduler/UIxCalListingActions.m | 35 ++++++++++++++----- UI/Scheduler/UIxCalMainView.m | 4 +-- UI/Templates/SchedulerUI/UIxCalMainView.wox | 6 ++++ 7 files changed, 41 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 5f4daaa88..b34a8f3b6 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 4.0.1 (2018-03-XX) ------------------ +Enhancements + - [web] now possible to show events/task for the current year + Bug fixes - [core] properly update the last-modified attribute (#4313) - [web] prevent deletion of special folders using del key diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 45567338e..e82b891b3 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -218,6 +218,7 @@ "view_next14" = "Next 14 days"; "view_next31" = "Next 31 days"; "view_thismonth" = "This Month"; +"view_thisyear" = "This Year"; "view_future" = "All Future Events"; "view_selectedday" = "Selected Day"; "view_not_started" = "Not started tasks"; diff --git a/UI/Scheduler/UIxCalFilterPanel.h b/UI/Scheduler/UIxCalFilterPanel.h index 47197975b..537d2e735 100644 --- a/UI/Scheduler/UIxCalFilterPanel.h +++ b/UI/Scheduler/UIxCalFilterPanel.h @@ -1,8 +1,6 @@ /* UIxContactsFilterPanel.h - this file is part of SOGo * - * Copyright (C) 2006 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2006-2018 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/UI/Scheduler/UIxCalFilterPanel.m b/UI/Scheduler/UIxCalFilterPanel.m index 55ee785ad..01cef4eca 100644 --- a/UI/Scheduler/UIxCalFilterPanel.m +++ b/UI/Scheduler/UIxCalFilterPanel.m @@ -1,8 +1,6 @@ /* UIxContactsFilterPanel.m - this file is part of SOGo * - * Copyright (C) 2006-2009 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2006-2018 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +35,7 @@ static NSArray *filters = nil; static NSString *quals[] = {@"view_all", @"view_today", @"view_next7", @"view_next14", - @"view_next31", @"view_thismonth", @"view_future", + @"view_next31", @"view_thismonth", @"view_thisyear", @"view_future", @"view_selectedday" }; if (!filters) diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 9ef83f95a..ae438859f 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -171,10 +171,26 @@ static NSArray *tasksFields = nil; endDate = [[startDate dateByAddingYears: 0 months: 0 days: 30] endOfDay]; } else if ([popupValue isEqualToString: @"view_thismonth"]) + { + newDate = [NSCalendarDate calendarDate]; + [newDate setTimeZone: userTZ]; + startDate = [[newDate firstDayOfMonth] beginOfDay]; + endDate = [[newDate lastDayOfMonth] endOfDay]; + } + else if ([popupValue isEqualToString: @"view_thisyear"]) { - newDate = [NSCalendarDate calendarDate]; - [newDate setTimeZone: userTZ]; + newDate = [NSCalendarDate dateWithYear: [[NSCalendarDate calendarDate] yearOfCommonEra] + month: 1 + day: 1 + hour: 0 minute: 0 second: 0 + timeZone: userTZ]; startDate = [[newDate firstDayOfMonth] beginOfDay]; + + newDate = [NSCalendarDate dateWithYear: [[NSCalendarDate calendarDate] yearOfCommonEra] + month: 12 + day: 31 + hour: 0 minute: 0 second: 0 + timeZone: userTZ]; endDate = [[newDate lastDayOfMonth] endOfDay]; } else if ([popupValue isEqualToString: @"view_future"]) @@ -780,7 +796,7 @@ static inline NSString* _userStateInEvent (NSArray *event) * @apiParam {Boolean} [asc] Descending sort when false. Defaults to true (ascending). * @apiParam {String} [sort] Sort field. Either title, start, end, location, or calendarName. * @apiParam {Number} [day] Selected day (YYYYMMDD) - * @apiParam {String} [filterpopup] Time period. Either view_today, view_next7, view_next14, view_next31, view_thismonth, view_future, view_selectedday, or view_all + * @apiParam {String} [filterpopup] Time period. Either view_today, view_next7, view_next14, view_next31, view_thismonth, view_thisyear, view_future, view_selectedday, or view_all * @apiParam {String} [search] Search field criteria. Either title_Category_Location or entireContent. * @apiParam {String} [value] String to match * @@ -1569,7 +1585,7 @@ _computeBlocksPosition (NSArray *blocks) * @apiParam {Boolean} [asc] Descending sort when false. Defaults to true (ascending). * @apiParam {Boolean} [sort] Sort field. Either title, priority, end, location, category, calendarname, or status. * @apiParam {Number} [day] Selected day (YYYYMMDD) - * @apiParam {String} [filterpopup] Time period. Either view_today, view_next7, view_next14, view_next31, view_thismonth, view_overdue, view_incomplete, view_not_started, or view_all + * @apiParam {String} [filterpopup] Time period. Either view_today, view_next7, view_next14, view_next31, view_thismonth, view_thisyear, view_overdue, view_incomplete, view_not_started, or view_all * @apiParam {String} [search] Search field criteria. Either title_Category_Location or entireContent. * * @apiSuccess (Success 200) {String[]} fields List of fields for each event definition @@ -1642,11 +1658,12 @@ _computeBlocksPosition (NSArray *blocks) forAllDay: NO]]; else [filteredTask addObject: [NSNull null]]; - if (([tasksView isEqualToString:@"view_today"] || - [tasksView isEqualToString:@"view_next7"] || - [tasksView isEqualToString:@"view_next14"] || - [tasksView isEqualToString:@"view_next31"] || - [tasksView isEqualToString:@"view_thismonth"]) && + if (([tasksView isEqualToString:@"view_today"] || + [tasksView isEqualToString:@"view_next7"] || + [tasksView isEqualToString:@"view_next14"] || + [tasksView isEqualToString:@"view_next31"] || + [tasksView isEqualToString:@"view_thismonth"] || + [tasksView isEqualToString:@"view_thisyear"]) && (endDateStamp == 0 || endDateStamp >= startSecs)) [filteredTasks addObject: filteredTask]; else if ([tasksView isEqualToString:@"view_all"]) diff --git a/UI/Scheduler/UIxCalMainView.m b/UI/Scheduler/UIxCalMainView.m index 752e2b189..8924278ff 100644 --- a/UI/Scheduler/UIxCalMainView.m +++ b/UI/Scheduler/UIxCalMainView.m @@ -1,6 +1,6 @@ /* UIxCalMainView.m - this file is part of SOGo * - * Copyright (C) 2006-2017 Inverse inc. + * Copyright (C) 2006-2018 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -143,7 +143,7 @@ - (NSArray *) tasksFilters { return [NSArray arrayWithObjects: @"view_all", @"view_today", @"view_next7", - @"view_next14", @"view_next31", @"view_thismonth", + @"view_next14", @"view_next31", @"view_thismonth", @"view_thisyear", @"view_not_started", @"view_overdue", @"view_incomplete", nil]; } diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index f4e81253d..19b1ee82d 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -201,6 +201,12 @@ + + + + + +