]> err.no Git - scalable-opengroupware.org/commitdiff
more code for day overview and the usual fixes
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 26 Jul 2004 17:30:47 +0000 (17:30 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 26 Jul 2004 17:30:47 +0000 (17:30 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@156 d1b88da0-ebda-0310-925b-ed51d893ca5b

15 files changed:
SOGo/UI/Common/ChangeLog
SOGo/UI/Common/calendar.css
SOGo/UI/SOGoUI/ChangeLog
SOGo/UI/SOGoUI/UIxComponent.m
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxAppointmentEditor.m
SOGo/UI/Scheduler/UIxCalDayOverview.m
SOGo/UI/Scheduler/UIxCalDayOverview.wox
SOGo/UI/Scheduler/UIxCalDayView.m
SOGo/UI/Scheduler/UIxCalMonthOverview.wox
SOGo/UI/Scheduler/UIxCalMonthView.m
SOGo/UI/Scheduler/UIxCalView.h
SOGo/UI/Scheduler/UIxCalView.m
SOGo/UI/Scheduler/UIxCalWeekView.m
SOGo/UI/Scheduler/Version

index 2cd35856c40582c1bee847323f99573ec4f63d13..1431b1fa04fa4b12cf226e14d33a2a45673aed7f 100644 (file)
@@ -1,3 +1,7 @@
+2004-07-26  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * calendar.css: added styles for dayoverview's content.
+
 2004-07-23  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * calendar.css: added styles for dayoverview's calendar.
index c485a1dc0132c3ce6b278e956b0eecadd7eb90d0..501f05c622e05988c1d0546cf930cf0b5b3544f0 100644 (file)
 }
 
 
+.dayoverview_content {
+  padding:          1px;
+  margin:           0px 0px 0px 0px;
+  vertical-align:   top;
+  font-family:      Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
+  letter-spacing:   0pt;
+  font-size:        9pt;
+}
+
+.dayoverview_content_time {
+  background-color: #d2d2cc;
+  text-align:       center;
+}
+
+.dayoverview_content_time_link {
+  font-size:        8pt;
+}
+.dayoverview_content_time_link a {
+  color:            #0033cc;
+  text-decoration:  none;
+}
+.dayoverview_content_time_link a:hover {
+  color:            #ff0000;
+  text-decoration:  underline;
+}
+
+.dayoverview_content_apts {
+  color:            #0033cc;
+  background-color: #e8e8e0;
+  text-align:       left;
+  vertical-align:   top;
+}
+
+
 .dayoverview_cal {
   color:            #000000;
   font-family:      Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
index f66a857d0eae591ec9b369e0d8b6cf67f47ca8f7..922b4408171bdd83e7e67cd3bf19ccc8e8ac3601 100644 (file)
@@ -1,3 +1,12 @@
+2004-07-26  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxComponent.m: added "hm" queryParameter to add hour/minute part to
+         selectedDate which is necessary for appointment proposals. Removed
+         all additional stuff from -dateForDateString: and moved this to
+         -selectedDate. IMHO this is always high-level behaviour which needs to
+         be refined in the appropriate high-level method, not at conversion
+         level.
+
 2004-07-21  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * UIxComponent.[hm]: renamed some of the labels to better reflect the
index 9ccbe480b16212c09172e9be9490fb37f783089d..8786220b830579d9e4589f41b9d97df9c681b70a 100644 (file)
@@ -221,12 +221,23 @@ static NSMutableArray *abbrMonthLabelKeys = nil;
 - (NSCalendarDate *)selectedDate {
   NSString       *s;
   NSCalendarDate *cdate;
-  
+
   s = [self queryParameterForKey:@"day"];
   cdate = ([s length] > 0)
     ? [self dateForDateString:s]
     : [NSCalendarDate date];
   [cdate setTimeZone:[self viewTimeZone]];
+  s = [self queryParameterForKey:@"hm"];
+  if([s length] == 4) {
+      unsigned hour, minute;
+      
+      hour = [[s substringToIndex:2] unsignedIntValue];
+      minute = [[s substringFromIndex:2] unsignedIntValue];
+      cdate = [cdate hour:hour minute:minute];
+  }
+  else {
+      cdate = [cdate hour:12 minute:0];
+  }
   return cdate;
 }
 
@@ -236,14 +247,8 @@ static NSMutableArray *abbrMonthLabelKeys = nil;
 }
 
 - (NSCalendarDate *)dateForDateString:(NSString *)_dateString {
-  NSTimeZone *tz;
-  
-  tz = [self viewTimeZone];
-  /* Note: we should give a time, best is noon to avoid edge conditions */
-  _dateString = [_dateString stringByAppendingFormat:@"12:00:00 %@",
-                              [tz abbreviation]];
   return [NSCalendarDate dateWithString:_dateString 
-                        calendarFormat:@"%Y%m%d %H:%M:%S %Z"];
+                        calendarFormat:@"%Y%m%d"];
 }
 
 
