]> err.no Git - scalable-opengroupware.org/commitdiff
refactoring and implementation of daychartview.
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 5 Aug 2004 17:55:50 +0000 (17:55 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 5 Aug 2004 17:55:50 +0000 (17:55 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@165 d1b88da0-ebda-0310-925b-ed51d893ca5b

17 files changed:
SOGo/UI/Common/ChangeLog
SOGo/UI/Common/Version
SOGo/UI/Common/calendar.css
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxCalDayChartview.m
SOGo/UI/Scheduler/UIxCalDayChartview.wox
SOGo/UI/Scheduler/UIxCalDayOverview.h
SOGo/UI/Scheduler/UIxCalDayOverview.m
SOGo/UI/Scheduler/UIxCalDayOverview.wox
SOGo/UI/Scheduler/UIxCalDayView.h
SOGo/UI/Scheduler/UIxCalDayView.m
SOGo/UI/Scheduler/UIxCalInlineMonthOverview.wox
SOGo/UI/Scheduler/UIxCalMonthOverview.wox
SOGo/UI/Scheduler/UIxCalView.h
SOGo/UI/Scheduler/UIxCalView.m
SOGo/UI/Scheduler/UIxCalWeekOverview.wox
SOGo/UI/Scheduler/Version

index b3ed0163f0c395f0285bfae148dca2a7677adc8f..c155e092798fbc4834dbb097451698707e343e8e 100644 (file)
@@ -1,3 +1,11 @@
+2004-08-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.7
+       
+       * calendar.css: commented some styles out, because they don't really do
+         what I think they should do. Someone with better knowledge of CSS should
+         look into this.
+
 2004-08-02  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.6
index 0eb47da345be1d4c8ac5a363234ca3f2c77473cb..cab297dce179f93daddb8c8e20c17af86c0b5d3b 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=6
+SUBMINOR_VERSION:=7
index b71267fcaf9f49176604ca1868bf38c0fb792178..dc846200401fece48c471411e3cfd8f93017c4c9 100644 (file)
 .dayoverview_cal_day_header {
   background-color: #d2d2cc;
   text-align:       center;
-  vertical-align:   middle;
+  vertical-align:   top;
   font-size:        11pt;
-  width:            20px;
-  padding:          2px 2px 2px 2px;
-  margin:           2px 2px 2px 2px;
+//  width:            24px;
+//  padding:          2px 2px 2px 2px;
+//  margin:           2px 2px 2px 2px;
 }
 
 .dayoverview_cal_content {
   color:            #0033cc;
   background-color: #e8e8e0;
   text-align:       center;
-  vertical-align:   middle;
+  vertical-align:   top;
 }
 
 .dayoverview_cal_content_hilite {
   color:            #0033cc;
   background-color: #fffff0;
   text-align:       center;
-  vertical-align:   middle;
+  vertical-align:   top;
 }
 
 .dayoverview_cal_content_selected {
   color:            #0033cc;
   background-color: #d2d2cc;
   text-align:       center;
-  vertical-align:   middle;
+  vertical-align:   top;
 }
 .dayoverview_cal_content_dimmed a {
   color:            #5a5a5a;
index 4c9b43ddb7331669ab72de1dbb6029d49e4bca74..5184b9fd6493fe95694c3646b1f499265ae0a56e 100644 (file)
@@ -1,3 +1,21 @@
+2004-08-05  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * v0.9.14
+
+       * UIxCalDayOverview.[hm]: refactored currentDate -> moved to
+         UIxCalDayView.[hm].
+
+       * UIxCalDayView.[hm]: added currentDate and accompanied functionality.
+
+       * UIxCalView.[hm]: added -tooltipForApt.
+
+       * UIxCalDayChartview.[wox|m]: implemented.
+
+       * UIxCalInlineMonthOverview.wox: cosmetic changes.
+
+       * UIxCalDayOverview.wox, UIxCalWeekOverview.wox, UIxCalMonthOverview.wox:
+         uses "tooltipForApt" for view hyperlinks.
+
 2004-08-02  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v0.9.13
index b7a01d7ee6088b6d930b58995a37fded89a08d03..3938d9d768aa470484434a2bab8904b81b72a68b 100644 (file)
 
 @implementation UIxCalDayChartview
 
+- (NSArray *)columns {
+    static NSArray *columns = nil;
+    if(columns == nil) {
+        columns = [[NSArray arrayWithObject:@"0"] retain];
+    }
+    return columns;
+}
+
+- (BOOL)isPadColumn {
+    return NO;
+}
+
+- (NSString *)shortTextForApt {
+    return [[self appointment] valueForKey:@"title"];
+}
+
 @end
index 3418bb4f66ad54ebeed48f986a3a2cb854e40ea6..3496297088127e3ef40047e09992117aa7194298 100644 (file)
@@ -7,7 +7,12 @@
                className="UIxPageFrame"
                title="name"
 >
-  <table id="skywintable" class="wintable" cellspacing="0" cellpadding="5" width="100%">
+  <table id="skywintable"
+         class="wintable"
+         cellspacing="0"
+         cellpadding="5"
+         width="100%"
+  >
     <tr>
       <td class="wintitle">
         <table cellpadding="0" cellspacing="0" width="100%">
       <td id="skywinbodycell" class="wincontent">
         <table border="0" cellpadding="0" cellspacing="0" width="100%">
           <tr bgcolor="#e8e8e0">
-            <td align="left" valign="middle" width="80%">TODO: controls</td><!-- 99% -->
+            <td align="left"
+                valign="middle"
+                width="80%"
+            >TODO: controls</td><!-- 99% -->
             <td align="right">
               <var:component className="UIxCalBackForthNavView"
                              methodName="ownMethodName"
                              const:selection="day"
                              currentDate="selectedDate"
               >
-                <table border="0" cellpadding="4" width="100%" cellspacing="2">
+                <table border="0"
+                       cellpadding="4"
+                       width="100%"
+                       cellspacing="2"
+                >
                   <tr>
-                    <td width="1%" align="left" valign="middle" bgcolor="#e8e8e0">
+                    <td width="1%"
+                        align="left"
+                        valign="middle"
+                        bgcolor="#e8e8e0"
+                    >
                       <table border='0' cellpadding='0' cellspacing='0'>
                         <tr>
                           <td><a href="dayoverview"
                     <td align="right" bgcolor="#e8e8e0">
                       <table border="0" cellpadding="0" cellspacing="1">
                         <tr>
-                          <td class="button_auto_env" nowrap="true" valign="middle" align="center">
+                          <td class="button_auto_env"
+                              nowrap="true"
+                              valign="middle"
+                              align="center"
+                          >
                             <a class="button_auto"
                                href="dayprintview"
                                var:queryDictionary="queryParameters"
                                target="SOGoPrintView"
                             ><var:string label:value="printview"/></a>
                           </td>
-                          <td class="button_auto_env" nowrap="true" valign="middle" align="center">
+                          <td class="button_auto_env"
+                              nowrap="true"
+                              valign="middle"
+                              align="center"
+                          >
                             <a class="button_auto"
                                href="proposal"
                                var:queryDictionary="queryParameters"
                              <var:component className="UIxCalInlineMonthOverview"
                                             selectedDate="thisMonth"
                                             const:showYear="1"
-                                            const:daySelectionHref="dayoverview"
+                                            const:daySelectionHref="daychartview"
                                             const:showWeekColumn="0"
                                             const:style="dayoverview_cal"
                                             const:headerStyle="dayoverview_cal_title"
                              <var:component className="UIxCalInlineMonthOverview"
                                             selectedDate="nextMonth"
                                             const:showYear="1"
-                                            const:daySelectionHref="dayoverview"
+                                            const:daySelectionHref="daychartview"
                                             const:showWeekColumn="0"
                                             const:style="dayoverview_cal"
                                             const:headerStyle="dayoverview_cal_title"
                         </tr>
                       </table>
                     </td>
-                    <td>
+                    <td width="100%">
                       <table class="dayoverview_content" width="100%">
-                        <var:foreach list="dateRange" item="currentDate">
-                          <tr>
-                            <td class="dayoverview_content_time">
+                        <td width="100%" valign="top">
+                          <var:vspan-matrix list="appointments"
+                                            item="appointment"
+                                            rows="dateRange"
+                                            row="currentDate"
+                                            columns="columns"
+                                            column="isPadColumn"
+                                            itemActive="isCurrentDateInApt"
+                                            const:rowHeight="8"
+                                            const:width="100%"
+                                            const:border="0"
+                                            const:cellpading="5"
+                                            const:cellspacing="2"
+                          >
+                            <var:matrix-label const:elementName="td"
+                                              const:position="left"
+                                              const:bgcolor="#e8e8e0"
+                                              const:width="2"
+                            >
                               <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>
+                            </var:matrix-label>
+                            <!-- TODO: use css instead! -->
+                            <var:matrix-empty const:elementName="td"
+                                              const:bgcolor="#efefe7"
+                            >
+                            </var:matrix-empty>
+                            <!-- TODO: use css instead! -->
+                            <var:matrix-cell const:elementName="td"
+                                             const:bgcolor="#d6d6ce"
+                                             const:valign="top"
+                            >
+                              <a var:href="appointmentViewURL"
+                                 var:queryDictionary="currentDateQueryParameters"
+                                 var:title="tooltipForApt"
+                              ><var:string value="shortTextForApt" /></a>
+                            </var:matrix-cell>
+                          </var:vspan-matrix>
+                        </td>
                       </table>
                     </td>
                   </tr>
index f33cf01b159b57b9ee093739b972684997e9821a..335cd215cab94ed010a945fb03d2962db7452dd6 100644 (file)
 
 @interface UIxCalDayOverview : UIxCalDayView
 {
-    NSCalendarDate *currentDate;
     NSArray *currentApts;
 }
 
-
-- (void)setCurrentDate:(NSCalendarDate *)_date;
-- (NSCalendarDate *)currentDate;
-
 - (void)setCurrentApts:(NSArray *)_apts;
 - (NSArray *)currentApts;
 
-- (NSArray *)aptsForCurrentDate;
-
-- (BOOL)hasNoAptsForCurrentDate;
 - (int)minRequiredRowSpan;
-
-- (NSDictionary *)currentDateQueryParameters;
     
 @end
index 75522a0e5883d84f2e7a47f7a5fba3375da08284..1d446bbf91ed27094a3bdbc89a94024ed5a9aa4f 100644 (file)
 @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);
 }
     return self->currentApts;
 }
 
