def description(self):
     if self.get_items():
         return _(u'The following custom metadata schemas are available for '
                  u'your site.')
     else:
         return _(u'Click the "Add Schema" button to begin creating '
                  u' a new metadata schema.')
예제 #2
0
 def description(self):
     if self.get_items():
         return _(
             u'The following custom metadata schemas are available for '
             u'your site.')
     else:
         return _(u'Click the "Add Schema" button to begin creating '
                  u' a new metadata schema.')
예제 #3
0
class PigeonholeSchemaAddForm(form.Form):

    label = _(u'Add Metadata Schema')
    fields = field.Fields(IPigeonholeSchemaSettings).select(
        'title', 'name', 'types', 'condition')
    ignoreContext = True
    id = 'add-schema-form'

    @button.buttonAndHandler(u'Add Schema')
    def handleAdd(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return

        name = data['name']
        registry = getUtility(IRegistry)
        schemas = registry.collectionOfInterface(IPigeonholeSchemaSettings,
                                                 prefix=REGISTRY_BASE_PREFIX)
        record = schemas.setdefault(name)
        for fname in ('name', 'title', 'types', 'condition'):
            setattr(record, fname, data[fname])

        self.status = _(u"Schema added successfully.")
        self.request.response.redirect(self.context.absolute_url())
예제 #4
0
    def __init__(self, context, request):
        super(PigeonholeControlPanel, self).__init__(context, request)

        # make sure that breadcrumbs will be correct
        self.id = None
        self.Title = lambda: _(u'Pigeonhole')

        # turn off green edit border for anything in the control panel
        request.set('disable_border', 1)
 def __init__(self, context, request):
     super(PigeonholeControlPanel, self).__init__(context, request)
     
     # make sure that breadcrumbs will be correct
     self.id = None
     self.Title = lambda: _(u'Pigeonhole')
     
     # turn off green edit border for anything in the control panel
     request.set('disable_border', 1)
    def handleAdd(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return

        name = data['name']
        registry = getUtility(IRegistry)
        schemas = registry.collectionOfInterface(IPigeonholeSchemaSettings, prefix=REGISTRY_BASE_PREFIX)
        record = schemas.setdefault(name)
        for fname in ('name', 'title', 'types', 'condition'):
            setattr(record, fname, data[fname])

        self.status = _(u"Schema added successfully.")
        self.request.response.redirect(self.context.absolute_url())
예제 #7
0
    def handleAdd(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return

        name = data['name']
        registry = getUtility(IRegistry)
        schemas = registry.collectionOfInterface(IPigeonholeSchemaSettings,
                                                 prefix=REGISTRY_BASE_PREFIX)
        record = schemas.setdefault(name)
        for fname in ('name', 'title', 'types', 'condition'):
            setattr(record, fname, data[fname])

        self.status = _(u"Schema added successfully.")
        self.request.response.redirect(self.context.absolute_url())