From 39228fb130b8dc2c42e7ee326e72d27b6252fcaf Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 28 Jul 2006 22:59:11 +0000 Subject: [PATCH] Monotone-Parent: 8566d6fbfa896a774b9907c3125e7b3de87296cd Monotone-Revision: 2ad8b0c019808014c990f51cc69c4457fdb537c6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-07-28T22:59:11 Monotone-Branch: ca.inverse.sogo --- SoObjects/Mailer/SOGoMailAccounts.m | 3 + UI/Common/UIxPageFrame.h | 16 +- UI/Common/UIxPageFrame.m | 140 ++- UI/Common/UIxToolbar.m | 26 +- UI/Common/product.plist | 9 - UI/Contacts/UIxContactEditorBase.m | 5 - UI/MailerUI/French.lproj/Localizable.strings | 55 +- UI/MailerUI/GNUmakefile | 8 +- UI/MailerUI/Toolbars/SOGoDraftObject.toolbar | 11 +- UI/MailerUI/Toolbars/SOGoMailObject.toolbar | 39 +- UI/MailerUI/UIxMailAccountView.m | 6 + UI/MailerUI/UIxMailAccountViewContainer.h | 32 + UI/MailerUI/UIxMailAccountViewContainer.m | 27 + UI/MailerUI/UIxMailAccountsView.m | 19 + UI/MailerUI/UIxMailEditor.m | 10 +- UI/MailerUI/UIxMailEditorAction.m | 2 +- UI/MailerUI/UIxMailFilterPanel.m | 16 - UI/MailerUI/UIxMailListView.h | 46 + UI/MailerUI/UIxMailListView.m | 251 +++-- UI/MailerUI/UIxMailListViewContainer.h | 34 + UI/MailerUI/UIxMailListViewContainer.m | 51 + UI/MailerUI/UIxMailMainFrame.h | 44 + UI/MailerUI/UIxMailMainFrame.m | 49 +- UI/MailerUI/UIxMailSortableTableHeader.m | 1 + UI/MailerUI/UIxMailTree.h | 43 + UI/MailerUI/UIxMailTree.m | 324 ++++-- UI/MailerUI/UIxMailTreeBlock.h | 50 +- UI/MailerUI/UIxMailTreeBlock.m | 149 ++- UI/MailerUI/UIxMailTreeBlockJS.h | 53 + UI/MailerUI/UIxMailTreeBlockJS.m | 113 ++ UI/MailerUI/UIxMailView.js | 35 - UI/MailerUI/UIxMailViewContainer.h | 31 + UI/MailerUI/UIxMailViewContainer.m | 27 + UI/MailerUI/product.plist | 127 ++- UI/SOGoUI/UIxComponent.h | 6 + UI/SOGoUI/UIxComponent.m | 89 +- UI/Scheduler/UIxAppointmentEditor.m | 4 - UI/Templates/MailerUI/UIxMailAccountView.wox | 52 +- .../MailerUI/UIxMailAccountViewContainer.wox | 39 + UI/Templates/MailerUI/UIxMailAccountsView.wox | 36 +- UI/Templates/MailerUI/UIxMailEditor.wox | 163 +-- UI/Templates/MailerUI/UIxMailFilterPanel.wox | 81 +- UI/Templates/MailerUI/UIxMailFolderMenu.wox | 39 + UI/Templates/MailerUI/UIxMailListView.wox | 440 +++----- .../MailerUI/UIxMailListViewContainer.wox | 38 + UI/Templates/MailerUI/UIxMailMainFrame.wox | 403 +++++-- UI/Templates/MailerUI/UIxMailMoveToPopUp.wox | 2 +- UI/Templates/MailerUI/UIxMailToSelection.wox | 12 +- UI/Templates/MailerUI/UIxMailTree.wox | 95 +- UI/Templates/MailerUI/UIxMailTreeBlockJS.wox | 7 + UI/Templates/MailerUI/UIxMailView.wox | 336 +++--- .../MailerUI/UIxMailViewContainer.wox | 37 + UI/Templates/UIxPageFrame.wox | 315 +++--- UI/Templates/UIxToolbar.wox | 74 +- UI/WebServerResources/MailerUI.js | 997 ++++++++++++++++++ UI/WebServerResources/UIxMailListView.js | 63 +- UI/WebServerResources/busy.gif | Bin 0 -> 1658 bytes UI/WebServerResources/empty.gif | Bin 0 -> 62 bytes UI/WebServerResources/generic.js | 451 +++++--- UI/WebServerResources/mailer.js | 20 +- UI/WebServerResources/tbtv_account_17x17.gif | Bin 1077 -> 1042 bytes UI/WebServerResources/tbtv_corner_17x17.gif | Bin 80 -> 61 bytes .../tbtv_corner_minus_17x17.gif | Bin 121 -> 207 bytes .../tbtv_corner_plus_17x17.gif | Bin 125 -> 205 bytes UI/WebServerResources/tbtv_drafts_17x17.gif | Bin 1084 -> 1033 bytes UI/WebServerResources/tbtv_inbox_17x17.gif | Bin 1093 -> 1057 bytes .../tbtv_junction2_17x17.gif | Bin 82 -> 0 bytes UI/WebServerResources/tbtv_junction_17x17.gif | Bin 81 -> 82 bytes .../tbtv_leaf_corner_17x17.gif | Bin 602 -> 595 bytes UI/WebServerResources/tbtv_line_17x17.gif | Bin 80 -> 89 bytes UI/WebServerResources/tbtv_minus_17x17.gif | Bin 122 -> 211 bytes UI/WebServerResources/tbtv_plus_17x17.gif | Bin 127 -> 208 bytes UI/WebServerResources/tbtv_trash_17x17.gif | Bin 1119 -> 1074 bytes 73 files changed, 4023 insertions(+), 1628 deletions(-) create mode 100644 UI/MailerUI/UIxMailAccountViewContainer.h create mode 100644 UI/MailerUI/UIxMailAccountViewContainer.m create mode 100644 UI/MailerUI/UIxMailListView.h create mode 100644 UI/MailerUI/UIxMailListViewContainer.h create mode 100644 UI/MailerUI/UIxMailListViewContainer.m create mode 100644 UI/MailerUI/UIxMailMainFrame.h create mode 100644 UI/MailerUI/UIxMailTree.h create mode 100644 UI/MailerUI/UIxMailTreeBlockJS.h create mode 100644 UI/MailerUI/UIxMailTreeBlockJS.m delete mode 100644 UI/MailerUI/UIxMailView.js create mode 100644 UI/MailerUI/UIxMailViewContainer.h create mode 100644 UI/MailerUI/UIxMailViewContainer.m create mode 100644 UI/Templates/MailerUI/UIxMailAccountViewContainer.wox create mode 100644 UI/Templates/MailerUI/UIxMailFolderMenu.wox create mode 100644 UI/Templates/MailerUI/UIxMailListViewContainer.wox create mode 100644 UI/Templates/MailerUI/UIxMailTreeBlockJS.wox create mode 100644 UI/Templates/MailerUI/UIxMailViewContainer.wox create mode 100644 UI/WebServerResources/MailerUI.js create mode 100644 UI/WebServerResources/busy.gif create mode 100644 UI/WebServerResources/empty.gif delete mode 100644 UI/WebServerResources/tbtv_junction2_17x17.gif diff --git a/SoObjects/Mailer/SOGoMailAccounts.m b/SoObjects/Mailer/SOGoMailAccounts.m index 002de868d..d88bb9d5b 100644 --- a/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SoObjects/Mailer/SOGoMailAccounts.m @@ -113,9 +113,11 @@ static NSString *AgenorShareLoginMarker = @".-."; return [[ctx activeUser] fetchAllMailIdentitiesWithOnlyEmitterAccess:_flag]; } + - (NSArray *)fetchAllIdentities { return [self fetchIdentitiesWithOnlyEmitterAccess:NO]; } + - (NSArray *)fetchIdentitiesWithEmitterPermissions { return [self fetchIdentitiesWithOnlyEmitterAccess:YES]; } @@ -143,6 +145,7 @@ static NSString *AgenorShareLoginMarker = @".-."; ct = [[ctClass alloc] initWithName:_key inContainer:self]; return [ct autorelease]; } + - (id)sharedMailAccountWithName:(NSString *)_key inContext:(id)_ctx { static Class ctClass = Nil; id ct; diff --git a/UI/Common/UIxPageFrame.h b/UI/Common/UIxPageFrame.h index 61ee743e1..388c91fa3 100644 --- a/UI/Common/UIxPageFrame.h +++ b/UI/Common/UIxPageFrame.h @@ -31,9 +31,23 @@ @interface UIxPageFrame : UIxComponent { NSString *title; - id item; + id item; + BOOL isPopup; } +- (NSString *) pageJavaScriptURL; +- (NSString *) productJavaScriptURL; +- (BOOL) hasPageSpecificJavaScript; +- (BOOL) hasProductSpecificJavaScript; + +- (NSString *) pageCSSURL; +- (NSString *) productCSSURL; +- (BOOL) hasPageSpecificCSS; +- (BOOL) hasProductSpecificCSS; + +- (void) setPopup: (BOOL) popup; +- (BOOL) isPopup; + @end #endif /* UIXPAGEFRAME_H */ diff --git a/UI/Common/UIxPageFrame.m b/UI/Common/UIxPageFrame.m index a758d95ae..7f27fa719 100644 --- a/UI/Common/UIxPageFrame.m +++ b/UI/Common/UIxPageFrame.m @@ -39,6 +39,7 @@ - (void)setTitle:(NSString *)_value { ASSIGNCOPY(self->title, _value); } + - (NSString *)title { if ([self isUIxDebugEnabled]) return self->title; @@ -49,6 +50,7 @@ - (void)setItem:(id)_item { ASSIGN(self->item, _item); } + - (id)item { return self->item; } @@ -59,14 +61,16 @@ /* Help URL/target */ -- (NSString *)helpURL { +- (NSString *)helpURL +{ return [NSString stringWithFormat: @"help/%@.html", self->title]; } -- (NSString *)helpWindowTarget { + +- (NSString *)helpWindowTarget +{ return [NSString stringWithFormat: @"Help_%@", self->title]; } - /* notifications */ - (void)sleep { @@ -77,108 +81,66 @@ /* URL generation */ // TODO: I think all this should be done by the clientObject?! -- (NSString *)relativeHomePath { +- (NSString *) relativeHomePath +{ return [self relativePathToUserFolderSubPath: @""]; } -- (NSString *)relativeCalendarPath { +- (NSString *)relativeCalendarPath +{ return [self relativePathToUserFolderSubPath: @"Calendar/"]; } -- (NSString *)relativeContactsPath { +- (NSString *)relativeContactsPath +{ return [self relativePathToUserFolderSubPath: @"Contacts/"]; } -- (NSString *)relativeMailPath { +- (NSString *)relativeMailPath +{ return [self relativePathToUserFolderSubPath: @"Mail/"]; } -- (NSString *)logoffPath { +- (NSString *)logoffPath +{ return [self relativePathToUserFolderSubPath: @"logoff"]; } -/* page based JavaScript */ - -- (WOResourceManager *)pageResourceManager { - WOResourceManager *rm; - - if ((rm = [[[self context] page] resourceManager]) == nil) - rm = [[WOApplication application] resourceManager]; - return rm; +/* popup handling */ +- (void) setPopup: (BOOL) popup +{ + isPopup = popup; } - (BOOL) isPopup { - WOComponent *page; - - page = [[self context] page]; - - return ([page respondsToSelector: @selector(isPopup)] - && [page isPopup]); + return isPopup; } +/* page based JavaScript */ + - (NSString *) pageJavaScriptURL { - static NSMutableDictionary *pageToURL = nil; - WOResourceManager *rm; WOComponent *page; - NSString *jsname, *pageName; - NSString *url; + NSString *pageJSFilename; page = [[self context] page]; - pageName = NSStringFromClass([page class]); - // TODO: does not seem to work! (gets reset): pageName = [page name]; - - if ((url = [pageToURL objectForKey:pageName]) != nil) - return [url isNotNull] ? url : nil; + pageJSFilename = [NSString stringWithFormat: @"%@.js", + NSStringFromClass([page class])]; - if (pageToURL == nil) - pageToURL = [[NSMutableDictionary alloc] initWithCapacity:32]; - - rm = [self pageResourceManager]; - jsname = [pageName stringByAppendingString: @".js"]; - - url = [rm urlForResourceNamed: jsname - inFramework: [[NSBundle bundleForClass: [page class]] bundlePath] - languages:nil - request:[[self context] request]]; - - /* cache */ - [pageToURL setObject:(url ? url : (id)[NSNull null]) forKey:pageName]; - - return url; + return [self urlForResourceFilename: pageJSFilename]; } - (NSString *) productJavaScriptURL { - static NSMutableDictionary *pageToURL = nil; - WOResourceManager *rm; WOComponent *page; - NSString *jsname, *pageName; - NSString *url; + NSString *fwJSFilename; + + page = [[self context] page]; + fwJSFilename = [NSString stringWithFormat: @"%@.js", + [page frameworkName]]; - page = [[self context] page]; - pageName = NSStringFromClass([page class]); - // TODO: does not seem to work! (gets reset): pageName = [page name]; - - if ((url = [pageToURL objectForKey:pageName]) != nil) - return [url isNotNull] ? url : nil; - - if (pageToURL == nil) - pageToURL = [[NSMutableDictionary alloc] initWithCapacity:32]; - - rm = [self pageResourceManager]; - jsname = [[page frameworkName] stringByAppendingString: @".js"]; - - url = [rm urlForResourceNamed: jsname - inFramework: [[NSBundle bundleForClass: [page class]] bundlePath] - languages:nil - request:[[self context] request]]; - - /* cache */ - [pageToURL setObject:(url ? url : (id)[NSNull null]) forKey:pageName]; - - return url; + return [self urlForResourceFilename: fwJSFilename]; } - (BOOL) hasPageSpecificJavaScript @@ -191,4 +153,38 @@ return ([[self productJavaScriptURL] length] > 0); } +- (NSString *) pageCSSURL +{ + WOComponent *page; + NSString *pageJSFilename; + + page = [[self context] page]; + pageJSFilename = [NSString stringWithFormat: @"%@.css", + NSStringFromClass([page class])]; + + return [self urlForResourceFilename: pageJSFilename]; +} + +- (NSString *) productCSSURL +{ + WOComponent *page; + NSString *fwJSFilename; + + page = [[self context] page]; + fwJSFilename = [NSString stringWithFormat: @"%@.css", + [page frameworkName]]; + + return [self urlForResourceFilename: fwJSFilename]; +} + +- (BOOL) hasPageSpecificCSS +{ + return ([[self pageCSSURL] length] > 0); +} + +- (BOOL) hasProductSpecificCSS +{ + return ([[self productCSSURL] length] > 0); +} + @end /* UIxPageFrame */ diff --git a/UI/Common/UIxToolbar.m b/UI/Common/UIxToolbar.m index ae0d37901..a325b8dde 100644 --- a/UI/Common/UIxToolbar.m +++ b/UI/Common/UIxToolbar.m @@ -19,18 +19,13 @@ 02111-1307, USA. */ -#if LIB_FOUNDATION_LIBRARY -# include -#elif NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY -# include -# include -#endif +#import +#import +#import -#include -#include -#include +#import -#include +#import @class NSArray, NSDictionary; @@ -42,8 +37,6 @@ } @end -#include - @implementation UIxToolbar - (void)dealloc { @@ -192,14 +185,13 @@ return label; } -- (id) buttonImage { - WOResourceManager *rm; +- (id) buttonImage +{ NSString *image; - rm = [self pageResourceManager]; image = [buttonInfo objectForKey: @"image"]; if (image && [image length] > 0) - image = [rm urlForResourceNamed: image]; + image = [self urlForResourceFilename: image]; return image; } @@ -213,7 +205,7 @@ if ((onOffKey = [[self buttonInfo] valueForKey:@"enabled"]) == nil) return YES; - + return [[[[self context] page] valueForKeyPath:onOffKey] boolValue]; } diff --git a/UI/Common/product.plist b/UI/Common/product.plist index 390b6120a..86fb6b4fa 100644 --- a/UI/Common/product.plist +++ b/UI/Common/product.plist @@ -30,15 +30,6 @@ }; categories = { - SOGoUserLogin = { - methods = { - logoff = { - protectedBy = "View"; - pageName = "UIxUserLogoff"; - actionName = "logoffUser"; - } - }; - }; SOGoObject = { methods = { }; diff --git a/UI/Contacts/UIxContactEditorBase.m b/UI/Contacts/UIxContactEditorBase.m index cf426904b..779302c0a 100644 --- a/UI/Contacts/UIxContactEditorBase.m +++ b/UI/Contacts/UIxContactEditorBase.m @@ -279,9 +279,4 @@ return [self redirectToLocation:uri]; } -- (BOOL) isPopup -{ - return YES; -} - @end /* UIxContactEditorBase */ diff --git a/UI/MailerUI/French.lproj/Localizable.strings b/UI/MailerUI/French.lproj/Localizable.strings index 4433f1d56..e5c8f1b1a 100644 --- a/UI/MailerUI/French.lproj/Localizable.strings +++ b/UI/MailerUI/French.lproj/Localizable.strings @@ -10,7 +10,7 @@ "Get Mail" = "Relever"; "Junk" = "Indésirable"; "Reply" = "Répondre"; -"Reply All" = "Répo. à tous"; +"Reply All" = "Rép. à tous"; "Print" = "Imprimer"; "Stop" = "Stop"; "Write" = "Écrire"; @@ -19,7 +19,7 @@ "Home" = "Accueil"; "Calendar" = "Agenda"; -"Addressbook" = "Carnet d'adresses"; +"Addressbook" = "Adresses"; "Mail" = "Mail"; "Right Administration" = "Administration"; "Help" = "Aide"; @@ -54,7 +54,7 @@ "all" = "Tous"; "read" = "Lus"; "unread" = "Non Lus"; -"deleted" = "Éffacés"; +"deleted" = "Effacés"; "flagged" = "Drapeau"; /* MailListView */ @@ -80,7 +80,7 @@ "SentFolderName" = "Éléments envoyés"; "TrashFolderName" = "Corbeille"; -"InboxFolderName" = "Boite de Réception"; +"InboxFolderName" = "Boite de réception"; "DraftsFolderName" = "Brouillons"; "SieveFolderName" = "Filtres"; "Folders" = "Dossiers"; @@ -93,3 +93,50 @@ "Add to Address Book..." = "Ajouter au carnet d'adresses"; "Compose Mail To" = "Écrire à"; "Create Filter From Message..." = "Créer un filtre à partir du message..."; + +/* Mailbox popup menus */ +"Open in New Mail Window" = "Ouvrir dans une nouvelle fenétre"; +"Copy Folder Location" = "Copier l'adresse du dossier"; +"Subscribe..." = "S'abonner..."; +"Mark Folder Read..." = "Marquer le dossier comme lu"; +"New Folder..." = "Nouveau dossier..."; +"Compact This Folder" = "Compacter ce dossier"; +"Search Messages..." = "Rechercher dans les messages..."; +"Properties..." = "Propriétés"; +"New Subfolder..." = "Nouveau sous-dossier..."; +"Rename Folder..." = "Renommer le dossier..."; +"Delete Folder" = "Supprimer le dossier..."; +"Get Messages for Account" = "Relever les messages de ce compte"; + +/* Message list popup menu */ +"Open Message In New Window" = "Ouvrir dans une nouvelle fenétre"; +"Reply to Sender Only" = "Répondre à l'expéditeur"; +"Reply to All" = "Répondre à tout le monde"; +"Forward" = "Transférer"; +"Edit As New..." = "Modifier comme un nouveau message"; +"Move To" = "Déplacer vers"; +"Copy To" = "Copier vers"; +"Label" = "Étiquette"; +"Mark" = "Marquer"; +"Save As..." = "Enregistrer comme..."; +"Print Preview" = "Aperçu avant impression"; +"Print..." = "Imprimer..."; +"Delete Message" = "Supprimer le message"; + +/* Label popup menu */ +"None" = "Aucune"; +"Important" = "Important"; +"Work" = "Travail"; +"Personal" = "Personnel"; +"To Do" = "À faire"; +"Later" = "Peut attendre"; + +/* Mark popup menu */ +"As Read" = "Comme lu"; +"Thread As Read" = "La discussion comme lue"; +"As Read By Date..." = "Comme lus par date..."; +"All Read" = "Tous les messages comme lus"; +"Flag" = "Avec un drapeau"; +"As Junk" = "Comme indésirable"; +"As Not Junk" = "Comme acceptable"; +"Run Junk Mail Controls" = "Lancer le contrôle des indésirables"; diff --git a/UI/MailerUI/GNUmakefile b/UI/MailerUI/GNUmakefile index 9def5acbb..123889d9c 100644 --- a/UI/MailerUI/GNUmakefile +++ b/UI/MailerUI/GNUmakefile @@ -19,11 +19,16 @@ MailerUI_OBJC_FILES += \ UIxMailMainFrame.m \ UIxMailTree.m \ UIxMailTreeBlock.m \ + UIxMailTreeBlockJS.m \ + UIxMailFolderMenu.m \ \ UIxMailAccountsView.m \ UIxMailAccountView.m \ + UIxMailAccountViewContainer.m \ UIxMailListView.m \ + UIxMailListViewContainer.m \ UIxMailView.m \ + UIxMailViewContainer.m \ UIxMailSortableTableHeader.m \ UIxMailMoveToPopUp.m \ UIxMailFilterPanel.m \ @@ -40,12 +45,11 @@ MailerUI_OBJC_FILES += \ UIxFilterList.m \ UIxSieveEditor.m \ \ - UIxMailFolderACLEditor.m \ + UIxMailFolderACLEditor.m MailerUI_RESOURCE_FILES += \ Version \ product.plist \ - UIxMailView.js \ Toolbars/*.toolbar \ Images/*.png diff --git a/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar b/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar index 432b22b1a..2a7ef183b 100644 --- a/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar +++ b/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar @@ -6,12 +6,12 @@ cssClass = "tbicon_send"; label = "Send"; }, { link = "#"; target = "addressbook"; onclick = "openAddressbook(this);return false;"; - image = "tb-mail-addressbook-flat-24x24.png"; - cssClass = "tbicon_addressbook"; label = "Addressbook"; }, - { link = "#"; target = "anais"; + image = "tb-compose-contacts-flat-24x24.png"; + cssClass = "tbicon_addressbook"; label = "Contacts"; }, +/* { link = "#"; target = "anais"; onclick = "openAnais(this);return false;"; image = "tbtb_anais.png"; - cssClass = "tbicon_anais"; label = "Anais"; }, + cssClass = "tbicon_anais"; label = "Anais"; }, */ { link = "#"; isSafe = NO; onclick = "clickedEditorAttach(this)"; image = "tb-compose-attach-flat-24x24.png"; @@ -20,8 +20,5 @@ onclick = "clickedEditorSave(this);return false;"; image = "tb-mail-file-flat-24x24.png"; cssClass = "tbicon_save"; label = "Save"; }, - { link = "delete"; isSafe = NO; - image = "tb-mail-delete-flat-24x24.png"; - cssClass = "tbicon_delete"; label = "Delete"; }, ) ) diff --git a/UI/MailerUI/Toolbars/SOGoMailObject.toolbar b/UI/MailerUI/Toolbars/SOGoMailObject.toolbar index 593355f7e..c32e7d60d 100644 --- a/UI/MailerUI/Toolbars/SOGoMailObject.toolbar +++ b/UI/MailerUI/Toolbars/SOGoMailObject.toolbar @@ -10,6 +10,10 @@ image = "tb-mail-write-flat-24x24.png"; onclick = "clickedCompose(this);return false;"; cssClass = "tbicon_compose"; label = "Write"; }, + { link = "#"; target = "addressbook"; + onclick = "openAddressbook(this);return false;"; + image = "tb-mail-addressbook-flat-24x24.png"; + cssClass = "tbicon_addressbook"; label = "Addressbook"; }, ), ( // second group @@ -30,28 +34,25 @@ ), ( // third group - { link = "delete"; isSafe = NO; + { link = "delete"; + isSafe = NO; enabled = showMarkDeletedButton; image = "tb-mail-delete-flat-24x24.png"; cssClass = "tbicon_delete"; label = "Delete"; }, - - { link = "trash"; isSafe = NO; - enabled = showTrashButton; - image = "tb-mail-delete-flat-24x24.png"; - cssClass = "tbicon_delete"; label = "Delete"; }, - - /* TODO: enable when we know how to mark junk (#971) - => we could move the mail to the Junk folder?! - { link = "#"; - isSafe = NO; - cssClass = "tbicon_junk"; label = "Junk"; }, - */ + { link = "#"; + isSafe = NO; + image = "tb-mail-junk-flat-24x24.png"; + cssClass = "tbicon_junk"; label = "Junk"; + }, ), -/* - ( // fourth group - // TODO: enable when we can print (#1207) - // { link = "#"; cssClass = "tbicon_print"; label = "Print"; }, - { link = "#"; cssClass = "tbicon_stop"; label = "Stop"; }, + ( + { link = "#"; + cssClass = "tbicon_print"; + image = "tb-mail-print-flat-24x24.png"; + label = "Print"; }, + { link = "#"; + image = "tb-mail-stop-flat-24x24.png"; + cssClass = "tbicon_stop"; + label = "Stop"; }, ), -*/ ) diff --git a/UI/MailerUI/UIxMailAccountView.m b/UI/MailerUI/UIxMailAccountView.m index 9df7fbe4c..dd13c0a1c 100644 --- a/UI/MailerUI/UIxMailAccountView.m +++ b/UI/MailerUI/UIxMailAccountView.m @@ -113,6 +113,12 @@ static BOOL useAltNamespace = NO; return [self->inbox isCreateAllowedInACL]; } +- (NSString *) mailFolderName +{ + return [NSString stringWithFormat: @"/%@", + [[self clientObject] nameInContainer]]; +} + /* error redirects */ - (id)redirectToViewWithError:(id)_error { diff --git a/UI/MailerUI/UIxMailAccountViewContainer.h b/UI/MailerUI/UIxMailAccountViewContainer.h new file mode 100644 index 000000000..e9c57ac39 --- /dev/null +++ b/UI/MailerUI/UIxMailAccountViewContainer.h @@ -0,0 +1,32 @@ +/* UIxMailAccountViewContainer.h - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#ifndef UIXMAILACCOUNTVIEWCONTAINER_H +#define UIXMAILACCOUNTVIEWCONTAINER_H + +#import + +@interface UIxMailAccountViewContainer : UIxComponent + +@end + +#endif /* UIXMAILLISTVIEWCONTAINER_H */ diff --git a/UI/MailerUI/UIxMailAccountViewContainer.m b/UI/MailerUI/UIxMailAccountViewContainer.m new file mode 100644 index 000000000..ed448becb --- /dev/null +++ b/UI/MailerUI/UIxMailAccountViewContainer.m @@ -0,0 +1,27 @@ +/* UIxMailAccountViewContainer.m - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 "UIxMailAccountViewContainer.h" + +@implementation UIxMailAccountViewContainer + +@end diff --git a/UI/MailerUI/UIxMailAccountsView.m b/UI/MailerUI/UIxMailAccountsView.m index cbef1b2b3..43dc81194 100644 --- a/UI/MailerUI/UIxMailAccountsView.m +++ b/UI/MailerUI/UIxMailAccountsView.m @@ -35,4 +35,23 @@ return [self labelForKey:@"SOGo Mail Accounts"]; } +- (id) defaultAction +{ + NSArray *c; + NSString *inbox; + id actionResult; + + c = [[self clientObject] toManyRelationshipKeys]; + if ([c count] == 1) + { + inbox = [NSString stringWithFormat: @"%@/INBOX", + [c objectAtIndex: 0]]; + actionResult = [self redirectToLocation: inbox]; + } + else + actionResult = self; + + return actionResult; +} + @end /* UIxMailAccountsView */ diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index fc8720c7d..0c2063d72 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -280,17 +280,17 @@ static NSArray *infoKeys = nil; SOGoMailAccounts *accounts; SOGoMailAccount *account; SOGoMailIdentity *identity; - + if (useLocationBasedSentFolder) /* from will be based on location */ return; - + if ([self->from isNotEmpty]) /* a from is already set */ return; - + accountID = [[[self context] request] formValueForKey:@"account"]; if (![accountID isNotEmpty]) return; - + accounts = [[self clientObject] mailAccountsFolder]; if ([accounts isExceptionOrNull]) return; /* we don't treat this as an error but are tolerant */ @@ -306,7 +306,7 @@ static NSArray *infoKeys = nil; return; } - [self setFrom:[identity email]]; + [self setFrom: [identity email]]; } - (SOGoMailIdentity *)selectedMailIdentity { diff --git a/UI/MailerUI/UIxMailEditorAction.m b/UI/MailerUI/UIxMailEditorAction.m index ab43a8703..dc0e4b743 100644 --- a/UI/MailerUI/UIxMailEditorAction.m +++ b/UI/MailerUI/UIxMailEditorAction.m @@ -27,7 +27,7 @@ #include #include "common.h" -#import "../Common/NSString+URL.h" +#import "../SOGoUI/NSString+URL.h" @implementation UIxMailEditorAction diff --git a/UI/MailerUI/UIxMailFilterPanel.m b/UI/MailerUI/UIxMailFilterPanel.m index 8b8434347..50df0507c 100644 --- a/UI/MailerUI/UIxMailFilterPanel.m +++ b/UI/MailerUI/UIxMailFilterPanel.m @@ -25,10 +25,6 @@ { NSString *searchText; NSString *searchCriteria; - struct { - int hideFrame:1; - int reserved:31; - } mfFlags; } @end @@ -79,8 +75,6 @@ static NSDictionary *filterToQualifier = nil; { searchText = nil; searchCriteria = nil; - mfFlags.hideFrame = 0; - mfFlags.reserved = 0; } return self; @@ -94,16 +88,6 @@ static NSDictionary *filterToQualifier = nil; /* accessors */ -- (void)setHideFrame:(BOOL)_flag -{ - self->mfFlags.hideFrame = _flag ? 1 : 0; -} - -- (BOOL)hideFrame -{ - return self->mfFlags.hideFrame ? YES : NO; -} - - (void)setSearchText: (NSString *)_txt { ASSIGNCOPY(self->searchText, _txt); diff --git a/UI/MailerUI/UIxMailListView.h b/UI/MailerUI/UIxMailListView.h new file mode 100644 index 000000000..c98cb4ba5 --- /dev/null +++ b/UI/MailerUI/UIxMailListView.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#ifndef UIXMAILLISTVIEW_H +#define UIXMAILLISTVIEW_H + +#include + +@class EOQualifier; + +@interface UIxMailListView : UIxComponent +{ + NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ + NSArray *messages; + unsigned firstMessageNumber; + id message; + EOQualifier *qualifier; +} + +- (NSString *)defaultSortKey; +- (NSString *)imap4SortKey; +- (NSString *)imap4SortOrdering; + +- (BOOL)isSortedDescending; + +@end + +#endif /* UIXMAILLISTVIEW_H */ diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index a6b09cc7d..fb5dcaf6b 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -19,8 +19,6 @@ 02111-1307, USA. */ -#include - /* UIxMailListView @@ -28,35 +26,20 @@ object. */ -@class EOQualifier; - -@interface UIxMailListView : UIxComponent -{ - NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ - NSArray *messages; - unsigned firstMessageNumber; - id message; - EOQualifier *qualifier; -} - -- (NSString *)defaultSortKey; -- (NSString *)imap4SortKey; -- (NSString *)imap4SortOrdering; - -- (BOOL)isSortedDescending; - -@end - #include "common.h" #include #include #include -@implementation UIxMailListView +#import "UIxMailListView.h" static int attachmentFlagSize = 8096; -- (void)dealloc { +@implementation UIxMailListView + + +- (void) dealloc +{ [self->qualifier release]; [self->sortedUIDs release]; [self->messages release]; @@ -64,15 +47,10 @@ static int attachmentFlagSize = 8096; [super dealloc]; } -/* frame */ - -- (BOOL)hideFrame { - return [[[[self context] request] formValueForKey:@"noframe"] boolValue]; -} - /* notifications */ -- (void)sleep { +- (void) sleep +{ [self->qualifier release]; self->qualifier = nil; [self->sortedUIDs release]; self->sortedUIDs = nil; [self->messages release]; self->messages = nil; @@ -82,21 +60,28 @@ static int attachmentFlagSize = 8096; /* accessors */ -- (void)setMessage:(id)_msg { +- (void)setMessage:(id)_msg +{ ASSIGN(self->message, _msg); } -- (id)message { + +- (id) message +{ return self->message; } -- (void)setQualifier:(EOQualifier *)_msg { +- (void) setQualifier: (EOQualifier *) _msg +{ ASSIGN(self->qualifier, _msg); } -- (EOQualifier *)qualifier { + +- (EOQualifier *) qualifier +{ return self->qualifier; } -- (BOOL)showToAddress { +- (BOOL) showToAddress +{ NSString *ftype; ftype = [[self clientObject] valueForKey:@"outlookFolderClass"]; @@ -105,10 +90,13 @@ static int attachmentFlagSize = 8096; /* title */ -- (NSString *)objectTitle { +- (NSString *) objectTitle +{ return [[self clientObject] nameInContainer]; } -- (NSString *)panelTitle { + +- (NSString *) panelTitle +{ NSString *s; s = [self labelForKey:@"View Mail Folder"]; @@ -119,24 +107,35 @@ static int attachmentFlagSize = 8096; /* derived accessors */ -- (BOOL)isMessageDeleted { +- (BOOL) isMessageDeleted +{ NSArray *flags; flags = [[self message] valueForKey:@"flags"]; return [flags containsObject:@"deleted"]; } -- (BOOL)isMessageRead { +- (BOOL) isMessageRead +{ NSArray *flags; flags = [[self message] valueForKey:@"flags"]; return [flags containsObject:@"seen"]; } -- (NSString *)messageUidString { +- (NSString *) messageUidString +{ return [[[self message] valueForKey:@"uid"] stringValue]; } -- (NSString *)messageSubjectCellStyleClass { +- (NSString *) messageCellStyleClass +{ + return [self isMessageDeleted] + ? @"mailer_listcell_deleted" + : @"mailer_listcell_regular"; +} + +- (NSString *) messageSubjectCellStyleClass +{ return [NSString stringWithFormat: @"%@ %@", [self messageCellStyleClass], ([self isMessageRead] @@ -144,13 +143,8 @@ static int attachmentFlagSize = 8096; : @"mailer_unreadmailsubject")]; } -- (NSString *)messageCellStyleClass { - return [self isMessageDeleted] - ? @"mailer_listcell_deleted" - : @"mailer_listcell_regular"; -} - -- (BOOL)hasMessageAttachment { +- (BOOL) hasMessageAttachment +{ /* we detect attachments by size ... */ unsigned size; @@ -160,7 +154,8 @@ static int attachmentFlagSize = 8096; /* fetching messages */ -- (NSArray *)fetchKeys { +- (NSArray *) fetchKeys +{ /* Note: see SOGoMailManager.m for allowed IMAP4 keys */ static NSArray *keys = nil; if (keys == nil) { @@ -170,10 +165,12 @@ static int attachmentFlagSize = 8096; return keys; } -- (NSString *)defaultSortKey { +- (NSString *) defaultSortKey +{ return @"DATE"; } -- (NSString *)imap4SortKey { +- (NSString *) imap4SortKey +{ NSString *sort; sort = [[[self context] request] formValueForKey:@"sort"]; @@ -183,7 +180,8 @@ static int attachmentFlagSize = 8096; return [sort uppercaseString]; } -- (BOOL)isSortedDescending { +- (BOOL) isSortedDescending +{ NSString *desc; desc = [[[self context] request] formValueForKey:@"desc"]; @@ -192,7 +190,8 @@ static int attachmentFlagSize = 8096; return [desc boolValue] ? YES : NO; } -- (NSString *)imap4SortOrdering { +- (NSString *) imap4SortOrdering +{ NSString *sort; sort = [self imap4SortKey]; @@ -201,13 +200,15 @@ static int attachmentFlagSize = 8096; return [@"REVERSE " stringByAppendingString:sort]; } -- (NSRange)fetchRange { +- (NSRange) fetchRange +{ if (self->firstMessageNumber == 0) return NSMakeRange(0, 50); return NSMakeRange(self->firstMessageNumber - 1, 50); } -- (NSArray *)sortedUIDs { +- (NSArray *) sortedUIDs +{ if (self->sortedUIDs != nil) return self->sortedUIDs; @@ -216,14 +217,19 @@ static int attachmentFlagSize = 8096; sortOrdering:[self imap4SortOrdering]] retain]; return self->sortedUIDs; } -- (unsigned int)totalMessageCount { + +- (unsigned int) totalMessageCount +{ return [self->sortedUIDs count]; } -- (BOOL)showsAllMessages { + +- (BOOL) showsAllMessages +{ return ([[self sortedUIDs] count] <= [self fetchRange].length) ? YES : NO; } -- (NSRange)fetchBlock { +- (NSRange) fetchBlock +{ NSRange r; unsigned len; NSArray *uids; @@ -249,27 +255,33 @@ static int attachmentFlagSize = 8096; r.length = len - r.location; return r; } -- (unsigned int)firstMessageNumber { +- (unsigned int) firstMessageNumber +{ return [self fetchBlock].location + 1; } -- (unsigned int)lastMessageNumber { +- (unsigned int) lastMessageNumber +{ NSRange r; r = [self fetchBlock]; return r.location + r.length; } -- (BOOL)hasPrevious { +- (BOOL) hasPrevious +{ return [self fetchBlock].location == 0 ? NO : YES; } -- (BOOL)hasNext { +- (BOOL) hasNext +{ NSRange r = [self fetchBlock]; return r.location + r.length >= [[self sortedUIDs] count] ? NO : YES; } -- (unsigned int)nextFirstMessageNumber { +- (unsigned int) nextFirstMessageNumber +{ return [self firstMessageNumber] + [self fetchRange].length; } -- (unsigned int)prevFirstMessageNumber { +- (unsigned int) prevFirstMessageNumber +{ NSRange r; unsigned idx; @@ -280,7 +292,8 @@ static int attachmentFlagSize = 8096; return 1; } -- (NSArray *)messages { +- (NSArray *) messages +{ NSArray *uids; NSArray *msgs; NSRange r; @@ -302,10 +315,14 @@ static int attachmentFlagSize = 8096; /* URL processing */ -- (NSString *)messageViewTarget { - return [@"SOGo_msg_" stringByAppendingString:[self messageUidString]]; +- (NSString *) messageViewTarget +{ + return [NSString stringWithFormat: @"SOGo_msg_%@", + [self messageUidString]]; } -- (NSString *)messageViewURL { + +- (NSString *) messageViewURL +{ // TODO: noframe only when view-target is empty // TODO: markread only if the message is unread NSString *s; @@ -314,11 +331,13 @@ static int attachmentFlagSize = 8096; if (![self isMessageRead]) s = [s stringByAppendingString:@"&markread=1"]; return s; } -- (NSString *)markReadURL { +- (NSString *) markReadURL +{ return [@"markMessageRead?uid=" stringByAppendingString: [self messageUidString]]; } -- (NSString *)markUnreadURL { +- (NSString *) markUnreadURL +{ return [@"markMessageUnread?uid=" stringByAppendingString: [self messageUidString]]; } @@ -345,35 +364,41 @@ static int attachmentFlagSize = 8096; return [@"unreaddiv_" stringByAppendingString:[self messageUidString]]; } -- (NSString *)clickedMsgJS { +- (NSString *) clickedMsgJS +{ /* return 'false' aborts processing */ return [NSString stringWithFormat:@"clickedUid(this, '%@'); return false", [self messageUidString]]; } // the following are unused? -- (NSString *)dblClickedMsgJS { +- (NSString *) dblClickedMsgJS +{ return [NSString stringWithFormat:@"doubleClickedUid(this, '%@')", [self messageUidString]]; } // the following are unused? -- (NSString *)highlightRowJS { +- (NSString *) highlightRowJS +{ return [NSString stringWithFormat:@"highlightUid(this, '%@')", [self messageUidString]]; } -- (NSString *)lowlightRowJS { +- (NSString *) lowlightRowJS +{ return [NSString stringWithFormat:@"lowlightUid(this, '%@')", [self messageUidString]]; } -- (NSString *)markUnreadJS { +- (NSString *) markUnreadJS +{ return [NSString stringWithFormat: @"mailListMarkMessage(this, 'markMessageUnread', " @"'%@', false)", [self messageUidString]]; } -- (NSString *)markReadJS { +- (NSString *) markReadJS +{ return [NSString stringWithFormat: @"mailListMarkMessage(this, 'markMessageRead', " @"'%@', true)", @@ -382,7 +407,8 @@ static int attachmentFlagSize = 8096; /* error redirects */ -- (id)redirectToViewWithError:(id)_error { +- (id) redirectToViewWithError: (id) _error +{ // TODO: DUP in UIxMailAccountView // TODO: improve, localize // TODO: there is a bug in the treeview which preserves the current URL for @@ -404,7 +430,8 @@ static int attachmentFlagSize = 8096; /* active message */ -- (SOGoMailObject *)lookupActiveMessage { +- (SOGoMailObject *) lookupActiveMessage +{ NSString *uid; if ((uid = [[[self context] request] formValueForKey:@"uid"]) == nil) @@ -416,16 +443,13 @@ static int attachmentFlagSize = 8096; /* actions */ -- (id)defaultAction { - self->firstMessageNumber = - [[[[self context] request] formValueForKey:@"idx"] intValue]; - return self; -} - -- (BOOL)isJavaScriptRequest { +- (BOOL) isJavaScriptRequest +{ return [[[[self context] request] formValueForKey:@"jsonly"] boolValue]; } -- (id)javaScriptOK { + +- (id) javaScriptOK +{ WOResponse *r; r = [[self context] response]; @@ -433,7 +457,21 @@ static int attachmentFlagSize = 8096; return r; } -- (id)markMessageUnreadAction { +- (id) defaultAction +{ + self->firstMessageNumber = + [[[[self context] request] formValueForKey:@"idx"] intValue]; + + return self; +} + +- (id) viewAction +{ + return [self defaultAction]; +} + +- (id) markMessageUnreadAction +{ NSException *error; if ((error = [[self lookupActiveMessage] removeFlags:@"seen"]) != nil) @@ -445,7 +483,9 @@ static int attachmentFlagSize = 8096; return [self redirectToLocation:@"view"]; } -- (id)markMessageReadAction { + +- (id) markMessageReadAction +{ NSException *error; if ((error = [[self lookupActiveMessage] addFlags:@"seen"]) != nil) @@ -458,7 +498,8 @@ static int attachmentFlagSize = 8096; return [self redirectToLocation:@"view"]; } -- (id)getMailAction { +- (id) getMailAction +{ // TODO: we might want to flush the caches? id client; @@ -466,18 +507,21 @@ static int attachmentFlagSize = 8096; return [NSException exceptionWithHTTPStatus:404 /* Not Found */ reason:@"did not find mail folder"]; } - - if (![client respondsToSelector:@selector(flushMailCaches)]) { - return [NSException exceptionWithHTTPStatus:500 /* Server Error */ - reason: - @"invalid client object (does not support flush)"]; - } - + + if (![client respondsToSelector:@selector(flushMailCaches) ]) + { + return [NSException exceptionWithHTTPStatus:500 /* Server Error */ + reason: + @"invalid client object (does not support flush)"]; + } + [client flushMailCaches]; + return [self redirectToLocation:@"view"]; } -- (id)expungeAction { +- (id) expungeAction +{ // TODO: we might want to flush the caches? NSException *error; id client; @@ -495,7 +539,8 @@ static int attachmentFlagSize = 8096; return [self redirectToLocation:@"view"]; } -- (id)emptyTrashAction { +- (id) emptyTrashAction +{ // TODO: we might want to flush the caches? NSException *error; id client; @@ -536,7 +581,8 @@ static int attachmentFlagSize = 8096; /* folder operations */ -- (id)createFolderAction { +- (id) createFolderAction +{ NSException *error; NSString *folderName; id client; @@ -562,7 +608,8 @@ static int attachmentFlagSize = 8096; return [self redirectToLocation:[folderName stringByAppendingString:@"/"]]; } -- (id)deleteFolderAction { +- (id) deleteFolderAction +{ NSException *error; NSString *url; id client; @@ -583,4 +630,6 @@ static int attachmentFlagSize = 8096; return [self redirectToLocation:url]; } -@end /* UIxMailListView */ +@end + +/* UIxMailListView */ diff --git a/UI/MailerUI/UIxMailListViewContainer.h b/UI/MailerUI/UIxMailListViewContainer.h new file mode 100644 index 000000000..dac635376 --- /dev/null +++ b/UI/MailerUI/UIxMailListViewContainer.h @@ -0,0 +1,34 @@ +/* UIxMailListViewContainer.h - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#ifndef UIXMAILLISTVIEWCONTAINER_H +#define UIXMAILLISTVIEWCONTAINER_H + +#import + +@interface UIxMailListViewContainer : UIxComponent + +- (NSString *) mailFolderName; + +@end + +#endif /* UIXMAILLISTVIEWCONTAINER_H */ diff --git a/UI/MailerUI/UIxMailListViewContainer.m b/UI/MailerUI/UIxMailListViewContainer.m new file mode 100644 index 000000000..30457bee1 --- /dev/null +++ b/UI/MailerUI/UIxMailListViewContainer.m @@ -0,0 +1,51 @@ +/* UIxMailListViewContainer.m - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 "UIxMailListViewContainer.h" + +@implementation UIxMailListViewContainer + +- (NSString *) mailFolderName +{ + NSMutableArray *mailboxes; + SOGoMailObject *currentObject; + + mailboxes = [NSMutableArray new]; + [mailboxes autorelease]; + + currentObject = [self clientObject]; + while (![currentObject isKindOfClass: [SOGoMailAccounts class]]) + { + [mailboxes insertObject: [currentObject nameInContainer] atIndex: 0]; + currentObject = [currentObject container]; + } + + return [NSString stringWithFormat: @"/%@", + [mailboxes componentsJoinedByString: @"/"]]; +} + +@end diff --git a/UI/MailerUI/UIxMailMainFrame.h b/UI/MailerUI/UIxMailMainFrame.h new file mode 100644 index 000000000..2de756099 --- /dev/null +++ b/UI/MailerUI/UIxMailMainFrame.h @@ -0,0 +1,44 @@ +/* UIxMailMainFrame.h - this file is part of $PROJECT_NAME_HERE$ + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#ifndef UIXMAILMAINFRAME_H +#define UIXMAILMAINFRAME_H + +#import "../Common/UIxPageFrame.h" + +@interface UIxMailMainFrame : UIxPageFrame +{ + NSString *rootURL; + NSString *userRootURL; + struct { + int hideFolderTree:1; + int reserved:31; + } mmfFlags; +} + +- (NSString *)rootURL; +- (NSString *)userRootURL; +- (NSString *)calendarRootURL; + +@end + +#endif /* UIXMAILMAINFRAME_H */ diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index bd64ca6bd..d15e4cbfa 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -19,31 +19,11 @@ 02111-1307, USA. */ -#include -#include "../Common/UIxPageFrame.h" +#import +#import "UIxMailMainFrame.h" -@interface UIxMailMainFrame : UIxPageFrame -{ - NSString *rootURL; - NSString *userRootURL; - struct { - int hideFolderTree:1; - int hideFrame:1; /* completely disables all the frame around the comp. */ - int reserved:30; - } mmfFlags; -} - -- (NSString *)rootURL; -- (NSString *)userRootURL; -- (NSString *)calendarRootURL; - -@end - -@interface UIxMailPanelFrame : UIxMailMainFrame -@end - -#include "common.h" -#include +#import "common.h" +#import @implementation UIxMailMainFrame @@ -78,14 +58,7 @@ static NSString *treeRootClassName = nil; return self->mmfFlags.hideFolderTree ? YES : NO; } -- (void)setHideFrame:(BOOL)_flag { - self->mmfFlags.hideFrame = _flag ? 1 : 0; -} -- (BOOL)hideFrame { - return self->mmfFlags.hideFrame ? YES : NO; -} - -- (NSString *)pageFormURL { +- (NSString *) pageFormURL { NSString *u; NSRange r; @@ -179,6 +152,7 @@ static NSString *treeRootClassName = nil; - (NSString *)calendarRootURL { return [[self userRootURL] stringByAppendingString:@"Calendar/"]; } + - (NSString *)contactsRootURL { return [[self userRootURL] stringByAppendingString:@"Contacts/"]; } @@ -210,14 +184,3 @@ static NSString *treeRootClassName = nil; } @end /* UIxMailMainFrame */ - -@implementation UIxMailPanelFrame - -- (BOOL)hideFolderTree { - return YES; -} -- (BOOL)showLinkBanner { - return NO; -} - -@end /* UIxMailPanelFrame */ diff --git a/UI/MailerUI/UIxMailSortableTableHeader.m b/UI/MailerUI/UIxMailSortableTableHeader.m index f7cbc4b97..3aa78e34b 100644 --- a/UI/MailerUI/UIxMailSortableTableHeader.m +++ b/UI/MailerUI/UIxMailSortableTableHeader.m @@ -65,6 +65,7 @@ - (void)setSortKey:(NSString *)_sortKey { ASSIGNCOPY(self->sortKey, _sortKey); } + - (NSString *)sortKey { return self->sortKey; } diff --git a/UI/MailerUI/UIxMailTree.h b/UI/MailerUI/UIxMailTree.h new file mode 100644 index 000000000..9e4c96442 --- /dev/null +++ b/UI/MailerUI/UIxMailTree.h @@ -0,0 +1,43 @@ +/* UIxMailTree.h - this file is part of $PROJECT_NAME_HERE$ + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#ifndef UIXMAILTREE_H +#define UIXMAILTREE_H + +#import + +@class NSString; + +@interface UIxMailTree : UIxComponent +{ + NSString *rootClassName; + NSString *treeFolderAction; + NSMutableDictionary *flattenedNodes; + id rootNodes; + id item; +} + +- (NSArray *) flattenedNodes; + +@end + +#endif /* UIXMAILTREE_H */ diff --git a/UI/MailerUI/UIxMailTree.m b/UI/MailerUI/UIxMailTree.m index 20aa7eba0..c1cc01273 100644 --- a/UI/MailerUI/UIxMailTree.m +++ b/UI/MailerUI/UIxMailTree.m @@ -19,23 +19,16 @@ 02111-1307, USA. */ -#include +#import "common.h" -@interface UIxMailTree : UIxComponent -{ - NSString *rootClassName; - NSString *treeFolderAction; - id rootNodes; - id item; -} -@end +#import +#import +#import +#import +#import -#include "UIxMailTreeBlock.h" -#include -#include -#include "common.h" -#include -#include +#import "UIxMailTree.h" +#import "UIxMailTreeBlock.h" /* Support special icons: @@ -58,21 +51,34 @@ static BOOL debugBlocks = NO; -+ (void)initialize { ++ (void)initialize +{ [UIxMailTreeBlock class]; // ensure that globals are initialized } -- (void)dealloc { +- (id) init +{ + if ((self = [super init])) + { + flattenedNodes = [NSMutableDictionary new]; + } + return self; +} + +- (void) dealloc +{ [self->treeFolderAction release]; [self->rootClassName release]; [self->rootNodes release]; [self->item release]; + [flattenedNodes release]; [super dealloc]; } /* icons */ -- (NSString *)defaultIconName { +- (NSString *) defaultIconName +{ return @"tbtv_leaf_corner_17x17.gif"; } @@ -133,7 +139,7 @@ static BOOL debugBlocks = NO; [self logWithFormat:@"to-many: %@ %@", _object, [names componentsJoinedByString:@","]]; } - + count = [names count]; ma = [NSMutableArray arrayWithCapacity:(count + 1)]; for (i = 0; i < count; i++) { @@ -180,40 +186,48 @@ static BOOL debugBlocks = NO; return [_object isKindOfClass:NSClassFromString([self rootClassName])]; } -- (NSString *)treeNavigationLinkForObject:(id)_object atDepth:(int)_depth { - NSString *link; - unsigned i; - - link = [[_object nameInContainer] stringByAppendingString:@"/"]; - link = [link stringByAppendingString:[self treeFolderAction]]; - - switch (_depth) { - case 0: return link; - case 1: return [@"../" stringByAppendingString:link]; - case 2: return [@"../../" stringByAppendingString:link]; - case 3: return [@"../../../" stringByAppendingString:link]; - } +- (NSString *)treeNavigationLinkForObject:(id)_object + atDepth:(int)_depth +{ + NSMutableString *link; + int i; + link = [NSMutableString new]; + [link autorelease]; + for (i = 0; i < _depth; i++) - link = [@"../" stringByAppendingString:link]; + [link appendString: @"../"]; + + [link appendFormat: @"%@/%@", + [_object nameInContainer], + [self treeFolderAction]]; + return link; } -- (void)getTitle:(NSString **)_t andIcon:(NSString **)_icon - forObject:(id)_object +- (void) getTitle: (NSString **)_t + folderType: (NSString **)_ft + andIcon: (NSString **)_icon + forObject: (id)_object { // TODO: need to refactor for reuse! NSString *ftype; unsigned len; + +// if ([_object respondsToSelector: @selector (outlookFolderClass)]) +// ftype = [_object outlookFolderClass]; +// else + ftype = [_object valueForKey:@"outlookFolderClass"]; + len = [ftype length]; - ftype = [_object valueForKey:@"outlookFolderClass"]; - len = [ftype length]; - + *_ft = nil; + switch (len) { case 8: if ([ftype isEqualToString:@"IPF.Sent"]) { *_t = [self labelForKey:@"SentFolderName"]; *_icon = @"tbtv_sent_17x17.gif"; + *_ft = @"sent"; return; } break; @@ -221,11 +235,13 @@ static BOOL debugBlocks = NO; if ([ftype isEqualToString:@"IPF.Inbox"]) { *_t = [self labelForKey:@"InboxFolderName"]; *_icon = @"tbtv_inbox_17x17.gif"; + *_ft = @"inbox"; return; } if ([ftype isEqualToString:@"IPF.Trash"]) { *_t = [self labelForKey:@"TrashFolderName"]; *_icon = @"tbtv_trash_17x17.gif"; + *_ft = @"trash"; return; } break; @@ -233,11 +249,13 @@ static BOOL debugBlocks = NO; if ([ftype isEqualToString:@"IPF.Drafts"]) { *_t = [self labelForKey:@"DraftsFolderName"]; *_icon = @"tbtv_drafts_17x17.gif"; + *_ft = @"drafts"; return; } if ([ftype isEqualToString:@"IPF.Filter"]) { *_t = [self labelForKey:@"SieveFolderName"]; *_icon = nil; + *_ft = @"sieve"; return; } break; @@ -249,32 +267,30 @@ static BOOL debugBlocks = NO; if ([_object isKindOfClass:NSClassFromString(@"SOGoMailFolder")]) *_icon = nil; else if ([_object isKindOfClass:NSClassFromString(@"SOGoMailAccount")]) { - *_icon = @"tbtv_inbox_17x17.gif"; + *_icon = @"tbtv_account_17x17.gif"; + + *_ft = @"account"; /* title processing is somehow Agenor specific and should be done in UI */ *_t = [[_object nameInContainer] titleForSOGoIMAP4String]; } else if ([_object isKindOfClass:NSClassFromString(@"SOGoMailAccounts")]) - *_icon = @"tbtv_inbox_17x17.gif"; + *_icon = @"tbtv_account_17x17.gif"; else if ([_object isKindOfClass:NSClassFromString(@"SOGoUserFolder")]) *_icon = @"tbtv_inbox_17x17.gif"; else { // TODO: use drafts icon for other SOGo folders *_icon = @"tbtv_drafts_17x17.gif"; } - - NSLog (@"title: '%@', ftype: '%@', class: '%@', icon: '%@'", - *_t, - ftype, NSStringFromClass([_object class]), *_icon); - - return; } -- (UIxMailTreeBlock *)treeNavigationBlockForLeafNode:(id)_o atDepth:(int)_d { +- (UIxMailTreeBlock *) treeNavigationBlockForLeafNode: (id) _o + atDepth: (int) _d +{ UIxMailTreeBlock *md; - NSString *n, *i; + NSString *n, *i, *ft; id blocks; - + /* Trigger plus in treeview if it has subfolders. It is an optimization that we do not generate blocks for folders which are not displayed anyway. @@ -282,14 +298,16 @@ static BOOL debugBlocks = NO; blocks = [[_o toManyRelationshipKeys] count] > 0 ? UIxMailTreeHasChildrenMarker : nil; - - [self getTitle:&n andIcon:&i forObject:_o]; - md = [UIxMailTreeBlock blockWithName:nil - title:n iconName:i - link:[self treeNavigationLinkForObject:_o atDepth:_d] - isPathNode:NO isActiveNode:NO - childBlocks:blocks]; + [self getTitle: &n folderType: &ft andIcon: &i forObject:_o]; + + md = [UIxMailTreeBlock blockWithName: nil + title: n + iconName: i + link: [self treeNavigationLinkForObject:_o atDepth:_d] + isPathNode:NO + isActiveNode:NO + childBlocks: blocks]; return md; } @@ -301,7 +319,7 @@ static BOOL debugBlocks = NO; UIxMailTreeBlock *md; NSMutableArray *blocks; NSArray *folders; - NSString *title, *icon; + NSString *title, *icon, *ft; unsigned i, count; if (debugBlocks) { @@ -317,7 +335,7 @@ static BOOL debugBlocks = NO; for (i = 0; i < count; i++) { id block; - block = [self treeNavigationBlockForLeafNode:[folders objectAtIndex:i] + block = [self treeNavigationBlockForLeafNode: [folders objectAtIndex:i] atDepth:0]; if ([block isNotNull]) [blocks addObject:block]; } @@ -326,18 +344,63 @@ static BOOL debugBlocks = NO; /* build block */ - [self getTitle:&title andIcon:&icon forObject:_object]; + [self getTitle:&title folderType: &ft andIcon:&icon forObject:_object]; - md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:title iconName:icon - link:[@"../" stringByAppendingString: - [_object nameInContainer]] - isPathNode:YES isActiveNode:YES - childBlocks:blocks]; + md = [UIxMailTreeBlock blockWithName: [_object nameInContainer] + title: title + iconName: icon + link: [@"../" stringByAppendingString: + [_object nameInContainer]] + isPathNode: YES + isActiveNode: YES + childBlocks: blocks]; return md; } -- (UIxMailTreeBlock *)treeNavigationBlockForActiveNode:(id)_object { +- (UIxMailTreeBlock *) fullTreeNavigationBlockForNode: (id)_object +{ + UIxMailTreeBlock *md; + NSMutableArray *blocks; + NSArray *folders; + NSString *title, *icon, *ft; + unsigned i, count; + + if (debugBlocks) + [self logWithFormat:@"block for root node 0x%08X<%@>", + _object, NSStringFromClass([_object class])]; + + folders = [self fetchSubfoldersOfObject: _object]; + count = [folders count]; + blocks = [NSMutableArray arrayWithCapacity: count]; + for (i = 0; i < count; i++) + { + id block; + + block = [self fullTreeNavigationBlockForNode: [folders objectAtIndex:i]]; + if ([block isNotNull]) [blocks addObject:block]; + } + + if (![blocks count]) + blocks = nil; + + [self getTitle: &title folderType: &ft andIcon: &icon forObject: _object]; +// NSLog (@"*********** title = '%@'/icon = '%@'", title, icon); + + md = [UIxMailTreeBlock blockWithName: [_object nameInContainer] + title: title + iconName: icon + link: [@"../" stringByAppendingString: + [_object nameInContainer]] + isPathNode: YES + isActiveNode: YES + childBlocks: blocks]; + [md setFolderType: ft]; + + return md; +} + +- (UIxMailTreeBlock *) treeNavigationBlockForActiveNode: (id) _object +{ /* This generates the block for the clientObject (the object which has the focus) @@ -345,7 +408,7 @@ static BOOL debugBlocks = NO; UIxMailTreeBlock *md; NSMutableArray *blocks; NSArray *folders; - NSString *title, *icon; + NSString *title, *icon, *ft; unsigned i, count; // TODO: maybe we can join the two implementations, this might not be @@ -367,26 +430,29 @@ static BOOL debugBlocks = NO; for (i = 0; i < count; i++) { UIxMailTreeBlock *block; - block = [self treeNavigationBlockForLeafNode:[folders objectAtIndex:i] - atDepth:0]; + block = [self treeNavigationBlockForLeafNode: [folders objectAtIndex:i] + atDepth: 0]; if ([block isNotNull]) [blocks addObject:block]; } if ([blocks count] == 0) blocks = nil; - + /* build block */ - [self getTitle:&title andIcon:&icon forObject:_object]; - md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:title iconName:icon - link:@"." - isPathNode:YES isActiveNode:YES - childBlocks:blocks]; + [self getTitle:&title folderType: &ft andIcon:&icon forObject:_object]; + md = [UIxMailTreeBlock blockWithName: [_object nameInContainer] + title: title + iconName: icon + link: @"." + isPathNode: YES + isActiveNode: YES + childBlocks: blocks]; return md; } -- (UIxMailTreeBlock *)treeNavigationBlockForObject:(id)_object - withActiveChildBlock:(UIxMailTreeBlock *)_activeChildBlock - depth:(int)_depth +- (UIxMailTreeBlock *) + treeNavigationBlockForObject: (id) _object + withActiveChildBlock: (UIxMailTreeBlock *) _activeChildBlock + depth: (int) _depth { /* Note: 'activeChildBlock' here doesn't mean that the block is the selected @@ -397,7 +463,7 @@ static BOOL debugBlocks = NO; NSMutableArray *blocks; NSString *activeName; NSArray *folders; - NSString *title, *icon; + NSString *title, *icon, *ft; unsigned i, count; activeName = [_activeChildBlock valueForKey:@"name"]; @@ -411,11 +477,11 @@ static BOOL debugBlocks = NO; UIxMailTreeBlock *block; id folder; - NSLog(@"activeName: %@", activeName); folder = [folders objectAtIndex:i]; block = [activeName isEqualToString:[folder nameInContainer]] ? _activeChildBlock - : [self treeNavigationBlockForLeafNode:folder atDepth:_depth]; + : [self treeNavigationBlockForLeafNode: folder + atDepth:_depth]; if ([block isNotNull]) [blocks addObject:block]; } @@ -425,17 +491,19 @@ static BOOL debugBlocks = NO; else blocks = nil; } - + /* build block */ - [self getTitle:&title andIcon:&icon forObject:_object]; - resultBlock = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:title iconName:icon - link: - [self treeNavigationLinkForObject:_object - atDepth:(_depth + 1)] - isPathNode:YES isActiveNode:NO - childBlocks:blocks]; + [self getTitle:&title folderType: &ft andIcon:&icon forObject:_object]; + resultBlock + = [UIxMailTreeBlock blockWithName: [_object nameInContainer] + title: title + iconName: icon + link: + [self treeNavigationLinkForObject: _object + atDepth: (_depth + 1)] + isPathNode:YES isActiveNode:NO + childBlocks:blocks]; /* recurse up unless we are at the root */ @@ -478,7 +546,7 @@ static BOOL debugBlocks = NO; if (debugBlocks) [self logWithFormat:@"ACTIVE parent block ..."]; block = [self treeNavigationBlockForObject:[_object container] withActiveChildBlock:block - depth:1]; + depth: 1]; if (debugBlocks) [self logWithFormat:@"done: %@", block]; return block; } @@ -501,6 +569,78 @@ static BOOL debugBlocks = NO; return self->rootNodes; } +- (int) addNodes: (NSArray *) nodes + atSerial: (int) startSerial + forParent: (int) parent + withRootName: (NSString *) rootName + toArray: (NSMutableArray *) array +{ + unsigned int count, max, currentSerial; + UIxMailTreeBlock *curNode; + NSArray *children; + NSString *fullName; + + max = [nodes count]; + currentSerial = startSerial; + for (count = 0; count < max; count++) + { + curNode = [nodes objectAtIndex: count]; + fullName = [rootName stringByAppendingFormat: @"/%@", [curNode name]]; + [curNode setName: fullName]; + [curNode setSerial: currentSerial]; + [curNode setParent: parent]; + [array addObject: curNode]; + if ([curNode hasChildren]) + currentSerial = [self addNodes: [curNode children] + atSerial: currentSerial + 1 + forParent: currentSerial + withRootName: fullName + toArray: array]; + else + currentSerial++; + } + + return currentSerial; +} + +- (NSArray *) flattenedNodes +{ + NSMutableArray *flattenedBlocks = nil; + NSString *userKey; + UIxMailTreeBlock *rootNode; // , *curNode; + id mailAccounts; +// unsigned int count, max; + + userKey = [[self user] login]; + flattenedBlocks = [flattenedNodes objectForKey: userKey]; + if (!flattenedBlocks) + { + flattenedBlocks = [NSMutableArray new]; + + if (![[self clientObject] isKindOfClass: NSClassFromString(@"SOGoMailAccounts")]) + mailAccounts = [[self clientObject] mailAccountsFolder]; + else + mailAccounts = [self clientObject]; + + rootNode = [self fullTreeNavigationBlockForNode: mailAccounts]; + [self addNodes: [rootNode children] + atSerial: 1 + forParent: 0 + withRootName: @"" + toArray: flattenedBlocks]; + + [flattenedNodes setObject: flattenedBlocks forKey: userKey]; +// max = [flattenedBlocks count]; +// for (count = 0; count < max; count++) +// { +// curNode = [flattenedBlocks objectAtIndex: count]; +// NSLog (@"%d: %@/%@", count, [curNode title], [curNode iconName]); +// } + } + + return flattenedBlocks; +} + /* notifications */ - (void)sleep { diff --git a/UI/MailerUI/UIxMailTreeBlock.h b/UI/MailerUI/UIxMailTreeBlock.h index cc3b31698..241914ef7 100644 --- a/UI/MailerUI/UIxMailTreeBlock.h +++ b/UI/MailerUI/UIxMailTreeBlock.h @@ -41,6 +41,9 @@ extern id UIxMailTreeHasChildrenMarker; NSString *link; NSArray *blocks; NSString *iconName; + NSString *folderType; + int serial; + int parent; struct { int isPath:1; int isActive:1; @@ -48,19 +51,48 @@ extern id UIxMailTreeHasChildrenMarker; } flags; } -+ (id)blockWithName:(NSString *)_n title:(NSString *)_t iconName:(NSString *)_i - link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive - childBlocks:(NSArray *)_blocks; ++ (id) blockWithName: (NSString *)_n + title: (NSString *)_t + iconName: (NSString *)_i + link: (NSString *)_link + isPathNode: (BOOL)_isPath + isActiveNode: (BOOL)_isActive + childBlocks: (NSArray *)_blocks; -- (id)initWithName:(NSString *)_n title:(NSString *)_t iconName:(NSString *)_i - link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive - childBlocks:(NSArray *)_blocks; +- (id)initWithName: (NSString *)_n + title: (NSString *)_t + iconName: (NSString *)_i + link: (NSString *)_link + isPathNode: (BOOL)_isPath + isActiveNode: (BOOL)_isActive + childBlocks: (NSArray *)_blocks; /* accessors */ -- (BOOL)hasChildren; -- (BOOL)areChildrenLoaded; -- (NSArray *)children; +- (BOOL) hasChildren; +- (BOOL) areChildrenLoaded; +- (NSArray *) children; + +- (void) setName: (NSString *) newName; +- (NSString *) name; + +- (void) setSerial: (int) newSerial; +- (int) serial; + +- (void) setParent: (int) newParent; +- (int) parent; + +- (void) setFolderType: (NSString *) newFolderType; +- (NSString *) folderType; + +- (NSString *) serialAsString; +- (NSString *) parentAsString; + +- (NSString *) title; +- (NSString *) link; +- (NSString *) iconName; + +- (NSString *) folderMenuId; @end diff --git a/UI/MailerUI/UIxMailTreeBlock.m b/UI/MailerUI/UIxMailTreeBlock.m index 257631e4d..1aabe3d10 100644 --- a/UI/MailerUI/UIxMailTreeBlock.m +++ b/UI/MailerUI/UIxMailTreeBlock.m @@ -19,53 +19,65 @@ 02111-1307, USA. */ -#include "UIxMailTreeBlock.h" -#include "common.h" +#import "UIxMailTreeBlock.h" +#import "common.h" @implementation UIxMailTreeBlock id UIxMailTreeHasChildrenMarker = nil; -+ (void)initialize { ++ (void) initialize +{ // TODO: needs to be an array because the WETreeView requires a // children array UIxMailTreeHasChildrenMarker = [[NSArray alloc] initWithObjects:@"FAKE", nil]; } -+ (id)blockWithName:(NSString *)_name title:(NSString *)_title - iconName:(NSString *)_icon - link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive - childBlocks:(NSArray *)_blocks ++ (id) blockWithName: (NSString *) _name + title: (NSString *) _title + iconName: (NSString *) _icon + link: (NSString *) _link + isPathNode: (BOOL) _isPath + isActiveNode: (BOOL) _isActive + childBlocks: (NSArray *) _blocks { UIxMailTreeBlock *block; - block = [[self alloc] initWithName:_name title:_title iconName:_icon + block = [[self alloc] initWithName:_name + title:_title + iconName:_icon link:_link - isPathNode:_isPath isActiveNode:_isActive + isPathNode:_isPath + isActiveNode:_isActive childBlocks:_blocks]; return [block autorelease]; } -- (id)initWithName:(NSString *)_name title:(NSString *)_title - iconName:(NSString *)_icon - link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive - childBlocks:(NSArray *)_blocks +- (id) initWithName: (NSString *) _name + title: (NSString *) _title + iconName: (NSString *) _icon + link: (NSString *) _link + isPathNode: (BOOL) _isPath + isActiveNode: (BOOL) _isActive + childBlocks: (NSArray *) _blocks { - if ((self = [self init])) { - self->name = [_name copy]; - self->title = [_title copy]; - self->iconName = [_icon copy]; - self->link = [_link copy]; - self->blocks = [_blocks retain]; + if ((self = [self init])) + { + self->name = [_name copy]; + self->title = [_title copy]; + self->iconName = [_icon copy]; + self->link = [_link copy]; + self->blocks = [_blocks retain]; - self->flags.isPath = _isPath ? 1 : 0; - self->flags.isActive = _isActive ? 1 : 0; - } + self->flags.isPath = _isPath ? 1 : 0; + self->flags.isActive = _isActive ? 1 : 0; + } return self; } -- (void)dealloc { +- (void) dealloc +{ [self->iconName release]; [self->blocks release]; [self->name release]; @@ -76,30 +88,49 @@ id UIxMailTreeHasChildrenMarker = nil; /* accessors */ -- (NSString *)name { +- (NSString *) name +{ return self->name; } -- (NSString *)title { + +- (void) setName: (NSString *) newName +{ + if (name) + [name release]; + name = [newName copy]; + if (name) + [name retain]; +} + +- (NSString *) title +{ return self->title; } -- (NSString *)link { + +- (NSString *) link +{ return self->link; } -- (NSString *)iconName { + +- (NSString *) iconName +{ return self->iconName; } -- (BOOL)hasChildren { +- (BOOL) hasChildren +{ if (self->blocks == UIxMailTreeHasChildrenMarker) return YES; return [self->blocks count] > 0 ? YES : NO; } -- (BOOL)areChildrenLoaded { +- (BOOL) areChildrenLoaded +{ return self->blocks != UIxMailTreeHasChildrenMarker ? YES : NO; } -- (NSArray *)children { +- (NSArray *) children +{ if (self->blocks == UIxMailTreeHasChildrenMarker) // TODO: print a warning return self->blocks; @@ -107,16 +138,20 @@ id UIxMailTreeHasChildrenMarker = nil; return self->blocks; } -- (BOOL)isPathNode { +- (BOOL) isPathNode +{ return self->flags.isPath ? YES : NO; } -- (BOOL)isActiveNode { + +- (BOOL) isActiveNode +{ return self->flags.isActive ? YES : NO; } /* description */ -- (void)appendAttributesToDescription:(NSMutableString *)_ms { +- (void) appendAttributesToDescription: (NSMutableString *) _ms +{ if (self->name != nil) [_ms appendFormat:@" name='%@'", self->name]; if (self->title != nil) [_ms appendFormat:@" title='%@'", self->title]; @@ -129,7 +164,8 @@ id UIxMailTreeHasChildrenMarker = nil; [_ms appendFormat:@" children=%@", self->blocks]; } -- (NSString *)description { +- (NSString *) description +{ NSMutableString *ms; ms = [NSMutableString stringWithCapacity:64]; @@ -139,4 +175,49 @@ id UIxMailTreeHasChildrenMarker = nil; return ms; } +- (void) setSerial: (int) newSerial +{ + serial = newSerial; +} + +- (int) serial +{ + return serial; +} + +- (NSString *) serialAsString +{ + return [NSString stringWithFormat: @"%d", serial]; +} + +- (void) setParent: (int) newParent +{ + parent = newParent; +} + +- (int) parent +{ + return parent; +} + +- (void) setFolderType: (NSString *) newFolderType +{ + folderType = newFolderType; +} + +- (NSString *) folderType +{ + return folderType; +} + +- (NSString *) parentAsString +{ + return [NSString stringWithFormat: @"%d", parent]; +} + +- (NSString *) folderMenuId +{ + return [NSString stringWithFormat: @"__wox_submenu_%d-%d", parent, serial]; +} + @end /* UIxMailTreeBlock */ diff --git a/UI/MailerUI/UIxMailTreeBlockJS.h b/UI/MailerUI/UIxMailTreeBlockJS.h new file mode 100644 index 000000000..e27d74788 --- /dev/null +++ b/UI/MailerUI/UIxMailTreeBlockJS.h @@ -0,0 +1,53 @@ +/* UIxMailTreeBlockJS.h - this file is part of $PROJECT_NAME_HERE$ + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#ifndef UIXMAILTREEBLOCKJS_H +#define UIXMAILTREEBLOCKJS_H + +#import + +#import "common.h" + +@class NSString; +@class UIxMailTreeBlock; + +@interface UIxMailTreeBlockJS : UIxComponent +{ + UIxMailTreeBlock *item; + NSString *treeObjectName; +} + +- (void) setItem: (UIxMailTreeBlock *) newItem; +- (UIxMailTreeBlock *) item; + +- (NSString *) iconName; + +- (void) setTreeObjectName: (NSString *) newName; +- (NSString *) treeObjectName; + +- (BOOL) isAccount; +- (BOOL) isInbox; +- (BOOL) isTrash; + +@end + +#endif /* UIXMAILTREEBLOCKJS_H */ diff --git a/UI/MailerUI/UIxMailTreeBlockJS.m b/UI/MailerUI/UIxMailTreeBlockJS.m new file mode 100644 index 000000000..1e03abee1 --- /dev/null +++ b/UI/MailerUI/UIxMailTreeBlockJS.m @@ -0,0 +1,113 @@ +/* UIxMailTreeBlockJS.m - this file is part of $PROJECT_NAME_HERE$ + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 "UIxMailTreeBlockJS.h" + +#import "Common/UIxPageFrame.h" + +@implementation UIxMailTreeBlockJS + +- (id) init +{ + if ((self = [super init])) + { + item = nil; + } + + return self; +} + +- (void) setItem: (UIxMailTreeBlock *) newItem +{ + item = newItem; +} + +- (UIxMailTreeBlock *) item +{ + return item; +} + +- (WOResourceManager *) resourceManager +{ + WOResourceManager *resourceManager; + id c; + + resourceManager = nil; + + c = self; + while (!resourceManager + && c) + if ([c respondsToSelector: @selector(pageResourceManager)]) + resourceManager = [c pageResourceManager]; + else + c = [c parent]; + + return resourceManager; +} + +- (NSString *) iconName +{ + WOResourceManager *resourceManager; + NSString *iconName, *rsrcIconName; + + iconName = [item iconName]; + if ([iconName length] > 0) + { + resourceManager = [self resourceManager]; + rsrcIconName = [resourceManager urlForResourceNamed: iconName + inFramework: nil + languages: nil + request: [[self context] request]]; + } + else + rsrcIconName = nil; + + return rsrcIconName; +} + +- (void) setTreeObjectName: (NSString *) newName +{ + treeObjectName = newName; +} + +- (NSString *) treeObjectName +{ + return treeObjectName; +} + +- (BOOL) isAccount +{ + return ([item parent] == 0); +} + +- (BOOL) isInbox +{ + return ([[item name] isEqualToString: @"INBOX"]); +} + +- (BOOL) isTrash +{ + return NO; +} + + +@end diff --git a/UI/MailerUI/UIxMailView.js b/UI/MailerUI/UIxMailView.js deleted file mode 100644 index 570c19904..000000000 --- a/UI/MailerUI/UIxMailView.js +++ /dev/null @@ -1,35 +0,0 @@ -/* contacts */ -function newContactFromEmail(sender) { - var emailre - = /([a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z])/g; - - emailre.exec(menuClickNode.innerHTML); - email = RegExp.$1; - - if (email.length > 0) - { - emailre.exec(""); - w = window.open("../../../../Contacts/new?contactEmail=" + email, - "SOGo_new_contact", - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," + - "location=0,directories=0,status=0,menubar=0,copyhistory=0"); - w.focus(); - } - - return false; /* stop following the link */ -} - -function newEmailTo(sender) { - var mailto = sanitizeMailTo(menuClickNode.innerHTML); - - if (mailto.length > 0) - { - w = window.open("compose?mailto=" + mailto, - "SOGo_compose", - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," + - "location=0,directories=0,status=0,menubar=0,copyhistory=0"); - w.focus(); - } - - return false; /* stop following the link */ -} diff --git a/UI/MailerUI/UIxMailViewContainer.h b/UI/MailerUI/UIxMailViewContainer.h new file mode 100644 index 000000000..fadfa541c --- /dev/null +++ b/UI/MailerUI/UIxMailViewContainer.h @@ -0,0 +1,31 @@ +/* UIxMailViewContainer.h - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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. + */ + +#ifndef UIXMAILVIEWCONTAINER_H +#define UIXMAILVIEWCONTAINER_H + +#import + +@interface UIxMailViewContainer : UIxComponent +@end + +#endif /* UIXMAILVIEWCONTAINER_H */ diff --git a/UI/MailerUI/UIxMailViewContainer.m b/UI/MailerUI/UIxMailViewContainer.m new file mode 100644 index 000000000..c74bfa21b --- /dev/null +++ b/UI/MailerUI/UIxMailViewContainer.m @@ -0,0 +1,27 @@ +/* UIxMailViewContainer.m - this file is part of SOGo + * + * Copyright (C) 2006 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 "UIxMailViewContainer.h" + +@implementation UIxMailViewContainer + +@end diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index 2ec676446..529562c64 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -12,7 +12,7 @@ "UIxMailToSelection.js", "lori_32x32.png", - + "tbtv_account_17x17.gif", "tbtv_drafts_17x17.gif", "tbtv_inbox_17x17.gif", @@ -27,7 +27,7 @@ "tbtv_corner_plus_17x17.gif", "tbtv_sent_17x17.gif", "tbtv_trash_17x17.gif", - + "tbtb_addressbook.png", "tbtb_compose.png", "tbtb_delete.png", @@ -81,52 +81,55 @@ slots = { toolbar = { protectedBy = "View"; - value = "SOGoMailFolder.toolbar"; + value = "SOGoMailObject.toolbar"; }; }; methods = { view = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; + }; + ajax = { + protectedBy = "View"; + pageName = "UIxMailAjaxRequest"; }; index = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; }; GET = { /* hack to make it work as the default method */ protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; }; - markMessageUnread = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "markMessageUnread"; }; markMessageRead = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "markMessageRead"; }; getMail = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "getMail"; }; expunge = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "expunge"; }; - + createFolder = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "createFolder"; }; deleteFolder = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "deleteFolder"; }; @@ -134,10 +137,10 @@ protectedBy = "View"; pageName = "UIxMailFolderACLEditor"; }; - + compose = { protectedBy = "View"; - actionClass = "UIxMailEditorAction"; + actionClass = "UIxMailEditorAction"; actionName = "compose"; }; }; @@ -148,13 +151,13 @@ slots = { toolbar = { protectedBy = "View"; - value = "SOGoTrashFolder.toolbar"; + value = "SOGoMailObject.toolbar"; }; }; methods = { emptyTrash = { protectedBy = "View"; - pageName = "UIxMailListView"; + pageName = "UIxMailListView"; actionName = "emptyTrash"; }; }; @@ -168,103 +171,97 @@ }; }; methods = { - view = { + view = { protectedBy = "View"; - pageName = "UIxMailView"; + pageName = "UIxMailViewContainer"; }; getMail = { protectedBy = "View"; - pageName = "UIxMailView"; + pageName = "UIxMailViewContainer"; actionName = "getMail"; }; - delete = { + delete = { protectedBy = "View"; - pageName = "UIxMailView"; + pageName = "UIxMailViewContainer"; actionName = "delete"; }; - trash = { + trash = { protectedBy = "View"; - pageName = "UIxMailView"; + pageName = "UIxMailViewContainer"; actionName = "trash"; }; - junk = { + junk = { protectedBy = "View"; - pageName = "UIxMailView"; + pageName = "UIxMailViewContainer"; actionName = "junk"; }; - edit = { + edit = { protectedBy = "View"; - pageName = "UIxMailEditor"; + pageName = "UIxMailEditor"; }; compose = { protectedBy = "View"; - actionClass = "UIxMailEditorAction"; + actionClass = "UIxMailEditorAction"; actionName = "compose"; }; reply = { protectedBy = "View"; - actionClass = "UIxMailReplyAction"; + actionClass = "UIxMailReplyAction"; actionName = "reply"; }; replyall = { protectedBy = "View"; - actionClass = "UIxMailReplyAction"; + actionClass = "UIxMailReplyAction"; actionName = "replyall"; }; forward = { protectedBy = "View"; - actionClass = "UIxMailForwardAction"; + actionClass = "UIxMailForwardAction"; actionName = "forward"; }; }; }; - + SOGoMailAccounts = { slots = { toolbar = { protectedBy = "View"; - value = ( /* the toolbar groups */ - ( /* first group */ - { link = "getMail"; - image = "tb-mail-getmail-flat-24x24.png"; - cssClass = "tbicon_getmail"; label = "Get Mail"; }, - ) - ); + value = "SOGoMailObject.toolbar"; }; }; methods = { view = { protectedBy = "View"; - pageName = "UIxMailAccountsView"; + pageName = "UIxMailAccountsView"; }; getMail = { protectedBy = "View"; - pageName = "UIxMailAccountsView"; + pageName = "UIxMailAccountsView"; }; }; }; - + SOGoMailAccount = { slots = { toolbar = { protectedBy = "View"; - value = "SOGoMailAccount.toolbar"; + value = "SOGoMailObject.toolbar"; }; }; methods = { view = { protectedBy = "View"; - pageName = "UIxMailAccountView"; + pageName = "UIxMailAccountView"; }; getMail = { protectedBy = "View"; - pageName = "UIxMailAccountView"; + pageName = "UIxMailAccountView"; }; addressbook = { protectedBy = "View"; - pageName = "UIxMailAddressbook"; + pageName = "UIxMailAddressbook"; }; anais = { protectedBy = "View"; @@ -273,12 +270,12 @@ }; compose = { protectedBy = "View"; - actionClass = "UIxMailEditorAction"; + actionClass = "UIxMailEditorAction"; actionName = "compose"; }; createFolder = { protectedBy = "View"; - pageName = "UIxMailAccountView"; + pageName = "UIxMailAccountView"; actionName = "createFolder"; }; }; @@ -330,43 +327,43 @@ methods = { view = { /* somewhat hackish */ protectedBy = "View"; - pageName = "UIxMailEditor"; + pageName = "UIxMailEditor"; }; edit = { protectedBy = "View"; - pageName = "UIxMailEditor"; + pageName = "UIxMailEditor"; actionName = "edit"; }; save = { protectedBy = "View"; - pageName = "UIxMailEditor"; + pageName = "UIxMailEditor"; actionName = "save"; }; delete = { protectedBy = "View"; - pageName = "UIxMailEditor"; + pageName = "UIxMailEditor"; actionName = "delete"; }; viewAttachments = { protectedBy = "View"; - pageName = "UIxMailEditorAttach"; + pageName = "UIxMailEditorAttach"; actionName = "viewAttachments"; }; attach = { protectedBy = "View"; - pageName = "UIxMailEditorAttach"; + pageName = "UIxMailEditorAttach"; actionName = "attach"; }; deleteAttachment = { protectedBy = "View"; - pageName = "UIxMailEditorAttach"; + pageName = "UIxMailEditorAttach"; actionName = "deleteAttachment"; }; send = { protectedBy = "View"; - pageName = "UIxMailEditor"; + pageName = "UIxMailEditor"; actionName = "send"; }; addressbook = { @@ -382,7 +379,7 @@ }; /* Sieve */ - + SOGoSieveScriptsFolder = { slots = { toolbar = { @@ -402,7 +399,7 @@ }, ), ( /* second group - { link = "#"; + { link = "#"; cssClass = "tbicon_delete"; label = "Delete"; },*/ ), ); @@ -411,11 +408,11 @@ methods = { view = { protectedBy = "View"; - pageName = "UIxFilterList"; + pageName = "UIxFilterList"; }; create = { protectedBy = "View"; - pageName = "UIxFilterList"; + pageName = "UIxFilterList"; actionName = "create"; }; }; @@ -442,17 +439,17 @@ methods = { edit = { protectedBy = "View"; - pageName = "UIxSieveEditor"; + pageName = "UIxSieveEditor"; actionName = "edit"; }; save = { protectedBy = "View"; - pageName = "UIxSieveEditor"; + pageName = "UIxSieveEditor"; actionName = "save"; }; delete = { protectedBy = "View"; - pageName = "UIxSieveEditor"; + pageName = "UIxSieveEditor"; actionName = "delete"; }; }; diff --git a/UI/SOGoUI/UIxComponent.h b/UI/SOGoUI/UIxComponent.h index 683c5486d..7dc606246 100644 --- a/UI/SOGoUI/UIxComponent.h +++ b/UI/SOGoUI/UIxComponent.h @@ -66,6 +66,8 @@ - (NSString *)dateStringForDate:(NSCalendarDate *)_date; - (NSCalendarDate *)dateForDateString:(NSString *)_dateString; +- (BOOL) hideFrame; + /* SoUser */ - (SoUser *)user; - (NSString *)shortUserNameForDisplay; @@ -84,6 +86,10 @@ /* locale */ - (NSDictionary *)locale; +/* cached resource filenames */ +- (WOResourceManager *) pageResourceManager; +- (NSString *) urlForResourceFilename: (NSString *) filename; + /* Debugging */ - (BOOL)isUIxDebugEnabled; diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index 1755d22e2..841a61679 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -19,10 +19,12 @@ 02111-1307, USA. */ -#include "UIxComponent.h" -#include "SOGoJSStringFormatter.h" -#include "common.h" -#include +#import "UIxComponent.h" +#import "SOGoJSStringFormatter.h" +#import "NSString+URL.h" +#import "common.h" +#import +#import @interface UIxComponent (PrivateAPI) - (void)_parseQueryString:(NSString *)_s; @@ -244,7 +246,8 @@ static BOOL uixDebugEnabled = NO; return [uri substringFromIndex:(r.location + 1)]; } -- (NSString *)userFolderPath { +- (NSString *) _urlForTraversalObject: (int) traversal +{ WOContext *ctx; NSArray *traversalObjects; NSString *url; @@ -252,13 +255,34 @@ static BOOL uixDebugEnabled = NO; ctx = [self context]; traversalObjects = [ctx objectTraversalStack]; - url = [[traversalObjects objectAtIndex:0] + url = [[traversalObjects objectAtIndex: traversal] baseURLInContext:ctx]; path = [[NSURL URLWithString:url] path]; - path = [path stringByAppendingPathComponent:[[ctx activeUser] login]]; +// path = [path stringByAppendingPathComponent:[[ctx activeUser] login]]; + return path; } +- (NSString *) userFolderPath +{ + return [self _urlForTraversalObject: 1]; +} + +- (NSString *) applicationPath +{ + return [self _urlForTraversalObject: 2]; +} + +- (NSString *) resourcesPath +{ + WOResourceManager *rm; + + if ((rm = [self resourceManager]) == nil) + rm = [[WOApplication application] resourceManager]; + + return [rm webServerResourcesPath]; +} + - (NSString *)ownPath { NSString *uri; NSRange r; @@ -325,6 +349,10 @@ static BOOL uixDebugEnabled = NO; calendarFormat:@"%Y%m%d"]; } +- (BOOL) hideFrame +{ + return ([[self queryParameterForKey: @"noframe"] boolValue]); +} /* SoUser */ @@ -410,9 +438,6 @@ static BOOL uixDebugEnabled = NO; label = [rm stringForKey:lKey inTableNamed:lTable withDefaultValue:lVal languages:languages]; - NSLog (@"string '%s' = '%s' (default: '%s')", - [lKey cString], [label cString], [lVal cString]); - return label; } @@ -455,6 +480,50 @@ static BOOL uixDebugEnabled = NO; return [[self context] valueForKey:@"locale"]; } +- (WOResourceManager *) pageResourceManager +{ + WOResourceManager *rm; + + if ((rm = [[[self context] page] resourceManager]) == nil) + rm = [[WOApplication application] resourceManager]; + + return rm; +} + +- (NSString *) urlForResourceFilename: (NSString *) filename +{ + static NSMutableDictionary *pageToURL = nil; + NSString *url; + WOComponent *page; + WOResourceManager *rm; + NSBundle *pageBundle; + + if (!pageToURL) + pageToURL = [[NSMutableDictionary alloc] initWithCapacity: 32]; + + url = [pageToURL objectForKey: filename]; + if (!url) + { + rm = [self pageResourceManager]; + page = [[self context] page]; + pageBundle = [NSBundle bundleForClass: [page class]]; + url = [rm urlForResourceNamed: filename + inFramework: [pageBundle bundlePath] + languages: nil + request: [[self context] request]]; + if (!url) + url = @""; + else + if ([url hasPrefix: @"http"]) + url = [url hostlessURL]; + [pageToURL setObject: url forKey: filename]; + } + +// NSLog (@"url for '%@': '%@'", filename, url); + + return url; +} + /* debugging */ - (BOOL)isUIxDebugEnabled { diff --git a/UI/Scheduler/UIxAppointmentEditor.m b/UI/Scheduler/UIxAppointmentEditor.m index 15c3e41db..48f9771ae 100644 --- a/UI/Scheduler/UIxAppointmentEditor.m +++ b/UI/Scheduler/UIxAppointmentEditor.m @@ -1080,8 +1080,4 @@ return [self redirectToLocation:[self _completeURIForMethod:@"../view"]]; } -- (BOOL) isPopup { - return YES; -} - @end /* UIxAppointmentEditor */ diff --git a/UI/Templates/MailerUI/UIxMailAccountView.wox b/UI/Templates/MailerUI/UIxMailAccountView.wox index ad2347079..269472a12 100644 --- a/UI/Templates/MailerUI/UIxMailAccountView.wox +++ b/UI/Templates/MailerUI/UIxMailAccountView.wox @@ -6,29 +6,27 @@ xmlns:uix="OGo:uix" xmlns:rsrc="OGo:url" xmlns:label="OGo:label" - className="UIxMailMainFrame" - title="panelTitle" + className="UIxMailAccountViewContainer" + title="title" > -
+

- SOGo Mail - - + SOGo Mail - + - - - + +

@@ -36,25 +34,25 @@
- +

Email

-
-
+
+

Accounts

- View settings for this account
- Create a new account [TBD: not in Agenor]
+ View settings for this account
+ Create a new account [TBD: not in Agenor]

- +

Advanced Features

- Search messages
- Manage message filters
- Manage folder subscriptions
- Offline settings [TBD: not in Agenor]
+ Search messages
+ Manage message filters
+ Manage folder subscriptions
+ Offline settings [TBD: not in Agenor]

diff --git a/UI/Templates/MailerUI/UIxMailAccountViewContainer.wox b/UI/Templates/MailerUI/UIxMailAccountViewContainer.wox new file mode 100644 index 000000000..e365dec15 --- /dev/null +++ b/UI/Templates/MailerUI/UIxMailAccountViewContainer.wox @@ -0,0 +1,39 @@ + + + + + + + + +
+ +
+ + +
+ + + + +
diff --git a/UI/Templates/MailerUI/UIxMailAccountsView.wox b/UI/Templates/MailerUI/UIxMailAccountsView.wox index 88eeaa38e..b235d3675 100644 --- a/UI/Templates/MailerUI/UIxMailAccountsView.wox +++ b/UI/Templates/MailerUI/UIxMailAccountsView.wox @@ -7,22 +7,24 @@ xmlns:label="OGo:label" xmlns:rsrc="OGo:url" className="UIxMailMainFrame" - title="panelTitle" + title="name" > -
- -
- -
-
-
- -
- + -
- + + + +
+
+ +
+
+ diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index ebdd09d12..cce341dda 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -1,88 +1,89 @@ - - -
- -
- +
+ +
+ -
-
- - -
-
- - - - - + + +
- : - - -
+ + - - -
+
+ + + + +
+ : + + +
-
- -
+
+ +
-
- -
- - - - - -
- : -
-
-
-
-
- : - + to="to" + cc="cc" + bcc="bcc" + />
-
- -
-
+ +
+ + + + + +
+ : +
-
-
- -
-