source: trunk/config.py @ 563

Revision 563, 7.3 KB checked in by jukka, 13 years ago (diff)

Fixed #588, spent 10min.

Line 
1# Copyright 2006 by the LeMill Team (see AUTHORS)
2#
3# This file is part of LeMill.
4#
5# LeMill is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# LeMill is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with LeMill; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19try:
20    from Products.CMFPlone.migrations import v2_5
21except ImportError:
22    PLONE25 = 0
23    PLONE21 = 1 # This is ok since we've never supported anything below Plone 2.1
24else:
25    PLONE25 = 1
26    PLONE21 = 0
27
28from Products.CMFCore import permissions
29from types import UnicodeType
30from Products.ATContentTypes import permission as atpermissions
31
32ADD_TOPICS = atpermissions.AddTopics
33ADD_CONTENT_PERMISSION = permissions.AddPortalContent
34LIST_FOLDER_CONTENTS = permissions.ListFolderContents
35MODIFY_CONTENT = permissions.ModifyPortalContent
36MANAGE_PORTAL = permissions.ManagePortal
37VIEW = permissions.View
38
39# Must match the folder in Products/ where this product is installed
40PROJECTNAME = "LeMill"
41
42#
43REMOTE_SERVERS = ["http://lemill.net"]
44
45MATERIAL_TYPES = ('PresentationMaterial', 'MultimediaMaterial',)
46CONTENT_TYPES = ('Piece',) + MATERIAL_TYPES
47ACTIVITY_TYPES = ('Activity',)
48TOOLS_TYPES = ('Tool',)
49COMMUNITY_MAIN_TYPES = ('GroupBlog','MemberFolder',)
50COMMUNITY_TYPES = ('Story','BlogPost',) + COMMUNITY_MAIN_TYPES
51FEATURED_TYPES = MATERIAL_TYPES + ACTIVITY_TYPES + TOOLS_TYPES + COMMUNITY_MAIN_TYPES
52ALL_CONTENT_TYPES = CONTENT_TYPES + ACTIVITY_TYPES + TOOLS_TYPES + COMMUNITY_TYPES
53SEARCHABLE_TYPES = ALL_CONTENT_TYPES
54l = list(ALL_CONTENT_TYPES)
55l.remove('MemberFolder')
56CREATED_RESOURCES = tuple(l)
57
58# Skin variations. The first one will be the defaul
59SKIN_VARIATIONS = ('Tables','Tableless','EUN')
60SKIN_NAMES = [PROJECTNAME+" " + x for x in SKIN_VARIATIONS]
61# Subdirectory of this product folder which contains our skin folders
62SKINS_DIR = 'skins'
63# List of skin folders that should be included in every skin
64# (each skin will have their own folder, which is the skin name in lowercase, with spaces
65# converted into underscores)
66SKIN_COMMON_FOLDERS=['lemill',]
67# The skin from which to build our own skin
68BASE_SKIN = 'Plone Default'
69
70MIMETYPE_WHITELIST = ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png',
71                      'video/3gpp', 'video/x-msvideo', 'video/mpeg', 'video/mp4',
72                      'video/quicktime', 'video/x-ms-wmv', 'application/x-shockwave-flash',
73                      'audio/mpeg']
74
75#list of shown metadata fields, if 'all' is in array then all fields are shown
76SHOW_METADATA_FIELDS = {'Piece':['all',],
77                        'PresentationMaterial':['all',],
78                        'MultimediaMaterial':['all',],
79                        'Tool':['all',],
80                        'Activity':['all',],
81                        'Story':['all',],
82                       }
83
84# Main sections of the site
85SECTIONS = ('Content','Activities','Tools','Community')
86
87SECTION_PROPERTIES = {
88    'Activities':
89        {'left_slots':('here/portlet_add_activity/macros/portlet', 'here/portlet_related_stories/macros/portlet'),},
90    'Tools':
91        {'left_slots':('here/portlet_add_tool/macros/portlet', 'here/portlet_related_stories/macros/portlet'),},
92    'Content':
93        {'left_slots': ('here/portlet_add_content/macros/portlet', 'here/portlet_related_stories/macros/portlet'),},
94    'Community':
95        {'left_slots':('here/portlet_add_community/macros/portlet',),},
96}
97
98SECTION_FOLDER_TYPES = {
99    'Activities':'ActivityFolder',
100    'Tools':'ToolFolder',
101    'Content':'ContentFolder',
102    'Community':'CommunityFolder'
103}
104
105MEMBERS_FOLDER = 'Community'
106DEFAULT_PORTRAIT = 'default_member.png'
107
108# Custom new member properties
109MEMBER_PROPERTIES=(
110    ('firstname','string',''),
111    ('lastname','string',''),
112    )
113
114# Topic configurations for SECTION_TOPICS only
115target_group = {'id':'target_group', 'title':'Target group', 'orderby':'getTarget_group', 'reversed':False}
116title = {'id':'by_title', 'title':'by title', 'orderby':'sortable_title', 'reversed':False}
117language = {'id':'language', 'title':'Language', 'orderby':'Language', 'reversed':False}
118tags = {'id':'tags', 'title':'Tags', 'orderby':'getTags', 'reversed':False}
119drafts = {'id':'drafts', 'title':'Draft', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','draft')]}
120published = {'id':'published', 'title':'Published', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]}
121language_skills = {'id':'language', 'title':'Language', 'orderby':'getLanguage_skills', 'reversed':False}
122group_language_skills = {'id':'group_language', 'title':'Language', 'orderby':'getLanguage_skills', 'reversed':False}
123name_topic = {'id':'name', 'title':'Name', 'orderby':'getSortable_nicename', 'reversed':False}
124group_name_topic = {'id':'group_name', 'title':'Group name', 'orderby':'sortable_title', 'reversed':False}
125location_topic = {'id':'country', 'title':'Location', 'orderby':'getLocation_country', 'reversed':False}
126skills = {'id':'skills', 'title':'Skills', 'orderby':'getSkills', 'reversed':False}
127interests = {'id':'interests', 'title':'Interests', 'orderby':'getInterests', 'reversed':False}
128
129
130DEFAULT_TOPIC_VIEW= "lemill_browse_results"
131
132# Folder:((allowed content types), (pregenerated topics))
133SECTION_TOPICS = {
134    'Activities':
135    [(('Activity',), (title, language, tags, drafts, published, {'id':'activities', 'title':'Activities'}))],
136    'Tools':
137    [(('Tool',), (title, language, tags, drafts, published,{'id':'tools', 'title':'Tools'}))],
138    'Content':
139    [(CONTENT_TYPES, (language, tags, published, {'id':'content', 'title':'Content'})),
140    (MATERIAL_TYPES, (target_group, drafts,  {'id':'materials', 'title':'Materials'})), (('Piece',), ({'id':'pieces', 'title':'Pieces'},))],
141    'Community':
142    [(('GroupBlog',), (group_name_topic, tags, group_language_skills,  {'id':'groups', 'title':'Groups'})),
143    (('MemberFolder',), (language_skills, name_topic, location_topic, skills, interests,  {'id':'members', 'title':'Members'}))]
144}
145
146TEMPLATES = {
147    'presentation' : {
148        'title'  : 'Presentation - a web page with your slides, comments, and possibly audio/video',
149        'fields' : ['title', 'bodyText', 'audio', 'refsToImages'],
150        'meta_type' : 'PresentationMaterial',
151        },
152    'multimediapage' : {
153        'title'  : 'Multimedia page - text with multimedia elements',
154        'fields' : ['title', 'bodyText', 'mediapieces'],
155        'meta_type' : 'MultimediaMaterial',
156        },
157    }
158
159LICENSES = (('CreativeCommons', '''Creative Commons BY-SA License'''),)
160
161for section in SECTIONS:
162    if section not in SECTION_PROPERTIES.keys():
163        SECTION_PROPERTIES[section]={}
164       
165GLOBALS = globals()
166
167# Supported 3rd party products
168# Fle3 turned off
169FLE3_AVAILABLE=False
170
171def to_unicode(s,encoding='utf-8'):
172    """Convenience method for converting strings to unicode."""
173    us=None
174    if not s:
175        us=u''
176    elif type(s)==UnicodeType:
177        us=s
178    else:
179        us=unicode(s,encoding)
180    return us
Note: See TracBrowser for help on using the repository browser.