Example #1
0
 def canHandle(self, dndSource):
     if dndSource.hasType(IZBlogAppDnDSource.TYPE_BLOG_POST):
         postDnDSource = dndSource.getSource(IZBlogAppDnDSource.TYPE_BLOG_POST)
         docId = postDnDSource.getData()
         document = self._getDataStore().getDocument(docId)
         if document:
             url = getBlogPostUrl(document)
             return url is not None
     return False
Example #2
0
 def canHandle(self, dndSource):
     if dndSource.hasType(IZBlogAppDnDSource.TYPE_BLOG_POST):
         postDnDSource = dndSource.getSource(
             IZBlogAppDnDSource.TYPE_BLOG_POST)
         docId = postDnDSource.getData()
         document = self._getDataStore().getDocument(docId)
         if document:
             url = getBlogPostUrl(document)
             return url is not None
     return False
Example #3
0
    def handle(self, dndSource, dndContext):
        postDnDSource = dndSource.getSource(IZBlogAppDnDSource.TYPE_BLOG_POST)
        docId = postDnDSource.getData()
        document = self._getDataStore().getDocument(docId)
        if document:
            url = getBlogPostUrl(document)
            if url:
                title = document.getTitle()
                return u'<a href="%s">%s</a>' % (url, title)  #$NON-NLS-1$
            else:
                ZShowInfoMessage(
                    dndContext.getWindow(),
                    _extstr(u"blogposthandler.NoContentDroppedMsg"),
                    _extstr(u"blogposthandler.NoContentTitle"
                            ))  #$NON-NLS-2$ #$NON-NLS-1$

        return None
Example #4
0
    def runAction(self, actionContext):
        selection = actionContext.getViewSelection()
        url = None
        if selection.getType() == IZViewSelectionTypes.BLOG_SELECTION:
            (accountId, blogId) = selection.getData()
            blog = getBlogFromIds(accountId, blogId)
            url = blog.getUrl()
        elif selection.getType() == IZViewSelectionTypes.DOCUMENT_SELECTION:
            (blog, document) = selection.getData()
            url = getBlogPostUrl(document, blog.getId())
        elif selection.getType() == IZViewSelectionTypes.LINK_SELECTION:
            url = selection.getData()[1].getUrl()
        elif selection.getType() == IZViewSelectionTypes.IMAGE_SELECTION:
            url = selection.getData()[1].getUrl()

        if url is not None:
            getOSUtil().openUrlInBrowser(url)
Example #5
0
    def handle(self, dndSource, dndContext):
        postDnDSource = dndSource.getSource(IZBlogAppDnDSource.TYPE_BLOG_POST)
        docId = postDnDSource.getData()
        document = self._getDataStore().getDocument(docId)
        if document:
            url = getBlogPostUrl(document)
            if url:
                title = document.getTitle()
                return u'<a href="%s">%s</a>' % (url, title)  # $NON-NLS-1$
            else:
                ZShowInfoMessage(
                    dndContext.getWindow(),
                    _extstr(u"blogposthandler.NoContentDroppedMsg"),
                    _extstr(u"blogposthandler.NoContentTitle"),
                )  # $NON-NLS-2$ #$NON-NLS-1$

        return None
    def runAction(self, actionContext):
        selection = actionContext.getViewSelection()
        url = None
        if selection.getType() == IZViewSelectionTypes.BLOG_SELECTION:
            (accountId, blogId) = selection.getData()
            blog = getBlogFromIds(accountId, blogId)
            url = blog.getUrl()
        elif selection.getType() == IZViewSelectionTypes.DOCUMENT_SELECTION:
            (blog, document) = selection.getData()
            url = getBlogPostUrl(document, blog.getId())
        elif selection.getType() == IZViewSelectionTypes.LINK_SELECTION:
            url = selection.getData()[1].getUrl()
        elif selection.getType() == IZViewSelectionTypes.IMAGE_SELECTION:
            url = selection.getData()[1].getUrl()

        if url is not None:
            getOSUtil().openUrlInBrowser(url)