Beispiel #1
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)
    context = {
        'version': 'none',
    }

    # animation triggered for ?v=1 via data attribute in template
    if request.GET.get('v', '') == '1':
        context['version'] = '1'

    if scene == '2':
        if lang_file_is_active('firefox/new/horizon',
                               l10n_utils.get_locale(request)):
            template = 'firefox/new/horizon/scene2.html'
        else:
            template = 'firefox/new/scene2.html'
    # if no/incorrect scene specified, show scene 1
    else:
        if lang_file_is_active('firefox/new/horizon',
                               l10n_utils.get_locale(request)):
            template = 'firefox/new/horizon/scene1.html'
        else:
            template = 'firefox/new/scene1.html'

    return l10n_utils.render(request, template, context)
Beispiel #2
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)
    experience = request.GET.get('xv', None)
    variant = request.GET.get('v', None)
    locale = l10n_utils.get_locale(request)

    if scene == '2':
        # `wait-face`, `reggiewatts` variations are currently localized for both en-US and de locales.
        if lang_file_is_active('firefox/new/wait-face',
                               locale) and experience == 'waitface':
            template = 'firefox/new/wait-face/scene2.html'
        elif lang_file_is_active('firefox/new/reggiewatts',
                                 locale) and experience == 'reggiewatts':
            template = 'firefox/new/reggie-watts/scene2.html'
        else:
            template = 'firefox/new/scene2.html'
    # if no/incorrect scene specified, show scene 1
    else:
        if lang_file_is_active('firefox/new/wait-face',
                               locale) and experience == 'waitface':
            if variant == 'b':
                template = 'firefox/new/wait-face/scene1-video.html'
            else:
                template = 'firefox/new/wait-face/scene1.html'
        elif lang_file_is_active('firefox/new/reggiewatts',
                                 locale) and experience == 'reggiewatts':
            template = 'firefox/new/reggie-watts/scene1.html'
        else:
            template = 'firefox/new/scene1.html'

    return l10n_utils.render(request, template)
Beispiel #3
0
def home(request, template='mozorg/home/home.html'):
    locale = l10n_utils.get_locale(request)
    donate_params = settings.DONATE_PARAMS.get(
        locale, settings.DONATE_PARAMS['en-US'])

    # presets are stored as a string but, for the takeover modal
    # we need it as a list.
    donate_params['preset_list'] = donate_params['presets'].split(',')

    if lang_file_is_active('mozorg/home/index-2016', locale):
        # check for variant - fundraising takeover
        v = request.GET.get('v', None)

        if (v == 'b'):
            template = 'mozorg/home/home-b.html'.format(v)
        else:
            template = 'mozorg/home/home.html'
    else:
        template = 'mozorg/home/home-voices.html'

    return l10n_utils.render(
        request, template, {
            'donate_params': donate_params,
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #4
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)

    # `wait-face`, `reggiewatts` variations are currently localized for both en-US and de locales.
    if lang_file_is_active('firefox/new/wait-face', locale) and experience == 'waitface':
        template = 'firefox/new/wait-face/scene2.html'
    elif lang_file_is_active('firefox/new/reggiewatts', locale) and experience == 'reggiewatts':
        template = 'firefox/new/reggie-watts/scene2.html'
    elif locale == 'de' and experience == 'berlin':
        template = 'firefox/new/berlin/scene2.html'
    elif locale == 'de' and experience == 'herz':
        template = 'firefox/new/berlin/scene2-herz.html'
    elif locale == 'en-US':
        if experience in ['portland', 'forgood']:
            template = 'firefox/new/portland/scene2.html'
        elif experience in ['portland-fast', 'fast']:
            template = 'firefox/new/portland/scene2-fast.html'
        elif experience in ['portland-safe', 'safe']:
            template = 'firefox/new/portland/scene2-safe.html'
        else:
            template = 'firefox/new/scene2.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template)
Beispiel #5
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)
    experience = request.GET.get('xv', None)
    variant = request.GET.get('v', None)
    locale = l10n_utils.get_locale(request)

    # ensure variant matches pre-defined value
    if variant not in ['a', 'b', 'c', 'd', 'e',
                       'f']:  # place expected ?v= values in this list
        variant = None

    if scene == '2':
        # send to new permanent scene2 URL (bug 1438302)
        thanks_url = reverse('firefox.download.thanks')
        query_string = request.META.get('QUERY_STRING', '')
        if query_string:
            thanks_url = '?'.join(
                [thanks_url,
                 force_text(query_string, errors='ignore')])
        return HttpResponsePermanentRedirect(thanks_url)
    # if no/incorrect scene specified, show scene 1
    else:
        if lang_file_is_active('firefox/new/wait-face',
                               locale) and experience == 'waitface':
            template = 'firefox/new/wait-face/scene1.html'
        elif lang_file_is_active('firefox/new/reggiewatts',
                                 locale) and experience == 'reggiewatts':
            template = 'firefox/new/reggie-watts/scene1.html'
        elif locale == 'de' and experience == 'berlin':
            if variant == 'b':
                template = 'firefox/new/berlin/scene1-b.html'
            else:
                template = 'firefox/new/berlin/scene1.html'
        elif locale == 'de' and experience == 'herz':
            template = 'firefox/new/berlin/scene1-herz.html'
        elif locale == 'en-US':
            if experience in ['portland', 'forgood']:
                template = 'firefox/new/portland/scene1.html'
            elif experience in ['portland-fast', 'fast']:
                template = 'firefox/new/portland/scene1-fast.html'
            elif experience in ['portland-safe', 'safe']:
                template = 'firefox/new/portland/scene1-safe.html'
            elif experience == 'betterbrowser' and variant:
                if variant == 'a':
                    template = 'firefox/new/scene1.html'
                else:
                    template = 'firefox/new/better-browser/scene1-{}.html'.format(
                        variant)
            else:
                template = 'firefox/new/scene1.html'
        else:
            template = 'firefox/new/scene1.html'

    # no harm done by passing 'v' to template, even when no experiment is running
    # (also makes tests easier to maintain by always sending a context)
    return l10n_utils.render(request, template, {'experience': experience})
