Skip to content

Commit

Permalink
(fix) enhance display of all-day invitations (fixes #4145)
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Apr 12, 2017
1 parent f28b7f2 commit 43385ce
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
2 changes: 2 additions & 0 deletions SoObjects/Appointments/English.lproj/Localizable.strings
Expand Up @@ -18,6 +18,8 @@ vtodo_class2 = "(Confidential task)";
"calendar_label" = "Calendar";
"startDate_label" = "Start";
"endDate_label" = "End";
"time_label" = "Time";
"to_label" = "to";
"due_label" = "Due Date";
"location_label" = "Location";
"summary_label" = "Summary";
Expand Down
14 changes: 14 additions & 0 deletions SoObjects/Appointments/SOGoAptMailNotification.m
Expand Up @@ -27,6 +27,7 @@
#import <NGObjWeb/WOActionResults.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WOResponse.h>
#import <NGExtensions/NSCalendarDate+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import <NGCards/iCalEvent.h>
#import <NGCards/iCalPerson.h>
Expand Down Expand Up @@ -186,6 +187,19 @@ - (NSString *) sentByText
return sentByText;
}

- (NSTimeInterval) duration
{
return [[self newEndDate] timeIntervalSinceDate:[self newStartDate]];
}

- (BOOL) isEndDateOnSameDay
{
if ([[self apt] isAllDay])
return ([self duration] <= 86400);

return [[self newStartDate] isDateOnSameDay: [self newEndDate]];
}

- (NSString *) formattedAptStartDate
{
NSString *s;
Expand Down
16 changes: 7 additions & 9 deletions UI/MailPartViewers/UIxMailPartICalViewer.m
Expand Up @@ -221,19 +221,17 @@ - (NSString *) endTime
return [[self dateFormatter] formattedTime: [self endCalendarDate]];
}

- (BOOL) isEndDateOnSameDay
- (NSTimeInterval) duration
{
NSCalendarDate *aDate;
if ([[self inEvent] isAllDay])
aDate = [[self endCalendarDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 seconds:-1];
else
aDate = [self endCalendarDate];
return [[self startCalendarDate] isDateOnSameDay: aDate];
return [[self endCalendarDate] timeIntervalSinceDate:[self startCalendarDate]];
}

- (NSTimeInterval) duration
- (BOOL) isEndDateOnSameDay
{
return [[self endCalendarDate] timeIntervalSinceDate:[self startCalendarDate]];
if ([[self inEvent] isAllDay])
return [self duration] <= 86400;

return [[self startCalendarDate] isDateOnSameDay: [self endCalendarDate]];
}

/* calendar folder support */
Expand Down
18 changes: 14 additions & 4 deletions UI/Templates/Appointments/SOGoAptMailInvitation.wox
Expand Up @@ -23,10 +23,19 @@ th, td { font-family: Lucida Grande, Bitstream VeraSans, Tahoma, sans-serif; fon
><tr>
<th align="right" style="font-weight: bold;"><var:string label:value="location_label" const:escapeHTML="NO"/></th>
<td><var:string value="location" const:escapeHTML="NO"/></td>
</tr
></var:if>
</tr></var:if>

<var:if condition="apt.isAllDay">
<tr>
<th align="right" style="font-weight: bold;"><var:string label:value="startDate_label" const:escapeHTML="NO"/></th>
<th align="right" style="font-weight: bold;"><var:string label:value="time_label" const:escapeHTML="NO"/></th>
<td><var:string value="formattedAptStartDate"
const:escapeHTML="NO"/><var:if condition="isEndDateOnSameDay" const:negate="YES"> <var:string label:value="to_label" const:escapeHTML="NO"/> <var:string value="formattedAptEndDate" const:escapeHTML="NO"/>
</var:if></td>
</tr>
</var:if>
<var:if condition="apt.isAllDay" const:negate="YES">
<tr>
<th align="right" style="font-weight: bold;"><var:string label:value="startDate_label" const:escapeHTML="NO"/></th>
<td><var:string value="formattedAptStartDate" const:escapeHTML="NO"
/><var:if condition="formattedAptStartTime.length"> - <var:string value="formattedAptStartTime" const:escapeHTML="NO"/> <var:string value="viewTZ" const:escapeHTML="NO"/>
</var:if></td>
Expand All @@ -36,7 +45,8 @@ th, td { font-family: Lucida Grande, Bitstream VeraSans, Tahoma, sans-serif; fon
<td><var:string value="formattedAptEndDate" const:escapeHTML="NO"
/><var:if condition="formattedAptEndTime.length"> - <var:string value="formattedAptEndTime" const:escapeHTML="NO"/> <var:string value="viewTZ" const:escapeHTML="NO"/>
</var:if></td>
</tr>
</tr>
</var:if>
<var:if condition="apt.comment.length"
><tr>
<th align="right" style="font-weight: bold;"><var:string label:value="comment_label" const:escapeHTML="NO"/></th>
Expand Down

0 comments on commit 43385ce

Please sign in to comment.