merge of '11f4bdac420d36e45b12ca5d1d393ec34f43c609'

and '90a65543c12f64be022dceaada5327dafced8237'

Monotone-Parent: 11f4bdac420d36e45b12ca5d1d393ec34f43c609
Monotone-Parent: 90a65543c12f64be022dceaada5327dafced8237
Monotone-Revision: 0ae742cafbf84e4884bef1a66df7ee968561f6b3

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-10T00:03:24
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-10 00:03:24 +00:00
2 changed files with 41 additions and 5 deletions
+17 -1
View File
@@ -335,9 +335,23 @@
SOGoAppointmentFolder *calendar, *currentCalendar;
SOGoAppointmentFolders *calendarParent;
NSEnumerator *allCalendars;
SoSecurityManager *sm;
NSString *perm, *privacy;
if (!calendarList)
{
sm = [SoSecurityManager sharedSecurityManager];
if ([[self clientObject] isNew])
perm = SoPerm_AddDocumentsImagesAndFiles;
else {
privacy = [component accessClass];
if ([privacy isEqualToString: @"PRIVATE"])
perm = SOGoCalendarPerm_ModifyPrivateRecords;
else if ([privacy isEqualToString: @"CONFIDENTIAL"])
perm = SOGoCalendarPerm_ModifyConfidentialRecords;
else
perm = SOGoCalendarPerm_ModifyPublicRecords;
}
calendarList = [NSMutableArray new];
calendar = [[self clientObject] container];
calendarParent = [calendar container];
@@ -345,7 +359,9 @@
currentCalendar = [allCalendars nextObject];
while (currentCalendar)
{
if ([currentCalendar isActive])
if (![sm validatePermission: perm
onObject: currentCalendar
inContext: context])
[calendarList addObject: currentCalendar];
currentCalendar = [allCalendars nextObject];
}
+24 -4
View File
@@ -1434,14 +1434,11 @@ function appendCalendar(folderName, folderPath) {
else {
var calendarList = $("calendarList");
var lis = calendarList.childNodesWithTag("li");
var color = indexColor(lis.length + 100);
//log ("color: " + color);
var li = document.createElement("li");
// Add the calendar to the proper place
var previousOwner = null;
for (var i = 1; i < lis.length; i++) {
for (var i = 0; i < lis.length; i++) {
var currentFolderName = lis[i].lastChild.nodeValue.strip();
var currentOwner = lis[i].readAttribute('owner');
if (currentOwner == owner) {
@@ -1461,6 +1458,29 @@ function appendCalendar(folderName, folderPath) {
li.setAttribute("id", folderPath);
li.setAttribute("owner", owner);
// Generate new color
var colorTable = [1, 1, 1];
var color;
var currentValue = lis.length + 1;
var index = 0;
while (currentValue) {
if (currentValue & 1)
colorTable[index]++;
if (index == 3)
index = 0;
currentValue >>= 1;
index++;
}
colorTable[0] = parseInt(255 / colorTable[0]) - 1;
colorTable[1] = parseInt(255 / colorTable[1]) - 1;
colorTable[2] = parseInt(255 / colorTable[2]) - 1;
color = "#"
+ colorTable[2].toString(16)
+ colorTable[1].toString(16)
+ colorTable[0].toString(16);
//log ("color = " + color);
var checkBox = document.createElement("input");
checkBox.setAttribute("type", "checkbox");
li.appendChild(checkBox);