2012-07-26 09:08:31 +00:00
|
|
|
|
{% extends base_template %}
|
|
|
|
|
|
2011-10-12 16:17:48 +00:00
|
|
|
|
{% load seahub_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 %}
|
|
|
|
|
<div id="info-bar">
|
|
|
|
|
<span class="info">当前链接会在短期内失效,欢迎您 <a href="http://seafile.com/" target="_blank">加入Seafile </a>体验更多功能。</span>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2012-08-13 07:58:54 +00:00
|
|
|
|
{% block right_panel %}
|
|
|
|
|
{% if messages %}
|
2012-08-14 05:27:27 +00:00
|
|
|
|
{% autoescape off %}
|
2012-08-13 09:40:27 +00:00
|
|
|
|
<ul class="messages hide">
|
2012-08-13 07:58:54 +00:00
|
|
|
|
{% for message in messages %}
|
2012-08-13 09:40:27 +00:00
|
|
|
|
<li class="info">{{ message }}</li>
|
2012-08-13 07:58:54 +00:00
|
|
|
|
{% endfor %}
|
|
|
|
|
</ul>
|
2012-08-14 05:27:27 +00:00
|
|
|
|
{% endautoescape %}
|
2012-08-13 07:58:54 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
2012-05-04 13:36:36 +00:00
|
|
|
|
{% block main_panel %}
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% if view_history %}
|
2012-07-18 02:57:09 +00:00
|
|
|
|
<h2>{{repo.props.name}} 历史浏览<span class="latest-commit-time-author">({{ current_commit.props.ctime|tsstr_sec }})</span></h2>
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% else %}
|
2012-07-02 02:21:17 +00:00
|
|
|
|
<h2>{{repo.props.name}}</h2>
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% endif %}
|
2012-05-29 09:26:00 +00:00
|
|
|
|
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% if view_history %}
|
|
|
|
|
<div class="side fright">
|
|
|
|
|
{% if can_access %}
|
|
|
|
|
<div class="latest-commit">
|
|
|
|
|
<h3>修改信息</h3>
|
|
|
|
|
<p>{{ current_commit.props.desc|translate_commit_desc }}</p>
|
|
|
|
|
<p class="al-rt">
|
|
|
|
|
<span class="author">by
|
|
|
|
|
{% if current_commit.props.creator_name %}
|
2012-07-23 09:00:58 +00:00
|
|
|
|
{{ current_commit.props.creator_name|short_email }}
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% else %}
|
|
|
|
|
未知
|
|
|
|
|
{% endif %}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
<h3>操作</h3>
|
|
|
|
|
<ul class="with-bg">
|
|
|
|
|
<li><a href="{{ SITE_ROOT }}repo/history/{{ repo.id }}/">返回历史列表</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
{% else %}
|
2012-05-05 05:57:42 +00:00
|
|
|
|
<div class="side fright">
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<h3>基本信息</h3>
|
|
|
|
|
<p>{{repo.props.desc}}</p>
|
|
|
|
|
<p>大小:{{ repo_size|filesizeformat }}</p>
|
|
|
|
|
|
|
|
|
|
{% if not repo.props.encrypted or password_set %}
|
|
|
|
|
{% if can_access %}
|
|
|
|
|
<div class="latest-commit">
|
2012-06-20 13:38:07 +00:00
|
|
|
|
<h3>最新修改
|
|
|
|
|
{% if request.user.is_authenticated %}
|
2012-08-13 07:58:54 +00:00
|
|
|
|
<a href="{% url 'seahub.views.repo_history' repo.id %}" class="more">(更多)</a>
|
2012-06-20 13:38:07 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
</h3>
|
2012-07-03 13:48:33 +00:00
|
|
|
|
<p>{{ current_commit.props.desc|translate_commit_desc }}</p>
|
2012-05-29 07:38:44 +00:00
|
|
|
|
<p class="al-rt">
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<span class="author">by
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% if current_commit.props.creator_name %}
|
2012-07-23 09:04:51 +00:00
|
|
|
|
{{ current_commit.props.creator_name|short_email }}
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% else %}
|
|
|
|
|
未知
|
|
|
|
|
{% endif %}
|
|
|
|
|
</span>
|
2012-07-03 13:48:33 +00:00
|
|
|
|
<span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span>
|
2012-05-29 07:38:44 +00:00
|
|
|
|
</p>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endif %}
|
2012-05-04 13:36:36 +00:00
|
|
|
|
</div>
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
|
2012-05-05 05:57:42 +00:00
|
|
|
|
<div class="main fleft">
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% if repo.props.encrypted and not password_set %}
|
|
|
|
|
<p class="access-notice">该目录已加密。如需在线查看里面的内容,请输入解密密码。密码只会在服务器上暂存1小时。</p>
|
|
|
|
|
<form action="{{ SITE_ROOT }}repo/{{ repo.id }}/" method="post">
|
|
|
|
|
<label>密码:</label>
|
|
|
|
|
<input id="id_password" type="password" name="password" maxlength="64" /><br />
|
|
|
|
|
{% if error %}
|
|
|
|
|
<p class="error">{{ error }}</p>
|
|
|
|
|
{% endif %}
|
|
|
|
|
<input type="submit" value="提交" />
|
|
|
|
|
</form>
|
2012-05-29 09:26:00 +00:00
|
|
|
|
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% else %}
|
|
|
|
|
{% if not can_access %}
|
|
|
|
|
<p class="access-notice">无法在线查看该同步目录。</p>
|
|
|
|
|
{% else %}
|
2012-07-25 06:28:28 +00:00
|
|
|
|
<p class="path">
|
2012-07-02 02:21:17 +00:00
|
|
|
|
当前路径:
|
|
|
|
|
{% for name, link in zipped %}
|
|
|
|
|
{% if not forloop.last %}
|
2012-07-05 11:29:56 +00:00
|
|
|
|
{% if view_history %}
|
|
|
|
|
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?commit_id={{ current_commit.id }}&p={{ link|urlencode }}">{{ name }}</a> /
|
|
|
|
|
{% else %}
|
|
|
|
|
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}">{{ name }}</a> /
|
|
|
|
|
{% endif %}
|
2012-07-02 02:21:17 +00:00
|
|
|
|
{% else %}
|
|
|
|
|
{{ name }}
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</p>
|
2012-07-05 06:39:28 +00:00
|
|
|
|
{% if not view_history and request.user.is_authenticated %}
|
2012-07-25 06:28:28 +00:00
|
|
|
|
<div class="repo-op">
|
2012-07-24 08:22:45 +00:00
|
|
|
|
<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>
|
2012-08-11 06:07:12 +00:00
|
|
|
|
<button id="add-new-file" class="op-btn">新建文件</button>
|
2012-07-02 02:21:17 +00:00
|
|
|
|
</div>
|
2012-07-03 13:48:33 +00:00
|
|
|
|
{% endif %}
|
2012-07-02 02:21:17 +00:00
|
|
|
|
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<table>
|
2012-05-29 09:26:00 +00:00
|
|
|
|
<tr>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<th width="5%"></th>
|
2012-07-02 02:21:17 +00:00
|
|
|
|
<th width="67%">名字</th>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<th width="13%">大小</th>
|
2012-07-02 02:21:17 +00:00
|
|
|
|
<th width="15%">操作</th>
|
2012-05-29 09:26:00 +00:00
|
|
|
|
</tr>
|
2012-05-19 13:01:21 +00:00
|
|
|
|
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% for dirent in dir_list %}
|
2012-05-29 09:26:00 +00:00
|
|
|
|
<tr>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<td class="icon-container"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="目录" /></td>
|
2012-07-05 11:29:56 +00:00
|
|
|
|
{% if view_history %}
|
|
|
|
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?commit_id={{ current_commit.id }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a></td>
|
|
|
|
|
{% else %}
|
2012-08-10 05:28:35 +00:00
|
|
|
|
<td>
|
|
|
|
|
<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a>
|
|
|
|
|
</td>
|
2012-07-05 11:29:56 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<td></td>
|
2012-07-02 02:21:17 +00:00
|
|
|
|
<td>
|
2012-07-05 06:39:28 +00:00
|
|
|
|
{% if not view_history and request.user.is_authenticated %}
|
2012-07-04 09:06:25 +00:00
|
|
|
|
<div>
|
2012-07-20 06:33:33 +00:00
|
|
|
|
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" alt="更多操作" class="more-op hide" />
|
2012-07-04 09:06:25 +00:00
|
|
|
|
<ul class="op-list 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>
|
|
|
|
|
<li><a class="op dir-rename" href="#" data="{{ dirent.obj_name }}">重命名</a></li>
|
|
|
|
|
<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-07-03 13:48:33 +00:00
|
|
|
|
{% endif %}
|
2012-07-02 02:21:17 +00:00
|
|
|
|
</td>
|
2012-05-29 09:26:00 +00:00
|
|
|
|
</tr>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% endfor %}
|
2012-05-19 13:01:21 +00:00
|
|
|
|
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% for dirent in file_list %}
|
2012-05-29 09:26:00 +00:00
|
|
|
|
<tr>
|
2012-07-19 04:24:07 +00:00
|
|
|
|
<td class="icon-container"><img src="{{ MEDIA_URL }}img/file/{{ dirent.obj_name|file_icon_filter }}" alt="文件" /></td>
|
2012-07-05 11:29:56 +00:00
|
|
|
|
{% if view_history %}
|
2012-07-11 14:39:36 +00:00
|
|
|
|
<td><a class="op" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/files/?obj_id={{ dirent.props.obj_id }}&commit_id={{ current_commit.id }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.props.obj_name }}</a></td>
|
2012-07-05 11:29:56 +00:00
|
|
|
|
{% else %}
|
2012-08-10 05:28:35 +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>
|
2012-07-05 11:29:56 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
|
2012-06-12 02:13:14 +00:00
|
|
|
|
<td>{{ dirent.file_size|filesizeformat }}</td>
|
|
|
|
|
<td>
|
2012-07-04 09:06:25 +00:00
|
|
|
|
<div>
|
2012-07-20 06:33:33 +00:00
|
|
|
|
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" alt="更多操作" class="more-op hide" />
|
2012-07-04 09:06:25 +00:00
|
|
|
|
<ul class="op-list 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>
|
2012-07-05 06:39:28 +00:00
|
|
|
|
{% if not view_history and request.user.is_authenticated %}
|
2012-07-04 09:06:25 +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">删除</a></li>
|
|
|
|
|
<li><a class="op file-rename" href="#" data="{{ dirent.obj_name }}">重命名</a></li>
|
|
|
|
|
<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>
|
2012-07-13 09:19:44 +00:00
|
|
|
|
<li><a class="op file-update" href="{{ SITE_ROOT }}repo/update_file/{{repo.id}}/?p={{ path|urlencode }}{{dirent.obj_name|urlencode}}">更新</a></li>
|
2012-07-04 09:06:25 +00:00
|
|
|
|
{% endif %}
|
2012-08-14 10:40:36 +00:00
|
|
|
|
{% if view_history and request.user.is_authenticated %}
|
|
|
|
|
<li><a href="{{ SITE_ROOT }}repo/revert_file/{{ repo.id }}/?commit={{ current_commit.id }}&p={{path|urlencode}}{{ dirent.obj_name|urlencode }}" class="op file-revert">还原</a></li>
|
|
|
|
|
{% endif %}
|
2012-07-04 09:06:25 +00:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
</td>
|
2012-05-29 09:26:00 +00:00
|
|
|
|
</tr>
|
2012-06-12 02:13:14 +00:00
|
|
|
|
{% endfor %}
|
|
|
|
|
</table>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% endif %}
|
2012-05-04 13:36:36 +00:00
|
|
|
|
</div>
|
2012-07-02 02:21:17 +00:00
|
|
|
|
|
2012-08-08 09:14:04 +00:00
|
|
|
|
{% if not view_history %}
|
2012-08-13 07:24:31 +00:00
|
|
|
|
<form id="add-new-dir-form" action="{{ SITE_ROOT}}repo/new_dir/" 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-08-13 07:24:31 +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 02:52:14 +00:00
|
|
|
|
<form id="add-new-file-form" action="{{ SITE_ROOT}}repo/new_file/" 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-08-13 07:24:31 +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">
|
|
|
|
|
<p id="mv-hd"></p>
|
|
|
|
|
<div id="dirs"></div>
|
|
|
|
|
<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">
|
|
|
|
|
<p>将 <span id="rename-target" class="op-target"></span> 重命名为:</p>
|
|
|
|
|
<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 />
|
|
|
|
|
<p class="error hide">输入不能为空。</p>
|
|
|
|
|
<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-08 09:14:04 +00:00
|
|
|
|
{% endif %}
|
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-08-08 09:14:04 +00:00
|
|
|
|
{% if not view_history %}
|
2012-07-02 02:21:17 +00:00
|
|
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}jstree_pre1.0_stable/jquery.jstree.js"></script>
|
2012-08-08 09:14:04 +00:00
|
|
|
|
{% endif %}
|
2011-10-18 07:41:48 +00:00
|
|
|
|
<script type="text/javascript">
|
2012-07-02 02:21:17 +00:00
|
|
|
|
$("table tr:gt(0)").hover(
|
|
|
|
|
function() {
|
|
|
|
|
$(this).find('.more-op').removeClass('hide');
|
|
|
|
|
},
|
|
|
|
|
function() {
|
|
|
|
|
$(this).find('.more-op').addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2012-07-18 02:57:09 +00:00
|
|
|
|
$('#main-panel').removeClass('ovhd');
|
2012-07-02 02:21:17 +00:00
|
|
|
|
var Hide = '';
|
|
|
|
|
$('.more-op').hover(
|
|
|
|
|
function() {
|
|
|
|
|
$(this).parent().css('position','relative');
|
|
|
|
|
$('.op-list').attr('class', 'op-list hide');
|
2012-07-18 02:57:09 +00:00
|
|
|
|
if ($(this).offset().top + $(this).next().height() <= $('#main').offset().top + $('#main').height()) {
|
2012-07-04 09:06:25 +00:00
|
|
|
|
$(this).next().css('top', 6);
|
|
|
|
|
} else {
|
|
|
|
|
$(this).next().css('bottom', 2);
|
2012-07-02 02:21:17 +00:00
|
|
|
|
}
|
|
|
|
|
$(this).next().removeClass('hide');
|
|
|
|
|
clearTimeout(Hide);
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
function() {
|
|
|
|
|
var op_list = $(this).next();
|
|
|
|
|
Hide = setTimeout(function() { op_list.addClass('hide'); }, 1000);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$('.op-list').hover(
|
|
|
|
|
function(){
|
|
|
|
|
clearTimeout(Hide);
|
|
|
|
|
},
|
|
|
|
|
function(){
|
|
|
|
|
$(this).addClass('hide');
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$('.op-list li').hover(
|
|
|
|
|
function() {
|
|
|
|
|
$(this).css('background', '#eee');
|
|
|
|
|
},
|
|
|
|
|
function() {
|
|
|
|
|
$(this).css('background', '#fff');
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2012-08-08 09:14:04 +00:00
|
|
|
|
{% if not view_history %}
|
2012-07-02 02:21:17 +00:00
|
|
|
|
$('.file-rename, .dir-rename').click(function () {
|
|
|
|
|
var type = $(this).hasClass('file-rename') ? '文件 ' : '目录 ',
|
|
|
|
|
name = $(this).attr('data');
|
|
|
|
|
$('#rename-target').html(type + name);
|
|
|
|
|
$('input[name="oldname"]').val(name);
|
|
|
|
|
$('#rename-form').modal({appendTo:'#main'});
|
|
|
|
|
return false;
|
|
|
|
|
});
|
2012-07-11 09:47:08 +00:00
|
|
|
|
|
2012-07-02 02:21:17 +00:00
|
|
|
|
var accessible_repos = [];
|
|
|
|
|
{% for repo in accessible_repos %}
|
|
|
|
|
{% if repo.props.has_subdir %}
|
|
|
|
|
accessible_repos.push({
|
|
|
|
|
'data': '{{ repo.props.name }}',
|
|
|
|
|
'attr': {'repo_id': '{{ repo.props.id }}'},
|
|
|
|
|
'state': 'closed'
|
|
|
|
|
});
|
|
|
|
|
{% else %}
|
|
|
|
|
accessible_repos.push({
|
|
|
|
|
'data': '{{ repo.props.name }}',
|
|
|
|
|
'attr': {'repo_id': '{{ repo.props.id }}'}
|
|
|
|
|
});
|
|
|
|
|
{% 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-07-02 02:21:17 +00:00
|
|
|
|
|
|
|
|
|
$('#dirs')
|
|
|
|
|
.bind('loaded.jstree', function(event,data) {
|
2012-07-05 11:52:02 +00:00
|
|
|
|
$('#mv-form').modal({appendTo:'#main', maxHeight: window.innerHeight - 57, autoResize:true});
|
2012-07-02 02:21:17 +00:00
|
|
|
|
})
|
|
|
|
|
.bind('after_open.jstree after_close.jstree set_focus.jstree', function(event, data) {
|
2012-07-19 13:17:50 +00:00
|
|
|
|
$('#mv-form').css({'max-height': window.innerHeight - parseInt($('#simplemodal-container').css('top')) - 57, 'max-width':window.innerWidth - $('#mv-form').offset().left - 40, 'overflow': 'auto'});
|
|
|
|
|
$('#simplemodal-container').css('height', $('#mv-form').height());
|
|
|
|
|
})
|
|
|
|
|
.bind('after_open.jstree set_focus.jstree', function(event,data) {
|
|
|
|
|
if ($('#mv-form').width() < $('#mv-form')[0].scrollWidth) {
|
|
|
|
|
$('#simplemodal-container').css('width', $('#mv-form')[0].scrollWidth + 15);
|
|
|
|
|
}
|
2012-07-19 04:06:04 +00:00
|
|
|
|
})
|
2012-07-02 02:21:17 +00:00
|
|
|
|
.bind('select_node.jstree', function(event,data) {
|
|
|
|
|
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': {
|
|
|
|
|
'data': accessible_repos,
|
|
|
|
|
'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']
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2012-08-11 06:07:12 +00:00
|
|
|
|
$('#add-new-dir-form .submit, #add-new-file-form .submit, #rename-form .submit').click(function() {
|
2012-07-02 02:21:17 +00:00
|
|
|
|
if (!$.trim($(this).prev().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;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$('#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-08-13 05:02:32 +00:00
|
|
|
|
$('#upload-file, #add-new-dir, #add-new-file').hover(
|
2012-08-08 09:14:04 +00:00
|
|
|
|
function() {
|
|
|
|
|
$(this).css({'background-color': '#fff', 'cursor': 'pointer'});
|
|
|
|
|
},
|
|
|
|
|
function() {
|
|
|
|
|
$(this).css('background-color', '#f5f5f5');
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
{% include "snippets/bottom_bar.html" %}
|
|
|
|
|
{% endif %}
|
2011-10-18 07:41:48 +00:00
|
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|