1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

[org] Change sys-org-info.html to sys-org-info-base.html

This commit is contained in:
lian
2014-10-23 10:52:45 +08:00
parent 34c8299854
commit 58e28d2955
2 changed files with 39 additions and 240 deletions

View File

@@ -1,240 +0,0 @@
{% extends "admin_base.html" %}
{% load i18n avatar_tags seahub_tags group_avatar_tags %}
{% load url from future %}
{% block nav_orgadmin_class %}class="cur"{% endblock %}
{% block extra_style %}
<style type="text/css">
#left-panel { position:relative; }
#set-quota-form {
min-width:255px;
}
</style>
{% endblock %}
{% block left_panel %}
<a class="go-back" title="{% trans "Back to organization list" %}" href="{% url 'sys_org_admin' %}"><span class="icon-chevron-left"></span></a>
<div class="side-info">
<h3 class="hd">{{ org.org_name }}</h3>
<dl>
<dt>{% trans "Number of members" %}</dt>
<dd>{{ users_count }}</dd>
<dt>{% trans "Number of groups" %}</dt>
<dd>{{ groups_count }}</dd>
</dl>
<h3 class="hd">{% trans "Space Used" %}</h3>
<p>{{ quota_usage|filesizeformat }} {% if total_quota > 0 %}/ {{ total_quota|filesizeformat }} {% endif %}</p>
<a href="#" id="set-quota">{% trans "Set Quota" %}</a>
</div>
<form id="set-quota-form" method="post" class="hide">{% csrf_token %}
<h3>{% trans "Set org storage limit" %}</h3>
<input type="hidden" name="org_id" value="{{ org.org_id }}" />
<input type="text" name="quota" /> MB
<p class="tip">{% trans "Tip: 0 means default limit" %}</p>
<p class="error hide"></p>
<input type="submit" value="{% trans "Submit" %}" class="submit" />
</form>
{% endblock %}
{% block right_panel %}
<div id="tabs" class="tab-tabs">
<div class="hd ovhd">
<ul class="tab-tabs-nav fleft">
<li class="tab"><a href="#members" class="a">{% trans "Members" %}</a></li>
<li class="tab"><a href="#grps" class="a">{% trans "Groups" %}</a></li>
</ul>
</div>
<div id="members">
<table>
<tr>
<th width="25%">{% trans "Email" %}</th>
<th width="10%">{% trans "Status" %}</th>
<th width="20%">{% trans "Space Used" %}</th>
<th width="25%">{% trans "Create At / Last Login" %}</th>
<th width="20%">{% trans "Operations" %}</th>
</tr>
{% for user in users %}
<tr data-userid="{{user.email}}">
<td><a href="{% url 'user_info' user.email %}">{{ user.email }}</a></td>
<td>
<div class="user-status">
{% if user.is_active %}
<span class="user-status-cur-value">{% trans "Active" %}</span>
{% else %}
<span class="user-status-cur-value">{% trans "Inactive" %}</span>
{% endif %}
<img src="{{MEDIA_URL}}img/edit_12.png" alt="{% trans "Edit"%}" title="{% trans "Edit"%}" class="user-status-edit-icon cspt vh" />
</div>
<select name="permission" class="user-status-select hide">
<option value="1" {%if user.is_active %}selected="selected"{% endif %}>{% trans "Active" %}</option>
<option value="0" {%if not user.is_active %}selected="selected"{% endif %}>{% trans "Inactive"%}</option>
</select>
</td>
<td>
{% if CALC_SHARE_USAGE %}
{{ user.self_usage|filesizeformat }} + {{ user.share_usage|filesizeformat }} {% if user.quota > 0 %} / {{ user.quota|filesizeformat }} {% endif %}
{% else %}
{{ user.self_usage|filesizeformat }} {% if user.quota > 0 %} / {{ user.quota|filesizeformat }} {% endif %}
{% endif %}
</td>
<td style="font-size:11px;">
{{ user.ctime|tsstr_sec }} / {% if user.last_login %}{{user.last_login|translate_seahub_time}} {% else %} -- {% endif %}
</td>
<td>
{% if not user.is_self %}
<a href="#" class="remove-user-btn op vh" data-url="{% url 'user_remove' user.id %}" data-target="{{ user.email }}">{% trans "Delete" %}</a>
<a href="#" class="reset-user-btn op vh" data-url="{% url 'user_reset' user.id %}" data-target="{{ user.email }}">{% trans "ResetPwd" %}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
<div id="grps" class="hide">
{% if groups %}
<table>
<tr>
<th width="30%">{% trans "Name" %}</th>
<th width="30%">{% trans "Creator" %}</th>
<th width="25%">{% trans "Create At" %}</th>
<th width="15%">{% trans "Operations" %}</th>
</tr>
{% for group in groups %}
<tr>
<td><a href="{{ SITE_ROOT }}group/{{ group.id }}/">{{ group.group_name }}</a></td>
<td>{{ group.creator_name }}</td>
<td>{{ group.timestamp|tsstr_sec }}</td>
<td><a href="#" data-url="{% url 'group_remove' group.id %}" data-target="{{ group.group_name }}" class="group-remove-btn op vh">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
{% else %}
<p>{% trans "None" %}</p>
{% endif %}
</div>
</div>
<div id="activate-msg" class="hide">
<p>{% trans "Activating..., please wait" %}</p>
</div>
{% 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 form = $('#set-quota-form'),
form_id = form.attr('id');
var quota = $('input[name="quota"]', form).val();
if (!$.trim(quota)) {
apply_form_error(form_id, "{% trans "Quota can not be empty" %}");
return false;
}
var sb_btn = $(this);
disable(sb_btn);
$.ajax({
url: '{% url 'sys_org_set_quota' org.org_id %}',
type: 'POST',
dataType: 'json',
cache: 'false',
beforeSend: prepareCSRFToken,
data: {
'quota': quota
},
success: function(data) {
location.reload(true);
},
error: function(xhr, textStatus, errorThrown) {
if (xhr.responseText) {
apply_form_error(form_id, $.parseJSON(xhr.responseText).error);
} else {
apply_form_error(form_id, "{% trans "Failed. Please check the network." %}");
}
enable(sb_btn);
}
});
return false;
});
addConfirmTo($('.group-remove-btn'), {
'title': "{% trans "Delete Group" %}",
'con': "{% trans "Are you sure you want to delete %s ?" %}"
});
addConfirmTo($('.remove-user-btn'), {
'title':"{% trans "Delete User" %}",
'con':"{% trans "Are you sure you want to delete %s ?" %}"
});
addConfirmTo($('.reset-user-btn'), {
'title':"{% trans "Password Reset" %}",
'con':"{% trans "Are you sure you want to reset the password of %s ?" %}"
});
$('tr:gt(0)').hover(
function() {
$(this).find('.user-status-edit-icon').removeClass('vh');
},
function() {
$(this).find('.user-status-edit-icon').addClass('vh');
}
);
$('.user-status-edit-icon').click(function() {
$(this).parent().addClass('hide');
$(this).parent().next().removeClass('hide'); // show 'select'
});
$('.user-status-select').change(function() {
var select = $(this),
select_val = select.val(),
uid = select.parents('tr').attr('data-userid'),
url = "{{ SITE_ROOT }}useradmin/toggle_status/" + uid + "/?s=" + select_val;
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
cache: false,
beforeSend: function() {
if (select_val == 1) {
// show activating popup
$('#activate-msg').modal();
$('#simplemodal-container').css({'height':'auto'});
}
},
success: function(data) {
if (data['email_sent']) {
feedback("{% trans "Edit succeeded, an email has been sent." %}", 'success');
} else if (data['email_sent'] === false) {
feedback("{% trans "Edit succeeded, but failed to send email, please check your email configuration." %}", 'success');
} else {
feedback("{% trans "Edit succeeded" %}", 'success');
}
select.prev().children('span').html(select.children('option[value="' +select.val() + '"]').text());
select.addClass('hide');
select.prev().removeClass('hide');
$.modal.close();
},
error: function() {
feedback("{% trans "Edit failed." %}", 'error');
select.addClass('hide');
select.prev().removeClass('hide');
$.modal.close();
}
});
});
$(document).click(function(e) {
var target = e.target || event.srcElement;
// target can't be edit-icon
if (!$('.user-status-edit-icon, .user-status-select').is(target)) {
$('.user-status').removeClass('hide');
$('.user-status-select').addClass('hide');
}
});
</script>
{% endblock %}

