def runAction(self, actionContext): viewSelection = actionContext.getViewSelection() document = ZBlogDocument() pubMetaData = self._createPubMetaData(viewSelection) if pubMetaData: document.addPubMetaData(pubMetaData) editorWindow = getEditorWindow() editorWindow.openDocument(document) editorWindow.Show()
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)
def deserialize(self, documentDom, deserializationContext): documentDom.setNamespaceMap(self.nssMap) document = ZBlogDocument() document.setId(documentDom.documentElement.getAttribute(u"entry-id")) #$NON-NLS-1$ self._deserializeAttributes(documentDom.documentElement, document) self._deserializeTrackbacks(documentDom, document) self._deserializeBlogInfoList(documentDom, document) self._deserializePubMetaDataList(documentDom, document) self._deserializeTagwordsList(documentDom, document) self._deserializeContent(documentDom, document, deserializationContext) return document
def _createDocument(self, actionContext): #@UnusedVariable document = ZBlogDocument() accountStore = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID) accounts = accountStore.getAccounts() if accounts and len(accounts) == 1: account = accounts[0] blogs = account.getBlogs() if blogs and len(blogs) == 1: blog = blogs[0] document.addPubMetaData(createDefaultPubMetaDataForBlog(blog)) return document
def deserialize(self, documentDom, deserializationContext): documentDom.setNamespaceMap(self.nssMap) document = ZBlogDocument() document.setId(documentDom.documentElement.getAttribute( u"entry-id")) #$NON-NLS-1$ self._deserializeAttributes(documentDom.documentElement, document) self._deserializeTrackbacks(documentDom, document) self._deserializeBlogInfoList(documentDom, document) self._deserializePubMetaDataList(documentDom, document) self._deserializeTagwordsList(documentDom, document) self._deserializeContent(documentDom, document, deserializationContext) 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): 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)
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)
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 _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 _createRavenDocument(self, zblog, serverEntry): # Create and return IZDocument # main document struct. zdoc = ZBlogDocument() # FIXME (PJ) server api needs separate dt fields for creation-time vs published time vs updated-time. schemaDt = ZSchemaDateTime(serverEntry.getUtcDateTime()) zdoc.setCreationTime(schemaDt) zdoc.setLastModifiedTime(schemaDt) # FIXME (PJ) Test test for entries with out a title (else autogen titles) zdoc.setTitle(serverEntry.getTitle()) # tagwords, if any. self._createRavenTagwords(zdoc, serverEntry) # blog info (including pubinfo object) zbloginfo = self._createRavenBlogInfo(zblog, serverEntry) # add blog info to doc zdoc.addBlogInfo(zbloginfo) # server side content content = serverEntry.getContent() # convert to Raven IZDocumentContent xhtml model zdocContent = self._createRavenContent(content) # add content to doc zdoc.setContent(zdocContent) # TODO: zdoc.setTagwords() and zdoc.add/setTrackback return zdoc
def _createDocument(self, actionContext): blog = actionContext.getBlog() document = ZBlogDocument() document.addPubMetaData(createDefaultPubMetaDataForBlog(blog)) return document
def _createRavenDocument(self, zblog, serverEntry): # Create and return IZDocument # main document struct. zdoc = ZBlogDocument() # FIXME (PJ) server api needs separate dt fields for creation-time vs published time vs updated-time. schemaDt = ZSchemaDateTime( serverEntry.getUtcDateTime() ) zdoc.setCreationTime( schemaDt ) zdoc.setLastModifiedTime( schemaDt ) # FIXME (PJ) Test test for entries with out a title (else autogen titles) zdoc.setTitle( serverEntry.getTitle() ) # tagwords, if any. self._createRavenTagwords(zdoc, serverEntry) # blog info (including pubinfo object) zbloginfo = self._createRavenBlogInfo(zblog, serverEntry) # add blog info to doc zdoc.addBlogInfo(zbloginfo) # server side content content = serverEntry.getContent() # convert to Raven IZDocumentContent xhtml model zdocContent = self._createRavenContent(content) # add content to doc zdoc.setContent(zdocContent) # TODO: zdoc.setTagwords() and zdoc.add/setTrackback return zdoc