瀏覽代碼

background, user_info

version-14
Rushabh Mehta 13 年之前
父節點
當前提交
ea8ea41fcd
共有 3 個檔案被更改,包括 20 行新增5 行删除
  1. +9
    -0
      js/core.min.js
  2. +1
    -1
      js/legacy/app.js
  3. +10
    -4
      py/webnotes/boot.py

+ 9
- 0
js/core.min.js 查看文件

@@ -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
*/


+ 1
- 1
js/legacy/app.js 查看文件

@@ -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;


+ 10
- 4
py/webnotes/boot.py 查看文件

@@ -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"""


Loading…
取消
儲存