(feat) links to calendars

pull/91/head
Ludovic Marcotte 2015-06-12 13:34:08 -04:00 committed by Francis Lachapelle
parent a89b116940
commit ee9e559765
7 changed files with 273 additions and 4 deletions

View File

@ -15,6 +15,7 @@ SchedulerUI_OBJC_FILES = \
\
UIxCalMainView.m \
UIxCalendarProperties.m \
UIxCalendarFolderLinksTemplate.m\
\
UIxCalFilterPanel.m \
UIxCalDayTable.m \

View File

@ -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 <SOGoUI/UIxComponent.h>
@class NSString;
@class SOGoAppointmentFolder;
@interface UIxCalendarFolderLinksTemplate : UIxComponent
{
SOGoAppointmentFolder *calendar;
NSString *baseCalDAVURL, *basePublicCalDAVURL;
}
@end

View File

@ -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 <SOGo/SOGoSystemDefaults.h>
#import <Appointments/SOGoAppointmentFolder.h>
#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

View File

@ -180,6 +180,10 @@
pageName = "UIxCalUserRightsEditor";
actionName = "saveUserRights";
};
links = {
protectedBy = "View";
pageName = "UIxCalendarFolderLinksTemplate";
};
};
};

View File

@ -174,10 +174,40 @@
ng-false-value="0"
label:aria-label="Enable"><!-- enable --></md-checkbox>
<p class="sg-item-name">{{calendar.name}}</p>
<md-button class="iconButton md-secondary" label:aria-label="Options"
ng-click="calendars.share(calendar)">
<i class="md-icon-more-vert"><!-- options --></i>
</md-button>
<md-menu class="md-secondary">
<md-button class="iconButton"
label:aria-label="Options"
ng-click="$mdOpenMenu()">
<i class="md-icon-more-vert" md-menu-origin="md-menu-origin"><!-- options --></i>
</md-button>
<md-menu-content width="2">
<md-menu-item>
<md-button type="button" ng-click="calendars.confirmDelete(calendar)">
<var:string label:value="Delete"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button type="button" ng-click="calendars.exportCalendar()">
<var:string label:value="Export"/>
</md-button>
</md-menu-item>
<md-menu-divider><!-- divider --></md-menu-divider>
<md-menu-item>
<md-button type="button" ng-click="calendars.showLinks(calendar)">
<var:string label:value="Links to this Calendar"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button type="button" ng-click="calendars.share(calendar)">
<var:string label:value="Sharing..."/>
</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</md-list-item>
</md-list>
</section>

View File

@ -0,0 +1,60 @@
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE var:component>
<var:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:uix="OGo:uix"
xmlns:rsrc="OGo:url"
xmlns:label="OGo:label"
className="UIxPageFrame">
<md-dialog>
<md-content>
<div layout="column" layout-padding="layout-padding">
<div layout="column" layout-padding="layout-padding">
<span><var:string label:value="Authenticated User Access"/></span>
<md-input-container>
<label><var:string label:value="CalDAV URL"/></label>
<input var:value="calDavURL" ng-readonly="true"/>
</md-input-container>
<md-input-container>
<label><var:string label:value="WebDAV ICS URL"/></label>
<input var:value="webDavICSURL" ng-readonly="true"/>
</md-input-container>
<md-input-container>
<label><var:string label:value="WebDAV XML URL"/></label>
<input var:value="webDavXMLURL" ng-readonly="true"/>
</md-input-container>
</div>
<var:if condition="isPublicAccessEnabled">
<div layout="column" layout-padding="layout-padding">
<span><var:string label:value="Public Access"/></span>
<md-input-container>
<label><var:string label:value="CalDAV URL: "/></label>
<input var:value="publicCalDavURL" ng-readonly="true"/>
</md-input-container>
</div>
<md-input-container>
<label><var:string label:value="WebDAV ICS URL"/></label>
<input var:value="publicWebDavICSURL" ng-readonly="true"/>
</md-input-container>
<md-input-container>
<label><var:string label:value="WebDAV XML URL"/></label>
<input var:value="publicWebDavXMLURL" ng-readonly="true"/>
</md-input-container>
</var:if>
</div>
<md-button type="button" ng-click="close()">
<var:string label:value="OK"/>
</md-button>
</md-content>
</md-dialog>
</var:component>

View File

@ -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