2012-07-26 09:08:31 +00:00
|
|
|
{% extends base_template %}
|
|
|
|
|
2012-09-15 13:01:06 +00:00
|
|
|
{% load seahub_tags avatar_tags %}
|
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">
|
|
|
|
<p>当前链接会在短期内失效,欢迎您 <a href="http://seafile.com/" target="_blank">加入Seafile </a>体验更多功能。</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-09-17 10:01:51 +00:00
|
|
|
{% if user_perm == 'rw' %}
|
2012-09-22 11:50:40 +00:00
|
|
|
<button id="repo-download-btn" class="fright">下载到本地</button>
|
2012-09-30 11:40:35 +00:00
|
|
|
<button id="recycle-btn" class="fright" data="{% url 'repo_recycle_view' repo.id %}">文件回收站</button>
|
2012-09-15 13:01:06 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2012-10-11 02:55:13 +00:00
|
|
|
{% if user_perm == 'r' %}
|
2012-10-09 06:38:13 +00:00
|
|
|
<p>这个资料库设置了只读共享,您只能在线浏览文件。</p>
|
2012-09-21 03:22:46 +00:00
|
|
|
{% endif %}
|
2012-10-11 02:55:13 +00:00
|
|
|
|
|
|
|
{% if user_perm %}
|
2012-09-15 13:01:06 +00:00
|
|
|
<div id="repo-basic-info">
|
|
|
|
<p class="desc">{{repo.props.desc}}</p>
|
|
|
|
<p class="size">大小:{{ repo_size|filesizeformat }}</p>
|
|
|
|
</div>
|
2012-10-11 02:55:13 +00:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if user_perm %}
|
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 }}
|
|
|
|
<a class="lsch" href="{{ SITE_ROOT }}repo/history/changes/{{ repo.id }}/?commit_id={{ current_commit.id }}" data="{{ current_commit.props.ctime|tsstr_sec }}">详情</a>
|
|
|
|
</span>
|
2012-09-17 10:01:51 +00:00
|
|
|
{% if user_perm == 'rw' %}
|
2012-09-15 13:01:06 +00:00
|
|
|
<a href="{% url 'seahub.views.repo_history' repo.id %}" class="more fright">更多历史</a>
|
|
|
|
{% endif %}
|
|
|
|
</p>
|
|
|
|
<p class="meta-info">
|
|
|
|
<span class="author">
|
|
|
|
{% if current_commit.props.creator_name %}
|
|
|
|
{% avatar current_commit.props.creator_name 20 %}
|
|
|
|
<a class="name" href="{% url 'profile.views.user_profile' current_commit.props.creator_name %}">{{ current_commit.props.creator_name|short_email }}</a>
|
|
|
|
{% else %}
|
|
|
|
未知
|
2012-06-20 13:38:07 +00:00
|
|
|
{% endif %}
|
2012-09-15 13:01:06 +00:00
|
|
|
</span>
|
|
|
|
<span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span>
|
|
|
|
</p>
|
|
|
|
<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-09 06:38:13 +00:00
|
|
|
<p class="access-notice">无法在线查看该资料库。</p>
|
2012-09-15 13:01:06 +00:00
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="repo-file-list-topbar ovhd">
|
|
|
|
<p class="path fleft">
|
|
|
|
当前路径:
|
|
|
|
{% 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">
|
|
|
|
<button data="{{ SITE_ROOT }}repo/upload_file/{{repo.id}}/?p={{ path|urlencode }}" id="upload-file" class="op-btn">上传</button>
|
|
|
|
<button id="add-new-dir" class="op-btn">新建目录</button>
|
|
|
|
<button id="add-new-file" class="op-btn">新建文件</button>
|
|
|
|
</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>
|
|
|
|
<th width="60%">名字</th>
|
|
|
|
<th width="10%">大小</th>
|
|
|
|
<th width="30%">操作</th>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
{% for dirent in dir_list %}
|
|
|
|
<tr>
|
|
|
|
<td class="icon-container"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="目录" /></td>
|
|
|
|
<td>
|
|
|
|
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td></td>
|
|
|
|
<td>
|
2012-09-17 10:01:51 +00:00
|
|
|
{% if user_perm == 'rw' %}
|
2012-09-17 02:32:31 +00:00
|
|
|
<div class="repo-file-op vh">
|
|
|
|
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" title="更多操作" alt="更多操作" class="more-op-icon" data="no-popup" />
|
2012-09-15 13:01:06 +00:00
|
|
|
<ul class="hidden-op hide">
|
|
|
|
<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">删除</a></li>
|
2012-09-20 06:29:02 +00:00
|
|
|
<li><a class="op dir-rename" href="#" data="{{ dirent.obj_name }}">重命名</a></li>
|
2012-09-15 13:01:06 +00:00
|
|
|
<li><a class="op dir-mv" href="#" data="{{ dirent.obj_name }}">移动</a></li>
|
|
|
|
<li><a class="op dir-cp" href="#" data="{{ dirent.obj_name }}">复制</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2012-09-17 10:01:51 +00:00
|
|
|
{% endif %}
|
2012-09-15 13:01:06 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for dirent in file_list %}
|
|
|
|
<tr>
|
|
|
|
<td class="icon-container"><img src="{{ MEDIA_URL }}img/file/{{ dirent.obj_name|file_icon_filter }}" alt="文件" /></td>
|
|
|
|
<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-09-15 13:01:06 +00:00
|
|
|
<a class="op" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}&op=download">下载</a>
|
2012-09-28 01:47:21 +00:00
|
|
|
{% if user_perm == 'rw' %}
|
2012-09-15 13:01:06 +00:00
|
|
|
<a class="op file-update" href="{{ SITE_ROOT }}repo/update_file/{{repo.id}}/?p={{ path|urlencode }}{{dirent.obj_name|urlencode}}">更新</a>
|
2012-09-28 01:47:21 +00:00
|
|
|
{% endif %}
|
2012-09-15 13:01:06 +00:00
|
|
|
</div>
|
2012-09-28 01:47:21 +00:00
|
|
|
{% if user_perm == 'rw' %}
|
2012-09-17 02:32:31 +00:00
|
|
|
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" title="更多操作" alt="更多操作" class="more-op-icon" data="no-popup" />
|
2012-09-15 13:01:06 +00:00
|
|
|
<ul class="hidden-op hide">
|
|
|
|
<!--li><a class="op" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}&op=download">下载</a></li-->
|
|
|
|
<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">删除</a></li>
|
2012-09-20 06:29:02 +00:00
|
|
|
<li><a class="op file-rename" href="#" data="{{ dirent.obj_name }}">重命名</a></li>
|
2012-09-15 13:01:06 +00:00
|
|
|
<li><a class="op file-mv" href="#" data="{{ dirent.obj_name }}">移动</a></li>
|
|
|
|
<li><a class="op file-cp" href="#" data="{{ dirent.obj_name }}">复制</a></li>
|
|
|
|
<!--li><a class="op file-update" href="{{ SITE_ROOT }}repo/update_file/{{repo.id}}/?p={{ path|urlencode }}{{dirent.obj_name|urlencode}}">更新</a></li-->
|
|
|
|
</ul>
|
2012-09-28 01:47:21 +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-09-07 03:01:44 +00:00
|
|
|
<form id="add-new-dir-form" action="" method="post" class="hide">{% csrf_token %}
|
2012-07-02 02:21:17 +00:00
|
|
|
<h4>新目录名称:</h4>
|
|
|
|
<input type="hidden" name="repo_id" value="{{ repo.id }}" />
|
|
|
|
<input type="hidden" name="parent_dir" value="{{ path }}" />
|
|
|
|
<input type="text" name="new_dir_name" value="" /><br />
|
2012-09-07 03:01:44 +00:00
|
|
|
<p class="error hide"></p>
|
2012-07-02 02:21:17 +00:00
|
|
|
<input type="submit" value="提交" class="submit" />
|
|
|
|
<button class="simplemodal-close">取消</button>
|
|
|
|
</form>
|
|
|
|
|
2012-09-07 03:01:44 +00:00
|
|
|
<form id="add-new-file-form" action="" method="post" class="hide">{% csrf_token %}
|
2012-08-11 06:07:12 +00:00
|
|
|
<h4>新文件名称:</h4>
|
|
|
|
<input type="hidden" name="repo_id" value="{{ repo.id }}" />
|
|
|
|
<input type="hidden" name="parent_dir" value="{{ path }}" />
|
|
|
|
<input type="text" name="new_file_name" value="" /><br />
|
2012-09-07 03:01:44 +00:00
|
|
|
<p class="error hide"></p>
|
2012-08-11 06:07:12 +00:00
|
|
|
<input type="submit" value="提交" class="submit" />
|
|
|
|
<button class="simplemodal-close">取消</button>
|
|
|
|
</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>
|
|
|
|
<div class="con">
|
2012-10-09 06:38:13 +00:00
|
|
|
<h4><span class="tri-bg tri-down-bg"></span>当前资料库:</h4>
|
2012-09-07 03:19:18 +00:00
|
|
|
<div id="current-repo-dirs"></div>
|
2012-10-09 06:38:13 +00:00
|
|
|
<h4><span class="tri-bg tri-right-bg"></span>其他资料库:</h4>
|
2012-09-06 11:50:04 +00:00
|
|
|
<div id="other-repos-dirs" class="hide"></div>
|
|
|
|
</div>
|
2012-07-02 02:21:17 +00:00
|
|
|
<input type="hidden" name="operation" id="operation" value="" />
|
|
|
|
<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="" />
|
|
|
|
<p class="error hide">请点击选择目标目录。</p>
|
|
|
|
<input type="submit" value="提交" class="submit" />
|
|
|
|
<button class="simplemodal-close">取消</button>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<form id="rename-form" action="{{ SITE_ROOT}}repo/file_rename/" method="post" class="hide">
|
2012-09-27 08:32:17 +00:00
|
|
|
<h3 id="rename-hd"></h3>
|
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="" />
|
|
|
|
<input type="text" name="newname" value="" class="new-name" /><br />
|
2012-09-07 03:01:44 +00:00
|
|
|
<p class="error hide"></p>
|
2012-07-02 02:21:17 +00:00
|
|
|
<input type="submit" value="提交" class="submit" />
|
|
|
|
<button class="simplemodal-close">取消</button>
|
|
|
|
</form>
|
2012-08-13 07:58:54 +00:00
|
|
|
{% with attach_type='dir' %}
|
|
|
|
{% include "snippets/group_recommend_form.html" %}
|
|
|
|
{% endwith %}
|
2012-08-10 05:28:35 +00:00
|
|
|
|
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>
|
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 () {
|
|
|
|
var type = $(this).hasClass('file-rename') ? '文件 ' : '目录 ',
|
|
|
|
name = $(this).attr('data');
|
2012-09-15 13:01:06 +00:00
|
|
|
newname = $('#rename-form input[name="newname"]');
|
2012-09-27 08:32:17 +00:00
|
|
|
$('#rename-hd').html( '将' + type + ' <span class="op-target">' + name + '</span> 重命名为:');
|
2012-09-15 13:01:06 +00:00
|
|
|
$('#rename-form input[name="oldname"]').val(name);
|
2012-07-02 02:21:17 +00:00
|
|
|
$('#rename-form').modal({appendTo:'#main'});
|
2012-09-15 13:01:06 +00:00
|
|
|
newname.before('<p class="hide">' + name + '</p>');
|
|
|
|
newname.val(name).css('width', newname.prev().width() + 3);
|
|
|
|
newname.prev().remove();
|
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')) {
|
|
|
|
$('#operation').val('cp');
|
|
|
|
mv_type = '复制';
|
|
|
|
} else {
|
|
|
|
$('#operation').val('mv');
|
|
|
|
mv_type = '移动';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($(this).hasClass('file-cp') || $(this).hasClass('file-mv')) {
|
|
|
|
file_type = '文件';
|
|
|
|
$('input[name="obj_type"]').val('file');
|
|
|
|
} else {
|
|
|
|
file_type = '目录';
|
|
|
|
$('input[name="obj_type"]').val('dir');
|
|
|
|
}
|
|
|
|
|
|
|
|
$('input[name="obj_name"]').val(obj_name);
|
2012-07-19 04:06:04 +00:00
|
|
|
$('#mv-hd').html('将' + file_type + ' <span class="op-target">' + obj_name + '</span> ' + mv_type + '到:');
|
2012-09-06 11:50:04 +00:00
|
|
|
$('#mv-form').modal({appendTo:'#main', autoResize:true});
|
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-09-06 11:50:04 +00:00
|
|
|
$('#mv-form h4').click(function() {
|
|
|
|
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-09-07 03:01:44 +00:00
|
|
|
$('#rename-form .submit').click(function() {
|
|
|
|
$.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(),
|
|
|
|
'newname': $('#rename-form input[name="newname"]').val()
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
if (data['success']) {
|
|
|
|
location.reload(true);
|
|
|
|
} else {
|
|
|
|
apply_form_error('rename-form', data['error']);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(data, textStatus, jqXHR) {
|
|
|
|
var errors = $.parseJSON(data.responseText);
|
|
|
|
$.each(errors, function(index, value) {
|
|
|
|
apply_form_error('rename-form', value[0]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#add-new-file-form .submit').click(function() {
|
|
|
|
$.ajax({
|
|
|
|
url: '{% url 'views.repo_new_file' %}',
|
|
|
|
type: 'POST',
|
|
|
|
dataType: 'json',
|
|
|
|
cache: 'false',
|
|
|
|
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(),
|
|
|
|
'new_file_name': $('#add-new-file-form input[name="new_file_name"]').val()
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
if (data['success']) {
|
|
|
|
location.reload(true);
|
|
|
|
} else {
|
|
|
|
apply_form_error('add-new-file-form', data['error']);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(data, textStatus, jqXHR) {
|
|
|
|
var errors = $.parseJSON(data.responseText);
|
|
|
|
$.each(errors, function(index, value) {
|
|
|
|
apply_form_error('add-new-file-form', value[0]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#add-new-dir-form .submit').click(function() {
|
|
|
|
$.ajax({
|
|
|
|
url: '{% url 'views.repo_new_dir' %}',
|
|
|
|
type: 'POST',
|
|
|
|
dataType: 'json',
|
|
|
|
cache: 'false',
|
|
|
|
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(),
|
|
|
|
'new_dir_name': $('#add-new-dir-form input[name="new_dir_name"]').val()
|
|
|
|
},
|
|
|
|
success: function(data) {
|
|
|
|
if (data['success']) {
|
|
|
|
location.reload(true);
|
|
|
|
} else {
|
|
|
|
apply_form_error('add-new-dir-form', data['error']);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(data, textStatus, jqXHR) {
|
|
|
|
var errors = $.parseJSON(data.responseText);
|
|
|
|
$.each(errors, function(index, value) {
|
|
|
|
apply_form_error('add-new-dir-form', value[0]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
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 () {
|
|
|
|
location.href = $(this).attr('data');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#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 () {
|
|
|
|
$('#add-new-file-form').modal({appendTo:'#main'});
|
|
|
|
});
|
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" %}
|
2012-09-12 09:11:27 +00:00
|
|
|
|
2011-10-18 07:41:48 +00:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|