Ejemplo n.º 1
0
    def enable(self):
        utils = getToolByName(self.context, 'plone_utils')

        if not IGalleryviewlet.providedBy(self.context):
            alsoProvides(self.context, IGalleryviewlet)
            self.context.reindexObject(idxs=['object_provides'])
            utils.addPortalMessage("Galleryviewlet added.")
            self.request.response.redirect(self.context.absolute_url())
            
        else:  
            self.request.response.redirect(self.context.absolute_url())
Ejemplo n.º 2
0
 def disable(self):
     utils = getToolByName(self.context, 'plone_utils')
     
     if IGalleryviewlet.providedBy(self.context):
         noLongerProvides(self.context, IGalleryviewlet)
         self.context.reindexObject(idxs=['object_provides'])
         
         #now delete the annotation
         annotations = IAnnotations(self.context)
         metadata = annotations.get('medialog.galleryviewlet', None)
         if metadata is not None:
             del annotations['medialog.galleryviewlet']
             
         utils.addPortalMessage("Galleryviewlet removed.")
         
     self.request.response.redirect(self.context.absolute_url())
Ejemplo n.º 3
0
 def enabled(self):
     return IGalleryviewlet.providedBy(self.context)