mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-02-12 06:54:28 +01:00
Make PHOTO deletable.
This commit is contained in:
parent
2bb405aea4
commit
519c3e0509
@ -43,8 +43,17 @@ if($id == '') {
|
|||||||
bailOut(OC_Contacts_App::$l10n->t('Missing contact 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 = new OC_TEMPLATE("contacts", "part.contactphoto");
|
||||||
$tmpl->assign('id', $id);
|
$tmpl->assign('id', $id);
|
||||||
$page = $tmpl->fetchPage();
|
$page = $tmpl->fetchPage();
|
||||||
OC_JSON::success(array('data' => array('page'=>$page)));
|
OC_JSON::success(array('data' => array('page'=>$page, 'checksum'=>$checksum)));
|
||||||
?>
|
?>
|
||||||
|
@ -662,7 +662,9 @@ Contacts={
|
|||||||
} else if(type == 'single') {
|
} else if(type == 'single') {
|
||||||
var proptype = Contacts.UI.propertyTypeFor(obj);
|
var proptype = Contacts.UI.propertyTypeFor(obj);
|
||||||
console.log('deleteProperty, hiding: ' + proptype);
|
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).hide();
|
||||||
Contacts.UI.propertyContainerFor(obj).data('checksum', '');
|
Contacts.UI.propertyContainerFor(obj).data('checksum', '');
|
||||||
} else {
|
} else {
|
||||||
@ -943,6 +945,7 @@ Contacts={
|
|||||||
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
|
$.getJSON('ajax/loadphoto.php',{'id':this.id},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
//alert(jsondata.data.page);
|
//alert(jsondata.data.page);
|
||||||
|
$('#file_upload_form').data('checksum', jsondata.data.checksum);
|
||||||
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
|
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -23,8 +23,9 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||||||
|
|
||||||
<div class="contactsection">
|
<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">
|
<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']; ?>)">
|
<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']; ?>" / -->
|
<!-- 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>
|
<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>
|
<a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a>
|
||||||
</dd -->
|
</dd -->
|
||||||
<dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Categories'); ?></label></dt>
|
<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>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="note" class="formfloat propertycontainer contactpart" style="display:none;" data-element="NOTE">
|
<fieldset id="note" class="formfloat propertycontainer contactpart" style="display:none;" data-element="NOTE">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user