diff --git a/UI/PreferencesUI/UIxJSONPreferences.h b/UI/PreferencesUI/UIxJSONPreferences.h index 77bee9685..452204568 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.h +++ b/UI/PreferencesUI/UIxJSONPreferences.h @@ -21,9 +21,12 @@ #ifndef UIXJSONPREFERENCES_H #define UIXJSONPREFERENCES_H -#import +#import -@interface UIxJSONPreferences : SOGoDirectAction +@interface UIxJSONPreferences : UIxComponent + +- (NSString *) jsonDefaults; +- (NSString *) jsonSettings; @end diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index 5dfd7939e..9ab81c3e2 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -36,6 +36,7 @@ #import #import #import +#import #import #import "UIxJSONPreferences.h" @@ -71,13 +72,18 @@ static SoProduct *preferencesProduct = nil; } - (WOResponse *) jsonDefaultsAction +{ + return [self responseWithStatus: 200 + andString: [self jsonDefaults]]; +} + +- (NSString *) jsonDefaults { NSMutableDictionary *values, *account, *vacation; SOGoUserDefaults *defaults; SOGoDomainDefaults *domainDefaults; NSMutableArray *accounts; NSDictionary *categoryLabels, *vacationOptions; - NSDictionary *locale; if (!preferencesProduct) { @@ -329,7 +335,6 @@ static SoProduct *preferencesProduct = nil; forKey: @"SOGoAppointmentSendEMailNotifications"]; // Add locale code (used by CK Editor) - locale = [[preferencesProduct resourceManager] localeForLanguageNamed: [defaults language]]; [values setObject: [locale objectForKey: @"NSLocaleCode"] forKey: @"LocaleCode"]; [values setObject: [NSDictionary dictionaryWithObjectsAndKeys: [locale objectForKey: @"NSMonthNameArray"], @"months", @@ -365,10 +370,16 @@ static SoProduct *preferencesProduct = nil; [values setObject: vacation forKey: @"Vacation"]; } - return [self responseWithStatus: 200 andJSONRepresentation: values]; + return [values jsonRepresentation]; } - (WOResponse *) jsonSettingsAction +{ + return [self responseWithStatus: 200 + andString: [self jsonSettings]]; +} + +- (NSString *) jsonSettings { SOGoUserSettings *settings; id v; @@ -396,7 +407,7 @@ static SoProduct *preferencesProduct = nil; if (![settings objectForKey: @"Mail"]) [settings setObject: [NSMutableDictionary dictionary] forKey: @"Mail"]; - return [self responseWithStatus: 200 andJSONRepresentation: [[settings source] values]]; + return [[[settings source] values] jsonRepresentation]; } @end diff --git a/UI/Templates/PreferencesUI/UIxJSONPreferences.wox b/UI/Templates/PreferencesUI/UIxJSONPreferences.wox index 594a1ab00..811e0dac5 100644 --- a/UI/Templates/PreferencesUI/UIxJSONPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxJSONPreferences.wox @@ -3,10 +3,12 @@ xmlns="http://www.w3.org/1999/xhtml" xmlns:var="http://www.skyrix.com/od/binding" xmlns:const="http://www.skyrix.com/od/constant"> + +