From: Thomas Tanghus Date: Tue, 13 Mar 2012 13:56:03 +0000 (+0100) Subject: Make PHOTO deletable. X-Git-Tag: v4.0.0beta~186^2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4a91c6dbed149fd8828b6652c73db8e796c3c055;p=nextcloud-server.git Make PHOTO deletable. --- diff --git a/apps/contacts/ajax/loadphoto.php b/apps/contacts/ajax/loadphoto.php index 1f4cde0b535..2c8bb7bf1ed 100644 --- a/apps/contacts/ajax/loadphoto.php +++ b/apps/contacts/ajax/loadphoto.php @@ -43,8 +43,17 @@ if($id == '') { bailOut(OC_Contacts_App::$l10n->t('Missing contact id.')); } +$checksum = ''; +$vcard = OC_Contacts_App::getContactVCard( $id ); +foreach($vcard->children as $property){ + if($property->name == 'PHOTO') { + $checksum = md5($property->serialize()); + break; + } +} + $tmpl = new OC_TEMPLATE("contacts", "part.contactphoto"); $tmpl->assign('id', $id); $page = $tmpl->fetchPage(); -OC_JSON::success(array('data' => array('page'=>$page))); +OC_JSON::success(array('data' => array('page'=>$page, 'checksum'=>$checksum))); ?> diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index 13d71be384d..18214cb1cc5 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -662,7 +662,9 @@ Contacts={ } else if(type == 'single') { var proptype = Contacts.UI.propertyTypeFor(obj); console.log('deleteProperty, hiding: ' + proptype); - if(proptype == 'NOTE') { + var othertypes = ['NOTE', 'PHOTO']; + if(othertypes.indexOf(proptype) != -1) { + console.log('NOTE or PHOTO'); Contacts.UI.propertyContainerFor(obj).hide(); Contacts.UI.propertyContainerFor(obj).data('checksum', ''); } else { @@ -943,6 +945,7 @@ Contacts={ $.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){ if(jsondata.status == 'success'){ //alert(jsondata.data.page); + $('#file_upload_form').data('checksum', jsondata.data.checksum); $('#contacts_details_photo_wrapper').html(jsondata.data.page); } else{ diff --git a/apps/contacts/templates/part.contact.php b/apps/contacts/templates/part.contact.php index a3b4917ae98..cb1e080a40a 100644 --- a/apps/contacts/templates/part.contact.php +++ b/apps/contacts/templates/part.contact.php @@ -23,8 +23,9 @@ $id = isset($_['id']) ? $_['id'] : '';
-