(fix) pimped ical viewer

pull/95/merge
Ludovic Marcotte 2015-08-04 13:52:31 -04:00
parent 95a360dd36
commit a27f106a4a
6 changed files with 58 additions and 69 deletions

View File

@ -32,9 +32,7 @@
{
iCalCalendar *inCalendar;
iCalEvent *inEvent;
id attendee;
SOGoDateFormatter *dateFormatter;
id item;
SOGoAppointmentObject *storedEventObject;
BOOL storedEventFetched;
iCalEvent *storedEvent;

View File

@ -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 */

View File

@ -243,28 +243,23 @@
<var:string value="formattedDateTime"/>
</div>
</div>
<md-list>
<header class="sg-md-subheader">
<var:string label:value="Attendees"/>
</header>
<var:foreach list="authorativeEvent.participants"
item="attendee">
<var:if condition="attendee.delegatedTo" const:negate="YES">
<md-list-item>
<div layout="row" layout-align="start center">
<div var:class="currentAttendeeClass"><!-- accepted/declided/tentative/delegated --></div>
<div class="md-list-item-text">
<p><a var:href="attendee.email"><var:string value="attendeeForDisplay"/></a></p>
<p>(<var:string label:value="$attendee.partStatWithDefault" /><var:if condition="attendee.delegatedTo"> <var:string label:value="to" /> <var:string value="attendee.delegatedTo.rfc822Email" /></var:if><var:if condition="attendee.delegatedFrom.length">, <var:string label:value="delegated from" /> <var:string value="attendee.delegatedFrom.rfc822Email" /></var:if>)</p>
</div>
</div>
</md-list-item>
</var:if>
</var:foreach>
<!-- ATTENDEES -->
<md-list>
<div class="pseudo-input-container">
<label class="pseudo-input-label"><var:string label:value="Attendees"/></label>
<!-- md-contact-chips don't support "readonly", so we build them using md-chips
in readonly mode and a template similar to the one of md-contact-chips -->
<md-chips class="md-contact-chips"
ng-model="part.participants"
readonly="true">
<md-chip-template>
<div class="md-contact-avatar"><img src="#" ng-src="{{$chip.image}}" alt="{{$chip.name}}"/></div>
<div class="md-contact-name">{{$chip.name}}</div>
<md-icon ng-class="'icon-' + $chip.status"><!-- partstat --></md-icon>
</md-chip-template>
</md-chips>
</div>
</md-list>
<var:if condition="authorativeEvent.comment.isNotEmpty">

View File

@ -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);

View File

@ -47,7 +47,7 @@
};
}
$scope.message.$imipAction(vm.pathToAttachment, action, data);
$scope.viewer.message.$imipAction(vm.pathToAttachment, action, data);
};
}

View File

@ -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";
}