{% if current_page != 1 %}
@@ -84,35 +63,10 @@
{% block extra_script %}
{% endblock %}
diff --git a/seahub/templates/sysadmin/sys_repo_search.html b/seahub/templates/sysadmin/sys_repo_search.html
index d17cd31812..3a5baecc60 100644
--- a/seahub/templates/sysadmin/sys_repo_search.html
+++ b/seahub/templates/sysadmin/sys_repo_search.html
@@ -13,27 +13,23 @@
{% endif %}
+
+
+
{% endblock %}
{% block extra_script %}
@@ -47,5 +43,7 @@ $('#search-repo-form').submit(function() {
return false;
}
});
+{% include "sysadmin/repoadmin_js.html" %}
+
{% endblock %}
diff --git a/seahub/templates/sysadmin/sys_useradmin.html b/seahub/templates/sysadmin/sys_useradmin.html
index 93b876e3e5..bde93ba00b 100644
--- a/seahub/templates/sysadmin/sys_useradmin.html
+++ b/seahub/templates/sysadmin/sys_useradmin.html
@@ -20,57 +20,7 @@
{% if current_page != 1 %}
@@ -104,79 +54,10 @@
{% block extra_script %}
{% endblock %}
diff --git a/seahub/templates/sysadmin/user_search.html b/seahub/templates/sysadmin/user_search.html
index 30724d1902..c22b297947 100644
--- a/seahub/templates/sysadmin/user_search.html
+++ b/seahub/templates/sysadmin/user_search.html
@@ -11,45 +11,7 @@
{% trans "Result"%}
{% if users %}
-
-
- {% trans "Email" %} |
- {% trans "Status" %} |
- {% trans "Space Used" %} |
- {% trans "Create At" %} |
- {% trans "Operations" %} |
-
-
- {% for user in users %}
-
- {{ user.email }} |
- {% if user.props.is_active %}
- {% trans "Activated" %} |
- {% else %}
- {% trans "Active" %} |
- {% endif %}
-
- {% 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 %}
- |
- {{ user.ctime|tsstr_sec }} |
-
- {% if not user.is_self %}
- {% trans "Delete" %}
- {% trans "ResetPwd" %}
- {% if user.is_staff %}
- {% trans "Revoke Admin" %}
- {% else %}
- {% trans "Set Admin" %}
- {% endif %}
- {% endif %}
- |
- {% endfor %}
-
+{% include "sysadmin/useradmin_table.html" %}
{% else %}
{% trans "No result" %}
{% endif %}
@@ -63,5 +25,8 @@ $('#search-user-form').submit(function() {
return false;
}
});
+
+{% include "sysadmin/useradmin_js.html" %}
+
{% endblock %}
diff --git a/seahub/templates/sysadmin/useradmin_js.html b/seahub/templates/sysadmin/useradmin_js.html
new file mode 100644
index 0000000000..ec4abdfc9a
--- /dev/null
+++ b/seahub/templates/sysadmin/useradmin_js.html
@@ -0,0 +1,69 @@
+{% load i18n%}
+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 ?" %}"
+});
+addConfirmTo($('.revoke-admin-btn'), {
+ 'title':"{% trans "Revoke Admin" %}",
+ 'con':"{% trans "Are you sure you want to revoke the admin permission of %s ?" %}"
+});
+addConfirmTo($('.set-admin-btn'), {
+ 'title':"{% trans "Set Admin" %}",
+ 'con':"{% trans "Are you sure you want to set %s as admin?" %}"
+});
+
+$('#add-user-btn').click(function() {
+ $('#add-user-form').modal();
+ $('#simplemodal-container').css({'width':'auto'});
+});
+$('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 'user-status-select'
+});
+$('.user-status-select').change(function() {
+ var select = $(this),
+ uid = $(this).parent().prev().attr('data'),
+ select_val = select.val(),
+ url = "{{ SITE_ROOT }}useradmin/toggle_status/" + uid + "/?s=" + select_val;
+
+ $.ajax({
+ url: url,
+ type: 'GET',
+ dataType: 'json',
+ cache: false,
+ success: function(data) {
+ if (data['success']) {
+ feedback("{% trans "Edit succeeded" %}", 'success');
+ select.prev().children('.user-status-cur-value').html(select.children('option[value="' +select.val() + '"]').text());
+ }
+ select.addClass('hide');
+ select.prev().removeClass('hide');
+ },
+ error: function() {
+ feedback("{% trans "Edit failed." %}", 'error');
+ select.addClass('hide');
+ select.prev().removeClass('hide');
+ }
+ });
+});
+// select shows, but the user doesn't select a value, or doesn't change the permission, click other place to hide the select
+$(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');
+ }
+});
diff --git a/seahub/templates/sysadmin/useradmin_table.html b/seahub/templates/sysadmin/useradmin_table.html
new file mode 100644
index 0000000000..57289fcbe8
--- /dev/null
+++ b/seahub/templates/sysadmin/useradmin_table.html
@@ -0,0 +1,52 @@
+{%load seahub_tags i18n%}
+
+
+ {% trans "Email" %} |
+ {% trans "Status" %} |
+ {% trans "Space Used" %} |
+ {% trans "Create At" %} |
+ {% trans "Operations" %} |
+
+
+ {% for user in users %}
+
+ {{ user.email }} |
+
+
+
+ {% if user.is_active %}
+ {% trans "Active" %}
+ {% else %}
+ {% trans "Inactive" %}
+ {% endif %}
+ 
+
+
+ |
+
+
+ {% 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 %}
+ |
+ {{ user.ctime|tsstr_sec }} |
+
+ {% if not user.is_self %}
+ {% trans "Delete" %}
+ {% trans "ResetPwd" %}
+ {% if user.is_staff %}
+ {% trans "Revoke Admin" %}
+ {% else %}
+ {% trans "Set Admin" %}
+ {% endif %}
+ {% endif %}
+ |
+
+ {% endfor %}
+
diff --git a/seahub/views/sysadmin.py b/seahub/views/sysadmin.py
index 5782c64add..74f691345a 100644
--- a/seahub/views/sysadmin.py
+++ b/seahub/views/sysadmin.py
@@ -545,7 +545,11 @@ def sys_repo_transfer(request):
messages.error(request, _(u'Failed to transfer, user %s not found') % new_owner)
else:
messages.error(request, _(u'Failed to transfer, invalid arguments.'))
- return HttpResponseRedirect(reverse(sys_repo_admin))
+
+ next = request.META.get('HTTP_REFERER', None)
+ if not next:
+ next = reverse(sys_repo_admin)
+ return HttpResponseRedirect(next)
@login_required
@sys_staff_required