(fix) reuse the calendar urls from the model
parent
744cba4422
commit
7b5541b5d1
|
@ -20,14 +20,6 @@
|
||||||
|
|
||||||
#import <SOGoUI/UIxComponent.h>
|
#import <SOGoUI/UIxComponent.h>
|
||||||
|
|
||||||
@class NSString;
|
|
||||||
|
|
||||||
@class SOGoAppointmentFolder;
|
|
||||||
|
|
||||||
@interface UIxCalendarFolderLinksTemplate : UIxComponent
|
@interface UIxCalendarFolderLinksTemplate : UIxComponent
|
||||||
{
|
|
||||||
SOGoAppointmentFolder *calendar;
|
|
||||||
NSString *baseCalDAVURL, *basePublicCalDAVURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -28,89 +28,6 @@
|
||||||
|
|
||||||
@implementation UIxCalendarFolderLinksTemplate
|
@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
|
- (BOOL) isPublicAccessEnabled
|
||||||
{
|
{
|
||||||
// NOTE: This method is the same found in Common/UIxAclEditor.m
|
// NOTE: This method is the same found in Common/UIxAclEditor.m
|
||||||
|
@ -118,14 +35,4 @@
|
||||||
enablePublicAccess];
|
enablePublicAccess];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isWebCalendar
|
|
||||||
{
|
|
||||||
return ([calendar isKindOfClass: [SOGoWebAppointmentFolder class]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *) webCalendarURL
|
|
||||||
{
|
|
||||||
return [calendar folderPropertyValueInCategory: @"WebCalendars"];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -193,7 +193,7 @@
|
||||||
actionName = "saveUserRights";
|
actionName = "saveUserRights";
|
||||||
};
|
};
|
||||||
links = {
|
links = {
|
||||||
protectedBy = "View";
|
protectedBy = "Access Contents Information";
|
||||||
pageName = "UIxCalendarFolderLinksTemplate";
|
pageName = "UIxCalendarFolderLinksTemplate";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,43 +75,49 @@
|
||||||
.then(function() {
|
.then(function() {
|
||||||
$scope.$broadcast('calendars:list');
|
$scope.$broadcast('calendars:list');
|
||||||
}, function(data, status) {
|
}, function(data, status) {
|
||||||
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".', folder.name),
|
Dialog.alert(l('An error occured while deleting the calendar "%{0}".', folder.name),
|
||||||
l(data.error));
|
l(data.error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the addressbook <em>%{0}</em>?', folder.name))
|
Dialog.confirm(l('Warning'), l('Are you sure you want to delete the calendar <em>%{0}</em>?', folder.name))
|
||||||
.then(function() {
|
.then(function() {
|
||||||
folder.$delete()
|
folder.$delete()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
$scope.$broadcast('calendars:list');
|
$scope.$broadcast('calendars:list');
|
||||||
}, function(data, status) {
|
}, function(data, status) {
|
||||||
Dialog.alert(l('An error occured while deleting the addressbook "%{0}".', folder.name),
|
Dialog.alert(l('An error occured while deleting the calendar "%{0}".', folder.name),
|
||||||
l(data.error));
|
l(data.error));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLinks(selectedFolder) {
|
function showLinks(calendar) {
|
||||||
$mdDialog.show({
|
$mdDialog.show({
|
||||||
parent: angular.element(document.body),
|
parent: angular.element(document.body),
|
||||||
clickOutsideToClose: true,
|
clickOutsideToClose: true,
|
||||||
escapeToClose: true,
|
escapeToClose: true,
|
||||||
templateUrl: selectedFolder.id + '/links',
|
templateUrl: calendar.id + '/links',
|
||||||
|
controller: LinksDialogController,
|
||||||
|
controllerAs: 'links',
|
||||||
locals: {
|
locals: {
|
||||||
},
|
calendar: calendar
|
||||||
controller: LinksDialogController
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngInject
|
* @ngInject
|
||||||
*/
|
*/
|
||||||
LinksDialogController.$inject = ['scope', '$mdDialog'];
|
LinksDialogController.$inject = ['$mdDialog', 'calendar'];
|
||||||
function LinksDialogController(scope, $mdDialog) {
|
function LinksDialogController($mdDialog, calendar) {
|
||||||
scope.close = function() {
|
var vm = this;
|
||||||
|
vm.calendar = calendar;
|
||||||
|
vm.close = close;
|
||||||
|
|
||||||
|
function close() {
|
||||||
$mdDialog.hide();
|
$mdDialog.hide();
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue