1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 19:05:16 +00:00

List history of read-only library, and fixed typo in share repo to all

This commit is contained in:
zhengxie 2013-01-21 11:34:18 +08:00
parent ecefe7adc7
commit f2ee3c614b
5 changed files with 14 additions and 9 deletions

View File

@ -77,8 +77,7 @@ def share_repo(request):
try:
seafserv_threaded_rpc.set_inner_pub_repo(repo_id, permission)
except:
msg = _(u'Failed to share to all members')
message.add_message(request, message.ERROR, msg)
messages.error(request, _(u'Failed to share to all members'))
continue
msg = _(u'Shared to all members successfully, go check it at <a href="%s">Share</a>.') % \

View File

@ -38,7 +38,7 @@
</div>
</div>
{% if user_perm == 'r' %}
<p>{% trans "This library is read-only, and you can only view the files."%}</p>
<p>{% trans "This library is read-only, you can not modify the contents of this library."%}</p>
{% endif %}
{% if user_perm and path == '/' %}
@ -53,7 +53,7 @@
{{ current_commit.props.desc|translate_commit_desc }}
<a class="lsch" href="#" data-url="{% url 'repo_history_changes' repo.id %}?commit_id={{ current_commit.id }}" data-time="{{ current_commit.props.ctime|tsstr_sec }}">{% trans "Details"%}</a>
</span>
{% if user_perm == 'rw' %}
{% if user_perm %}
<a href="{% url 'seahub.views.repo_history' repo.id %}" class="more fright">{% trans "History"%}</a>
{% endif %}
</p>

View File

@ -8,7 +8,10 @@
<button data="{{ SITE_ROOT }}repo/{{ repo.props.id }}/" class="fright" id="back">{% trans "Back to Library"%}</button>
</div>
{% if user_perm == 'rw' %}
<p class="tip">{% trans "Tip: A snapshot will be generated after modification, which records the library state before this modification."%}<a href="{% url 'repo_view_snapshot' repo.props.id %}">{% trans "View Snapshot"%}</a></p>
{% endif %}
<div class="commit-list-outer-container">
<div class="commit-list-inner-container">
<table class="commit-list">

View File

@ -11,6 +11,7 @@ from django.contrib.sites.models import RequestSite
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.hashcompat import sha_constructor, md5_constructor
from django.utils.translation import ugettext as _
from base.models import FileContributors, UserStarredFiles, DirFilesLastModifiedInfo
@ -65,7 +66,7 @@ def render_permission_error(request, msg=None, extra_ctx=None):
"""
ctx = {}
ctx['error_msg'] = msg or u'权限错误'
ctx['error_msg'] = msg or _('permissiong error')
if extra_ctx:
for k in extra_ctx:
@ -80,7 +81,7 @@ def render_error(request, msg=None, extra_ctx=None):
"""
ctx = {}
ctx['error_msg'] = msg or u'内部错误'
ctx['error_msg'] = msg or _('Internal error')
if extra_ctx:
for k in extra_ctx:

View File

@ -117,8 +117,8 @@ def access_to_repo(request, repo_id, repo_ap=None):
Check whether user in the request can access to repo, which means user can
view directory entries on repo page. Only repo owner or person who is shared
can access to repo.
NOTE: `repo_ap` may be used in future.
NOTE: This function is deprecated, use `get_user_permission`.
"""
if not request.user.is_authenticated():
token = request.COOKIES.get('anontoken', None)
@ -670,9 +670,10 @@ def get_subdir(request):
@ctx_switch_required
def repo_history(request, repo_id):
"""
View repo history.
List library modification histories.
"""
if not access_to_repo(request, repo_id, ''):
user_perm = get_user_permission(request, repo_id)
if not user_perm:
return render_permission_error(request, _(u'Unable to view library modification'))
repo = get_repo(repo_id)
@ -713,6 +714,7 @@ def repo_history(request, repo_id):
'next_page': current_page+1,
'per_page': per_page,
'page_next': page_next,
'user_perm': user_perm,
}, context_instance=RequestContext(request))
@login_required