Esempio n. 1
0
    def portlets(self):
        '''
        Renders the first paragraph of all ghost objects and documents contained in the site root.
        '''
        view = self.context
        root = rw_layout.getLocalSite(view, self.request)
        portlets = []
        index = root.get_default()
        for portlet in root.get_ordered_publishables():            
            model = None
            if IGhost.providedBy(portlet):
                model = portlet.getLastVersion().get_haunted()
            elif IDocument.providedBy(portlet):
                model = portlet
            if not model: continue
            
            view.REQUEST.model = model
            version = model.get_viewable()
            content = None
            if version:
                content = self._renderVersion(version, portlet.get_title(), model.absolute_url())                
            if content:
                portlets.append(content)

        return portlets and portlets or []
Esempio n. 2
0
 def update(self):
     assert self.manager.ghost is not None
     if IGhost.providedBy(self.manager.ghost):
         publication = IPublicationWorkflow(self.manager.ghost)
         if self.manager.ghost.get_editable() is None:
             publication.new_version()
         version = self.manager.ghost.get_editable()
         version.set_haunted(
             self.target, auto_delete=self.manager.auto_delete)
         if self.manager.auto_publish:
             publication.publish()
     else:
         self.recreate()
     return self.manager.ghost
Esempio n. 3
0
 def update(self):
     assert self.manager.ghost is not None
     if IGhost.providedBy(self.manager.ghost):
         publication = IPublicationWorkflow(self.manager.ghost)
         if self.manager.ghost.get_editable() is None:
             publication.new_version()
         version = self.manager.ghost.get_editable()
         version.set_haunted(self.target,
                             auto_delete=self.manager.auto_delete)
         if self.manager.auto_publish:
             publication.publish()
     else:
         self.recreate()
     return self.manager.ghost
 def search_document(self, name):
     if not hasattr(self.context, name):
         return None
     content = getattr(self.context, name).get_silva_object()
     if IContainer.providedBy(content):
         content = content.get_default()
         if content is None:
             return None
     if IPermanentRedirectLink.providedBy(content):
         return None
     version = content.get_viewable()
     if IGhost.providedBy(content):
         content = version.get_haunted()
         version = content.get_viewable()
     if version is not None:
         details = queryMultiAdapter((version, self.request),
                                     IDocumentDetails)
         if details is not None:
             return details.get_text()
     return None
 def search_document(self, name):
     if not hasattr(self.context, name):
         return None
     content = getattr(self.context, name).get_silva_object()
     if IContainer.providedBy(content):
         content = content.get_default()
         if content is None:
             return None
     if IPermanentRedirectLink.providedBy(content):
         return None
     version = content.get_viewable()
     if IGhost.providedBy(content):
         content = version.get_haunted()
         version = content.get_viewable()
     if version is not None:
         details = queryMultiAdapter(
             (version, self.request), IDocumentDetails)
         if details is not None:
             return details.get_text()
     return None
Esempio n. 6
0
 def need_update(self):
     if IGhost.providedBy(self.manager.ghost):
         viewable = self.manager.ghost.get_viewable()
         return self.target != viewable.get_haunted()
     return IContent.providedBy(self.manager.ghost)
Esempio n. 7
0
 def need_update(self):
     if IGhost.providedBy(self.manager.ghost):
         viewable = self.manager.ghost.get_viewable()
         return self.target != viewable.get_haunted()
     return IContent.providedBy(self.manager.ghost)