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 %}
|
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-08-13 07:58:54 +00:00
|
|
|
|
{% 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 %}
|
|
|
|
|
|
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-09-06 03:39:00 +00:00
|
|
|
|
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" alt="更多操作" class="more-op vh" data="no-popup" />
|
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-09-06 03:39:00 +00:00
|
|
|
|
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" alt="更多操作" class="more-op vh" data="no-popup" />
|
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 %}
|
2012-09-07 02:58:42 +00:00
|
|
|
|
<li><a href="{{ SITE_ROOT }}repo/revert_file/{{ repo.id }}/?commit={{ current_commit.id }}&p={{path|urlencode}}{{ dirent.obj_name|urlencode }}&from=repo_history" class="op file-revert">还原</a></li>
|
2012-08-14 10:40:36 +00:00
|
|
|
|
{% 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-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-09-07 03:19:18 +00:00
|
|
|
|
<h4><span class="tri-bg tri-down-bg"></span>当前同步目录:</h4>
|
|
|
|
|
<div id="current-repo-dirs"></div>
|
2012-09-06 11:50:04 +00:00
|
|
|
|
<h4><span class="tri-bg tri-right-bg"></span>其他同步目录:</h4>
|
|
|
|
|
<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">
|
|
|
|
|
<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 />
|
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-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() {
|
2012-09-05 08:37:14 +00:00
|
|
|
|
$(this).find('.more-op').removeClass('vh');
|
2012-07-02 02:21:17 +00:00
|
|
|
|
},
|
|
|
|
|
function() {
|
2012-09-05 08:37:14 +00:00
|
|
|
|
$(this).find('.more-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-05 08:37:14 +00:00
|
|
|
|
var clicked_more_op;
|
|
|
|
|
$('.more-op').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-07 02:44:12 +00:00
|
|
|
|
clicked_more_op = $(this);
|
2012-07-02 02:21:17 +00:00
|
|
|
|
$(this).parent().css('position','relative');
|
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
|
|
|
|
$('.op-list').addClass('hide');
|
|
|
|
|
its_op_list.removeClass('hide');
|
2012-09-06 03:39:00 +00:00
|
|
|
|
$(this).attr('data','');
|
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-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-06 11:50:04 +00:00
|
|
|
|
if (clicked_more_op && target != clicked_more_op[0]) {
|
2012-09-05 08:37:14 +00:00
|
|
|
|
clicked_more_op.next().addClass('hide');
|
2012-09-06 03:39:00 +00:00
|
|
|
|
clicked_more_op.attr('data','no-popup');
|
2012-07-02 02:21:17 +00:00
|
|
|
|
}
|
2012-09-05 08:37:14 +00:00
|
|
|
|
});
|
2012-07-02 02:21:17 +00:00
|
|
|
|
$('.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);
|
2012-09-02 12:10:49 +00:00
|
|
|
|
$('input[name="newname"]').val(name);
|
2012-07-02 02:21:17 +00:00
|
|
|
|
$('#rename-form').modal({appendTo:'#main'});
|
|
|
|
|
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-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 %}
|