diff --git a/media/css/seahub.css b/media/css/seahub.css index fb792e294b..52d5e17cd6 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -1,4 +1,4 @@ -body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,dl,dt,dd,blockquote,form,input,textarea,button,img { margin:0; padding:0; } +body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,dl,dt,dd,pre,blockquote,form,input,textarea,button,img { margin:0; padding:0; } ul > li { list-style:none; } a { color:#ee8833; text-decoration:none; font-weight:bold; } a:hover { color: #ff9933; text-decoration: underline; } @@ -26,12 +26,12 @@ input[type=checkbox] { input[type=submit], input.submit, button { - color: #080; + color: #333; height:23px; line-height:21px; padding:0 3px; - background: #EEE; - border: 1px solid #80B0B0; + background: #efefef; + border: 1px solid #ddd; border-radius: 3px; -moz-border-radius:3px; margin-top:8px; @@ -641,17 +641,42 @@ table img { } /* file preview */ -#file-content { - border: 1px solid #999; +.file-op { + color:#444; + margin-top:12px; + text-align:right; +} +.file-op a { + font-weight:normal; + margin-right:2px; +} +.file-op button { + color:#444; + margin-top:3px; +} +#file-view { + margin-top:20px; + padding:5px; + background:#dedede; + border-radius:3px; + -moz-border-radius:3px; +} +#docu-view { + word-wrap: break-word; + width:928px; padding: 5px; min-height: 200px; - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ + border: 1px solid #ccc; } -.img-preview { - max-width: 550px; - max-height: 550px; +#image-view { + padding:1px; + background:#fff; + border:1px solid #eee; +} +#docu-view, +#svg-view { + background:#fff; +} +#svg-view { + min-height:500px;/*for ff*/ } diff --git a/settings.py b/settings.py index 4d7d3ac3b6..47619b4903 100644 --- a/settings.py +++ b/settings.py @@ -149,8 +149,9 @@ FILEEXT_ICON_MAP = { FILE_PREVIEW_MAX_SIZE = 10 * 1024 * 1024 PREVIEW_FILEEXT = { - 'Document': ('ac', 'am', 'bat', 'c', 'cc', 'cmake', 'cpp', 'css', 'diff', 'h', 'htm', 'html', 'java', 'js', 'less', 'make', 'php', 'properties', 'py', 'rb', 'scala', 'script', 'sh', 'sql', 'txt', 'vi', 'vim', 'xml'), - 'Image': ('ai', 'bmp', 'eps', 'gif', 'ind', 'jpeg', 'jpg', 'png', 'ps', 'psd', 'svg', 'tif', 'tiff'), + 'Document': ('ac', 'am', 'bat', 'c', 'cc', 'cmake', 'cpp', 'css', 'diff', 'h', 'htm', 'html', 'xhtml', 'java', 'js', 'json', 'less', 'make', 'php', 'properties', 'py', 'rb', 'scala', 'script', 'sh', 'sql', 'txt','text', 'vi', 'vim', 'xml'), + 'Image': ('gif', 'jpeg', 'jpg', 'png'), + 'SVG':('svg',), } # Avatar diff --git a/templates/base.html b/templates/base.html index 34f53fe939..98af2b82d9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,4 @@ - + {{ seahub_title }} diff --git a/templates/repo_view_file.html b/templates/repo_view_file.html index a1580a3214..abef1b6f5c 100644 --- a/templates/repo_view_file.html +++ b/templates/repo_view_file.html @@ -12,58 +12,54 @@ {% endblock %} {% block main_panel %} -

- {{repo.props.name}} - {% if view_history %} - 历史浏览 - ({{ current_commit.props.ctime|tsstr_sec }}) +

+ {% if not view_history %} + {{ u_filename }} + {% else %} + {{repo.props.name}} 历史浏览({{ current_commit.props.ctime|tsstr_sec }}) {% endif %}

- -
-

操作

-

查看原始文件

-

查看所有历史版本

-

下载文件

+
+

+ 当前路径: + {% for name, link in zipped %} + {% if not forloop.last %} + {% if view_history %} + {{ name }} / {% else %} + {{ name }} / + {% endif %} + {% else %} + {{ name }} + {% endif %} + {% endfor %} +

- {% if not view_history %} -

共享

- - - {% endif %} +
+ 查看原始文件 + 下载文件 +
+ + {% if not view_history %} + {{ file_shared_link }} + + + + {% endif %} +
-
-

- 当前路径: - {% for name, link in zipped %} - {% if not forloop.last %} - {% if view_history %} - {{ name }} / - {% else %} - {{ name }} / - {% endif %} - {% else %} - {{ name }} - {% endif %} - {% endfor %} -

-
正在读取文件内容...
+
+

文件内容读取中...

{% endblock %} @@ -71,59 +67,58 @@ {% block extra_script %} {% endblock %} diff --git a/views.py b/views.py index 3a0445608b..f3143e967a 100644 --- a/views.py +++ b/views.py @@ -799,7 +799,8 @@ def repo_view_file(request, repo_id): path = request.GET.get('p', '/') if path[-1] == '/': path = path[:-1] - filename = urllib2.quote(os.path.basename(path).encode('utf-8')) + u_filename = os.path.basename(path) + filename = urllib2.quote(u_filename.encode('utf-8')) commit_id = request.GET.get('commit_id', '') view_history = True if commit_id else False @@ -872,6 +873,7 @@ def repo_view_file(request, repo_id): 'repo': repo, 'path': path, 'obj_id': obj_id, + 'u_filename': u_filename, 'file_name': filename, 'path': path, 'zipped': zipped,