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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: stevenbird
  • Date: 2008-02-19 21:17:21 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:512
Renaming of problems to exercises (initial commit).
Fix up module naming (exercises sometimes called tutorials).

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
""" % (cgi.escape(titlepart), cgi.escape(req.content_type)))
53
53
    # Write inline JavaScript which gives the client code access to certain
54
54
    # server-side variables.
55
 
    if req.username:
56
 
        username = repr(req.username)
 
55
    if req.user:
 
56
        username = repr(req.user.login)
57
57
    else:
58
58
        username = "null"
59
59
    req.write("""  <script type="text/javascript">
86
86
  <h2>Informatics Virtual Learning Environment</h2>
87
87
""")
88
88
 
89
 
    if req.username:
 
89
    if req.user:
90
90
        # Get the user's nickname from the request session
91
 
        nickname = req.get_session()['nick']
 
91
        nickname = req.user.nick
92
92
        req.write('  <p class="userhello">%s (<span '
93
93
            'class="username">%s</span>) |\n'
94
94
            '    <a href="%s">Help</a> |\n'
95
95
            '    <a href="%s">Logout</a>\n'
96
96
            '  </p>\n' %
97
 
            (cgi.escape(nickname), cgi.escape(req.username),
 
97
            (cgi.escape(nickname), cgi.escape(req.user.login),
98
98
             cgi.escape(get_help_url(req)),
99
99
             cgi.escape(util.make_path('logout'))))
100
100
    else:
113
113
    # If req has a "no_agreement" attribute, then it is because the user has
114
114
    # not signed the agreement; therefore we are displaying the TOS page.
115
115
    # Do not show apps (see dispatch.login).
116
 
    if req.username and not hasattr(req, 'no_agreement'):
 
116
    if req.user and not req.user.state == 'no_agreement':
117
117
        # Only print app tabs if logged in
118
118
        print_apps_list(req, req.app)
119
119
    req.write('</div>\n<div id="ivlebody">\n')