From 1c1d49f3b42bfa18245f6cbf770087d6dc4ece79 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Thu, 7 Feb 2008 23:12:12 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1363 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 4 +++ SoObjects/Mailer/SOGoMailAccount.m | 4 +-- UI/WebServerResources/ContactsUI.js | 45 ++++++++++++++++++++++------- UI/WebServerResources/generic.js | 8 ++++- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index e17a8e43..84bb6628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-02-07 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -imap4URLString]): compose the mail hostname part of the url by + escaping the username. This is part of the fix below. + * SoObjects/SOGo/SOGoUser.m ([SOGoUser -mailAccounts]): if the loginname for the default mail account contains an "@", it should be url-escaped to avoid confusing NSURL. diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 357b7702..7270874e 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -246,7 +246,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default return [creds objectAtIndex:0]; /* the user */ } -- (NSString *) urlHostString +- (NSString *) _urlHostString { NSDictionary *mailAccount; NSString *username, *escUsername, *hostString; @@ -280,7 +280,7 @@ static NSString *otherUsersFolderName = @""; // TODO: add English default else [urlString appendString: @"imap://"]; - host = [self urlHostString]; + host = [self _urlHostString]; if (![host rangeOfString: @"@"].length) [urlString appendFormat: @"%@@", [self imap4LoginFromHTTP]]; [urlString appendFormat: @"%@/", host]; diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 4ec02478..e6196b0b 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -169,7 +169,7 @@ function onContactFoldersContextMenu(event) { $(this).selectElement(); } -function onContactContextMenu(event, element) { log ("onContactContextMenu"); +function onContactContextMenu(event, element) {// log ("onContactContextMenu"); var menu = $("contactMenu"); Event.observe(menu, "mousedown", onContactContextMenuHide, false); @@ -311,13 +311,6 @@ function onMenuEditContact(event) { function onMenuWriteToContact(event) { var contactId = document.menuTarget.getAttribute('id'); - var contactRow = $(contactId); - var emailCell = contactRow.down('td', 1); - - if (!emailCell.firstChild) { // .nodeValue is the contact email address - window.alert(labels["The selected contact has no email address."]); - return false; - } openMailComposeWindow(ApplicationBaseURL + currentContactFolder + "/" + contactId + "/write"); @@ -326,6 +319,13 @@ function onMenuWriteToContact(event) { window.close(); } +function onMenuAIMContact(event) { + var contactRow = $(document.menuTarget.getAttribute('id')); + var aimCell = contactRow.down('td', 2); + + window.location.href = "aim:goim?ScreenName=" + aimCell.firstChild.nodeValue; +} + function onMenuDeleteContact(event) { uixDeleteSelectedContacts(this); } @@ -808,7 +808,7 @@ function onMenuSharing(event) { function onContactFoldersMenuPrepareVisibility() { var folders = $("contactFolders"); - var selected = folders.getSelectedNodes(); + var selected = folders.getSelectedNodes(); if (selected.length > 0) { var folderOwner = selected[0].getAttribute("owner"); @@ -827,19 +827,42 @@ function onContactFoldersMenuPrepareVisibility() { } } +function onContactMenuPrepareVisibility() { + 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 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, null, "-", - onMenuDeleteContact); + onMenuWriteToContact, onMenuAIMContact, + "-", onMenuDeleteContact); menus["searchMenu"] = new Array(setSearchCriteria); var contactFoldersMenu = $("contactFoldersMenu"); if (contactFoldersMenu) contactFoldersMenu.prepareVisibility = onContactFoldersMenuPrepareVisibility; + var contactMenu = $("contactMenu"); + if (contactMenu) + contactMenu.prepareVisibility = onContactMenuPrepareVisibility; return menus; } diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 0888d79a..41d184bd 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -652,6 +652,11 @@ function onBodyClickMenuHandler(event) { preventDefault(event); } +function onMenuClickHandler(event) { + if (!this.hasClassName("disabled")) + this.menuCallback.apply(this, [event]); +} + function hideMenu(menuNode) { var onHide; @@ -1198,7 +1203,8 @@ function initMenu(menuDIV, callbacks) { } else { node.observe("mouseup", onBodyClickMenuHandler); - node.observe("click", callback); + node.menuCallback = callback; + node.observe("click", onMenuClickHandler); } } else -- 2.39.5