summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/contacts/css/styles.css3
-rw-r--r--apps/contacts/export.php2
-rw-r--r--apps/contacts/js/interface.js4
-rw-r--r--apps/contacts/lib/vcard.php21
-rw-r--r--apps/contacts/templates/part.details.php1
5 files changed, 24 insertions, 7 deletions
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index dfc296a221b..4fcd8fc1131 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -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; }
diff --git a/apps/contacts/export.php b/apps/contacts/export.php
index a1e974c962b..735d1c5b631 100644
--- a/apps/contacts/export.php
+++ b/apps/contacts/export.php
@@ -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'];
}
?>
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index 9547c581c87..741483633da 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -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');
});
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 401f9622547..726927013c6 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -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']));
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
index 1482c063685..fe0dac235b8 100644
--- a/apps/contacts/templates/part.details.php
+++ b/apps/contacts/templates/part.details.php
@@ -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 ?>