source: trunk/config.py @ 1907

Revision 1907, 15.7 KB checked in by jukka, 12 years ago (diff)

Closed #1476, spent 20h. I'm allowing editing and deleting resource discussions like any other forum posts: if the discussion is deleted, new one will be created next time someone tries discussion. The default discussion post bodytext is i18n:translated, but once someone changes it, it won't try to translate it anymore.

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
36DELETE_CONTENT = permissions.DeleteObjects
37MANAGE_PORTAL = permissions.ManagePortal
38VIEW = permissions.View
39
40# Must match the folder in Products/ where this product is installed
41PROJECTNAME = "LeMill"
42
43
44# If you want to enable Flickr-search for pieces, you must have a flickr api key.
45# You can get one from http://www.flickr.com/services/
46FLICKR_API_KEY = "774a1f64011ec6166e85def00ec641f6"
47#FLICKR_API_KEY = ""
48
49#
50REMOTE_SERVERS = ["http://lemill.net"]
51
52MATERIAL_TYPES = ('PresentationMaterial', 'MultimediaMaterial', 'PILOTMaterial')
53CONTENT_TYPES = ('Piece','LeMillReference') + MATERIAL_TYPES
54ACTIVITY_TYPES = ('Activity',)
55TOOLS_TYPES = ('Tool',)
56COMMUNITY_MAIN_TYPES = ('GroupBlog','MemberFolder',)
57COMMUNITY_FEATUTED_TYPES = ('MemberFolder',)
58COMMUNITY_TYPES = ('BlogPost',) + COMMUNITY_MAIN_TYPES
59FEATURED_TYPES = MATERIAL_TYPES + ACTIVITY_TYPES + TOOLS_TYPES + COMMUNITY_FEATUTED_TYPES
60ALL_CONTENT_TYPES = CONTENT_TYPES + ACTIVITY_TYPES + TOOLS_TYPES + COMMUNITY_TYPES
61SEARCHABLE_TYPES = ALL_CONTENT_TYPES + ('Collection',)
62l = list(ALL_CONTENT_TYPES)
63l.remove('MemberFolder')
64CREATED_RESOURCES = tuple(l)
65
66TYPE_NAMES = {'Piece':('Media piece','Media pieces'),
67 'Material':('Content', 'Content'),
68 'Learning resource':('Learning resource', 'Learning resources'),
69 'Content': ('Content', 'Content'),
70 'Activity': ('Method', 'Methods'),
71 'Tool': ('Tool', 'Tools'),
72 'MemberFolder': ('Member', 'Members'),
73 'GroupBlog': ('Group', 'Groups'),
74 'BlogPost': ('Forum post', 'Forum posts'),
75 'LeMillReference': ('Reference', 'References'),
76 'MultimediaMaterial': ('Multimedia page', 'Multimedia pages'),
77 'PILOTMaterial': ('PILOT', 'PILOTs'),
78 'PresentationMaterial': ('Presentation', 'Presentations'),     
79 'Collection': ('Collection', 'Collections'),
80 'All': ('All','All'),
81}
82
83
84SUBJECT_AREAS = ["Natural sciences",
85        "Geography",
86        "Chemistry",
87        "Physics",
88        "Biology",
89        "Environmental education",
90        "Language and literature",
91        "Foreign languages",
92        "Mathematics",
93        "Informatics or ICT",
94        "Art",
95        "Music",
96        "History",
97        "Religion",
98        "Philosophy",
99        "Ethics",
100        "Psychology",
101        "Social sciences",
102        "Culture",
103        "Citizenship",
104        "Politics",
105        "Economics",
106        "Media education",
107        "Physical education",
108        "School-community relationship",
109        "Educational administration",
110        "Cross-curricular education"]
111
112
113TAGS_BLACKLIST= ['center', 'span', 'tt', 'big', 'small', 'u', 's', 'strike', 'basefont', 'font', 'div', 'img', 'h1', 'em', 'strong']
114
115INVALID_ATTRIBUTES = ['dir', 'lang', 'valign', 'halign', 'border', 'frame', 'rules', 'cellspacing', 'cellpadding', 'bgcolor', 'style']
116
117# when translating resources values of these fields are copied to translation
118LANGUAGE_INDEPENDENT_FIELDS=['target_group', 'groups', 'file', 'originalAuthor', 'hasCoverImage', 'coverImage', 'originalCoverImage', 'rights', 'video', 'address', 'latestEdit',
119'bodyText','title'
120]
121## added bodyText and title as a temporary fix. Translations should inherit chapter structure and links to pieces, but not text. Doesn't work yet.
122
123# these refer to topics that collect them
124TYPE_LOCATIONS={'Piece':'content.content',
125         'Material':'content.content',
126         'Learning resource':'content.content',
127         'LeMillReference':'content.content',
128         'Content':'content.content',
129         'Activity':'methods.methods',
130         'Tool':'tools.tools',
131         'MemberFolder':'community.members',
132         'GroupBlog':'community.groups',
133         'BlogPost':'community.blogposts'}
134
135TYPE_ABBREVIATIONS={'Piece':'MP',
136            'MultimediaMaterial':'LR',
137            'PresentationMaterial':'LR',
138            'PILOTMaterial':'LR',
139            'LeMillReference':'R',
140            'Activity':'LM',
141            'Tool':'T',
142            'MemberFolder':'M',
143            'GroupBlog':'G',
144            'BlogPost':'FP',
145            'Collection':'C'}
146           
147
148# Skin variations. The first one will be the defaul
149SKIN_VARIATIONS = ('Tables','Tableless')
150SKIN_NAMES = [PROJECTNAME+" " + x for x in SKIN_VARIATIONS]
151# Subdirectory of this product folder which contains our skin folders
152SKINS_DIR = 'skins'
153# List of skin folders that should be included in every skin
154# (each skin will have their own folder, which is the skin name in lowercase, with spaces
155# converted into underscores)
156SKIN_COMMON_FOLDERS=['lemill',]
157# The skin from which to build our own skin
158BASE_SKIN = 'Plone Default'
159
160# application/octet-stream have to be in white list, because the browser recognize FLV as octet stream
161MIMETYPE_WHITELIST = ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png',
162                      'video/3gpp', 'video/x-msvideo', 'video/mpeg', 'video/mp4', 'video/avi',
163                      'video/quicktime', 'video/x-ms-wmv', 'application/x-shockwave-flash',
164                      'audio/mpeg', 'application/octet-stream']
165
166#list of shown metadata fields, if 'all' is in array then all fields are shown
167SHOW_METADATA_FIELDS = {'Piece':['description', 'tags'],
168                        'PresentationMaterial':['all',],
169                        'MultimediaMaterial':['all',],
170                        'Tool':['all',],
171                        'Activity':['all',],
172                        'GroupBlog':['all',],
173                        'LeMillReference' : ['all',],
174                        'PILOTMaterial' : ['all',],
175                       }
176
177# Main sections of the site
178SECTIONS = ('Content','Methods','Tools','Community')
179
180SECTION_PROPERTIES = {
181    'Methods':
182        {'left_slots':('here/portlet_add_activity/macros/portlet',),},
183    'Tools':
184        {'left_slots':('here/portlet_add_tool/macros/portlet',),},
185    'Content':
186        {'left_slots': ('here/portlet_add_content/macros/portlet',),},
187    'Community':
188        {'left_slots':('here/portlet_add_community/macros/portlet',),},
189}
190
191SECTION_FOLDER_TYPES = {
192    'Methods':'LargeActivityFolder',
193    'Tools':'LargeToolFolder',
194    'Content':'LargeContentFolder',
195    'Community':'LargeCommunityFolder'
196}
197
198MEMBERS_FOLDER = 'Community'
199DEFAULT_PORTRAIT = 'default_member.png'
200
201# Custom new member properties
202MEMBER_PROPERTIES=(
203    ('firstname','string',''),
204    ('lastname','string',''),
205    )
206
207INSTANT_MESSENGERS = ('AIM','Google Talk','ICQ','MSN','Skype','Yahoo')
208
209# search terms travel all over the place in urls, often without any
210# (easy) access to types that have these fields. Still they need to be displayed in some nice way.
211FIELD_METHODS_DISPLAY_STRINGS={
212    'getSubject_area':('subject area','subject areas'),
213    'getTarget_group':('target group','target groups'),
214    'sortable_title':('title', 'titles'),
215    'Language':('language', 'languages'),
216    'getTags' : ('tag', 'tags'),
217    'review_state':('status', 'status'),
218    'getLanguage_skills':('language skill', 'language skills'),
219    'getSortable_nicename':('name', 'names'),
220    'sortable_title':('title', 'titles'),
221    'getLocation_country':('country', 'countries'),
222    'getLocation_area':('area', 'areas'),
223    'getSkills':('skill', 'skills'),
224    'getInterests':('interest', 'interests'),
225    'Creator':('creator', 'creators'),
226    }
227
228# Topic configurations for SECTION_TOPICS
229# The idea for topics is that there are few special topics like language, tags, skills, target_group etc. that exist solely to provide tag clouds arranged by values for that field.
230#
231#
232
233
234#put these to dictionary so it won't mess the namespace
235
236
237DEFAULT_TOPIC_VIEW= "lemill_browse_results"
238
239# {folder : [(allowed_types, (topic1_conf,topic2_conf)), (allowed_types, (topic1_conf...
240
241SECTION_TOPICS = {
242    'Content':
243    # ***********************
244    [(CONTENT_TYPES, (
245    {'id':'tags', 'title':'Tags', 'getmethod':'getTags', 'view':'lemill_browse_content'},
246    {'id':'published', 'title':'Published', 'view':'lemill_published_content', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]},)),
247    # +++++++++++++++++++++++
248    (MATERIAL_TYPES, (
249    {'id':'resources', 'title':'Resources', 'view':'lemill_content_titlecloud'},
250    {'id':'drafts', 'title':'Draft', 'view':'lemill_published_view', 'criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','draft')]},)),
251    # +++++++++++++++++++++++
252    (MATERIAL_TYPES+('LeMillReference',), (
253    {'id':'language', 'title':'Language', 'getmethod':'Language', 'view':'lemill_browse_content'},
254    {'id':'subject_area', 'title':'Subject area', 'getmethod':'getSubject_area', 'view':'lemill_browse_content'},
255    {'id':'target_group', 'title':'Target group', 'getmethod':'getTarget_group', 'view':'lemill_browse_content'},)),
256    # +++++++++++++++++++++++
257    (('LeMillReference',), (
258    {'id':'references', 'title':'References', 'view':'lemill_content_titlecloud'},)),
259    # +++++++++++++++++++++++
260    (('Piece',), (
261    {'id':'pieces', 'title':'Pieces', 'view':'lemill_content_titlecloud'},)),
262    # +++++++++++++++++++++++
263     (MATERIAL_TYPES+ACTIVITY_TYPES+TOOLS_TYPES+COMMUNITY_TYPES+('LeMillReference',), (
264    {'id':'recent', 'title':"What's going on", 'getmethod':'getLatestEdit', 'sortby':'getLatestEdit', 'reversed':True, 'view':'lemill_recent_view'},))
265    # +++++++++++++++++++++++
266    ],
267
268    'Methods':
269    # ***********************
270    [(('Activity',),(
271    {'id':'language', 'title':'Language', 'getmethod':'Language','view':'lemill_browse_methods'},
272    {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view':'lemill_browse_methods'},
273    {'id':'published', 'title':'Published', 'view':'lemill_published_view','criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]},
274    {'id':'methods', 'title':'Methods', 'view':'lemill_titlecloud'}))
275    ],
276
277    'Tools':
278    # ***********************
279    [(('Tool',),(
280    {'id':'language', 'title':'Language', 'getmethod':'Language','view':'lemill_browse_tools'},
281    {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view':'lemill_browse_tools'},
282    {'id':'published', 'title':'Published', 'view':'lemill_published_view','criterions':[('ATCurrentAuthorCriterion','Creator',''),('ATSelectionCriterion','review_state','public')]},
283    {'id':'tools', 'title':'Tools', 'view':'lemill_titlecloud'}))
284    ],
285
286    'Community':
287    # ***********************
288    [((),(
289    {'id':'portfolio', 'title':'Portfolio', 'getmethod':'getTags','sortby':'getTags', 'view':'lemill_portfolio_view','criterions':[('ATSelectionCriterion','review_state','public')]},)),
290    # +++++++++++++++++++++++
291    (('MemberFolder',),(
292    {'id':'members', 'title':'Members', 'getmethod':'getSortable_nicename', 'sortby':'getSortable_nicename', 'view':'lemill_titlecloud'},
293    {'id':'language', 'title':'Language', 'getmethod':'getLanguage_skills', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'},
294    {'id':'country', 'title':'Location', 'getmethod':'getLocation_country', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'},
295    {'id':'skills', 'title':'Skills', 'getmethod':'getSkills', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'},
296    {'id':'interests', 'title':'Interests',  'getmethod':'getInterests', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'},
297    {'id':'subject_area', 'title':'Subject area', 'getmethod':'getSubject_area', 'sortby':'getSortable_nicename', 'view':'lemill_browse_members'})),
298    # +++++++++++++++++++++++
299    (('GroupBlog',),(
300    {'id':'groups', 'title':'Groups', 'view':'lemill_titlecloud'},
301    {'id':'tags', 'title':'Tags', 'getmethod':'getTags','view':'lemill_browse_groups'},
302    {'id':'g_language', 'title':'Language', 'getmethod':'getLanguage_skills', 'view':'lemill_browse_groups'},
303    {'id':'group_subject_area', 'title':'Subject area', 'getmethod':'getSubject_area', 'view':'lemill_browse_groups'}))
304    # +++++++++++++++++++++++
305    ]}   
306
307TEMPLATES = {
308    'multimediapage' : {
309        'title'  : 'Multimedia page',
310        'description' : 'Create a web page with images, sound and movie clips.',
311        'fields' : ['title', 'bodyText', 'mediapieces'],
312        'meta_type' : 'MultimediaMaterial',
313        'icon' : 'images/default_multimedia_page.png',
314        'order' : 'A',
315        },
316    'presentation' : {
317        'title'  : 'Presentation',
318        'description' : 'Create a web page with your presentation slides, comments and audio recording.',
319        'fields' : ['title', 'bodyText', 'audio'],
320        'meta_type' : 'PresentationMaterial',
321        'icon' : 'images/default_presentation.png',
322        'order' : 'B',
323        },
324    'PILOTMaterial' : {
325        'title' : 'PILOT',
326        'description' : 'Create a Flash movie for initiating progressive inquiry.',
327        'fields' : ['title', 'shortDescription', 'description', 'bodyText'],
328        'meta_type' : 'PILOTMaterial',
329        'icon' : 'images/default_pilot.png',
330        'order' : 'C',
331        },
332    }
333
334ALL_LICENSES = (('CreativeCommons', '''Creative Commons Attribution-ShareAlike License'''), ('CreativeCommonsAttribution', 'Creative Commons Attribution License'), ('FreeDocumentationLicense', 'Free Documentation License'), ('PublicDomain', 'Public Domain'))
335LICENSES = ALL_LICENSES[0:1]
336
337
338for section in SECTIONS:
339    if section not in SECTION_PROPERTIES.keys():
340        SECTION_PROPERTIES[section]={}
341       
342GLOBALS = globals()
343
344def to_unicode(s,encoding='utf-8'):
345    """Convenience method for converting strings to unicode."""
346    us=None
347    if not s:
348        us=u''
349    elif type(s)==UnicodeType:
350        us=s
351    else:
352        us=unicode(s,encoding)
353    return us
354
355       
356DEFAULT_ICONS = {
357        'Piece':'piece', # shouldn't be called this way
358        'PresentationMaterial':'images/default_presentation.png',
359        'PILOTMaterial':'images/default_pilot.png',
360        'MultimediaMaterial':'images/default_multimedia_page.png',
361        'LeMillReference':'images/default_reference.png',
362        'Tool':'images/default_tool.png',
363        'Activity':'images/default_activity.png',
364        'GroupBlog':'images/default_group.png',
365        'MemberFolder':'images/default_member.png',
366        'Collection':'images/default_collection.png', # doesn't exist
367        'BlogPost':'images/default_member.png', # shouldn't be called this way
368        'Discussion Item': 'images/default_group.png'
369        }
370       
371
372# Front-page shows only resources that already have stories, no random combinations.
373GOOD_STORIES_ONLY = True
374
375TARGET_GROUP = ["pre-school education", "1st grade", "2nd grade", "3rd grade", "4th grade", "5th grade", "6th grade", "7th grade", "8th grade", "9th grade", "10th grade", "11th grade", "12th grade", "higher education", "adult education","teachers", "special education", "", None]
Note: See TracBrowser for help on using the repository browser.