Make sure VERSION is set.
Set REV for each edit. Download single VCard.
This commit is contained in:
parent
d93a5a0774
commit
eae3e134ff
|
@ -4,7 +4,8 @@
|
|||
#contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;}
|
||||
#contacts_details_photo { margin:.5em 0em .5em 25%; }
|
||||
|
||||
#contacts_deletecard {position:absolute;top:15px;right:15px;}
|
||||
#contacts_deletecard {position:absolute;top:15px;right:25px;}
|
||||
#contacts_downloadcard {position:absolute;top:15px;right:50px;}
|
||||
#contacts_details_list { list-style:none; }
|
||||
#contacts_details_list li { overflow:visible; }
|
||||
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; }
|
||||
|
|
|
@ -33,7 +33,7 @@ if(isset($book)){
|
|||
exit;
|
||||
}
|
||||
header('Content-Type: text/directory');
|
||||
header('Content-Disposition: inline; filename=' . $data['fullname'] . '.vcf');
|
||||
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
|
||||
echo $data['carddata'];
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -197,6 +197,7 @@ $(document).ready(function(){
|
|||
* Delete currently selected contact (and clear form?)
|
||||
*/
|
||||
$('#contacts_deletecard').live('click',function(){
|
||||
$('#contacts_deletecard').tipsy('hide');
|
||||
var id = $('#rightcontent').data('id');
|
||||
$.getJSON('ajax/deletecard.php',{'id':id},function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
|
@ -401,7 +402,8 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
|
||||
$('.action').tipsy();
|
||||
$('#contacts_deletecard').tipsy();
|
||||
$('#contacts_downloadcard').tipsy();
|
||||
$('.button').tipsy();
|
||||
//Contacts.UI.messageBox('Hello','Sailor');
|
||||
});
|
||||
|
|
|
@ -111,16 +111,21 @@ class OC_Contacts_VCard{
|
|||
if(is_null($uid)){
|
||||
$card->setUID();
|
||||
$uid = $card->getAsString('UID');
|
||||
$data = $card->serialize();
|
||||
//$data = $card->serialize();
|
||||
};
|
||||
$uri = $uid.'.vcf';
|
||||
// VCARD must have a version
|
||||
$version = $card->getAsString('VERSION');
|
||||
// Add version if needed
|
||||
if(is_null($version)){
|
||||
if(!$version){
|
||||
$card->add(new Sabre_VObject_Property('VERSION','3.0'));
|
||||
$data = $card->serialize();
|
||||
}
|
||||
//$data = $card->serialize();
|
||||
}/* else {
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. Version already set as: '.$version,OC_Log::DEBUG);
|
||||
}*/
|
||||
$now = new DateTime;
|
||||
$card->setString('REV', $now->format(DateTime::W3C));
|
||||
$data = $card->serialize();
|
||||
}
|
||||
else{
|
||||
// that's hard. Creating a UID and not saving it
|
||||
|
@ -182,7 +187,12 @@ class OC_Contacts_VCard{
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$now = new DateTime;
|
||||
$card->setString('REV', $now->format(DateTime::W3C));
|
||||
$data = $card->serialize();
|
||||
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
|
||||
$result = $stmt->execute(array($fn,$data,time(),$id));
|
||||
|
@ -212,6 +222,9 @@ class OC_Contacts_VCard{
|
|||
}
|
||||
}
|
||||
}
|
||||
$now = new DateTime;
|
||||
$card->setString('REV', $now->format(DateTime::W3C));
|
||||
$data = $card->serialize();
|
||||
|
||||
$stmt = OC_DB::prepare( 'UPDATE *PREFIX*contacts_cards SET fullname = ?,carddata = ?, lastmodified = ? WHERE id = ?' );
|
||||
$result = $stmt->execute(array($fn,$data,time(),$oldcard['id']));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php if(array_key_exists('FN',$_['details'])): ?>
|
||||
<?php echo $this->inc('part.property.FN', array('property' => $_['details']['FN'][0])); ?>
|
||||
<a href="export?contactid=<?php echo $_['id']; ?>"><img class="svg action" id="contacts_downloadcard" src="<?php echo image_path('', 'actions/download.svg'); ?>" title="<?php echo $l->t('Download contact');?>" /></a>
|
||||
<img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
|
||||
|
||||
<?php if(isset($_['details']['PHOTO'])): // Emails first ?>
|
||||
|
|
Loading…
Reference in New Issue