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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2009-03-24 03:14:44 UTC
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: matt.giuca@gmail.com-20090324031444-dbpn1bj6dr4zh4sx
Added auto-generated (and hand-modified) Sphinx files (conf, Makefile and
    index).
    Our IVLE documentation will be stored as Sphinx files.
    make html to generate the documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
        for key in kwargs:
49
49
            setattr(self, key, kwargs[key])
50
50
 
 
51
    def filter(self, stream, ctx):
 
52
        return stream
 
53
 
51
54
    def render(self, req):
52
55
        req.content_type = 'text/html' # TODO: Detect application/xhtml+xml
53
56
 
61
64
                        inspect.getmodule(self).__file__), self.template) 
62
65
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
63
66
        tmpl = loader.load(app_template)
64
 
        app = tmpl.generate(viewctx)
 
67
        app = self.filter(tmpl.generate(viewctx), viewctx)
65
68
 
66
69
        for plugin in self.plugin_scripts:
67
70
            for path in self.plugin_scripts[plugin]:
74
77
        # Global template
75
78
        ctx = genshi.template.Context()
76
79
        # XXX: Leave this here!! (Before req.styles is read)
77
 
        ctx['overlays'] = self.render_overlays(req)
 
80
        ctx['overlays'] = self.render_overlays(req) if req.user else []
78
81
 
79
82
        ctx['styles'] = [media_url(req, CorePlugin, 'ivle.css')]
80
83
        ctx['styles'] += req.styles
81
84
 
82
85
        ctx['scripts'] = [media_url(req, CorePlugin, path) for path in
83
86
                           ('util.js', 'json2.js', 'md5.js')]
 
87
        ctx['scripts'].append(media_url(req, '+external/jquery', 'jquery.js'))
84
88
        ctx['scripts'] += req.scripts
85
89
 
86
90
        ctx['scripts_init'] = req.scripts_init
87
91
        ctx['app_template'] = app
 
92
        ctx['title_img'] = media_url(req, CorePlugin,
 
93
                                     "images/chrome/title.png")
88
94
        self.populate_headings(req, ctx)
89
95
        tmpl = loader.load(os.path.join(os.path.dirname(__file__), 
90
96
                                                        'ivle-headings.html'))
117
123
            for tab in plugin.tabs:
118
124
                # tab is a tuple: name, title, desc, icon, path
119
125
                new_app = {}
120
 
                new_app['this_app'] = hasattr(self, 'appname') \
121
 
                                      and tab[0] == self.appname
 
126
                new_app['this_app'] = hasattr(self, 'tab') \
 
127
                                      and tab[0] == self.tab
122
128
 
123
129
                # Icon name
124
130
                if tab[3] is not None:
191
197
 
192
198
        if req.user is None:
193
199
            # Not logged in. Redirect to login page.
194
 
            req.throw_redirect('/+login?' + 
195
 
                               urllib.urlencode([('url', req.uri)]))
 
200
            if req.uri == '/':
 
201
                query_string = ''
 
202
            else:
 
203
                query_string = '?url=' + urllib.quote(req.uri, safe="/~")
 
204
            req.throw_redirect('/+login' + query_string)
196
205
 
197
206
        req.status = 403