diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index 5c3d00357..e469262ea 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -15,6 +15,7 @@ SchedulerUI_OBJC_FILES = \ \ UIxCalMainView.m \ UIxCalendarProperties.m \ + UIxCalendarFolderLinksTemplate.m\ \ UIxCalFilterPanel.m \ UIxCalDayTable.m \ diff --git a/UI/Scheduler/UIxCalendarFolderLinksTemplate.h b/UI/Scheduler/UIxCalendarFolderLinksTemplate.h new file mode 100644 index 000000000..ee8e3aca4 --- /dev/null +++ b/UI/Scheduler/UIxCalendarFolderLinksTemplate.h @@ -0,0 +1,33 @@ +/* UIxCalendarFolderLinksTemplate.h - this file is part of SOGo + * + * Copyright (C) 2015 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +@class NSString; + +@class SOGoAppointmentFolder; + +@interface UIxCalendarFolderLinksTemplate : UIxComponent +{ + SOGoAppointmentFolder *calendar; + NSString *baseCalDAVURL, *basePublicCalDAVURL; +} + +@end diff --git a/UI/Scheduler/UIxCalendarFolderLinksTemplate.m b/UI/Scheduler/UIxCalendarFolderLinksTemplate.m new file mode 100644 index 000000000..c76a5fe3e --- /dev/null +++ b/UI/Scheduler/UIxCalendarFolderLinksTemplate.m @@ -0,0 +1,118 @@ +/* UIxCalendarFolderLinksTemplate.m - this file is part of SOGo + * + * Copyright (C) 2015 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import + +#import "UIxCalendarFolderLinksTemplate.h" + +@implementation UIxCalendarFolderLinksTemplate + +- (id) init +{ + if ((self = [super init])) + { + calendar = [self clientObject]; + baseCalDAVURL = nil; + basePublicCalDAVURL = nil; + } + + return self; +} + +- (void) dealloc +{ + [baseCalDAVURL release]; + [basePublicCalDAVURL release]; + [super dealloc]; +} + +- (NSString *) _baseCalDAVURL +{ + NSString *davURL; + + if (!baseCalDAVURL) + { + davURL = [[calendar realDavURL] absoluteString]; + if ([davURL hasSuffix: @"/"]) + baseCalDAVURL = [davURL substringToIndex: [davURL length] - 1]; + else + baseCalDAVURL = davURL; + [baseCalDAVURL retain]; + } + + return baseCalDAVURL; +} + +- (NSString *) calDavURL +{ + return [NSString stringWithFormat: @"%@/", [self _baseCalDAVURL]]; +} + +- (NSString *) webDavICSURL +{ + return [calendar webDavICSURL]; +} + +- (NSString *) webDavXMLURL +{ + return [calendar webDavXMLURL]; +} + +- (NSString *) _basePublicCalDAVURL +{ + NSString *davURL; + + if (!basePublicCalDAVURL) + { + davURL = [[calendar publicDavURL] absoluteString]; + if ([davURL hasSuffix: @"/"]) + basePublicCalDAVURL = [davURL substringToIndex: [davURL length] - 1]; + else + basePublicCalDAVURL = davURL; + [basePublicCalDAVURL retain]; + } + + return basePublicCalDAVURL; +} + +- (NSString *) publicCalDavURL +{ + return [NSString stringWithFormat: @"%@/", [self _basePublicCalDAVURL]]; +} + +- (NSString *) publicWebDavICSURL +{ + return [calendar publicWebDavICSURL]; +} + +- (NSString *) publicWebDavXMLURL +{ + return [calendar publicWebDavXMLURL]; +} + +- (BOOL) isPublicAccessEnabled +{ + // NOTE: This method is the same found in Common/UIxAclEditor.m + return [[SOGoSystemDefaults sharedSystemDefaults] + enablePublicAccess]; +} + +@end diff --git a/UI/Scheduler/product.plist b/UI/Scheduler/product.plist index a1724c67b..443f234cc 100644 --- a/UI/Scheduler/product.plist +++ b/UI/Scheduler/product.plist @@ -180,6 +180,10 @@ pageName = "UIxCalUserRightsEditor"; actionName = "saveUserRights"; }; + links = { + protectedBy = "View"; + pageName = "UIxCalendarFolderLinksTemplate"; + }; }; }; diff --git a/UI/Templates/SchedulerUI/UIxCalMainView.wox b/UI/Templates/SchedulerUI/UIxCalMainView.wox index db54422b3..09d41c26e 100644 --- a/UI/Templates/SchedulerUI/UIxCalMainView.wox +++ b/UI/Templates/SchedulerUI/UIxCalMainView.wox @@ -174,10 +174,40 @@ ng-false-value="0" label:aria-label="Enable">

{{calendar.name}}

- - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UI/Templates/SchedulerUI/UIxCalendarFolderLinksTemplate.wox b/UI/Templates/SchedulerUI/UIxCalendarFolderLinksTemplate.wox new file mode 100644 index 000000000..703c53830 --- /dev/null +++ b/UI/Templates/SchedulerUI/UIxCalendarFolderLinksTemplate.wox @@ -0,0 +1,60 @@ + + + + + + +
+ +
+ + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
+ + + + + + + + +
+
+ + + + + +
+
+ +
diff --git a/UI/WebServerResources/js/Scheduler/CalendarsController.js b/UI/WebServerResources/js/Scheduler/CalendarsController.js index 6eeb8141f..e7bae8a4a 100644 --- a/UI/WebServerResources/js/Scheduler/CalendarsController.js +++ b/UI/WebServerResources/js/Scheduler/CalendarsController.js @@ -16,6 +16,7 @@ vm.addWebCalendar = addWebCalendar; vm.confirmDelete = confirmDelete; vm.share = share; + vm.showLinks = showLinks; vm.subscribeToFolder = subscribeToFolder; // Dispatch the event named 'calendars:list' when a calendar is activated or deactivated or @@ -91,6 +92,28 @@ } } + function showLinks(selectedFolder) { + $mdDialog.show({ + parent: angular.element(document.body), + clickOutsideToClose: true, + escapeToClose: true, + templateUrl: selectedFolder.id + '/links', + locals: { + }, + controller: LinksDialogController + }); + + /** + * @ngInject + */ + LinksDialogController.$inject = ['scope', '$mdDialog']; + function LinksDialogController(scope, $mdDialog) { + scope.close = function(type) { + $mdDialog.hide(); + } + } + } + function share(calendar) { $mdDialog.show({ templateUrl: calendar.id + '/UIxAclEditor', // UI/Templates/UIxAclEditor.wox