mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
Expose user settings and defaults inline (cont'd)
This commit is contained in:
@@ -21,9 +21,12 @@
|
||||
#ifndef UIXJSONPREFERENCES_H
|
||||
#define UIXJSONPREFERENCES_H
|
||||
|
||||
#import <UI/SOGoUI/SOGoDirectAction.h>
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
|
||||
@interface UIxJSONPreferences : SOGoDirectAction
|
||||
@interface UIxJSONPreferences : UIxComponent
|
||||
|
||||
- (NSString *) jsonDefaults;
|
||||
- (NSString *) jsonSettings;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
#import <SOGo/SOGoUserProfile.h>
|
||||
#import <SOGo/WOResourceManager+SOGo.h>
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
#import <Mailer/SOGoMailLabel.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -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">
|
||||
|
||||
<script id="UserDefaults" type="text/json">
|
||||
<var:string value="jsonDefaults" const:escapeHTML="NO"/>
|
||||
</script>
|
||||
<script id="UserSettings" type="text/json">
|
||||
<var:string value="jsonSettings" const:escapeHTML="NO"/>
|
||||
</script>
|
||||
|
||||
</container>
|
||||
|
||||
Reference in New Issue
Block a user