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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: dilshan_a
  • Date: 2008-01-24 23:49:08 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:292
Fixed bug in get_name for TestSuite.

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
27
26
import os.path
28
27
 
29
28
import conf
49
48
<head>
50
49
  <title>%sIVLE</title>
51
50
  <meta http-equiv="Content-Type" content="%s; charset=utf-8" />
52
 
""" % (cgi.escape(titlepart), cgi.escape(req.content_type)))
 
51
""" % (titlepart, req.content_type))
53
52
    # Write inline JavaScript which gives the client code access to certain
54
53
    # server-side variables.
55
54
    if req.username:
64
63
    iconurl = get_icon_url(req.app)
65
64
    if iconurl:
66
65
        req.write("""  <link rel="shortcut icon" href="%s" />
67
 
""" % cgi.escape(iconurl))
 
66
""" % iconurl)
68
67
    req.write("""  <link rel="stylesheet" type="text/css" href="%s" />
69
 
""" % cgi.escape(util.make_path('media/common/ivle.css')))
 
68
""" % util.make_path('media/common/ivle.css'))
70
69
 
71
70
    # Write any app-specific style and script links
72
71
    for style in req.styles:
73
72
        req.write('  <link rel="stylesheet" type="text/css" href="%s" />\n'
74
 
            % cgi.escape(util.make_path(style)))
 
73
            % util.make_path(style))
75
74
    for script in req.scripts:
76
75
        req.write('  <script type="text/javascript" src="%s" />\n'
77
 
            % cgi.escape(util.make_path(script)))
 
76
            % util.make_path(script))
78
77
 
79
78
    req.write("</head>\n\n")
80
79
 
81
80
    # Open the body element and write a bunch of stuff there (the header)
82
81
    req.write("""<body>
83
 
<div id="ivleheader"></div>
84
 
<div id="ivleheader_text">
 
82
<div id="ivleheader">
85
83
  <h1>IVLE</h1>
86
84
  <h2>Informatics Virtual Learning Environment</h2>
87
85
""")
92
90
            '    <a href="%s">Help</a> |\n'
93
91
            '    <a href="%s">Logout</a>\n'
94
92
            '  </p>\n' %
95
 
            (cgi.escape(req.username),
96
 
             cgi.escape(get_help_url(req)),
97
 
             cgi.escape(util.make_path('logout'))))
 
93
            (req.username, get_help_url(req), util.make_path('logout')))
98
94
    else:
99
95
        req.write('  <p class="userhello">Not logged in.</p>')
100
96
 
104
100
        req.write("  <p><small>Warning: debuginfo is enabled. Remove this "
105
101
            "app from conf.apps.app_url when placed into production."
106
102
            "</small></p>\n")
107
 
    # ivleheader_tabs is a separate div, so it can be positioned absolutely
108
 
    req.write('</div>\n<div id="ivleheader_tabs">\n')
109
103
 
110
104
    if req.username:
111
105
        # Only print app tabs if logged in
161
155
            li_attr = ''
162
156
        file.write('    <li%s>' % li_attr)
163
157
        if app.icon:
164
 
            file.write('<img src="%s" alt="" /> '
165
 
                % cgi.escape(get_icon_url(urlname)))
 
158
            file.write('<img src="%s" alt="" /> ' % get_icon_url(urlname))
166
159
        file.write('<a href="%s">%s</a></li>\n'
167
 
            % (cgi.escape(util.make_path(urlname)), cgi.escape(app.name)))
 
160
            % (util.make_path(urlname), app.name))
168
161
 
169
162
    file.write('  </ul>\n')