Ejemplo n.º 1
0
"""
Settings for reputation changes that apply to 
user in response to various actions by the same
users or others
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import REP_AND_BADGES
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext as _

BADGES = ConfigurationGroup(
                    'BADGES',
                    _('Badge settings'),
                    ordering=2,
                    super_group = REP_AND_BADGES
                )

settings.register(
    IntegerValue(
        BADGES,
        'DISCIPLINED_BADGE_MIN_UPVOTES',
        default=3,
        description=_('Disciplined: minimum upvotes for deleted post')
    )
)

settings.register(
    IntegerValue(
        BADGES,
        'PEER_PRESSURE_BADGE_MIN_DOWNVOTES',
        default=3,
Ejemplo n.º 2
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext as _
from askbot.conf.super_groups import CONTENT_AND_UI
SIDEBAR_EXERCISE = ConfigurationGroup(  #shitty name - why sidebar?
    'SIDEBAR_EXERCISE',
    _('Exercise page banners and sidebar'),
    super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_EXERCISE,
        'EXERCISE_PAGE_TOP_BANNER',
        description=_('Top banner'),
        default='',
        help_text=_('When using this option, please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.LongStringValue(
        SIDEBAR_EXERCISE,
        'SIDEBAR_EXERCISE_HEADER',
        description=_('Custom sidebar header'),
        default='',
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format. When using this option '
Ejemplo n.º 3
0
        return new_value

    if new_value == True:
        for key, value in LARGE_SITE_MODE_SETTINGS.items():
            settings.update(key, value)

    else:
        for key in LARGE_SITE_MODE_SETTINGS:
            settings.reset(key)

    return new_value


SITE_MODES = ConfigurationGroup(
                    'SITE_MODES',
                    _('Bootstrap mode'),
                    super_group = REP_AND_BADGES
                )

settings.register(
    BooleanValue(
        SITE_MODES,
        'ACTIVATE_LARGE_SITE_MODE',
        default=False,
        description=_(
            'Activate a "Large site" mode'),
        help_text=_(
            "\"Large site\" mode increases reputation and certain badge "
            "thresholds, to values, more suitable "
            "for the larger communities, "
            "<strong>WARNING:</strong> your current values for "
Ejemplo n.º 4
0
"""Settings to control content moderation"""

from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import DATA_AND_FORMATTING
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import BooleanValue
from django.core.cache import cache
from django.utils.translation import ugettext as _


def empty_cache_callback(old_value, new_value):
    """used to clear cache on change of certain values"""
    if old_value != new_value:
        #todo: change this to warmup cache
        cache.clear()
    return new_value


MODERATION = ConfigurationGroup('MODERATION',
                                _('Content moderation'),
                                super_group=DATA_AND_FORMATTING)

settings.register(
    BooleanValue(MODERATION,
                 'ENABLE_CONTENT_MODERATION',
                 default=False,
                 description=_('Enable content moderation'),
                 update_callback=empty_cache_callback))
Ejemplo n.º 5
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext_lazy as _
from askbot.conf.super_groups import CONTENT_AND_UI

SIDEBAR_PROFILE = ConfigurationGroup('SIDEBAR_PROFILE',
                                     _('User profile sidebar'),
                                     super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_PROFILE,
        'SIDEBAR_PROFILE',
        description=_('Custom sidebar'),
        default='',
        localized=True,
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(SIDEBAR_PROFILE,
                        'SIDEBAR_PROFILE_ANON_ONLY',
                        description=_('Show above only to anonymous users'),
                        default=False))
Ejemplo n.º 6
0
General skin settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from askbot.skins import utils as skin_utils
from askbot import const
from askbot.conf.super_groups import CONTENT_AND_UI

GENERAL_SKIN_SETTINGS = ConfigurationGroup(
                    'GENERAL_SKIN_SETTINGS',
                    _('Skin, logos and HTML <head> parts'),
                    super_group = CONTENT_AND_UI
                )

def logo_destination_callback(old_url, new_url):
    url = new_url.strip()
    if url == '':
        return ''

    if url.startswith('/'):
        return url

    validate = URLValidator()
    try:
        validate(url)
        return url
Ejemplo n.º 7
0
"""
Settings for reputation changes that apply to 
user in response to various actions by the same
users or others
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext as _

REP_CHANGES = ConfigurationGroup('REP_CHANGES',
                                 _('Reputation loss and gain rules'),
                                 ordering=2)

settings.register(
    IntegerValue(REP_CHANGES,
                 'MAX_REP_GAIN_PER_USER_PER_DAY',
                 default=200,
                 description=_('Maximum daily reputation gain per user')))

settings.register(
    IntegerValue(REP_CHANGES,
                 'REP_GAIN_FOR_RECEIVING_UPVOTE',
                 default=10,
                 description=_('Gain for receiving an upvote')))

settings.register(
    IntegerValue(REP_CHANGES,
                 'REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE',
                 default=15,
                 description=_('Gain for the author of accepted answer')))
Ejemplo n.º 8
0
"""
General skin settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext_lazy as _
from askbot.skins import utils as skin_utils
from askbot import const
from askbot.conf.super_groups import CONTENT_AND_UI

WORDS = ConfigurationGroup('WORDS',
                           _('Site terms vocabulary'),
                           super_group=CONTENT_AND_UI)

settings.register(
    values.StringValue(WORDS,
                       'WORDS_ASK_YOUR_QUESTION',
                       default=_('Ask Your Question'),
                       description=_('Ask Your Question'),
                       help_text=_('Used on a button')))

settings.register(
    values.StringValue(
        WORDS,
        'WORDS_PLEASE_ENTER_YOUR_QUESTION',
        default=_('Please enter your question'),
        description=_('Please enter your question'),
    ))

settings.register(
"""
Skin settings to color view, vote and answer counters
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue, StringValue
from django.utils.translation import ugettext as _
from askbot.deps.grapefruit import Color

SKIN_COUNTER_SETTINGS = ConfigurationGroup(
    'SKIN_COUNTER_SETTINGS', _('Skin: view, vote and answer counters'))

settings.register(
    IntegerValue(
        SKIN_COUNTER_SETTINGS,
        'VOTE_COUNTER_EXPECTED_MAXIMUM',
        default=3,
        description=_('Vote counter value to give "full color"'),
        hidden=True,
    ))

settings.register(
    StringValue(
        SKIN_COUNTER_SETTINGS,
        'COLORS_VOTE_COUNTER_EMPTY_BG',
        default='white',
        description=_('Background color for votes = 0'),
        help_text=_('HTML color name or hex value'),
        hidden=True,
    ))

