mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-23 04:15:26 +00:00
Monotone-Parent: d77760b82142bf6467142bd190255019d19263e0
Monotone-Revision: 9bf9ff8b6daaabd45f42c3278a9e48a54484d5f6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-18T22:51:44 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
2006-08-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxCalDateSelector.[hm]: new class designed to
|
||||
display a calendar as a dynamic widget from where one can select
|
||||
the current visible day.
|
||||
|
||||
* UI/Scheduler/NSCalendarDate+Scheduler.[hm]: category code
|
||||
extracted from UIxCalInlineMonthOverview.m.
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/* UIxCalDateSelector.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* 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 UIXCALDATESELECTOR_H
|
||||
#define UIXCALDATESELECTOR_H
|
||||
|
||||
#include "UIxCalMonthOverview.h"
|
||||
|
||||
@interface UIxCalDateSelector : UIxCalMonthOverview
|
||||
{
|
||||
NSCalendarDate *selectedDate;
|
||||
NSString *style;
|
||||
NSString *headerStyle;
|
||||
NSString *weekStyle;
|
||||
NSString *todayWeekStyle;
|
||||
NSString *dayHeaderStyle;
|
||||
NSString *dayBodyStyle;
|
||||
NSString *todayBodyStyle;
|
||||
NSString *inactiveDayBodyStyle;
|
||||
NSString *selectedDayExtraStyle;
|
||||
NSString *daySelectionHref;
|
||||
NSString *weekSelectionHref;
|
||||
NSString *monthSelectionHref;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif /* UIXCALDATESELECTOR_H */
|
||||
@@ -0,0 +1,156 @@
|
||||
/* UIxCalDateSelector.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse groupe conseil
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
*
|
||||
* 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 <NGExtensions/NSCalendarDate+misc.h>
|
||||
|
||||
#import "NSCalendarDate+Scheduler.h"
|
||||
|
||||
#import "UIxCalDateSelector.h"
|
||||
|
||||
@implementation UIxCalDateSelector
|
||||
|
||||
/* binding accessors */
|
||||
|
||||
- (void) setSelectedDate: (NSCalendarDate *) _date
|
||||
{
|
||||
ASSIGN (selectedDate, _date);
|
||||
[selectedDate setTimeZone: [self viewTimeZone]];
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) selectedDate
|
||||
{
|
||||
if (!selectedDate)
|
||||
selectedDate = [super selectedDate];
|
||||
|
||||
return selectedDate;
|
||||
}
|
||||
|
||||
- (NSString *) style
|
||||
{
|
||||
return style;
|
||||
}
|
||||
|
||||
- (NSString *) headerStyle
|
||||
{
|
||||
return headerStyle;
|
||||
}
|
||||
|
||||
- (NSString *) weekStyle
|
||||
{
|
||||
return weekStyle;
|
||||
}
|
||||
|
||||
- (void) setTodayWeekStyle: (NSString *) _style
|
||||
{
|
||||
ASSIGN (todayWeekStyle, _style);
|
||||
}
|
||||
|
||||
- (NSString *) todayWeekStyle
|
||||
{
|
||||
return ((todayWeekStyle)
|
||||
? todayWeekStyle
|
||||
: [self weekStyle]);
|
||||
}
|
||||
|
||||
- (NSString *) dayHeaderStyle
|
||||
{
|
||||
return dayHeaderStyle;
|
||||
}
|
||||
|
||||
- (void) setSelectedDayExtraStyle: (NSString *) _style
|
||||
{
|
||||
ASSIGN(selectedDayExtraStyle, _style);
|
||||
}
|
||||
|
||||
- (NSString *) selectedDayExtraStyle
|
||||
{
|
||||
return selectedDayExtraStyle;
|
||||
}
|
||||
|
||||
/* date ranges */
|
||||
|
||||
- (NSCalendarDate *) startDate
|
||||
{
|
||||
return [[self selectedDate] firstDayOfMonth];
|
||||
}
|
||||
|
||||
/* labels */
|
||||
|
||||
- (NSString *) headerString
|
||||
{
|
||||
NSCalendarDate *date;
|
||||
|
||||
date = [self startDate];
|
||||
|
||||
return [NSString stringWithFormat:@"%@ %d",
|
||||
[self localizedNameForMonthOfYear: [date monthOfYear]],
|
||||
[date yearOfCommonEra]];
|
||||
}
|
||||
|
||||
- (NSString *) localizedDayOfWeekName
|
||||
{
|
||||
return [self localizedAbbreviatedNameForDayOfWeek: [self dayOfWeek]];
|
||||
}
|
||||
|
||||
|
||||
/* stylesheets */
|
||||
|
||||
- (NSString *) currentWeekStyle
|
||||
{
|
||||
return (([currentWeekStart isDateInSameWeek:[NSCalendarDate date]] &&
|
||||
[currentWeekStart isDateInSameMonth:[self selectedDate]])
|
||||
? [self todayWeekStyle]
|
||||
: [self weekStyle]);
|
||||
}
|
||||
|
||||
- (NSString *) contentStyle
|
||||
{
|
||||
return (([currentDay isToday]
|
||||
&& [currentDay isDateInSameMonth:[self selectedDate]])
|
||||
? @"dayOfToday"
|
||||
: (([currentDay monthOfYear] != [[self startDate] monthOfYear])
|
||||
? @"inactiveDay"
|
||||
: @"activeDay"));
|
||||
}
|
||||
|
||||
- (NSString *) extraStyle
|
||||
{
|
||||
return (([[self selectedDate] isDateOnSameDay: currentDay])
|
||||
? [self selectedDayExtraStyle]
|
||||
: nil);
|
||||
}
|
||||
|
||||
/* URLs */
|
||||
|
||||
- (NSDictionary *) currentMonthQueryParameters
|
||||
{
|
||||
return [self queryParametersBySettingSelectedDate: [self startDate]];
|
||||
}
|
||||
|
||||
/* overriding */
|
||||
|
||||
- (NSArray *) fetchCoreInfos
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user