Beispiel #6
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)
    context = {
        'version': 'none',
    }

    # animation triggered for ?v=1 via data attribute in template
    if request.GET.get('v', '') == '1':
        context['version'] = '1'

    if scene == '2':
        if lang_file_is_active('firefox/new/horizon', l10n_utils.get_locale(request)):
            template = 'firefox/new/horizon/scene2.html'
        else:
            template = 'firefox/new/scene2.html'
    # if no/incorrect scene specified, show scene 1
    else:
        if lang_file_is_active('firefox/new/horizon', l10n_utils.get_locale(request)):
                template = 'firefox/new/horizon/scene1.html'
        else:
            template = 'firefox/new/scene1.html'

    return l10n_utils.render(request, template, context)
Beispiel #7
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)
    show_newsletter = locale in [
        'en-US', 'en-GB', 'en-CA', 'en-ZA', 'es-ES', 'es-AR', 'es-CL', 'es-MX',
        'pt-BR', 'fr', 'ru', 'id', 'de', 'pl'
    ]

    # ensure variant matches pre-defined value
    if variant not in ['a', 'x',
                       'y']:  # place expected ?v= values in this list
        variant = None

    if variant == 'a' and locale == 'en-US':
        show_newsletter = False  # Prevent showing the newsletter for pre-download experiment Issue #5944
    if variant == 'x' and locale == 'en-US':
        show_newsletter = False  # Prevent showing the newsletter for FxA account experiment mozilla/bedrock#5974

    # `wait-face`, `reggiewatts` variations are currently localized for both en-US and de locales.
    if lang_file_is_active('firefox/new/wait-face',
                           locale) and experience == 'waitface':
        template = 'firefox/new/wait-face/scene2.html'
    elif lang_file_is_active('firefox/new/reggiewatts',
                             locale) and experience == 'reggiewatts':
        template = 'firefox/new/reggie-watts/scene2.html'
    elif locale == 'de':
        if experience == 'berlin':
            template = 'firefox/new/berlin/scene2.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/new/berlin/scene2-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/new/berlin/scene2-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/new/berlin/scene2-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/new/berlin/scene2-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/new/berlin/scene2-auf-deiner-seite.html'
        else:
            template = 'firefox/new/scene2.html'
    elif locale == 'en-US':
        if experience in ['portland', 'forgood']:
            template = 'firefox/new/portland/scene2.html'
        elif experience in ['portland-fast', 'fast']:
            template = 'firefox/new/portland/scene2-fast.html'
        elif experience in ['portland-safe', 'safe']:
            template = 'firefox/new/portland/scene2-safe.html'
        elif experience == 'betterbrowser':
            template = 'firefox/new/better-browser/scene2.html'
        else:
            template = 'firefox/new/scene2.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template,
                             {'show_newsletter': show_newsletter})
Beispiel #8
0
 def test_lang_file_is_active(self):
     """
     `lang_file_is_active` should return true if lang file has the
     comment, and false otherwise.
     """
     ok_(lang_file_is_active('active_de_lang_file', 'de'))
     ok_(lang_file_is_active('active_de_lang_file_bom', 'de'))
     ok_(not lang_file_is_active('active_de_lang_file', 'es'))
     ok_(not lang_file_is_active('inactive_de_lang_file', 'de'))
     ok_(not lang_file_is_active('does_not_exist', 'de'))
Beispiel #9
0
 def test_lang_file_is_active(self):
     """
     `lang_file_is_active` should return true if lang file has the
     comment, and false otherwise.
     """
     ok_(lang_file_is_active("active_de_lang_file", "de"))
     ok_(lang_file_is_active("active_de_lang_file_bom", "de"))
     ok_(not lang_file_is_active("active_de_lang_file", "es"))
     ok_(not lang_file_is_active("inactive_de_lang_file", "de"))
     ok_(not lang_file_is_active("does_not_exist", "de"))
Beispiel #10
0
 def test_lang_file_is_active(self):
     """
     `lang_file_is_active` should return true if lang file has the
     comment, and false otherwise.
     """
     ok_(lang_file_is_active('active_de_lang_file', 'de'))
     ok_(lang_file_is_active('active_de_lang_file_bom', 'de'))
     ok_(not lang_file_is_active('active_de_lang_file', 'es'))
     ok_(not lang_file_is_active('inactive_de_lang_file', 'de'))
     ok_(not lang_file_is_active('does_not_exist', 'de'))
Beispiel #11
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        version = self.kwargs.get('version') or ''
        oldversion = self.request.GET.get('oldversion', '')
        # old versions of Firefox sent a prefixed version
        if oldversion.startswith('rv:'):
            oldversion = oldversion[3:]

        channel = detect_channel(version)

        if channel == 'nightly':
            template = 'firefox/nightly_whatsnew.html'
        elif channel == 'developer':
            if show_57_dev_whatsnew(version):
                template = 'firefox/developer/whatsnew.html'
            else:
                template = 'firefox/whatsnew/index.html'
        elif channel == 'beta':
            if version.startswith('74.'):
                if locale in ['en-US', 'en-CA', 'en-GB']:
                    template = 'firefox/whatsnew/whatsnew-fx70-en.html'
                elif locale == 'de':
                    template = 'firefox/whatsnew/whatsnew-fx70-de.html'
                elif locale == 'fr':
                    template = 'firefox/whatsnew/whatsnew-fx70-fr.html'
                else:
                    template = 'firefox/whatsnew/index.html'
            else:
                template = 'firefox/whatsnew/index.html'
        elif locale == 'id':
            template = 'firefox/whatsnew/index-lite.id.html'
        elif version.startswith('73.') and lang_file_is_active('firefox/whatsnew_73', locale):
            template = 'firefox/whatsnew/whatsnew-fx73.html'
        elif version.startswith('72.') and lang_file_is_active('firefox/whatsnew_71', locale):
            template = 'firefox/whatsnew/whatsnew-fx71.html'
        elif version.startswith('71.') and lang_file_is_active('firefox/whatsnew_71', locale):
            template = 'firefox/whatsnew/whatsnew-fx71.html'
        elif version.startswith('70.'):
            if locale in ['en-US', 'en-CA', 'en-GB']:
                template = 'firefox/whatsnew/whatsnew-fx70-en.html'
            elif locale == 'de':
                template = 'firefox/whatsnew/whatsnew-fx70-de.html'
            elif locale == 'fr':
                template = 'firefox/whatsnew/whatsnew-fx70-fr.html'
            else:
                template = 'firefox/whatsnew/index.html'
        else:
            if show_default_account_whatsnew(version) and ftl_file_is_active('firefox/whatsnew/whatsnew-account'):
                template = 'firefox/whatsnew/index-account.html'
            else:
                template = 'firefox/whatsnew/index.html'

        # return a list to conform with original intention
        return [template]
