Пример #1
0
    def refreshContent(self, selection):
        isUnselecting = False
        if self.entriesListView.getSelection():
            isUnselecting = True

        (accountId, blogId) = selection.getData()

        filter = ZDocumentSearchFilter()
        if blogId is not None:
            account = self.accountStore.getAccountById(accountId)
            self.blog = account.getBlogById(blogId)
            filter.setAccountIdCriteria(accountId)
            filter.setBlogIdCriteria(blogId)
        else:
            self.blog = None
            filter.setAccountIdCriteria(
                IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
            filter.setBlogIdCriteria(
                IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)

        self.model = ZContextInfoPostsModel(filter)
        self.entriesListView.setContentProvider(
            ZBlogEntryListContentProvider(self.model))
        self.entriesListView.refresh()
        self.entriesListView.deselectAll()
        self.onInvalidSelection()
        if isUnselecting:
            fireViewUnselectionEvent()
Пример #2
0
 def _getDocumentIdoListFromEntryId(self, blogEntryId):
     # Convenience method to return the document ido list (in case of duplicates) given blogEntryId.
     if not self.docIndexService:
         self._error(u"_getDocumentIdoFromEntryId() -> Document Indexer service must be enabled.")  #$NON-NLS-1$
         return None
     filter = ZDocumentSearchFilter()
     filter.setBlogEntryIdCriteria(blogEntryId)
     izdocumentIdoList = self.docIndexService.findDocuments(filter)
     return izdocumentIdoList
Пример #3
0
    def refreshContent(self, selection):
        isUnselecting = False
        if self.entriesListView.getSelection():
            isUnselecting = True

        (accountId, blogId) = selection.getData()

        filter = ZDocumentSearchFilter()
        if blogId is not None:
            account = self.accountStore.getAccountById(accountId)
            self.blog = account.getBlogById(blogId)
            filter.setAccountIdCriteria(accountId)
            filter.setBlogIdCriteria(blogId)
        else:
            self.blog = None
            filter.setAccountIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
            filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)

        self.model = ZContextInfoPostsModel(filter)
        self.entriesListView.setContentProvider(ZBlogEntryListContentProvider(self.model))
        self.entriesListView.refresh()
        self.entriesListView.deselectAll()
        self.onInvalidSelection()
        if isUnselecting:
            fireViewUnselectionEvent()
Пример #4
0
 def _getDocumentIdoListFromEntryId(self, blogEntryId):
     # Convenience method to return the document ido list (in case of duplicates) given blogEntryId.
     if not self.docIndexService:
         self._error(
             u"_getDocumentIdoFromEntryId() -> Document Indexer service must be enabled."
         )  #$NON-NLS-1$
         return None
     filter = ZDocumentSearchFilter()
     filter.setBlogEntryIdCriteria(blogEntryId)
     izdocumentIdoList = self.docIndexService.findDocuments(filter)
     return izdocumentIdoList
Пример #5
0
class ZNavigatorTreePostsNode(ZNavigatorTreeSubNode):
    def __init__(self):
        ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_POSTS)
        self.filter = ZDocumentSearchFilter()
        self.postsCount = -1

    # end __init__()

    def getPostsCount(self):
        if self.postsCount == -1:
            self._configureFilter()
            self.postsCount = self._getPostsCount()
        return self.postsCount

    # end getPostsCount()

    def _configureFilter(self):
        if self.parentBlog:
            self.filter.setBlogIdCriteria(self.parentBlog.getId())

    # end _configureFilter()

    def _getPostsCount(self):
        docIndex = getApplicationModel().getEngine().getService(
            IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        return docIndex.getDocumentCount(self.filter)

    # end _getPostsCount()

    def getSearchFilter(self):
        return self.filter

    # end getSearchFilter()

    def getLabel(self):
        label = ZNavigatorTreeSubNode.getLabel(self)
        return u"%s (%d)" % (label, self.getPostsCount())  #$NON-NLS-1$

    # end getLabel()

    def addDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount + 1
            return True
        return False

    # end addDocumentIDO()

    def removeDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount - 1
            return True
        return False
Пример #6
0
class ZNavigatorTreePostsNode(ZNavigatorTreeSubNode):

    def __init__(self):
        ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_POSTS)
        self.filter = ZDocumentSearchFilter()
        self.postsCount = -1
    # end __init__()

    def getPostsCount(self):
        if self.postsCount == -1:
            self._configureFilter()
            self.postsCount = self._getPostsCount()
        return self.postsCount
    # end getPostsCount()

    def _configureFilter(self):
        if self.parentBlog:
            self.filter.setBlogIdCriteria(self.parentBlog.getId())
    # end _configureFilter()

    def _getPostsCount(self):
        docIndex = getApplicationModel().getEngine().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        return docIndex.getDocumentCount(self.filter)
    # end _getPostsCount()

    def getSearchFilter(self):
        return self.filter
    # end getSearchFilter()

    def getLabel(self):
        label = ZNavigatorTreeSubNode.getLabel(self)
        return u"%s (%d)" % (label, self.getPostsCount()) #$NON-NLS-1$
    # end getLabel()

    def addDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount + 1
            return True
        return False
    # end addDocumentIDO()

    def removeDocumentIDO(self, documentIDO):
        if self.postsCount != -1 and self.filter.matches(documentIDO):
            self.postsCount = self.postsCount - 1
            return True
        return False
Пример #7
0
    def __init__(self, parent):
        filter = ZDocumentSearchFilter()
        filter.setAccountIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
        filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)
        self.model = ZContextInfoPostsModel(filter)
        self.openAction = getApplicationModel().getActionRegistry().findAction(IZBlogAppActionIDs.OPEN_BLOG_POST_ACTION)
        self.blogPostContextMenu = ZBlogPostMenuModel()
        self.postsAccelTable = ZBlogPostsListAcceleratorTable(self)
        self.document = None
        self.blog = None
        self.hasFocus = False

        self.indexService = getApplicationModel().getService(IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        self.docStore = getApplicationModel().getService(IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
        self.accountStore = getApplicationModel().getService(IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)

        ZBoxedView.__init__(self, parent)

        self._registerAsIndexListener()
Пример #8
0
    def __init__(self, parent):
        filter = ZDocumentSearchFilter()
        filter.setAccountIdCriteria(
            IZDocumentSearchFilter.UNPUBLISHED_ACCOUNT_ID)
        filter.setBlogIdCriteria(IZDocumentSearchFilter.UNPUBLISHED_BLOG_ID)
        self.model = ZContextInfoPostsModel(filter)
        self.openAction = getApplicationModel().getActionRegistry().findAction(
            IZBlogAppActionIDs.OPEN_BLOG_POST_ACTION)
        self.blogPostContextMenu = ZBlogPostMenuModel()
        self.postsAccelTable = ZBlogPostsListAcceleratorTable(self)
        self.document = None
        self.blog = None
        self.hasFocus = False

        self.indexService = getApplicationModel().getService(
            IZBlogAppServiceIDs.DOCUMENT_INDEX_SERVICE_ID)
        self.docStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.DATA_STORE_SERVICE_ID)
        self.accountStore = getApplicationModel().getService(
            IZBlogAppServiceIDs.ACCOUNT_STORE_SERVICE_ID)

        ZBoxedView.__init__(self, parent)

        self._registerAsIndexListener()
Пример #9
0
 def _createSearchFilter(self):
     searchFilter = None
     if self.linkUrl is not None:
         searchFilter = ZDocumentSearchFilter()
         searchFilter.setLinkURLCriteria(self.linkUrl)
     return searchFilter
Пример #10
0
 def _createSearchFilter(self):
     searchFilter = None
     if self.tagId is not None:
         searchFilter = ZDocumentSearchFilter()
         searchFilter.setTagIdCriteria(self.tagId)
     return searchFilter
Пример #11
0
 def _createSearchFilter(self):
     return ZDocumentSearchFilter()
Пример #12
0
 def __init__(self):
     ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_DRAFTED)
     self.filter = ZDocumentSearchFilter()
     self.postsCount = -1
Пример #13
0
 def _createSearchFilter(self):
     searchFilter = None
     if self.linkUrl is not None:
         searchFilter = ZDocumentSearchFilter()
         searchFilter.setLinkURLCriteria(self.linkUrl)
     return searchFilter
Пример #14
0
 def _createSearchFilter(self):
     searchFilter = None
     if self.tagId is not None:
         searchFilter = ZDocumentSearchFilter()
         searchFilter.setTagIdCriteria(self.tagId)
     return searchFilter
Пример #15
0
 def __init__(self):
     ZNavigatorTreeSubNode.__init__(self, NODE_TYPE_POSTS)
     self.filter = ZDocumentSearchFilter()
     self.postsCount = -1