]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1131 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 1 Aug 2007 18:59:27 +0000 (18:59 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 1 Aug 2007 18:59:27 +0000 (18:59 +0000)
52 files changed:
ChangeLog
NEWS
OGoContentStore/GNUmakefile
SoObjects/Mailer/SOGoCalendarMailBodyPart.m
SoObjects/Mailer/SOGoDraftsFolder.m
SoObjects/Mailer/SOGoImageMailBodyPart.m
SoObjects/Mailer/SOGoMailAccount.m
SoObjects/Mailer/SOGoMailAccounts.m
SoObjects/Mailer/SOGoMailBaseObject.m
SoObjects/Mailer/SOGoMailBodyPart.h
SoObjects/Mailer/SOGoMailBodyPart.m
SoObjects/Mailer/SOGoMailFolder.h
SoObjects/Mailer/SOGoMailFolder.m
SoObjects/Mailer/SOGoMailFolderDataSource.m
SoObjects/Mailer/SOGoMailIdentity.m
SoObjects/Mailer/SOGoMailManager.m
SoObjects/Mailer/SOGoMailObject.m
SoObjects/Mailer/SOGoMessageMailBodyPart.m
SoObjects/Mailer/SOGoSharedInboxFolder.h
SoObjects/Mailer/SOGoSharedInboxFolder.m
SoObjects/Mailer/SOGoSharedMailAccount.m
SoObjects/Mailer/SOGoTrashFolder.h
SoObjects/Mailer/SOGoTrashFolder.m
SoObjects/Mailer/SOGoUser+Mail.m
SoObjects/Mailer/SOGoVCardMailBodyPart.m
SoObjects/Mailer/common.h [deleted file]
SoObjects/SOGo/SOGoObject.m
UI/Common/English.lproj/Localizable.strings
UI/Common/French.lproj/Localizable.strings
UI/MailPartViewers/UIxKolabPartContactViewer.m
UI/MailPartViewers/UIxMailPartViewer.m
UI/MailPartViewers/UIxMailRenderingContext.h
UI/MailPartViewers/UIxMailRenderingContext.m
UI/MailPartViewers/product.plist
UI/MailerUI/UIxMailEditor.m
UI/MailerUI/UIxMailEditorAction.m
UI/MailerUI/UIxMailMainFrame.m
UI/MailerUI/UIxMailView.m
UI/MailerUI/product.plist
UI/Templates/UIxPageFrame.wox
UI/WebServerResources/ContactsUI.js
UI/WebServerResources/HTMLElement.js
UI/WebServerResources/MailerUI+dTree.js
UI/WebServerResources/MailerUI.js
UI/WebServerResources/SchedulerUI.js
UI/WebServerResources/UIxAclEditor.js
UI/WebServerResources/UIxAttendeesEditor.js
UI/WebServerResources/UIxComponentEditor.js
UI/WebServerResources/UIxContactsUserFolders.js
UI/WebServerResources/generic.js
UI/WebServerResources/prototype.js
UI/WebServerResources/skycalendar.html

index 08cf853ea217ef1e8147454d327f27a1a5f1ff26..bad50c6cff02b9538cf51d3a4a40eafff1e9231f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,58 @@
+2007-08-01  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * UI/MailPartViewers/UIxMailPartViewer.m ([UIxMailPartViewer
+       -content]): new method returning the decoded content of the
+       corresponding attachment as an NSData instance.
+       ([UIxMailPartViewer -filename]): if the "filename" parameter of
+       the metadata parameterList is empty, try to find out the filename
+       from the "disposition" metadata returned with the BODYSTRUCTURE
+       imap4 tag.
+
+       * UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame
+       -composeAction]): prefix the INBOX folder with "folder".
+
+       * SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailBaseObject
+       -relativeImap4Name]): return nameInContainer stripped from its
+       first 6 characters since all folder names are prefixed with
+       "folder".
+
+       * SoObjects/Mailer/SOGoMailBaseObject.m ([SOGoMailBaseObject
+       -imap4URLString]): invoke -relativeImap4Name instead of
+       "nameInContainer" since the former will return the fixed IMAP4
+       foldername and the latter the SoObject name.
+
+       * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
+       +initialize]): we now fetch the "BODYSTRUCTURE" key instead of "BODY".
+
+       * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount -inboxFolderNameInContext:])
+       ([SOGoMailAccount -draftsFolderNameInContext:_ctx])
+       ([SOGoMailAccount -sieveFolderNameInContext:_ctx])
+       ([SOGoMailAccount -sentFolderNameInContext:])
+       ([SOGoMailAccount -trashFolderNameInContext:]): prefix the folder
+       names with "folder".
+       ([SOGoMailAccount -inboxFolderInContext:_ctx])
+       ([SOGoMailAccount -sentFolderInContext:_ctx])
+       ([SOGoMailAccount -trashFolderInContext:_ctx]): no longer prefix
+       the folder names with "folder" since they are prefixed earlier.
+
+2007-07-30  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount -inboxFolderInContext:_ctx])
+       ([-sentFolderInContext:], [-trashFolderInContext:]): folder keys
+       all starts with "folder".
+
+       * SoObjects/SOGo/SOGoObject.m ([SOGoObject +initialize]): no
+       longer declare security info from here.
+
+       * SoObjects/Mailer/SOGoMailFolder.m
+       ([-isMessageKey:_keyinContext:_ctx]): removed useless method.
+       ([SOGoMailFolder -lookupName:_keyinContext:acquire:_acquire]):
+       folder names now always start with "folder".
+
+       * SoObjects/Mailer/SOGoMailAccount.m
+       ([-lookupName:inContext:acquire:]): folder names now always start
+       with "folder".
+
 2007-07-27  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/MailerUI/UIxMailForwardAction.m ([UIxMailForwardAction
diff --git a/NEWS b/NEWS
index 281d6d336c047a03b88d6e1da2f730cc933f345f..0396e5600e6ddc4e77589b8fc3078501049bce0e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@
   entries whenever a specific one is being requested;
 - added support for limiting LDAP queries with the SOGoLDAPQueryLimit and
   the SOGoLDAPSizeLimit settings;
+- fixed a bug where folders starting with digits would not be displayed;
 
 0.9.0-20070713
 --------------
index d8a20b4f9cdaa77d3c0bedd519034853997d2e3a..d66c95f2791026ad1339fab96821211ef5199555 100644 (file)
@@ -22,7 +22,9 @@ libOGoContentStore_OBJC_FILES +=              \
 
 libOGoContentStore_TYPEMODELS += \
        appointment.ocs \
-       contact.ocs
+       contact.ocs \
+       appointment-oracle.ocs \
+       contact-oracle.ocs
 
 test_quick_extract_OBJC_FILES += \
        test_quick_extract.m
index 714c0bc455b182671b751db523dc3edcb1c0fcec..def0dda88c2dae8a3ce5ccdf48e573909273439c 100644 (file)
@@ -19,7 +19,7 @@
   02111-1307, USA.
 */
 
-#include <Mailer/SOGoMailBodyPart.h>
+#import "SOGoMailBodyPart.h"
 
 /*
   SOGoCalendarMailBodyPart
 */
 
 @interface SOGoCalendarMailBodyPart : SOGoMailBodyPart
-{
-}
-
 @end
 
-#include "common.h"
-
 @implementation SOGoCalendarMailBodyPart
 
 @end /* SOGoCalendarMailBodyPart */
index 13655da0d22bee7e8c8f8e3c2504fc665fa88b38..2509ff059ea725697e16cd540a5c853322ec2521 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoDraftsFolder.h"
-#include "SOGoDraftObject.h"
-#include <SOGo/SOGoUserFolder.h>
-#include <NGExtensions/NSFileManager+Extensions.h>
-#include "common.h"
-#include <unistd.h>
+#import <unistd.h>
+
+#import <Foundation/NSArray.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGExtensions/NSFileManager+Extensions.h>
+#import <NGExtensions/NSNull+misc.h>
+#import <NGExtensions/NSObject+Logs.h>
+
+#import <SoObjects/SOGo/SOGoUserFolder.h>
+#import "SOGoDraftObject.h"
+
+#import "SOGoDraftsFolder.h"
 
 @implementation SOGoDraftsFolder
 
 static NSString *spoolFolder = nil;
 
-+ (void)initialize {
-  NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
++ (void) initialize
+{
+  NSUserDefaults *ud;;
 
-  spoolFolder = [[ud stringForKey:@"SOGoMailSpoolPath"] copy];
-  if ([spoolFolder length] < 3)
-    spoolFolder = @"/tmp/";
-  
-  NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder);
+  if (!spoolFolder)
+    {
+      ud = [NSUserDefaults standardUserDefaults];
+      spoolFolder = [[ud stringForKey:@"SOGoMailSpoolPath"] copy];
+      if ([spoolFolder length] < 3)
+       spoolFolder = @"/tmp/";
+
+      NSLog(@"Note: using SOGo mail spool folder: %@", spoolFolder);
+    }
 }
 
 /* new objects */
 
-- (NSString *)makeNewObjectNameInContext:(id)_ctx {
+- (NSString *) makeNewObjectNameInContext: (id) _ctx
+{
   static int counter = 1; // THREAD
+
   return [NSString stringWithFormat:@"draft_%08d_%08x", getpid(), counter++];
 }
 
-- (NSString *)newObjectBaseURLInContext:(id)_ctx {
+- (NSString *) newObjectBaseURLInContext: (id) _ctx
+{
   NSString *s, *n;
   
   n = [self makeNewObjectNameInContext:_ctx];
@@ -59,29 +75,36 @@ static NSString *spoolFolder = nil;
   return [s stringByAppendingString:n];
 }
 
-- (id)newObjectInContext:(id)_ctx {
+- (id) newObjectInContext: (id) _ctx
+{
   return [self lookupName:[self makeNewObjectNameInContext:_ctx]
               inContext:_ctx acquire:NO];
 }
 
 /* draft folder functionality */
 
-- (NSFileManager *)spoolFileManager {
+- (NSFileManager *) spoolFileManager
+{
   return [NSFileManager defaultManager];
 }
 
-- (NSString *)spoolFolderPath {
+- (NSString *) spoolFolderPath
+{
   return spoolFolder;
 }
-- (NSString *)userSpoolFolderPath {
+
+- (NSString *) userSpoolFolderPath
+{
   NSString *p, *n;
   
   p = [self spoolFolderPath];
   n = [[self lookupUserFolder] nameInContainer];
+
   return [p stringByAppendingPathComponent:n];
 }
 
-- (BOOL)_ensureUserSpoolFolderPath {
+- (BOOL) _ensureUserSpoolFolderPath
+{
   NSFileManager *fm;
   
   if ((fm = [self spoolFileManager]) == nil) {
@@ -92,7 +115,8 @@ static NSString *spoolFolder = nil;
             attributes:nil];
 }
 
-- (NSArray *)fetchMailNames {
+- (NSArray *) fetchMailNames
+{
   NSString *p;
   
   if ((p = [self userSpoolFolderPath]) == nil)
@@ -103,7 +127,9 @@ static NSString *spoolFolder = nil;
 
 /* folder methods (used by template) */
 
-- (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so {
+- (NSArray *) fetchUIDsMatchingQualifier: (id) _q
+                           sortOrdering: (id) _so
+{
   // TODO: retrieve contained objects
   NSArray *allUids;
   
@@ -117,7 +143,7 @@ static NSString *spoolFolder = nil;
   // TODO: should sort uids (q=%@,so=%@): %@", _q, _so, allUids];
   return allUids;
 }
-- (NSArray *)fetchUIDs:(NSArray *)_uids parts:(NSArray *)_parts {
+- (NSArray *)fetchUIDs: (NSArray *)_uids parts: (NSArray *)_parts {
   /* FLAGS, ENVELOPE, RFC822.SIZE */
   NSMutableArray  *drafts;
   unsigned i, count;
@@ -146,13 +172,18 @@ static NSString *spoolFolder = nil;
 
 /* name lookup */
 
-- (id)lookupDraftMessage:(NSString *)_key inContext:(id)_ctx {
+- (id) lookupDraftMessage: (NSString *) _key
+               inContext: (id) _ctx
+{
   // TODO: we might want to check for existence prior controller creation
   return [[[SOGoDraftObject alloc] initWithName:_key 
                                   inContainer:self] autorelease];
 }
 
-- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+- (id) lookupName: (NSString *) _key
+       inContext: (id) _ctx
+         acquire: (BOOL) _flag
+{
   id obj;
   
   /* first check attributes directly bound to the application */
@@ -168,17 +199,20 @@ static NSString *spoolFolder = nil;
 
 /* WebDAV */
 
-- (BOOL)davIsCollection {
+- (BOOL) davIsCollection
+{
   return YES;
 }
 
-- (NSArray *)toOneRelationshipKeys {
+- (NSArray *) toOneRelationshipKeys
+{
   return [self fetchMailNames];
 }
 
 /* folder type */
 
-- (NSString *)outlookFolderClass {
+- (NSString *) outlookFolderClass
+{
   return @"IPF.Drafts";
 }
 
index 0319ac0010e24bfc2b07dd4db5ff409fff757fe1..3d9679203de2b8e2251c7272896d7d00ca03709d 100644 (file)
@@ -19,7 +19,7 @@
   02111-1307, USA.
 */
 
-#include <Mailer/SOGoMailBodyPart.h>
+#import "SOGoMailBodyPart.h"
 
 /*
   SOGoImageMailBodyPart
@@ -36,8 +36,6 @@
 
 @end
 
-#include "common.h"
-
 @implementation SOGoImageMailBodyPart
 
 @end /* SOGoImageMailBodyPart */
index b82b1451bb1e59d9f37d282bd5746cf566abb091..93927275bf710296377670c6c43500f14a58af31 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoMailAccount.h"
-#include "SOGoMailFolder.h"
-#include "SOGoMailManager.h"
-#include "SOGoDraftsFolder.h"
-#include "SOGoUser+Mail.h"
-#include <NGObjWeb/SoHTTPAuthenticator.h>
-#include "common.h"
+#import <Foundation/NSArray.h>
+#import <Foundation/NSURL.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGObjWeb/SoHTTPAuthenticator.h>
+#import <NGObjWeb/WORequest.h>
+#import <NGObjWeb/WOContext+SoObjects.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NSNull+misc.h>
+#import <NGImap4/NGImap4Connection.h>
+
+#import "SOGoMailFolder.h"
+#import "SOGoMailManager.h"
+#import "SOGoDraftsFolder.h"
+#import "SOGoUser+Mail.h"
+
+#import "SOGoMailAccount.h"
 
 @implementation SOGoMailAccount
 
@@ -33,6 +45,8 @@ static NSArray  *rootFolderNames      = nil;
 static NSString *inboxFolderName      = @"INBOX";
 static NSString *draftsFolderName     = @"Drafts";
 static NSString *sieveFolderName      = @"Filters";
+static NSString *sentFolderName = nil;
+static NSString *trashFolderName = nil;
 static NSString *sharedFolderName     = @""; // TODO: add English default
 static NSString *otherUsersFolderName = @""; // TODO: add English default
 static BOOL     useAltNamespace       = NO;
@@ -43,9 +57,23 @@ static BOOL     useAltNamespace       = NO;
 
   useAltNamespace = [ud boolForKey:@"SOGoSpecialFoldersInRoot"];
   
-  sharedFolderName     = [ud stringForKey:@"SOGoSharedFolderName"];
+  sharedFolderName = [ud stringForKey:@"SOGoSharedFolderName"];
   otherUsersFolderName = [ud stringForKey:@"SOGoOtherUsersFolderName"];
   cfgDraftsFolderName = [ud stringForKey:@"SOGoDraftsFolderName"];
+  if (!sentFolderName)
+    {
+      sentFolderName = [ud stringForKey: @"SOGoSentFolderName"];
+      if (!sentFolderName)
+       sentFolderName = @"Sent";
+      [sentFolderName retain];
+    }
+  if (!trashFolderName)
+    {
+      trashFolderName = [ud stringForKey: @"SOGoTrashFolderName"];
+      if (!trashFolderName)
+       trashFolderName = @"Trash";
+      [trashFolderName retain];
+    }
   if ([cfgDraftsFolderName length] > 0)
     {
       ASSIGN (draftsFolderName, cfgDraftsFolderName);
@@ -220,7 +248,7 @@ static BOOL     useAltNamespace       = NO;
 - (id)lookupImap4Folder:(NSString *)_key inContext:(id)_cx {
   NSString *s;
 
-  s = [_key isEqualToString:[self trashFolderNameInContext:_cx]]
+  s = [_key isEqualToString: [self trashFolderNameInContext:_cx]]
     ? @"SOGoTrashFolder" : @"SOGoMailFolder";
   
   return [self lookupFolder:_key ofClassNamed:s inContext:_cx];
@@ -235,127 +263,117 @@ static BOOL     useAltNamespace       = NO;
               inContext:_ctx];
 }
 
-- (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
+- (id) lookupName: (NSString *) _key
+       inContext: (id)_ctx
+         acquire: (BOOL) _flag
+{
   id obj;
-  
-  /* first check attributes directly bound to the application */
-  if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]) != nil)
-    return obj;
-  
+
+  if ([_key hasPrefix: @"folder"])
+    {
   // TODO: those should be product.plist bindings? (can't be class bindings
   //       though because they are 'per-account')
-  if ([_key isEqualToString: draftsFolderName]) {
-    if ((obj = [self lookupDraftsFolder:_key inContext:_ctx]) != nil)
-      return obj;
-  }
-  if ([_key isEqualToString: sieveFolderName]) {
-    if ((obj = [self lookupFiltersFolder:_key inContext:_ctx]) != nil)
-      return obj;
-  }
-  
-  if ((obj = [self lookupImap4Folder:_key inContext:_ctx]) != nil)
-    return obj;
+      if ([_key isEqualToString: [self draftsFolderNameInContext: _ctx]])
+       obj = [self lookupDraftsFolder: _key inContext: _ctx];
+      else if ([_key isEqualToString: [self sieveFolderNameInContext: _ctx]])
+       obj = [self lookupFiltersFolder: _key inContext: _ctx];
+      else
+       obj = [self lookupImap4Folder: _key inContext: _ctx];
+    }
+  else
+    obj = [super lookupName: _key inContext: _ctx acquire: NO];
   
   /* return 404 to stop acquisition */
-  return [NSException exceptionWithHTTPStatus:404 /* Not Found */];
+  if (!obj)
+    obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */];
+
+  return obj;
 }
 
 /* special folders */
 
-- (NSString *)inboxFolderNameInContext:(id)_ctx {
-  return inboxFolderName; /* cannot be changed in Cyrus ? */
+- (NSString *) inboxFolderNameInContext: (id)_ctx
+{
+  /* cannot be changed in Cyrus ? */
+  return [NSString stringWithFormat: @"folder%@", inboxFolderName];
 }
-- (NSString *)draftsFolderNameInContext:(id)_ctx {
-  return draftsFolderName; /* SOGo managed folder */
+
+- (NSString *) draftsFolderNameInContext: (id) _ctx
+{
+  /* SOGo managed folder */
+  return [NSString stringWithFormat: @"folder%@", draftsFolderName];
 }
-- (NSString *)sieveFolderNameInContext:(id)_ctx {
-  return sieveFolderName;  /* SOGo managed folder */
+
+- (NSString *) sieveFolderNameInContext: (id) _ctx
+{
+  return [NSString stringWithFormat: @"folder%@", sieveFolderName];
 }
-- (NSString *)sentFolderNameInContext:(id)_ctx {
-  /* OGo issue #1225 */
-  static NSString *s = nil;
-  
-  if (s == nil) {
-    NSUserDefaults *ud;
-    
-    ud = [NSUserDefaults standardUserDefaults];
-    s = [[ud stringForKey:@"SOGoSentFolderName"] copy];
-    if ([s length] == 0) s = @"Sent";
-    [self logWithFormat:@"Note: using SOGoSentFolderName: '%@'", s];
-  }
-  return s;
+
+- (NSString *) sentFolderNameInContext: (id)_ctx
+{
+  return [NSString stringWithFormat: @"folder%@", sentFolderName];
 }
-- (NSString *)trashFolderNameInContext:(id)_ctx {
-  /* OGo issue #1225 */
-  static NSString *s = nil;
-  
-  if (s == nil) {
-    NSUserDefaults *ud;
-    
-    ud = [NSUserDefaults standardUserDefaults];
-    s = [[ud stringForKey:@"SOGoTrashFolderName"] copy];
-    if ([s length] == 0) s = @"Trash";
-    NSLog(@"Note: using SOGoTrashFolderName: '%@'", s);
-  }
-  return s;
+
+- (NSString *) trashFolderNameInContext: (id)_ctx
+{
+  return [NSString stringWithFormat: @"folder%@", trashFolderName];
 }
 
-- (SOGoMailFolder *)inboxFolderInContext:(id)_ctx {
+- (SOGoMailFolder *) inboxFolderInContext: (id) _ctx
+{
   // TODO: use some profile to determine real location, use a -traverse lookup
-  SOGoMailFolder *folder;
-  
-  if (inboxFolder != nil)
-    return inboxFolder;
-  
-  folder = [self lookupName:[self inboxFolderNameInContext:_ctx]
-                inContext:_ctx acquire:NO];
-  if ([folder isKindOfClass:[NSException class]]) return folder;
-  
-  return ((inboxFolder = [folder retain]));
+  if (!inboxFolder)
+    {
+      inboxFolder = [self lookupName: [self inboxFolderNameInContext: _ctx]
+                         inContext: _ctx acquire: NO];
+      [inboxFolder retain];
+    }
+
+  return inboxFolder;
 }
 
-- (SOGoMailFolder *)sentFolderInContext:(id)_ctx {
+- (SOGoMailFolder *) sentFolderInContext: (id) _ctx
+{
+  SOGoMailFolder *lookupFolder;
   // TODO: use some profile to determine real location, use a -traverse lookup
-  SOGoMailFolder *folder;
-  
-  if (sentFolder != nil)
-    return sentFolder;
-  
-  folder = useAltNamespace ? (id)self : [self inboxFolderInContext:_ctx];
-  if ([folder isKindOfClass:[NSException class]]) return folder;
-  
-  folder = [folder lookupName:[self sentFolderNameInContext:_ctx]
-                  inContext:_ctx acquire:NO];
-  if ([folder isKindOfClass:[NSException class]]) return folder;
-  
-  if (![folder isNotNull]) {
-    return [NSException exceptionWithHTTPStatus:404 /* not found */
-                       reason:@"did not find Sent folder!"];
-  }
-  
-  return ((sentFolder = [folder retain]));
+
+  if (!sentFolder)
+    {
+      lookupFolder = (useAltNamespace
+                     ? (id) self
+                     : [self inboxFolderInContext:_ctx]);
+      if (![lookupFolder isKindOfClass: [NSException class]])
+       sentFolder = [lookupFolder lookupName: [self sentFolderNameInContext:_ctx]
+                                  inContext: _ctx acquire: NO];
+      if (![sentFolder isNotNull])
+       sentFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
+                                 reason: @"did not find Sent folder!"];
+      [sentFolder retain];
+    }
+
+  return sentFolder;
 }
 
-- (SOGoMailFolder *)trashFolderInContext:(id)_ctx {
-  // TODO: use some profile to determine real location
-  SOGoMailFolder *folder;
-  
-  if (trashFolder != nil)
-    return trashFolder;
-  
-  folder = useAltNamespace ? (id)self : [self inboxFolderInContext:_ctx];
-  if ([folder isKindOfClass:[NSException class]]) return folder;
-  
-  folder = [folder lookupName:[self trashFolderNameInContext:_ctx]
-                  inContext:_ctx acquire:NO];
-  if ([folder isKindOfClass:[NSException class]]) return folder;
-  
-  if (![folder isNotNull]) {
-    return [NSException exceptionWithHTTPStatus:404 /* not found */
-                       reason:@"did not find Trash folder!"];
-  }
-  
-  return ((trashFolder = [folder retain]));
+- (SOGoMailFolder *) trashFolderInContext: (id) _ctx
+{
+  SOGoMailFolder *lookupFolder;
+  // TODO: use some profile to determine real location, use a -traverse lookup
+
+  if (!trashFolder)
+    {
+      lookupFolder = (useAltNamespace
+                     ? (id) self
+                     : [self inboxFolderInContext:_ctx]);
+      if (![lookupFolder isKindOfClass: [NSException class]])
+       trashFolder = [lookupFolder lookupName: [self trashFolderNameInContext: _ctx]
+                                   inContext: _ctx acquire: NO];
+      if (![trashFolder isNotNull])
+       trashFolder = [NSException exceptionWithHTTPStatus: 404 /* not found */
+                                 reason: @"did not find Trash folder!"];
+      [trashFolder retain];
+    }
+
+  return trashFolder;
 }
 
 /* WebDAV */
index bb3ac3ba4687fc2a987b89eef1cc4f9e0fc738c2..71d4f0b8ceb2114a0df705803d8834e6076dfada 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoMailAccounts.h"
-#include "SOGoUser+Mail.h"
-#include "common.h"
-#include <NGObjWeb/SoObject+SoDAV.h>
+#import <Foundation/NSString.h>
+
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGObjWeb/WOContext+SoObjects.h>
+#import <NGExtensions/NSNull+misc.h>
+#import <NGExtensions/NSObject+Logs.h>
+
+#import "SOGoUser+Mail.h"
+
+#import "SOGoMailAccounts.h"
 
 @implementation SOGoMailAccounts
 
@@ -38,7 +44,7 @@ static NSString *AgenorShareLoginMarker  = @".-.";
 - (NSArray *)toManyRelationshipKeys {
   SOGoUser *user;
   id        account;
-  NSArray   *shares;
+//   NSArray   *shares;
   NSString *userLogin;
   
   /*
@@ -63,11 +69,12 @@ static NSString *AgenorShareLoginMarker  = @".-.";
   
   account = [user primaryIMAP4AccountString];
   if ([account isNotNull]) account = [NSArray arrayWithObject:account];
-  
-  shares  = [user valueForKey:@"additionalIMAP4AccountStrings"];
-  return ([shares count] == 0)
-    ? account
-    : [account arrayByAddingObjectsFromArray:shares];
+
+  return account;
+//   shares  = [user valueForKey:@"additionalIMAP4AccountStrings"]
+//   return ([shares count] == 0)
+//     ? account
+//     : [account arrayByAddingObjectsFromArray:shares];
 }
 
 - (NSArray *) fetchIdentitiesWithOnlyEmitterAccess: (BOOL) _flag
index 4ba1c62cadffbdce6c5ea50358831da8c23ec985..91d3c8d881edc7de1829e76dbb6dcf54af4cce10 100644 (file)
@@ -142,9 +142,11 @@ static BOOL debugOn = YES;
 - (NSMutableString *) imap4URLString
 {
   NSMutableString *urlString;
+  NSString *imap4Name;
 
   urlString = [container imap4URLString];
-  [urlString appendFormat: @"%@/", [nameInContainer stringByEscapingURL]];
+  imap4Name = [[self relativeImap4Name] stringByEscapingURL];
+  [urlString appendFormat: @"%@/", imap4Name];
 
   return urlString;
 }
@@ -154,9 +156,7 @@ static BOOL debugOn = YES;
   /* this could probably be handled better from NSURL but it's buggy in
      GNUstep */
   if (!imap4URL)
-    {
-      imap4URL = [[NSURL alloc] initWithString: [self imap4URLString]];
-    }
+    imap4URL = [[NSURL alloc] initWithString: [self imap4URLString]];
 
   return imap4URL;
 }
index 7a996ebd660ee8df14066c9d3f5228f7b6daa397..bfb30aa2fa93897fdd38d59f402dd68d4316122f 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __Mailer_SOGoMailBodyPart_H__
 #define __Mailer_SOGoMailBodyPart_H__
 
-#include <Mailer/SOGoMailBaseObject.h>
+#import <Mailer/SOGoMailBaseObject.h>
 
 /*
   SOGoMailBodyPart
 
 /* hierarchy */
 
-- (SOGoMailObject *)mailObject;
+- (SOGoMailObject *) mailObject;
 
 /* IMAP4 */
 
-- (NSString *)bodyPartName;
-- (NSArray *)bodyPartPath;
-- (NSString *)bodyPartIdentifier;
+- (NSString *) bodyPartName;
+- (NSArray *) bodyPartPath;
+- (NSString *) bodyPartIdentifier;
 
 /* part info */
 
-- (id)partInfo;
+- (id) partInfo;
+- (NSData *) fetchBLOB;
 
 /* factory */
 
-+ (Class)bodyPartClassForKey:(NSString *)_key inContext:(id)_ctx;
++ (Class) bodyPartClassForKey: (NSString *) _key
+                   inContext: (id) _ctx;
 
 @end
 
index ec10200f2165b8d8bc9c0a1c4823448c781612fe..15bc9dd5efffe89aa9e40635d6d2807c238a5f13 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoMailBodyPart.h"
-#include "SOGoMailObject.h"
-#include "SOGoMailManager.h"
-#include "common.h"
+#import <Foundation/NSArray.h>
+#import <Foundation/NSDictionary.h>
+#import <Foundation/NSEnumerator.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGObjWeb/SoObject+SoDAV.h>
+#import <NGObjWeb/WOContext.h>
+#import <NGObjWeb/WOResponse.h>
+#import <NGExtensions/NSNull+misc.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NGBase64Coding.h>
+#import <NGImap4/NGImap4Connection.h>
+
+#import "SOGoMailObject.h"
+#import "SOGoMailManager.h"
+
+#import "SOGoMailBodyPart.h"
 
 @implementation SOGoMailBodyPart
 
index f6fd2f538c157a19f22dc6584f51432c2579e440..491734c730878c63f2c43aac2e4bfeb408a86101 100644 (file)
   The SOGoMailFolder maps to an IMAP4 folder from NGImap4.
 */
 
-@class NSData, NSArray, NSException;
+@class NSData, NSArray, NSException, NSMutableArray;
 @class NGImap4MailboxInfo;
 
 @interface SOGoMailFolder : SOGoMailBaseObject
 {
-  NSArray            *filenames;
-  NSString           *folderType;
+  NSMutableArray *filenames;
+  NSString *folderType;
 }
 
 /* messages */
index ab951bda192d58c8e9e0fe06d360642e44bcdeeb..5198482c70d03db7e0e16ddc2d66177ce4caaa09 100644 (file)
@@ -102,7 +102,7 @@ static BOOL useAltNamespace = NO;
 
 - (NSString *) relativeImap4Name
 {
-  return nameInContainer;
+  return [nameInContainer substringFromIndex: 6];
 }
 
 /* listing the available folders */
@@ -151,34 +151,26 @@ static BOOL useAltNamespace = NO;
 
 - (NSArray *) toOneRelationshipKeys
 {
-  NSArray  *uids;
-  unsigned count;
-  
-  if (filenames != nil)
-    return [filenames isNotNull] ? filenames : nil;
+  NSArray *uids;
+  unsigned int count, max;
+  NSString *filename;
 
-  uids = [self fetchUIDsMatchingQualifier:nil sortOrdering:@"DATE"];
-  if ([uids isKindOfClass:[NSException class]])
-    return nil;
-  
-  if ((count = [uids count]) == 0) {
-    filenames = [[NSArray alloc] init];
-  }
-  else {
-    NSMutableArray *keys;
-    unsigned i;
-    
-    keys = [[NSMutableArray alloc] initWithCapacity:count];
-    for (i = 0; i < count; i++) {
-      NSString *k;
-      
-      k = [[uids objectAtIndex:i] stringValue];
-      k = [k stringByAppendingString:@".mail"];
-      [keys addObject:k];
+  if (!filenames)
+    {
+      filenames = [NSMutableArray new];
+      uids = [self fetchUIDsMatchingQualifier: nil sortOrdering: @"DATE"];
+      if (![uids isKindOfClass: [NSException class]])
+       {
+         max = [uids count];
+         for (count = 0; count < max; count++)
+           {
+             filename = [NSString stringWithFormat: @"%@.mail",
+                                  [uids objectAtIndex: count]];
+             [filenames addObject: filename];
+           }
+       }
     }
-    filenames = [keys copy];
-    [keys release];
-  }
+
   return filenames;
 }
 
@@ -230,27 +222,6 @@ static BOOL useAltNamespace = NO;
 
 /* name lookup */
 
-- (BOOL) isMessageKey: (NSString *) _key
-           inContext: (id) _ctx
-{
-  /*
-    Every key starting with a digit is consider an IMAP4 message key. This is
-    not entirely correct since folders could also start with a number.
-    
-    If we want to support folders beginning with numbers, we would need to
-    scan the folder list for the _key, which would make everything quite a bit
-    slower.
-    TODO: support this mode using a default.
-  */
-  if ([_key length] == 0)
-    return NO;
-  
-  if (isdigit([_key characterAtIndex:0]))
-    return YES;
-  
-  return NO;
-}
-
 - (id) lookupImap4Folder: (NSString *) _key
               inContext: (id) _ctx
 {
@@ -291,28 +262,22 @@ static BOOL useAltNamespace = NO;
          acquire: (BOOL) _acquire
 {
   id obj;
-  
-  if ([self isMessageKey:_key inContext:_ctx]) {
-    /* 
-       We assume here that _key is a number and methods are not and this is
-       moved above the super lookup since the super checks the
-       -toOneRelationshipKeys which in turn loads the message ids.
-    */
-    return [self lookupImap4Message:_key inContext:_ctx];
-  }
 
-  obj = [self lookupImap4Folder:_key  inContext:_ctx];
-  if (obj != nil)
-    return obj;
-  
-  /* check attributes directly bound to the app */
-  if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
-    return obj;
-  
-  /* return 404 to stop acquisition */
-  return _acquire
-    ? [NSException exceptionWithHTTPStatus:404 /* Not Found */]
-    : nil; /* hack to work with WebDAV move */
+  if ([_key hasPrefix: @"folder"])
+    obj = [self lookupImap4Folder: [_key substringFromIndex: 6]
+               inContext: _ctx];
+  else
+    {
+      if (isdigit ([_key characterAtIndex: 0]))
+       obj = [self lookupImap4Message: _key inContext: _ctx];
+      else
+       obj = [super lookupName: _key inContext: _ctx acquire: NO];
+    }
+
+  if (!obj && _acquire)
+    obj = [NSException exceptionWithHTTPStatus: 404 /* Not Found */];
+
+  return obj;
 }
 
 /* WebDAV */
index f9aba4878dd0342deaf5f4234c2b2a89f9b95b6c..2dbc71ee32ed94833617067e02e8f28d3862bcf7 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoMailFolderDataSource.h"
-#include "SOGoMailManager.h"
-#include <NGObjWeb/EOFetchSpecification+SoDAV.h>
-#include <NGImap4/NGImap4Envelope.h>
-#include "common.h"
+#import <Foundation/NSArray.h>
+#import <Foundation/NSAutoreleasePool.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <NGObjWeb/EOFetchSpecification+SoDAV.h>
+#import <NGExtensions/EODataSource+NGExtensions.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <EOControl/EOQualifier.h>
+#import <EOControl/EOSortOrdering.h>
+#import <NGImap4/NGImap4Envelope.h>
+
+#import "SOGoMailManager.h"
+
+#import "SOGoMailFolderDataSource.h"
 
 @implementation SOGoMailFolderDataSource
 
index a9373dfae423047fa00ade5ffc94eedf3f71c52e..424d08918a2a2c28e1de7f9d419a0a0605a16345 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoMailIdentity.h"
-#include "common.h"
+#import <Foundation/NSString.h>
+
+#import <NGExtensions/NSNull+misc.h>
+
+#import "SOGoMailIdentity.h"
 
 @implementation SOGoMailIdentity
 
 - (void)dealloc {
-  [self->name                release];
-  [self->email               release];
-  [self->replyTo             release];
-  [self->organization        release];
-  [self->signature           release];
-  [self->vCard               release];
-  [self->sentFolderName      release];
-  [self->sentBCC             release];
-  [self->draftsFolderName    release];
-  [self->templatesFolderName release];
+  [name                release];
+  [email               release];
+  [replyTo             release];
+  [organization        release];
+  [signature           release];
+  [vCard               release];
+  [sentFolderName      release];
+  [sentBCC             release];
+  [draftsFolderName    release];
+  [templatesFolderName release];
   [super dealloc];
 }
 
 /* accessors */
 
 - (void)setName:(NSString *)_value {
-  ASSIGNCOPY(self->name, _value);
+  ASSIGNCOPY(name, _value);
 }
 - (NSString *)name {
-  return self->name;
+  return name;
 }
 
 - (void)setEmail:(NSString *)_value {
-  ASSIGNCOPY(self->email, _value);
+  ASSIGNCOPY(email, _value);
 }
 - (NSString *)email {
-  return self->email;
+  return email;
 }
 
 - (void)setReplyTo:(NSString *)_value {
-  ASSIGNCOPY(self->replyTo, _value);
+  ASSIGNCOPY(replyTo, _value);
 }
 - (NSString *)replyTo {
-  return self->replyTo;
+  return replyTo;
 }
 
 - (void)setOrganization:(NSString *)_value {
-  ASSIGNCOPY(self->organization, _value);
+  ASSIGNCOPY(organization, _value);
 }
 - (NSString *)organization {
-  return self->organization;
+  return organization;
 }
 
 - (void)setSignature:(NSString *)_value {
-  ASSIGNCOPY(self->signature, _value);
+  ASSIGNCOPY(signature, _value);
 }
 - (NSString *)signature {
-  return self->signature;
+  return signature;
 }
 - (BOOL)hasSignature {
   return [[self signature] isNotEmpty];
 }
 
 - (void)setVCard:(NSString *)_value {
-  ASSIGNCOPY(self->vCard, _value);
+  ASSIGNCOPY(vCard, _value);
 }
 - (NSString *)vCard {
-  return self->vCard;
+  return vCard;
 }
 - (BOOL)hasVCard {
   return [[self vCard] isNotEmpty];
 }
 
 - (void)setSentFolderName:(NSString *)_value {
-  ASSIGNCOPY(self->sentFolderName, _value);
+  ASSIGNCOPY(sentFolderName, _value);
 }
 - (NSString *)sentFolderName {
-  return self->sentFolderName;
+  return sentFolderName;
 }
 
 - (void)setSentBCC:(NSString *)_value {
-  ASSIGNCOPY(self->sentBCC, _value);
+  ASSIGNCOPY(sentBCC, _value);
 }
 - (NSString *)sentBCC {
-  return self->sentBCC;
+  return sentBCC;
 }
 
 - (void)setDraftsFolderName:(NSString *)_value {
-  ASSIGNCOPY(self->draftsFolderName, _value);
+  ASSIGNCOPY(draftsFolderName, _value);
 }
 - (NSString *)draftsFolderName {
-  return self->draftsFolderName;
+  return draftsFolderName;
 }
 
 - (void)setTemplatesFolderName:(NSString *)_value {
-  ASSIGNCOPY(self->templatesFolderName, _value);
+  ASSIGNCOPY(templatesFolderName, _value);
 }
 - (NSString *)templatesFolderName {
-  return self->templatesFolderName;
+  return templatesFolderName;
 }
 
 /* description */
   ms = [NSMutableString stringWithCapacity:128];
   [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
   
-  if (self->name  != nil) [ms appendFormat:@" name='%@'",  self->name];
-  if (self->email != nil) [ms appendFormat:@" email='%@'", self->email];
+  if (name  != nil) [ms appendFormat:@" name='%@'",  name];
+  if (email != nil) [ms appendFormat:@" email='%@'", email];
   
-  if (self->sentFolderName != nil) 
-    [ms appendFormat:@" sent='%@'", self->sentFolderName];
+  if (sentFolderName != nil) 
+    [ms appendFormat:@" sent='%@'", sentFolderName];
   
-  if ([self->sentBCC length] > 0) [ms appendString:@" sent-bcc"];
-  if ([self->vCard length]   > 0) [ms appendString:@" vcard"];
+  if ([sentBCC length] > 0) [ms appendString:@" sent-bcc"];
+  if ([vCard length]   > 0) [ms appendString:@" vcard"];
   
   [ms appendString:@">"];
   return ms;
index f3e947a3068853a874dc0e4d312fbb274fc67d66..59c1f4c0b4b6678e84e2ef8a8e1885fbe7e0fd94 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoMailManager.h"
-#include <NGImap4/NGImap4Connection.h>
-#include <NGImap4/NGImap4ConnectionManager.h>
-#include "common.h"
+#import <Foundation/NSArray.h>
+
+#import <NGObjWeb/NSException+HTTP.h>
+#import <NGExtensions/NSNull+misc.h>
+#import <NGImap4/NGImap4Connection.h>
+#import <NGImap4/NGImap4ConnectionManager.h>
+
+#import "SOGoMailManager.h"
 
 /*
   Could check read-write state:
index db704eb93090867fdd5fba9df92229a8c52ce293..75306461f284444fbc67d9a7123b970a3a9c278a 100644 (file)
@@ -74,7 +74,7 @@ static BOOL debugSoParts       = NO;
   /* Note: "BODY" actually returns the structure! */
   if (fetchHeader) {
     coreInfoKeys = [[NSArray alloc] initWithObjects:
-                                     @"FLAGS", @"ENVELOPE", @"BODY",
+                                     @"FLAGS", @"ENVELOPE", @"BODYSTRUCTURE",
                                      @"RFC822.SIZE",
                                      @"RFC822.HEADER",
                                      // not yet supported: @"INTERNALDATE",
@@ -82,7 +82,7 @@ static BOOL debugSoParts       = NO;
   }
   else {
     coreInfoKeys = [[NSArray alloc] initWithObjects:
-                                     @"FLAGS", @"ENVELOPE", @"BODY",
+                                     @"FLAGS", @"ENVELOPE", @"BODYSTRUCTURE",
                                      @"RFC822.SIZE",
                                      // not yet supported: @"INTERNALDATE",
                                    nil];
@@ -117,9 +117,11 @@ static BOOL debugSoParts       = NO;
 - (NSMutableString *) imap4URLString
 {
   NSMutableString *urlString;
+  NSString *imap4Name;
 
   urlString = [container imap4URLString];
-  [urlString appendFormat: @"%@", [nameInContainer stringByEscapingURL]];
+  imap4Name = [[self relativeImap4Name] stringByEscapingURL];
+  [urlString appendFormat: @"%@", imap4Name];
 
   return urlString;
 }
@@ -203,7 +205,7 @@ static BOOL debugSoParts       = NO;
   /*
     Called by -fetchPlainTextParts:
   */
-  return [[self imap4Connection] fetchURL:[self imap4URL] parts:_parts];
+  return [[self imap4Connection] fetchURL: [self imap4URL] parts:_parts];
 }
 
 /* core infos */
@@ -679,12 +681,12 @@ static BOOL debugSoParts       = NO;
 
 - (NSException *) addFlags: (id) _flags
 {
-  return [[self imap4Connection] addFlags:_flags toURL:[self imap4URL]];
+  return [[self imap4Connection] addFlags:_flags toURL: [self imap4URL]];
 }
 
 - (NSException *) removeFlags: (id) _flags
 {
-  return [[self imap4Connection] removeFlags:_flags toURL:[self imap4URL]];
+  return [[self imap4Connection] removeFlags:_flags toURL: [self imap4URL]];
 }
 
 /* permissions */
index 4932bf20cce227abce0c51c01d02f67572f65044..0e5fcc5be8378f83eb20718b833879f408669e20 100644 (file)
@@ -19,7 +19,7 @@
   02111-1307, USA.
 */
 
-#include <Mailer/SOGoMailBodyPart.h>
+#import "SOGoMailBodyPart.h"
 
 /*
   SOGoMessageMailBodyPart
 */
 
 @interface SOGoMessageMailBodyPart : SOGoMailBodyPart
-{
-}
-
 @end
 
-#include "common.h"
-
 @implementation SOGoMessageMailBodyPart
 
 @end /* SOGoMessageMailBodyPart */
index 1e597b30f84a0c211cdfe5d764227cc3ffa31dbc..8fc1f4173af59ee0f25666794d024ec1849cfc99 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __Mailer_SOGoSharedInboxFolder_H__
 #define __Mailer_SOGoSharedInboxFolder_H__
 
-#include <SoObjects/Mailer/SOGoMailFolder.h>
+#import <SoObjects/Mailer/SOGoMailFolder.h>
 
 /*
   SOGoSharedInboxFolder
index d5e444bffe2af018f8c0371739c67a45ae110303..5399b751ecf5639029d2d579332b46578b76b08f 100644 (file)
@@ -19,8 +19,7 @@
   02111-1307, USA.
 */
 
-#include "SOGoSharedInboxFolder.h"
-#include "common.h"
+#import "SOGoSharedInboxFolder.h"
 
 @implementation SOGoSharedInboxFolder
 
index 5b7ba9ec2cb92498a9078e749fb6a44b3a2bc633..86922604b87e608c3bde5edbe0e929822505e9d2 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoSharedMailAccount.h"
-#include "common.h"
+#import <Foundation/NSArray.h>
+#import <Foundation/NSString.h>
+#import <Foundation/NSUserDefaults.h>
+
+#import <NGImap4/NGImap4Connection.h>
+
+#import "SOGoSharedMailAccount.h"
 
 @interface SOGoMailAccount(UsedPrivates)
 
index c4089a8af0f23acfe4d36a8558c4ac9f365472fa..d097490a4d2c892b57caf03c3cff6d192dc4321f 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __Mailer_SOGoTrashFolder_H__
 #define __Mailer_SOGoTrashFolder_H__
 
-#include <SoObjects/Mailer/SOGoMailFolder.h>
+#import "SOGoMailFolder.h"
 
 @interface SOGoTrashFolder : SOGoMailFolder
 @end
index 01cbd13d5fdcebdc51879b08324bb1c1e8f58ced..b034bfb16ae88ac1e3df2297c6616e462a02fbca 100644 (file)
@@ -19,8 +19,9 @@
   02111-1307, USA.
 */
 
-#include "SOGoTrashFolder.h"
-#include "common.h"
+#import <Foundation/NSString.h>
+
+#import "SOGoTrashFolder.h"
 
 @implementation SOGoTrashFolder
 
index 00b5561ca99c9aeae6bbc8172f182872540566ee..2cde839863f87bb630c6ec068e73af84b09414be 100644 (file)
   02111-1307, USA.
 */
 
-#include "SOGoUser+Mail.h"
-#include "SOGoMailIdentity.h"
-#include "common.h"
+#import <Foundation/NSArray.h>
+#import <Foundation/NSUserDefaults.h>
+#import <Foundation/NSKeyValueCoding.h>
+
+#import <NGExtensions/NSNull+misc.h>
+#import <NGExtensions/NSObject+Logs.h>
+
+#import "SOGoMailIdentity.h"
+
+#import "SOGoUser+Mail.h"
 
 @implementation SOGoUser(Mail)
 
index 3f24d21a343c9e5cbedc366e4777bded73154a51..6299fe542172f1750c0e0b9b9a67442a8b164aa1 100644 (file)
@@ -19,7 +19,7 @@
   02111-1307, USA.
 */
 
-#include <Mailer/SOGoMailBodyPart.h>
+#import "SOGoMailBodyPart.h"
 
 /*
   SOGoVCardMailBodyPart
 */
 
 @interface SOGoVCardMailBodyPart : SOGoMailBodyPart
-{
-}
-
 @end
 
-#include "common.h"
-
 @implementation SOGoVCardMailBodyPart
-
 @end /* SOGoVCardMailBodyPart */
diff --git a/SoObjects/Mailer/common.h b/SoObjects/Mailer/common.h
deleted file mode 100644 (file)
index 634e72e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-  Copyright (C) 2002-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.
-*/
-
-#warning importing common is baaad
-
-#import <Foundation/Foundation.h>
-#import <Foundation/NSObjCRuntime.h>
-
-#if NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY
-#  include <NGExtensions/NGObjectMacros.h>
-#  include <NGExtensions/NSString+Ext.h>
-#endif
-
-#include <NGExtensions/NGExtensions.h>
-#include <NGObjWeb/NGObjWeb.h>
-#include <NGObjWeb/SoObjects.h>
-
-#include <NGObjWeb/SoObject+SoDAV.h>
-
-#include <NGImap4/NGImap4Connection.h>
-
-#warning importing common.h is baaad
index 8691beff0c08a5dee51f85190cd82831657ed28c..8d84e92898f426834625c8549ad0577e798e58a6 100644 (file)
@@ -167,10 +167,10 @@ static BOOL kontactGroupDAV = YES;
 //   SoClass security declarations
   
 //   require View permission to access the root (bound to authenticated ...)
-  [[self soClassSecurityInfo] declareObjectProtected: SoPerm_View];
+//   [[self soClassSecurityInfo] declareObjectProtected: SoPerm_View];
 
 //   to allow public access to all contained objects (subkeys)
-  [[self soClassSecurityInfo] setDefaultAccess: @"allow"];
+//   [[self soClassSecurityInfo] setDefaultAccess: @"allow"];
   
 //   /* require Authenticated role for View and WebDAV */
 //   [[self soClassSecurityInfo] declareRole: SoRole_Owner
index bb9c1bf5d4d951da48b9ce80e761944f2ce0f1cf..9af10007e41ae91a16bad5a4f7c4fb9e2fde59cd 100644 (file)
@@ -26,3 +26,9 @@
 "Default Roles" = "Default Roles";
 
 "Sorry, the user rights can not be configured for that object." = "Sorry, the user rights can not be configured for that object.";
+
+/* generic.js */
+"Unable to subscribe to that folder!" = "Unable to subscribe to that folder!";
+"You cannot subscribe to a folder that you own!" = "You cannot subscribe to a folder that you own!";
+"Unable to unsubscribe from that folder!" = "Unable to unsubscribe from that folder!";
+"You cannot unsubscribe from a folder that you own!" = "You cannot unsubscribe from a folder that you own!";
index 5264f182aac17704aeb7f6a5c96af801f6ba6dda..18a984d3b65630cb4e63d91dadb3c292299c3f1c 100644 (file)
@@ -27,3 +27,9 @@
 "Default Roles" = "Rôles par défaut";
 
 "Sorry, the user rights can not be configured for that object." = "Sorry, the user rights can not be configured for that object.";
+
+/* generic.js */
+"Unable to subscribe to that folder!" = "Impossible de s'abonner Ã  ce dossier.";
+"You cannot subscribe to a folder that you own!" = "Impossible de vous abonner Ã  un dossier qui vous appartient.";
+"Unable to unsubscribe from that folder!" = "Impossible de se désabonner de ce dossier.";
+"You cannot unsubscribe from a folder that you own!" = "Impossible de vous désabonner d'un dossier qui vous appartient.";
index dc8f65d1ad240bb2bce5b28907b9be2c9fcc3bd8..4a68368d7fedecd735357a254f44867c58df9952 100644 (file)
@@ -19,6 +19,9 @@
   02111-1307, USA.
 */
 
+@class NSString;
+#import <Foundation/NSObject.h>
+
 #import <DOM/DOMProtocols.h>
 
 #import "UIxKolabPartViewer.h"
index 73ff7282f8ca5908477e57532df9d001e9ea28f1..e44980ea2d23630417100e1ab9a30f4266630e66 100644 (file)
@@ -19,6 +19,7 @@
   02111-1307, USA.
 */
 
+#import <Foundation/NSArray.h>
 #import <Foundation/NSDictionary.h>
 
 #import <NGExtensions/NGBase64Coding.h>
@@ -27,7 +28,9 @@
 #import <NGExtensions/NGQuotedPrintableCoding.h>
 #import <NGExtensions/NSString+Encoding.h>
 #import <NGExtensions/NSString+misc.h>
+
 #import <SoObjects/SOGo/NSString+Utilities.h>
+#import <SoObjects/Mailer/SOGoMailBodyPart.h>
 
 #import "UI/MailerUI/WOContext+UIxMailer.h"
 #import "UIxMailRenderingContext.h"
 
 @implementation UIxMailPartViewer
 
-- (void)dealloc {
+- (void) dealloc
+{
   [flatContent release];
-  [bodyInfo    release];
-  [partPath    release];
+  [bodyInfo release];
+  [partPath release];
   [super dealloc];
 }
 
 /* caches */
 
-- (void)resetPathCaches {
+- (void) resetPathCaches
+{
   /* this is called when -setPartPath: is called */
   [flatContent release]; flatContent = nil;
 }
-- (void)resetBodyInfoCaches {
+
+- (void) resetBodyInfoCaches
+{
 }
 
 /* notifications */
 
-- (void)sleep {
+- (void) sleep
+{
   [self resetPathCaches];
   [self resetBodyInfoCaches];
-  [partPath release]; partPath = nil;
-  [bodyInfo release]; bodyInfo = nil;
+  [partPath release];
+  [bodyInfo release];
+  partPath = nil;
+  bodyInfo = nil;
   [super sleep];
 }
 
 /* accessors */
 
-- (void)setPartPath:(NSArray *)_path {
-  if ([_path isEqual:partPath])
+- (void) setPartPath: (NSArray *) _path
+{
+  if ([_path isEqual: partPath])
     return;
-  
+
   ASSIGN(partPath, _path);
+
   [self resetPathCaches];
 }
-- (NSArray *)partPath {
+
+- (NSArray *) partPath
+{
   return partPath;
 }
 
-- (void)setBodyInfo:(id)_info {
+- (void) setBodyInfo: (id) _info
+{
   ASSIGN(bodyInfo, _info);
 }
-- (id)bodyInfo {
+
+- (id) bodyInfo
+{
   return bodyInfo;
 }
 
-- (NSData *)flatContent {
+- (NSData *) flatContent
+{
   if (flatContent != nil)
     return [flatContent isNotNull] ? flatContent : nil;
   
   flatContent = 
     [[[context mailRenderingContext] flatContentForPartPath:
-                                             [self partPath]] retain];
+                                             partPath] retain];
   return flatContent;
 }
 
-- (NSData *)decodedFlatContent {
+- (NSData *) decodedFlatContent
+{
   NSString *enc;
   
-  enc = [[(NSDictionary *)[self bodyInfo] 
-                         objectForKey:@"encoding"] lowercaseString];
-  
+  enc = [[bodyInfo objectForKey:@"encoding"] lowercaseString];
+
   if ([enc isEqualToString:@"7bit"])
     return [self flatContent];
   
     return [[self flatContent] dataByDecodingQuotedPrintable];
   
   [self errorWithFormat:@"unsupported MIME encoding: %@", enc];
+
   return [self flatContent];
 }
 
-- (NSStringEncoding)fallbackStringEncoding {
+- (NSData *) content
+{
+  NSData *content;
+  NSEnumerator *parts;
+  id currentObject;
+  NSString *currentPart;
+
+  content = nil;
+
+  currentObject = [self clientObject];
+  parts = [partPath objectEnumerator];
+  currentPart = [parts nextObject];
+  while (currentPart)
+    {
+      currentObject = [currentObject lookupName: currentPart
+                                    inContext: context
+                                    acquire: NO];
+      currentPart = [parts nextObject];
+    }
+
+  content = [currentObject fetchBLOB];
+
+  return content;
+}
+
+- (NSStringEncoding) fallbackStringEncoding
+{
   return 0;
 }
+
 - (NSString *)flatContentAsString {
   /* Note: we even have the line count in the body-info! */
   NSString *charset;
   NSString *s;
   NSData   *content;
-  
-  if ((content = [self decodedFlatContent]) == nil) {
-    [self errorWithFormat:@"got no text content: %@", 
-           [[self partPath] componentsJoinedByString:@"."]];
-    return nil;
-  }
-  
-  charset = [(NSDictionary *)
-             [(NSDictionary *)[self bodyInfo] objectForKey:@"parameterList"]
-              objectForKey:@"charset"];
-  charset = [charset lowercaseString];
 
-  // TODO: properly decode charset, might need to handle encoding?
-  
-  if ([charset length] > 0) {
-    s = [NSString stringWithData: content usingEncodingNamed: charset];
-  }
-  else {
-    s = [[NSString alloc] initWithData: content encoding: NSUTF8StringEncoding];
-    s = [s autorelease];
-  }
+  content = [self decodedFlatContent];
+  if (content)
+    {
+      charset = [[bodyInfo objectForKey:@"parameterList"]
+                 objectForKey: @"charset"];
+
+      // TODO: properly decode charset, might need to handle encoding?
   
-  if (s == nil) {
-    /* 
-       Note: this can happend with iCalendar invitations sent by Outlook 2002.
-             It will mark the content as UTF-8 but actually deliver it as
+      if ([charset length] > 0)
+       s = [NSString stringWithData: content
+                     usingEncodingNamed: [charset lowercaseString]];
+      else
+       {
+         s = [[NSString alloc] initWithData: content
+                               encoding: NSUTF8StringEncoding];
+         [s autorelease];
+       }
+
+      if (!s)
+       {
+         /* 
+            Note: this can happend with iCalendar invitations sent by Outlook 2002.
+            It will mark the content as UTF-8 but actually deliver it as
             Latin-1 (or Windows encoding?).
-    */
-    [self errorWithFormat:@"could not convert content to text, charset: '%@'",
-            charset];
-    if ([self fallbackStringEncoding] > 0) {
-      s = [[NSString alloc] initWithData:content 
-                           encoding:[self fallbackStringEncoding]];
-      s = [s autorelease];
-      
-      if (s == nil) {
-       [self errorWithFormat:
-               @"  an attempt to use fallback encoding failed to."];
-      }
+         */
+         [self errorWithFormat:@"could not convert content to text, charset: '%@'",
+               charset];
+         if ([self fallbackStringEncoding] > 0)
+           {
+             s = [[NSString alloc] initWithData:content 
+                                   encoding: [self fallbackStringEncoding]];
+             if (s)
+               [s autorelease];
+             else
+               [self errorWithFormat:
+                       @"an attempt to use fallback encoding failed to."];
+           }
+       }
     }
-  }
+  else
+    {
+      [self errorWithFormat:@"got no text content: %@", 
+           [partPath componentsJoinedByString:@"."]];
+      s = nil;
+    }
+
   return s;
 }
 
 /* path extension */
 
-- (NSString *)pathExtensionForType:(NSString *)_mt subtype:(NSString *)_st {
+- (NSString *) pathExtensionForType: (NSString *) _mt
+                           subtype: (NSString *) _st
+{
   // TODO: support /etc/mime.types
   
   if (![_mt isNotNull] || ![_st isNotNull])
   return nil;
 }
 
-- (NSString *)preferredPathExtension {
-  return [self pathExtensionForType:[[self bodyInfo] valueForKey:@"type"]
-              subtype:[[self bodyInfo] valueForKey:@"subtype"]];
+- (NSString *) preferredPathExtension
+{
+  return [self pathExtensionForType: [bodyInfo valueForKey:@"type"]
+              subtype: [bodyInfo valueForKey:@"subtype"]];
 }
 
-- (NSString *)filename {
-  id tmp;
-  
-  tmp = [[self bodyInfo] valueForKey:@"parameterList"];
-  if (![tmp isNotNull])
-    return nil;
-  
-  tmp = [tmp valueForKey:@"name"];
-  if (![tmp isNotNull])
-    return nil;
-  if ([tmp length] == 0)
-    return nil;
-  
-  return tmp;
+- (NSString *) filename
+{
+  NSDictionary *parameters;
+  NSString *filename;
+
+  filename = nil;
+  parameters = [bodyInfo valueForKey: @"parameterList"];
+  if (parameters)
+    filename = [parameters valueForKey: @"name"];
+
+  if (!filename)
+    {
+      parameters = [[bodyInfo valueForKey: @"disposition"]
+                    valueForKey: @"parameterList"];
+      filename = [parameters valueForKey: @"filename"];
+    }
+
+  return filename;
 }
 
-- (NSString *)filenameForDisplay {
+- (NSString *) filenameForDisplay
+{
   NSString *s;
   
   if ((s = [self filename]) != nil)
     return s;
   
-  s = [[self partPath] componentsJoinedByString:@"-"];
+  s = [partPath componentsJoinedByString:@"-"];
   return ([s length] > 0)
     ? [@"untitled-" stringByAppendingString:s]
     : @"untitled";
 }
 
-- (NSFormatter *)sizeFormatter {
+- (NSFormatter *) sizeFormatter
+{
   return [UIxMailSizeFormatter sharedMailSizeFormatter];
 }
 
 /* URL generation */
 
-- (NSString *)pathToAttachmentObject {
+- (NSString *) pathToAttachmentObject
+{
   /* this points to the SoObject representing the part, no modifications */
   NSString *url, *n, *pext;
 
   /* path to mail controller object */
   
   url = [[self clientObject] baseURLInContext:context];
-  if (![url hasSuffix:@"/"]) url = [url stringByAppendingString:@"/"];
+  if (![url hasSuffix: @"/"])
+    url = [url stringByAppendingString: @"/"];
   
   /* mail relative path to body-part */
   
-  if ([(n = [[self partPath] componentsJoinedByString:@"/"]) isNotNull]) {
-    /* eg this was nil for a draft containing an HTML message */
+  /* eg this was nil for a draft containing an HTML message */
+  if ([(n = [partPath componentsJoinedByString:@"/"]) isNotNull])
     url = [url stringByAppendingString:n];
-  }
   
   /* we currently NEED the extension for SoObject lookup (should be fixed) */
   
   pext = [self preferredPathExtension];
-  if ([pext isNotNull] && [pext length] > 0) {
-    /* attach extension */
-    if ([url hasSuffix:@"/"]) {
-      /* this happens if the part is the root-content of the mail */
-      url = [url substringToIndex:([url length] - 1)];
+  if ([pext isNotNull] && [pext length] > 0)
+    {
+      /* attach extension */
+      if ([url hasSuffix:@"/"]) {
+       /* this happens if the part is the root-content of the mail */
+       url = [url substringToIndex:([url length] - 1)];
+      }
+      url = [url stringByAppendingString:@"."];
+      url = [url stringByAppendingString:pext];
     }
-    url = [url stringByAppendingString:@"."];
-    url = [url stringByAppendingString:pext];
-  }
   
   return url;
 }
 
-- (NSString *)pathToAttachment {
+- (NSString *) pathToAttachment
+{
   /* this generates a more beautiful 'download' URL for a part */
   NSString *url, *fn;
 
      SOGoMailBodyPart.
   */
   
-  if (fn != nil) {
-    if (![url hasSuffix:@"/"]) url = [url stringByAppendingString:@"/"];
-    if (isdigit([fn characterAtIndex:0]))
-      url = [url stringByAppendingString:@"fn-"];
-    url = [url stringByAppendingString:[fn stringByEscapingURL]];
+  if (fn)
+    {
+      if (![url hasSuffix: @"/"])
+       url = [url stringByAppendingString: @"/"];
+      if (isdigit([fn characterAtIndex:0]))
+       url = [url stringByAppendingString: @"fn-"];
+      url = [url stringByAppendingString: [fn stringByEscapingURL]];
     
     // TODO: should we check for a proper extension?
-  }
-  
+    }
+
   return url;
 }
 
index 13c92f539b53e485c8e04ba7657d5830bf982b59..5817816ae7f470d525aabd8f2724af29afeb3284 100644 (file)
 
 #import <Foundation/NSObject.h>
 
+#include <NGObjWeb/WOContext.h>
+
+
 /*
   UIxMailRenderingContext
   
   The rendering context is used to track nesting of mail part viewers.
 */
 
-@class NSData, NSArray, NSDictionary;
-@class WOContext, WOComponent;
+@class NSArray;
+@class NSData;
+@class NSDictionary;
+@class WOComponent;
 
 @interface UIxMailRenderingContext : NSObject
 {
   WOComponent  *htmlViewer;
 }
 
-- (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx;
+- (id) initWithViewer: (WOComponent *) _viewer
+             context: (WOContext *) _ctx;
 
 /* state */
 
-- (void)reset;
+- (void) reset;
 
 /* fetching */
 
-- (NSDictionary *)flatContents;
-- (NSData *)flatContentForPartPath:(NSArray *)_partPath;
+- (NSDictionary *) flatContents;
+- (NSData *) flatContentForPartPath: (NSArray *) _partPath;
 
 /* viewer components */
 
-- (WOComponent *)viewerForBodyInfo:(id)_info;
+- (WOComponent *) viewerForBodyInfo: (id)_info;
 
 @end
 
-
-#include <NGObjWeb/WOContext.h>
-
 @interface WOContext(UIxMailPart)
 
-- (void)pushMailRenderingContext:(UIxMailRenderingContext *)_mctx;
-- (UIxMailRenderingContext *)popMailRenderingContext;
-- (UIxMailRenderingContext *)mailRenderingContext;
+- (void) pushMailRenderingContext: (UIxMailRenderingContext *) _mctx;
+- (UIxMailRenderingContext *) popMailRenderingContext;
+- (UIxMailRenderingContext *) mailRenderingContext;
 
 @end
 
index e2a101ae07b96f8d90307ddf4bd0a4e3bdec7488..e60be0bbcc989c872090bc911ac9d00cb29088f0 100644 (file)
   02111-1307, USA.
 */
 
-#include "UIxMailRenderingContext.h"
-#include <SoObjects/Mailer/SOGoMailObject.h>
-#include "common.h"
+#import <Foundation/NSString.h>
+
+#import <NGObjWeb/WOComponent.h>
+#import <NGExtensions/NSObject+Logs.h>
+#import <NGExtensions/NSNull+misc.h>
+
+#import <SoObjects/Mailer/SOGoMailObject.h>
+
+#import "UIxMailRenderingContext.h"
 
 @implementation UIxMailRenderingContext
 
 static BOOL showNamedTextAttachmentsInline = NO;
 
-- (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx {
-  if ((self = [super init])) {
-    self->viewer  = _viewer;
-    self->context = _ctx;
-  }
+- (id) initWithViewer: (WOComponent *) _viewer
+             context: (WOContext *) _ctx
+{
+  if ((self = [super init]))
+    {
+      viewer  = _viewer;
+      context = _ctx;
+    }
+
   return self;
 }
-- (id)init {
-  return [self initWithViewer:nil context:nil];
+
+- (id) init
+{
+  return [self initWithViewer: nil context: nil];
 }
 
-- (void)dealloc {
-  [self->iCalViewer    release];
-  [self->htmlViewer    release];
-  [self->textViewer    release];
-  [self->imageViewer   release];
-  [self->linkViewer    release];
-  [self->messageViewer release];
+- (void) dealloc
+{
+  [flatContents release];
+  [iCalViewer release];
+  [htmlViewer release];
+  [textViewer release];
+  [imageViewer release];
+  [linkViewer release];
+  [messageViewer release];
   [super dealloc];
 }
 
-/* resetting state */
-
-- (void)reset {
-  [self->flatContents  release]; self->flatContents  = nil;
-  [self->textViewer    release]; self->textViewer    = nil;
-  [self->htmlViewer    release]; self->htmlViewer    = nil;
-  [self->imageViewer   release]; self->imageViewer   = nil;
-  [self->linkViewer    release]; self->linkViewer    = nil;
-  [self->messageViewer release]; self->messageViewer = nil;
-  [self->iCalViewer    release]; self->iCalViewer    = nil;
+- (void) reset
+{
+  [flatContents release];
+  [iCalViewer release];
+  [htmlViewer release];
+  [textViewer release];
+  [imageViewer release];
+  [linkViewer release];
+  [messageViewer release];
+
+  flatContents = nil;
+  iCalViewer = nil;
+  textViewer = nil;
+  imageViewer = nil;
+  htmlViewer = nil;
+  linkViewer = nil;
+  messageViewer = nil;
 }
 
 /* fetching */
 
-- (NSDictionary *)flatContents {
-  if (self->flatContents != nil)
-    return [self->flatContents isNotNull] ? self->flatContents : nil;
-  
-  self->flatContents =
-    [[[self->viewer clientObject] fetchPlainTextParts] retain];
-  [self debugWithFormat:@"CON: %@", self->flatContents];
-  return self->flatContents;
+- (NSDictionary *) flatContents
+{
+  if (!flatContents)
+    {
+      flatContents = [[viewer clientObject] fetchPlainTextParts];
+      [flatContents retain];
+//       [self debugWithFormat:@"CON: %@", flatContents];
+    }
+
+  return flatContents;
 }
 
-- (NSData *)flatContentForPartPath:(NSArray *)_partPath {
+- (NSData *) flatContentForPartPath: (NSArray *) _partPath
+{
   NSString *pid;
   
   pid = _partPath ? [_partPath componentsJoinedByString:@"."] : @"";
+
   return [[self flatContents] objectForKey:pid];
 }
 
 /* viewer components */
 
-- (WOComponent *)mixedViewer {
+- (WOComponent *) mixedViewer
+{
   /* Note: we cannot cache the multipart viewers, because it can be nested */
-  return [self->viewer pageWithName:@"UIxMailPartMixedViewer"];
+  return [viewer pageWithName: @"UIxMailPartMixedViewer"];
 }
 
-- (WOComponent *)signedViewer {
+- (WOComponent *) signedViewer
+{
   /* Note: we cannot cache the multipart viewers, because it can be nested */
   // TODO: temporary workaround (treat it like a plain mixed part)
+
   return [self mixedViewer];
 }
 
-- (WOComponent *)alternativeViewer {
+- (WOComponent *) alternativeViewer
+{
   /* Note: we cannot cache the multipart viewers, because it can be nested */
-  return [self->viewer pageWithName:@"UIxMailPartAlternativeViewer"];
+  return [viewer pageWithName: @"UIxMailPartAlternativeViewer"];
 }
 
-- (WOComponent *)textViewer {
-  if (self->textViewer == nil) {
-    self->textViewer = 
-      [[self->viewer pageWithName:@"UIxMailPartTextViewer"] retain];
-  }
-  return self->textViewer;
+- (WOComponent *) textViewer
+{
+  if (!textViewer)
+    {
+      textViewer = [viewer pageWithName: @"UIxMailPartTextViewer"];
+      [textViewer retain];
+    }
+
+  return textViewer;
 }
 
-- (WOComponent *)imageViewer {
-  if (self->imageViewer == nil) {
-    self->imageViewer = 
-      [[self->viewer pageWithName:@"UIxMailPartImageViewer"] retain];
-  }
-  return self->imageViewer;
+- (WOComponent *) imageViewer
+{
+  if (!imageViewer)
+    {
+      imageViewer = [viewer pageWithName: @"UIxMailPartImageViewer"];
+      [imageViewer retain];
+    }
+
+  return imageViewer;
 }
 
-- (WOComponent *)linkViewer {
-  if (self->linkViewer == nil) {
-    self->linkViewer = 
-      [[self->viewer pageWithName:@"UIxMailPartLinkViewer"] retain];
-  }
-  return self->linkViewer;
+- (WOComponent *) linkViewer
+{
+  if (!linkViewer)
+    {
+      linkViewer = [viewer pageWithName: @"UIxMailPartLinkViewer"];
+      [linkViewer retain];
+    }
+
+  return linkViewer;
 }
 
-- (WOComponent *)htmlViewer {
-  if (self->htmlViewer == nil) {
-    self->htmlViewer = 
-      [[self->viewer pageWithName:@"UIxMailPartHTMLViewer"] retain];
-  }
-  return self->htmlViewer;
+- (WOComponent *) htmlViewer
+{
+  if (!htmlViewer)
+    {
+      htmlViewer = [viewer pageWithName: @"UIxMailPartHTMLViewer"];
+      [htmlViewer retain];
+    }
+
+  return htmlViewer;
 }
 
-- (WOComponent *)messageViewer {
-  if (self->messageViewer == nil) {
-    self->messageViewer = 
-      [[self->viewer pageWithName:@"UIxMailPartMessageViewer"] retain];
-  }
-  return self->messageViewer;
+- (WOComponent *) messageViewer
+{
+  if (!messageViewer)
+    {
+      messageViewer = [viewer pageWithName: @"UIxMailPartMessageViewer"];
+      [messageViewer retain];
+    }
+
+  return messageViewer;
 }
 
-- (WOComponent *)iCalViewer {
-  if (self->iCalViewer == nil) {
-    self->iCalViewer = 
-      [[self->viewer pageWithName:@"UIxMailPartICalViewer"] retain];
-  }
-  return self->iCalViewer;
+- (WOComponent *) iCalViewer
+{
+  if (!iCalViewer)
+    {
+      iCalViewer = [viewer pageWithName: @"UIxMailPartICalViewer"];
+      [iCalViewer retain];
+    }
+
+  return iCalViewer;
 }
 
 /* Kolab viewers */
 
-- (WOComponent *)kolabContactViewer {
-  return [self->viewer pageWithName:@"UIxKolabPartContactViewer"];
+- (WOComponent *) kolabContactViewer
+{
+  return [viewer pageWithName: @"UIxKolabPartContactViewer"];
 }
-- (WOComponent *)kolabEventViewer {
-  return [self->viewer pageWithName:@"UIxKolabPartEventViewer"];
+
+- (WOComponent *) kolabEventViewer
+{
+  return [viewer pageWithName: @"UIxKolabPartEventViewer"];
 }
-- (WOComponent *)kolabTodoViewer {
-  return [self->viewer pageWithName:@"UIxKolabPartTodoViewer"];
+
+- (WOComponent *) kolabTodoViewer
+{
+  return [viewer pageWithName: @"UIxKolabPartTodoViewer"];
 }
 
-- (WOComponent *)kolabNoteViewer {
+- (WOComponent *) kolabNoteViewer
+{
   return [self textViewer]; // TODO
 }
-- (WOComponent *)kolabJournalViewer {
+
+- (WOComponent *) kolabJournalViewer
+{
   return [self textViewer]; // TODO
 }
-- (WOComponent *)kolabDistributionListViewer {
+
+- (WOComponent *) kolabDistributionListViewer
+{
   return [self textViewer]; // TODO
 }
 
 /* main viewer selection */
 
-- (WOComponent *)viewerForBodyInfo:(id)_info {
+- (WOComponent *) viewerForBodyInfo: (id) _info
+{
   NSString *mt, *st;
 
-  mt = [[_info valueForKey:@"type"]    lowercaseString];
+  mt = [[_info valueForKey:@"type"] lowercaseString];
   st = [[_info valueForKey:@"subtype"] lowercaseString];
-  
-  if ([mt isEqualToString:@"multipart"]) {
-    if ([st isEqualToString:@"mixed"])
-      return [self mixedViewer];
-    else if ([st isEqualToString:@"signed"])
-      return [self signedViewer];
-    else if ([st isEqualToString:@"alternative"]
+
+  if ([mt isEqualToString:@"multipart"])
+    {
+      if ([st isEqualToString:@"mixed"])
+       return [self mixedViewer];
+      else if ([st isEqualToString:@"signed"])
+       return [self signedViewer];
+      else if ([st isEqualToString:@"alternative"]
              || [st isEqualToString:@"related"])
       return [self alternativeViewer];
     
     if ([st isEqualToString:@"report"])
       /* this is used by mail-delivery reports */
       return [self mixedViewer];
-  }
-  else if ([mt isEqualToString:@"text"]) {
+    }
+  else if ([mt isEqualToString:@"text"])
+    {
     /* 
        Note: in the _info dictionary we do not get the content-disposition
              information (inline vs attachment). Our hack is to check for the
@@ -236,37 +296,40 @@ static BOOL showNamedTextAttachmentsInline = NO;
     return [self linkViewer];
   }
 
-  if ([mt isEqualToString:@"application"]) {
-    // octet-stream (generate download link?, autodetect type?)
+  if ([mt isEqualToString:@"application"])
+    {
+      // octet-stream (generate download link?, autodetect type?)
     
-    if ([st hasPrefix:@"x-vnd.kolab."]) {
-      if ([st isEqualToString:@"x-vnd.kolab.contact"])
-       return [self kolabContactViewer];
-      if ([st isEqualToString:@"x-vnd.kolab.event"])
-       return [self kolabEventViewer];
-      if ([st isEqualToString:@"x-vnd.kolab.task"])
-       return [self kolabTodoViewer];
-      if ([st isEqualToString:@"x-vnd.kolab.note"])
-       return [self kolabNoteViewer];
-      if ([st isEqualToString:@"x-vnd.kolab.journal"])
-       return [self kolabJournalViewer];
-      if ([st isEqualToString:@"x-vnd.kolab.contact.distlist"])
-       return [self kolabDistributionListViewer];
+    if ([st hasPrefix:@"x-vnd.kolab."])
+      {
+       if ([st isEqualToString:@"x-vnd.kolab.contact"])
+         return [self kolabContactViewer];
+       if ([st isEqualToString:@"x-vnd.kolab.event"])
+         return [self kolabEventViewer];
+       if ([st isEqualToString:@"x-vnd.kolab.task"])
+         return [self kolabTodoViewer];
+       if ([st isEqualToString:@"x-vnd.kolab.note"])
+         return [self kolabNoteViewer];
+       if ([st isEqualToString:@"x-vnd.kolab.journal"])
+         return [self kolabJournalViewer];
+       if ([st isEqualToString:@"x-vnd.kolab.contact.distlist"])
+         return [self kolabDistributionListViewer];
       
-      [self errorWithFormat:@"found no viewer for Kolab type: %@/%@", mt, st];
-      return [self linkViewer];
-    }
+       [self errorWithFormat:@"found no viewer for Kolab type: %@/%@", mt, st];
+       return [self linkViewer];
+      }
     
 #if 0 /* the link viewer looks better than plain text ;-) */
     if ([st isEqualToString:@"pgp-signature"]) // TODO: real PGP viewer
       return [self textViewer];
 #endif
-  }
+    }
 
   // TODO: always fallback to octet viewer?!
 #if 1
   [self errorWithFormat:@"found no viewer for MIME type: %@/%@", mt, st];
 #endif
+
   return [self linkViewer];
 }
 
index 7bebf273b02e467cc669bc6515650a42f2eaba27..a042a538bf66804f2ba22949237543eca1438482 100644 (file)
@@ -1,5 +1,5 @@
 {
-  requires = ( MAIN, MailerUI );
+  requires = ( MAIN );
 
   publicResources = (
   );
index ffae1214b123186d74c5f5f0203dd38563514d48..89d8cd2ab841cf9f09b07c79464fbecaa45d1944 100644 (file)
@@ -269,13 +269,16 @@ static NSArray      *infoKeys            = nil;
 
 /* requests */
 
-- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{
+- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq
+                          inContext: (WOContext*) _c
+{
   return YES;
 }
 
 /* IMAP4 store */
 
-- (NSException *)patchFlagsInStore {
+- (NSException *) patchFlagsInStore
+{
   /*
     Flags we should set:
       if the draft is a reply   => [message markAnswered]
@@ -286,7 +289,8 @@ static NSArray      *infoKeys            = nil;
   return nil;
 }
 
-- (id)lookupSentFolderUsingAccount {
+- (id) lookupSentFolderUsingAccount
+{
   SOGoMailAccount *account;
   SOGoMailFolder  *folder;
   
@@ -301,7 +305,8 @@ static NSArray      *infoKeys            = nil;
   return ((sentFolder = [folder retain]));
 }
 
-- (void)_presetFromBasedOnAccountsQueryParameter {
+- (void) _presetFromBasedOnAccountsQueryParameter
+{
   /* preset the from field to the primary identity of the given account */
   /* Note: The compose action sets the 'accounts' query parameter */
   NSString         *accountID;
@@ -337,7 +342,8 @@ static NSArray      *infoKeys            = nil;
   [self setFrom: [identity email]];
 }
 
-- (SOGoMailIdentity *)selectedMailIdentity {
+- (SOGoMailIdentity *) selectedMailIdentity
+{
   SOGoMailAccounts *accounts;
   NSEnumerator     *e;
   SOGoMailIdentity *identity;
@@ -360,7 +366,8 @@ static NSArray      *infoKeys            = nil;
   return nil;
 }
 
-- (id)lookupSentFolderUsingFrom {
+- (id) lookupSentFolderUsingFrom
+{
   // TODO: if we have the identity we could also support BCC
   SOGoMailAccounts *accounts;
   SOGoMailIdentity *identity;
@@ -410,7 +417,8 @@ static NSArray      *infoKeys            = nil;
   return sentFolder;
 }
 
-- (NSException *)storeMailInSentFolder:(NSString *)_path {
+- (NSException *) storeMailInSentFolder: (NSString *) _path
+{
   SOGoMailFolder *folder;
   NSData *data;
   id result;
@@ -523,7 +531,8 @@ static NSArray      *infoKeys            = nil;
   return success;
 }
 
-- (id)failedToSaveFormResponse {
+- (id) failedToSaveFormResponse
+{
   // TODO: improve error handling
   return [NSException exceptionWithHTTPStatus:500 /* server error */
                      reason:@"failed to store draft object on server!"];
@@ -531,7 +540,8 @@ static NSArray      *infoKeys            = nil;
 
 /* attachment helper */
 
-- (NSArray *)attachmentNames {
+- (NSArray *) attachmentNames
+{
   NSArray *a;
   
   if (attachmentNames != nil)
@@ -542,7 +552,9 @@ static NSArray      *infoKeys            = nil;
   attachmentNames = [a copy];
   return attachmentNames;
 }
-- (BOOL)hasAttachments {
+
+- (BOOL) hasAttachments
+{
   return [[self attachmentNames] count] > 0 ? YES : NO;
 }
 
@@ -558,11 +570,13 @@ static NSArray      *infoKeys            = nil;
   return self;
 }
 
-- (id)saveAction {
+- (id) saveAction
+{
   return [self _saveFormInfo] ? self : [self failedToSaveFormResponse];
 }
 
-- (NSException *)validateForSend {
+- (NSException *) validateForSend
+{
   // TODO: localize errors
   
   if (![self hasOneOrMoreRecipients]) {
@@ -646,7 +660,8 @@ static NSArray      *infoKeys            = nil;
   return result;
 }
 
-- (id)deleteAction {
+- (id) deleteAction
+{
   NSException *error;
   id page;
   
index e61b788ecd2174dfbce74dfbcf0dac0a4b32f5af..8fd8ed27cea7698006ff9776526f6571fd96d740 100644 (file)
@@ -63,8 +63,8 @@
   accountFolder = [[self clientObject] mailAccountFolder];
 
   return [accountFolder
-           lookupName: [accountFolder draftsFolderNameInContext: context]
-           inContext: context acquire: NO];
+          lookupName: [accountFolder draftsFolderNameInContext: context]
+          inContext: context acquire: NO];
 }
 
 /* errors */
index 4c3e3bf23b0eeb2487defa74d24267c5ff3d301e..95c64ca83b7378b6f1cee5a57fcea81c7e1c8549 100644 (file)
@@ -236,7 +236,7 @@ static NSString *treeRootClassName = nil;
       if (parameter)
         [urlParams setObject: parameter
                    forKey: @"mailto"];
-      inbox = [NSString stringWithFormat: @"%@/INBOX",
+      inbox = [NSString stringWithFormat: @"%@/folderINBOX",
                         [c objectAtIndex: 0]];
       url = [inbox composeURLWithAction: @"compose"
                    parameters: urlParams
index ecd299dbeab5daa2397d7cd5de9e4b87fa4d8a9b..a8c01a0bc34fd63228a8f10dfdba693b7ff7fbfc 100644 (file)
@@ -102,33 +102,39 @@ static NSString *mailETag = nil;
 
 /* links (DUP to UIxMailPartViewer!) */
 
-- (NSString *)linkToEnvelopeAddress:(NGImap4EnvelopeAddress *)_address {
+- (NSString *) linkToEnvelopeAddress: (NGImap4EnvelopeAddress *) _address
+{
   // TODO: make some web-link, eg open a new compose panel?
-  return [@"mailto:" stringByAppendingString:[_address baseEMail]];
+  return [NSString stringWithFormat: @"mailto: %@", [_address baseEMail]];
 }
 
-- (NSString *)currentAddressLink {
+- (NSString *) currentAddressLink
+{
   return [self linkToEnvelopeAddress:[self currentAddress]];
 }
 
 /* fetching */
 
-- (id)message {
+- (id) message
+{
   return [[self clientObject] fetchCoreInfos];
 }
 
-- (BOOL)hasCC {
+- (BOOL) hasCC
+{
   return [[[self clientObject] ccEnvelopeAddresses] count] > 0 ? YES : NO;
 }
 
 /* viewers */
 
-- (id)contentViewerComponent {
+- (id) contentViewerComponent
+{
   // TODO: I would prefer to flatten the body structure prior rendering,
   //       using some delegate to decide which parts to select for alternative.
   id info;
   
   info = [[self clientObject] bodyStructure];
+
   return [[context mailRenderingContext] viewerForBodyInfo:info];
 }
 
@@ -171,21 +177,27 @@ static NSString *mailETag = nil;
   return self;
 }
 
-- (BOOL)isDeletableClientObject {
-  return [[self clientObject] respondsToSelector:@selector(delete)];
+- (BOOL) isDeletableClientObject
+{
+  return [[self clientObject] respondsToSelector: @selector (delete)];
 }
-- (BOOL)isInlineViewer {
+
+- (BOOL) isInlineViewer
+{
   return NO;
 }
 
-- (id)redirectToParentFolder {
+- (id) redirectToParentFolder
+{
   id url;
   
-  url = [[[self clientObject] container] baseURLInContext:context];
-  return [self redirectToLocation:url];
+  url = [[[self clientObject] container] baseURLInContext: context];
+
+  return [self redirectToLocation: url];
 }
 
-- (id)deleteAction {
+- (id) deleteAction
+{
   NSException *ex;
   
   if (![self isDeletableClientObject]) {
@@ -220,7 +232,8 @@ static NSString *mailETag = nil;
   return [self redirectToParentFolder];
 }
 
-- (id)trashAction {
+- (id) trashAction
+{
   NSException *ex;
   
   if ([self isInvokedBySafeMethod]) {
@@ -298,18 +311,21 @@ static NSString *mailETag = nil;
 
 /* generating response */
 
-- (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
+- (void) appendToResponse: (WOResponse *) _response
+               inContext: (WOContext *) _ctx
+{
   UIxMailRenderingContext *mctx;
 
   if (mailETag != nil)
     [[_ctx response] setHeader:mailETag forKey:@"etag"];
 
-  mctx = [[NSClassFromString(@"UIxMailRenderingContext")
-                           alloc] initWithViewer:self context:_ctx];
-  [_ctx pushMailRenderingContext:mctx];
+  mctx = [[UIxMailRenderingContext alloc] initWithViewer: self
+                                         context: _ctx];
+
+  [_ctx pushMailRenderingContext: mctx];
   [mctx release];
-  
-  [super appendToResponse:_response inContext:_ctx];
+
+  [super appendToResponse: _response inContext: _ctx];
   
   [[_ctx popMailRenderingContext] reset];
 }
index d8418c3a938f59021fd59e4058bbaf5267dace79..8a3b1331aef95b415f035f8deff45dfdaadea5a1 100644 (file)
@@ -1,5 +1,5 @@
 { /* -*-javascript-*- */
-requires = ( MAIN, MainUI, CommonUI, Mailer ); /* , Sieve */
+requires = ( MAIN, MainUI, CommonUI, Mailer, MailPartViewers ); /* , Sieve */
 
    publicResources = (
       "uix.css",
index f1bd213e415abcbd73e2636f9d469426d5b6d957..b2b87f6ade148ce67cb892586246d2f0636c0072 100644 (file)
@@ -57,6 +57,8 @@
        <var:js-stringtable
          var:framework="productFrameworkName"
          const:identifier="labels" />
+       <var:js-stringtable
+         const:identifier="clabels" />
 
        <var:if condition="isPopup" const:negate="YES"
          ><var:if condition="context.isUIxDebugEnabled"
index 90dce72298ec830081b19928b159c757d6037547..7ed9b7b2d804e330e1569d72ada4adbf08324f20 100644 (file)
@@ -31,8 +31,9 @@ function validateEditorInput(sender) {
 }
 
 function openContactsFolder(contactsFolder, reload, idx) {
-  if (contactsFolder != currentContactFolder || reload) {
-     currentContactFolder = contactsFolder;
+  if ((currentContactFolder && contactsFolder != currentContactFolder)
+      || reload) {
+     currentContactFolder = contactsFolder; log("openContactsFolder " + contactsFolder);
      var url = URLForFolderID(currentContactFolder) +
        "/view?noframe=1";
 
@@ -436,7 +437,7 @@ function onFolderSelectionChange() {
    }
 }
 
-function refreshCurrentFolder() {
+function refreshCurrentFolder() { log("refreshCurrentFolder");
    openContactsFolder(currentContactFolder, true);
 }
 
index 187c70df5d46ba19082f5c9394d1d6385f932ab0..c78cc95432fa6f66d9fc861a69c2fc1ebac4c6b8 100644 (file)
@@ -40,13 +40,13 @@ Element.addMethods({
   cascadeLeftOffset: function(element) {
     element = $(element);
     var currentElement = element;
-    
+
     var offset = 0;
     while (currentElement) {
       offset += currentElement.offsetLeft;
-      currentElement = currentElement.getParentWithTagName("div");
+      currentElement = $(currentElement).getParentWithTagName("div");
     }
-    
+
     return offset;
   },
 
index 085b253cba160aa3d9886b5edd55c5a66694f36c..c5bed5158c9545b588553f2404061ef5776913f9 100644 (file)
@@ -26,10 +26,11 @@ var MailerUIdTreeExtension = {
       var thisCounter = this.elementCounter;
       var fullName = "";
       var currentFolder = folder;
-      while (currentFolder) {
-        fullName = "/" + currentFolder.name + fullName;
+      while (currentFolder.parentFolder) {
+        fullName = "/folder" + currentFolder.name + fullName;
         currentFolder = currentFolder.parentFolder;
       }
+      fullName = "/" + currentFolder.name + fullName;
       this._addFolderNode(parent, folder.name, fullName, folder.type);
       for (var i = 0; i < folder.children.length; i++)
       this._addFolder(thisCounter, folder.children[i]);
index 1793aa300ffcb6714a6a9c55f209e80b197e7a59..dba1bfe48a6c0544f1757a0f9582bcb1c9c856e8 100644 (file)
@@ -13,177 +13,177 @@ var usersRightsWindowWidth = 400;
 /* mail list */
 
 function openMessageWindow(msguid, url) {
-   var wId = '';
-   if (msguid) {
-      wId += "SOGo_msg_" + msguid;
-      markMailReadInWindow(window, msguid);
-   }
-   var msgWin = window.open(url, wId,
-                           "width=680,height=520,resizable=1,scrollbars=1,toolbar=0,"
-                           + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
-   if (msguid) {
-      msgWin.messageId = msguid;
-      msgWin.messageURL = ApplicationBaseURL + currentMailbox + "/" + msguid;
-   }
-   msgWin.focus();
-
-   return false;
+  var wId = '';
+  if (msguid) {
+    wId += "SOGo_msg_" + msguid;
+    markMailReadInWindow(window, msguid);
+  }
+  var msgWin = window.open(url, wId,
+                          "width=680,height=520,resizable=1,scrollbars=1,toolbar=0,"
+                          + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
+  if (msguid) {
+    msgWin.messageId = msguid;
+    msgWin.messageURL = ApplicationBaseURL + currentMailbox + "/" + msguid;
+  }
+  msgWin.focus();
+
+  return false;
 }
 
 function onMessageDoubleClick(event) {
-   resetSelection(window);
-   var msguid = this.parentNode.id.substr(4);
+  resetSelection(window);
+  var msguid = this.parentNode.id.substr(4);
    
-   return openMessageWindow(msguid,
-                           ApplicationBaseURL + currentMailbox + "/"
-                           + msguid + "/popupview");
+  return openMessageWindow(msguid,
+                          ApplicationBaseURL + currentMailbox + "/"
+                          + msguid + "/popupview");
 }
 
 function toggleMailSelect(sender) {
-   var row;
-   row = $(sender.name);
-   row.className = sender.checked ? "tableview_selected" : "tableview";
+  var row;
+  row = $(sender.name);
+  row.className = sender.checked ? "tableview_selected" : "tableview";
 }
 
 function clearSearch(sender) {
-   var searchField = window.$("search");
-   if (searchField) searchField.value="";
-   return true;
+  var searchField = window.$("search");
+  if (searchField) searchField.value="";
+  return true;
 }
 
 function openAddressbook(sender) {
-   var urlstr;
+  var urlstr;
    
-   urlstr = ApplicationBaseURL + "/../Contacts/?popup=YES";
-   var w = window.open(urlstr, "Addressbook",
-                      "width=640,height=400,resizable=1,scrollbars=1,toolbar=0,"
-                      + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
-   w.focus();
+  urlstr = ApplicationBaseURL + "/../Contacts/?popup=YES";
+  var w = window.open(urlstr, "Addressbook",
+                     "width=640,height=400,resizable=1,scrollbars=1,toolbar=0,"
+                     + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
+  w.focus();
 
-   return false;
+  return false;
 }
 
 function onMenuSharing(event) {
-   var folderID = document.menuTarget.getAttribute("dataname");
-   var urlstr = URLForFolderID(folderID) + "/acls";
-   preventDefault(event);
+  var folderID = document.menuTarget.getAttribute("dataname");
+  var urlstr = URLForFolderID(folderID) + "/acls";
+  preventDefault(event);
 
-   openAclWindow(urlstr);
+  openAclWindow(urlstr);
 }
 
 /* mail list DOM changes */
 
 function markMailInWindow(win, msguid, markread) {
-   var msgDiv;
-
-   msgDiv = win.$("div_" + msguid);
-   if (msgDiv) {
-      if (markread) {
-        msgDiv.removeClassName("mailer_unreadmailsubject");
-        msgDiv.addClassName("mailer_readmailsubject");
-        msgDiv = win.$("unreaddiv_" + msguid);
-        if (msgDiv)
-        {
-           msgDiv.setAttribute("class", "mailerUnreadIcon");
-           msgDiv.setAttribute("id", "readdiv_" + msguid);
-           msgDiv.setAttribute("src", ResourcesURL + "/icon_read.gif");
-           msgDiv.setAttribute("onclick", "mailListMarkMessage(this,"
-                               + " 'markMessageUnread', " + msguid
-                               + ", false);"
-                               +" return false;");
-           var title = msgDiv.getAttribute("title-markunread");
-           if (title)
-              msgDiv.setAttribute("title", title);
-        }
-      }
-      else {
-        msgDiv.removeClassName('mailer_readmailsubject');
-        msgDiv.addClassName('mailer_unreadmailsubject');
-        msgDiv = win.$("readdiv_" + msguid);
-        if (msgDiv)
-        {
-           msgDiv.setAttribute("class", "mailerReadIcon");
-           msgDiv.setAttribute("id", "unreaddiv_" + msguid);
-           msgDiv.setAttribute("src", ResourcesURL + "/icon_unread.gif");
-           msgDiv.setAttribute("onclick", "mailListMarkMessage(this,"
-                               + " 'markMessageRead', " + msguid
-                               + ", true);"
-                               +" return false;");
-           var title = msgDiv.getAttribute("title-markread");
-           if (title)
-              msgDiv.setAttribute("title", title);
-        }
-      }
-      return true;
-   }
-   else
-      return false;
+  var msgDiv;
+
+  msgDiv = win.$("div_" + msguid);
+  if (msgDiv) {
+    if (markread) {
+      msgDiv.removeClassName("mailer_unreadmailsubject");
+      msgDiv.addClassName("mailer_readmailsubject");
+      msgDiv = win.$("unreaddiv_" + msguid);
+      if (msgDiv)
+       {
+         msgDiv.setAttribute("class", "mailerUnreadIcon");
+         msgDiv.setAttribute("id", "readdiv_" + msguid);
+         msgDiv.setAttribute("src", ResourcesURL + "/icon_read.gif");
+         msgDiv.setAttribute("onclick", "mailListMarkMessage(this,"
+                             + " 'markMessageUnread', " + msguid
+                             + ", false);"
+                             +" return false;");
+         var title = msgDiv.getAttribute("title-markunread");
+         if (title)
+           msgDiv.setAttribute("title", title);
+       }
+    }
+    else {
+      msgDiv.removeClassName('mailer_readmailsubject');
+      msgDiv.addClassName('mailer_unreadmailsubject');
+      msgDiv = win.$("readdiv_" + msguid);
+      if (msgDiv)
+       {
+         msgDiv.setAttribute("class", "mailerReadIcon");
+         msgDiv.setAttribute("id", "unreaddiv_" + msguid);
+         msgDiv.setAttribute("src", ResourcesURL + "/icon_unread.gif");
+         msgDiv.setAttribute("onclick", "mailListMarkMessage(this,"
+                             + " 'markMessageRead', " + msguid
+                             + ", true);"
+                             +" return false;");
+         var title = msgDiv.getAttribute("title-markread");
+         if (title)
+           msgDiv.setAttribute("title", title);
+       }
+    }
+    return true;
+  }
+  else
+    return false;
 }
 
 function markMailReadInWindow(win, msguid) {
-   /* this is called by UIxMailView with window.opener */
-       return markMailInWindow(win, msguid, true);
+  /* this is called by UIxMailView with window.opener */
+  return markMailInWindow(win, msguid, true);
 }
 
 /* main window */
 
 function reopenToRemoveLocationBar() {
-   // we cannot really use this, see below at the close comment
-        if (window.locationbar && window.locationbar.visible) {
-           newwin = window.open(window.location.href, "SOGo",
-                                "width=800,height=600,resizable=1,scrollbars=1," +
-                                "toolbar=0,location=0,directories=0,status=0," + 
-                                "menubar=0,copyhistory=0");
-           if (newwin) {
-              window.close(); // this does only work for windows opened by scripts!
-                                                                    newwin.focus();
-              return true;
-           }
-           return false;
-        }
-   return true;
+  // we cannot really use this, see below at the close comment
+  if (window.locationbar && window.locationbar.visible) {
+    newwin = window.open(window.location.href, "SOGo",
+                        "width=800,height=600,resizable=1,scrollbars=1," +
+                        "toolbar=0,location=0,directories=0,status=0," + 
+                        "menubar=0,copyhistory=0");
+    if (newwin) {
+      window.close(); // this does only work for windows opened by scripts!
+      newwin.focus();
+      return true;
+    }
+    return false;
+  }
+  return true;
 }
 
 /* mail list reply */
 
 function openMessageWindowsForSelection(action) {
-   if (document.body.hasClassName("popup"))
-      win = openMessageWindow(window.messageId,
-                             window.messageURL + "/" + action /* url */);
-   else {
-      var messageList = $("messageList");
-      var rows = messageList.getSelectedRowsId();
-      var idset = "";
-      for (var i = 0; i < rows.length; i++)
-        win = openMessageWindow(rows[i].substr(4)        /* msguid */,
-                                ApplicationBaseURL + currentMailbox
-                                + "/" + rows[i].substr(4)
-                                + "/" + action /* url */);
-   }
-
-   return false;
+  if (document.body.hasClassName("popup"))
+    win = openMessageWindow(window.messageId,
+                           window.messageURL + "/" + action /* url */);
+  else {
+    var messageList = $("messageList");
+    var rows = messageList.getSelectedRowsId();
+    var idset = "";
+    for (var i = 0; i < rows.length; i++)
+      win = openMessageWindow(rows[i].substr(4)        /* msguid */,
+                             ApplicationBaseURL + currentMailbox
+                             + "/" + rows[i].substr(4)
+                             + "/" + action /* url */);
+  }
+
+  return false;
 }
 
 function mailListMarkMessage(event) {
-   var http = createHTTPClient();
-   var url = ApplicationBaseURL + currentMailbox + "/" + action + "?uid=" + msguid;
-
-   if (http) {
-      // TODO: add parameter to signal that we are only interested in OK
-                 http.open("POST", url + "&jsonly=1", false /* not async */);
-      http.send("");
-      if (http.status != 200) {
-        // TODO: refresh page?
-                    alert("Message Mark Failed: " + http.statusText);
-        window.location.reload();
-      }
-      else {
-        markMailInWindow(window, msguid, markread);
-      }
-   }
-   else {
-      window.location.href = url;
-   }
+  var http = createHTTPClient();
+  var url = ApplicationBaseURL + currentMailbox + "/" + action + "?uid=" + msguid;
+
+  if (http) {
+    // TODO: add parameter to signal that we are only interested in OK
+    http.open("POST", url + "&jsonly=1", false /* not async */);
+    http.send("");
+    if (http.status != 200) {
+      // TODO: refresh page?
+      alert("Message Mark Failed: " + http.statusText);
+      window.location.reload();
+    }
+    else {
+      markMailInWindow(window, msguid, markread);
+    }
+  }
+  else {
+    window.location.href = url;
+  }
 }
 
 /* maillist row highlight */
@@ -191,270 +191,270 @@ function mailListMarkMessage(event) {
 var oldMaillistHighlight = null; // to remember deleted/selected style
 
 function ml_highlight(sender) {
-   oldMaillistHighlight = sender.className;
-   if (oldMaillistHighlight == "tableview_highlight")
-      oldMaillistHighlight = null;
-   sender.className = "tableview_highlight";
+  oldMaillistHighlight = sender.className;
+  if (oldMaillistHighlight == "tableview_highlight")
+    oldMaillistHighlight = null;
+  sender.className = "tableview_highlight";
 }
 
 function ml_lowlight(sender) {
-   if (oldMaillistHighlight) {
-      sender.className = oldMaillistHighlight;
-      oldMaillistHighlight = null;
-   }
-   else
-      sender.className = "tableview";
+  if (oldMaillistHighlight) {
+    sender.className = oldMaillistHighlight;
+    oldMaillistHighlight = null;
+  }
+  else
+    sender.className = "tableview";
 }
 
 
 /* folder operations */
 
 function ctxFolderAdd(sender) {
-   var folderName;
+  var folderName;
    
-   folderName = prompt("Foldername: ");
-   if (folderName == undefined)
-      return false;
-   if (folderName == "")
-      return false;
+  folderName = prompt("Foldername: ");
+  if (folderName == undefined)
+    return false;
+  if (folderName == "")
+    return false;
    
-   // TODO: should use a form-POST or AJAX
-              window.location.href = "createFolder?name=" + escape(folderName);
-   return false;
+  // TODO: should use a form-POST or AJAX
+  window.location.href = "createFolder?name=" + escape(folderName);
+  return false;
 }
 
 function ctxFolderDelete(sender) {
-   if (!confirm("Delete current folder?").decodeEntities())
-      return false;
+  if (!confirm("Delete current folder?").decodeEntities())
+    return false;
    
-   // TODO: should use a form-POST or AJAX
-              window.location.href = "deleteFolder";
-   return false;
+  // TODO: should use a form-POST or AJAX
+  window.location.href = "deleteFolder";
+  return false;
 }
 
 /* bulk delete of messages */
 
 function uixDeleteSelectedMessages(sender) {
-   var failCount = 0;
+  var failCount = 0;
    
-   var messageList = $("messageList");
-   var rowIds = messageList.getSelectedRowsId();
-
-   for (var i = 0; i < rowIds.length; i++) {
-      var url, http;
-      var rowId = rowIds[i].substr(4);
-      /* send AJAX request (synchronously) */
-
-      var messageId = currentMailbox + "/" + rowId;
-      url = ApplicationBaseURL + messageId + "/trash?jsonly=1";
-      http = createHTTPClient();
-      http.open("GET", url, false /* not async */);
-      http.send("");
-      if (http.status != 200) { /* request failed */
-                                   failCount++;
+  var messageList = $("messageList");
+  var rowIds = messageList.getSelectedRowsId();
+
+  for (var i = 0; i < rowIds.length; i++) {
+    var url, http;
+    var rowId = rowIds[i].substr(4);
+    /* send AJAX request (synchronously) */
+
+    var messageId = currentMailbox + "/" + rowId;
+    url = ApplicationBaseURL + messageId + "/trash?jsonly=1";
+    http = createHTTPClient();
+    http.open("GET", url, false /* not async */);
+    http.send("");
+    if (http.status != 200) { /* request failed */
+      failCount++;
       http = null;
       continue;
-      } else {
-        deleteCachedMessage(messageId);
-        if (currentMessages[currentMailbox] == rowId) {
-           var div = $('messageContent');
-           div.innerHTML = "";
-           currentMessages[currentMailbox] = null;
-        }
+    } else {
+      deleteCachedMessage(messageId);
+      if (currentMessages[currentMailbox] == rowId) {
+       var div = $('messageContent');
+       div.innerHTML = "";
+       currentMessages[currentMailbox] = null;
       }
-      http = null;
+    }
+    http = null;
 
-      /* remove from page */
+    /* remove from page */
 
-         /* line-through would be nicer, but hiding is OK too */
-         var row = $(rowIds[i]);
-      row.parentNode.removeChild(row);
-   }
+    /* line-through would be nicer, but hiding is OK too */
+    var row = $(rowIds[i]);
+    row.parentNode.removeChild(row);
+  }
 
-   if (failCount > 0)
-      alert("Could not delete " + failCount + " messages!");
+  if (failCount > 0)
+    alert("Could not delete " + failCount + " messages!");
    
-   return false;
+  return false;
 }
 
 function moveMessages(rowIds, folder) {
-   var failCount = 0;
+  var failCount = 0;
 
-   for (var i = 0; i < rowIds.length; i++) {
-      var url, http;
+  for (var i = 0; i < rowIds.length; i++) {
+    var url, http;
 
-      /* send AJAX request (synchronously) */
+    /* send AJAX request (synchronously) */
          
-      var messageId = currentMailbox + "/" + rowIds[i];
-      url = (ApplicationBaseURL + messageId
-            + "/move?jsonly=1&tofolder=" + folder);
-      http = createHTTPClient();
-      http.open("GET", url, false /* not async */);
-      http.send("");
-      if (http.status == 200) {
-        var row = $("row_" + rowIds[i]);
-        row.parentNode.removeChild(row);
-        deleteCachedMessage(messageId);
-        if (currentMessages[currentMailbox] == rowIds[i]) {
-           var div = $('messageContent');
-           div.innerHTML = "";
-           currentMessages[currentMailbox] = null;
-        }
+    var messageId = currentMailbox + "/" + rowIds[i];
+    url = (ApplicationBaseURL + messageId
+          + "/move?jsonly=1&tofolder=" + folder);
+    http = createHTTPClient();
+    http.open("GET", url, false /* not async */);
+    http.send("");
+    if (http.status == 200) {
+      var row = $("row_" + rowIds[i]);
+      row.parentNode.removeChild(row);
+      deleteCachedMessage(messageId);
+      if (currentMessages[currentMailbox] == rowIds[i]) {
+       var div = $('messageContent');
+       div.innerHTML = "";
+       currentMessages[currentMailbox] = null;
       }
-      else /* request failed */
-             failCount++;
+    }
+    else /* request failed */
+      failCount++;
 
-      /* remove from page */
+    /* remove from page */
 
-         /* line-through would be nicer, but hiding is OK too */
-         }
+    /* line-through would be nicer, but hiding is OK too */
+  }
 
-   if (failCount > 0)
-      alert("Could not move " + failCount + " messages!");
+  if (failCount > 0)
+    alert("Could not move " + failCount + " messages!");
    
-   return failCount;
+  return failCount;
 }
 
 function onMenuDeleteMessage(event) {
-   uixDeleteSelectedMessages();
-   preventDefault(event);
+  uixDeleteSelectedMessages();
+  preventDefault(event);
 }
 
 function onMailboxTreeItemClick(event) {
-   var topNode = $("mailboxTree");
-   var mailbox = this.parentNode.getAttribute("dataname");
-
-   if (topNode.selectedEntry)
-      topNode.selectedEntry.deselect();
-   this.select();
-   topNode.selectedEntry = this;
-
-   search = {};
-   sorting = {};
-   $("searchValue").value = "";
-   initCriteria();
-
-   var datatype = this.parentNode.getAttribute("datatype");
-   if (datatype == "account" || datatype == "additional") {
-      currentMailbox = mailbox;
-      $("messageContent").innerHTML = "";
-      var body = $("messageList").tBodies[0];
-      for (var i = body.rows.length - 1; i > 0; i--)
-        body.deleteRow(i);
-   }
-   else
-      openMailbox(mailbox);
+  var topNode = $("mailboxTree");
+  var mailbox = this.parentNode.getAttribute("dataname");
+
+  if (topNode.selectedEntry)
+    topNode.selectedEntry.deselect();
+  this.select();
+  topNode.selectedEntry = this;
+
+  search = {};
+  sorting = {};
+  $("searchValue").value = "";
+  initCriteria();
+
+  var datatype = this.parentNode.getAttribute("datatype");
+  if (datatype == "account" || datatype == "additional") {
+    currentMailbox = mailbox;
+    $("messageContent").innerHTML = "";
+    var body = $("messageList").tBodies[0];
+    for (var i = body.rows.length - 1; i > 0; i--)
+      body.deleteRow(i);
+  }
+  else
+    openMailbox(mailbox);
    
-   preventDefault(event);
+  preventDefault(event);
 }
 
 function onMailboxMenuMove() {
-   window.alert("unimplemented");
+  window.alert("unimplemented");
 }
 
 function onMailboxMenuCopy() {
-   window.alert("unimplemented");
+  window.alert("unimplemented");
 }
 
 function refreshMailbox() {
-   var topWindow = getTopWindow();
-   if (topWindow)
-      topWindow.refreshCurrentFolder();
+  var topWindow = getTopWindow();
+  if (topWindow)
+    topWindow.refreshCurrentFolder();
 
-   return false;
+  return false;
 }
 
 function openMailbox(mailbox, reload, idx) {
-   if (mailbox != currentMailbox || reload) {
-      currentMailbox = mailbox;
-      var url = ApplicationBaseURL + mailbox + "/view?noframe=1";
-      var messageContent = $("messageContent");
-      messageContent.innerHTML = '';
-
-      if (currentMessages[mailbox]) {
-        loadMessage(currentMessages[mailbox]);
-        url += '&pageforuid=' + currentMessages[mailbox];
-      }
+  if (mailbox != currentMailbox || reload) {
+    currentMailbox = mailbox;
+    var url = ApplicationBaseURL + mailbox + "/view?noframe=1";
+    var messageContent = $("messageContent");
+    messageContent.innerHTML = '';
+      
+    if (currentMessages[mailbox]) {
+      loadMessage(currentMessages[mailbox]);
+      url += '&pageforuid=' + currentMessages[mailbox];
+    }
 
-      var searchValue = search["value"];
-      if (searchValue && searchValue.length > 0)
-        url += ("&search=" + search["criteria"]
-                + "&value=" + searchValue);
-      var sortAttribute = sorting["attribute"];
-      if (sortAttribute && sortAttribute.length > 0)
-        url += ("&sort=" + sorting["attribute"]
-                + "&asc=" + sorting["ascending"]);
-      if (idx)
-        url += "&idx=" + idx;
-
-      if (document.messageListAjaxRequest) {
-        document.messageListAjaxRequest.aborted = true;
-        document.messageListAjaxRequest.abort();
-      }
+    var searchValue = search["value"];
+    if (searchValue && searchValue.length > 0)
+      url += ("&search=" + search["criteria"]
+             + "&value=" + searchValue);
+    var sortAttribute = sorting["attribute"];
+    if (sortAttribute && sortAttribute.length > 0)
+      url += ("&sort=" + sorting["attribute"]
+             + "&asc=" + sorting["ascending"]);
+    if (idx)
+      url += "&idx=" + idx;
+
+    if (document.messageListAjaxRequest) {
+      document.messageListAjaxRequest.aborted = true;
+      document.messageListAjaxRequest.abort();
+    }
 
-      var mailboxContent = $("mailboxContent");
-      if (mailboxContent.getStyle('visibility') == "hidden") {
-        mailboxContent.setStyle({ visibility: "visible" });
-        var rightDragHandle = $("rightDragHandle");
-        rightDragHandle.setStyle({ visibility: "visible" });
-        messageContent.setStyle({ top: (rightDragHandle.offsetTop
-                                        + rightDragHandle.offsetHeight
-                                        + 'px') });
-      }
+    var mailboxContent = $("mailboxContent");
+    if (mailboxContent.getStyle('visibility') == "hidden") {
+      mailboxContent.setStyle({ visibility: "visible" });
+      var rightDragHandle = $("rightDragHandle");
+      rightDragHandle.setStyle({ visibility: "visible" });
+      messageContent.setStyle({ top: (rightDragHandle.offsetTop
+                                     + rightDragHandle.offsetHeight
+                                     + 'px') });
+    }
 
-      document.messageListAjaxRequest
-        = triggerAjaxRequest(url, messageListCallback,
-                             currentMessages[mailbox]);
+    document.messageListAjaxRequest
+      = triggerAjaxRequest(url, messageListCallback,
+                          currentMessages[mailbox]);
 
-      var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
-      document.quotasAjaxRequest
-        = triggerAjaxRequest(quotasUrl, quotasCallback);
-   }
+    var quotasUrl = ApplicationBaseURL + mailbox + "/quotas";
+    document.quotasAjaxRequest
+      = triggerAjaxRequest(quotasUrl, quotasCallback);
+  }
 }
 
 function openMailboxAtIndex(event) {
-   openMailbox(currentMailbox, true, this.getAttribute("idx"));
+  openMailbox(currentMailbox, true, this.getAttribute("idx"));
 
-   preventDefault(event);
+  preventDefault(event);
 }
 
 function messageListCallback(http) {
-   var div = $('mailboxContent');
+  var div = $('mailboxContent');
    
-   if (http.readyState == 4
-       && http.status == 200) {
-      document.messageListAjaxRequest = null;
-      div.innerHTML = http.responseText;
-      var selected = http.callbackData;
-      if (selected) {
-        var row = $("row_" + selected);
-        if (row)
-           row.select();
-      }
-      configureMessageListEvents();
-      if (sorting["attribute"] && sorting["attribute"].length > 0) {
-        var sortHeader;
-        if (sorting["attribute"] == "subject")
-           sortHeader = $("subjectHeader");
-        else if (sorting["attribute"] == "from")
-           sortHeader = $("fromHeader");
-        else if (sorting["attribute"] == "date")
-           sortHeader = $("dateHeader");
-        else
-           sortHeader = null;
-
-        if (sortHeader) {
-           var sortImage = createElement("img", "messageSortImage", "sortImage");
-           sortHeader.insertBefore(sortImage, sortHeader.firstChild);
-           if (sorting["ascending"])
-              sortImage.src = ResourcesURL + "/title_sortdown_12x12.png";
-           else
-              sortImage.src = ResourcesURL + "/title_sortup_12x12.png";
-        }
+  if (http.readyState == 4
+      && http.status == 200) {
+    document.messageListAjaxRequest = null;
+    div.innerHTML = http.responseText;
+    var selected = http.callbackData;
+    if (selected) {
+      var row = $("row_" + selected);
+      if (row)
+       row.select();
+    }
+    configureMessageListEvents();
+    if (sorting["attribute"] && sorting["attribute"].length > 0) {
+      var sortHeader;
+      if (sorting["attribute"] == "subject")
+       sortHeader = $("subjectHeader");
+      else if (sorting["attribute"] == "from")
+       sortHeader = $("fromHeader");
+      else if (sorting["attribute"] == "date")
+       sortHeader = $("dateHeader");
+      else
+       sortHeader = null;
+
+      if (sortHeader) {
+       var sortImage = createElement("img", "messageSortImage", "sortImage");
+       sortHeader.insertBefore(sortImage, sortHeader.firstChild);
+       if (sorting["ascending"])
+         sortImage.src = ResourcesURL + "/title_sortdown_12x12.png";
+       else
+         sortImage.src = ResourcesURL + "/title_sortup_12x12.png";
       }
-   }
-   else
-      log("messageListCallback: problem during ajax request (readyState = " + http.readyState + ", status = " + http.status + ")");
+    }
+  }
+  else
+    log("messageListCallback: problem during ajax request (readyState = " + http.readyState + ", status = " + http.status + ")");
 }
 
 function quotasCallback(http) {
@@ -482,243 +482,243 @@ function quotasCallback(http) {
 }
 
 function onMessageContextMenu(event) {
-   var menu = $('messageListMenu');
-   Event.observe(menu, "hideMenu", onMessageContextMenuHide);
-   popupMenu(event, "messageListMenu", this);
+  var menu = $('messageListMenu');
+  Event.observe(menu, "hideMenu", onMessageContextMenuHide);
+  popupMenu(event, "messageListMenu", this);
 
-   var topNode = $('messageList');
-   var selectedNodes = topNode.getSelectedRows();
-   for (var i = 0; i < selectedNodes.length; i++)
-      selectedNodes[i].deselect();
-   topNode.menuSelectedRows = selectedNodes;
-   topNode.menuSelectedEntry = this;
-   this.select();
+  var topNode = $('messageList');
+  var selectedNodes = topNode.getSelectedRows();
+  for (var i = 0; i < selectedNodes.length; i++)
+    selectedNodes[i].deselect();
+  topNode.menuSelectedRows = selectedNodes;
+  topNode.menuSelectedEntry = this;
+  this.select();
 }
 
 function onMessageContextMenuHide(event) {
-   var topNode = $('messageList');
+  var topNode = $('messageList');
 
-   if (topNode.menuSelectedEntry) {
-      topNode.menuSelectedEntry.deselect();
-      topNode.menuSelectedEntry = null;
-   }
-   if (topNode.menuSelectedRows) {
-      var nodes = topNode.menuSelectedRows;
-      for (var i = 0; i < nodes.length; i++)
-        nodes[i].select();
-      topNode.menuSelectedRows = null;
-   }
+  if (topNode.menuSelectedEntry) {
+    topNode.menuSelectedEntry.deselect();
+    topNode.menuSelectedEntry = null;
+  }
+  if (topNode.menuSelectedRows) {
+    var nodes = topNode.menuSelectedRows;
+    for (var i = 0; i < nodes.length; i++)
+      nodes[i].select();
+    topNode.menuSelectedRows = null;
+  }
 }
 
 function onFolderMenuClick(event) {
-   var onhide, menuName;
+  var onhide, menuName;
    
-   var menutype = this.parentNode.getAttribute("datatype");
-   if (menutype) {
-      if (menutype == "inbox") {
-        menuName = "inboxIconMenu";
-      } else if (menutype == "account") {
-        menuName = "accountIconMenu";
-      } else if (menutype == "trash") {
-        menuName = "trashIconMenu";
-      } else {
-        menuName = "mailboxIconMenu";
-      }
-   } else {
+  var menutype = this.parentNode.getAttribute("datatype");
+  if (menutype) {
+    if (menutype == "inbox") {
+      menuName = "inboxIconMenu";
+    } else if (menutype == "account") {
+      menuName = "accountIconMenu";
+    } else if (menutype == "trash") {
+      menuName = "trashIconMenu";
+    } else {
       menuName = "mailboxIconMenu";
-   }
+    }
+  } else {
+    menuName = "mailboxIconMenu";
+  }
 
-   var menu = $(menuName);
-   Event.observe(menu, "hideMenu", onFolderMenuHide);
-   popupMenu(event, menuName, this.parentNode);
+  var menu = $(menuName);
+  Event.observe(menu, "hideMenu", onFolderMenuHide);
+  popupMenu(event, menuName, this.parentNode);
 
-   var topNode = $("mailboxTree");
-   if (topNode.selectedEntry)
-      topNode.selectedEntry.deselect();
-   if (topNode.menuSelectedEntry)
-      topNode.menuSelectedEntry.deselect();
-   topNode.menuSelectedEntry = this;
-   this.select();
+  var topNode = $("mailboxTree");
+  if (topNode.selectedEntry)
+    topNode.selectedEntry.deselect();
+  if (topNode.menuSelectedEntry)
+    topNode.menuSelectedEntry.deselect();
+  topNode.menuSelectedEntry = this;
+  this.select();
 
-   preventDefault(event);
+  preventDefault(event);
 }
 
 function onFolderMenuHide(event) {
-   var topNode = $("mailboxTree");
+  var topNode = $("mailboxTree");
 
-   if (topNode.menuSelectedEntry) {
-      topNode.menuSelectedEntry.deselect();
-      topNode.menuSelectedEntry = null;
-   }
-   if (topNode.selectedEntry)
-      topNode.selectedEntry.select();
+  if (topNode.menuSelectedEntry) {
+    topNode.menuSelectedEntry.deselect();
+    topNode.menuSelectedEntry = null;
+  }
+  if (topNode.selectedEntry)
+    topNode.selectedEntry.select();
 }
 
 function deleteCachedMessage(messageId) {
-   var done = false;
-   var counter = 0;
-
-   while (counter < cachedMessages.length
-         && !done)
-      if (cachedMessages[counter]
-         && cachedMessages[counter]['idx'] == messageId) {
-        cachedMessages.splice(counter, 1);
-        done = true;
-      }
-      else
-        counter++;
+  var done = false;
+  var counter = 0;
+
+  while (counter < cachedMessages.length
+        && !done)
+    if (cachedMessages[counter]
+       && cachedMessages[counter]['idx'] == messageId) {
+      cachedMessages.splice(counter, 1);
+      done = true;
+    }
+    else
+      counter++;
 }
 
 function getCachedMessage(idx) {
-   var message = null;
-   var counter = 0;
-
-   while (counter < cachedMessages.length
-         && message == null)
-      if (cachedMessages[counter]
-         && cachedMessages[counter]['idx'] == currentMailbox + '/' + idx)
-        message = cachedMessages[counter];
-      else
-        counter++;
+  var message = null;
+  var counter = 0;
+
+  while (counter < cachedMessages.length
+        && message == null)
+    if (cachedMessages[counter]
+       && cachedMessages[counter]['idx'] == currentMailbox + '/' + idx)
+      message = cachedMessages[counter];
+    else
+      counter++;
 
-   return message;
+  return message;
 }
 
 function storeCachedMessage(cachedMessage) {
-   var oldest = -1;
-   var timeOldest = -1;
-   var counter = 0;
-
-   if (cachedMessages.length < maxCachedMessages)
-      oldest = cachedMessages.length;
-   else {
-      while (cachedMessages[counter]) {
-        if (oldest == -1
-            || cachedMessages[counter]['time'] < timeOldest) {
-           oldest = counter;
-           timeOldest = cachedMessages[counter]['time'];
-        }
-        counter++;
+  var oldest = -1;
+  var timeOldest = -1;
+  var counter = 0;
+
+  if (cachedMessages.length < maxCachedMessages)
+    oldest = cachedMessages.length;
+  else {
+    while (cachedMessages[counter]) {
+      if (oldest == -1
+         || cachedMessages[counter]['time'] < timeOldest) {
+       oldest = counter;
+       timeOldest = cachedMessages[counter]['time'];
       }
+      counter++;
+    }
 
-      if (oldest == -1)
-        oldest = 0;
-   }
+    if (oldest == -1)
+      oldest = 0;
+  }
 
-   cachedMessages[oldest] = cachedMessage;
+  cachedMessages[oldest] = cachedMessage;
 }
 
 function onMessageSelectionChange() {
-   var rows = this.getSelectedRowsId();
+  var rows = this.getSelectedRowsId();
 
-   if (rows.length == 1) {
-      var idx = rows[0].substr(4);
+  if (rows.length == 1) {
+    var idx = rows[0].substr(4);
 
-      if (currentMessages[currentMailbox] != idx) {
-        currentMessages[currentMailbox] = idx;
-        loadMessage(idx);
-      }
-   }
+    if (currentMessages[currentMailbox] != idx) {
+      currentMessages[currentMailbox] = idx;
+      loadMessage(idx);
+    }
+  }
 }
 
 function loadMessage(idx) {
-   if (document.messageAjaxRequest) {
-      document.messageAjaxRequest.aborted = true;
-      document.messageAjaxRequest.abort();
-   }
-
-   var cachedMessage = getCachedMessage(idx);
-
-   if (cachedMessage == null) {
-      var url = (ApplicationBaseURL + currentMailbox + "/"
-                + idx + "/view?noframe=1");
-      document.messageAjaxRequest
-        = triggerAjaxRequest(url, messageCallback, idx);
-      markMailInWindow(window, idx, true);
-   } else {
-      var div = $('messageContent');
-      div.innerHTML = cachedMessage['text'];
-      cachedMessage['time'] = (new Date()).getTime();
-      document.messageAjaxRequest = null;
-      configureLinksInMessage();
-   }
+  if (document.messageAjaxRequest) {
+    document.messageAjaxRequest.aborted = true;
+    document.messageAjaxRequest.abort();
+  }
+
+  var cachedMessage = getCachedMessage(idx);
+
+  if (cachedMessage == null) {
+    var url = (ApplicationBaseURL + currentMailbox + "/"
+              + idx + "/view?noframe=1");
+    document.messageAjaxRequest
+      = triggerAjaxRequest(url, messageCallback, idx);
+    markMailInWindow(window, idx, true);
+  } else {
+    var div = $('messageContent');
+    div.innerHTML = cachedMessage['text'];
+    cachedMessage['time'] = (new Date()).getTime();
+    document.messageAjaxRequest = null;
+    configureLinksInMessage();
+  }
 }
 
 function configureLinksInMessage() {
-   var messageDiv = $('messageContent');
-   var mailContentDiv = document.getElementsByClassName('mailer_mailcontent',
-                                                       messageDiv)[0];
-   Event.observe(mailContentDiv, "contextmenu",
-                onMessageContentMenu.bindAsEventListener(mailContentDiv));
-   var anchors = messageDiv.getElementsByTagName('a');
-   for (var i = 0; i < anchors.length; i++)
-      if (anchors[i].href.substring(0,7) == "mailto:") {
-        Event.observe(anchors[i], "click",
-                      onEmailAddressClick.bindAsEventListener(anchors[i]));
-        Event.observe(anchors[i], "contextmenu",
-                      onEmailAddressClick.bindAsEventListener(anchors[i]));
-      }
-      else
-        Event.observe(anchors[i], "click",
-                      onMessageAnchorClick);
+  var messageDiv = $('messageContent');
+  var mailContentDiv = document.getElementsByClassName('mailer_mailcontent',
+                                                      messageDiv)[0];
+  Event.observe(mailContentDiv, "contextmenu",
+               onMessageContentMenu.bindAsEventListener(mailContentDiv));
+  var anchors = messageDiv.getElementsByTagName('a');
+  for (var i = 0; i < anchors.length; i++)
+    if (anchors[i].href.substring(0,7) == "mailto:") {
+      Event.observe(anchors[i], "click",
+                   onEmailAddressClick.bindAsEventListener(anchors[i]));
+      Event.observe(anchors[i], "contextmenu",
+                   onEmailAddressClick.bindAsEventListener(anchors[i]));
+    }
+    else
+      Event.observe(anchors[i], "click",
+                   onMessageAnchorClick);
 }
 
 function onMessageContentMenu(event) {
-   popupMenu(event, 'messageContentMenu', this);
+  popupMenu(event, 'messageContentMenu', this);
 }
 
 function onEmailAddressClick(event) {
-   popupMenu(event, 'addressMenu', this);
+  popupMenu(event, 'addressMenu', this);
 }
 
 function onMessageAnchorClick (event) {
-   window.open(this.href);
-   preventDefault(event);
+  window.open(this.href);
+  preventDefault(event);
 }
 
 function messageCallback(http) {
-   var div = $('messageContent');
+  var div = $('messageContent');
 
-   if (http.readyState == 4
-       && http.status == 200) {
-      document.messageAjaxRequest = null;
-      div.innerHTML = http.responseText;
-      configureLinksInMessage();
+  if (http.readyState == 4
+      && http.status == 200) {
+    document.messageAjaxRequest = null;
+    div.innerHTML = http.responseText;
+    configureLinksInMessage();
       
-      if (http.callbackData) {
-        var cachedMessage = new Array();
-        cachedMessage['idx'] = currentMailbox + '/' + http.callbackData;
-        cachedMessage['time'] = (new Date()).getTime();
-        cachedMessage['text'] = http.responseText;
-        if (cachedMessage['text'].length < 30000)
-           storeCachedMessage(cachedMessage);
-      }
-   }
-   else
-      log("messageCallback: problem during ajax request: " + http.status);
+    if (http.callbackData) {
+      var cachedMessage = new Array();
+      cachedMessage['idx'] = currentMailbox + '/' + http.callbackData;
+      cachedMessage['time'] = (new Date()).getTime();
+      cachedMessage['text'] = http.responseText;
+      if (cachedMessage['text'].length < 30000)
+       storeCachedMessage(cachedMessage);
+    }
+  }
+  else
+    log("messageCallback: problem during ajax request: " + http.status);
 }
 
 function processMailboxMenuAction(mailbox) {
-   var currentNode, upperNode;
-   var mailboxName;
-   var action;
+  var currentNode, upperNode;
+  var mailboxName;
+  var action;
 
-   mailboxName = mailbox.getAttribute('mailboxname');
-   currentNode = mailbox;
-   upperNode = null;
+  mailboxName = mailbox.getAttribute('mailboxname');
+  currentNode = mailbox;
+  upperNode = null;
 
-   while (currentNode
-         && !currentNode.hasAttribute('mailboxaction'))
-      currentNode = currentNode.parentNode.parentNode.parentMenuItem;
+  while (currentNode
+        && !currentNode.hasAttribute('mailboxaction'))
+    currentNode = currentNode.parentNode.parentNode.parentMenuItem;
 
-   if (currentNode)
-   {
+  if (currentNode)
+    {
       action = currentNode.getAttribute('mailboxaction');
       //       var rows  = collectSelectedRows();
       //       var rString = rows.join(', ');
       //       alert("performing '" + action + "' on " + rString
-                    //             + " to " + mailboxName);
-   }
+      //             + " to " + mailboxName);
+    }
 }
 
 var rowSelectionCount = 0;
@@ -726,28 +726,28 @@ var rowSelectionCount = 0;
 validateControls();
 
 function showElement(e, shouldShow) {
-   e.style.display = shouldShow ? "" : "none";
+  e.style.display = shouldShow ? "" : "none";
 }
 
 function enableElement(e, shouldEnable) {
-   if(!e)
-      return;
-   if(shouldEnable) {
-      if(e.hasAttribute("disabled"))
-        e.removeAttribute("disabled");
-   }
-   else {
-      e.setAttribute("disabled", "1");
-   }
+  if(!e)
+    return;
+  if(shouldEnable) {
+    if(e.hasAttribute("disabled"))
+      e.removeAttribute("disabled");
+  }
+  else {
+    e.setAttribute("disabled", "1");
+  }
 }
 
 function validateControls() {
-   var e = $("moveto");
-   this.enableElement(e, rowSelectionCount > 0);
+  var e = $("moveto");
+  this.enableElement(e, rowSelectionCount > 0);
 }
 
 function moveTo(uri) {
-   alert("MoveTo: " + uri);
+  alert("MoveTo: " + uri);
 }
 
 function deleteSelectedMails() {
@@ -755,273 +755,273 @@ function deleteSelectedMails() {
 
 /* message menu entries */
 function onMenuOpenMessage(event) {
-   return openMessageWindowsForSelection('popupview');
+  return openMessageWindowsForSelection('popupview');
 }
 
 function onMenuReplyToSender(event) {
-   return openMessageWindowsForSelection('reply');
+  return openMessageWindowsForSelection('reply');
 }
 
 function onMenuReplyToAll(event) {
-   return openMessageWindowsForSelection('replyall');
+  return openMessageWindowsForSelection('replyall');
 }
 
 function onMenuForwardMessage(event) {
-   return openMessageWindowsForSelection('forward');
+  return openMessageWindowsForSelection('forward');
 }
 
 function onMenuViewMessageSource(event) {
-   var messageList = $("messageList");
-   var rows = messageList.getSelectedRowsId();
-
-   if (rows.length > 0) {
-      var url = (ApplicationBaseURL + currentMailbox + "/"
-                + rows[0].substr(4) + "/viewsource");
-      window.open(url, "",
-                 "width=680,height=520,resizable=1,scrollbars=1,toolbar=0,"
-                 + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
-   }
+  var messageList = $("messageList");
+  var rows = messageList.getSelectedRowsId();
+
+  if (rows.length > 0) {
+    var url = (ApplicationBaseURL + currentMailbox + "/"
+              + rows[0].substr(4) + "/viewsource");
+    window.open(url, "",
+               "width=680,height=520,resizable=1,scrollbars=1,toolbar=0,"
+               + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
+  }
 
-   preventDefault(event);
+  preventDefault(event);
 }
 
 /* contacts */
 function newContactFromEmail(event) {
-   var mailto = document.menuTarget.innerHTML;
+  var mailto = document.menuTarget.innerHTML;
 
-   var email = extractEmailAddress(mailto);
-   var c_name = extractEmailName(mailto);
-   if (email.length > 0)
-   {
+  var email = extractEmailAddress(mailto);
+  var c_name = extractEmailName(mailto);
+  if (email.length > 0)
+    {
       var url = UserFolderURL + "Contacts/new?contactEmail=" + email;
       if (c_name)
-        url += "&contactFN=" + c_name;
+       url += "&contactFN=" + c_name;
       w = window.open(url, null,
                       "width=546,height=490,resizable=1,scrollbars=1,toolbar=0,"
                       + "location=0,directories=0,status=0,menubar=0,copyhistory=0");
       w.focus();
-   }
+    }
 
-   return false; /* stop following the link */
+  return false; /* stop following the link */
 }
 
 function newEmailTo(sender) {
-   return openMailTo(document.menuTarget.innerHTML);
+  return openMailTo(document.menuTarget.innerHTML);
 }
 
 function expandUpperTree(node) {
-   var currentNode = node.parentNode;
-
-   while (currentNode.className != "dtree") {
-      if (currentNode.className == 'clip') {
-        var id = currentNode.getAttribute("id");
-        var number = parseInt(id.substr(2));
-        if (number > 0) {
-           var cn = mailboxTree.aNodes[number];
-           mailboxTree.nodeStatus(1, number, cn._ls);
-        }
+  var currentNode = node.parentNode;
+
+  while (currentNode.className != "dtree") {
+    if (currentNode.className == 'clip') {
+      var id = currentNode.getAttribute("id");
+      var number = parseInt(id.substr(2));
+      if (number > 0) {
+       var cn = mailboxTree.aNodes[number];
+       mailboxTree.nodeStatus(1, number, cn._ls);
       }
-      currentNode = currentNode.parentNode;
-   }
+    }
+    currentNode = currentNode.parentNode;
+  }
 }
 
 function onHeaderClick(event) {
-   var headerId = this.getAttribute("id");
-   var newSortAttribute;
-   if (headerId == "subjectHeader")
-      newSortAttribute = "subject";
-   else if (headerId == "fromHeader")
-      newSortAttribute = "from";
-   else if (headerId == "dateHeader")
-      newSortAttribute = "date";
-   else
-      newSortAttribute = "arrival";
-
-   if (sorting["attribute"] == newSortAttribute)
-      sorting["ascending"] = !sorting["ascending"];
-   else {
-      sorting["attribute"] = newSortAttribute;
-      sorting["ascending"] = true;
-   }
+  var headerId = this.getAttribute("id");
+  var newSortAttribute;
+  if (headerId == "subjectHeader")
+    newSortAttribute = "subject";
+  else if (headerId == "fromHeader")
+    newSortAttribute = "from";
+  else if (headerId == "dateHeader")
+    newSortAttribute = "date";
+  else
+    newSortAttribute = "arrival";
+
+  if (sorting["attribute"] == newSortAttribute)
+    sorting["ascending"] = !sorting["ascending"];
+  else {
+    sorting["attribute"] = newSortAttribute;
+    sorting["ascending"] = true;
+  }
 
-   refreshCurrentFolder();
+  refreshCurrentFolder();
 
-   preventDefault(event);
+  preventDefault(event);
 }
 
 function refreshCurrentFolder() {
-   openMailbox(currentMailbox, true);
+  openMailbox(currentMailbox, true);
 }
 
 function pouetpouet(event) {
-   window.alert("pouet pouet");
+  window.alert("pouet pouet");
 }
 
 var mailboxSpanAcceptType = function(type) {
-   return (type == "mailRow");
+  return (type == "mailRow");
 }
 
 var mailboxSpanEnter = function() {
-   this.addClassName("_dragOver");
+  this.addClassName("_dragOver");
 }
 
 var mailboxSpanExit = function() {
-   this.removeClassName("_dragOver");
+  this.removeClassName("_dragOver");
 }
 
 var mailboxSpanDrop = function(data) {
-   var success = false;
-
-   if (data) {
-      var folder = this.parentNode.parentNode.getAttribute("dataname");
-      if (folder != currentMailbox)
-        success = (moveMessages(data, folder) == 0);
-   }
-   else
-   success = false;
+  var success = false;
 
-   return success;
+  if (data) {
+    var folder = this.parentNode.parentNode.getAttribute("dataname");
+    if (folder != currentMailbox)
+      success = (moveMessages(data, folder) == 0);
+  }
+  else
+    success = false;
+  
+  return success;
 }
-
+    
 var plusSignEnter = function() {
-   var nodeNr = parseInt(this.id.substr(2));
-   if (!mailboxTree.aNodes[nodeNr]._io)
-     this.plusSignTimer = setTimeout("openPlusSign('" + nodeNr + "');", 1000);
+  var nodeNr = parseInt(this.id.substr(2));
+  if (!mailboxTree.aNodes[nodeNr]._io)
+    this.plusSignTimer = setTimeout("openPlusSign('" + nodeNr + "');", 1000);
 }
-
+      
 var plusSignExit = function() {
-   if (this.plusSignTimer) {
-      clearTimeout(this.plusSignTimer);
-      this.plusSignTimer = null;
-   }
+  if (this.plusSignTimer) {
+    clearTimeout(this.plusSignTimer);
+    this.plusSignTimer = null;
+  }
 }
-
+       
 function openPlusSign(nodeNr) {
-   mailboxTree.nodeStatus(1, nodeNr, mailboxTree.aNodes[nodeNr]._ls);
-   mailboxTree.aNodes[nodeNr]._io = 1;
-   this.plusSignTimer = null;
+  mailboxTree.nodeStatus(1, nodeNr, mailboxTree.aNodes[nodeNr]._ls);
+  mailboxTree.aNodes[nodeNr]._io = 1;
+  this.plusSignTimer = null;
 }
 
 var messageListGhost = function () {
-   var newDiv = document.createElement("div");
-   //   newDiv.style.width = "25px;";
-   //   newDiv.style.height = "25px;";
-   newDiv.style.backgroundColor = "#aae;";
-   newDiv.style.border = "2px solid #a3a;";
-   newDiv.style.padding = "5px;";
-   newDiv.ghostOffsetX = 10;
-   newDiv.ghostOffsetY = 5;
+  var newDiv = document.createElement("div");
+  //   newDiv.style.width = "25px;";
+  //   newDiv.style.height = "25px;";
+  newDiv.style.backgroundColor = "#aae;";
+  newDiv.style.border = "2px solid #a3a;";
+  newDiv.style.padding = "5px;";
+  newDiv.ghostOffsetX = 10;
+  newDiv.ghostOffsetY = 5;
 
-   var newImg = document.createElement("img");
-   newImg.src = ResourcesURL + "/message-mail.png";
+  var newImg = document.createElement("img");
+  newImg.src = ResourcesURL + "/message-mail.png";
 
-   var list = $("messageList");
-   var count = list.getSelectedRows().length;
-   newDiv.appendChild(newImg);
-   newDiv.appendChild(document.createElement("br"));
-   newDiv.appendChild(document.createTextNode(count + " messages..."));
+  var list = $("messageList");
+  var count = list.getSelectedRows().length;
+  newDiv.appendChild(newImg);
+  newDiv.appendChild(document.createElement("br"));
+  newDiv.appendChild(document.createTextNode(count + " messages..."));
 
-   return newDiv;
+  return newDiv;
 }
 
 var messageListData = function(type) {
-   var rows = this.parentNode.parentNode.getSelectedRowsId();
-   var msgIds = new Array();
-   for (var i = 0; i < rows.length; i++)
-   msgIds.push(rows[i].substr(4));
+  var rows = this.parentNode.parentNode.getSelectedRowsId();
+  var msgIds = new Array();
+  for (var i = 0; i < rows.length; i++)
+    msgIds.push(rows[i].substr(4));
 
-   return msgIds;
+  return msgIds;
 }
 
 /* a model for a futur refactoring of the sortable table headers mechanism */
 
 function configureMessageListHeaders(cells) {
-   for (var i = 0; i < cells.length; i++) {
-      var currentCell = $(cells[i]);
-      Event.observe(currentCell, "click",
-                   onHeaderClick.bindAsEventListener(currentCell));
-      Event.observe(currentCell, "mousedown", listRowMouseDownHandler);
-   }
+  for (var i = 0; i < cells.length; i++) {
+    var currentCell = $(cells[i]);
+    Event.observe(currentCell, "click",
+                 onHeaderClick.bindAsEventListener(currentCell));
+    Event.observe(currentCell, "mousedown", listRowMouseDownHandler);
+  }
 }
 
 function configureMessageListEvents() {
-   var messageList = $("messageList");
-   if (messageList) {
-      Event.observe(messageList, "mousedown",
-                   onMessageSelectionChange.bindAsEventListener(messageList));
-
-      configureMessageListHeaders(messageList.tHead.rows[0].cells);
-      var cell = messageList.tHead.rows[1].cells[0];
-      if ($(cell).hasClassName("tbtv_navcell")) {
-        var anchors = $(cell).childNodesWithTag("a");
-        for (var i = 0; i < anchors.length; i++)
-           Event.observe(anchors[i], "click", openMailboxAtIndex.bindAsEventListener(anchors[i]));
-      }
+  var messageList = $("messageList");
+  if (messageList) {
+    Event.observe(messageList, "mousedown",
+                 onMessageSelectionChange.bindAsEventListener(messageList));
+
+    configureMessageListHeaders(messageList.tHead.rows[0].cells);
+    var cell = messageList.tHead.rows[1].cells[0];
+    if ($(cell).hasClassName("tbtv_navcell")) {
+      var anchors = $(cell).childNodesWithTag("a");
+      for (var i = 0; i < anchors.length; i++)
+       Event.observe(anchors[i], "click", openMailboxAtIndex.bindAsEventListener(anchors[i]));
+    }
 
-      rows = messageList.tBodies[0].rows;
-      for (var i = 0; i < rows.length; i++) {
-        Event.observe(rows[i], "mousedown", onRowClick);
-        Event.observe(rows[i], "contextmenu", onMessageContextMenu.bindAsEventListener(rows[i]));
+    rows = messageList.tBodies[0].rows;
+    for (var i = 0; i < rows.length; i++) {
+      Event.observe(rows[i], "mousedown", onRowClick);
+      Event.observe(rows[i], "contextmenu", onMessageContextMenu.bindAsEventListener(rows[i]));
         
-        rows[i].dndTypes = function() { return new Array("mailRow"); };
-        rows[i].dndGhost = messageListGhost;
-        rows[i].dndDataForType = messageListData;
-        document.DNDManager.registerSource(rows[i]);
-
-        for (var j = 0; j < rows[i].cells.length; j++) {
-           var cell = rows[i].cells[j];
-           Event.observe(cell, "mousedown", listRowMouseDownHandler);
-           if (j == 2 || j == 3 || j == 5)
-              Event.observe(cell, "dblclick", onMessageDoubleClick.bindAsEventListener(cell));
-           else if (j == 4) {
-              var img = cell.childNodesWithTag("img")[0];
-              Event.observe(img, "click", mailListMarkMessage);
-           }
-        }
+      rows[i].dndTypes = function() { return new Array("mailRow"); };
+      rows[i].dndGhost = messageListGhost;
+      rows[i].dndDataForType = messageListData;
+      document.DNDManager.registerSource(rows[i]);
+
+      for (var j = 0; j < rows[i].cells.length; j++) {
+       var cell = rows[i].cells[j];
+       Event.observe(cell, "mousedown", listRowMouseDownHandler);
+       if (j == 2 || j == 3 || j == 5)
+         Event.observe(cell, "dblclick", onMessageDoubleClick.bindAsEventListener(cell));
+       else if (j == 4) {
+         var img = cell.childNodesWithTag("img")[0];
+         Event.observe(img, "click", mailListMarkMessage);
+       }
       }
-   }
+    }
+  }
 }
 
 function configureDragHandles() {
-   var handle = $("verticalDragHandle");
-   if (handle) {
-      handle.addInterface(SOGoDragHandlesInterface);
-      handle.leftBlock=$("leftPanel");
-      handle.rightBlock=$("rightPanel");
-   }
+  var handle = $("verticalDragHandle");
+  if (handle) {
+    handle.addInterface(SOGoDragHandlesInterface);
+    handle.leftBlock=$("leftPanel");
+    handle.rightBlock=$("rightPanel");
+  }
 
-   handle = $("rightDragHandle");
-   if (handle) {
-      handle.addInterface(SOGoDragHandlesInterface);
-      handle.upperBlock=$("mailboxContent");
-      handle.lowerBlock=$("messageContent");
-   }
+  handle = $("rightDragHandle");
+  if (handle) {
+    handle.addInterface(SOGoDragHandlesInterface);
+    handle.upperBlock=$("mailboxContent");
+    handle.lowerBlock=$("messageContent");
+  }
 }
 
 /* dnd */
 function initDnd() {
-   //   log("MailerUI initDnd");
-
-   var tree = $("mailboxTree");
-   if (tree) {
-      var images = tree.getElementsByTagName("img");
-      for (var i = 0; i < images.length; i++) {
-        if (images[i].id[0] == 'j') {
-           images[i].dndAcceptType = mailboxSpanAcceptType;
-           images[i].dndEnter = plusSignEnter;
-           images[i].dndExit = plusSignExit;
-           document.DNDManager.registerDestination(images[i]);
-        }
-      }
-      var nodes = document.getElementsByClassName("nodeName", tree);
-      for (var i = 0; i < nodes.length; i++) {
-        nodes[i].dndAcceptType = mailboxSpanAcceptType;
-        nodes[i].dndEnter = mailboxSpanEnter;
-        nodes[i].dndExit = mailboxSpanExit;
-        nodes[i].dndDrop = mailboxSpanDrop;
-        document.DNDManager.registerDestination(nodes[i]);
+  //   log("MailerUI initDnd");
+
+  var tree = $("mailboxTree");
+  if (tree) {
+    var images = tree.getElementsByTagName("img");
+    for (var i = 0; i < images.length; i++) {
+      if (images[i].id[0] == 'j') {
+       images[i].dndAcceptType = mailboxSpanAcceptType;
+       images[i].dndEnter = plusSignEnter;
+       images[i].dndExit = plusSignExit;
+       document.DNDManager.registerDestination(images[i]);
       }
-   }
+    }
+    var nodes = document.getElementsByClassName("nodeName", tree);
+    for (var i = 0; i < nodes.length; i++) {
+      nodes[i].dndAcceptType = mailboxSpanAcceptType;
+      nodes[i].dndEnter = mailboxSpanEnter;
+      nodes[i].dndExit = mailboxSpanExit;
+      nodes[i].dndDrop = mailboxSpanDrop;
+      document.DNDManager.registerDestination(nodes[i]);
+    }
+  }
 }
 
 /* stub */
@@ -1030,338 +1030,338 @@ function refreshContacts() {
 }
 
 function openInbox(node) {
-   var done = false;
-   openMailbox(node.parentNode.getAttribute("dataname"));
-   var tree = $("mailboxTree");
-   tree.selectedEntry = node;
-   node.select();
-   mailboxTree.o(1);
+  var done = false;
+  openMailbox(node.parentNode.getAttribute("dataname"));
+  var tree = $("mailboxTree");
+  tree.selectedEntry = node;
+  node.select();
+  mailboxTree.o(1);
 }
 
 function initMailer(event) {
-   if (!document.body.hasClassName("popup")) {
-      configureMessageListEvents();
-      initDnd();
-      currentMailbox = "/" + accounts[0] + "/INBOX";
-      initMailboxTree();
-   }
+  if (!document.body.hasClassName("popup")) {
+    configureMessageListEvents();
+    initDnd();
+    currentMailbox = "/" + accounts[0] + "/folderINBOX";
+    initMailboxTree();
+  }
 }
 
 function initMailboxTree() {
-   mailboxTree = new dTree("mailboxTree");
-   mailboxTree.config.folderLinks = true;
-   mailboxTree.config.hideRoot = true;
-
-   mailboxTree.icon.root = ResourcesURL + "/tbtv_account_17x17.gif";
-   mailboxTree.icon.folder = ResourcesURL + "/tbtv_leaf_corner_17x17.gif";
-   mailboxTree.icon.folderOpen = ResourcesURL + "/tbtv_leaf_corner_17x17.gif";
-   mailboxTree.icon.node = ResourcesURL + "/tbtv_leaf_corner_17x17.gif";
-   mailboxTree.icon.line = ResourcesURL + "/tbtv_line_17x17.gif";
-   mailboxTree.icon.join = ResourcesURL + "/tbtv_junction_17x17.gif";
-   mailboxTree.icon.joinBottom = ResourcesURL + "/tbtv_corner_17x17.gif";
-   mailboxTree.icon.plus = ResourcesURL + "/tbtv_plus_17x17.gif";
-   mailboxTree.icon.plusBottom = ResourcesURL + "/tbtv_corner_plus_17x17.gif";
-   mailboxTree.icon.minus = ResourcesURL + "/tbtv_minus_17x17.gif";
-   mailboxTree.icon.minusBottom = ResourcesURL + "/tbtv_corner_minus_17x17.gif";
-   mailboxTree.icon.nlPlus = ResourcesURL + "/tbtv_corner_plus_17x17.gif";
-   mailboxTree.icon.nlMinus = ResourcesURL + "/tbtv_corner_minus_17x17.gif";
-   mailboxTree.icon.empty = ResourcesURL + "/empty.gif";
-
-   mailboxTree.add(0, -1, '');
-
-   mailboxTree.pendingRequests = mailAccounts.length;
-   for (var i = 0; i < mailAccounts.length; i++) {
-      var url = ApplicationBaseURL + "/" + mailAccounts[i] + "/mailboxes";
-      triggerAjaxRequest(url, onLoadMailboxesCallback, mailAccounts[i]);
-   }
+  mailboxTree = new dTree("mailboxTree");
+  mailboxTree.config.folderLinks = true;
+  mailboxTree.config.hideRoot = true;
+
+  mailboxTree.icon.root = ResourcesURL + "/tbtv_account_17x17.gif";
+  mailboxTree.icon.folder = ResourcesURL + "/tbtv_leaf_corner_17x17.gif";
+  mailboxTree.icon.folderOpen  = ResourcesURL + "/tbtv_leaf_corner_17x17.gif";
+  mailboxTree.icon.node = ResourcesURL + "/tbtv_leaf_corner_17x17.gif";
+  mailboxTree.icon.line = ResourcesURL + "/tbtv_line_17x17.gif";
+  mailboxTree.icon.join = ResourcesURL + "/tbtv_junction_17x17.gif";
+  mailboxTree.icon.joinBottom  = ResourcesURL + "/tbtv_corner_17x17.gif";
+  mailboxTree.icon.plus = ResourcesURL + "/tbtv_plus_17x17.gif";
+  mailboxTree.icon.plusBottom  = ResourcesURL + "/tbtv_corner_plus_17x17.gif";
+  mailboxTree.icon.minus = ResourcesURL + "/tbtv_minus_17x17.gif";
+  mailboxTree.icon.minusBottom = ResourcesURL + "/tbtv_corner_minus_17x17.gif";
+  mailboxTree.icon.nlPlus = ResourcesURL + "/tbtv_corner_plus_17x17.gif";
+  mailboxTree.icon.nlMinus = ResourcesURL + "/tbtv_corner_minus_17x17.gif";
+  mailboxTree.icon.empty = ResourcesURL + "/empty.gif";
+
+  mailboxTree.add(0, -1, '');
+
+  mailboxTree.pendingRequests = mailAccounts.length;
+  for (var i = 0; i < mailAccounts.length; i++) {
+    var url = ApplicationBaseURL + "/" + mailAccounts[i] + "/mailboxes";
+    triggerAjaxRequest(url, onLoadMailboxesCallback, mailAccounts[i]);
+  }
 }
 
 function updateMailboxTreeInPage() {
-   $("folderTreeContent").innerHTML = mailboxTree;
-
-   var inboxFound = false;
-   var tree = $("mailboxTree");
-   var nodes = document.getElementsByClassName("node", tree);
-   for (i = 0; i < nodes.length; i++) {
-      Event.observe(nodes[i], "click", onMailboxTreeItemClick.bindAsEventListener(nodes[i]));
-      Event.observe(nodes[i], "contextmenu", onFolderMenuClick.bindAsEventListener(nodes[i]));
-      if (!inboxFound
-         && nodes[i].parentNode.getAttribute("datatype") == "inbox") {
-        openInbox(nodes[i]);
-        inboxFound = true;
-      }
-   }
+  $("folderTreeContent").innerHTML = mailboxTree;
+
+  var inboxFound = false;
+  var tree = $("mailboxTree");
+  var nodes = document.getElementsByClassName("node", tree);
+  for (i = 0; i < nodes.length; i++) {
+    Event.observe(nodes[i], "click", onMailboxTreeItemClick.bindAsEventListener(nodes[i]));
+    Event.observe(nodes[i], "contextmenu", onFolderMenuClick.bindAsEventListener(nodes[i]));
+    if (!inboxFound
+       && nodes[i].parentNode.getAttribute("datatype") == "inbox") {
+      openInbox(nodes[i]);
+      inboxFound = true;
+    }
+  }
 }
 
 function mailboxMenuNode(type, name) {
-   var newNode = document.createElement("li");
-   var icon = MailerUIdTreeExtension.folderIcons[type];
-   if (!icon)
-      icon = "tbtv_leaf_corner_17x17.gif";
-   var image = document.createElement("img");
-   image.src = ResourcesURL + "/" + icon;
-   newNode.appendChild(image);
-   newNode.appendChild(document.createTextNode(" " + name));
+  var newNode = document.createElement("li");
+  var icon = MailerUIdTreeExtension.folderIcons[type];
+  if (!icon)
+    icon = "tbtv_leaf_corner_17x17.gif";
+  var image = document.createElement("img");
+  image.src = ResourcesURL + "/" + icon;
+  newNode.appendChild(image);
+  newNode.appendChild(document.createTextNode(" " + name));
 
-   return newNode;
+  return newNode;
 }
 
 function generateMenuForMailbox(mailbox, prefix, callback) {
-   var menuDIV = document.createElement("div");
-   $(menuDIV).addClassName("menu");
-   menuDIV.setAttribute("id", prefix + "Submenu");
-   var menu = document.createElement("ul");
-   menuDIV.appendChild(menu);
-
-   var callbacks = new Array();
-   if (mailbox.type != "account") {
-      var newNode = document.createElement("li");
-      newNode.mailbox = mailbox;
-      newNode.appendChild(document.createTextNode("coucou"));
-      menu.appendChild(newNode);
-      menu.appendChild(document.createElement("li"));
+  var menuDIV = document.createElement("div");
+  $(menuDIV).addClassName("menu");
+  menuDIV.setAttribute("id", prefix + "Submenu");
+  var menu = document.createElement("ul");
+  menuDIV.appendChild(menu);
+
+  var callbacks = new Array();
+  if (mailbox.type != "account") {
+    var newNode = document.createElement("li");
+    newNode.mailbox = mailbox;
+    newNode.appendChild(document.createTextNode("coucou"));
+    menu.appendChild(newNode);
+    menu.appendChild(document.createElement("li"));
+    callbacks.push(callback);
+    callbacks.push("-");
+  }
+
+  var submenuCount = 0;
+  for (var i = 0; i < mailbox.children.length; i++) {
+    var child = mailbox.children[i];
+    var newNode = mailboxMenuNode(child.type, child.name);
+    menu.appendChild(newNode);
+    if (child.children.length > 0) {
+      var newPrefix = prefix + submenuCount;
+      var newSubmenu = generateMenuForMailbox(child,
+                                             newPrefix,
+                                             callback);
+      document.body.appendChild(newSubmenu);
+      callbacks.push(newPrefix + "Submenu");
+      submenuCount++;
+    }
+    else {
+      newNode.mailbox = child;
       callbacks.push(callback);
-      callbacks.push("-");
-   }
-
-   var submenuCount = 0;
-   for (var i = 0; i < mailbox.children.length; i++) {
-      var child = mailbox.children[i];
-      var newNode = mailboxMenuNode(child.type, child.name);
-      menu.appendChild(newNode);
-      if (child.children.length > 0) {
-        var newPrefix = prefix + submenuCount;
-        var newSubmenu = generateMenuForMailbox(child,
-                                                newPrefix,
-                                                callback);
-        document.body.appendChild(newSubmenu);
-        callbacks.push(newPrefix + "Submenu");
-        submenuCount++;
-      }
-      else {
-        newNode.mailbox = child;
-        callbacks.push(callback);
-      }
-   }
-   initMenu(menuDIV, callbacks);
+    }
+  }
+  initMenu(menuDIV, callbacks);
 
-   return menuDIV;
+  return menuDIV;
 }
 
 function updateMailboxMenus() {
-   var mailboxActions = { move: onMailboxMenuMove,
-                         copy: onMailboxMenuCopy };
+  var mailboxActions = { move: onMailboxMenuMove,
+                        copy: onMailboxMenuCopy };
 
-   for (key in mailboxActions) {
-      var menuId = key + "MailboxMenu";
-      var menuDIV = $(menuId);
-      if (menuDIV)
-        menuDIV.parentNode.removeChild(menuDIV);
+  for (key in mailboxActions) {
+    var menuId = key + "MailboxMenu";
+    var menuDIV = $(menuId);
+    if (menuDIV)
+      menuDIV.parentNode.removeChild(menuDIV);
 
-      menuDIV = document.createElement("div");
-      document.body.appendChild(menuDIV);
+    menuDIV = document.createElement("div");
+    document.body.appendChild(menuDIV);
 
-      var menu = document.createElement("ul");
-      menuDIV.appendChild(menu);
+    var menu = document.createElement("ul");
+    menuDIV.appendChild(menu);
 
-      $(menuDIV).addClassName("menu");
-      menuDIV.setAttribute("id", menuId);
+    $(menuDIV).addClassName("menu");
+    menuDIV.setAttribute("id", menuId);
       
-      var submenuIds = new Array();
-      for (var i = 0; i < mailAccounts.length; i++) {
-       var menuEntry = mailboxMenuNode("account", mailAccounts[i]);
-        menu.appendChild(menuEntry);
-        var mailbox = accounts[mailAccounts[i]];
-        var newSubmenu = generateMenuForMailbox(mailbox,
-                                                key, mailboxActions[key]);
-        document.body.appendChild(newSubmenu);
-        submenuIds.push(newSubmenu.getAttribute("id"));
-      }
-      initMenu(menuDIV, submenuIds);
-   }
+    var submenuIds = new Array();
+    for (var i = 0; i < mailAccounts.length; i++) {
+      var menuEntry = mailboxMenuNode("account", mailAccounts[i]);
+      menu.appendChild(menuEntry);
+      var mailbox = accounts[mailAccounts[i]];
+      var newSubmenu = generateMenuForMailbox(mailbox,
+                                             key, mailboxActions[key]);
+      document.body.appendChild(newSubmenu);
+      submenuIds.push(newSubmenu.getAttribute("id"));
+    }
+    initMenu(menuDIV, submenuIds);
+  }
 }
 
 function onLoadMailboxesCallback(http) {
-   if (http.readyState == 4
-       && http.status == 200) {
-      var newAccount = buildMailboxes(http.callbackData,
-                                     http.responseText);
-      accounts[http.callbackData] = newAccount;
-      mailboxTree.addMailAccount(newAccount);
-      mailboxTree.pendingRequests--;
-      if (!mailboxTree.pendingRequests) {
-       updateMailboxTreeInPage();
-       updateMailboxMenus();
-      }
+  if (http.readyState == 4
+      && http.status == 200) {
+    var newAccount = buildMailboxes(http.callbackData,
+                                   http.responseText);
+    accounts[http.callbackData] = newAccount;
+    mailboxTree.addMailAccount(newAccount);
+    mailboxTree.pendingRequests--;
+    if (!mailboxTree.pendingRequests) {
+      updateMailboxTreeInPage();
+      updateMailboxMenus();
+    }
   }
 
-//       var tree = $("mailboxTree");
-//       var treeNodes = document.getElementsByClassName("dTreeNode", tree);
-//       var i = 0;
-//       while (i < treeNodes.length
-//          && treeNodes[i].getAttribute("dataname") != currentMailbox)
-//      i++;
-//       if (i < treeNodes.length) {
-//      //     log("found mailbox");
-//      var links = document.getElementsByClassName("node", treeNodes[i]);
-//      if (tree.selectedEntry)
-//         tree.selectedEntry.deselect();
-//      links[0].select();
-//      tree.selectedEntry = links[0];
-//      expandUpperTree(links[0]);
-//       }
+  //       var tree = $("mailboxTree");
+  //       var treeNodes = document.getElementsByClassName("dTreeNode", tree);
+  //       var i = 0;
+  //       while (i < treeNodes.length
+  //        && treeNodes[i].getAttribute("dataname") != currentMailbox)
+  //    i++;
+  //       if (i < treeNodes.length) {
+  //    //     log("found mailbox");
+  //    var links = document.getElementsByClassName("node", treeNodes[i]);
+  //    if (tree.selectedEntry)
+  //       tree.selectedEntry.deselect();
+  //    links[0].select();
+  //    tree.selectedEntry = links[0];
+  //    expandUpperTree(links[0]);
+  //       }
 }
 
 function buildMailboxes(accountName, encoded) {
-   var account = new Mailbox("account", accountName);
-   var data = encoded.evalJSON(true);
-   for (var i = 0; i < data.length; i++) {
-      var currentNode = account;
-      var names = data[i].path.split("/");
-      for (var j = 1; j < (names.length - 1); j++) {
-        var node = currentNode.findMailboxByName(names[j]);
-        if (!node) {
-           node = new Mailbox("additional", names[j]);
-           currentNode.addMailbox(node);
-        }
-        currentNode = node;
+  var account = new Mailbox("account", accountName);
+  var data = encoded.evalJSON(true);
+  for (var i = 0; i < data.length; i++) {
+    var currentNode = account;
+    var names = data[i].path.split("/");
+    for (var j = 1; j < (names.length - 1); j++) {
+      var node = currentNode.findMailboxByName(names[j]);
+      if (!node) {
+       node = new Mailbox("additional", names[j]);
+       currentNode.addMailbox(node);
       }
-      var basename = names[names.length-1];
-      var leaf = currentNode.findMailboxByName(basename);
-      if (leaf)
-        leaf.type = data[i].type;
-      else {
-        leaf = new Mailbox(data[i].type, basename);
-        currentNode.addMailbox(leaf);
-      }
-   }
+      currentNode = node;
+    }
+    var basename = names[names.length-1];
+    var leaf = currentNode.findMailboxByName(basename);
+    if (leaf)
+      leaf.type = data[i].type;
+    else {
+      leaf = new Mailbox(data[i].type, basename);
+      currentNode.addMailbox(leaf);
+    }
+  }
 
-   return account;
+  return account;
 }
 
 function onMenuCreateFolder(event) {
-   var name = window.prompt(labels["Name :"].decodeEntities(), "");
-   if (name && name.length > 0) {
-      var folderID = document.menuTarget.getAttribute("dataname");
-      var urlstr = URLForFolderID(folderID) + "/createFolder?name=" + name;
-      triggerAjaxRequest(urlstr, folderOperationCallback);
-   }
+  var name = window.prompt(labels["Name :"].decodeEntities(), "");
+  if (name && name.length > 0) {
+    var folderID = document.menuTarget.getAttribute("dataname");
+    var urlstr = URLForFolderID(folderID) + "/createFolder?name=" + name;
+    triggerAjaxRequest(urlstr, folderOperationCallback);
+  }
 }
 
 function onMenuRenameFolder(event) {
-   var name = window.prompt(labels["Enter the new name of your folder :"]
-                           .decodeEntities(),
-                           "");
-   if (name && name.length > 0) {
-      var folderID = document.menuTarget.getAttribute("dataname");
-      var urlstr = URLForFolderID(folderID) + "/renameFolder?name=" + name;
-      triggerAjaxRequest(urlstr, folderOperationCallback);
-   }
+  var name = window.prompt(labels["Enter the new name of your folder :"]
+                          .decodeEntities(),
+                          "");
+  if (name && name.length > 0) {
+    var folderID = document.menuTarget.getAttribute("dataname");
+    var urlstr = URLForFolderID(folderID) + "/renameFolder?name=" + name;
+    triggerAjaxRequest(urlstr, folderOperationCallback);
+  }
 }
 
 function onMenuDeleteFolder(event) {
-   var answer = window.confirm(labels["Do you really want to move this folder into the trash ?"].decodeEntities());
-   if (answer) {
-      var folderID = document.menuTarget.getAttribute("dataname");
-      var urlstr = URLForFolderID(folderID) + "/deleteFolder";
-      triggerAjaxRequest(urlstr, folderOperationCallback);
-   }
+  var answer = window.confirm(labels["Do you really want to move this folder into the trash ?"].decodeEntities());
+  if (answer) {
+    var folderID = document.menuTarget.getAttribute("dataname");
+    var urlstr = URLForFolderID(folderID) + "/deleteFolder";
+    triggerAjaxRequest(urlstr, folderOperationCallback);
+  }
 }
 
 function onMenuEmptyTrash(event) {
-   var folderID = document.menuTarget.getAttribute("dataname");
-   var urlstr = URLForFolderID(folderID) + "/emptyTrash";
-   triggerAjaxRequest(urlstr, folderOperationCallback);
+  var folderID = document.menuTarget.getAttribute("dataname");
+  var urlstr = URLForFolderID(folderID) + "/emptyTrash";
+  triggerAjaxRequest(urlstr, folderOperationCallback);
 }
 
 function folderOperationCallback(http) {
-   if (http.readyState == 4
-       && http.status == 204)
-      initMailboxTree();
-   else
-      window.alert(labels["Operation failed"].decodeEntities());
+  if (http.readyState == 4
+      && http.status == 204)
+    initMailboxTree();
+  else
+    window.alert(labels["Operation failed"].decodeEntities());
 }
 
 function getMenus() {
-   var menus = {}
-   menus["accountIconMenu"] = new Array(null, null, onMenuCreateFolder, null,
-                                       null, null);
-   menus["inboxIconMenu"] = new Array(null, null, null, "-", null,
-                                     onMenuCreateFolder, null, "-", null,
-                                     onMenuSharing);
-   menus["trashIconMenu"] = new Array(null, null, null, "-", null,
-                                     onMenuCreateFolder, null,
-                                     onMenuEmptyTrash, "-", null,
-                                     onMenuSharing);
-   menus["mailboxIconMenu"] = new Array(null, null, null, "-", null,
-                                       onMenuCreateFolder,
-                                       onMenuRenameFolder,
-                                       null, onMenuDeleteFolder, "-", null,
-                                       onMenuSharing);
-   menus["addressMenu"] = new Array(newContactFromEmail, newEmailTo, null);
-   menus["messageListMenu"] = new Array(onMenuOpenMessage, "-",
-                                       onMenuReplyToSender,
-                                       onMenuReplyToAll,
-                                       onMenuForwardMessage, null,
-                                       "-", "moveMailboxMenu",
-                                       "copyMailboxMenu", "label-menu",
-                                       "mark-menu", "-", null,
-                                       onMenuViewMessageSource, null,
-                                       null, onMenuDeleteMessage);
-   menus["messageContentMenu"] = new Array(onMenuReplyToSender,
-                                          onMenuReplyToAll,
-                                          onMenuForwardMessage,
-                                          null, "moveMailboxMenu",
-                                          "copyMailboxMenu",
-                                          "-", "label-menu", "mark-menu",
-                                          "-",
-                                          null, onMenuViewMessageSource,
-                                          null, null,
-                                          onMenuDeleteMessage);
-   menus["label-menu"] = new Array(null, "-", null , null, null, null , null,
-                                  null);
-   menus["mark-menu"] = new Array(null, null, null, null, "-", null, "-",
-                                 null, null, null);
-   menus["searchMenu"] = new Array(setSearchCriteria, setSearchCriteria,
-                                  setSearchCriteria, setSearchCriteria,
-                                  setSearchCriteria);
-
-   return menus;
+  var menus = {}
+  menus["accountIconMenu"] = new Array(null, null, onMenuCreateFolder, null,
+                                      null, null);
+  menus["inboxIconMenu"] = new Array(null, null, null, "-", null,
+                                    onMenuCreateFolder, null, "-", null,
+                                    onMenuSharing);
+  menus["trashIconMenu"] = new Array(null, null, null, "-", null,
+                                    onMenuCreateFolder, null,
+                                    onMenuEmptyTrash, "-", null,
+                                    onMenuSharing);
+  menus["mailboxIconMenu"] = new Array(null, null, null, "-", null,
+                                      onMenuCreateFolder,
+                                      onMenuRenameFolder,
+                                      null, onMenuDeleteFolder, "-", null,
+                                      onMenuSharing);
+  menus["addressMenu"] = new Array(newContactFromEmail, newEmailTo, null);
+  menus["messageListMenu"] = new Array(onMenuOpenMessage, "-",
+                                      onMenuReplyToSender,
+                                      onMenuReplyToAll,
+                                      onMenuForwardMessage, null,
+                                      "-", "moveMailboxMenu",
+                                      "copyMailboxMenu", "label-menu",
+                                      "mark-menu", "-", null,
+                                      onMenuViewMessageSource, null,
+                                      null, onMenuDeleteMessage);
+  menus["messageContentMenu"] = new Array(onMenuReplyToSender,
+                                         onMenuReplyToAll,
+                                         onMenuForwardMessage,
+                                         null, "moveMailboxMenu",
+                                         "copyMailboxMenu",
+                                         "-", "label-menu", "mark-menu",
+                                         "-",
+                                         null, onMenuViewMessageSource,
+                                         null, null,
+                                         onMenuDeleteMessage);
+  menus["label-menu"] = new Array(null, "-", null , null, null, null , null,
+                                 null);
+  menus["mark-menu"] = new Array(null, null, null, null, "-", null, "-",
+                                null, null, null);
+  menus["searchMenu"] = new Array(setSearchCriteria, setSearchCriteria,
+                                 setSearchCriteria, setSearchCriteria,
+                                 setSearchCriteria);
+
+  return menus;
 }
 
 addEvent(window, 'load', initMailer);
 
 function Mailbox(type, name) {
-   this.type = type;
-   this.name = name;
-   this.parentFolder = null;
-   this.children = new Array();
-   return this;
+  this.type = type;
+  this.name = name;
+  this.parentFolder = null;
+  this.children = new Array();
+  return this;
 }
 
 Mailbox.prototype.dump = function(indent) {
-   if (!indent)
-     indent = 0;
-   log(" ".repeat(indent) + this.name);
-   for (var i = 0; i < this.children.length; i++) {
-      this.children[i].dump(indent + 2);
-   }
+  if (!indent)
+    indent = 0;
+  log(" ".repeat(indent) + this.name);
+  for (var i = 0; i < this.children.length; i++) {
+    this.children[i].dump(indent + 2);
+  }
 }
 
 Mailbox.prototype.findMailboxByName = function(name) {
-   var mailbox = null;
+  var mailbox = null;
 
-   var i = 0;
-   while (!mailbox && i <this.children.length)
-      if (this.children[i].name == name)
-        mailbox = this.children[i];
-      else
-        i++;
+  var i = 0;
+  while (!mailbox && i < this.children.length)
+    if (this.children[i].name == name)
+      mailbox = this.children[i];
+    else
+      i++;
 
-   return mailbox;
+  return mailbox;
 }
 
 Mailbox.prototype.addMailbox = function(mailbox) {
-   mailbox.parentFolder = this;
-   this.children.push(mailbox);
+  mailbox.parentFolder = this;
+  this.children.push(mailbox);
 }
index b4fe4f2f07d502fd90b722d5117a52e659964956..757255c416186719aa7a159fce633c9e96b6e9e4 100644 (file)
@@ -403,7 +403,7 @@ function tasksListCallback(http) {
 }
 
 function restoreCurrentDaySelection(div) {
-  var elements = div.getElementsByTagName("a");
+  var elements = $(div).getElementsByTagName("a");
   var day = null;
   var i = 9;
   while (!day && i < elements.length)
@@ -417,10 +417,10 @@ function restoreCurrentDaySelection(div) {
       for (i = 0; i < elements.length; i++) {
         day = elements[i].day;
         if (day && day == currentDay) {
-          var td = elements[i].getParentWithTagName("td");
+          var td = $(elements[i]).getParentWithTagName("td");
           if (document.selectedDate)
             document.selectedDate.deselect();
-          td.select();
+          $(td).select();
           document.selectedDate = td;
         }
       }
index 8e39832b308694a5fd1aa775a1cd2fd73fbb80d7..91c249ab9fa746846832a89ef2420ed1839d71bc 100644 (file)
@@ -83,8 +83,13 @@ function onUserRemove(event) {
 }
 
 function subscribeToFolder(refreshCallback, refreshCallbackData) {
-   addUser(refreshCallbackData["folderName"],
-          refreshCallbackData["folder"]);
+   if (UserLogin != refreshCallbackData["folder"]) {
+      addUser(refreshCallbackData["folderName"],
+             refreshCallbackData["folder"]);
+   }
+   else
+      refreshCallbackData["window"].alert(clabels["You cannot subscribe to a folder that you own!"]
+                  .decodeEntities());
 }
 
 function openRightsForUserID(userID) {
index 1fe1004b01bbc0f4e1e4894516a78415e0dad71d..2c078deeda003b285aea8c1b2c6411c9628a3b5c 100644 (file)
@@ -19,7 +19,7 @@ function onContactKeydown(event) {
     if (this.confirmedValue)
       this.value = this.confirmedValue;
     var row = this.parentNode.parentNode.nextSibling;
-    while (!(row instanceof HTMLTableRowElement))
+    while (row && row.tagName != 'TR')
       row = row.nextSibling;
     this.blur();
     var input = $(row.cells[0]).childNodesWithTag("input")[0];
@@ -203,7 +203,7 @@ function checkAttendee() {
   this.focussed = false;
   var th = this.parentNode.parentNode;
   var tbody = th.parentNode;
-  if (this.value.trim().length == 0)
+  if (tbody && this.value.trim().length == 0)
     tbody.removeChild(th);
   else if (!this.hasfreebusy) {
     if (this.confirmedValue)
@@ -535,4 +535,4 @@ function onFreeBusyLoadHandler() {
    initializeFreebusys();
 }
 
-window.addEventListener("load", onFreeBusyLoadHandler, false);
+addEvent(window, 'load', onFreeBusyLoadHandler);
index 9b2d5dc28cd774ff2f05284c66d62b3bef133032..e6fe548b64c0e3c812f485168938dad67601721e 100644 (file)
@@ -8,12 +8,11 @@ function onPopupAttendeesWindow(event) {
 }
 
 function onSelectPrivacy(event) {
-   if (event.button == 0) {
-      var node = event.target;
+   if (event.button == 0 || (isSafari() && event.button == 1)) {
+      var node = getTarget(event);
       if (node.tagName != 'A')
-        node = node.getParentWithTagName("a");
-      node = node.childNodesWithTag("span")[0];
-
+       node = $(node).getParentWithTagName("a");
+      node = $(node).childNodesWithTag("span")[0];
       popupToolbarMenu(node, "privacy-menu");
       Event.stop(event);
 //       preventDefault(event);
index ca472c5228e3b028bbc141ef3a4a2028bdf34eb5..c4c6b2a3d679d6066e1b4c467efa7d502cefed5a 100644 (file)
@@ -3,7 +3,7 @@ function onSearchFormSubmit() {
 
   var url = (ApplicationBaseURL
             + "/foldersSearch?ldap-only=YES&search=" + searchValue.value
-            + "&type=" + window.userFolderType);
+            + "&type=" + window.opener.userFolderType);
   if (document.userFoldersRequest) {
      document.userFoldersRequest.aborted = true;
      document.userFoldersRequest.abort();
@@ -18,7 +18,7 @@ function addLineToTree(tree, parent, line) {
    var offset = 0;
 
    var nodes = line.split(";");
-   if (window.userFolderType == "user"
+   if (window.opener.userFolderType == "user"
        || nodes.length > 1) {
       var parentNode = nodes[0];
       var userInfos = parentNode.split(":");
@@ -41,7 +41,7 @@ function addLineToTree(tree, parent, line) {
       offset = nodes.length - 1;
    }
    else
-      window.alert("nope:" + window.userFolderType);
+      window.alert("nope:" + window.opener.userFolderType);
 
    return offset;
 }
@@ -95,19 +95,18 @@ function userFoldersCallback(http) {
         div.innerHTML = buildTree(http.responseText);
         var nodes = document.getElementsByClassName("node", $("d"));
         for (i = 0; i < nodes.length; i++)
-           nodes[i].addEventListener("click",
-                                     onFolderTreeItemClick, false);
+          Event.observe(nodes[i], "click", onFolderTreeItemClick.bindAsEventListener(nodes[i]));
       }
    }
 }
 
 function onConfirmFolderSelection(event) {
-   var topNode = $("d");
-   if (topNode.selectedEntry) {
+  var topNode = $("d");
+  if (topNode.selectedEntry) {
       var node = topNode.selectedEntry.parentNode;
       var folder = node.getAttribute("dataname");
       var folderName;
-      if (window.userFolderType == "user") {
+      if (window.opener.userFolderType == "user") {
         var spans = document.getElementsByClassName("nodeName",
                                                     topNode.selectedEntry);
         var email = spans[0].innerHTML;
@@ -125,14 +124,14 @@ function onConfirmFolderSelection(event) {
         email = email.replace("&gt;", ">");
         folderName = spans1[0].innerHTML + ' (' + email + ')';
       }
-      var data = { folderName: folderName, folder: folder };
-      window.opener.subscribeToFolder(window.userFolderCallback, data);
+      var data = { folderName: folderName, folder: folder, window: window };
+      window.opener.subscribeToFolder(window.opener.userFolderCallback, data);
    }
 }
 
 function initUserFoldersWindow() {
    configureSearchField();
-   $("addButton").addEventListener("click", onConfirmFolderSelection, false);
+   Event.observe($("addButton"), "click",  onConfirmFolderSelection);
 }
 
-window.addEventListener("load", initUserFoldersWindow, false);
+addEvent(window, 'load', initUserFoldersWindow);
index 188457957304a51231d5d3898f060f3aa5b804b0..7c5aa1bddb4919edcbf26093f1037abc1ac1d4cd 100644 (file)
@@ -201,14 +201,14 @@ function sanitizeMailTo(dirtyMailTo) {
 
 function openUserFolderSelector(callback, type) {
    var urlstr = ApplicationBaseURL;
-   if (urlstr[urlstr.length-1] != '/')
+   if (! urlstr.endsWith('/'))
       urlstr += '/';
    urlstr += ("../../" + UserLogin + "/Contacts/userFolders");
-   var w = window.open(urlstr, "User Selector",
+   var w = window.open(urlstr, "_blank",
                       "width=322,height=250,resizable=1,scrollbars=0");
    w.opener = window;
-   w.userFolderCallback = callback;
-   w.userFolderType = type;
+   window.userFolderCallback = callback;
+   window.userFolderType = type;
    w.focus();
 }
 
@@ -862,7 +862,7 @@ function onSearchKeyDown(event) {
   this.timer = setTimeout("onSearchFormSubmit()", 1000);
 }
 
-function onSearchFormSubmit(event) {
+function onSearchFormSubmit(event) { log("generic.onSearchFormSubmit")
    var searchValue = $("searchValue");
    var searchCriteria = $("searchCriteria");
 
@@ -895,9 +895,9 @@ function popupToolbarMenu(node, menuId) {
       hideMenu(document.currentPopupMenu);
 
    var popup = $(menuId);
-   var top = node.top + node.offsetHeight - 2;
+   var top = ($(node).getStyle('top') || 0) + node.offsetHeight - 2;
    popup.setStyle({ top: top + "px",
-                   left: node.cascadeLeftOffset() + "px",
+                   left: $(node).cascadeLeftOffset() + "px",
                    visibility: "visible" });
 
    document.currentPopupMenu = popup;
@@ -913,11 +913,11 @@ function folderSubscriptionCallback(http) {
            http.callbackData["method"](http.callbackData["data"]);
       }
       else
-        window.alert(labels["Unable to subscribe to that folder!"].decodeEntities());
+        window.alert(clabels["Unable to subscribe to that folder!"].decodeEntities());
       document.subscriptionAjaxRequest = null;
    }
    else
-      log ("ajax fuckage");
+      log ("folderSubscriptionCallback Ajax error");
 }
 
 function subscribeToFolder(refreshCallback, refreshCallbackData) {
@@ -937,7 +937,7 @@ function subscribeToFolder(refreshCallback, refreshCallbackData) {
                                                            rfCbData);
    }
    else
-      window.alert(labels["You cannot subscribe to a folder that you own!"]
+      refreshCallbackData["window"].alert(clabels["You cannot subscribe to a folder that you own!"]
                   .decodeEntities());
 }
 
@@ -948,7 +948,7 @@ function folderUnsubscriptionCallback(http) {
            http.callbackData["method"](http.callbackData["data"]);
       }
       else
-        window.alert(labels["Unable to unsubscribe from that folder!"].decodeEntities());
+        window.alert(clabels["Unable to unsubscribe from that folder!"].decodeEntities());
       document.unsubscriptionAjaxRequest = null;
    }
 }
@@ -975,7 +975,7 @@ function unsubscribeFromFolder(folder, refreshCallback, refreshCallbackData) {
                                 rfCbData);
       }
       else
-        window.alert(labels["You cannot unsubscribe from a folder that you own!"].decodeEntities());
+        window.alert(clabels["You cannot unsubscribe from a folder that you own!"].decodeEntities());
    }
 }
 
index 5d2100fac2dd69383a5d601d49181090cf106171..a3f21ac790995f83f0d7e1dfc8a448d7580d035b 100644 (file)
@@ -1,4 +1,4 @@
-/*  Prototype JavaScript framework, version 1.5.1
+/*  Prototype JavaScript framework, version 1.5.1.1
  *  (c) 2005-2007 Sam Stephenson
  *
  *  Prototype is freely distributable under the terms of an MIT-style license.
@@ -7,7 +7,7 @@
 /*--------------------------------------------------------------------------*/
 
 var Prototype = {
-  Version: '1.5.1',
+  Version: '1.5.1.1',
 
   Browser: {
     IE:     !!(window.attachEvent && !window.opera),
@@ -24,8 +24,8 @@ var Prototype = {
        document.createElement('form').__proto__)
   },
 
-  ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',
-  JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/,
+  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
 
   emptyFunction: function() { },
   K: function(x) { return x }
@@ -364,11 +364,15 @@ Object.extend(String.prototype, {
     return this.sub(filter || Prototype.JSONFilter, '#{1}');
   },
 
+  isJSON: function() {
+    var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+  },
+
   evalJSON: function(sanitize) {
     var json = this.unfilterJSON();
     try {
-      if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)))
-        return eval('(' + json + ')');
+      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
     } catch (e) { }
     throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
   },
@@ -1270,10 +1274,12 @@ if (Prototype.BrowserFeatures.XPath) {
 
 } else document.getElementsByClassName = function(className, parentElement) {
   var children = ($(parentElement) || document.body).getElementsByTagName('*');
-  var elements = [], child;
+  var elements = [], child, pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
   for (var i = 0, length = children.length; i < length; i++) {
     child = children[i];
-    if (Element.hasClassName(child, className))
+    var elementClassName = child.className;
+    if (elementClassName.length == 0) continue;
+    if (elementClassName == className || elementClassName.match(pattern))
       elements.push(Element.extend(child));
   }
   return elements;
index 97e7dd313f314475a600fcd470ffe508edc541e9..265205de69b093969c294008ecfb929512e41f5e 100644 (file)
@@ -20,6 +20,7 @@ modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
 <style>
        td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}
 </style>
+<script src="/SOGo.woa/WebServerResources/prototype.js" type="text/javascript"></script>
 <script language="JavaScript">
 
 // months as they appear in the calendar's title
@@ -110,9 +111,20 @@ function set_datetime(n_datetime, b_close) {
             ? obj_caller.gen_tsmp(dt_datetime)
             : obj_caller.gen_date(dt_datetime)
           );
-          var onChangeEvent = document.createEvent("Event");
-          onChangeEvent.initEvent("change", false, true);
-          obj_caller.target.dispatchEvent(onChangeEvent );
+          if (document.initEvent) {
+            var onChangeEvent = document.createEvent("Events");
+            onChangeEvent.initEvent("mousedown", false, true);
+            obj_caller.target.dispatchEvent(onChangeEvent);
+          }
+          else if (document.createEvent) {
+            var onChangeEvent = document.createEvent("UIEvents");
+            onChangeEvent.initEvent("mousedown", false, true);
+            obj_caller.target.dispatchEvent(onChangeEvent);
+          }
+          else {
+            // Francis: add support for IE
+            obj_caller.target.fireEvent("onmousedown");
+          }
         }
        if (b_close) window.close();
        else obj_caller.popup(dt_datetime.valueOf());