From a27f106a4ada9fdc7101579a9de355607e3f54cb Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 4 Aug 2015 13:52:31 -0400 Subject: [PATCH] (fix) pimped ical viewer --- UI/MailPartViewers/UIxMailPartICalViewer.h | 2 - UI/MailPartViewers/UIxMailPartICalViewer.m | 73 ++++++++----------- .../MailPartViewers/UIxMailPartICalViewer.wox | 37 ++++------ .../js/Mailer/Message.service.js | 11 ++- .../js/Mailer/sgIMIP.directive.js | 2 +- .../scss/components/icon/icon.scss | 2 +- 6 files changed, 58 insertions(+), 69 deletions(-) diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.h b/UI/MailPartViewers/UIxMailPartICalViewer.h index 98a2019a0..e0383005a 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.h +++ b/UI/MailPartViewers/UIxMailPartICalViewer.h @@ -32,9 +32,7 @@ { iCalCalendar *inCalendar; iCalEvent *inEvent; - id attendee; SOGoDateFormatter *dateFormatter; - id item; SOGoAppointmentObject *storedEventObject; BOOL storedEventFetched; iCalEvent *storedEvent; diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index 210ec76b5..0cddac5b0 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -59,8 +59,6 @@ { [storedEventObject release]; [storedEvent release]; - [attendee release]; - [item release]; [inCalendar release]; [dateFormatter release]; [super dealloc]; @@ -75,10 +73,6 @@ [inCalendar release]; inCalendar = nil; [storedEventObject release]; storedEventObject = nil; [storedEvent release]; storedEvent = nil; - - /* not strictly path-related, but useless without it anyway: */ - [attendee release]; attendee = nil; - [item release]; item = nil; } /* accessors */ @@ -127,18 +121,6 @@ return dateFormatter; } -/* below is copied from UIxAppointmentView, can we avoid that? */ - -- (void) setAttendee: (id) _attendee -{ - ASSIGN (attendee, _attendee); -} - -- (id) attendee -{ - return attendee; -} - - (NSString *) _personForDisplay: (iCalPerson *) person { NSString *fn, *email, *result; @@ -147,28 +129,13 @@ email = [person rfc822Email]; if ([fn length]) result = [NSString stringWithFormat: @"%@ <%@>", - fn, email]; + fn, email]; else result = email; return result; } -- (NSString *) attendeeForDisplay -{ - return [self _personForDisplay: attendee]; -} - -- (void) setItem: (id) _item -{ - ASSIGN(item, _item); -} - -- (id) item -{ - return item; -} - - (NSCalendarDate *) startCalendarDate { NSCalendarDate *date; @@ -434,15 +401,6 @@ return [[self authorativeEvent] userIsAttendee: [context activeUser]]; } -- (NSString *) currentAttendeeClass -{ - NSString *cssClass; - - cssClass = [[attendee partStatWithDefault] lowercaseString]; - - return [NSString stringWithFormat: @"sg-%@", cssClass]; -} - /* derived fields */ - (NSString *) organizerDisplayName @@ -571,4 +529,33 @@ != NSOrderedAscending)); } +- (id) renderedPart +{ + NSMutableDictionary *d; + NSArray *participants; + iCalPerson *person; + NSMutableArray *a; + int i; + + d = [NSMutableDictionary dictionaryWithDictionary: [super renderedPart]]; + + // We also add our participants + participants = [[self authorativeEvent] participants]; + a = [NSMutableArray array]; + + for (i = 0; i < [participants count]; i++) + { + person = [participants objectAtIndex: i]; + + if (![[person delegatedTo] length]) + [a addObject: [NSDictionary dictionaryWithObjectsAndKeys: ([person cnWithoutQuotes] ? [person cnWithoutQuotes] : [person rfc822Email]), @"name", + [person rfc822Email], @"email", + [[person partStatWithDefault] lowercaseString], @"status", nil]]; + } + + [d setObject: a forKey: @"participants"]; + + return d; +} + @end /* UIxMailPartICalViewer */ diff --git a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox index c0125be7e..c96f3fd8f 100644 --- a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox +++ b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox @@ -243,28 +243,23 @@ - - - -
- -
- - - -
-
-
-

-

( , )

-
-
-
-
-
- + + +
+ + + + +
{{$chip.name}}
+
{{$chip.name}}
+ +
+
+
diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js index e4aa2dcf1..bc9e367ed 100644 --- a/UI/WebServerResources/js/Mailer/Message.service.js +++ b/UI/WebServerResources/js/Mailer/Message.service.js @@ -35,12 +35,13 @@ * @desc The factory we'll use to register with Angular * @returns the Message constructor */ - Message.$factory = ['$q', '$timeout', '$log', '$sce', 'sgSettings', 'Resource', 'Preferences', function($q, $timeout, $log, $sce, Settings, Resource, Preferences) { + Message.$factory = ['$q', '$timeout', '$log', '$sce', 'sgSettings', 'Gravatar', 'Resource', 'Preferences', function($q, $timeout, $log, $sce, Settings, Gravatar, Resource, Preferences) { angular.extend(Message, { $q: $q, $timeout: $timeout, $log: $log, $sce: $sce, + $gravatar: Gravatar, $$resource: new Resource(Settings.activeUser('folderURL') + 'Mail', Settings.activeUser()) }); // Initialize tags form user's defaults @@ -222,6 +223,14 @@ else if (part.type == 'UIxMailPartICalViewer' || part.type == 'UIxMailPartImageViewer' || part.type == 'UIxMailPartLinkViewer') { + + // UIxMailPartICalViewer injects 'participants' + if (part.participants) { + _.each(part.participants, function(participant) { + participant.image = Message.$gravatar(participant.email, 32); + }); + } + // Trusted content that can be compiled (Angularly-speaking) part.compile = true; parts.push(part); diff --git a/UI/WebServerResources/js/Mailer/sgIMIP.directive.js b/UI/WebServerResources/js/Mailer/sgIMIP.directive.js index 1078e11ae..8da553a2e 100644 --- a/UI/WebServerResources/js/Mailer/sgIMIP.directive.js +++ b/UI/WebServerResources/js/Mailer/sgIMIP.directive.js @@ -47,7 +47,7 @@ }; } - $scope.message.$imipAction(vm.pathToAttachment, action, data); + $scope.viewer.message.$imipAction(vm.pathToAttachment, action, data); }; } diff --git a/UI/WebServerResources/scss/components/icon/icon.scss b/UI/WebServerResources/scss/components/icon/icon.scss index 70adfb3dd..67b85e08e 100644 --- a/UI/WebServerResources/scss/components/icon/icon.scss +++ b/UI/WebServerResources/scss/components/icon/icon.scss @@ -71,10 +71,10 @@ md-icon { &.icon-arrow-forward:before { content: "\e5c8"; } + &.icon-accepted:before, &.icon-check:before { content: "\e5ca"; } - &.icon-accepted:before, &.icon-clear:before { content: "\e14c"; }