diff --git a/group/templates/group/group_info.html b/group/templates/group/group_info.html index 1279ed8e77..7d4dba501c 100644 --- a/group/templates/group/group_info.html +++ b/group/templates/group/group_info.html @@ -69,8 +69,15 @@ {% endblock %} {% block right_panel %} -

{% trans "Libraries" %}

- +
+
+ + +
+
{% if repos %} @@ -88,7 +95,7 @@ {% if repo.user_perm == 'rw' %} {% trans {% else %} - {% trans + {% trans {% endif %} @@ -117,6 +124,57 @@

{% trans "Libraries shared as writable can be downloaded and synced by other group members. Read only libraries can only be downloaded, updates by others will not be uploaded." %}

{% endif %} + + +
+{% if recent_commits|length > 0 %} +
{{ repo.props.name }}
+ + + + + + + + {% for cmt in recent_commits %} + + + + + + + {% endfor %} +
{% trans "Library" %}{% trans "Time" %}{% trans "Description" %}
+ {% if cmt.tp == 'A' or cmt.tp == 'D' %} + {% if cmt.tp == 'A' %} + + {% else %} + + {% endif %} + {% else %} + + {% endif %} + {{ cmt.repo.props.name }}{{cmt.props.ctime|translate_seahub_time}} + {{cmt.props.desc|translate_commit_desc}} + {% if cmt.repo.encrypted %} + {% trans 'Details' %} + {% else %} + {% trans 'Details' %} + {% endif %} +
+
+

{% trans 'Library' %} {% trans 'is encrypted' %}

+ +
+ +

{% trans 'The password will be kept in the server for only 1 hour.' %}

+

+ + +
+{% endif %} +
+

{% trans "Messages" %}

@@ -287,5 +345,21 @@ $('#grp-member-add').click(function() { {% with post_url=member_add_url %} {% include 'group/grpmember_add_js.html' %} {% endwith %} + +{% if recent_commits %} +{% include 'snippets/list_commit_detail.html' %} +$('.lsch-encrypted').click(function() { + if ($(this).data('passwordset')) { + listCommitDetails($(this).data('url'), $(this).data('time')); + } else { + var form = $('#repo-decrypt-form'); + form.find('input[name="repo_id"]').val($(this).data('repoid')); + form.find('.op-target').html($(this).data('reponame')); + form.data({'url':$(this).data('url'), 'time':$(this).data('time')}).modal({appendTo:'#main'}); + } + return false; +}); +{% include 'snippets/repo_decrypt_js.html' %} +{% endif %} {% endblock %} diff --git a/group/views.py b/group/views.py index 75493cd8df..5def066167 100644 --- a/group/views.py +++ b/group/views.py @@ -17,7 +17,7 @@ from django.views.generic.base import TemplateResponseMixin from django.views.generic.edit import BaseFormView, FormMixin from auth.decorators import login_required -from seaserv import ccnet_rpc, ccnet_threaded_rpc, seafserv_threaded_rpc, \ +from seaserv import ccnet_rpc, ccnet_threaded_rpc, seafserv_threaded_rpc, seafserv_rpc, \ get_repo, get_group_repos, check_group_staff, get_commits, is_group_user, \ get_personal_groups_by_user, get_group, get_group_members, \ get_personal_groups, create_org_repo, get_org_group_repos, \ @@ -210,10 +210,23 @@ def render_group_info(request, group_id, form): request.user.username) else: repos = get_group_repos(group_id_int, request.user.username) - + + recent_commits = [] for repo in repos: repo.user_perm = check_permission(repo.props.id, request.user.username) + recent_commits += get_commits(repo.props.id, 0, 10) + recent_commits.sort(lambda x, y : cmp(y.props.ctime, x.props.ctime)) + recent_commits = recent_commits[0:15] + for cmt in recent_commits: + cmt.repo = get_repo(cmt.props.repo_id) + if cmt.repo: + cmt.repo.password_set = seafserv_rpc.is_passwd_set(cmt.props.repo_id, request.user.username) + else: + del cmt + # get type + cmt.tp = cmt.props.desc[0] + """group messages""" # Make sure page request is an int. If not, deliver first page. try: @@ -267,6 +280,7 @@ def render_group_info(request, group_id, form): "common_members": common_members, "members": members, "repos": repos, + "recent_commits": recent_commits, "group_id": group_id, "group" : group, "is_staff": is_staff, diff --git a/media/css/seahub.css b/media/css/seahub.css index 382ea04dbe..2ad1ee35f0 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -756,34 +756,38 @@ textarea:-moz-placeholder {/* for FF */ width:262px; margin-bottom:10px; } -#repos-tabs { +#tabs { font-size:1em; padding:0; border:0; min-height:150px; margin-bottom:75px; } -#repos-tabs .ui-tabs-nav { +#tabs-nav { padding:0; } -#repos-tabs .ui-tabs-nav li { +#tabs-nav li { + float:left; border:0; background:none; } -#repos-tabs .ui-tabs-nav li a { +#tabs-nav .long-item { + margin-left:.4em; +} +#tabs-nav li a { color:#8A948F; font-weight:normal; padding:.3em 0; margin-right:0.6em; } -#repos-tabs .ui-tabs-nav .ui-state-active a { +#tabs-nav .ui-state-active a { color:#DD4B39; border-bottom:2px solid #DD4B39; } -#repos-tabs .ui-tabs-nav li a:hover { +#tabs-nav li a:hover { color:#DD4B39; } -#repos-tabs .ui-tabs-panel { +#tabs .ui-tabs-panel { padding:0; } .event-item { @@ -1241,6 +1245,9 @@ textarea:-moz-placeholder {/* for FF */ } /* group message and replies */ +#grp-repos-commits td { + padding:6px 3px; +} #group-reply, .new-reply-msg-list { width:602px; diff --git a/media/img/minus-16.png b/media/img/minus-16.png new file mode 100644 index 0000000000..3cfcd9f4a1 Binary files /dev/null and b/media/img/minus-16.png differ diff --git a/media/img/modify-16.png b/media/img/modify-16.png new file mode 100644 index 0000000000..eca2d27820 Binary files /dev/null and b/media/img/modify-16.png differ diff --git a/media/img/plus-16.png b/media/img/plus-16.png new file mode 100644 index 0000000000..5965d71503 Binary files /dev/null and b/media/img/plus-16.png differ diff --git a/media/js/utils.js b/media/js/utils.js index f232545f6f..12e422d056 100644 --- a/media/js/utils.js +++ b/media/js/utils.js @@ -318,3 +318,6 @@ function trimByChar(str, n) { } return new_str; } + +$('#tabs').tabs({cookie:{expires:1}}); +$('#tabs-nav a').focus(function() { $(this).blur(); }); diff --git a/templates/snippets/events_js.html b/templates/snippets/events_js.html index d4ca65e674..a5250eeb0a 100644 --- a/templates/snippets/events_js.html +++ b/templates/snippets/events_js.html @@ -55,45 +55,4 @@ $('#events-more').click(function() { $(this).addClass('hide'); reqEvents($(this).data('start')); }); - -$('#repo-decrypt-form').submit(function() { - var form = $(this); - var form_id = form.attr('id'); - var input_password = form.find('input[name="password"]'); - var repo_id = form.find('input[name="repo_id"]').val(); - var password = input_password.val(); - var cur_data = form.data(); - if (!password) { - apply_form_error(form_id, '{% trans "Password is required." %}'); - } else { - apply_form_error(form_id, ''); - $.ajax({ - url: '{% url repo_set_password %}', - type: 'POST', - dataType: 'json', - cache: 'false', - beforeSend: prepareCSRFToken, - data: { - repo_id: repo_id, - password: password, - username: '{{request.user.username}}' - }, - success: function(data) { - $.modal.close(); - $('.lsch-encrypted[data-repoid="' + repo_id + '"]').attr('data-passwordset', true); - listCommitDetails(cur_data.url, cur_data.time); - }, - error: function(jqXHR, textStatus, errorThrown) { - var err = ''; - if (jqXHR.responseText) { - err = $.parseJSON(jqXHR.responseText).error; - } else { - err = '{% trans "Failed. Please check the network." %}'; - } - apply_form_error(form_id, err); - input_password.val(''); - } - }); - } - return false; -}); +{% include 'snippets/repo_decrypt_js.html' %} diff --git a/templates/snippets/my_owned_repos.html b/templates/snippets/my_owned_repos.html index d0a21c337e..46369ca0fc 100644 --- a/templates/snippets/my_owned_repos.html +++ b/templates/snippets/my_owned_repos.html @@ -1,16 +1,16 @@ {% load seahub_tags i18n %} {% load url from future %}

{% trans "Libraries" %}

-
+
-
+
{% if owned_repos %} @@ -48,7 +48,7 @@ {% endif %} -
+
{% if in_repos %}
@@ -93,7 +93,7 @@ {% endif %} -
+
{% if starred_files %}
diff --git a/templates/snippets/myhome_extra_script.html b/templates/snippets/myhome_extra_script.html index ede7c10046..8944e67073 100644 --- a/templates/snippets/myhome_extra_script.html +++ b/templates/snippets/myhome_extra_script.html @@ -1,5 +1,4 @@ {% load seahub_tags avatar_tags i18n %} -$('#repos-tabs').tabs({cookie:{expires:1}}); $(function() { //repo-share-form share-list autocomplete var share_list = [], contact_email, group_name, group_name_py; diff --git a/templates/snippets/repo_decrypt_js.html b/templates/snippets/repo_decrypt_js.html new file mode 100644 index 0000000000..175672ff75 --- /dev/null +++ b/templates/snippets/repo_decrypt_js.html @@ -0,0 +1,43 @@ +{% load i18n %} +{% load url from future %} +$('#repo-decrypt-form').submit(function() { + var form = $(this); + var form_id = form.attr('id'); + var input_password = form.find('input[name="password"]'); + var repo_id = form.find('input[name="repo_id"]').val(); + var password = input_password.val(); + var cur_data = form.data(); + if (!password) { + apply_form_error(form_id, '{% trans "Password is required." %}'); + } else { + apply_form_error(form_id, ''); + $.ajax({ + url: '{% url 'repo_set_password' %}', + type: 'POST', + dataType: 'json', + cache: 'false', + beforeSend: prepareCSRFToken, + data: { + repo_id: repo_id, + password: password, + username: '{{request.user.username}}' + }, + success: function(data) { + $.modal.close(); + $('.lsch-encrypted[data-repoid="' + repo_id + '"]').attr('data-passwordset', true); + listCommitDetails(cur_data.url, cur_data.time); + }, + error: function(jqXHR, textStatus, errorThrown) { + var err = ''; + if (jqXHR.responseText) { + err = $.parseJSON(jqXHR.responseText).error; + } else { + err = '{% trans "Failed. Please check the network." %}'; + } + apply_form_error(form_id, err); + input_password.val(''); + } + }); + } + return false; +});