Beispiel #12
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)
    experience = request.GET.get('xv', None)
    variant = request.GET.get('v', None)
    locale = l10n_utils.get_locale(request)

    # ensure variant matches pre-defined value
    if variant not in ['a', 'b', 'c', 'd', 'e', 'f']:  # place expected ?v= values in this list
        variant = None

    if scene == '2':
        # send to new permanent scene2 URL (bug 1438302)
        thanks_url = reverse('firefox.download.thanks')
        query_string = request.META.get('QUERY_STRING', '')
        if query_string:
            thanks_url = '?'.join([thanks_url, force_text(query_string, errors='ignore')])
        return HttpResponsePermanentRedirect(thanks_url)
    # if no/incorrect scene specified, show scene 1
    else:
        if lang_file_is_active('firefox/new/wait-face', locale) and experience == 'waitface':
            template = 'firefox/new/wait-face/scene1.html'
        elif lang_file_is_active('firefox/new/reggiewatts', locale) and experience == 'reggiewatts':
            template = 'firefox/new/reggie-watts/scene1.html'
        elif locale == 'de' and experience == 'berlin':
            template = 'firefox/new/berlin/scene1.html'
        elif locale == 'de' and experience == 'aus-gruenden':
            template = 'firefox/new/berlin/scene1-aus-gruenden.html'
        elif locale == 'de' and experience == 'herz':
            template = 'firefox/new/berlin/scene1-herz.html'
        elif locale == 'de' and variant == 'b':
            template = 'firefox/new/de/scene1-b.html'
        elif locale == 'en-US':
            if experience in ['portland', 'forgood']:
                template = 'firefox/new/portland/scene1.html'
            elif experience in ['portland-fast', 'fast']:
                template = 'firefox/new/portland/scene1-fast.html'
            elif experience in ['portland-safe', 'safe']:
                template = 'firefox/new/portland/scene1-safe.html'
            elif experience == 'betterbrowser' and variant:
                if variant == 'a':
                    template = 'firefox/new/scene1.html'
                else:
                    template = 'firefox/new/better-browser/scene1-{}.html'.format(variant)
            else:
                template = 'firefox/new/scene1.html'
        else:
            template = 'firefox/new/scene1.html'

    # no harm done by passing 'v' to template, even when no experiment is running
    # (also makes tests easier to maintain by always sending a context)
    return l10n_utils.render(request, template, {'experience': experience})
Beispiel #13
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)
    newsletter = request.GET.get('n', None)
    show_newsletter = locale in [
        'en-US',
        'en-GB',
        'en-CA',
        'es-ES',
        'es-AR',
        'es-CL',
        'es-MX',
        'pt-BR',
        'fr',
        'ru',
        'id',
        'de',
        'pl',
    ]

    # ensure variant matches pre-defined value
    if variant not in ['b']:  # place expected ?v= values in this list
        variant = None

    # check to see if a URL explicitly asks to hide the newsletter
    if newsletter == 'f':
        show_newsletter = False

    if locale == 'de':
        if experience == 'berlin':
            template = 'firefox/campaign/berlin/scene2.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/campaign/berlin/scene2-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/campaign/berlin/scene2-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/campaign/berlin/scene2-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/campaign/berlin/scene2-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/campaign/berlin/scene2-auf-deiner-seite.html'
        elif lang_file_is_active('firefox/new/trailhead', locale):
            template = 'firefox/new/trailhead/thanks.html'
        else:
            template = 'firefox/new/scene2.html'
    elif locale == 'en-US' and experience == 'betterbrowser':
        template = 'firefox/campaign/better-browser/scene2.html'
    elif lang_file_is_active('firefox/new/trailhead', locale):
        template = 'firefox/new/trailhead/thanks.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template,
                             {'show_newsletter': show_newsletter})
