mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
fix avatar/files update issues
This commit is contained in:
parent
b40fd0a8eb
commit
dd4ae60fa2
@ -3109,10 +3109,12 @@ window.egw_LAB.wait(function() {
|
||||
* Ajax method to update edited avatar photo via avatar widget
|
||||
*
|
||||
* @param int $contact_id
|
||||
* @param file string $file = null null means to delete
|
||||
* @param file string $file null means to delete
|
||||
* @param string $etemplate_exec_id to update id, files, etag, ...
|
||||
*/
|
||||
function ajax_update_photo ($contact_id, $file= null)
|
||||
function ajax_update_photo ($contact_id, $file, $etemplate_exec_id)
|
||||
{
|
||||
$et_request = Api\Etemplate\Request::read($etemplate_exec_id);
|
||||
$response = Api\Json\Response::get();
|
||||
$contact = $this->read($contact_id);
|
||||
if ($file)
|
||||
@ -3132,6 +3134,9 @@ window.egw_LAB.wait(function() {
|
||||
else
|
||||
{
|
||||
$response->data(true);
|
||||
// merge changes (files, id, ...) into current eT request
|
||||
unset($contact['jpegphoto'], $contact['photo_unchanged']);
|
||||
$et_request->preserv = array_merge($et_request->preserv, $contact);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ var et2_avatar = (function(){ "use strict"; return et2_image.extend(
|
||||
/**
|
||||
* Build Editable Mask Layer (EML) in order to show edit/delete actions
|
||||
* on top of profile picture.
|
||||
* @param {boolean} disable delete button in initialization
|
||||
* @param {boolean} _noDelete disable delete button in initialization
|
||||
*/
|
||||
_buildEditableLayer: function (_noDelete)
|
||||
{
|
||||
@ -457,13 +457,16 @@ var et2_avatar = (function(){ "use strict"; return et2_image.extend(
|
||||
{
|
||||
var canvas = jQuery('#_cropper_image').cropper('getCroppedCanvas');
|
||||
self.image.attr('src', canvas.toDataURL("image/jpeg", 1.0));
|
||||
egw.json('addressbook.addressbook_ui.ajax_update_photo', [self.options.contact_id, canvas.toDataURL('image/jpeg',1.0)], function(res){
|
||||
if (res)
|
||||
self.egw().json('addressbook.addressbook_ui.ajax_update_photo',
|
||||
[self.options.contact_id, canvas.toDataURL('image/jpeg',1.0), self.getInstanceManager().etemplate_exec_id],
|
||||
function(res)
|
||||
{
|
||||
del.show();
|
||||
egw.refresh('Avatar updated.', egw.app_name());
|
||||
}
|
||||
}).sendRequest();
|
||||
if (res)
|
||||
{
|
||||
del.show();
|
||||
self.egw().refresh('Avatar updated.', egw.app_name());
|
||||
}
|
||||
}).sendRequest();
|
||||
}
|
||||
},
|
||||
title: _title||egw.lang('Input required'),
|
||||
@ -490,14 +493,17 @@ var et2_avatar = (function(){ "use strict"; return et2_image.extend(
|
||||
et2_dialog.show_dialog(function(_btn){
|
||||
if (_btn == et2_dialog.YES_BUTTON)
|
||||
{
|
||||
egw.json('addressbook.addressbook_ui.ajax_update_photo', [self.options.contact_id, null], function(res){
|
||||
if (res)
|
||||
self.egw().json('addressbook.addressbook_ui.ajax_update_photo',
|
||||
[self.options.contact_id, null, self.getInstanceManager().etemplate_exec_id],
|
||||
function(res)
|
||||
{
|
||||
self.image.attr('src','');
|
||||
del.hide();
|
||||
if (res)
|
||||
{
|
||||
self.image.attr('src','');
|
||||
del.hide();
|
||||
egw.refresh('Avatar Deleted.', egw.app_name());
|
||||
}
|
||||
}).sendRequest();
|
||||
}
|
||||
}).sendRequest();
|
||||
}
|
||||
}, egw.lang('Delete this photo?'), 'Delete', null, et2_dialog.BUTTONS_YES_NO);
|
||||
})
|
||||
|
@ -994,6 +994,7 @@ class Contacts extends Contacts\Storage
|
||||
$contact['id'] = $to_write['id'];
|
||||
$contact['uid'] = $to_write['uid'];
|
||||
$contact['etag'] = $to_write['etag'];
|
||||
$contact['files'] = $to_write['files'];
|
||||
|
||||
// Clear any files saved with new entries
|
||||
// They've been dealt with already and they cause errors with linking
|
||||
|
@ -575,6 +575,7 @@ class Storage
|
||||
$contact['id'] = $this->somain->data['id'];
|
||||
$contact['uid'] = $this->somain->data['uid'];
|
||||
$contact['etag'] = $this->somain->data['etag'];
|
||||
$contact['files'] = $this->somain->data['files'];
|
||||
|
||||
if ($this->contact_repository == 'sql-ldap')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user