+2004-06-18 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * Common/OGoComponent.[hm]: new component which serves as a base
+ component for calendar components now. Knows how to deal with
+ queryParameters and offers url construction method(s).
+
+ * All existing components have been rewritten to use queryParameters
+ instead of hardcoded strings where this is feasible. This provides
+ future extensibility and flexibility.
+
+ * Handling of dates has been fixed to center around the use of a
+ 'day' parameter. startDate/endDate are coupled to this, but
+ don't override it as it's the duty of the individual view to set
+ its (feasible) ranges accordingly. The new behaviour is noticable
+ in the calendar selection tabview instantly, as it now replicates
+ what OGo does.
+
2004-06-16 Marcus Mueller <znek@mulle-kybernetik.com>
* Common/OGoAppNavView.m: construct URL correctly.
- (NSString *)queryParameterForKey:(NSString *)_key;
- (NSDictionary *)queryParameters;
-/* use this to set permanent query parameters */
+/* use this to set 'sticky' query parameters */
- (void)setQueryParameter:(NSString *)_param forKey:(NSString *)_key;
+/* appends queryParameters to _method if any are set */
+- (NSString *)completeHrefForMethod:(NSString *)_method;
+
@end
#endif /* __OGoComponent_H_ */
return self->queryParameters;
}
+- (NSString *)completeHrefForMethod:(NSString *)_method {
+ NSDictionary *qp;
+ NSString *qs;
+
+ qp = [self queryParameters];
+ if([qp count] == 0)
+ return _method;
+
+ qs = [[self context] queryStringFromDictionary:qp];
+ return [_method stringByAppendingFormat:@"?%@", qs];
+}
+
@end
<tr bgcolor="#e8e8e0">
<td align="left" valign="middle" width="80%">TODO: controls</td><!-- 99% -->
<td align="right">
- <var:component className="OGoCalBackForthNavView" prevURL="prevMonthURL" currentURL="thisMonthURL" nextURL="nextMonthURL" const:label="this month" />
+ <var:component className="OGoCalBackForthNavView"
+ methodName="ownMethodName"
+ prevQueryParameters="prevMonthQueryParameters"
+ currentQueryParameters="todayQueryParameters"
+ nextQueryParameters="nextMonthQueryParameters"
+ const:label="this month"
+ />
</td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
- <var:component className="OGoCalSelectTab" const:selection="month" currentDate="startDate">
+ <var:component className="OGoCalSelectTab"
+ const:selection="month"
+ currentDate="selectedDate"
+ >
<var:month-overview
list="appointments"
{
}
+- (NSDictionary *)prevMonthQueryParameters;
+- (NSDictionary *)thisMonthQueryParameters;
+- (NSDictionary *)nextMonthQueryParameters;
+
@end
#endif /* __ZideStoreUI_OGoCalMonthView_H__ */
/* URLs (TODO: fix scroll ranges for months!) */
-- (NSString *)prevMonthURL {
- NSCalendarDate *newMonthDate;
-
- newMonthDate = [[[self startDate] firstDayOfMonth] dateByAddingYears:0
- months:-1
- days:0
- hours:0
- minutes:0
- seconds:0];
- return [self dateNavigationURLWithNewStartDate:newMonthDate];
-}
-
-- (NSString *)nextMonthURL {
- NSCalendarDate *newMonthDate;
- newMonthDate = [[[self startDate] firstDayOfMonth] dateByAddingYears:0
- months:1
- days:0
- hours:0
- minutes:0
- seconds:0];
- return [self dateNavigationURLWithNewStartDate:newMonthDate];
+- (NSDictionary *)prevMonthQueryParameters {
+ NSCalendarDate *date;
+
+ date = [[[self startDate] firstDayOfMonth] dateByAddingYears:0
+ months:-1
+ days:0
+ hours:0
+ minutes:0
+ seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
-- (NSString *)thisMonthURL {
- NSCalendarDate *newMonthDate;
-
- newMonthDate = [[NSCalendarDate date] mondayOfWeek];
- return [self dateNavigationURLWithNewStartDate:newMonthDate];
+- (NSDictionary *)nextMonthQueryParameters {
+ NSCalendarDate *date;
+
+ date = [[[self startDate] firstDayOfMonth] dateByAddingYears:0
+ months:1
+ days:0
+ hours:0
+ minutes:0
+ seconds:0];
+ return [self queryParametersBySettingSelectedDate:date];
}
@end /* OGoCalMonthView */
NSCalendarDate *currentDate;
}
-- (NSString *)completeHrefForMethod:(NSString *)_method;
-
@end
/* hrefs */
-- (NSString *)completeHrefForMethod:(NSString *)_method {
- NSDictionary *qp;
- NSString *qs;
-
- qp = [self queryParameters];
- if([qp count] == 0)
- return _method;
-
- qs = [[self context] queryStringFromDictionary:qp];
- return [_method stringByAppendingFormat:@"?%@", qs];
-}
-
- (NSString *)daytabLink {
return [self completeHrefForMethod:@"dayoverview"];
}
/* date selection & conversion */
+- (NSDictionary *)todayQueryParameters {
+ NSCalendarDate *date;
+
+ date = [NSCalendarDate date]; /* today */
+ return [self queryParametersBySettingSelectedDate:date];
+}
+
- (NSDictionary *)queryParametersBySettingSelectedDate:(NSCalendarDate *)_date {
NSMutableDictionary *qp;
<tr bgcolor="#e8e8e0">
<td align="left" valign="middle" width="80%">TODO: controls</td><!-- 99% -->
<td align="right">
- <var:component className="OGoCalBackForthNavView" methodName="ownMethodName" prevQueryParameters="prevWeekQueryParameters" currentQueryParameters="thisWeekQueryParameters" nextQueryParameters="nextWeekQueryParameters" const:label="this week" />
+ <var:component className="OGoCalBackForthNavView"
+ methodName="ownMethodName"
+ prevQueryParameters="prevWeekQueryParameters"
+ currentQueryParameters="todayQueryParameters"
+ nextQueryParameters="nextWeekQueryParameters"
+ const:label="this week"
+ />
</td>
</tr>
</table>
</td>
</tr>
</table>
+ <!--
<hr />
<var:string value="thisWeekQueryParameters" />
+ -->
<!--
<hr/>
return [self queryParametersBySettingSelectedDate:date];
}
-- (NSDictionary *)thisWeekQueryParameters {
- NSCalendarDate *date;
-
- date = [NSCalendarDate date]; /* today */
- return [self queryParametersBySettingSelectedDate:date];
-}
-
- (NSDictionary *)nextWeekQueryParameters {
NSCalendarDate *date;