Exemple #1
0
    def get(self):
        version_number = None

        if (user_models.UserData.current() and
            user_models.UserData.current().developer):
            version_number = self.request_string('version', default=None)

        content_uninitialized = (
            topic_models.TopicVersion.get_default_version() is None)
#        '''
        if content_uninitialized:
            library_content = ('<h1>Content not initialized. '
                               '<a href="/devadmin/content?autoupdate=1">'
                               'Click here</a> '
                               'to autoupdate from iktel.nl.')
        elif version_number:
            layer_cache.disable()
            library_content = library.library_content_html(
                version_number=int(version_number))
        elif self.is_mobile_capable():
            # Only running ajax version of homepage for non-mobile clients
            library_content = library.library_content_html(ajax=False)
        else:
            library_content = library.library_content_html(ajax=True)
 #       '''

#        library_content = library.library_content_html(ajax=True)

        template_values = {
            'library_content': library_content,
        }
        self.render_jinja2_template('browsepage.html', template_values)

        layer_cache.enable()
Exemple #2
0
    def get(self):
        version_number = None

        if (user_models.UserData.current()
                and user_models.UserData.current().developer):
            version_number = self.request_string('version', default=None)

        content_uninitialized = (
            topic_models.TopicVersion.get_default_version() is None)
        #        '''
        if content_uninitialized:
            library_content = ('<h1>Content not initialized. '
                               '<a href="/devadmin/content?autoupdate=1">'
                               'Click here</a> '
                               'to autoupdate from iktel.nl.')
        elif version_number:
            layer_cache.disable()
            library_content = library.library_content_html(
                version_number=int(version_number))
        elif self.is_mobile_capable():
            # Only running ajax version of homepage for non-mobile clients
            library_content = library.library_content_html(ajax=False)
        else:
            library_content = library.library_content_html(ajax=True)
#       '''

#        library_content = library.library_content_html(ajax=True)

        template_values = {
            'library_content': library_content,
        }
        self.render_jinja2_template('browsepage.html', template_values)

        layer_cache.enable()
Exemple #3
0
    def get(self):

        version_number = None

        if models.UserData.current() and models.UserData.current().developer:
            version_number = self.request_string('version', default=None)

        thumbnail_link_sets = new_and_noteworthy_link_sets()

        # If all else fails, just show the TED talk on the homepage
        marquee_video = {
            "youtube_id": "gO-P6Rx9fyk",
            "href": "/video?v=%s" % "gO-P6Rx9fyk",
            "thumb_urls": models.Video.youtube_thumbnail_urls("gO-P6Rx9fyk"),
            "title": 'אקדמיית קהאן ואני10 ברשת אמי"ת',
            "key": "",
        }

        if len(thumbnail_link_sets) > 1:

            day = datetime.datetime.now().day

            # Switch up the first 4 New & Noteworthy videos on a daily basis
            current_link_set_offset = day % len(thumbnail_link_sets)

            # Switch up the marquee video on a daily basis
            marquee_videos = []
            for thumbnail_link_set in thumbnail_link_sets:
                marquee_videos += filter(lambda item: item["marquee"],
                                         thumbnail_link_set)

            if marquee_videos:
                marquee_video = marquee_videos[day % len(marquee_videos)]
                marquee_video["selected"] = True

            if len(thumbnail_link_sets[current_link_set_offset]) < ITEMS_PER_SET:
                # If the current offset lands on a set of videos that isn't a full set, just start
                # again at the first set, which is most likely full.
                current_link_set_offset = 0

            thumbnail_link_sets = thumbnail_link_sets[current_link_set_offset:] + thumbnail_link_sets[:current_link_set_offset]

        default = models.TopicVersion.get_default_version()
        is_mobile = self.is_mobile()
        logging.info("is_mobile = %s", is_mobile)
        if App.is_dev_server and default is None:
            library_content = "<h1>Content not initialized. <a href=\"/devadmin/content?autoupdate=1\">Click here</a> to autoupdate from khanacademy.org."
        elif version_number:
            logging.info("Library for version = %s", version_number)
            layer_cache.disable()
            library_content = library.library_content_html(mobile=is_mobile, version_number=int(version_number))
#        elif not self.is_mobile_capable():
#            # Only running ajax version of homepage for non-mobile clients
#            library_content = library.library_content_html(ajax = True)
        else:
            # if App.is_dev_server:
            #     logging.info("Disabling layer_cache")
            #     layer_cache.disable()
            library_content = library.library_content_html(mobile=is_mobile)

        template_values = {
                            'marquee_video': marquee_video,
                            'thumbnail_link_sets': thumbnail_link_sets,
                            'library_content': library_content,
                            'DVD_list': DVD_list,
                            'is_mobile_allowed': True,
                            'approx_vid_count': models.Video.approx_count(),
                            'exercise_count': models.Exercise.get_count(),
                            'link_heat': self.request_bool("heat", default=False),
                            'version_number': version_number
                        }

        self.render_jinja2_template('homepage.html', template_values)

        layer_cache.enable()
