source: trunk/Story.py @ 552

Revision 552, 5.1 KB checked in by vahur, 13 years ago (diff)

closes #575 spent 20m

  • Property svn:eol-style set to native
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
19from SharedMetadata import target_group_schema, description, tags
20from Products.Archetypes.public import *
21from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget
22from FieldsWidgets import WYSIWYMField, WYSIWYMWidget
23from Products.CMFCore.permissions import ModifyPortalContent
24from Products.Archetypes.public import BaseContent, registerType
25from Products.Archetypes.atapi import DisplayList
26from Globals import InitializeClass
27from Products.CMFCore.utils import getToolByName
28from AccessControl import ClassSecurityInfo, Unauthorized
29from config import PROJECTNAME, MODIFY_CONTENT, VIEW, ALL_CONTENT_TYPES
30
31schema = BaseSchema + description + tags + target_group_schema + Schema((
32    WYSIWYMField('bodyText',
33        required=True,
34        primary=False,
35        languageIndependent=False,
36        widget=WYSIWYMWidget(
37            label="Body",
38            label_msgid="label_bodytext",
39            description="Stories tell about teachers' experiences with the resources available in LeMill. If you've used the resource in this collection in a learning session, we would really like to hear your experiences.",
40            description_msgid="help_story_body",
41            i18n_domain="lemill",),
42        ),
43
44    ReferenceField('relatedContent',
45        relationship = 'relatesTo',
46        multiValued = True,
47        isMetadata = True,
48        languageIndependent = False,
49        index = 'KeywordIndex',
50        write_permission = ModifyPortalContent,
51        allowed_types= ALL_CONTENT_TYPES,
52        widget = ReferenceBrowserWidget(
53            allow_search = True,
54            allow_browse = True,
55            show_indexes = False,
56            force_close_on_insert = True,
57            startup_directory = "content",
58            size = 4,
59            label = "Related Content",
60            label_msgid = "label_related_content",
61            description = "",
62            description_msgid = "help_story_related_content",
63            i18n_domain = "lemill",
64            visible = {'edit' : 'invisible', 'view' : 'invisible' }
65            )
66        ),
67    ReferenceField('relatedActivities',
68        relationship = 'relatesToActivities',
69        multiValued = True,
70        isMetadata = True,
71        languageIndependent = False,
72        index = 'KeywordIndex',
73        write_permission = ModifyPortalContent,
74        allowed_types=('Document','Activity',),
75        widget = ReferenceBrowserWidget(
76            allow_search = True,
77            allow_browse = True,
78            show_indexes = False,
79            force_close_on_insert = True,
80            startup_directory = "activities",
81            size = 4,
82            label = "Related Activities",
83            label_msgid = "label_related_activities",
84            description = "",
85            description_msgid = "help_story_related_activities",
86            i18n_domain = "lemill",
87            visible = {'edit' : 'invisible', 'view' : 'invisible' }
88            )
89        ),
90    ReferenceField('relatedTools',
91        relationship = 'relatesToTools',
92        multiValued = True,
93        isMetadata = True,
94        languageIndependent = False,
95        index = 'KeywordIndex',
96        write_permission = ModifyPortalContent,
97        allowed_types=('Document','Tool',),
98        widget = ReferenceBrowserWidget(
99            allow_search = True,
100            allow_browse = True,
101            show_indexes = False,
102            force_close_on_insert = True,
103            startup_directory = "tools",
104            size = 4,
105
106            label = "Related Tools",
107            label_msgid = "label_related_tools",
108            description = "",
109            description_msgid = "help_story_related_tools",
110            i18n_domain = "lemill",
111            visible = {'edit' : 'invisible', 'view' : 'invisible' }
112            )
113        )
114))
115
116class Story(BaseContent):
117    """Story"""
118   
119    schema = schema
120    actions= (
121    {
122    'id':'view',
123    'name':'view',
124    'action':'string:${object_url}/story_view',
125    'permission':(VIEW,),
126    },
127    {
128    'id':'edit',
129    'name':'Edit',
130    'action':'string:${object_url}/story_edit',
131    'permission':(MODIFY_CONTENT,),
132    },
133    )
134    meta_type = "Story"
135    archetype_name = "Story" 
136    typeDescription="Story of using a collection of learning resources together."
137    typeDescMsgId='description_story'
138    global_allow = 1
139    security = ClassSecurityInfo()
140    security.declareObjectPublic()
141
142
143registerType(Story, PROJECTNAME)
Note: See TracBrowser for help on using the repository browser.