View File

@@ -0,0 +1,39 @@
{% extends "admin_base.html" %}
{% load i18n seahub_tags %}
{% load url from future %}
{% block nav_orgadmin_class %}class="cur"{% endblock %}
{% block extra_style %}
<style type="text/css">
#left-panel { position:relative; }
#set-quota-form {
min-width:255px;
}
</style>
{% endblock %}
{% block left_panel %}
<a class="go-back" title="{% trans "Back to organization list" %}" href="{% url 'sys_org_admin' %}"><span class="icon-chevron-left"></span></a>
<div class="side-info">
<h3 class="hd">{{ org.org_name }}</h3>
<dl>
<dt>{% trans "Number of members" %}</dt>
<dd>{{ users_count }}</dd>
<dt>{% trans "Number of groups" %}</dt>
<dd>{{ groups_count }}</dd>
</dl>
<h3 class="hd">{% trans "Space Used" %}</h3>
<p>{{ quota_usage|filesizeformat }} {% if total_quota > 0 %}/ {{ total_quota|filesizeformat }} {% endif %}</p>
<a href="#" id="set-quota">{% trans "Set Quota" %}</a>
</div>
<form id="set-quota-form" method="post" class="hide">{% csrf_token %}
<h3>{% trans "Set org storage limit" %}</h3>
<input type="hidden" name="org_id" value="{{ org.org_id }}" />
<input type="text" name="quota" /> MB
<p class="tip">{% trans "Tip: 0 means default limit" %}</p>
<p class="error hide"></p>
<input type="submit" value="{% trans "Submit" %}" class="submit" />
</form>
{% endblock %}