2012-07-26 09:08:31 +00:00
{% extends base_template %}
2012-10-27 09:23:30 +00:00
{% load seahub_tags avatar_tags i18n %}
2012-08-13 07:58:54 +00:00
{% load url from future %}
2011-08-16 13:05:42 +00:00
2012-06-12 02:13:14 +00:00
{% block info_bar_message %}
{% if request.user.is_authenticated %}
{{ block.super }}
{% else %}
2012-08-18 09:00:44 +00:00
< div id = "sharelink-infobar" >
2012-10-29 13:43:52 +00:00
< p > {% blocktrans %}This page will be invalid shortly, you can join < a href = "http://seafile.com/" target = "_blank" > Seafile< / a > to experience more.{% endblocktrans %}< / p >
2012-06-12 02:13:14 +00:00
< / div >
{% endif %}
{% endblock %}
2012-09-04 08:13:06 +00:00
{% block main_panel %}
2012-09-15 13:01:06 +00:00
< div class = "w100 ovhd" >
< h2 class = "fleft" > {{repo.props.name}}< / h2 >
2012-10-24 09:38:03 +00:00
< div class = "fright" >
2012-10-27 09:23:30 +00:00
< button id = "repo-download-btn" > {% trans "Download"%}< / button >
2012-11-09 06:11:38 +00:00
{% if user_perm == 'rw' %}
2012-10-27 09:23:30 +00:00
< button id = "recycle-btn" data = "{% url 'repo_recycle_view' repo.id %}" > {% trans "Trash"%}< / button >
2012-11-09 06:11:38 +00:00
{% endif %}
2012-10-24 09:38:03 +00:00
< / div >
2012-09-15 13:01:06 +00:00
< / div >
2012-10-11 02:55:13 +00:00
{% if user_perm == 'r' %}
2012-10-29 13:43:52 +00:00
< p > {% trans "This library is read-only, and you can only view the files."%}< / p >
2012-09-21 03:22:46 +00:00
{% endif %}
2012-10-11 02:55:13 +00:00
2012-11-27 08:40:09 +00:00
{% if user_perm and path == '/' %}
2012-09-15 13:01:06 +00:00
< div id = "repo-basic-info" >
< p class = "desc" > {{repo.props.desc}}< / p >
2012-10-31 11:36:29 +00:00
< p class = "size" > {% trans 'Size: ' %}{{ repo_size|filesizeformat }}< / p >
2012-09-15 13:01:06 +00:00
< / div >
2012-10-11 02:55:13 +00:00
2012-09-17 04:57:29 +00:00
< div id = "repo-latest-commit" >
2012-09-15 13:01:06 +00:00
< p class = "commit-msg ovhd" >
< span class = "fleft" >
{{ current_commit.props.desc|translate_commit_desc }}
2012-10-31 11:36:29 +00:00
< a class = "lsch" href = "{{ SITE_ROOT }}repo/history/changes/{{ repo.id }}/?commit_id={{ current_commit.id }}" data = "{{ current_commit.props.ctime|tsstr_sec }}" > {% trans "Detail"%}< / a >
2012-09-15 13:01:06 +00:00
< / span >
2012-09-17 10:01:51 +00:00
{% if user_perm == 'rw' %}
2012-10-29 13:43:52 +00:00
< a href = "{% url 'seahub.views.repo_history' repo.id %}" class = "more fright" > {% trans "History"%}< / a >
2012-09-15 13:01:06 +00:00
{% endif %}
< / p >
< p class = "meta-info" >
< span class = "author" >
{% if current_commit.props.creator_name %}
2012-10-29 13:43:52 +00:00
{% if not current_commit.second_parent_id %}
{% avatar current_commit.props.creator_name 20 %}
2012-12-05 06:56:59 +00:00
< a class = "name" href = "{% url 'profile.views.user_profile' current_commit.props.creator_name %}" > {{ current_commit.creator_name|email2nickname }}< / a >
2012-10-29 13:43:52 +00:00
{% else %}
< span class = "name" > {% trans "Generated by system"%}< / span >
{% endif %}
2012-09-15 13:01:06 +00:00
{% else %}
2012-10-27 09:23:30 +00:00
{% trans "Unknown"%}
2012-06-20 13:38:07 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< / span >
2012-11-05 09:27:57 +00:00
< span class = "time" > {{ current_commit.props.ctime|translate_seahub_time }}< / span >
2012-09-15 13:01:06 +00:00
< / p >
2012-10-22 09:15:35 +00:00
< div id = "ls-ch" class = "hide" > < / div > <!-- list modification details of a commit -->
2012-05-04 13:36:36 +00:00
< / div >
2012-10-11 02:55:13 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< div class = "repo-file-list-outer-container" >
< div class = "repo-file-list-inner-container" >
2012-09-17 10:01:51 +00:00
{% if not user_perm %}
2012-09-15 13:01:06 +00:00
< div class = "repo-file-list-not-show" >
2012-10-29 13:43:52 +00:00
< p class = "access-notice" > {% trans "You can't access this library."%}< / p >
2012-09-15 13:01:06 +00:00
< / div >
{% else %}
< div class = "repo-file-list-topbar ovhd" >
< p class = "path fleft" >
2012-10-27 09:23:30 +00:00
{% trans "Current path: "%}
2012-09-15 13:01:06 +00:00
{% for name, link in zipped %}
{% if not forloop.last %}
2012-07-05 11:29:56 +00:00
< a href = "{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}" > {{ name }}< / a > /
2012-09-15 13:01:06 +00:00
{% else %}
{{ name }}
{% endif %}
{% endfor %}
< / p >
2012-09-17 10:01:51 +00:00
{% if user_perm == 'rw' %}
2012-09-15 13:01:06 +00:00
< div class = "repo-op fright" >
2012-10-27 09:23:30 +00:00
< button data = "{{ SITE_ROOT }}repo/upload_file/{{repo.id}}/?p={{ path|urlencode }}" id = "upload-file" class = "op-btn" > {% trans "Upload"%}< / button >
2012-10-29 13:43:52 +00:00
< button id = "add-new-dir" class = "op-btn" > {% trans "New Directory"%}< / button >
2012-10-27 09:23:30 +00:00
< button id = "add-new-file" class = "op-btn" > {% trans "New File"%}< / button >
2012-09-15 13:01:06 +00:00
< / div >
2012-07-03 13:48:33 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< / div >
2012-09-17 10:01:51 +00:00
<!-- /.repo - file - list - topbar -->
2012-09-15 13:01:06 +00:00
< table class = "repo-file-list" >
< tr >
< th width = "5%" > < / th >
2012-10-27 09:23:30 +00:00
< th width = "60%" > {% trans "Name"%}< / th >
< th width = "10%" > {% trans "Size"%}< / th >
< th width = "30%" > {% trans "Operations"%}< / th >
2012-09-15 13:01:06 +00:00
< / tr >
{% for dirent in dir_list %}
< tr >
2012-10-29 13:43:52 +00:00
< td class = "icon-container" > < img src = "{{ MEDIA_URL }}img/folder-icon-24.png" alt = "{% trans " Directory icon " % } " / > < / td >
2012-09-15 13:01:06 +00:00
< td >
< a href = "{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}" > {{ dirent.obj_name }}< / a >
< / td >
< td > < / td >
< td >
2012-11-02 07:17:55 +00:00
{% if user_perm %}
2012-09-17 02:32:31 +00:00
< div class = "repo-file-op vh" >
2012-12-05 07:27:15 +00:00
< div class = "displayed-op" >
< a class = "op" href = "{{ SITE_ROOT }}repo/download_dir/{{ repo.id }}/?parent={{ path|urlencode }}&dirname={{ dirent.obj_name|urlencode }}" > {% trans 'Download' %}< / a >
< / div >
2012-12-05 14:07:22 +00:00
{% if user_perm == 'rw' %}
2012-10-29 13:43:52 +00:00
< img src = "{{ MEDIA_URL }}img/dropdown-arrow.png" title = "{% trans 'More operations'%}" alt = "{% trans 'More operations'%}" class = "more-op-icon" data = "no-popup" / >
2012-09-15 13:01:06 +00:00
< ul class = "hidden-op hide" >
2012-10-27 09:23:30 +00:00
< li > < a class = "op" href = "{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?p={{ path|urlencode }}&file_name={{ dirent.props.obj_name|urlencode }}&op=del" > {% trans "Delete"%}< / a > < / li >
< li > < a class = "op dir-rename" href = "#" data = "{{ dirent.obj_name }}" > {% trans "Rename"%}< / a > < / li >
< li > < a class = "op dir-mv" href = "#" data = "{{ dirent.obj_name }}" > {% trans "Move"%}< / a > < / li >
< li > < a class = "op dir-cp" href = "#" data = "{{ dirent.obj_name }}" > {% trans "Copy"%}< / a > < / li >
2012-09-15 13:01:06 +00:00
< / ul >
2012-12-05 14:07:22 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< / div >
2012-11-02 07:17:55 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< / td >
< / tr >
{% endfor %}
{% for dirent in file_list %}
< tr >
2012-10-27 09:23:30 +00:00
< td class = "icon-container" > < img src = "{{ MEDIA_URL }}img/file/{{ dirent.obj_name|file_icon_filter }}" alt = "{% trans " File " % } " / > < / td >
2012-09-15 13:01:06 +00:00
< td >
< a class = "op" href = "{{ SITE_ROOT }}repo/{{ repo.props.id }}/files/?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}" > {{ dirent.props.obj_name }}< / a >
< / td >
< td > {{ dirent.file_size|filesizeformat }}< / td >
< td >
2012-09-17 02:32:31 +00:00
< div class = "repo-file-op vh" >
< div class = "displayed-op" >
2012-10-27 09:23:30 +00:00
< a class = "op" href = "{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}&op=download" > {% trans "Download"%}< / a >
2012-10-24 09:38:03 +00:00
{% if user_perm == 'rw' %}
2012-11-17 09:31:37 +00:00
< a class = "op update-file" data-target = "{{ path }}{{dirent.obj_name}}" href = "#" > {% trans "Update"%}< / a >
2012-10-24 09:38:03 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< / div >
2012-10-17 07:37:15 +00:00
{% if user_perm == 'rw' %}
2012-10-27 09:23:30 +00:00
< img src = "{{ MEDIA_URL }}img/dropdown-arrow.png" title = "{% trans " More Operations " % } " alt = "{% trans " More Operations " % } " class = "more-op-icon" data = "no-popup" / >
2012-09-15 13:01:06 +00:00
< ul class = "hidden-op hide" >
2012-10-29 13:43:52 +00:00
< li > < a class = "op" href = "{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?p={{ path|urlencode }}&file_name={{ dirent.props.obj_name|urlencode }}&op=del" > {% trans "Delete" %}< / a > < / li >
< li > < a class = "op file-rename" href = "#" data = "{{ dirent.obj_name }}" > {% trans "Rename" %}< / a > < / li >
< li > < a class = "op file-mv" href = "#" data = "{{ dirent.obj_name }}" > {% trans "Move" %}< / a > < / li >
< li > < a class = "op file-cp" href = "#" data = "{{ dirent.obj_name }}" > {% trans "Copy" %}< / a > < / li >
< li > < a class = "op" href = "{% url 'file_revisions' repo.props.id %}?p={{ path }}{{ dirent.obj_name }}" > {% trans "History" %}< / a > < / li >
2012-09-15 13:01:06 +00:00
< / ul >
2012-10-17 07:37:15 +00:00
{% endif %}
2012-09-15 13:01:06 +00:00
< / div >
< / td >
< / tr >
{% endfor %}
< / table >
2012-09-17 10:01:51 +00:00
<!-- /.repo - file - list -->
2012-09-15 13:01:06 +00:00
{% endif %}
< / div >
2012-05-04 13:36:36 +00:00
< / div >
2012-07-02 02:21:17 +00:00
2012-11-17 09:31:37 +00:00
<!-- popup dialog for file upload -->
< div id = "upload-file-dialog" class = "hide" >
2012-11-27 03:17:14 +00:00
< h3 > {% trans "Upload Files" %}< / h3 >
2012-11-17 09:31:37 +00:00
{% if no_quota %}
2012-12-06 09:44:50 +00:00
< p class = "error" > {% trans "The owner of this library has ran out of space." %}< / p >
2012-11-17 09:31:37 +00:00
{% else %}
< form id = "upload-file-form" enctype = "multipart/form-data" method = "post" action = "{{ upload_url }}" >
< input type = "hidden" name = "parent_dir" id = "parent_dir" value = "{{ parent_dir }}" / >
2012-12-06 09:44:50 +00:00
< div class = "files-add" >
< span class = "op" > {% trans "Add files" %}< / span >
2012-12-07 03:22:41 +00:00
< span id = "upload-add-tip" > ({% trans "smaller than" %} {{ max_upload_file_size|filesizeformat }})< / span >
2012-12-06 09:44:50 +00:00
< input type = "file" name = "file" id = "file-upload-input" / >
2012-11-17 09:31:37 +00:00
< / div >
2012-12-06 09:44:50 +00:00
< div id = "upload-file-list" > < / div >
2012-11-17 09:31:37 +00:00
< p class = "error" > {{ error_msg }}< / p >
< input type = "submit" value = "{% trans " Upload " % } " class = "submit" / >
< / form >
< div id = "upload-progress" class = "hide" >
2012-12-07 08:46:53 +00:00
< p > {% trans "Uploaded:" %} < span id = "upload-progress-text" > {% trans "Fetching ..." %}< / span > < / p >
2012-11-17 09:31:37 +00:00
< div id = "task-progress-bar" class = "hide" > < / div >
< button id = "upload-cancel" > {% trans "Cancel" %}< / button >
< / div >
< iframe id = "request-progress" class = "hide" > <!-- for chrome --> < / iframe >
{% endif %}
< / div >
<!-- popup dialog for file update -->
< div id = "update-file-dialog" class = "hide" >
< h3 > Update File< / h3 >
{% if no_quota %}
< p class = "error" > {% trans "The owner of this library has ran out of space. Update failed." %}< / p >
{% else %}
< form id = "update-file-form" enctype = "multipart/form-data" method = "post" action = "{{ update_url }}?head={{ head_id }}" >
< input type = "hidden" name = "target_file" / >
< input type = "file" name = "file" id = "id_update_file" / >
< p > ({% trans "Smaller than" %} {{ max_upload_file_size|filesizeformat }})< / p >
< p class = "error" > {{ error_msg }}< / p >
< input type = "submit" value = "{% trans " Update " % } " class = "submit" / >
< / form >
< div id = "upload-progress" class = "hide" >
2012-12-07 08:46:53 +00:00
< p > {% trans "Uploaded:" %} < span id = "upload-progress-text" > {% trans "Fetching..." %}< / span > < / p >
2012-11-17 09:31:37 +00:00
< div id = "task-progress-bar" class = "hide" > < / div >
< button id = "upload-cancel" > {% trans "Cancel" %}< / button >
< / div >
< iframe id = "request-progress" class = "hide" > <!-- for chrome --> < / iframe >
{% endif %}
< / div >
2012-11-10 03:31:05 +00:00
< form id = "add-new-dir-form" action = "" method = "post" class = "simple-input-popup hide" > {% csrf_token %}
< h3 > {% trans "New Directory" %}< / h3 >
< label > {% trans "Directory Name" %}< / label >
2012-07-02 02:21:17 +00:00
< input type = "hidden" name = "repo_id" value = "{{ repo.id }}" / >
< input type = "hidden" name = "parent_dir" value = "{{ path }}" / >
2012-11-10 03:31:05 +00:00
< input type = "text" name = "new_dir_name" value = "" class = "long-input" / > < br / >
2012-09-07 03:01:44 +00:00
< p class = "error hide" > < / p >
2012-10-29 13:43:52 +00:00
< input type = "submit" value = "{% trans " Submit " % } " class = "submit" / >
< button class = "simplemodal-close" > {% trans "Cancel" %}< / button >
2012-07-02 02:21:17 +00:00
< / form >
2012-11-10 03:31:05 +00:00
< form id = "add-new-file-form" action = "" method = "post" class = "simple-input-popup hide" > {% csrf_token %}
< h3 > {% trans "New File" %}< / h3 >
2012-11-20 08:28:33 +00:00
< div id = "featured-filetype" >
< label > {% trans "Featured File Type" %}< / label > < br / >
2012-12-05 08:51:34 +00:00
< button type = "button" data = "seaf" title = "{% trans " Click to choose " % } " > seaf< / button > < span > {% trans "online Rich Text format ( experimental ) ." %}< / span > < a href = "http://www.seafile.com/{% if LANGUAGE_CODE == 'en' %}en/{% endif %}help/seaf/" target = "_blank" > {% trans 'more' %}< / a > < br / >
2012-12-04 08:19:40 +00:00
< button type = "button" data = "md" title = "{% trans " Click to choose " % } " > markdown< / button > < span > {% trans "simple markup format." %}< / span > < a href = "http://www.seafile.com/{% if LANGUAGE_CODE == 'en' %}en/{% endif %}help/markdown/" target = "_blank" > {% trans 'more' %}< / a >
2012-11-20 08:28:33 +00:00
< / div >
2012-11-10 03:31:05 +00:00
< label > {% trans "File Name" %}< / label >
2012-08-11 06:07:12 +00:00
< input type = "hidden" name = "repo_id" value = "{{ repo.id }}" / >
< input type = "hidden" name = "parent_dir" value = "{{ path }}" / >
2012-11-20 08:28:33 +00:00
< input type = "text" name = "new_file_name" value = "" class = "long-input" / >
2012-09-07 03:01:44 +00:00
< p class = "error hide" > < / p >
2012-10-27 09:23:30 +00:00
< input type = "submit" value = "{% trans " Submit " % } " class = "submit" / >
< button class = "simplemodal-close" > {% trans "Cancel"%}< / button >
2012-08-11 06:07:12 +00:00
< / form >
2012-07-02 02:21:17 +00:00
< form id = "mv-form" action = "{{ SITE_ROOT }}file/move/" method = "post" class = "hide" >
2012-09-06 11:50:04 +00:00
< h3 id = "mv-hd" > < / h3 >
2012-12-06 03:30:23 +00:00
< h4 id = "mv-detail" > < / h4 >
< div id = "mv-dir-list" >
< h5 > < span class = "tri-bg tri-down-bg" > < / span > {% trans "Current Library"%}< / h5 >
2012-09-07 03:19:18 +00:00
< div id = "current-repo-dirs" > < / div >
2012-12-06 03:30:23 +00:00
< h5 > < span class = "tri-bg tri-right-bg" > < / span > {% trans "Other Libraries"%}< / h5 >
2012-09-06 11:50:04 +00:00
< div id = "other-repos-dirs" class = "hide" > < / div >
< / div >
2012-12-06 03:30:23 +00:00
< input type = "hidden" name = "operation" id = "mv-type" value = "" / >
2012-07-02 02:21:17 +00:00
< input type = "hidden" name = "src_repo" value = "{{ repo.id }}" / >
< input type = "hidden" name = "src_path" value = "{{ path }}" / >
< input type = "hidden" name = "obj_name" value = "" / >
< input type = "hidden" name = "obj_type" value = "" / >
< input type = "hidden" name = "dst_repo" value = "" / >
< input type = "hidden" name = "dst_path" value = "" / >
2012-10-29 13:43:52 +00:00
< p class = "error hide" > {% trans "Please click and choose a directory."%}< / p >
2012-10-27 09:23:30 +00:00
< input type = "submit" value = "{% trans " Submit " % } " class = "submit" / >
< button class = "simplemodal-close" > {% trans "Cancel"%}< / button >
2012-07-02 02:21:17 +00:00
< / form >
2012-12-01 07:37:54 +00:00
< form id = "rename-form" action = "{{ SITE_ROOT}}repo/file_rename/" method = "post" class = "simple-input-popup hide" >
2012-12-06 03:30:23 +00:00
< h3 > {% trans 'Rename < span id = "rename-type" > < / span > ' %}< / h3 >
< p > {% trans 'Rename < span id = "rename-obj" class = "op-target" > < / span > as: ' %}< / p >
2012-07-02 02:21:17 +00:00
< input type = "hidden" name = "repo_id" value = "{{ repo.id }}" / >
< input type = "hidden" name = "parent_dir" value = "{{ path }}" / >
< input type = "hidden" name = "oldname" value = "" / >
2012-12-01 07:37:54 +00:00
< input type = "text" name = "newname" value = "" class = "long-input" / > < br / >
2012-09-07 03:01:44 +00:00
< p class = "error hide" > < / p >
2012-10-27 09:23:30 +00:00
< input type = "submit" value = "{% trans " Submit " % } " class = "submit" / >
< button class = "simplemodal-close" > {% trans "Cancel"%}< / button >
2012-07-02 02:21:17 +00:00
< / form >
2012-10-22 09:15:35 +00:00
2012-08-13 07:58:54 +00:00
{% with attach_type='dir' %}
{% include "snippets/group_recommend_form.html" %}
{% endwith %}
2011-08-16 13:05:42 +00:00
{% endblock %}
2011-10-18 07:41:48 +00:00
{% block extra_script %}
2012-07-02 02:21:17 +00:00
< script type = "text/javascript" src = "{{ MEDIA_URL }}jstree_pre1.0_stable/jquery.jstree.js" > < / script >
2012-11-20 09:03:43 +00:00
< script type = "text/javascript" src = "{{ MEDIA_URL }}js/jquery.MultiFile.pack.js" > < / script >
2011-10-18 07:41:48 +00:00
< script type = "text/javascript" >
2012-09-27 08:32:17 +00:00
var clicked_more_op_icon, no_file_op_popup = true;
$("table tr:gt(0)").unbind().hover( // remove previously binded hover handler at first
2012-07-02 02:21:17 +00:00
function() {
2012-09-27 08:32:17 +00:00
if (no_file_op_popup) {
$(this).addClass('hl').find('.repo-file-op').removeClass('vh');
}
2012-07-02 02:21:17 +00:00
},
function() {
2012-09-27 08:32:17 +00:00
if (no_file_op_popup) {
$(this).removeClass('hl').find('.repo-file-op').addClass('vh');
}
2012-07-02 02:21:17 +00:00
}
);
2012-07-18 02:57:09 +00:00
$('#main-panel').removeClass('ovhd');
2012-09-15 13:01:06 +00:00
$('.more-op-icon').click(function(e) {
2012-09-07 02:44:12 +00:00
var its_op_list = $(this).next();
2012-09-06 03:39:00 +00:00
if ($(this).attr('data')) { // no popup
2012-09-27 08:32:17 +00:00
clicked_more_op_icon = $(this);
2012-07-02 02:21:17 +00:00
$(this).parent().css('position','relative');
2012-09-15 13:01:06 +00:00
its_op_list.css('left', $(this).position().left + $(this).width() + 5);
2012-09-07 02:44:12 +00:00
if ($(this).offset().top + its_op_list.height() < = $('#main').offset().top + $('#main').height()) {
its_op_list.css('top', 6);
2012-07-04 09:06:25 +00:00
} else {
2012-09-07 02:44:12 +00:00
its_op_list.css('bottom', 2);
2012-07-02 02:21:17 +00:00
}
2012-09-07 02:44:12 +00:00
its_op_list.removeClass('hide');
2012-09-06 03:39:00 +00:00
$(this).attr('data','');
2012-09-27 08:32:17 +00:00
no_file_op_popup = false;
2012-09-05 08:37:14 +00:00
} else {
2012-09-07 02:44:12 +00:00
its_op_list.addClass('hide');
2012-09-06 03:39:00 +00:00
$(this).attr('data','no-popup');
2012-09-27 08:32:17 +00:00
no_file_op_popup = true;
2012-07-02 02:21:17 +00:00
}
2012-09-05 08:37:14 +00:00
});
$(document).click(function(e) {
var target = e.target || event.srcElement;
2012-09-27 08:32:17 +00:00
if (clicked_more_op_icon & & target != clicked_more_op_icon[0]) {
2012-09-27 09:15:19 +00:00
clicked_more_op_icon.next().addClass('hide'); // hide the popup
clicked_more_op_icon.attr('data','no-popup');
var its_tr = clicked_more_op_icon.parent().parent().parent();
if (!(its_tr.find('*').is(target))) {
clicked_more_op_icon.parent().addClass('vh');
its_tr.removeClass('hl');
2012-09-28 03:43:51 +00:00
if ($('table tr:gt(0)').find('*').is(target)) {
target.parentNode.className += 'hl';
target.parentNode.getElementsByTagName('div')[0].className = 'repo-file-op';
}
2012-09-27 09:15:19 +00:00
}
no_file_op_popup = true;
2012-07-02 02:21:17 +00:00
}
2012-09-05 08:37:14 +00:00
});
2012-09-15 13:01:06 +00:00
$('.hidden-op li').hover(
2012-07-02 02:21:17 +00:00
function() {
$(this).css('background', '#eee');
},
function() {
$(this).css('background', '#fff');
}
);
$('.file-rename, .dir-rename').click(function () {
2012-12-06 03:30:23 +00:00
var type = $(this).hasClass('file-rename') ? '{% trans "File" %}' : '{% trans "Directory" %}';
var name = $(this).attr('data');
$('#rename-type').html(type);
$('#rename-obj').html(name);
$('#rename-form input[name*="name"]').val(name);
2012-12-01 07:37:54 +00:00
$('#rename-form').modal();
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
$(window).resize();// make the popup in the center of the window
2012-07-02 02:21:17 +00:00
return false;
});
2012-07-11 09:47:08 +00:00
2012-09-06 11:50:04 +00:00
var current_repo = [],
other_repos = [];
{% for a_repo in accessible_repos %}
{% if a_repo.props.id == repo.props.id %}
{% if a_repo.props.has_subdir %}
current_repo.push({
'data': '{{ a_repo.props.name }}',
'attr': {'repo_id': '{{ a_repo.props.id }}'},
'state': 'closed'
});
{% else %}
current_repo.push({
'data': '{{ a_repo.props.name }}',
'attr': {'repo_id': '{{ a_repo.props.id }}'}
});
{% endif %}
2012-07-02 02:21:17 +00:00
{% else %}
2012-09-06 11:50:04 +00:00
{% if a_repo.props.has_subdir %}
other_repos.push({
'data': '{{ a_repo.props.name }}',
'attr': {'repo_id': '{{ a_repo.props.id }}'},
'state': 'closed'
});
{% else %}
other_repos.push({
'data': '{{ a_repo.props.name }}',
'attr': {'repo_id': '{{ a_repo.props.id }}'}
});
{% endif %}
2012-07-02 02:21:17 +00:00
{% endif %}
{% endfor %}
$('.file-cp, .file-mv, .dir-cp, .dir-mv').click(function () {
var obj_name = $(this).attr('data'),
mv_type = '',
file_type = '';
if ($(this).hasClass('file-cp') || $(this).hasClass('dir-cp')) {
2012-12-06 03:30:23 +00:00
$('#mv-type').val('cp');
2012-10-29 13:43:52 +00:00
mv_type = '{% trans "Copy " %}';
2012-07-02 02:21:17 +00:00
} else {
2012-12-06 03:30:23 +00:00
$('#mv-type').val('mv');
2012-10-29 13:43:52 +00:00
mv_type = '{% trans "Move " %}';
2012-07-02 02:21:17 +00:00
}
if ($(this).hasClass('file-cp') || $(this).hasClass('file-mv')) {
2012-12-06 03:30:23 +00:00
file_type = '{% trans "File" %}';
2012-07-02 02:21:17 +00:00
$('input[name="obj_type"]').val('file');
} else {
2012-12-06 03:30:23 +00:00
file_type = '{% trans "Directory" %}';
2012-12-01 13:52:50 +00:00
$('input[name="obj_type"]').val('dir');
2012-07-02 02:21:17 +00:00
}
$('input[name="obj_name"]').val(obj_name);
2012-12-06 03:30:23 +00:00
$('#mv-hd').html(mv_type + file_type);
$('#mv-detail').html(mv_type + ' < span class = "op-target" > ' + obj_name + '< / span > {% trans "to:" %}');
$('#mv-form').modal({appendTo:'#main', autoResize:true, focus:false});
2012-09-07 03:19:18 +00:00
renderDirTree($('#current-repo-dirs'), current_repo);
2012-09-06 11:50:04 +00:00
return false;
});
2012-07-02 02:21:17 +00:00
2012-09-06 11:50:04 +00:00
function renderDirTree(container, repo_data) {
container
2012-09-07 06:53:11 +00:00
.delegate('.jstree-closed', 'dblclick', function(e) {
container.jstree('open_node', $(this));
$(this).find('a').removeClass('jstree-clicked');
2012-07-19 13:17:50 +00:00
})
2012-09-07 07:01:54 +00:00
.bind('before.jstree', function(e, data) {
if (data.func === 'select_node') { // ensure only one selected dir display in the popup
$('#mv-form .jstree-clicked').removeClass('jstree-clicked');
2012-07-19 13:17:50 +00:00
}
2012-07-19 04:06:04 +00:00
})
2012-09-07 06:53:11 +00:00
.bind('select_node.jstree', function(e, data) {
2012-07-02 02:21:17 +00:00
var repo_id = data.rslt.obj.attr('repo_id') || data.inst._get_parent(data.rslt.obj).attr('repo_id');
$('input[name="dst_repo"]').attr('value', repo_id);
var path = data.inst.get_path(data.rslt.obj);
var mv_dst_path = '';
if (path.length == 1) {
mv_dst_path = '/';
} else {
path.shift();
mv_dst_path = '/' + path.join('/') + '/';
}
$('input[name="dst_path"]').attr('value', mv_dst_path);
})
.jstree({
'json_data': {
2012-09-06 11:50:04 +00:00
'data': repo_data,
2012-07-02 02:21:17 +00:00
'ajax': {
'url': function(data) {
var path = this.get_path(data);
var repo_id = data.attr('repo_id');
if (path.length == 1) {
path = '/';
} else {
path.shift();
path = '/' + path.join('/') + '/';
}
2012-07-04 09:06:25 +00:00
return '{{ SITE_ROOT }}file/move/get_subdir/?repo_id=' + e(repo_id) + '& path=' + e(path);
2012-07-02 02:21:17 +00:00
}
}
},
'core': {
'animation': 100
},
'plugins': ['themes', 'json_data', 'ui']
});
2012-09-06 11:50:04 +00:00
}
2012-09-07 08:01:07 +00:00
2012-12-06 03:30:23 +00:00
$('#mv-dir-list h5').click(function() {
2012-09-06 11:50:04 +00:00
var span = $(this).children('.tri-bg'),
next = $(this).next();
if (span.hasClass('tri-right-bg')) {
span.attr('class','tri-bg tri-down-bg');
if (next.attr('id') == 'current-repo-dirs') {
renderDirTree(next, current_repo);
} else {
renderDirTree(next, other_repos);
}
next.removeClass('hide');
} else {
span.attr('class','tri-bg tri-right-bg');
next.addClass('hide');
}
2012-07-02 02:21:17 +00:00
});
2012-12-01 07:37:54 +00:00
$('#rename-form').submit(function() {
var new_name = $(this).find('input[name="newname"]').val();
if (!$.trim(new_name)) {
apply_form_error('rename-form', "{% trans "File name can't be empty" %}");
return false;
}
var submit_btn = $(this).children('input[type="submit"]');
disable(submit_btn);
2012-10-12 13:11:30 +00:00
2012-09-07 03:01:44 +00:00
$.ajax({
url: '{% url 'views.repo_rename_file' %}',
type: 'POST',
dataType: 'json',
cache: 'false',
beforeSend: prepareCSRFToken,
data: {
'repo_id': $('#rename-form input[name="repo_id"]').val(),
'parent_dir': $('#rename-form input[name="parent_dir"]').val(),
'oldname': $('#rename-form input[name="oldname"]').val(),
2012-12-01 07:37:54 +00:00
'newname': new_name
2012-09-07 03:01:44 +00:00
},
success: function(data) {
if (data['success']) {
location.reload(true);
} else {
apply_form_error('rename-form', data['error']);
2012-12-01 07:37:54 +00:00
enable(submit_btn);
2012-09-07 03:01:44 +00:00
}
},
error: function(data, textStatus, jqXHR) {
var errors = $.parseJSON(data.responseText);
$.each(errors, function(index, value) {
apply_form_error('rename-form', value[0]);
});
2012-12-01 07:37:54 +00:00
enable(submit_btn);
2012-09-07 03:01:44 +00:00
}
});
return false;
});
2012-11-14 11:49:57 +00:00
$('#add-new-file-form').submit(function() {
2012-11-15 08:51:14 +00:00
var new_file = $(this).find('input[name="new_file_name"]').val();
if (!$.trim(new_file)) {
apply_form_error('add-new-file-form', "{% trans "File name can't be empty" %}");
return false;
}
2012-11-14 11:49:57 +00:00
var submit_btn = $(this).children('input[type="submit"]');
2012-11-15 03:28:57 +00:00
disable(submit_btn);
2012-09-07 03:01:44 +00:00
$.ajax({
url: '{% url 'views.repo_new_file' %}',
type: 'POST',
dataType: 'json',
beforeSend: prepareCSRFToken,
data: {
'repo_id': $('#add-new-file-form input[name="repo_id"]').val(),
'parent_dir': $('#add-new-file-form input[name="parent_dir"]').val(),
2012-11-15 08:51:14 +00:00
'new_file_name': new_file
2012-09-07 03:01:44 +00:00
},
success: function(data) {
if (data['success']) {
location.reload(true);
} else {
apply_form_error('add-new-file-form', data['error']);
2012-11-15 03:28:57 +00:00
enable(submit_btn);
2012-09-07 03:01:44 +00:00
}
},
error: function(data, textStatus, jqXHR) {
var errors = $.parseJSON(data.responseText);
$.each(errors, function(index, value) {
apply_form_error('add-new-file-form', value[0]);
});
2012-11-15 03:28:57 +00:00
enable(submit_btn);
2012-09-07 03:01:44 +00:00
}
});
return false;
});
2012-11-14 11:49:57 +00:00
$('#add-new-dir-form').submit(function() {
2012-11-15 08:51:14 +00:00
var new_dir = $(this).find('input[name="new_dir_name"]').val();
if (!$.trim(new_dir)) {
apply_form_error('add-new-dir-form', "{% trans "Directory name can't be empty" %}");
return false;
}
2012-11-14 11:49:57 +00:00
var submit_btn = $(this).children('input[type="submit"]');
2012-11-15 03:28:57 +00:00
disable(submit_btn);
2012-09-07 03:01:44 +00:00
$.ajax({
url: '{% url 'views.repo_new_dir' %}',
type: 'POST',
dataType: 'json',
beforeSend: prepareCSRFToken,
data: {
'repo_id': $('#add-new-dir-form input[name="repo_id"]').val(),
'parent_dir': $('#add-new-dir-form input[name="parent_dir"]').val(),
2012-11-15 08:51:14 +00:00
'new_dir_name': new_dir
2012-09-07 03:01:44 +00:00
},
success: function(data) {
if (data['success']) {
location.reload(true);
} else {
apply_form_error('add-new-dir-form', data['error']);
2012-11-15 03:28:57 +00:00
enable(submit_btn);
2012-09-07 03:01:44 +00:00
}
},
error: function(data, textStatus, jqXHR) {
var errors = $.parseJSON(data.responseText);
$.each(errors, function(index, value) {
apply_form_error('add-new-dir-form', value[0]);
});
2012-11-15 03:28:57 +00:00
enable(submit_btn);
2012-09-07 03:01:44 +00:00
}
});
return false;
2012-07-02 02:21:17 +00:00
});
2012-09-07 03:01:44 +00:00
2012-07-02 02:21:17 +00:00
$('#mv-form .submit').click(function() {
if (!$.trim($(this).prev().prev().val())) {//if the input is empty
$(this).prev().removeClass('hide');//show error msg
2012-07-19 13:17:50 +00:00
$('#simplemodal-container').css('height', $(this).parent().height());
2012-07-02 02:21:17 +00:00
return false;
}
});
2012-08-08 09:14:04 +00:00
$('#upload-file').click(function () {
2012-12-06 09:44:50 +00:00
$('#upload-file-dialog').modal({focus:false});
$('#file-upload-input').MultiFile({
2012-11-17 09:31:37 +00:00
list: '#upload-file-list',
STRING: {
2012-12-06 09:44:50 +00:00
file: '< span title = "{% trans " Click to remove " % } " onclick = "$(this).parent().prev().click()" > $file< / span > ',
2012-11-27 03:17:14 +00:00
duplicate: '{% trans "This file has already been selected:\n$file!" %}'
2012-12-07 03:22:41 +00:00
},
afterFileAppend:function() {
$('#upload-file-form .files-add input').css({'right':$('#upload-add-tip').width()});
}
}); // init MultiFile
2012-12-06 09:44:50 +00:00
$('#simplemodal-container').css({'height':'auto', 'width':'auto'});
2012-12-07 03:22:41 +00:00
$('#upload-file-form .files-add').css({'width':$('#upload-file-form .files-add').width()});
$('#upload-file-form .files-add input').css({'right':$('#upload-add-tip').width()});
2012-11-17 09:31:37 +00:00
});
$('a.update-file').click(function() {
// Get target file and set hidden input of update file form.
var target_file = $(this).data("target");
$('#update-file-form input[name="target_file"]').val(target_file);
2012-12-06 09:44:50 +00:00
$('#update-file-dialog').modal({focus:false});
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
2012-11-17 09:31:37 +00:00
return false;
2012-08-08 09:14:04 +00:00
});
$('#add-new-dir').click(function () {
$('#add-new-dir-form').modal({appendTo:'#main'});
});
2012-08-11 06:07:12 +00:00
$('#add-new-file').click(function () {
2012-11-20 08:28:33 +00:00
$('#add-new-file-form').modal({appendTo:'#main', focus:false, containerCss:{'padding':'20px 25px'}});
});
$('#featured-filetype button').click(function() {
var file_name = $('#add-new-file-form input[name="new_file_name"]');
file_name.val('.' + $(this).attr('data'));
setCaretPos(file_name[0], 0);
2012-08-11 06:07:12 +00:00
});
2012-08-08 09:14:04 +00:00
2012-09-30 11:40:35 +00:00
$('#upload-file, #add-new-dir, #add-new-file, #repo-download-btn, #recycle-btn').hover(
2012-08-08 09:14:04 +00:00
function() {
$(this).css({'background-color': '#fff', 'cursor': 'pointer'});
},
function() {
$(this).css('background-color', '#f5f5f5');
}
2012-09-26 07:15:08 +00:00
);
$('#repo-download-btn').click(function() {
2012-09-15 13:01:06 +00:00
window.open('{{ SITE_ROOT }}seafile_access_check/?repo_id={{repo.props.id}}');
});
2012-09-30 11:40:35 +00:00
$('#recycle-btn').click(function() {
location.href = $(this).attr('data');
});
2012-09-15 13:01:06 +00:00
{% include "snippets/list_commit_detail.html" %}
2012-08-08 09:14:04 +00:00
{% include "snippets/bottom_bar.html" %}
2011-10-18 07:41:48 +00:00
< / script >
2012-11-17 09:31:37 +00:00
{% include 'snippets/file_upload_progress_js.html' %}
2011-10-18 07:41:48 +00:00
{% endblock %}