diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-04-30 10:30:10 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-05-02 11:44:00 +0200 |
commit | 72256abf349c6f8c09f626509aaf4a6c59bbf8be (patch) | |
tree | 54d82f6fb9c19c608d025f81b8f69cdc4e484bfd /apps | |
parent | 67509989845ea422c4d96ebd704fbf5981eb5e8f (diff) | |
download | nextcloud-server-72256abf349c6f8c09f626509aaf4a6c59bbf8be.tar.gz nextcloud-server-72256abf349c6f8c09f626509aaf4a6c59bbf8be.zip |
Contacts: Trying to improve PHOTO handling a bit.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/contacts/js/contacts.js | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index ba8e08fd875..47c660efce8 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -693,6 +693,7 @@ Contacts={ //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) { @@ -701,7 +702,7 @@ Contacts={ if(proptype == 'PHOTO') { console.log('Delete PHOTO'); Contacts.UI.Contacts.refreshThumbnail(Contacts.UI.Card.id); - Contacts.UI.Card.loadPhoto(); + Contacts.UI.Card.loadPhoto(true); } else if(proptype == 'NOTE') { $('#note').find('textarea').val(''); Contacts.UI.propertyContainerFor(obj).hide(); @@ -1119,26 +1120,19 @@ Contacts={ } }); }, - loadPhoto:function(force){ - //if(this.data.PHOTO||force==true) { - $.getJSON(OC.filePath('contacts', 'ajax', 'loadphoto.php'),{'id':this.id},function(jsondata){ - if(jsondata.status == 'success'){ - //alert(jsondata.data.page); - $('#contacts_details_photo_wrapper').data('checksum', jsondata.data.checksum); - $('#contacts_details_photo_wrapper').html(jsondata.data.page); - Contacts.UI.Card.loadPhotoHandlers(); - } - else{ - OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); - } - }); - $('#file_upload_form').show(); - $('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide(); - /*} else { - $('#contacts_details_photo_wrapper').empty(); - $('#file_upload_form').hide(); - $('#contacts_propertymenu a[data-type="PHOTO"]').parent().show(); - }*/ + loadPhoto:function(refresh){ + $.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); + $('#contacts_details_photo_wrapper').html(jsondata.data.page); + Contacts.UI.Card.loadPhotoHandlers(); + } + else{ + OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); + } + }); + $('#file_upload_form').show(); + $('#contacts_propertymenu a[data-type="PHOTO"]').parent().hide(); }, editCurrentPhoto:function(){ $.getJSON(OC.filePath('contacts', 'ajax', 'currentphoto.php'),{'id':this.id},function(jsondata){ @@ -1178,6 +1172,7 @@ Contacts={ if(response != undefined && response.status == 'success'){ // load cropped photo. $('#contacts_details_photo_wrapper').html(response.data.page); + Contacts.UI.Card.data.PHOTO = true; Contacts.UI.Card.loadPhotoHandlers(); }else{ OC.dialogs.alert(response.data.message, t('contacts', 'Error')); |