Esempio n. 1
0
 def test_getLink_caching_isViewable(self):
     """Cache takes the 'isViewable' parameter into account."""
     adapted = IPrettyLink(self.folder)
     self.assertTrue(adapted.isViewable)
     self.assertFalse(adapted.notViewableHelpMessage in adapted.getLink())
     adapted.isViewable = False
     self.assertTrue(adapted.notViewableHelpMessage in adapted.getLink())
Esempio n. 2
0
 def test_getLink_caching_isViewable(self):
     """Cache takes the 'isViewable' parameter into account."""
     adapted = IPrettyLink(self.folder)
     self.assertTrue(adapted.isViewable)
     self.assertFalse(adapted.notViewableHelpMessage in adapted.getLink())
     adapted.isViewable = False
     self.assertTrue(adapted.notViewableHelpMessage in adapted.getLink())
Esempio n. 3
0
 def adapted(self,
             showColors=False,
             display_tag_title=False,
             isViewable=True):
     plo = IPrettyLink(self.context)
     plo.showContentIcon = True
     plo.showColors = showColors
     plo.display_tag_title = display_tag_title
     plo.isViewable = isViewable
     plo.notViewableHelpMessage = ''
     return plo
Esempio n. 4
0
    def renderCell(self, item):
        """ """
        obj = self._getObject(item)
        prettyLinker = IPrettyLink(obj)
        prettyLinker.target = '_parent'
        prettyLinker.showContentIcon = True

        annexes = staticInfos = moreInfos = ''

        tool = api.portal.get_tool('portal_plonemeeting')
        cfg = tool.getMeetingConfig(self.context)
        if obj.meta_type == 'MeetingItem':
            isPrivacyViewable = obj.adapted().isPrivacyViewable()
            prettyLinker.isViewable = isPrivacyViewable
            # display annexes and infos if item and item isPrivacyViewable
            if isPrivacyViewable:
                # display moreInfos about item
                # visible columns are one define for items listings or when the meeting is displayed
                # so check where we are
                if IMeeting.providedBy(self.context):
                    # on the meeting
                    if displaying_available_items(self.context):
                        visibleColumns = cfg.getAvailableItemsListVisibleColumns(
                        )
                    else:
                        visibleColumns = cfg.getItemsListVisibleColumns()
                else:
                    visibleColumns = cfg.getItemColumns()
                staticInfos = obj.restrictedTraverse('@@static-infos')(
                    visibleColumns=visibleColumns)
                if self.showMoreInfos:
                    moreInfos = obj.restrictedTraverse('@@item-more-infos')(
                        visibleColumns=visibleColumns)

                # display annexes
                annexes = render_item_annexes(obj, tool)
        elif obj.getTagName() == 'Meeting':
            visibleColumns = cfg.getMeetingColumns()
            staticInfos = obj.restrictedTraverse('@@static-infos')(
                visibleColumns=visibleColumns)
            # check_can_view=True because permission check is not enough
            annexes += obj.restrictedTraverse('@@categorized-childs')(
                portal_type='annex', check_can_view=True)
            # display number of items in meeting title
            contentValue = "{0} [{1}]".format(obj.Title(),
                                              obj.number_of_items())
            prettyLinker.contentValue = contentValue

        if annexes:
            annexes = u"<div class='dashboard_annexes'>{0}</div>".format(
                annexes)

        pretty_link = prettyLinker.getLink()
        return pretty_link + staticInfos + moreInfos + annexes