예제 #1
0
    def allowed_nested_blocks(self):
        """
        Returns a list of allowed nested XBlocks. Each item can be either
        * An XBlock class
        * A NestedXBlockSpec

        If XBlock class is used it is assumed that this XBlock is enabled and allows multiple instances.
        NestedXBlockSpec allows explicitly setting disabled/enabled state, disabled reason (if any) and single/multiple
        instances
        """
        additional_blocks = []
        try:
            from xmodule.video_module.video_module import VideoDescriptor
            additional_blocks.append(
                NestedXBlockSpec(VideoDescriptor,
                                 category='video',
                                 label=_(u"Video")))
        except ImportError:
            pass
        try:
            from imagemodal import ImageModal
            additional_blocks.append(
                NestedXBlockSpec(ImageModal,
                                 category='imagemodal',
                                 label=_(u"Image Modal")))
        except ImportError:
            pass

        return [
            NestedXBlockSpec(AnswerBlock, boilerplate='studio_default'),
            MCQBlock, RatingBlock, MRQBlock, CompletionBlock,
            NestedXBlockSpec(None, category="html", label=self._("HTML")),
            AnswerRecapBlock, MentoringTableBlock, PlotBlock, SliderBlock
        ] + additional_blocks
예제 #2
0
    def allowed_nested_blocks(self):
        """
        Returns a list of allowed nested blocks.

        """
        additional_blocks = []
        try:
            from xmodule.video_module.video_module import VideoBlock
            _spec = NestedXBlockSpec(VideoBlock,
                                     category="video",
                                     label=u"Video")
            additional_blocks.append(_spec)
        except ImportError:
            logger.warning("Unable to import VideoBlock", exc_info=True)

        try:
            from pdf import pdfXBlock
            _spec = NestedXBlockSpec(pdfXBlock, category="pdf", label=u"PDF")
            additional_blocks.append(_spec)
        except ImportError:
            logger.info("Unable to import pdfXblock", exc_info=True)

        try:
            from markdown_xblock import MarkdownXBlock
            _spec = NestedXBlockSpec(MarkdownXBlock,
                                     category="markdown",
                                     label=u"Markdown")
            additional_blocks.append(_spec)
        except ImportError:
            logger.info("Unable to import MarkdownXBlock", exc_info=True)

        return [NestedXBlockSpec(None, category="html", label=u"HTML")
                ] + additional_blocks
예제 #3
0
 def allowed_nested_blocks(self):  # pylint: disable=no-self-use
     return [
         NestedXBlockSpec(GroupActivityXBlock),
         NestedXBlockSpec(GroupProjectNavigatorXBlock,
                          single_instance=True),
         NestedXBlockSpec(DiscussionXBlockShim, single_instance=True)
     ]
예제 #4
0
 def allowed_nested_blocks(self):  # pylint: disable=no-self-use
     return [
         NestedXBlockSpec(NavigationViewXBlock, single_instance=True),
         NestedXBlockSpec(ResourcesViewXBlock, single_instance=True),
         NestedXBlockSpec(SubmissionsViewXBlock, single_instance=True),
         NestedXBlockSpec(AskTAViewXBlock, single_instance=True),
         NestedXBlockSpec(PrivateDiscussionViewXBlock, single_instance=True),
     ]
예제 #5
0
 def allowed_nested_blocks(self):
     return [
         NestedXBlockSpec(EditableXBlock,
                          disabled=True,
                          disabled_reason="Some reason"),
         NestedXBlockSpec(FancyBlockShim,
                          disabled=False,
                          disabled_reason="Irrelevant")
     ]
예제 #6
0
    def allowed_nested_blocks(self):
        """
        Returns a list of allowed nested XBlocks. Each item can be either
        * An XBlock class
        * A NestedXBlockSpec

        If XBlock class is used it is assumed that this XBlock is enabled and allows multiple instances.
        NestedXBlockSpec allows explicitly setting disabled/enabled state,
        disabled reason (if any) and single/multiple instances.
        """
        return [
            ConditionalMessageBlock,
            NestedXBlockSpec(None, category='html', label=self._("HTML")),
            NestedXBlockSpec(ScoreSummaryBlock, single_instance=True),
            NestedXBlockSpec(PerQuestionFeedbackBlock, single_instance=True),
        ]
예제 #7
0
 def allowed_nested_blocks(self):
     return [
         EditableXBlock,
         NestedXBlockSpec(FancyBlockShim,
                          single_instance=True,
                          boilerplate="fancy-boiler")
     ]
예제 #8
0
def xblock_specs_from_categories(categories):
    """
    Return NestedXBlockSpecs for available XBlocks from categories.
    """
    return (NestedXBlockSpec(class_,
                             category=category,
                             label=class_.display_name.default)
            for category, class_ in XBlock.load_classes()
            if category in categories)