index 78abaa65bc09edc436a55011e0f1c1877c96f5bb..8f6d7682b0b2031d90310caa6f6422e69e00a844 100644 (file)
@@ -1,3 +1,17 @@
+2004-07-26  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.7
+
+       * UIxCalView.[hm]: new methods for defaults access, -dayStartHour,
+         -dayEndHour and -shouldDisplayWeekend.
+
+       * UIxCalDayOverview.[m|wox]: added content. CSS isn't 100% proper, yet.
+
+       * UIxCalWeekView.m, UIxCalMonthView.m: set startDate/endDate properly.
+
+       * UIxAppointmentEditor.m: fixed a subtle bug in -uriAsFormat that
+         prevented date information from being set properly in newAction:.
+
 2004-07-23  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.6
index 0eeb5058c78268d77ebe78bc915135712a9edc68..ab9e5196973d7b9cffee0f3d771a27d0730534fa 100644 (file)
   NSRange r;
 
   uri = [[[self context] request] uri];
-    
+
   /* first: identify query parameters */
   r = [uri rangeOfString:@"?" options:NSBackwardsSearch];
   if (r.length > 0) {
-    uri = [uri substringToIndex:r.location];
     qp = [uri substringFromIndex:r.location];
+    uri = [uri substringToIndex:r.location];
   }
   else
     qp = nil;
   nextMethod = [NSString stringWithFormat:@"%@/edit", objectId];
   uriFormat  = [self uriAsFormat];
   uri = [[NSString alloc] initWithFormat:uriFormat, nextMethod];
-  
   req = [[self context] request];
   r = [WOResponse responseWithRequest:req];
   [r setStatus:302 /* moved */];
index ed701e96b5795069176cf46b5803b229202bbe0b..b5647dd97391bf4c39f14e5dc16eebf36c2de480 100644 (file)
 
 
 #include "UIxCalDayView.h"
+#include <Foundation/Foundation.h>
+#include <NGExtensions/NGExtensions.h>
+
 
 @interface UIxCalDayOverview : UIxCalDayView
 {
-
+    NSCalendarDate *currentDate;
+    NSArray *currentApts;
 }
 
 @end
 
 @implementation UIxCalDayOverview
 
