New user setting to set calendars display order
parent
d19f1572ae
commit
6cb513f30b
|
@ -2956,6 +2956,9 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
refDict = [moduleSettings objectForKey: @"NotifyUserOnPersonalModifications"];
|
refDict = [moduleSettings objectForKey: @"NotifyUserOnPersonalModifications"];
|
||||||
[refDict removeObjectForKey: reference];
|
[refDict removeObjectForKey: reference];
|
||||||
|
|
||||||
|
refArray = [moduleSettings objectForKey: @"FoldersOrder"];
|
||||||
|
[refArray removeObject: nameInContainer];
|
||||||
|
|
||||||
refArray = [moduleSettings objectForKey: @"InactiveFolders"];
|
refArray = [moduleSettings objectForKey: @"InactiveFolders"];
|
||||||
[refArray removeObject: nameInContainer];
|
[refArray removeObject: nameInContainer];
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* UIxCalMainView.m - this file is part of SOGo
|
/* UIxCalMainView.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2015 Inverse inc.
|
* Copyright (C) 2006-2016 Inverse inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -301,6 +301,27 @@
|
||||||
return (state && [state compare: @"collapse"] == NSOrderedSame)? @"display: none;" : @"";
|
return (state && [state compare: @"collapse"] == NSOrderedSame)? @"display: none;" : @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (WOResponse *) saveFoldersOrderAction
|
||||||
|
{
|
||||||
|
WORequest *request;
|
||||||
|
NSDictionary *params;
|
||||||
|
NSArray *list;
|
||||||
|
|
||||||
|
[self _setupContext];
|
||||||
|
request = [context request];
|
||||||
|
params = [[request contentAsString] objectFromJSONString];
|
||||||
|
|
||||||
|
list = [params objectForKey: @"folders"];
|
||||||
|
if (list)
|
||||||
|
[moduleSettings setObject: list
|
||||||
|
forKey: @"FoldersOrder"];
|
||||||
|
else
|
||||||
|
[moduleSettings removeObjectForKey: @"FoldersOrder"];
|
||||||
|
[us synchronize];
|
||||||
|
|
||||||
|
return [self responseWithStatus: 204];
|
||||||
|
}
|
||||||
|
|
||||||
- (unsigned int) firstDayOfWeek
|
- (unsigned int) firstDayOfWeek
|
||||||
{
|
{
|
||||||
SOGoUserDefaults *ud;
|
SOGoUserDefaults *ud;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* UIxCalendarSelector.m - this file is part of SOGo
|
/* UIxCalendarSelector.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2015 Inverse inc.
|
* Copyright (C) 2007-2016 Inverse inc.
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||||
#import <SoObjects/SOGo/SOGoUser.h>
|
#import <SoObjects/SOGo/SOGoUser.h>
|
||||||
|
#import <SoObjects/SOGo/SOGoUserSettings.h>
|
||||||
|
|
||||||
#import <Appointments/SOGoAppointmentFolders.h>
|
#import <Appointments/SOGoAppointmentFolders.h>
|
||||||
#import <Appointments/SOGoWebAppointmentFolder.h>
|
#import <Appointments/SOGoWebAppointmentFolder.h>
|
||||||
|
@ -89,26 +90,77 @@ _intValueFromHex (NSString *hexString)
|
||||||
|
|
||||||
- (NSArray *) calendars
|
- (NSArray *) calendars
|
||||||
{
|
{
|
||||||
NSMutableDictionary *calendar, *notifications, *urls, *acls;
|
BOOL objectCreator, objectEraser, reloadOnLogin, synchronize, dirty;
|
||||||
NSString *userLogin, *folderName, *fDisplayName, *owner;
|
NSArray *folders, *allACLs;
|
||||||
|
NSMutableArray *sortedFolders, *sortedFolderNames;
|
||||||
|
NSMutableDictionary *moduleSettings, *calendar, *notifications, *urls, *acls;
|
||||||
NSNumber *isActive, *fActiveTasks;
|
NSNumber *isActive, *fActiveTasks;
|
||||||
|
NSString *userLogin, *folderName, *fDisplayName, *owner;
|
||||||
|
NSUInteger count, index, max;
|
||||||
SOGoAppointmentFolder *folder;
|
SOGoAppointmentFolder *folder;
|
||||||
SOGoAppointmentFolders *co;
|
SOGoAppointmentFolders *co;
|
||||||
NSArray *folders, *allACLs;
|
SOGoUser *activeUser;
|
||||||
|
SOGoUserSettings *us;
|
||||||
|
|
||||||
BOOL objectCreator, objectEraser, reloadOnLogin, synchronize;
|
|
||||||
NSUInteger count, max;
|
|
||||||
|
|
||||||
if (!calendars)
|
if (!calendars)
|
||||||
{
|
{
|
||||||
co = [self clientObject];
|
co = [self clientObject];
|
||||||
userLogin = [[context activeUser] login];
|
activeUser = [context activeUser];
|
||||||
|
userLogin = [activeUser login];
|
||||||
folders = [co subFolders];
|
folders = [co subFolders];
|
||||||
|
|
||||||
|
// Sort calendars according to user settings
|
||||||
|
dirty = NO;
|
||||||
|
us = [activeUser userSettings];
|
||||||
|
moduleSettings = [us objectForKey: [co nameInContainer]];
|
||||||
|
sortedFolders = [NSMutableArray arrayWithArray: [moduleSettings objectForKey: @"FoldersOrder"]];
|
||||||
|
|
||||||
|
max = [folders count];
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
|
{
|
||||||
|
folder = [folders objectAtIndex: count];
|
||||||
|
folderName = [folder nameInContainer];
|
||||||
|
index = [sortedFolders indexOfObject: folderName];
|
||||||
|
if (index == NSNotFound)
|
||||||
|
{
|
||||||
|
// Calendar is missing from user's "FoldersOrder" setting; add it
|
||||||
|
dirty = YES;
|
||||||
|
[sortedFolders addObject: folder];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
[sortedFolders replaceObjectAtIndex: index withObject: folder];
|
||||||
|
}
|
||||||
|
|
||||||
|
max = [sortedFolders count];
|
||||||
|
sortedFolderNames = [NSMutableArray arrayWithCapacity: max];
|
||||||
|
for (count = max; count > -1; count--)
|
||||||
|
{
|
||||||
|
if ([[sortedFolders objectAtIndex: count] isKindOfClass: [NSString class]])
|
||||||
|
{
|
||||||
|
// Calendar no longer exists; remove it from user's "FoldersOrder" setting
|
||||||
|
dirty = YES;
|
||||||
|
[sortedFolders removeObjectAtIndex: count];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
folder = [sortedFolders objectAtIndex: count];
|
||||||
|
folderName = [folder nameInContainer];
|
||||||
|
[sortedFolderNames addObject: folderName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dirty)
|
||||||
|
{
|
||||||
|
// Synchronize user's settings
|
||||||
|
[moduleSettings setObject: sortedFolderNames forKey: @"FoldersOrder"];
|
||||||
|
[us synchronize];
|
||||||
|
}
|
||||||
|
|
||||||
max = [folders count];
|
max = [folders count];
|
||||||
calendars = [[NSMutableArray alloc] initWithCapacity: max];
|
calendars = [[NSMutableArray alloc] initWithCapacity: max];
|
||||||
for (count = 0; count < max; count++)
|
for (count = 0; count < max; count++)
|
||||||
{
|
{
|
||||||
folder = [folders objectAtIndex: count];
|
folder = [sortedFolders objectAtIndex: count];
|
||||||
owner = [folder ownerInContext: context];
|
owner = [folder ownerInContext: context];
|
||||||
calendar = [NSMutableDictionary dictionary];
|
calendar = [NSMutableDictionary dictionary];
|
||||||
folderName = [folder nameInContainer];
|
folderName = [folder nameInContainer];
|
||||||
|
@ -195,7 +247,7 @@ _intValueFromHex (NSString *hexString)
|
||||||
|
|
||||||
[calendars addObject: calendar];
|
[calendars addObject: calendar];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return calendars;
|
return calendars;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,11 @@
|
||||||
pageName = "UIxCalMainView";
|
pageName = "UIxCalMainView";
|
||||||
actionName = "saveListState";
|
actionName = "saveListState";
|
||||||
};
|
};
|
||||||
|
saveFoldersOrder = {
|
||||||
|
protectedBy = "View";
|
||||||
|
pageName = "UIxCalMainView";
|
||||||
|
actionName = "saveFoldersOrder";
|
||||||
|
};
|
||||||
dateselector = {
|
dateselector = {
|
||||||
protectedBy = "View";
|
protectedBy = "View";
|
||||||
pageName = "UIxCalDateSelector";
|
pageName = "UIxCalDateSelector";
|
||||||
|
|
Loading…
Reference in New Issue