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

« back to all changes in this revision

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

ivle-config now sets appropriate permissions (www-data:, 600) on any config
file that it creates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        # view.
60
60
        app_template = os.path.join(os.path.dirname(
61
61
                        inspect.getmodule(self).__file__), self.template) 
 
62
        req.write_html_head_foot = False
62
63
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
63
64
        tmpl = loader.load(app_template)
64
65
        app = tmpl.generate(viewctx)
74
75
        # Global template
75
76
        ctx = genshi.template.Context()
76
77
        # XXX: Leave this here!! (Before req.styles is read)
77
 
        ctx['overlays'] = self.render_overlays(req) if req.user else []
 
78
        ctx['overlays'] = self.render_overlays(req)
78
79
 
79
80
        ctx['styles'] = [media_url(req, CorePlugin, 'ivle.css')]
80
81
        ctx['styles'] += req.styles
85
86
 
86
87
        ctx['scripts_init'] = req.scripts_init
87
88
        ctx['app_template'] = app
88
 
        ctx['title_img'] = media_url(req, CorePlugin,
89
 
                                     "images/chrome/title.png")
90
89
        self.populate_headings(req, ctx)
91
90
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
92
91
                                                        'ivle-headings.html'))
112
111
            ctx['help_path'] = self.help
113
112
 
114
113
        ctx['apps_in_tabs'] = []
115
 
        for plugin in req.config.plugin_index[ViewPlugin]:
 
114
        for plugin in req.plugin_index[ViewPlugin]:
116
115
            if not hasattr(plugin, 'tabs'):
117
116
                continue
118
117
 
119
118
            for tab in plugin.tabs:
120
119
                # tab is a tuple: name, title, desc, icon, path
121
120
                new_app = {}
122
 
                new_app['this_app'] = hasattr(self, 'tab') \
123
 
                                      and tab[0] == self.tab
 
121
                new_app['this_app'] = hasattr(self, 'appname') \
 
122
                                      and tab[0] == self.appname
124
123
 
125
124
                # Icon name
126
125
                if tab[3] is not None:
149
148
        if not self.allow_overlays:
150
149
            return overlays
151
150
 
152
 
        for plugin in req.config.plugin_index[OverlayPlugin]:
 
151
        for plugin in req.plugin_index[OverlayPlugin]:
153
152
            for overclass in plugin.overlays:
154
153
                if overclass in self.overlay_blacklist:
155
154
                    continue
193
192
 
194
193
        if req.user is None:
195
194
            # Not logged in. Redirect to login page.
196
 
            if req.uri == '/':
197
 
                query_string = ''
198
 
            else:
199
 
                query_string = '?url=' + urllib.quote(req.uri, safe="/~")
200
 
            req.throw_redirect('/+login' + query_string)
 
195
            req.throw_redirect('/+login?' + 
 
196
                               urllib.urlencode([('url', req.uri)]))
201
197
 
202
198
        req.status = 403