Changeset 495


Ignore:
Timestamp:
07/20/06 11:14:36 (13 years ago)
Author:
vahur
Message:

made a list of content types. Also made config.py accessible from python scripts and page templates.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Collection.py

    r490 r495  
    2727from Products.CMFCore.utils import getToolByName 
    2828from AccessControl import ClassSecurityInfo, Unauthorized 
    29 from config import PROJECTNAME 
     29from config import PROJECTNAME, ALL_CONTENT_TYPES, CONTENT_TYPES 
    3030 
    3131schema = BaseSchema + Schema(( 
     
    4545        relationship = 'References', 
    4646        mutator = 'addRefsToResources', 
    47         allowed_types = ('Piece', 'PresentationMaterial', 'Material','Tool','Activity'), 
     47        allowed_types = ALL_CONTENT_TYPES,  
    4848        multiValued = True, 
    4949        widget = ReferenceBrowserWidget( 
     
    160160        has_tool = 0 
    161161        for x in self.getRefsToResources(): 
    162             if x.meta_type in ['Piece', 'PresentationMaterial', 'Material', 'MultimediaMaterial']: has_content = 1 
     162            if x.meta_type in CONTENT_TYPES: has_content = 1 
    163163            if x.meta_type == 'Activity': has_act = 1 
    164164            if x.meta_type == 'Tool': has_tool = 1 
  • trunk/ConfigurationMethods.py

    r475 r495  
    400400    ft = getToolByName(portal, 'portal_factory') 
    401401    types_list = ft.getFactoryTypes() 
    402     for t in ['PresentationMaterial', 'MultimediaMaterial', 'Story', 'Tool', 'Activity']: 
     402    for t in ALL_CONTENT_TYPES: 
    403403        types_list[t] = 1 
    404404    ft.manage_setPortalFactoryTypes(None, types_list) 
  • trunk/LeMillSearchTool.py

    r475 r495  
    2929from xmlrpclib import ProtocolError 
    3030from Acquisition import aq_base 
    31 from config import MANAGE_PORTAL 
     31from config import MANAGE_PORTAL, ALL_CONTENT_TYPES 
    3232 
    3333class LeMillSearchTool(PropertyManager, SimpleItem, UniqueObject): 
     
    8181        if not kw.has_key('portal_type'): 
    8282            # limiting search results to meta_types listed below. I wouldn't want junk on my way 
    83             kw['portal_type'] = ['Piece', 'PresentationMaterial', 'Tool', 'Story', 'Activity'] 
     83            kw['portal_type'] = ALL_CONTENT_TYPES 
    8484        local = self.local_search(REQUEST, **kw) 
    8585        remote = [] 
  • trunk/MemberFolder.py

    r490 r495  
    2727from Products.CMFCore.utils import getToolByName 
    2828from AccessControl import ClassSecurityInfo, Unauthorized 
    29 from config import PROJECTNAME, MODIFY_CONTENT, VIEW 
     29from config import PROJECTNAME, MODIFY_CONTENT, VIEW, ALL_CONTENT_TYPES 
    3030from Products.PloneLanguageTool.availablelanguages import countries 
    3131try: 
     
    516516        """ Search for content-like created by member. """ 
    517517        if not stay: 
     518            # TODO: should make use of the ALL_CONTENT_TYPES here 
    518519            return REQUEST.RESPONSE.redirect('/'.join((self.absolute_url(),'search?portal_type=Material&portal_type=Piece&portal_type=Activity&portal_type=Tool&portal_type=BlogPost&Creator=%s' % self.getId()))) 
    519520             
    520         types=['Material','Piece','Activity','Tool','BlogPost'] 
     521        types = ALL_CONTENT_TYPES + ('BlogPost',) 
    521522        pc = getToolByName(self, 'portal_catalog') 
    522523        results=pc.searchResults(Creator=self.id) 
  • trunk/SectionFolder.py

    r485 r495  
    1717# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    1818 
    19 from config import PROJECTNAME, SHOW_METADATA_FIELDS, TEMPLATES, to_unicode, MIMETYPE_WHITELIST 
     19from config import PROJECTNAME, SHOW_METADATA_FIELDS, TEMPLATES, to_unicode, MIMETYPE_WHITELIST, CONTENT_TYPES, MATERIAL_TYPES 
    2020from Products.Archetypes.public import * 
    2121from Products.ATContentTypes.content.folder import ATFolder, ATFolderSchema 
     
    142142    def getSamples(self, search_results): 
    143143        """ Pick three random objects from search results that have non-default images to display in folders front pages. """ 
    144         pic_results = [x for x in search_results if x.meta_type != 'Piece' and x.getHasCoverImage and x.review_state=='public' and x.Title] 
     144        pic_results = [x for x in search_results if x.meta_type in MATERIAL_TYPES and x.getHasCoverImage and x.review_state=='public' and x.Title] 
    145145        n=min(3,len(pic_results)) 
    146146        samples=sample(pic_results,n) 
     
    300300    meta_type = "Content Folder"  
    301301 
    302     allowed_content_types = ('Piece', 'Material', 'Topic', 'PresentationMaterial') 
     302    allowed_content_types = CONTENT_TYPES +('Topic',) 
    303303    default_view = ('lemill_content_view') 
    304304    filter_content_types = True 
  • trunk/Story.py

    r490 r495  
    2727from Products.CMFCore.utils import getToolByName 
    2828from AccessControl import ClassSecurityInfo, Unauthorized 
    29 from config import PROJECTNAME, MODIFY_CONTENT, VIEW 
     29from config import PROJECTNAME, MODIFY_CONTENT, VIEW, ALL_CONTENT_TYPES 
    3030 
    3131schema = BaseSchema + description + tags + age_group + Schema(( 
     
    4949        index = 'KeywordIndex', 
    5050        write_permission = ModifyPortalContent, 
    51         allowed_types=('Document','Piece','Content','Material', 'PresentationMaterial'), 
     51        allowed_types= ALL_CONTENT_TYPES, 
    5252        widget = ReferenceBrowserWidget( 
    5353            allow_search = True, 
  • trunk/__init__.py

    r464 r495  
    6666    MigrationTool.registerSetupWidget(LeMillSetup) 
    6767 
     68    # making config accessible from python scripts. 
     69    from AccessControl import allow_module 
     70    allow_module('Products.LeMill.config') 
     71 
    6872    # Register our extension profile / customization policy 
    6973    if PLONE25: 
  • trunk/config.py

    r483 r495  
    4040# 
    4141REMOTE_SERVERS = ["http://lemill.net"]  
     42 
     43CONTENT_TYPES = ('Piece', 'PresentationMaterial',) 
     44MATERIAL_TYPES = ('PresentationMaterial',) 
     45ACTIVITY_TYPES = ('Activity',) 
     46TOOLS_TYPES = ('Tool',) 
     47COMMUNITY_TYPES = ('Story',) 
     48ALL_CONTENT_TYPES = CONTENT_TYPES + ACTIVITY_TYPES + TOOLS_TYPES + COMMUNITY_TYPES 
    4249 
    4350# Skin variations. The first one will be the defaul 
  • trunk/skins/lemill/lemill_content_view.pt

    r481 r495  
    66 
    77<div metal:fill-slot="main" style="width:100%" tal:define="piece_results python:here.getSearchObject(portal_type='Piece'); 
    8          material_results python:here.getSearchObject(portal_type=['Material', 'PresentationMaterial', 'MultimediaMaterial']); 
     8         material_results python:here.getSearchObject(portal_type=modules['Products.LeMill.config'].MATERIAL_TYPES); 
    99         search_results python:piece_results+material_results"> 
    1010 
  • trunk/skins/lemill/portlet_related_stories.pt

    r477 r495  
    55    <div metal:define-macro="portlet" 
    66        tal:define="related context/find_related_stories" 
    7         tal:condition="python:not(isAnon) and context.meta_type in ['Activity', 'Tool', 'Piece', 'Material'] and related"> 
     7        tal:condition="python:not(isAnon) and context.meta_type in modules['Products.LeMill.config'].ALL_CONTENT_TYPES and related"> 
    88        <dl class="portlet" id="portlet-"> 
    99             
  • trunk/skins/lemill/start_story.py

    r481 r495  
    99 
    1010from Products.CMFCore.utils import getToolByName 
     11from Products.LeMill.config import CONTENT_TYPES 
    1112 
    1213this_uid = context.UID() 
     
    3536    elif ref.meta_type == 'Tool': 
    3637        refs_to_tools.append(ref.UID()) 
    37     elif ref.meta_type in ['Piece', 'Material', 'PresentationMaterial']: 
     38    elif ref.meta_type in CONTENT_TYPES: 
    3839        refs_to_content.append(ref.UID()) 
    3940    else: 
Note: See TracChangeset for help on using the changeset viewer.