]> err.no Git - scalable-opengroupware.org/blobdiff - UI/PreferencesUI/UIxJSONPreferences.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1160 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / UI / PreferencesUI / UIxJSONPreferences.m
index 96f1d35f9905959d88e482d8acd6b08a71d101df..0b18a97b889d63dc9e1b4a378f352e23e3f1726b 100644 (file)
 
 #import <NGObjWeb/WOContext+SoObjects.h>
 #import <NGObjWeb/WODirectAction.h>
+#import <NGObjWeb/WOResponse.h>
 
+#import <SoObjects/SOGo/NSObject+Utilities.h>
 #import <SoObjects/SOGo/SOGoUser.h>
 
 #import "UIxJSONPreferences.h"
 
 @implementation UIxJSONPreferences
 
+- (WOResponse *) _makeResponse: (NSString *) jsonText
+{
+  WOResponse *response;
+
+  response = [context response];
+  [response setHeader: @"text/plain; charset=utf-8"
+           forKey: @"content-type"];
+  [response appendContentString: jsonText];
+
+  return response;
+}
+
 - (WOResponse *) jsonDefaultsAction
 {
   NSUserDefaults *defaults;
 
   defaults = [[context activeUser] userDefaults];
 
-  return [defaults jsonRepresentation];
+  return [self _makeResponse: [defaults jsonRepresentation]];
 }
 
 - (WOResponse *) jsonSettingsAction
@@ -46,7 +60,7 @@
 
   settings = [[context activeUser] userSettings];
 
-  return [settings jsonRepresentation];
+  return [self _makeResponse: [settings jsonRepresentation]];
 }
 
 @end