diff --git a/group/views.py b/group/views.py index 86f40bcd3a..be7941a317 100644 --- a/group/views.py +++ b/group/views.py @@ -8,6 +8,7 @@ from django.http import HttpResponse, HttpResponseRedirect, Http404, \ from django.shortcuts import render_to_response, redirect from django.template import RequestContext from django.template.loader import render_to_string +from django.utils.http import urlquote from auth.decorators import login_required from seaserv import ccnet_rpc, ccnet_threaded_rpc, seafserv_threaded_rpc, \ diff --git a/organizations/templates/organizations/org_info.html b/organizations/templates/organizations/org_info.html index 03a6f83b6e..add9ae2eec 100644 --- a/organizations/templates/organizations/org_info.html +++ b/organizations/templates/organizations/org_info.html @@ -34,10 +34,11 @@ - - + + - + + {% if repos %} {% for repo in repos %} @@ -49,6 +50,7 @@ {% else %} {% endif %} +
名字描述名字描述 更新时间操作共享来源操作
--{{ repo.owner|email2nickname }} 同步 diff --git a/organizations/templates/organizations/personal.html b/organizations/templates/organizations/personal.html index 4d869c05dc..ac4b75c441 100644 --- a/organizations/templates/organizations/personal.html +++ b/organizations/templates/organizations/personal.html @@ -33,6 +33,7 @@ {% endautoescape %} {% endif %} +

{{ org.org_name }}

我拥有的同步目录

diff --git a/templates/base.html b/templates/base.html index a324f57a9d..7d44ec7683 100644 --- a/templates/base.html +++ b/templates/base.html @@ -35,7 +35,7 @@ diff --git a/templates/public_home.html b/templates/public_home.html index 1b5a496de6..52779de611 100644 --- a/templates/public_home.html +++ b/templates/public_home.html @@ -23,10 +23,11 @@
- - + + - + + {% if public_repos %} {% for repo in public_repos %} @@ -38,6 +39,7 @@ {% else %} {% endif %} +
名字描述名字描述 更新时间操作共享来源操作
--{{ repo.owner|email2nickname }} 同步 删除 diff --git a/thirdpart/seaserv/__init__.py b/thirdpart/seaserv/__init__.py index 0d9cbc79a5..5dd1fa2606 100644 --- a/thirdpart/seaserv/__init__.py +++ b/thirdpart/seaserv/__init__.py @@ -12,7 +12,7 @@ from service import get_org_groups, get_personal_groups, get_group_repoids, \ 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, \ - list_personal_shared_repos, is_personal_repo + list_personal_shared_repos, is_personal_repo, list_inner_pub_repos from service import get_binding_peerids, is_valid_filename, check_permission from service import create_org, get_orgs_by_user, get_org_by_url_prefix, \ diff --git a/thirdpart/seaserv/service.py b/thirdpart/seaserv/service.py index a51790afde..548e7eebf2 100644 --- a/thirdpart/seaserv/service.py +++ b/thirdpart/seaserv/service.py @@ -476,6 +476,22 @@ def get_org_group_repos(org_id, group_id, user): return repos # inner pub repo +def list_inner_pub_repos(): + """ + List inner pub repos, which can be access by everyone. + """ + inner_pub_repos = seafserv_threaded_rpc.list_inner_pub_repos() + for repo in inner_pub_repos: + repo.owner = seafserv_threaded_rpc.get_repo_owner(repo.id) + + try: + repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime + except: + repo.latest_modify = None + + inner_pub_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify)) + return inner_pub_repos + def is_inner_pub_repo(repo_id): """ Check whether a repo is public. @@ -500,6 +516,7 @@ def list_org_inner_pub_repos(org_id, start=None, limit=None): # calculate repo's lastest modify time for repo in repos: + repo.owner = seafserv_threaded_rpc.get_org_repo_owner(repo.id) try: repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime except: diff --git a/views.py b/views.py index 8564641a88..e079cfc1eb 100644 --- a/views.py +++ b/views.py @@ -33,7 +33,8 @@ from seaserv import ccnet_rpc, ccnet_threaded_rpc, get_repos, get_emailusers, \ seafserv_threaded_rpc, seafserv_rpc, get_binding_peerids, is_inner_pub_repo, \ 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_personal_shared_repos, is_org_group, get_org_id_by_group, \ + list_inner_pub_repos from pysearpc import SearpcError from base.accounts import User @@ -671,9 +672,7 @@ def public_home(request): Show public home page when CLOUD_MODE is False. """ users = get_emailusers(-1, -1) - public_repos = seafserv_threaded_rpc.list_inner_pub_repos() - calculate_repo_last_modify(public_repos) - public_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify)) + public_repos = list_inner_pub_repos() return render_to_response('public_home.html', { 'users': users,