def updateModel(self):
        document = self.zblogPostEditorModel.getDocument()
        # Flush title, tags, blog meta data etc. from UI controls to zmetadata model.
        self.metaDataWidget.updateModel()
        #  Next copy title, tags etc. from meta data model to the document.
        self.zblogPostEditorModel.getMetaDataModel().updateDocument(document)

        # Finally, get the Xhtml content from the editor and set it in the document
        xhtmlDoc = self._getContentEditControl().getXhtmlDocument()
        xhtmlContent = ZXhtmlContent()
        xhtmlContent.setXhtmlDocument(xhtmlDoc)
        document.setContent(xhtmlContent)
Exemple #2
0
    def updateModel(self):
        document = self.zblogPostEditorModel.getDocument()
        # Flush title, tags, blog meta data etc. from UI controls to zmetadata model.
        self.metaDataWidget.updateModel()
        #  Next copy title, tags etc. from meta data model to the document.
        self.zblogPostEditorModel.getMetaDataModel().updateDocument(document)

        # Finally, get the Xhtml content from the editor and set it in the document
        xhtmlDoc = self._getContentEditControl().getXhtmlDocument()
        xhtmlContent = ZXhtmlContent()
        xhtmlContent.setXhtmlDocument(xhtmlDoc)
        document.setContent(xhtmlContent)
 def _createRavenContent(self, serverContent):
     # Created and return xhtml content in IZDocumentContent.
     # content holder.
     zdocContent = ZXhtmlContent()
     zdocContent.setType(u"application/xhtml+xml")  #$NON-NLS-1$
     zdocContent.setMode(u"xml")  #$NON-NLS-1$
     xhtmlDoc = loadXhtmlDocumentFromString(serverContent)
     zdocContent.setXhtmlDocument(xhtmlDoc)
     return zdocContent
 def _createRavenContent(self, serverContent):
     # Created and return xhtml content in IZDocumentContent.
     # content holder.
     zdocContent = ZXhtmlContent()
     zdocContent.setType(u"application/xhtml+xml") #$NON-NLS-1$
     zdocContent.setMode(u"xml") #$NON-NLS-1$
     xhtmlDoc = loadXhtmlDocumentFromString(serverContent)
     zdocContent.setXhtmlDocument(xhtmlDoc)
     return zdocContent
Exemple #5
0
 def createBlogDocument(self):
     u"""createBlogDocument( -> IZBlogDocument"""  #$NON-NLS-1$
     xhtmlDoc = self.createXhtmlDocument()
     doc = ZBlogDocument()
     title = getNoneString(self.izBlogThisInformation.getTitle())
     if not title:
         title = getSafeString(xhtmlDoc.getTitle())
     doc.setTitle(title)
     content = ZXhtmlContent()
     content.setMode(u"xml")  #$NON-NLS-1$
     content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
     content.setXhtmlDocument(xhtmlDoc)
     doc.setContent(content)
     return doc
Exemple #6
0
    def __init__(self):
        ZBlogDocument.__init__(self)

        self.setId(u"_template_preview_document_")  #$NON-NLS-1$
        self.setTitle(
            u"Proin tincidunt. Sed sapien libero, feugiat eu, tristique."
        )  #$NON-NLS-1$
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(self._createXHtmlDocument())
        self.setContent(content)
Exemple #7
0
    def __init__(self, title, xhtmlDoc):
        self.title = title
        self.xhtmlDoc = xhtmlDoc

        ZBlogDocument.__init__(self)

        self.setId(u"_blog_post_editor_preview_document_")  #$NON-NLS-1$
        self.setTitle(self.title)
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(self.xhtmlDoc)
        self.setContent(content)
Exemple #8
0
    def _createDocument(self):
        document = ZBlogDocument()
        document.setTitle(u"RAVEN_TEMPLATE_FETCH_TITLE")  #$NON-NLS-1$
        document.setCreationTime(ZSchemaDateTime())
        document.setLastModifiedTime(ZSchemaDateTime())

        xhtmlDoc = loadXhtmlDocumentFromString(
            u"<p id='_raven_template_body'>RAVEN_TEMPLATE_FETCH_BODY</p>"
        )  #$NON-NLS-1$
        content = ZXhtmlContent()
        content.setMode(u"xml")  #$NON-NLS-1$
        content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
        content.setXhtmlDocument(xhtmlDoc)
        document.setContent(content)

        return document
 def __init__(self):
     ZBlogDocument.__init__(self)
     
     self.setId(u"_template_preview_document_") #$NON-NLS-1$
     self.setTitle(u"Proin tincidunt. Sed sapien libero, feugiat eu, tristique.") #$NON-NLS-1$
     self.setCreationTime(ZSchemaDateTime())
     self.setLastModifiedTime(ZSchemaDateTime())
     
     content = ZXhtmlContent()
     content.setMode(u"xml") #$NON-NLS-1$
     content.setType(u"application/xhtml+xml") #$NON-NLS-1$
     content.setXhtmlDocument(self._createXHtmlDocument())
     self.setContent(content)
