From 1acef513bee3b2fc8055858174cf6ef04d98ef80 Mon Sep 17 00:00:00 2001 From: C Robert Date: Mon, 27 Jul 2009 12:48:27 +0000 Subject: [PATCH] Mantis 78 Monotone-Parent: 244b022b573e6f31bb6d274bcd23e14acd12414b Monotone-Revision: f9dd483f39d42723f222b997f3c1e66833300458 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-27T12:48:27 Monotone-Branch: ca.inverse.sogo --- .../Localizable.strings | 2 + UI/Scheduler/Czech.lproj/Localizable.strings | 2 + UI/Scheduler/Dutch.lproj/Localizable.strings | 2 + .../English.lproj/Localizable.strings | 2 + UI/Scheduler/French.lproj/Localizable.strings | 2 + UI/Scheduler/GNUmakefile | 3 +- UI/Scheduler/German.lproj/Localizable.strings | 3 + .../Italian.lproj/Localizable.strings | 2 + .../Russian.lproj/Localizable.strings | 2 + .../Spanish.lproj/Localizable.strings | 2 + UI/Scheduler/Toolbars/SOGoEmpty.toolbar | 2 + UI/Scheduler/UIxComponentEditor.m | 181 ++++++++++-------- UI/Scheduler/Welsh.lproj/Localizable.strings | 2 + .../SchedulerUI/UIxComponentEditor.wox | 150 ++++++++++----- .../UIxAppointmentEditor.css | 10 +- UI/WebServerResources/UIxAppointmentEditor.js | 46 ++++- UI/WebServerResources/UIxComponentEditor.css | 50 +++++ UI/WebServerResources/UIxComponentEditor.js | 103 +++++++--- 18 files changed, 403 insertions(+), 163 deletions(-) create mode 100644 UI/Scheduler/Toolbars/SOGoEmpty.toolbar diff --git a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings index de0399ff1..031061ba5 100755 --- a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings @@ -214,6 +214,8 @@ "Category:" = "Categoria:"; "Repeat:" = "Repetir:"; "Reminder:" = "Lembrete:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Target:"; diff --git a/UI/Scheduler/Czech.lproj/Localizable.strings b/UI/Scheduler/Czech.lproj/Localizable.strings index 88f769876..1827b8df2 100755 --- a/UI/Scheduler/Czech.lproj/Localizable.strings +++ b/UI/Scheduler/Czech.lproj/Localizable.strings @@ -214,6 +214,8 @@ "Category:" = "Kategorie:"; "Repeat:" = "Opakování:"; "Reminder:" = "Upomínka:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Cíl:"; diff --git a/UI/Scheduler/Dutch.lproj/Localizable.strings b/UI/Scheduler/Dutch.lproj/Localizable.strings index d64ae80aa..31eb61cac 100644 --- a/UI/Scheduler/Dutch.lproj/Localizable.strings +++ b/UI/Scheduler/Dutch.lproj/Localizable.strings @@ -208,6 +208,8 @@ "Category:" = "Categorie:"; "Repeat:" = "Herhalen:"; "Reminder:" = "Alarm:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Bestemming:"; diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 79d5d0274..49e3a15c8 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -214,6 +214,8 @@ "Category:" = "Category:"; "Repeat:" = "Repeat:"; "Reminder:" = "Reminder:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Target:"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index be9d8abc8..ca3fb1430 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -212,6 +212,8 @@ "Category:" = "Catégorie :"; "Repeat:" = "Répétition :"; "Reminder:" = "Rappel :"; +"General:" = "Général:"; +"Reply:" = "Réponse:"; "Target:" = "Destination :"; diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index 08b877da3..c3e07b952 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -57,7 +57,8 @@ SchedulerUI_RESOURCE_FILES += \ Toolbars/SOGoAppointmentObjectDecline.toolbar \ Toolbars/SOGoAppointmentObjectAcceptOrDecline.toolbar \ Toolbars/SOGoTaskObject.toolbar \ - Toolbars/SOGoComponentClose.toolbar + Toolbars/SOGoComponentClose.toolbar \ + Toolbars/SOGoEmpty.toolbar SchedulerUI_LOCALIZED_RESOURCE_FILES += \ Localizable.strings \ diff --git a/UI/Scheduler/German.lproj/Localizable.strings b/UI/Scheduler/German.lproj/Localizable.strings index 048e4e4c1..c24d1dcf5 100644 --- a/UI/Scheduler/German.lproj/Localizable.strings +++ b/UI/Scheduler/German.lproj/Localizable.strings @@ -211,6 +211,9 @@ "Category:" = "Kategorie:"; "Repeat:" = "Wiederholen:"; "Reminder:" = "Alarm:"; +"General:" = "General:"; +"Reply:" = "Reply:"; + "Target:" = "Destination :"; diff --git a/UI/Scheduler/Italian.lproj/Localizable.strings b/UI/Scheduler/Italian.lproj/Localizable.strings index d18b3187a..8e43ef8dc 100644 --- a/UI/Scheduler/Italian.lproj/Localizable.strings +++ b/UI/Scheduler/Italian.lproj/Localizable.strings @@ -213,6 +213,8 @@ "Category:" = "Categoria:"; "Repeat:" = "Ripeti:"; "Reminder:" = "Promemoria:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Percorso:"; diff --git a/UI/Scheduler/Russian.lproj/Localizable.strings b/UI/Scheduler/Russian.lproj/Localizable.strings index 4aa3389f2..40b0151b2 100644 --- a/UI/Scheduler/Russian.lproj/Localizable.strings +++ b/UI/Scheduler/Russian.lproj/Localizable.strings @@ -213,6 +213,8 @@ "Category:" = "Category:"; "Repeat:" = "Repeat:"; "Reminder:" = "Reminder:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Target:"; diff --git a/UI/Scheduler/Spanish.lproj/Localizable.strings b/UI/Scheduler/Spanish.lproj/Localizable.strings index 23c5b1bf2..294613865 100644 --- a/UI/Scheduler/Spanish.lproj/Localizable.strings +++ b/UI/Scheduler/Spanish.lproj/Localizable.strings @@ -218,6 +218,8 @@ "Category:" = "Categoría:"; "Repeat:" = "Repetir:"; "Reminder:" = "Recordatorio:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "URL documento:"; diff --git a/UI/Scheduler/Toolbars/SOGoEmpty.toolbar b/UI/Scheduler/Toolbars/SOGoEmpty.toolbar new file mode 100644 index 000000000..c97df27ee --- /dev/null +++ b/UI/Scheduler/Toolbars/SOGoEmpty.toolbar @@ -0,0 +1,2 @@ +( /* the toolbar groups -*-cperl-*- */ +) diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 0c0f10d9e..aa063c4f4 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -27,6 +27,7 @@ #import #import #import +#import #import #import @@ -793,6 +794,11 @@ iRANGE(2); return location; } +- (BOOL) hasLocation +{ + return [location length] > 0; +} + - (void) setComment: (NSString *) _value { ASSIGN (comment, _value); @@ -803,6 +809,11 @@ iRANGE(2); return comment; } +- (BOOL) hasComment +{ + return [comment length] > 0; +} + - (NSArray *) categoryList { NSMutableArray *categoryList; @@ -843,6 +854,11 @@ iRANGE(2); return category; } +- (BOOL) hasCategory +{ + return [category length] > 0; +} + - (NSArray *) repeatList { static NSArray *repeatItems = nil; @@ -935,6 +951,38 @@ iRANGE(2); ASSIGN(repeat, newRepeat); } +- (BOOL) hasRepeat +{ + return [repeat length] > 0; +} + +- (NSString *) itemReplyText +{ + NSString *word; + + if ([item intValue] == iCalPersonPartStatAccepted) + word = @"ACCEPTED"; + else if ([item intValue] == iCalPersonPartStatDeclined) + word = @"DECLINED"; + + return [self labelForKey: [NSString stringWithFormat: @"partStat_%@", word]]; +} + +- (NSArray *) replyList +{ + return [NSArray arrayWithObjects: + [NSNumber numberWithInt: iCalPersonPartStatAccepted], + [NSNumber numberWithInt: iCalPersonPartStatDeclined], nil]; +} + +- (NSNumber *) reply +{ + iCalPersonPartStat participationStatus; + + participationStatus = [[component findParticipant: [context activeUser]] participationStatus]; + return [NSNumber numberWithInt: participationStatus]; +} + - (NSString *) _permissionForEditing { NSString *perm; @@ -1013,6 +1061,11 @@ iRANGE(2); return componentCalendar; } +- (NSString *) componentCalendarName +{ + return [componentCalendar displayName]; +} + - (void) setComponentCalendar: (SOGoAppointmentFolder *) _componentCalendar { ASSIGN(componentCalendar, _componentCalendar); @@ -1048,6 +1101,11 @@ iRANGE(2); return priority; } +- (BOOL) hasPriority +{ + return [priority length] > 0; +} + - (NSArray *) privacyClasses { static NSArray *priorities = nil; @@ -1832,7 +1890,6 @@ RANGE(2); andClientObject: (SOGoContentObject *) clientObject { - iCalPersonPartStat participationStatus; NSString *toolbarFilename; BOOL isOrganizer; @@ -1844,9 +1901,7 @@ RANGE(2); isOrganizer = [component userIsOrganizer: ownerUser]; if (isOrganizer) - { - isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]]; - } + isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]]; if ([[component attendees] count] && [component userIsParticipant: ownerUser] @@ -1855,22 +1910,13 @@ RANGE(2); // so we also ignore the participation status of tasks in the // web interface. && ![[component tag] isEqualToString: @"VTODO"]) - { - participationStatus - = [[component findParticipant: ownerUser] participationStatus]; - if (participationStatus == iCalPersonPartStatAccepted) - toolbarFilename = @"SOGoAppointmentObjectDecline.toolbar"; - else if (participationStatus == iCalPersonPartStatDeclined) - toolbarFilename = @"SOGoAppointmentObjectAccept.toolbar"; - else - toolbarFilename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; - } + toolbarFilename = @"SOGoEmpty.toolbar"; else { if ([clientObject isKindOfClass: [SOGoAppointmentObject class]]) - toolbarFilename = @"SOGoAppointmentObject.toolbar"; + toolbarFilename = @"SOGoAppointmentObject.toolbar"; else - toolbarFilename = @"SOGoTaskObject.toolbar"; + toolbarFilename = @"SOGoTaskObject.toolbar"; } return toolbarFilename; @@ -1882,7 +1928,6 @@ RANGE(2); { SoSecurityManager *sm; NSString *toolbarFilename, *adminToolbar; - iCalPersonPartStat participationStatus; SOGoUser *currentUser; if ([clientObject isKindOfClass: [SOGoAppointmentObject class]]) @@ -1894,29 +1939,12 @@ RANGE(2); sm = [SoSecurityManager sharedSecurityManager]; if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent - onObject: clientObject - inContext: context]) + onObject: clientObject + inContext: context]) toolbarFilename = [self _toolbarForOwner: ownerUser - andClientObject: clientObject]; - else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent - onObject: clientObject - inContext: context] - && [[component attendees] count] - && [component userIsParticipant: ownerUser] - && ![component userIsOrganizer: ownerUser]) - { - participationStatus - = [[component findParticipant: ownerUser] participationStatus]; - /* Lightning does not manage participation status within tasks */ - if (participationStatus == iCalPersonPartStatAccepted) - toolbarFilename = @"SOGoAppointmentObjectDecline.toolbar"; - else if (participationStatus == iCalPersonPartStatDeclined) - toolbarFilename = @"SOGoAppointmentObjectAccept.toolbar"; - else - toolbarFilename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; - } + andClientObject: clientObject]; else - toolbarFilename = @"SOGoComponentClose.toolbar"; + toolbarFilename = @"SOGoEmpty.toolbar"; return toolbarFilename; } @@ -1943,11 +1971,12 @@ RANGE(2); } -- (BOOL) ownerIsAttendee: (SOGoUser *) ownerUser +- (int) ownerIsAttendee: (SOGoUser *) ownerUser andClientObject: (SOGoContentObject *) clientObject { - BOOL isOrganizer, rc = NO; + BOOL isOrganizer; + int rc = 0; isOrganizer = [component userIsOrganizer: ownerUser]; if (isOrganizer) @@ -1957,18 +1986,18 @@ RANGE(2); && [component userIsParticipant: ownerUser] && !isOrganizer && ![[component tag] isEqualToString: @"VTODO"]) - rc = YES; + rc = 1; return rc; } -- (BOOL) delegateIsAttendee: (SOGoUser *) ownerUser +- (int) delegateIsAttendee: (SOGoUser *) ownerUser andClientObject: (SOGoContentObject *) clientObject { SoSecurityManager *sm; SOGoUser *currentUser; - BOOL rc = NO; + int rc = 0; currentUser = [context activeUser]; sm = [SoSecurityManager sharedSecurityManager]; @@ -1984,18 +2013,18 @@ RANGE(2); && [[component attendees] count] && [component userIsParticipant: ownerUser] && ![component userIsOrganizer: ownerUser]) - rc = YES; + rc = 1; else - rc = YES; + rc = 2; // not invited, just RO return rc; } -- (BOOL) eventIsReadOnly +- (int) getEventRWType { SOGoContentObject *clientObject; SOGoUser *ownerUser; - BOOL rc = NO; + int rc = 0; clientObject = [self clientObject]; ownerUser = [SOGoUser userWithLogin: [clientObject ownerInContext: context] @@ -2008,14 +2037,22 @@ RANGE(2); rc = [self delegateIsAttendee: ownerUser andClientObject: clientObject]; - return rc; } -- (NSString *) startDateString +- (BOOL) eventIsReadOnly { - NSCalendarDate *startDate; - NSCalendarDate *firstDate; + return [self getEventRWType] != 0; +} + +- (BOOL) userIsAttendee +{ + return [self getEventRWType] == 1; +} + +- (NSCalendarDate *) getDateFor: (NSString *) when +{ + NSCalendarDate *startDate, *endDate, *firstDate, *rc; NSTimeZone *timeZone; iCalEvent *master; signed int daylightOffset; @@ -2037,39 +2074,25 @@ RANGE(2); } } [startDate setTimeZone: [[context activeUser] timeZone]]; + endDate = [[component endDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:daylightOffset]; + [endDate setTimeZone: [[context activeUser] timeZone]]; + + if ([when isEqualToString: @"start"]) + rc = startDate; + else + rc = endDate; - return [startDate description]; + return rc; +} + +- (NSString *) startDateString +{ + return [[self getDateFor: @"start"] description]; } - (NSString *) endDateString { - NSCalendarDate *startDate, *endDate; - NSCalendarDate *firstDate; - NSTimeZone *timeZone; - iCalEvent *master; - signed int daylightOffset; - - startDate = [component startDate]; - daylightOffset = 0; - - if ([component isKindOfClass: [SOGoAppointmentOccurence class]]) - { - master = (iCalEvent*)[[component parent] firstChildWithTag: @"vevent"]; - firstDate = [master startDate]; - timeZone = [[context activeUser] timeZone]; - - if ([timeZone isDaylightSavingTimeForDate: startDate] != [timeZone isDaylightSavingTimeForDate: firstDate]) - { - daylightOffset = (signed int)[timeZone secondsFromGMTForDate: firstDate] - - (signed int)[timeZone secondsFromGMTForDate: startDate]; - startDate = [startDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:daylightOffset]; - } - } - - endDate = [[component endDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:daylightOffset]; - [endDate setTimeZone: [[context activeUser] timeZone]]; - - return [endDate description]; + return [[self getDateFor: @"end"] description]; } @end diff --git a/UI/Scheduler/Welsh.lproj/Localizable.strings b/UI/Scheduler/Welsh.lproj/Localizable.strings index 13f751449..9316e39bd 100644 --- a/UI/Scheduler/Welsh.lproj/Localizable.strings +++ b/UI/Scheduler/Welsh.lproj/Localizable.strings @@ -214,6 +214,8 @@ "Category:" = "Categori:"; "Repeat:" = "Ailwneud:"; "Reminder:" = "Atgoffa:"; +"General:" = "General:"; +"Reply:" = "Reply:"; "Target:" = "Targed:"; diff --git a/UI/Templates/SchedulerUI/UIxComponentEditor.wox b/UI/Templates/SchedulerUI/UIxComponentEditor.wox index 8692dd7ef..32c44a2ba 100644 --- a/UI/Templates/SchedulerUI/UIxComponentEditor.wox +++ b/UI/Templates/SchedulerUI/UIxComponentEditor.wox @@ -168,60 +168,100 @@ -
- - - - - - - - -
- - - - -
- - + + + + + + + - - --> + +
+
+ + +
+ +
+ + +
+
+ - + >x--> @@ -281,7 +321,15 @@ + +
+ + + + +
-
diff --git a/UI/WebServerResources/UIxAppointmentEditor.css b/UI/WebServerResources/UIxAppointmentEditor.css index 8e4be68a7..21ae90d28 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.css +++ b/UI/WebServerResources/UIxAppointmentEditor.css @@ -121,20 +121,22 @@ A#attendeesHref { color: #00f; text-decoration: underline; } -DIV#attendeesMenu LI +DIV#attendeesMenu * { padding-left: 20px; } -DIV#attendeesMenu LI.accepted +DIV# + +DIV#attendeesMenu .accepted { background-image: url("accepted.png"); background-repeat: no-repeat; background-position: 5px center; } -DIV#attendeesMenu LI.needs-action +DIV#attendeesMenu .needs-action { background-image: url("needs-action.png"); background-repeat: no-repeat; background-position: 5px center; } -DIV#attendeesMenu LI.declined +DIV#attendeesMenu .declined { background-image: url("declined.png"); background-repeat: no-repeat; background-position: 5px center; } diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js index d7431327b..0645f4e3c 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ b/UI/WebServerResources/UIxAppointmentEditor.js @@ -334,15 +334,55 @@ function initTimeWidgets(widgets) { } } +function refreshAttendeesRO () { + var attendeesNames = $("attendeesNames").value; + var attendeesEmails = $("attendeesEmails").value.split(","); + var attendeesStates = $("attendeesStates").value.split(","); + var attendeesMenu = $("attendeesMenu"); + + if (attendeesMenu) { + for (var i = 0; i < attendeesMenu.childNodes.length; i++) + attendeesMenu.removeChild (attendeesMenu.childNodes[i]); + } + + if (attendeesNames.length > 0) { + // Update attendees link and show label + attendeesLabel.setStyle({ display: "block" }); + + // Update attendees in menu + attendeesNames = attendeesNames.split(","); + for (var i = 0; i < attendeesEmails.length; i++) { + var node = document.createElement("div"); + if (attendeesMenu) + attendeesMenu.appendChild(node); + $(node).writeAttribute("email", attendeesEmails[i]); + $(node).addClassName("attendee"); + $(node).addClassName(attendeesStates[i]); + node.appendChild(document.createTextNode(attendeesNames[i])); + $(node).observe("click", onMailTo); + } + } + else { + // Hide link of attendees + attendeesLabel.setStyle({ display: "none" }); + if ($("attendeesDiv")) + $("attendeesDiv").setStyle({display: "none"}); + } + +} + function refreshAttendees() { var attendeesLabel = $("attendeesLabel"); var attendeesNames = $("attendeesNames").value; var attendeesEmails = $("attendeesEmails").value.split(","); var attendeesStates = $("attendeesStates").value.split(","); var attendeesHref = $("attendeesHref"); - var attendeesMenu = null; + var attendeesMenu = $("attendeesMenu"); - if ($("attendeesMenu")) + if (!attendeesHref) + return refreshAttendeesRO (); + + if (attendeesMenu) attendeesMenu = $("attendeesMenu").down("ul"); // Remove link of attendees @@ -384,7 +424,7 @@ function initializeAttendeesHref() { var attendeesLabel = $("attendeesLabel"); var attendeesNames = $("attendeesNames"); - if (!attendeesHref.hasClassName ("nomenu")) + if (attendeesHref && !attendeesHref.hasClassName ("nomenu")) attendeesHref.observe("click", onAttendeesHrefClick, false); refreshAttendees(); } diff --git a/UI/WebServerResources/UIxComponentEditor.css b/UI/WebServerResources/UIxComponentEditor.css index b755696a4..1ed3b289d 100644 --- a/UI/WebServerResources/UIxComponentEditor.css +++ b/UI/WebServerResources/UIxComponentEditor.css @@ -41,3 +41,53 @@ LABEL#commentArea textarea padding: 0px; margin: 0px; margin-left: 1px; } + +SPAN.headerContent +{ + width: 80%; + height: 1px; + background: #aaaaaa; + top: 0.9em; +} +LABEL.title +{ + margin-top: 20px; + font-weight: bold; +} +LABEL.titleNoSpace +{ + margin-top: 0px; +} + +DIV#windowButtons +{ + width: 100%; + position: absolute; + bottom: 4em; +} + +LABEL.calendarName +{ text-align: right; + margin-top: 10px; + margin-bottom: 10px; + width: 97%; +} + +DIV#attendeesMenu +{ overflow: auto; } + +DIV.fakeTextArea +{ overflow: auto; + background: white; + border-width: 2px; + border-style: inset; + padding: 2px; + height: 100%; +} + +DIV#descriptionDiv { + height: 80px; +} +SPAN.fixedHeight { + height: 60px; +} diff --git a/UI/WebServerResources/UIxComponentEditor.js b/UI/WebServerResources/UIxComponentEditor.js index 4c60e8e17..b8fed7a94 100644 --- a/UI/WebServerResources/UIxComponentEditor.js +++ b/UI/WebServerResources/UIxComponentEditor.js @@ -138,15 +138,21 @@ function onComponentEditorLoad(event) { false); } - $("repeatHref").observe("click", onPopupRecurrenceWindow); - if ($("repeatList")) - $("repeatList").observe("change", onPopupRecurrenceWindow); - if ($("reminderHref")) - $("reminderHref").observe("click", onPopupReminderWindow); - if ($("reminderList")) - $("reminderList").observe("change", onPopupReminderWindow); - if ($("summary")) - $("summary").observe("keyup", onSummaryChange); + var tmp = $("repeatHref"); + if (tmp) + tmp.observe("click", onPopupRecurrenceWindow); + tmp = $("repeatList"); + if (tmp) + tmp.observe("change", onPopupRecurrenceWindow); + tmp = $("reminderHref"); + if (tmp) + tmp.observe("click", onPopupReminderWindow); + tmp = $("reminderList"); + if (tmp) + tmp.observe("change", onPopupReminderWindow); + tmp = $("summary"); + if (tmp) + tmp.observe("keyup", onSummaryChange); Event.observe(window, "resize", onWindowResize); @@ -159,6 +165,18 @@ function onComponentEditorLoad(event) { summary.focus(); summary.selectText(0, summary.value.length); } + + tmp = $("okButton"); + if (tmp) + tmp.observe ("click", onOkButtonClick); + tmp = $("cancelButton"); + if (tmp) + tmp.observe ("click", onCancelButtonClick); + + if (tmp) + window.resizeTo(430,540) + + } function onSummaryChange (e) { @@ -169,22 +187,37 @@ function onSummaryChange (e) { function onWindowResize(event) { var document = $("documentLabel"); var comment = $("commentArea"); - var area = comment.select("textarea").first(); - var offset = 6; - var height; + if (comment) { + var area = comment.select("textarea").first(); + var offset = 6; + var height; - height = window.height() - comment.cumulativeOffset().top - offset; + height = window.height() - comment.cumulativeOffset().top - offset; - if (document.visible()) { - if ($("changeAttachButton")) - height -= $("changeAttachButton").getHeight(); - else - height -= $("documentHref").getHeight(); - } + if (document.visible()) { + if ($("changeAttachButton")) + height -= $("changeAttachButton").getHeight(); + else + height -= $("documentHref").getHeight(); + } - if (area) - area.setStyle({ height: (height - offset*2) + "px" }); - comment.setStyle({ height: (height - offset) + "px" }); + if (area) + area.setStyle({ height: (height - offset*2) + "px" }); + comment.setStyle({ height: (height - offset) + "px" }); + } + else { + $("eventView").style.height = window.height () + "px"; + var height = window.height() - 120; + var tmp = $("generalDiv"); + if (tmp) + height -= tmp.offsetHeight; + tmp = $("descriptionDiv"); + if (tmp) + height -= tmp.offsetHeight; + + $("attendeesDiv").style.height = height + "px"; + $("attendeesMenu").style.height = (height - 20) + "px"; + } return true; } @@ -195,13 +228,14 @@ function onPopupRecurrenceWindow(event) { var repeatHref = $("repeatHref"); - if ($("repeatList") && $("repeatList").value == 7) { + var repeatList = $("repeatList"); + if (repeatList && repeatList.value == 7) { repeatHref.show(); if (event) window.open(ApplicationBaseURL + "editRecurrence", null, "width=500,height=400"); } - else + else if (repeatHref) repeatHref.hide(); return false; @@ -213,7 +247,8 @@ function onPopupReminderWindow(event) { var reminderHref = $("reminderHref"); - if ($("reminderList") && $("reminderList").value == 15) { + var reminderList = $("reminderList"); + if (reminderList && reminderList.value == 15) { reminderHref.show(); if (event) window.open(ApplicationBaseURL + "editReminder", null, @@ -225,4 +260,22 @@ function onPopupReminderWindow(event) { return false; } +function onOkButtonClick (e) { + var item = $("replyList"); + var value = parseInt(item.options[item.selectedIndex].value); + var action = ""; + + if (value == 0) + action = 'accept'; + else if (value == 1) + action = 'decline'; + + if (action != "") + modifyEvent (item, action); +} + +function onCancelButtonClick (e) { + window.close (); +} + document.observe("dom:loaded", onComponentEditorLoad);