~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/xhtml.py

Allow any authenticated (even invalid) user to use the logout view.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import genshi.template
25
25
 
26
26
from ivle.webapp.media import media_url
27
 
from ivle.webapp.core import Plugin as CorePlugin
28
27
from ivle.webapp.base.views import BaseView
29
28
from ivle.webapp.base.plugins import ViewPlugin, OverlayPlugin
30
29
from ivle.webapp.errors import HTTPError, Unauthorized
41
40
    template = 'template.html'
42
41
    plugin_scripts = {}
43
42
    plugin_styles = {}
44
 
    allow_overlays = True
45
43
    overlay_blacklist = []
46
44
 
47
45
    def __init__(self, req, **kwargs):
59
57
        # view.
60
58
        app_template = os.path.join(os.path.dirname(
61
59
                        inspect.getmodule(self).__file__), self.template) 
 
60
        req.write_html_head_foot = False
62
61
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
63
62
        tmpl = loader.load(app_template)
64
63
        app = tmpl.generate(viewctx)
75
74
        ctx = genshi.template.Context()
76
75
        # XXX: Leave this here!! (Before req.styles is read)
77
76
        ctx['overlays'] = self.render_overlays(req)
78
 
 
79
 
        ctx['styles'] = [media_url(req, CorePlugin, 'ivle.css')]
80
 
        ctx['styles'] += req.styles
81
 
 
82
 
        ctx['scripts'] = [media_url(req, CorePlugin, path) for path in
83
 
                           ('util.js', 'json2.js', 'md5.js')]
84
 
        ctx['scripts'] += req.scripts
85
 
 
 
77
        ctx['app_styles'] = req.styles
 
78
        ctx['scripts'] = req.scripts
86
79
        ctx['scripts_init'] = req.scripts_init
87
80
        ctx['app_template'] = app
88
81
        self.populate_headings(req, ctx)
110
103
            ctx['help_path'] = self.help
111
104
 
112
105
        ctx['apps_in_tabs'] = []
113
 
        for plugin in req.config.plugin_index[ViewPlugin]:
 
106
        for plugin in req.plugin_index[ViewPlugin]:
114
107
            if not hasattr(plugin, 'tabs'):
115
108
                continue
116
109
 
144
137
        scripts_init.
145
138
        """
146
139
        overlays = []
147
 
        if not self.allow_overlays:
148
 
            return overlays
149
 
 
150
 
        for plugin in req.config.plugin_index[OverlayPlugin]:
 
140
        for plugin in req.plugin_index[OverlayPlugin]:
151
141
            for overclass in plugin.overlays:
152
142
                if overclass in self.overlay_blacklist:
153
143
                    continue