]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1302 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 14 Dec 2007 22:07:31 +0000 (22:07 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 14 Dec 2007 22:07:31 +0000 (22:07 +0000)
12 files changed:
ChangeLog
SOPE/sope-patchset-r1557.diff
SoObjects/Appointments/SOGoCalendarComponent.m
SoObjects/Appointments/product.plist
SoObjects/Mailer/SOGoDraftObject.m
UI/MailerUI/UIxMailMainFrame.h
UI/MailerUI/UIxMailMainFrame.m
UI/MailerUI/product.plist
UI/MainUI/product.plist
UI/WebServerResources/MailerUI+dTree.js
UI/WebServerResources/MailerUI.js
UI/WebServerResources/SchedulerUI.js

index debdfec734042078668c36a8587a06991707337a..4757ac4a2ddb9fa5dda723c3f2ec5b2c7f284b06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-12-14  Ludovic Marcotte <ludovic@inverse.ca>
+
+       * SoObjects/Appointments/SOGoCalendarComponent.m
+       We set headers in lowercase so that they get properly
+       encoded by SOPE.
+
+       * SoObjects/Mailer/SOGoDraftObject.m
+       Minor cleanups. 
+
+2007-12-13  Francis Lachapelle  <flachapelle@inverse.ca>
+
+       * UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame -saveFoldersStateAction])
+       ([UIxMailMainFrame -getFoldersStateAction]): new methods to get
+       and set the folders state of the user's web view.
+
 2007-12-13  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/MainUI/SOGoRootPage.m ([SOGoRootPage -crashAction]): new
index ca62e7bdff394e0c7ba0e892f265d92c4c3a8aac..85c2064b1b942bd4a86b77aee988b1fbbd80a49c 100644 (file)
@@ -874,6 +874,19 @@ Index: sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
    if (date == nil) goto failed;
  
  #if 0  
+Index: sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m
+===================================================================
+--- sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m   (révision 1557)
++++ sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m   (copie de travail)
+@@ -70,6 +70,8 @@
+     [rfc822Set setGenerator:gen forField:Fields->cc];
+     [rfc822Set setGenerator:gen forField:@"bcc"];
+     [rfc822Set setGenerator:gen forField:Fields->from];
++    [rfc822Set setGenerator:gen forField:@"reply-to"];
++    [rfc822Set setGenerator:gen forField:@"in-reply-to"];
+   }
+   
+   if ((gen = [NGMimeStringHeaderFieldGenerator headerFieldGenerator]))
 Index: sope-mime/NGMime/NGMimeBodyPart.m
 ===================================================================
 --- sope-mime/NGMime/NGMimeBodyPart.m  (révision 1557)
@@ -975,6 +988,37 @@ Index: sope-mime/NGMime/NGMimePartParser.m
    contentType = ([ctype isKindOfClass:[NGMimeType class]])
      ? ctype
      : [NGMimeType mimeType:[ctype stringValue]];