Exemple #4
0
    def get(self):
        version_number = None

        if (user_models.UserData.current() and
            user_models.UserData.current().developer):
            version_number = self.request_string('version', default=None)

        thumbnail_link_sets = new_and_noteworthy_link_sets()

        # If all else fails, just show the TED talk on the homepage
        marquee_video = {
            "youtube_id": "gM95HHI4gLk",
            "href": "/video?v=%s" % "gM95HHI4gLk",
            "thumb_urls": (
                video_models.Video.youtube_thumbnail_urls("gM95HHI4gLk")),
            "title": "Salman Khan talk at TED 2011",
            "key": "",
        }
        if len(thumbnail_link_sets) > 1:

            day = datetime.datetime.now().day

            # Switch up the first 4 New & Noteworthy videos on a daily basis
            current_link_set_offset = day % len(thumbnail_link_sets)

            # Switch up the marquee video on a daily basis
            marquee_videos = []
            for thumbnail_link_set in thumbnail_link_sets:
                marquee_videos += filter(lambda item: item["marquee"],
                                         thumbnail_link_set)

            if marquee_videos:
                marquee_video = marquee_videos[day % len(marquee_videos)]
                marquee_video["selected"] = True

            thumbnail_link_sets = (
                thumbnail_link_sets[current_link_set_offset:]
                + thumbnail_link_sets[:current_link_set_offset])

            # If there is a set of videos that isn't full,
            # move it to the last position in the carousel.
            for i, link_set in enumerate(thumbnail_link_sets):
                if len(link_set) < ITEMS_PER_SET:
                    thumbnail_link_sets[i], thumbnail_link_sets[-1] = (
                            thumbnail_link_sets[-1], thumbnail_link_sets[i])

        content_uninitialized = (
            topic_models.TopicVersion.get_default_version() is None)

        if content_uninitialized:
            library_content = ('<h1>Content not initialized. '
                               '<a href="/devadmin/content?autoupdate=1">'
                               'Click here</a> '
                               'to autoupdate from iktel.nl.')
        elif version_number:
            layer_cache.disable()
            library_content = library.library_content_html(
                version_number=int(version_number))
        elif self.is_mobile_capable():
            # Only running ajax version of homepage for non-mobile clients
            library_content = library.library_content_html(ajax=False)
        else:
            library_content = library.library_content_html(ajax=True)

        from gae_bingo.gae_bingo import create_redirect_url

        donate_redirect_url = create_redirect_url("/donate",
                                                  "hp_donate_button_click")

        from rssblog_model import RSSBlog
        template_values = {
            'rssblog': RSSBlog.get(0, 4),
            'marquee_video': marquee_video,
            'thumbnail_link_sets': thumbnail_link_sets,
            'library_content': library_content,
            'DVD_list': DVD_list,
            'is_mobile_allowed': True,
            'approx_vid_count': video_models.Video.approx_count(),
            'link_heat': self.request_bool("heat", default=False),
            'version_number': version_number,
            'donate_redirect_url': donate_redirect_url
            }

        self.render_jinja2_template('homepage.html', template_values)

        layer_cache.enable()
Exemple #5
0
    def get(self):
        version_number = None

        if user_models.UserData.current() and user_models.UserData.current().developer:
            version_number = self.request_string('version', default=None)

        thumbnail_link_sets = new_and_noteworthy_link_sets()

        # If all else fails, just show the TED talk on the homepage
        marquee_video = {
            "youtube_id": "gM95HHI4gLk",
            "href": "/video?v=%s" % "gM95HHI4gLk",
            "thumb_urls": video_models.Video.youtube_thumbnail_urls("gM95HHI4gLk"),
            "title": "Salman Khan talk at TED 2011",
            "key": "",
        }

        if len(thumbnail_link_sets) > 1:

            day = datetime.datetime.now().day

            # Switch up the first 4 New & Noteworthy videos on a daily basis
            current_link_set_offset = day % len(thumbnail_link_sets)

            # Switch up the marquee video on a daily basis
            marquee_videos = []
            for thumbnail_link_set in thumbnail_link_sets:
                marquee_videos += filter(lambda item: item["marquee"],
                                         thumbnail_link_set)

            if marquee_videos:
                marquee_video = marquee_videos[day % len(marquee_videos)]
                marquee_video["selected"] = True

            if len(thumbnail_link_sets[current_link_set_offset]) < ITEMS_PER_SET:
                # If the current offset lands on a set of videos that isn't a full set, just start
                # again at the first set, which is most likely full.
                current_link_set_offset = 0

            thumbnail_link_sets = thumbnail_link_sets[current_link_set_offset:] + thumbnail_link_sets[:current_link_set_offset]

        default = topic_models.TopicVersion.get_default_version()
        if App.is_dev_server and default is None:
            library_content = "<h1>Content not initialized. <a href=\"/devadmin/content?autoupdate=1\">Click here</a> to autoupdate from khanacademy.org."
        elif version_number:
            layer_cache.disable()
            library_content = library.library_content_html(version_number=int(version_number))
        elif not self.is_mobile_capable():
            # Only running ajax version of homepage for non-mobile clients
            library_content = library.library_content_html(ajax = True)
        else:
            library_content = library.library_content_html()
            
        from gae_bingo.gae_bingo import ab_test, create_redirect_url

        donate_button_test = ab_test("hp_donate_button",
                                     {"button":1, "text":99},
                                     conversion_name=['hp_donate_button_click', 'hp_donate_button_paypal'])
        donate_redirect_url = create_redirect_url("/donate", "hp_donate_button_click")

        template_values = {
                            'marquee_video': marquee_video,
                            'thumbnail_link_sets': thumbnail_link_sets,
                            'library_content': library_content,
                            'DVD_list': DVD_list,
                            'is_mobile_allowed': True,
                            'approx_vid_count': video_models.Video.approx_count(),
                            'link_heat': self.request_bool("heat", default=False),
                            'version_number': version_number,
                            'donate_button_test': donate_button_test,
                            'donate_redirect_url': donate_redirect_url
                        }

        self.render_jinja2_template('homepage.html', template_values)

        layer_cache.enable()
