diff --git a/base/context_processors.py b/base/context_processors.py index 4546ad231d..4294c2b5eb 100644 --- a/base/context_processors.py +++ b/base/context_processors.py @@ -13,6 +13,11 @@ try: except ImportError: BUSINESS_MODE = False +try: + from settings import ENABLE_FILE_SEARCH +except ImportError: + ENABLE_FILE_SEARCH = False + def base(request): """ Add seahub base configure to the context. @@ -37,5 +42,6 @@ def base(request): 'site_name': SITE_NAME, 'enable_signup': ENABLE_SIGNUP, 'max_file_name': MAX_FILE_NAME, + 'enable_file_search': ENABLE_FILE_SEARCH, } diff --git a/base/models.py b/base/models.py index d075524780..7b086ef184 100644 --- a/base/models.py +++ b/base/models.py @@ -181,4 +181,17 @@ class DirFilesLastModifiedInfo(models.Model): last_modified_info = models.TextField() class Meta: - unique_together = ('repo_id', 'parent_dir_hash') \ No newline at end of file + unique_together = ('repo_id', 'parent_dir_hash') + +class FileLastModifiedInfo(models.Model): + repo_id = models.CharField(max_length=36, db_index=True) + file_id = models.CharField(max_length=40) + + file_path = models.TextField() + file_path_hash = models.CharField(max_length=12) + + last_modified = models.BigIntegerField() + email = models.EmailField() + + class Meta: + unique_together = ('repo_id', 'file_path_hash') \ No newline at end of file diff --git a/media/css/seahub.css b/media/css/seahub.css index 4e1480575e..c0719b1926 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -1971,6 +1971,41 @@ textarea:-moz-placeholder {/* for FF */ background:#f7f7f8; border-radius:2px; } + #search-results { padding-top:15px; +} + +#search-results a { + font-weight: normal; +} + +#search-results b { + font-weight: bold; +} + +.search-results-item { + margin-top: 20px; + clear: left; +} + +.search-results-item .file-icon { + display: block; + float: left; +} + +.search-results-item .title { + margin: 0 0 0 40px; +} + +.search-results-item .title a, +.search-results-item .title img, +.search-results-item .title span +{ + vertical-align: middle; +} + +.search-results-item .content { + clear: left; + margin: 0 0 0 40px; } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 359d71c739..8ed2360354 100644 --- a/templates/base.html +++ b/templates/base.html @@ -87,7 +87,7 @@ {% block nav %}{% endblock %} - {% if request.user.is_authenticated %} + {% if enable_file_search and request.user.is_authenticated %}