Beispiel #14
0
    def get_template_names(self):
        variation = self.request.GET.get('v', None)
        locale = l10n_utils.get_locale(self.request)

        version = self.kwargs.get('version') or ''
        oldversion = self.request.GET.get('oldversion', '')
        # old versions of Firefox sent a prefixed version
        if oldversion.startswith('rv:'):
            oldversion = oldversion[3:]

        channel = detect_channel(version)

        if channel == 'nightly':
            template = 'firefox/nightly_whatsnew.html'
        elif channel == 'developer':
            if show_57_dev_whatsnew(version):
                template = 'firefox/developer/whatsnew.html'
            else:
                template = 'firefox/whatsnew/index.html'
        elif locale == 'id' and show_firefox_lite_whatsnew(version):
            template = 'firefox/whatsnew/firefox-lite.id.html'
        elif version.startswith('79.') and ftl_file_is_active(
                'firefox/whatsnew/whatsnew-fx79'):
            template = 'firefox/whatsnew/whatsnew-fx79.html'
        elif version.startswith('78.'):
            variations = ['2', '3', '4', '5']
            locales = ['en-US', 'en-CA', 'en-GB', 'de', 'fr']

            if variation in variations and locale in locales:
                locale = locale.split('-')[0]
                template = 'firefox/whatsnew/whatsnew-fx78-{0}-{1}.html'.format(
                    variation, locale)
            else:
                template = 'firefox/whatsnew/whatsnew-fx78.html'
        elif version.startswith('77.') and lang_file_is_active(
                'firefox/whatsnew_77', locale):
            # YouTube is blocked in China so zh-CN gets an alternative, self-hosted video.
            # If we run into bandwidth trouble we can turn the video off and zh-CN falls back to the 76 page.
            if locale == 'zh-CN' and not switch(
                    'firefox-whatsnew77-video-zhCN'):
                template = 'firefox/whatsnew/whatsnew-fx76.html'
            else:
                template = 'firefox/whatsnew/whatsnew-fx77.html'
        elif version.startswith('76.') and lang_file_is_active(
                'firefox/whatsnew_76', locale):
            template = 'firefox/whatsnew/whatsnew-fx76.html'
        else:
            if show_default_account_whatsnew(version) and ftl_file_is_active(
                    'firefox/whatsnew/whatsnew-account'):
                template = 'firefox/whatsnew/index-account.html'
            else:
                template = 'firefox/whatsnew/index.html'

        # return a list to conform with original intention
        return [template]
Beispiel #15
0
def campaign(request):

    # note: v and xv params only allow a-z, A-Z, 0-9, -, and _ characters
    experience = request.GET.get('xv', None)
    variant = request.GET.get('v', None)

    locale = l10n_utils.get_locale(request)

    # ensure variant matches pre-defined value

    if variant not in []:  # place expected ?v= values in this list
        variant = None

    if locale == 'de':
        if experience == 'berlin':
            template = 'firefox/campaign/berlin/scene1.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/campaign/berlin/scene1-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/campaign/berlin/scene1-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/campaign/berlin/scene1-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/campaign/berlin/scene1-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/campaign/berlin/scene1-auf-deiner-seite.html'
        else:
            if lang_file_is_active('firefox/campaign-trailhead', locale):
                template = 'firefox/campaign/index-trailhead.html'
            else:
                template = 'firefox/campaign/index.html'
    elif locale == 'en-US':
        if experience == 'betterbrowser':
            template = 'firefox/campaign/better-browser/scene1.html'
        elif experience == 'safari':
            template = 'firefox/campaign/compare/scene1-safari.html'
        elif experience == 'edge':
            template = 'firefox/campaign/compare/scene1-edge.html'
        else:
            template = 'firefox/campaign/index-trailhead.html'
    elif lang_file_is_active('firefox/campaign-trailhead', locale):
        template = 'firefox/campaign/index-trailhead.html'
    else:
        template = 'firefox/campaign/index.html'

    # no harm done by passing 'v' to template, even when no experiment is running
    # (also makes tests easier to maintain by always sending a context)
    return l10n_utils.render(request, template, {
        'experience': experience,
        'v': variant
    })
Beispiel #16
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)
    show_newsletter = locale in ['en-US', 'en-GB', 'en-CA', 'en-ZA', 'es-ES', 'es-AR', 'es-CL', 'es-MX', 'pt-BR', 'fr', 'ru', 'id', 'de', 'pl']

    # ensure variant matches pre-defined value
    if variant not in ['a', 'x', 'y']:  # place expected ?v= values in this list
        variant = None

    if variant == 'a' and locale == 'en-US':
        show_newsletter = False  # Prevent showing the newsletter for pre-download experiment Issue #5944
    if variant == 'x' and locale == 'en-US':
        show_newsletter = False  # Prevent showing the newsletter for FxA account experiment mozilla/bedrock#5974

    # `wait-face`, `reggiewatts` variations are currently localized for both en-US and de locales.
    if lang_file_is_active('firefox/new/wait-face', locale) and experience == 'waitface':
        template = 'firefox/new/wait-face/scene2.html'
    elif lang_file_is_active('firefox/new/reggiewatts', locale) and experience == 'reggiewatts':
        template = 'firefox/new/reggie-watts/scene2.html'
    elif locale == 'de':
        if experience == 'berlin':
            template = 'firefox/new/berlin/scene2.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/new/berlin/scene2-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/new/berlin/scene2-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/new/berlin/scene2-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/new/berlin/scene2-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/new/berlin/scene2-auf-deiner-seite.html'
        else:
            template = 'firefox/new/scene2.html'
    elif locale == 'en-US':
        if experience in ['portland', 'forgood']:
            template = 'firefox/new/portland/scene2.html'
        elif experience in ['portland-fast', 'fast']:
            template = 'firefox/new/portland/scene2-fast.html'
        elif experience in ['portland-safe', 'safe']:
            template = 'firefox/new/portland/scene2-safe.html'
        elif experience == 'betterbrowser':
            template = 'firefox/new/better-browser/scene2.html'
        else:
            template = 'firefox/new/scene2.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template, {'show_newsletter': show_newsletter})
