65
61
inspect.getmodule(self).__file__), self.template)
66
62
loader = genshi.template.TemplateLoader(".", auto_reload=True)
67
63
tmpl = loader.load(app_template)
68
app = self.filter(tmpl.generate(viewctx), viewctx)
64
app = tmpl.generate(viewctx)
71
66
for plugin in self.plugin_scripts:
72
67
for path in self.plugin_scripts[plugin]:
73
view_scripts.append(media_url(req, plugin, path))
68
req.scripts.append(media_url(req, plugin, path))
76
70
for plugin in self.plugin_styles:
77
71
for path in self.plugin_styles[plugin]:
78
view_styles.append(media_url(req, plugin, path))
72
req.styles.append(media_url(req, plugin, path))
81
75
ctx = genshi.template.Context()
83
overlay_bits = self.render_overlays(req) if req.user else [[]]*4
84
ctx['overlays'] = overlay_bits[0]
76
# XXX: Leave this here!! (Before req.styles is read)
77
ctx['overlays'] = self.render_overlays(req) if req.user else []
86
79
ctx['styles'] = [media_url(req, CorePlugin, 'ivle.css')]
87
ctx['styles'] += view_styles
88
ctx['styles'] += overlay_bits[1]
80
ctx['styles'] += req.styles
90
82
ctx['scripts'] = [media_url(req, CorePlugin, path) for path in
91
('util.js', 'json2.js', 'md5.js')]
92
ctx['scripts'].append(media_url(req, '+external/jquery', 'jquery.js'))
93
ctx['scripts'] += view_scripts
94
ctx['scripts'] += overlay_bits[2]
83
('util.js', 'json2.js', 'md5.js', 'jquery.js')]
84
ctx['scripts'] += req.scripts
96
ctx['scripts_init'] = self.scripts_init + overlay_bits[3]
86
ctx['scripts_init'] = req.scripts_init
97
87
ctx['app_template'] = app
98
88
ctx['title_img'] = media_url(req, CorePlugin,
99
89
"images/chrome/title.png")
108
98
def populate_headings(self, req, ctx):
109
99
ctx['favicon'] = None
110
ctx['root_dir'] = req.config['urls']['root']
111
ctx['public_host'] = req.config['urls']['public_host']
112
ctx['svn_base'] = req.config['urls']['svn_addr']
100
ctx['root_dir'] = ivle.conf.root_dir
101
ctx['public_host'] = ivle.conf.public_host
113
102
ctx['write_javascript_settings'] = req.write_javascript_settings
115
104
ctx['login'] = req.user.login
171
157
#TODO: Re-factor this to look nicer
172
158
for mplugin in overlay.plugin_scripts:
173
159
for path in overlay.plugin_scripts[mplugin]:
174
scripts.append(media_url(req, mplugin, path))
160
req.scripts.append(media_url(req, mplugin, path))
176
162
for mplugin in overlay.plugin_styles:
177
163
for path in overlay.plugin_styles[mplugin]:
178
styles.append(media_url(req, mplugin, path))
164
req.styles.append(media_url(req, mplugin, path))
180
scripts_init += overlay.plugin_scripts_init
166
req.scripts_init += overlay.plugin_scripts_init
182
168
overlays.append(overlay.render(req))
183
return (overlays, styles, scripts, scripts_init)
186
172
def get_error_view(cls, e):