2012-05-03 10:52:43 +08:00
|
|
|
"""
|
|
|
|
A set of request processors that return dictionaries to be merged into a
|
|
|
|
template context. Each function takes the request object as its only parameter
|
|
|
|
and returns a dictionary to add to the context.
|
|
|
|
|
|
|
|
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
|
|
|
RequestContext.
|
|
|
|
"""
|
2013-05-02 19:27:17 +08:00
|
|
|
from seahub.settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, SITE_BASE, \
|
2013-10-14 19:42:04 +08:00
|
|
|
ENABLE_SIGNUP, MAX_FILE_NAME, BRANDING_CSS, LOGO_PATH, LOGO_URL, KEEP_ENC_REPO_PASSWD
|
2012-09-18 14:04:47 +08:00
|
|
|
try:
|
2013-05-02 19:27:17 +08:00
|
|
|
from seahub.settings import BUSINESS_MODE
|
2012-09-18 14:04:47 +08:00
|
|
|
except ImportError:
|
|
|
|
BUSINESS_MODE = False
|
2013-03-17 15:43:33 +08:00
|
|
|
try:
|
|
|
|
from seahub.settings import SEACLOUD_MODE
|
|
|
|
except ImportError:
|
|
|
|
SEACLOUD_MODE = False
|
2012-05-03 10:52:43 +08:00
|
|
|
|
2013-05-29 12:13:02 +08:00
|
|
|
from seahub.utils import HAS_FILE_SEARCH
|
2013-03-09 14:15:53 +08:00
|
|
|
|
2013-05-21 21:42:59 +08:00
|
|
|
try:
|
|
|
|
from seahub.settings import ENABLE_PUBFILE
|
|
|
|
except ImportError:
|
|
|
|
ENABLE_PUBFILE = False
|
|
|
|
|
2012-05-30 22:42:21 +08:00
|
|
|
def base(request):
|
2012-05-03 10:52:43 +08:00
|
|
|
"""
|
2012-05-30 22:42:21 +08:00
|
|
|
Add seahub base configure to the context.
|
2012-05-03 10:52:43 +08:00
|
|
|
|
|
|
|
"""
|
2012-08-31 17:28:50 +08:00
|
|
|
try:
|
|
|
|
org = request.user.org
|
|
|
|
except AttributeError:
|
|
|
|
org = None
|
|
|
|
try:
|
|
|
|
base_template = request.base_template
|
|
|
|
except AttributeError:
|
2012-09-01 17:46:46 +08:00
|
|
|
base_template = 'myhome_base.html'
|
2012-10-26 19:15:52 +08:00
|
|
|
|
2012-05-30 22:42:21 +08:00
|
|
|
return {
|
2012-08-01 17:42:28 +08:00
|
|
|
'seafile_version': SEAFILE_VERSION,
|
2012-11-07 20:39:59 +08:00
|
|
|
'site_title': SITE_TITLE,
|
2013-04-19 11:50:57 +02:00
|
|
|
'branding_css': BRANDING_CSS,
|
|
|
|
'logo_path': LOGO_PATH,
|
|
|
|
'logo_url': LOGO_URL,
|
2012-09-17 21:38:54 +08:00
|
|
|
'business_mode': BUSINESS_MODE,
|
2013-03-17 15:43:33 +08:00
|
|
|
'seacloud_mode': SEACLOUD_MODE,
|
2012-08-01 22:34:35 +08:00
|
|
|
'cloud_mode': request.cloud_mode,
|
2012-08-31 17:28:50 +08:00
|
|
|
'org': org,
|
|
|
|
'base_template': base_template,
|
2012-10-30 19:37:47 +08:00
|
|
|
'site_name': SITE_NAME,
|
2012-12-19 14:11:32 +08:00
|
|
|
'enable_signup': ENABLE_SIGNUP,
|
2012-12-25 15:05:12 +08:00
|
|
|
'max_file_name': MAX_FILE_NAME,
|
2013-05-29 12:13:02 +08:00
|
|
|
'has_file_search': HAS_FILE_SEARCH,
|
2013-05-21 21:42:59 +08:00
|
|
|
'enable_pubfile': ENABLE_PUBFILE,
|
2013-10-14 19:42:04 +08:00
|
|
|
'keep_enc_repo_passwd': KEEP_ENC_REPO_PASSWD,
|
2012-05-30 22:42:21 +08:00
|
|
|
}
|
2012-07-26 17:08:31 +08:00
|
|
|
|