Пример #1
0
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'))
Пример #2
0
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")
Пример #3
0
 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())            
Пример #4
0
 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())            
Пример #5
0
    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
Пример #6
0
    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