Fixed image attachment in profile settings
This commit is contained in:
parent
6a605b47ef
commit
c111803a4a
@ -97,7 +97,12 @@ MyProfile = function(wrapper) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
var w = d.widgets['wrapper'];
|
var w = d.widgets['wrapper'];
|
||||||
me.uploader = new Uploader(w, {cmd:'home.page.profile_settings.profile_settings.set_user_image'}, pscript.user_image_upload, 1)
|
me.uploader = new Uploader(w,
|
||||||
|
{
|
||||||
|
modulename:'home.page.profile_settings.profile_settings',
|
||||||
|
method: 'set_user_image'
|
||||||
|
},
|
||||||
|
pscript.user_image_upload, 1)
|
||||||
me.change_dialog = d;
|
me.change_dialog = d;
|
||||||
}
|
}
|
||||||
me.change_dialog.show();
|
me.change_dialog.show();
|
||||||
|
@ -36,24 +36,10 @@ def set_user_details(arg=None):
|
|||||||
p.save()
|
p.save()
|
||||||
webnotes.msgprint('Updated')
|
webnotes.msgprint('Updated')
|
||||||
|
|
||||||
def set_user_image(arg=None):
|
def set_user_image(fid, fname):
|
||||||
"""
|
"""
|
||||||
Set uploaded image as user image
|
Set uploaded image as user image
|
||||||
"""
|
"""
|
||||||
from webnotes.utils.upload_handler import UploadHandler
|
from webnotes.utils.file_manager import add_file_list, remove_all
|
||||||
|
remove_all('Profile', webnotes.session['user'])
|
||||||
uh = UploadHandler()
|
add_file_list('Profile', webnotes.session['user'], fname, fid)
|
||||||
if not uh.file_name:
|
|
||||||
# do nothing - no file found
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
# save the file
|
|
||||||
from webnotes.utils.file_manager import FileAttachments
|
|
||||||
|
|
||||||
fa = FileAttachments('Profile', webnotes.session['user'])
|
|
||||||
fa.delete_all()
|
|
||||||
fa.add(uh.file_name, uh.content)
|
|
||||||
fa.save()
|
|
||||||
|
|
||||||
uh.set_callback('window.parent.upload_callback("%s", "%s")' \
|
|
||||||
% (webnotes.form_dict['uploader_id'], fa.get_fid(0)))
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>ERPNext</title>
|
<title>ERPNext</title>
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<script type="text/javascript">window._version_number="338"
|
<script type="text/javascript">window._version_number="340"
|
||||||
|
|
||||||
wn={}
|
wn={}
|
||||||
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
|
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user