def register_badge_settings(badge_slug=None, badge_name=None, params=None): settings.register( BooleanValue(BADGES, badge_slug + '_BADGE_ENABLED', default=True, description=_('Enable "%s" badge') % badge_name)) if params is None: return for param_slug, param_data in params.items(): param_description = param_data[0] param_default = param_data[1] settings.register( IntegerValue(BADGES, badge_slug + '_BADGE_' + param_slug, description=string_concat(badge_name, ': ', param_description), default=param_default))
""" 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,
"""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))
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 " "Minimum reputation, " "Badge Settings and " "Vote Rules will " "be changed after you modify this setting." ), update_callback = bootstrap_callback ) )
for i in range(0, len(regex_list)): re.compile(regex_list[i].strip()) return args[1] except Exception: # The regex is invalid, so we overwrite it with empty string return "" 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)) settings.register( BooleanValue( MARKUP, 'ENABLE_MATHJAX', description=_('Mathjax support (rendering of LaTeX)'), help_text=_('If you enable this feature, ' '<a href="%(url)s">mathjax</a> must be ' 'installed on your server in its own directory.') % { 'url': const.DEPENDENCY_URLS['mathjax'], },
"Audit is made after the posts are published, pre-moderation " "prevents publishing before moderator's decision."))) settings.register( LongStringValue(MODERATION, 'FORBIDDEN_PHRASES', default='', description=_('Reject all posts with these phrases'), help_text=_( 'Enter one phrase per line (case-insensitive). ' 'Posts with these phrases will be rejected ' 'without moderation.'))) settings.register( BooleanValue(MODERATION, 'MODERATE_IMAGES', default=False, description=_('Enable image moderation'))) settings.register( BooleanValue(MODERATION, 'MODERATE_LINKS', default=False, description=_('Enable link moderation'))) settings.register( BooleanValue(MODERATION, 'ENABLE_TAG_MODERATION', default=False, description=_('Enable tag moderation'), help_text=_( 'If enabled, any new tags will not be applied '
""" 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'), help_text=_('Important - to actually start sharing on twitter, '
from askbot.conf.settings_wrapper import settings from askbot.conf.super_groups import LOGIN_USERS_COMMUNICATION from askbot.deps import livesettings from askbot.deps.livesettings import BooleanValue from askbot.deps.livesettings import StringValue from django.utils.translation import ugettext_lazy as _ ACCESS_CONTROL = livesettings.ConfigurationGroup( 'ACCESS_CONTROL', _('Access control settings'), super_group=LOGIN_USERS_COMMUNICATION) settings.register( BooleanValue( ACCESS_CONTROL, 'READ_ONLY_MODE_ENABLED', default=False, description=_('Make site read-only'), )) settings.register( 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', default=False,
if new_value == True: for key, value in BOOTSTRAP_MODE_SETTINGS.items(): settings.update(key, value) else: for key in BOOTSTRAP_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_BOOTSTRAP_MODE', default=False, description=_('Activate a "Bootstrap" mode'), help_text=_( "Bootstrap mode lowers reputation and certain badge " "thresholds, to values, more suitable " "for the smaller communities, " "<strong>WARNING:</strong> your current value for " "Minimum reputation, " "Bagde Settings and " "Vote Rules will " "be changed after you modify this setting."), update_callback=bootstrap_callback))
"""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.utils.translation import ugettext as _ MODERATION = ConfigurationGroup('MODERATION', _('Content moderation'), super_group=DATA_AND_FORMATTING) settings.register( BooleanValue( MODERATION, 'ENABLE_CONTENT_MODERATION', default=False, description=_('Enable content moderation'), ))
""" 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_SOCIAL_SHARING', default=True, description=_( 'Check to enable sharing of questions on Twitter and Facebook')))
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)) settings.register( BooleanValue(MODERATION, 'ENABLE_TAG_MODERATION', default=False, description=_('Enable tag moderation'), help_text=_( 'If enabled, any new tags will not be applied ' 'to the questions, but emailed to the moderators. ' 'To use this feature, tags must be optional.')))