Пример #1
0
    def _render_calendar_summary(self, cal, group_id):
        logging.info("got a calendar from group id: %s" % group_id)
        faculty, student_profile = (cal.header_data['faculty'],
                                    cal.header_data['student_profile'])
        
        ical_urls = ["/student_set/ical/%s/%s.ics" % (q, group_id) for q in ("q1", "q2")]
        ical_url_titles = ["ULB - %s -  %s" % (q, student_profile) for q in ("Q1", "Q2")]


        q1_span = convert_weekspan_to_dates(conf.Q1_WEEKSPAN, conf.FIRST_MONDAY)
        q2_span = convert_weekspan_to_dates(conf.Q2_WEEKSPAN, conf.FIRST_MONDAY)

        template_values = {'gehol_is_down': is_status_down(),
                         'last_status_update': get_last_status_update(),
                         'version':version.VERSION,
                         'gehol_url':make_studentset_gehol_url(group_id, conf.Q1_WEEKSPAN),
                         'cal_faculty':faculty,
                         'cal_student_profile':student_profile,
                         'ical_q1_url':ical_urls[0],
                         'ical_q2_url':ical_urls[1],
                         'ical_q1_url_title':ical_url_titles[0],
                         'ical_q2_url_title':ical_url_titles[1],
                         'q1_span': "from %s to %s" %
                           tuple([q1_span[i].strftime("%B %d, %Y") for i in (0, 1)]),
                         'q2_span': "from %s to %s" %
                           tuple([q2_span[i].strftime("%B %d, %Y") for i in (0, 1)]),
                         'qrcode_page_url': "/student_set/qrcode/%s" % group_id,
                         'qrcode_img_url': conf.STUDENTSET_QRCODE_URL_TEMPLATE % (group_id[3:], 256, 256),
                         'mobile_page_url': '/student_set/m/%s' % group_id[3:],
                         
        }


        current_session_name = conf.CURRENT_EXAM_SESSION
        exam_session = None
        if current_session_name:
            exam_session = self._extract_current_session_info(current_session_name, group_id, student_profile)

        template_values['exam_session'] = exam_session

        self._save_successful_request(student_profile, "/student_set/%s" % group_id)
        path = os.path.join(os.path.dirname(__file__), 'templates/student.html')
        self.response.out.write(template.render(path, template_values))
Пример #2
0
    def _render_calendar_summary(self, cal, group_id):
        """

        """
        faculty, student_profile = (cal.header_data['faculty'],
                                    cal.header_data['student_profile'])
        

        webcal_urls = [conf.WEBCAL_BASE_URL % "/student_set/ical/%s/%s.ics" % (q, group_id) for q in ("q1", "q2")]
        webcal_url_titles = ["ULB - %s -  %s" % (q, student_profile) for q in ("Q1", "Q2")]

        q1_span = convert_weekspan_to_dates(conf.Q1_WEEKSPAN, conf.FIRST_MONDAY)
        q2_span = convert_weekspan_to_dates(conf.Q2_WEEKSPAN, conf.FIRST_MONDAY)


        template_values = {'version':version.VERSION,
                         'gehol_url':make_studentset_gehol_url(group_id, conf.Q1_WEEKSPAN),
                         'cal_faculty':faculty,
                         'cal_student_profile':student_profile,
                         'webcal_q1_url':webcal_urls[0],
                         'webcal_q2_url':webcal_urls[1],
                         'webcal_q1_url_title':webcal_url_titles[0],
                         'webcal_q2_url_title':webcal_url_titles[1],
                         'q1_span': "from %s to %s" %
                           tuple([q1_span[i].strftime("%B %d, %Y") for i in (0, 1)]),
                         'q2_span': "from %s to %s" %
                           tuple([q2_span[i].strftime("%B %d, %Y") for i in (0, 1)]),
                         'full_page_url':"/student_set/%s" % group_id,
        }

        current_session_name = conf.CURRENT_EXAM_SESSION

        exam_session = None
        if current_session_name:
            exam_session = self._extract_current_session_info(current_session_name, group_id, student_profile)

        template_values['exam_session'] = exam_session

        #self._save_successful_request(student_profile, "/student_set/%s" % group_id)

        path = os.path.join(os.path.dirname(__file__), 'templates/student_mobile.html')
        self.response.out.write(template.render(path, template_values))