+- (void)dealloc {
+    [self->currentDate release];
+    [self->currentApts release];
+    [super dealloc];
+}
+
+- (void)setCurrentDate:(NSCalendarDate *)_date {
+    ASSIGN(self->currentDate, _date);
+}
+- (NSCalendarDate *)currentDate {
+    return self->currentDate;
+}
+
+- (void)setCurrentApts:(NSArray *)_apts {
+    ASSIGN(self->currentApts, _apts);
+}
+- (NSArray *)currentApts {
+    return self->currentApts;
+}
+
+- (NSArray *)dateRange {
+    NSMutableArray *dateRange;
+    unsigned i, count, offset;
+    
+    offset = [self dayStartHour];
+    count = [self dayEndHour] - offset;
+    dateRange = [[NSMutableArray alloc] initWithCapacity:count];
+    for(i = 0; i < count; i++) {
+        NSCalendarDate *date;
+        
+        date = [[self startDate] hour:offset + i minute:0];
+        [dateRange addObject:date];
+    }
+    return [dateRange autorelease];
+}
+
+
+- (NSArray *)aptsForCurrentDate {
+    NSArray *apts;
+    NSMutableArray *filtered;
+    unsigned i, count;
+    NSCalendarDate *start, *end;
+
+    start = self->currentDate;
+    end = [start dateByAddingYears:0
+                            months:0
+                              days:0
+                             hours:0
+                           minutes:59
+                           seconds:59];
+
+    apts = [self appointments];
+    filtered = [[NSMutableArray alloc] initWithCapacity:1];
+    count = [apts count];
+    for(i = 0; i < count; i++) {
+        id apt;
+        NSCalendarDate *aptStartDate;
+
+        /* NOTE: appointments are totally opaque objects, we don't know much
+           about them. The reason for this is that they are backend-dependent
+           and we'd like to use UIx for SOGo *and* ZideStore also.
+           We have to accept the fact that we know just a little bit
+           of their API which is completely KVC driven.
+        */
+
+        apt = [apts objectAtIndex:i];
+        aptStartDate = [apt valueForKey:@"startDate"];
+        if([aptStartDate isGreaterThanOrEqualTo:start] &&
+           [aptStartDate isLessThan:end]) {
+            [filtered addObject:apt];
+        }
+    }
+    
+    return [filtered autorelease];
+}
+
+- (NSString *)shortTextForApt {
+    NSCalendarDate *startDate, *endDate;
+    NSString *ms;
+    
+    startDate = [[self appointment] valueForKey:@"startDate"];
+    [startDate setTimeZone:[self viewTimeZone]];
+    endDate = [[self appointment] valueForKey:@"endDate"];
+    [endDate setTimeZone:[self viewTimeZone]];
+
+    ms = [NSString stringWithFormat:@"%02i:%02i %@",
+        [startDate hourOfDay],
+        [startDate minuteOfHour],
+        [[self appointment] valueForKey:@"title"]];
+    return ms;
+}
+
+
+/* URLs */
+
+- (NSDictionary *)currentDateQueryParameters {
+    NSMutableDictionary *qp;
+    NSString *hmString;
+    NSCalendarDate *date;
+
+    date = [self currentDate];
+    hmString = [NSString stringWithFormat:@"%02d%02d",
+        [date hourOfDay], [date minuteOfHour]];
+    qp = [[self queryParameters] mutableCopy];
+    [self setSelectedDateQueryParameter:date inDictionary:qp];
+    [qp setObject:hmString forKey:@"hm"];
+    return [qp autorelease];
+}
+
+
+/* appointments */
+
+- (NSArray *)appointments {
+    return [self fetchCoreInfos];
+}
+
 @end
index bdd4e8c61965634f80b369e145bc5397d05350f6..89d65fbeaf01d7a3da19550edf69367a312985f6 100644 (file)
                           <td><a href="daychartview"
                                  var:queryDictionary="queryParameters"
                               ><img rsrc:src="icon_apt_chart.gif"
-                                                          label:title="Chart"
-                                                          label:alt="Chart"
-                                                          border="0"
-                                                          valign="top"
-                                                     /></a></td>
+                                    label:title="Chart"
+                                    label:alt="Chart"
+                                    border="0"
+                                    valign="top"
+                               /></a></td>
                           <td><a href="daylistview"
                                  var:queryDictionary="queryParameters"
                               ><img rsrc:src="icon_apt_list.gif"
-                                                         label:title="List"
-                                                         label:alt="List"
-                                                         border="0"
-                                                         valign="top"
-                                                    /></a></td>
+                                    label:title="List"
+                                    label:alt="List"
+                                    border="0"
+                                    valign="top"
+                               /></a></td>
                         </tr>
                       </table>
                     </td>
                       </table>
                     </td>
                     <td>
-                      TODO: Content
+                      <table class="dayoverview_content" width="100%">
+                        <var:foreach list="dateRange" item="currentDate">
+                          <tr>
+                            <td class="dayoverview_content_time">
+                              <var:string value="currentDate"
+                                          const:dateformat="%H:%M"
+                              />
+                              <br />
+                              <span class="dayoverview_content_time_link">
+                                [<a href="new"
+                                    var:queryDictionary="currentDateQueryParameters"
+                                 ><var:string label:value="new" /></a>]
+                              </span>
+                            </td>
+                            <td class="dayoverview_content_apts">
+                              <var:foreach list="aptsForCurrentDate" item="appointment">
+                                <a var:href="appointmentViewURL"
+                                   var:queryDictionary="currentDateQueryParameters"
+                                ><var:string value="shortTextForApt" /></a>
+                                <br />
+                              </var:foreach>
+                            </td>
+                          </tr>
+                        </var:foreach>
+                      </table>
                     </td>
                   </tr>
                 </table>
