from Globals import InitializeClass from Products.MetadataPortal.utils import getLanguage, translate from browseview import BrowseView from mdportal import MetadataPortalView RESOURES_ON_DESKTOP = 15 class UserView(BrowseView): def __init__(self, context, request): self.request = request self.context = context self._has_more = False def breadcrumbs(self): return MetadataPortalView.breadcrumbs(self, True) + \ " > "+translate(self.context, 'users', getLanguage(self.request))+" > " + \ '' +\ self.context.getFullName().decode('utf-8') + '' def getResourcesList(self): # list 10 resources # TODO: uname aliases w = self._getWaramu() q = '' q += '<_owner>'+self.context.getUsername()+'@'+w.getWaramuSuffix()+'' #q += '<_sort param="descending">_owner' q += '<_sort param="descending">created' q += '' llist = w.listIdentifiers(q) if len(llist) > RESOURES_ON_DESKTOP: self._has_more = True return llist[:RESOURES_ON_DESKTOP] def hasMore(self): return self._has_more def buildLinkToBrowse(self): w = self._getWaramu() return "browse/by/_owner/"+self.context.getUsername()+'@'+w.getWaramuSuffix() InitializeClass(UserView)