options = FormFieldsets(IMultiLanguageOptionsSchema)
options.label = _(u'Negotiation scheme')

extras = FormFieldsets(IMultiLanguageExtraOptionsSchema)
extras.label = _(u'Extra options')

policies = FormFieldsets(IMultiLanguagePolicies)
policies.label = _(u'Policies')

clean_site_setup = FormFieldsets(IInitialCleanSiteSetupAdapter)
clean_site_setup.label = _(u'Clean site setup')
clean_site_setup.description = _(
    u"If you are installing PAM for the first time in a Plone site, either if "
    u"it's on an existing or a brand new one you should run the following "
    u"procedures in order to move the default site content to its right root "
    u"language folder and be sure that all the content have the language "
    u"attribute set up correctly. Previous to run them, please be sure that "
    u"you have set up your site's languages in the 'Site languages' tab and "
    u"have saved that setting. Finally, in case you have an existing Plone "
    u"site with Products.LinguaPlone installed, please do not run this steps "
    u"and refer directly to the 'Migration' tab.")


class LanguageControlPanel(BasePanel):
    """A modified language control panel, allows selecting multiple languages.
    """

    template = ViewPageTemplateFile('templates/controlpanel.pt')

    form_fields = FormFieldsets(
        selection, options, policies, extras, clean_site_setup)
    def get_personal_title_attr(self):
        return self.context.personal_title_attr

    def set_personal_title_attr(self, value):
        self.context._updateProperty('personal_title_attr', value)

    personal_title_attr = property(get_personal_title_attr, set_personal_title_attr)


main_set = FormFieldsets(IECABControlPanelSchema)
main_set.id = 'ecab_settings_spooler'
main_set.label = _(u"legend_ecab_attr_mapping", default=u"Student attributes mapping")
main_set.description =  _(u"help_ecab_attr_mapping", 
                          default=u"Here you can specify user attributes which "
                                   "should be used to retrieve additional student "
                                   "information.  The available user attributes are "
                                   "listed in portal_memberdata in the "
                                   "Zope Management Interface (ZMI).")
 
class ECABControlPanel(ControlPanelForm):
    """
    """
    
    form_fields = FormFieldsets(main_set, )

    label = _(u"heading_ecab_prefs", 
              default=u"Assignment Box Settings")
    
    description = _(u"description_ecspooler_setup",
                    default=u"Settings that affect the "
                             "behavior of all assignment boxes on this site.")
        assignment.portal_type = portal_type
        assignment.assigned_categories = set(selected_categories(portal_type))

        return assignment


def selected_categories(portal_type):
    assignments = getUtility(IRatingCategoryAssignment)
    return (t for t in assignments.categories_for_type(portal_type))


typespolicies = FormFieldsets(IEditCategoryAssignment)
typespolicies.id = 'types_categories'
typespolicies.label = _(u'Rating Assignments')
typespolicies.description = _(
    'typespolicies_description_help',
    default=u'Choose a portal type from the list and select '
    u'one or more rating categories to appear on that type.')
typespolicies.required = False

categories = FormFieldsets(ICategoryContainer)
categories.id = 'manage_categories'
categories.label = _(u'Manage Categories')
categories.description = _(
    'categories_description_help',
    default=u'Add, modify, or remove rating categories. You '
    u'may specify a title, description, conditions for viewing and setting '
    u'ratings, a view to display the rating, and a relative order number. '
    u'Categories which are defined at a lower level (e.g., globally) may not be '
    u'edited. You need to save your changes after adding or removing categories'
)
Beispiel #4
0
    def set_search_review_state_for_anon(self, value):
        self.context._updateProperty('search_review_state_for_anon', value)

    search_review_state_for_anon = property(get_search_review_state_for_anon,
                                            set_search_review_state_for_anon)


searchset = FormFieldsets(IBaseSearchSchema)
searchset.id = 'search'
searchset.label = _("Search settings")

advancedset = FormFieldsets(IAdvancedSearchSchema)
advancedset.id = 'advanced'
advancedset.label = _("Advanced search form settings")
advancedset.description = _("Configure when and how to show search options in the advanced search form.")

class SearchControlPanel(ControlPanelForm):

    form_fields = FormFieldsets(searchset, advancedset)
    form_fields['types_not_searched'].custom_widget = MCBThreeColumnWidget
    form_fields['types_not_searched'].custom_widget.cssClass='label'

    for fieldname in ['search_enable_description_search',
                      'search_enable_title_search',
                      'search_enable_batch_size',
                      'search_enable_sort_on']:
        form_fields[fieldname].custom_widget = MultiCheckBoxVocabularyWidget
        form_fields[fieldname].custom_widget.cssClass='label'

    label = _("Search settings")
        return self.context.personal_title_attr

    def set_personal_title_attr(self, value):
        self.context._updateProperty('personal_title_attr', value)

    personal_title_attr = property(get_personal_title_attr,
                                   set_personal_title_attr)


main_set = FormFieldsets(IECABControlPanelSchema)
main_set.id = 'ecab_settings_spooler'
main_set.label = _(u"legend_ecab_attr_mapping",
                   default=u"Student attributes mapping")
