mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-30 02:37:16 +00:00
Initial recurrence editor for appointments
This commit is contained in:
@@ -128,6 +128,8 @@
|
||||
"Attach" = "Attach";
|
||||
"Update" = "Update";
|
||||
"Cancel" = "Cancel";
|
||||
"Reset" = "Reset";
|
||||
"Save" = "Save";
|
||||
"show_rejected_apts" = "Show rejected appointments";
|
||||
"hide_rejected_apts" = "Hide rejected appointments";
|
||||
|
||||
@@ -337,6 +339,11 @@
|
||||
"appointment(s)" = "appointment(s)";
|
||||
"Repeat until" = "Repeat until";
|
||||
|
||||
"End Repeat" = "End Repeat";
|
||||
"Never" = "Never";
|
||||
"After" = "After";
|
||||
"On Date" = "On Date";
|
||||
|
||||
"First" = "First";
|
||||
"Second" = "Second";
|
||||
"Third" = "Third";
|
||||
|
||||
@@ -359,10 +359,9 @@
|
||||
|
||||
if (!repeatItems)
|
||||
{
|
||||
repeatItems = [NSArray arrayWithObjects: @"daily",
|
||||
repeatItems = [NSArray arrayWithObjects: @"never",
|
||||
@"daily",
|
||||
@"weekly",
|
||||
@"bi-weekly",
|
||||
@"every_weekday",
|
||||
@"monthly",
|
||||
@"yearly",
|
||||
nil];
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
@interface UIxComponentEditor : UIxComponent
|
||||
{
|
||||
id item;
|
||||
iCalRepeatableEntityObject *component;
|
||||
SOGoAppointmentFolder *componentCalendar;
|
||||
}
|
||||
|
||||
@@ -242,59 +242,6 @@ static NSArray *reminderValues = nil;
|
||||
// return [comment stringByReplacingString: @"\n" withString: @"\r\n"];
|
||||
//}
|
||||
|
||||
// TODO: Expose this method to the JSON API or centralize in UIxPreferences
|
||||
- (NSArray *) categoryList
|
||||
{
|
||||
NSMutableArray *categoryList;
|
||||
NSArray *categoryLabels;
|
||||
SOGoUserDefaults *defaults;
|
||||
|
||||
defaults = [[context activeUser] userDefaults];
|
||||
categoryLabels = [defaults calendarCategories];
|
||||
if (!categoryLabels)
|
||||
categoryLabels = [[self labelForKey: @"category_labels"]
|
||||
componentsSeparatedByString: @","];
|
||||
categoryList = [NSMutableArray arrayWithCapacity: [categoryLabels count] + 1];
|
||||
[categoryList addObjectsFromArray:
|
||||
[categoryLabels sortedArrayUsingSelector:
|
||||
@selector (localizedCaseInsensitiveCompare:)]];
|
||||
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
//- (NSArray *) repeatList
|
||||
//{
|
||||
// static NSArray *repeatItems = nil;
|
||||
//
|
||||
// if (!repeatItems)
|
||||
// {
|
||||
// repeatItems = [NSArray arrayWithObjects: @"DAILY",
|
||||
// @"WEEKLY",
|
||||
// @"BI-WEEKLY",
|
||||
// @"EVERY WEEKDAY",
|
||||
// @"MONTHLY",
|
||||
// @"YEARLY",
|
||||
// @"-",
|
||||
// @"CUSTOM",
|
||||
// nil];
|
||||
// [repeatItems retain];
|
||||
// }
|
||||
//
|
||||
// return repeatItems;
|
||||
//}
|
||||
|
||||
//- (NSString *) repeatLabel
|
||||
//{
|
||||
// NSString *rc;
|
||||
//
|
||||
// if ([self repeat])
|
||||
// rc = [self labelForKey: [NSString stringWithFormat: @"repeat_%@", [self repeat]]];
|
||||
// else
|
||||
// rc = [self labelForKey: @"repeat_NEVER"];
|
||||
//
|
||||
// return rc;
|
||||
//}
|
||||
|
||||
//- (NSString *) reminder
|
||||
//{
|
||||
// if ([[self clientObject] isNew])
|
||||
@@ -394,20 +341,6 @@ static NSArray *reminderValues = nil;
|
||||
// return priorities;
|
||||
//}
|
||||
|
||||
//- (NSArray *) classificationClasses
|
||||
//{
|
||||
// static NSArray *classes = nil;
|
||||
//
|
||||
// if (!classes)
|
||||
// {
|
||||
// classes = [NSArray arrayWithObjects: @"PUBLIC",
|
||||
// @"CONFIDENTIAL", @"PRIVATE", nil];
|
||||
// [classes retain];
|
||||
// }
|
||||
//
|
||||
// return classes;
|
||||
//}
|
||||
|
||||
/* helpers */
|
||||
|
||||
//- (BOOL) isWriteableClientObject
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* UIxRecurrenceEditor.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2008 Inverse inc.
|
||||
*
|
||||
* Author: Ludovic Marcotte <ludovic@inverse.ca>
|
||||
* Copyright (C) 2015 Inverse inc.
|
||||
*
|
||||
* 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
|
||||
@@ -21,11 +19,14 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSUserDefaults.h> /* for locale string constants */
|
||||
|
||||
#import <Common/UIxPageFrame.h>
|
||||
|
||||
#import <SOPE/NGCards/iCalRecurrenceRule.h>
|
||||
|
||||
#import "UIxRecurrenceEditor.h"
|
||||
|
||||
@implementation UIxRecurrenceEditor
|
||||
@@ -64,7 +65,7 @@
|
||||
if (!monthlyDayList)
|
||||
{
|
||||
monthlyDayList = [NSMutableArray arrayWithArray: [locale objectForKey: NSWeekDayNameArray]];
|
||||
[monthlyDayList addObject: @"DayOfTheMonth"];
|
||||
[monthlyDayList addObject: [self labelForKey: @"DayOfTheMonth"]];
|
||||
[monthlyDayList retain];
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@
|
||||
|
||||
if (!yearlyMonthList)
|
||||
{
|
||||
yearlyMonthList = [locale objectForKey: NSMonthNameArray];
|
||||
yearlyMonthList = [locale objectForKey: NSShortMonthNameArray];
|
||||
[yearlyMonthList retain];
|
||||
}
|
||||
|
||||
@@ -102,18 +103,27 @@
|
||||
//
|
||||
- (NSArray *) repeatList
|
||||
{
|
||||
static NSArray *repeatList = nil;
|
||||
static NSArray *repeatItems = nil;
|
||||
|
||||
if (!repeatList)
|
||||
if (!repeatItems)
|
||||
{
|
||||
repeatList = [NSArray arrayWithObjects: @"Daily", @"Weekly",
|
||||
@"Monthly", @"Yearly", nil];
|
||||
[repeatList retain];
|
||||
repeatItems = [NSArray arrayWithObjects: @"daily",
|
||||
@"weekly",
|
||||
@"bi-weekly",
|
||||
@"every_weekday",
|
||||
@"monthly",
|
||||
@"yearly",
|
||||
nil];
|
||||
[repeatItems retain];
|
||||
}
|
||||
|
||||
return repeatList;
|
||||
return repeatItems;
|
||||
}
|
||||
|
||||
- (NSString *) itemRepeatText
|
||||
{
|
||||
return [self labelForKey: [NSString stringWithFormat: @"repeat_%@", [item uppercaseString]]];
|
||||
}
|
||||
|
||||
//
|
||||
// Accessors
|
||||
@@ -158,4 +168,54 @@
|
||||
return item;
|
||||
}
|
||||
|
||||
- (NSString *) valueForWeekDay
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = [[self shortWeekDaysList] indexOfObject: item];
|
||||
|
||||
return iCalWeekDayString[i];
|
||||
}
|
||||
|
||||
- (NSString *) valueForMonthlyRepeat
|
||||
{
|
||||
static NSArray *monthlyRepeatValues = nil;
|
||||
unsigned int i;
|
||||
|
||||
if (!monthlyRepeatValues)
|
||||
{
|
||||
monthlyRepeatValues = [NSArray arrayWithObjects: @"1", @"2", @"3",
|
||||
@"4", @"5", @"-1", nil];
|
||||
[monthlyRepeatValues retain];
|
||||
}
|
||||
i = [[self monthlyRepeatList] indexOfObject: item];
|
||||
|
||||
return [monthlyRepeatValues objectAtIndex: i];
|
||||
}
|
||||
|
||||
- (NSString *) valueForMonthlyDay
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = [[self monthlyDayList] indexOfObject: item];
|
||||
if (i % 7 != i)
|
||||
return @"";
|
||||
else
|
||||
return iCalWeekDayString[i];
|
||||
}
|
||||
|
||||
- (unsigned int) valueForYearlyMonth
|
||||
{
|
||||
return [[self yearlyMonthList] indexOfObject: item] + 1;
|
||||
}
|
||||
|
||||
- (NSString *) valueForYearlyDay
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = [[self yearlyDayList] indexOfObject: item];
|
||||
|
||||
return iCalWeekDayString[i];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user