diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index ee703b1d5..05e760909 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -80,6 +80,8 @@ typedef enum { - (NSArray *) calendarUIDs; +- (NSNumber *) activeTasks; + /* vevent UID handling */ - (NSString *) resourceNameForEventUID: (NSString *) _uid; diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index c05eeb31f..96a14d536 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -590,7 +590,6 @@ static iCalEvent *iCalEventK = nil; { /* this is used for group calendars (this folder just returns itself) */ NSString *s; - s = [[self container] nameInContainer]; // [self logWithFormat:@"CAL UID: %@", s]; return [s isNotNull] ? [NSArray arrayWithObjects:&s count:1] : nil; @@ -3338,4 +3337,25 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir return users; } +- (NSNumber *) activeTasks +{ + NSArray *tasksList; + NSMutableArray *fields; + NSNumber *activeTasks; + + fields = [NSMutableArray arrayWithObjects: @"c_component", @"c_status", nil]; + + tasksList = [self bareFetchFields: fields + from: nil + to: nil + title: nil + component: @"vtodo" + additionalFilters: @"c_status != 1 AND c_status != 3"]; + + activeTasks = [NSNumber numberWithInt:[tasksList count]]; + + return activeTasks; +} + + @end /* SOGoAppointmentFolder */ diff --git a/UI/Scheduler/UIxCalendarSelector.m b/UI/Scheduler/UIxCalendarSelector.m index 7da4392b3..2c8a6910d 100644 --- a/UI/Scheduler/UIxCalendarSelector.m +++ b/UI/Scheduler/UIxCalendarSelector.m @@ -93,37 +93,39 @@ _intValueFromHex (NSString *hexString) NSMutableDictionary *calendar; unsigned int count, max; NSString *folderName, *fDisplayName; - NSNumber *isActive; - + NSNumber *isActive, *fActiveTasks; + if (!calendars) + { + co = [self clientObject]; + folders = [co subFolders]; + max = [folders count]; + calendars = [[NSMutableArray alloc] initWithCapacity: max]; + for (count = 0; count < max; count++) { - co = [self clientObject]; - folders = [co subFolders]; - max = [folders count]; - calendars = [[NSMutableArray alloc] initWithCapacity: max]; - for (count = 0; count < max; count++) - { - folder = [folders objectAtIndex: count]; - calendar = [NSMutableDictionary dictionary]; - folderName = [folder nameInContainer]; - fDisplayName = [folder displayName]; - if (fDisplayName == nil) - fDisplayName = @""; - if ([fDisplayName isEqualToString: [co defaultFolderName]]) - fDisplayName = [self labelForKey: fDisplayName]; - [calendar setObject: [NSString stringWithFormat: @"/%@", folderName] - forKey: @"id"]; - [calendar setObject: fDisplayName forKey: @"displayName"]; - [calendar setObject: folderName forKey: @"folder"]; - [calendar setObject: [folder calendarColor] forKey: @"color"]; - isActive = [NSNumber numberWithBool: [folder isActive]]; - [calendar setObject: isActive forKey: @"active"]; - [calendar setObject: [folder ownerInContext: context] - forKey: @"owner"]; - [calendars addObject: calendar]; - } + folder = [folders objectAtIndex: count]; + calendar = [NSMutableDictionary dictionary]; + folderName = [folder nameInContainer]; + fDisplayName = [folder displayName]; + if (fDisplayName == nil) + fDisplayName = @""; + if ([fDisplayName isEqualToString: [co defaultFolderName]]) + fDisplayName = [self labelForKey: fDisplayName]; + [calendar setObject: [NSString stringWithFormat: @"/%@", folderName] + forKey: @"id"]; + [calendar setObject: fDisplayName forKey: @"displayName"]; + [calendar setObject: folderName forKey: @"folder"]; + [calendar setObject: [folder calendarColor] forKey: @"color"]; + isActive = [NSNumber numberWithBool: [folder isActive]]; + [calendar setObject: isActive forKey: @"active"]; + [calendar setObject: [folder ownerInContext: context] + forKey: @"owner"]; + fActiveTasks = [folder activeTasks]; + [calendar setObject:fActiveTasks forKey:@"activeTasks" ]; + [calendars addObject: calendar]; } - + } + return calendars; } diff --git a/UI/Templates/SchedulerUI/UIxCalendarSelector.wox b/UI/Templates/SchedulerUI/UIxCalendarSelector.wox index 477a64513..5b3bd488e 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarSelector.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarSelector.wox @@ -38,9 +38,10 @@ div.colorBox.calendarFolder
  • -
  • +
    + + +
    diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 8a3a44215..d69d69830 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -2900,27 +2900,35 @@ function configureDragHandles() { } function initCalendarSelector() { - var selector = $("calendarSelector"); - updateCalendarStatus(); // triggers the initial events refresh - selector.changeNotification = updateCalendarsList; - - var list = $("calendarList"); - list.on("mousedown", onCalendarSelectionChange); - list.on("dblclick", onCalendarModify); - list.on("selectstart", listRowMouseDownHandler); - list.attachMenu("calendarsMenu"); - - var items = list.childNodesWithTag("li"); - for (var i = 0; i < items.length; i++) { - var input = items[i].childNodesWithTag("input")[0]; - $(input).observe("click", clickEventWrapper(updateCalendarStatus)); + var selector = $("calendarSelector"); + updateCalendarStatus(); // triggers the initial events refresh + selector.changeNotification = updateCalendarsList; + + var list = $("calendarList"); + list.on("mousedown", onCalendarSelectionChange); + list.on("dblclick", onCalendarModify); + list.on("selectstart", listRowMouseDownHandler); + list.attachMenu("calendarsMenu"); + + var items = list.childNodesWithTag("li"); + for (var i = 0; i < items.length; i++) { + var input = items[i].childNodesWithTag("input")[0]; + var activeTasks = items[i].childNodesWithTag("span")[0]; + $(input).observe("click", clickEventWrapper(updateCalendarStatus)); + if (activeTasks.textContent == "0") { + activeTasks.innerHTML = ""; } - - var links = $("calendarSelectorButtons").childNodesWithTag("a"); - $(links[0]).observe("click", clickEventWrapper(onCalendarNew)); - $(links[1]).observe("click", clickEventWrapper(onCalendarWebAdd)); - $(links[2]).observe("click", clickEventWrapper(onCalendarAdd)); - $(links[3]).observe("click", clickEventWrapper(onCalendarRemove)); + else { + activeTasks.innerHTML = "(" + activeTasks.innerText + ")"; + } + + } + + var links = $("calendarSelectorButtons").childNodesWithTag("a"); + $(links[0]).observe("click", clickEventWrapper(onCalendarNew)); + $(links[1]).observe("click", clickEventWrapper(onCalendarWebAdd)); + $(links[2]).observe("click", clickEventWrapper(onCalendarAdd)); + $(links[3]).observe("click", clickEventWrapper(onCalendarRemove)); } function onCalendarSelectionChange(event) {