main_set.description = _(u"help_ecab_attr_mapping",
                         default=u"Here you can specify user attributes which "
                         "should be used to retrieve additional student "
                         "information.  The available user attributes are "
                         "listed in portal_memberdata in the "
                         "Zope Management Interface (ZMI).")


class ECABControlPanel(ControlPanelForm):
    """
    """

    form_fields = FormFieldsets(main_set, )

    label = _(u"heading_ecab_prefs", default=u"Assignment Box Settings")

    description = _(u"description_ecspooler_setup",
                    default=u"Settings that affect the "
                    "behavior of all assignment boxes on this site.")
        assignment = CategoryAssignment()
        assignment.portal_type = portal_type
        assignment.assigned_categories = set(selected_categories(portal_type))

        return assignment

def selected_categories(portal_type):
    assignments = getUtility(IRatingCategoryAssignment)
    return (t for t in assignments.categories_for_type(portal_type))


typespolicies = FormFieldsets(IEditCategoryAssignment)
typespolicies.id = 'types_categories'
typespolicies.label = _(u'Rating Assignments')
typespolicies.description = _(u'Choose a portal type from the list and select '
u'one or more rating categories to appear on that type. ')
typespolicies.required = False

categories = FormFieldsets(ICategoryContainer)
categories.id = 'manage_categories'
categories.label = _(u'Manage Categories')
categories.description = _(u'Add, modify, or remove rating categories.  You '
u'may specify a title, description, conditions for viewing and setting '
u'ratings, a view to display the rating, and a relative order number.  '
u'Categories which are defined at a lower level (e.g., globally) may not be '
u'edited. You need to save your changes after adding or removing categories')

categories.required = False

class ContentRatingsControlPanel(ControlPanelForm):
extras = FormFieldsets(IMultiLanguageExtraOptionsSchema)
extras.label = _(u'Extra options')

policies = FormFieldsets(IMultiLanguagePolicies)
policies.label = _(u'Policies')

clean_site_setup = FormFieldsets(IInitialCleanSiteSetupAdapter)
clean_site_setup.label = _(u'Clean site setup')
clean_site_setup.description = _(u"""If you are installing PAM for the first """
                                  """time in a Plone site, either if it's on an """
                                  """existing or a brand new one you should run the """
                                  """following procedures in order to move the """
                                  """default site content to its right root """
                                  """language folder and be sure that all the """
                                  """content have the language attribute set up """
                                  """correctly. Previous to run them, please be """
                                  """sure that you have set up your site's """
                                  """languages in the 'Site languages' tab and have """
                                  """saved that setting. Finally, in case you have """
                                  """an existing Plone site with """
                                  """Products.LinguaPlone installed, please do not """
                                  """run this steps and refer directly to the """
                                  """'Migration' tab.""")


class LanguageControlPanel(BasePanel):
    """A modified language control panel, allows selecting multiple languages.
    """

    template = ViewPageTemplateFile('templates/controlpanel.pt')
    def set_cse_label(self, value):
        self.settings.cse_label = value
    cse_label = property(get_cse_label, set_cse_label)

    @property
    def settings(self):
        site = getSite()
        ann = IAnnotations(site)
        return ann.setdefault(SETTING_KEY, Settings())


urlset = FormFieldsets(IURLSchema)
urlset.id = 'urls'
urlset.label = _(u'URLs')
urlset.description = _(u"This list holds all URLs that are associated with "
                     "a Provider. You cannot add URLs to this list here - "
                     "instead go directly to the desired Provider. There you "
                     "will find an option to add the Provider's URL")

manual_urlset = FormFieldsets(IManualURLsSchema)
manual_urlset.id = 'manual_urls'
manual_urlset.label = _(u'Manual URLs')
manual_urlset.description = _(u'URLs entered here that are already linked with'
                              ' a Provider will be ignored.')

cseset = FormFieldsets(ICSESchema)
cseset.id = 'cse'
cseset.label = _(u'CSE')

search_url_settings_widget = CustomWidgetFactory(ObjectWidget, SearchUrlTuple)
search_url_widget = CustomWidgetFactory(
    UrlSequenceWidget, subwidget=search_url_settings_widget)
Beispiel #9
0
class UIControlPanelAdapter(SchemaAdapterBase):
    """ Adapter for the interface schema fields """

    adapts(IPloneSiteRoot)
    implements(IUITool)

    def __init__(self, context):
        super(UIControlPanelAdapter, self).__init__(context)
        self.portal = context
        ui_tool = getToolByName(self.portal, 'portal_ui_tool')
        self.context = ui_tool

theme = FormFieldsets(IUIToolTheme)
theme.id = 'theme'
theme.label = _(u"Existing themes")
theme.description = _(u'Please select a theme from the existing ones.')

themeroller = FormFieldsets(IUIToolThemeroller)
themeroller.id = 'themeroller'
themeroller.label = _('Add theme')


class ThemeDisplayWidget(DisplayWidget):
    """ Display the create directory link """

    def __call__(self):
        tool = self.context.context
        tool._rebuildThemeHashes()

        create_help = translate(_(u"Create download directory at: "),
                                domain="zettwerk.ui",