Changeset 1366


Ignore:
Timestamp:
02/12/07 17:32:46 (13 years ago)
Author:
jukka
Message:

Worked #1146, spent 5h. New front page working, if running migration script with

LeMill setup, old redirect to content/ is removed. Writing stories not yet impl

emented. Front page needs css.

M ConfigurationMethods?.py
A skins/lemill/front-page_template.pt
A skins/lemill/front-page.pt
M LeMillTool?.py

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ConfigurationMethods.py

    r1360 r1366  
    112112    ob.content_status_modify(workflow_action='publish') 
    113113 
     114def setupFrontPage(self,portal): 
     115    """Setup the front page.""" 
     116    # Make sure that old PythonScript for redirecting isn't there anymore 
     117    # the content section. 
     118    try: 
     119        portal._delObject('front-page') 
     120    except AttributeError: 
     121        pass 
    114122                   
    115123def setupFolders(self,portal): 
     
    483491    portal.manage_permission('Add portal member',('Manager',)) 
    484492 
     493    # Replace front-page with a PythonScript that does a redirection to 
     494    # the content section. 
     495    try: 
     496        portal._delObject('front-page') 
     497    except AttributeError: 
     498        pass 
     499    id = portal._setObject('front-page',PythonScript('front-page')) 
     500    getattr(portal,id).write( 
     501    """request = container.REQUEST 
     502    RESPONSE =  request.RESPONSE 
     503    RESPONSE.redirect(container.absolute_url()+'/content/') """) 
     504 
    485505######### 
    486506# Collect all setup functions into a setup widget 
  • trunk/LeMillTool.py

    r1298 r1366  
    2323from AccessControl import ClassSecurityInfo 
    2424from Products.CMFCore.utils import getToolByName 
    25 from config import SEARCHABLE_TYPES, CONTENT_TYPES, COMMUNITY_TYPES, TOOLS_TYPES, ACTIVITY_TYPES 
     25from config import SEARCHABLE_TYPES, CONTENT_TYPES, COMMUNITY_TYPES, TOOLS_TYPES, ACTIVITY_TYPES, MATERIAL_TYPES 
    2626from permissions import MANAGE_PORTAL 
    2727from itertools import chain 
    2828from Products.LeMill.Resources import Resource 
     29from random import choice 
     30 
    2931 
    3032import re 
     
    177179        return stri 
    178180 
     181    def getStoryCandidate(self, only_with_story=False): 
     182        """ Random pick for one content, method and tool """ 
     183        pc=getToolByName(self, 'portal_catalog') 
     184        rc=getToolByName(self, 'reference_catalog')         
     185        full_results=pc({'review_state':'public','getHasCoverImage':True}) 
     186        content=[x for x in full_results if x.meta_type in MATERIAL_TYPES] 
     187        method=[x for x in full_results if x.meta_type=='Activity'] 
     188        tool=[x for x in full_results if x.meta_type=='Tool'] 
     189        if content: 
     190            content=choice(content).getObject() 
     191        if method: 
     192            method=choice(method).getObject() 
     193        if tool: 
     194            tool=choice(tool).getObject() 
     195        if content and method and tool: 
     196            story=None 
     197        #    stories=self.reference_catalog({'relationship':'relatedContent', 'targetUID':content.UID()}) 
     198        #    stories=[x for x in stories if x.targetUID==content.UID() 
     199        else: 
     200            story=None 
     201        candidate = {'chcontent':content, 'method':method, 'tool':tool, 'story':story} 
     202        print candidate 
     203        return candidate 
     204         
     205         
     206 
    179207    security.declareProtected(MANAGE_PORTAL, 'manage_cleanAfterSchemaUpdate') 
    180208    def manage_cleanAfterSchemaUpdate(self, admin=''): 
Note: See TracChangeset for help on using the changeset viewer.