diff --git a/ChangeLog b/ChangeLog index 47e5e8a93..a274bf3a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-07-22 Cyril Robert + + * UI/Scheduler/UIxCalListingActions.m: Added "editable" field to tasks, so + that the UI can disable the checkboxes next to them. + 2009-07-22 Wolfgang Sourdeau * SoObjects/Appointments/SOGoUserFolder+Appointments.m diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 4e8ff69da..f6d226ee5 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -86,7 +86,7 @@ static NSArray *tasksFields = nil; { tasksFields = [NSArray arrayWithObjects: @"c_name", @"c_folder", @"c_status", @"c_title", @"c_enddate", - @"c_classification", nil]; + @"c_classification", @"editable", nil]; [tasksFields retain]; } } @@ -311,6 +311,7 @@ static NSArray *tasksFields = nil; NSMutableArray *infos; NSNull *marker; SOGoAppointmentFolders *clientObject; + NSString *role; infos = [NSMutableArray array]; @@ -333,12 +334,26 @@ static NSArray *tasksFields = nil; while ((newInfo = [currentInfos nextObject])) { + if ([fields containsObject: @"editable"]) + { + role = + [currentFolder roleForComponentsWithAccessClass: + [[newInfo objectForKey: @"c_classification"] intValue] + forUser: [[context activeUser] login]]; + if ([role isEqualToString: @"ComponentModifier"] + || [role length] == 0) + [newInfo setObject: [NSNumber numberWithInt: 1] + forKey: @"editable"]; + else + [newInfo setObject: [NSNumber numberWithInt: 0] + forKey: @"editable"]; + } [newInfo setObject: [currentFolder nameInContainer] forKey: @"c_folder"]; [newInfo setObject: [currentFolder ownerInContext: context] forKey: @"c_owner"]; if (![[newInfo objectForKey: @"c_title"] length]) - [self _fixComponentTitle: newInfo withType: component]; + [self _fixComponentTitle: newInfo withType: component]; // Possible improvement: only call _fixDates if event is recurrent // or the view range span a daylight saving time change [self _fixDates: newInfo]; diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 267529682..66c27ea0f 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -664,12 +664,14 @@ function tasksListCallback(http) { var cname = escape(data[i][0]); listItem.setAttribute("id", calendar + "-" + cname); //listItem.addClassName(data[i][5]); // Classification - listItem.addClassName(data[i][6]); + listItem.addClassName(data[i][7]); listItem.calendar = calendar; listItem.addClassName("calendarFolder" + calendar); listItem.cname = cname; var input = $(document.createElement("input")); input.setAttribute("type", "checkbox"); + if (parseInt(data[i][6]) == 0) + input.setAttribute ("disabled", true); listItem.appendChild(input); input.observe("click", updateTaskStatus, true); input.setAttribute("value", "1");