diff --git a/media/css/seahub.css b/media/css/seahub.css index 31f9c9021f..af00a00ed4 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -316,6 +316,12 @@ p { margin:0.5em 0; } .alc { text-align: center;} .cspt { cursor:pointer; } .pos-rel { position:relative; } +.top-tip { + background:#fddaa4; + color:#1f0600; + text-align:center; + margin:0 0 15px; +} /** for input, textarea in form **/ /* e.g repo-create */ .input, .textarea { width:260px; diff --git a/seahub/templates/sysadmin/sys_useradmin.html b/seahub/templates/sysadmin/sys_useradmin.html index c5bafce2e9..b307170eda 100644 --- a/seahub/templates/sysadmin/sys_useradmin.html +++ b/seahub/templates/sysadmin/sys_useradmin.html @@ -81,10 +81,33 @@ $(function(){ if (data['need_update']) { var tip = "{% trans "A new server version %(v)s is available." %}"; tip = tip.replace('%(v)s', data['new_version']); - $('#title-panel').html('
' + tip + '
').removeClass('hide'); + $('#title-panel').append('' + tip + '
').addClass('top-tip').removeClass('hide'); } } }); + + {% if is_pro %} + // check if seafile license expired + $.ajax({ + url: "{% url 'sys_check_license' %}", + dataType: 'json', + cache: false, + success: function(data) { + var tip; + + if (data['already_expired']) { + tip = "Your license expired on %(date)s."; + } else if (data['to_be_expired']) { + tip = "Your license will expire on %(date)s."; + } + + if (data['already_expired'] || data['to_be_expired']) { + tip = tip.replace('%(date)s', data['expiration_date']); + $('#title-panel').append('' + tip + '
').addClass('top-tip').removeClass('hide'); + } + } + }); + {% endif %} }); $('#add-user-btn').click(function() { diff --git a/seahub/urls.py b/seahub/urls.py index 4bf67f4bd4..6be848f71f 100644 --- a/seahub/urls.py +++ b/seahub/urls.py @@ -236,6 +236,7 @@ urlpatterns = patterns( url(r'^sys/uploadlink/remove/$', sys_upload_link_remove, name='sys_upload_link_remove'), url(r'^sys/notificationadmin/', notification_list, name='notification_list'), url(r'^sys/sudo/', sys_sudo_mode, name='sys_sudo_mode'), + url(r'^sys/check-license/', sys_check_license, name='sys_check_license'), url(r'^useradmin/add/$', user_add, name="user_add"), url(r'^useradmin/remove/(?P