class IResources(Interface): """A folder containing resources. """ title = schema.TextLine(title=_(u"Title"), required=True) description = schema.TextLine( title=_(u"Description"), description=_(u"A short summary of this folder"))
class ICourseContent(Interface): """A folder containing sco, modules, lessons, etc. """ title = schema.TextLine(title=_(u"Title"), required=True) description = schema.TextLine( title=_(u"Description"), description=_(u"A short summary of this folder"))
class ILessons(Interface): """A folder containing sco, modules, lessons, etc. """ #contains('eduintelligent.sco.interfaces.ISCO') title = schema.TextLine(title=_(u"Title"), required=True) description = schema.TextLine( title=_(u"Description"), description=_(u"A short summary of this folder"))
class ICoursesPortlet(IPortletDataProvider): count = schema.Int(title=_(u'Number of courses to display'), description=_(u'Maximum number of courses to be shown'), required=True, default=5) randomize = schema.Bool( title=_(u'Randomize courses'), description=_(u'If enabled, courses to show will be picked randomly.'), default=False)
class AddForm(base.AddForm): form_fields = form.Fields(ICoursesPortlet) label = _(u'Add Course portlet') description = _(u'This portlet displays my courses.') # This method must be implemented to actually construct the object. # The 'data' parameter is a dictionary, containing the values entered # by the user. def create(self, data): assignment = Assignment() form.applyChanges(assignment, self.form_fields, data) return assignment
class ICourseFolder(Interface): """A folder containing courses """ contains('.ICourse') title = schema.TextLine(title=_(u"Title"), required=True) description = schema.TextLine( title=_(u"Description"), description=_(u"A short summary of this folder")) categories = schema.List( title=_(u"Categories"), description=_(u"Classify this Course using the listed categories"), required=True)
from zope.interface import implements from Products.Archetypes import atapi from Products.ATContentTypes.content import folder from Products.ATContentTypes.content.schemata import finalizeATCTSchema from eduintelligent.courses.interfaces import ICourseFolder from eduintelligent.courses.config import PROJECTNAME from eduintelligent.courses.utility import hideMetadataSchema from eduintelligent.courses import coursesMessageFactory as _ CourseFolderSchema = folder.ATBTreeFolderSchema.copy() + atapi.Schema(( atapi.LinesField('categories', storage=atapi.AnnotationStorage(), widget=atapi.LinesWidget(label=_(u"Categories"), description=_(u"One category on each line. Used for grouping courses. <br /> " u"CAUTION: ONCE YOU ADD A NEW CATEGORY, YOU DON'T MODIFY OR DELETE THIS, ONLY YOU CAN ADD NEW CATEGORY"), rows=6, ), ), )) CourseFolderSchema['title'].storage = atapi.AnnotationStorage() CourseFolderSchema['description'].storage = atapi.AnnotationStorage() finalizeATCTSchema(CourseFolderSchema, folderish=True, moveDiscussion=False) hideMetadataSchema(CourseFolderSchema, excludeFromNav=True) class CourseFolder(folder.ATBTreeFolder):
class IBannerProvider(Interface): """A component which can provide an HTML tag for a banner image """ tag = schema.TextLine( title=_(u"A HTML tag to render to show the banner image"))
from Products.Archetypes import atapi from Products.ATContentTypes.content import folder from Products.ATContentTypes.content.schemata import finalizeATCTSchema from eduintelligent.courses.interfaces import ICourseFolder from eduintelligent.courses.config import PROJECTNAME from eduintelligent.courses.utility import hideMetadataSchema from eduintelligent.courses import coursesMessageFactory as _ CourseFolderSchema = folder.ATBTreeFolderSchema.copy( ) + atapi.Schema((atapi.LinesField( 'categories', storage=atapi.AnnotationStorage(), widget=atapi.LinesWidget( label=_(u"Categories"), description=_( u"One category on each line. Used for grouping courses. <br /> " u"CAUTION: ONCE YOU ADD A NEW CATEGORY, YOU DON'T MODIFY OR DELETE THIS, ONLY YOU CAN ADD NEW CATEGORY" ), rows=6, ), ), )) CourseFolderSchema['title'].storage = atapi.AnnotationStorage() CourseFolderSchema['description'].storage = atapi.AnnotationStorage() finalizeATCTSchema(CourseFolderSchema, folderish=True, moveDiscussion=False) hideMetadataSchema(CourseFolderSchema, excludeFromNav=True)
class ManagerRole(object): implements(IPageRole) title = _(u"title_administrator", default=u"Instructor") required_permission = None
class StudentRole(object): implements(IPageRole) title = _(u"title_student", default=u"Student") required_permission = None
from eduintelligent.courses.interfaces import ICourse, IBannerProvider from eduintelligent.courses.config import PROJECTNAME, COURSEBOX_PORTLET_COLUMN from eduintelligent.courses.utility import hideMetadataSchema from eduintelligent.courses.portlets import coursebox from eduintelligent.courses import coursesMessageFactory as _ CourseSchema = folder.ATBTreeFolderSchema.copy() + atapi.Schema( ( atapi.StringField( "courseCode", # required=True, searchable=True, storage=atapi.AnnotationStorage(), widget=atapi.StringWidget( label=_(u"Course code"), description=_(u"This should match the course code used in the " "booking system."), ), ), # By using the name 'image' we can have the image show up in preview # folder listings for free atapi.ImageField( "image", # required=True, languageIndependent=True, storage=atapi.AnnotationStorage(), swallowResizeExceptions=True, # pil_quality=90, # pil_resize_algo='antialias', max_size="no", sizes={"preview": (400, 400), "mini": (200, 200), "icon": (32, 32)},
def title(self): return _(u"Course Box")
def title(self): return _(u'My Courses')
class EditForm(base.EditForm): form_fields = form.Fields(ICoursesPortlet) label = _(u'Edit Courses portlet') description = _(u'This portlet displays my courses.')
class ICourse(Interface): """A Course """ #containers('.ICourseFolder') title = schema.TextLine(title=_(u"Course title"), required=True) description = schema.TextLine( title=_(u"Description"), description=_(u"Plain-text blurb about the course")) course_code = schema.ASCIILine( title=_(u"Course Code"), description=_( u"This should match the course code used by the booking system"), required=True) objetives = schema.SourceText(title=_(u"Objetives"), description=_(u"A objetives of the course"), required=True) start_date = schema.Date( title=_(u"Visible from"), description=_(u"Date when course first appears on the website")) end_date = schema.Date( title=_(u"Visible until"), description=_(u"Date when course last appears on the website")) category = schema.TextLine(title=_(u"Category"), required=True)
from eduintelligent.courses.interfaces import ICourse, IBannerProvider from eduintelligent.courses.config import PROJECTNAME, COURSEBOX_PORTLET_COLUMN from eduintelligent.courses.utility import hideMetadataSchema from eduintelligent.courses.portlets import coursebox from eduintelligent.courses import coursesMessageFactory as _ CourseSchema = folder.ATBTreeFolderSchema.copy() + atapi.Schema(( atapi.StringField( 'courseCode', #required=True, searchable=True, storage=atapi.AnnotationStorage(), widget=atapi.StringWidget( label=_(u"Course code"), description=_(u"This should match the course code used in the " "booking system."))), # By using the name 'image' we can have the image show up in preview # folder listings for free atapi.ImageField( 'image', #required=True, languageIndependent=True, storage=atapi.AnnotationStorage(), swallowResizeExceptions=True, #pil_quality=90, #pil_resize_algo='antialias', max_size='no', sizes={ 'preview': (400, 400),