Changeset 1751


Ignore:
Timestamp:
05/14/07 15:56:36 (13 years ago)
Author:
jukka
Message:

Worked on #1365, #1366. Spent 12h. Major refactoring of browsing views. Should be working except portfolios and tests. Code should be much, much clearer, less insane and faster.

Location:
trunk
Files:
9 added
3 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ConfigurationMethods.py

    r1728 r1751  
    355355                            getmethod=topic_conf['getmethod'] 
    356356                        topic.getmethod=getmethod 
    357                         criterion = topic.addCriterion('Type', 'ATPortalTypeCriterion' ) 
    358                         criterion.setValue(allowed_types) 
     357                        if allowed_types: 
     358                            criterion = topic.addCriterion('Type', 'ATPortalTypeCriterion' ) 
     359                            criterion.setValue(allowed_types) 
    359360                        # Set additional criterions for drafts and publisheds 
    360361                        if topic_conf.has_key('criterions'): 
     
    374375                            if not hasattr(topic.aq_base, 'left_slots'): 
    375376                                topic._setProperty('left_slots', ['here/portlet_portfolio/macros/backlinks',], 'lines') 
    376                         if topic_conf.has_key('view_type'): 
    377                             if topic_conf['view_type']=='multi_browse': 
    378                                 topic.setLayout('lemill_multi_browse') 
    379                             elif topic_conf['view_type']=='multitag_browse': 
    380                                 topic.setLayout('lemill_multitag_browse')                             
    381     folder= getattr(portal, 'content') 
    382     for sa in SUBJECT_AREAS: 
    383         if hasattr(folder.aq_base, sa): 
    384             folder._delObject(sa) 
    385         addObject(folder, sa, 'Topic', sa) 
    386         topic = getattr(folder, sa) 
    387         topic.manage_permission(ADD_CONTENT_PERMISSION, ('Member',), acquire=1)  
    388         topic.manage_permission(LIST_FOLDER_CONTENTS, ('Member',), acquire=1) 
    389         topic.setSortCriterion('sortable_title', reversed=False) 
    390         topic.getmethod='getSubject_area' 
    391         criterion = topic.addCriterion('Type', 'ATPortalTypeCriterion' ) 
    392         criterion.setValue(CONTENT_TYPES) 
    393         criterion = topic.addCriterion('getSubject_area','ATSelectionCriterion') 
    394         criterion.setValue(sa) 
    395         topic.setLayout('lemill_multi_browse') 
    396  
    397  
    398 def setupRemoteLeMilles(self, portal): 
     377                        if topic_conf.has_key('view'): 
     378                            topic.setLayout(topic_conf['view']) 
     379 
     380def setupRemoteLeMills(self, portal): 
    399381    #If variable set, tries to add REMOTE_SERVERS to be included in LeMill searches 
    400382    search_tool=getToolByName(portal, 'lemill_search') 
  • trunk/LargeSectionFolder.py

    r1749 r1751  
    146146        return new 
    147147 
    148     def analyzeRequest(self, REQUEST): 
    149         """ Digs searchterms and content filters out of request, returns dictionary """ 
    150         ltool = getToolByName(self, 'lemill_tool') 
    151         queries=REQUEST.form 
    152         # HUGE kludge - no other ideas on how to fix the mysterious "-c" appearing 
    153         toremove=[] 
    154         for key in queries.keys(): 
    155             if key.startswith('-'): 
    156                 toremove.append(key) 
    157         for rem in toremove: 
    158             del queries[rem] 
    159          
    160         fmds=FIELD_METHODS_DISPLAY_STRINGS 
    161         if queries.has_key('filter'): 
    162             filter=queries.pop('filter') 
    163         else:  
    164             filter='' 
    165         if queries.has_key('b_start'): 
    166             batch_start=queries.pop('b_start') 
    167         search_url='' 
    168         for (key,value) in queries.items(): 
    169             if type(value) == list or type(value) == tuple: 
    170                 for y in value: 
    171                     search_url='%s&%s=%s' % (search_url, key, y)                 
    172             else:  
    173                 search_url='%s&%s=%s' % (search_url, key, value)         
    174         if search_url!='': 
    175             cont_url=''.join(('?',search_url,'&')) 
    176         else: 
    177             cont_url=''.join((search_url,'?')) 
    178         searchterm_nice={} 
    179         value_nice={} 
    180         is_plural={} 
    181         for (key, value) in queries.items():            
    182             if type(value) == list or type(value) == tuple:                 
    183             # Show materials where *tags* *are* *nature*, *tree* 
    184                 if fmds.has_key(key):  
    185                     searchterm_nice[key]=fmds[key][1] 
    186                 else: 
    187                     searchterm_nice[key]=key 
    188                 is_plural[key]=True 
    189                 if key=='Language' or key=='getLanguage_skills': 
    190                     value_nice=', '.join([lemill_tool.getPrettyLanguage(x) for x in value])                                        
    191                 else: 
    192                     value_nice=', '.join(value)                                        
    193             else: 
    194             # Show materials where *tag* *is* *nature* 
    195                 if fmds.has_key(key):  
    196                     searchterm_nice[key]=fmds[key][0] 
    197                 else: 
    198                     searchterm_nice[key]=key 
    199                 is_plural[key]=False 
    200                 if key=='Language' or key=='getLanguage_skills': 
    201                     value_nice[key]=ltool.getPrettyLanguage(value)                                        
    202                 else: 
    203                     value_nice[key]=value                                        
    204  
    205         dict={'searchterms':queries, # dictionary of searchterms got from url attributes {'searchterm' : 'value', ...} 
    206             'search_url':search_url,  # searchterms in url string form '&searchterm=value' 
    207             'cont_url':cont_url,  #searchterms in url string beginning with '?' and ending with '&' 
    208             'searchterm_nice':searchterm_nice, # dictionary of tuples for each searchterm, contains displayed form of searchterm f.ex 'getTags': (tag, tags) 
    209             'is_plural':is_plural, # dictionary of booleans, if certain searchterm has multiple values  
    210             'value_nice':value_nice, # dictionary of strings, if searchterm is language contains full names of languages otherwise just values for keys {'language':'Finnish'} 
    211             'filter':filter} # if materials / pieces filter is activated 
    212         return dict 
    213  
    214     def fullResultCount(self,  REQUEST=None, topic_name=None, getIndexMethod=None, request_opened=None, **kw): 
    215         """ Does a full catalog search with criteria from Topic (called from lemill_browse_results) """ 
    216  
    217         # if the same search has just been done, return it instead of going through all of this 
    218 #        if hasattr(REQUEST, 'SESSION'):         
    219 #            if REQUEST.SESSION.get('latest_st')== request_opened['searchterms']: 
    220 #                return REQUEST.SESSION.get('results_n_dict') 
    221  
    222         pcatalog = getToolByName(self, 'portal_catalog') 
    223         mtool = getToolByName(self, 'portal_membership') 
    224  
    225         if request_opened.has_key('searchterms'): 
    226             kw=request_opened['searchterms']         
    227  
    228         if topic_name=='published': # some topic criteria cannot be drawn from given variables and must be hardcoded 
    229             kw['Creator']=mtool.getAuthenticatedMember().getId() 
    230             kw['review_state']='public' 
    231         elif topic_name=='draft': 
    232             return {} # this shouldn't have happened 
    233  
    234         if kw=={}: return {} # don't try to display results if there isn't proper search 
    235  
    236         results = pcatalog.searchResults(REQUEST, **kw) 
    237         #print [(x.portal_type, x.Title, x.id) for x in results if x.portal_type in SEARCHABLE_TYPES] 
    238  
    239         if topic_name=='published':  
    240             del kw['review_state'] # this kw would just mess up the results 
    241          
    242         rc={} 
    243         for t in SEARCHABLE_TYPES: 
    244             rc[t]=0 
    245         for r in results: 
    246             rpt=r.portal_type 
    247             if rpt in SEARCHABLE_TYPES and r.review_state != 'deleted': 
    248                 rc[rpt]=rc[rpt]+1 
    249         rc['Learning resource']= sum([rc[k] for k in MATERIAL_TYPES]) 
    250         rc['Content']=rc['Learning resource']+rc['Piece']+rc['LeMillReference'] 
    251         for k in MATERIAL_TYPES: del rc[k] 
    252          
    253 #        if hasattr(REQUEST, 'SESSION'):         
    254 #            REQUEST.SESSION.set('latest_st', request_opened['searchterms']) 
    255 #            REQUEST.SESSION.set('results_n_dict', rc) 
    256         #print rc 
    257  
    258         return rc 
    259148 
    260149    def prettyMethodNameDictionary(self): 
     
    263152        return FIELD_METHODS_DISPLAY_STRINGS                      
    264153 
    265     def getBrowsedStuff(self, topic_name): 
    266         """ returns nice name for currently browsed content type""" 
    267         return self.getId() 
    268154 
    269155    def getNameOfResourceType(self,restype): 
     
    289175        return lt.checkTitle(self,obj=obj, title=title, objtype=objtype) 
    290176         
    291  
    292     def getTopicLinks(self, topic, here_url, rfilter, search_url): 
    293         """ Figures out what links should be displayed in this topic page """         
    294          
    295         # these dictionaries define what kinds of links there are in legend tabs (up) and to other resource types (down). 
    296         # type_name_key : (location of link, path of link, filter) 
    297         # dictionary keys should match those of TYPE_NAMES so that displayed names for links can be fetched from there 
    298  
    299         # show all major categories 
    300         if topic=='published':             
    301             dict={'Piece':('up','content/published','pieces'), 
    302             'LeMillReference':('up','content/published','references'), 
    303             'Learning resource':('up','content/published','resources'), 
    304             'Activity':('down','methods/published',''), 
    305             'Tool':('down','tools/published','')} 
    306  
    307         # in #1173 all of the filters are removed from recent changes 
    308         elif topic=='recent':             
    309             dict={} 
    310  
    311         # only resources can be drafts, so show nothing 
    312         elif topic=='draft': 
    313             dict={} 
    314  
    315         elif topic=='content' or topic=='content_list':             
    316             dict={'Piece':('up','here','pieces'), 
    317             'LeMillReference':('up','here','references'), 
    318             'Learning resource':('up','here','resources'), 
    319             'All':('up','here','')} 
    320  
    321         # almost everything has tags 
    322         elif topic=='tags': 
    323             dict={'Piece':('up','here','pieces'), 
    324             'LeMillReference':('up','here','references'), 
    325             'Learning resource':('up','here','resources'), 
    326             'Content':('down','content/tags','resources'), 
    327             'Activity':('down','activities/tags',''), 
    328             'Tool':('down','tools/tags',''), 
    329             'GroupBlog':('down','community/tags','')} 
    330  
    331         # almost everything has language (except pieces) 
    332         elif topic=='language' or topic=='group_language': 
    333             dict={'LeMillReference':('up','here','references'), 
    334             'Learning resource':('up','here','resources'), 
    335             'Content':('down', 'content/language','resources'), 
    336             'Activity':('down','activities/language',''), 
    337             'Tool':('down','tools/language',''), 
    338             'GroupBlog':('down','community/group_language',''), 
    339             'MemberFolder':('down','community/language','')} 
    340  
    341         # only references and resources have these 
    342         elif topic=='subject_area' or topic=='target_group': 
    343             dict={'LeMillReference':('up','here','references'), 
    344             'Learning resource':('up','here','resources')} 
    345          
    346         # portfolio should show all stuff 
    347         elif topic=='portfolio' and not search_url.startswith('&getGroupsShared'): 
    348             dict={'Piece':('up','here','pieces'), 
    349             'LeMillReference':('up','here','references'), 
    350             'Learning resource':('up','here','resources'), 
    351             'Content':('down','here','resources'), 
    352             'Activity':('down','here','activities'), 
    353             'Tool':('down','here','tools'), 
    354             #'Collection':('down','here','collections'), <-- I think these should be included, but will require some extra work, I'll wait for comments 
    355             } 
    356          
    357         # these should show nothing except themselves 
    358         elif topic in ['activities','tools','groups','members','country','skills','interests']: 
    359             dict={}                    
    360         else: 
    361             dict={} 
    362  
    363         if dict=={}: 
    364             return ({},{}) 
    365  
    366  
    367         # filter conversion table - this is stupid, but has to be done. 
    368         # if you're using filter, you want to disable the link to that filter, how do you know which one is it? 
    369         filter_conversion={'pieces':'Piece',  
    370         'references':'LeMillReference',  
    371         'resources':'Learning resource', 
    372         'methods':'Activity',  
    373         'tools':'Tool', 
    374         'collections':'Collection', 
    375         'activities':'Activity', # this should be deprecated soon 
    376         'materials':'Learning resource' # this should be deprecated already 
    377         } 
    378  
    379         # mark current page disabled 
    380         if rfilter: 
    381             current_page=filter_conversion[rfilter] 
    382             if current_page in dict.keys(): 
    383                 (place, path, lfilter)=dict[current_page] 
    384                 dict[current_page]=(place,'disabled', lfilter) 
    385  
    386         portal_url = getToolByName(self, 'portal_url') 
    387         up_dict={} 
    388         down_dict={} 
    389         base_url = self.portal_url() 
    390          
    391         # create better dicts:  
    392         # find display labels from TYPE_NAMES dict, 
    393         # replace path with real url with filters and searchterms 
    394         # if linked page is current page, set link to '' 
    395         # example: 
    396         # 'Piece':(('Piece','Pieces'), 'http://www.lemill.net/content/tags?filter=pieces') 
    397         for (key, value) in dict.items(): 
    398             labels=TYPE_NAMES[key] 
    399             linkplace=value[0] 
    400             path=value[1] 
    401             lfilter=value[2] 
    402             if path=='here': 
    403                 url=here_url 
    404             else: 
    405                 url='/'.join((base_url, path)) 
    406                 if url==here_url and rfilter=='': 
    407                     path='disabled' 
    408             if key=='Content' and rfilter in ['references','resources','pieces']: 
    409                 path='disabled' 
    410             if key=='All' and not rfilter: 
    411                 path='disabled' 
    412             if path=='disabled': 
    413                 url='' 
    414             else: 
    415                 if search_url=='' and lfilter!='': 
    416                   url='%s?filter=%s' % (url, lfilter) 
    417                 elif search_url!='' and lfilter!='': 
    418                   url='%s?%s&filter=%s' % (url, search_url[1:], lfilter) 
    419                 elif search_url!='' and lfilter=='': 
    420                   url='%s?%s' % (url, search_url[1:]) 
    421              
    422             if linkplace=='up': 
    423                 # add variable 'order' to dictionary value tuple, so sorting can be based on something 
    424                 order=9                 
    425                 for c in range(len(FILTER_LINK_ORDER)): 
    426                     if FILTER_LINK_ORDER[c]==key: 
    427                         order=c 
    428                         continue 
    429                 up_dict[key]=(order,labels, url) 
    430             elif linkplace=='down': 
    431                 down_dict[key]=(labels, url) 
    432         uplinks=up_dict.values() 
    433         uplinks.sort() 
    434         return (uplinks, down_dict) 
    435  
    436177    def getMetadataFieldsToShowInEditor(self, object): 
    437178        """ gets fields which are shown in metadata edit area """ 
     
    480221        return None 
    481222 
    482     def getSamples(self, search_results): 
    483         """ Pick three random objects from search results that have non-default images to display in folders front pages. """ 
    484         pic_results = [x for x in search_results if x.meta_type in FEATURED_TYPES and x.getHasCoverImage and x.review_state=='public' and x.Title] 
    485         n=min(3,len(pic_results)) 
    486         samples=sample(pic_results,n) 
    487         return samples 
    488  
    489     def getLanguageDependantSamples(self, search_results): 
    490         """ Same as previous, but gives language-dependant results. """ 
     223    def getSamples(self, search_results, language_dependant=True): 
     224        """ Pick three random objects from search results that have non-default images to display in folders front pages. Gives language-dependant results. """ 
    491225        ltool = getToolByName(self, 'portal_languages') 
    492         language_used_now = ltool.getLanguageCookie() 
    493         if language_used_now == None: 
    494             language_used_now = 'en' 
    495         pic_results = [x for x in search_results if x.meta_type in FEATURED_TYPES and x.getHasCoverImage and x.review_state=='public' and x.Title and x.Language == language_used_now] 
     226        favlang = ltool.getLanguageCookie() 
     227        if favlang == None: 
     228            favlang = 'en' 
     229        good_results = [x for x in search_results if x.meta_type in FEATURED_TYPES and x.getHasCoverImage and x.review_state=='public' and x.Title] 
     230        if not language_dependant: 
     231            n=min(3,len(good_results)) 
     232            samples=sample(good_results,n) 
     233            return samples 
     234 
     235        favlang_results = [x for x in good_results if x.Language == favlang] 
     236        results_en=[] 
    496237        # If 3 results or more, then return 
    497         if len(pic_results) >= 3: 
    498             n=min(3,len(pic_results)) 
    499             samples=sample(pic_results,n) 
     238        if len(favlang_results) >= 3: 
     239            samples=sample(favlang_results,3) 
    500240            return samples 
    501241        # If less than 3 results for current language, then add english results 
    502         if len(pic_results) < 3: 
    503             additional_results_en = [x for x in search_results if x.meta_type in FEATURED_TYPES and x.getHasCoverImage and x.review_state=='public' and x.Title and x.Language == 'en'] 
    504             returned_results_en = pic_results + additional_results_en 
    505             if len(returned_results_en) >= 3: 
    506                 results_needed = 3 - len(pic_results) 
    507                 samples = pic_results + sample(additional_results_en,results_needed) 
     242        if len(favlang_results) < 3 and favlang!='en': 
     243            results_en = [x for x in good_results if x.Language == 'en'] 
     244            if len(results_en) >= 3: 
     245                results_needed = 3 - len(favlang_results) 
     246                samples = favlang_results + sample(results_en,results_needed) 
    508247                return samples 
    509248        # If english results are not enough, then add any results 
    510         if len(returned_results_en) < 3: 
    511             additional_results_all = [x for x in search_results if x.meta_type in FEATURED_TYPES and x.getHasCoverImage and x.review_state=='public' and x.Title] 
    512             returned_results_all = returned_results_en + additional_results_all 
    513             if len(returned_results_all) >=3: 
    514                 results_needed = 3 - len(returned_results_en) 
    515                 samples = returned_results_en + sample(additional_results_all,results_needed) 
     249        if len(favlang_results)+len(results_en) < 3: 
     250            if len(good_results) >=3: 
     251                results_needed = 3 - len(favlang_results) - len(results_en) 
     252                samples = favlang_results + results_en + sample(good_results,results_needed) 
    516253                return samples 
    517         n=min(3,len(returned_results_all)) 
    518         samples=sample(returned_results_all,n) 
     254        n=min(3,len(good_results)) 
     255        samples=sample(good_results,n) 
    519256        return samples 
    520257         
     
    553290        return urllib.quote(word) 
    554291 
    555     def tagcloud_type(self,topic_name): 
    556         """ Other than community/tool/activity titles count tag cloud weights by their popularity, aka hits """ 
    557         return 'hits' 
    558  
    559292    def getTitleCloud(self, search_results, browse_type): 
    560         """ Simplified version of getUniques that doesn't try to weigh results, used for equal-worth ordering like with titles """ 
     293        """ Build a cloud based on popularity score for that resource """ 
    561294        # uniquetuplelist contains result metadata reordered: (sort_title, count, url, indexvalue, title) 
    562295        from math import log 
     296        if not search_results: 
     297            return [] 
    563298        rc=getToolByName(self, 'reference_catalog') 
    564299        uc=getToolByName(self, 'uid_catalog') 
    565300        pc = getToolByName(self, 'portal_catalog') 
    566         if browse_type=='group_titles': 
    567             grouptool = getToolByName(self, 'portal_groups') 
     301        grouptool = getToolByName(self, 'portal_groups')         
    568302 
    569303        def getTypeForReferenceSource(ref_catalog_item): 
     
    579313            return i         
    580314             
    581         def calc_piece(x): 
     315        def pieces_titles(x): 
    582316            res=rc({'targetUID':x.UID}) 
    583317            score=len(res) 
    584318            return score 
    585319             
    586         def calc_activity(x): 
     320        def methods_titles(x): 
    587321            res=rc({'targetUID':x.UID}) 
    588322            score=0 
     
    593327                    score+=scores[typ] 
    594328            return score 
    595         calc_content=calc_activity 
    596         calc_tool=calc_activity 
    597         calc_reference=calc_activity 
    598         calc_material=calc_activity 
    599  
    600         def calc_member(x): 
     329        resources_titles=references_titles=tools_titles=methods_titles 
     330 
     331        def members_titles(x): 
    601332            created=pc({'Creator':x.id}) 
    602333            score=0 
     
    610341            return score 
    611342 
    612         def calc_group(x): 
     343        def groups_titles(x): 
    613344            # slow! 
    614345            score=0 
     
    626357            return score          
    627358         
    628         func = eval('calc_%s' % browse_type.split('_')[0]) 
     359        func = eval(browse_type) 
    629360        popularity =[(func(x)+1, x.sortable_title, x) for x in search_results] 
    630361        popularity.sort(cmp=lambda t2,t1: cmp(t1[0],t2[0])) 
    631362        popularity=popularity[:100] 
    632         if browse_type=='member_titles': 
     363        if browse_type=='members_titles': 
    633364            titlecloud=[(x.getSortable_nicename,pop,x.getURL(),s_title, x.getNicename) for (pop, s_title, x) in popularity]         
    634365        else: 
     
    642373        return titlecloud 
    643374 
    644     def getUniques(self, search_results, index_type='Date', browse_type='hits'): 
    645         """ Should return unique values of search results in given index, results are list of index-metadata-like tuples in alphabetical order """ 
    646  
    647         if search_results==[] or search_results==None: 
     375 
     376    def getTagCloud(self, search_results, index_type): 
     377        """ Build a cloud based on how many occurences of this item are in results """ 
     378        if not search_results: 
    648379            return [] 
    649         elif browse_type.endswith('_titles'):  
    650             return self.getTitleCloud(search_results, browse_type) 
    651         elif browse_type=='hits': 
    652             return self.getTagCloud(search_results, index_type, browse_type) 
    653  
    654  
    655     def getTagCloud(self, search_results, index_type, browse_type): 
    656380        lemill_tool = getToolByName(self, 'lemill_tool') 
    657381        pc = getToolByName(self, 'portal_catalog') 
     
    681405        spent_urls=[] 
    682406        for c_obj in search_results: 
    683             if c_obj.review_state!='deleted': 
    684                 values=getattr(c_obj, index_type) 
    685                 if values!=None: 
    686                     if type(values)==str or type(values)==int: 
    687                         hits[values]=hits[values]+1 
    688                     elif type(values)==list or type(values)==tuple: 
    689                         for a in list(values): 
    690                             hits[a]=hits[a]+1                
     407            values=getattr(c_obj, index_type) 
     408            if values!=None: 
     409                if type(values)==str or type(values)==int: 
     410                    hits[values]=hits[values]+1 
     411                elif type(values)==list or type(values)==tuple: 
     412                    for a in list(values): 
     413                        hits[a]=hits[a]+1                
    691414 
    692415        # -- Step 4 -- : Build a list from previous dictionary. 
     
    715438        resultlist.sort() 
    716439        return resultlist 
    717  
    718     def getTagURL(self,context,category,value,filter=None, insideMemberFolder=False): 
    719         value=to_unicode(value) 
    720  
    721         if filter: 
    722             filter=''.join(('&filter=',filter)) 
    723         else: 
    724             filter='' 
    725  
    726         if insideMemberFolder: 
    727             begin='/'.join((insideMemberFolder.absolute_url(),context.getId())) 
    728             filter='&Creator=%s' % insideMemberFolder.Creator() 
    729         else: 
    730             begin=context.absolute_url() 
    731          
    732         return u"%s?%s=%s%s" % (begin,category,value, filter) 
    733  
    734     def getUrlInsideMemberFolder(self, memberfolder=None, topicid='', here_url=''): 
    735         """ When trying to get url for topics, absolute_url omits the memberfolder, this method puts it back in """ 
    736         if memberfolder: 
    737             return '/'.join((memberfolder.absolute_url(),topicid)) 
    738         else: 
    739             return here_url 
    740440 
    741441    def js_queryForPieces(self, keyword, audio=False): 
     
    775475        return str(result) 
    776476 
    777     security.declarePublic('public_getSortCriterion') 
    778     def public_getSortCriterion(self,topic): 
    779         """ Topics have this useful getSortCriterion -method, but it's available only if allowed to change content.""" 
    780         if hasattr(topic, 'hasSortCriterion'):  
    781             if topic.hasSortCriterion(): 
    782                 return topic.getSortCriterion().field 
    783         return False 
    784  
    785     def filterContent(self, results, show_what=''): 
    786         """ Currently only contents use this, other SectionFolders traverse here because stupid test(x,y,z) implementation """ 
    787         return results 
    788  
    789477    def getDefaultIcon(self, meta_type, obj=None): 
    790478        """ general method for getting proper icon for object, used when only catalog-metadata is available """         
     
    799487                return DEFAULT_ICONS['Piece'] 
    800488 
    801     def removeBadResults(self, results, pageid): 
    802         """ filter out those without titles if viewing a list of titles """ 
    803         if pageid.endswith('_list'): 
    804             results=[r for r in results if r.Title] 
    805         return results 
    806  
    807489    def getTitleOfACLGroup(self, group): 
    808490        """ gfjreih5eh """ 
     
    821503 
    822504 
    823     # For lemill_multi_browse     
    824505    def getSelectables(self, results): 
    825506        """Try to find which of languages and target groups are selectable""" 
     
    850531        return (langlist, targlist, typelist, subjslist) 
    851532         
    852     # For lemill_multi_browse     
    853533    def getBrowseArguments(self, request): 
    854         """ Gets browsing state from arguments, cooks url, and also gives mapping between visible names and catalog variables """ 
    855         argstring='?' 
     534        """ Gets browsing state from arguments and give mapping between visible names and catalog variables """ 
    856535        argdict={} 
    857536        has_args=False 
     
    862541            'portal_type':'type', 
    863542            'getSubject_area':'subject_area'} 
    864         for key in request.form.keys(): 
    865             if key in goodargs.keys() and request.form[key]: 
     543        for key in source.keys(): 
     544            if key in goodargs.keys() and source[key]: 
    866545                has_args=True 
    867                 argstring='%s&%s=%s' % (argstring,key,source[key]) 
    868546                argdict[goodargs[key]]=source[key] 
    869         if has_args==False: 
    870             argstring='' 
    871         return {'has_args':has_args, 'argstring':argstring,'argdict':argdict, 'tags':'getTags','target_group':'getTarget_group','language':'Language','portal_type':'Type', 'subject_area':'getSubject_area',  
     547        return {'has_args':has_args,'argdict':argdict, 'tags':'getTags','target_group':'getTarget_group','language':'Language','portal_type':'Type', 'subject_area':'getSubject_area',  
    872548        'resources_tags':'Resource', 'pieces_tags':'Piece','references_tags':'Reference'}   
    873549 
     
    889565        return TEMPLATES.get(template_id, None) 
    890566 
    891     def filterContent(self, results, show_what='resources'): 
    892         if show_what=='content': 
    893             allowed=CONTENT_TYPES 
    894         elif show_what=='activities': 
    895             allowed=('Activity',) 
    896         elif show_what=='tools': 
    897             allowed=('Tool',) 
    898         elif show_what=='resources': 
    899             allowed=MATERIAL_TYPES 
    900         elif show_what=='pieces': 
    901             allowed=('Piece',) 
    902         elif show_what=='references': 
    903             allowed=('LeMillReference',) 
    904  
    905         else: return results 
    906         return filter(lambda x: x.portal_type in allowed, results) 
    907  
    908  
    909  
    910     def tagcloud_type(self,topic_name): 
    911         """ There are content tag clouds by titles """ 
    912         if topic_name=='pieces': return 'piece_titles' 
    913         elif topic_name=='materials': return 'material_titles' 
    914         elif topic_name=='references': return 'reference_titles' # I'm not sure if these are used 
    915         elif topic_name=='content': return 'content_titles' 
    916         else: return 'hits' 
    917567 
    918568    security.declareProtected(ADD_CONTENT_PERMISSION,'lemidlet_post') 
     
    939589    filter_content_types = True 
    940590 
    941     def tagcloud_type(self,topic_name): 
    942         """ Other than community tag clouds count tags by their popularity, except hits """ 
    943         if topic_name=='methods': return 'activity_titles' 
    944         else: return 'hits' 
     591    def getBrowseArguments(self, request): 
     592        """ Gets browsing state from arguments and give mapping between visible names and catalog variables """ 
     593        argdict={} 
     594        has_args=False 
     595        source=request.form         
     596        goodargs={'Language':'language', 
     597            'getTags':'tags'} 
     598        for key in source.keys(): 
     599            if key in goodargs.keys() and source[key]: 
     600                has_args=True 
     601                argdict[goodargs[key]]=source[key] 
     602        return {'has_args':has_args, 'argdict':argdict, 'tags':'getTags', 'language':'Language'}   
     603 
     604    def getSelectables(self, results): 
     605        """Try to find which of languages are found in results""" 
     606        lang_dict = getToolByName(self, 'lemill_tool').language_dict 
     607        langs={} 
     608        # Create dictionaries 
     609        for r in results: 
     610            langs[r.Language]=langs.get(r.Language,0)+1 
     611        # Convert them to tuples where (value, display value) 
     612        langlist=[(lang_dict[x], x, y) for (x,y) in langs.items()] 
     613        langlist.sort() 
     614        return langlist 
    945615     
    946616class LargeToolFolder(LargeSectionFolder): 
     
    953623    filter_content_types = True 
    954624 
    955     def tagcloud_type(self,topic_name): 
    956         """ Other than community tag clouds count tags by their popularity, aka hits """ 
    957         if topic_name=='tools': return 'tool_titles' 
    958         else: return 'hits' 
     625    def getBrowseArguments(self, request): 
     626        """ Gets browsing state from arguments and give mapping between visible names and catalog variables """ 
     627        argdict={} 
     628        has_args=False 
     629        source=request.form         
     630        goodargs={'Language':'language', 
     631            'getTags':'tags'} 
     632        for key in source.keys(): 
     633            if key in goodargs.keys() and source[key]: 
     634                has_args=True 
     635                argdict[goodargs[key]]=source[key] 
     636        return {'has_args':has_args, 'argdict':argdict, 'tags':'getTags', 'language':'Language'}   
     637 
     638    def getSelectables(self, results): 
     639        """Try to find which of languages are found in results""" 
     640        lang_dict = getToolByName(self, 'lemill_tool').language_dict 
     641        langs={} 
     642        # Create dictionaries 
     643        for r in results: 
     644            langs[r.Language]=langs.get(r.Language,0)+1 
     645        # Convert them to tuples where (value, display value) 
     646        langlist=[(lang_dict[x], x, y) for (x,y) in langs.items()] 
     647        langlist.sort() 
     648        return langlist 
    959649 
    960650 
     
    984674            folder.invokeFactory('CollectionsFolder', id='collections') 
    985675        return folder.absolute_url()    
    986  
    987     def tagcloud_type(self,topic_name): 
    988         """ Community tag clouds can use people's activities or group activities as base """ 
    989         if topic_name=='members': return 'member_titles' 
    990         elif topic_name=='groups': return 'group_titles' 
    991         else: return 'hits' 
    992          
    993676 
    994677    def getCollaboration_proposals(self): 
     
    1050733        recents.reverse() 
    1051734        return recents[:5] 
    1052                              
    1053     def getBrowsedStuff(self, topic_name): 
    1054         """ returns nice name for currently browsed content type""" 
    1055         if BROWSING_TITLE_FROM_LOCATION.has_key(topic_name):             
    1056             return BROWSING_TITLE_FROM_LOCATION[topic_name] 
    1057         else: 
    1058             return self.getId() 
    1059          
    1060          
     735                                     
    1061736    def getCollections(self, obj_uid=None): 
    1062737        """ Show collections where object is used.""" 
     
    1074749        return res 
    1075750 
    1076     def filterContent(self, results, show_what='resources'): 
    1077         if show_what=='content': 
    1078             allowed=CONTENT_TYPES 
    1079         elif show_what=='activities': 
    1080             allowed=('Activity',) 
    1081         elif show_what=='tools': 
    1082             allowed=('Tool',) 
    1083         elif show_what=='resources': 
    1084             allowed=MATERIAL_TYPES 
    1085         elif show_what=='pieces': 
    1086             allowed=('Piece',) 
    1087         elif show_what=='references': 
    1088             allowed=('LeMillReference',) 
    1089  
    1090         else: return results 
    1091         return filter(lambda x: x.portal_type in allowed, results) 
     751    def getUrlInsideMemberFolder(self, memberfolder=None, topicid='', here_url=''): 
     752        """ When trying to get url for topics, absolute_url omits the memberfolder, this method puts it back in """ 
     753        if memberfolder: 
     754            return '/'.join((memberfolder.absolute_url(),topicid)) 
     755        else: 
     756            return here_url 
     757 
     758 
     759    def getSelectablesForMembers(self, results): 
     760        """Try to find which of languages and target groups are selectable""" 
     761        lang_dict = getToolByName(self, 'lemill_tool').language_dict 
     762        langs={} 
     763        subjs={} 
     764        locas={} 
     765        # Create dictionaries 
     766        for r in results: 
     767            if r.getLanguage_skills: 
     768                for s in r.getLanguage_skills: 
     769                    langs[s]=langs.get(s,0)+1 
     770            if r.getSubject_area: 
     771                for s in r.getSubject_area: 
     772                    subjs[s]=subjs.get(s,0)+1 
     773            locas[r.getLocation_country]=locas.get(r.getLocation_country,0)+1 
     774                     
     775        # Convert them to tuples where (value, display value) 
     776        langlist=[(lang_dict[x], x, y) for (x,y) in langs.items()] 
     777        subjslist=[(x,x,y) for (x,y) in subjs.items()] 
     778        locaslist=[(x,x,y) for (x,y) in locas.items()] 
     779        langlist.sort() 
     780        subjslist.sort() 
     781        locaslist.sort() 
     782        return (langlist, subjslist,locaslist) 
     783         
     784    def getBrowseArgumentsForMembers(self, request): 
     785        """ Gets browsing state from arguments and give mapping between visible names and catalog variables """ 
     786        argdict={} 
     787        has_args=False 
     788        source=request.form         
     789        goodargs={'getLanguage_skills':'language_skills', 
     790            'getSkills':'skills', 
     791            'getInterests':'interests', 
     792            'getLocation_country':'location_country', 
     793            'getSubject_area':'subject_area'} 
     794        for key in source.keys(): 
     795            if key in goodargs.keys() and source[key]: 
     796                has_args=True 
     797                argdict[goodargs[key]]=source[key] 
     798        return {'has_args':has_args,'argdict':argdict, 'language_skills':'getLanguage_skills','skills':'getSkills','interests':'getInterests','location_country':'getLocation_country', 'subject_area':'getSubject_area'}   
     799 
     800    def getBrowseArgumentsForGroups(self, request): 
     801        """ Gets browsing state from arguments and give mapping between visible names and catalog variables """ 
     802        argdict={} 
     803        has_args=False 
     804        source=request.form         
     805        goodargs={'getLanguage_skills':'language_skills', 
     806            'getTags':'tags'} 
     807        for key in source.keys(): 
     808            if key in goodargs.keys() and source[key]: 
     809                has_args=True 
     810                argdict[goodargs[key]]=source[key] 
     811        return {'has_args':has_args, 'argdict':argdict, 'tags':'getTags', 'language_skills':'getLanguage_skills'}   
     812 
     813    def getSelectablesForGroups(self, results): 
     814        """Try to find which of languages are found in results""" 
     815        lang_dict = getToolByName(self, 'lemill_tool').language_dict 
     816        langs={} 
     817        # Create dictionaries 
     818        for r in results: 
     819            if r.getLanguage_skills: 
     820                for s in r.getLanguage_skills: 
     821                    langs[s]=langs.get(s,0)+1 
     822        # Convert them to tuples where (value, display value) 
     823        langlist=[(lang_dict[x], x, y) for (x,y) in langs.items()] 
     824        langlist.sort() 
     825        return langlist 
    1092826 
    1093827class LargeTrashFolder(LargeSectionFolder): 
  • trunk/LeMillTool.py

    r1745 r1751  
    678678            return True 
    679679 
     680    def prioritizeResults(self, results): 
     681        """ First by language:  
     682            1)selected user interface language 
     683            2)by user profile's language selections 
     684            3)english 
     685            4)others 
     686            secondary sort by points 
     687            """ 
     688        ilanguage=getToolByName(self, 'portal_languages').getLanguageCookie() 
     689        ulanguages=getToolByName(self, 'portal_membership').getHomeFolder().getLanguage_skills() 
     690 
     691        def compfunc(a,b): 
     692            # this looks stupid, but hopefully we don't have to go very far in those ifs per run. 
     693            al=a.Language 
     694            bl=b.Language 
     695            if al==ilanguage and bl!=ilanguage: 
     696                return -1 
     697            if al!=ilanguage and bl==ilanguage: 
     698                return 1 
     699            if al in ulanguages and bl not in ulanguages: 
     700                return -1 
     701            if al not in ulanguages and bl in ulanguages: 
     702                return 1 
     703            if al=='en' and bl!='en': 
     704                return -1 
     705            if al!='en' and bl=='en': 
     706                return 1 
     707            return cmp(b.score, a.score) 
     708             
     709        return results.sort(compfunc) 
     710         
     711                                 
     712 
     713 
    680714 
    681715InitializeClass(LeMillTool) 
  • trunk/SharedMetadata.py

    r1728 r1751  
    162162       ), 
    163163)) 
     164 
    164165 
    165166tags = Schema(( 
  • trunk/config.py

    r1728 r1751  
    225225#put these to dictionary so it won't mess the namespace 
    226226 
    227 TOPIC_CONFIGURATIONS={ 
    228     'language' : {'id':'language', 'title':'Language', 'getmethod':'Language'}, 
    229     'c_language' : {'id':'language', 'title':'Language', 'getmethod':'Language','view_type':'multi_browse'}, 
    230     'tags' : {'id':'tags', 'title':'Tags', 'getmethod':'getTags'}, 
    231     'c_tags' : {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view_type':'multitag_browse'}, 
    232     'drafts' : {'id':'drafts', 'title':'Draft','criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','draft')]}, 
    233     'published' : {'id':'published', 'title':'Published', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]}, 
    234     'language_skills' : {'id':'language', 'title':'Language', 'getmethod':'getLanguage_skills', 'sortby':'getSortable_nicename'}, 
    235     'group_language_skills' : {'id':'group_language', 'title':'Language', 'getmethod':'getLanguage_skills'}, 
    236     'location_topic' : {'id':'country', 'title':'Location', 'getmethod':'getLocation_country', 'sortby':'getSortable_nicename'}, 
    237     'skills' : {'id':'skills', 'title':'Skills', 'getmethod':'getSkills', 'sortby':'getSortable_nicename'}, 
    238     'interests' : {'id':'interests', 'title':'Interests',  'getmethod':'getInterests', 'sortby':'getSortable_nicename'}, 
    239     'recent' : {'id':'recent', 'title':"What's going on",'getmethod':'getLatestEdit', 'sortby':'getLatestEdit', 'reversed':True}, 
    240  
    241     } 
    242  
    243 def tc(topicname): 
    244     return TOPIC_CONFIGURATIONS[topicname] 
    245227 
    246228DEFAULT_TOPIC_VIEW= "lemill_browse_results" 
    247229 
    248 # Folder:((allowed content types), (pregenerated topics)) 
     230# {folder : [(allowed_types, (topic1_conf,topic2_conf)), (allowed_types, (topic1_conf... 
     231 
    249232SECTION_TOPICS = { 
    250     'Methods': # folder where these topics should be created 
    251     [(('Activity',), (tc('language'), tc('tags'), tc('published'), {'id':'method_list', 'title':'Methods'}, {'id':'methods', 'title':'Methods'}))], # list of topics to be created 
    252     'Tools': 
    253     [(('Tool',), (tc('language'), tc('tags'), tc('published'),{'id':'tool_list', 'title':'Tools'},{'id':'tools', 'title':'Tools'}))], 
    254     'Content': 
    255     [(CONTENT_TYPES, (tc('c_tags'), tc('published'), {'id':'content_list', 'title':'Content'}, {'id':'content', 'title':'Content'})), 
    256      (MATERIAL_TYPES+('LeMillReference',), (tc('c_language'),)), 
    257      (MATERIAL_TYPES, (tc('drafts'),  {'id':'materials', 'title':'Materials'}, {'id':'resources_tags', 'title':'Tags','view_type':'multitag_browse','getmethod':'getTags'})), 
    258      (('Piece',), ({'id':'pieces', 'title':'Pieces'}, {'id':'pieces_tags', 'title':'Tags','view_type':'multitag_browse','getmethod':'getTags'})), 
    259      (('LeMillReference',), ({'id':'references', 'title':'References'}, {'id':'references_tags', 'title':'Tags','view_type':'multitag_browse','getmethod':'getTags'})), 
    260      (MATERIAL_TYPES+ACTIVITY_TYPES+TOOLS_TYPES+COMMUNITY_TYPES+('LeMillReference',), (tc('recent'),))], 
     233    'Content':  
     234    # *********************** 
     235    [(CONTENT_TYPES, (  
     236    {'id':'language', 'title':'Language', 'getmethod':'Language', 'view':'lemill_browse_content'}, 
     237    {'id':'tags', 'title':'Tags', 'getmethod':'getTags', 'view':'lemill_browse_content'}, 
     238    {'id':'subject_area', 'title':'Subject area', 'getmethod':'getSubject_area', 'view':'lemill_browse_content'}, 
     239    {'id':'target_group', 'title':'Target group', 'getmethod':'getTarget_group', 'view':'lemill_browse_content'}, 
     240    {'id':'published', 'title':'Published', 'view':'lemill_published_view', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]}, 
     241    {'id':'drafts', 'title':'Draft', 'view':'lemill_published_view', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','draft')]})), 
     242    # +++++++++++++++++++++++ 
     243    (MATERIAL_TYPES, (  
     244    {'id':'resources', 'title':'Resources', 'view':'lemill_titlecloud'},)), 
     245    # +++++++++++++++++++++++ 
     246    (('LeMillReference',), (  
     247    {'id':'references', 'title':'References', 'view':'lemill_titlecloud'},)), 
     248    # +++++++++++++++++++++++ 
     249    (('Piece',), (  
     250    {'id':'pieces', 'title':'Pieces', 'view':'lemill_titlecloud'},)), 
     251    # +++++++++++++++++++++++ 
     252     (MATERIAL_TYPES+ACTIVITY_TYPES+TOOLS_TYPES+COMMUNITY_TYPES+('LeMillReference',), ( 
     253    {'id':'recent', 'title':"What's going on", 'getmethod':'getLatestEdit', 'sortby':'getLatestEdit', 'reversed':True, 'view':'lemill_recent_view'},)) 
     254    # +++++++++++++++++++++++ 
     255    ], 
     256 
     257    'Methods':  
     258    # *********************** 
     259    [(('Activity',),(  
     260    {'id':'language', 'title':'Language', 'getmethod':'Language','view':'lemill_browse_methods'}, 
     261    {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view':'lemill_browse_methods'}, 
     262    {'id':'published', 'title':'Published', 'view':'lemill_published_view','criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]}, 
     263    {'id':'methods', 'title':'Methods', 'view':'lemill_titlecloud'})) 
     264    ], 
     265 
     266    'Tools':  
     267    # *********************** 
     268    [(('Tool',),(  
     269    {'id':'language', 'title':'Language', 'getmethod':'Language','view':'lemill_browse_tools'}, 
     270    {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view':'lemill_browse_tools'}, 
     271    {'id':'published', 'title':'Published', 'view':'lemill_published_view','criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]}, 
     272    {'id':'tools', 'title':'Tools', 'view':'lemill_titlecloud'})) 
     273    ], 
     274 
    261275    'Community': 
    262     [(('GroupBlog',), (tc('tags'), tc('group_language_skills'),  {'id':'group_list', 'title':'Groups'},  {'id':'groups', 'title':'Groups'})), 
    263     (('MemberFolder',), (tc('language_skills'), tc('location_topic'), tc('skills'), tc('interests'),  {'id':'member_list', 'title':'Members','getmethod':'getSortable_nicename','sortby':'getSortable_nicename'},  {'id':'members', 'title':'Members','getmethod':'getSortable_nicename','sortby':'getSortable_nicename'})), 
    264     (('BlogPost',), ({'id':'blogposts', 'title':'Blog posts'}, {'id':'my_blogposts', 'title':'My posts', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]})), 
    265     (ALL_CONTENT_TYPES+('Collection',), ({'id':'portfolio', 'title':'Portfolio',  'getmethod':'getTags','sortby':'getTags', 'criterions':[('ATSelectionCriterion','review_state','public')]},))] 
    266 } 
     276    # *********************** 
     277    [((),( 
     278    {'id':'portfolio', 'title':'Portfolio', 'getmethod':'getTags','sortby':'getTags', 'view':'lemill_portfolio_view','criterions':[('ATSelectionCriterion','review_state','public')]},)), 
     279    # +++++++++++++++++++++++ 
     280    (('MemberFolder',),( 
     281    {'id':'members', 'title':'Members', 'getmethod':'getSortable_nicename', 'sortby':'getSortable_nicename', 'view':'lemill_titlecloud'}, 
     282    {'id':'language', 'title':'Language', 'getmethod':'getLanguage_skills', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'}, 
     283    {'id':'country', 'title':'Location', 'getmethod':'getLocation_country', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'}, 
     284    {'id':'skills', 'title':'Skills', 'getmethod':'getSkills', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'}, 
     285    {'id':'interests', 'title':'Interests',  'getmethod':'getInterests', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'})), 
     286    # +++++++++++++++++++++++ 
     287    (('GroupBlog',),( 
     288    {'id':'groups', 'title':'Groups', 'view':'lemill_titlecloud'}, 
     289    {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view':'lemill_browse_groups'}, 
     290    {'id':'g_language', 'title':'Language', 'getmethod':'getLanguage_skills', 'view':'lemill_browse_groups'})) 
     291    # +++++++++++++++++++++++ 
     292    ]}     
    267293 
    268294TEMPLATES = { 
     
    314340    return us 
    315341 
    316 BROWSING_TITLE_FROM_LOCATION = { 
    317         'country': 'members', 
    318         'language': 'members', 
    319         'skills': 'members', 
    320         'interests': 'members', 
    321         'tags': 'groups', 
    322         'group_language': 'groups', 
    323         'stories':'stories', 
    324         'blogposts':'posts', 
    325         'name':'members', # there is a topic for listing users by name, but there shouldn't be links to it  
    326         'resources':'resources', # no idea where these come from 
    327         'my_blogposts':'posts', # this shouldn't be called 
    328         } 
    329342         
    330343DEFAULT_ICONS = { 
     
    343356        } 
    344357         
    345 # Links at up row are presented in this order, if content type is not in this list, it has order '9' 
    346 FILTER_LINK_ORDER = ('Learning resource', 'Piece', 'LeMillReference') 
    347358 
    348359# Front-page shows only resources that already have stories, no random combinations. 
  • trunk/skins/lemill/lemill_activities_view.pt

    r1738 r1751  
    77<div metal:fill-slot="main" style="width:100%" tal:define="search_results python:here.getSearchObject(portal_type='Activity')"> 
    88 
    9     <span tal:define="samples python:here.getLanguageDependantSamples(search_results);" tal:condition="samples" tal:omit-tag=""> 
     9    <span tal:define="samples python:here.getSamples(search_results);" tal:condition="samples" tal:omit-tag=""> 
    1010    
    1111    <h1 i18n:translate="heading_featured_methods">Featured methods</h1> 
  • trunk/skins/lemill/lemill_browse_macros.pt

    r1728 r1751  
    22      lang="en" 
    33      i18n:domain="lemill"> 
    4  
    5 <!-- different pages have different headings --> 
    6  
    7 <tal:headings metal:define-macro="heading"> 
    8  
    9     <h1 tal:condition="python:here.id=='recent'" i18n:translate="title_whats_going_on">What's going on?</h1> 
    10     <h1 tal:condition="python:here.id=='drafts'" i18n:translate="" tal:content="string:My draft ${parent_folder}"></h1> 
    11     <h1 tal:condition="python:here.id=='published'" i18n:translate="" tal:content="string:My published ${parent_folder}"></h1> 
    12     <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 | nothing">author</span></span></h1> 
    13     <h1 tal:condition="python:here.id=='portfolio' and not filter and searchterm.keys()==['getGroupsShared']" tal:content="here/NiceName | nothing">Group name</h1> 
    14     <h1 tal:condition="python:here.id=='portfolio' and not filter and searchterm.keys()==['Creator']" i18n:translate="heading_user_tagcloud">User tagcloud: <span i18n:name="authors_name" tal:content="here/NiceName | nothing">author</span></h1> 
    15     <h1 tal:condition="python:here.id not in ('drafts','published','portfolio','recent') or (here.id=='portfolio' and len(searchterm)>1)"> 
    16         <tal:cond tal:condition="python: tagcloud_type!='hits'" i18n:translate="" tal:content="string:Browse ${topic_name}"></tal:cond>  
    17         <tal:cond tal:condition="python:tagcloud_type=='hits'"> 
    18             <tal:cond tal:condition="searchterm"> 
    19                 <span i18n:translate="" tal:content="string:Browse ${browsed_stuff} where"/> 
    20           <tal:repeat tal:repeat="si searchterm/items"> 
    21         <span i18n:translate="text_field_is_value"> 
    22                  <span i18n:name="field"><span tal:omit-tag="" i18n:translate="" tal:content="python:searchterm_nice[si[0]].lower()">Field</span></span> is 
    23                  <span i18n:name="value"><span tal:condition="not:can_l10n_topic_values" tal:content="python:value_nice[si[0]]"/><span tal:condition="can_l10n_topic_values" i18n:translate="" tal:content="python:value_nice[si[0]]"/></span> 
    24         </span> 
    25                 <span tal:omit-tag="" tal:condition="not: repeat/si/end" i18n:translate="and">and</span> 
    26           </tal:repeat> 
    27           </tal:cond> 
    28           <span tal:condition="not:searchterm" i18n:translate="" tal:content="string:Browse ${browsed_stuff} by ${topic_name}"/> 
    29         </tal:cond> 
    30     </h1> 
    31     <h2 tal:condition="python:here.id=='recent'"><span tal:define="DateTime python:modules['DateTime'].DateTime;" tal:content="python:'%s, %s' % (DateTime().Day(), DateTime().Date())" /></h2> 
    32  
    33  
    34 </tal:headings> 
    35  
    36  
    37  
    38  
    39 <tal:filters metal:define-macro="filter_links"> 
    40     <legend tal:condition="uplinks"> 
    41         <span tal:omit-tag="" i18n:translate="label_show">Show</span>: 
    42         <tal:repeater repeat="linky uplinks"> 
    43             <tal:defs define="url python:linky[2]; 
    44                             singular python:linky[1][0]; 
    45                             plural python:linky[1][1];">         
    46               <a tal:condition="url"   
    47                 tal:attributes="href url"  
    48                 i18n:translate="" href=""  
    49                 tal:content="plural">learning resources</a> 
    50               <span tal:condition="not:url" tal:content="plural" i18n:translate="">disabled link</span> 
    51             </tal:defs> 
    52             <tal:notlast condition="not:repeat/linky/end"> | </tal:notlast> 
    53         </tal:repeater> 
    54     </legend>     
    55 </tal:filters> 
    56  
    57  
    58 <tal:other_results metal:define-macro="show_other_results"> 
    59 <tal:visibility_condition condition="downdict"> 
    60     <div tal:define="frc python:here.fullResultCount(request, topic_name, topic_get_method, request_opened);                
    61         " tal:omit-tag=""> 
    62              
    63         <span tal:repeat="linkydict downdict/items" tal:omit-tag=""> 
    64         <p tal:define=" 
    65             key python:linkydict[0]; 
    66             url python:linkydict[1][1]; 
    67             singular python:linkydict[1][0][0]; 
    68             plural python:linkydict[1][0][1];             
    69             results_n python:frc[key]; 
    70             nicename python:test(results_n>1, plural.lower(), singular.lower());             
    71             "> 
    72         <tal:worth_listing condition="python:results_n>0 and url!=''"> 
    73             <a href="" tal:attributes="href url"> 
    74         <span i18n:translate="" tal:condition="python:here.id not in ['portfolio', 'recent', 'published']" tal:content="string:Browse matching ${plural/lower}"/> 
    75         <span i18n:translate="" tal:condition="python:here.id=='recent'" tal:content="string:Browse recent ${plural/lower}"/> 
    76         <span i18n:translate="" tal:condition="python:here.id=='published'" tal:content="string:Show my ${plural/lower}"/> 
    77         <tal:portfolio condition="python:here.id=='portfolio'"> 
    78         <tal:trans i18n:translate="" tal:content="string:Browse ${plural/lower} made by" /> 
    79          <span tal:replace="here/NiceName" /> 
    80         </tal:portfolio> 
    81  
    82         (<tal:block tal:content="results_n"/>) 
    83             </a> 
    84         </tal:worth_listing> 
    85         </p> 
    86         </span> 
    87     </div> 
    88 </tal:visibility_condition> 
    89 </tal:other_results> 
    904 
    915<tal:rss_macro metal:define-macro="rss_count"> 
     
    15367                    "> 
    15468            <span tal:attributes="class string:size$tagsize"> 
    155             <a tal:attributes="href python: here.getTagURL(context,topic_get_method,tag_value,filter, insideMemberFolder)"><tal:block tal:condition="not:can_l10n_topic_values" tal:content="nicename"/><tal:block tal:condition="can_l10n_topic_values" i18n:translate="" tal:content="nicename"/></a> 
     69            <a tal:attributes="href python: '%s?%s=%s' % (here_url, topic_get_method, tag_value)" tal:content="nicename" /> 
    15670            </span> 
    15771            </tal:taggyvalues>  
     
    16579</tal:tagcloud2> 
    16680 
    167 <tal:tagcloud3 metal:define-macro="subject_tagcloud"> 
    168  
    169     <div tal:condition="not: wordtuples"> 
    170         <p><strong i18n:domain="plone" i18n:translate="description_no_results_found">No results were found.</strong></p> 
    171     </div> 
    172  
    173     <fieldset tal:condition="wordtuples"> 
    174      
    175     <table class="keyword_list"> 
    176         <tr> 
    177             <td>  
    178             <tal:taggy repeat="wordinfo wordtuples"> 
    179             <tal:taggyvalues define="sort_name python:wordinfo[0]; 
    180                     tagsize python:wordinfo[1]; 
    181                     obj_url python:wordinfo[2]; 
    182                     tag_value python:wordinfo[3]; 
    183                     nicename python:wordinfo[4]; 
    184                     "> 
    185             <span tal:attributes="class string:size$tagsize"> 
    186             <a tal:attributes="href tag_value" i18n:translate="" tal:content="nicename"/> 
    187             </span> 
    188             </tal:taggyvalues>  
    189             <tal:comma tal:condition="not: repeat/wordinfo/end">, </tal:comma> 
    190             </tal:taggy>  
    191             </td> 
    192         </tr> 
    193         </table> 
    194     </fieldset> 
    195  
    196 </tal:tagcloud3> 
    197  
    19881 
    19982</html> 
  • trunk/skins/lemill/lemill_community_view.pt

    r1749 r1751  
    1010                        groups python:context.lemill_usertool.getGroupsList(user.getId());"> 
    1111     
    12    <span tal:define="samples python:here.getSamples(search_results);" tal:condition="samples" tal:omit-tag=""> 
     12   <span tal:define="samples python:here.getSamples(search_results, language_dependant=False);" tal:condition="samples" tal:omit-tag=""> 
    1313    
    1414    <h1 i18n:translate="heading_featured_people">Featured people</h1> 
     
    7575    <ul> 
    7676        <li tal:define="results python:here.getTopResults(group_results, 'getLanguage_skills')"> 
    77             <a i18n:translate="label_browse_by_language" href="group_language" class="byTextsFont">By language</a>: 
     77            <a i18n:translate="label_browse_by_language" href="g_language" class="byTextsFont">By language</a>: 
    7878            <span tal:repeat="result results"> 
    79                 <a href="" tal:attributes="href python:'group_language?getLanguage_skills='+here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, 
     79                <a href="" tal:attributes="href python:'g_language?getLanguage_skills='+here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, 
    8080            </span> 
    8181            <a href="group_language">...</a> 
  • trunk/skins/lemill/lemill_content_view.pt

    r1743 r1751  
    1010 
    1111    <h1 i18n:translate="heading_featured_content">Featured content</h1> 
    12     <span tal:define="samples python:here.getLanguageDependantSamples(search_results);" tal:condition="samples" tal:omit-tag=""> 
     12    <span tal:define="samples python:here.getSamples(material_results);" tal:condition="samples" tal:omit-tag=""> 
    1313 
    1414    <table border="0" cellpadding="0" cellspacing="4" width="550"> 
     
    2828   </span>     
    2929    <h1 i18n:translate="heading_browse_content">Browse content</h1> 
     30     
     31    <ul> 
     32        <li tal:define="results python:here.getTopResults(search_results, 'Language')"> 
     33            <a i18n:translate="label_browse_by_language" href="language" class="byTextsFont">By language</a>: 
     34            <span tal:repeat="result results"> 
     35                <a href="" tal:attributes="href python:'language?Language=%s' % here.url_quote(result)" tal:content="python:here.script_getPrettyLanguage(result)">PLACEHOLDER</a>, 
     36            </span> 
     37            <a href="language">...</a> 
     38        </li> 
    3039 
    31     <tal:tagclouddef define="wordtuples python:here.getUniques(search_results, 'getSubject_area', 'hits')"> 
    32         <tal:tagcloud metal:use-macro="here/lemill_browse_macros/macros/subject_tagcloud" /> 
    33     </tal:tagclouddef> 
     40        <li> 
     41            <a i18n:translate="label_browse_by_title_cloud" href="resources" class="byTextsFont">By title cloud</a> 
     42        </li> 
     43         
     44        <li tal:define="results python:here.getTopResults(material_results, 'getSubject_area')"> 
     45            <a i18n:translate="label_browse_by_subject_area" href="subject_area" class="byTextsFont">By subject area</a>: 
     46            <span tal:repeat="result results"> 
     47                <a href="" tal:attributes="href python:'subject_area?getSubject_area=%s' % here.url_quote(result)" tal:content="result" i18n:translate="">PLACEHOLDER</a>, 
     48            </span> 
     49            <a href="subject_area">...</a> 
     50        </li> 
    3451 
    35     <h1 i18n:translate="heading_tagclouds">Tagclouds</h1> 
    36      
    37      
    38     <a href="pieces_tags">Pieces</a> | <a href="resources_tags">Resources</a> | <a href="references_tags">References</a> 
     52        <li tal:define="results python:here.getTopResults(material_results, 'getTarget_group')"> 
     53            <a i18n:translate="label_browse_by_target_group" href="target_group" class="byTextsFont">By target group</a>: 
     54            <span tal:repeat="result results"> 
     55                <a href="" tal:attributes="href python:'target_group?getTarget_group=%s' % here.url_quote(result)" tal:content="result" i18n:translate="">PLACEHOLDER</a>, 
     56            </span> 
     57            <a href="target_group">...</a> 
     58        </li> 
     59         
     60        <li tal:define="results python:here.getTopResults(search_results, 'getTags')"> 
     61            <a i18n:translate="label_browse_by_tags" href="tags" class="byTextsFont">By tags</a>: 
     62            <span tal:repeat="result results"> 
     63                <a href="" tal:attributes="href python:'tags?getTags=%s' % here.url_quote(result)" tal:content="result">PLACEHOLDER</a>, 
     64            </span> 
     65            <a href="tags?filter=resources">...</a> 
     66        </li> 
     67    </ul> 
    3968 
    40      
    4169    <div style="margin-top:30px"> 
    4270        <a i18n:translate="label_whats_going_on" href="recent">What's going on?</a> | <a i18n:translate="label_faq" href="lemill-faq">FAQ</a> 
    4371    </div> 
    44  
    4572 
    4673</div> 
  • trunk/skins/lemill/lemill_tools_view.pt

    r1738 r1751  
    77<div metal:fill-slot="main" style="width:100%" tal:define="search_results python:here.getSearchObject(portal_type='Tool')"> 
    88 
    9     <span tal:define="samples python:here.getLanguageDependantSamples(search_results);" tal:condition="samples" tal:omit-tag=""> 
     9    <span tal:define="samples python:here.getSamples(search_results);" tal:condition="samples" tal:omit-tag=""> 
    1010    
    1111    <h1 i18n:translate="heading_featured_tools">Featured tools</h1> 
  • trunk/skins/lemill/resource_list_macro.pt

    r1714 r1751  
    44<body> 
    55 
    6  <metal:tag_macro define-macro="show_tags" tal:define="suffix suffix | nothing"> 
    7              <tal:block i18n:translate="label_tags">Tags</tal:block>: 
    8                  <tal:block tal:repeat="tag python:tags[:20]"  tal:omit-tag=""> 
    9                     <a href="#" tal:attributes="href string:${this_section}/tags?getTags=${tag}${suffix}" tal:content="tag">PLACEHOLDER</a><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span> 
    10                  </tal:block> 
    11  </metal:tag_macro> 
    12  
    13  
    14  <metal:inside_list define-macro="MemberFolder_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None; 
     6 
     7 <metal:block define-macro="memberfolder_object_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None; 
    158     interests obj/getInterests | nothing; 
    169     nicename obj/getNicename | nothing; 
    1710     location_country obj/getLocation_country | nothing; 
    18      location_area obj/getLocation_area | nothing; 
    1911     messenger real_obj/getMessenger1 | nothing; 
    20      members_url context/community/members/absolute_url | nothing; 
    21      real_obj obj/getObject; 
     12     obj_url obj/getURL; 
    2213     "> 
    2314 
     
    4132         <span tal:replace="nicename"></span> 
    4233     </a> 
    43         <a tal:condition="messenger" tal:attributes="href messenger"> 
     34        <a tal:condition="python: messenger and not isAnon" tal:attributes="href messenger"> 
    4435            <img src="discussionitem_icon.gif" align="right"/> 
    4536        </a>      
     
    5243            <span tal:replace="nicename"></span> 
    5344        </a> 
    54         <a tal:condition="messenger" tal:attributes="href messenger"> 
     45        <a tal:condition="python: messenger and not isAnon" tal:attributes="href messenger"> 
    5546            <img src="discussionitem_icon.gif" /> 
    5647        </a>      
    5748     </li> 
    58      <li class="browse_info" tal:condition="python:location_country or location_area"> 
     49     <li class="browse_info" tal:condition="location_country"> 
    5950             <tal:block i18n:translate="label_location">Location</tal:block>: 
    60                  <a href="#" tal:attributes="href string:${community_section}/country?getLocation_area=${location_area}" tal:content="location_area">Area</a><tal:comma condition="python: location_country and location_area">, </tal:comma><a href="#" tal:attributes="href string:${community_section}/country?getLocation_country=${location_country}" tal:content="location_country">Country</a> 
     51                <a href="#" tal:attributes="href string:${community_section}/country?getLocation_country=${location_country}" tal:content="location_country">Country</a> 
    6152     </li>         
    6253     <li class="browse_info" tal:condition="interests"> 
     
    7162   </div> 
    7263 
    73  </metal:inside_list> 
    74  
    75  
    76  <metal:inside_list define-macro="GroupBlog_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None; 
     64 </metal:block> 
     65 
     66 
     67 <metal:block define-macro="group_object_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None; 
    7768     name obj/Title | obj/getId; 
    7869     tags obj/getTags; 
     70     obj_url obj/getURL; 
     71     lang obj/getLanguage_skills; 
    7972     "> 
    8073     <div class="coverimage" tal:condition="HasCoverImage"> 
     
    10699          </a> 
    107100      </li> 
    108       <li class="browse_info" tal:condition="tags"> 
    109           <span metal:use-macro="here/resource_list_macro/macros/show_tags"/> 
    110       </li> 
     101    <li class="browse_info" tal:condition="tags"> 
     102        <tal:block i18n:translate="label_tags">Tags</tal:block>: 
     103        <tal:block tal:repeat="tag python:tags[:20]"  tal:omit-tag=""> 
     104            <a href="#" tal:attributes="href string:${tag_link_pref}${tag}" tal:content="tag">PLACEHOLDER</a><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span> 
     105        </tal:block>     
     106    </li> 
     107    <li class="browse_info" tal:condition="lang"> 
     108        <tal:block i18n:translate="label_languages">Languages</tal:block>: 
     109        <tal:block tal:repeat="la lang"  tal:omit-tag=""> 
     110            <a href="#" tal:attributes="href python:'%s%s' % (lang_link_pref, la)" tal:content="python:context.script_getPrettyLanguage(la)">PLACEHOLDER</a><span tal:condition="not:repeat/la/end" tal:omit-tag="">, </span> 
     111        </tal:block>     
     112    </li> 
     113 
    111114     </ul> 
    112115    </div> 
    113  </metal:inside_list> 
    114  
    115  <metal:inside_list define-macro="Resource_info" tal:define="HasCoverImage obj/getHasCoverImage | python:None; 
    116      name obj/Title | obj/getId; 
    117      real_obj obj/getObject|obj; 
    118      creator obj/Creator; 
    119      modDate obj/ModificationDate; 
    120      authors real_obj/getAuthors|python:[creator,]; 
    121      ref_author real_obj/getAuthor | real_obj/getOriginalAuthor | python:None; 
    122      lang obj/Language; 
    123      tags obj/getTags | string:; 
    124      creatorf python:mtool.getHomeFolder(creator); 
    125      creator_nicename creatorf/NiceName | creatorf; 
    126      creator_url creatorf/absolute_url |creatorf; 
     116 </metal:block> 
     117 
     118 
     119 
     120 
     121 
     122<metal:block define-macro="resource_object_info"> 
     123 
     124    <tal:defs define="obj_url obj/getURL | obj/absolute_url; 
     125            showAuthor python:obj.review_state != 'draft'; 
     126            obj_url python:test(use_view_action, '%s/view' % obj_url, obj_url); 
     127            HasCoverImage obj/getHasCoverImage | python:None; 
     128            name obj/Title | obj/getId; 
     129            real_obj obj/getObject|obj; 
     130            creator obj/Creator; 
     131            modDate obj/ModificationDate; 
     132            authors real_obj/getAuthors|python:[creator,]; 
     133            ref_author real_obj/getAuthor | real_obj/getOriginalAuthor | python:None; 
     134            lang obj/Language; 
     135            tags obj/getTags | string:; 
    127136     "> 
    128137 
    129138     <div class="coverimage" tal:condition="HasCoverImage"> 
    130139        <span></span> 
    131          <span tal:define="real_object obj/getObject | nothing; 
    132                            piccyurl real_object/getCoverImageURL | obj/getCoverImageURL; 
    133                            piccyurl piccyurl | real_object/getDefaultIcon;" tal:omit-tag=""> 
     140         <span tal:define="piccyurl real_obj/getCoverImageURL | obj/getCoverImageURL; 
     141                           piccyurl piccyurl | real_obj/getDefaultIcon;" tal:omit-tag=""> 
    134142             <a href="" tal:attributes="href obj_url"> 
    135                  <img src="" tal:attributes="src piccyurl; alt python:obj.meta_type" /> 
     143                 <img src="" tal:attributes="src piccyurl; alt python:obj.portal_type" /> 
    136144             </a> 
    137145         </span> 
     
    140148        <span></span> 
    141149         <a href="" tal:attributes="href obj_url"> 
    142              <img src="" tal:attributes="src python:context.tools.getDefaultIcon(obj.meta_type, obj); alt python:obj.meta_type" height="120" width="120" /> 
     150             <img src="" tal:attributes="src python:context.getDefaultIcon(obj.portal_type, real_obj); alt python:obj.portal_type" height="120" width="120" /> 
    143151         </a> 
    144152     </div> 
     
    146154    <a href=""  
    147155        tal:attributes="href obj_url" class="browse_title_d"> 
    148         <span tal:replace="name"></span> 
     156        <span tal:replace="name"/> 
    149157    </a> 
    150158    <div class="metadata"> 
     
    154162         <a href=""  
    155163             tal:attributes="href obj_url"> 
    156              <strong><span tal:replace="name"></span></strong> 
     164             <strong tal:content="name" /> 
    157165         </a> 
    158166     </li> 
     
    160168     <li class="browse_info" tal:condition="showAuthor"><span i18n:translate="label_authors">Authors</span>: 
    161169        <tal:loop tal:repeat="author authors" condition="not:ref_author"> 
    162 <tal:def tal:define="homefolder python:mtool.getHomeFolder(author);homeurl homefolder/absolute_url|string:"> 
    163 <tal:cond tal:condition="homeurl"> 
    164  <a href="#" tal:attributes="href homeurl"><span tal:replace="python:mtool.getHomeFolder(author).NiceName()"/></a><tal:sep tal:condition="not:repeat/author/end">,</tal:sep> 
    165 </tal:cond> 
    166 <tal:cond tal:condition="not:homeurl"> 
    167 <span tal:replace="author"/><tal:sep tal:condition="not:repeat/author/end">,</tal:sep> 
    168 </tal:cond> 
    169 </tal:def> 
    170 </tal:loop> 
    171 <span tal:condition="ref_author" tal:content="ref_author"></span> 
    172     </li> 
    173     <li class="browse_info" tal:condition="tags"><span metal:use-macro="here/resource_list_macro/macros/show_tags"/></li> 
     170            <tal:def tal:define="homefolder python:mtool.getHomeFolder(author); homeurl homefolder/absolute_url|string:"> 
     171                 <a href="#" tal:condition="homeurl" tal:attributes="href homeurl" tal:content="homefolder/NiceName" /> 
     172                 <span tal:condition="not:homeurl" tal:replace="author" />                     
     173                 <tal:sep tal:condition="not:repeat/author/end">,</tal:sep>  
     174            </tal:def> 
     175        </tal:loop> 
     176        <span tal:condition="ref_author" tal:replace="ref_author"/> 
     177    </li> 
     178    <li class="browse_info" tal:condition="tags"> 
     179        <tal:block i18n:translate="label_tags">Tags</tal:block>: 
     180        <tal:block tal:repeat="tag python:tags[:20]"  tal:omit-tag=""> 
     181            <a href="#" tal:attributes="href string:${link_pref}${tag}" tal:content="tag">PLACEHOLDER</a><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span> 
     182        </tal:block> 
     183     
     184    </li> 
    174185    <li class="browse_info" tal:condition="lang"> 
    175186        <tal:block i18n:domain="plone" i18n:translate="label_language">Language</tal:block>: <span tal:replace="python:here.script_getPrettyLanguage(lang)"></span></li> 
    176     <li class="browse_info"  
    177          tal:condition="python:context.getId()=='recent'"> 
    178          <tal:block i18n:domain="plone" i18n:translate="modified">Modified</tal:block>: 
    179          <span tal:replace="modDate"></span> 
    180     </li> 
    181187    </ul> 
    182188   </div> 
    183  
    184  </metal:inside_list> 
    185  
    186  <metal:inside_list define-macro="recent_event" tal:define=" 
    187      real_obj obj/getObject|obj; 
    188      name real_obj/title_or_id | real_obj/getId; 
    189      last_editor real_obj/getLastEditor | nothing; 
    190      modDate obj/getLatestEdit | real_obj/getLatestEdit; 
    191      creation python:context.script_creationOrModification(modDate, obj.CreationDate); 
    192      editorhome python:mtool.getHomeFolder(last_editor); 
    193      editor_nicename editorhome/NiceName | editorhome; 
    194      editor_url editorhome/absolute_url |editorhome; 
    195      timedif python:context.lemill_tool.getTimeDifference(modDate);      
    196      "> 
    197      <p> 
    198   <metal:use_nicetimes use-macro="here/macros_timedifference/macros/days_ago" /> 
    199     <a href=""  
    200         tal:attributes="href obj_url" tal:content="name"> 
    201     </a> 
    202     <span tal:condition="not:creation" tal:omit-tag="" i18n:translate="was_changed_by">was changed by</span> 
    203     <span tal:condition="creation" tal:omit-tag="" i18n:translate="was_created_by">was created by</span> 
    204     <a href="#" tal:attributes="href editor_url" tal:content="editor_nicename"/> 
    205     </p> 
    206  </metal:inside_list> 
    207  
    208  
    209  
    210 <metal:block define-macro="resources_list" tal:define="inCollection inCollection | nothing">  
    211 <tal:comment replace="nothing"> 
    212 This macro should be called with either "batch" or "object_list" in the namespace, 
    213 containing the list of objects to display. object_list takes precedence over batch. 
    214 </tal:comment> 
    215  
    216 <tal:comment replace="nothing"> 
    217 <!-- 
    218 <div> 
    219 <span  i18n:translate="show">Show</span>: 
    220 <select id="views_menu" name="views_menu" size="1" onchange="listtoggle();"> 
    221     <option>image view</option> 
    222     <option>detail view</option> 
    223 </select> 
    224 </div> 
    225  
    226 <ul id="resource_list" tal:attributes="class python:test(inCollection, 'expanded', 'cover')"> 
    227 --> 
    228  
    229 </tal:comment> 
    230  
    231 <tal:condition define="object_list object_list | batch" condition="python:len(object_list) > 0"> 
    232 <ul id="resource_list" class="expanded"  
    233     tal:define="community_section python:'/'.join((portal_url,'community')); 
    234         content_section python:'/'.join((portal_url,'content')); 
    235         this_section context/getSectionFolder | nothing; 
    236         this_section this_section/absolute_url | content_section; 
    237         recent_page python:context.getId()=='recent'; 
    238         "> 
    239     <li tal:repeat="obj object_list" class="resultobject"> 
    240     <tal:block define="obj_url obj/getURL | obj/absolute_url; 
    241             obj_fine_url obj/getURL | obj/absolute_url; 
    242             portal_type python:obj.portal_type.lower().replace(' ', '_'); 
    243             obj_type portal_type; 
    244             searchterm searchterm|nothing; 
    245             url python:'%s?searchterm=%s'%(test(obj_type in use_view_action, obj_url+'/view', obj_url+'/'), searchterm); 
    246             review_state obj/review_state | nothing; 
    247             showAuthor python:review_state != 'draft'; 
    248             suffix filter | nothing; 
    249             suffix python:test(suffix!=None, '='.join(('&amp;filter',str(suffix))), ''); 
    250             obj_url python: (test(obj_type in ['multimediamaterial', 'pilotmaterial', 'presentationmaterial'], obj_url+'/view', obj_url));"> 
    251             <span tal:condition="inCollection" id="checkboxtd" tal:omit-tag=""> 
    252                 <input type="checkbox" name="" id="" value="True" tal:attributes="name python:repeat['obj'].number(); id python:repeat['obj'].number()" /> 
    253             </span> 
    254             <tal:inside condition="python: obj_type=='memberfolder' and not recent_page"> 
    255                 <metal:tds use-macro="here/resource_list_macro/macros/MemberFolder_info" /> 
    256             </tal:inside> 
    257             <tal:inside condition="python: obj_type=='groupblog' and not recent_page">              
    258                 <metal:tds use-macro="here/resource_list_macro/macros/GroupBlog_info" /> 
    259             </tal:inside> 
    260             <tal:inside condition="python: obj_type!='groupblog' and obj_type!='memberfolder' and not recent_page">              
    261                 <metal:tds use-macro="here/resource_list_macro/macros/Resource_info" /> 
    262             </tal:inside> 
    263             <tal:inside condition="recent_page">              
    264                 <metal:tds use-macro="here/resource_list_macro/macros/recent_event" /> 
    265             </tal:inside> 
    266  
    267  
    268             <span tal:condition="inCollection" tal:omit-tag=""> 
    269                 <div><img src="arrowUp.gif" alt="Move up" title="Move up" i18n:attributes="title label_move_up; alt label_move_up" onClick="" tal:attributes="onClick python:'javascript:location.href=\''+here.absolute_url()+'/script_collection_actions?action=MoveUp&amp;id='+obj.UID()+'\''"/></div> 
    270                  
    271                 <div><img src="arrowDown.gif" alt="Move down" title="Move down" i18n:attributes="title label_move_down; alt label_move_down" onClick="" tal:attributes="onClick python:'javascript:location.href=\''+here.absolute_url()+'/script_collection_actions?action=MoveDown&amp;id='+obj.UID()+'\''"/></div> 
    272             </span> 
    273  
    274         </tal:block> 
     189   </tal:defs> 
     190 
     191</metal:block> 
     192 
     193 
     194 
     195<metal:block define-macro="resources_list">  
     196<ul id="resource_list" class="expanded" tal:define="link_pref string:${context/aq_inner/aq_parent/absolute_url}/tags?getTags="> 
     197    <li tal:repeat="obj batch" class="resultobject"> 
     198        <metal:tds use-macro="here/resource_list_macro/macros/resource_object_info" /> 
    275199    </li> 
    276200</ul> 
    277 </tal:condition> 
    278 <br/> 
    279  
     201</metal:block> 
     202 
     203<metal:block define-macro="members_list">  
     204<ul id="resources_list" class="expanded" tal:define="community_section python: '%s/community' % portal_url;"> 
     205    <li tal:repeat="obj batch" class="resultobject"> 
     206        <metal:tds use-macro="here/resource_list_macro/macros/memberfolder_object_info" /> 
     207    </li> 
     208</ul> 
     209</metal:block> 
     210 
     211<metal:block define-macro="groups_list">  
     212<ul id="resources_list" class="expanded" tal:define="tag_link_pref string:${portal_url}/community/tags?getTags=; 
     213lang_link_pref string:${portal_url}/community/g_language?getLanguage_skills="> 
     214    <li tal:repeat="obj batch" class="resultobject"> 
     215        <metal:tds use-macro="here/resource_list_macro/macros/group_object_info" /> 
     216    </li> 
     217</ul> 
    280218</metal:block> 
    281219 
Note: See TracChangeset for help on using the changeset viewer.