diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index ab4ab2a12..718c494f6 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -6,11 +6,6 @@ var currentContactFolder = null; var usersRightsWindowHeight = 200; var usersRightsWindowWidth = 450; -function openContactWindow(sender, url) { - var msgWin = window.open(url, null, "width=450,height=600,resizable=0"); - msgWin.focus(); -} - function validateEditorInput(sender) { var errortext = ""; var field; @@ -280,9 +275,8 @@ function onContactRowClick(event, node) { function onContactRowDblClick(event, node) { var contactId = node.getAttribute('id'); - openContactWindow(null, - URLForFolderID(currentContactFolder) - + "/" + contactId + "/edit"); + openContactWindow(URLForFolderID(currentContactFolder) + + "/" + contactId + "/edit", contactId); return false; } @@ -290,9 +284,8 @@ function onContactRowDblClick(event, node) { function onMenuEditContact(event) { var contactId = document.menuTarget.getAttribute('id'); - openContactWindow(null, - URLForFolderID(currentContactFolder) - + "/" + contactId + "/edit"); + openContactWindow(URLForFolderID(currentContactFolder) + + "/" + contactId + "/edit", contactId); } function onMenuWriteToContact(event) { @@ -311,9 +304,8 @@ function onToolbarEditSelectedContacts(event) { var rows = contactsList.getSelectedRowsId(); for (var i = 0; i < rows.length; i++) { - openContactWindow(null, - URLForFolderID(currentContactFolder) - + "/" + rows[i] + "/edit"); + openContactWindow(URLForFolderID(currentContactFolder) + + "/" + rows[i] + "/edit", rows[i]); } return false; @@ -372,13 +364,7 @@ function newEmailTo(sender) { var mailto = sanitizeMailTo(sender.parentNode.parentNode.menuTarget.innerHTML); if (mailto.length > 0) - { - w = window.open("compose?mailto=" + mailto, - "SOGo_compose", - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," + - "location=0,directories=0,status=0,menubar=0,copyhistory=0"); - w.focus(); - } + openMailComposeWindow("compose?mailto=" + mailto); return false; /* stop following the link */ } @@ -411,13 +397,8 @@ function onHeaderClick(event) { preventDefault(event); } -function registerDraggableMessageNodes() { - log ("can we drag..."); -} - function newContact(sender) { - openContactWindow(sender, - URLForFolderID(currentContactFolder) + "/new"); + openContactWindow(URLForFolderID(currentContactFolder) + "/new"); return false; /* stop following the link */ } diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index d0aa924f9..1327b2454 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -19,9 +19,7 @@ function openMessageWindow(msguid, url) { wId += "SOGo_msg_" + msguid; markMailReadInWindow(window, msguid); } - var msgWin = window.open(url, wId, - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); + var msgWin = openMailComposeWindow(url, wId); if (msguid) { msgWin.messageId = msguid; msgWin.messageURL = ApplicationBaseURL + currentMailbox + "/" + msguid; @@ -122,25 +120,6 @@ function markMailReadInWindow(win, msguid) { return markMailInWindow(win, msguid, true); } -/* main window */ - -function reopenToRemoveLocationBar() { - // we cannot really use this, see below at the close comment - if (window.locationbar && window.locationbar.visible) { - newwin = window.open(window.location.href, "SOGo", - "width=800,height=600,resizable=1,scrollbars=1," + - "toolbar=0,location=0,directories=0,status=0," + - "menubar=0,copyhistory=0"); - if (newwin) { - window.close(); // this does only work for windows opened by scripts! - newwin.focus(); - return true; - } - return false; - } - return true; -} - /* mail list reply */ function openMessageWindowsForSelection(action, firstOnly) { @@ -393,9 +372,7 @@ function onComposeMessage() { function composeNewMessage() { var account = currentMailbox.split("/")[1]; var url = ApplicationBaseURL + "/" + account + "/compose"; - window.open(url, null, - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); + openMailComposeWindow(url); } function openMailbox(mailbox, reload, idx) { @@ -823,9 +800,7 @@ function onMenuViewMessageSource(event) { if (rows.length > 0) { var url = (ApplicationBaseURL + currentMailbox + "/" + rows[0].substr(4) + "/viewsource"); - window.open(url, "", - "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); + openMailComposeWindow(url); } preventDefault(event); @@ -842,10 +817,7 @@ function newContactFromEmail(event) { var url = UserFolderURL + "Contacts/new?contactEmail=" + email; if (c_name) url += "&contactFN=" + c_name; - w = window.open(url, null, - "width=546,height=490,resizable=1,scrollbars=1,toolbar=0," - + "location=0,directories=0,status=0,menubar=0,copyhistory=0"); - w.focus(); + openContactWindow(url); } return false; /* stop following the link */ diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index 42da85e11..0e5d7587f 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -212,8 +212,20 @@ function openUserFolderSelector(callback, type) { w.focus(); } -function openMailComposeWindow(url) { - var w = window.open(url, null, +function openContactWindow(url, wId) { + if (!wId) + wId = "" + (new Date().getTime()); + var w = window.open(url, wId, + "width=450,height=600,resizable=0"); + w.focus(); + + return w; +} + +function openMailComposeWindow(url, wId) { + if (!wId) + wId = "" + (new Date().getTime()); + var w = window.open(url, wId, "width=680,height=520,resizable=1,scrollbars=1,toolbar=0," + "location=0,directories=0,status=0,menubar=0" + ",copyhistory=0");