+2004-06-28 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * Common/UIxComponent.[hm]: moved -ownMethodName here.
+
+ * Scheduler/UIxCalView.[hm]: removed -ownMethodName, moved to
+ UIxComponent (reuse).
+
+ * Scheduler/UIxAppointmentView.[hm]: first "draft" of view component.
+ The look of OGo is resembled closely, but most features are still
+ missing.
+
2004-06-28 Marcus Mueller <znek@mulle-kybernetik.com>
* Scheduler/GNUmakefile.preamble: links against libSOGoLogic now.
/* appends queryParameters to _method if any are set */
- (NSString *)completeHrefForMethod:(NSString *)_method;
+- (NSString *)ownMethodName;
+
@end
#endif /* __UIxComponent_H_ */
return [_method stringByAppendingFormat:@"?%@", qs];
}
+- (NSString *)ownMethodName {
+ NSString *uri;
+ NSRange r;
+
+ uri = [[[self context] request] uri];
+
+ /* first: cut off query parameters */
+
+ r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
+ if (r.length > 0)
+ uri = [uri substringToIndex:r.location];
+
+ /* next: strip trailing slash */
+
+ if ([uri hasSuffix:@"/"]) uri = [uri substringToIndex:([uri length] - 1)];
+ r = [uri rangeOfString:@"/" options:NSBackwardsSearch];
+
+ /* then: cut of last path component */
+
+ if (r.length == 0) // no slash? are we at root?
+ return @"/";
+
+ return [uri substringFromIndex:(r.location + 1)];
+}
+
@end
-.date_label {
- color: #06348b;
+.aptview_title {
+ font-size: 10pt;
font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
- font-size: 12pt;
+ color: #000000;
font-weight: bold;
}
+.aptview_text {
+ font-size: 10pt;
+ font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
+ color: #000000;
+}
+
.weekoverview_title {
font-size: 10pt;
font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
color: #000000;
}
+.window_label {
+ color: #06348b;
+ font-family: Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
+ font-size: 12pt;
+ font-weight: bold;
+}
+
+
/* tabs */
.tab {
#ifndef __ZideStoreUI_UIxAppointmentView_H__
#define __ZideStoreUI_UIxAppointmentView_H__
-#include <NGObjWeb/SoComponent.h>
+#include <Common/UIxComponent.h>
-@interface UIxAppointmentView : SoComponent
+@interface UIxAppointmentView : UIxComponent
{
+ NSString *tabSelection;
+ id appointment;
+ id attendee;
}
+- (id)appointment;
+
+- (NSString *)attributesTabLink;
+- (NSString *)participantsTabLink;
+
+- (NSString *)completeHrefForMethod:(NSString *)_method
+ withParameter:(NSString *)_param
+ forKey:(NSString *)_key;
+
@end
#endif /* __ZideStoreUI_UIxAppointmentView_H__ */
#include "UIxAppointmentView.h"
#include "common.h"
#include <Backend/SxAptManager.h>
+#include <SOGoLogic/SOGoAppointment.h>
+
@interface NSObject(UsedPrivates)
- (SxAptManager *)aptManagerInContext:(id)_ctx;
@implementation UIxAppointmentView
- (void)dealloc {
+ [self->appointment release];
+ [self->attendee release];
[super dealloc];
}
+
+/* accessors */
+
+
+- (NSString *)tabSelection {
+ NSString *selection;
+
+ selection = [self queryParameterForKey:@"tab"];
+ if(! selection)
+ selection = @"attributes";
+ return selection;
+}
+
+- (void)setAttendee:(id)_attendee {
+ ASSIGN(self->attendee, _attendee);
+}
+- (id)attendee {
+ return self->attendee;
+}
+
+
/* backend */
+
- (SxAptManager *)aptManager {
return [[self clientObject] aptManagerInContext:[self context]];
}
-- (id)sogoApt {
- NSString *iCalString;
- id apt;
+- (SOGoAppointment *)appointment {
+ if(self->appointment == nil) {
+ NSString *iCalString;
+
+ iCalString = [[self clientObject] valueForKey:@"iCalString"];
+ self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
+ }
+ return self->appointment;
+}
+
+- (NSString *)formattedAptStartTime {
+ NSCalendarDate *date;
+
+ date = [[self appointment] startDate];
+ /* TODO: convert this into display timeZone! */
+ return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+}
+
+- (NSString *)formattedAptEndTime {
+ NSCalendarDate *date;
- iCalString = [[self clientObject] iCalString];
- apt = [[NSClassFromString(@"SOGoAppointment") alloc] initWithiCalString:iCalString];
- return apt;
+ date = [[self appointment] endDate];
+ /* TODO: convert this into display timeZone! */
+ return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+}
+
+
+/* hrefs */
+
+
+- (NSString *)attributesTabLink {
+ return [self completeHrefForMethod:[self ownMethodName]
+ withParameter:@"attributes"
+ forKey:@"tab"];
+}
+
+- (NSString *)participantsTabLink {
+ return [self completeHrefForMethod:[self ownMethodName]
+ withParameter:@"participants"
+ forKey:@"tab"];
+}
+
+- (NSString *)completeHrefForMethod:(NSString *)_method
+ withParameter:(NSString *)_param
+ forKey:(NSString *)_key
+{
+ NSString *href;
+
+ [self setQueryParameter:_param forKey:_key];
+ href = [self completeHrefForMethod:[self ownMethodName]];
+ [self setQueryParameter:nil forKey:_key];
+ return href;
}
@end /* UIxAppointmentView */
<?xml version='1.0' standalone='yes'?>
-<var:component className="UIxPageFrame" title="name"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:var="http://www.skyrix.com/od/binding"
- xmlns:const="http://www.skyrix.com/od/constant"
+<var:component xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:var="http://www.skyrix.com/od/binding"
+ xmlns:const="http://www.skyrix.com/od/constant"
+ xmlns:uix="OGo:uix"
+ className="UIxPageFrame"
+ title="name"
>
+
+ <table cellspacing="0" cellpadding="5" width="100%">
+ <tr>
+ <td>
+ <table cellpadding="0" cellspacing="0" width="100%">
+ <tr>
+ <td width="5"/>
+ <td class="window_label">Appointment Viewer</td>
+ <td width="36" align="right" valign="center">
+ <var:component className="UIxWinClose" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <table border="0" cellpadding="2" width="100%" cellspacing="0">
+ <tr bgcolor="#e8e8e0">
+ <td align="left">
+ <span class="aptview_title"><var:string value="formattedAptStartTime" /></span>
+ </td>
+ <td align="right" >
+ <table border='0' cellpadding='0' cellspacing='1'>
+ <tr>
+ <td class="button_auto_env" nowrap="true" valign='middle' align='center'>
+ <a class="button_auto"
+ href="aptprintview"
+ var:queryDictionary="queryParameters"
+ target="SOGoPrintView"
+ >printview</a>
+ </td>
+ <td class="button_auto_env" nowrap="true" valign='middle' align='center'>
+ <a class="button_auto"
+ href="edit"
+ var:queryDictionary="queryParameters"
+ >edit</a>
+ </td>
+ <td class="button_auto_env" nowrap="true" valign='middle' align='center'>
+ <a class="button_auto"
+ href="delete"
+ var:queryDictionary="queryParameters"
+ >delete</a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="100%">
+ <table width="100%" border="0" cellpadding="4" cellspacing="0">
+ <!-- general appointment info -->
+ <tr valign="top">
+ <td align="right" width="15%" bgcolor="#E8E8E0">
+ <span class="aptview_text">Title:</span>
+ </td>
+ <td align="left" bgcolor="#FFFFF0">
+ <span class="aptview_text">
+ <var:string value="appointment.summary" />
+ </span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td align="right" width="15%" bgcolor="#E8E8E0">
+ <span class="aptview_text">Location:</span>
+ </td>
+ <td align="left" bgcolor="#FFFFF0">
+ <span class="aptview_text">
+ <var:string value="appointment.location" />
+ </span>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" width="100%">
+ <uix:tabview var:selection="tabSelection"
+ const:tabStyle="tab"
+ const:selectedTabStyle="tab_selected"
+ const:bodyStyle="tabview_body"
+ >
+ <uix:tab const:key="attributes"
+ const:label="attributes"
+ var:href="attributesTabLink">
+ <table width="100%" border="0" cellpadding="4" cellspacing="0">
+ <tr valign="top">
+ <td align="right" width="15%" bgcolor="#E8E8E0">
+ <span class="aptview_text">Start time:</span>
+ </td>
+ <td align="left" bgcolor="#FFFFF0">
+ <span class="aptview_text">
+ <var:string value="formattedAptStartTime" />
+ </span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td align="right" width="15%" bgcolor="#E8E8E0">
+ <span class="aptview_text">End time:</span>
+ </td>
+ <td align="left" bgcolor="#FFFFF0">
+ <span class="aptview_text">
+ <var:string value="formattedAptEndTime" />
+ </span>
+ </td>
+ </tr>
+ </table>
+ </uix:tab>
+ <uix:tab const:key="participants"
+ const:label="participants"
+ var:href="participantsTabLink">
+ <table width="100%" border="0" cellpadding="4" cellspacing="0">
+ <tr valign="top">
+ <td align="left" bgcolor="#E8E8E0">
+ <span class="aptview_title">Email</span>
+ </td>
+ </tr>
+ <var:foreach list="appointment.attendees" item="attendee">
+ <tr valign="top">
+ <td align="left" bgcolor="#FFFFF0">
+ <span class="aptview_text">
+ <var:string value="attendee.email" />
+ </span>
+ </td>
+ </tr>
+ </var:foreach>
+ </table>
+ </uix:tab>
+ </uix:tabview>
+ </td>
+ </tr>
+ </table>
+
+<!-- DEBUGGING
<a href="../weekoverview" >week</a>
<a href="../monthoverview">month</a>
<br />
As SOGoApt:<br />
<pre><var:string value="sogoApt"/></pre>
<pre><var:string value="sogoApt.event"/></pre>
-
+-->
</var:component>
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:rsrc="OGo:url"
- const:class="date_label"
+ const:class="window_label"
><var:string value="label" const:escapeHTML="NO" /></span>
\ No newline at end of file
<a var:href="appointmentViewURL"
class="monthoverview_content_link"
var:title="shortTextForApt"
+ var:queryDictionary="currentDayQueryParameters"
><var:string value="shortTitleForApt" /></a>
</var:month>
</var:month-overview>
/* URLs */
- (NSString *)appointmentViewURL;
-- (NSString *)ownMethodName;
/* backend */
return [NSString stringWithFormat:@"%@/view", pkey];
}
-- (NSString *)ownMethodName {
- NSString *uri;
- NSRange r;
-
- uri = [[[self context] request] uri];
-
- /* first: cut off query parameters */
-
- r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
- if (r.length > 0)
- uri = [uri substringToIndex:r.location];
-
- /* next: strip trailing slash */
-
- if ([uri hasSuffix:@"/"]) uri = [uri substringToIndex:([uri length] - 1)];
- r = [uri rangeOfString:@"/" options:NSBackwardsSearch];
-
- /* then: cut of last path component */
-
- if (r.length == 0) // no slash? are we at root?
- return @"/";
-
- return [uri substringFromIndex:(r.location + 1)];
-}
-
/* backend */
<var:string value="holidayInfo" const:class="weekoverview_holidayinfo" />
</var:if>
<var:foreach list="allDayApts" item="appointment">
- <a var:href="appointmentViewURL"><var:string value="shortTextForApt" /></a>
+ <a var:href="appointmentViewURL"
+ var:queryDictionary="currentDayQueryParameters"
+ ><var:string value="shortTextForApt" /></a>
</var:foreach>
</var:week-info>
</var:if>