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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: mattgiuca
  • Date: 2008-01-28 23:04:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:315
trampoline/trampoline.c: Added 2 includes, which are required
for the "umask" function. (This wasn't a problem on Ubuntu 7.10 but is for
older versions).

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
# content (the common parts of the HTML pages shared across the entire site).
24
24
# Does not include the login page. See login.py.
25
25
 
 
26
import cgi
26
27
import os.path
27
28
 
28
29
import conf
48
49
<head>
49
50
  <title>%sIVLE</title>
50
51
  <meta http-equiv="Content-Type" content="%s; charset=utf-8" />
51
 
""" % (titlepart, req.content_type))
 
52
""" % (cgi.escape(titlepart), cgi.escape(req.content_type)))
52
53
    # Write inline JavaScript which gives the client code access to certain
53
54
    # server-side variables.
54
55
    if req.username:
63
64
    iconurl = get_icon_url(req.app)
64
65
    if iconurl:
65
66
        req.write("""  <link rel="shortcut icon" href="%s" />
66
 
""" % iconurl)
 
67
""" % cgi.escape(iconurl))
67
68
    req.write("""  <link rel="stylesheet" type="text/css" href="%s" />
68
 
""" % util.make_path('media/common/ivle.css'))
 
69
""" % cgi.escape(util.make_path('media/common/ivle.css')))
69
70
 
70
71
    # Write any app-specific style and script links
71
72
    for style in req.styles:
72
73
        req.write('  <link rel="stylesheet" type="text/css" href="%s" />\n'
73
 
            % util.make_path(style))
 
74
            % cgi.escape(util.make_path(style)))
74
75
    for script in req.scripts:
75
76
        req.write('  <script type="text/javascript" src="%s" />\n'
76
 
            % util.make_path(script))
 
77
            % cgi.escape(util.make_path(script)))
77
78
 
78
79
    req.write("</head>\n\n")
79
80
 
90
91
            '    <a href="%s">Help</a> |\n'
91
92
            '    <a href="%s">Logout</a>\n'
92
93
            '  </p>\n' %
93
 
            (req.username, get_help_url(req), util.make_path('logout')))
 
94
            (cgi.escape(req.username),
 
95
             cgi.escape(get_help_url(req)),
 
96
             cgi.escape(util.make_path('logout'))))
94
97
    else:
95
98
        req.write('  <p class="userhello">Not logged in.</p>')
96
99
 
155
158
            li_attr = ''
156
159
        file.write('    <li%s>' % li_attr)
157
160
        if app.icon:
158
 
            file.write('<img src="%s" alt="" /> ' % get_icon_url(urlname))
 
161
            file.write('<img src="%s" alt="" /> '
 
162
                % cgi.escape(get_icon_url(urlname)))
159
163
        file.write('<a href="%s">%s</a></li>\n'
160
 
            % (util.make_path(urlname), app.name))
 
164
            % (cgi.escape(util.make_path(urlname)), cgi.escape(app.name)))
161
165
 
162
166
    file.write('  </ul>\n')