Add file icon
@@ -1,7 +1,7 @@
|
||||
from datetime import datetime
|
||||
from django import template
|
||||
|
||||
from seahub.settings import SUPPORTED_FILE_EXT
|
||||
from seahub.settings import FILEEXT_ICON_MAP
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@@ -21,7 +21,7 @@ def file_icon_filter(value):
|
||||
else:
|
||||
file_ext = None
|
||||
|
||||
if file_ext and SUPPORTED_FILE_EXT.has_key(file_ext):
|
||||
return SUPPORTED_FILE_EXT.get(file_ext)
|
||||
if file_ext and FILEEXT_ICON_MAP.has_key(file_ext):
|
||||
return FILEEXT_ICON_MAP.get(file_ext)
|
||||
else:
|
||||
return SUPPORTED_FILE_EXT.get('default')
|
||||
return FILEEXT_ICON_MAP.get('default')
|
||||
|
BIN
media/img/File-Music-icon-24.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
media/img/File-Pictures-icon-24.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
media/img/File-icon-default-24.png
Normal file
After Width: | Height: | Size: 916 B |
BIN
media/img/Files-Music-File-icon2-24.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
media/img/document-excel-icon-24.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
media/img/document-pdf-icon-24.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
media/img/document-powerpoint-icon-24.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
media/img/document-word-icon-24.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
media/img/file-extension-pdf-icon-24.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
21
settings.py
@@ -131,10 +131,23 @@ SEAFILE_VERSION = '0.9.2'
|
||||
|
||||
# Add supported file extensions and file icon name.
|
||||
# Icons will show in repo page.
|
||||
SUPPORTED_FILE_EXT = {
|
||||
'txt' : 'foo.jpg',
|
||||
'pdf' : '',
|
||||
'default' : '',
|
||||
FILEEXT_ICON_MAP = {
|
||||
# pdf file
|
||||
'pdf' : 'file-extension-pdf-icon-24.png',
|
||||
# document file
|
||||
'doc' : 'document-word-icon-24.png',
|
||||
'docx' : 'document-word-icon-24.png',
|
||||
# ppt file
|
||||
'ppt' : 'document-powerpoint-icon-24.png',
|
||||
'pptx' : 'document-powerpoint-icon-24.png',
|
||||
# music file
|
||||
'mp3' : 'File-Music-icon-24.png',
|
||||
# picture file
|
||||
'jpg' : 'File-Pictures-icon-24.png',
|
||||
'jpeg' : 'File-Pictures-icon-24.png',
|
||||
'png' : 'File-Pictures-icon-24.png',
|
||||
# normal file and unkown file
|
||||
'default' : 'File-icon-default-24.png',
|
||||
}
|
||||
|
||||
try:
|
||||
|
@@ -46,16 +46,19 @@
|
||||
{% else %}
|
||||
<table>
|
||||
<tr>
|
||||
<th width="70%">名字</th>
|
||||
<th width="5%"></th>
|
||||
<th width="65%">名字</th>
|
||||
<th width="30%">操作</th>
|
||||
</tr>
|
||||
|
||||
{% for dirent in dirs %}
|
||||
<tr>
|
||||
{% if dirent.is_dir %}
|
||||
<td><img src="{{ MEDIA_URL }}/img/favicon.png" /></td>
|
||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/?root_id={{ dirent.props.obj_id }}">{{ dirent.props.obj_name }}</a></td>
|
||||
<td></td>
|
||||
{% else %}
|
||||
<td><img src="{{ MEDIA_URL }}/img/{{ dirent.obj_name|file_icon_filter }}" /></td>
|
||||
<td>{{ dirent.props.obj_name }}</td>
|
||||
<td>
|
||||
<a class="table-op" href="{{ SITE_ROOT }}repo/view/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}">查看</a>
|
||||
|