settings.register(
Ejemplo n.º 10
0
"""
Settings for reputation changes that apply to 
user in response to various actions by the same
users or others
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext as _

BADGES = ConfigurationGroup('BADGES', _('Badge settings'), ordering=2)

settings.register(
    IntegerValue(
        BADGES,
        'DISCIPLINED_BADGE_MIN_UPVOTES',
        default=3,
        description=_('Disciplined: minimum upvotes for deleted post')))

settings.register(
    IntegerValue(
        BADGES,
        'PEER_PRESSURE_BADGE_MIN_DOWNVOTES',
        default=3,
        description=_('Peer Pressure: minimum downvotes for deleted post')))

settings.register(
    IntegerValue(BADGES,
                 'TEACHER_BADGE_MIN_UPVOTES',
                 default=1,
                 description=_('Teacher: minimum upvotes for the answer')))
Ejemplo n.º 11
0
"""
Settings for embeddable widgets
"""
from django.utils.translation import ugettext as _
from django.utils.html import escape
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from askbot.conf.super_groups import CONTENT_AND_UI

EMBEDDABLE_WIDGETS = ConfigurationGroup('EMBEDDABLE_WIDGETS',
                                        _('Embeddable widgets'),
                                        super_group=CONTENT_AND_UI)

#we need better capabilities for the settings here
#

settings.register(
    values.IntegerValue(
        EMBEDDABLE_WIDGETS,
        'QUESTIONS_WIDGET_MAX_QUESTIONS',
        default=7,
        description=_('Number of questions to show'),
        help_text=escape(
            _('To embed the widget, add the following code '
              'to your site (and fill in correct base url, preferred tags, width and height):'
              '<iframe '
              'src="{{base_url}}/widgets/questions?tags={{comma-separated-tags}}" '
              'width="100%" '
              'height="300"'
              'scrolling="no">'
Ejemplo n.º 12
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext as _

SIDEBAR_QUESTION = ConfigurationGroup(
    'SIDEBAR_QUESTION',
    _('Sidebar widget settings - question page'),
)

settings.register(
    values.LongStringValue(
        SIDEBAR_QUESTION,
        'SIDEBAR_QUESTION_HEADER',
        description=_('Custom sidebar header'),
        default='',
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(SIDEBAR_QUESTION,
                        'SIDEBAR_QUESTION_SHOW_TAGS',
                        description=_('Show tag list in sidebar'),
                        help_text=_('Uncheck this if you want to hide the tag '
                                    'list from the sidebar '),
Ejemplo n.º 13
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext as _
from askbot.conf.super_groups import CONTENT_AND_UI
SIDEBAR_QUESTION = ConfigurationGroup('SIDEBAR_QUESTION',
                                      _('Question page sidebar'),
                                      super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_QUESTION,
        'SIDEBAR_QUESTION_HEADER',
        description=_('Custom sidebar header'),
        default='',
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(SIDEBAR_QUESTION,
                        'SIDEBAR_QUESTION_SHOW_TAGS',
                        description=_('Show tag list in sidebar'),
                        help_text=_('Uncheck this if you want to hide the tag '
                                    'list from the sidebar '),
                        default=True))
Ejemplo n.º 14
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext_lazy as _
from askbot.conf.super_groups import CONTENT_AND_UI

SIDEBAR_MAIN = ConfigurationGroup('SIDEBAR_MAIN',
                                  _('Main page sidebar'),
                                  super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_MAIN,
        'SIDEBAR_MAIN_HEADER',
        description=_('Custom sidebar header'),
        default='',
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.BooleanValue(SIDEBAR_MAIN,
                        'SIDEBAR_MAIN_SHOW_AVATARS',
                        description=_('Show avatar block in sidebar'),
                        help_text=_(
                            'Uncheck this if you want to hide the avatar '
Ejemplo n.º 15
0
"""
Settings that modify processing of user text input
"""

from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import BooleanValue, StringValue
from django.utils.translation import ugettext as _
import askbot
from askbot import const
import os

MARKUP = ConfigurationGroup(
                    'MARKUP',
                    _('Markup formatting')
                )

settings.register(
    BooleanValue(
        MARKUP,
        'MARKUP_CODE_FRIENDLY',
        description = _('Enable code-friendly Markdown'),
        help_text = _(
            'If checked, underscore characters will not '
            'trigger italic or bold formatting - '
            'bold and italic text can still be marked up '
            'with asterisks. Note that "MathJax support" '
            'implicitly turns this feature on, because '
            'underscores are heavily used in LaTeX input.'
        ),
        default = False
Ejemplo n.º 16
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext as _

SIDEBAR_MAIN = ConfigurationGroup(
                    'SIDEBAR_MAIN',
                    _('Sidebar widget settings - main page'),
                )

settings.register(
    values.LongStringValue(
        SIDEBAR_MAIN,
        'SIDEBAR_MAIN_HEADER',
        description = _('Custom sidebar header'),
        default = '',
        help_text = _(
                    'Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.'
                    )
    )
)

settings.register(
    values.BooleanValue(
Ejemplo n.º 17
0
"""
Social sharing settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, BooleanValue
from django.utils.translation import ugettext as _

SOCIAL_SHARING = ConfigurationGroup(
    'SOCIAL_SHARING',
    _('Sharing content on social networks'),
)

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_TWITTER',
        default=True,
        description=_('Check to enable sharing of questions on Twitter')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_FACEBOOK',
        default=True,
        description=_('Check to enable sharing of questions on Facebook')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_LINKEDIN',
        default=True,
Ejemplo n.º 18
0
"""
Social sharing settings
"""
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import EXTERNAL_SERVICES
from askbot.deps.livesettings import ConfigurationGroup, BooleanValue, \
    StringValue

SOCIAL_SHARING = ConfigurationGroup('SOCIAL_SHARING',
                                    _('Content sharing'),
                                    super_group=EXTERNAL_SERVICES)

settings.register(
    BooleanValue(SOCIAL_SHARING,
                 'RSS_ENABLED',
                 default=False,
                 description=_('Check to enable RSS feeds')))

settings.register(
    StringValue(SOCIAL_SHARING,
                'SHARING_SUFFIX_TEXT',
                default='',
                description=_('Hashtag or suffix to sharing messages')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_TWITTER',
        default=False,
        description=_('Check to enable sharing of questions on Twitter'),
Ejemplo n.º 19
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext_lazy as _
from askbot.conf.super_groups import CONTENT_AND_UI

LEADING_SIDEBAR = ConfigurationGroup('LEADING_SIDEBAR',
                                     _('Common left sidebar'),
                                     super_group=CONTENT_AND_UI)

settings.register(
    values.BooleanValue(
        LEADING_SIDEBAR,
        'ENABLE_LEADING_SIDEBAR',
        description=_('Enable left sidebar'),
        default=False,
    ))

settings.register(
    values.LongStringValue(
        LEADING_SIDEBAR,
        'LEADING_SIDEBAR',
        description=_('HTML for the left sidebar'),
        default='',
        help_text=_('Use this area to enter content at the LEFT sidebar'
                    'in HTML format.  When using this option, please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))
Ejemplo n.º 20
0
"""
Q&A forum flatpages (about, etc.)
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, LongStringValue
from askbot.conf.super_groups import CONTENT_AND_UI
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat

FLATPAGES = ConfigurationGroup(
    'FLATPAGES',
    _('Messages and pages - about, privacy policy, etc.'),
    super_group=CONTENT_AND_UI)

settings.register(
    LongStringValue(
        FLATPAGES,
        'FORUM_ABOUT',
        description=_('Text of the Q&amp;A forum About page (html format)'),
        localized=True,
        help_text=\
        _(
            'Save, then <a href="http://validator.w3.org/">'
            'use HTML validator</a> on the "about" page to check your input.'
        )
    )
)

settings.register(
    LongStringValue(
        FLATPAGES,
Ejemplo n.º 21
0
"""
Sidebar settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext as _

SIDEBAR_PROFILE = ConfigurationGroup(
    'SIDEBAR_PROFILE',
    _('Sidebar widget settings - profile page'),
)

settings.register(
    values.LongStringValue(
        SIDEBAR_PROFILE,
        'SIDEBAR_PROFILE_HEADER',
        description=_('Custom sidebar header'),
        default='',
        help_text=_('Use this area to enter content at the TOP of the sidebar'
                    'in HTML format.   When using this option '
                    '(as well as the sidebar footer), please '
                    'use the HTML validation service to make sure that '
                    'your input is valid and works well in all browsers.')))

settings.register(
    values.LongStringValue(
        SIDEBAR_PROFILE,
        'SIDEBAR_PROFILE_FOOTER',
        description=_('Custom sidebar footer'),
        default='',
Ejemplo n.º 22
0
"""
Settings that modify processing of user text input
"""

from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import DATA_AND_FORMATTING
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import BooleanValue, StringValue, LongStringValue
from askbot import const
from django.utils.translation import ugettext_lazy as _
import re

MARKUP = ConfigurationGroup('MARKUP',
                            _('Markup in posts'),
                            super_group=DATA_AND_FORMATTING)


def regex_settings_validation(*args):
    """
    Validate the regular expressions
    """
    try:

        new_value = args[1]
        regex_list = new_value.split('\n')

        for i in range(0, len(regex_list)):
            re.compile(regex_list[i].strip())
        return args[1]

    except Exception:
Ejemplo n.º 23
0
"""
Settings for reputation changes that apply to
user in response to various actions by the same
users or others
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext_lazy as _
from askbot.conf.super_groups import REP_AND_BADGES

REP_CHANGES = ConfigurationGroup('REP_CHANGES',
                                 _('Karma loss and gain rules'),
                                 super_group=REP_AND_BADGES,
                                 ordering=2)

settings.register(
    IntegerValue(REP_CHANGES,
                 'MAX_REP_GAIN_PER_USER_PER_DAY',
                 default=200,
                 description=_('Maximum daily reputation gain per user')))

settings.register(
    IntegerValue(REP_CHANGES,
                 'REP_GAIN_FOR_RECEIVING_UPVOTE',
                 default=10,
                 description=_('Gain for receiving an upvote')))

settings.register(
    IntegerValue(REP_CHANGES,
                 'REP_GAIN_FOR_RECEIVING_ANSWER_ACCEPTANCE',
                 default=15,
Ejemplo n.º 24
0
"""
Forum configuration settings detailing rules on votes
and offensive flags.

For example number of times a person can vote each day, etc.
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import REP_AND_BADGES
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext as _

VOTE_RULES = ConfigurationGroup('VOTE_RULES',
                                _('Vote and flag limits'),
                                ordering=1,
                                super_group=REP_AND_BADGES)

settings.register(
    IntegerValue(VOTE_RULES,
                 'MAX_VOTES_PER_USER_PER_DAY',
                 default=30,
                 description=_('Number of votes a user can cast per day')))

settings.register(
    IntegerValue(VOTE_RULES,
                 'MAX_FLAGS_PER_USER_PER_DAY',
                 default=5,
                 description=_('Maximum number of flags per user per day')))

settings.register(
    IntegerValue(
        VOTE_RULES,
Ejemplo n.º 25
0
"""
Forum configuration settings detailing rules on votes
and offensive flags.

For example number of times a person can vote each day, etc.
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, IntegerValue
from django.utils.translation import ugettext as _

VOTE_RULES = ConfigurationGroup(
    'VOTE_RULES',
    _('Limits applicable to votes and moderation flags'),
    ordering=1,
)

settings.register(
    IntegerValue(VOTE_RULES,
                 'MAX_VOTES_PER_USER_PER_DAY',
                 default=30,
                 description=_('Number of votes a user can cast per day')))

settings.register(
    IntegerValue(VOTE_RULES,
                 'MAX_FLAGS_PER_USER_PER_DAY',
                 default=5,
                 description=_('Maximum number of flags per user per day')))

settings.register(
    IntegerValue(
        VOTE_RULES,
Ejemplo n.º 26
0
"""
Social sharing settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import EXTERNAL_SERVICES
from askbot.deps.livesettings import ConfigurationGroup, BooleanValue
from django.utils.translation import ugettext as _

SOCIAL_SHARING = ConfigurationGroup('SOCIAL_SHARING',
                                    _('Sharing content on social networks'),
                                    super_group=EXTERNAL_SERVICES)

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_TWITTER',
        default=True,
        description=_('Check to enable sharing of exercises on Twitter')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_FACEBOOK',
        default=True,
        description=_('Check to enable sharing of exercises on Facebook')))

settings.register(
    BooleanValue(
        SOCIAL_SHARING,
        'ENABLE_SHARING_LINKEDIN',
        default=True,
Ejemplo n.º 27
0
"""
Q&A forum flatpages (about, etc.)
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup, LongStringValue
from django.utils.translation import ugettext as _

FLATPAGES = ConfigurationGroup('FLATPAGES',
                               _('Flatpages - about, privacy policy, etc.'))

settings.register(
    LongStringValue(
        FLATPAGES,
        'FORUM_ABOUT',
        description=_('Text of the Q&A forum About page (html format)'),
        help_text=\
        _(
            'Save, then <a href="http://validator.w3.org/">'
            'use HTML validator</a> on the "about" page to check your input.'
        )
    )
)

settings.register(
    LongStringValue(
        FLATPAGES,
        'FORUM_FAQ',
        description=_('Text of the Q&A forum FAQ page (html format)'),
        help_text=\
        _(
            'Save, then <a href="http://validator.w3.org/">'
Ejemplo n.º 28
0
"""
Sidebar settings
"""
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from askbot.conf.super_groups import CONTENT_AND_UI

SIDEBAR_QUESTION = ConfigurationGroup(  # TODO: Shitty name - why sidebar?
    'SIDEBAR_QUESTION',
    _('Question page banners and sidebar'),
    super_group=CONTENT_AND_UI)

settings.register(
    values.LongStringValue(
        SIDEBAR_QUESTION,
        'QUESTION_PAGE_TOP_BANNER',
        description=_('Top banner'),
        default='',
        localized=True,
        help_text=_(
            'When using this option, please use the HTML validation service '
            'to make sure that your input is valid and works well in all '
            'browsers.')))

settings.register(
    values.BooleanValue(
        SIDEBAR_QUESTION,
        'QUESTION_PAGE_TOP_BANNER_ANON_ONLY',
        default=False,
Ejemplo n.º 29
0
"""
General skin settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import values
from django.utils.translation import ugettext as _
from django.conf import settings as django_settings
from askbot.skins import utils as skin_utils
from askbot import const

GENERAL_SKIN_SETTINGS = ConfigurationGroup(
    'GENERAL_SKIN_SETTINGS',
    _('Skin and User Interface settings'),
)

settings.register(
    values.ImageValue(GENERAL_SKIN_SETTINGS,
                      'SITE_LOGO_URL',
                      description=_('Q&A site logo'),
                      help_text=_('To change the logo, select new file, '
                                  'then submit this whole form.'),
                      upload_directory=django_settings.ASKBOT_FILE_UPLOAD_DIR,
                      upload_url='/' +
                      django_settings.ASKBOT_UPLOADED_FILES_URL,
                      default='/images/logo.gif',
                      url_resolver=skin_utils.get_media_url))

settings.register(
    values.BooleanValue(
        GENERAL_SKIN_SETTINGS,