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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2009-02-26 02:08:28 UTC
  • Revision ID: grantw@unimelb.edu.au-20090226020828-0qrhe3llq9r5olmr
ivle-showenrolment: Swap year and semester, and show the role.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from ivle.webapp.base.views import BaseView
29
29
from ivle.webapp.base.plugins import ViewPlugin, OverlayPlugin
30
30
from ivle.webapp.errors import HTTPError, Unauthorized
 
31
import ivle.conf
 
32
import ivle.util
31
33
 
32
34
class XHTMLView(BaseView):
33
35
    """
46
48
        for key in kwargs:
47
49
            setattr(self, key, kwargs[key])
48
50
 
49
 
    def filter(self, stream, ctx):
50
 
        return stream
51
 
 
52
51
    def render(self, req):
53
52
        req.content_type = 'text/html' # TODO: Detect application/xhtml+xml
54
53
 
62
61
                        inspect.getmodule(self).__file__), self.template) 
63
62
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
64
63
        tmpl = loader.load(app_template)
65
 
        app = self.filter(tmpl.generate(viewctx), viewctx)
 
64
        app = tmpl.generate(viewctx)
66
65
 
67
66
        for plugin in self.plugin_scripts:
68
67
            for path in self.plugin_scripts[plugin]:
82
81
 
83
82
        ctx['scripts'] = [media_url(req, CorePlugin, path) for path in
84
83
                           ('util.js', 'json2.js', 'md5.js')]
85
 
        ctx['scripts'].append(media_url(req, '+external/jquery', 'jquery.js'))
86
84
        ctx['scripts'] += req.scripts
87
85
 
88
86
        ctx['scripts_init'] = req.scripts_init
99
97
 
100
98
    def populate_headings(self, req, ctx):
101
99
        ctx['favicon'] = None
102
 
        ctx['root_dir'] = req.config['urls']['root']
103
 
        ctx['public_host'] = req.config['urls']['public_host']
104
 
        ctx['svn_base'] = req.config['urls']['svn_addr']
 
100
        ctx['root_dir'] = ivle.conf.root_dir
 
101
        ctx['public_host'] = ivle.conf.public_host
105
102
        ctx['write_javascript_settings'] = req.write_javascript_settings
106
103
        if req.user:
107
104
            ctx['login'] = req.user.login
134
131
                        ctx['favicon'] = icon_url
135
132
                else:
136
133
                    new_app['has_icon'] = False
137
 
                new_app['path'] = req.make_path(tab[4])
 
134
                new_app['path'] = ivle.util.make_path(tab[4])
138
135
                new_app['desc'] = tab[2]
139
136
                new_app['name'] = tab[1]
140
137
                new_app['weight'] = tab[5]