# Path: lizard_ui/forms.py
# class LoginForm(AuthenticationForm):
#     username = forms.CharField(
#         max_length=100,
#         label=_('Username'),
#         required=True)
#     password = forms.CharField(
#         max_length=100,
#         label=_('Password'),
#         widget=forms.PasswordInput(),
#         required=True)
#     next_url = forms.CharField(
#         max_length=100,
#         required=False,
#         widget=forms.HiddenInput())
# 
# class ChangeLanguageForm(forms.Form):
#     language = forms.ChoiceField(
#         choices=settings.LANGUAGES
#     )
# 
# Path: lizard_ui/layout.py
# class Action(object):
#     """Small wrapper for actions, just to make the attributes explicit.
# 
#     A dictionary with keys instead of attributes is just as fine for the
#     templates, but for documentation purposes this class is handier.
# 
#     - **name**: text of the link.
# 
#     - **element_id**: id the element will get in the HTML. The id is prepended
#       with 'action-'.
# 
#     - **icon**: icon class according to
#       http://twitter.github.com/bootstrap/base-css.html#icons, optional.
# 
#     - **url**: where the link points at.
# 
#     - **description**: optional description for helpful popup.
# 
#     - **klass**: optional CSS class to give to the link. This allows you to
#       tie custom javascript handling to the link.
# 
#     - **data_attributes**: optional dictionary to set data-xyz attributes on
#       the action that can be used by css that reacts on the actions.
# 
#     """
#     def __init__(self, name=None, element_id=None, icon=None, url='#',
#                  description=None, klass=None, data_attributes=None,
#                  target=None):
#         self.name = name
#         if element_id is not None:
#             self.element_id = 'action-%s' % element_id
#         self.icon = icon
#         self.url = url
#         self.description = description
#         self.klass = klass
#         self.data_attributes = data_attributes
#         self.target = target  # &$%^!, this is for opening in a new tab.
# 
# Path: lizard_ui/uisettings.py
# SITE_TITLE = getattr(settings, 'UI_SITE_TITLE', 'Lizard')
# SHOW_LOGIN = getattr(settings, 'UI_SHOW_LOGIN', True)
# SITE_ACTIONS = getattr(settings, 'UI_SITE_ACTIONS', [])
# GAUGES_SITE_ID = getattr(settings, 'UI_GAUGES_SITE_ID', None)
# SHOW_LANGUAGE_PICKER = getattr(settings, 'UI_SHOW_LANGUAGE_PICKER', False)


from copy import copy
from django.conf import settings
from django.contrib.auth import login
from django.contrib.auth import logout
from django.core.urlresolvers import reverse
from django.http import Http404
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.http import HttpResponseServerError
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.template import Context, loader
from django.utils.translation import check_for_language
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateView, View
from django.views.generic.edit import FormView
from lizard_ui.forms import LoginForm, ChangeLanguageForm
from lizard_ui.layout import Action
from lizard_ui.models import ApplicationScreen
from lizard_ui.models import ApplicationIcon
from lizard_ui.models import CustomerLogo
from lizard_ui import uisettings
import logging
import urlparse
import urllib
import json

        return super(UiView, self).dispatch(request, *args, **kwargs)

    @property
    def gauges_site_id(self):
        """Return gaug.es tracking code (unless we're in debug mode)."""
        if settings.DEBUG:
            return
        return uisettings.GAUGES_SITE_ID

    @property
    def title(self):
        """Return title for use in 'head' tag.

        By default it uses the ``page_title`` attribute, followed by
        ``UI_SITE_TITLE`` (which is 'lizard' by default).

        """
        return ' - '.join([self.page_title, uisettings.SITE_TITLE])

    @property
    def site_actions(self):
        """Return site actions.

        ``UI_SITE_ACTIONS`` are on the left, a login link (if
        ``UI_SHOW_LOGIN`` is True) on the right.

        """
        actions = copy(uisettings.SITE_ACTIONS)


