summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-03-13 14:56:03 +0100
committerThomas Tanghus <thomas@tanghus.net>2012-03-13 14:56:03 +0100
commit4a91c6dbed149fd8828b6652c73db8e796c3c055 (patch)
treeea8576f574ed1c0c4729bc45b7cc23e2ce54a27a /apps
parent9e83f0247ff9c259a3dbf86106a6eeb06de42ba4 (diff)
downloadnextcloud-server-4a91c6dbed149fd8828b6652c73db8e796c3c055.tar.gz
nextcloud-server-4a91c6dbed149fd8828b6652c73db8e796c3c055.zip
Make PHOTO deletable.
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/ajax/loadphoto.php11
-rw-r--r--apps/contacts/js/contacts.js5
-rw-r--r--apps/contacts/templates/part.contact.php5
3 files changed, 17 insertions, 4 deletions
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'] : '';
<div class="contactsection">
- <form style="display:none;" id="file_upload_form" action="ajax/uploadphoto.php" method="post" enctype="multipart/form-data" target="file_upload_target">
+ <form style="display:none;" id="file_upload_form" action="ajax/uploadphoto.php" method="post" enctype="multipart/form-data" target="file_upload_target" class="propertycontainer" data-element="PHOTO">
<fieldset id="photo" class="formfloat">
+ <a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a>
<div id="contacts_details_photo_wrapper" title="<?php echo $l->t('Click or drop to upload picture'); ?> (max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
<!-- 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>
@@ -63,7 +64,7 @@ $id = isset($_['id']) ? $_['id'] : '';
<a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a>
</dd -->
<dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Categories'); ?></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" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Categories'); ?>" /><a class="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 categories'); ?>"></a></dd>
+ <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" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Categories'); ?>" /><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 categories'); ?>"></a></dd>
</dl>
</fieldset>
<fieldset id="note" class="formfloat propertycontainer contactpart" style="display:none;" data-element="NOTE">