source: trunk/config.py @ 1923

Revision 1923, 15.9 KB checked in by pjotr, 12 years ago (diff)

Fixes #1480, added Gadu-Gadu client to the IM's list, it will require Archetypes update

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