1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 04:10:47 +00:00

Add OFFICIAL_MODE to switch between cloud version and download version.

This commit is contained in:
xiez
2012-08-01 17:42:28 +08:00
parent dea8dc7ea8
commit 331e57cd1e
8 changed files with 16 additions and 34 deletions

View File

@@ -6,7 +6,8 @@ and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
import settings
from settings import SEAFILE_VERSION
from settings import SEAHUB_TITLE
def base(request):
"""
@@ -14,8 +15,9 @@ def base(request):
"""
return {
'seafile_version': settings.SEAFILE_VERSION,
'seahub_title': settings.SEAHUB_TITLE,
'seafile_version': SEAFILE_VERSION,
'seahub_title': SEAHUB_TITLE,
'official_mode': request.official_mode,
# 'account_type': settings.ACCOUNT_TYPE,
}

View File

@@ -5,9 +5,9 @@ from seaserv import get_org_by_url_prefix, get_orgs_by_user
from settings import ORG_CACHE_PREFIX
try:
from seahub.settings import USE_ORG
from seahub.settings import OFFICIAL_MODE
except ImportError:
USE_ORG = False
OFFICIAL_MODE = False
class OrganizationMiddleware(object):
"""
@@ -16,8 +16,8 @@ class OrganizationMiddleware(object):
"""
def process_request(self, request):
if USE_ORG:
request.use_org = True
if OFFICIAL_MODE:
request.official_mode = True
# Get current org context
org = cache.get(ORG_CACHE_PREFIX + request.user.username)
@@ -27,7 +27,7 @@ class OrganizationMiddleware(object):
orgs = get_orgs_by_user(request.user.username)
request.user.orgs = orgs
else:
request.use_org = False
request.official_mode = False
request.user.org = None
request.user.orgs = None

View File

@@ -233,4 +233,4 @@ LOGIN_URL = SITE_ROOT + 'accounts/login'
USER_TOTAL_SPACE = 2 * pow(2,30)
SEAFILE_VERSION = '0.9.4'
SEAFILE_VERSION = '0.9.5'

View File

@@ -12,7 +12,7 @@
<li>
<a href="{{ SITE_ROOT }}sys/groupadmin/" {% block nav_groupadmin_class %}{% endblock %}>小组管理</a>
</li>
{% if request.use_org %}
{% if request.official_mode %}
<li>
<a href="{{ SITE_ROOT }}sys/orgadmin/" {% block nav_orgadmin_class %}{% endblock %}>团体管理</a>
</li>

View File

@@ -27,7 +27,7 @@
<div class="top-bar-in">
<div class="left">
{% if request.user.is_authenticated %}
{% if request.use_org %}
{% if official_mode %}
<a href="#" id="team-account" data="no-popup">
{% if org %} {{ org.org_name }} {% else %} 个人帐号 {% endif %}
{% endif %}

View File

@@ -22,7 +22,7 @@
{% endif %}
<h3>已用空间</h3>
<p>{{ quota_usage|filesizeformat }} / 2 GB</p>
<p>{{ quota_usage|filesizeformat }} {% if official_mode %}/ 2 GB {% endif %}</p>
<h3>我管理的小组</h3>
{% if groups_manage %}

View File

@@ -1,18 +1,8 @@
{% extends "myhome_base.html" %}
{% load seahub_tags %}
{% block info_bar_message %}
{% if request.user.is_authenticated %}
{{ block.super }}
{% else %}
<div id="info-bar">
<span class="info">当前链接会在短期内失效,欢迎您 <a href="http://seafile.com/" target="_blank">加入Seafile </a>体验更多功能。</span>
</div>
{% endif %}
{% endblock %}
{% block main_panel %}
{% if used_space < total_space %}
{% if not official_mode or used_space < total_space %}
<div class="narrow-panel">
<h3>更新文件
{% for name, link in zipped %}

View File

@@ -1,18 +1,8 @@
{% extends base_template %}
{% load seahub_tags %}
{% block info_bar_message %}
{% if request.user.is_authenticated %}
{{ block.super }}
{% else %}
<div id="info-bar">
<span class="info">当前链接会在短期内失效,欢迎您 <a href="http://seafile.com/" target="_blank">加入Seafile </a>体验更多功能。</span>
</div>
{% endif %}
{% endblock %}
{% block main_panel %}
{% if used_space < total_space %}
{% if not official_mode or used_space < total_space %}
<div class="narrow-panel">
<h3>上传文件到
{% for name, link in zipped %}