Exemple #6
0
 def get(self):
     some_value = 100
     template_values = {'some_value': some_value,}
     self.render_jinja2_template('new_page.html', template_values)
     layer_cache.enable()
 def get(self):
     some_value = 100
     template_values = {'some_value': some_value,}
     self.render_jinja2_template('privacybeleid.html', template_values)
     layer_cache.enable()
Exemple #8
0
    def get(self):
        version_number = None

        if (user_models.UserData.current()
                and user_models.UserData.current().developer):
            version_number = self.request_string('version', default=None)

        thumbnail_link_sets = new_and_noteworthy_link_sets()

        # If all else fails, just show the TED talk on the homepage
        marquee_video = {
            "youtube_id":
            "gM95HHI4gLk",
            "href":
            "/video?v=%s" % "gM95HHI4gLk",
            "thumb_urls":
            (video_models.Video.youtube_thumbnail_urls("gM95HHI4gLk")),
            "title":
            "Salman Khan talk at TED 2011",
            "key":
            "",
        }
        if len(thumbnail_link_sets) > 1:

            day = datetime.datetime.now().day

            # Switch up the first 4 New & Noteworthy videos on a daily basis
            current_link_set_offset = day % len(thumbnail_link_sets)

            # Switch up the marquee video on a daily basis
            marquee_videos = []
            for thumbnail_link_set in thumbnail_link_sets:
                marquee_videos += filter(lambda item: item["marquee"],
                                         thumbnail_link_set)

            if marquee_videos:
                marquee_video = marquee_videos[day % len(marquee_videos)]
                marquee_video["selected"] = True

            thumbnail_link_sets = (
                thumbnail_link_sets[current_link_set_offset:] +
                thumbnail_link_sets[:current_link_set_offset])

            # If there is a set of videos that isn't full,
            # move it to the last position in the carousel.
            for i, link_set in enumerate(thumbnail_link_sets):
                if len(link_set) < ITEMS_PER_SET:
                    thumbnail_link_sets[i], thumbnail_link_sets[-1] = (
                        thumbnail_link_sets[-1], thumbnail_link_sets[i])

        content_uninitialized = (
            App.is_dev_server
            and topic_models.TopicVersion.get_default_version() is None)

        if content_uninitialized:
            library_content = ('<h1>Content not initialized. '
                               '<a href="/devadmin/content?autoupdate=1">'
                               'Click here</a> '
                               'to autoupdate from khanacademy.org.')
        elif version_number:
            layer_cache.disable()
            library_content = library.library_content_html(
                version_number=int(version_number))
        elif self.is_mobile_capable():
            # Only running ajax version of homepage for non-mobile clients
            library_content = library.library_content_html(ajax=False)
        else:
            library_content = library.library_content_html(ajax=True)

        from gae_bingo.gae_bingo import create_redirect_url

        donate_redirect_url = create_redirect_url("/donate",
                                                  "hp_donate_button_click")

        template_values = {
            'marquee_video': marquee_video,
            'thumbnail_link_sets': thumbnail_link_sets,
            'library_content': library_content,
            'DVD_list': DVD_list,
            'is_mobile_allowed': True,
            'approx_vid_count': video_models.Video.approx_count(),
            'link_heat': self.request_bool("heat", default=False),
            'version_number': version_number,
            'donate_redirect_url': donate_redirect_url
        }

        self.render_jinja2_template('homepage.html', template_values)

        layer_cache.enable()
 def get(self):
     some_value = 100
     template_values = {'some_value': some_value,}
     self.render_jinja2_template('gebruiksvoorwaarden.html', template_values)
     layer_cache.enable()