class IVersioningSettingsSchema(Interface): versionable_types = schema.Tuple( title=_(u'Versionable types'), description=_(u'Specify content types that can be versioned.'), required=False, missing_value=tuple(), value_type=schema.Choice(vocabulary='upfront.versioning-portal_types'))
class VersioningSettingsConfiglet(ControlPanelForm): """The formlib class for the versioning settings page""" form_fields = FormFields(IVersioningSettingsSchema) form_fields[ 'versionable_types'].custom_widget = MultiCheckBoxVocabularyWidget label = _("Upfront Versioning Settings") description = _("") form_name = _("Upfront Versioning Settings")
def commit(self): utility = getUtility(IVersioner) obj = utility.commit(aq_inner(self.context)) msg = _("The item has been committed") getToolByName(self.context, 'plone_utils').addPortalMessage( msg, type='info' ) self.request.response.redirect(obj.absolute_url())
def start_new_version(self): utility = getUtility(IVersioner) obj = utility.start_new_version(aq_inner(self.context)) msg = _("You have started a new version") getToolByName(self.context, 'plone_utils').addPortalMessage( msg, type='info' ) self.request.response.redirect(obj.absolute_url())
def breadcrumbs(self): result = PhysicalNavigationBreadcrumbs.breadcrumbs(self) if not result: return result # Override last element vc = getToolByName(self.context, 'upfront_versioning_catalog') latest = vc.getLatestVersionOf(self.context) if self.context == latest: result[-1]['Title'] = _('Latest') else: result[-1]['Title'] = '#%s' % IVersionMetadata(self.context).version return result
def breadcrumbs(self): result = PhysicalNavigationBreadcrumbs.breadcrumbs(self) if not result: return result # Override last element vc = getToolByName(self.context, 'upfront_versioning_catalog') latest = vc.getLatestVersionOf(self.context) if self.context == latest: result[-1]['Title'] = _('Latest') else: result[-1]['Title'] = '#%s' % IVersionMetadata( self.context).version return result