""" Settings for askbot data display and entry """ from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from livesettings import values as livesettings from askbot import const from askbot.conf.super_groups import DATA_AND_FORMATTING 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 = (
""" User policy settings """ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import values as livesettings from django.conf import settings as django_settings from askbot.skins import utils as skin_utils from django.utils.translation import ugettext_lazy as _ from askbot import const import re USER_SETTINGS = livesettings.ConfigurationGroup( 'USER_SETTINGS', _('User settings'), super_group=LOGIN_USERS_COMMUNICATION) settings.register( livesettings.LongStringValue( USER_SETTINGS, 'NEW_USER_GREETING', default=_('Welcome to our community!'), description=_('On-screen greeting shown to the new users'))) settings.register( livesettings.BooleanValue(USER_SETTINGS, 'EDITABLE_SCREEN_NAME', default=True, description=_('Allow editing user screen name'))) settings.register( livesettings.BooleanValue( USER_SETTINGS,
""" Q&A website settings - title, desctiption, basic urls keywords """ from urllib.parse import urlparse from django.utils.translation import ugettext_lazy as _ from django.conf import settings as django_settings from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import CONTENT_AND_UI from livesettings import values as 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 that allow changing of the license clause used in askbot instances""" from django.utils.translation import ugettext_lazy as _ from askbot import const from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import CONTENT_AND_UI from livesettings import values as livesettings from askbot.skins import utils as skin_utils LICENSE_SETTINGS = livesettings.ConfigurationGroup('LICENSE_SETTINGS', _('Content License'), 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'),
""" External service key settings """ from django.utils.text import format_lazy from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import values as livesettings from askbot.skins import utils as skin_utils from askbot.utils.loading import module_exists LOGIN_PROVIDERS = livesettings.ConfigurationGroup( 'LOGIN_PROVIDERS', _('Login provider settings'), super_group=LOGIN_USERS_COMMUNICATION) settings.register( livesettings.BooleanValue( LOGIN_PROVIDERS, 'TERMS_CONSENT_REQUIRED', default=False, description=_('Acceptance of terms required at registration'), help_text=settings.get_related_settings_info( ('FLATPAGES', 'TERMS', True)))) settings.register( livesettings.BooleanValue( LOGIN_PROVIDERS, 'SIGNIN_WORDPRESS_SITE_ENABLED', default=False,
"""Settings for LDAP login for Askbot""" from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import EXTERNAL_SERVICES from livesettings import values as livesettings LDAP_SETTINGS = livesettings.ConfigurationGroup('LDAP_SETTINGS', _('LDAP login configuration'), super_group=EXTERNAL_SERVICES) settings.register( livesettings.BooleanValue( LDAP_SETTINGS, 'USE_LDAP_FOR_PASSWORD_LOGIN', description=_('Use LDAP authentication for the password login'), default=False)) settings.register( livesettings.BooleanValue( LDAP_SETTINGS, 'LDAP_AUTOCREATE_USERS', description=_('Automatically create user accounts when possible'), 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)!!!')))
"""External service key settings""" from askbot import const from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import EXTERNAL_SERVICES from livesettings import values as 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'),
from django.utils.translation import ugettext_lazy as _ from django.utils.text import format_lazy from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import values as livesettings ACCESS_CONTROL = livesettings.ConfigurationGroup( 'ACCESS_CONTROL', _('Access control settings'), super_group=LOGIN_USERS_COMMUNICATION) settings.register( livesettings.BooleanValue( ACCESS_CONTROL, 'READ_ONLY_MODE_ENABLED', default=False, description=_('Make site read-only'), )) settings.register( livesettings.StringValue( ACCESS_CONTROL, 'READ_ONLY_MESSAGE', default=_('The site is temporarily read-only. ' 'Only viewing of the content is possible at the moment.'))) settings.register( livesettings.BooleanValue( ACCESS_CONTROL, 'ASKBOT_CLOSED_FORUM_MODE',
""" Email related settings """ from django.utils.translation import ugettext_lazy as _ from django.utils.text import format_lazy from django.conf import settings as django_settings from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import values as livesettings from askbot import const 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:
"""Feedback form settings """ import re from django.utils.translation import ugettext_lazy as _ from django.core.validators import validate_email, ValidationError from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import values as livesettings 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 for minimum reputation required for a variety of actions on the askbot askbot """ from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import REP_AND_BADGES from livesettings import values as livesettings MIN_REP = livesettings.ConfigurationGroup('MIN_REP', _('Karma thresholds'), ordering=0, super_group=REP_AND_BADGES) settings.register( livesettings.IntegerValue( MIN_REP, 'MIN_REP_TO_AUTOAPPROVE_USER', default=10, description=_('To become an automatically approved user'), help_text=_('Approved users bypass moderation and skip recaptcha'))) settings.register( livesettings.IntegerValue(MIN_REP, 'MIN_REP_TO_VOTE_UP', default=5, description=_('Upvote'))) settings.register( livesettings.IntegerValue(MIN_REP, 'MIN_REP_TO_VOTE_DOWN',
""" Settings for making the karma and badge systems visible to the users at a different degree """ from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from livesettings import values as livesettings from askbot.conf.super_groups import REP_AND_BADGES 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(
from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from livesettings import values as livesettings 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 responsible for display of questions lists """ from django.utils.translation import ugettext_lazy as _ from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import DATA_AND_FORMATTING from livesettings import values as livesettings QUESTION_LISTS = livesettings.ConfigurationGroup( 'QUESTION_LISTS', _('Listings of questions'), super_group=DATA_AND_FORMATTING) settings.register( livesettings.BooleanValue( QUESTION_LISTS, 'ALL_SCOPE_ENABLED', default=True, description=_('Enable "All Questions" selector'), help_text=_('At least one of these selectors must be enabled'))) settings.register( livesettings.BooleanValue( QUESTION_LISTS, 'UNANSWERED_SCOPE_ENABLED', default=True, description=_('Enable "Unanswered Questions" selector'), help_text=_('At least one of these selectors must be enabled'))) settings.register( livesettings.BooleanValue(
"""Settings for content moderation and spam control""" from django.utils.translation import ugettext_lazy as _ from askbot import const from livesettings import values as livesettings from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import EXTERNAL_SERVICES SPAM_AND_MODERATION = livesettings.ConfigurationGroup( 'SPAM_AND_MODERATION', _('Akismet spam protection'), super_group=EXTERNAL_SERVICES) settings.register( livesettings.BooleanValue( SPAM_AND_MODERATION, 'USE_AKISMET', description=_( 'Enable Akismet spam detection(keys below are required)'), default=False, help_text=_('To get an Akismet key please visit ' '<a href="%(url)s">Akismet site</a>') % {'url': const.DEPENDENCY_URLS['akismet']})) settings.register( livesettings.StringValue(SPAM_AND_MODERATION, 'AKISMET_API_KEY', description=_('Akismet key for spam detection')))