2012-07-11 22:39:36 +08:00
|
|
|
{% extends "myhome_base.html" %}
|
2012-11-10 12:03:25 +08:00
|
|
|
{% load seahub_tags i18n %}
|
2012-07-11 22:39:36 +08:00
|
|
|
|
2012-10-17 22:06:12 +08:00
|
|
|
{% block extra_style %}
|
2012-12-14 19:56:27 +08:00
|
|
|
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/file_view_extra.css" />
|
2012-11-28 15:24:11 +08:00
|
|
|
{% if filetype == 'Text' %}
|
2012-10-17 22:06:12 +08:00
|
|
|
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}codemirror/codemirror.css" />
|
2012-12-14 19:56:27 +08:00
|
|
|
{% if fileext == 'txt' or fileext == 'text' %}
|
|
|
|
<style type="text/css">
|
|
|
|
.CodeMirror {
|
|
|
|
width:624px;
|
|
|
|
padding:40px 96px;
|
|
|
|
}
|
|
|
|
</style>
|
2012-11-28 15:24:11 +08:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2012-10-17 22:06:12 +08:00
|
|
|
{% endblock %}
|
|
|
|
|
2012-07-11 22:39:36 +08:00
|
|
|
{% block main_panel %}
|
2012-11-28 15:24:11 +08:00
|
|
|
<h2 id="view-hd">{{ file_name }}</h2>
|
2012-08-10 21:35:58 +08:00
|
|
|
<div id="file">
|
2012-08-15 10:44:15 +08:00
|
|
|
<div id="file-op">
|
2012-11-28 15:24:11 +08:00
|
|
|
<p class="fleft">{% trans "Shared by: " %}{{ username }}</p>
|
|
|
|
|
2012-09-24 15:29:24 +08:00
|
|
|
{% if filetype == 'Text' or filetype == 'Image' or filetype == 'SVG' or filetype == 'Markdown' %}
|
2012-11-10 12:03:25 +08:00
|
|
|
<button data="{{ SITE_ROOT }}repo/{{ repo.id }}/{{ obj_id }}/?file_name={{ file_name }}&op=view&t={{ shared_token }}" id="view-original">{% trans "Raw" %}</button>
|
2012-09-24 15:29:24 +08:00
|
|
|
{% endif %}
|
2012-11-28 15:24:11 +08:00
|
|
|
|
2012-11-10 12:03:25 +08:00
|
|
|
<button data="{{ SITE_ROOT }}repo/{{ repo.id }}/{{ obj_id }}/?file_name={{ file_name }}&op=download&t={{ shared_token }}" id="download">{% trans "Download" %}</button>
|
2012-08-10 21:35:58 +08:00
|
|
|
</div>
|
|
|
|
<div id="file-view">
|
2012-11-20 16:28:33 +08:00
|
|
|
{% if filetype == 'Text' or filetype == 'Sf' %}
|
2012-09-13 16:36:23 +08:00
|
|
|
{% ifnotequal file_content None %}
|
2012-11-20 16:28:33 +08:00
|
|
|
{% if filetype == 'Text' %}
|
2012-09-13 16:36:23 +08:00
|
|
|
<textarea id="docu-view" class="vh">{{ file_content|escape }}</textarea>
|
2012-11-20 16:28:33 +08:00
|
|
|
{% else %}
|
2012-11-28 15:24:11 +08:00
|
|
|
<div id="sf" class="article">{{ file_content|safe }}</div>
|
2012-11-20 16:28:33 +08:00
|
|
|
{% endif %}
|
2012-09-13 16:36:23 +08:00
|
|
|
{% endifnotequal %}
|
|
|
|
{% endif %}
|
2012-07-14 15:19:09 +08:00
|
|
|
</div>
|
2012-07-11 22:39:36 +08:00
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block extra_script %}
|
2012-07-31 16:48:55 +08:00
|
|
|
{% include "snippets/file_view_js.html" %}
|
2012-07-11 22:39:36 +08:00
|
|
|
<script type="text/javascript">
|
2012-08-10 21:35:58 +08:00
|
|
|
$('#view-original, #download').click(function() {
|
|
|
|
window.open($(this).attr('data'));
|
|
|
|
});
|
2012-12-14 19:56:27 +08:00
|
|
|
{% include "snippets/repo_file_get.html" %}
|
2012-07-11 22:39:36 +08:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|