Esempio n. 1
0
settings.register(
    livesettings.BooleanValue(LOGIN_PROVIDERS,
                              'SIGNIN_FEDORA_ENABLED',
                              default=False,
                              description=_('Enable Fedora OpenID login')))

settings.register(
    livesettings.BooleanValue(LOGIN_PROVIDERS,
                              'SIGNIN_CUSTOM_OPENID_ENABLED',
                              default=False,
                              description=_('Enable custom OpenID login')))

settings.register(
    livesettings.StringValue(
        LOGIN_PROVIDERS,
        'SIGNIN_CUSTOM_OPENID_NAME',
        default=_('Custom OpenID'),
        description=_('Short name for the custom OpenID provider')))

CUSTOM_OPENID_MODE_CHOICES = (('openid-direct', _('Direct button login')),
                              ('openid-username', _('Requires username')))

settings.register(
    livesettings.StringValue(LOGIN_PROVIDERS,
                             'SIGNIN_CUSTOM_OPENID_MODE',
                             default='openid-direct',
                             description=_('Type of OpenID login'),
                             choices=CUSTOM_OPENID_MODE_CHOICES))

settings.register(
    livesettings.ImageValue(LOGIN_PROVIDERS,
Esempio n. 2
0
from askbot import const
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from django.conf import settings as django_settings

EMAIL_SUBJECT_PREFIX = getattr(django_settings, 'EMAIL_SUBJECT_PREFIX', '')

EMAIL = livesettings.ConfigurationGroup('EMAIL',
                                        _('Email and email alert settings'),
                                        super_group=LOGIN_USERS_COMMUNICATION)

settings.register(
    livesettings.StringValue(
        EMAIL,
        'EMAIL_SUBJECT_PREFIX',
        default=EMAIL_SUBJECT_PREFIX,
        description=_('Prefix for the email subject line'),
        help_text=_('This setting takes default from the django setting'
                    'EMAIL_SUBJECT_PREFIX. A value entered here will override'
                    'the default.')))


def get_default_admin_email():
    try:
        return django_settings.ADMINS[0][1]
    except:
        return ''


settings.register(
    livesettings.StringValue(
        EMAIL,
Esempio n. 3
0
FORUM_DATA_RULES = livesettings.ConfigurationGroup(
                        'FORUM_DATA_RULES',
                        _('Data entry and display rules'),
                        super_group = DATA_AND_FORMATTING
                    )

EDITOR_CHOICES = (
    ('markdown', 'markdown'),
    ('tinymce', 'WYSIWYG (tinymce)')
)

settings.register(
    livesettings.StringValue(
        FORUM_DATA_RULES,
        'EDITOR_TYPE',
        default = 'markdown',
        choices = EDITOR_CHOICES,
        description = _('Editor for the posts')
    )
)

COMMENTS_EDITOR_CHOICES = (
    ('plain-text', 'Plain text editor'),
    ('rich-text', 'Same editor as for questions and answers')
)

settings.register(
    livesettings.StringValue(
        FORUM_DATA_RULES,
        'COMMENTS_EDITOR_TYPE',
        default='plain-text',
Esempio n. 4
0
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
import livesettings
from django.utils.translation import ugettext_lazy as _
import re

FEEDBACK = livesettings.ConfigurationGroup(
    'FEEDBACK', _('Feedback settings'), super_group=LOGIN_USERS_COMMUNICATION)

FEEDBACK_MODE_CHOICES = (('open', _('Anyone')),
                         ('auth-only', _('Only authenticated users')),
                         ('disabled', _('Nobody, disable feedback form')))

settings.register(
    livesettings.StringValue(FEEDBACK,
                             'FEEDBACK_MODE',
                             default='open',
                             choices=FEEDBACK_MODE_CHOICES,
                             description=_('Who can send feedback')))

settings.register(
    livesettings.StringValue(
        FEEDBACK,
        'FEEDBACK_SITE_URL',
        description=_('Feedback site URL'),
        help_text=_('If left empty, a simple internal feedback form '
                    'will be used instead')))

settings.register(
    livesettings.LongStringValue(
        FEEDBACK,
        'FEEDBACK_PAGE_MESSAGE',
Esempio n. 5
0
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION
import livesettings
from django.utils.translation import ugettext_lazy as _

EMAIL_TEXT = livesettings.ConfigurationGroup(
    'EMAIL_TEXT',
    _('Email template phrases'),
    super_group=LOGIN_USERS_COMMUNICATION)

settings.register(
    livesettings.StringValue(
        EMAIL_TEXT,
        'EMAIL_TEXT_SHORT_WELCOME',
        description=_('Short welcome message, for subject line'),
        default=_('Welcome to {{ SITE_NAME }}!'),
        help_text=
        _('<b>NOTE: All email text settings allow placeholders: {{ USER_NAME }}, {{ SITE_NAME }} and {{ SITE_LINK }}.</b>'
          )))

settings.register(
    livesettings.LongStringValue(
        EMAIL_TEXT,
        'EMAIL_TEXT_LONG_WELCOME',
        description=_('Longer welcome message, for email body'),
        default=
        _('<p>Please visit {{ SITE_NAME }} at {{ SITE_LINK }}, we look forward to your posts.</p>'
          ),
    ))

settings.register(
Esempio n. 6
0
    scope_switch_name = new_value.upper() + '_SCOPE_ENABLED'
    is_enabled = getattr(settings, scope_switch_name)
    if not is_enabled:
        settings.update(scope_switch_name, True)
    return new_value


SCOPE_CHOICES_AUTHENTICATED = (('all', _('All Questions')),
                               ('unanswered', _('Unanswered Questions')),
                               ('followed', _('Followed Questions')))

settings.register(
    livesettings.StringValue(
        QUESTION_LISTS,
        'DEFAULT_SCOPE_AUTHENTICATED',
        choices=SCOPE_CHOICES_AUTHENTICATED,
        default='all',
        description=_(
            'Default questions selector for the authenticated users'),
        update_callback=enable_default_selector_if_disabled))

SCOPE_CHOICES_ANONYMOUS = (  # anonymous users can't see followed questions
    ('all', _('All Questions')),
    ('unanswered', _('Unanswered Questions')),
)

settings.register(
    livesettings.StringValue(
        QUESTION_LISTS,
        'DEFAULT_SCOPE_ANONYMOUS',
        choices=SCOPE_CHOICES_ANONYMOUS,
        default='all',
Esempio n. 7
0
    super_group=CONTENT_AND_UI
)

settings.register(
    livesettings.BooleanValue(
        LICENSE_SETTINGS,
        'USE_LICENSE',
        description=_('Show license clause in the site footer'),
        default=True
    )
)

settings.register(
    livesettings.StringValue(
        LICENSE_SETTINGS,
        'LICENSE_ACRONYM',
        description=_('Short name for the license'),
        default='cc-by-sa'
    )
)

settings.register(
    livesettings.StringValue(
        LICENSE_SETTINGS,
        'LICENSE_TITLE',
        description=_('Full name of the license'),
        default=_('Creative Commons Attribution Share Alike 3.0'),
    )
)

settings.register(
    livesettings.BooleanValue(
Esempio n. 8
0
)

def avatar_type_callback(old, new):
    """strips trailing slash"""
    if settings.ENABLE_GRAVATAR:
        return new
    elif new == 'g':
        # can't use gravatar because it is disabled
        return 'n'
    return new

settings.register(
    livesettings.StringValue(
        USER_SETTINGS,
        'AVATAR_TYPE_FOR_NEW_USERS',
        description=_('Avatar type for new users'),
        default='g',
        choices=const.AVATAR_TYPE_CHOICES_FOR_NEW_USERS,
        update_callback=avatar_type_callback
    )
)

settings.register(
    livesettings.ImageValue(
        USER_SETTINGS,
        'DEFAULT_AVATAR_URL',
        description = _('Default avatar for users'),
        help_text = _(
                        'To change the avatar image, select new file, '
                        'then submit this whole form.'
                    ),
        default = '/images/nophoto.png',
Esempio n. 9
0
from askbot.conf.super_groups import REP_AND_BADGES
import livesettings

KARMA_AND_BADGE_VISIBILITY = livesettings.ConfigurationGroup(
    'KARMA_AND_BADGE_VISIBILITY',
    _('Karma & Badge visibility'),
    super_group=REP_AND_BADGES)

settings.register(
    livesettings.StringValue(
        KARMA_AND_BADGE_VISIBILITY,
        'KARMA_MODE',
        default='public',
        choices=(
            ('public', 'show publicly'),
            ('private', 'show to owners only'),
            ('hidden', 'hide completely'),
        ),  # TODO: later implement hidden mode
        description=_("Visibility of karma"),
        clear_cache=True,
        help_text=_(
            "User's karma may be shown publicly or only to the owners")))

settings.register(
    livesettings.StringValue(
        KARMA_AND_BADGE_VISIBILITY,
        'BADGES_MODE',
        default='public',
        choices=(('public', 'show publicly'),
                 ('hidden',
                  'hide completely')),  # TODO: later implement private mode
Esempio n. 10
0
        default=False,
        help_text=_(
            'Potentially reduces number of steps in the registration process '
            'but can expose personal information, e.g. when LDAP login name is '
            'the same as email address or real name.')))

LDAP_PROTOCOL_VERSION_CHOICES = (('3', _('Version 3')),
                                 ('2',
                                  _('Version 2 (insecure and deprecated)!!!')))

settings.register(
    livesettings.StringValue(
        LDAP_SETTINGS,
        'LDAP_PROTOCOL_VERSION',
        default='3',
        choices=LDAP_PROTOCOL_VERSION_CHOICES,
        description=_('LDAP protocol version'),
        help_text=
        _('Note that Version 2 protocol is not secure!!! Do not use it on unprotected network.'
          )))

settings.register(
    livesettings.StringValue(LDAP_SETTINGS,
                             'LDAP_URL',
                             description=_('LDAP URL'),
                             default="ldap://<host>:<port>"))

settings.register(
    livesettings.StringValue(LDAP_SETTINGS,
                             'LDAP_ENCODING',
                             description=_('LDAP encoding'),
Esempio n. 11
0
import livesettings
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings

EXTERNAL_KEYS = livesettings.ConfigurationGroup(
    'EXTERNAL_KEYS',
    _('Keys for external services'),
    super_group=EXTERNAL_SERVICES)

settings.register(
    livesettings.StringValue(
        EXTERNAL_KEYS,
        'GOOGLE_SITEMAP_CODE',
        description=_('Google site verification key'),
        help_text=_('This key helps google index your site '
                    'please obtain is at '
                    '<a href="%(url)s?hl=%(lang)s">'
                    'google webmasters tools site</a>') % {
                        'url': const.DEPENDENCY_URLS['google-webmaster-tools'],
                        'lang': django_settings.LANGUAGE_CODE,
                    }))

settings.register(
    livesettings.StringValue(
        EXTERNAL_KEYS,
        'GOOGLE_ANALYTICS_KEY',
        description=_('Google Analytics key'),
        help_text=_(
            'Obtain is at <a href="%(url)s">'
            'Google Analytics</a> site, if you '
            'wish to use Google Analytics to monitor '
Esempio n. 12
0
from __future__ import unicode_literals
from django.conf import settings as django_settings
from django.utils.six.moves.urllib.parse import urlparse
from django.utils.translation import ugettext_lazy as _
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
import livesettings

QA_SITE_SETTINGS = livesettings.ConfigurationGroup(
    'QA_SITE_SETTINGS',
    _('URLS, keywords & greetings'),
    super_group=CONTENT_AND_UI)

settings.register(
    livesettings.StringValue(QA_SITE_SETTINGS,
                             'APP_TITLE',
                             default=_('My site'),
                             description=_('Site title for the Q&A forum')))

settings.register(
    livesettings.StringValue(
        QA_SITE_SETTINGS,
        'APP_KEYWORDS',
        default='Askbot,forum,community',
        description=_('Comma separated list of Q&A site keywords')))

settings.register(
    livesettings.StringValue(
        QA_SITE_SETTINGS,
        'APP_COPYRIGHT',
        default='Copyright Askbot, 2010-2011.',
        description=_('Copyright message to show in the footer')))