~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-12-07 01:45:06 UTC
  • Revision ID: grantw@unimelb.edu.au-20091207014506-zaxmgnh56hd8oo2c
Abort group creation if the prompt is cancelled or the name is empty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    """
38
38
 
39
39
    template = 'template.html'
 
40
 
40
41
    plugin_scripts = {}
41
42
    plugin_styles = {}
 
43
    scripts_init = []
 
44
 
42
45
    allow_overlays = True
43
46
    overlay_blacklist = []
44
47
 
64
67
        tmpl = loader.load(app_template)
65
68
        app = self.filter(tmpl.generate(viewctx), viewctx)
66
69
 
 
70
        view_scripts = []
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))
70
74
 
 
75
        view_styles = []
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))
74
79
 
75
80
        # Global template
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 []
 
82
 
 
83
        overlay_bits = self.render_overlays(req) if req.user else [[]]*4
 
84
        ctx['overlays'] = overlay_bits[0]
79
85
 
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]
82
89
 
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]
87
95
 
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")
113
121
        ctx['publicmode'] = req.publicmode
114
122
        if hasattr(self, 'help'):
115
123
            ctx['help_path'] = self.help
 
124
        if hasattr(self, 'tab'):
 
125
            ctx['tab'] = self.tab
116
126
 
117
127
        ctx['apps_in_tabs'] = []
118
128
        for plugin in req.config.plugin_index[ViewPlugin]:
149
159
        scripts_init.
150
160
        """
151
161
        overlays = []
 
162
        styles = []
 
163
        scripts = []
 
164
        scripts_init = []
152
165
        if not self.allow_overlays:
153
 
            return overlays
 
166
            return (overlays, styles, scripts, scripts_init)
154
167
 
155
168
        for plugin in req.config.plugin_index[OverlayPlugin]:
156
169
            for overclass in plugin.overlays:
160
173
                #TODO: Re-factor this to look nicer
161
174
                for mplugin in overlay.plugin_scripts:
162
175
                    for path in overlay.plugin_scripts[mplugin]:
163
 
                        req.scripts.append(media_url(req, mplugin, path))
 
176
                        scripts.append(media_url(req, mplugin, path))
164
177
 
165
178
                for mplugin in overlay.plugin_styles:
166
179
                    for path in overlay.plugin_styles[mplugin]:
167
 
                        req.styles.append(media_url(req, mplugin, path))
 
180
                        styles.append(media_url(req, mplugin, path))
168
181
 
169
 
                req.scripts_init += overlay.plugin_scripts_init
 
182
                scripts_init += overlay.plugin_scripts_init
170
183
 
171
184
                overlays.append(overlay.render(req))
172
 
        return overlays
 
185
        return (overlays, styles, scripts, scripts_init)
173
186
 
174
187
    @classmethod
175
188
    def get_error_view(cls, e):