~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:
24
24
# Does not include the login page. See login.py.
25
25
 
26
26
import cgi
27
 
import urllib
28
27
import os.path
29
28
 
30
29
import conf
62
61
    username = %s;
63
62
  </script>
64
63
""" % (repr(conf.root_dir), username))
65
 
    iconurl = get_icon_url(req.app, small=True)
 
64
    iconurl = get_icon_url(req.app)
66
65
    if iconurl:
67
66
        req.write("""  <link rel="shortcut icon" href="%s" />
68
67
""" % cgi.escape(iconurl))
90
89
    if req.user:
91
90
        # Get the user's nickname from the request session
92
91
        nickname = req.user.nick
93
 
        req.write('  <p class="userhello"><span id="usernick">%s</span> '
94
 
            '(<span class="username">%s</span>) |\n'
95
 
            '    <a href="%s">Settings</a> |\n'
 
92
        req.write('  <p class="userhello">%s (<span '
 
93
            'class="username">%s</span>) |\n'
96
94
            '    <a href="%s">Help</a> |\n'
97
 
            '    <a href="%s">Sign out</a>\n'
 
95
            '    <a href="%s">Logout</a>\n'
98
96
            '  </p>\n' %
99
97
            (cgi.escape(nickname), cgi.escape(req.user.login),
100
 
             cgi.escape(util.make_path('settings')),
101
98
             cgi.escape(get_help_url(req)),
102
99
             cgi.escape(util.make_path('logout'))))
103
100
    else:
109
106
    # If the "debuginfo" app is installed, display a warning to the admin to
110
107
    # make sure it is removed in production.
111
108
    if "debuginfo" in conf.apps.app_url:
112
 
        req.write("  <p><small>Warning: debuginfo is enabled. Set "
113
 
            "enable_debuginfo = False in lib/conf/apps.py, when placing IVLE "
114
 
            "into production.</small></p>\n")
 
109
        req.write("  <p><small>Warning: debuginfo is enabled. Remove this "
 
110
            "app from conf.apps.app_url when placed into production."
 
111
            "</small></p>\n")
115
112
 
116
113
    # If req has a "no_agreement" attribute, then it is because the user has
117
114
    # not signed the agreement; therefore we are displaying the TOS page.
146
143
    """Given an app's url name, gets the URL of the icon image for this app,
147
144
    relative to the site root. Returns None if the app has no icon."""
148
145
    if appurl is None: return None
149
 
    try:
150
 
        app = conf.apps.app_url[appurl]
151
 
    except KeyError:
152
 
        # Due to navigating to a bad app
153
 
        return None
 
146
    app = conf.apps.app_url[appurl]
154
147
    if small:
155
148
        icon_dir = conf.apps.app_icon_dir_small
156
149
    else:
176
169
        file.write('    <li%s>' % li_attr)
177
170
        if app.icon:
178
171
            file.write('<img src="%s" alt="" /> '
179
 
                % urllib.quote(get_icon_url(urlname)))
180
 
        file.write('<a href="%s" title="%s">%s</a></li>\n'
181
 
            % (urllib.quote(util.make_path(urlname)), cgi.escape(app.desc),
182
 
                cgi.escape(app.name)))
 
172
                % cgi.escape(get_icon_url(urlname)))
 
173
        file.write('<a href="%s">%s</a></li>\n'
 
174
            % (cgi.escape(util.make_path(urlname)), cgi.escape(app.name)))
183
175
 
184
176
    file.write('  </ul>\n')