Beispiel #17
0
def home(request, template='mozorg/home/home.html'):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/home/index-2016', locale):
        template = 'mozorg/home/home.html'
    else:
        template = 'mozorg/home/home-voices.html'

    return l10n_utils.render(
        request, template, {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #18
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)

    # ensure variant matches pre-defined value
    if variant not in ['a', 'b']:  # place expected ?v= values in this list
        variant = None

    # `wait-face`, `reggiewatts` variations are currently localized for both en-US and de locales.
    if lang_file_is_active('firefox/new/wait-face',
                           locale) and experience == 'waitface':
        template = 'firefox/new/wait-face/scene2.html'
    elif lang_file_is_active('firefox/new/reggiewatts',
                             locale) and experience == 'reggiewatts':
        template = 'firefox/new/reggie-watts/scene2.html'
    elif locale == 'de':
        if variant == 'b':
            template = 'firefox/new/de/scene2-b.html'
        elif experience == 'berlin':
            template = 'firefox/new/berlin/scene2.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/new/berlin/scene2-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/new/berlin/scene2-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/new/berlin/scene2-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/new/berlin/scene2-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/new/berlin/scene2-auf-deiner-seite.html'
        else:
            template = 'firefox/new/scene2.html'
    elif locale == 'en-US':
        if variant == 'b':
            template = 'firefox/new/email/scene2-b.html'
        elif experience in ['portland', 'forgood']:
            template = 'firefox/new/portland/scene2.html'
        elif experience in ['portland-fast', 'fast']:
            template = 'firefox/new/portland/scene2-fast.html'
        elif experience in ['portland-safe', 'safe']:
            template = 'firefox/new/portland/scene2-safe.html'
        elif experience == 'betterbrowser':
            template = 'firefox/new/better-browser/scene2.html'
        else:
            template = 'firefox/new/email/scene2.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template)
Beispiel #19
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        version = self.kwargs.get('version') or ''
        oldversion = self.request.GET.get('oldversion', '')
        # old versions of Firefox sent a prefixed version
        if oldversion.startswith('rv:'):
            oldversion = oldversion[3:]

        channel = detect_channel(version)

        if channel == 'nightly':
            template = 'firefox/nightly/whatsnew.html'
        elif channel == 'developer':
            if show_57_dev_whatsnew(version):
                template = 'firefox/developer/whatsnew.html'
            else:
                template = 'firefox/whatsnew/index.html'
        elif version.startswith('81.') and ftl_file_is_active(
                'firefox/whatsnew/whatsnew-fx81'):
            template = 'firefox/whatsnew/whatsnew-fx81.html'
        elif version.startswith('80.') and ftl_file_is_active(
                'firefox/whatsnew/whatsnew-fx80'):
            template = 'firefox/whatsnew/whatsnew-fx80.html'
        elif version.startswith('79.') and ftl_file_is_active(
                'firefox/whatsnew/whatsnew-fx79'):
            template = 'firefox/whatsnew/whatsnew-fx79.html'
        elif version.startswith('78.'):
            template = 'firefox/whatsnew/index.html'
        elif version.startswith('77.') and lang_file_is_active(
                'firefox/whatsnew_77', locale):
            # YouTube is blocked in China so zh-CN gets an alternative, self-hosted video.
            # If we run into bandwidth trouble we can turn the video off and zh-CN falls back to the 76 page.
            if locale == 'zh-CN' and not switch(
                    'firefox-whatsnew77-video-zhCN'):
                template = 'firefox/whatsnew/whatsnew-fx76.html'
            else:
                template = 'firefox/whatsnew/whatsnew-fx77.html'
        elif version.startswith('76.') and lang_file_is_active(
                'firefox/whatsnew_76', locale):
            template = 'firefox/whatsnew/whatsnew-fx76.html'
        else:
            if show_default_account_whatsnew(version) and ftl_file_is_active(
                    'firefox/whatsnew/whatsnew-account'):
                template = 'firefox/whatsnew/index-account.html'
            else:
                template = 'firefox/whatsnew/index.html'

        # return a list to conform with original intention
        return [template]
Beispiel #20
0
def plugincheck(request):
    template = 'mozorg/plugincheck.html'
    if lang_file_is_active('mozorg/plugincheck-redesign',
                           l10n_utils.get_locale(request)):
        template = 'mozorg/plugincheck-redesign.html'

    return l10n_utils.render(request, template)
Beispiel #21
0
 def get_context_data(self, **kwargs):
     ctx = super(HomeTestView, self).get_context_data(**kwargs)
     ctx['has_contribute'] = lang_file_is_active('mozorg/contribute')
     locale = l10n_utils.get_locale(self.request)
     locale = locale if locale in settings.MOBILIZER_LOCALE_LINK else 'en-US'
     ctx['mobilizer_link'] = settings.MOBILIZER_LOCALE_LINK[locale]
     return ctx
Beispiel #22
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        version = self.kwargs.get('version') or ''
        oldversion = self.request.GET.get('oldversion', '')
        # old versions of Firefox sent a prefixed version
        if oldversion.startswith('rv:'):
            oldversion = oldversion[3:]

        channel = detect_channel(version)
        if channel == 'alpha':
            if show_57_dev_whatsnew(version) and lang_file_is_active(
                    'firefox/products/developer-quantum', locale):
                template = 'firefox/developer-quantum-whatsnew.html'
            else:
                template = 'firefox/dev-whatsnew.html'
        elif channel == 'nightly':
            template = 'firefox/nightly_whatsnew.html'
        elif show_57_whatsnew(version):
            # locale-specific templates don't seem to work for the default locale
            if locale == 'en-US':
                template = 'firefox/whatsnew/fx57/whatsnew-57.en-US.html'
            # locale-specific templates for de, en-GB, es-AR, es-CL, es-ES, es-MX,
            # fr, id, pl, pt-BR, ru, zh-CN, and zh-TW
            else:
                template = 'firefox/whatsnew/fx57/whatsnew-57.html'
        elif show_56_whatsnew(version, oldversion):
            template = 'firefox/whatsnew/whatsnew-56.html'
        else:
            template = 'firefox/whatsnew/index.html'

        # return a list to conform with original intention
        return [template]
Beispiel #23
0
def plugincheck(request):
    template = 'mozorg/plugincheck.html'
    if lang_file_is_active('mozorg/plugincheck-redesign',
                           l10n_utils.get_locale(request)):
        template = 'mozorg/plugincheck-redesign.html'

    return l10n_utils.render(request, template)
Beispiel #24
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)
        version = self.kwargs.get('version') or ''
        exp = self.request.GET.get('v')
        f = self.request.GET.get('f', None)

        if detect_channel(version) == 'alpha':
            if show_57_dev_firstrun(version) and lang_file_is_active(
                    'firefox/products/developer-quantum', locale):
                    template = 'firefox/developer-quantum-firstrun.html'
            else:
                template = 'firefox/dev-firstrun.html'
        elif show_56_cliqz_firstrun(locale, version, f):
            template = 'firefox/firstrun/cliqz-funnelcake-119-122.html'
        elif show_40_firstrun(version):
            if locale == 'en-US' and exp in ['a', 'b']:
                template = 'firefox/firstrun/membership-{0}.html'.format(exp)
            else:
                template = 'firefox/firstrun/index.html'
        elif show_38_0_5_firstrun(version):
            template = 'firefox/australis/fx38_0_5/firstrun.html'
        else:
            template = 'firefox/australis/firstrun.html'

        # return a list to conform with original intention
        return [template]
