2012-05-17 12:39:37 +00:00
|
|
|
{% extends "admin_base.html" %}
|
2012-11-01 07:09:14 +00:00
|
|
|
{% load i18n avatar_tags %}
|
2012-10-26 06:27:54 +00:00
|
|
|
{% load url from future %}
|
|
|
|
|
2012-05-17 12:39:37 +00:00
|
|
|
{% block nav_useradmin_class %}class="cur"{% endblock %}
|
2012-04-13 05:21:48 +00:00
|
|
|
{% block left_panel %}
|
2013-03-18 03:59:04 +00:00
|
|
|
|
2012-11-01 07:09:14 +00:00
|
|
|
<div class="info-item">
|
|
|
|
<h3 class="info-item-top">{% trans "Profile" %}</h3>
|
|
|
|
<div class="info-item-bottom home-profile ovhd">
|
2013-03-18 03:59:04 +00:00
|
|
|
{% avatar email 48 %}
|
2012-11-01 07:09:14 +00:00
|
|
|
{% if nickname %}
|
|
|
|
<p class="fleft">{{ nickname }}</p>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2012-10-26 06:27:54 +00:00
|
|
|
<div class="info-item">
|
|
|
|
<div class="info-item-top">
|
2012-11-01 07:09:14 +00:00
|
|
|
<h3 class="inbl">{% trans "Space Used" %}</h3>
|
|
|
|
<a href="#" class="set-quota op">{% trans "Set Quota" %}</a>
|
2012-10-26 06:27:54 +00:00
|
|
|
</div>
|
2013-01-29 07:30:18 +00:00
|
|
|
<div class="info-item-bottom">
|
|
|
|
{% if CALC_SHARE_USAGE %}
|
|
|
|
<p>{% trans "Total" %}: {{ quota_usage|filesizeformat }} {% if quota > 0 %}/ {{ quota|filesizeformat }} {% endif %}</p>
|
|
|
|
<p>{% trans "Used" %}: {{ my_usage|filesizeformat }}</p>
|
|
|
|
<p>{% trans "Sharing" %}: {{ share_usage|filesizeformat }}</p>
|
|
|
|
{% else %}
|
|
|
|
<p>{{ quota_usage|filesizeformat }} {% if quota > 0 %}/ {{ quota|filesizeformat }} {% endif %}</p>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2012-10-26 06:27:54 +00:00
|
|
|
</div>
|
2012-04-13 05:21:48 +00:00
|
|
|
|
2012-05-03 02:52:43 +00:00
|
|
|
{% endblock %}
|
2012-04-13 05:21:48 +00:00
|
|
|
|
|
|
|
{% block right_panel %}
|
2012-11-01 07:09:14 +00:00
|
|
|
<h3>{% trans "Owned" %}</h3>
|
2012-05-03 02:52:43 +00:00
|
|
|
{% if owned_repos %}
|
2012-05-17 12:39:37 +00:00
|
|
|
<table>
|
2012-05-03 02:52:43 +00:00
|
|
|
<tr>
|
2012-09-27 08:32:17 +00:00
|
|
|
<th width="4%"><!--icon--></th>
|
2012-11-01 07:09:14 +00:00
|
|
|
<th width="30%">{% trans "Name" %}</th>
|
|
|
|
<th width="46%">{% trans "Description" %}</th>
|
|
|
|
<th width="20%">{% trans "Operations" %}</th>
|
2012-05-03 02:52:43 +00:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
{% for repo in owned_repos %}
|
|
|
|
<tr>
|
2012-11-09 11:16:31 +00:00
|
|
|
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td>
|
2012-05-03 02:52:43 +00:00
|
|
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
|
|
|
<td>{{ repo.props.desc }}</td>
|
|
|
|
<td>
|
2012-11-09 11:16:31 +00:00
|
|
|
<a href="#" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" data-target="{{ repo.props.name }}" class="remove-user-repo op">{% trans "Delete" %}</a>
|
2012-05-03 02:52:43 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
{% else %}
|
2012-11-01 07:09:14 +00:00
|
|
|
<p>{% trans "Empty" %}</p>
|
2012-05-03 02:52:43 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2012-11-01 07:09:14 +00:00
|
|
|
<h3>{% trans "Shared" %}</h3>
|
2012-05-03 02:52:43 +00:00
|
|
|
{% if in_repos %}
|
2012-09-27 08:32:17 +00:00
|
|
|
<table>
|
2012-05-03 02:52:43 +00:00
|
|
|
<tr>
|
2012-09-27 08:32:17 +00:00
|
|
|
<th width="4%"><!--icon--></th>
|
2012-11-01 07:09:14 +00:00
|
|
|
<th width="30%">{% trans "Name" %}</th>
|
|
|
|
<th width="26%">{% trans "Share From" %}</th>
|
|
|
|
<th width="40%">{% trans "Description" %}</th>
|
2012-05-03 02:52:43 +00:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
{% for repo in in_repos %}
|
|
|
|
<tr>
|
2012-11-01 07:09:14 +00:00
|
|
|
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="目录icon" /></td>
|
2012-10-11 02:55:13 +00:00
|
|
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.repo_name }}</a></td>
|
|
|
|
<td>{{ repo.props.user }}</td>
|
|
|
|
<td>{{ repo.props.repo_desc }}</td>
|
2012-05-03 02:52:43 +00:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
{% else %}
|
2012-11-01 07:09:14 +00:00
|
|
|
<p>{% trans "Empty" %}</p>
|
2012-05-03 02:52:43 +00:00
|
|
|
{% endif %}
|
2012-04-13 05:21:48 +00:00
|
|
|
|
2012-10-26 06:27:54 +00:00
|
|
|
<form id="set-quota-form" method="post" class="hide">{% csrf_token %}
|
2012-11-01 07:09:14 +00:00
|
|
|
<label>{% trans "Set user storage limit" %}</label><br />
|
2012-10-26 06:27:54 +00:00
|
|
|
<input type="hidden" name="email" value="{{ email }}" />
|
|
|
|
<input type="text" name="quota" /> MB <br />
|
2012-11-01 07:09:14 +00:00
|
|
|
<p class="tip">{% trans "Tip: 0 means default limit" %}</p>
|
2012-10-26 06:27:54 +00:00
|
|
|
<p class="error hide"></p>
|
2012-11-01 07:09:14 +00:00
|
|
|
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
2012-10-26 06:27:54 +00:00
|
|
|
</form>
|
2012-04-13 05:21:48 +00:00
|
|
|
|
2012-10-26 06:27:54 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
{% block extra_script %}
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
$('.set-quota').click(function() {
|
|
|
|
$("#set-quota-form").modal({appendTo: "#main"});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#set-quota-form .submit').click(function() {
|
|
|
|
var self = $(this);
|
|
|
|
self.attr('disabled', 'disabled');
|
|
|
|
$.ajax({
|
|
|
|
url: '{% url 'views.user_info' email %}',
|
|
|
|
type: 'POST',
|
|
|
|
dataType: 'json',
|
|
|
|
cache: 'false',
|
|
|
|
beforeSend: prepareCSRFToken,
|
|
|
|
data: {
|
|
|
|
'email': $('#set-quota-form input[name="email"]').val(),
|
|
|
|
'quota': $('#set-quota-form input[name="quota"]').val()
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
if (data['success']) {
|
|
|
|
location.reload(true);
|
|
|
|
} else {
|
|
|
|
apply_form_error('set-quota-form', data['error']);
|
|
|
|
self.removeAttr('disabled');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(data, textStatus, jqXHR) {
|
|
|
|
var errors = $.parseJSON(data.responseText);
|
|
|
|
$.each(errors, function(index, value) {
|
|
|
|
apply_form_error('set-quota-form', value[0]);
|
|
|
|
});
|
|
|
|
self.removeAttr('disabled');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2013-03-01 09:31:08 +00:00
|
|
|
addConfirmTo($('.remove-user-repo'), {
|
|
|
|
'title':'{% trans "Delete Library" %}',
|
|
|
|
'con':'{% trans "Are you sure you want to delete %s ?" %}'
|
|
|
|
});
|
2012-10-26 06:27:54 +00:00
|
|
|
</script>
|
2012-04-13 05:21:48 +00:00
|
|
|
{% endblock %}
|