64
67
tmpl = loader.load(app_template)
65
68
app = self.filter(tmpl.generate(viewctx), viewctx)
67
71
for plugin in self.plugin_scripts:
68
72
for path in self.plugin_scripts[plugin]:
69
req.scripts.append(media_url(req, plugin, path))
73
view_scripts.append(media_url(req, plugin, path))
71
76
for plugin in self.plugin_styles:
72
77
for path in self.plugin_styles[plugin]:
73
req.styles.append(media_url(req, plugin, path))
78
view_styles.append(media_url(req, plugin, path))
76
81
ctx = genshi.template.Context()
77
# XXX: Leave this here!! (Before req.styles is read)
78
ctx['overlays'] = self.render_overlays(req) if req.user else []
83
overlay_bits = self.render_overlays(req) if req.user else [[]]*4
84
ctx['overlays'] = overlay_bits[0]
80
86
ctx['styles'] = [media_url(req, CorePlugin, 'ivle.css')]
81
ctx['styles'] += req.styles
87
ctx['styles'] += view_styles
88
ctx['styles'] += overlay_bits[1]
83
90
ctx['scripts'] = [media_url(req, CorePlugin, path) for path in
84
91
('util.js', 'json2.js', 'md5.js')]
85
92
ctx['scripts'].append(media_url(req, '+external/jquery', 'jquery.js'))
86
ctx['scripts'] += req.scripts
93
ctx['scripts'] += view_scripts
94
ctx['scripts'] += overlay_bits[2]
88
ctx['scripts_init'] = req.scripts_init
96
ctx['scripts_init'] = self.scripts_init + overlay_bits[3]
89
97
ctx['app_template'] = app
90
98
ctx['title_img'] = media_url(req, CorePlugin,
91
99
"images/chrome/title.png")
152
163
if not self.allow_overlays:
164
return (overlays, styles, scripts, scripts_init)
155
166
for plugin in req.config.plugin_index[OverlayPlugin]:
156
167
for overclass in plugin.overlays:
160
171
#TODO: Re-factor this to look nicer
161
172
for mplugin in overlay.plugin_scripts:
162
173
for path in overlay.plugin_scripts[mplugin]:
163
req.scripts.append(media_url(req, mplugin, path))
174
scripts.append(media_url(req, mplugin, path))
165
176
for mplugin in overlay.plugin_styles:
166
177
for path in overlay.plugin_styles[mplugin]:
167
req.styles.append(media_url(req, mplugin, path))
178
styles.append(media_url(req, mplugin, path))
169
req.scripts_init += overlay.plugin_scripts_init
180
scripts_init += overlay.plugin_scripts_init
171
182
overlays.append(overlay.render(req))
183
return (overlays, styles, scripts, scripts_init)
175
186
def get_error_view(cls, e):