예제 #9
0
    def allowed_nested_blocks(self):
        """
        Returns a list of allowed nested XBlocks. Each item can be either
        * An XBlock class
        * A NestedXBlockSpec

        If XBlock class is used it is assumed that this XBlock is enabled and allows multiple instances.
        NestedXBlockSpec allows explicitly setting disabled/enabled state, disabled reason (if any) and single/multiple
        instances
        """
        additional_blocks = []
        try:
            from xmodule.video_module.video_module import VideoBlock
            additional_blocks.append(NestedXBlockSpec(
                VideoBlock, category='video', label=_(u"Video")
            ))
        except ImportError:
            pass
        try:
            from imagemodal import ImageModal
            additional_blocks.append(NestedXBlockSpec(
                ImageModal, category='imagemodal', label=_(u"Image Modal")
            ))
        except ImportError:
            pass

        from .platform_dependencies import XBlockConfiguration
        if XBlockConfiguration:
            opt = XBlockConfiguration.objects.filter(name="pb-swipe")
            if opt.count() and opt.first().enabled:
                additional_blocks.append(SwipeBlock)

        try:
            from ooyala_player.ooyala_player import OoyalaPlayerBlock
            additional_blocks.append(NestedXBlockSpec(
                OoyalaPlayerBlock, category='ooyala-player', label=_(u"Ooyala Player")
            ))
        except ImportError:
            pass

        message_block_shims = [
            NestedXBlockSpec(
                MentoringMessageBlock,
                category='pb-message',
                boilerplate=message_type,
                label=get_message_label(message_type),
            )
            for message_type in (
                'completed',
                'incomplete',
                'max_attempts_reached',
            )
        ]

        return [
            NestedXBlockSpec(AnswerBlock, boilerplate='studio_default'),
            MCQBlock, RatingBlock, MRQBlock, CompletionBlock,
            NestedXBlockSpec(None, category="html", label=self._("HTML")),
            AnswerRecapBlock, MentoringTableBlock, PlotBlock, SliderBlock
        ] + additional_blocks + message_block_shims
예제 #10
0
    def allowed_nested_blocks(self):
        """
        Returns a list of allowed nested XBlocks. Each item can be either
        * An XBlock class
        * A NestedXBlockSpec

        If XBlock class is used it is assumed that this XBlock is enabled and allows multiple instances.
        NestedXBlockSpec allows explicitly setting disabled/enabled state, disabled reason (if any) and single/multiple
        instances
        """
        additional_blocks = []
        try:
            from xmodule.video_module.video_module import VideoDescriptor
            additional_blocks.append(
                NestedXBlockSpec(VideoDescriptor,
                                 category='video',
                                 label=_(u"Video")))
        except ImportError:
            pass
        try:
            from imagemodal import ImageModal
            additional_blocks.append(
                NestedXBlockSpec(ImageModal,
                                 category='imagemodal',
                                 label=_(u"Image Modal")))
        except ImportError:
            pass

        message_block_shims = [
            NestedXBlockSpec(
                MentoringMessageBlock,
                category='pb-message',
                boilerplate=message_type,
                label=get_message_label(message_type),
            ) for message_type in (
                'completed',
                'incomplete',
                'max_attempts_reached',
            )
        ]

        if self.is_assessment:
            message_block_shims.append(
                NestedXBlockSpec(
                    MentoringMessageBlock,
                    category='pb-message',
                    boilerplate='on-assessment-review',
                    label=get_message_label('on-assessment-review'),
                ))

        return [
            NestedXBlockSpec(AnswerBlock, boilerplate='studio_default'),
            MCQBlock, RatingBlock, MRQBlock, CompletionBlock,
            NestedXBlockSpec(None, category="html", label=self._("HTML")),
            AnswerRecapBlock, MentoringTableBlock, PlotBlock, SliderBlock
        ] + additional_blocks + message_block_shims
예제 #11
0
    def allowed_nested_blocks(self):
        """
        Returns a list of allowed nested XBlocks. Each item can be either
        * An XBlock class
        * A NestedXBlockSpec

        If XBlock class is used it is assumed that this XBlock is enabled and allows multiple instances.
        NestedXBlockSpec allows explicitly setting disabled/enabled state, disabled reason (if any) and single/multiple
        instances
        """
        # Import here to avoid circular dependency
        from .step import MentoringStepBlock
        return [
            MentoringStepBlock,
            NestedXBlockSpec(ReviewStepBlock, single_instance=True),
        ]
예제 #12
0
 def allowed_nested_blocks(self):
     return [
         NestedXBlockSpec(UnawareXBlock,
                          category='unaware',
                          label='Unaware Block')
     ]