Пример #1
0
    def add(self, annotator):
        fields = self.makeField(annotator)
        name = str(annotator.__name__)
        context = self.context
        ignoreContext = True

        # since the adapter results in a factory that instantiates
        # the annotation, this side effect must be avoided.
        if has_note(context, name):
            ignoreContext = False
            context = zope.component.getAdapter(
                context, annotator.for_interface, name=name)

        # make the group and assign data.
        g = form.Group(context, self.request, self.form)
        g.__name__ = annotator.title
        g.label = annotator.title
        g.fields = fields
        g.ignoreContext = ignoreContext
        if not fields.keys():
            g.description = u''\
                'There are no editable attributes for this note as values ' \
                'for this annotation are automatically generated.'

        # finally append this group
        self.form.groups.append(g)
Пример #2
0
 def links(self):
     vocab = zope.component.queryUtility(
         zope.schema.interfaces.IVocabulary,
         name='pmr2.vocab.ExposureFileAnnotators'
     )
     result = [{
         'href': '%s/@@%s' % (self.context.absolute_url(), view),
         'title': vocab.getTerm(view).title,
     } for view in self.context.views if has_note(self.context, view)]
     return result
Пример #3
0
    def links(self):
        vocab = zope.component.queryUtility(
            zope.schema.interfaces.IVocabulary, name="pmr2.vocab.ExposureFileAnnotators"
        )

        result = [
            {
                "href": zope.component.queryAdapter(
                    self.context, IExposureNoteTarget, name=view, default=default_note_url(self.context)
                )(view),
                "title": vocab.getTerm(view).title,
                "class": "exposurefilenote " + view,
            }
            for view in self.context.views
            if has_note(self.context, view) and not view in self.context.hidden_views
        ]
        return result
Пример #4
0
 def get_download_link(self, exposure_object):
     if not has_note(exposure_object, 'flatmap_sds_archive'):
         return False
     if not exists(self.get_archive_path(exposure_object)):
         return False
     return exposure_object.absolute_url() + '/flatmap_sds_archive_download'
Пример #5
0
 def available(self):
     return has_note(self.context, 'license_citation')