def update(self):
        processInputs(self.request)

        self.errors = {}
        submitted = False
        form = self.request.form

        if 'form.button.Cancel' in form:
            IStatusMessage(self.request).add(_(u'Changes canceled.'))
            portal_url = getToolByName(self.context, 'portal_url')()
            self.request.response.redirect("%s/plone_control_panel"%
                                           portal_url)
            return False

        if 'form.button.Select' in form:
            self.authorize()
            submitted = True
            registry = getUtility(IRegistry)
            settings = registry.forInterface(IExhibitSettings)
            selected = form.get('selected_types', None)
            if isinstance(selected, basestring):
                selected = (selected,)
            settings.exhibit_item_types = tuple(selected)

        if submitted and not self.errors:
            IStatusMessage(self.request).add(u"Updated content type list")
        elif submitted:
            IStatusMessage(self.request).add(_(u"There were errors"), 'error')

        return True
def bibliography_faceted_navigation(context):
    xmlconfig = context.readDataFile('ex_bibliography_facets.xml')
    if xmlconfig is None or not HAS_EEA:
        return
    portal = context.getSite()
    qitool = getToolByName(portal, "portal_quickinstaller")

    if qitool.isProductInstallable('eea.facetednavigation'):
        if not qitool.isProductInstalled('eea.facetednavigation'):
            qitool.installProduct('eea.facetednavigation')

        folder = portal.restrictedTraverse(EXHIBIT_TEMPLATES)
        existing = folder.keys()
        if 'explore-bibliography' not in existing:
            _createObjectByType('Folder', folder, id='explore-bibliography',
                                title=_(u'Explore Bibliography'))
            faceted = folder['explore-bibliography']
            alsoProvides(faceted, IHidePloneRightColumn)
            # We need to constrain types in order to allow an ATCT
            # folder inside a dexterity folder!
            faceted.setConstrainTypesMode(constraintypes.ENABLED)
            faceted.setLocallyAllowedTypes([])
            faceted.setImmediatelyAddableTypes([])
            # Enable faceted search view
            faceted.unrestrictedTraverse('@@faceted_subtyper/enable')()
            # Load default facet config/layout
            importer = faceted.unrestrictedTraverse('@@faceted_exportimport')
            importer.import_xml(import_file=xmlconfig, redirect=None)
            notify(FacetedGlobalSettingsChangedEvent(faceted))
    def update(self):
        super(View, self).update()

        # Determine if the referenced object is viewable by anonymous.
        sm = getSecurityManager()
        try:
            referenced = self.context._get_referenced()
        except AttributeError:
            referenced = None
        if (referenced is not None and
              sm.checkPermission('Modify portal content', self.context)):
            view_this = 'Anonymous' in rolesForPermissionOn('View',
                                                            self.context)
            view_ref = 'Anonymous' in rolesForPermissionOn('View', referenced)
            # If the current user is an editor, and the exhibit item
            # item is visible to anonymous users, but the referenced
            # item is not, show a warning:
            if view_this and not view_ref:
                IStatusMessage(self.request).add(_('The referenced item is '
                                                   'not published, so this '
                                                   'exhibit item will not be '
                                                   'visible to anonymous '
                                                   'users.'),
                                                 'warning')