background, user_info

This commit is contained in:
Rushabh Mehta 2012-02-29 19:09:26 +05:30
parent 805b8a64b5
commit ea8ea41fcd
3 changed files with 20 additions and 5 deletions

9
js/core.min.js vendored
View file

@ -59,6 +59,15 @@ wn.page={set:function(src){var new_selection=$('.inner div.content[_src="'+src+'
$('.inner .current_page').removeClass('current_page');new_selection.addClass('current_page');var title=$('nav ul li a[href*="'+src+'"]').attr('title')||'No Title'
state=window.location.hash;if(state!=src){window.location.hash=state;}
else{document.title=title;}}}
/*
* lib/js/wn/misc/user.js
*/
wn.user_info=function(uid){var def={'fullname':uid,'image':'lib/images/ui/no_img_m.gif'}
if(!wn.boot.user_info)return def
if(!wn.boot.user_info[uid])return def
if(!wn.boot.user_info[uid].fullname)
wn.boot.user_info[uid].fullname=uid;if(!wn.boot.user_info[uid].image)
wn.boot.user_info[uid].image=def.image;return wn.boot.user_info[uid];}
/*
* lib/js/lib/json2.js
*/

View file

@ -19,7 +19,7 @@ function startup() {
profile = r.profile;
user = r.profile.name;
user_fullname = wn.boot.user_fullnames ? wn.boot.user_fullnames[user] : 'Guest';
user_fullname = wn.user_info(user).fullname;
user_defaults = profile.defaults;
user_roles = profile.roles;
user_email = profile.email;

View file

@ -77,13 +77,19 @@ def get_fullnames():
import webnotes
ret = webnotes.conn.sql("""select name,
concat(ifnull(first_name, ''),
if(ifnull(first_name, '')!='', ' ', ''), ifnull(last_name, '')), user_image
from tabProfile where ifnull(enabled, 0)=1""")
if(ifnull(first_name, '')!='', ' ', ''), ifnull(last_name, '')),
user_image, gender
from tabProfile where ifnull(enabled, 0)=1""", as_list=1)
d = {}
for r in ret:
d[r[0]]= {'fullname': r[1], 'image': r[2]}
if not r[2]:
r[2] = 'lib/images/ui/no_img_m.gif'
else:
r[2] = 'files/' + r[2]
d[r[0]]= {'fullname': r[1], 'image': r[2], 'gender': r[3]}
return ret
return d
def get_profile(bootinfo):
"""get profile info"""