Back to index

plone3  3.1.7
usergroups.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 from zope.component import adapts
00003 from zope.formlib.form import FormFields
00004 from zope.interface import implements
00005 from zope.schema import Bool
00006 
00007 from Products.CMFCore.utils import getToolByName
00008 from Products.CMFDefault.formlib.schema import ProxyFieldProperty
00009 from Products.CMFDefault.formlib.schema import SchemaAdapterBase
00010 from Products.CMFPlone import PloneMessageFactory as _
00011 from Products.CMFPlone.interfaces import IPloneSiteRoot
00012 
00013 from form import ControlPanelForm
00014 
00015 class IUserGroupsSettingsSchema(Interface):
00016 
00017     many_groups = Bool(title=_(u'Many groups?'),
00018                        description=_(u"Determines if your Plone is optimized "
00019                            "for small or large sites. In environments with a "
00020                            "lot of groups it can be very slow or impossible "
00021                            "to build a list all groups. This option tunes the "
00022                            "user interface and behaviour of Plone for this "
00023                            "case by allowing you to search for groups instead "
00024                            "of listing all of them."),
00025                        default=False)
00026 
00027     many_users = Bool(title=_(u'Many users?'),
00028                       description=_(u"Determines if your Plone is optimized "
00029                           "for small or large sites. In environments with a "
00030                           "lot of users it can be very slow or impossible to "
00031                           "build a list all users. This option tunes the user "
00032                           "interface and behaviour of Plone for this case by "
00033                           "allowing you to search for users instead of "
00034                           "listing all of them."),
00035                       default=False)
00036 
00037 
00038 class UserGroupsSettingsControlPanelAdapter(SchemaAdapterBase):
00039 
00040     adapts(IPloneSiteRoot)
00041     implements(IUserGroupsSettingsSchema)
00042 
00043     def __init__(self, context):
00044         super(UserGroupsSettingsControlPanelAdapter, self).__init__(context)
00045         pprop = getToolByName(context, 'portal_properties')
00046         self.context = pprop.site_properties
00047 
00048     many_groups = ProxyFieldProperty(IUserGroupsSettingsSchema['many_groups'])
00049     many_users = ProxyFieldProperty(IUserGroupsSettingsSchema['many_users'])
00050 
00051 
00052 class UserGroupsSettingsControlPanel(ControlPanelForm):
00053 
00054     form_fields = FormFields(IUserGroupsSettingsSchema)
00055 
00056     label = _("User/Groups settings")
00057     description = _("User and groups settings for this site.")
00058     form_name = _("User/Groups settings")