81
81
# Open the body element and write a bunch of stuff there (the header)
82
82
req.write("""<body>
83
<div id="ivleheader"></div>
84
<div id="ivleheader_text">
85
86
<h2>Informatics Virtual Learning Environment</h2>
89
req.write(' <p class="userhello">Welcome, <span '
90
'class="username">%s</span> |\n'
90
# Get the user's nickname from the request session
91
nickname = req.get_session()['nick']
92
req.write(' <p class="userhello">%s (<span '
93
'class="username">%s</span>) |\n'
91
94
' <a href="%s">Help</a> |\n'
92
95
' <a href="%s">Logout</a>\n'
94
(cgi.escape(req.username),
97
(cgi.escape(nickname), cgi.escape(req.username),
95
98
cgi.escape(get_help_url(req)),
96
99
cgi.escape(util.make_path('logout'))))
98
101
req.write(' <p class="userhello">Not logged in.</p>')
103
# ivleheader_tabs is a separate div, so it can be positioned absolutely
104
req.write('</div>\n<div id="ivleheader_tabs">\n')
100
106
# If the "debuginfo" app is installed, display a warning to the admin to
101
107
# make sure it is removed in production.
102
108
if "debuginfo" in conf.apps.app_url:
103
109
req.write(" <p><small>Warning: debuginfo is enabled. Remove this "
104
110
"app from conf.apps.app_url when placed into production."
105
111
"</small></p>\n")
106
# ivleheader_tabs is a separate div, so it can be positioned absolutely
107
req.write('</div>\n<div id="ivleheader_tabs">\n')
110
114
# Only print app tabs if logged in