Exemplo n.º 1
0
    def _render_with_tracking(self, video_id):
        """Embed video and enable event tracking."""
        video_id = jinja_utils.js_string_raw(video_id)
        uid = common_utils.generate_instance_id()
        dom = cElementTree.XML("""
<p>
    <script></script>
    <script></script>
</p>""")
        dom.attrib['id'] = uid
        dom[0].attrib['src'] = os.path.join(RESOURCE_FOLDER, 'youtube_video.js')
        dom[1].text = 'gcbTagYoutubeEnqueueVideo("%s", "%s");' % (video_id, uid)
        return dom
Exemplo n.º 2
0
    def _render_with_tracking(self, video_id):
        """Embed video and enable event tracking."""
        video_id = jinja_utils.js_string_raw(video_id)
        uid = common_utils.generate_instance_id()
        dom = cElementTree.XML("""
<p>
    <script></script>
    <script></script>
</p>""")
        dom.attrib['id'] = uid
        dom[0].attrib['src'] = os.path.join(
            _STATIC_URL, 'js', 'youtube_video.js')
        dom[1].text = 'gcbTagYoutubeEnqueueVideo("%s", "%s");' % (video_id, uid)
        return dom
Exemplo n.º 3
0
    def _create_assessment(self, questions):
        question_id_list = []
        for question in questions:
            question_id_list.append(self._add_question(question))

        questions_data_list = []
        for i in xrange(len(questions)):
            questions_data_list.append(
                str(safe_dom.Element(
                    'question',
                    quid=str(question_id_list[i]),
                    instanceid=common_utils.generate_instance_id())))

        questions_data = '\n'.join(questions_data_list)

        course = self.get_course()
        self._add_assessment(course, 'Next Assessment', questions_data)
    def _create_assessment(self, questions):
        question_id_list = []
        for question in questions:
            question_id_list.append(self._add_question(question))

        questions_data_list = []
        for i in xrange(len(questions)):
            questions_data_list.append(
                str(
                    safe_dom.Element(
                        'question',
                        quid=str(question_id_list[i]),
                        instanceid=common_utils.generate_instance_id())))

        questions_data = '\n'.join(questions_data_list)

        course = self.get_course()
        self._add_assessment(course, 'Next Assessment', questions_data)