From 49e944ea24d5c1777c45285ad19a502f26c1d61d Mon Sep 17 00:00:00 2001 From: wolfgang Date: Wed, 13 Jun 2007 19:34:50 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1084 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 14 +++ .../Appointments/SOGoAppointmentFolder.m | 6 - SoObjects/SOGo/GNUmakefile | 2 - SoObjects/SOGo/NSObject+AptComparison.h | 34 ----- SoObjects/SOGo/NSObject+AptComparison.m | 75 ----------- UI/Scheduler/GNUmakefile | 1 + UI/Scheduler/NSArray+Scheduler.h | 35 ++++++ UI/Scheduler/NSArray+Scheduler.m | 87 +++++++++++++ UI/Scheduler/UIxCalListingActions.m | 3 + UI/Scheduler/UIxCalWeekView.m | 8 +- UI/WebServerResources/SchedulerUI.css | 12 +- UI/WebServerResources/SchedulerUI.js | 15 +-- UI/WebServerResources/mailer-toolbar.css | 119 ------------------ 13 files changed, 159 insertions(+), 252 deletions(-) delete mode 100644 SoObjects/SOGo/NSObject+AptComparison.h delete mode 100644 SoObjects/SOGo/NSObject+AptComparison.m create mode 100644 UI/Scheduler/NSArray+Scheduler.h create mode 100644 UI/Scheduler/NSArray+Scheduler.m delete mode 100644 UI/WebServerResources/mailer-toolbar.css diff --git a/ChangeLog b/ChangeLog index 189cd503..022ce2c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-06-13 Wolfgang Sourdeau + + * UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions + -eventsListAction]): sort events from here. + ([UIxCalListingActions -tasksListAction]): sort tasks from here. + + * SoObjects/SOGo/NSObject+AptComparison.[hm]: removed category + module, replaced with NSArray+Scheduler in UI/SchedulerUI/. + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder + -fetchFields:_fieldsfromFolder:_folderfrom:_startDateto:_endDatecomponent:_component]): + no longer sort elements from here. + 2007-06-12 Wolfgang Sourdeau * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index afeee305..66d5c14c 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -869,12 +869,6 @@ static NSNumber *sharedYes = nil; return nil; } - /* NOTE: why do we sort here? - This probably belongs to UI but cannot be achieved as fast there as - we can do it here because we're operating on a mutable array - - having the apts sorted is never a bad idea, though - */ - [ma sortUsingSelector: @selector (compareAptsAscending:)]; if (logger) [self debugWithFormat:@"returning %i records", [ma count]]; diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index ca032f9e..03916b35 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -32,7 +32,6 @@ libSOGo_HEADER_FILES = \ LDAPSource.h \ SOGoPermissions.h \ SOGoLRUCache.h \ - NSObject+AptComparison.h \ WOContext+Agenor.h \ SOGoDAVRendererTypes.h \ NSArray+Utilities.h \ @@ -61,7 +60,6 @@ libSOGo_OBJC_FILES = \ SOGoLRUCache.m \ LDAPUserManager.m \ LDAPSource.m \ - NSObject+AptComparison.m \ WOContext+Agenor.m \ SOGoDAVRendererTypes.m \ AgenorUserDefaults.m \ diff --git a/SoObjects/SOGo/NSObject+AptComparison.h b/SoObjects/SOGo/NSObject+AptComparison.h deleted file mode 100644 index ae50afda..00000000 --- a/SoObjects/SOGo/NSObject+AptComparison.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ -// $Id$ - -#ifndef __SOGo_NSObject_AptComparison_H_ -#define __SOGo_NSObject_AptComparison_H_ - -#import - -@interface NSObject (SOGoAptComparison) - -- (NSComparisonResult)compareAptsAscending:(id)_other; - -@end - -#endif /* __SOGo_NSObject_AptComparison_H_ */ diff --git a/SoObjects/SOGo/NSObject+AptComparison.m b/SoObjects/SOGo/NSObject+AptComparison.m deleted file mode 100644 index d3b0eb2d..00000000 --- a/SoObjects/SOGo/NSObject+AptComparison.m +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ -// $Id$ - -#include "NSObject+AptComparison.h" -#include -#include "common.h" - -@implementation NSObject (SOGoAptComparison) - -- (NSComparisonResult) compareAptsAscending: (id) _other -{ - NSCalendarDate *sd, *ed; - NGCalendarDateRange *r1, *r2; - NSComparisonResult result; - NSTimeInterval t1, t2; - - sd = [self valueForKey: @"startDate"]; - ed = [self valueForKey: @"endDate"]; - if (sd && ed) - r1 = [NGCalendarDateRange calendarDateRangeWithStartDate: sd - endDate: ed]; - else - r1 = nil; - - sd = [_other valueForKey: @"startDate"]; - ed = [_other valueForKey: @"endDate"]; - if (sd && ed) - r2 = [NGCalendarDateRange calendarDateRangeWithStartDate: sd - endDate: ed]; - else - r2 = nil; - - if (r1) - if (r2) - { - result = [r1 compare: r2]; - if (result != NSOrderedSame) - return result; - - t1 = [r1 duration]; - t2 = [r2 duration]; - if (t1 == t2) - return NSOrderedSame; - if (t1 > t2) - return NSOrderedDescending; - } - else - return NSOrderedDescending; - else - if (!r2) - return NSOrderedSame; - - return NSOrderedAscending; -} - -@end diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index 455d1bd1..b8f79463 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -10,6 +10,7 @@ SchedulerUI_LANGUAGES = English French German SchedulerUI_OBJC_FILES = \ SchedulerUIProduct.m \ + NSArray+Scheduler.m \ \ UIxCalMainView.m \ \ diff --git a/UI/Scheduler/NSArray+Scheduler.h b/UI/Scheduler/NSArray+Scheduler.h new file mode 100644 index 00000000..ac8e8b98 --- /dev/null +++ b/UI/Scheduler/NSArray+Scheduler.h @@ -0,0 +1,35 @@ +/* NSArray+Scheduler.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef NSARRAY_SCHEDULER_H +#define NSARRAY_SCHEDULER_H + +#import + +@interface NSArray (SOGoEventComparison) + +- (NSComparisonResult) compareEventsAscending: (NSArray *) otherEvent; +- (NSComparisonResult) compareTasksAscending: (NSArray *) otherTask; + +@end + +#endif /* NSARRAY_SCHEDULER_H */ diff --git a/UI/Scheduler/NSArray+Scheduler.m b/UI/Scheduler/NSArray+Scheduler.m new file mode 100644 index 00000000..d6d45df1 --- /dev/null +++ b/UI/Scheduler/NSArray+Scheduler.m @@ -0,0 +1,87 @@ +/* NSArray+Scheduler.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import +#import + +#import "NSArray+Scheduler.h" + +@implementation NSArray (SOGoEventComparison) + +- (NSComparisonResult) _compareCompletionWithStatus1: (NSNumber *) status1 + andStatus2: (NSNumber *) status2 +{ + NSComparisonResult result; + unsigned int ts1, ts2; + + ts1 = [status1 intValue]; + ts2 = [status2 intValue]; + if (ts1 == 1 && ts2 != 1) + result = NSOrderedDescending; + else if (ts1 != 1 && ts2 == 1) + result = NSOrderedAscending; + else + result = NSOrderedSame; + + return result; +} + +- (NSComparisonResult) compareEventsAscending: (NSArray *) otherEvent +{ + return [[self objectAtIndex: 4] compare: [otherEvent objectAtIndex: 4]]; +} + +- (NSComparisonResult) compareTasksAscending: (NSArray *) otherTask +{ + NSComparisonResult result; + unsigned int selfTime, otherTime; + Class nullClass; + + result = [self _compareCompletionWithStatus1: [self objectAtIndex: 2] + andStatus2: [otherTask objectAtIndex: 2]]; + if (result == NSOrderedSame) + { + nullClass = [NSNull class]; + selfTime = [[self objectAtIndex: 4] intValue]; + otherTime = [[otherTask objectAtIndex: 4] intValue]; + if (selfTime && !otherTime) + result = NSOrderedAscending; + else if (!selfTime && otherTime) + result = NSOrderedDescending; + else + { + if (selfTime > otherTime) + result = NSOrderedDescending; + else if (selfTime < otherTime) + result = NSOrderedAscending; + else + result = [[self objectAtIndex: 1] + compare: [otherTask objectAtIndex: 1]]; + } + } + + return result; +} + +@end diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index d3aa3cac..d946a13d 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -39,6 +39,7 @@ #import #import "../SOGoUI/SOGoDateFormatter.h" +#import "NSArray+Scheduler.h" #import "UIxCalListingActions.h" @@ -326,6 +327,7 @@ oldEvent = [events nextObject]; } + [newEvents sortUsingSelector: @selector (compareEventsAscending:)]; return [self _responseWithData: newEvents]; } @@ -398,6 +400,7 @@ } task = [tasks nextObject]; } + [filteredTasks sortUsingSelector: @selector (compareTasksAscending:)]; return [self _responseWithData: filteredTasks]; } diff --git a/UI/Scheduler/UIxCalWeekView.m b/UI/Scheduler/UIxCalWeekView.m index ab520323..ff06cc7b 100644 --- a/UI/Scheduler/UIxCalWeekView.m +++ b/UI/Scheduler/UIxCalWeekView.m @@ -52,10 +52,10 @@ endOfDay]; } -- (NSArray *) appointments -{ - return [self fetchCoreAppointmentsInfos]; -} +// - (NSArray *) appointments +// { +// return [self fetchCoreAppointmentsInfos]; +// } /* URLs */ diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css index b3b26fc4..a8f87456 100644 --- a/UI/WebServerResources/SchedulerUI.css +++ b/UI/WebServerResources/SchedulerUI.css @@ -20,7 +20,9 @@ DIV#tasksListView bottom: 0px; left: .2em; right: .7em; - padding: 0px; } + padding: 0px; + overflow: hidden; +} DIV#tasksListView H2 { font-size: 10pt; @@ -55,8 +57,6 @@ UL#tasksList, UL#calendarList { cursor: default; margin: .25em; padding: 0px; - overflow-x: hidden; - overflow-y: auto; border-bottom: 1px solid #fff; border-right: 1px solid #fff; border-top: 2px solid #222; @@ -65,7 +65,9 @@ UL#tasksList, UL#calendarList -moz-border-top-colors: #9c9a94 #000 transparent; -moz-border-left-colors: #9c9a94 #000 transparent; list-style-type: none; - list-style-image: none; } + list-style-image: none; + overflow-y: auto; + overflow-x: hidden; } UL#calendarList { clear: both; @@ -270,7 +272,7 @@ TABLE#eventsList position: relative; width: 100%; } -TABLE#eventsList td.tbtv_subject_headercell, +TABLE#eventsList td.headerTitle, TABLE#eventsList td.headerLocation { width: 35%; } diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index d5993316..d5e22f6b 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -319,8 +319,10 @@ function eventsListCallback(http) { startDate.setTime(data[i][4] * 1000); row.day = startDate.getDayString(); row.hour = startDate.getHourString(); - Event.observe(row, "click", onEventClick.bindAsEventListener(row)); - Event.observe(row, "dblclick", editDoubleClickedEvent.bindAsEventListener(row)); + Event.observe(row, "click", + onEventClick.bindAsEventListener(row)); + Event.observe(row, "dblclick", + editDoubleClickedEvent.bindAsEventListener(row)); Event.observe(row, "contextmenu", onEventContextMenu.bindAsEventListener(row)); @@ -760,6 +762,7 @@ function calendarDisplayCallback(http) { currentView = http.callbackData["view"]; if (http.callbackData["day"]) currentDay = http.callbackData["day"]; + var hour = null; if (http.callbackData["hour"]) hour = http.callbackData["hour"]; @@ -942,10 +945,8 @@ function onListFilterChange() { } function onEventClick(event) { - var target = getTarget(event); - var node = target.getParentWithTagName("tr"); - var day = node.day; - var hour = node.hour; + var day = this.day; + var hour = this.hour; changeCalendarDisplay( { "day": day, "hour": hour} ); changeDateSelectorDisplay(day); @@ -1212,7 +1213,7 @@ function calendarStatusCallback(http) { function calendarEntryCallback(http) { if (http.readyState == 4) { - var denied = (http.status != 204) + var denied = !isHttpStatus204(http.status); var entry = $(http.callbackData); if (denied) entry.addClassName("denied"); diff --git a/UI/WebServerResources/mailer-toolbar.css b/UI/WebServerResources/mailer-toolbar.css deleted file mode 100644 index 005a21a4..00000000 --- a/UI/WebServerResources/mailer-toolbar.css +++ /dev/null @@ -1,119 +0,0 @@ -/* toolbar for mailer application */ - -table.tb_maintable { - width: 100%; - top: 0px; /* this is patched when the linkbar is on */ - height: 40px; /* 48px; */ - z-index: 100; -} -td.tb_logocell { - width: 24px; /* 36px; */ - padding-right: 8px; -} -div.tb_consumer { /* consumes the spaces taken by the toolbar */ - height: 52px; /* 58px; */ /* this is patched when the linkbar is on */ - clear: both; -} - -.tb_toolbar { - height: 22px; /* was 30 */ -} -.tb_toolbar_group { /* not used currently? */ - height: 22px; /* was 30 */ - padding-right: 16px; -} - -.tb_icon { - text-align: center; -} -.tb_label { - color: #000000; - text-align: center; - padding-left: .5em; - padding-right: .5em; -} - -.tb_label a:link, .tb_label a:hover { - color: #000000; - text-align: center; -} - -.tb_spacer { - width: 16px; -} - -.tb_icon a { - width: 24px; - height: 24px; - margin: 0px auto; - display: block; -} - -.tbicon_logo { - background-image: url(lori_32x32.png); - width: 32px; - height: 32px; -} - -/* TODO: hover, doesn't work this way - as soon as I add ".tbicon_getmail" it stops working - TODO: we also need to draw a border around the full cell (not too easy)) - => probably we need to move to real icons - -.tb_icon a:hover .tbicon_getmail { - background-image: url(tb-mail-write-off-24x24.png); -} -*/ - -.tbicon_getmail { - background-image: url(tb-mail-getmail-flat-24x24.png); -} -.tbicon_compose { - background-image: url(tb-mail-write-flat-24x24.png); -} -.tbicon_addressbook { - background-image: url(tb-mail-addressbook-flat-24x24.png); -} -.tbicon_anais { - background-image: url(tbtb_anais.png); -} -.tbicon_reply { - background-image: url(tb-mail-reply-flat-24x24.png); -} -.tbicon_replyall { - background-image: url(tb-mail-replyall-flat-24x24.png); -} -.tbicon_forward { - background-image: url(tb-mail-forward-flat-24x24.png); -} -.tbicon_delete { - background-image: url(tb-mail-delete-flat-24x24.png); -} -.tbicon_trash { - background-image: url(tb-mail-junk-flat-24x24.png); -} -.tbicon_junk { - background-image: url(tb-mail-junk-flat-24x24.png); -} -.tbicon_print { - background-image: url(tb-mail-print-flat-24x24.png); -} -.tbicon_stop { - background-image: url(tb-mail-stop-flat-24x24.png); -} - -.tbicon_send { - background-image: url(tb-compose-send-flat-24x24.png); -} -.tbicon_attach { - background-image: url(tb-compose-attach-flat-24x24.png); -} -.tbicon_save { - background-image: url(tb-mail-file-flat-24x24.png); -} -.tbicon_folderadd { - background-image: url(tbtb_folderadd.png); -} -.tbicon_folderdel { - background-image: url(tbtb_folderdel.png); -} -- 2.39.5