-- (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];
-}
-
-- (BOOL)hasNoAptsForCurrentDate {
-    return [[self aptsForCurrentDate] count] == 0;
-}
-
 - (int)minRequiredRowSpan {
     unsigned count = [[self aptsForCurrentDate] count];
     return count == 0 ? 1 : count;
 }
 
-- (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];
-}
-
 @end
index 7cc732a026fc5a322e44b8f48d8f5560487f608b..703840f8f23e2d2aeac22638aec3c553d2f99ef4 100644 (file)
                               <var:foreach list="allDayApts" item="appointment">
                                 <a var:href="appointmentViewURL"
                                    var:queryDictionary="currentDateQueryParameters"
+                                   var:title="tooltipForApt"
                                 ><var:string value="shortTextForApt" /></a>
                                 <br />
                               </var:foreach>
                               <var:foreach list="aptsForCurrentDate" item="appointment">
                                 <a var:href="appointmentViewURL"
                                    var:queryDictionary="currentDateQueryParameters"
+                                   var:title="tooltipForApt"
                                 ><var:string value="shortTextForApt" /></a>
                                 <br />
                               </var:foreach>
index 8b428bea2081581ee212abc334fd8372576b6b94..7f89929199424234e523b29dc1570df96bd9c0c9 100644 (file)
 
 @interface UIxCalDayView : UIxCalView
 {
+    NSCalendarDate *currentDate;
 }
 
