diff --git a/media/css/seahub.css b/media/css/seahub.css
index 7cc5a49474..a5df1d9634 100644
--- a/media/css/seahub.css
+++ b/media/css/seahub.css
@@ -283,6 +283,7 @@ ul.with-bg li {
min-width:65px;
padding:5px 0;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
+ z-index: 1000;
-moz-box-shadow: -1px 1px 1px rgba(0,0,0,.2);
-webkit-box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
diff --git a/templates/snippets/bottom_bar.html b/templates/snippets/bottom_bar.html
index fa4658b3b6..a286739e8a 100644
--- a/templates/snippets/bottom_bar.html
+++ b/templates/snippets/bottom_bar.html
@@ -1,4 +1,5 @@
-var Bottom_bar = '
{% if groups %} {% endif %}
';
+{% load url from future %}
+var Bottom_bar = '{% if groups %} {% endif %}
';
$('#wrapper').append(Bottom_bar);
$('#bottom-bar').css({'position':'fixed', 'bottom':0, 'right':'10px'});
$('#main-panel').css('margin-bottom', '28px');
@@ -17,6 +18,15 @@ $('#recommend').click(function() {
addAutocomplete('#recommend-groups', '#recommend-form', group_list);
$('.ui-autocomplete').css({'max-height': window.innerHeight - $('.ui-autocomplete-input').offset().top - $('.ui-autocomplete-input').height() - 10, 'overflow': 'auto'});
});
+
+$('#click-into-group').click(function() {
+ {% for group in groups %}
+ {% if forloop.first %}
+ location.href= "{% url 'group_info' group.id %}";
+ {% endif %}
+ {% endfor %}
+});
+
$('#recommend-submit').click(function() {
if (!$.trim($('#recommend-groups').val())) {
apply_form_error('recommend-form', '小组名称不能为空。');
diff --git a/thirdpart/seaserv/__init__.py b/thirdpart/seaserv/__init__.py
index 5dd1fa2606..06bac9b8fe 100644
--- a/thirdpart/seaserv/__init__.py
+++ b/thirdpart/seaserv/__init__.py
@@ -8,7 +8,7 @@ from service import get_org_groups, get_personal_groups, get_group_repoids, \
check_group_staff, remove_group_user, get_group, get_org_id_by_group, \
get_group_members, get_shared_groups_by_repo, is_group_user, \
get_org_group_repos, get_group_repos, get_org_groups_by_user, is_org_group,\
- del_org_group_repo
+ del_org_group_repo, get_org_groups_by_repo
from service import get_repos, get_repo, get_commits, get_branches, \
get_org_repos, is_repo_owner, create_org_repo, is_inner_pub_repo, \
list_org_inner_pub_repos, get_org_id_by_repo_id, list_org_shared_repos, \
diff --git a/thirdpart/seaserv/service.py b/thirdpart/seaserv/service.py
index 548e7eebf2..1804ab9cbc 100644
--- a/thirdpart/seaserv/service.py
+++ b/thirdpart/seaserv/service.py
@@ -364,9 +364,9 @@ def get_branches(repo_id):
def get_shared_groups_by_repo(repo_id):
try:
group_ids = seafserv_threaded_rpc.get_shared_groups_by_repo(repo_id)
- if not group_ids:
- return []
except SearpcError:
+ group_ids = ''
+ if not group_ids:
return []
groups = []
@@ -475,6 +475,24 @@ def get_org_group_repos(org_id, group_id, user):
return repos
+def get_org_groups_by_repo(org_id, repo_id):
+ try:
+ group_ids = seafserv_threaded_rpc.get_org_groups_by_repo(org_id,
+ repo_id)
+ except SearpcError:
+ group_ids = ''
+ if not group_ids:
+ return []
+
+ groups = []
+ for group_id in group_ids.split('\n'):
+ if not group_id:
+ continue
+ group = get_group(group_id)
+ if group:
+ groups.append(group)
+ return groups
+
# inner pub repo
def list_inner_pub_repos():
"""
diff --git a/views.py b/views.py
index e079cfc1eb..73ffda3bf2 100644
--- a/views.py
+++ b/views.py
@@ -34,7 +34,7 @@ from seaserv import ccnet_rpc, ccnet_threaded_rpc, get_repos, get_emailusers, \
check_group_staff, get_personal_groups, is_repo_owner, del_org_group_repo,\
get_group, get_shared_groups_by_repo, is_group_user, check_permission, \
list_personal_shared_repos, is_org_group, get_org_id_by_group, \
- list_inner_pub_repos
+ list_inner_pub_repos, get_org_groups_by_repo
from pysearpc import SearpcError
from base.accounts import User
@@ -199,9 +199,13 @@ def render_repo(request, repo_id, error=''):
# generate path and link
zipped = gen_path_link(path, repo.name)
- # get groups this repo is shared
+ # get groups this repo is shared
groups = []
- repo_shared_groups = get_shared_groups_by_repo(repo_id)
+ if request.user.org:
+ org_id = request.user.org['org_id']
+ repo_shared_groups = get_org_groups_by_repo(org_id, repo_id)
+ else:
+ repo_shared_groups = get_shared_groups_by_repo(repo_id)
for group in repo_shared_groups:
# check whether user joined this group
if is_group_user(group.id, request.user.username):