Esempio n. 1
0
    def _deleteMultiPublishedPost(self, parent, zblogDocument, blogInfos,
                                  blog):
        blogs = []
        for blogInfo in blogInfos:
            b = getBlogFromBlogInfo(blogInfo)
            blogs.append(b)

        (rBool, alsoDeleteLocal,
         blogsToDeleteFrom) = ZShowConfirmDeletePostFromMultipleBlogsDialog(
             parent, zblogDocument, blog, blogs)
        if rBool:
            if not ZPublisherUiValidator().validateBlogs(
                    parent, blogsToDeleteFrom):
                return

            if alsoDeleteLocal and not blogsToDeleteFrom:
                docStore = getApplicationModel().getService(
                    IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
                docStore.removeDocument(zblogDocument.getId())
            else:
                task = ZDeletePostBackgroundTask()
                task.initialize(blogsToDeleteFrom, zblogDocument,
                                alsoDeleteLocal)
                title = _extstr(
                    u"publisherutil.DeletingOnlinePost")  #$NON-NLS-1$
                desc = _extstr(u"publisherutil.DeletingPostFromBlogs") % (
                    zblogDocument.getTitle(), len(blogsToDeleteFrom)
                )  #$NON-NLS-1$
                self._addBackgroundTask(task, parent, title, desc, None)
Esempio n. 2
0
 def _createMenuModel(self, actionContext): #@UnusedVariable
     menuModel = ZMenuModel()
     editor = actionContext.getEditor()
     zblogDocument = editor.getDocument()
     blogInfos = zblogDocument.getBlogInfoList()
     for blogInfo in blogInfos:
         blog = getBlogFromBlogInfo(blogInfo)
         menuModel.addMenuItemWithAction(blog.getName(), 0, ZBlogPostViewOnlineAction(blog.getId()))
     return menuModel
Esempio n. 3
0
 def _createMenuModel(self, actionContext):  #@UnusedVariable
     menuModel = ZMenuModel()
     editor = actionContext.getEditor()
     zblogDocument = editor.getDocument()
     blogInfos = zblogDocument.getBlogInfoList()
     for blogInfo in blogInfos:
         blog = getBlogFromBlogInfo(blogInfo)
         menuModel.addMenuItemWithAction(
             blog.getName(), 0, ZBlogPostViewOnlineAction(blog.getId()))
     return menuModel
Esempio n. 4
0
 def runAction(self, actionContext):
     docIDO = actionContext.getDocumentIDO()
     if docIDO is not None:
         docId = docIDO.getId()
         document = self._getDataStore().getDocument(docId)
         docList = [document]
         blog = None
         blogId = actionContext.getBlogId()
         if blogId is not None:
             blogInfo = document.getBlogInfo(blogId)
             if blogInfo is not None:
                 blog = getBlogFromBlogInfo(blogInfo)
         ZDeleteEntryUiUtil().deletePosts(actionContext.getParentWindow(), blog, docList)
Esempio n. 5
0
 def runAction(self, actionContext):
     docIDO = actionContext.getDocumentIDO()
     if docIDO is not None:
         docId = docIDO.getId()
         document = self._getDataStore().getDocument(docId)
         docList = [document]
         blog = None
         blogId = actionContext.getBlogId()
         if blogId is not None:
             blogInfo = document.getBlogInfo(blogId)
             if blogInfo is not None:
                 blog = getBlogFromBlogInfo(blogInfo)
         ZDeleteEntryUiUtil().deletePosts(actionContext.getParentWindow(),
                                          blog, docList)
Esempio n. 6
0
    def _deleteMultiPublishedPost(self, parent, zblogDocument, blogInfos, blog):
        blogs = []
        for blogInfo in blogInfos:
            b = getBlogFromBlogInfo(blogInfo)
            blogs.append(b)

        (rBool, alsoDeleteLocal, blogsToDeleteFrom) = ZShowConfirmDeletePostFromMultipleBlogsDialog(parent, zblogDocument, blog, blogs)
        if rBool:
            if not ZPublisherUiValidator().validateBlogs(parent, blogsToDeleteFrom):
                return

            if alsoDeleteLocal and not blogsToDeleteFrom:
                docStore = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
                docStore.removeDocument(zblogDocument.getId())
            else:
                task = ZDeletePostBackgroundTask()
                task.initialize(blogsToDeleteFrom, zblogDocument, alsoDeleteLocal)
                title = _extstr(u"publisherutil.DeletingOnlinePost") #$NON-NLS-1$
                desc = _extstr(u"publisherutil.DeletingPostFromBlogs") % (zblogDocument.getTitle(), len(blogsToDeleteFrom)) #$NON-NLS-1$
                self._addBackgroundTask(task, parent, title, desc, None)