+- (void)setCurrentDate:(NSCalendarDate *)_date;
+- (NSCalendarDate *)currentDate;
+- (BOOL)isCurrentDateInApt;
+    
+- (NSDictionary *)currentDateQueryParameters;
+
 - (NSArray *)dateRange;
 
+/* appointments */
+- (NSArray *)aptsForCurrentDate;
+- (BOOL)hasAptsForCurrentDate;
+
 @end
 
 #endif /* __UIxCalDayView_H_ */
index b072fafee8a5ae8ba60205a0d20c33668fd730da..89c1f190450ca680de299715ceae121f34137d2f 100644 (file)
 #include "common.h"
 
 @interface UIxCalDayView (PrivateAPI)
+- (BOOL)isCurrentDateInApt:(id)_apt;
 - (NSArray *)_getDatesFrom:(NSCalendarDate *)_from to:(NSCalendarDate *)_to;
 @end
 
 @implementation UIxCalDayView
 
+- (void)dealloc {
+    [self->currentDate release];
+    [super dealloc];
+}
+
+- (void)setCurrentDate:(NSCalendarDate *)_date {
+    ASSIGN(self->currentDate, _date);
+}
+- (NSCalendarDate *)currentDate {
+    return self->currentDate;
+}
+
+- (BOOL)isCurrentDateInApt {
+    return [self isCurrentDateInApt:[self appointment]];
+}
+
+- (BOOL)isCurrentDateInApt:(id)_apt {
+    NSCalendarDate *start, *end, *aptStartDate, *aptEndDate;
+
+    start = self->currentDate;
+    end = [start dateByAddingYears:0
+                            months:0
+                              days:0
+                             hours:0
+                           minutes:59
+                           seconds:59];
+    
+    aptStartDate = [_apt valueForKey:@"startDate"];
+    aptEndDate = [_apt valueForKey:@"endDate"];
+
+    /* does apt fully enclose start/end? */
+    if([start isGreaterThanOrEqualTo:aptStartDate] &&
+       [end isLessThanOrEqualTo:aptEndDate])
+        return YES;
+    if([aptStartDate isGreaterThanOrEqualTo:start] &&
+       [aptStartDate isLessThan:end])
+        return YES;
+    if([aptEndDate isGreaterThan:start] &&
+       [aptEndDate isLessThanOrEqualTo:end])
+        return YES;
+
+    return NO;
+}
 
 - (NSArray *)dateRange {
     /* default range is from dayStartHour to dayEndHour. Any values before
     return [self queryParametersBySettingSelectedDate:date];
 }
 
+- (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];
+}
+
 
 /* fetching */
 
     return [self fetchCoreInfos];
 }
 
+- (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];
+}
+
+- (BOOL)hasAptsForCurrentDate {
+    return [[self aptsForCurrentDate] count] != 0;
+}
+
 @end
index aa6d005a351023c3e7711a8f808b7610eaef27c2..f12a042677325fffec7f7e7fb3cedeee45c3f5d8 100644 (file)
@@ -9,11 +9,14 @@
 >
        <tr var:class="headerStyle">
                <td>
-              <var:if condition="hasMonthSelectionHref"><a var:href="monthSelectionHref"
-                                                           var:queryDictionary="currentMonthQueryParameters"
-                                                        ><var:string value="headerString" /></a>
+              <var:if condition="hasMonthSelectionHref"
+              ><a var:href="monthSelectionHref"
+                  var:queryDictionary="currentMonthQueryParameters"
+               ><var:string value="headerString" /></a>
               </var:if>
-              <var:if condition="hasMonthSelectionHref" const:negate="YES"><var:string value="headerString" /></var:if>
+              <var:if condition="hasMonthSelectionHref"
+                      const:negate="YES"
+              ><var:string value="headerString" /></var:if>
                </td>
        </tr>
        <tr>
@@ -41,7 +44,9 @@
                                var:queryDictionary="currentWeekQueryParameters"
                             ><var:string value="weekOfYear" /></a>
                         </var:if>