# Path: lizard_ui/forms.py
# class LoginForm(AuthenticationForm):
#     username = forms.CharField(
#         max_length=100,
#         label=_('Username'),
#         required=True)
#     password = forms.CharField(
#         max_length=100,
#         label=_('Password'),
#         widget=forms.PasswordInput(),
#         required=True)
#     next_url = forms.CharField(
#         max_length=100,
#         required=False,
#         widget=forms.HiddenInput())
# 
# class ChangeLanguageForm(forms.Form):
#     language = forms.ChoiceField(
#         choices=settings.LANGUAGES
#     )
# 
# Path: lizard_ui/layout.py
# class Action(object):
#     """Small wrapper for actions, just to make the attributes explicit.
# 
#     A dictionary with keys instead of attributes is just as fine for the
#     templates, but for documentation purposes this class is handier.
# 
#     - **name**: text of the link.
# 
#     - **element_id**: id the element will get in the HTML. The id is prepended
#       with 'action-'.
# 
#     - **icon**: icon class according to
#       http://twitter.github.com/bootstrap/base-css.html#icons, optional.
# 
#     - **url**: where the link points at.
# 
#     - **description**: optional description for helpful popup.
# 
#     - **klass**: optional CSS class to give to the link. This allows you to
#       tie custom javascript handling to the link.
# 
#     - **data_attributes**: optional dictionary to set data-xyz attributes on
#       the action that can be used by css that reacts on the actions.
# 
#     """
#     def __init__(self, name=None, element_id=None, icon=None, url='#',
#                  description=None, klass=None, data_attributes=None,
#                  target=None):
#         self.name = name
#         if element_id is not None:
#             self.element_id = 'action-%s' % element_id
#         self.icon = icon
#         self.url = url
#         self.description = description
#         self.klass = klass
#         self.data_attributes = data_attributes
#         self.target = target  # &$%^!, this is for opening in a new tab.
# 
# Path: lizard_ui/uisettings.py
# SITE_TITLE = getattr(settings, 'UI_SITE_TITLE', 'Lizard')
# SHOW_LOGIN = getattr(settings, 'UI_SHOW_LOGIN', True)
# SITE_ACTIONS = getattr(settings, 'UI_SITE_ACTIONS', [])
# GAUGES_SITE_ID = getattr(settings, 'UI_GAUGES_SITE_ID', None)
# SHOW_LANGUAGE_PICKER = getattr(settings, 'UI_SHOW_LANGUAGE_PICKER', False)


# Path: lizard_ui/views.py
from copy import copy
from django.conf import settings
from django.contrib.auth import login
from django.contrib.auth import logout
from django.core.urlresolvers import reverse
from django.http import Http404
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.http import HttpResponseServerError
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.template import Context, loader
from django.utils.translation import check_for_language
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateView, View
from django.views.generic.edit import FormView
from lizard_ui.forms import LoginForm, ChangeLanguageForm
from lizard_ui.layout import Action
from lizard_ui.models import ApplicationScreen
from lizard_ui.models import ApplicationIcon
from lizard_ui.models import CustomerLogo
from lizard_ui import uisettings
import logging
import urlparse
import urllib
import json


        return super(UiView, self).dispatch(request, *args, **kwargs)

    @property
    def gauges_site_id(self):
        """Return gaug.es tracking code (unless we're in debug mode)."""
        if settings.DEBUG:
            return
        return uisettings.GAUGES_SITE_ID

    @property
    def title(self):
        """Return title for use in 'head' tag.

        By default it uses the ``page_title`` attribute, followed by
        ``UI_SITE_TITLE`` (which is 'lizard' by default).

        """
        return ' - '.join([self.page_title, uisettings.SITE_TITLE])

    @property
    def site_actions(self):
        """Return site actions.

        ``UI_SITE_ACTIONS`` are on the left, a login link (if
        ``UI_SHOW_LOGIN`` is True) on the right.

        """
        actions = copy(uisettings.SITE_ACTIONS)


        if uisettings.SHOW_LANGUAGE_PICKER: