Fix for bug 2007
parent
3cce9b2012
commit
05990e9a14
|
@ -1,8 +1,6 @@
|
||||||
/* SOGoAppointmentFolders.h - this file is part of SOGo
|
/* SOGoAppointmentFolders.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Inverse inc.
|
* Copyright (C) 2007-2013 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -35,8 +33,8 @@
|
||||||
NSMutableArray *folderObjectKeys;
|
NSMutableArray *folderObjectKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoWebAppointmentFolder *) newWebCalendarWithName: (NSString *) folderDisplayName
|
- (SOGoWebAppointmentFolder *) newWebCalendarWithURL: (NSString *) urlString
|
||||||
atURL: (NSString *) url;
|
nameInContainer: (NSString *) name;
|
||||||
|
|
||||||
- (void) reloadWebCalendars: (BOOL) forceReload;
|
- (void) reloadWebCalendars: (BOOL) forceReload;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
|
|
||||||
/* SOGoAppointmentFolders.m - this file is part of SOGo
|
/* SOGoAppointmentFolders.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2010 Inverse inc.
|
* Copyright (C) 2007-2013 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -133,18 +131,29 @@ static SoSecurityManager *sm = nil;
|
||||||
return [self labelForKey: @"Personal Calendar" inContext: context];
|
return [self labelForKey: @"Personal Calendar" inContext: context];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoWebAppointmentFolder *)
|
|
||||||
newWebCalendarWithName: (NSString *) folderDisplayName
|
|
||||||
atURL: (NSString *) urlString
|
- (SOGoWebAppointmentFolder *) newWebCalendarWithURL: (NSString *) urlString
|
||||||
|
nameInContainer: (NSString *) name
|
||||||
{
|
{
|
||||||
NSException *error;
|
NSString *folderDisplayName, *tmp;
|
||||||
SOGoAppointmentFolder *aptFolder;
|
|
||||||
SOGoWebAppointmentFolder *webCalendar;
|
SOGoWebAppointmentFolder *webCalendar;
|
||||||
NSString *name;
|
SOGoAppointmentFolder *aptFolder;
|
||||||
|
NSException *error;
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
|
|
||||||
|
folderDisplayName = [self labelForKey: @"Web Calendar"];
|
||||||
webCalendar = nil;
|
webCalendar = nil;
|
||||||
|
|
||||||
|
tmp = [urlString lastPathComponent];
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
if ([[tmp pathExtension] caseInsensitiveCompare: @"ics"] == NSOrderedSame)
|
||||||
|
folderDisplayName = [tmp substringToIndex: [tmp length] - 4];
|
||||||
|
else
|
||||||
|
folderDisplayName = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
if ([folderDisplayName length] > 0 && [urlString length] > 0)
|
if ([folderDisplayName length] > 0 && [urlString length] > 0)
|
||||||
{
|
{
|
||||||
url = [NSURL URLWithString: urlString];
|
url = [NSURL URLWithString: urlString];
|
||||||
|
@ -154,6 +163,10 @@ static SoSecurityManager *sm = nil;
|
||||||
nameInContainer: &name];
|
nameInContainer: &name];
|
||||||
if (!error)
|
if (!error)
|
||||||
{
|
{
|
||||||
|
// We make sure we initialized our subfolfers list. This can happen
|
||||||
|
// when auto-creating Web calendars during the logon process.
|
||||||
|
[self subFolders];
|
||||||
|
|
||||||
aptFolder = [subFolders objectForKey: name];
|
aptFolder = [subFolders objectForKey: name];
|
||||||
[aptFolder setFolderPropertyValue: urlString
|
[aptFolder setFolderPropertyValue: urlString
|
||||||
inCategory: @"WebCalendars"];
|
inCategory: @"WebCalendars"];
|
||||||
|
@ -561,9 +574,25 @@ static SoSecurityManager *sm = nil;
|
||||||
folder = [SOGoWebAppointmentFolder
|
folder = [SOGoWebAppointmentFolder
|
||||||
folderWithSubscriptionReference: ref
|
folderWithSubscriptionReference: ref
|
||||||
inContainer: self];
|
inContainer: self];
|
||||||
if (folder
|
|
||||||
&& (forceReload || [folder reloadOnLogin]))
|
if (forceReload || [folder reloadOnLogin] || !folder)
|
||||||
[folder loadWebCalendar];
|
{
|
||||||
|
if (!folder)
|
||||||
|
{
|
||||||
|
NSString *s, *urlString;
|
||||||
|
|
||||||
|
urlString = [[calSettings objectForKey: @"WebCalendars"] objectForKey: ref];
|
||||||
|
s = [ref lastPathComponent];
|
||||||
|
|
||||||
|
// See bug #2007. Some admins want to subscribe users to Web calendars
|
||||||
|
// using sogo-tool. If they do that, the db tables won't be created
|
||||||
|
// so we must detect that here and create them upon login.
|
||||||
|
folder = [self newWebCalendarWithURL: urlString
|
||||||
|
nameInContainer: s];
|
||||||
|
}
|
||||||
|
|
||||||
|
[folder loadWebCalendar];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
/* NSString+Utilities.h - this file is part of SOGo
|
/* NSString+Utilities.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2011 Inverse inc.
|
* Copyright (C) 2006-2013 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2013 Inverse inc.
|
* Copyright (C) 2006-2013 Inverse inc.
|
||||||
*
|
*
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
|
||||||
*
|
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
|
|
@ -364,7 +364,11 @@ static SoSecurityManager *sm = nil;
|
||||||
NSString *newFolderID;
|
NSString *newFolderID;
|
||||||
NSException *error;
|
NSException *error;
|
||||||
|
|
||||||
newFolderID = [self globallyUniqueObjectId];
|
newFolderID = *newNameInContainer;
|
||||||
|
|
||||||
|
if (!newFolderID)
|
||||||
|
newFolderID = [self globallyUniqueObjectId];
|
||||||
|
|
||||||
error = [self newFolderWithName: name
|
error = [self newFolderWithName: name
|
||||||
andNameInContainer: newFolderID];
|
andNameInContainer: newFolderID];
|
||||||
if (error)
|
if (error)
|
||||||
|
|
|
@ -37,24 +37,6 @@
|
||||||
|
|
||||||
@implementation UIxCalMainActions
|
@implementation UIxCalMainActions
|
||||||
|
|
||||||
- (NSString *) displayNameForUrl: (NSString *) calendarURL
|
|
||||||
{
|
|
||||||
NSString *rc, *tmp;
|
|
||||||
|
|
||||||
tmp = [calendarURL lastPathComponent];
|
|
||||||
if (tmp)
|
|
||||||
{
|
|
||||||
if ([[tmp pathExtension] caseInsensitiveCompare: @"ics"] == NSOrderedSame)
|
|
||||||
rc = [tmp substringToIndex: [tmp length] - 4];
|
|
||||||
else
|
|
||||||
rc = tmp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rc = [self labelForKey: @"Web Calendar"];
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (WOResponse *) addWebCalendarAction
|
- (WOResponse *) addWebCalendarAction
|
||||||
{
|
{
|
||||||
WORequest *r;
|
WORequest *r;
|
||||||
|
@ -70,11 +52,12 @@
|
||||||
if ([urlString length] > 0)
|
if ([urlString length] > 0)
|
||||||
{
|
{
|
||||||
folders = [self clientObject];
|
folders = [self clientObject];
|
||||||
displayName = [self displayNameForUrl: urlString];
|
folder = [folders newWebCalendarWithURL: urlString
|
||||||
folder = [folders newWebCalendarWithName: displayName
|
nameInContainer: nil];
|
||||||
atURL: urlString];
|
|
||||||
if (folder)
|
if (folder)
|
||||||
{
|
{
|
||||||
|
displayName = [folder displayName];
|
||||||
response = [self responseWithStatus: 200];
|
response = [self responseWithStatus: 200];
|
||||||
[response setHeader: @"application/json" forKey: @"content-type"];
|
[response setHeader: @"application/json" forKey: @"content-type"];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue