]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1399 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 17 Apr 2008 17:26:17 +0000 (17:26 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 17 Apr 2008 17:26:17 +0000 (17:26 +0000)
28 files changed:
ChangeLog
Main/SOGo.m
SOPE/sope-mime-nosort.diff [new file with mode: 0644]
SoObjects/Appointments/SOGoAppointmentFolder.m
SoObjects/Contacts/SOGoFolder+CardDAV.m
UI/MailPartViewers/UIxMailPartHTMLViewer.m
UI/MailerUI/UIxMailEditor.m
UI/Templates/MailerUI/UIxMailEditor.wox
UI/Templates/SchedulerUI/UIxAttendeesEditor.wox
UI/WebServerResources/ContactsUI.js
UI/WebServerResources/HTMLElement.js
UI/WebServerResources/HTMLInputElement.js
UI/WebServerResources/MailerUI.js
UI/WebServerResources/SOGoDragHandles.js
UI/WebServerResources/SOGoRootPage.js
UI/WebServerResources/SchedulerUI.js
UI/WebServerResources/UIxAclEditor.js
UI/WebServerResources/UIxAppointmentEditor.js
UI/WebServerResources/UIxAttendeesEditor.css
UI/WebServerResources/UIxAttendeesEditor.js
UI/WebServerResources/UIxCalUserRightsEditor.js
UI/WebServerResources/UIxComponentEditor.js
UI/WebServerResources/UIxContactsUserRightsEditor.js
UI/WebServerResources/UIxMailEditor.js
UI/WebServerResources/UIxRecurrenceEditor.js
UI/WebServerResources/UIxTaskEditor.js
UI/WebServerResources/minus.png [new file with mode: 0644]
UI/WebServerResources/plus.png [new file with mode: 0644]

index a96d48cbdb62ab2e8e53c203044474fc3dd044e8..243b773d1df3b5249e6e2f9cfd21062f1d28bba4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2008-04-15  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * UI/MailPartViewers/UIxMailPartHTMLViewer.m
+       ([_UIxHTMLMailContentHandler -characters:_charslength:_len])
+       ([_UIxHTMLMailContentHandler -comment:_charslength:_len]): don't
+       cast the unichar data to char, to avoid issues with endianness
+       which prevents the CSS from being parsed properly.
+
+       * UI/MailerUI/UIxMailEditor.m ([UIxMailEditor -isMailReply]): new
+       method that returns the JS values "true" or "false" as strings is
+       the mail has a non-null count of recipients.
+
+2008-04-14  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/Appointments/SOGoAppointmentFolder.m ([SOGoAppointmentFolder -davCalendarQuery:queryContext])
+       ([SOGoAppointmentFolder -davCalendarMultiget:queryContext]):
+       deduce the cname of objects even if we are using hostless urls.
+
 2008-03-31  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/SOGoUI/SOGoACLAdvisory.m ([SOGoACLAdvisory -resourceName]):
index afb19b095bf06301840945c788400c385a64d516..f61c14668256dbd3d1df126574e38f27a6b28a15 100644 (file)
@@ -392,6 +392,7 @@ static BOOL debugObjectAllocation = NO;
   static NSArray *runLoopModes = nil;
   WOResponse *resp;
 
+//   sleep (1);
   cache = [SOGoCache sharedCache];
   resp = [super dispatchRequest: _request];
   [SOGoCache killCache];
diff --git a/SOPE/sope-mime-nosort.diff b/SOPE/sope-mime-nosort.diff
new file mode 100644 (file)
index 0000000..1ea4bf5
--- /dev/null
@@ -0,0 +1,69 @@
+Index: sope-mime/NGImap4/NGImap4Client.m
+===================================================================
+--- sope-mime/NGImap4/NGImap4Client.m  (révision 1620)
++++ sope-mime/NGImap4/NGImap4Client.m  (copie de travail)
+@@ -1054,17 +1054,18 @@
+   if (![_encoding   isNotNull]) _encoding   = @"UTF-8";
+   if (![_qualString isNotNull]) _qualString = @" ALL";
++
++  sortStr = @"FETCH 1:* UID";
++//   sortStr = [NSMutableString stringWithCapacity:128];
+   
+-  sortStr = [NSMutableString stringWithCapacity:128];
++//   [sortStr appendString:@"UID SORT ("];
++//   if (_sort != nil) [sortStr appendString:_sort];
++//   [sortStr appendString:@") "];
+   
+-  [sortStr appendString:@"UID SORT ("];
+-  if (_sort != nil) [sortStr appendString:_sort];
+-  [sortStr appendString:@") "];
++//   [sortStr appendString:_encoding];   /* eg 'UTF-8' */
+   
+-  [sortStr appendString:_encoding];   /* eg 'UTF-8' */
+-  
+   /* Note: this is _space sensitive_! to many spaces lead to error! */
+-  [sortStr appendString:_qualString]; /* eg ' ALL' or ' TEXT "abc"' */
++//   [sortStr appendString:_qualString]; /* eg ' ALL' or ' TEXT "abc"' */
+   
+   return [self->normer normalizeSortResponse:[self processCommand:sortStr]];
+ }
+Index: sope-mime/NGImap4/NGImap4Connection.m
+===================================================================
+--- sope-mime/NGImap4/NGImap4Connection.m      (révision 1620)
++++ sope-mime/NGImap4/NGImap4Connection.m      (copie de travail)
+@@ -456,7 +456,7 @@
+     return nil;
+   }
+   
+-  uids = [result valueForKey:@"sort"];
++  uids = [result valueForKey:@"fetch"];
+   if (![uids isNotNull]) {
+     [self errorWithFormat:@"got no UIDs for URL: %@: %@", _url, result];
+     return nil;
+Index: sope-mime/NGImap4/NGImap4ResponseNormalizer.m
+===================================================================
+--- sope-mime/NGImap4/NGImap4ResponseNormalizer.m      (révision 1620)
++++ sope-mime/NGImap4/NGImap4ResponseNormalizer.m      (copie de travail)
+@@ -148,12 +148,18 @@
+   /* filter for sort response (search  : NSArray (msn)) */
+   id                  obj;
+   NSMutableDictionary *result;
++  NSMutableArray *uids;
++  NSEnumerator *fetchEnum;
+   result = [self normalizeResponse:_map];
++  uids = [NSMutableArray array];
++
++  fetchEnum = [_map objectEnumeratorForKey:@"fetch"];
++  while ((obj = [fetchEnum nextObject]))
++    [uids addObject: [obj objectForKey: @"uid"]];
+   
+-  if ((obj = [[_map objectEnumeratorForKey:@"sort"] nextObject]) != nil)
+-    [result setObject:obj forKey:@"sort"];
+-  
++  [result setObject: uids forKey:@"fetch"];
++
+   return result;
+ }
index 7824aca9d3b0d4eb2aab870dadfdc05f28743c0b..b7760034757203cda30973a0b9304330ce372ea8 100644 (file)
@@ -494,16 +494,29 @@ static NSNumber   *sharedYes = nil;
   component = nil;
 
   realBaseURL = [NSURL URLWithString: baseURL];
-  componentURL = [[NSURL URLWithString: url
-                        relativeToURL: realBaseURL]
-                  standardizedURL];
-  componentURLPath = [componentURL absoluteString];
-  if ([componentURLPath rangeOfString: [realBaseURL absoluteString]].location
-      != NSNotFound)
+  if (realBaseURL) /* url has a host part */
     {
-      urlComponents = [componentURLPath componentsSeparatedByString: @"/"];
-      cName = [urlComponents objectAtIndex: [urlComponents count] - 1];
-      component = [NSDictionary dictionaryWithObject: cName forKey: @"c_name"];
+      componentURL = [[NSURL URLWithString: url
+                            relativeToURL: realBaseURL]
+                      standardizedURL];
+      componentURLPath = [componentURL absoluteString];
+      if ([componentURLPath rangeOfString: [realBaseURL absoluteString]].location
+         != NSNotFound)
+       {
+         urlComponents = [componentURLPath componentsSeparatedByString: @"/"];
+         cName = [urlComponents objectAtIndex: [urlComponents count] - 1];
+         component = [NSDictionary dictionaryWithObject: cName forKey: @"c_name"];
+       }
+    }
+  else
+    {
+      if ([url hasPrefix: baseURL])
+       {
+         urlComponents = [[url stringByDeletingPrefix: baseURL]
+                           componentsSeparatedByString: @"/"];
+         cName = [urlComponents objectAtIndex: [urlComponents count] - 1];
+         component = [NSDictionary dictionaryWithObject: cName forKey: @"c_name"];
+       }
     }
 
   return component;
index 8d2fb90ee47edf3e81d9865059c3103305cf65db..bc2518a90cffce2eeace930419089acce7685d88 100644 (file)
   NSDictionary *currentFilter, *contact;
   NSEnumerator *contacts;
   NSString *baseURL;
-  SOGoObject <SOGoContactFolder> *o;
 
-  o = (id <SOGoContactFolder>) self;
-  baseURL = [o baseURLInContext: localContext];
+  baseURL = [self baseURLInContext: localContext];
 
   max = [filters count];
   for (count = 0; count < max; count++)
     {
       currentFilter = [filters objectAtIndex: count];
-      contacts = [[o lookupContactsWithFilter: [[currentFilter allValues] lastObject]
-                    sortBy: @"c_givenname"
-                    ordering: NSOrderedDescending]
+      contacts = [[self lookupContactsWithFilter: [[currentFilter allValues] lastObject]
+                       sortBy: @"c_givenname"
+                       ordering: NSOrderedDescending]
                   objectEnumerator];
       
       while ((contact = [contacts nextObject]))
-       [o appendObject: contact
-          withBaseURL: baseURL
-          toREPORTResponse: response];
+       [self appendObject: contact
+             withBaseURL: baseURL
+             toREPORTResponse: response];
     }
 }
 
index 94c7055de4166741d238ccef1f19276eded4b4e2..9123ca8680af93a7cf0f261edfb22981e2e2e73f 100644 (file)
       currentChar = _chars + count;
       if (inCSSDeclaration)
         {
-          if (*(char *) currentChar == '}')
+          if (*currentChar == '}')
             {
               inCSSDeclaration = NO;
               hasEmbeddedCSS = NO;
         }
       else
         {
-          if (*(char *) currentChar == '{')
+          if (*currentChar == '{')
             inCSSDeclaration = YES;
-          if (*(char *) currentChar == ',')
+          if (*currentChar == ',')
             hasEmbeddedCSS = NO;
           else if (!hasEmbeddedCSS)
             {
-              if (*(char *) currentChar == '@')
+              if (*currentChar == '@')
                 hasEmbeddedCSS = YES;
               else
-                if (*(char *) currentChar > 32)
+                if (*currentChar > 32)
                   {
                     [css appendString: [NSString stringWithCharacters: start
                                                  length: (currentChar - start)]];
index 18e2bd8a0c3ef21fd35646e224606e5eed67f0ee..39d7f984813d436bf645bbf5932a56a240fa7d57 100644 (file)
@@ -121,6 +121,10 @@ static NSArray *infoKeys = nil;
 }
 
 /* accessors */
+- (NSString *) isMailReply
+{
+  return ([to count] > 0 ? @"true" : @"false");
+}
 
 - (void) setFrom: (NSString *) newFrom
 {
index abda2830b21ce7aa61566f42d45b32c0eb97abaf..7753c0b3d76ff3728f105d34c31a0356077b3645 100644 (file)
@@ -11,6 +11,9 @@
   title="panelTitle"
   const:popup="YES"
   const:jsFiles="UIxMailToSelection.js">
+  <script type="text/javascript">
+    var mailIsReply = <var:string value="isMailReply"/>;
+  </script>
   <div class="menu" id="attachmentsMenu">
     <ul>
       <li><var:string label:value="Open"/></li>
index ae58f71f7542c5c7a8aef19284aa917a7ddb6747..b2367908d3010665f9e7740a54896ca67412b3d9 100644 (file)
@@ -83,8 +83,8 @@
              ><var:string label:value="Free" /></li>
          <li><span class="colorBox busy"><!-- spacer --></span
              ><var:string label:value="Busy" /></li>
-         <li><span class="colorBox maybe-busy"><!-- spacer --></span
-             ><var:string label:value="Maybe busy" /></li>
+<!--     li><span class="colorBox maybe-busy">\- spacer -\->/span -->
+<!--         >var:string label:value="Maybe busy" />/li> -->
          <li><span class="colorBox noFreeBusy"><!-- spacer --></span
              ><var:string label:value="No free-busy information" /></li>
        </ul>
index b139ee3a462f1223c8f6cba3b2904f339afedad4..a9155fad4f3794d37a330281a191e12df4d356c4 100644 (file)
 /* JavaScript for SOGoContacts */
 
 var cachedContacts = new Array();
-var currentContactFolder = null;
+var currentAddressBook = null;
 
 var usersRightsWindowHeight = 200;
 var usersRightsWindowWidth = 450;
 
 function validateEditorInput(sender) {
-   var errortext = "";
-   var field;
+  var errortext = "";
+  var field;
   
-   field = document.pageform.subject;
-   if (field.value == "")
-      errortext = errortext + labels.error_missingsubject + "\n";
+  field = document.pageform.subject;
+  if (field.value == "")
+    errortext = errortext + labels.error_missingsubject + "\n";
 
-   if (!hasRecipients())
-      errortext = errortext + labels.error_missingrecipients + "\n";
+  if (!hasRecipients())
+    errortext = errortext + labels.error_missingrecipients + "\n";
   
-   if (errortext.length > 0) {
-      alert(labels.error_validationfailed + ":\n"
-            + errortext);
-      return false;
-   }
-   return true;
+  if (errortext.length > 0) {
+    alert(labels.error_validationfailed + ":\n"
+         + errortext);
+    return false;
+  }
+  return true;
 }
 
 function openContactsFolder(contactsFolder, reload, idx) {
-   if ((contactsFolder && contactsFolder != currentContactFolder)
-       || reload) {
-      currentContactFolder = contactsFolder;
-      var url = URLForFolderID(currentContactFolder) +
-         "/view?noframe=1";
-
-      var searchValue = search["value"];
-      if (searchValue && searchValue.length > 0)
-         url += ("&search=" + search["criteria"]
-                 + "&value=" + escape(searchValue.utf8encode()));
-      var sortAttribute = sorting["attribute"];
-      if (sortAttribute && sortAttribute.length > 0)
-         url += ("&sort=" + sorting["attribute"]
-                 + "&asc=" + sorting["ascending"]);
-
-      var selection;
-      if (contactsFolder == currentContactFolder) {
-         var contactsList = $("contactsList");
-         if (contactsList)
-            selection = contactsList.getSelectedRowsId();
-         //        else
-         //           window.alert("no contactsList");
-      }
-      else
-         selection = null;
-
-      if (document.contactsListAjaxRequest) {
-         document.contactsListAjaxRequest.aborted = true;
-         document.contactsListAjaxRequest.abort();
-      }
-      document.contactsListAjaxRequest
-         = triggerAjaxRequest(url, contactsListCallback, selection);
-   }
+  if ((contactsFolder && contactsFolder != currentAddressBook)
+      || reload) {
+    currentAddressBook = contactsFolder;
+    var url = URLForFolderID(currentAddressBook) +
+      "/view?noframe=1";
+
+    var searchValue = search["value"];
+    if (searchValue && searchValue.length > 0)
+      url += ("&search=" + search["criteria"]
+             + "&value=" + escape(searchValue.utf8encode()));
+    var sortAttribute = sorting["attribute"];
+    if (sortAttribute && sortAttribute.length > 0)
+      url += ("&sort=" + sorting["attribute"]
+             + "&asc=" + sorting["ascending"]);
+
+    var selection;
+    if (contactsFolder == currentAddressBook) {
+      var contactsList = $("contactsList");
+      if (contactsList)
+       selection = contactsList.getSelectedRowsId();
+      //        else
+      //           window.alert("no contactsList");
+    }
+    else
+      selection = null;
+
+    if (document.contactsListAjaxRequest) {
+      document.contactsListAjaxRequest.aborted = true;
+      document.contactsListAjaxRequest.abort();
+    }
+    document.contactsListAjaxRequest
+      = triggerAjaxRequest(url, contactsListCallback, selection);
+  }
 }
 
 function openContactsFolderAtIndex(element) {
-   var idx = element.getAttribute("idx");
-   var url = URLForFolderID(currentContactFolder) + "/view?noframe=1&idx=" + idx;
+  var idx = element.getAttribute("idx");
+  var url = URLForFolderID(currentAddressBook) + "/view?noframe=1&idx=" + idx;
 
-   if (document.contactsListAjaxRequest) {
-      document.contactsListAjaxRequest.aborted = true;
-      document.contactsListAjaxRequest.abort();
-   }
-   document.contactsListAjaxRequest
-      = triggerAjaxRequest(url, contactsListCallback);
+  if (document.contactsListAjaxRequest) {
+    document.contactsListAjaxRequest.aborted = true;
+    document.contactsListAjaxRequest.abort();
+  }
+  document.contactsListAjaxRequest
+    = triggerAjaxRequest(url, contactsListCallback);
 }
 
 function contactsListCallback(http) {
-   if (http.readyState == 4) {
-      if (http.status == 200) {
-         document.contactsListAjaxRequest = null;
-
-         var table = $("contactsList");
-         if (table) {
-            // Update table
-            var data = http.responseText;
-            var html = data.replace(/^(.*\n)*.*(<table(.*\n)*)$/, "$2");
-            var tbody = table.tBodies[0];
-            var tmp = document.createElement('div');
-            $(tmp).update(html);
-            table.replaceChild($(tmp).select("table tbody")[0], tbody);
-
-            var rows = table.tBodies[0].rows;
-            for (var i = 0; i < rows.length; i++) {
-               Event.observe(rows[i], "mousedown", onRowClick);
-               Event.observe(rows[i], "dblclick", onContactRowDblClick.bindAsEventListener(rows[i]));
-               Event.observe(rows[i], "selectstart", listRowMouseDownHandler);
-               Event.observe(rows[i], "contextmenu", onContactContextMenu.bindAsEventListener(rows[i]));
-            }
-         }
-         else {
-            // Add table (doesn't happen .. yet)
-            var div = $("contactsListContent");
-            div.update(http.responseText);
-            table = $("contactsList");
-            configureSortableTableHeaders(table);
-            TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
-         }
-
-         if (sorting["attribute"] && sorting["attribute"].length > 0) {
-            var sortHeader;
-            if (sorting["attribute"] == "displayName")
-               sortHeader = $("nameHeader");
-            else if (sorting["attribute"] == "mail")
-               sortHeader = $("mailHeader");
-            else if (sorting["attribute"] == "screenName")
-               sortHeader = $("screenNameHeader");
-            else if (sorting["attribute"] == "org")
-               sortHeader = $("orgHeader");
-            else if (sorting["attribute"] == "phone")
-               sortHeader = $("phoneHeader");
-            else
-               sortHeader = null;
-       
-            if (sortHeader) {
-               var sortImages = $(table.tHead).select(".sortImage");
-               $(sortImages).each(function(item) {
-                     item.remove();
-                  });
-
-               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";
-            }
-         }
-
-         var selected = http.callbackData;
-         if (selected) {
-            for (var i = 0; i < selected.length; i++) {
-               var row = $(selected[i]);
-               if (row)
-                  row.selectElement();
-            }
-         }
+  if (http.readyState == 4) {
+    if (http.status == 200) {
+      document.contactsListAjaxRequest = null;
+
+      var table = $("contactsList");
+      if (table) {
+       // Update table
+       var data = http.responseText;
+       var html = data.replace(/^(.*\n)*.*(<table(.*\n)*)$/, "$2");
+       var tbody = table.tBodies[0];
+       var tmp = document.createElement('div');
+       $(tmp).update(html);
+       table.replaceChild($(tmp).select("table tbody")[0], tbody);
+
+       var rows = table.tBodies[0].rows;
+       for (var i = 0; i < rows.length; i++) {
+         rows[i].observe("mousedown", onRowClick);
+         rows[i].observe("dblclick", onContactRowDblClick);
+         rows[i].observe("selectstart", listRowMouseDownHandler);
+         rows[i].observe("contextmenu", onContactContextMenu);
+       }
       }
       else {
-         var table = $("contactsList");
-         if (table) {
-            var sortImages = $(table.tHead).select(".sortImage");
-            $(sortImages).each(function(item) {
-                  item.remove();
-               });
-            var tBody = $(table.tBodies[0]);
-            var length = tBody.rows.length;
-            for (var i = length - 1; i > -1; i--)
-               tBody.removeChild(tBody.rows[i]);
-         }
+       // Add table (doesn't happen .. yet)
+       var div = $("contactsListContent");
+       div.update(http.responseText);
+       table = $("contactsList");
+       configureSortableTableHeaders(table);
+       TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
+      }
+
+      if (sorting["attribute"] && sorting["attribute"].length > 0) {
+       var sortHeader;
+       if (sorting["attribute"] == "displayName")
+         sortHeader = $("nameHeader");
+       else if (sorting["attribute"] == "mail")
+         sortHeader = $("mailHeader");
+       else if (sorting["attribute"] == "screenName")
+         sortHeader = $("screenNameHeader");
+       else if (sorting["attribute"] == "org")
+         sortHeader = $("orgHeader");
+       else if (sorting["attribute"] == "phone")
+         sortHeader = $("phoneHeader");
+       else
+         sortHeader = null;
+       
+       if (sortHeader) {
+         var sortImages = $(table.tHead).select(".sortImage");
+         $(sortImages).each(function(item) {
+             item.remove();
+           });
+
+         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";
+       }
+      }
+
+      var selected = http.callbackData;
+      if (selected) {
+       for (var i = 0; i < selected.length; i++) {
+         var row = $(selected[i]);
+         if (row)
+           row.selectElement();
+       }
+      }
+    }
+    else {
+      var table = $("contactsList");
+      if (table) {
+       var sortImages = $(table.tHead).select(".sortImage");
+       $(sortImages).each(function(item) {
+           item.remove();
+         });
+       var tBody = $(table.tBodies[0]);
+       var length = tBody.rows.length;
+       for (var i = length - 1; i > -1; i--)
+         tBody.removeChild(tBody.rows[i]);
       }
-   }
-   else
-      log ("ajax problem 1: status = " + http.status);
+    }
+  }
+  else
+    log ("ajax problem 1: status = " + http.status);
 }
 
-function onContactFoldersContextMenu(event) {
-   var menu = $("contactFoldersMenu");
-   Event.observe(menu, "mousedown", onContactFoldersContextMenuHide, false);
-   popupMenu(event, "contactFoldersMenu", this);
+function onAddressBooksContextMenu(event) {
+  var menu = $("contactFoldersMenu");
+  menu.observe("mousedown", onAddressBooksContextMenuHide);
+  popupMenu(event, "contactFoldersMenu", this);
 
-   var topNode = $("contactFolders");
-   var selectedNodes = topNode.getSelectedRows();
-   topNode.menuSelectedRows = selectedNodes;
-   for (var i = 0; i < selectedNodes.length; i++)
-      $(selectedNodes[i]).deselect();
-   topNode.menuSelectedEntry = this;
-   $(this).selectElement();
+  var topNode = $("contactFolders");
+  var selectedNodes = topNode.getSelectedRows();
+  topNode.menuSelectedRows = selectedNodes;
+  for (var i = 0; i < selectedNodes.length; i++)
+    $(selectedNodes[i]).deselect();
+  topNode.menuSelectedEntry = this;
+  $(this).selectElement();
 }
 
 function onContactContextMenu(event) {
-   var menu = $("contactMenu");
-   var topNode = $('contactsList');
-   var selectedNodes = topNode.getSelectedRows();
+  var menu = $("contactMenu");
+  var topNode = $('contactsList');
+  var selectedNodes = topNode.getSelectedRows();
 
-   if (selectedNodes.length > 1) {
-      // TODO: Add support for selection of multiple contacts
-   }
-   else {
-      Event.observe(menu, "hideMenu", onContactContextMenuHide);
-      popupMenu(event, "contactMenu", this);
-   }
+  if (selectedNodes.length > 1) {
+    // TODO: Add support for selection of multiple contacts
+  }
+  else {
+    menu.observe("hideMenu", onContactContextMenuHide);
+    popupMenu(event, "contactMenu", this);
+  }
 }
 
 function onContactContextMenuHide(event) {
-   var topNode = $("contactsList");
-
-   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]).selectElement();
-      topNode.menuSelectedRows = null;
-   }
-}
-
-function onContactFoldersContextMenuHide(event) {
-   var topNode = $("contactFolders");
-
-   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].selectElement();
-      topNode.menuSelectedRows = null;
-   }
+  var topNode = $("contactsList");
+
+  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]).selectElement();
+    topNode.menuSelectedRows = null;
+  }
+}
+
+function onAddressBooksContextMenuHide(event) {
+  var topNode = $("contactFolders");
+
+  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].selectElement();
+    topNode.menuSelectedRows = null;
+  }
 }
 
 function onFolderMenuHide(event) {
-   var topNode = $('d');
+  var topNode = $('d');
 
-   if (topNode.menuSelectedEntry) {
-      topNode.menuSelectedEntry.deselect();
-      topNode.menuSelectedEntry = null;
-   }
-   if (topNode.selectedEntry)
-      topNode.selectedEntry.selectElement();
+  if (topNode.menuSelectedEntry) {
+    topNode.menuSelectedEntry.deselect();
+    topNode.menuSelectedEntry = null;
+  }
+  if (topNode.selectedEntry)
+    topNode.selectedEntry.selectElement();
 }
 
 function loadContact(idx) {
-   if (document.contactAjaxRequest) {
-      document.contactAjaxRequest.aborted = true;
-      document.contactAjaxRequest.abort();
-   }
-
-   if (cachedContacts[currentContactFolder + "/" + idx]) {
-      var div = $('contactView');
-      div.innerHTML = cachedContacts[currentContactFolder + "/" + idx];
-   }
-   else {
-      var url = (URLForFolderID(currentContactFolder)
-                 + "/" + idx + "/view?noframe=1");
-      document.contactAjaxRequest
-         = triggerAjaxRequest(url, contactLoadCallback, idx);
-   }
+  if (document.contactAjaxRequest) {
+    document.contactAjaxRequest.aborted = true;
+    document.contactAjaxRequest.abort();
+  }
+
+  if (cachedContacts[currentAddressBook + "/" + idx]) {
+    var div = $('contactView');
+    div.innerHTML = cachedContacts[currentAddressBook + "/" + idx];
+  }
+  else {
+    var url = (URLForFolderID(currentAddressBook)
+              + "/" + idx + "/view?noframe=1");
+    document.contactAjaxRequest
+      = triggerAjaxRequest(url, contactLoadCallback, idx);
+  }
 }
 
 function contactLoadCallback(http) {
-   var div = $('contactView');
-
-   if (http.readyState == 4
-       && http.status == 200) {
-      document.contactAjaxRequest = null;
-      var content = http.responseText;
-      cachedContacts[currentContactFolder + "/" + http.callbackData] = content;
-      div.innerHTML = content;
-   }
-   else
-      log ("ajax problem 2: " + http.status);
+  var div = $('contactView');
+
+  if (http.readyState == 4
+      && http.status == 200) {
+    document.contactAjaxRequest = null;
+    var content = http.responseText;
+    cachedContacts[currentAddressBook + "/" + http.callbackData] = content;
+    div.innerHTML = content;
+  }
+  else
+    log ("ajax problem 2: " + http.status);
 }
 
 var rowSelectionCount = 0;
@@ -268,595 +268,596 @@ 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);
 }
 
 /* contact menu entries */
 function onContactRowDblClick(event) {
-   var contactId = this.getAttribute('id');
+  var contactId = this.getAttribute('id');
 
-   openContactWindow(URLForFolderID(currentContactFolder)
-                     + "/" + contactId + "/edit", contactId);
+  openContactWindow(URLForFolderID(currentAddressBook)
+                   + "/" + contactId + "/edit", contactId);
 
-   return false;
+  return false;
 }
 
 function onContactSelectionChange(event) {
-   var rows = this.getSelectedRowsId();
+  var rows = this.getSelectedRowsId();
   
-   if (rows.length == 1) {
-      var node = $(rows[0]);
-      loadContact(node.getAttribute('id'));
-   }
-   else if (rows.length > 1) {
-      $('contactView').update();
-   }
+  if (rows.length == 1) {
+    var node = $(rows[0]);
+    loadContact(node.getAttribute('id'));
+  }
+  else if (rows.length > 1) {
+    $('contactView').update();
+  }
 }
 
 function onMenuEditContact(event) {
-   var contactId = document.menuTarget.getAttribute('id');
+  var contactId = document.menuTarget.getAttribute('id');
 
-   openContactWindow(URLForFolderID(currentContactFolder)
-                     + "/" + contactId + "/edit", contactId);
+  openContactWindow(URLForFolderID(currentAddressBook)
+                   + "/" + contactId + "/edit", contactId);
 }
 
 function onMenuWriteToContact(event) {
-   var contactId = document.menuTarget.getAttribute('id');
+  var contactId = document.menuTarget.getAttribute('id');
 
-   openMailComposeWindow(ApplicationBaseURL + currentContactFolder
-                         + "/" + contactId + "/write");
+  openMailComposeWindow(ApplicationBaseURL + currentAddressBook
+                       + "/" + contactId + "/write");
 
-   if (document.body.hasClassName("popup"))
-      window.close();
+  if (document.body.hasClassName("popup"))
+    window.close();
 }
 
 function onMenuAIMContact(event) {
-   var contactRow = $(document.menuTarget.getAttribute('id'));
-   var aimCell = contactRow.down('td', 2);
+  var contactRow = $(document.menuTarget.getAttribute('id'));
+  var aimCell = contactRow.down('td', 2);
 
-   window.location.href = "aim:goim?ScreenName=" + aimCell.firstChild.nodeValue;
+  window.location.href = "aim:goim?ScreenName=" + aimCell.firstChild.nodeValue;
 }
 
 function onMenuDeleteContact(event) {
-   uixDeleteSelectedContacts(this);
+  uixDeleteSelectedContacts(this);
 }
 
 function onToolbarEditSelectedContacts(event) {
-   var contactsList = $('contactsList');
-   var rows = contactsList.getSelectedRowsId();
+  var contactsList = $('contactsList');
+  var rows = contactsList.getSelectedRowsId();
 
-   if (rows.length == 0) {
-      window.alert(labels["Please select a contact."]);
-      return false;
-   }
+  if (rows.length == 0) {
+    window.alert(labels["Please select a contact."]);
+    return false;
+  }
 
-   for (var i = 0; i < rows.length; i++) {
-      openContactWindow(URLForFolderID(currentContactFolder)
-                        + "/" + rows[i] + "/edit", rows[i]);
-   }
+  for (var i = 0; i < rows.length; i++) {
+    openContactWindow(URLForFolderID(currentAddressBook)
+                     + "/" + rows[i] + "/edit", rows[i]);
+  }
 
-   return false;
+  return false;
 }
 
 function onToolbarWriteToSelectedContacts(event) {
-   var contactsList = $('contactsList');
-   var rows = contactsList.getSelectedRowsId();
-   var rowsWithEmail = 0;
-
-   if (rows.length == 0) {
-      openMailComposeWindow(ApplicationBaseURL + "Mail/compose");
-      return false;
-   }
-
-   for (var i = 0; i < rows.length; i++) {
-      var emailCell = $(rows[i]).down('td', 1);
-      if (emailCell.firstChild) { // .nodeValue is the contact email address
-         rowsWithEmail++;
-         openMailComposeWindow(ApplicationBaseURL + currentContactFolder
-                               + "/" + rows[i] + "/write");
-      }
-   }
+  var contactsList = $('contactsList');
+  var rows = contactsList.getSelectedRowsId();
+  var rowsWithEmail = 0;
 
-   if (rowsWithEmail == 0) {
-      window.alert(labels["The selected contact has no email address."]);
-   }
-   else if (document.body.hasClassName("popup"))
-      window.close();
+  if (rows.length == 0) {
+    openMailComposeWindow(ApplicationBaseURL + "Mail/compose");
+    return false;
+  }
+
+  for (var i = 0; i < rows.length; i++) {
+    var emailCell = $(rows[i]).down('td', 1);
+    if (emailCell.firstChild) { // .nodeValue is the contact email address
+      rowsWithEmail++;
+      openMailComposeWindow(ApplicationBaseURL + currentAddressBook
+                           + "/" + rows[i] + "/write");
+    }
+  }
 
-   return false;
+  if (rowsWithEmail == 0) {
+    window.alert(labels["The selected contact has no email address."]);
+  }
+  else if (document.body.hasClassName("popup"))
+    window.close();
+
+  return false;
 }
 
 function uixDeleteSelectedContacts(sender) {
-   var failCount = 0;
-   var contactsList = $('contactsList');
-   var rows = contactsList.getSelectedRowsId();
+  var failCount = 0;
+  var contactsList = $('contactsList');
+  var rows = contactsList.getSelectedRowsId();
 
-   if (rows.length == 0) {
-      window.alert(labels["Please select a contact."]);
-      return false;
-   }
+  if (rows.length == 0) {
+    window.alert(labels["Please select a contact."]);
+    return false;
+  }
 
-   var contactView = $('contactView');
+  var contactView = $('contactView');
 
-   for (var i = 0; i < rows.length; i++) {
-      var url, http, rowElem;
+  for (var i = 0; i < rows.length; i++) {
+    var url, http, rowElem;
     
-      /* send AJAX request (synchronously) */
+    /* send AJAX request (synchronously) */
     
-      url = (URLForFolderID(currentContactFolder) + "/"
-             + rows[i] + "/delete");
-      http = createHTTPClient();
-      http.open("POST", url, false /* not async */);
-      http.send("");
-      http.setRequestHeader("Content-Length", 0);
-      if (http.status != 200) { /* request failed */
-         failCount++;
-         http = null;
-         continue;
-      }
+    url = (URLForFolderID(currentAddressBook) + "/"
+          + rows[i] + "/delete");
+    http = createHTTPClient();
+    http.open("POST", url, false /* not async */);
+    http.send("");
+    http.setRequestHeader("Content-Length", 0);
+    if (http.status != 200) { /* request failed */
+      failCount++;
       http = null;
+      continue;
+    }
+    http = null;
 
-      /* remove from page */
+    /* remove from page */
 
-      /* line-through would be nicer, but hiding is OK too */
-      rowElem = $(rows[i]);
-      rowElem.parentNode.removeChild(rowElem);
-   }
+    /* line-through would be nicer, but hiding is OK too */
+    rowElem = $(rows[i]);
+    rowElem.parentNode.removeChild(rowElem);
+  }
 
-   if (failCount > 0)
-      alert(labels["You cannot delete the selected contact(s)."]);
-   else
-      contactView.update();
+  if (failCount > 0)
+    alert(labels["You cannot delete the selected contact(s)."]);
+  else
+    contactView.update();
   
-   return false;
+  return false;
 }
 
 function newEmailTo(sender) {
-   var mailto = sanitizeMailTo(sender.parentNode.parentNode.menuTarget.innerHTML);
+  var mailto = sanitizeMailTo(sender.parentNode.parentNode.menuTarget.innerHTML);
 
-   if (mailto.length > 0)
-      openMailComposeWindow("compose?mailto=" + mailto);
+  if (mailto.length > 0)
+    openMailComposeWindow("compose?mailto=" + mailto);
 
-   return false; /* stop following the link */
+  return false; /* stop following the link */
 }
 
 function onHeaderClick(event) {
-   var headerId = this.getAttribute("id");
-   var newSortAttribute;
-   if (headerId == "nameHeader")
-      newSortAttribute = "displayName";
-   else if (headerId == "mailHeader")
-      newSortAttribute = "mail";
-   else if (headerId == "screenNameHeader")
-      newSortAttribute = "screenName";
-   else if (headerId == "orgHeader")
-      newSortAttribute = "org";
-   else if (headerId == "phoneHeader")
-      newSortAttribute = "phone";
-
-   if (sorting["attribute"] == newSortAttribute)
-      sorting["ascending"] = !sorting["ascending"];
-   else {
-      sorting["attribute"] = newSortAttribute;
-      sorting["ascending"] = true;
-   }
-
-   refreshCurrentFolder();
-
-   Event.stop(event);
+  var headerId = this.getAttribute("id");
+  var newSortAttribute;
+  if (headerId == "nameHeader")
+    newSortAttribute = "displayName";
+  else if (headerId == "mailHeader")
+    newSortAttribute = "mail";
+  else if (headerId == "screenNameHeader")
+    newSortAttribute = "screenName";
+  else if (headerId == "orgHeader")
+    newSortAttribute = "org";
+  else if (headerId == "phoneHeader")
+    newSortAttribute = "phone";
+
+  if (sorting["attribute"] == newSortAttribute)
+    sorting["ascending"] = !sorting["ascending"];
+  else {
+    sorting["attribute"] = newSortAttribute;
+    sorting["ascending"] = true;
+  }
+
+  refreshCurrentFolder();
+
+  Event.stop(event);
 }
 
 function newContact(sender) {
-   openContactWindow(URLForFolderID(currentContactFolder) + "/newcontact");
+  openContactWindow(URLForFolderID(currentAddressBook) + "/newcontact");
 
-   return false; /* stop following the link */
+  return false; /* stop following the link */
 }
 
 function onFolderSelectionChange(event) {
-   var folderList = $("contactFolders");
-   var nodes = folderList.getSelectedNodes();
+  var folderList = $("contactFolders");
+  var nodes = folderList.getSelectedNodes();
 
-   if (event) {
-      var node = getTarget(event);
-      if (node.tagName == 'UL')
-         return;
-   }
+  if (event) {
+    var node = getTarget(event);
+    if (node.tagName == 'UL')
+      return;
+  }
 
-   $("contactView").update();
+  $("contactView").update();
   
-   if (nodes[0].hasClassName("denied")) {
-      var div = $("contactsListContent");
-      div.update();
-   }
-   else {
-      search = {};
-      sorting = {};
-      $("searchValue").value = "";
-      initCriteria();
-      openContactsFolder(nodes[0].getAttribute("id"));
-   }
+  if (nodes[0].hasClassName("denied")) {
+    var div = $("contactsListContent");
+    div.update();
+  }
+  else {
+    search = {};
+    sorting = {};
+    $("searchValue").value = "";
+    initCriteria();
+    openContactsFolder(nodes[0].getAttribute("id"));
+  }
 }
 
 function refreshCurrentFolder() {
-   openContactsFolder(currentContactFolder, true);
+  openContactsFolder(currentAddressBook, true);
 }
 
 function onConfirmContactSelection(event) {
-   var tag = this.getAttribute("name");
-   var folderLi = $(currentContactFolder);
-   var currentContactFolderName = folderLi.innerHTML;
-   var selectorList = null;
-   var initialValues = null;
-
-   if (selector) {
-     var selectorId = selector.getAttribute("id");
-     selectorList = opener.window.document.getElementById('uixselector-'
-                                                         + selectorId
-                                                         + '-uidList');
-     initialValues = selectorList.value;
-   }
-
-   var contactsList = $("contactsList");
-   var rows = contactsList.getSelectedRows();
-   for (i = 0; i < rows.length; i++) {
-      var cid = rows[i].getAttribute("contactid");
-      var cname = '' + rows[i].getAttribute("contactname");
-      var email = '' + rows[i].cells[1].innerHTML;
-      window.opener.addContact(tag, currentContactFolderName + '/' + cname,
-                               cid, cname, email);
-   }
-
-   if (selector && selector.changeNotification
-       && selectorList.value != initialValues)
-      selector.changeNotification("addition");
-
-   preventDefault(event);
+  var tag = this.getAttribute("name");
+  var folderLi = $(currentAddressBook);
+  var currentAddressBookName = folderLi.innerHTML;
+  var selectorList = null;
+  var initialValues = null;
+
+  if (selector) {
+    var selectorId = selector.getAttribute("id");
+    selectorList = opener.window.document.getElementById('uixselector-'
+                                                        + selectorId
+                                                        + '-uidList');
+    initialValues = selectorList.value;
+  }
+
+  var contactsList = $("contactsList");
+  var rows = contactsList.getSelectedRows();
+  for (i = 0; i < rows.length; i++) {
+    var cid = rows[i].getAttribute("contactid");
+    var cname = '' + rows[i].getAttribute("contactname");
+    var email = '' + rows[i].cells[1].innerHTML;
+
+    window.opener.addContact(tag, currentAddressBookName + '/' + cname,
+                            cid, cname, email);
+  }
+
+  if (selector && selector.changeNotification
+      && selectorList.value != initialValues)
+    selector.changeNotification("addition");
+
+  preventDefault(event);
 }
 
 function onContactMailTo(node) {
-   return openMailTo(node.innerHTML);
+  return openMailTo(node.innerHTML);
 }
 
 function refreshContacts(contactId) {
-   refreshCurrentFolder();
-   cachedContacts[currentContactFolder + "/" + contactId] = null;
-   loadContact(contactId);
+  refreshCurrentFolder();
+  cachedContacts[currentAddressBook + "/" + contactId] = null;
+  loadContact(contactId);
 
-   return false;
+  return false;
 }
 
 function onAddressBookNew(event) {
-   createFolder(window.prompt(labels["Name of the Address Book"]),
-                appendAddressBook);
-   preventDefault(event);
+  createFolder(window.prompt(labels["Name of the Address Book"]),
+              appendAddressBook);
+  preventDefault(event);
 }
 
 function appendAddressBook(name, folder) {
-   var owner;
-   var result = true;
-
-   if (folder) {
-      owner = getSubscribedFolderOwner(folder);
-      folder = accessToSubscribedFolder(folder);
-   }
-   else
-      folder = "/" + name;
-  
-   if (!owner)
-      owner = UserLogin;
+  var owner;
+  var result = true;
 
-   if ($(folder))
-      result = false;
-   else {
-      var contactFolders = $("contactFolders");
-      var items = contactFolders.childNodesWithTag("li");
-      var li = document.createElement("li");
-
-      // Add the calendar to the proper place
-      var i = getListIndexForFolder(items, owner, name);
-      if (i != items.length) // User is subscribed to other calendars of the same owner
-         contactFolders.insertBefore(li, items[i]);
-      else 
-         contactFolders.appendChild(li);
-
-      li.setAttribute("id", folder);
-      li.setAttribute("owner", owner);
-      li.appendChild(document.createTextNode(name));
-      setEventsOnContactFolder(li);
-   }
+  if (folder) {
+    owner = getSubscribedFolderOwner(folder);
+    folder = accessToSubscribedFolder(folder);
+  }
+  else
+    folder = "/" + name;
+  
+  if (!owner)
+    owner = UserLogin;
+
+  if ($(folder))
+    result = false;
+  else {
+    var contactFolders = $("contactFolders");
+    var items = contactFolders.childNodesWithTag("li");
+    var li = document.createElement("li");
+
+    // Add the calendar to the proper place
+    var i = getListIndexForFolder(items, owner, name);
+    if (i != items.length) // User is subscribed to other calendars of the same owner
+      contactFolders.insertBefore(li, items[i]);
+    else 
+      contactFolders.appendChild(li);
+
+    li.setAttribute("id", folder);
+    li.setAttribute("owner", owner);
+    li.appendChild(document.createTextNode(name));
+    setEventsOnAddressBook(li);
+  }
 
-   return result;
+  return result;
 }
 
 function newFolderCallback(http) {
-   if (http.readyState == 4
-       && http.status == 201) {
-      var name = http.callbackData;
-      appendAddressBook(name, "/" + name);
-   }
-   else
-      log ("ajax problem 4:" + http.status);
+  if (http.readyState == 4
+      && http.status == 201) {
+    var name = http.callbackData;
+    appendAddressBook(name, "/" + name);
+  }
+  else
+    log ("ajax problem 4:" + http.status);
 }
 
 function newUserFolderCallback(folderData) {
-   var folder = $(folderData["folder"]);
-   if (!folder)
-      appendAddressBook(folderData["folderName"], folderData["folder"]);
+  var folder = $(folderData["folder"]);
+  if (!folder)
+    appendAddressBook(folderData["folderName"], folderData["folder"]);
 }
 
 function onAddressBookAdd(event) {
-   openUserFolderSelector(newUserFolderCallback, "contact");
+  openUserFolderSelector(newUserFolderCallback, "contact");
 
-   preventDefault(event);
+  preventDefault(event);
 }
 
 function onFolderUnsubscribeCB(folderId) {
-   var node = $(folderId);
-   node.parentNode.removeChild(node);
-   var personal = $("/personal");
-   personal.selectElement();
-   onFolderSelectionChange();
+  var node = $(folderId);
+  node.parentNode.removeChild(node);
+  var personal = $("/personal");
+  personal.selectElement();
+  onFolderSelectionChange();
 }
 
 function onAddressBookRemove(event) {
-   var selector = $("contactFolders");
-   var nodes = selector.getSelectedNodes();
-   if (nodes.length > 0) { 
-      nodes[0].deselect();
-      var folderId = nodes[0].getAttribute("id");
-      var folderIdElements = folderId.split("_");
-      if (folderIdElements.length > 1)
-         unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId);
-      else {
-         var abId = folderIdElements[0].substr(1);
-         deletePersonalAddressBook(abId);
-         var personal = $("/personal");
-         personal.selectElement();
-         onFolderSelectionChange();
-      }
-   }
+  var selector = $("contactFolders");
+  var nodes = selector.getSelectedNodes();
+  if (nodes.length > 0) { 
+    nodes[0].deselect();
+    var folderId = nodes[0].getAttribute("id");
+    var folderIdElements = folderId.split("_");
+    if (folderIdElements.length > 1)
+      unsubscribeFromFolder(folderId, onFolderUnsubscribeCB, folderId);
+    else {
+      var abId = folderIdElements[0].substr(1);
+      deletePersonalAddressBook(abId);
+      var personal = $("/personal");
+      personal.selectElement();
+      onFolderSelectionChange();
+    }
+  }
 
-   preventDefault(event);
+  preventDefault(event);
 }
 
 function deletePersonalAddressBook(folderId) {
-   var label
-      = labels["Are you sure you want to delete the selected address book?"];
-   if (window.confirm(label)) {
-      if (document.deletePersonalABAjaxRequest) {
-         document.deletePersonalABAjaxRequest.aborted = true;
-         document.deletePersonalABAjaxRequest.abort();
-      }
-      var url = ApplicationBaseURL + "/" + folderId + "/deleteFolder";
-      document.deletePersonalABAjaxRequest
-         = triggerAjaxRequest(url, deletePersonalAddressBookCallback,
-                              folderId);
-   }
+  var label
+    = labels["Are you sure you want to delete the selected address book?"];
+  if (window.confirm(label)) {
+    if (document.deletePersonalABAjaxRequest) {
+      document.deletePersonalABAjaxRequest.aborted = true;
+      document.deletePersonalABAjaxRequest.abort();
+    }
+    var url = ApplicationBaseURL + "/" + folderId + "/deleteFolder";
+    document.deletePersonalABAjaxRequest
+      = triggerAjaxRequest(url, deletePersonalAddressBookCallback,
+                          folderId);
+  }
 }
 
 function deletePersonalAddressBookCallback(http) {
-   if (http.readyState == 4) {
-      if (isHttpStatus204(http.status)) {
-         var ul = $("contactFolders");
+  if (http.readyState == 4) {
+    if (isHttpStatus204(http.status)) {
+      var ul = $("contactFolders");
        
-         var children = ul.childNodesWithTag("li");
-         var i = 0;
-         var done = false;
-         while (!done && i < children.length) {
-            var currentFolderId = children[i].getAttribute("id").substr(1);
-            if (currentFolderId == http.callbackData) {
-               ul.removeChild(children[i]);
-               done = true;
-            }
-            else
-               i++;
-         }
+      var children = ul.childNodesWithTag("li");
+      var i = 0;
+      var done = false;
+      while (!done && i < children.length) {
+       var currentFolderId = children[i].getAttribute("id").substr(1);
+       if (currentFolderId == http.callbackData) {
+         ul.removeChild(children[i]);
+         done = true;
+       }
+       else
+         i++;
       }
-      document.deletePersonalABAjaxRequest = null;
-   }
-   else
-      log ("ajax problem 5: " + http.status);
+    }
+    document.deletePersonalABAjaxRequest = null;
+  }
+  else
+    log ("ajax problem 5: " + http.status);
 }
 
 function configureDragHandles() {
-   var handle = $("dragHandle");
-   if (handle) {
-      handle.addInterface(SOGoDragHandlesInterface);
-      handle.leftBlock=$("contactFoldersList");
-      handle.rightBlock=$("rightPanel");
-      handle.leftMargin = 100;
-   }
-
-   handle = $("rightDragHandle");
-   if (handle) {
-      handle.addInterface(SOGoDragHandlesInterface);
-      handle.upperBlock=$("contactsListContent");
-      handle.lowerBlock=$("contactView");
-   }
+  var handle = $("dragHandle");
+  if (handle) {
+    handle.addInterface(SOGoDragHandlesInterface);
+    handle.leftBlock=$("contactFoldersList");
+    handle.rightBlock=$("rightPanel");
+    handle.leftMargin = 100;
+  }
+
+  handle = $("rightDragHandle");
+  if (handle) {
+    handle.addInterface(SOGoDragHandlesInterface);
+    handle.upperBlock=$("contactsListContent");
+    handle.lowerBlock=$("contactView");
+  }
 }
 
 function lookupDeniedFolders() {
-   var list = $("contactFolders").childNodesWithTag("li");
-   for (var i = 0; i < list.length; i++) {
-      var folderID = list[i].getAttribute("id");
-      var url = URLForFolderID(folderID) + "/canAccessContent";
-      triggerAjaxRequest(url, deniedFoldersLookupCallback, folderID);
-   }
+  var list = $("contactFolders").childNodesWithTag("li");
+  for (var i = 0; i < list.length; i++) {
+    var folderID = list[i].getAttribute("id");
+    var url = URLForFolderID(folderID) + "/canAccessContent";
+    triggerAjaxRequest(url, deniedFoldersLookupCallback, folderID);
+  }
 }
 
 function deniedFoldersLookupCallback(http) {
-   if (http.readyState == 4) {
-      var denied = ! isHttpStatus204(http.status);
-      var entry = $(http.callbackData);
-      if (denied)
-         entry.addClassName("denied");
-      else
-         entry.removeClassName("denied");
-   }
+  if (http.readyState == 4) {
+    var denied = ! isHttpStatus204(http.status);
+    var entry = $(http.callbackData);
+    if (denied)
+      entry.addClassName("denied");
+    else
+      entry.removeClassName("denied");
+  }
 }
 
 function configureAbToolbar() {
-   var toolbar = $("abToolbar");
-   if (toolbar) {
-     var links = toolbar.childNodesWithTag("a");
-     $(links[0]).observe("click", onAddressBookNew);
-     $(links[1]).observe("click", onAddressBookAdd);
-     $(links[2]).observe("click", onAddressBookRemove);
-   }
-}
-
-function configureContactFolders() {
-   var contactFolders = $("contactFolders");
-   if (contactFolders) {
-      contactFolders.observe("mousedown", listRowMouseDownHandler);
-      contactFolders.observe("click", onFolderSelectionChange);
-      var lis = contactFolders.childNodesWithTag("li");
-      for (var i = 0; i < lis.length; i++)
-         setEventsOnContactFolder(lis[i]);
+  var toolbar = $("abToolbar");
+  if (toolbar) {
+    var links = toolbar.childNodesWithTag("a");
+    $(links[0]).observe("click", onAddressBookNew);
+    $(links[1]).observe("click", onAddressBookAdd);
+    $(links[2]).observe("click", onAddressBookRemove);
+  }
+}
+
+function configureAddressBooks() {
+  var contactFolders = $("contactFolders");
+  if (contactFolders) {
+    contactFolders.observe("mousedown", listRowMouseDownHandler);
+    contactFolders.observe("click", onFolderSelectionChange);
+    var lis = contactFolders.childNodesWithTag("li");
+    for (var i = 0; i < lis.length; i++)
+      setEventsOnAddressBook(lis[i]);
     
-      lookupDeniedFolders();
+    lookupDeniedFolders();
     
-      var personalFolder = $("/personal");
-      personalFolder.selectElement();
-      openContactsFolder("/personal");
-   }
-}
-
-function setEventsOnContactFolder(folder) {
-   var node = $(folder);
-
-   node.observe("mousedown", listRowMouseDownHandler);
-   node.observe("click", onRowClick);
-   Event.observe(node, "contextmenu",
-                 onContactFoldersContextMenu.bindAsEventListener(node));
-}
-
-function onMenuModify(event) {
-   var folders = $("contactFolders");
-   var selected = folders.getSelectedNodes()[0];
-
-   if (UserLogin == selected.getAttribute("owner")) {
-      var currentName = selected.innerHTML;
-      var newName = window.prompt(labels["Address Book Name"],
-                                  currentName);
-      if (newName && newName.length > 0
-          && newName != currentName) {
-         var url = (URLForFolderID(selected.getAttribute("id"))
-                    + "/renameFolder?name=" + escape(newName.utf8encode()));
-         triggerAjaxRequest(url, folderRenameCallback,
-                            {node: selected, name: newName});
-      }
-   } else
-      window.alert(clabels["Unable to rename that folder!"]);
+    var personalFolder = $("/personal");
+    personalFolder.selectElement();
+    openContactsFolder("/personal");
+  }
+}
+
+function setEventsOnAddressBook(folder) {
+  var node = $(folder);
+
+  node.observe("mousedown", listRowMouseDownHandler);
+  node.observe("click", onRowClick);
+  node.observe("dblclick", onAddressBookModify);
+  node.observe("contextmenu", onAddressBooksContextMenu);
+}
+
+function onAddressBookModify(event) {
+  var folders = $("contactFolders");
+  var selected = folders.getSelectedNodes()[0];
+
+  if (UserLogin == selected.getAttribute("owner")) {
+    var currentName = selected.innerHTML;
+    var newName = window.prompt(labels["Address Book Name"],
+                               currentName);
+    if (newName && newName.length > 0
+       && newName != currentName) {
+      var url = (URLForFolderID(selected.getAttribute("id"))
+                + "/renameFolder?name=" + escape(newName.utf8encode()));
+      triggerAjaxRequest(url, folderRenameCallback,
+                        {node: selected, name: newName});
+    }
+  } else
+    window.alert(clabels["Unable to rename that folder!"]);
 }
 
 function folderRenameCallback(http) {
-   if (http.readyState == 4) {
-      if (isHttpStatus204(http.status)) {
-         var dict = http.callbackData;
-         dict["node"].innerHTML = dict["name"];
-      }
-   }
+  if (http.readyState == 4) {
+    if (isHttpStatus204(http.status)) {
+      var dict = http.callbackData;
+      dict["node"].innerHTML = dict["name"];
+    }
+  }
 }
 
 function onMenuSharing(event) {
-   if ($(this).hasClassName("disabled"))
-      return;
+  if ($(this).hasClassName("disabled"))
+    return;
+
+  var folders = $("contactFolders");
+  var selected = folders.getSelectedNodes()[0];
+  var owner = selected.getAttribute("owner");
+  if (owner == "nobody")
+    window.alert(clabels["The user rights cannot be"
+                        + " edited for this object!"]);
+  else {
+    var title = this.innerHTML;
+    var url = URLForFolderID(selected.getAttribute("id"));
+
+    openAclWindow(url + "/acls", title);
+  }
+}
 
-   var folders = $("contactFolders");
-   var selected = folders.getSelectedNodes()[0];
-   var owner = selected.getAttribute("owner");
-   if (owner == "nobody")
-      window.alert(clabels["The user rights cannot be"
-                           + " edited for this object!"]);
-   else {
-      var title = this.innerHTML;
-      var url = URLForFolderID(selected.getAttribute("id"));
-
-      openAclWindow(url + "/acls", title);
-   }
-}
-
-function onContactFoldersMenuPrepareVisibility() {
-   var folders = $("contactFolders");
-   var selected = folders.getSelectedNodes();
-
-   if (selected.length > 0) {
-      var folderOwner = selected[0].getAttribute("owner");
-      var modifyOption = $(this).down("ul").childElements().first();
-      var sharingOption = $(this).down("ul").childElements().last();
-      // Disable the "Sharing" and "Modify" options when address book
-      // is not owned by user
-      if (folderOwner == UserLogin || IsSuperUser) {
-         modifyOption.removeClassName("disabled");
-         sharingOption.removeClassName("disabled");
-      }
-      else {
-         modifyOption.addClassName("disabled");
-         sharingOption.addClassName("disabled");
-      }
-   }
+function onAddressBooksMenuPrepareVisibility() {
+  var folders = $("contactFolders");
+  var selected = folders.getSelectedNodes();
+
+  if (selected.length > 0) {
+    var folderOwner = selected[0].getAttribute("owner");
+    var modifyOption = $(this).down("ul").childElements().first();
+    var sharingOption = $(this).down("ul").childElements().last();
+    // Disable the "Sharing" and "Modify" options when address book
+    // is not owned by user
+    if (folderOwner == UserLogin || IsSuperUser) {
+      modifyOption.removeClassName("disabled");
+      sharingOption.removeClassName("disabled");
+    }
+    else {
+      modifyOption.addClassName("disabled");
+      sharingOption.addClassName("disabled");
+    }
+  }
 }
 
 function onContactMenuPrepareVisibility() {
-   var contactId = document.menuTarget.getAttribute('id');
-   var contactRow = $(contactId);
-   var elements = $(this).down("ul").childElements();
+  var contactId = document.menuTarget.getAttribute('id');
+  var contactRow = $(contactId);
+  var elements = $(this).down("ul").childElements();
 
-   var writeOption = elements[2];
-   var emailCell = contactRow.down('td', 1);
-   if (emailCell.firstChild)
-      writeOption.removeClassName("disabled");
-   else
-      writeOption.addClassName("disabled");
+  var writeOption = elements[2];
+  var emailCell = contactRow.down('td', 1);
+  if (emailCell.firstChild)
+    writeOption.removeClassName("disabled");
+  else
+    writeOption.addClassName("disabled");
 
-   var aimOption = elements[3];
-   var aimCell = contactRow.down('td', 2);
-   if (aimCell.firstChild)
-      aimOption.removeClassName("disabled");
-   else
-      aimOption.addClassName("disabled");
+  var aimOption = elements[3];
+  var aimCell = contactRow.down('td', 2);
+  if (aimCell.firstChild)
+    aimOption.removeClassName("disabled");
+  else
+    aimOption.addClassName("disabled");
 }
 
 function getMenus() {
-   var menus = {};
-   menus["contactFoldersMenu"] = new Array(onMenuModify, "-", null,
-                                           null, "-", null, "-",
-                                           onMenuSharing);
-   menus["contactMenu"] = new Array(onMenuEditContact, "-",
-                                    onMenuWriteToContact, onMenuAIMContact,
-                                    "-", onMenuDeleteContact);
-   menus["searchMenu"] = new Array(setSearchCriteria);
+  var menus = {};
+  menus["contactFoldersMenu"] = new Array(onAddressBookModify, "-", null,
+                                         null, "-", null, "-",
+                                         onMenuSharing);
+  menus["contactMenu"] = new Array(onMenuEditContact, "-",
+                                  onMenuWriteToContact, onMenuAIMContact,
+                                  "-", onMenuDeleteContact);
+  menus["searchMenu"] = new Array(setSearchCriteria);
    
-   var contactFoldersMenu = $("contactFoldersMenu");
-   if (contactFoldersMenu)
-      contactFoldersMenu.prepareVisibility = onContactFoldersMenuPrepareVisibility;
-   var contactMenu = $("contactMenu");
-   if (contactMenu)
-      contactMenu.prepareVisibility = onContactMenuPrepareVisibility;
+  var contactFoldersMenu = $("contactFoldersMenu");
+  if (contactFoldersMenu)
+    contactFoldersMenu.prepareVisibility = onAddressBooksMenuPrepareVisibility;
+  var contactMenu = $("contactMenu");
+  if (contactMenu)
+    contactMenu.prepareVisibility = onContactMenuPrepareVisibility;
    
-   return menus;
+  return menus;
 }
 
 function configureSelectionButtons() {
@@ -864,31 +865,29 @@ function configureSelectionButtons() {
   if (container) {
     var buttons = container.childNodesWithTag("input");
     for (var i = 0; i < buttons.length; i++)
-      $(buttons[i]).observe("click",
-                           onConfirmContactSelection);
+      $(buttons[i]).observe("click", onConfirmContactSelection);
   }
 }
 
 function initContacts(event) {
-   if (document.body.hasClassName("popup"))
-     configureSelectionButtons();
-   configureAbToolbar();
-   configureContactFolders();
-   //     initDnd();
-
-   var table = $("contactsList");
-   if (table) {
-      // Initialize contacts table
-      table.multiselect = true;
-      Event.observe(table, "mousedown",
-                    onContactSelectionChange.bindAsEventListener(table));    
-      configureSortableTableHeaders(table);
-      TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
-   }
-
-   // Default sort options
-   sorting["attribute"] = "displayName";
-   sorting["ascending"] = true;
+  if (document.body.hasClassName("popup"))
+    configureSelectionButtons();
+  configureAbToolbar();
+  configureAddressBooks();
+  //     initDnd();
+
+  var table = $("contactsList");
+  if (table) {
+    // Initialize contacts table
+    table.multiselect = true;
+    table.observe("mousedown", onContactSelectionChange);
+    configureSortableTableHeaders(table);
+    TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
+  }
+
+  // Default sort options
+  sorting["attribute"] = "displayName";
+  sorting["ascending"] = true;
 }
 
 FastInit.addOnLoad(initContacts);
index 33af5266ba01dc8dc6733b3fc171b0ae49dc57a3..e30fcba417bd67fcf1735cb2555ab7908cda9110 100644 (file)
@@ -145,14 +145,14 @@ Element.addMethods({
                      visibility: "visible" } );
     
     document.currentPopupMenu = popup;
-    Event.observe(document.body, "click", onBodyClickMenuHandler);
+    document.body.observe("click", onBodyClickMenuHandler);
   },
 
   attachMenu: function(element, menuName) {
     element = $(element);
     element.sogoContextMenu = $(menuName);
-    Event.observe(element, "contextmenu",
-                 element.onContextMenu.bindAsEventListener(element));
+    element.observe("contextmenu",
+                   element.onContextMenu.bindAsEventListener(element));
   },
 
   selectElement: function(element) {
index 9af238a56ed2ad0da9a7b07a09fd164ef58f6a1e..af297c9d285021d1e8ce963145ed2a3a6f8fe4f9 100644 (file)
@@ -11,7 +11,7 @@ Form.Element.Methods._replicate =  function(element) {
 Form.Element.Methods.assignReplica = function(element, otherInput) {
   element = $(element);
   if (!element._onChangeBound) {
-    Event.observe(element, "change", element._replicate, false);
+    element.observe("change", element._replicate, false);
     element._onChangeBound = true;
   }
   element.replica = otherInput;
index 42ea0f2297cac9767535e5829579741ae3bd96fc..77cf17e74d17c2e3fbd284b8d1f356476c2f31fb 100644 (file)
@@ -220,24 +220,24 @@ function ml_lowlight(sender) {
 /* bulk delete of messages */
 
 function deleteSelectedMessages(sender) {
-   var messageList = $("messageList");
-   var rowIds = messageList.getSelectedRowsId();
+  var messageList = $("messageList");
+  var rowIds = messageList.getSelectedRowsId();
   
-   if (rowIds.length > 0) {
-      for (var i = 0; i < rowIds.length; i++) {
-       var url;
-       var rowId = rowIds[i].substr(4);
-       var messageId = Mailer.currentMailbox + "/" + rowId;
-       url = ApplicationBaseURL + messageId + "/trash";
-       deleteMessageRequestCount++;
-       var data = { "id": rowId, "mailbox": Mailer.currentMailbox, "messageId": messageId };
-       triggerAjaxRequest(url, deleteSelectedMessagesCallback, data);
-      }
-   }
-   else
-     window.alert(labels["Please select a message."]);
+  if (rowIds.length > 0) {
+    for (var i = 0; i < rowIds.length; i++) {
+      var url;
+      var rowId = rowIds[i].substr(4);
+      var messageId = Mailer.currentMailbox + "/" + rowId;
+      url = ApplicationBaseURL + messageId + "/trash";
+      deleteMessageRequestCount++;
+      var data = { "id": rowId, "mailbox": Mailer.currentMailbox, "messageId": messageId };
+      triggerAjaxRequest(url, deleteSelectedMessagesCallback, data);
+    }
+  }
+  else
+    window.alert(labels["Please select a message."]);
    
-   return false;
+  return false;
 }
 
 function deleteSelectedMessagesCallback(http) {
@@ -257,7 +257,7 @@ function deleteSelectedMessagesCallback(http) {
       if (!nextRow)
        nextRow = row.previous("tr");
       row.parentNode.removeChild(row);
-//     row.addClassName("deleted"); // when we'll offer "mark as deleted"
+      //       row.addClassName("deleted"); // when we'll offer "mark as deleted"
       
       if (deleteMessageRequestCount == 0) {
        if (nextRow) {
@@ -311,8 +311,8 @@ function moveMessages(rowIds, folder) {
 }
 
 function onMenuDeleteMessage(event) {
-    deleteSelectedMessages();
-    preventDefault(event);
+  deleteSelectedMessages();
+  preventDefault(event);
 }
 
 function deleteMessage(url, id, mailbox, messageId) {
@@ -614,7 +614,7 @@ function onMessageContextMenu(event) {
   var topNode = $('messageList');
   var selectedNodes = topNode.getSelectedRows();
 
-  Event.observe(menu, "hideMenu", onMessageContextMenuHide);
+  menu.observe("hideMenu", onMessageContextMenuHide);
   
   if (selectedNodes.length > 1)
     popupMenu(event, "messagesListMenu", selectedNodes);
@@ -656,7 +656,7 @@ function onFolderMenuClick(event) {
   }
 
   var menu = $(menuName);
-  Event.observe(menu, "hideMenu", onFolderMenuHide);
+  menu.observe("hideMenu", onFolderMenuHide);
   popupMenu(event, menuName, this.parentNode);
 
   var topNode = $("mailboxTree");
@@ -795,8 +795,8 @@ function configureLinksInMessage() {
 
   var editDraftButton = $("editDraftButton");
   if (editDraftButton)
-    Event.observe(editDraftButton, "click",
-                 onMessageEditDraft.bindAsEventListener(editDraftButton));
+    editDraftButton.observe("click",
+                           onMessageEditDraft.bindAsEventListener(editDraftButton));
 
   configureiCalLinksInMessage();
 }
@@ -813,8 +813,8 @@ function configureiCalLinksInMessage() {
     var button = $(key);
     if (button) {
       button.action = buttons[key];
-      Event.observe(button, "click",
-                   onICalendarButtonClick.bindAsEventListener(button));
+      button.observe("click",
+                    onICalendarButtonClick.bindAsEventListener(button));
     }
   }
 }
@@ -854,34 +854,34 @@ function resizeMailContent() {
   // Show expand buttons if necessary
   var spans = $$("TABLE TR.mailer_fieldrow TD.mailer_fieldvalue SPAN");
   spans.each(function(span) {
-        var row = span.up("TR");
-        if (span.getWidth() > row.getWidth()) {
-           var cell = row.select("TD.mailer_fieldname").first();
-           var link = cell.down("img");
-           link.show();
-           link.observe("click", toggleDisplayHeader);
-        }
-     });
+      var row = span.up("TR");
+      if (span.getWidth() > row.getWidth()) {
+       var cell = row.select("TD.mailer_fieldname").first();
+       var link = cell.down("img");
+       link.show();
+       link.observe("click", toggleDisplayHeader);
+      }
+    });
 }
 
 function toggleDisplayHeader(event) {
-   var row = this.up("TR");
-   var span = row.down("SPAN");
+  var row = this.up("TR");
+  var span = row.down("SPAN");
    
-   if (this.hasClassName("collapse")) {
-      this.writeAttribute("src", ResourcesURL + '/minus.png');
-      this.writeAttribute("class", "expand");
-      span.writeAttribute("class", "expand");
-   }
-   else {
-      this.writeAttribute("src", ResourcesURL + '/plus.png');
-      this.writeAttribute("class", "collapse");
-      span.writeAttribute("class", "collapse");
-   }
-   resizeMailContent();
+  if (this.hasClassName("collapse")) {
+    this.writeAttribute("src", ResourcesURL + '/minus.png');
+    this.writeAttribute("class", "expand");
+    span.writeAttribute("class", "expand");
+  }
+  else {
+    this.writeAttribute("src", ResourcesURL + '/plus.png');
+    this.writeAttribute("class", "collapse");
+    span.writeAttribute("class", "collapse");
+  }
+  resizeMailContent();
 
-   preventDefault(event);
-   return false;
+  preventDefault(event);
+  return false;
 }
 
 function onMessageContentMenu(event) {
@@ -1062,8 +1062,8 @@ function expandUpperTree(node) {
       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 cn = mailboxTree.aNodes[number];
+       mailboxTree.nodeStatus(1, number, cn._ls);
       }
     }
     currentNode = currentNode.parentNode;
@@ -1109,46 +1109,46 @@ var mailboxSpanAcceptType = function(type) {
   return (type == "mailRow");
 }
 
-var mailboxSpanEnter = function() {
-  this.addClassName("_dragOver");
-}
+  var mailboxSpanEnter = function() {
+    this.addClassName("_dragOver");
+  }
 
-var mailboxSpanExit = function() {
-  this.removeClassName("_dragOver");
-}
+    var mailboxSpanExit = function() {
+      this.removeClassName("_dragOver");
+    }
 
-var mailboxSpanDrop = function(data) {
-  var success = false;
+      var mailboxSpanDrop = function(data) {
+       var success = false;
 
-  if (data) {
-    var folder = this.parentNode.parentNode.getAttribute("dataname");
-    if (folder != Mailer.currentMailbox)
-      success = (moveMessages(data, folder) == 0);
-  }
-  else
-    success = false;
+       if (data) {
+         var folder = this.parentNode.parentNode.getAttribute("dataname");
+         if (folder != Mailer.currentMailbox)
+           success = (moveMessages(data, folder) == 0);
+       }
+       else
+         success = false;
 
-  return success;
-}
+       return success;
+      }
 
-var plusSignEnter = function() {
-  var nodeNr = parseInt(this.id.substr(2));
-  if (!mailboxTree.aNodes[nodeNr]._io)
-    this.plusSignTimer = setTimeout("openPlusSign('" + nodeNr + "');", 1000);
-}
+       var plusSignEnter = function() {
+         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;
-  }
-}
+         var plusSignExit = function() {
+           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;
-}
+           function openPlusSign(nodeNr) {
+             mailboxTree.nodeStatus(1, nodeNr, mailboxTree.aNodes[nodeNr]._ls);
+             mailboxTree.aNodes[nodeNr]._io = 1;
+             this.plusSignTimer = null;
+           }
 
 var messageListGhost = function () {
   var newDiv = document.createElement("div");
@@ -1172,26 +1172,26 @@ var messageListGhost = function () {
   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 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));
 
-  return msgIds;
-}
-
-/* a model for a futur refactoring of the sortable table headers mechanism */
-function configureMessageListEvents(table) {
-  if (table) {
-    table.multiselect = true;
-    // Each body row can load a message
-    Event.observe(table, "mousedown",
-                 onMessageSelectionChange.bindAsEventListener(table));    
-    // Sortable columns
-    configureSortableTableHeaders(table);
+    return msgIds;
   }
-}
+
+  /* a model for a futur refactoring of the sortable table headers mechanism */
+    function configureMessageListEvents(table) {
+      if (table) {
+       table.multiselect = true;
+       // Each body row can load a message
+       table.observe("mousedown",
+                     onMessageSelectionChange.bindAsEventListener(table));    
+       // Sortable columns
+       configureSortableTableHeaders(table);
+      }
+    }
 
 function configureMessageListBodyEvents(table) {
   if (table) {
@@ -1200,29 +1200,29 @@ function configureMessageListBodyEvents(table) {
     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]));
+       anchors[i].observe("click",
+                          openMailboxAtIndex.bindAsEventListener(anchors[i]));
     }
 
     rows = table.tBodies[0].rows;
     for (var i = 0; i < rows.length; i++) {
-      Event.observe(rows[i], "mousedown", onRowClick);
-      Event.observe(rows[i], "selectstart", listRowMouseDownHandler);
-      Event.observe(rows[i], "contextmenu", onMessageContextMenu.bindAsEventListener(rows[i]));
+      rows[i].observe("mousedown", onRowClick);
+      rows[i].observe("selectstart", listRowMouseDownHandler);
+      rows[i].observe("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]);
+      //       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);
+       cell.observe("mousedown", listRowMouseDownHandler);
        if (j == 2 || j == 3 || j == 5)
-         Event.observe(cell, "dblclick", onMessageDoubleClick.bindAsEventListener(cell));
+         cell.observe("dblclick", onMessageDoubleClick.bindAsEventListener(cell));
        else if (j == 4) {
          var img = cell.childNodesWithTag("img")[0];
-         Event.observe(img, "click", mailListMarkMessage.bindAsEventListener(img));
+         img.observe("click", mailListMarkMessage.bindAsEventListener(img));
        }
       }
     }
@@ -1288,7 +1288,7 @@ function openInbox(node) {
 
 function initMailer(event) {
   if (!$(document.body).hasClassName("popup")) {
-//     initDnd();
+    //     initDnd();
     initMailboxTree();
     initMessageCheckTimer();
   }
@@ -1355,10 +1355,10 @@ function updateMailboxTreeInPage() {
   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]));
+    nodes[i].observe("click",
+                    onMailboxTreeItemClick.bindAsEventListener(nodes[i]));
+    nodes[i].observe("contextmenu",
+                    onFolderMenuClick.bindAsEventListener(nodes[i]));
     if (!inboxFound
        && nodes[i].parentNode.getAttribute("datatype") == "inbox") {
       Mailer.currentMailboxType = "inbox";
@@ -1767,13 +1767,13 @@ function onLabelMenuPrepareVisibility() {
     var rows = messageList.getSelectedRows();
     for (var i = 0; i < rows.length; i++) {
       $w(rows[i].getAttribute("labels")).each(function(flag) {
-       flags[flag] = true;
+         flags[flag] = true;
        });
     }
   }
 
   var lis = this.childNodesWithTag("ul")[0].childNodesWithTag("li")
-  var isFlagged = false;
+    var isFlagged = false;
   for (var i = 1; i < 6; i++) {
     if (flags["label" + i]) {
       isFlagged = true;
@@ -1820,8 +1820,8 @@ function getMenus() {
                                       null, onMenuDeleteMessage);
   menus["messagesListMenu"] = new Array(onMenuForwardMessage,
                                        "-", "moveMailboxMenu",
-                                      "copyMailboxMenu", "label-menu",
-                                      "mark-menu", "-",
+                                       "copyMailboxMenu", "label-menu",
+                                       "mark-menu", "-",
                                        null, null,
                                        onMenuDeleteMessage);
   menus["imageMenu"] = new Array(saveImage);
@@ -1864,41 +1864,41 @@ function Mailbox(type, name) {
   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);
-  }
-}
-
-Mailbox.prototype.fullName = function() {
-  var fullName = "";
-
-  var currentFolder = this;
-  while (currentFolder.parentFolder) {
-    fullName = "/folder" + currentFolder.name + fullName;
-    currentFolder = currentFolder.parentFolder;
-  }
-
-  return "/" + currentFolder.name + fullName;
-}
-
-Mailbox.prototype.findMailboxByName = function(name) {
-  var mailbox = null;
-
-  var i = 0;
-  while (!mailbox && i < this.children.length)
-    if (this.children[i].name == name)
-      mailbox = this.children[i];
-    else
-      i++;
+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);
+    }
+  },
+ fullName: function() {
+   var fullName = "";
+
+   var currentFolder = this;
+   while (currentFolder.parentFolder) {
+     fullName = "/folder" + currentFolder.name + fullName;
+     currentFolder = currentFolder.parentFolder;
+   }
 
-  return mailbox;
-}
+   return "/" + currentFolder.name + fullName;
+ },
+ findMailboxByName: function(name) {
+   var mailbox = null;
+
+   var i = 0;
+   while (!mailbox && i < this.children.length)
+     if (this.children[i].name == name)
+       mailbox = this.children[i];
+     else
+       i++;
+
+   return mailbox;
+ },
+ addMailbox: function(mailbox) {
+   mailbox.parentFolder = this;
+   this.children.push(mailbox);
+ }
+};
 
-Mailbox.prototype.addMailbox = function(mailbox) {
-  mailbox.parentFolder = this;
-  this.children.push(mailbox);
-}
index fa953dcd9efebebe54bfd07567fa4b63ce897dfd..8a5167022525ca3c4888a9df4e608f1367a4daa3 100644 (file)
@@ -18,7 +18,7 @@ var SOGoDragHandlesInterface = {
   moveBound: null,
   bind: function () {
     this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this);
-    Event.observe(this, "mousedown", this.startHandleDraggingBound, false);
+    this.observe("mousedown", this.startHandleDraggingBound, false);
   },
   _determineType: function () {
     if (this.leftBlock && this.rightBlock)
@@ -47,9 +47,9 @@ var SOGoDragHandlesInterface = {
         document.body.setStyle({ cursor: "n-resize" });
       }
       this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this);
-      Event.observe(document.body, "mouseup", this.stopHandleDraggingBound, true);
+      document.body.observe("mouseup", this.stopHandleDraggingBound, true);
       this.moveBound = this.move.bindAsEventListener(this);
-      Event.observe(document.body, "mousemove", this.moveBound, true);
+      document.body.observe("mousemove", this.moveBound, true);
       this.move(event);
       event.cancelBubble = true;
     }
index 582a91d90d418fbce6bc9bdafb4c330ed58f6200..a6ea9239b4df1055c9a6981101ac1c795ebf5dcb 100644 (file)
@@ -4,7 +4,7 @@ function initLogin() {
   document.cookie = ("0xHIGHFLYxSOGo-0.9=discard; path=/"
                     + "; expires=" + date.toGMTString());
   var submit = $("submit");
-  Event.observe(submit, "click", onLoginClick);
+  submit.observe("click", onLoginClick);
 
   var userName = $("userName");
   userName.focus();
index e2f1f341bd4408361be4929496a48cef7fa1c8cf..714dd0df7d775af35b279af1ea98ca1694a83f1b 100644 (file)
@@ -353,31 +353,29 @@ function eventsListCallback(http) {
        startDate.setTime(data[i][4] * 1000);
        row.day = startDate.getDayString();
        row.hour = startDate.getHourString();
-       Event.observe(row, "mousedown", onRowClick);
-       Event.observe(row, "selectstart", listRowMouseDownHandler);
-       Event.observe(row, "dblclick",
-                     editDoubleClickedEvent.bindAsEventListener(row));
-       Event.observe(row, "contextmenu",
-                     onEventContextMenu.bindAsEventListener(row));
+       row.observe("mousedown", onRowClick);
+       row.observe("selectstart", listRowMouseDownHandler);
+       row.observe("dblclick", editDoubleClickedEvent);
+       row.observe("contextmenu", onEventContextMenu);
       
        var td = document.createElement("td");
        row.appendChild(td);
-       Event.observe(td, "mousedown", listRowMouseDownHandler, true);
+       td.observe("mousedown", listRowMouseDownHandler, true);
        td.appendChild(document.createTextNode(data[i][3]));
 
        td = document.createElement("td");
        row.appendChild(td);
-       Event.observe(td, "mousedown", listRowMouseDownHandler, true);
+       td.observe("mousedown", listRowMouseDownHandler, true);
        td.appendChild(document.createTextNode(data[i][10]));
 
        td = document.createElement("td");
        row.appendChild(td);
-       Event.observe(td, "mousedown", listRowMouseDownHandler, true);
+       td.observe("mousedown", listRowMouseDownHandler, true);
        td.appendChild(document.createTextNode(data[i][11]));
       
        td = document.createElement("td");
        row.appendChild(td);
-       Event.observe(td, "mousedown", listRowMouseDownHandler, true);
+       td.observe("mousedown", listRowMouseDownHandler, true);
        td.appendChild(document.createTextNode(data[i][6]));
       }
 
@@ -418,10 +416,10 @@ function tasksListCallback(http) {
       for (var i = 0; i < data.length; i++) {
        var listItem = document.createElement("li");
        list.appendChild(listItem);
-       Event.observe(listItem, "mousedown", listRowMouseDownHandler);
-       Event.observe(listItem, "click", onRowClick);
-       Event.observe(listItem, "dblclick",
-                     editDoubleClickedEvent.bindAsEventListener(listItem));
+       //      listItem.observe("mousedown", listRowMouseDownHandler);
+       //      listItem.observe("click", onRowClick);
+       //      listItem.observe("dblclick",
+       //                    editDoubleClickedEvent);
        listItem.setAttribute("id", data[i][0]);
        $(listItem).addClassName(data[i][5]);
        $(listItem).addClassName(data[i][6]);
@@ -431,11 +429,14 @@ function tasksListCallback(http) {
        var input = document.createElement("input");
        input.setAttribute("type", "checkbox");
        listItem.appendChild(input);
-       Event.observe(input, "click", updateTaskStatus.bindAsEventListener(input), true);
+       //      input.observe("click", updateTaskStatus, true);
        input.setAttribute("value", "1");
        if (data[i][2] == 1)
          input.setAttribute("checked", "checked");
        $(input).addClassName("checkBox");
+
+       setEventsOnCalendar(input, listItem);
+
        listItem.appendChild(document.createTextNode(data[i][3]));
       }
 
@@ -696,264 +697,264 @@ function refreshCalendarEvents(scrollEvent) {
 }
 
 function refreshCalendarEventsCallback(http) {
-   if (http.readyState == 4
-       && http.status == 200) {
-      if (http.responseText.length > 0) {
-         var data = http.responseText.evalJSON(true);
-         // log("refresh calendar events: " + data.length);
-         var dateTuples = new Array();
-         for (var i = 0; i < data.length; i++) {
-            var dates = drawCalendarEvent(data[i],
-                                          http.callbackData["startDate"],
-                                          http.callbackData["endDate"]);
-            dates.each(function(tuple) {
-                  if (tuple[3] == 0) tuple[3] = 96;
-                  dateTuples.push(tuple);
-               });
-         }
+  if (http.readyState == 4
+      && http.status == 200) {
+    if (http.responseText.length > 0) {
+      var data = http.responseText.evalJSON(true);
+      // log("refresh calendar events: " + data.length);
+      var dateTuples = new Array();
+      for (var i = 0; i < data.length; i++) {
+       var dates = drawCalendarEvent(data[i],
+                                     http.callbackData["startDate"],
+                                     http.callbackData["endDate"]);
+       dates.each(function(tuple) {
+           if (tuple[3] == 0) tuple[3] = 96;
+           dateTuples.push(tuple);
+         });
+      }
       
-         var c = {
-         div:               0,
-         day:               1,
-         start:             2,
-         end:               3,
-         siblingsCount:     4,
-         siblingsPosition:  5,
-         siblingsMaxCount:  6
-         };
-         for (var i = 0; i < dateTuples.length; i++) {
-            if (dateTuples[i].length < 6) {
-               dateTuples[i][c.siblingsCount] = 1;
-               dateTuples[i][c.siblingsPosition] = 0;
-            }
-            for (var j = 0; j < dateTuples.length; j++) {
-               if (j == i) continue;
-               if (dateTuples[i][c.day] == dateTuples[j][c.day]) {
-                  // Same day
-                  if (dateTuples[j][c.start] > dateTuples[i][c.start] &&
-                      dateTuples[j][c.start] < dateTuples[i][c.end] ||
+      var c = {
+      div:               0,
+      day:               1,
+      start:             2,
+      end:               3,
+      siblingsCount:     4,
+      siblingsPosition:  5,
+      siblingsMaxCount:  6
+      };
+      for (var i = 0; i < dateTuples.length; i++) {
+       if (dateTuples[i].length < 6) {
+         dateTuples[i][c.siblingsCount] = 1;
+         dateTuples[i][c.siblingsPosition] = 0;
+       }
+       for (var j = 0; j < dateTuples.length; j++) {
+         if (j == i) continue;
+         if (dateTuples[i][c.day] == dateTuples[j][c.day]) {
+           // Same day
+           if (dateTuples[j][c.start] > dateTuples[i][c.start] &&
+               dateTuples[j][c.start] < dateTuples[i][c.end] ||
                
-                      dateTuples[j][c.start] == dateTuples[i][c.start] &&
-                      dateTuples[j][c.end] < dateTuples[i][c.end] ||
-
-                      dateTuples[j][c.start] == dateTuples[i][c.start] &&
-                      dateTuples[j][c.end] == dateTuples[i][c.end] &&
-                      i < j) {
-                     // Same period
-                     if (dateTuples[j].length < 6) {
-                        dateTuples[j][c.siblingsCount] = 2;
-                        dateTuples[j][c.siblingsPosition] = dateTuples[i][c.siblingsPosition] + 1;
-                     }
-                     else {
-                        dateTuples[j][c.siblingsCount]++;
-                        dateTuples[j][c.siblingsPosition]++;
-                     }
-                     dateTuples[i][c.siblingsCount]++;
-                  }
-               }
-            }
-         }
+               dateTuples[j][c.start] == dateTuples[i][c.start] &&
+               dateTuples[j][c.end] < dateTuples[i][c.end] ||
+
+               dateTuples[j][c.start] == dateTuples[i][c.start] &&
+               dateTuples[j][c.end] == dateTuples[i][c.end] &&
+               i < j) {
+             // Same period
+             if (dateTuples[j].length < 6) {
+               dateTuples[j][c.siblingsCount] = 2;
+               dateTuples[j][c.siblingsPosition] = dateTuples[i][c.siblingsPosition] + 1;
+             }
+             else {
+               dateTuples[j][c.siblingsCount]++;
+               dateTuples[j][c.siblingsPosition]++;
+             }
+             dateTuples[i][c.siblingsCount]++;
+           }
+         }
+       }
+      }
          
-         // Second loop; adjust total number of siblings for each event
-         for (var i = 0; i < dateTuples.length; i++) {
-            //log (i + " " + dateTuples[i].inspect());
-            var maxCount = 0;
-            for (var j = 0; j < dateTuples.length; j++) {
-               if (j == i) continue;
-               if (dateTuples[i][c.day] == dateTuples[j][c.day]) {
-                  // Same day
-                  if (dateTuples[j][c.start] > dateTuples[i][c.start] &&
-                      dateTuples[j][c.start] < dateTuples[i][c.end] ||
+      // Second loop; adjust total number of siblings for each event
+      for (var i = 0; i < dateTuples.length; i++) {
+       //log (i + " " + dateTuples[i].inspect());
+       var maxCount = 0;
+       for (var j = 0; j < dateTuples.length; j++) {
+         if (j == i) continue;
+         if (dateTuples[i][c.day] == dateTuples[j][c.day]) {
+           // Same day
+           if (dateTuples[j][c.start] > dateTuples[i][c.start] &&
+               dateTuples[j][c.start] < dateTuples[i][c.end] ||
                
-                      dateTuples[j][c.start] == dateTuples[i][c.start] &&
-                      dateTuples[j][c.end] < dateTuples[i][c.end] ||
-
-                      dateTuples[j][c.start] == dateTuples[i][c.start] &&
-                      dateTuples[j][c.end] == dateTuples[i][c.end] &&
-                      i < j) {
-                     // Same period
-                     if (dateTuples[j][c.siblingsCount] > maxCount)
-                        maxCount = dateTuples[j][c.siblingsCount];
-                  }
-               }
-            }
-            if (maxCount > 0) {
-               dateTuples[i][c.siblingsCount] = maxCount;
-               dateTuples[i][c.siblingsMaxCount] = maxCount;
-            }
-         }
-
-         // Third loop; adjust position and total number of siblings for each event
-         for (var i = 0; i < dateTuples.length; i++) {
-            //log (i + " " + dateTuples[i].inspect());
-            for (var j = 0; j < dateTuples.length; j++) {
-               if (j == i) continue;
-               if (dateTuples[i][c.day] == dateTuples[j][c.day]) {
-                  // Same day
-                  if (dateTuples[j][c.start] > dateTuples[i][c.start] &&
-                      dateTuples[j][c.start] < dateTuples[i][c.end] ||
+               dateTuples[j][c.start] == dateTuples[i][c.start] &&
+               dateTuples[j][c.end] < dateTuples[i][c.end] ||
+
+               dateTuples[j][c.start] == dateTuples[i][c.start] &&
+               dateTuples[j][c.end] == dateTuples[i][c.end] &&
+               i < j) {
+             // Same period
+             if (dateTuples[j][c.siblingsCount] > maxCount)
+               maxCount = dateTuples[j][c.siblingsCount];
+           }
+         }
+       }
+       if (maxCount > 0) {
+         dateTuples[i][c.siblingsCount] = maxCount;
+         dateTuples[i][c.siblingsMaxCount] = maxCount;
+       }
+      }
+
+      // Third loop; adjust position and total number of siblings for each event
+      for (var i = 0; i < dateTuples.length; i++) {
+       //log (i + " " + dateTuples[i].inspect());
+       for (var j = 0; j < dateTuples.length; j++) {
+         if (j == i) continue;
+         if (dateTuples[i][c.day] == dateTuples[j][c.day]) {
+           // Same day
+           if (dateTuples[j][c.start] > dateTuples[i][c.start] &&
+               dateTuples[j][c.start] < dateTuples[i][c.end] ||
                
-                      dateTuples[j][c.start] == dateTuples[i][c.start] &&
-                      dateTuples[j][c.end] < dateTuples[i][c.end] ||
-
-                      dateTuples[j][c.start] == dateTuples[i][c.start] &&
-                      dateTuples[j][c.end] == dateTuples[i][c.end] &&
-                      i < j) {
-                     // Overlapping period
-                     if (dateTuples[j][c.siblingsPosition] == dateTuples[i][c.siblingsPosition]) {
-                        // Same position
-                        dateTuples[j][c.siblingsPosition]--; // not very clever
-                     }
-                     if (dateTuples[j].length < 7 ||
-                         dateTuples[j][c.siblingsMaxCount] < dateTuples[i][c.siblingsMaxCount])
-                        dateTuples[j][c.siblingsMaxCount] = dateTuples[i][c.siblingsMaxCount];
-                  }
-               }
-            }
-            if (dateTuples[i].length < 7)
-               dateTuples[i][c.siblingsMaxCount] = dateTuples[i][c.siblingsCount];
-         }
-
-         // Final loop; draw the events
-         //log ("[div, day, start index, end index, siblings count, siblings position, siblings max count]");
-         for (var i = 0; i < dateTuples.length; i++) {
-            //log (i + " " + dateTuples[i].inspect());
+               dateTuples[j][c.start] == dateTuples[i][c.start] &&
+               dateTuples[j][c.end] < dateTuples[i][c.end] ||
+
+               dateTuples[j][c.start] == dateTuples[i][c.start] &&
+               dateTuples[j][c.end] == dateTuples[i][c.end] &&
+               i < j) {
+             // Overlapping period
+             if (dateTuples[j][c.siblingsPosition] == dateTuples[i][c.siblingsPosition]) {
+               // Same position
+               dateTuples[j][c.siblingsPosition]--; // not very clever
+             }
+             if (dateTuples[j].length < 7 ||
+                 dateTuples[j][c.siblingsMaxCount] < dateTuples[i][c.siblingsMaxCount])
+               dateTuples[j][c.siblingsMaxCount] = dateTuples[i][c.siblingsMaxCount];
+           }
+         }
+       }
+       if (dateTuples[i].length < 7)
+         dateTuples[i][c.siblingsMaxCount] = dateTuples[i][c.siblingsCount];
+      }
+
+      // Final loop; draw the events
+      //log ("[div, day, start index, end index, siblings count, siblings position, siblings max count]");
+      for (var i = 0; i < dateTuples.length; i++) {
+       //log (i + " " + dateTuples[i].inspect());
        
-            var base = dateTuples[i][c.siblingsCount] * dateTuples[i][c.siblingsMaxCount];
-            var length = 1;
-            var maxLength = 1 * dateTuples[i][c.siblingsMaxCount];
+       var base = dateTuples[i][c.siblingsCount] * dateTuples[i][c.siblingsMaxCount];
+       var length = 1;
+       var maxLength = 1 * dateTuples[i][c.siblingsMaxCount];
 
-            for (var j = dateTuples[i][c.siblingsCount];
-                 j < maxLength;
-                 j += dateTuples[i][c.siblingsCount]) { }
+       for (var j = dateTuples[i][c.siblingsCount];
+            j < maxLength;
+            j += dateTuples[i][c.siblingsCount]) { }
 
-            if (j > maxLength) {
-               j -= dateTuples[i][c.siblingsCount];
-            }
+       if (j > maxLength) {
+         j -= dateTuples[i][c.siblingsCount];
+       }
        
-            var width = 100 * j / base;
-            var left = width * dateTuples[i][c.siblingsPosition];
-            dateTuples[i][0].setStyle({ width: width + "%",
-                     left: left + "%" });
-         }
+       var width = 100 * j / base;
+       var left = width * dateTuples[i][c.siblingsPosition];
+       dateTuples[i][0].setStyle({ width: width + "%",
+             left: left + "%" });
       }
-      scrollDayView(http.callbackData["scrollEvent"]);
-   }
-   else
-      log("AJAX error when refreshing calendar events");
+    }
+    scrollDayView(http.callbackData["scrollEvent"]);
+  }
+  else
+    log("AJAX error when refreshing calendar events");
 }
 
 function drawCalendarEvent(eventData, sd, ed) {
-   var dateTuples = new Array();
+  var dateTuples = new Array();
 
-   var viewStartDate = sd.asDate();
-   var viewEndDate = ed.asDate();
+  var viewStartDate = sd.asDate();
+  var viewEndDate = ed.asDate();
 
-   var startDate = new Date();
-   startDate.setTime(eventData[4] * 1000);
-   var endDate = new Date();
-   endDate.setTime(eventData[5] * 1000);
+  var startDate = new Date();
+  startDate.setTime(eventData[4] * 1000);
+  var endDate = new Date();
+  endDate.setTime(eventData[5] * 1000);
 
-   //log ("s: " + startDate + "; e: " + endDate);
+  //log ("s: " + startDate + "; e: " + endDate);
 
-   var days = startDate.daysUpTo(endDate);
+  var days = startDate.daysUpTo(endDate);
 
-   var title;
-   if (currentView == "monthview"
-       && (eventData[7] == 0))
-      title = startDate.getDisplayHoursString() + " " + eventData[3];
-   else
-      title = eventData[3];
+  var title;
+  if (currentView == "monthview"
+      && (eventData[7] == 0))
+    title = startDate.getDisplayHoursString() + " " + eventData[3];
+  else
+    title = eventData[3];
 
-   //    log("title: " + title); 
-   //    log("viewS: " + viewStartDate);
-   var startHour = null;
-   var endHour = null;
+  //    log("title: " + title); 
+  //    log("viewS: " + viewStartDate);
+  var startHour = null;
+  var endHour = null;
    
-   var siblings = new Array();
-   for (var i = 0; i < days.length; i++)
-      if (days[i].earlierDate(viewStartDate) == viewStartDate
-          && days[i].laterDate(viewEndDate) == viewEndDate) {
-         var starts;
-
-         //     log("day: " + days[i]);
-         if (i == 0) {
-            var quarters = (startDate.getUTCHours() * 4
-                            + Math.floor(startDate.getUTCMinutes() / 15));
-            starts = quarters;
-            startHour = startDate.getDisplayHoursString();
-            endHour = endDate.getDisplayHoursString();
-         }
-         else
-            starts = 0;
+  var siblings = new Array();
+  for (var i = 0; i < days.length; i++)
+    if (days[i].earlierDate(viewStartDate) == viewStartDate
+       && days[i].laterDate(viewEndDate) == viewEndDate) {
+      var starts;
+
+      //        log("day: " + days[i]);
+      if (i == 0) {
+       var quarters = (startDate.getUTCHours() * 4
+                       + Math.floor(startDate.getUTCMinutes() / 15));
+       starts = quarters;
+       startHour = startDate.getDisplayHoursString();
+       endHour = endDate.getDisplayHoursString();
+      }
+      else
+       starts = 0;
         
-         var ends;
-         var lasts;
-         if (i == days.length - 1) {
-            var quarters = (endDate.getUTCHours() * 4
-                            + Math.ceil(endDate.getUTCMinutes() / 15));
-            ends = quarters;
-         }
-         else
-            ends = 96;
-         lasts = ends - starts;
-         if (!lasts)
-            lasts = 1;
-
-         var eventDiv = newEventDIV(eventData[0], eventData[1], starts, lasts,
-                                    null, null, title);
-         siblings.push(eventDiv);
-         eventDiv.siblings = siblings;
-         if (eventData[9].length > 0)
-            eventDiv.addClassName(eventData[9]); // event owner status
-         //eventDiv.setStyle({ width: '50%' });
-         if (currentView != "monthview" && 
-             eventData[7] == 0) // not "all day"
-            dateTuples.push(new Array(eventDiv, days[i].getDayString(), starts, ends));
-         var dayString = days[i].getDayString();
-         // log("day: " + dayString);
-         var parentDiv = null;
-         if (currentView == "monthview") {
-            var dayDivs = $("monthDaysView").childNodesWithTag("div");
-            var j = 0; 
-            while (!parentDiv && j < dayDivs.length) {
-               if (dayDivs[j].getAttribute("day") == dayString)
-                  parentDiv = dayDivs[j];
-               else
-                  j++;
-            }
-         }
-         else {
-            if (eventData[7] == 0) {
-               var daysView = $("daysView");
-               var eventsDiv = $(daysView).childNodesWithTag("div")[1];
-               var dayDivs = $(eventsDiv).childNodesWithTag("div");
-               var j = 0; 
-               while (!parentDiv && j < dayDivs.length) {
-                  if (dayDivs[j].getAttribute("day") == dayString)
-                     parentDiv = dayDivs[j].childNodesWithTag("div")[0];
-                  else
-                     j++;
-               }
-            }
-            else {
-               var header = $("calendarHeader");
-               var daysDiv = $(header).childNodesWithTag("div")[1];
-               var dayDivs = $(daysDiv).childNodesWithTag("div");
-               var j = 0; 
-               while (!parentDiv && j < dayDivs.length) {
-                  if (dayDivs[j].getAttribute("day") == dayString)
-                     parentDiv = dayDivs[j];
-                  else
-                     j++;
-               }
-            }
-         }
-         if (parentDiv)
-            parentDiv.appendChild(eventDiv);
+      var ends;
+      var lasts;
+      if (i == days.length - 1) {
+       var quarters = (endDate.getUTCHours() * 4
+                       + Math.ceil(endDate.getUTCMinutes() / 15));
+       ends = quarters;
+      }
+      else
+       ends = 96;
+      lasts = ends - starts;
+      if (!lasts)
+       lasts = 1;
+
+      var eventDiv = newEventDIV(eventData[0], eventData[1], starts, lasts,
+                                null, null, title);
+      siblings.push(eventDiv);
+      eventDiv.siblings = siblings;
+      if (eventData[9].length > 0)
+       eventDiv.addClassName(eventData[9]); // event owner status
+      //eventDiv.setStyle({ width: '50%' });
+      if (currentView != "monthview" && 
+         eventData[7] == 0) // not "all day"
+       dateTuples.push(new Array(eventDiv, days[i].getDayString(), starts, ends));
+      var dayString = days[i].getDayString();
+      // log("day: " + dayString);
+      var parentDiv = null;
+      if (currentView == "monthview") {
+       var dayDivs = $("monthDaysView").childNodesWithTag("div");
+       var j = 0; 
+       while (!parentDiv && j < dayDivs.length) {
+         if (dayDivs[j].getAttribute("day") == dayString)
+           parentDiv = dayDivs[j];
+         else
+           j++;
+       }
       }
+      else {
+       if (eventData[7] == 0) {
+         var daysView = $("daysView");
+         var eventsDiv = $(daysView).childNodesWithTag("div")[1];
+         var dayDivs = $(eventsDiv).childNodesWithTag("div");
+         var j = 0; 
+         while (!parentDiv && j < dayDivs.length) {
+           if (dayDivs[j].getAttribute("day") == dayString)
+             parentDiv = dayDivs[j].childNodesWithTag("div")[0];
+           else
+             j++;
+         }
+       }
+       else {
+         var header = $("calendarHeader");
+         var daysDiv = $(header).childNodesWithTag("div")[1];
+         var dayDivs = $(daysDiv).childNodesWithTag("div");
+         var j = 0; 
+         while (!parentDiv && j < dayDivs.length) {
+           if (dayDivs[j].getAttribute("day") == dayString)
+             parentDiv = dayDivs[j];
+           else
+             j++;
+         }
+       }
+      }
+      if (parentDiv)
+       parentDiv.appendChild(eventDiv);
+    }
 
-   return dateTuples;
+  return dateTuples;
 }
 
 function eventClass(cname) {
@@ -1001,11 +1002,9 @@ function newEventDIV(cname, calendar, starts, lasts,
   }
   textDiv.appendChild(document.createTextNode(title));
 
-  Event.observe(eventDiv, "mousedown", listRowMouseDownHandler);
-  Event.observe(eventDiv, "click",
-               onCalendarSelectEvent.bindAsEventListener(eventDiv));
-  Event.observe(eventDiv, "dblclick",
-               editDoubleClickedEvent.bindAsEventListener(eventDiv));
+  eventDiv.observe("mousedown", listRowMouseDownHandler);
+  eventDiv.observe("click", onCalendarSelectEvent);
+  eventDiv.observe("dblclick", editDoubleClickedEvent);
 
   return eventDiv;
 }
@@ -1033,34 +1032,30 @@ function calendarDisplayCallback(http) {
     var days = document.getElementsByClassName("day", contentView);
     if (currentView == "monthview")
       for (var i = 0; i < days.length; i++) {
-        Event.observe(days[i], "click",
-                     onCalendarSelectDay.bindAsEventListener(days[i]));
-        Event.observe(days[i], "dblclick",
-                     onClickableCellsDblClick.bindAsEventListener(days[i]));
+        days[i].observe("click", onCalendarSelectDay);
+        days[i].observe("dblclick", onClickableCellsDblClick);
       }
     else {
       var headerDivs = $("calendarHeader").childNodesWithTag("div"); 
-      var headerDaysLabels = document.getElementsByClassName("day", headerDivs[0]);
+      var headerDaysLabels
+       = document.getElementsByClassName("day", headerDivs[0]);
       var headerDays = document.getElementsByClassName("day", headerDivs[1]);
       for (var i = 0; i < days.length; i++) {
        headerDays[i].hour = "allday";
-       Event.observe(headerDaysLabels[i], "mousedown", listRowMouseDownHandler);
-       Event.observe(headerDays[i], "click",
-                     onCalendarSelectDay.bindAsEventListener(days[i]));
-       Event.observe(headerDays[i], "dblclick",
-                     onClickableCellsDblClick.bindAsEventListener(headerDays[i]));
-       Event.observe(days[i], "click",
-                     onCalendarSelectDay.bindAsEventListener(days[i]));
-       var clickableCells = document.getElementsByClassName("clickableHourCell",
-                                                            days[i]);
+       headerDaysLabels[i].observe("mousedown", listRowMouseDownHandler);
+       headerDays[i].observe("click", onCalendarSelectDay);
+       headerDays[i].observe("dblclick", onClickableCellsDblClick);
+       days[i].observe("click", onCalendarSelectDay);
+       var clickableCells
+         = document.getElementsByClassName("clickableHourCell", days[i]);
        for (var j = 0; j < clickableCells.length; j++)
-         Event.observe(clickableCells[j], "dblclick",
-                       onClickableCellsDblClick.bindAsEventListener(clickableCells[j]));
+         clickableCells[j].observe("dblclick", onClickableCellsDblClick);
       }
     }
   }
   else
-    log ("calendarDisplayCallback Ajax error (" + http.readyState + "/" + http.status + ")");
+    log ("calendarDisplayCallback Ajax error ("
+        + http.readyState + "/" + http.status + ")");
 }
 
 function assignCalendar(name) {
@@ -1076,18 +1071,18 @@ function assignCalendar(name) {
 }
 
 function popupCalendar(node) {
-   var nodeId = $(node).readAttribute("inputId");
-   var input = $(nodeId);
-   input.calendar.popup();
+  var nodeId = $(node).readAttribute("inputId");
+  var input = $(nodeId);
+  input.calendar.popup();
 
-   return false;
+  return false;
 }
 
 function onEventContextMenu(event) {
   var topNode = $("eventsList");
   var menu = $("eventsListMenu");
 
-  Event.observe(menu, "hideMenu",  onEventContextMenuHide);
+  menu.observe("hideMenu", onEventContextMenuHide);
   popupMenu(event, "eventsListMenu", this);
 }
 
@@ -1496,30 +1491,6 @@ function updateCalendarsList(method) {
   }
 }
 
-function addContact(tag, fullContactName, contactId, contactName, contactEmail) {
-  var uids = $("uixselector-calendarsList-uidList");
-  //   log("addContact");
-  if (contactId)
-    {
-      var re = new RegExp("(^|,)" + contactId + "($|,)");
-
-      if (!re.test(uids.value))
-        {
-          if (uids.value.length > 0)
-            uids.value += ',' + contactId;
-          else
-            uids.value = contactId;
-          var names = $("calendarList");
-          var listElems = names.childNodesWithTag("li");
-          var colorDef = indexColor(listElems.length);
-          names.appendChild(userCalendarEntry(contactId, colorDef));
-
-        }
-    }
-
-  return false;
-}
-
 function validateBrowseURL(input) {
   var button = $("browseURLBtn");
 
@@ -1574,7 +1545,7 @@ function getMenus() {
                                      editEvent, deleteEvent, "-",
                                      onSelectAll, "-",
                                      null, null);
-  menus["calendarsMenu"] = new Array(onMenuModify,
+  menus["calendarsMenu"] = new Array(onCalendarModify,
                                     "-",
                                     onCalendarNew, onCalendarRemove,
                                     "-", null, null, "-",
@@ -1630,19 +1601,20 @@ function initCalendarSelector() {
   var items = list.childNodesWithTag("li");
   for (var i = 0; i < items.length; i++) {
     var input = items[i].childNodesWithTag("input")[0];
-    Event.observe(input, "click", updateCalendarStatus.bindAsEventListener(input));
-    Event.observe(items[i], "mousedown", listRowMouseDownHandler);
-    Event.observe(items[i], "selectstart", listRowMouseDownHandler);
-    Event.observe(items[i], "click", onRowClick);
+    input.observe("click", updateCalendarStatus);
+    items[i].observe("mousedown", listRowMouseDownHandler);
+    items[i].observe("selectstart", listRowMouseDownHandler);
+    items[i].observe("click", onRowClick);
+    items[i].observe("dblclick", onCalendarModify);
   }
 
   var links = $("calendarSelectorButtons").childNodesWithTag("a");
-  Event.observe(links[0], "click",  onCalendarNew);
-  Event.observe(links[1], "click",  onCalendarAdd);
-  Event.observe(links[2], "click",  onCalendarRemove);
+  links[0].observe("click", onCalendarNew);
+  links[1].observe("click", onCalendarAdd);
+  links[2].observe("click", onCalendarRemove);
 }
 
-function onMenuModify(event) {
+function onCalendarModify(event) {
   var folders = $("calendarList");
   var selected = folders.getSelectedNodes()[0];
 
@@ -1682,6 +1654,14 @@ function onCalendarAdd(event) {
   preventDefault(event);
 }
 
+function setEventsOnCalendar(checkBox, li) {
+  li.observe("mousedown", listRowMouseDownHandler);
+  li.observe("selectstart", listRowMouseDownHandler);
+  li.observe("click", onRowClick);
+  li.observe("dblclick", onCalendarModify);
+  checkBox.observe("click", updateCalendarStatus);
+}
+
 function appendCalendar(folderName, folderPath) {
   var owner;
 
@@ -1757,11 +1737,7 @@ function appendCalendar(folderName, folderPath) {
     $(colorBox).addClassName('calendarFolder' + folderPath.substr(1));
 
     // Register events (doesn't work with Safari)
-    Event.observe(li, "mousedown",  listRowMouseDownHandler);
-    Event.observe(li, "selectstart", listRowMouseDownHandler);
-    Event.observe(li, "click",  onRowClick);
-    Event.observe(checkBox, "click",
-                 updateCalendarStatus.bindAsEventListener(checkBox));
+    setEventsOnCalendar(checkBox, li);
 
     var url = URLForFolderID(folderPath) + "/canAccessContent";
     triggerAjaxRequest(url, calendarEntryCallback, folderPath);
@@ -1864,50 +1840,43 @@ function deletePersonalCalendarCallback(http) {
 function configureLists() {
   var list = $("tasksList");
   list.multiselect = true;
-  Event.observe(list, "mousedown",
-               onTasksSelectionChange.bindAsEventListener(list));
+  list.observe("mousedown", onTasksSelectionChange);
 
   var input = $("showHideCompletedTasks");
-  Event.observe(input, "click",
-               onShowCompletedTasks.bindAsEventListener(input));
+  input.observe("click", onShowCompletedTasks);
 
   list = $("eventsList");
   list.multiselect = true;
   configureSortableTableHeaders(list);
   TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true});
-  Event.observe(list, "mousedown",
-               onEventsSelectionChange.bindAsEventListener(list));
+  list.observe("mousedown", onEventsSelectionChange);
 }
 
 function initDateSelectorEvents() {
   var arrow = $("rightArrow");
-  Event.observe(arrow, "click",
-               onDateSelectorGotoMonth.bindAsEventListener(arrow));
+  arrow.observe("click", onDateSelectorGotoMonth);
   arrow = $("leftArrow");
-  Event.observe(arrow, "click",
-               onDateSelectorGotoMonth.bindAsEventListener(arrow));
+  arrow.observe("click", onDateSelectorGotoMonth);
    
   var menuButton = $("monthLabel");
-  Event.observe(menuButton, "click",
-               popupMonthMenu.bindAsEventListener(menuButton));
+  menuButton.observe("click", popupMonthMenu);
   menuButton = $("yearLabel");
-  Event.observe(menuButton, "click",
-               popupMonthMenu.bindAsEventListener(menuButton));
+  menuButton.observe("click", popupMonthMenu);
 }
 
 function initCalendars() {
-   sorting["attribute"] = "start";
-   sorting["ascending"] = true;
+  sorting["attribute"] = "start";
+  sorting["ascending"] = true;
   
-   if (!document.body.hasClassName("popup")) {
-      initDateSelectorEvents();
-      initCalendarSelector();
-      configureSearchField();
-      configureLists();
-      var selector = $("calendarSelector");
-      if (selector)
-         selector.attachMenu("calendarsMenu");
-   }
+  if (!document.body.hasClassName("popup")) {
+    initDateSelectorEvents();
+    initCalendarSelector();
+    configureSearchField();
+    configureLists();
+    var selector = $("calendarSelector");
+    if (selector)
+      selector.attachMenu("calendarsMenu");
+  }
 }
 
 FastInit.addOnLoad(initCalendars);
index 66a448d2d10de45b579bb4e0c4919c14e822137b..4e3e97d5f96ae055ebf962808f21e4309a9c1e67 100644 (file)
@@ -26,10 +26,10 @@ function addUserCallback(http) {
 }
 
 function setEventsOnUserNode(node) {
-   Event.observe(node, "mousedown", listRowMouseDownHandler);
-   Event.observe(node, "selectstart", listRowMouseDownHandler);
-   Event.observe(node, "dblclick", onOpenUserRights);
-   Event.observe(node, "click", onRowClick);
+   node.observe("mousedown", listRowMouseDownHandler);
+   node.observe("selectstart", listRowMouseDownHandler);
+   node.observe("dblclick", onOpenUserRights);
+   node.observe("click", onRowClick);
 }
 
 function nodeForUser(userName, userId) {
@@ -135,7 +135,7 @@ function onAclLoadHandler() {
    defaultUserID = $("defaultUserID").value;
    var defaultRolesBtn = $("defaultRolesBtn");
    if (defaultRolesBtn)
-      Event.observe(defaultRolesBtn, "click", openRightsForDefaultUser);
+      defaultRolesBtn.observe("click", openRightsForDefaultUser);
    var ul = $("userList");
    var lis = ul.childNodesWithTag("li");
    for (var i = 0; i < lis.length; i++)
@@ -144,8 +144,8 @@ function onAclLoadHandler() {
    var buttonArea = $("userSelectorButtons");
    if (buttonArea) {
       var buttons = buttonArea.childNodesWithTag("a");
-      Event.observe(buttons[0], "click", onUserAdd);
-      Event.observe(buttons[1], "click", onUserRemove);
+      buttons[0].observe("click", onUserAdd);
+      buttons[1].observe("click", onUserRemove);
    }
 
    AclEditor['userRightsHeight'] = window.opener.getUsersRightsWindowHeight();
index 815f93a7fab92fd106e961d3a1f857745a4cbbfd..a2f45ccfe60a3bdb7936ee79355ff37961423107 100644 (file)
@@ -305,23 +305,17 @@ function onAllDayChanged(event) {
 function initTimeWidgets(widgets) {
   this.timeWidgets = widgets;
 
-  Event.observe(widgets['start']['date'], "change",
-               this.onAdjustTime, false);
-  Event.observe(widgets['start']['hour'], "change",
-               this.onAdjustTime, false);
-  Event.observe(widgets['start']['minute'], "change",
-               this.onAdjustTime, false);
-
-  Event.observe(widgets['end']['date'], "change",
-               this.onAdjustTime, false);
-  Event.observe(widgets['end']['hour'], "change",
-               this.onAdjustTime, false);
-  Event.observe(widgets['end']['minute'], "change",
-               this.onAdjustTime, false);
+  widgets['start']['date'].observe("change", this.onAdjustTime, false);
+  widgets['start']['hour'].observe("change", this.onAdjustTime, false);
+  widgets['start']['minute'].observe("change", this.onAdjustTime, false);
+
+  widgets['end']['date'].observe("change", this.onAdjustTime, false);
+  widgets['end']['hour'].observe("change", this.onAdjustTime, false);
+  widgets['end']['minute'].observe("change", this.onAdjustTime, false);
 
   var allDayLabel = $("allDay");
   var input = $(allDayLabel).childNodesWithTag("input")[0];
-  Event.observe(input, "change", onAllDayChanged.bindAsEventListener(input));
+  input.observe("change", onAllDayChanged.bindAsEventListener(input));
   if (input.checked) {
     for (var type in widgets) {
       widgets[type]['hour'].disabled = true;
@@ -376,7 +370,7 @@ function initializeAttendeesHref() {
   var attendeesLabel = $("attendeesLabel");
   var attendeesNames = $("attendeesNames");
 
-  Event.observe(attendeesHref, "click", onAttendeesHrefClick, false);
+  attendeesHref.observe("click", onAttendeesHrefClick, false);
   refreshAttendees();
 }
 
index 46c0fc6caf05d91246c9ea91393dadbd2c7fcd15..f3681c61aba4bd4d3562eb467928b6de23414388 100644 (file)
@@ -138,10 +138,7 @@ TABLE#freeBusyData TD SPAN.freeBusyZoneElement
 
 SPAN.colorBox.free,
 TABLE#freeBusyData TD SPAN.freeBusyZoneElement
-{ background-color: #8ca6bd; }
-
-TABLE#freeBusyHeader TH SPAN.freeBusyZoneElement.busy
-{ background-color: #c55 !important; }
+{ background-color: #ebebe4; }
 
 DIV#freeBusyFooter
 { position: absolute;
@@ -188,7 +185,7 @@ SPAN.colorBox
 
 SPAN.colorBox.busy,
 SPAN.freeBusyZoneElement.busy
-{ background-color: #5a6b79 !important; }
+{ background-color: #35556b !important; }
 
 SPAN.colorBox.maybe-busy,
 SPAN.freeBusyZoneElement.maybe-busy
@@ -196,7 +193,7 @@ SPAN.freeBusyZoneElement.maybe-busy
 
 SPAN.colorBox.noFreeBusy,
 TABLE#freeBusyData TD.noFreeBusy
-{ background-color: #559; }
+{ background-color: #e09ebd; }
 
 DIV#freeBusyViewButtons
 { position: absolute;
index 9081c2fb35b3812f7d7c8b1acde2755fdbefab3e..169d322870b492271b6c3c73c70ae91e03832ac9 100644 (file)
@@ -395,18 +395,18 @@ function initializeWindowButtons() {
    var okButton = $("okButton");
    var cancelButton = $("cancelButton");
 
-   Event.observe(okButton, "click", onEditorOkClick, false);
-   Event.observe(cancelButton, "click", onEditorCancelClick, false);
+   okButton.observe("click", onEditorOkClick, false);
+   cancelButton.observe("click", onEditorCancelClick, false);
 
    var buttons = $("freeBusyViewButtons").childNodesWithTag("a");
    for (var i = 0; i < buttons.length; i++)
-     Event.observe(buttons[i], "click", listRowMouseDownHandler, false);
+     buttons[i].observe("click", listRowMouseDownHandler, false);
    buttons = $("freeBusyZoomButtons").childNodesWithTag("a");
    for (var i = 0; i < buttons.length; i++)
-     Event.observe(buttons[i], "click", listRowMouseDownHandler, false);
+     buttons[i].observe("click", listRowMouseDownHandler, false);
    buttons = $("freeBusyButtons").childNodesWithTag("a");
    for (var i = 0; i < buttons.length; i++)
-     Event.observe(buttons[i], "click", listRowMouseDownHandler, false);
+     buttons[i].observe("click", listRowMouseDownHandler, false);
 }
 
 function onEditorOkClick(event) {
@@ -624,7 +624,7 @@ function prepareAttendees() {
 
    var inputs = tableAttendees.getElementsByTagName("input");
    inputs[inputs.length - 2].setAttribute("autocomplete", "off");
-   Event.observe(inputs[inputs.length - 2], "click", newAttendee);
+   inputs[inputs.length - 2].observe("click", newAttendee);
 }
 
 function onWindowResize(event) {
@@ -670,7 +670,7 @@ function onFreeBusyLoadHandler() {
    prepareAttendees();
    onWindowResize(null);
    Event.observe(window, "resize", onWindowResize);
-   Event.observe($$('TABLE#freeBusy TD.freeBusyData DIV').first(), "scroll", onScroll);
+   $$('TABLE#freeBusy TD.freeBusyData DIV').first().observe("scroll", onScroll);
 }
 
 FastInit.addOnLoad(onFreeBusyLoadHandler);
@@ -683,24 +683,24 @@ function initTimeWidgets(widgets) {
    assignCalendar('startTime_date');
    assignCalendar('endTime_date');
 
-   Event.observe(widgets['start']['date'], "change",
+   widgets['start']['date'].observe("change",
                  this.onAdjustTime, false);
-   Event.observe(widgets['start']['hour'], "change",
+   widgets['start']['hour'].observe("change",
                  this.onAdjustTime, false);
-   Event.observe(widgets['start']['minute'], "change",
+   widgets['start']['minute'].observe("change",
                  this.onAdjustTime, false);
 
-   Event.observe(widgets['end']['date'], "change",
+   widgets['end']['date'].observe("change",
                  this.onAdjustTime, false);
-   Event.observe(widgets['end']['hour'], "change",
+   widgets['end']['hour'].observe("change",
                  this.onAdjustTime, false);
-   Event.observe(widgets['end']['minute'], "change",
+   widgets['end']['minute'].observe("change",
                  this.onAdjustTime, false);
 
    var allDayLabel = $("allDay");
    if (allDayLabel) {
       var input = $(allDayLabel).childNodesWithTag("input")[0];
-      Event.observe(input, "change", onAllDayChanged.bindAsEventListener(input));
+      input.observe("change", onAllDayChanged.bindAsEventListener(input));
       if (input.checked) {
          for (var type in widgets) {
             widgets[type]['hour'].disabled = true;
index 1c739b5ca5534dc2fa2461143e686c90bbf225a9..4fee972d75f0572bee796effc13dedabb1e131e5 100644 (file)
@@ -1,9 +1,9 @@
 function onCancelClick(event) {
-   window.close();
+  window.close();
 }
 
 function initACLButtons() {
-  Event.observe($("cancelButton"), "click", onCancelClick);
+  $("cancelButton").observe("click", onCancelClick);
 }
 
 FastInit.addOnLoad(initACLButtons);
index dbd8c21936a923a465e8ae975017d9565f628359..9cc02b2cee518129bd9822d8580f7645f409abf8 100644 (file)
@@ -82,7 +82,7 @@ function initializeDocumentHref() {
   var documentLabel = $("documentLabel");
   var documentUrl = $("url");
 
-  Event.observe(documentHref, "click", onPopupDocumentWindow, false);
+  documentHref.observe("click", onPopupDocumentWindow, false);
   documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
   if (documentUrl.value.length > 0) {
     documentHref.appendChild(document.createTextNode(documentUrl.value));
@@ -90,7 +90,7 @@ function initializeDocumentHref() {
   }
 
   var changeUrlButton = $("changeUrlButton");
-  Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
+  changeUrlButton.observe("click", onPopupUrlWindow, false);
 }
 
 function initializePrivacyMenu() {
@@ -114,16 +114,16 @@ function onComponentEditorLoad(event) {
   initializeDocumentHref();
   initializePrivacyMenu();
   var list = $("calendarList");
-  Event.observe(list, "mousedown",
+  list.observe("mousedown",
                 onChangeCalendar.bindAsEventListener(list),
                 false);
   list.fire("mousedown");
 
   var menuItems = $("itemPrivacyList").childNodesWithTag("li");
   for (var i = 0; i < menuItems.length; i++)
-     Event.observe(menuItems[i], "mousedown",
-                   onMenuSetClassification.bindAsEventListener(menuItems[i]),
-                   false);
+     menuItems[i].observe("mousedown",
+                         onMenuSetClassification.bindAsEventListener(menuItems[i]),
+                         false);
 
   $("repeatHref").observe("click", onPopupRecurrenceWindow);
   $("repeatList").observe("change", onPopupRecurrenceWindow);
index a38422dc48a9d11c390818c75994daf4ce96fc57..6d21bdfa360822a05cd1179e20c51148d4fed665 100644 (file)
@@ -4,7 +4,7 @@ function onCancelClick(event) {
 
 function initACLButtons() {
   var button = $("cancelButton");
-   Event.observe(button, "click", onCancelClick);
+  button.observe("click", onCancelClick);
 }
 
 FastInit.addOnLoad(initACLButtons);
index 1aa2e1a5459bedec6bc302c8d69bc7cccf0a6e50..3160af40039ae1106fbd08feae8e273e4625aadb 100644 (file)
@@ -198,7 +198,7 @@ function clickedEditorAttach(sender) {
                                        name: attachmentName },
                                      area);
     attachmentCount++;
-    Event.observe(newAttachment, "change",
+    newAttachment.observe("change",
                  onAttachmentChange.bindAsEventListener(newAttachment));
   }
 
@@ -225,7 +225,7 @@ function createAttachment(node, list) {
   var attachment = createElement("li", null, null, { node: node }, null, list);
   createElement("img", null, null, { src: ResourcesURL + "/attachment.gif" },
                null, attachment);
-  Event.observe(attachment, "click", onRowClick);
+  attachment.observe("click", onRowClick);
 
   var filename = node.value;
   var separator;
@@ -312,6 +312,9 @@ function initMailEditor() {
   onWindowResize(null);
   Event.observe(window, "resize", onWindowResize);
   Event.observe(window, "beforeunload", onMailEditorClose);
+
+  var focusField = (mailIsReply ? textarea : $("addr_0"));
+  focusField.focus();
 }
 
 function getMenus() {
index 5443379fc1b5779a8f5dd24493c82afeb71a2bb9..ebad2f50af7658a71b4d2ff62c649d85ba780062 100644 (file)
@@ -69,8 +69,8 @@ function initializeWindowButtons() {
   var okButton = $("okButton");
   var cancelButton = $("cancelButton");
 
-  Event.observe(okButton, "click", onEditorOkClick, false);
-  Event.observe(cancelButton, "click", onEditorCancelClick, false);
+  okButton.observe("click", onEditorOkClick, false);
+  cancelButton.observe("click", onEditorCancelClick, false);
 
   var repeatType = $("repeatType");
   setRepeatType(parseInt(repeatType.value));
index e56d28f2512216012358ab02d1265859a6cdee68..6964ee79abf04f66281614c334cea20aa3c4e724 100644 (file)
@@ -251,9 +251,9 @@ this.onAdjustDueTime = function(event) {
 this.initTimeWidgets = function (widgets) {
    this.timeWidgets = widgets;
    
-   Event.observe(widgets['start']['date'], "change", this.onAdjustDueTime, false);
-   Event.observe(widgets['start']['hour'], "change", this.onAdjustDueTime, false);
-   Event.observe(widgets['start']['minute'], "change", this.onAdjustDueTime, false);
+   widgets['start']['date'].observe("change", this.onAdjustDueTime, false);
+   widgets['start']['hour'].observe("change", this.onAdjustDueTime, false);
+   widgets['start']['minute'].observe("change", this.onAdjustDueTime, false);
 };
    
 function onStatusListChange(event) {
@@ -290,7 +290,7 @@ function onStatusListChange(event) {
 
 function initializeStatusLine() {
   var statusList = $("statusList");
-  Event.observe(statusList, "mouseup", onStatusListChange, false);
+  statusList.observe("mouseup", onStatusListChange, false);
 }
 
 function onTaskEditorLoad() {
diff --git a/UI/WebServerResources/minus.png b/UI/WebServerResources/minus.png
new file mode 100644 (file)
index 0000000..66a71f1
Binary files /dev/null and b/UI/WebServerResources/minus.png differ
diff --git a/UI/WebServerResources/plus.png b/UI/WebServerResources/plus.png
new file mode 100644 (file)
index 0000000..bf37a17
Binary files /dev/null and b/UI/WebServerResources/plus.png differ