From 9a445505049f29a22cfce2747bae1e1339e8fc44 Mon Sep 17 00:00:00 2001 From: znek Date: Tue, 19 Jul 2005 16:36:39 +0000 Subject: [PATCH] proper validation for UIxMailToSelection git-svn-id: http://svn.opengroupware.org/SOGo/trunk@831 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SOGo.xcodeproj/project.pbxproj | 19 +- SOGo/UI/MailerUI/ChangeLog | 8 + SOGo/UI/MailerUI/UIxMailToSelection.m | 178 +------------- SOGo/UI/MailerUI/Version | 2 +- SOGo/UI/MailerUI/product.plist | 5 +- SOGo/UI/Templates/ChangeLog | 5 + SOGo/UI/Templates/UIxMailToSelection.wox | 10 +- .../UIxAppointmentEditor.js | 21 ++ .../UI/WebServerResources/UIxContactEditor.js | 22 ++ .../WebServerResources/UIxMailToSelection.js | 225 ++++++++++++++++++ SOGo/UI/WebServerResources/mailer.js | 7 +- 11 files changed, 322 insertions(+), 180 deletions(-) create mode 100644 SOGo/UI/WebServerResources/UIxMailToSelection.js diff --git a/SOGo/SOGo.xcodeproj/project.pbxproj b/SOGo/SOGo.xcodeproj/project.pbxproj index 24a51515..cf4c8d13 100644 --- a/SOGo/SOGo.xcodeproj/project.pbxproj +++ b/SOGo/SOGo.xcodeproj/project.pbxproj @@ -101,6 +101,10 @@ AD3D6101088BF4E600CBB51B /* UIxContactEditorBase.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = UIxContactEditorBase.m; sourceTree = ""; }; AD3D6102088BF4E600CBB51B /* UIxContactsListViewBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = UIxContactsListViewBase.h; sourceTree = ""; }; AD3D6103088BF4E600CBB51B /* UIxContactsListViewBase.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = UIxContactsListViewBase.m; sourceTree = ""; }; + AD3D6336088D2E7400CBB51B /* UIxMailToSelection.js */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.javascript; path = UIxMailToSelection.js; sourceTree = ""; tabWidth = 4; }; + AD3D63CE088D5EB000CBB51B /* calendar.css */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = calendar.css; sourceTree = ""; }; + AD3D63CF088D5EB000CBB51B /* UIxAppointmentEditor.js */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.javascript; path = UIxAppointmentEditor.js; sourceTree = ""; }; + AD3D63D0088D5EB000CBB51B /* UIxContactEditor.js */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.javascript; path = UIxContactEditor.js; sourceTree = ""; }; AD494C6206F5EA6600E51EC9 /* UIxContactSelector.m */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = UIxContactSelector.m; sourceTree = ""; }; AD494C8E06F606F900E51EC9 /* UIxContactsSelectionView.m */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = UIxContactsSelectionView.m; sourceTree = ""; }; AD494D1806F6EB3A00E51EC9 /* SOGoMailAccount.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = SOGoMailAccount.h; sourceTree = ""; }; @@ -307,7 +311,7 @@ ADDF4D7306DE0BAB00C4E7F8 /* Version */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; indentWidth = 8; path = Version; sourceTree = ""; tabWidth = 8; usesTabs = 1; }; ADDF4D7706DE0BFE00C4E7F8 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 8; lastKnownFileType = text; path = ChangeLog; sourceTree = ""; tabWidth = 8; usesTabs = 1; }; ADDF4DBC06DE0E9900C4E7F8 /* bundle-info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = "bundle-info.plist"; sourceTree = ""; }; - ADDF4DBD06DE0E9900C4E7F8 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 8; lastKnownFileType = text; path = ChangeLog; sourceTree = ""; tabWidth = 8; }; + ADDF4DBD06DE0E9900C4E7F8 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 8; lastKnownFileType = text; path = ChangeLog; sourceTree = ""; tabWidth = 8; usesTabs = 1; }; ADDF4DBE06DE0E9900C4E7F8 /* common.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; ADDF4DBF06DE0E9900C4E7F8 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; ADDF4DC006DE0E9900C4E7F8 /* COPYRIGHT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYRIGHT; sourceTree = ""; }; @@ -546,16 +550,21 @@ name = Components; sourceTree = ""; }; - AD2C74C3071AA0190087E027 /* CSS / Scripts */ = { + AD2C74C3071AA0190087E027 /* JS / CSS */ = { isa = PBXGroup; children = ( + ADE0AC130885C45100E62D67 /* mailer.css */, + AD3D63CE088D5EB000CBB51B /* calendar.css */, ADE0AC120885C45100E62D67 /* generic.js */, ADE0AC140885C45100E62D67 /* mailer.js */, ADE0AC150885C45100E62D67 /* searchfield.js */, - ADE0AC130885C45100E62D67 /* mailer.css */, ADE0AC160885C45100E62D67 /* uix.css */, + AD3D63CF088D5EB000CBB51B /* UIxAppointmentEditor.js */, + AD3D63D0088D5EB000CBB51B /* UIxContactEditor.js */, + AD3D6336088D2E7400CBB51B /* UIxMailToSelection.js */, ); - name = "CSS / Scripts"; + name = "JS / CSS"; + path = ../WebServerResources; sourceTree = ""; }; AD2C74C6071AA0ED0087E027 /* Formatters */ = { @@ -1155,7 +1164,7 @@ ADDF4DC906DE0E9A00C4E7F8 /* product.plist */, ADDF4DC106DE0E9A00C4E7F8 /* Localizable.strings */, ADDF4DD306DE0EB600C4E7F8 /* Makefiles */, - AD2C74C3071AA0190087E027 /* CSS / Scripts */, + AD2C74C3071AA0190087E027 /* JS / CSS */, ADDF4DD906DE0ECB00C4E7F8 /* Classes */, ADDF4DD606DE0EC100C4E7F8 /* Components */, ); diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index 6d7ff44d..2b20ddd3 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,3 +1,11 @@ +2005-07-19 Marcus Mueller + + * v0.9.155 + + * UIxMailToSelection.m: externalized JavaScript + + * product.plist: added new JavaScript files as public resources + 2005-07-19 Helge Hess * UIxMailEditor.m: do not complain on drafts not being found when the diff --git a/SOGo/UI/MailerUI/UIxMailToSelection.m b/SOGo/UI/MailerUI/UIxMailToSelection.m index bada2e37..9f4cc526 100644 --- a/SOGo/UI/MailerUI/UIxMailToSelection.m +++ b/SOGo/UI/MailerUI/UIxMailToSelection.m @@ -307,175 +307,15 @@ static NSArray *headers = nil; [self getAddressesFromFormValues:d]; } -/* response generation */ - -- (NSString *)jsCode { - // TODO: can't we put this into a resource? - // TODO: might be better to use -stringByReplacingBindings: etc - static NSString *script = \ - @"var currentIndex = %d;\n" - @"var lastIndex = currentIndex;\n" - @"\n" - @"function hasAddress(email) {\n" - @" var e = document.getElementById(email);\n" - @" if(e)\n" - @" return true;\n" - @" return false;\n" - @"}\n" - @"\n" - @"function rememberAddress(email) {\n" - @" var list, span, idx;\n" - @" \n" - @" list = document.getElementById('addr_addresses');\n" - @" span = document.createElement('span');\n" - @" span.id = email;\n" - @" idx = document.createTextNode(currentIndex);\n" - @" span.appendChild(idx);\n" - @" list.appendChild(span);\n" - @"}\n" - @"\n" - @"function sanitizedCn(cn) {\n" - @" var parts;\n" - @" parts = cn.split(', ');\n" - @" if(parts.length == 1)\n" - @" return cn;\n" - @" return parts[0];\n" - @"}\n" - @"\n" - @"function addAddress(type, email, uid, sn, cn, dn) {\n" - @" var shouldAddRow, s, e;\n" - @" \n" - @" shouldAddRow = true;\n" - @" s = this.sanitizedCn(cn) + ' <' + email + '>';\n" - @"\n" - @" if(this.hasAddress(email))\n" - @" return;\n" - @"\n" - @" e = document.getElementById('addr_0');\n" - @" if(e.value == '') {\n" - @" e.value = s;\n" - @" shouldAddRow = false;\n" - @" }\n" - @" if(shouldAddRow) {\n" - @" this.fancyAddRow(false, s);\n" - @" }\n" - @" this.rememberAddress(email);\n" - @"}\n" - @"\n" - @"function fancyAddRow(shouldEdit, text) {\n" - @" var addr, table, lastChild, proto, row, select, input;\n" - @"\n" - @" addr = document.getElementById('addr_' + lastIndex);\n" - @" if (addr && addr.value == '') {\n" - @" input = document.getElementById('compose_subject_input');\n" - @" if (input) {\n" - @" input.focus();\n" - @" input.select();\n" - @" return;\n" - @" }\n" - @" }\n" - @" table = this.getTable();\n" - @" lastChild = document.getElementById('row_last');\n" - @"\n" - @" currentIndex++;\n" - @"\n" - @" proto = document.getElementById('row_' + lastIndex);\n" - @" row = proto.cloneNode(true);\n" - @" row.id = 'row_' + currentIndex;\n" - @"\n" - @" // select popup\n" - @" select = row.childNodes[1].childNodes[1];\n" - @" select.name = 'popup_' + currentIndex;\n" - @" select.value = proto.childNodes[1].childNodes[1].value;\n" - @" input = row.childNodes[3].childNodes[1];\n" - @" input.name = 'addr_' + currentIndex;\n" - @" input.id = 'addr_' + currentIndex;\n" - @" input.value = text;\n" - @"\n" - @" table.insertBefore(row, lastChild);\n" - @" if(shouldEdit) {\n" - @" input.focus();\n" - @" input.select();\n" - @" }\n" - @"}\n" - @"\n" - @"function addressFieldGotFocus(sender) {\n" - @" var idx;\n" - @"\n" - @" idx = this.getIndexFromIdentifier(sender.id);\n" - @" if ((lastIndex == idx) || (idx == 0)) return;\n" - @" this.removeLastEditedRowIfEmpty();\n" - @"}\n" - @"function addressFieldLostFocus(sender) {\n" - @" lastIndex = this.getIndexFromIdentifier(sender.id);\n" - @"}\n" - @"\n" - @"function removeIfNecessary(sender) {\n" - @"/*" - @" var idx, addr, table, senderRow;\n" - @"\n" - @" if(sender.value != '')\n" - @" return;\n" - @" if(sender.id == 'addr_0')\n" - @" return;\n" - @" idx = this.getIndexFromIdentifier(sender.id);\n" - @" addr = this.findAddressWithIndex(idx);\n" - @" if(addr) {\n" - @" var addresses = document.getElementById('addr_addresses');\n" - @" addresses.removeChild(addr);\n" - @" }\n" - @" table = this.getTable();\n" - @" senderRow = this.findRowWithIndex(idx);\n" - @" table.removeChild(senderRow);\n" - @"*/" - @"}\n" - @"\n" - @"function removeLastEditedRowIfEmpty() {\n" - @" var idx, addr, table, senderRow;\n" - @"\n" - @" idx = lastIndex;\n" - @" addr = document.getElementById('addr_' + idx);\n" - @" if (!addr) return;\n" - @" if (addr.value != '') return;\n" - @" addr = this.findAddressWithIndex(idx);\n" - @" if(addr) {\n" - @" var addresses = document.getElementById('addr_addresses');\n" - @" addresses.removeChild(addr);\n" - @" }\n" - @" table = this.getTable();\n" - @" senderRow = this.findRowWithIndex(idx);\n" - @" table.removeChild(senderRow);\n" - @"}\n" - @"\n" - @"function findAddressWithIndex(idx) {\n" - @" var list, i, count, addr, idx\n" - @" list = document.getElementById('addr_addresses').childNodes;\n" - @" count = list.length;\n" - @" for(i = 0; i < count; i++) {\n" - @" addr = list[i];\n" - @" if(addr.innerHTML == idx)\n" - @" return addr;\n" - @" }\n" - @" return null;\n" - @"}\n" - @"\n" - @"function findRowWithIndex(idx) {\n" - @" var id = 'row_' + idx;\n" - @" return document.getElementById(id);\n" - @"}\n" - @"\n" - @"function getIndexFromIdentifier(id) {\n" - @" return id.split('_')[1];\n" - @"}\n" - @"\n" - @"function getTable() {\n" - @" return document.getElementById('addr_table').childNodes[1];\n" - @"}\n"; - unsigned idx; - - idx = [self->to count] + [self->cc count] + [self->bcc count]; - - return [NSString stringWithFormat:script, idx]; +- (int)addressCount { + return [self->to count] + [self->cc count] + [self->bcc count]; +} + +- (int)currentIndex { + int count; + + count = [self addressCount]; + return count > 0 ? count - 1 : 0; } @end /* UIxMailToSelection */ diff --git a/SOGo/UI/MailerUI/Version b/SOGo/UI/MailerUI/Version index 3a1e35de..6e79fcdd 100644 --- a/SOGo/UI/MailerUI/Version +++ b/SOGo/UI/MailerUI/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=154 +SUBMINOR_VERSION:=155 # v0.9.140 requires SoObjects/Mailer v0.9.100 # v0.9.134 requires libSOGo v0.9.41 diff --git a/SOGo/UI/MailerUI/product.plist b/SOGo/UI/MailerUI/product.plist index 099c97a8..6babb46f 100644 --- a/SOGo/UI/MailerUI/product.plist +++ b/SOGo/UI/MailerUI/product.plist @@ -7,7 +7,10 @@ "mailer.js", "generic.js", "searchfield.js", - + "UIxAppointmentEditor.js", + "UIxContactEditor.js", + "UIxMailToSelection.js", + "lori_32x32.png", "tbtv_account_17x17.gif", diff --git a/SOGo/UI/Templates/ChangeLog b/SOGo/UI/Templates/ChangeLog index f700586c..b973e9b9 100644 --- a/SOGo/UI/Templates/ChangeLog +++ b/SOGo/UI/Templates/ChangeLog @@ -1,3 +1,8 @@ +2005-07-19 Marcus Mueller + + * UIxMailToSelection.wox: changed inclusion of JavaScript to resource + lookup (with a little global stub being the exception) + 2005-07-19 Helge Hess * UIxAppointmentEditor.wox: import scheduler labels to the client, diff --git a/SOGo/UI/Templates/UIxMailToSelection.wox b/SOGo/UI/Templates/UIxMailToSelection.wox index 6e217ef3..63fccb40 100644 --- a/SOGo/UI/Templates/UIxMailToSelection.wox +++ b/SOGo/UI/Templates/UIxMailToSelection.wox @@ -7,9 +7,10 @@ border="0" width="100%" > - + @@ -52,6 +53,9 @@
- \ No newline at end of file diff --git a/SOGo/UI/WebServerResources/UIxAppointmentEditor.js b/SOGo/UI/WebServerResources/UIxAppointmentEditor.js index a2bfec1d..0285a1bb 100644 --- a/SOGo/UI/WebServerResources/UIxAppointmentEditor.js +++ b/SOGo/UI/WebServerResources/UIxAppointmentEditor.js @@ -1,3 +1,24 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo 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 + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + function validateAptEditor() { var e; diff --git a/SOGo/UI/WebServerResources/UIxContactEditor.js b/SOGo/UI/WebServerResources/UIxContactEditor.js index bfc1adeb..abf74d9b 100644 --- a/SOGo/UI/WebServerResources/UIxContactEditor.js +++ b/SOGo/UI/WebServerResources/UIxContactEditor.js @@ -1,3 +1,25 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo 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 + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + + function unescapeCallbackParameter(s) { if(!s || s.length == 0) return s; diff --git a/SOGo/UI/WebServerResources/UIxMailToSelection.js b/SOGo/UI/WebServerResources/UIxMailToSelection.js new file mode 100644 index 00000000..8a917e5e --- /dev/null +++ b/SOGo/UI/WebServerResources/UIxMailToSelection.js @@ -0,0 +1,225 @@ +/* + Copyright (C) 2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo 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 + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo 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 Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +/* Dependencies: + * It's required that "currentIndex" is defined in a top level context. + * + * Exports: + * defines UIxRecipientSelectorHasRecipients() returning a bool for the + * surrounding context to check. + */ + +var lastIndex = currentIndex; + +function sanitizedCn(cn) { + var parts; + parts = cn.split(', '); + if(parts.length == 1) + return cn; + return parts[0]; +} + +function hasAddress(email) { + var e = document.getElementById(email); + if(e) + return true; + return false; +} + +function rememberAddress(email) { + var list, span, idx; + + list = document.getElementById('addr_addresses'); + span = document.createElement('span'); + span.id = email; + idx = document.createTextNode(currentIndex); + span.appendChild(idx); + list.appendChild(span); +} + +function checkAddresses() { + alert("addressCount: " + this.getAddressCount() + " currentIndex: " + currentIndex + " lastIndex: " + lastIndex); +} + +function addAddress(type, email, uid, sn, cn, dn) { + var shouldAddRow, s, e; + + shouldAddRow = true; + if (cn) + s = this.sanitizedCn(cn) + ' <' + email + '>'; + else + s = email; + + if(this.hasAddress(email)) + return; + + e = document.getElementById('addr_0'); + if(e.value == '') { + e.value = s; + shouldAddRow = false; + } + if(shouldAddRow) { + this.fancyAddRow(false, s); + } + this.rememberAddress(email); +} + +function fancyAddRow(shouldEdit, text) { + var addr, table, lastChild, proto, row, select, input; + + addr = document.getElementById('addr_' + lastIndex); + if (addr && addr.value == '') { + input = document.getElementById('compose_subject_input'); + if (input && input.value != '') { + input.focus(); + input.select(); + return; + } + } + table = this.getTable(); + lastChild = document.getElementById('row_last'); + + currentIndex++; + + proto = document.getElementById('row_' + lastIndex); + row = proto.cloneNode(true); + row.id = 'row_' + currentIndex; + + // select popup + select = row.childNodes[1].childNodes[1]; + select.name = 'popup_' + currentIndex; + select.value = proto.childNodes[1].childNodes[1].value; + input = row.childNodes[3].childNodes[1]; + input.name = 'addr_' + currentIndex; + input.id = 'addr_' + currentIndex; + input.value = text; + + table.insertBefore(row, lastChild); + + if(shouldEdit) { + input.focus(); + input.select(); + } +} + +function addressFieldGotFocus(sender) { + var idx; + + idx = this.getIndexFromIdentifier(sender.id); + if ((lastIndex == idx) || (idx == 0)) return; + this.removeLastEditedRowIfEmpty(); +} +function addressFieldLostFocus(sender) { + lastIndex = this.getIndexFromIdentifier(sender.id); +} + +function removeLastEditedRowIfEmpty() { + var idx, addr, table, senderRow; + + idx = lastIndex; + if (idx == 0) return; + addr = document.getElementById('addr_' + idx); + if (!addr) return; + if (addr.value != '') return; + addr = this.findAddressWithIndex(idx); + if(addr) { + var addresses = document.getElementById('addr_addresses'); + addresses.removeChild(addr); + } + table = this.getTable(); + senderRow = this.findRowWithIndex(idx); + table.removeChild(senderRow); +} + +function findAddressWithIndex(idx) { + var list, i, count, addr, idx + list = document.getElementById('addr_addresses').childNodes; + count = list.length; + for(i = 0; i < count; i++) { + addr = list[i]; + if(addr.innerHTML == idx) + return addr; + } + return null; +} + +function findRowWithIndex(idx) { + var id = 'row_' + idx; + return document.getElementById(id); +} + +function getIndexFromIdentifier(id) { + return id.split('_')[1]; +} + +function getTable() { + return document.getElementById('addr_table').childNodes[1]; +}; + +function getAddressIDs() { + var table, rows, i, count, addressIDs; + + addressIDs = new Array(); + + table = this.getTable(); + rows = table.childNodes; + count = rows.length; + + for (i = 0; i < count; i++) { + var row, rowId; + + row = table.childNodes[i]; + rowId = row.id; + if (rowId && rowId != 'row_last') { + var idx; + + idx = this.getIndexFromIdentifier(rowId); + addressIDs.push(idx); + } + } + return addressIDs; +} + +function getAddressCount() { + var addressCount, addressIDs, i, count; + + addressCount = 0; + addressIDs = this.getAddressIDs(); + count = addressIDs.length; + for (i = 0; i < count; i++) { + var idx, input; + + idx = addressIDs[i]; + input = document.getElementById('addr_' + idx); + if (input.value != '') + addressCount++; + } + return addressCount; +} + +function UIxRecipientSelectorHasRecipients() { + var count; + + count = this.getAddressCount(); + if (count > 0) + return true; + return false; +} diff --git a/SOGo/UI/WebServerResources/mailer.js b/SOGo/UI/WebServerResources/mailer.js index 58f3d604..049e78c0 100644 --- a/SOGo/UI/WebServerResources/mailer.js +++ b/SOGo/UI/WebServerResources/mailer.js @@ -113,7 +113,12 @@ function clickedEditorSend(sender) { return false; // TODO: validate whether we have a recipient! (#1220) - + /* + if (!UIxRecipientSelectorHasRecipients()) { + alert("do not have any recipients?!"); + return false; + } + */ document.pageform.action="send"; document.pageform.submit(); // if everything is ok, close the window -- 2.39.5