+Index: sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m
+===================================================================
+--- sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m       (révision 1557)
++++ sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m       (copie de travail)
+@@ -122,8 +122,13 @@
+     }
+     
+     if (doEnc) {
++#if NeXT_Foundation_LIBRARY
+       unsigned char iso[]     = "=?iso-8859-15?q?";
+       unsigned      isoLen    = 16;
++#else
++      unsigned char iso[]     = "=?utf-8?q?";
++      unsigned      isoLen    = 10;
++#endif
+       unsigned char isoEnd[]  = "?=";
+       unsigned      isoEndLen = 2;
+       unsigned      desLen;
+@@ -133,10 +138,10 @@
+       {
+         NSData *data;
+-#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
++#if NeXT_Foundation_LIBRARY
+         data = [tmp dataUsingEncoding:NSISOLatin1StringEncoding];
+ #else
+-        data = [tmp dataUsingEncoding:NSISOLatin9StringEncoding];
++        data = [tmp dataUsingEncoding:NSUTF8StringEncoding];
+ #endif
+         bufLen  = [data length];
 Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m
 ===================================================================
 --- sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m    (révision 1557)
index 8411b79415932bcb8ed8ac70cd108ef2e7da1478..c8ed4eb3a8ea70a3778dce28940751eaef6d9f99 100644 (file)
@@ -316,11 +316,11 @@ static BOOL sendEMailNotifications = NO;
                   * so we'll stick with multipart/mixed for the time being.
                   */
                  [headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
-                 [headerMap setObject: sender forKey: @"From"];
-                 [headerMap setObject: recipient forKey: @"To"];
+                 [headerMap setObject: sender forKey: @"from"];
+                 [headerMap setObject: recipient forKey: @"to"];
                  mailDate = [[NSCalendarDate date] rfc822DateString];
                  [headerMap setObject: mailDate forKey: @"date"];
-                 [headerMap setObject: subject forKey: @"Subject"];
+                 [headerMap setObject: subject forKey: @"subject"];
                  msg = [NGMimeMessage messageWithHeader: headerMap];
 
                  /* multipart body */
@@ -407,11 +407,11 @@ static BOOL sendEMailNotifications = NO;
           * so we'll stick with multipart/mixed for the time being.
           */
          [headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
-         [headerMap setObject: [attendee mailAddress] forKey: @"From"];
-         [headerMap setObject: [organizer mailAddress] forKey: @"To"];
+         [headerMap setObject: [attendee mailAddress] forKey: @"from"];
+         [headerMap setObject: [organizer mailAddress] forKey: @"to"];
          mailDate = [[NSCalendarDate date] rfc822DateString];
          [headerMap setObject: mailDate forKey: @"date"];
-         [headerMap setObject: [p getSubject] forKey: @"Subject"];
+         [headerMap setObject: [p getSubject] forKey: @"subject"];
          msg = [NGMimeMessage messageWithHeader: headerMap];
 
          NSLog (@"sending 'REPLY' from %@ to %@",
index 297b9b2315b8cfa7c33af837e0e11371580d63aa..af1952f610a83516aed08bf10327e14aa8ad8adc 100644 (file)
@@ -41,6 +41,7 @@
        "ModifyComponent" = ( "Owner", "Organizer" );
        "RespondToComponent" = ( "Participant", "ComponentModifier", "ComponentResponder" );
        "Access Object" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" );
+       "Change Images and Files" = ( "Owner", "Organizer", "ComponentModifier" );
        "Access Contents Information" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" );
         "WebDAV Access" = ( "Owner", "Organizer", "Participant", "ComponentModifier", "ComponentResponder", "ComponentViewer", "ComponentDAndTViewer" );
       };
index fd3ac53126275b934a798ec893b0f661a6c38767..8a9215627f1d5453334b1adb545d68022550ba45 100644 (file)
@@ -1164,20 +1164,18 @@ static BOOL        showTextAttachmentsInline  = NO;
   else if (![self isEmptyValue:from])
     [map setObjects:[map objectsForKey: @"from"] forKey: @"reply-to"];
   
-  /* add subject */
   if (inReplyTo)
     [map setObject: inReplyTo forKey: @"in-reply-to"];
 
+  /* add subject */
   if ([(s = [headers objectForKey: @"subject"]) length] > 0)
     [map setObject: [s asQPSubjectString: @"utf-8"]
         forKey: @"subject"];
-//     [map setObject: [s asQPSubjectString: @"utf-8"] forKey: @"subject"];
 
   [map setObject: [headers objectForKey: @"message-id"]
        forKey: @"message-id"];
 
   /* add standard headers */
-
   dateString = [[NSCalendarDate date] rfc822DateString];
   [map addObject: dateString forKey: @"date"];
   [map addObject: @"1.0" forKey: @"MIME-Version"];
index 70bf0198c2a51893d0cf2abb573ab9262389fa0f..1e4ecd5530992b27b62211a92d9f1340b8e00f0c 100644 (file)
 #import "../SOGoUI/UIxComponent.h"
 
 @interface UIxMailMainFrame : UIxComponent
-
+{
+  NSUserDefaults *ud;
+  NSMutableDictionary *moduleSettings;
+}
 @end
 
 #endif /* UIXMAILMAINFRAME_H */
index 94842a19ef081df0b2cab66aac5ec0d371bc8d2f..b0967759a1c1f9452891dc049b4b93aa871df6ea 100644 (file)
 
 @implementation UIxMailMainFrame
 
+- (void) _setupContext
+{
+  SOGoUser *activeUser;
+  NSString *login, *module;
+  SOGoMailAccounts *clientObject;
+
+  activeUser = [context activeUser];
+  login = [activeUser login];
+  clientObject = [self clientObject];
+
+  module = [clientObject nameInContainer];
+
+  ud = [activeUser userSettings];
+  moduleSettings = [ud objectForKey: module];
+  if (!moduleSettings)
+    {
+      moduleSettings = [NSMutableDictionary new];
+      [moduleSettings autorelease];
+    }
+  [ud setObject: moduleSettings forKey: module];
+}
+
 /* accessors */
 - (NSString *) mailAccounts
 {
   return [self redirectToLocation: newLocation];
 }
 
+- (WOResponse *) getFoldersStateAction
+{
+  NSString *expandedFolders;
+
+  [self _setupContext];
+  expandedFolders = [moduleSettings objectForKey: @"ExpandedFolders"];
+
+  return [self responseWithStatus: 200 andString: expandedFolders];
+}
+
+- (WOResponse *) saveFoldersStateAction
+{
+  WORequest *request;
+  NSString *expandedFolders;
+  
+  [self _setupContext];
+  request = [context request];
+  expandedFolders = [request formValueForKey: @"expandedFolders"];
+
+  [moduleSettings setObject: expandedFolders
+                 forKey: @"ExpandedFolders"];
+
+  [ud synchronize];
+
+  return [self responseWithStatus: 204];
+}
+
 @end /* UIxMailMainFrame */
index 0c024e62f3d5f8b292a0e5bcf9670bf583c3c131..61714cd2a726771d42ba923307deb5fcf5093cf0 100644 (file)
        compose = {
          protectedBy = "View";
          pageName    = "UIxMailMainFrame";
-         actionName = "compose";
+         actionName  = "compose";
+       };
+       foldersState = {
+         protectedBy = "View";
+         pageName    = "UIxMailMainFrame";
+         actionName  = "getFoldersState";
+       };
+       saveFoldersState = {
+         protectedBy = "View";
+         pageName    = "UIxMailMainFrame";
+         actionName  = "saveFoldersState";
        };
       };
     };
index 83342e46449deb529fba56a60b691e87d4c6e49f..af40eccd767e1df2bbede00dd5227dcbc8c662e9 100644 (file)
@@ -89,7 +89,7 @@
           protectedBy = "<public>";
           pageName = "SOGoRootPage"; 
         };
-       crash = {
+/*     crash = {
           protectedBy = "<public>";
           pageName = "SOGoRootPage";
          actionName = "crash";
           protectedBy = "<public>";
           pageName = "SOGoRootPage";
          actionName = "raisedException";
-        };
+        }; */
        connect = {
           protectedBy = "<public>";
           pageName = "SOGoRootPage";
index 42e60b4fbe76061ec291eed4016f0e1da8f437d9..a0805e5b88b6265121498b0736a5ffa26ed962a0 100644 (file)
@@ -29,8 +29,31 @@ var MailerUIdTreeExtension = {
       this._addFolder(thisCounter, folder.children[i]);
    },
    addMailAccount: function (mailAccount) {
-      this._addFolder(0, mailAccount);
-   }
+     this._addFolder(0, mailAccount);
+  },
+  setCookie: function(cookieName, cookieValue, expires, path, domain, secure) {
+    
+  },
+  getCookie: function(cookieName) {
+    return ("");
+  },
+  updateCookie: function () {
+    if (Mailer.foldersStateTimer)
+      clearTimeout(Mailer.foldersStateTimer);
+    Mailer.foldersStateTimer = setTimeout('saveFoldersState()', 3000); // 3 seconds
+  },
+  getFoldersState: function () {
+    var expandedFolders = new Array();
+    for (var n = 0; n < this.aNodes.length; n++) {
+      if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
+        expandedFolders.push(this.aNodes[n].dataname);
+      }
+    }
+    return expandedFolders.toJSON();
+  },
+  autoSync: function() {
+    this.config.useCookies = true;
+  }
 };
 
 Object.extend(dTree.prototype, MailerUIdTreeExtension);
