Monotone-Parent: 487cdad3dbd4c7d9c8e79989636b26cefcde1b80

Monotone-Revision: 7d00dc40e4703750dc10ef05910f0c4d9a7162fb

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-04-02T19:27:46
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-04-02 19:27:46 +00:00
parent 3e468870ac
commit 1445ac4d5b
5 changed files with 77 additions and 63 deletions
+3
View File
@@ -1,5 +1,8 @@
2007-04-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor
-calendarList]): new method replacing "availableCalendars".
* UI/Scheduler/UIxCalendarSelector.m ([UIxCalendarSelector
-calendarFolders]): we now take the list of subscribed calendar
from the container.
+1 -3
View File
@@ -41,6 +41,7 @@
id item;
NSString *saveURL;
NSMutableArray *calendarList;
/* individual values */
NSCalendarDate *cycleUntilDate;
@@ -125,9 +126,6 @@
- (void) setIsCycleEndUntil;
- (void) setIsCycleEndNever;
- (NSString *) componentOwner;
- (NSArray *) availableCalendars;
/* access */
- (BOOL) isMyComponent;
- (BOOL) canEditComponent;
+48 -35
View File
@@ -42,6 +42,7 @@
#import <SOGo/AgenorUserManager.h>
#import <SOGo/SOGoUser.h>
#import <SOGoUI/SOGoDateFormatter.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SoObjects/Appointments/SOGoTaskObject.h>
@@ -62,6 +63,7 @@
organizer = nil;
attendeesNames = nil;
attendeesEmails = nil;
calendarList = nil;
}
return self;
@@ -82,6 +84,7 @@
[url release];
[attendeesNames release];
[attendeesEmails release];
[calendarList release];
[super dealloc];
}
@@ -293,7 +296,51 @@
- (NSString *) itemCategoryText
{
return [self labelForKey: [NSString stringWithFormat: @"category_%@", item]];
return [self labelForKey:
[NSString stringWithFormat: @"category_%@", item]];
}
- (NSArray *) calendarList
{
SOGoAppointmentFolder *folder;
NSEnumerator *allCalendars;
NSDictionary *currentCalendar;
if (!calendarList)
{
calendarList = [NSMutableArray new];
folder = [[self clientObject] container];
allCalendars
= [[folder calendarFoldersInContext: context] objectEnumerator];
currentCalendar = [allCalendars nextObject];
while (currentCalendar)
{
if ([[currentCalendar objectForKey: @"active"] boolValue])
[calendarList addObject: currentCalendar];
currentCalendar = [allCalendars nextObject];
}
}
return calendarList;
}
- (NSString *) itemCalendarText
{
return item;
}
- (NSString *) calendarsFoldersList
{
NSArray *calendars;
calendars = [[self calendarList] valueForKey: @"folder"];
return [calendars componentsJoinedByString: @","];
}
- (NSString *) componentCalendar
{
return @"/";
}
/* priorities */
@@ -706,40 +753,6 @@
/* contact editor compatibility */
- (NSArray *) availableCalendars
{
NSEnumerator *rawContacts;
NSString *list, *currentId;
NSMutableArray *calendars;
SOGoUser *user;
calendars = [NSMutableArray array];
user = [context activeUser];
list = [[user userDefaults] stringForKey: @"calendaruids"];
if ([list length] == 0)
list = [self shortUserNameForDisplay];
rawContacts
= [[list componentsSeparatedByString: @","] objectEnumerator];
currentId = [rawContacts nextObject];
while (currentId)
{
if ([currentId hasPrefix: @"-"])
[calendars addObject: [currentId substringFromIndex: 1]];
else
[calendars addObject: currentId];
currentId = [rawContacts nextObject];
}
return calendars;
}
- (NSString *) componentOwner
{
return componentOwner;
}
- (NSString *) urlButtonClasses
{
NSString *classes;
@@ -42,9 +42,11 @@
label:noSelectionString="category_NONE"
string="itemCategoryText" selection="category"
/><var:string label:value="Calendar:" />
<var:popup list="availableCalendars" item="item"
const:onChange="onChangeCalendar(this);"
string="item" selection="componentOwner" /></span></span>
<var:popup const:id="calendarList"
list="calendarList" item="item"
string="item.displayName"
selection="componentCalendar"
/></span></span>
<label id="attendeesLabel" style="display: none;"><var:string label:value="Attendees:"
/><span class="content"
><a href="#" id="attendeesHref"><!-- space --></a></span></label>
@@ -68,28 +70,9 @@
var:value="attendeesNames"/>
<input type="hidden" name="attendeesEmails" id="attendeesEmails"
var:value="attendeesEmails"/>
<!-- <label><var:string label:value="Privacy" />
<span class="content"><var:popup list="privacyClasses" item="item"
string="itemPrivacyText" selection="privacy"
/></span></label>
<label><var:string label:value="Priority" />
<span class="content"><var:popup list="priorities" item="item"
string="itemPriorityText" selection="priority"
/></span></label>
<label><var:string label:value="Status" />
<span class="content"><var:popup list="statusTypes" item="item"
string="itemStatusText" selection="status"
/></span></label>
<hr /> -->
<!-- <label id="urlArea"><var:string label:value="URL" />
<span class="content"><input type="text" name="url" id="url"
size="40"
onkeyup="validateBrowseURL(this);"
class="textField"
var:value="url"
/><a id="browseUrlBtn" var:class="urlButtonClasses" var:href="#" onclick="return browseUrl(this, event);"><var:string value="Browse URL" /><var:string label:value="Browse URL" /></a
></span></label> -->
<input type="hidden" name="calendarFoldersList"
id="calendarFoldersList"
var:value="calendarsFoldersList"/>
</div>
</form>
</var:component>
@@ -67,6 +67,22 @@ function onMenuSetClassification(event, classification) {
privacyInput.value = classification;
}
function onChangeCalendar(event) {
var calendars = $("calendarFoldersList").value.split(",");
var form = document.forms["editform"];
var urlElems = form.getAttribute("action").split("/");
var choice = calendars[this.value];
var ownerLogin;
if (choice.indexOf(":") > -1)
ownerLogin = choice.split(":")[0];
else
ownerLogin = UserLogin;
urlElems[urlElems.length-4] = ownerLogin;
form.setAttribute("action", urlElems.join("/"));
log ("after: " + form.getAttribute("action"));
}
function refreshAttendees() {
var attendeesLabel = $("attendeesLabel");
var attendeesNames = $("attendeesNames");
@@ -137,4 +153,5 @@ function onComponentEditorLoad(event) {
initializeAttendeesHref();
initializeDocumentHref();
initializePrivacyMenu();
$("calendarList").addEventListener("change", onChangeCalendar, false);
}