index fcd872c29c140971cf271c9f927e6639a747e807..a873ae2c898a4cb706a14130c43924673a77bfef 100644 (file)
 /* fetching */
 
 - (NSCalendarDate *)startDate {
-    return [[self selectedDate] beginOfDay];
+    return [[self selectedDate] hour:[self dayStartHour] minute:0];
 }
 - (NSCalendarDate *)endDate {
-    return [[self startDate] endOfDay];
+    return [[self startDate] hour:[self dayEndHour] minute:0];
 }
 
 @end
index 331aa8f27b60eab8cf39ab573849c9e37c8dff65..df1d41e0f830391090580d40b6fc8b5a154b1f83 100644 (file)
@@ -96,6 +96,7 @@
                     <var:foreach list="allDayApts" item="appointment">
                       <a var:href="appointmentViewURL"
                       ><var:string value="shortTextForApt"/></a>
+                      <br />
                     </var:foreach>
                   </var:month-info>
                   <var:month-label const:orientation="top" dayOfWeek="dayOfWeek" const:class="monthoverview_title">
                        var:title="shortTextForApt"
                        var:queryDictionary="currentDayQueryParameters"
                     ><var:string value="shortTitleForApt"/></a>
+                    <br />
                   </var:month>
                 </var:month-overview>
               </var:component>
index 09f93086135950e909be321f7ce8f365ff1cac01..d2e1f73f16ee7acb65c5b933b303c1fc787f8250 100644 (file)
@@ -1,16 +1,22 @@
 // $Id$
 
 #include "UIxCalMonthView.h"
+#include <NGExtensions/NGExtensions.h>
 #include "common.h"
 
+
 @implementation UIxCalMonthView
 
 - (NSCalendarDate *)startDate {
-  return [[[super startDate] firstDayOfMonth] beginOfDay];
+  return [[[super startDate] firstDayOfMonth]
+                             hour:[self dayStartHour]
+                             minute:0];
 }
 
 - (NSCalendarDate *)endDate {
-  NSCalendarDate *startDate = [[self startDate] endOfDay];
+  NSCalendarDate *startDate = [[self startDate]
+                                     hour:[self dayEndHour]
+                                     minute:0];
   return [startDate dateByAddingYears:0
                     months:0
                     days:[startDate numberOfDaysInMonth]
index ae2e65926815ef92bc8233d6c916bbe15ee83129..25e32bbd8e55c10989a3004d162254da2bd74b2e 100644 (file)
     
 - (BOOL)showFullNames;
 - (BOOL)showAMPMDates;
+- (unsigned)dayStartHour;
+- (unsigned)dayEndHour;
+- (BOOL)shouldDisplayWeekend;
+    
 - (NSCalendarDate *)referenceDateForFormatter;
     
 /* URLs */
index 69fa83ae0080c9e5674bf24ce287ea23b6b92926..4404e32448962778803e357b74a401e20ea9ba9e 100644 (file)
     return NO;
 }
 
+- (unsigned)dayStartHour {
+    return 8;
+}
+
+- (unsigned)dayEndHour {
+    return 19;
+}
+
+- (BOOL)shouldDisplayWeekend {
+    return NO;
+}
+
 
 /* URLs */
 
index 5696cfa1befc6d16ab35e986e51765e9ab594f32..8d2240748ca429c3c431ac89ddfda3bb59c02867 100644 (file)
@@ -1,17 +1,20 @@
 // $Id$
 
 #include "UIxCalWeekView.h"
+#include <NGExtensions/NGExtensions.h>
 #include "common.h"
 
 @implementation UIxCalWeekView
 
 - (NSCalendarDate *)startDate {
-  return [[[super startDate] mondayOfWeek] beginOfDay];
+    return [[[super startDate] mondayOfWeek] hour:[self dayStartHour]
+                                             minute:0];
 }
 
 - (NSCalendarDate *)endDate {
   return [[[self startDate] dateByAddingYears:0 months:0 days:7
-                          hours:0 minutes:0 seconds:0] endOfDay];
+                                        hours:0 minutes:0 seconds:0]
+                            hour:[self dayEndHour] minute:0];
 }
 
 /* URLs */
index 3fc5892ad6908249bb272cd5044dfceab1ecc155..e852897c1c1790055150e249ba4afaa7c21995df 100644 (file)
@@ -1,5 +1,5 @@
 # $Id$
 
-SUBMINOR_VERSION:=6
+SUBMINOR_VERSION:=7
 
 # 1.1.0 requires NGObjWeb 4.2.202