Exemple #10
0
    def _createDocument(self):
        document = ZBlogDocument()
        document.setTitle(u"RAVEN_TEMPLATE_FETCH_TITLE") #$NON-NLS-1$
        document.setCreationTime(ZSchemaDateTime())
        document.setLastModifiedTime(ZSchemaDateTime())

        xhtmlDoc = loadXhtmlDocumentFromString(u"<p id='_raven_template_body'>RAVEN_TEMPLATE_FETCH_BODY</p>") #$NON-NLS-1$
        content = ZXhtmlContent()
        content.setMode(u"xml") #$NON-NLS-1$
        content.setType(u"application/xhtml+xml") #$NON-NLS-1$
        content.setXhtmlDocument(xhtmlDoc)
        document.setContent(content)

        return document
 def createBlogDocument(self):
     u"""createBlogDocument( -> IZBlogDocument""" #$NON-NLS-1$
     xhtmlDoc = self.createXhtmlDocument()
     doc = ZBlogDocument()
     title = getNoneString( self.izBlogThisInformation.getTitle() )
     if not title:
         title = getSafeString( xhtmlDoc.getTitle() )
     doc.setTitle( title )
     content = ZXhtmlContent()
     content.setMode(u"xml") #$NON-NLS-1$
     content.setType(u"application/xhtml+xml") #$NON-NLS-1$
     content.setXhtmlDocument(xhtmlDoc)
     doc.setContent(content)
     return doc
    def __init__(self, title, xhtmlDoc):
        self.title = title
        self.xhtmlDoc = xhtmlDoc

        ZBlogDocument.__init__(self)

        self.setId(u"_blog_post_editor_preview_document_") #$NON-NLS-1$
        self.setTitle(self.title)
        self.setCreationTime(ZSchemaDateTime())
        self.setLastModifiedTime(ZSchemaDateTime())

        content = ZXhtmlContent()
        content.setMode(u"xml") #$NON-NLS-1$
        content.setType(u"application/xhtml+xml") #$NON-NLS-1$
        content.setXhtmlDocument(self.xhtmlDoc)
        self.setContent(content)
Exemple #13
0
    def _deserializeContent(self, documentDom, document,
                            deserializationContext):
        contentNode = documentDom.selectSingleNode(
            u"/zns:entry/zns:content")  #$NON-NLS-1$

        # Handle the Case of the Missing Content
        if not contentNode:
            xhtmlDoc = loadXhtmlDocumentFromString(u"")  #$NON-NLS-1$
            content = ZXhtmlContent()
            content.setMode(u"xml")  #$NON-NLS-1$
            content.setType(u"application/xhtml+xml")  #$NON-NLS-1$
            content.setXhtmlDocument(xhtmlDoc)
            document.setContent(content)
            return

        self._processContent(contentNode, deserializationContext)

        mode = contentNode.getAttribute(u"mode")  #$NON-NLS-1$
        type = contentNode.getAttribute(u"type")  #$NON-NLS-1$

        content = ZXhtmlContent()
        content.setMode(mode)
        content.setType(type)

        if mode == u"xml":  #$NON-NLS-1$
            xhtmlNode = contentNode.selectSingleNode(u"*")  #$NON-NLS-1$
            xhtmlDoc = loadXhtmlDocumentFromDOM(xhtmlNode)
            content.setXhtmlDocument(xhtmlDoc)
        elif mode == u"escaped":  #$NON-NLS-1$
            htmlText = contentNode.getText()
            xhtmlDoc = loadXhtmlDocumentFromString(htmlText)
            content.setXhtmlDocument(xhtmlDoc)
        else:
            raise ZBlogAppException(
                _extstr(
                    u"deserializers.NoContentModeFoundError"))  #$NON-NLS-1$

        document.setContent(content)
Exemple #14
0
    def _deserializeContent(self, documentDom, document, deserializationContext):
        contentNode = documentDom.selectSingleNode(u"/zns:entry/zns:content") #$NON-NLS-1$

        # Handle the Case of the Missing Content
        if not contentNode:
            xhtmlDoc = loadXhtmlDocumentFromString(u"") #$NON-NLS-1$
            content = ZXhtmlContent()
            content.setMode(u"xml") #$NON-NLS-1$
            content.setType(u"application/xhtml+xml") #$NON-NLS-1$
            content.setXhtmlDocument(xhtmlDoc)
            document.setContent(content)
            return

        self._processContent(contentNode, deserializationContext)

        mode = contentNode.getAttribute(u"mode") #$NON-NLS-1$
        type = contentNode.getAttribute(u"type") #$NON-NLS-1$

        content = ZXhtmlContent()
        content.setMode(mode)
        content.setType(type)

        if mode == u"xml": #$NON-NLS-1$
            xhtmlNode = contentNode.selectSingleNode(u"*") #$NON-NLS-1$
            xhtmlDoc = loadXhtmlDocumentFromDOM(xhtmlNode)
            content.setXhtmlDocument(xhtmlDoc)
        elif mode == u"escaped": #$NON-NLS-1$
            htmlText = contentNode.getText()
            xhtmlDoc = loadXhtmlDocumentFromString(htmlText)
            content.setXhtmlDocument(xhtmlDoc)
        else:
            raise ZBlogAppException(_extstr(u"deserializers.NoContentModeFoundError")) #$NON-NLS-1$

        document.setContent(content)