Changeset 1215


Ignore:
Timestamp:
12/12/06 15:38:12 (13 years ago)
Author:
jukka
Message:

Fixed #1026. Refactored user resources to not generate new topics for every user and use general portfolio-topic. Unauthenticated users tried to create them when one didn't exist in viewed memberfolder. In general I have a gutfeeling that having many so topics reduces their efficiency, but I am open to arguments, it's only feeling.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Extensions/Install.py

    r1197 r1215  
    662662                    x.recalculateAuthors() 
    663663            print >>out, "Migration to 1.3.4 complete" 
     664        if old<='1.4': 
     665            print >>out, "Starting migration to 1.4" 
     666            # delete unnecessary topics from users 
     667            for member in self.community.objectValues('MemberFolder'): 
     668                for x in member.objectValues('Topic'): 
     669                    member._delObject(x.getId()) 
     670            print >>out, "Migration to 1.4 complete" 
     671 
     672 
    664673 
    665674        print >>out,"Migration completed." 
  • trunk/MemberFolder.py

    r1213 r1215  
    317317        # the collections and resources folders. 
    318318 
    319     def createResourcesTopic(self): 
    320         # assumes that topic 'resources' doesn't exist 
    321         self.invokeFactory('Topic', id='resources') 
    322         topic=self.resources 
    323         criterion = topic.addCriterion('Type', 'ATPortalTypeCriterion' ) 
    324         criterion.setValue(CREATED_RESOURCES) 
    325         criterion = topic.addCriterion('review_state','ATSelectionCriterion') 
    326         criterion.setValue(('public','draft'))     
    327         criterion = topic.addCriterion('Creator', 'ATSimpleStringCriterion') 
    328         criterion.setValue(self.getId()) 
    329319 
    330320    def getMemberId(self): 
     
    335325        """ return the member, useful for collections, topics etc. subobjects """ 
    336326        return self 
    337  
    338     def createStoriesTopic(self): 
    339         # assumes that topic 'stories' doesn't exist 
    340         self.invokeFactory('Topic', id='stories') 
    341         topic=self.stories 
    342         criterion = topic.addCriterion('Type', 'ATPortalTypeCriterion' ) 
    343         criterion.setValue('Story') 
    344         criterion = topic.addCriterion('review_state','ATSelectionCriterion') 
    345         criterion.setValue(('public','draft')) 
    346         criterion = topic.addCriterion('Creator', 'ATSimpleStringCriterion') 
    347         criterion.setValue(self.getId()) 
    348327 
    349328    def getCollectionsFolder(self): 
     
    509488 
    510489    def getResources(self, n=False, REQUEST=None, filter=None): 
    511         """ Search for content-like created by member. 
    512         The funny REQUEST thingy is because the link to the resources topic 
    513         can't be made directly, since it might not exist. It's created here 
    514         if necessary.""" 
    515         if not hasattr(self.aq_base, 'resources'): 
    516             if n == True: 
    517                 return 0 
    518             self.createResourcesTopic() 
    519         if n==True: 
    520             #if not hasattr(self.aq_base, 'resources_n'): 
    521             if filter is None: 
    522                 results=self.resources.queryCatalog() 
    523             else: 
    524                 results=self.resources.queryCatalog(meta_type=filter) 
    525             #self.resources_n=len(results) 
    526             return len(results) 
    527         else: 
    528            return REQUEST.RESPONSE.redirect(self.resources.absolute_url()) 
     490        """ Get resources from subject of this memberfolder by using general portfolio-topic """ 
     491        if filter is None: 
     492            results=self.portfolio.queryCatalog(Creator=getMemberFolder().getId())  
     493        else: 
     494            results=self.portfolio.queryCatalog(meta_type=filter, Creator=self.getMemberFolder().getId())  
     495        return len(results) 
    529496 
    530497    def getSamples(self): 
    531498        """ get n number of samples """ 
    532         if not hasattr(self.aq_base, 'resources'): 
    533             self.createResourcesTopic() 
    534         q = {'review_state':'public', 'meta_type': self.getFeaturedTypes(), 'getHasCoverImage':True} 
    535         all = self.resources.queryCatalog(q) 
     499        q = {'review_state':'public', 'meta_type': self.getFeaturedTypes(), 'getHasCoverImage':True, 'Creator': self.getMemberFolder().getId()} 
     500        all = self.portfolio.queryCatalog(q) 
    536501        import random 
    537502        n = min(3, len(all)) 
  • trunk/skins/lemill/lemill_browse_results.pt

    r1214 r1215  
    4444    <h1 tal:condition="python:here.id=='portfolio' and filter"><span i18n:translate="" tal:content="python:filter.capitalize()">Content</span> <span i18n:translate="by_author"> by <span i18n:name="authors_name" tal:content="here/NiceName">author</span></span></h1> 
    4545    <h1 tal:condition="python:here.id=='portfolio' and not filter and not searchterm" i18n:translate="heading_user_tagcloud">User tagcloud: <span i18n:name="authors_name" tal:content="here/NiceName | nothing">author</span></h1> 
    46     <h1 tal:condition="python:here.id not in ('drafts','published','portfolio') or (here.id=='portfolio' and searchterm)"> 
     46    <h1 tal:condition="python:here.id not in ('drafts','published','portfolio') or (here.id=='portfolio' and len(searchterm)>1)"> 
    4747        <tal:cond tal:condition="python: tagcloud_type!='hits'" i18n:translate="" tal:content="string:Browse ${topic_name}"></tal:cond>  
    4848        <tal:cond tal:condition="python:tagcloud_type=='hits'"> 
Note: See TracChangeset for help on using the changeset viewer.