diff --git a/apps/contacts/css/contacts.css b/apps/contacts/css/contacts.css index 54edf16397..d7c9a6bf34 100644 --- a/apps/contacts/css/contacts.css +++ b/apps/contacts/css/contacts.css @@ -119,8 +119,7 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; } .propertycontainer dd { float: left; width: 25em; } .propertylist { clear: none; max-width: 28em; } .propertylist li.propertycontainer { white-space: nowrap; min-width: 35em; /*max-width: 30em;*/ display: block; clear: right; } -.propertycontainer[data-element="EMAIL"] > input[type="email"] { min-width: 19em !important; float: left; } -.propertycontainer[data-element="TEL"] > input[type="text"] { width: 10em !important; float: left; } +.propertycontainer[data-element="EMAIL"] > input[type="email"],.propertycontainer[data-element="TEL"] > input[type="text"] { min-width: 12em !important; float: left; } .propertylist li > input[type="checkbox"],input[type="radio"] { float: left; clear: left; width: 20px; height: 20px; vertical-align: middle; } .propertylist li > select { float: left; max-width: 8em; } .typelist[type="button"] { float: left; max-width: 10em; border: 0; background-color: #fff; color: #bbb} /* for multiselect */ diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index fda47665c9..8f52ec8873 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -1301,26 +1301,39 @@ OC.Contacts={ loadMails:function() { $('#emails').hide(); $('#emaillist li.propertycontainer').remove(); + var emaillist = $('#emaillist'); for(var mail in this.data.EMAIL) { this.addMail(); //$('#emaillist li:first-child').clone().appendTo($('#emaillist')).show(); - $('#emaillist li:last-child').data('checksum', this.data.EMAIL[mail]['checksum']) - $('#emaillist li:last-child').find('input[type="email"]').val(this.data.EMAIL[mail]['value']); + var curemail = emaillist.find('li:last-child'); + curemail.data('checksum', this.data.EMAIL[mail]['checksum']) + curemail.find('input[type="email"]').val(this.data.EMAIL[mail]['value']); for(var param in this.data.EMAIL[mail]['parameters']) { if(param.toUpperCase() == 'PREF') { - $('#emaillist li:last-child').find('input[type="checkbox"]').attr('checked', 'checked') + curemail.find('input[type="checkbox"]').attr('checked', 'checked') } else if(param.toUpperCase() == 'TYPE') { for(etype in this.data.EMAIL[mail]['parameters'][param]) { + var found = false; var et = this.data.EMAIL[mail]['parameters'][param][etype]; - $('#emaillist li:last-child').find('select option').each(function(){ + curemail.find('select option').each(function(){ if($.inArray($(this).val().toUpperCase(), et.toUpperCase().split(',')) > -1) { $(this).attr('selected', 'selected'); + found = true; } }); + if(!found) { + curemail.find('select option:last-child').after(''); + } } } } + curemail.find('select').multiselect({ + noneSelectedText: t('contacts', 'Select type'), + header: false, + selectedList: 4, + classes: 'typelist' + }); } if($('#emaillist li').length > 1) { $('#emails').show(); @@ -1359,13 +1372,18 @@ OC.Contacts={ } else if(param.toUpperCase() == 'TYPE') { for(ptype in this.data.TEL[phone]['parameters'][param]) { + var found = false; var pt = this.data.TEL[phone]['parameters'][param][ptype]; - phonelist.find('li:last-child').find('select option').each(function(){ + phonelist.find('li:last-child').find('select option').each(function() { //if ($(this).val().toUpperCase() == pt.toUpperCase()) { if ($.inArray($(this).val().toUpperCase(), pt.toUpperCase().split(',')) > -1) { $(this).attr('selected', 'selected'); + found = true; } }); + if(!found) { + phonelist.find('li:last-child').find('select option:last-child').after(''); + } } } } diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php index 1f85f65687..41c9122137 100644 --- a/apps/contacts/templates/part.contact.php +++ b/apps/contacts/templates/part.contact.php @@ -61,7 +61,7 @@ $id = isset($_['id']) ? $_['id'] : '';