mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 18:29:23 +00:00
Only show share usage when option is enabled
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<p>{% trans "Self:" %} {{ space_usage|filesizeformat }} {% if space_quota > 0 %}/ {{ space_quota|filesizeformat }} {% endif %}</p>
|
<p>{% trans "Used:" %} {{ space_usage|filesizeformat }} {% if space_quota > 0 %}/ {{ space_quota|filesizeformat }} {% endif %}</p>
|
||||||
|
|
||||||
{% if not org %}
|
{% if not org %}
|
||||||
|
{% if CALC_SHARE_USAGE %}
|
||||||
<p>{% trans "Sharing:" %} {{ share_usage|filesizeformat }} {% if share_quota > 0 %}/ {{ share_quota|filesizeformat }} {% endif %}</p>
|
<p>{% trans "Sharing:" %} {{ share_usage|filesizeformat }} {% if share_quota > 0 %}/ {{ share_quota|filesizeformat }} {% endif %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if space_quota > 0 or share_quota > 0 %}
|
{% if space_quota > 0 or share_quota > 0 %}
|
||||||
<div id="quota-bar">
|
<div id="quota-bar">
|
||||||
|
@@ -41,10 +41,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th width="25%">{% trans "Email" %}</th>
|
<th width="25%">{% trans "Email" %}</th>
|
||||||
<th width="12%">{% trans "Status" %}</th>
|
<th width="12%">{% trans "Status" %}</th>
|
||||||
<th width="11%">{% trans "Role" %}</th>
|
<th width="9%">{% trans "Role" %}</th>
|
||||||
<th width="15%">{% trans "Space Used" %}</th>
|
<th width="18%">{% trans "Space Used" %}</th>
|
||||||
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
||||||
<th width="15%">{% trans "Operations" %}</th>
|
<th width="14%">{% trans "Operations" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for user in admin_users %}
|
{% for user in admin_users %}
|
||||||
@@ -85,11 +85,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td style="font-size:11px;">
|
||||||
|
<p> {{ user.space_usage|filesizeformat }} {% if user.space_quota > 0 %} / {{ user.space_quota|filesizeformat }} {% endif %} </p>
|
||||||
|
{% if not user.org %}
|
||||||
{% if CALC_SHARE_USAGE %}
|
{% if CALC_SHARE_USAGE %}
|
||||||
{{ user.self_usage|filesizeformat }} + {{ user.share_usage|filesizeformat }} {% if user.quota > 0 %} / {{ user.quota|filesizeformat }} {% endif %}
|
<p> {{ user.share_usage|filesizeformat }} {% if user.share_quota > 0 %} / {{ user.share_quota|filesizeformat }} {% endif %} </p>
|
||||||
{% else %}
|
{% endif %}
|
||||||
{{ user.self_usage|filesizeformat }} {% if user.quota > 0 %} / {{ user.quota|filesizeformat }} {% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<th width="25%">{% trans "Email" %}</th>
|
<th width="25%">{% trans "Email" %}</th>
|
||||||
<th width="12%">{% trans "Status" %}</th>
|
<th width="12%">{% trans "Status" %}</th>
|
||||||
<th width="9%">{% trans "Role" %}</th>
|
<th width="9%">{% trans "Role" %}</th>
|
||||||
<th width="18%">{% trans "Space/Share Used" %}</th>
|
<th width="18%">{% trans "Space Used" %}</th>
|
||||||
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
<th width="22%">{% trans "Create At / Last Login" %}</th>
|
||||||
<th width="14%">{% trans "Operations" %}</th>
|
<th width="14%">{% trans "Operations" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -56,8 +56,10 @@
|
|||||||
<td style="font-size:11px;">
|
<td style="font-size:11px;">
|
||||||
<p> {{ user.space_usage|filesizeformat }} {% if user.space_quota > 0 %} / {{ user.space_quota|filesizeformat }} {% endif %} </p>
|
<p> {{ user.space_usage|filesizeformat }} {% if user.space_quota > 0 %} / {{ user.space_quota|filesizeformat }} {% endif %} </p>
|
||||||
{% if not user.org %}
|
{% if not user.org %}
|
||||||
|
{% if CALC_SHARE_USAGE %}
|
||||||
<p> {{ user.share_usage|filesizeformat }} {% if user.share_quota > 0 %} / {{ user.share_quota|filesizeformat }} {% endif %} </p>
|
<p> {{ user.share_usage|filesizeformat }} {% if user.share_quota > 0 %} / {{ user.share_quota|filesizeformat }} {% endif %} </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if user.source != 'LDAP' %}
|
{% if user.source != 'LDAP' %}
|
||||||
|
@@ -40,8 +40,11 @@
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3 class="hd">{% trans "Space Used" %}</h3>
|
<h3 class="hd">{% trans "Space Used" %}</h3>
|
||||||
<p>{% trans "Self" %}: {{ space_usage|filesizeformat }} {% if space_quota > 0 %} / {{ space_quota|filesizeformat }} {% endif %}</p>
|
<p>{% trans "Used" %}: {{ space_usage|filesizeformat }} {% if space_quota > 0 %} / {{ space_quota|filesizeformat }} {% endif %}</p>
|
||||||
|
|
||||||
|
{% if CALC_SHARE_USAGE %}
|
||||||
<p>{% trans "Sharing" %}: {{ share_usage|filesizeformat }} {% if share_quota > 0 %} / {{ share_quota|filesizeformat }} {% endif %}</p>
|
<p>{% trans "Sharing" %}: {{ share_usage|filesizeformat }} {% if share_quota > 0 %} / {{ share_quota|filesizeformat }} {% endif %}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<a href="#" id="set-quota">{% trans "Set Quota" %}</a>
|
<a href="#" id="set-quota">{% trans "Set Quota" %}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1387,8 +1387,12 @@ def space_and_traffic(request):
|
|||||||
if not org:
|
if not org:
|
||||||
space_quota = seafile_api.get_user_quota(username)
|
space_quota = seafile_api.get_user_quota(username)
|
||||||
space_usage = seafile_api.get_user_self_usage(username)
|
space_usage = seafile_api.get_user_self_usage(username)
|
||||||
share_quota = seafile_api.get_user_share_quota(username)
|
if CALC_SHARE_USAGE:
|
||||||
share_usage = seafile_api.get_user_share_usage(username)
|
share_quota = seafile_api.get_user_share_quota(username)
|
||||||
|
share_usage = seafile_api.get_user_share_usage(username)
|
||||||
|
else:
|
||||||
|
share_quota = 0
|
||||||
|
share_usage = 0
|
||||||
else:
|
else:
|
||||||
org_id = org[0].org_id
|
org_id = org[0].org_id
|
||||||
space_quota = seafserv_threaded_rpc.get_org_user_quota(org_id,
|
space_quota = seafserv_threaded_rpc.get_org_user_quota(org_id,
|
||||||
@@ -1446,6 +1450,7 @@ def space_and_traffic(request):
|
|||||||
"space_usage": space_usage,
|
"space_usage": space_usage,
|
||||||
"share_quota": share_quota,
|
"share_quota": share_quota,
|
||||||
"share_usage": share_usage,
|
"share_usage": share_usage,
|
||||||
|
"CALC_SHARE_USAGE": CALC_SHARE_USAGE,
|
||||||
"show_quota_help": not CALC_SHARE_USAGE,
|
"show_quota_help": not CALC_SHARE_USAGE,
|
||||||
"rates": rates,
|
"rates": rates,
|
||||||
"TRAFFIC_STATS_ENABLED": TRAFFIC_STATS_ENABLED,
|
"TRAFFIC_STATS_ENABLED": TRAFFIC_STATS_ENABLED,
|
||||||
|
@@ -166,9 +166,13 @@ def _populate_user_quota_usage(user):
|
|||||||
user.share_usage = user.share_quota = 0
|
user.share_usage = user.share_quota = 0
|
||||||
else:
|
else:
|
||||||
user.space_usage = seafile_api.get_user_self_usage(user.email)
|
user.space_usage = seafile_api.get_user_self_usage(user.email)
|
||||||
user.share_usage = seafile_api.get_user_share_usage(user.email)
|
|
||||||
user.space_quota = seafile_api.get_user_quota(user.email)
|
user.space_quota = seafile_api.get_user_quota(user.email)
|
||||||
user.share_quota = seafile_api.get_user_share_quota(user.email)
|
|
||||||
|
if CALC_SHARE_USAGE:
|
||||||
|
user.share_quota = seafile_api.get_user_share_quota(user.email)
|
||||||
|
user.share_usage = seafile_api.get_user_share_usage(user.email)
|
||||||
|
else:
|
||||||
|
user.share_usage = user.share_quota = 0
|
||||||
except SearpcError as e:
|
except SearpcError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
user.space_usage = user.space_quota = user.share_usage = user.share_quota = -1
|
user.space_usage = user.space_quota = user.share_usage = user.share_quota = -1
|
||||||
@@ -332,8 +336,11 @@ def user_info(request, email):
|
|||||||
if not org:
|
if not org:
|
||||||
space_usage = seafile_api.get_user_self_usage(email)
|
space_usage = seafile_api.get_user_self_usage(email)
|
||||||
space_quota = seafile_api.get_user_quota(email)
|
space_quota = seafile_api.get_user_quota(email)
|
||||||
share_usage = seafile_api.get_user_share_usage(email)
|
if CALC_SHARE_USAGE:
|
||||||
share_quota = seafile_api.get_user_share_quota(email)
|
share_usage = seafile_api.get_user_share_usage(email)
|
||||||
|
share_quota = seafile_api.get_user_share_quota(email)
|
||||||
|
else:
|
||||||
|
share_quota = share_usage = 0
|
||||||
else:
|
else:
|
||||||
org_id = org[0].org_id
|
org_id = org[0].org_id
|
||||||
org_name = org[0].org_name
|
org_name = org[0].org_name
|
||||||
@@ -413,6 +420,7 @@ def user_info(request, email):
|
|||||||
'space_usage': space_usage,
|
'space_usage': space_usage,
|
||||||
'share_quota': share_quota,
|
'share_quota': share_quota,
|
||||||
'share_usage': share_usage,
|
'share_usage': share_usage,
|
||||||
|
'CALC_SHARE_USAGE': CALC_SHARE_USAGE,
|
||||||
'in_repos': in_repos,
|
'in_repos': in_repos,
|
||||||
'email': email,
|
'email': email,
|
||||||
'profile': profile,
|
'profile': profile,
|
||||||
|
Reference in New Issue
Block a user