From 03625e4aae6899d53efc7ddd20104b2fa266a7ba Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 2 Dec 2011 07:22:47 +0000 Subject: [PATCH] See ChangeLog. Monotone-Parent: 1ea08f6ec84d602c5e78b6c440e2f7d6297a82cd Monotone-Revision: 61b12be970a9603306d37277ee431b6fd5ab89cd Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-12-02T07:22:47 --- ChangeLog | 45 ++++ NEWS | 16 ++ SoObjects/SOGo/SOGoUserFolder.h | 4 + UI/MailerUI/Toolbars/SOGoDraftObject.toolbar | 9 +- UI/MailerUI/Toolbars/SOGoMailFolder.toolbar | 67 ++++++ UI/MailerUI/Toolbars/SOGoMailObject.toolbar | 34 +-- UI/MailerUI/UIxMailEditor.m | 72 +++++- UI/MailerUI/product.plist | 8 +- UI/MainUI/UIxLoading.h | 35 +++ UI/MainUI/UIxLoading.m | 37 +++ UI/MainUI/product.plist | 4 + .../Toolbars/UIxPreferences.toolbar | 2 +- UI/SOGoUI/UIxComponent.m | 18 ++ .../ContactsUI/UIxContactsUserFolders.wox | 2 + UI/Templates/MailerUI/UIxMailEditor.wox | 55 ++++- UI/Templates/UIxJSClose.wox | 14 +- UI/WebServerResources/ContactsUI.css | 4 + UI/WebServerResources/ContactsUI.js | 163 ++++++++------ UI/WebServerResources/HTMLElement.js | 4 +- UI/WebServerResources/MailerUI.css | 2 +- UI/WebServerResources/MailerUI.js | 47 ++-- UI/WebServerResources/UIxContactEditor.js | 3 +- .../UIxContactsUserFolders.js | 6 +- UI/WebServerResources/UIxListEditor.css | 2 + UI/WebServerResources/UIxListEditor.js | 7 +- UI/WebServerResources/UIxMailEditor.css | 97 +++++++- UI/WebServerResources/UIxMailEditor.js | 114 ++++++---- UI/WebServerResources/generic.css | 45 +++- UI/WebServerResources/generic.js | 213 +++++++++++++----- UI/WebServerResources/iefixes.css | 15 +- 30 files changed, 904 insertions(+), 240 deletions(-) create mode 100644 UI/MailerUI/Toolbars/SOGoMailFolder.toolbar create mode 100644 UI/MainUI/UIxLoading.h create mode 100644 UI/MainUI/UIxLoading.m diff --git a/ChangeLog b/ChangeLog index 34f354f0f..6891016d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2011-12-05 Francis Lachapelle + + * UI/WebServerResources/MailerUI.js (deleteSelectedMessages) + (onMailboxTreeItemClick, onMessageSelecitionChange) + (configureMessageListEvents): update the message content div only + if it exists (will be hidden in single-window mode). + + * UI/WebServerResources/UIxContactsUserFolders.js + (initUserFoldersWindow): registered "click" event on new Done button. + + * UI/WebServerResources/UIxMailEditor.js (onContactAdd): show + contacts in a pane instead of a new window. + (onContactFolderChange): new method to update the contacts list + when changing contacts folder from the new popup menu. + (configureDragHandle): new method to allow the new contacts pane + to be resizable. + (onMailEditorResize): was onWindowResize. Now computes the space + used by the search contacts pane. + + * UI/WebServerResources/ContactsUI.js (getMenus): the function now + overloads the returning array with the menus defined by the + previously defined function with the same name. Used in + UIxMailEditor.wox that loads both MailerUI.js and ContactsUI.js. + (contactsListCallback): added support for 2-column view. Also + used in mail editor to refresh the new contacts pane. + (initContacts, onContactSelectionChange): don't update contactView when the div + doesn't exist. + (configureDraggables): don't allow drag'n'drop when the folders + list doesn't exist. + + * UI/MainUI/UIxLoading.m: new class for empty template used when + loading the iframe in single-window mode. + 2011-12-05 Wolfgang Sourdeau * UI/Scheduler/UIxComponentEditor.m (-setCategory): ensure that @@ -70,6 +103,18 @@ resulting string to @"" when the unicode or string pointers are NULL. +2011-11-28 Francis Lachapelle + + * UI/SOGoUI/UIxComponent.m (-singleWindowModeEnabled): new method + that returns true if the single-window mode is enabled. This mode + can be forced by setting the cookie "SOGoWindowMode" to "single". + + * UI/MailerUI/UIxMailEditor.m (-contactFolders) + (-personalContactInfos, -setCurrentFolder:, -currentContactFolderId) + (-currentContactFolderName, -currentContactFolderOwner) + (-currentContactFolderClass): getters/setters for new contacts + pane in the mail editor. + 2011-11-28 Wolfgang Sourdeau * OpenChange/MAPIStoreContext.m diff --git a/NEWS b/NEWS index d59c2923b..0e36006d0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +1.3-201112DD (1.3.11) +--------------------- +New Features + - new experimental feature to force popup windows to appear in an iframe -- this mode + can be forced by setting the cookie "SOGoWindowMode" to "single" + +Enhancements + - contacts from the email editor now appear in a pane, like in Thunderbird + - added DanishDenmark translation - thanks to Altibox + - updated German translation + - updated SpanishArgentina translation + - updated SpanishSpain translation + +Bug Fixes + - + 1.3-20111130 (1.3.10) --------------------- New Features diff --git a/SoObjects/SOGo/SOGoUserFolder.h b/SoObjects/SOGo/SOGoUserFolder.h index a51c326f7..2cb02aa3e 100644 --- a/SoObjects/SOGo/SOGoUserFolder.h +++ b/SoObjects/SOGo/SOGoUserFolder.h @@ -39,6 +39,7 @@ @class NSDictionary; @class NSString; @class WOContext; +@class SOGoContactFolders; @interface SOGoUserFolder : SOGoFolder @@ -58,6 +59,9 @@ - (BOOL) collectionDavKey: (NSString *) key matches: (NSString *) value; +- (SOGoContactFolders *) privateContacts: (NSString *) _key + inContext: (WOContext *) _ctx; + @end #endif /* __SOGo_SOGoUserFolder_H__ */ diff --git a/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar b/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar index 9a677f406..c4c1020ad 100644 --- a/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar +++ b/UI/MailerUI/Toolbars/SOGoDraftObject.toolbar @@ -10,7 +10,7 @@ ), ( { link = "#"; - onclick = "return onContactAdd(null);"; + onclick = "return onContactAdd(this);"; image = "tb-compose-contacts-flat-24x24.png"; cssClass = "tbicon_addressbook"; label = "Contacts"; @@ -35,5 +35,12 @@ image = "options.png"; cssClass = "tbicon_options"; label = "Options"; } + ), + ( + { link = "#"; + isSafe = NO; + onclick = "return onCloseButtonClick(event);"; + label = "Close"; + image = "tb-mail-stop-flat-24x24.png"; } ) ) diff --git a/UI/MailerUI/Toolbars/SOGoMailFolder.toolbar b/UI/MailerUI/Toolbars/SOGoMailFolder.toolbar new file mode 100644 index 000000000..a84c9780c --- /dev/null +++ b/UI/MailerUI/Toolbars/SOGoMailFolder.toolbar @@ -0,0 +1,67 @@ +( /* the toolbar groups -*-cperl-*- */ + + ( // first group + { link = "#"; + image = "tb-mail-getmail-flat-24x24.png"; + cssClass = "tbicon_getmail"; + label = "Get Mail"; + onclick = "return refreshMailbox(this);"; + tooltip = "Get new messages"; }, + { link = "#"; + isSafe = NO; + image = "tb-mail-write-flat-24x24.png"; + onclick = "return onComposeMessage();"; + cssClass = "tbicon_compose"; + label = "Write"; + tooltip = "Create a new message"; }, + ), + + ( // second group + { link = "#"; + onclick = "return openMessageWindowsForSelection('reply');"; + isSafe = NO; + image = "tb-mail-reply-flat-24x24.png"; + cssClass = "tbicon_reply"; + label = "Reply"; + tooltip = "Reply to the message"; }, + { link = "#"; + onclick = "return openMessageWindowsForSelection('replyall');"; + isSafe = NO; + image = "tb-mail-replyall-flat-24x24.png"; + cssClass = "tbicon_replyall"; + label = "Reply All"; + tooltip = "Reply to sender and all recipients"; }, + { link = "#"; + onclick = "return openMessageWindowsForSelection('forward');"; + isSafe = NO; + image = "tb-mail-forward-flat-24x24.png"; + cssClass = "tbicon_forward"; + label = "Forward"; + tooltip = "Forward selected message"; }, + ), + + ( // third group + { link = "#"; + isSafe = NO; + onclick = "onMenuDeleteMessage(event);"; +// enabled = showMarkDeletedButton; + image = "tb-mail-delete-flat-24x24.png"; + cssClass = "tbicon_delete"; + label = "Delete"; + tooltip = "Delete selected message or folder"; }, +// { link = "#"; +// isSafe = NO; +// image = "tb-mail-junk-flat-24x24.png"; +// cssClass = "tbicon_junk"; +// label = "Junk"; +// tooltip = "Mark the selected messages as junk"; }, + ), + ( + { link = "#"; + onclick = "return onPrintCurrentMessage(event);"; + cssClass = "tbicon_print"; + image = "tb-mail-print-flat-24x24.png"; + label = "Print"; + tooltip = "Print this message"; }, + ) +) diff --git a/UI/MailerUI/Toolbars/SOGoMailObject.toolbar b/UI/MailerUI/Toolbars/SOGoMailObject.toolbar index f17c464a6..727c6e8eb 100644 --- a/UI/MailerUI/Toolbars/SOGoMailObject.toolbar +++ b/UI/MailerUI/Toolbars/SOGoMailObject.toolbar @@ -1,29 +1,6 @@ ( /* the toolbar groups -*-cperl-*- */ - ( /* first group */ - { link = "#"; - image = "tb-mail-getmail-flat-24x24.png"; - cssClass = "tbicon_getmail"; - label = "Get Mail"; - onclick = "return refreshMailbox(this);"; - tooltip = "Get new messages"; }, - { link = "#"; - isSafe = NO; - image = "tb-mail-write-flat-24x24.png"; - onclick = "return onComposeMessage();"; - cssClass = "tbicon_compose"; - label = "Write"; - tooltip = "Create a new message"; }, - { link = "#"; - target = "addressbook"; - onclick = "openAddressbook(this);return false;"; - image = "tb-mail-addressbook-flat-24x24.png"; - cssClass = "tbicon_addressbook"; - label = "Addressbook"; - tooltip = "Go to address book"; }, - ), - - ( // second group + ( // first group { link = "#"; onclick = "return openMessageWindowsForSelection('reply');"; isSafe = NO; @@ -47,7 +24,7 @@ tooltip = "Forward selected message"; }, ), - ( // third group + ( // second group { link = "#"; isSafe = NO; onclick = "onMenuDeleteMessage(event);"; @@ -71,4 +48,11 @@ label = "Print"; tooltip = "Print this message"; }, ), + ( + { link = "#"; + isSafe = NO; + onclick = "return onCloseButtonClick(event);"; + label = "Close"; + image = "tb-mail-stop-flat-24x24.png"; } + ) ) diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index 66c8dd0fa..26fafd12b 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -1,6 +1,6 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG - Copyright (C) 2008-2010 Inverse inc. + Copyright (C) 2008-2011 Inverse inc. This file is part of SOGo. @@ -47,15 +47,19 @@ #import #import -#import -#import -#import -#import #import +#import #import #import #import #import +#import +#import +#import +#import +#import +#import +#import /* UIxMailEditor @@ -80,6 +84,7 @@ NSString *priority; NSString *receipt; id item; + id currentFolder; /* these are for the inline attachment list */ NSString *attachmentName; @@ -108,6 +113,7 @@ static NSArray *infoKeys = nil; { priority = @"NORMAL"; receipt = nil; + currentFolder = nil; } return self; @@ -131,6 +137,7 @@ static NSArray *infoKeys = nil; [attachmentName release]; [attachmentNames release]; [attachedFiles release]; + [currentFolder release]; [super dealloc]; } @@ -386,6 +393,61 @@ static NSArray *infoKeys = nil; return [self valuesForKeys:infoKeys]; } +/* contacts search */ +- (NSArray *) contactFolders +{ + SOGoContactFolders *folderContainer; + + folderContainer = (SOGoContactFolders *) [[[self clientObject] lookupUserFolder] privateContacts: @"Contacts" + inContext: nil]; + + return [folderContainer subFolders]; +} + +- (NSArray *) personalContactInfos +{ + SOGoContactFolders *folderContainer; + id folder; + NSArray *contactInfos; + + folderContainer = (SOGoContactFolders *) [[[self clientObject] lookupUserFolder] privateContacts: @"Contacts" + inContext: nil]; + folder = [folderContainer lookupPersonalFolder: @"personal" ignoringRights: YES]; + + contactInfos = [folder lookupContactsWithFilter: nil + onCriteria: nil + sortBy: @"c_cn" + ordering: NSOrderedAscending]; + + return contactInfos; +} + +- (void) setCurrentFolder: (id) _currentFolder +{ + ASSIGN (currentFolder, _currentFolder); +} + +- (NSString *) currentContactFolderId +{ + return [NSString stringWithFormat: @"/%@", [currentFolder nameInContainer]]; +} + +- (NSString *) currentContactFolderName +{ + return [currentFolder displayName]; +} + +- (NSString *) currentContactFolderOwner +{ + return [currentFolder ownerInContext: context]; +} + +- (NSString *) currentContactFolderClass +{ + return ([currentFolder isKindOfClass: [SOGoContactSourceFolder class]] + ? @"remote" : @"local"); +} + /* requests */ - (BOOL) shouldTakeValuesFromRequest: (WORequest *) request diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index a35b3ecdb..49941d90b 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -73,7 +73,7 @@ slots = { toolbar = { protectedBy = "View"; - value = "SOGoMailObject.toolbar"; + value = "SOGoMailFolder.toolbar"; }; }; methods = { @@ -184,7 +184,7 @@ slots = { toolbar = { protectedBy = "View"; - value = "SOGoMailObject.toolbar"; + value = "SOGoMailFolder.toolbar"; }; }; methods = { @@ -329,7 +329,7 @@ slots = { toolbar = { protectedBy = "View"; - value = "SOGoMailObject.toolbar"; + value = "SOGoMailFolder.toolbar"; }; }; methods = { @@ -369,7 +369,7 @@ slots = { toolbar = { protectedBy = "View"; - value = "SOGoMailObject.toolbar"; + value = "SOGoMailFolder.toolbar"; }; }; methods = { diff --git a/UI/MainUI/UIxLoading.h b/UI/MainUI/UIxLoading.h new file mode 100644 index 000000000..092603644 --- /dev/null +++ b/UI/MainUI/UIxLoading.h @@ -0,0 +1,35 @@ +/* UIxLoading.h - this file is part of SOGo + * + * Copyright (C) 2011 Inverse inc. + * + * Author: Francis Lachapelle + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef UIXLOADING_H +#define UIXLOADING_H + +#import + + +@interface UIxLoading : UIxComponent +{ +} + +@end + +#endif /* UIXLOADING_H */ diff --git a/UI/MainUI/UIxLoading.m b/UI/MainUI/UIxLoading.m new file mode 100644 index 000000000..6647658d1 --- /dev/null +++ b/UI/MainUI/UIxLoading.m @@ -0,0 +1,37 @@ +/* UIxLoading.m - this file is part of SOGo + * + * Copyright (C) 2011 Inverse inc. + * + * Author: Francis Lachapelle + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +#import "UIxLoading.h" + +@implementation UIxLoading + +- (NSString *) doctype +{ + return (@"\n" + @""); +} + +@end diff --git a/UI/MainUI/product.plist b/UI/MainUI/product.plist index e5942c8bb..212429a0c 100644 --- a/UI/MainUI/product.plist +++ b/UI/MainUI/product.plist @@ -144,6 +144,10 @@ pageName = "SOGoRootPage"; actionName = "changePassword"; }; + loading = { + protectedBy = ""; + pageName = "UIxLoading"; + }; GET = { // more or less a hack, see README of dbd protectedBy = ""; pageName = "SOGoRootPage"; diff --git a/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar index b30200e85..09b0c9d8d 100644 --- a/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar +++ b/UI/PreferencesUI/Toolbars/UIxPreferences.toolbar @@ -6,7 +6,7 @@ { link = "#"; isSafe = NO; label = "Close"; - onclick = "window.close(); return false;"; + onclick = "return onCloseButtonClick();"; image = "tb-mail-stop-flat-24x24.png"; } ) ) diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index 86a105f7d..473d2bf9a 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -447,6 +447,24 @@ static NSMutableArray *abbrMonthLabelKeys = nil; inContext: context]); } +- (BOOL) singleWindowModeEnabled +{ + //WEClientCapabilities *cc; + NSString *value; + BOOL result; + + //cc = [[context request] clientCapabilities]; + + //NSLog(@"User agent = %@, Type = %@, OS = %@, CPU = %@, Browser major version = %i", [cc userAgent], [cc userAgentType], [cc os], [cc cpu], [cc majorVersion]); + + value = [[context request] cookieValueForKey: @"SOGoWindowMode"]; + result = ([value isEqualToString: @"single"]); + + NSLog(@"Single window mode %@", result?@"enabled":@"disabled"); + + return result; +} + /* SoUser */ - (NSString *) shortUserNameForDisplay diff --git a/UI/Templates/ContactsUI/UIxContactsUserFolders.wox b/UI/Templates/ContactsUI/UIxContactsUserFolders.wox index fe5bb2dc2..5b34b2f37 100644 --- a/UI/Templates/ContactsUI/UIxContactsUserFolders.wox +++ b/UI/Templates/ContactsUI/UIxContactsUserFolders.wox @@ -17,5 +17,7 @@ diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index 15abf5513..2658ddfef 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -11,7 +11,7 @@ title="panelTitle" const:popup="YES" const:userDefaultsKeys="SOGoMailComposeMessageType,SOGoMailReplyPlacement,SOGoMailSignature" - const:jsFiles="UIxMailToSelection.js,ckeditor/ckeditor.js,SOGoAutoCompletion.js"> + const:jsFiles="UIxMailToSelection.js,ckeditor/ckeditor.js,SOGoAutoCompletion.js,ContactsUI.js"> + + diff --git a/UI/WebServerResources/ContactsUI.css b/UI/WebServerResources/ContactsUI.css index 4c187b8cd..ecea7053f 100644 --- a/UI/WebServerResources/ContactsUI.css +++ b/UI/WebServerResources/ContactsUI.css @@ -201,11 +201,15 @@ TABLE#contactsList -khtml-user-select: none; width: 100%; } +TABLE#contactsList TBODY TD +{ cursor: pointer; } + TABLE#contactsList TD, TABLE#contactsList TH { overflow: hidden; line-height: 16px; height: 18px; + text-overflow: ellipsis; white-space: nowrap; } /* pre, normal, nowrap */ TABLE#contactsList TH diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 3821a671b..c11b306a8 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -35,7 +35,7 @@ function openContactsFolder(contactsFolder, reload, idx) { if ((contactsFolder && contactsFolder != Contact.currentAddressBook) || reload) { Contact.currentAddressBook = contactsFolder; - var url = URLForFolderID(Contact.currentAddressBook) + + var url = URLForFolderID(Contact.currentAddressBook, "Contacts") + "/view?noframe=1"; var searchValue = search["value"]; @@ -63,6 +63,7 @@ function openContactsFolder(contactsFolder, reload, idx) { document.contactsListAjaxRequest.aborted = true; document.contactsListAjaxRequest.abort(); } + document.contactsListAjaxRequest = triggerAjaxRequest(url, contactsListCallback, selection); } @@ -77,6 +78,7 @@ function contactsListCallback(http) { var table = $("contactsList"); var tbody = table.tBodies[0]; var rows = tbody.getElementsByTagName("TR"); + var fullView = (table.tHead.rows[0].cells.length > 2); var data = []; if (http.responseText.length > 0) data = http.responseText.evalJSON(true); @@ -96,9 +98,11 @@ function contactsListCallback(http) { var cells = row.getElementsByTagName("TD"); $(cells[0]).update(contact["c_cn"]); $(cells[1]).update(contact["c_mail"]); - $(cells[2]).update(contact["c_screenname"]); - $(cells[3]).update(contact["c_o"]); - $(cells[4]).update(contact["c_telephonenumber"]); + if (fullView) { + $(cells[2]).update(contact["c_screenname"]); + $(cells[3]).update(contact["c_o"]); + $(cells[4]).update(contact["c_telephonenumber"]); + } } // Add extra rows @@ -119,26 +123,31 @@ function contactsListCallback(http) { null, row); cell.appendChild(document.createTextNode(contact["c_cn"])); + cell.title = contact["c_cn"]; cell = document.createElement("td"); row.appendChild(cell); - if (contact["c_mail"]) + if (contact["c_mail"]) { cell.appendChild(document.createTextNode(contact["c_mail"])); + cell.title = contact["c_mail"]; + } - cell = document.createElement("td"); - row.appendChild(cell); - if (contact["c_screenname"]) - cell.appendChild(document.createTextNode(contact["c_screenname"])); + if (fullView) { + cell = document.createElement("td"); + row.appendChild(cell); + if (contact["c_screenname"]) + cell.appendChild(document.createTextNode(contact["c_screenname"])); - cell = document.createElement("td"); - row.appendChild(cell); - if (contact["c_o"]) - cell.appendChild(document.createTextNode(contact["c_o"])); + cell = document.createElement("td"); + row.appendChild(cell); + if (contact["c_o"]) + cell.appendChild(document.createTextNode(contact["c_o"])); - cell = document.createElement("td"); - row.appendChild(cell); - if (contact["c_telephonenumber"]) - cell.appendChild(document.createTextNode(contact["c_telephonenumber"])); + cell = document.createElement("td"); + row.appendChild(cell); + if (contact["c_telephonenumber"]) + cell.appendChild(document.createTextNode(contact["c_telephonenumber"])); + } } configureDraggables(); @@ -180,9 +189,9 @@ function contactsListCallback(http) { } // Restore selection and scroll to first selected node - tbody.refreshSelectionByIds(); var selection = http.callbackData; if (selection) { + tbody.refreshSelectionByIds(selection); for (var i = 0; i < selection.length; i++) { var row = $(selection[i]); if (row) { @@ -406,21 +415,23 @@ function onContactRowDblClick(event) { } function onContactSelectionChange(event) { + var contactView = $("contactView"); if (event) { // Update rows selection var t = getTarget(event); onRowClick(event, t); } - - var rows = this.parentNode.getSelectedRowsId(); + if (contactView) { + var rows = this.parentNode.getSelectedRowsId(); - if (rows.length == 1) { - var node = $(rows[0]); - loadContact(node.getAttribute('id')); - } - else if (rows.length > 1) { - $('contactView').update(); - Contact.currentContact = null; + if (rows.length == 1) { + var node = $(rows[0]); + loadContact(node.getAttribute('id')); + } + else if (rows.length > 1) { + $('contactView').update(); + Contact.currentContact = null; + } } } @@ -626,10 +637,11 @@ function refreshCurrentFolder() { openContactsFolder(Contact.currentAddressBook, true); } +/* Only used in UIxMailEditor */ function onConfirmContactSelection(event) { var tag = this.getAttribute("name"); - var folderLi = $(Contact.currentAddressBook); - var currentAddressBookName = folderLi.innerHTML; + var folder = $("contactFolder"); + var currentAddressBookName = folder.textContent; var selectorList = null; var initialValues = null; @@ -644,9 +656,8 @@ function onConfirmContactSelection(event) { else { var cname = '' + rows[i].readAttribute("contactname"); var email = '' + rows[i].cells[1].innerHTML; - - window.opener.addContact(tag, currentAddressBookName + '/' + cname, - cid, cname, email); + addContact(tag, currentAddressBookName + '/' + cname, + cid, cname, email); } } @@ -657,7 +668,7 @@ function onConfirmContactSelection(event) { } function addListToOpener (tag, aBookId, aBookName, listId) { - var url = ApplicationBaseURL + "/" + aBookId + "/" + listId + "/properties"; + var url = UserFolderURL + "Contacts/" + aBookId + "/" + listId + "/properties"; triggerAjaxRequest (url, addListToOpenerCallback, { "aBookId": aBookId, "aBookName": aBookName, @@ -669,8 +680,8 @@ function addListToOpenerCallback (http) { var received = http.responseText.evalJSON (true); for (var i = 0; i < received.length; i++) { var contact = received[i]; - window.opener.addContact(data.tag, data.aBookName + '/' + contact[1], - contact[0], contact[1], contact[2]); + addContact(data.tag, data.aBookName + '/' + contact[1], + contact[0], contact[1], contact[2]); } } @@ -1161,7 +1172,11 @@ function onContactMenuPrepareVisibility() { return true; } -function getMenus() { +var originalGetMenus = null; +if (typeof getMenus == 'function') { + originalGetMenus = getMenus; +} +getMenus = function() { var menus = {}; menus["contactFoldersMenu"] = new Array(onAddressBookModify, "-", newContact, newList, "-", @@ -1184,6 +1199,12 @@ function getMenus() { if (contactMenu) contactMenu.prepareVisibility = onContactMenuPrepareVisibility; + if (originalGetMenus) { + var originalMenus = originalGetMenus(); + if (originalMenus) + menus = Object.extend(menus, originalMenus); + } + return menus; } @@ -1197,15 +1218,6 @@ function configureSelectionButtons() { } } -function onWindowResize(event) { - var handle = $("dragHandle"); - if (handle) - handle.adjust(); - handle = $("rightDragHandle"); - if (handle) - handle.adjust(); -} - function onDocumentKeydown(event) { var target = Event.element(event); if (target.tagName != "INPUT") { @@ -1297,23 +1309,36 @@ function initContacts(event) { table.multiselect = true; var tbody = $(table.tBodies[0]); tbody.on("click", onContactSelectionChange); - tbody.on("dblclick", onContactRowDblClick); - tbody.on("selectstart", listRowMouseDownHandler); - tbody.on("contextmenu", onContactContextMenu); + if ($("contactView")) { + tbody.on("dblclick", onContactRowDblClick); + tbody.on("selectstart", listRowMouseDownHandler); + tbody.on("contextmenu", onContactContextMenu); + resetCategoriesMenu(); + TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true}); + } configureSortableTableHeaders(table); - TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true}); - - resetCategoriesMenu(); } - onWindowResize.defer(); - Event.observe(window, "resize", onWindowResize); - + if (typeof onWindowResize != 'function') { + // When loaded from the mail editor, onWindowResize is + // already registered + onWindowResize.defer(); + Event.observe(window, "resize", onWindowResize); + } // Default sort options sorting["attribute"] = "c_cn"; sorting["ascending"] = true; } +function onWindowResize(event) { + var handle = $("dragHandle"); + if (handle) + handle.adjust(); + handle = $("rightDragHandle"); + if (handle) + handle.adjust(); +} + function resetCategoriesMenu() { var menu = $("categoriesMenu"); if (menu) { @@ -1431,23 +1456,25 @@ function unsetCategoryOnNode(contactNode, category) { } function configureDraggables() { - var mainElement = $("dragDropVisual"); - Draggables.empty (); + if ($("contactFolders")) { + var mainElement = $("dragDropVisual"); + Draggables.empty(); - if (mainElement == null) { - mainElement = new Element ("div", {id: "dragDropVisual"}); - document.body.appendChild(mainElement); - mainElement.absolutize (); - } - mainElement.hide(); + if (mainElement == null) { + mainElement = new Element ("div", {id: "dragDropVisual"}); + document.body.appendChild(mainElement); + mainElement.absolutize(); + } + mainElement.hide(); - new Draggable ("dragDropVisual", - { handle: "contactsList", - onStart: startDragging, - onEnd: stopDragging, - onDrag: whileDragging, - scroll: window + new Draggable ("dragDropVisual", + { handle: "contactsList", + onStart: startDragging, + onEnd: stopDragging, + onDrag: whileDragging, + scroll: window }); + } } function configureDroppables() { diff --git a/UI/WebServerResources/HTMLElement.js b/UI/WebServerResources/HTMLElement.js index 5d52f438b..b76d73549 100644 --- a/UI/WebServerResources/HTMLElement.js +++ b/UI/WebServerResources/HTMLElement.js @@ -261,8 +261,10 @@ Element.addMethods({ element.selectedIds = null; }, - refreshSelectionByIds: function(element) { + refreshSelectionByIds: function(element, selectedIds) { element = $(element); + if (selectedIds) + element.selectedIds = selectedIds; if (element.selectedIds) { for (var i = 0; i < element.selectedIds.length; i++) { //var e = element.down('#'+element.selectedIds[i]); // buggy with IE diff --git a/UI/WebServerResources/MailerUI.css b/UI/WebServerResources/MailerUI.css index 713d36d45..7e4bbf453 100644 --- a/UI/WebServerResources/MailerUI.css +++ b/UI/WebServerResources/MailerUI.css @@ -900,4 +900,4 @@ A#iCalendarDeleteFromCalendar A#iCalendarAddToCalendar { border-left: 2px solid #E6E7E6; - margin-left: 5px;} + margin-left: 5px;} \ No newline at end of file diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 26064335b..76b20d5cf 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -35,8 +35,12 @@ var messageCheckTimer; /* We need to override this method since it is adapted to GCS-based folder references, which we do not use here */ -function URLForFolderID(folderID) { - var url = ApplicationBaseURL + encodeURI(folderID.substr(1)); +function URLForFolderID(folderID, application) { + if (application) + application = UserFolderURL + application + "/"; + else + application = ApplicationBaseURL; + var url = application + encodeURI(folderID.substr(1)); if (url[url.length-1] == '/') url = url.substr(0, url.length-1); @@ -53,6 +57,7 @@ function openMessageWindow(msguid, url) { markMailReadInWindow(window, msguid); } var msgWin = openMailComposeWindow(url, wId); + msgWin.focus(); Mailer.popups.push(msgWin); @@ -395,7 +400,7 @@ function onDocumentKeydown(event) { var divDimensions = viewPort.getDimensions(); var centerOffset = divDimensions.height/2; var rowScrollOffset = nextRow.cumulativeScrollOffset(); - var divBottom = divDimensions.height + rowScrollOffset.top; + var divBottom = divDimensions.height + rowScrollOffset.top; var rowBottom = nextRow.offsetTop + nextRow.getHeight(); if (divBottom < rowBottom) @@ -458,7 +463,7 @@ function deleteSelectedMessages(sender) { deleteCachedMessage(path); if (Mailer.currentMessages[Mailer.currentMailbox] == uid) { - messageContent.innerHTML = ''; + if (messageContent) messageContent.innerHTML = ''; Mailer.currentMessages[Mailer.currentMailbox] = null; } @@ -490,7 +495,7 @@ function deleteSelectedMessages(sender) { } } } - else { + else if (messageContent) { messageContent.innerHTML = ''; } Mailer.dataTable.remove(uid); @@ -623,7 +628,8 @@ function onMailboxTreeItemClick(event) { Mailer.currentMailboxType = this.parentNode.getAttribute("datatype"); if (Mailer.currentMailboxType == "account" || Mailer.currentMailboxType == "additional") { Mailer.currentMailbox = mailbox; - $("messageContent").innerHTML = ''; + var messageContent = $("messageContent"); + if (messageContent) messageContent.innerHTML = ''; $("messageCountHeader").childNodes[0].innerHTML = ' '; Mailer.dataTable._emptyTable(); updateWindowTitle(); @@ -772,7 +778,7 @@ function openMailbox(mailbox, reload) { if (!reload) { var messageContent = $("messageContent"); - messageContent.innerHTML = ''; + if (messageContent) messageContent.innerHTML = ''; $("messageCountHeader").childNodes[0].innerHTML = ' '; lastClickedRow = -1; // from generic.js } @@ -1171,11 +1177,11 @@ function onMessageSelectionChange(event) { } else if (t.className == 'messageUnreadColumn') { mailListToggleMessagesRead(t.parentNode); - return true; + return false; } else if (t.className == 'messageFlagColumn') { mailListToggleMessagesFlagged(t.parentNode); - return true; + return false; } } } @@ -1185,15 +1191,16 @@ function onMessageSelectionChange(event) { // Update rows selection onRowClick(event, t); + var messageContent = $("messageContent"); var rows = this.getSelectedRowsId(); if (rows.length == 1) { var idx = rows[0].substr(4); if (Mailer.currentMessages[Mailer.currentMailbox] != idx) { Mailer.currentMessages[Mailer.currentMailbox] = idx; - loadMessage(idx); + if (messageContent) loadMessage(idx); } } - else if (rows.length > 1) + else if (rows.length > 1 && messageContent) $('messageContent').innerHTML = ''; return true; @@ -1206,6 +1213,10 @@ function loadMessage(msguid) { } var div = $('messageContent'); + if (div == null) + // Single-window mode + return false; + var cachedMessage = getCachedMessage(msguid); var row = $("row_" + msguid); var seenStateHasChanged = row && row.hasClassName('mailer_unreadmail'); @@ -1852,6 +1863,7 @@ function refreshMessage(mailbox, messageUID) { function configureMessageListEvents() { var headerTable = $("messageListHeader"); var dataTable = $("messageListBody"); + var messageContent = $("messageContent"); if (headerTable) // Sortable columns @@ -1859,8 +1871,16 @@ function configureMessageListEvents() { if (dataTable) { dataTable.multiselect = true; - dataTable.observe("click", onMessageSelectionChange); - dataTable.observe("dblclick", onMessageDoubleClick); + if (messageContent) { + dataTable.observe("click", onMessageSelectionChange); + dataTable.observe("dblclick", onMessageDoubleClick); + } + else { + // Single-window mode + dataTable.observe("click", function(e) { + onMessageSelectionChange.bind(this)(e) && + onMessageDoubleClick.bind(this)(e); }); + } dataTable.observe("selectstart", listRowMouseDownHandler); dataTable.observe("contextmenu", onMessageContextMenu); } @@ -1890,6 +1910,7 @@ function onMessageListResize(event) { } function onWindowResize(event) { + log ("resize mailer"); var handle = $("verticalDragHandle"); if (handle) handle.adjust(); diff --git a/UI/WebServerResources/UIxContactEditor.js b/UI/WebServerResources/UIxContactEditor.js index cca21ac5e..f9f3a53bd 100644 --- a/UI/WebServerResources/UIxContactEditor.js +++ b/UI/WebServerResources/UIxContactEditor.js @@ -131,8 +131,7 @@ function onFnNewValue(event) { function onEditorCancelClick(event) { this.blur(); - preventDefault(event); - window.close(); + onCloseButtonClick(event); } function onEditorSubmitClick(event) { diff --git a/UI/WebServerResources/UIxContactsUserFolders.js b/UI/WebServerResources/UIxContactsUserFolders.js index a2dd8f418..3b1774c32 100644 --- a/UI/WebServerResources/UIxContactsUserFolders.js +++ b/UI/WebServerResources/UIxContactsUserFolders.js @@ -259,8 +259,10 @@ function onFolderSearchKeyDown(event) { function initUserFoldersWindow() { var searchValue = $("searchValue"); searchValue.observe("keydown", onFolderSearchKeyDown); - var addButton = $("addButton"); - addButton.observe("click", onConfirmFolderSelection); + + $("addButton").observe("click", onConfirmFolderSelection); + $("doneButton").observe("click", onCloseButtonClick); + searchValue.focus(); } diff --git a/UI/WebServerResources/UIxListEditor.css b/UI/WebServerResources/UIxListEditor.css index ed1cccb7c..dd7ecfb19 100644 --- a/UI/WebServerResources/UIxListEditor.css +++ b/UI/WebServerResources/UIxListEditor.css @@ -67,6 +67,8 @@ DIV#windowButtons vertical-align: middle; text-align: right; } +INPUT.textField +{ width: 100%; } DIV#buttons { position: fixed; diff --git a/UI/WebServerResources/UIxListEditor.js b/UI/WebServerResources/UIxListEditor.js index e9b22eab3..0ab846349 100644 --- a/UI/WebServerResources/UIxListEditor.js +++ b/UI/WebServerResources/UIxListEditor.js @@ -142,11 +142,6 @@ function resetTableActions() { } } -function onEditorCancelClick(event) { - preventDefault(event); - window.close(); -} - function onEditorSubmitClick(event) { if (validateListEditor()) $("mainForm").submit(); @@ -168,7 +163,7 @@ function initListEditor() { resetTableActions(); $("referenceAdd").observe("click", onReferenceAdd); $("referenceDelete").observe("click", onReferenceDelete); - $("cancelButton").observe("click", onEditorCancelClick); + $("cancelButton").observe("click", onCloseButtonClick); $("submitButton").observe("click", onEditorSubmitClick); Event.observe(document, "keydown", onDocumentKeydown); diff --git a/UI/WebServerResources/UIxMailEditor.css b/UI/WebServerResources/UIxMailEditor.css index 50d08752c..49ee656ee 100644 --- a/UI/WebServerResources/UIxMailEditor.css +++ b/UI/WebServerResources/UIxMailEditor.css @@ -1,5 +1,30 @@ /* CSS for compose panel */ +DIV#leftPanel +{ position: absolute; + top: 52px; + left: 0px; + width: 15em; + bottom: 0px; + overflow: hidden; } + +DIV#rightPanel +{ position: absolute; + top: 48px; + left: 0em; + right: 0px; + bottom: 0px; + margin-left: 5px; + overflow: hidden; } + +DIV#hiddenDragHandle +{ cursor: e-resize; + border: 0px; + top: 52px; + left: 15em; + width: 5px; + bottom: 0; } + div#compose_panel div table { padding: 2px; } @@ -82,8 +107,7 @@ div#compose_internetmarker border-style: solid; } div#headerArea -{ border-top: 1px solid #fff; - padding: 5px 0px; } +{ padding: 5px 0px; } div#headerArea div.addressList { max-height: 10em; @@ -110,7 +134,7 @@ hr.fieldSeparator width: 100%; } input.currentAttachment -{ position: absolute; +{ position: fixed; top: 1em; right: 1em; } @@ -169,3 +193,70 @@ UL#attachments LI IMG TEXTAREA#text { display: none; background: #fff; } + +/* Contacts search pane */ + +DIV#contactsSearch +{ border-right: 1px solid #fff; + padding-top: 5px; + padding-bottom: 5px; + margin-left: 5px; } + +DIV#contactsSearch LABEL +{ display: block; + margin: 0 0 5px 0; } + +SELECT#contactFolder +{ margin-bottom: 5px; } + +INPUT#searchValue +{ position: absolute; + top: 6.2em; + left: 5px; + right: 0px; /* doesn't work in FF */ + display: block; + width: auto; } + +DIV#contactsListContent +{ position: absolute; + top: 9em; + left: 0px; + right: 0px; + bottom: 0px; + margin: 0; + border-right: 1px solid #fff; + background-color: #fff; } + +TABLE#contactsList +{ width: 100%; } + +TABLE#contactsList TD, +TABLE#contactsList TH +{ overflow: hidden; + line-height: 16px; + height: 18px; + text-overflow: ellipsis; + white-space: nowrap; } + +TABLE#contactsList TD#nameHeader, +TABLE#contactsList TD#mailHeader +{ width: 50%; + max-width: 50%; } + +DIV.contactSelection +{ + z-index: 10; + background: inherit; + position: absolute; + bottom: 0em; + padding: 1em; + left: 0px; + right: 0px; + height: 90px; + text-align: right; + background: #E6E7E6; + border-top: 1px solid #fff; + border-left: 0px; + border-right: 0px; + border-bottom: 0px; +} diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index f207acaad..548c8d596 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -3,7 +3,6 @@ var contactSelectorAction = 'mailer-contacts'; var attachmentCount = 0; var MailEditor = { - addressBook: null, currentField: null, selectedIndex: -1, delay: 750, @@ -12,24 +11,21 @@ var MailEditor = { textFirstFocus: true }; -function onContactAdd() { - var selector = null; - var selectorURL = '?popup=YES&selectorId=mailer-contacts'; - - if (MailEditor.addressBook && MailEditor.addressBook.open && !MailEditor.addressBook.closed) - MailEditor.addressBook.focus(); - else { - var urlstr = ApplicationBaseURL - + "../Contacts/" - + contactSelectorAction + selectorURL; - MailEditor.addressBook = window.open(urlstr, "_blank", - "width=640,height=400,resizable=1,scrollbars=0"); - MailEditor.addressBook.selector = selector; - MailEditor.addressBook.opener = self; - MailEditor.addressBook.focus(); +function onContactAdd(button) { + var div = $("contacts"); + if (div.visible()) { + $("contacts").hide(); + $("rightPanel").setStyle({ left: "0" }); + $(button).removeClassName("active"); } - - return false; + else { + $("rightPanel").setStyle({ left: $("leftPanel").getStyle("width") }); + $("contacts").show(); + $(button).addClassName("active"); + } + + $("hiddenDragHandle").adjust(); + onMailEditorResize(null); } function addContact(tag, fullContactName, contactId, contactName, contactEmail) { @@ -60,11 +56,16 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail) var select = $(td.childNodesWithTag("select")[0]); select.value = neededOptionValue; insertContact($("addr_" + currentIndex), contactName, contactEmail); - onWindowResize(null); + onMailEditorResize(null); } } } +function onContactFolderChange(event) { + initCriteria(); + openContactsFolder(this.value); +} + function mailIsRecipient(mailto) { var isRecipient = false; @@ -157,11 +158,15 @@ function onPostComplete(response) { if (response && response.length > 0) { var jsonResponse = response.evalJSON(); if (jsonResponse["status"] == "success") { - if (window.opener && window.opener.refreshMessage) { - window.opener.refreshMessage(jsonResponse["sourceFolder"], - jsonResponse["messageID"]); - } - window.close(); + var p; + if (window.frameElement && window.frameElement.id) + p = parent; + if (window.opener && window.opener.refreshMessage) + p = window.opener; + if (p && p.refreshMessage) + p.refreshMessage(jsonResponse["sourceFolder"], + jsonResponse["messageID"]); + onCloseButtonClick(); } else { var message = jsonResponse["message"]; @@ -174,7 +179,7 @@ function onPostComplete(response) { } } else { - window.close(); + onCloseButtonClick(); } } @@ -207,7 +212,7 @@ function clickedEditorAttach() { if (!area.style.display) { area.setStyle({ display: "block" }); - onWindowResize(null); + onMailEditorResize(null); } var inputs = area.getElementsByTagName("input"); var attachmentName = "attachment" + attachmentCount; @@ -355,6 +360,18 @@ function initAddresses() { }); } +/* Overwrites function of MailerUI.js */ +function configureDragHandle() { + var handle = $("hiddenDragHandle"); + if (handle) { + handle.addInterface(SOGoDragHandlesInterface); + handle.leftMargin = 100; + handle.leftBlock=$("leftPanel"); + handle.rightBlock=$("rightPanel"); + handle.observe("handle:dragged", onMailEditorResize); + } +} + function initMailEditor() { if (composeMode != "html" && $("text")) $("text").style.display = "block"; @@ -396,6 +413,8 @@ function initMailEditor() { initializePriorityMenu(); + configureDragHandle(); + var composeMode = UserDefaults["SOGoMailComposeMessageType"]; if (composeMode == "html") { CKEDITOR.replace('text', @@ -415,9 +434,13 @@ function initMailEditor() { focusCKEditor(); } - Event.observe(window, "resize", onWindowResize); + $("contactFolder").observe("change", onContactFolderChange); + + + Event.observe(window, "resize", onMailEditorResize); Event.observe(window, "beforeunload", onMailEditorClose); - onWindowResize.defer(); + + onMailEditorResize.defer(); } function focusCKEditor(event) { @@ -459,7 +482,6 @@ function onMenuCheckReturnReceipt(event) { else { this.removeClassName("_chosen"); } - var receiptInput = $("receipt"); receiptInput.value = (enabled ? "true" : "false") ; } @@ -562,12 +584,13 @@ function onSelectOptions(event) { } } -function onWindowResize(event) { +function onMailEditorResize(event) { if (!document.pageform) return; var textarea = document.pageform.text; var rowheight = (Element.getHeight(textarea) / textarea.rows); var headerarea = $("headerArea"); + var totalwidth = $("rightPanel").getWidth(); var attachmentsarea = $("attachmentsArea"); var attachmentswidth = 0; @@ -585,15 +608,15 @@ function onWindowResize(event) { } // Resize subject field - subjectinput.setStyle({ width: (window.width() + subjectinput.setStyle({ width: (totalwidth - $(subjectfield).getWidth() - attachmentswidth - - 12) + 'px' }); + - 17) + 'px' }); // Resize from field - $("fromSelect").setStyle({ width: (window.width() + $("fromSelect").setStyle({ width: (totalwidth - $("fromField").getWidth() - attachmentswidth - - 10) + 'px' }); + - 15) + 'px' }); // Resize address fields var addresslist = $('addressList'); @@ -608,7 +631,7 @@ function onWindowResize(event) { if (composeMode == "html") { var editor = $('cke_text'); if (editor == null) { - onWindowResize.defer(); + onMailEditorResize.defer(); return; } var ck_top = $("cke_top_text"); @@ -628,25 +651,26 @@ function onWindowResize(event) { } else textarea.rows = Math.floor((window.height() - textarea.offsetTop) / rowheight); + + // Resize search contacts addressbook selector + if ($("contacts").visible()) + $("contactFolder").setStyle({ width: ($("contactsSearch").getWidth() - 10) + "px" }); } function onMailEditorClose(event) { if (window.shouldPreserve) window.shouldPreserve = false; else { - if (window.opener && window.opener.open && !window.opener.closed) { - var url = "" + window.location; - var parts = url.split("/"); - parts[parts.length-1] = "delete"; - url = parts.join("/"); + var url = "" + window.location; + var parts = url.split("/"); + parts[parts.length-1] = "delete"; + url = parts.join("/"); + if (window.frameElement && window.frameElement.id) + parent.deleteDraft(url); + else if (window.opener && window.opener.open && !window.opener.closed) window.opener.deleteDraft(url); - } } - if (MailEditor.addressBook && MailEditor.addressBook.open - && !MailEditor.addressBook.closed) - MailEditor.addressBook.close(); - Event.stopObserving(window, "beforeunload", onMailEditorClose); } diff --git a/UI/WebServerResources/generic.css b/UI/WebServerResources/generic.css index 13ddc9cf5..aa00e01f3 100644 --- a/UI/WebServerResources/generic.css +++ b/UI/WebServerResources/generic.css @@ -565,6 +565,8 @@ DIV.dialog DIV.dialog > DIV { border: 1px solid #444; + -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.5); + box-shadow: 0 5px 10px rgba(0,0,0,.5); background-color: #fff; padding: 5px; padding-bottom: 26px; } @@ -617,14 +619,23 @@ DIV.dialog.none P DIV.dialog.none P.prompt { text-align: right; } +DIV#bgFrameDiv +{ position: absolute; + top: 0px; left: 0px; + bottom: 0px; + right: 0px; + z-index: 2; + background: -webkit-radial-gradient(ellipse cover,rgba(0, 0, 0, .1) 0,rgba(0, 0, 0, .1) 20%,rgba(0, 0, 0, .7) 80%); + background: -moz-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, .1)); } + DIV#bgDialogDiv { position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 2; - opacity: .3; - background-color: #555 !important; } + background: -webkit-radial-gradient(ellipse cover,rgba(0, 0, 0, .1) 0,rgba(0, 0, 0, .1) 20%,rgba(0, 0, 0, .7) 80%); + background: -moz-linear-gradient(top, rgba(0, 0, 0, .5), rgba(0, 0, 0, .1)); } DIV#uploadDialog, DIV#uploadResults @@ -886,6 +897,36 @@ IFRAME.hidden, DIV.tab { display: none; } +DIV#popupFrame +{ position: absolute; + top: 40px; + bottom: 40px; + left: 15%; + right: 15%; + padding: 4px; + z-index: 2000; + background-color: #E6E7E6; + -webkit-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; + -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.5); + box-shadow: 0 5px 10px rgba(0,0,0,.5); +} + +DIV#popupFrame.small +{ left: 30%; + right: 30%; +} + +DIV#popupFrame > IFRAME +{ margin: 0; + padding: 0; + color: #000; + background-color: #E6E7E6; + border: 0; + -webkit-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} + DIV.tabsContainer DIV.active { display: block; } diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index b687b2ed9..459eecc8b 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -1,7 +1,7 @@ /* generic.js - this file is part of SOGo Copyright (C) 2005 SKYRIX Software AG - Copyright (C) 2006-2010 Inverse + Copyright (C) 2006-2011 Inverse SOGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -161,46 +161,108 @@ function openUserFolderSelector(callback, type) { if (! urlstr.endsWith('/')) urlstr += '/'; urlstr += ("../../" + UserLogin + "/Contacts/userFolders"); - var w = window.open(urlstr, "_blank", - "width=322,height=250,resizable=1,scrollbars=0,location=0"); - w.opener = window; - window.userFolderCallback = callback; - window.userFolderType = type; - w.focus(); + + var div = $("popupFrame"); + if (div) { + if (!div.hasClassName("small")) + div.addClassName("small"); + var iframe = div.down("iframe"); + iframe.src = urlstr; + iframe.id = "folderSelectorFrame"; + var bgDiv = $("bgFrameDiv"); + if (bgDiv) { + bgDiv.show(); + } + else { + bgDiv = createElement("div", "bgFrameDiv", ["bgMail"]); + document.body.appendChild(bgDiv); + } + div.show(); + } + else { + var w = window.open(urlstr, "_blank", + "width=322,height=250,resizable=1,scrollbars=0,location=0"); + w.opener = window; + window.userFolderCallback = callback; + window.userFolderType = type; + w.focus(); + } } function openContactWindow(url, wId) { - if (!wId) - wId = "_blank"; - else - wId = sanitizeWindowName(wId); + var div = $("popupFrame"); + if (div) { + if (!div.hasClassName("small")) + div.addClassName("small"); + var iframe = div.down("iframe"); + iframe.src = url; + iframe.id = "contactEditorFrame"; + var bgDiv = $("bgFrameDiv"); + if (bgDiv) { + bgDiv.show(); + } + else { + bgDiv = createElement("div", "bgFrameDiv"); + document.body.appendChild(bgDiv); + } + div.show(); - var w = window.open(url, wId, - "width=450,height=530,resizable=0,location=0"); - w.focus(); + return div; + } + else { + if (!wId) + wId = "_blank"; + else + wId = sanitizeWindowName(wId); - return w; + var w = window.open(url, wId, + "width=450,height=530,resizable=0,location=0"); + w.focus(); + + return w; + } } function openMailComposeWindow(url, wId) { - var parentWindow = this; + var div = $("popupFrame"); + if (div) { + if (div.hasClassName("small")) + div.removeClassName("small"); + var iframe = div.down("iframe"); + iframe.src = url; + iframe.id = "messageCompositionFrame"; + var bgDiv = $("bgFrameDiv"); + if (bgDiv) { + bgDiv.show(); + } + else { + bgDiv = createElement("div", "bgFrameDiv"); + document.body.appendChild(bgDiv); + } + div.show(); - if (!wId) - wId = "_blank"; - else - wId = sanitizeWindowName(wId); + return div; + } + else { + var parentWindow = this; - if (document.body.hasClassName("popup")) - parentWindow = window.opener; + if (!wId) + wId = "_blank"; + else + wId = sanitizeWindowName(wId); - var w = parentWindow.open(url, wId, - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0" - + ",copyhistory=0"); + if (document.body.hasClassName("popup")) + parentWindow = window.opener; - w.focus(); + var w = parentWindow.open(url, wId, + "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," + + "location=0,directories=0,status=0,menubar=0" + + ",copyhistory=0"); - return w; + w.focus(); + + return w; + } } function openMailTo(senderMailTo) { @@ -580,7 +642,7 @@ function onRowClick(event, target) { else // Not a list; stop here return true; - + var initialSelection = $(node.parentNode).getSelectedNodesId(); if (initialSelection && initialSelection.length > 0 && initialSelection.indexOf(node.id) >= 0 @@ -803,10 +865,17 @@ function toggleLogConsole(event) { function log(message) { if (!logWindow) { - logWindow = window; try { - while (logWindow.opener && logWindow.opener_logMessage) - logWindow = logWindow.opener; + if (window.frameElement && window.frameElement.id) { + logWindow = parent.window; + while (logWindow.frameElement && window.frameElement.id) + logWindow = logWindow.parent.window; + } + else { + logWindow = window; + while (logWindow.opener && logWindow.opener._logMessage) + logWindow = logWindow.opener; + } } catch(e) {} } @@ -945,8 +1014,8 @@ function popupSearchMenu(event) { var popup = $(menuId); offset = Position.positionedOffset(this); - popup.setStyle({ top: this.offsetHeight + "px", - left: (offset[0] + 3) + "px", + popup.setStyle({ top: (offset.top + this.getHeight()) + "px", + left: (offset.left + 3) + "px", visibility: "visible" }); document.currentPopupMenu = popup; @@ -958,6 +1027,9 @@ function setSearchCriteria(event) { var searchValue = $("searchValue"); var searchCriteria = $("searchCriteria"); + if (searchValue.ghostPhrase == searchValue.value) + searchValue.value = ""; + searchValue.ghostPhrase = this.innerHTML; searchCriteria.value = this.getAttribute('id'); @@ -975,13 +1047,6 @@ function setSearchCriteria(event) { } } -function checkSearchValue(event) { - var searchValue = $("searchValue"); - - if (searchValue.value == searchValue.ghostPhrase) - searchValue.value = ""; -} - function configureSearchField() { var searchValue = $("searchValue"); @@ -1368,6 +1433,8 @@ function initMenus() { var menuDIV = $(menuID); if (menuDIV) initMenu(menuDIV, menus[menuID]); + else + log("Can't find menu " + menuID); } } } @@ -1429,7 +1496,8 @@ function getTopWindow() { var currentWindow = window; while (!topWindow) { if (currentWindow.document.body.hasClassName("popup") - && currentWindow.opener) + && currentWindow.opener + && currentWindow.opener.getTopWindow) currentWindow = currentWindow.opener; else topWindow = currentWindow; @@ -1535,6 +1603,23 @@ function onLoadHandler(event) { onFinalLoadHandler(); } +function onCloseButtonClick(event) { + if (event) + Event.stop(event); + + if (window.frameElement && window.frameElement.id) { + var div = parent$("popupFrame"); + div.hide(); + div.down("iframe").src = "/SOGo/loading"; + parent$("bgFrameDiv").hide(); + } + else { + window.close(); + } + + return false; +} + function onBodyClickContextMenu(event) { var target = $(event.target); if (!(target @@ -1562,12 +1647,32 @@ function onLinkBannerClick() { function onPreferencesClick(event) { var urlstr = UserFolderURL + "preferences"; - var w = window.open(urlstr, "_blank", - "width=580,height=450,resizable=1,scrollbars=0,location=0"); - w.opener = window; - w.focus(); + var div = $("popupFrame"); + if (div) { + if (div.hasClassName("small")) + div.removeClassName("small"); + var iframe = div.down("iframe"); + iframe.src = urlstr; + iframe.id = "preferencesFrame"; + var bgDiv = $("bgFrameDiv"); + if (bgDiv) { + bgDiv.show(); + } + else { + bgDiv = createElement("div", "bgFrameDiv", ["bgMail"]); + document.body.appendChild(bgDiv); + } + div.show(); //setStyle({display: "block"}); + } + else { + var w = window.open(urlstr, "_blank", + "width=580,height=450,resizable=1,scrollbars=0,location=0"); + w.opener = window; + w.focus(); + } preventDefault(event); + return false; } function configureLinkBanner() { @@ -1688,7 +1793,14 @@ function onFinalLoadHandler(event) { } function parent$(element) { - return this.opener.document.getElementById(element); + var div = $("popupFrame"); + + if (div) + p = parent.document; + else + p = this.opener.document; + + return p.getElementById(element); } /* stubs */ @@ -1710,12 +1822,7 @@ function _(key) { value = labels[key]; } else { - var topWindow = null; - if (!topWindow) { - topWindow = window; - while (topWindow.opener) - topWindow = topWindow.opener; - } + var topWindow = getTopWindow(); if (topWindow && topWindow.clabels && topWindow.clabels[key]) value = topWindow.clabels[key]; } diff --git a/UI/WebServerResources/iefixes.css b/UI/WebServerResources/iefixes.css index 85f223247..9a76ec585 100644 --- a/UI/WebServerResources/iefixes.css +++ b/UI/WebServerResources/iefixes.css @@ -6,6 +6,9 @@ FORM { padding: 0px; margin: 0px; } +DIV#loginScreen A.button SPAN +{ padding: 0; } + /* generic */ SPAN.disabledToolbarButton @@ -38,8 +41,13 @@ DIV.tabsContainer > DIV.scrollToolbar > A > SPAN DIV.dialog.none DIV { padding-bottom: 0px; } +DIV#popupFrame IFRAME +{ height: expression(document.body.clientHeight - 88 + "px") } + +DIV#bgFrameDiv, DIV#bgDialogDiv -{ filter: alpha(opacity=30); } +{ background-color: #555; + filter: alpha(opacity=40); } /* MailerUI */ @@ -176,7 +184,10 @@ A.smallToolbarButton SPAN, A.smallToolbarButton:hover SPAN A.toolbarButton:active SPAN { background-position: auto; /*broken*/ } -A.toolbarButton, A.toolbarButton SPAN, A.button, A.button SPAN +A.toolbarButton, A.toolbarButton SPAN +{ color: #fff; } + +A.button, A.button SPAN { color: #262B33; } DIV#toolbar