Beispiel #25
0
def download_thanks(request):
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)
    newsletter = request.GET.get('n', None)
    show_newsletter = locale in [
        'en-US',
        'en-GB',
        'en-CA',
        'es-ES',
        'es-AR',
        'es-CL',
        'es-MX',
        'pt-BR',
        'fr',
        'ru',
        'id',
        'de',
        'pl',
    ]

    # ensure variant matches pre-defined value
    if variant not in ['b']:  # place expected ?v= values in this list
        variant = None

    # check to see if a URL explicitly asks to hide the newsletter
    if newsletter == 'f':
        show_newsletter = False

    if lang_file_is_active('firefox/new/trailhead', locale):
        template = 'firefox/new/trailhead/thanks.html'
    else:
        template = 'firefox/new/protocol/thanks.html'

    return l10n_utils.render(request, template,
                             {'show_newsletter': show_newsletter})
Beispiel #26
0
def contribute_index(request):
    if lang_file_is_active('mozorg/contribute/index',
                           l10n_utils.get_locale(request)):
        return ContributeIndex.as_view()(request)
    else:
        return contribute(request, 'mozorg/contribute/contribute-old.html',
                          False)
Beispiel #27
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        version = self.kwargs.get('version') or ''
        oldversion = self.request.GET.get('oldversion', '')
        # old versions of Firefox sent a prefixed version
        if oldversion.startswith('rv:'):
            oldversion = oldversion[3:]

        channel = detect_channel(version)
        if channel == 'alpha':
            if show_57_dev_whatsnew(version) and lang_file_is_active(
                    'firefox/products/developer-quantum', locale):
                    template = 'firefox/developer-quantum-whatsnew.html'
            else:
                template = 'firefox/dev-whatsnew.html'
        elif channel == 'nightly':
            template = 'firefox/nightly_whatsnew.html'
        elif show_56_whatsnew(version, oldversion):
            template = 'firefox/whatsnew/whatsnew-56.html'
        elif show_54_whatsnew(version):
            template = 'firefox/whatsnew/fx54/whatsnew-54.html'
        elif show_50_whatsnew(version):
            # zh-TW has locale-specific template: whatsnew-50.zh-TW.html
            template = 'firefox/whatsnew/whatsnew-50.html'
        # zh-TW on 49.0 gets a special template
        elif locale == 'zh-TW' and show_49_0_whatsnew(version):
            template = 'firefox/whatsnew/whatsnew-zh-tw-49.html'
        elif show_42_whatsnew(version):
            template = 'firefox/whatsnew/whatsnew-42.html'
        else:
            template = 'firefox/australis/whatsnew.html'

        # return a list to conform with original intention
        return [template]
Beispiel #28
0
 def get_context_data(self, **kwargs):
     ctx = super(HomeTestView, self).get_context_data(**kwargs)
     ctx['has_contribute'] = lang_file_is_active('mozorg/contribute')
     locale = l10n_utils.get_locale(self.request)
     locale = locale if locale in settings.MOBILIZER_LOCALE_LINK else 'en-US'
     ctx['mobilizer_link'] = settings.MOBILIZER_LOCALE_LINK[locale]
     return ctx
Beispiel #29
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        if lang_file_is_active('firefox/hub/home-quantum', locale):
            template_name = 'firefox/hub/home-quantum.html'
        else:
            template_name = 'firefox/hub/home.html'
        return [template_name]
Beispiel #30
0
    def get(self, request, *args, **kwargs):
        locale = l10n_utils.get_locale(request)

        # If locale does not have hub page translated, redirect to /new.
        if lang_file_is_active('firefox/hub/home', locale):
            return super(FirefoxHubView, self).get(request, *args, **kwargs)
        else:
            return HttpResponseRedirect(reverse('firefox.new'))
Beispiel #31
0
def firefox_home(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('firefox/home-master', locale):
        template_name = 'firefox/home/index-master.html'
    else:
        template_name = 'firefox/home/index-quantum.html'
    return l10n_utils.render(request, template_name)
Beispiel #32
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)

    # ensure variant matches pre-defined value
    if variant not in ['a', 'b']:  # place expected ?v= values in this list
        variant = None

    # `wait-face`, `reggiewatts` variations are currently localized for both en-US and de locales.
    if lang_file_is_active('firefox/new/wait-face', locale) and experience == 'waitface':
        template = 'firefox/new/wait-face/scene2.html'
    elif lang_file_is_active('firefox/new/reggiewatts', locale) and experience == 'reggiewatts':
        template = 'firefox/new/reggie-watts/scene2.html'
    elif locale == 'de':
        if experience == 'berlin':
            template = 'firefox/new/berlin/scene2.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/new/berlin/scene2-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/new/berlin/scene2-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/new/berlin/scene2-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/new/berlin/scene2-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/new/berlin/scene2-auf-deiner-seite.html'
        else:
            template = 'firefox/new/scene2.html'
    elif locale == 'en-US':
        if variant == 'b':
            template = 'firefox/new/email/scene2-b.html'
        elif experience in ['portland', 'forgood']:
            template = 'firefox/new/portland/scene2.html'
        elif experience in ['portland-fast', 'fast']:
            template = 'firefox/new/portland/scene2-fast.html'
        elif experience in ['portland-safe', 'safe']:
            template = 'firefox/new/portland/scene2-safe.html'
        elif experience == 'betterbrowser':
            template = 'firefox/new/better-browser/scene2.html'
        else:
            template = 'firefox/new/email/scene2.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template)
