From 1d78ec4c4ed045b81900e057fa1bbeb82b3868dc Mon Sep 17 00:00:00 2001 From: llj Date: Thu, 17 Dec 2015 19:02:10 +0800 Subject: [PATCH] [dir view] enable read-only dirents in non-encrypted libs to be copied into other libs --- seahub/templates/js/lib-op-popups.html | 2 ++ seahub/templates/js/templates.html | 10 ++++++++++ static/scripts/app/views/dirent.js | 19 +++++++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/seahub/templates/js/lib-op-popups.html b/seahub/templates/js/lib-op-popups.html index 094d2ebfe6..5f60854274 100644 --- a/seahub/templates/js/lib-op-popups.html +++ b/seahub/templates/js/lib-op-popups.html @@ -43,9 +43,11 @@
{% csrf_token %}

<%= form_title %>

+ <% if (show_cur_repo) { %>
{% trans "Current Library"%}
+ <% } %> <% if (show_other_repos) { %>
{% trans "Other Libraries"%}
diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html index c9df5015dd..42e847888d 100644 --- a/seahub/templates/js/templates.html +++ b/seahub/templates/js/templates.html @@ -234,6 +234,11 @@
  • {% trans "Open via Client" %}
  • <% } %> + <% } else if (dirent.perm == 'r' && !repo_encrypted) { %> + + <% } %>
    @@ -316,6 +321,11 @@
  • {% trans "Open via Client" %}
  • <% } %> + <% } else if (dirent.perm == 'r' && !repo_encrypted) { %> + + <% } %>
    diff --git a/static/scripts/app/views/dirent.js b/static/scripts/app/views/dirent.js index dd9ff653dd..cf15225091 100644 --- a/static/scripts/app/views/dirent.js +++ b/static/scripts/app/views/dirent.js @@ -308,21 +308,28 @@ define([ var title = op_type == 'mv' ? gettext("Move {placeholder} to:") : gettext("Copy {placeholder} to:"); title = title.replace('{placeholder}', '' + Common.HTMLescape(obj_name) + ''); + var show_cur_repo = true; + if (this.model.get('perm') == 'r') { + show_cur_repo = false; + } var form = $(this.mvcpTemplate({ form_title: title, op_type: op_type, obj_type: obj_type, obj_name: obj_name, - show_other_repos: !dir.encrypted, + show_cur_repo: show_cur_repo, + show_other_repos: !dir.encrypted })); form.modal({appendTo:'#main', autoResize:true, focus:false}); $('#simplemodal-container').css({'width':'auto', 'height':'auto'}); - FileTree.renderTreeForPath({ - repo_name: dir.repo_name, - repo_id: dir.repo_id, - path: dir.path - }); + if (show_cur_repo) { + FileTree.renderTreeForPath({ + repo_name: dir.repo_name, + repo_id: dir.repo_id, + path: dir.path + }); + } if (!dir.encrypted) { FileTree.prepareOtherReposTree({cur_repo_id: dir.repo_id}); }