67
67
# Open the body element and write a bunch of stuff there (the header)
68
68
req.write("""<body>
69
<h1>IVLE - Informatics Virtual Learning Environment</h1>
70
<h1>IVLE - Informatics Virtual Learning Environment</h1>
73
req.write('<p class="userhello">Hello, %s. '
74
'<a href="%s">Logout</a></p>\n' %
74
req.write(' <p class="userhello">Welcome, <span '
75
'class="username">%s</span>. '
76
'<a href="%s">Logout</a>.</p>\n' %
75
77
(req.username, util.make_path('logout')))
77
req.write('<p class="userhello">Not logged in.</p>')
79
req.write(' <p class="userhello">Not logged in.</p>')
81
81
# If the "debuginfo" app is installed, display a warning to the admin to
82
82
# make sure it is removed in production.
83
83
if "debuginfo" in conf.apps.app_url:
84
req.write("<p><small>Warning: debuginfo is enabled. Remove this app "
85
"from conf.apps.app_url when placed into production."
84
req.write(" <p><small>Warning: debuginfo is enabled. Remove this "
85
"app from conf.apps.app_url when placed into production."
88
print_apps_list(req, req.app)
89
req.write('</div>\n<div id="ivlebody">\n')
88
91
def write_html_foot(req):
89
92
"""Writes the HTML footer, given a request object.
91
94
req: An IVLE request object. Written to.
93
req.write("</body>\n</html>\n")
96
req.write("</div>\n</body>\n</html>\n")
95
def print_apps_list(file):
98
def print_apps_list(file, thisapp):
96
99
"""Prints all app tabs, as a UL. Prints a list item for each app that has
99
102
file: Object with a "write" method - ie. the request object.
102
file.write('<ul class="apptabs">\n')
105
file.write(' <ul class="apptabs">\n')
104
107
for urlname in conf.apps.apps_in_tabs:
105
108
app = conf.apps.app_url[urlname]
106
file.write(' <li><a href="%s">%s</a></li>\n'
107
% (util.make_path(urlname), app.name))
109
if urlname == thisapp:
110
li_attr = ' class="thisapp"'
113
file.write(' <li%s><a href="%s">%s</a></li>\n'
114
% (li_attr, util.make_path(urlname), app.name))
109
file.write('</ul>\n')
116
file.write(' </ul>\n')