From 5c3f0138f55fb5403a2e09f7d99914a52d29ab38 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 25 Feb 2015 17:21:07 -0500 Subject: [PATCH] First pass at the v3 pref module The UI needs to be styled. We also need to properly load "default" values from the system/domain/user defaults and save them correctly too. --- UI/Common/UIxPageFrame.m | 7 +- UI/PreferencesUI/GNUmakefile | 1 + UI/PreferencesUI/UIxAccountEditor.m | 102 ++ UI/PreferencesUI/UIxFilterEditor.m | 2 +- UI/PreferencesUI/UIxJSONPreferences.h | 4 +- UI/PreferencesUI/UIxJSONPreferences.m | 4 +- UI/PreferencesUI/UIxPreferences.m | 6 + UI/PreferencesUI/product.plist | 11 +- .../PreferencesUI/UIxAccountEditor.wox | 120 ++ .../PreferencesUI/UIxFilterEditor.wox | 143 +- UI/Templates/PreferencesUI/UIxPreferences.wox | 1564 ++++++++++------- .../js/Mailer/mailbox-model.js | 2 +- .../js/Preferences/preferences-model.js | 106 ++ UI/WebServerResources/js/PreferencesUI.js | 250 +++ UI/WebServerResources/scss/PreferencesUI.scss | 182 ++ 15 files changed, 1792 insertions(+), 712 deletions(-) create mode 100644 UI/PreferencesUI/UIxAccountEditor.m create mode 100644 UI/Templates/PreferencesUI/UIxAccountEditor.wox create mode 100644 UI/WebServerResources/js/Preferences/preferences-model.js create mode 100644 UI/WebServerResources/js/PreferencesUI.js create mode 100644 UI/WebServerResources/scss/PreferencesUI.scss diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index 632d2ddf2..0fde1831f 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -164,7 +164,7 @@ - (NSString *) relativePreferencesPath { - return [self relativePathToUserFolderSubPath: @"preferences"]; + return [self relativePathToUserFolderSubPath: @"Preferences/"]; } - (NSString *) relativeAdministrationPath @@ -466,6 +466,11 @@ return [self _moduleIs: @"MailerUI"]; } +- (BOOL) isPreferences +{ + return [self _moduleIs: @"PreferencesUI"]; +} + - (BOOL) isAdministration { return [self _moduleIs: @"AdministrationUI"]; diff --git a/UI/PreferencesUI/GNUmakefile b/UI/PreferencesUI/GNUmakefile index 570327559..e106e9760 100644 --- a/UI/PreferencesUI/GNUmakefile +++ b/UI/PreferencesUI/GNUmakefile @@ -13,6 +13,7 @@ PreferencesUI_OBJC_FILES = \ \ UIxJSONPreferences.m \ UIxPreferences.m \ + UIxAccountEditor.m \ UIxFilterEditor.m \ \ UIxAdditionalPreferences.m diff --git a/UI/PreferencesUI/UIxAccountEditor.m b/UI/PreferencesUI/UIxAccountEditor.m new file mode 100644 index 000000000..57391d134 --- /dev/null +++ b/UI/PreferencesUI/UIxAccountEditor.m @@ -0,0 +1,102 @@ +/* UIxAccountEditor.m - this file is part of SOGo + * + * Copyright (C) 2010-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 + * 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 +#import + +#import +#import + +#import +#import +#import +#import +#import + +#import + +@interface UIxAccountEditor : UIxComponent +{ + NSString *accountId; +} + +@end + +@implementation UIxAccountEditor + +- (id) init +{ + self = [super init]; + + if (self) + { + accountId = nil; + } + + return self; +} + +- (void) dealloc +{ + RELEASE(accountId); + [super dealloc]; +} + + +- (BOOL) _validateFilterId +{ + NSCharacterSet *digits; + BOOL rc; + + digits = [NSCharacterSet decimalDigitCharacterSet]; + rc = ([accountId isEqualToString: @"new"] + || [[accountId stringByTrimmingCharactersInSet: digits] length] == 0); + + return rc; +} + +- (id ) defaultAction +{ + id result; + WORequest *request; + + request = [context request]; + ASSIGN (accountId, [request formValueForKey: @"account"]); + if (accountId) + { + if ([self _validateFilterId]) + result = self; + else + result = [self responseWithStatus: 403 + andString: @"Bad value for 'account'"]; + } + else + result = [self responseWithStatus: 403 + andString: @"Missing 'account' parameter"]; + + return result; +} + +- (NSString *) accountId +{ + return accountId; +} + +@end diff --git a/UI/PreferencesUI/UIxFilterEditor.m b/UI/PreferencesUI/UIxFilterEditor.m index 50ae1af15..7ddfcefb4 100644 --- a/UI/PreferencesUI/UIxFilterEditor.m +++ b/UI/PreferencesUI/UIxFilterEditor.m @@ -1,6 +1,6 @@ /* UIxFilterEditor.m - this file is part of SOGo * - * Copyright (C) 2010-2014 Inverse inc. + * Copyright (C) 2010-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 diff --git a/UI/PreferencesUI/UIxJSONPreferences.h b/UI/PreferencesUI/UIxJSONPreferences.h index 3cb14ddb2..4e9dfc573 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.h +++ b/UI/PreferencesUI/UIxJSONPreferences.h @@ -1,8 +1,6 @@ /* UIxJSONPreferences.h - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-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 diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index 11bd05b36..edea3c0b8 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -1,8 +1,6 @@ /* UIxJSONPreferences.m - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-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 diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index c73206d0b..fc24b198c 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1887,4 +1887,10 @@ static NSArray *reminderValues = nil; return (mailCustomFromEnabled ? @"true" : @"false"); } +- (id ) saveAction +{ + //return [self responseWithStatus: 200 andJSONRepresentation: data]; + return [self responseWithStatus: 200]; +} + @end diff --git a/UI/PreferencesUI/product.plist b/UI/PreferencesUI/product.plist index 1866d2905..ddb329aca 100644 --- a/UI/PreferencesUI/product.plist +++ b/UI/PreferencesUI/product.plist @@ -15,10 +15,14 @@ }; }; methods = { - preferences = { + Preferences = { protectedBy = "View"; pageName = "UIxPreferences"; }; + editAccount = { + protectedBy = "View"; + pageName = "UIxAccountEditor"; + }; editFilter = { protectedBy = "View"; pageName = "UIxFilterEditor"; @@ -37,6 +41,11 @@ actionClass = "UIxJSONPreferences"; actionName = "jsonSettings"; }; + save = { + protectedBy = "Change Images And Files"; + pageName = "UIxPreferences"; + actionName = "save"; + }; }; }; }; diff --git a/UI/Templates/PreferencesUI/UIxAccountEditor.wox b/UI/Templates/PreferencesUI/UIxAccountEditor.wox new file mode 100644 index 000000000..166ade2ea --- /dev/null +++ b/UI/Templates/PreferencesUI/UIxAccountEditor.wox @@ -0,0 +1,120 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Cancel + Save +
+ +
+
+
+
diff --git a/UI/Templates/PreferencesUI/UIxFilterEditor.wox b/UI/Templates/PreferencesUI/UIxFilterEditor.wox index b62f77a84..df4e855c9 100644 --- a/UI/Templates/PreferencesUI/UIxFilterEditor.wox +++ b/UI/Templates/PreferencesUI/UIxFilterEditor.wox @@ -11,6 +11,8 @@ title="title" const:popup="YES" > + +
-
+ + + +
- + + + + + + + + + + +
+
-
- +
+ + + + + {{ value }} + + + + + + + {{ value }} + + + + + + {{ value }} + + + + + + +
+
+ +
+
+
+
+ + +
+
- + +

- + + + + + + {{ value }} + + + + + + + + + + + + + + + + + + {{ item.name }} + + + + + + {{ value[0] }} + + + + + + + +
+
+ +
+
+
+ + +
+
+ +
+ Cancel + Save +
+
+
diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 6459c874d..6a30f5967 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -1,687 +1,911 @@ - -
-
    -
    - - - -
    -
    + xmlns="http://www.w3.org/1999/xhtml" + xmlns:var="http://www.skyrix.com/od/binding" + xmlns:const="http://www.skyrix.com/od/constant" + xmlns:uix="OGo:uix" + xmlns:rsrc="OGo:url" + xmlns:label="OGo:label" + className="UIxPageFrame" + title="title" + const:jsFiles="Common/resource.js,Mailer/mailbox-model.js,Mailer/message-model.js,Preferences/preferences-model.js"> + + + + + + +
    + + + + +

    + {{activeUser.identification}} +

    +
    + + + Close + + + + + + General + + + + + + Calendar + + + + + + Contacts + + + + + + Mail + + + + + +
    + +
    + + + +
    + + + + +
    + [[Preferences]] +
    +
    + + search +
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
      -
    • -
    • -
    • -
    • -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    - -
    - -
    -
    -
    - - - - -
    - -
    - -
    -
    -
    -
    - -
    - - - - - - - - - - - - - -
    -
    -
    -
    -
    - - - - -
    - -
    -
    -
    -
    -
    -
    - -
    - - - - - - - -
    -
    - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
      -
    • -
    • -
    -
    -
    - -
    - - - - - - - - -
    - -
    - -
    - -
    -
    - - - - - - - - - - - - - - -
    -
    -
    -
    - - -
    -
    -
    -
    - -
    - -
    - -
    - - - - - - + + + +
    + + +
    + + + + + + - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    - - -
    - - -
    + + + + + + + + +
    + + + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + +
    + + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + + +
    +