-                        <var:if condition="hasWeekSelectionHref" const:negate="YES">
+                        <var:if condition="hasWeekSelectionHref"
+                                const:negate="YES"
+                        >
                             <var:string value="weekOfYear" />
                         </var:if>
                     </var:month-label>
@@ -53,7 +58,9 @@
                         var:queryDictionary="currentDayQueryParameters"
                     ><var:string value="currentDay.dayOfMonth"/></a>
                   </var:if>
-                  <var:if condition="hasDaySelectionHref" const:negate="YES">
+                  <var:if condition="hasDaySelectionHref"
+                          const:negate="YES"
+                  >
                     <var:string value="currentDay.dayOfMonth"/>
                   </var:if>
                   </span>
index b8dabadd417af02714188534fdd4fa46f83e6828..2db35fc040e08d877d8fc76122f8a4dd8321fa79 100644 (file)
                   <var:month>
                     <a var:href="appointmentViewURL"
                        class="monthoverview_content_link"
-                       var:title="shortTextForApt"
+                       var:title="tooltipForApt"
                        var:queryDictionary="currentDayQueryParameters"
                     ><var:string value="shortTitleForApt"/></a>
                     <br />
index 65a17f7c90a2c89e3e79b803535632297fc9eeaa..e53a422908cd481eb8c71af60744cd3d6583cca7 100644 (file)
@@ -30,6 +30,7 @@
 - (NSString *)aptTypeIcon;
 - (NSString *)shortTextForApt;
 - (NSString *)shortTitleForApt;
+- (NSString *)tooltipForApt;
 - (NSString *)appointmentViewURL;
 
 - (id)holidayInfo;
index 0fe828b46835b3756db73610255b404c9850e442..3edb7567e5dc29541c8c4d307034601f788c0a59 100644 (file)
   return title;
 }
 
+- (NSString *)tooltipForApt {
+    NSCalendarDate *startDate, *endDate;
+    NSMutableString *aptDescr;
+    NSString *s;
+    BOOL spansRange;
+    id apt;
+    
+    apt = [self appointment];
+    spansRange = NO;
+    startDate = [apt valueForKey:@"startDate"];
+    [startDate setTimeZone:[self viewTimeZone]];
+    endDate = [apt valueForKey:@"endDate"];
+    if(endDate != nil) {
+        [endDate setTimeZone:[self viewTimeZone]];
+        spansRange = ![endDate isEqualToDate:startDate];
+    }
+    aptDescr = [[NSMutableString alloc] init];
+    [aptDescr appendString:[self labelForKey:@"appointment"]];
+    [aptDescr appendFormat:@"\n%02i:%02i",
+        [startDate hourOfDay],
+        [startDate minuteOfHour]];
+    if(spansRange) {
+        [aptDescr appendFormat:@" - %02i:%02i",
+            [endDate hourOfDay],
+            [endDate minuteOfHour]];
+    }
+    s = [apt valueForKey:@"title"];
+    if(s) {
+        [aptDescr appendFormat:@"\n%@", s];
+    }
+    s = [apt valueForKey:@"location"];
+    if(s) {
+        [aptDescr appendFormat:@"\n%@", s];
+    }
+    return [aptDescr autorelease];
+}
+
 - (NSCalendarDate *)referenceDateForFormatter {
   return [self selectedDate];
 }
index 6be563d0414fcf70b633d670a11a240e0e5814cb..99db42bdfe59047cff7b5dcb29cc9201bdc080a7 100644 (file)
       </var:if>
       <var:week>
         <a var:href="appointmentViewURL" 
+           var:title="tooltipForApt"
           ><small><var:string value="shortTextForApt" /></small></a><br />
       </var:week>
     </var:week-overview>
index 92c8fa08c38f073a34665a077f87e34ece0ab9e3..cc039aca8fe720e89b35bf8bb715cdccb043159e 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=13
+SUBMINOR_VERSION:=14