1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Re-enable profile picture upload.

This commit is contained in:
Thomas Tanghus 2012-11-05 12:39:12 +01:00
parent 10d7fbdb92
commit c76abd593a

View File

@ -830,6 +830,10 @@ OC.Contacts = OC.Contacts || {
//console.log('scroll, unseen:', offset, self.$rightContent.height());
}
});*/
$('#contactphoto_fileupload').on('change', function() {
self.uploadPhoto(this.files);
});
this.$ninjahelp.find('.close').on('click keydown',function(event) {
if(wrongKey(event)) {
return;
@ -1193,6 +1197,37 @@ OC.Contacts = OC.Contacts || {
update: function() {
console.log('update');
},
uploadPhoto:function(filelist) {
var self = this;
if(!filelist) {
OC.notify({message:t('contacts','No files selected for upload.')});
return;
}
var file = filelist[0];
var target = $('#file_upload_target');
var form = $('#file_upload_form');
var totalSize=0;
if(file.size > $('#max_upload').val()){
OC.notify({
message:t(
'contacts',
'The file you are trying to upload exceed the maximum size for file uploads on this server.'),
});
return;
} else {
target.load(function() {
var response=jQuery.parseJSON(target.contents().text());
if(response != undefined && response.status == 'success') {
console.log('response', response);
self.editPhoto(self.currentid, response.data.tmp);
//alert('File: ' + file.tmp + ' ' + file.name + ' ' + file.mime);
} else {
OC.notify({message:response.data.message});
}
});
form.submit();
}
},
cloudPhotoSelected:function(id, path) {
var self = this;
console.log('cloudPhotoSelected, id', id)