Ejemplo n.º 1
0
 def items(self):
     if hasattr(self, '_items'):
         return self._items
     ret = list()
     context = aq_inner(self.context)
     brains = self.context.portal_catalog({
         'portal_type': typesToList(self.context),
         'sort_on': 'getObjPositionInParent',
         'path': {
             'query': '/'.join(self.context.getPhysicalPath()),
             'depth': 1,
         },
         'Language': 'all',
     })
     # plone_layout not available in plone3
     #layout = getMultiAdapter((context, self.request), name=u'plone_layout')
     for brain in brains:
         icon = getMultiAdapter((self.context, self.request, brain),
                                IContentIcon)
         #icon = layout.getIcon(brain)
         uid = brain.UID
         if not uid:
             # don't display items without UID
             continue
         cut = self.request.cookies.get('__fct') == uid
         ret.append(nav_item(item_id(uid),
                             icon.url,
                             brain.Title and brain.Title or brain.id,
                             brain.is_folderish, 
                             self._item_selected(brain.getURL()),
                             brain.review_state,
                             cut,
                             default_type_css(brain.portal_type)))
     self._items = ret
     return ret
Ejemplo n.º 2
0
 def items_by_configlets(self, group):
     ret = list()
     pu = self.context.plone_utils
     cp_items = ControlPanelItems(self.context)
     configlets = cp_items.items_by_group(group)
     for item in configlets:
         if not item['available'] or not item['allowed']:
             continue
         try:
             icon = pu.getIconFor('controlpanel', item['id'])
         except KeyError, e:
             icon = ''
         ret.append(nav_item(item_id(item['id']),
                             icon,
                             item['title'],
                             False,
                             False)) # XXX selected.
Ejemplo n.º 3
0
 def items(self):
     uid = self.request.get('uid', 'plone_content')
     ret = list()
     if self.request.getURL()[:-17] != self.context.absolute_url():
         uid = 'plone_content'
     items = [
         ('plone_content', _('Content'), 'logoIcon.png'),
     ]
     if has_permission('Manage portal', self.context):
         items += [
             ('plone_control_panel', _('Control Panel'), 'site_icon.png'),
             ('plone_addons', _('Addon Configuration'), 'product_icon.png'),
         ]
     for id, title, icon in items:
         ret.append(nav_item(item_id(id),
                             icon,
                             title,
                             True,
                             uid == id and True or False))
     return ret