index 97a2a289e3113e4ec9e700453215c34630e82883..9e46418e59c419dc8bf9d343de10c41e10910571 100644 (file)
@@ -14,7 +14,8 @@ var Mailer = {
  currentMailboxType: "",
  currentMessages: {},
  maxCachedMessages: 20,
- cachedMessages: new Array()
+ cachedMessages: new Array(),
+ foldersStateTimer: false
 };
 
 var usersRightsWindowHeight = 320;
@@ -450,18 +451,20 @@ function openMailbox(mailbox, reload, idx) {
     Mailer.currentMailbox = mailbox;
     var url = ApplicationBaseURL + encodeURI(mailbox) + "/view?noframe=1";
     
-    if (!reload) {
+    if (!reload || idx) {
       var messageContent = $("messageContent");
       messageContent.update();
       lastClickedRow = -1; // from generic.js
     }
     
     var currentMessage;
-    if (!idx && !reload) {
+      
+    if (!idx) {
       currentMessage = Mailer.currentMessages[mailbox];
       if (currentMessage) {
-       loadMessage(currentMessage);
        url += '&pageforuid=' + currentMessage;
+       if (!reload)
+         loadMessage(currentMessage);
       }
     }
 
@@ -1254,7 +1257,7 @@ function initMailer(event) {
     initMailboxTree();
     initMessageCheckTimer();
   }
-
+  
   // Default sort options
   sorting["attribute"] = "date";
   sorting["ascending"] = false;
@@ -1434,6 +1437,7 @@ function onLoadMailboxesCallback(http) {
        updateMailboxTreeInPage();
        updateMailboxMenus();
        checkAjaxRequestsState();
+       getFoldersState();
       }
     }
   }
@@ -1482,6 +1486,45 @@ function buildMailboxes(accountName, encoded) {
   return account;
 }
 
+function getFoldersState() {
+  if (mailAccounts.length > 0) {
+    var urlstr =  ApplicationBaseURL + "foldersState";
+    triggerAjaxRequest(urlstr, getFoldersStateCallback);
+  }
+}
+
+function getFoldersStateCallback(http) {
+  if (http.readyState == 4
+      && http.status == 200) {
+    if (http.responseText.length > 0) {
+      // The response text is a JSOn representation
+      // of the folders that were left opened.
+      var data = http.responseText.evalJSON(true);
+      for (var i = 1; i < mailboxTree.aNodes.length; i++) {
+       if ($(data).indexOf(mailboxTree.aNodes[i].dataname) > 0)
+         // If the folder is found, open it
+         mailboxTree.o(i);
+      }
+    }
+  }
+  mailboxTree.autoSync();
+}
+
+function saveFoldersState() {
+  if (mailAccounts.length > 0) {
+    var foldersState = mailboxTree.getFoldersState();
+    var urlstr =  ApplicationBaseURL + "saveFoldersState" + "?expandedFolders=" + foldersState;
+    triggerAjaxRequest(urlstr, saveFoldersStateCallback);
+  }
+}
+
+function saveFoldersStateCallback(http) {
+  if (http.readyState == 4
+      && isHttpStatus204(http.status)) {
+    log ("folders state saved");
+  }
+}
+
 function onMenuCreateFolder(event) {
   var name = window.prompt(labels["Name :"], "");
   if (name && name.length > 0) {
index 273a21e5fc2fa618bb009baae7f5dcacd26f0bea..3ac2a758ba8ab725aa5897c79a17e4e6f848f71c 100644 (file)
@@ -357,12 +357,12 @@ function eventsListCallback(http) {
        td = document.createElement("td");
        row.appendChild(td);
        Event.observe(td, "mousedown", listRowMouseDownHandler, true);
-       td.appendChild(document.createTextNode(data[i][9]));
+       td.appendChild(document.createTextNode(data[i][10]));
 
        td = document.createElement("td");
        row.appendChild(td);
        Event.observe(td, "mousedown", listRowMouseDownHandler, true);
-       td.appendChild(document.createTextNode(data[i][10]));
+       td.appendChild(document.createTextNode(data[i][11]));
       
        td = document.createElement("td");
        row.appendChild(td);