~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-04-28 08:25:30 UTC
  • Revision ID: grantw@unimelb.edu.au-20090428082530-u6w762gn0cyokpwf
Remove ivle.conf dependency from ivle.webapp.filesystem.serve.

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