Make PHOTO deletable.
This commit is contained in:
parent
9e83f0247f
commit
4a91c6dbed
3 changed files with 17 additions and 4 deletions
|
@ -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)));
|
||||
?>
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue