mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-30 21:50:59 +00:00
Add seafile version, change 4GB to 2GB, and modify userinfo page
This commit is contained in:
parent
eaaee89f55
commit
566e66b8d6
16
base/context_processors.py
Normal file
16
base/context_processors.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
A set of request processors that return dictionaries to be merged into a
|
||||||
|
template context. Each function takes the request object as its only parameter
|
||||||
|
and returns a dictionary to add to the context.
|
||||||
|
|
||||||
|
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
||||||
|
RequestContext.
|
||||||
|
"""
|
||||||
|
import settings
|
||||||
|
|
||||||
|
def version(request):
|
||||||
|
"""
|
||||||
|
Adds seafile version to the context
|
||||||
|
|
||||||
|
"""
|
||||||
|
return {'seafile_version': settings.SEAFILE_VERSION}
|
@ -48,6 +48,7 @@ div.logo { margin-top: 0px; }
|
|||||||
#user-info { float: right; font-size: 12px; color: #808; font-style:normal; margin-bottom:10px; }
|
#user-info { float: right; font-size: 12px; color: #808; font-style:normal; margin-bottom:10px; }
|
||||||
#user-info span { color: #888; display:inline-block; width:60px; text-align:right; margin-right:5px; }
|
#user-info span { color: #888; display:inline-block; width:60px; text-align:right; margin-right:5px; }
|
||||||
#logo-info { float:right; font-size: 14px; color: #ccc; font-style:italic; }
|
#logo-info { float:right; font-size: 14px; color: #ccc; font-style:italic; }
|
||||||
|
#version-info { float:right; font-size: 12px; color: #ccc; }
|
||||||
#header #ident { margin-top: 8px; float: right; font-size: 12px; }
|
#header #ident { margin-top: 8px; float: right; font-size: 12px; }
|
||||||
#header #ident p { color: #808; }
|
#header #ident p { color: #808; }
|
||||||
#header #ident label { color: #888; }
|
#header #ident label { color: #888; }
|
||||||
|
@ -74,7 +74,6 @@ ROOT_URLCONF = 'djblets.util.rooturl'
|
|||||||
|
|
||||||
SITE_ROOT = '/'
|
SITE_ROOT = '/'
|
||||||
|
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||||
# Always use forward slashes, even on Windows.
|
# Always use forward slashes, even on Windows.
|
||||||
@ -89,6 +88,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
|||||||
'django.core.context_processors.media',
|
'django.core.context_processors.media',
|
||||||
'djblets.util.context_processors.siteRoot',
|
'djblets.util.context_processors.siteRoot',
|
||||||
'django.core.context_processors.request',
|
'django.core.context_processors.request',
|
||||||
|
'seahub.base.context_processors.version',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -127,6 +127,8 @@ HTTP_SERVER_ROOT = "http://localhost:8082"
|
|||||||
# ccnet-applet address and port, used in repo download
|
# ccnet-applet address and port, used in repo download
|
||||||
CCNET_APPLET_ROOT = "http://localhost:8081"
|
CCNET_APPLET_ROOT = "http://localhost:8081"
|
||||||
|
|
||||||
|
SEAFILE_VERSION = '0.9.2'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import local_settings
|
import local_settings
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -40,6 +40,11 @@
|
|||||||
Hope our efforts will bring you benefits.
|
Hope our efforts will bring you benefits.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="verson info">
|
||||||
|
<div id="version-info">
|
||||||
|
Seafile 版本: {{ seafile_version }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="navs">
|
<div class="navs">
|
||||||
{% block nav %}
|
{% block nav %}
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% block nav_home_class %}class="cur"{% endblock %}
|
{% block nav_home_class %}class="cur"{% endblock %}
|
||||||
{% block left_panel %}
|
{% block left_panel %}
|
||||||
<h3>已用空间</h3>
|
<h3>已用空间</h3>
|
||||||
<p>{{ quota_usage|filesizeformat }} / 4 GB</p>
|
<p>{{ quota_usage|filesizeformat }} / 2 GB</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
{% extends "myhome_base.html" %}
|
|
||||||
|
|
||||||
{% block nav_home_class %}class="cur"{% endblock %}
|
|
||||||
{% block left_panel %}
|
|
||||||
<h3>已用空间</h3>
|
|
||||||
<p>{{ quota_usage|filesizeformat }} / 4 GB</p>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block right_panel %}
|
|
||||||
|
|
||||||
{% if not owner %}
|
|
||||||
<h3>我的同步目录</h3>
|
|
||||||
{% else %}
|
|
||||||
<h3>{{ owner }}的同步目录</h3>
|
|
||||||
{% endif %}
|
|
||||||
{% if owned_repos %}
|
|
||||||
<table class="repo-list">
|
|
||||||
<tr>
|
|
||||||
<th width="12%">名字</th>
|
|
||||||
<th width="33%">ID</th>
|
|
||||||
<th width="47%">描述</th>
|
|
||||||
<th width="8%">操作</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% for repo in owned_repos %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
|
|
||||||
<td>{{ repo.props.id }}</td>
|
|
||||||
<td>{{ repo.props.desc }}</td>
|
|
||||||
<td><button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<p>暂无</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if not owner %}
|
|
||||||
<h3>我用过的同步目录</h3>
|
|
||||||
{% else %}
|
|
||||||
<h3>{{ owner }}用过的同步目录</h3>
|
|
||||||
{% endif %}
|
|
||||||
{% if fetched_repos %}
|
|
||||||
<table class="repo-list">
|
|
||||||
<tr>
|
|
||||||
<th width="12%">名字</th>
|
|
||||||
<th width="33%">ID</th>
|
|
||||||
<th width="47%">描述</th>
|
|
||||||
<th width="8%">操作</th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% for repo in fetched_repos %}
|
|
||||||
<tr>
|
|
||||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
|
|
||||||
<td>{{ repo.props.id }}</td>
|
|
||||||
<td>{{ repo.props.desc }}</td>
|
|
||||||
<td><button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<p>暂无</p>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block extra_script %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
addConfirmTo($('.repo-delete-btn'));
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
@ -6,17 +6,15 @@
|
|||||||
{% if repos %}
|
{% if repos %}
|
||||||
<table class="repo-list">
|
<table class="repo-list">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="12%">名字</th>
|
<th width="20%">名字</th>
|
||||||
<th width="20%">拥有者</th>
|
<th width="20%">拥有者</th>
|
||||||
<th width="33%">ID</th>
|
<th width="52%">描述</th>
|
||||||
<th width="27%">描述</th>
|
|
||||||
<th width="8%">操作</th>
|
<th width="8%">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for repo in repos %}
|
{% for repo in repos %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
||||||
<td><a href="{{ SITE_ROOT }}home/owner/{{ repo.owner }}/">{{ repo.owner}}</a></td>
|
<td><a href="{{ SITE_ROOT }}useradmin/info/{{ repo.owner }}/">{{ repo.owner}}</a></td>
|
||||||
<td>{{ repo.props.id }}</td>
|
|
||||||
<td>{{ repo.props.desc }}</td>
|
<td>{{ repo.props.desc }}</td>
|
||||||
<td><button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button></td>
|
<td><button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ SITE_ROOT }}useradmin/info/{{ user.props.email }}">{{ user.props.email }}</a></td>
|
<td><a href="{{ SITE_ROOT }}useradmin/info/{{ user.props.email }}/">{{ user.props.email }}</a></td>
|
||||||
{% if user.props.is_active %}
|
{% if user.props.is_active %}
|
||||||
<td>已激活</td>
|
<td>已激活</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -1,21 +1,70 @@
|
|||||||
{% extends "myhome_base.html" %}
|
{% extends "myhome_base.html" %}
|
||||||
|
|
||||||
{% block nav_useradmin_class %}class="cur"{% endblock %}
|
{% block nav_useradmin_class %}class=""{% endblock %}
|
||||||
{% block left_panel %}
|
{% block left_panel %}
|
||||||
|
<!--
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{{ SITE_ROOT }}useradmin/add/">添加用户</a></li>
|
<li><a href="{{ SITE_ROOT }}useradmin/add/">添加用户</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
-->
|
||||||
|
<h3>已用空间</h3>
|
||||||
|
<p>{{ quota_usage|filesizeformat }} / 2 GB</p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block right_panel %}
|
{% block right_panel %}
|
||||||
|
<h3>{{ email }}拥有的同步目录</h3>
|
||||||
|
{% if owned_repos %}
|
||||||
|
<table class="repo-list">
|
||||||
|
<tr>
|
||||||
|
<th width="30%">名字</th>
|
||||||
|
<th width="50%">描述</th>
|
||||||
|
<th width="20%">操作</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for repo in owned_repos %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
||||||
|
<td>{{ repo.props.desc }}</td>
|
||||||
|
<td>
|
||||||
|
<button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p>暂无</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h3>共享给{{ email }}的同步目录</h3>
|
||||||
|
{% if in_repos %}
|
||||||
|
<table class="repo-list">
|
||||||
|
<tr>
|
||||||
|
<th width="30%">名字</th>
|
||||||
|
<th width="30%">共享来源</th>
|
||||||
|
<th width="40%">描述</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for repo in in_repos %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
|
||||||
|
<td>{{ repo.props.shared_email }}</td>
|
||||||
|
<td>{{ repo.props.desc }}</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p>暂无</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h3>{{ email }}的计算机:</h3>
|
<h3>{{ email }}的计算机:</h3>
|
||||||
<table class="user-list">
|
<table class="user-list">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="60%">计算机名</th>
|
<th width="60%">计算机名</th>
|
||||||
<th width="30%">角色</th>
|
<th width="20%">角色</th>
|
||||||
<th width="10%">状态</th>
|
<th width="20%">状态</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for username, roles in user_dict.items %}
|
{% for username, roles in user_dict.items %}
|
||||||
|
27
views.py
27
views.py
@ -287,24 +287,18 @@ def myhome(request):
|
|||||||
@login_required
|
@login_required
|
||||||
def ownerhome(request, owner_name):
|
def ownerhome(request, owner_name):
|
||||||
owned_repos = []
|
owned_repos = []
|
||||||
fetched_repos = []
|
|
||||||
quota_usage = 0
|
quota_usage = 0
|
||||||
|
|
||||||
ownerid_list = get_binding_peerids(owner_name)
|
owned_repos = seafserv_threaded_rpc.list_owned_repos(owner_name)
|
||||||
for owner_id in ownerid_list:
|
quota_usage = seafserv_threaded_rpc.get_user_quota_usage(owner_name)
|
||||||
if owner_id:
|
|
||||||
try:
|
user_dict = user_info(request, owner_name)
|
||||||
owned_repos.extend(seafserv_threaded_rpc.list_owned_repos(owner_id))
|
|
||||||
quota_usage = quota_usage + seafserv_threaded_rpc.get_user_quota_usage(owner_id)
|
|
||||||
fetched_repos.extend(seafserv_threaded_rpc.list_fetched_repos(owner_id))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return render_to_response('ownerhome.html', {
|
return render_to_response('ownerhome.html', {
|
||||||
"owned_repos": owned_repos,
|
"owned_repos": owned_repos,
|
||||||
"quota_usage": quota_usage,
|
"quota_usage": quota_usage,
|
||||||
"fetched_repos": fetched_repos,
|
|
||||||
"owner": owner_name,
|
"owner": owner_name,
|
||||||
|
"user_dict": user_dict,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -510,6 +504,11 @@ def user_info(request, email):
|
|||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
user_dict = {}
|
user_dict = {}
|
||||||
|
owned_repos = []
|
||||||
|
quota_usage = 0
|
||||||
|
|
||||||
|
owned_repos = seafserv_threaded_rpc.list_owned_repos(email)
|
||||||
|
quota_usage = seafserv_threaded_rpc.get_user_quota_usage(email)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
peers = ccnet_rpc.get_peers_by_email(email)
|
peers = ccnet_rpc.get_peers_by_email(email)
|
||||||
@ -522,8 +521,14 @@ def user_info(request, email):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Repos that are share to user
|
||||||
|
in_repos = seafserv_threaded_rpc.list_share_repos(email, 'to_email', -1, -1)
|
||||||
|
|
||||||
return render_to_response(
|
return render_to_response(
|
||||||
'userinfo.html', {
|
'userinfo.html', {
|
||||||
|
'owned_repos': owned_repos,
|
||||||
|
'quota_usage': quota_usage,
|
||||||
|
"in_repos": in_repos,
|
||||||
'user_dict': user_dict,
|
'user_dict': user_dict,
|
||||||
'email': email
|
'email': email
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user