mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 13:50:07 +00:00
Add public link admin
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
<li>
|
||||
<a href="{{ SITE_ROOT }}sys/notificationadmin/" {% block nav_notificationadmin_class %}{% endblock %}>{% trans "Notifications" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ SITE_ROOT }}sys/publinkadmin/" {% block nav_publinkadmin_class %}{% endblock %}>{% trans "Links" %}</a>
|
||||
</li>
|
||||
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
65
seahub/templates/sysadmin/sys_publink_admin.html
Normal file
65
seahub/templates/sysadmin/sys_publink_admin.html
Normal file
@@ -0,0 +1,65 @@
|
||||
{% extends "admin_base.html" %}
|
||||
{% load i18n seahub_tags %}
|
||||
{% block nav_seafadmin_class %}class="cur"{% endblock %}
|
||||
|
||||
{% block main_panel %}
|
||||
<h3>{% trans "All Public Links" %}</h3>
|
||||
{% if publinks %}
|
||||
<table>
|
||||
<tr>
|
||||
<th width="20%">{% trans "Name" %}</th>
|
||||
<th width="20%">{% trans "Owner" %}</th>
|
||||
<th width="20%">{% trans "Create At" %}</th>
|
||||
<th width="30%">{% trans "Count" %}</th>
|
||||
<th width="10%">{% trans "Operations" %}</th>
|
||||
</tr>
|
||||
{% for publink in publinks %}
|
||||
<tr>
|
||||
<td>{{ publink.name }}</td>
|
||||
<td>{{ publink.username }}</td>
|
||||
<td>{{ publink.ctime|translate_seahub_time }} </td>
|
||||
<td>{{ publink.view_cnt }}</td>
|
||||
<td><a class="op" href="{% url 'remove_shared_link' %}?t={{ publink.token }}">{% trans "Remove" %}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<div id="paginator">
|
||||
{% if current_page != 1 %}
|
||||
<a href="{{ SITE_ROOT }}sys/seafadmin/?page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous" %}</a>
|
||||
{% endif %}
|
||||
{% if page_next %}
|
||||
<a href="{{ SITE_ROOT }}sys/seafadmin/?page={{ next_page }}&per_page={{ per_page }}">{% trans "Next" %}</a>
|
||||
{% endif %}
|
||||
{% if current_page != 1 or page_next %}
|
||||
|
|
||||
{% endif %}
|
||||
<span>{% trans "Per page: " %}</span>
|
||||
{% if per_page == 25 %}
|
||||
<span> 25 </span>
|
||||
{% else %}
|
||||
<a href="{{ SITE_ROOT }}sys/seafadmin/?per_page=25" class="per-page">25</a>
|
||||
{% endif %}
|
||||
{% if per_page == 50 %}
|
||||
<span> 50 </span>
|
||||
{% else %}
|
||||
<a href="{{ SITE_ROOT }}sys/seafadmin/?per_page=50" class="per-page">50</a>
|
||||
{% endif %}
|
||||
{% if per_page == 100 %}
|
||||
<span> 100 </span>
|
||||
{% else %}
|
||||
<a href="{{ SITE_ROOT }}sys/seafadmin/?per_page=100" class="per-page">100</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{% trans "Empty" %}</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@@ -15,7 +15,7 @@ from seahub.views.wiki import personal_wiki, personal_wiki_pages, \
|
||||
personal_wiki_page_delete
|
||||
from seahub.views.sysadmin import sys_repo_admin, sys_user_admin, sys_group_admin, \
|
||||
user_info, user_add, user_remove, user_make_admin, \
|
||||
user_remove_admin, user_reset, user_activate
|
||||
user_remove_admin, user_reset, user_activate, sys_publink_admin
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
#from django.contrib import admin
|
||||
@@ -115,6 +115,7 @@ urlpatterns = patterns('',
|
||||
(r'^sys/seafadmin/$', sys_repo_admin),
|
||||
url(r'^sys/useradmin/$', sys_user_admin, name='sys_useradmin'),
|
||||
url(r'^sys/groupadmin/$', sys_group_admin, name='sys_group_admin'),
|
||||
url(r'^sys/publinkadmin/$', sys_publink_admin, name='sys_publink_admin'),
|
||||
url(r'^sys/notificationadmin/', notification_list, name='notification_list'),
|
||||
url(r'^useradmin/add/$', user_add, name="user_add"),
|
||||
(r'^useradmin/remove/(?P<user_id>[^/]+)/$', user_remove),
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# encoding: utf-8
|
||||
|
||||
import os
|
||||
from types import FunctionType
|
||||
import logging
|
||||
import simplejson as json
|
||||
@@ -30,6 +31,7 @@ from seahub.auth.decorators import login_required
|
||||
from seahub.utils import IS_EMAIL_CONFIGURED
|
||||
from seahub.forms import SetUserQuotaForm, AddUserForm
|
||||
from seahub.profile.models import Profile
|
||||
from seahub.share.models import FileShare, AnonymousShare
|
||||
|
||||
import seahub.settings as settings
|
||||
from seahub.settings import INIT_PASSWD, \
|
||||
@@ -381,3 +383,33 @@ def sys_group_admin(request):
|
||||
'page_next': page_next,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@login_required
|
||||
@sys_staff_required
|
||||
def sys_publink_admin(request):
|
||||
# Make sure page request is an int. If not, deliver first page.
|
||||
try:
|
||||
current_page = int(request.GET.get('page', '1'))
|
||||
per_page = int(request.GET.get('per_page', '100'))
|
||||
except ValueError:
|
||||
current_page = 1
|
||||
per_page = 100
|
||||
|
||||
publinks = FileShare.objects.all()[per_page * (current_page -1):
|
||||
per_page + 1]
|
||||
for l in publinks:
|
||||
if l.s_type == 'f':
|
||||
l.name = os.path.basename(l.path)
|
||||
else:
|
||||
l.name = os.path.dirname(l.path)
|
||||
|
||||
return render_to_response(
|
||||
'sysadmin/sys_publink_admin.html', {
|
||||
'publinks': publinks,
|
||||
'current_page': current_page,
|
||||
'prev_page': current_page-1,
|
||||
'next_page': current_page+1,
|
||||
'per_page': per_page,
|
||||
'page_next': True,
|
||||
},
|
||||
context_instance=RequestContext(request))
|
||||
|
Reference in New Issue
Block a user