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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: mattgiuca
  • Date: 2008-02-21 05:03:21 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:529
setup.py: Fixed copytree; now able to handle copying a directory over itself
(just does nothing).
usrmgt-server: Fixed all the commented out prints, replacing them with calls
to a "log" function which is configurable as to whether it prints or not.
makeuser.py: Removed the creation of jails.
    Now it creates a unix account, and a database entry.
    It *shouldn't* be creating a unix account still. (?)

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