(fix) pimped ical viewer
This commit is contained in:
parent
95a360dd36
commit
a27f106a4a
|
@ -32,9 +32,7 @@
|
||||||
{
|
{
|
||||||
iCalCalendar *inCalendar;
|
iCalCalendar *inCalendar;
|
||||||
iCalEvent *inEvent;
|
iCalEvent *inEvent;
|
||||||
id attendee;
|
|
||||||
SOGoDateFormatter *dateFormatter;
|
SOGoDateFormatter *dateFormatter;
|
||||||
id item;
|
|
||||||
SOGoAppointmentObject *storedEventObject;
|
SOGoAppointmentObject *storedEventObject;
|
||||||
BOOL storedEventFetched;
|
BOOL storedEventFetched;
|
||||||
iCalEvent *storedEvent;
|
iCalEvent *storedEvent;
|
||||||
|
|
|
@ -59,8 +59,6 @@
|
||||||
{
|
{
|
||||||
[storedEventObject release];
|
[storedEventObject release];
|
||||||
[storedEvent release];
|
[storedEvent release];
|
||||||
[attendee release];
|
|
||||||
[item release];
|
|
||||||
[inCalendar release];
|
[inCalendar release];
|
||||||
[dateFormatter release];
|
[dateFormatter release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -75,10 +73,6 @@
|
||||||
[inCalendar release]; inCalendar = nil;
|
[inCalendar release]; inCalendar = nil;
|
||||||
[storedEventObject release]; storedEventObject = nil;
|
[storedEventObject release]; storedEventObject = nil;
|
||||||
[storedEvent release]; storedEvent = nil;
|
[storedEvent release]; storedEvent = nil;
|
||||||
|
|
||||||
/* not strictly path-related, but useless without it anyway: */
|
|
||||||
[attendee release]; attendee = nil;
|
|
||||||
[item release]; item = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* accessors */
|
/* accessors */
|
||||||
|
@ -127,18 +121,6 @@
|
||||||
return dateFormatter;
|
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 *) _personForDisplay: (iCalPerson *) person
|
||||||
{
|
{
|
||||||
NSString *fn, *email, *result;
|
NSString *fn, *email, *result;
|
||||||
|
@ -147,28 +129,13 @@
|
||||||
email = [person rfc822Email];
|
email = [person rfc822Email];
|
||||||
if ([fn length])
|
if ([fn length])
|
||||||
result = [NSString stringWithFormat: @"%@ <%@>",
|
result = [NSString stringWithFormat: @"%@ <%@>",
|
||||||
fn, email];
|
fn, email];
|
||||||
else
|
else
|
||||||
result = email;
|
result = email;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) attendeeForDisplay
|
|
||||||
{
|
|
||||||
return [self _personForDisplay: attendee];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setItem: (id) _item
|
|
||||||
{
|
|
||||||
ASSIGN(item, _item);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) item
|
|
||||||
{
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSCalendarDate *) startCalendarDate
|
- (NSCalendarDate *) startCalendarDate
|
||||||
{
|
{
|
||||||
NSCalendarDate *date;
|
NSCalendarDate *date;
|
||||||
|
@ -434,15 +401,6 @@
|
||||||
return [[self authorativeEvent] userIsAttendee: [context activeUser]];
|
return [[self authorativeEvent] userIsAttendee: [context activeUser]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) currentAttendeeClass
|
|
||||||
{
|
|
||||||
NSString *cssClass;
|
|
||||||
|
|
||||||
cssClass = [[attendee partStatWithDefault] lowercaseString];
|
|
||||||
|
|
||||||
return [NSString stringWithFormat: @"sg-%@", cssClass];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* derived fields */
|
/* derived fields */
|
||||||
|
|
||||||
- (NSString *) organizerDisplayName
|
- (NSString *) organizerDisplayName
|
||||||
|
@ -571,4 +529,33 @@
|
||||||
!= NSOrderedAscending));
|
!= 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 */
|
@end /* UIxMailPartICalViewer */
|
||||||
|
|
|
@ -244,27 +244,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- ATTENDEES -->
|
||||||
<md-list>
|
<md-list>
|
||||||
|
<div class="pseudo-input-container">
|
||||||
<header class="sg-md-subheader">
|
<label class="pseudo-input-label"><var:string label:value="Attendees"/></label>
|
||||||
<var:string label:value="Attendees"/>
|
<!-- md-contact-chips don't support "readonly", so we build them using md-chips
|
||||||
</header>
|
in readonly mode and a template similar to the one of md-contact-chips -->
|
||||||
|
<md-chips class="md-contact-chips"
|
||||||
<var:foreach list="authorativeEvent.participants"
|
ng-model="part.participants"
|
||||||
item="attendee">
|
readonly="true">
|
||||||
<var:if condition="attendee.delegatedTo" const:negate="YES">
|
<md-chip-template>
|
||||||
<md-list-item>
|
<div class="md-contact-avatar"><img src="#" ng-src="{{$chip.image}}" alt="{{$chip.name}}"/></div>
|
||||||
<div layout="row" layout-align="start center">
|
<div class="md-contact-name">{{$chip.name}}</div>
|
||||||
<div var:class="currentAttendeeClass"><!-- accepted/declided/tentative/delegated --></div>
|
<md-icon ng-class="'icon-' + $chip.status"><!-- partstat --></md-icon>
|
||||||
<div class="md-list-item-text">
|
</md-chip-template>
|
||||||
<p><a var:href="attendee.email"><var:string value="attendeeForDisplay"/></a></p>
|
</md-chips>
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
</md-list-item>
|
|
||||||
</var:if>
|
|
||||||
</var:foreach>
|
|
||||||
|
|
||||||
</md-list>
|
</md-list>
|
||||||
|
|
||||||
<var:if condition="authorativeEvent.comment.isNotEmpty">
|
<var:if condition="authorativeEvent.comment.isNotEmpty">
|
||||||
|
|
|
@ -35,12 +35,13 @@
|
||||||
* @desc The factory we'll use to register with Angular
|
* @desc The factory we'll use to register with Angular
|
||||||
* @returns the Message constructor
|
* @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, {
|
angular.extend(Message, {
|
||||||
$q: $q,
|
$q: $q,
|
||||||
$timeout: $timeout,
|
$timeout: $timeout,
|
||||||
$log: $log,
|
$log: $log,
|
||||||
$sce: $sce,
|
$sce: $sce,
|
||||||
|
$gravatar: Gravatar,
|
||||||
$$resource: new Resource(Settings.activeUser('folderURL') + 'Mail', Settings.activeUser())
|
$$resource: new Resource(Settings.activeUser('folderURL') + 'Mail', Settings.activeUser())
|
||||||
});
|
});
|
||||||
// Initialize tags form user's defaults
|
// Initialize tags form user's defaults
|
||||||
|
@ -222,6 +223,14 @@
|
||||||
else if (part.type == 'UIxMailPartICalViewer' ||
|
else if (part.type == 'UIxMailPartICalViewer' ||
|
||||||
part.type == 'UIxMailPartImageViewer' ||
|
part.type == 'UIxMailPartImageViewer' ||
|
||||||
part.type == 'UIxMailPartLinkViewer') {
|
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)
|
// Trusted content that can be compiled (Angularly-speaking)
|
||||||
part.compile = true;
|
part.compile = true;
|
||||||
parts.push(part);
|
parts.push(part);
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.message.$imipAction(vm.pathToAttachment, action, data);
|
$scope.viewer.message.$imipAction(vm.pathToAttachment, action, data);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,10 +71,10 @@ md-icon {
|
||||||
&.icon-arrow-forward:before {
|
&.icon-arrow-forward:before {
|
||||||
content: "\e5c8";
|
content: "\e5c8";
|
||||||
}
|
}
|
||||||
|
&.icon-accepted:before,
|
||||||
&.icon-check:before {
|
&.icon-check:before {
|
||||||
content: "\e5ca";
|
content: "\e5ca";
|
||||||
}
|
}
|
||||||
&.icon-accepted:before,
|
|
||||||
&.icon-clear:before {
|
&.icon-clear:before {
|
||||||
content: "\e14c";
|
content: "\e14c";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue