Added calendar sharing capability
parent
0d62ec0bea
commit
feee156c0a
|
@ -23,6 +23,7 @@
|
|||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <SoObjects/SOGo/SOGoPermissions.h>
|
||||
|
||||
|
@ -94,22 +95,35 @@
|
|||
return rightsForType;
|
||||
}
|
||||
|
||||
- (void) updateRights
|
||||
- (NSDictionary *) userRightsForObject
|
||||
{
|
||||
NSMutableDictionary *d;
|
||||
|
||||
[self prepareRightsForm];
|
||||
|
||||
d = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:[self userCanCreateObjects]], @"canCreateObjects",
|
||||
[NSNumber numberWithBool:[self userCanEraseObjects]], @"canEraseObjects",
|
||||
nil];
|
||||
|
||||
[d addEntriesFromDictionary: rights];
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
- (void) updateRights: (NSDictionary *) newRights
|
||||
{
|
||||
NSEnumerator *types;
|
||||
NSString *currentType, *currentValue;
|
||||
NSArray *rightsForType;
|
||||
WORequest *request;
|
||||
|
||||
request = [context request];
|
||||
types = [[self rightTypes] objectEnumerator];
|
||||
currentType = [types nextObject];
|
||||
while (currentType)
|
||||
{
|
||||
rightsForType = [self _rightsForType: currentType];
|
||||
currentValue
|
||||
= [request formValueForKey:
|
||||
[NSString stringWithFormat: @"%@Right", currentType]];
|
||||
currentValue = [newRights objectForKey: currentType];
|
||||
|
||||
if ([currentValue isEqualToString: @"None"])
|
||||
[self removeAllRightsFromList: rightsForType];
|
||||
else
|
||||
|
@ -119,12 +133,12 @@
|
|||
currentType = [types nextObject];
|
||||
}
|
||||
|
||||
if ([[request formValueForKey: @"ObjectCreator"] length] > 0)
|
||||
if ([[newRights objectForKey: @"canCreateObjects"] boolValue])
|
||||
[self appendRight: SOGoRole_ObjectCreator];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectCreator];
|
||||
|
||||
if ([[request formValueForKey: @"ObjectEraser"] length] > 0)
|
||||
if ([[newRights objectForKey: @"canEraseObjects"] boolValue])
|
||||
[self appendRight: SOGoRole_ObjectEraser];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectEraser];
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
userRights = {
|
||||
protectedBy = "ReadAcls";
|
||||
pageName = "UIxCalUserRightsEditor";
|
||||
actionName = "userRights";
|
||||
};
|
||||
saveUserRights = {
|
||||
protectedBy = "Change Permissions";
|
||||
|
@ -168,6 +169,7 @@
|
|||
userRights = {
|
||||
protectedBy = "ReadAcls";
|
||||
pageName = "UIxCalUserRightsEditor";
|
||||
actionName = "userRights";
|
||||
};
|
||||
saveUserRights = {
|
||||
protectedBy = "Change Permissions";
|
||||
|
|
|
@ -10,28 +10,36 @@
|
|||
|
||||
<md-checkbox name="canViewObjects"
|
||||
ng-model="selectedUser.rights.canViewObjects"
|
||||
ng-change="confirmChange(selectedUser)" >
|
||||
ng-change="confirmChange(selectedUser)"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="This person can read the cards of this addressbook." />
|
||||
</md-checkbox>
|
||||
|
||||
<md-checkbox name="canCreateObjects"
|
||||
ng-model="selectedUser.rights.canCreateObjects"
|
||||
ng-change="confirmChange(selectedUser)"
|
||||
ng-hide="selectedUser.$isAnonymous()">
|
||||
ng-hide="selectedUser.$isAnonymous()"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="This person can add cards to this addressbook." />
|
||||
</md-checkbox>
|
||||
|
||||
<md-checkbox name="canEditObjects"
|
||||
ng-model="selectedUser.rights.canEditObjects"
|
||||
ng-change="confirmChange(selectedUser)"
|
||||
ng-hide="selectedUser.$isAnonymous()">
|
||||
ng-hide="selectedUser.$isAnonymous()"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="This person can edit the cards of this addressbook." />
|
||||
</md-checkbox>
|
||||
|
||||
<md-checkbox name="canEraseObjects"
|
||||
ng-model="selectedUser.rights.canEraseObjects"
|
||||
ng-change="confirmChange(selectedUser)"
|
||||
ng-hide="selectedUser.$isAnonymous()">
|
||||
ng-hide="selectedUser.$isAnonymous()"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="This person can erase cards from this addressbook." />
|
||||
</md-checkbox>
|
||||
|
||||
|
|
|
@ -175,7 +175,12 @@
|
|||
label:aria-label="Enable"><!-- enable --></md-checkbox>
|
||||
<p class="sg-item-name">{{calendar.name}}</p>
|
||||
<i class="md-icon-turned-in md-display-8"
|
||||
ng-class="calendar.getClassName()"><!-- calendar color --></i>
|
||||
ng-class="calendar.getClassName()"><!-- calendar
|
||||
color --></i>
|
||||
<md-button class="iconButton" label:aria-label="Options"
|
||||
ng-click="share(calendar)">
|
||||
<i class="md-icon-more-vert"><!-- options --></i>
|
||||
</md-button>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</section>
|
||||
|
@ -294,4 +299,8 @@
|
|||
</section>
|
||||
</script>
|
||||
|
||||
<script type="text/ng-template" id="UIxUserRightsEditor">
|
||||
<var:component className="UIxCalUserRightsEditor" />
|
||||
</script>
|
||||
|
||||
</var:component>
|
||||
|
|
|
@ -10,16 +10,11 @@
|
|||
title="title"
|
||||
const:toolbar="none"
|
||||
const:popup="YES">
|
||||
<form id="userRightsForm" const:href="saveUserRights">
|
||||
<input id="uid" type="hidden" name="uid" var:value="uid"/>
|
||||
<div class="title">
|
||||
<label><span><var:string label:value="Access rights to"/></span>
|
||||
<span id="folderName" class="value"><var:string value="folderName"/></span></label>
|
||||
<label><span><var:string label:value="For user"/></span>
|
||||
<span class="value"><var:string value="userDisplayName"/></span></label>
|
||||
</div>
|
||||
<div class="calendarUserRights">
|
||||
<var:foreach list="rightTypes" item="currentRightType">
|
||||
|
||||
<div class="calendarUserRights" layout="column">
|
||||
|
||||
|
||||
<!-- <var:foreach list="rightTypes" item="currentRightType">
|
||||
<div><span><var:string value="currentRightTypeLabel"/></span>
|
||||
<var:popup list="objectRights" item="currentRight"
|
||||
var:name="currentRightTypeName"
|
||||
|
@ -28,27 +23,59 @@
|
|||
selection="currentRightSelection"
|
||||
/></div>
|
||||
</var:foreach>
|
||||
-->
|
||||
<div layout="row" layout-align="space-around center">
|
||||
<var:string label:value="Public"/>
|
||||
<md-select ng-model="selectedUser.rights.Public">
|
||||
<var:foreach list="objectRights" item="currentRight">
|
||||
<md-option var:value="currentRight">
|
||||
<var:string value="currentRightLabel"/>
|
||||
</md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
</div>
|
||||
<var:if condition="userIsAnonymousUser" const:negate="YES"
|
||||
><div class="basicUserRights">
|
||||
<label><input type="checkbox" class="checkBox"
|
||||
const:name="ObjectCreator"
|
||||
var:checked="userCanCreateObjects"/><var:string
|
||||
label:value="This person can create objects in my calendar."
|
||||
/></label>
|
||||
<br/>
|
||||
<label><input type="checkbox" class="checkBox"
|
||||
const:name="ObjectEraser"
|
||||
var:checked="userCanEraseObjects"/><var:string
|
||||
label:value="This person can erase objects from my calendar."
|
||||
/></label>
|
||||
</div></var:if>
|
||||
<div class="buttons">
|
||||
<a href="#" const:name="updateButton" id="updateButton"
|
||||
class="button actionButton">
|
||||
<span><var:string label:value="Update" /></span></a>
|
||||
<a href="#" const:name="cancelButton" id="cancelButton" class="button">
|
||||
<span><var:string label:value="Cancel" /></span></a>
|
||||
|
||||
<div layout="row" layout-align="space-around center">
|
||||
<var:string label:value="Confidential"/>
|
||||
<md-select ng-model="selectedUser.rights.Confidential">
|
||||
<var:foreach list="objectRights" item="currentRight">
|
||||
<md-option var:value="currentRight">
|
||||
<var:string value="currentRightLabel"/>
|
||||
</md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div layout="row" layout-align="space-around center">
|
||||
<var:string label:value="Private"/>
|
||||
<md-select ng-model="selectedUser.rights.Private">
|
||||
<var:foreach list="objectRights" item="currentRight">
|
||||
<md-option var:value="currentRight">
|
||||
<var:string value="currentRightLabel"/>
|
||||
</md-option>
|
||||
</var:foreach>
|
||||
</md-select>
|
||||
</div>
|
||||
|
||||
<md-checkbox name="canCreateObjects"
|
||||
ng-model="selectedUser.rights.canCreateObjects"
|
||||
ng-change="confirmChange(selectedUser)"
|
||||
ng-hide="selectedUser.$isAnonymous()"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="This person can create objects in my calendar." />
|
||||
</md-checkbox>
|
||||
|
||||
<md-checkbox name="canEraseObjects"
|
||||
ng-model="selectedUser.rights.canEraseObjects"
|
||||
ng-change="confirmChange(selectedUser)"
|
||||
ng-hide="selectedUser.$isAnonymous()"
|
||||
ng-true-value="1"
|
||||
ng-false-value="0">
|
||||
<var:string label:value="This person can erase objects from my calendar." />
|
||||
</md-checkbox>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</var:component>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 96559458633f90dafd543d3a88f9a2165fd76ac3
|
||||
Subproject commit 6fe6a8fb20e00c337b60385aef4da9c7f639a92b
|
|
@ -90,9 +90,9 @@
|
|||
User.$$resource.fetch(folderId, 'userRights', param).then(function(data) {
|
||||
_this.rights = data;
|
||||
// Convert numbers (0|1) to boolean values
|
||||
angular.forEach(_.keys(_this.rights), function(key) {
|
||||
_this.rights[key] = _this.rights[key] ? true : false;
|
||||
});
|
||||
//angular.forEach(_.keys(_this.rights), function(key) {
|
||||
// _this.rights[key] = _this.rights[key] ? true : false;
|
||||
//});
|
||||
// console.debug('rights ' + _this.uid + ' => ' + JSON.stringify(data, undefined, 2));
|
||||
// Keep a copy of the server's version
|
||||
_this.$shadowRights = angular.copy(data);
|
||||
|
|
|
@ -84,7 +84,8 @@
|
|||
})
|
||||
})
|
||||
|
||||
.controller('CalendarsController', ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$log', 'sgFocus', 'encodeUriFilter', 'sgDialog', 'sgSettings', 'sgCalendar', 'stateCalendars', function($scope, $rootScope, $stateParams, $state, $timeout, $log, focus, encodeUriFilter, Dialog, Settings, Calendar, stateCalendars) {
|
||||
|
||||
.controller('CalendarsController', ['$scope', '$rootScope', '$stateParams', '$state', '$timeout', '$q', '$mdDialog', '$log', 'sgFocus', 'encodeUriFilter', 'sgDialog', 'sgSettings', 'sgCalendar', 'sgUser', 'stateCalendars', function($scope, $rootScope, $stateParams, $state, $timeout, $q, $mdDialog, $log, focus, encodeUriFilter, Dialog, Settings, Calendar, User, stateCalendars) {
|
||||
var vm = this;
|
||||
|
||||
vm.activeUser = Settings.activeUser;
|
||||
|
@ -115,6 +116,77 @@
|
|||
true // compare for object equality
|
||||
);
|
||||
|
||||
$scope.share = function(calendar) {
|
||||
$mdDialog.show({
|
||||
templateUrl: calendar.id + '/UIxAclEditor', // UI/Templates/UIxAclEditor.wox
|
||||
controller: CalendarACLController,
|
||||
clickOutsideToClose: true,
|
||||
escapeToClose: true,
|
||||
locals: {
|
||||
usersWithACL: calendar.$acl.$users(),
|
||||
User: User,
|
||||
stateCalendar: calendar,
|
||||
q: $q
|
||||
}
|
||||
});
|
||||
function CalendarACLController($scope, $mdDialog, usersWithACL, User, stateCalendar, q) {
|
||||
$scope.users = usersWithACL; // ACL users
|
||||
$scope.stateCalendar = stateCalendar;
|
||||
$scope.userToAdd = '';
|
||||
$scope.searchText = '';
|
||||
$scope.userFilter = function($query) {
|
||||
var deferred = q.defer();
|
||||
User.$filter($query).then(function(results) {
|
||||
deferred.resolve(results)
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
$scope.closeModal = function() {
|
||||
stateCalendar.$acl.$resetUsersRights(); // cancel changes
|
||||
$mdDialog.hide();
|
||||
};
|
||||
$scope.saveModal = function() {
|
||||
stateCalendar.$acl.$saveUsersRights().then(function() {
|
||||
$mdDialog.hide();
|
||||
}, function(data, status) {
|
||||
Dialog.alert(l('Warning'), l('An error occured please try again.'));
|
||||
});
|
||||
};
|
||||
$scope.confirmChange = function(user) {
|
||||
var confirmation = user.$confirmRights();
|
||||
if (confirmation) {
|
||||
Dialog.confirm(l('Warning'), confirmation).then(function(res) {
|
||||
if (!res)
|
||||
user.$resetRights(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.removeUser = function(user) {
|
||||
stateCalendar.$acl.$removeUser(user.uid).then(function() {
|
||||
if (user.uid == $scope.selectedUser.uid) {
|
||||
$scope.selectedUser = null;
|
||||
}
|
||||
}, function(data, status) {
|
||||
Dialog.alert(l('Warning'), l('An error occured please try again.'))
|
||||
});
|
||||
};
|
||||
$scope.addUser = function(data) {
|
||||
stateCalendar.$acl.$addUser(data).then(function() {
|
||||
$scope.userToAdd = '';
|
||||
$scope.searchText = '';
|
||||
}, function(error) {
|
||||
Dialog.alert(l('Warning'), error);
|
||||
});
|
||||
};
|
||||
$scope.selectUser = function(user) {
|
||||
// Check if it is a different user
|
||||
if ($scope.selectedUser != user) {
|
||||
$scope.selectedUser = user;
|
||||
$scope.selectedUser.$rights();
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* subscribeToFolder - Callback of sgSubscribe directive
|
||||
*/
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
md-bottom-sheet.md-default-theme {
|
||||
border: none;
|
||||
background-color: inherit;
|
||||
background-image: url("../img/cardboard-transp.png");
|
||||
background-blend-mode: multiply;
|
||||
//background-image: url("../img/cardboard-transp.png");
|
||||
//background-blend-mode: multiply;
|
||||
}
|
||||
|
||||
md-bottom-sheet.md-default-theme .md-button.md-default-theme {
|
||||
&:hover:not([disabled]) {
|
||||
background-color: inherit;
|
||||
background-image: url("../img/cardboard-transp.png");
|
||||
background-blend-mode: multiply;
|
||||
//background-image: url("../img/cardboard-transp.png");
|
||||
//background-blend-mode: multiply;
|
||||
color: sg-color($sogoBlue, 800);
|
||||
}
|
||||
&[disabled] {
|
||||
|
|
|
@ -32,8 +32,8 @@ md-sidenav {
|
|||
& md-content,
|
||||
& md-toolbar {
|
||||
background-color: inherit;
|
||||
background-image: url("../img/cardboard-transp.png");
|
||||
background-blend-mode: multiply;
|
||||
//background-image: url("../img/cardboard-transp.png");
|
||||
//background-blend-mode: multiply;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ md-toolbar {
|
|||
z-index: $z-index-toolbar;
|
||||
// dirty fix to override angular-material botchy typography
|
||||
font-size: 1em !important;
|
||||
background-image: url("../img/felt-transp.png");
|
||||
background-blend-mode: luminosity;
|
||||
//background-image: url("../img/felt-transp.png");
|
||||
//background-blend-mode: luminosity;
|
||||
box-shadow: $whiteframe-shadow-z1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue