Beispiel #1
0
def createCourse(obj, event):
    """
    This is a callback function for the IObjectInitializedEvent.
    
    This function is called when a course folder has been created.
    
    The ZCML call is:
        <subscriber
            for=".interfaces.ICourse
                Products.Archetypes.interfaces.IObjectInitializedEvent"
            handler=".events.createCourse"
        />
    
    """
    context = ICourse(obj)
    # Make a Lessons folder
    makeItem(context, 
             'lessons',
             'Lessons',
             'Modules',
             'Insert content and configure as necesary')
    # Make Tests
    makeItem(context, 
             'exams',
             'ExamContent',
             'Exámenes',
             'Exámenes del curso')
    #obj.setConstrainTypesMode(constraintypes.ENABLED)        
    #obj.setLocallyAllowedTypes(['Exam'])
    #obj.setImmediatelyAddableTypes(['Exam'])
    #obj.setLayout('view_exams')
    #obj.reindexObject()
    
    # Make Quizzes
    makeItem(context, 
             'quizzes',
             'QuizContent',
             'Quizzes',
             'Quizes de los cursos')
    # obj.setConstrainTypesMode(constraintypes.ENABLED)        
    # obj.setLocallyAllowedTypes(['Quiz'])
    # obj.setImmediatelyAddableTypes(['Quiz'])
    # obj.setLayout('view_quizzes')
    # obj.reindexObject()
    
    # Make Polls
    makeItem(context, 
             'polls',
             'PollContent',
             'Encuestas',
             'Encuestas del Curso')
    
    # Make Files
    makeItem(context, 
             'files',
             'Resources',
             'Recursos',
             'Carpeta contenedora de archivos del curso')
    context.reindexObject()
Beispiel #2
0
def add_course_portlet(obj, event):

    # Only do this if the parent is not a course, i.e. only do it on
    # top-level course. Of course, site managers can move things
    # around once the site structure is created

    parent = aq_parent(aq_inner(obj))
    if ICourse.providedBy(parent):
        return

    # A portlet manager is akin to a column
    column = getUtility(IPortletManager, name=COURSEBOX_PORTLET_COLUMN)

    # We multi-adapt the object and the column to an assignment mapping,
    # which acts like a dict where we can put portlet assignments
    manager = getMultiAdapter((
        obj,
        column,
    ), IPortletAssignmentMapping)

    # We then create the assignment and put it in the assignment manager,
    # using the default name-chooser to pick a suitable name for us.
    assignment = coursebox.Assignment()
    chooser = INameChooser(manager)
    manager[chooser.chooseName(None, assignment)] = assignment
Beispiel #3
0
def editCourse(obj, event):
    """
    This is a callback function for the IObjectEditedEvent.
    
    This function is called when a course folder has been edited.
    
        <subscriber
            for=".interfaces.ICourse
                Products.Archetypes.interfaces.IObjectEditedEvent"
            handler=".events.editCourse"
        />
    
    """
    context = ICourse(obj)
    #Set the instructors
    instructors = context.getLocalRoles('Manager')
    context.setInstructor(instructors)
    #print "editCourse-instructor ",instructors
    
    #Register all the users
    registered = len(context.getRegisteredStudents())
    context.setRegistered(registered)
def add_course_portlet(obj, event):

    # Only do this if the parent is not a course, i.e. only do it on
    # top-level course. Of course, site managers can move things
    # around once the site structure is created

    parent = aq_parent(aq_inner(obj))
    if ICourse.providedBy(parent):
        return

    # A portlet manager is akin to a column
    column = getUtility(IPortletManager, name=COURSEBOX_PORTLET_COLUMN)

    # We multi-adapt the object and the column to an assignment mapping,
    # which acts like a dict where we can put portlet assignments
    manager = getMultiAdapter((obj, column), IPortletAssignmentMapping)

    # We then create the assignment and put it in the assignment manager,
    # using the default name-chooser to pick a suitable name for us.
    assignment = coursebox.Assignment()
    chooser = INameChooser(manager)
    manager[chooser.chooseName(None, assignment)] = assignment
def editCourse(obj, event):
    """
    This is a callback function for the IObjectEditedEvent.
    
    This function is called when a course folder has been edited.
    
        <subscriber
            for=".interfaces.ICourse
                Products.Archetypes.interfaces.IObjectEditedEvent"
            handler=".events.editCourse"
        />
    
    """
    context = ICourse(obj)
    #Set the instructors
    instructors = context.getLocalRoles('Manager')
    context.setInstructor(instructors)
    #print "editCourse-instructor ",instructors
    
    #Register all the users
    registered = len(context.getRegisteredStudents())
    context.setRegistered(registered)
def createCourse(obj, event):
    """
    This is a callback function for the IObjectInitializedEvent.
    
    This function is called when a course folder has been created.
    
    The ZCML call is:
        <subscriber
            for=".interfaces.ICourse
                Products.Archetypes.interfaces.IObjectInitializedEvent"
            handler=".events.createCourse"
        />
    
    """
    context = ICourse(obj)
    # Make a Lessons folder
    makeItem(context, 
             'lessons',
             'Lessons',
             'Modules',
             'Insert content and configure as necesary')
    # Make Forum
    makeItem(context, 
             'forum',
             'Ploneboard',
             'Foro',
             'Necesita configurar el foro', 
             publish=False)
    # Make Tests
    makeItem(context, 
             'exams',
             'ExamContent',
             'Exámenes',
             'Exámenes del curso')
    #obj.setConstrainTypesMode(constraintypes.ENABLED)        
    #obj.setLocallyAllowedTypes(['Exam'])
    #obj.setImmediatelyAddableTypes(['Exam'])
    #obj.setLayout('view_exams')
    #obj.reindexObject()
    
    # Make Quizzes
    makeItem(context, 
             'quizzes',
             'QuizContent',
             'Quizzes',
             'Quizes de los cursos')
    # obj.setConstrainTypesMode(constraintypes.ENABLED)        
    # obj.setLocallyAllowedTypes(['Quiz'])
    # obj.setImmediatelyAddableTypes(['Quiz'])
    # obj.setLayout('view_quizzes')
    # obj.reindexObject()
    
    # Make Polls
    makeItem(context, 
             'polls',
             'PollContent',
             'Encuestas',
             'Encuestas del Curso')
    # obj.setConstrainTypesMode(constraintypes.ENABLED)        
    # obj.setLocallyAllowedTypes(['PlonePopoll'])
    # obj.setImmediatelyAddableTypes(['PlonePopoll'])
    # obj.setLayout('view_polls')
    # obj.reindexObject()
    
    # Make Chat
    #makeItem(context, 'chat','Chat',_('Chat'),_('Course Chat'))
    
    # Make Glossary
    makeItem(context, 
             'glossary',
             'PloneGlossary',
             'Glosario',
             'Glosario del Curso')
    
    # Make Faq
    makeItem(context, 
             'faq',
             'FaqFolder',
             'Faq',
             'Faq del Curso')
    
    # Make Files
    makeItem(context, 
             'files',
             'Resources',
             'Recursos',
             'Carpeta contenedora de archivos del curso')
    
    # Make Bibliography
    makeItem(context, 
             'bibliography',
             'Biblio',
             u'Bibliografía',
             u'Para utilizar la bibliografía debe personalizar la categorías en la pestaña editar')
    
    context.reindexObject()
 def courseURL(self):
     context = aq_inner(self.context)
     while not ICourse.providedBy(context):
         context = aq_parent(aq_inner(context))            
     return context.absolute_url()
Beispiel #8
0
 def courseURL(self):
     context = aq_inner(self.context)
     while not ICourse.providedBy(context):
         context = aq_parent(aq_inner(context))
     return context.absolute_url()