1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 21:50:59 +00:00

[group-member-add]enable add more than one at one time

This commit is contained in:
llj 2012-05-21 11:47:53 +08:00
parent de984749d0
commit 2ac9c9b7f6
3 changed files with 19 additions and 11 deletions

View File

@ -44,7 +44,7 @@
<form id="member-add-form" action="{{ SITE_ROOT }}group/memberadd/" method="post" name="member-add-form" class="hide">
<label>邮箱:</label><br />
<input id="added-member-name" name="user_name" value="" /><br />
<textarea id="added-member-name" name="user_name"></textarea><br />
<input type="hidden" id="group_id" name="group_id" value="{{ group.id }}" />
<p class="error hide" id="member-add-error">输入不能为空。</p>
<input type="submit" value="提交" id="member-add-submit" />

View File

@ -121,15 +121,22 @@ def group_info(request, group_id):
def group_add_member(request):
if request.method == 'POST':
group_id = request.POST.get('group_id')
member_name = request.POST.get('user_name').split(',')[0]
if not validate_emailuser(member_name):
err_msg = u'用户不存在'
return go_error(request, err_msg)
else:
try:
group_id_int = int(group_id)
except ValueError:
return go_error(request, u'group id 不是有效参数')
member_names = request.POST.get('user_name').split(',')
try:
group_id_int = int(group_id)
except ValueError:
return go_error(request, u'group id 不是有效参数')
for member_name in member_names:
member_name = member_name.strip(' ')
if not member_name:
continue
if not validate_emailuser(member_name):
err_msg = u'用户不存在'
return go_error(request, err_msg)
try:
ccnet_rpc.group_add_member(group_id_int, request.user.username,
member_name)

View File

@ -227,7 +227,8 @@ label { display: inline-block; margin:2px 0px; }
margin-bottom:14px;
}
/*repo-share-form*/
#to_email {
#to_email,
#added-member-name {
width:260px;
height:80px;
}