From 1b9865bbbfa755c88f144d07e5858ced544fc719 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 6 Oct 2014 09:57:50 +0000 Subject: [PATCH] fix javascript error "no method indexOf of undefined" --- mail/js/app.js | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 617b1bffd1..69f86e98aa 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -674,20 +674,18 @@ app.classes.mail = AppJS.extend( var remembervalue = ''; for(var i = 0; i < content.length; i++) { + if (typeof content[i] != 'string' || !content[i]) continue; // if there is no @ in string, its most likely that we have a comma in the personal name part of the emailaddress - if (content[i] != 'undefined' && content[i]) + if (content[i].indexOf('@')< 0) { - if (content[i].indexOf('@')< 0) - { - remembervalue = content[i]; - } - else - { - var value = remembervalue+(remembervalue?',':'')+content[i]; - var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); - email.loadingFinished(); - remembervalue = ''; - } + remembervalue = content[i]; + } + else + { + var value = remembervalue+(remembervalue?',':'')+content[i]; + var email = et2_createWidget('url-email',{id:widget.id+'_'+i, value:value,readonly:true, contact_plus:true},widget); + email.loadingFinished(); + remembervalue = ''; } } } @@ -3229,7 +3227,7 @@ app.classes.mail = AppJS.extend( { var content = this.et2.getArrayMgr('content'); var lastDrafted = this.et2.getWidgetById('lastDrafted'); - var folderTree = typeof opener.etemplate2.getByApplication('mail')[0] !='undefined'? + var folderTree = typeof opener.etemplate2.getByApplication('mail')[0] !='undefined'? opener.etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('nm[foldertree]'): null; var activeFolder = folderTree?folderTree.getSelectedNode():null; if (content) @@ -3248,7 +3246,7 @@ app.classes.mail = AppJS.extend( } this.egw.refresh(_responseData.message,'mail',_responseData.draftedId); } - } + } switch (_action) { case 'button[saveAsDraftAndPrint]': @@ -3600,23 +3598,23 @@ app.classes.mail = AppJS.extend( var folder = mailbox[1] || 'INBOX', acc_id = mailbox[0]; this.egw.open_link('mail.mail_acl.edit&mailbox='+ jQuery.base64Encode(folder)+'&acc_id='+acc_id, '_blank', '640x480'); }, - + /** * Submit new selected folder back to server in order to read its acl's rights */ acl_folderChange: function () { var mailbox = this.et2.getWidgetById('mailbox'); - + if (mailbox) { if (mailbox.taglist.getValue().length > 0) { this.et2._inst.submit(); - } + } } }, - + /** * Edit a mail account *