1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-01 01:12:41 +00:00
seahub/templates/repo.html

394 lines
16 KiB
HTML
Raw Normal View History

2011-09-07 02:57:47 +00:00
{% extends "myhome_base.html" %}
2011-10-12 16:17:48 +00:00
{% load seahub_tags %}
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-05-04 13:36:36 +00:00
{% block main_panel %}
2012-07-03 13:48:33 +00:00
{% if view_history %}
<h2 class="subject">
{{repo.props.name}} 历史浏览
<span class="latest-commit-time-author">({{ current_commit.props.ctime|tsstr_sec }})</span>
</h2>
{% else %}
<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 %}
{{ current_commit.props.creator_name }}
{% 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 %}
<a href="{{ SITE_ROOT }}repo/history/{{repo.props.id}}/" class="more">(更多)</a>
{% 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 %}
{{ current_commit.props.creator_name }}
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 %}
<div class="repo-top-bar w100 ovhd">
<p class="path fleft">
当前路径:
{% 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 %}
{% else %}
{{ name }}
{% endif %}
{% endfor %}
</p>
{% if not view_history and request.user.is_authenticated %}
<div class="repo-op fright">
<a href="{{ SITE_ROOT }}repo/upload_file/{{repo.id}}/?p={{ path|urlencode }}" class="upload-file">上传</a>
<a id="add-new-dir" href="#">新建目录</a>
</div>
2012-07-03 13:48:33 +00:00
{% endif %}
</div>
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>
<th width="67%">名字</th>
2012-06-12 02:13:14 +00:00
<th width="13%">大小</th>
<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 %}
<td><a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a></td>
{% endif %}
2012-06-12 02:13:14 +00:00
<td></td>
<td>
{% if not view_history and request.user.is_authenticated %}
<div>
<img src="{{ MEDIA_URL }}img/more-option.png" alt="更多操作" class="more-op hide" />
<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 %}
</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-06-12 02:13:14 +00:00
<td class="icon-container"><img src="{{ MEDIA_URL }}img/{{ dirent.obj_name|file_icon_filter }}" alt="文件" /></td>
2012-07-05 11:29:56 +00:00
{% if view_history %}
<td><a class="op" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/view/{{ dirent.props.obj_id }}/?commit_id={{ current_commit.id }}&file_name={{ dirent.props.obj_name }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.props.obj_name }}</a></td>
{% else %}
<td><a class="op" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/view/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}&p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.props.obj_name }}</a></td>
{% endif %}
2012-06-12 02:13:14 +00:00
<td>{{ dirent.file_size|filesizeformat }}</td>
<td>
<div>
<img src="{{ MEDIA_URL }}img/more-option.png" alt="更多操作" class="more-op hide" />
<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>
{% if not view_history and request.user.is_authenticated %}
<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>
<li><a class="op file-update" href="{{ SITE_ROOT }}repo/update_file/{{repo.id}}/?p={{ path|urlencode }}{{dirent.obj_name|urlencode}}">更新</a></li>
<li><a class="op list-revisions" href="{{ SITE_ROOT }}repo/file_revisions/{{repo.id}}/?p={{ path|urlencode}}{{dirent.obj_name|urlencode}}">历史</a></li>
{% endif %}
</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>
<form id="add-new-dir-form" action="{{ SITE_ROOT}}repo/new_dir/" method="post" class="hide">
<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 />
<p class="error hide">输入不能为空。</p>
<input type="submit" value="提交" class="submit" />
<button class="simplemodal-close">取消</button>
</form>
<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>
2011-08-16 13:05:42 +00:00
{% endblock %}
2011-10-18 07:41:48 +00:00
{% block extra_script %}
<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">
$('#add-new-dir').click(function () {
$('#add-new-dir-form').modal({appendTo:'#main'});
return false;
});
$("table tr:gt(0)").hover(
function() {
$(this).find('.more-op').removeClass('hide');
},
function() {
$(this).find('.more-op').addClass('hide');
}
);
var Hide = '';
$('.more-op').hover(
function() {
$(this).parent().css('position','relative');
$('.op-list').attr('class', 'op-list hide');
if ($(this).offset().top + $(this).next().height() <= $('#main-panel').offset().top + $('#main-panel').height()) {
$(this).next().css('top', 6);
} else {
$(this).next().css('bottom', 2);
}
$(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');
}
);
$('.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
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);
$('#mv-hd').html('将 <span class="op-target">' + file_type + ' ' + obj_name + '</span> ' + mv_type + '到:');
$('#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});
})
.bind('after_open.jstree after_close.jstree set_focus.jstree', function(event, data) {
//resize the popup when open/close/focus a dir
2012-07-06 07:13:32 +00:00
$('#mv-form')
.css('max-height', window.innerHeight - parseInt($('#simplemodal-container').css('top')) - 57)
.css('overflow', 'auto');
$('#simplemodal-container')
.css('height', $('#mv-form').height())
.css('width', $('#mv-form').width());
})
.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('/') + '/';
}
return '{{ SITE_ROOT }}file/move/get_subdir/?repo_id=' + e(repo_id) + '&path=' + e(path);
}
}
},
'core': {
'animation': 100
},
'plugins': ['themes', 'json_data', 'ui']
});
return false;
});
$('#add-new-dir-form .submit, #rename-form .submit').click(function() {
if (!$.trim($(this).prev().prev().prev().val())) {//if the input is empty
$(this).prev().removeClass('hide');//show error msg
$('#simplemodal-container').css('height', $(this).parent().height()).css('width', $(this).parent().width());
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
$('#simplemodal-container').css('height', $(this).parent().height()).css('width', $(this).parent().width());
return false;
}
});
2011-10-18 07:41:48 +00:00
</script>
{% endblock %}