Changeset 3013 for trunk


Ignore:
Timestamp:
04/07/10 19:02:27 (10 years ago)
Author:
jukka
Message:

Done #1969, material portlets have tags-section.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CommonMixIn.py

    r3010 r3013  
    526526            'aboutView':False, 
    527527            'editMetadataLink':'', 
     528            'tags':[], 
    528529            'lenCollections':0, 
    529530            'showCollections':False, 
     
    610611            v['discussionLink']= '' 
    611612            v['lenDiscussion'] = 0 
     613 
     614        if hasattr(self, 'tags'): 
     615            v['tags']=self.getTags() 
    612616 
    613617        v['lenCollections'] = lenCollections = self.getCollectionsLen() 
  • trunk/LargeSectionFolder.py

    r3002 r3013  
    3131from AccessControl import ClassSecurityInfo 
    3232from permissions import MODIFY_CONTENT, ADD_CONTENT_PERMISSION, ModerateContent 
    33 from Products.LeMill import LeMillMessageFactory as _ 
     33from messagefactory_ import i18nme as _ 
    3434from CommonMixIn import CommonMixIn 
    3535from Products.ZCatalog.Lazy import Lazy 
     
    201201        return ALL_CONTENT_TYPES 
    202202 
    203     def getMaterialTypes(self): 
     203    def getMaterialTypes(self, no_references=False): 
    204204        """ returns a list of material types """ 
    205         return MATERIAL_TYPES 
     205        if no_references: 
     206            return [x for x in MATERIAL_TYPES if x!='LeMillReference'] 
     207        else: 
     208            return MATERIAL_TYPES 
    206209 
    207210    def getContentTypes(self): 
     
    248251        return "" 
    249252 
    250     def getSectionFolder(self): 
    251         """ return this """ 
    252         return self 
     253    def getSectionFolder(self, bottom=False): 
     254        """ return this or if bottom, then tries to look if there is a section folders beyond this """ 
     255        if not bottom: 
     256            return self 
     257        if isinstance(self.aq_parent,LargeSectionFolder): 
     258            return self.aq_parent.getSectionFolder(bottom=True) 
     259        else: 
     260            return self 
    253261 
    254262 
     
    431439                        continue 
    432440                    problems=True 
    433                     lt.addPortalMessage('text_message_cannot_convert', default='Cannot convert ${obj}.', mapping={'obj':k}) 
     441                    lt.addPortalMessage(_('text_message_cannot_convert'), default='Cannot convert ${obj}.', mapping={'obj':k}) 
    434442            to_folder._delObject(to_obj.id) 
    435443            if not problems: 
    436                 lt.addPortalMessage('text_message_conversion_will_be_fine', default='Checked conversion and it will be fine. Click \'Convert resource\' to do the conversion.') 
     444                lt.addPortalMessage(_('text_message_conversion_will_be_fine'), default='Checked conversion and it will be fine. Click \'Convert resource\' to do the conversion.') 
    437445            if problems: 
    438                 lt.addPortalMessage("text_message_conversion_will_have_problems", default="Indicated fields have text that cannot be copied to other resource type. Click 'Convert resource' if you want to do the conversion anyway.") 
     446                lt.addPortalMessage(_("text_message_conversion_will_have_problems"), default="Indicated fields have text that cannot be copied to other resource type. Click 'Convert resource' if you want to do the conversion anyway.") 
    439447            return REQUEST.RESPONSE.redirect('%s/manage_convert?trial_run=False&from_obj_id=%s&to_obj_type=%s' % (from_obj.absolute_url(), from_obj.id, to_obj_type)) 
    440448 
     
    539547 
    540548        # Return new object 
    541         lt.addPortalMessage('Resource converted succesfully.')         
     549        lt.addPortalMessage(_('Resource converted succesfully.'))         
    542550        if to_obj.portal_type in MATERIAL_TYPES: 
    543551            return REQUEST.RESPONSE.redirect('%s/view' % to_obj.absolute_url())             
     
    829837        return False 
    830838 
    831     def getTemplates(self, aslist=False): 
    832         if not aslist: 
    833             return TEMPLATES 
    834         else:             
    835             # as list = ordered list of dictionaries, original key is under key 'keyname' 
    836             rl=[(value['order'], key, value) for (key,value) in TEMPLATES.items()] 
    837             rl.sort() 
    838             resl=[] 
    839             for (order, key, value) in rl: 
    840                 value['keyname']=key 
    841                 resl.append(value) 
    842             return resl  
    843  
    844  
    845839    def getTemplate(self, template_id): 
    846840        return TEMPLATES.get(template_id, None) 
  • trunk/skins/lemill/portlet_macros.pt

    r3010 r3013  
    9898 
    9999Used by: 
     100All Content: 
     101Uses tags 
     102 
     103<tal:tags_div metal:define-macro="tagsDiv"> 
     104    <div class="tb-portlet" tal:define="url_base python:context.getSectionFolder(bottom=True).absolute_url()"> 
     105        <ul> 
     106           <li> <tal:loopy repeat="tag d/tags"><a href="" tal:attributes="href python:url_base+'/tags?tag='+tag" tal:content="tag" /><span tal:condition="not:repeat/tag/end" tal:omit-tag="">, </span></tal:loopy></li><span i18n:translate="no_tags" tal:condition="not:d/tags">No tags</span> 
     107        </ul> 
     108    </div>     
     109</tal:tags_div> 
     110 
     111 
     112Used by: 
    100113All Resources 
    101114Uses: 
  • trunk/skins/lemill/portlet_material_actions.pt

    r3010 r3013  
    1010 
    1111<tal:block metal:use-macro="here/portlet_macros/macros/editDiv"/> 
     12 
     13<tal:block metal:use-macro="here/portlet_macros/macros/tagsDiv" /> 
    1214 
    1315<tal:block metal:use-macro="here/portlet_macros/macros/collectionsDiv"/> 
Note: See TracChangeset for help on using the changeset viewer.