1 from forms import CommaStringListWidget, StringListWidget
 
   2 from django.forms import CheckboxSelectMultiple
 
   3 from django.forms.widgets import RadioSelect
 
   4 from base import Setting, SettingSet
 
   5 from django.utils.translation import ugettext as _
 
   7 USERS_SET = SettingSet('users', _('Users settings'), _("General settings for the OSQA users."), 20)
 
   9 ALLOW_NEGATIVE_REPUTATION = Setting('ALLOW_NEGATIVE_REPUTATION', True, USERS_SET, dict(
 
  10 label = _("Allow negative reputation"),
 
  11 help_text = _("Check if you want to allow negative user reputations in the community."),
 
  14 STORE_GREETING_IN_COOKIE = Setting('STORE_GREETING_IN_COOKIE', True, USERS_SET, dict(
 
  15 label = _("Store greeting in cookie"),
 
  16 help_text = _("If you check this the greeting will be stored in a cookie and the users won't be notified on logout."),
 
  19 EDITABLE_SCREEN_NAME = Setting('EDITABLE_SCREEN_NAME', False, USERS_SET, dict(
 
  20 label = _("Editable screen name"),
 
  21 help_text = _("Allow users to alter their screen name."),
 
  24 MIN_USERNAME_LENGTH = Setting('MIN_USERNAME_LENGTH', 3, USERS_SET, dict(
 
  25 label = _("Minimum username length"),
 
  26 help_text = _("The minimum length (in character) of a username.")))
 
  28 RESERVED_USERNAMES = Setting('RESERVED_USERNAMES',
 
  29 [_('fuck'), _('shit'), _('ass'), _('sex'), _('add'), _('edit'), _('save'), _('delete'), _('manage'), _('update'), _('remove'), _('new')]
 
  31 label = _("Disabled usernames"),
 
  32 help_text = _("A comma separated list of disabled usernames (usernames not allowed during a new user registration)."),
 
  33 widget=CommaStringListWidget))
 
  35 TRUNCATE_LONG_USERNAMES = Setting('TRUNCATE_LONG_USERNAMES', True, USERS_SET, dict(
 
  36 label=_("Truncate long usernames"),
 
  37 help_text = _("The long usernames will be truncated.."),
 
  41 SHOW_USER_ACCEPT_RATE = Setting('SHOW_USER_ACCEPT_RATE', True, USERS_SET, dict(
 
  42 label = _("Show user accept rate"),
 
  43 help_text = _("If you check this the user accept rate will be displayed on the user posts."),
 
  46 FREEZE_ACCEPT_RATE_FOR = Setting('FREEZE_ACCEPT_RATE_FOR',
 
  49 label = _("Freeze accept rate"),
 
  50 help_text = _("Freeze answers accept rate for the selected users."),
 
  51 widget=StringListWidget))
 
  53 TRUNCATE_USERNAMES_LONGER_THAN = Setting('TRUNCATE_USERNAMES_LONGER_THAN', 15, USERS_SET, dict(
 
  54 label = _("Truncate usernames longer than"),
 
  55 help_text = _("The usernames that are longer than this will be truncated and ... will be appended.")))
 
  57 SHOW_STATUS_DIAMONDS = Setting('SHOW_STATUS_DIAMONDS', True, USERS_SET, dict(
 
  58 label=_("Show status diamonds"),
 
  59 help_text = _("Show status \"diamonds\" next to moderators or superusers usernames."),
 
  63 EMAIL_UNIQUE = Setting('EMAIL_UNIQUE', True, USERS_SET, dict(
 
  64 label = _("Force unique email"),
 
  65 help_text = _("Should each user have an unique email."),
 
  68 REQUIRE_EMAIL_VALIDATION_TO = Setting('REQUIRE_EMAIL_VALIDATION_TO', [], USERS_SET, dict(
 
  69 label = _("Require email validation to..."),
 
  70 help_text = _("Which actions in this site, users without a valid email will be prevented from doing."),
 
  71 widget=CheckboxSelectMultiple,
 
  72 choices=(("ask", _("ask questions")), ("answer", _("provide answers")), ("comment", _("make comments")), ("flag", _("report posts"))),
 
  76 DONT_NOTIFY_UNVALIDATED = Setting('DONT_NOTIFY_UNVALIDATED', True, USERS_SET, dict(
 
  77 label = _("Don't notify to invalid emails"),
 
  78 help_text = _("Do not notify users with unvalidated emails."),
 
  81 HOLD_PENDING_POSTS_MINUTES = Setting('HOLD_PENDING_POSTS_MINUTES', 120, USERS_SET, dict(
 
  82 label=_("Hold pending posts for X minutes"),
 
  83 help_text=_("How much time in minutes a post should be kept in session until the user logs in or validates the email.")
 
  86 WARN_PENDING_POSTS_MINUTES = Setting('WARN_PENDING_POSTS_MINUTES', 15, USERS_SET, dict(
 
  87 label=_("Warn about pending posts afer X minutes"),
 
  88 help_text=_("How much time in minutes a user that just logged in or validated his email should be warned about a pending post instead of publishing it automatically.")
 
  91 GRAVATAR_RATING_CHOICES = (
 
  92     ('g', _('suitable for display on all websites with any audience type.')),
 
  93     ('pg', _('may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.')),
 
  94     ('r', _('may contain such things as harsh profanity, intense violence, nudity, or hard drug use.')),
 
  95     ('x', _('may contain hardcore sexual imagery or extremely disturbing violence.')),
 
  98 GRAVATAR_ALLOWED_RATING = Setting('GRAVATAR_ALLOWED_RATING', 'g', USERS_SET, dict(
 
  99 label = _("Gravatar rating"),
 
 100 help_text = _("Gravatar allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience."),
 
 102 choices=GRAVATAR_RATING_CHOICES,
 
 105 GRAVATAR_DEFAULT_CHOICES = (
 
 106     ('mm', _('(mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)')),
 
 107     ('identicon', _('a geometric pattern based on an email hash')),
 
 108     ('monsterid', _('a generated "monster" with different colors, faces, etc')),
 
 109     ('wavatar', _('generated faces with differing features and backgrounds')),
 
 112 GRAVATAR_DEFAULT_IMAGE = Setting('GRAVATAR_DEFAULT_IMAGE', 'identicon', USERS_SET, dict(
 
 113 label = _("Gravatar default"),
 
 114 help_text = _("Gravatar has a number of built in options which you can also use as defaults."),
 
 116 choices=GRAVATAR_DEFAULT_CHOICES,