]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: Removed styling and (most) js from template. Started making app more keyboa...
authorThomas Tanghus <thomas@tanghus.net>
Wed, 2 May 2012 10:10:44 +0000 (12:10 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Wed, 2 May 2012 10:10:44 +0000 (12:10 +0200)
apps/contacts/ajax/editname.php
apps/contacts/css/contacts.css
apps/contacts/js/contacts.js
apps/contacts/templates/index.php
apps/contacts/templates/part.contact.php

index 9ff85dd8586aa5078e2434be1264ce70909cefd5..331aa4c7742602733592f471574f4c8be8f35bd5 100755 (executable)
@@ -21,6 +21,7 @@ function debug($msg) {
 $tmpl = new OC_TEMPLATE("contacts", "part.edit_name_dialog");
 
 $id = isset($_GET['id'])?$_GET['id']:'';
+debug('id: '.$id);
 if($id) {
        $vcard = OC_Contacts_App::getContactVCard($id);
        $name = array('', '', '', '', '');
@@ -33,8 +34,9 @@ if($id) {
        $tmpl->assign('name',$name);
        $tmpl->assign('id',$id);
 } else {
-       $addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
-       $tmpl->assign('addressbooks', $addressbooks);
+       bailOut(OC_Contacts_App::$l10n->t('Contact ID is missing.'));
+       //$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
+       //$tmpl->assign('addressbooks', $addressbooks);
 }
 $tmpl->printpage();
 
index fdd31e1a9869e1dc38a40f780f0abe8fd5e674c9..c09cb0825b1fb4f44427135467456cb6dfbb0e60 100644 (file)
@@ -9,9 +9,9 @@
 #chooseaddressbook { float: right; margin: 0.2em 1em 0 0; }
 #leftcontent a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; }
 #actionbar { height: 30px; width: 60px; position: fixed; right: 0px; top: 4em; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 1000; }
-#contacts_deletecard {position:absolute;top:15px;right:25px;}
-#contacts_downloadcard {position:absolute;top:15px;right:50px;}
-#contacts_propertymenu_button { position:absolute;top:15px;right:150px; background:url('%webroot%/core/img/actions/add.svg') no-repeat center;  }
+#contacts_deletecard {position:absolute;top:15px;right:25px; background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; }
+#contacts_downloadcard {position:absolute;top:15px;right:50px; background:url('%webroot%/core/img/actions/download.svg') no-repeat center; }
+#contacts_propertymenu_button { position:absolute;top:15px;right:150px; background:url('%webroot%/core/img/actions/add.svg') no-repeat center; }
 #contacts_propertymenu { background-color: #fff; position:absolute;top:40px;right:150px; overflow:hidden; text-overflow:ellipsis; /*border: thin solid #1d2d44;*/  -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; }
 #contacts_propertymenu li { display: block; font-weight: bold; height: 20px; width: 100px; }
 #contacts_propertymenu li a { padding: 3px; display: block }
@@ -38,6 +38,7 @@ dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
 .loading { background: url('%webroot%/core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
 .ui-autocomplete-loading { background: url('%webroot%/core/img/loading.gif') right center no-repeat; }
 .float { float: left; }
+.action { border: inherit; background: inherit; }
 .listactions { height: 1em; width:60px; float: left; clear: right; }
 .add,.edit,.delete,.mail, .globe, .upload, .cloud { cursor: pointer; width: 20px; height: 20px; margin: 0; float: left; position:relative; opacity: 0.1; }
 .add:hover,.edit:hover,.delete:hover,.mail:hover, .globe:hover, .upload:hover, .cloud:hover { opacity: 1.0 }
@@ -79,6 +80,7 @@ dl.addresscard dd {}
 dl.addresscard dt { padding: 0.3em; /*border-bottom: thin solid lightgray;*/ font-weight: bold; clear: both; color: #bbb;}
 dl.addresscard dt:hover { color:#777; }
 dl.addresscard dd > ul { margin: 0.3em; padding: 0.3em; }
+dl.addresscard .action { float: right; }
 #adr_type {} /* Select */
 #adr_pobox {}
 #adr_extended {}
@@ -96,7 +98,7 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
 .huge { font-weight:bold; font-size:1.5em; }
 .propertycontainer dd { float: left; width: 25em; }
 .propertylist { clear: none; max-width: 28em; }
-.propertylist li.propertycontainer { /*background-color: cyan; */ min-width: 25em; /*max-width: 30em;*/ display: block; clear: right; }
+.propertylist li.propertycontainer { white-space: nowrap; min-width: 35em; /*max-width: 30em;*/ display: block; clear: right; }
 .propertylist li > input[type="text"],input[type="email"],input[type="tel"] { float: left; max-width: 15em; }
 .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; }
index 47c660efce8ead51e5f257915b9399ecc1c418c2..02ce84cc5f87d35f368517d882bce8d31b871b29 100644 (file)
@@ -25,7 +25,6 @@ Contacts={
                },
                searchOSM:function(obj) {
                        var adr = Contacts.UI.propertyContainerFor(obj).find('.adr').val();
-                       console.log('adr 1: ' + adr);
                        if(adr == undefined) {
                                OC.dialogs.alert(t('contacts', 'Couldn\'t get a valid address.'), t('contacts', 'Error'));
                                return;
@@ -48,11 +47,8 @@ Contacts={
                        if(adrarr[6].trim() != '') {
                                adrstr = adrstr + adrarr[6].trim();
                        }
-                       console.log('adrstr: "' + adrstr + '"');
                        adrstr = encodeURIComponent(adrstr);
-                       console.log('adrstr 2: ' + adrstr);
                        var uri = 'http://open.mapquestapi.com/nominatim/v1/search.php?q=' + adrstr + '&limit=10&addressdetails=1&zoom=';
-                       console.log('uri: ' + uri);
                        var newWindow = window.open(uri,'_blank');
                        newWindow.focus();
                },
@@ -73,43 +69,6 @@ Contacts={
                propertyTypeFor:function(obj) {
                        return $(obj).parents('.propertycontainer').first().data('element');
                },
-               /*showHideContactInfo:function() {
-                       var show = ($('#emaillist li.propertycontainer').length > 0 || $('#phonelist li.propertycontainer').length > 0 || $('#addressdisplay dl.propertycontainer').length > 0);
-                       console.log('showHideContactInfo: ' + show);
-                       if(show) {
-                               $('#contact_communication').show();
-                       } else {
-                               $('#contact_communication').hide();
-                       }
-               },*/
-               /*checkListFor:function(obj) {
-                       var type = $(obj).parents('.propertycontainer').first().data('element');
-                       console.log('checkListFor: ' + type);
-                       switch (type) {
-                               case 'EMAIL':
-                                       console.log('emails: '+$('#emaillist>li').length);
-                                       if($('#emaillist li.propertycontainer').length == 0) {
-                                               $('#emails').hide();
-                                       }
-                                       break;
-                               case 'TEL':
-                                       console.log('phones: '+$('#phonelist>li').length);
-                                       if($('#phonelist li.propertycontainer').length == 0) {
-                                               $('#phones').hide();
-                                       }
-                                       break;
-                               case 'ADR':
-                                       console.log('addresses: '+$('#addressdisplay>dl').length);
-                                       if($('#addressdisplay dl.propertycontainer').length == 0) {
-                                               $('#addresses').hide();
-                                       }
-                                       break;
-                               case 'NICKNAME':
-                               case 'ORG':
-                               case 'BDAY':
-                                       break;
-                       }
-               },*/
                loading:function(obj, state) {
                        if(state) {
                                $(obj).addClass('loading');
@@ -123,16 +82,21 @@ Contacts={
                        $('#carddav_url_close').show();
                },
                loadListHandlers:function() {
-                       //$('.add,.delete').hide();
+                       $('.propertylist li a.delete').unbind('click');
+                       $('.propertylist li a.delete').unbind('keydown');
                        $('.globe,.mail,.delete,.edit,.tip').tipsy();
-                       /*$('.addresscard,.propertylist li,.propertycontainer').hover(
-                               function () {
-                                       $(this).find('.globe,.mail,.delete,.edit').fadeIn(100);
-                               }, 
-                               function () {
-                                       $(this).find('.globe,.mail,.delete,.edit').fadeOut(100);
-                               }
-                       );*/
+                       var deleteItem = function(obj) {
+                               obj.tipsy('hide');
+                               Contacts.UI.Card.deleteProperty(obj, 'list');
+                       }
+                       $('.propertylist li a.delete, .addresscard .delete').click(function() { deleteItem($(this)) });
+                       $('.propertylist li a.delete, .addresscard .delete').keydown(function() { deleteItem($(this)) });
+                       $('.propertylist li a.mail').click(function() { Contacts.UI.mailTo(this) });
+                       $('.propertylist li a.mail').keydown(function() { Contacts.UI.mailTo(this) });
+                       $('.addresscard .globe').click(function() { $(this).tipsy('hide');Contacts.UI.searchOSM(this); });
+                       $('.addresscard .globe').keydown(function() { $(this).tipsy('hide');Contacts.UI.searchOSM(this); });
+                       $('.addresscard .edit').click(function() { $(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false); });
+                       $('.addresscard .edit').keydown(function() { $(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false); });
                        $('.addresscard,.propertylist li,.propertycontainer').hover(
                                function () {
                                        $(this).find('.globe,.mail,.delete,.edit').animate({ opacity: 1.0 }, 200, function() {});
@@ -143,33 +107,23 @@ Contacts={
                        );
                },
                loadHandlers:function() {
-                       //console.log('loadHandlers');
-                       /*
-                       $('.formfloat').hover(
-                               function () {
-                                       $(this).find('.add').fadeIn(500);
-                               }, 
-                               function () {
-                                       $(this).find('.add').fadeOut(500);
-                               }
-                       );*/
-                       //$('#fn').jec();
+                       var deleteItem = function(obj) {
+                               obj.tipsy('hide');
+                               Contacts.UI.Card.deleteProperty(obj, 'single');
+                       }
+                       $('#identityprops a.delete').click( function() { deleteItem($(this)) });
+                       $('#identityprops a.delete').keydown( function() { deleteItem($(this)) });
+                       $('#categories_value a.edit').click( function() { $(this).tipsy('hide');OCCategories.edit(); } );
+                       $('#categories_value a.edit').keydown( function() { $(this).tipsy('hide');OCCategories.edit(); } );
                        $('#fn_select').combobox({
                                'id': 'fn',
                                'name': 'value',
                                'classes': ['contacts_property', 'huge', 'tip', 'float'],
                                'attributes': {'placeholder': t('contacts', 'Enter name')},
                                'title': t('contacts', 'Format custom, Short name, Full name, Reverse or Reverse with comma')});
-                       //$('.jecEditableOption').attr('title', t('contacts','Custom'));
                        $('#bday').datepicker({
                                                dateFormat : 'dd-mm-yy'
                        });
-                       /*$('#categories_value').find('select').multiselect({
-                                                                               noneSelectedText: t('contacts', 'Select categories'),
-                                                                               header: false,
-                                                                               selectedList: 6,
-                                                                               classes: 'categories'
-                                                                       });*/
                        // Style phone types
                        $('#phonelist').find('select.contacts_property').multiselect({
                                                                                                        noneSelectedText: t('contacts', 'Select type'),
@@ -177,20 +131,8 @@ Contacts={
                                                                                                        selectedList: 4,
                                                                                                        classes: 'typelist'
                                                                                                });
-                       $('#add_email').click(function(){
-                               Contacts.UI.Card.addMail();
-                       });
-                       $('#add_phone').click(function(){
-                               Contacts.UI.Card.addPhone();
-                       });
-//                     $('#add_address').click(function(){
-//                             Contacts.UI.Card.editAddress();
-//                             return false;
-//                     });
-                       $('#edit_name').click(function(){
-                               Contacts.UI.Card.editName();
-                               return false;
-                       });
+                       $('#edit_name').click(function(){Contacts.UI.Card.editName()});
+                       $('#edit_name').keydown(function(){Contacts.UI.Card.editName()});
                        
                        /* Initialize the photo edit dialog */
                        $('#edit_photo_dialog').dialog({ autoOpen: false, modal: true, height: 'auto', width: 'auto' });
@@ -227,8 +169,6 @@ Contacts={
                        update:function(id) {
                                // Make sure proper DOM is loaded.
                                var newid;
-                               console.log('Card.update(), id: ' + id);
-                               console.log('Card.update(), #contacts: ' + $('#contacts li').length);
                                if(id == undefined) {
                                        newid = $('#contacts li:first-child').data('id');
                                } else {
@@ -243,7 +183,6 @@ Contacts={
                                                                //var newid = $('#contacts li:first-child').data('id');
                                                                //$('#contacts li:first-child').addClass('active');
                                                                $('#leftcontent li[data-id="'+newid+'"]').addClass('active');
-                                                               console.log('trying to load: ' + newid);
                                                                $.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':newid},function(jsondata){
                                                                        if(jsondata.status == 'success'){
                                                                                Contacts.UI.Card.loadContact(jsondata.data);
@@ -279,10 +218,8 @@ Contacts={
                                Contacts.UI.notImplemented();
                        },
                        add:function(n, fn, aid, isnew){ // add a new contact
-                               console.log('Add contact: ' + n + ', ' + fn + ' ' + aid);
                                var card = $('#card')[0];
                                if(!card) {
-                                       console.log('Loading proper card DOM');
                                        $.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){
                                                if(jsondata.status == 'success'){
                                                        $('#rightcontent').html(jsondata.data.page);
@@ -348,7 +285,6 @@ Contacts={
                                                                var newid = '';
                                                                var curlistitem = $('#leftcontent [data-id="'+jsondata.data.id+'"]');
                                                                var newlistitem = curlistitem.prev();
-                                                               console.log('Previous: ' + newlistitem);
                                                                if(newlistitem == undefined) {
                                                                        newlistitem = curlistitem.next();
                                                                }
@@ -391,14 +327,13 @@ Contacts={
                                this.data = jsondata;
                                this.id = this.data.id;
                                $('#rightcontent').data('id',this.id);
-                               console.log('loaded: ' + this.data.FN[0]['value']);
                                this.populateNameFields();
-                               //this.loadCategories();
                                this.loadPhoto();
                                this.loadMails();
                                this.loadPhones();
                                this.loadAddresses();
                                this.loadSingleProperties();
+                               Contacts.UI.loadListHandlers();
                                if(this.data.NOTE) {
                                        $('#note').data('checksum', this.data.NOTE[0]['checksum']);
                                        $('#note').find('textarea').val(this.data.NOTE[0]['value']);
@@ -511,9 +446,7 @@ Contacts={
                                        var categories = this.data.CATEGORIES[0]['value'].split(/,\s*/);
                                        for(var c in categories) {
                                                var cat = this.data.CATEGORIES[0]['value'][c];
-                                               console.log('hasCategory: ' + cat + ' === ' + category + '?');
                                                if(typeof cat === 'string' && (cat.toUpperCase() === category.toUpperCase())) {
-                                                       console.log('Yes');
                                                        return true;
                                                }
                                        }
@@ -522,12 +455,10 @@ Contacts={
                        },
                        categoriesChanged:function(newcategories) { // Categories added/deleted.
                                categories = $.map(newcategories, function(v) {return v;});
-                               console.log('categoriesChanged for ' + Contacts.UI.Card.id + ' : ' + categories);
                                $('#categories').multiple_autocomplete('option', 'source', categories);
                                var categorylist = $('#categories_value').find('input');
                                $.getJSON(OC.filePath('contacts', 'ajax', 'categories/categoriesfor.php'),{'id':Contacts.UI.Card.id},function(jsondata){
                                        if(jsondata.status == 'success'){
-                                               console.log('Setting checksum: ' + jsondata.data.checksum + ', value: ' + jsondata.data.value);
                                                $('#categories_value').data('checksum', jsondata.data.checksum);
                                                categorylist.val(jsondata.data.value);
                                        } else {
@@ -538,11 +469,12 @@ Contacts={
                        editNew:function(){ // add a new contact
                                this.id = ''; this.fn = ''; this.fullname = ''; this.givname = ''; this.famname = ''; this.addname = ''; this.honpre = ''; this.honsuf = '';
                                Contacts.UI.Card.add(t('contacts', 'Contact')+';'+t('contacts', 'New')+';;;', t('contacts', 'New Contact'), '', true);
+                               return false;
                        },
                        savePropertyInternal:function(name, fields, oldchecksum, checksum){
                                // TODO: Add functionality for new fields.
-                               console.log('savePropertyInternal: ' + name + ', fields: ' + fields + 'checksum: ' + checksum);
-                               console.log('savePropertyInternal: ' + this.data[name]);
+                               //console.log('savePropertyInternal: ' + name + ', fields: ' + fields + 'checksum: ' + checksum);
+                               //console.log('savePropertyInternal: ' + this.data[name]);
                                var multivalue = ['CATEGORIES'];
                                var params = {};
                                var value = multivalue.indexOf(name) != -1 ? new Array() : undefined;
@@ -573,7 +505,6 @@ Contacts={
                        saveProperty:function(obj){
                                // I couldn't get the selector to filter on 'contacts_property' so I filter by hand here :-/
                                if(!$(obj).hasClass('contacts_property')) {
-                                       console.log('Filtering out object.' + obj);
                                        return false;
                                }
                                if($(obj).hasClass('nonempty') && $(obj).val().trim() == '') {
@@ -584,11 +515,10 @@ Contacts={
                                Contacts.UI.loading(container, true);
                                var checksum = container.data('checksum');
                                var name = container.data('element');
-                               console.log('saveProperty: ' + name);
                                var fields = container.find('input.contacts_property,select.contacts_property').serializeArray();
                                var q = container.find('input.contacts_property,select.contacts_property,textarea.contacts_property').serialize();
                                if(q == '' || q == undefined) {
-                                       console.log('Couldn\'t serialize elements.');
+                                       OC.dialogs.alert(t('contacts', 'Couldn\'t serialize elements.'), t('contacts', 'Error'));
                                        Contacts.UI.loading(container, false);
                                        return false;
                                }
@@ -634,8 +564,7 @@ Contacts={
                                }
                        },
                        addProperty:function(type){
-                               //var type = $(obj).data('type');
-                               console.log('addProperty:' + type);
+                               //console.log('addProperty:' + type);
                                switch (type) {
                                        case 'PHOTO':
                                                this.loadPhoto(true);
@@ -653,21 +582,21 @@ Contacts={
                                                        $('#emails').show();
                                                }
                                                Contacts.UI.Card.addMail();
-                                               //Contacts.UI.showHideContactInfo();
+                                               Contacts.UI.loadListHandlers();
                                                break;
                                        case 'TEL':
                                                if($('#phonelist>li').length == 1) {
                                                        $('#phones').show();
                                                }
                                                Contacts.UI.Card.addPhone();
-                                               //Contacts.UI.showHideContactInfo();
+                                               Contacts.UI.loadListHandlers();
                                                break;
                                        case 'ADR':
                                                if($('#addressdisplay>dl').length == 1) {
                                                        $('#addresses').show();
                                                }
                                                Contacts.UI.Card.editAddress('new', true);
-                                               //Contacts.UI.showHideContactInfo();
+                                               Contacts.UI.loadListHandlers();
                                                break;
                                        case 'NICKNAME':
                                        case 'ORG':
@@ -680,27 +609,21 @@ Contacts={
                                }
                        },
                        deleteProperty:function(obj, type){
-                               console.log('deleteProperty, obj: ' + obj.attr('id') + ', container: ' + Contacts.UI.propertyContainerFor(obj).html());
                                Contacts.UI.loading(obj, true);
                                var checksum = Contacts.UI.checksumFor(obj);
-                               console.log('deleteProperty, id: ' + this.id + ', checksum: ' + checksum);
+                               //console.log('deleteProperty, id: ' + this.id + ', checksum: ' + checksum);
                                if(checksum) {
                                        $.getJSON(OC.filePath('contacts', 'ajax', 'deleteproperty.php'),{'id': this.id, 'checksum': checksum },function(jsondata){
                                                if(jsondata.status == 'success'){
                                                        if(type == 'list') {
                                                                Contacts.UI.propertyContainerFor(obj).remove();
-                                                               //Contacts.UI.showHideContactInfo();
-                                                               //Contacts.UI.checkListFor(obj);
                                                        } else if(type == 'single') {
                                                                var proptype = Contacts.UI.propertyTypeFor(obj);
                                                                Contacts.UI.Card.data[proptype] = null;
-                                                               console.log('deleteProperty, hiding: ' + proptype);
                                                                var othertypes = ['NOTE', 'PHOTO'];
                                                                if(othertypes.indexOf(proptype) != -1) {
-                                                                       console.log('NOTE or PHOTO');
                                                                        Contacts.UI.propertyContainerFor(obj).data('checksum', '');
                                                                        if(proptype == 'PHOTO') {
-                                                                               console.log('Delete PHOTO');
                                                                                Contacts.UI.Contacts.refreshThumbnail(Contacts.UI.Card.id);
                                                                                Contacts.UI.Card.loadPhoto(true);
                                                                        } else if(proptype == 'NOTE') {
@@ -727,11 +650,8 @@ Contacts={
                                } else { // Property hasn't been saved so there's nothing to delete.
                                        if(type == 'list') {
                                                Contacts.UI.propertyContainerFor(obj).remove();
-                                               //Contacts.UI.showHideContactInfo();
-                                               //Contacts.UI.checkListFor(obj);
                                        } else if(type == 'single') {
                                                var proptype = Contacts.UI.propertyTypeFor(obj);
-                                               console.log('deleteProperty, hiding: ' + proptype);
                                                $('dl dt[data-element="'+proptype+'"],dd[data-element="'+proptype+'"]').hide();
                                                $('#contacts_propertymenu a[data-type="'+proptype+'"]').parent().show();
                                                Contacts.UI.loading(obj, false);
@@ -745,7 +665,7 @@ Contacts={
                                /* Initialize the name edit dialog */
                                if($('#edit_name_dialog').dialog('isOpen') == true){
                                        $('#edit_name_dialog').dialog('moveToTop');
-                               }else{ // TODO: If id=='' call addcontact.php (or whatever name) instead and reload view with id.
+                               }else{
                                        $('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'editname.php')+'?id='+this.id, function(jsondata){
                                                if(jsondata.status != 'error'){
                                                        $('#edit_name_dialog' ).dialog({
@@ -760,13 +680,13 @@ Contacts={
                                                                        },
                                                                        'Cancel':function() { $(this).dialog('destroy').remove(); }
                                                                },
-                                                               close : function(event, ui) {
+                                                               close: function(event, ui) {
                                                                        $(this).dialog('destroy').remove();
                                                                        //return event;
-                                                               }/*,
-                                                               open : function(event, ui) {
+                                                               },
+                                                               open: function(event, ui) {
                                                                        // load 'N' property - maybe :-P
-                                                               }*/
+                                                               }
                                                        });
                                                } else {
                                                        OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
@@ -775,7 +695,7 @@ Contacts={
                                }
                        },
                        saveName:function(dlg){
-                               console.log('saveName, id: ' + this.id);
+                               //console.log('saveName, id: ' + this.id);
                                var n = new Array($(dlg).find('#fam').val().strip_tags(),$(dlg).find('#giv').val().strip_tags(),$(dlg).find('#add').val().strip_tags(),$(dlg).find('#pre').val().strip_tags(),$(dlg).find('#suf').val().strip_tags());
                                this.famname = n[0];
                                this.givname = n[1];
@@ -798,7 +718,6 @@ Contacts={
                                var tmp = [this.fullname, this.givname + ' ' + this.famname, this.famname + ' ' + this.givname, this.famname + ', ' + this.givname];
                                var names = new Array();
                                for(var name in tmp) {
-                                       console.log('idx: ' + names.indexOf(tmp[name]));
                                        if(names.indexOf(tmp[name]) == -1) {
                                                names.push(tmp[name]);
                                        }
@@ -861,11 +780,9 @@ Contacts={
                                        $('#addresses').show();
                                        $('#contact_communication').show();
                                }
-                               Contacts.UI.loadListHandlers();
                                return false;
                        },
                        editAddress:function(obj, isnew){
-                               console.log('editAddress');
                                var container = undefined;
                                var q = q = '?id=' + this.id;
                                if(obj === 'new') {
@@ -873,7 +790,6 @@ Contacts={
                                        $('#addressdisplay dl').first().clone().insertAfter($('#addressdisplay dl').last()).show();
                                        container = $('#addressdisplay dl').last();
                                        container.removeClass('template').addClass('propertycontainer');
-                                       Contacts.UI.loadListHandlers();
                                } else {
                                        q = q + '&checksum='+Contacts.UI.checksumFor(obj);
                                }
@@ -970,9 +886,9 @@ Contacts={
                                                                                                },
                                                                                                success: function( data ) {
                                                                                                        response( $.map( data.geonames, function( item ) {
-                                                                                                               for(var key in item) {
-                                                                                                                       console.log(key + ': ' + item[key]);
-                                                                                                               }
+                                                                                                               //for(var key in item) {
+                                                                                                               //      console.log(key + ': ' + item[key]);
+                                                                                                               //}
                                                                                                                return {
                                                                                                                        label: item.name,
                                                                                                                        value: item.name
@@ -1044,7 +960,6 @@ Contacts={
                                        OC.dialogs.alert(t('contacts','No files selected for upload.'), t('contacts', 'Error'));
                                        return;
                                }
-                               //var file = filelist.item(0);
                                var file = filelist[0];
                                var target = $('#file_upload_target');
                                var form = $('#file_upload_form');
@@ -1066,6 +981,7 @@ Contacts={
                                }
                        },
                        loadPhotoHandlers:function(){
+                               $('#phototools li a').tipsy('hide');
                                $('#phototools li a').tipsy();
                                $('#phototools li a').click(function() {
                                        $(this).tipsy('hide');
@@ -1108,7 +1024,6 @@ Contacts={
                                });
                        },
                        cloudPhotoSelected:function(path){
-                               console.log('cloudPhotoSelected: ' + path);
                                $.getJSON(OC.filePath('contacts', 'ajax', 'oc_photo.php'),{'path':path,'id':Contacts.UI.Card.id},function(jsondata){
                                        if(jsondata.status == 'success'){
                                                //alert(jsondata.data.page);
@@ -1121,6 +1036,7 @@ Contacts={
                                });
                        },
                        loadPhoto:function(refresh){
+                               $('#phototools li a').tipsy('hide');
                                $.getJSON(OC.filePath('contacts', 'ajax', 'loadphoto.php'),{'id':this.id, 'refresh': refresh},function(jsondata){
                                        if(jsondata.status == 'success'){
                                                $('#contacts_details_photo_wrapper').data('checksum', jsondata.data.checksum);
@@ -1186,7 +1102,6 @@ Contacts={
                                $('#emaillist li.template:last-child').find('select').addClass('contacts_property');
                                $('#emaillist li.template:last-child').removeClass('template').addClass('propertycontainer');
                                $('#emaillist li:last-child').find('input[type="email"]').focus();
-                               Contacts.UI.loadListHandlers();
                                return false;
                        },
                        loadMails:function() {
@@ -1219,7 +1134,6 @@ Contacts={
                                }
 
                                $('#emaillist li:last-child').find('input[type="text"]').focus();
-                               Contacts.UI.loadListHandlers();
                                return false;
                        },
                        addPhone:function() {
@@ -1227,7 +1141,6 @@ Contacts={
                                $('#phonelist li.template:last-child').find('select').addClass('contacts_property');
                                $('#phonelist li.template:last-child').removeClass('template').addClass('propertycontainer');
                                $('#phonelist li:last-child').find('input[type="text"]').focus();
-                               Contacts.UI.loadListHandlers();
                                $('#phonelist li:last-child').find('select').multiselect({
                                                                                                                noneSelectedText: t('contacts', 'Select type'),
                                                                                                                header: false,
@@ -1295,6 +1208,7 @@ Contacts={
                                                }
                                        });
                                }
+                               return false;
                        },
                        activation:function(checkbox, bookid)
                        {
@@ -1357,7 +1271,6 @@ Contacts={
                                $(this.droptarget).bind('drop',function(event){
                                        event.stopPropagation();
                                        event.preventDefault();
-                                       console.log('drop');
                                        $(event.target).removeClass('droppable');
                                        $(event.target).html(t('contacts', 'Uploading...'));
                                        Contacts.UI.loading(event.target, true);
@@ -1365,9 +1278,7 @@ Contacts={
                                });
 
                                $.fileUpload = function(files){
-                                       console.log(files + ', ' + files.length);
                                        var file = files[0];
-                                       console.log('size: '+file.size+', type: '+file.type);
                                        if(file.size > $('#max_upload').val()){
                                                OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
                                                $(Contacts.UI.Addressbooks.droptarget).html(Contacts.UI.Addressbooks.droptext);
@@ -1445,7 +1356,6 @@ Contacts={
                                $(Contacts.UI.Addressbooks.droptarget).html(t('contacts', 'Importing...'));
                                Contacts.UI.loading(Contacts.UI.Addressbooks.droptarget, true);
                                var id = $('#importaddressbook_dialog').find('#book').val();
-                               console.log('Selected book: ' + id);
                                $.post(OC.filePath('contacts', '', 'import.php'), { id: id, path: path, file: file, fstype: 'OC_FilesystemView' },
                                        function(jsondata){
                                                if(jsondata.status == 'success'){
@@ -1494,7 +1404,6 @@ Contacts={
                Contacts:{
                        // Reload the contacts list.
                        update:function(){
-                               console.log('Contacts.update, start');
                                $.getJSON(OC.filePath('contacts', 'ajax', 'contacts.php'),{},function(jsondata){
                                        if(jsondata.status == 'success'){
                                                $('#contacts').html(jsondata.data.page);
@@ -1530,18 +1439,17 @@ $(document).ready(function(){
                $('#notification').fadeOut();
        });
        
-       $('#chooseaddressbook').click(function(){
-               Contacts.UI.Addressbooks.overview();
-               return false;
-       });
+       $('#chooseaddressbook').click(Contacts.UI.Addressbooks.overview);
+       $('#chooseaddressbook').keydown(Contacts.UI.Addressbooks.overview);
 
-       $('#contacts_newcontact').click(function(){
-               Contacts.UI.Card.editNew();
-       });
+       $('#contacts_newcontact').click(Contacts.UI.Card.editNew);
+       $('#contacts_newcontact').keydown(Contacts.UI.Card.editNew);
        
-       $('#contacts_deletecard').click(function(){
-               Contacts.UI.Card.doDelete();
-       });
+       $('#contacts_deletecard').click( function() { Contacts.UI.Card.doDelete();return false;} );
+       $('#contacts_deletecard').keydown( function() { Contacts.UI.Card.doDelete();return false;} );
+
+       $('#contacts_downloadcard').click( function() { Contacts.UI.Card.doExport();return false;} );
+       $('#contacts_downloadcard').keydown( function() { Contacts.UI.Card.doExport();return false;} );
 
        // Load a contact.
        $('#leftcontent li').click(function(){
@@ -1626,13 +1534,11 @@ $(document).ready(function(){
                Contacts.UI.Card.uploadPhoto(this.files);
        });
        $('#contacts_details_photo_wrapper').bind('dragover',function(event){
-               console.log('dragover');
                $(event.target).addClass('droppable');
                event.stopPropagation();
                event.preventDefault();  
        });
        $('#contacts_details_photo_wrapper').bind('dragleave',function(event){
-               console.log('dragleave');
                $(event.target).removeClass('droppable');
                //event.stopPropagation();
                //event.preventDefault();  
@@ -1640,7 +1546,6 @@ $(document).ready(function(){
        $('#contacts_details_photo_wrapper').bind('drop',function(event){
                event.stopPropagation();
                event.preventDefault();
-               console.log('drop');
                $(event.target).removeClass('droppable');
                $.fileUpload(event.originalEvent.dataTransfer.files);
        });
@@ -1650,7 +1555,6 @@ $(document).ready(function(){
         */
        $.fileUpload = function(files){
                var file = files[0];
-               console.log('size: '+file.size);
                if(file.size > $('#max_upload').val()){
                        OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
                        return;
@@ -1709,18 +1613,22 @@ $(document).ready(function(){
                        $('#contacts_propertymenu').hide();
                }
        });
-       $('#contacts_propertymenu_button').click(function(){
+       function propertyMenu(){
                var menu = $('#contacts_propertymenu');
                if(menu.is(':hidden')) {
                        menu.show();
-                       menu.find('ul').focus();
+                       menu.find('li').first().focus();
                } else {
                        menu.hide();
                }
-       });
-       $('#contacts_propertymenu a').click(function(){
+       }
+       $('#contacts_propertymenu_button').click(propertyMenu);
+       $('#contacts_propertymenu_button').keydown(propertyMenu);
+       function propertyMenuItem(){
                var type = $(this).data('type');
                Contacts.UI.Card.addProperty(type);
                $('#contacts_propertymenu').hide();
-       });
+       }
+       $('#contacts_propertymenu a').click(propertyMenuItem);
+       $('#contacts_propertymenu a').keydown(propertyMenuItem);
 });
index eb229a70a5983530ed41bac2f372286628454ca3..aa3885c4523a65b9cfa923f719b7f11f13bdd218 100755 (executable)
@@ -3,12 +3,6 @@
        var categories = <?php echo json_encode($_['categories']); ?>;
        var lang = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
 </script>
-<!-- div id="controls">
-       <form>
-               <input type="button" id="contacts_newcontact" value="<?php echo $l->t('Add Contact'); ?>">
-               <input type="button" id="chooseaddressbook" value="<?php echo $l->t('Addressbooks'); ?>">
-       </form>
-</div -->
 <div id="leftcontent" class="leftcontent">
        <ul id="contacts">
                <?php echo $this->inc("part.contacts"); ?>
@@ -16,8 +10,8 @@
 </div>
        <div id="bottomcontrols">
                <form>
-                       <img class="svg" id="contacts_newcontact" src="<?php echo OCP\Util::linkTo('contacts', 'img/contact-new.svg'); ?>" alt="<?php echo $l->t('Add Contact'); ?>"  title="<?php echo $l->t('Add Contact'); ?>" />
-                       <img class="svg" id="chooseaddressbook" src="core/img/actions/settings.svg" alt="<?php echo $l->t('Addressbooks'); ?>" title="<?php echo $l->t('Addressbooks'); ?>" />
+                       <button class="action" id="contacts_newcontact"><img class="svg" src="<?php echo OCP\Util::linkTo('contacts', 'img/contact-new.svg'); ?>" alt="<?php echo $l->t('Add Contact'); ?>"  title="<?php echo $l->t('Add Contact'); ?>" /></button>
+                       <button class="action" id="chooseaddressbook"><img class="svg" src="core/img/actions/settings.svg" alt="<?php echo $l->t('Addressbooks'); ?>" title="<?php echo $l->t('Addressbooks'); ?>" /></button>
                </form>
        </div>
 <div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
index 5e0607e31921a7cc11763e4478687d290582d7a1..942417c009e39b40a24fb6fc2c27b6640be561ff 100755 (executable)
@@ -3,30 +3,29 @@ $id = isset($_['id']) ? $_['id'] : '';
 ?>
 <div id="card">
        <div id="actionbar">
-       <a title="<?php echo $l->t('Add field'); ?>" class="svg action" id="contacts_propertymenu_button"></a>
-       <div id="contacts_propertymenu" style="display: none;">
-       <ul>
-               <li><a data-type="PHOTO"><?php echo $l->t('Profile picture'); ?></a></li>
-               <li><a data-type="ORG"><?php echo $l->t('Organization'); ?></a></li>
-               <li><a data-type="NICKNAME"><?php echo $l->t('Nickname'); ?></a></li>
-               <li><a data-type="BDAY"><?php echo $l->t('Birthday'); ?></a></li>
-               <li><a data-type="TEL"><?php echo $l->t('Phone'); ?></a></li>
-               <li><a data-type="EMAIL"><?php echo $l->t('Email'); ?></a></li>
-               <li><a data-type="ADR"><?php echo $l->t('Address'); ?></a></li>
-               <li><a data-type="NOTE"><?php echo $l->t('Note'); ?></a></li>
-               <li><a data-type="CATEGORIES"><?php echo $l->t('Groups'); ?></a></li>
+       <button title="<?php echo $l->t('Add field'); ?>" class="svg action" id="contacts_propertymenu_button"></button>
+       <div id="contacts_propertymenu" class="hidden">
+       <ul role="menu">
+               <li><a role="menuitem" data-type="PHOTO"><?php echo $l->t('Profile picture'); ?></a></li>
+               <li><a role="menuitem" data-type="ORG"><?php echo $l->t('Organization'); ?></a></li>
+               <li><a role="menuitem" data-type="NICKNAME"><?php echo $l->t('Nickname'); ?></a></li>
+               <li><a role="menuitem" data-type="BDAY"><?php echo $l->t('Birthday'); ?></a></li>
+               <li><a role="menuitem" data-type="TEL"><?php echo $l->t('Phone'); ?></a></li>
+               <li><a role="menuitem" data-type="EMAIL"><?php echo $l->t('Email'); ?></a></li>
+               <li><a role="menuitem" data-type="ADR"><?php echo $l->t('Address'); ?></a></li>
+               <li><a role="menuitem" data-type="NOTE"><?php echo $l->t('Note'); ?></a></li>
+               <li><a role="menuitem" data-type="CATEGORIES"><?php echo $l->t('Groups'); ?></a></li>
        </ul>
        </div>
-       <img  onclick="Contacts.UI.Card.doExport();" class="svg action" id="contacts_downloadcard" src="<?php echo image_path('', 'actions/download.svg'); ?>" title="<?php echo $l->t('Download contact');?>" />
-       <img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
+       <button class="svg action" id="contacts_downloadcard" title="<?php echo $l->t('Download contact');?>"></button>
+       <button class="svg action" id="contacts_deletecard" title="<?php echo $l->t('Delete contact');?>"></button>
        </div>
 
        <div id="contact_photo" class="contactsection">
 
        <form class="float" id="file_upload_form" action="<?php echo OCP\Util::linkTo('contacts', 'ajax/uploadphoto.php'); ?>" method="post" enctype="multipart/form-data" target="file_upload_target">
-               <div class="tip propertycontainer" id="contacts_details_photo_wrapper" title="<?php echo $l->t('Click or drop to upload picture'); ?> (max <?php echo $_['uploadMaxHumanFilesize']; ?>)" data-element="PHOTO">
-               <!-- img style="padding: 1em;" id="contacts_details_photo" alt="Profile picture"  src="photo.php?id=<?php echo $_['id']; ?>" / -->
-               <progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
+               <div class="tip propertycontainer" id="contacts_details_photo_wrapper" title="<?php echo $l->t('Drop photo to upload'); ?> (max <?php echo $_['uploadMaxHumanFilesize']; ?>)" data-element="PHOTO">
+               <progress id="contacts_details_photo_progress" class="hidden" value="0" max="100">0 %</progress>
                </div>
                <input type="hidden" name="id" value="<?php echo $_['id'] ?>">
                <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
@@ -40,22 +39,22 @@ $id = isset($_['id']) ? $_['id'] : '';
        <form method="post">
        <input type="hidden" name="id" value="<?php echo $_['id'] ?>">
        <fieldset id="ident" class="contactpart">
-       <!-- legend>Name</legend -->
        <span class="propertycontainer" data-element="N"><input type="hidden" id="n" class="contacts_property" name="value" value="" /></span>
        <span id="name" class="propertycontainer" data-element="FN">
-       <select class="float" id="fn_select" title="<?php echo $l->t('Format custom, Short name, Full name, Reverse or Reverse with comma'); ?>" style="width:16em;">
-       </select><a id="edit_name" class="action edit" title="<?php echo $l->t('Edit name details'); ?>"></a>
+       <select class="float" id="fn_select" title="<?php echo $l->t('Format custom, Short name, Full name, Reverse or Reverse with comma'); ?>">
+       </select><a role="button" id="edit_name" class="action edit" title="<?php echo $l->t('Edit name details'); ?>"></a>
        </span>
        <dl id="identityprops" class="form">
-               <dt style="display:none;" id="org_label" data-element="ORG"><label for="org"><?php echo $l->t('Organization'); ?></label></dt>
-               <dd style="display:none;" class="propertycontainer" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
-               <dt style="display:none;" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
-               <dd style="display:none;" class="propertycontainer" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
-               <dt style="display:none;" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
-               <dd style="display:none;" class="propertycontainer" id="bday_value" data-element="BDAY"><input id="bday"  required="required" name="value" type="text" class="contacts_property big" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
-               <dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Groups'); ?></label></dt>
-               <dd style="display:none;" class="propertycontainer" id="categories_value" data-element="CATEGORIES"><input id="categories" required="required" name="value[CATEGORIES]" type="text" class="contacts_property bold" name="value" value="" placeholder="
-<?php echo $l->t('Separate groups with commas'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit groups'); ?>"></a></dd>
+               <dt class="hidden" id="org_label" data-element="ORG"><label for="org"><?php echo $l->t('Organization'); ?></label></dt>
+               <dd class="propertycontainer hidden" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
+               <dt class="hidden" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
+               <dd class="propertycontainer hidden" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
+               <dt class="hidden" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
+               <dd class="propertycontainer hidden" id="bday_value" data-element="BDAY"><input id="bday"  required="required" name="value" type="text" class="contacts_property big" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
+               <dt class="hidden" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Groups'); ?></label></dt>
+               <dd class="propertycontainer hidden" id="categories_value" data-element="CATEGORIES"><input id="categories" required="required" name="value[CATEGORIES]" type="text" class="contacts_property bold" name="value" value="" placeholder="
+<?php echo $l->t('Separate groups with commas'); ?>" />
+               <a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a><a role="button" class="action edit" title="<?php echo $l->t('Edit groups'); ?>"></a></dd>
        </dl>
        </fieldset>
        </form>
@@ -67,43 +66,40 @@ $id = isset($_['id']) ? $_['id'] : '';
                <!-- email addresses -->
                <div id="emails">
                <fieldset class="contactpart">
-               <!-- legend><?php echo $l->t('Email'); ?></legend -->
                        <ul id="emaillist" class="propertylist">
-                       <li class="template" style="white-space: nowrap; display: none;" data-element="EMAIL">
+                       <li class="template hidden" data-element="EMAIL">
                                <input type="checkbox" class="contacts_property tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
-                               <input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" />
+                               <input type="email" required="required" class="nonempty contacts_property" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" />
                                <select class="hidden" multiple="multiple" name="parameters[TYPE][]">
                                        <?php echo html_select_options($_['email_types'], array()) ?>
                                </select>
-                               <span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="action mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
-                               <a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
-                       </ul><!-- a id="add_email" class="add" title="<?php echo $l->t('Add email address'); ?>"></a -->
+                               <span class="listactions"><a class="action mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
+                               <a role="button" class="action delete" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
+                       </ul>
                </div> <!-- email addresses-->
 
                <!-- Phone numbers -->
                <div id="phones">
                <fieldset class="contactpart">
-               <!-- legend><?php echo $l->t('Phone'); ?></legend -->
                        <ul id="phonelist" class="propertylist">
-                               <li class="template" style="white-space: nowrap; display: none;" data-element="TEL">
+                               <li class="template hidden" data-element="TEL">
                                <input type="checkbox" class="contacts_property tip" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" /> 
-                               <input type="text" required="required" class="nonempty contacts_property" style="width:10em; border: 0px;" name="value" value="" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
+                               <input type="text" required="required" class="nonempty contacts_property" name="value" value="" placeholder="<?php echo $l->t('Enter phone number'); ?>" />
                                <select multiple="multiple" name="parameters[TYPE][]">
                                        <?php echo html_select_options($_['phone_types'], array()) ?>
                                </select>
-                               <a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
-                       </ul><!-- a id="add_phone" class="add" title="<?php echo $l->t('Add phone number'); ?>"></a -->
+                               <a role="button" class="action delete" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
+                       </ul>
                </div> <!-- Phone numbers -->
 
                <!-- Addresses -->
-               <div id="addresses" style="display:none;">
+               <div id="addresses" class="hidden">
                <fieldset class="contactpart">
-               <!-- legend><?php echo $l->t('Address'); ?></legend -->
                <div id="addressdisplay">
-                       <dl class="addresscard template" style="display: none;" data-element="ADR"><dt>
+                       <dl class="addresscard template hidden" data-element="ADR"><dt>
                        <input class="adr contacts_property" name="value" type="hidden" value="" />
                        <input type="hidden" class="adr_type contacts_property" name="parameters[TYPE][]" value="" />
-                       <span class="adr_type_label"></span><a class="action globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="action edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="action delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
+                       <span class="adr_type_label"></span><a class="action globe" title="<?php echo $l->t('View on map'); ?>"></a><a class="action edit" title="<?php echo $l->t('Edit address details'); ?>"></a><a role="button" class="action delete" title="Delete address"></a>
                        </dt><dd><ul class="addresslist"></ul></dd></dl>
 
                </fieldset>