Beispiel #33
0
    def get(self, request, *args, **kwargs):
        locale = l10n_utils.get_locale(request)

        # If locale does not have hub page translated, redirect to /new.
        if lang_file_is_active('firefox/hub/home', locale):
            return super(FirefoxHubView, self).get(request, *args, **kwargs)
        else:
            return HttpResponseRedirect(reverse('firefox.new'))
Beispiel #34
0
def home(request):
    locale = l10n_utils.get_locale(request)
    return l10n_utils.render(
        request, 'mozorg/home/home.html', {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #35
0
def new_home(request, locale=None):
    locale = locale or l10n_utils.get_locale(request)
    return l10n_utils.render(
        request, 'mozorg/home/home-new.html', {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #36
0
def about_view(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/about-2019', locale):
        template_name = 'mozorg/about-2019.html'
    else:
        template_name = 'mozorg/about.html'

    return l10n_utils.render(request, template_name)
Beispiel #37
0
def firefox_accounts(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('firefox/accounts-2018', locale):
        template_name = 'firefox/accounts-2018.html'
    else:
        template_name = 'firefox/accounts.html'

    return l10n_utils.render(request, template_name)
Beispiel #38
0
def sync_page(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('firefox/features/sync', locale):
        template = 'firefox/features/sync.html'
    else:
        template = 'firefox/features/sync-old.html'

    return l10n_utils.render(request, template)
Beispiel #39
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        if lang_file_is_active('mozorg/internet-health/index', locale):
            template_name = 'mozorg/internet-health/index.html'
        else:
            template_name = 'mozorg/internet-health.html'

        return [template_name]
Beispiel #40
0
    def get_template_names(self):
        locale = l10n_utils.get_locale(self.request)

        if lang_file_is_active('firefox/products/ios', locale):
            template_name = 'firefox/products/ios.html'
        else:
            template_name = 'firefox/ios.html'

        return [template_name]
Beispiel #41
0
def plugincheck(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/plugincheck-update', locale):
        template = 'mozorg/plugincheck-update.html'
    else:
        template = 'mozorg/plugincheck.html'

    return l10n_utils.render(request, template)
Beispiel #42
0
def about_view(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/about-2019', locale):
        template_name = 'mozorg/about-2019.html'
    else:
        template_name = 'mozorg/about.html'

    return l10n_utils.render(request, template_name)
Beispiel #43
0
def features_landing(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('firefox/features/index', locale):
        template = 'firefox/features/index.html'
    else:
        template = 'firefox/features.html'

    return l10n_utils.render(request, template)
Beispiel #44
0
def moss_view(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/moss/index-092018', locale):
        template_name = 'mozorg/moss/index-092018.html'
    else:
        template_name = 'mozorg/moss/index.html'

    return l10n_utils.render(request, template_name)
Beispiel #45
0
def moss_view(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/moss/index-092018', locale):
        template_name = 'mozorg/moss/index-092018.html'
    else:
        template_name = 'mozorg/moss/index.html'

    return l10n_utils.render(request, template_name)
Beispiel #46
0
def firefox_accounts(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('firefox/accounts-2018', locale):
        template_name = 'firefox/accounts-2018.html'
    else:
        template_name = 'firefox/accounts.html'

    return l10n_utils.render(request, template_name)
Beispiel #47
0
def plugincheck(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/plugincheck-update', locale):
        template = 'mozorg/plugincheck-update.html'
    else:
        template = 'mozorg/plugincheck.html'

    return l10n_utils.render(request, template)
Beispiel #48
0
def firefox_mobile(request):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('firefox/mobile-2019', locale):
        template_name = 'firefox/mobile-2019.html'
    else:
        template_name = 'firefox/mobile.html'

    return l10n_utils.render(request, template_name)
Beispiel #49
0
def home(request, template='mozorg/home/home.html'):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/home/home-2016', l10n_utils.get_locale(request)):
        template = 'mozorg/home/home.html'

        variant = request.GET.get('v', '')

        if variant in ['a', 'b']:
            template = 'mozorg/home/home-{0}.html'.format(variant)
    else:
        template = 'mozorg/home/home-voices.html'

    return l10n_utils.render(
        request, template, {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #50
0
def home(request, template='mozorg/home/home.html'):
    locale = l10n_utils.get_locale(request)

    if lang_file_is_active('mozorg/home/index-2016', locale):
        # check for variant - fx copy experiment
        v = request.GET.get('v', None)

        if (locale.startswith('en-') and v in ['a', 'b', 'c']):
            template = 'mozorg/home/home-{0}.html'.format(v)
        else:
            template = 'mozorg/home/home.html'
    else:
        template = 'mozorg/home/home-voices.html'

    return l10n_utils.render(
        request, template, {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #51
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)

    if scene == '2':
        if lang_file_is_active('firefox/new/horizon', l10n_utils.get_locale(request)):
            template = 'firefox/new/horizon/scene2.html'
        else:
            template = 'firefox/new/scene2.html'
    # if no/incorrect scene specified, show scene 1
    else:
        if lang_file_is_active('firefox/new/horizon', l10n_utils.get_locale(request)):
                template = 'firefox/new/horizon/scene1.html'
        else:
            template = 'firefox/new/scene1.html'

    return l10n_utils.render(request, template)
Beispiel #52
0
def firefox_os_index(request):

    locale = l10n_utils.get_locale(request)
    lang_file = 'firefox/os/index-new'
    old_home = 'firefox/os/index.html'
    new_home = 'firefox/os/index-new.html'

    if waffle.switch_is_active('firefox-os-index-2015') and lang_file_is_active(lang_file, locale):
            return l10n_utils.render(request, new_home)
    else:
        return l10n_utils.render(request, old_home)
Beispiel #53
0
def download_thanks(request):
    experience = request.GET.get('xv', None)
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)
    newsletter = request.GET.get('n', None)
    show_newsletter = locale in ['en-US', 'en-GB', 'en-CA', 'es-ES', 'es-AR', 'es-CL', 'es-MX', 'pt-BR', 'fr', 'ru', 'id', 'de', 'pl']

    # ensure variant matches pre-defined value
    if variant not in ['b']:  # place expected ?v= values in this list
        variant = None

    # check to see if a URL explicitly asks to hide the newsletter
    if newsletter == 'f':
        show_newsletter = False

    if locale == 'de':
        if experience == 'berlin':
            template = 'firefox/campaign/berlin/scene2.html'
        elif experience == 'aus-gruenden':
            template = 'firefox/campaign/berlin/scene2-aus-gruenden.html'
        elif experience == 'herz':
            template = 'firefox/campaign/berlin/scene2-herz.html'
        elif experience == 'geschwindigkeit':
            template = 'firefox/campaign/berlin/scene2-gesch.html'
        elif experience == 'privatsphare':
            template = 'firefox/campaign/berlin/scene2-privat.html'
        elif experience == 'auf-deiner-seite':
            template = 'firefox/campaign/berlin/scene2-auf-deiner-seite.html'
        elif lang_file_is_active('firefox/new/trailhead', locale):
            template = 'firefox/new/trailhead/thanks.html'
        else:
            template = 'firefox/new/scene2.html'
    elif locale == 'en-US' and experience == 'betterbrowser':
        template = 'firefox/campaign/better-browser/scene2.html'
    elif lang_file_is_active('firefox/new/trailhead', locale):
        template = 'firefox/new/trailhead/thanks.html'
    else:
        template = 'firefox/new/scene2.html'

    return l10n_utils.render(request, template, {'show_newsletter': show_newsletter})
Beispiel #54
0
def home(request, template='mozorg/home/home.html'):
    locale = l10n_utils.get_locale(request)

    variant = request.GET.get('v', '')

    if variant == 'b':
        template = 'mozorg/home/home-b.html'

    return l10n_utils.render(
        request, template, {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #55
0
def home(request):
    locale = l10n_utils.get_locale(request)
    donate_params = settings.DONATE_PARAMS.get(
        locale, settings.DONATE_PARAMS['en-US'])

    # presets are stored as a string but, for the takeover modal
    # we need it as a list.
    donate_params['preset_list'] = donate_params['presets'].split(',')

    return l10n_utils.render(
        request, 'mozorg/home/home.html', {
            'donate_params': donate_params,
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #56
0
def home(request, template='mozorg/home/home.html'):
    locale = l10n_utils.get_locale(request)

    # en-US gets new template (or variation)
    if locale == 'en-US':
        template = 'mozorg/home/home-en-US.html'

        variant = request.GET.get('v', '')

        if variant in ['a', 'b', 'c']:
            template = 'mozorg/home/home-en-US-{0}.html'.format(variant)

    return l10n_utils.render(
        request, template, {
            'has_contribute': lang_file_is_active('mozorg/contribute'),
            'tweets': home_tweets(locale),
            'mobilizer_link': settings.MOBILIZER_LOCALE_LINK.get(
                locale, settings.MOBILIZER_LOCALE_LINK['en-US'])})
Beispiel #57
0
def about_view(request):
    locale = l10n_utils.get_locale(request)
    variant = request.GET.get('v', None)
    allowed_variants = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

    # ensure variant matches pre-defined value
    if variant not in allowed_variants:
        variant = None

    if lang_file_is_active('mozorg/about-2019', locale):
        if variant == 'a':
            template_name = 'mozorg/perf-exp/control.html'
        elif variant in allowed_variants:
            template_name = 'mozorg/perf-exp/variation.html'
        else:
            template_name = 'mozorg/about-2019.html'
    else:
        template_name = 'mozorg/about.html'

    return l10n_utils.render(request, template_name, {'variant': variant})
Beispiel #58
0
def new(request):
    # Remove legacy query parameters (Bug 1236791)
    if request.GET.get('product', None) or request.GET.get('os', None):
        return HttpResponsePermanentRedirect(reverse('firefox.new'))

    scene = request.GET.get('scene', None)

    # note: v and xv params only allow a-z, A-Z, 0-9, -, and _ charcaters
    experience = request.GET.get('xv', None)
    variant = request.GET.get('v', None)

    locale = l10n_utils.get_locale(request)

    # ensure variant matches pre-defined value

    if variant not in ['a', 'b']:  # place expected ?v= values in this list
        variant = None

    if scene == '2':
        # send to new permanent scene2 URL (bug 1438302)
        thanks_url = reverse('firefox.download.thanks')
        query_string = request.META.get('QUERY_STRING', '')
        if query_string:
            thanks_url = '?'.join([thanks_url, force_text(query_string, errors='ignore')])
        return HttpResponsePermanentRedirect(thanks_url)
    # if no/incorrect scene specified, show scene 1
    else:
        if locale == 'ru' and switch('firefox-yandex'):
            template = 'firefox/new/yandex/scene1.html'
        elif lang_file_is_active('firefox/new/trailhead', locale):
            template = 'firefox/new/trailhead/download.html'
        else:
            template = 'firefox/new/scene1.html'

    # no harm done by passing 'v' to template, even when no experiment is running
    # (also makes tests easier to maintain by always sending a context)
    return l10n_utils.render(request, template, {'experience': experience, 'v': variant})
Beispiel #59
0
def contribute_index(request):
    if lang_file_is_active('mozorg/contribute/index',
                           l10n_utils.get_locale(request)):
        return ContributeIndex.as_view()(request)
    else:
        return contribute(request, 'mozorg/contribute/contribute-old.html', False)