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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: wagrant
  • Date: 2008-07-24 06:19:30 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:949
specialhome: Only show the subjects header if we are enrolled in some
             subjects.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import conf
31
31
import conf.apps
32
32
from common import util
 
33
import plugins.console
33
34
 
34
35
def write_html_head(req):
35
36
    """Writes the HTML header, given a request object.
59
60
        username = "null"
60
61
    req.write("""  <script type="text/javascript">
61
62
    root_dir = %s;
 
63
    public_host = %s;
62
64
    username = %s;
63
65
  </script>
64
 
""" % (repr(conf.root_dir), username))
 
66
""" % (repr(conf.root_dir), repr(conf.public_host), username))
65
67
    iconurl = get_icon_url(req.app, small=True)
66
68
    if iconurl:
67
69
        req.write("""  <link rel="shortcut icon" href="%s" />
76
78
    for script in req.scripts:
77
79
        req.write('  <script type="text/javascript" src="%s"></script>\n'
78
80
            % cgi.escape(util.make_path(script)))
 
81
    req.write('  <script type="text/javascript">\n    /* Init Functions */\n')
 
82
    for init in req.scripts_init:
 
83
        req.write('    window.addEventListener("load", %s, false);\n'%init)
 
84
    req.write('  </script>\n')
79
85
 
80
86
    req.write("</head>\n\n")
81
87
 
87
93
  <h2>Informatics Virtual Learning Environment</h2>
88
94
""")
89
95
 
90
 
    if req.user:
 
96
    if req.publicmode:
 
97
        req.write('   <p class="userhello">Running in public mode.</p>')
 
98
    elif req.user:
91
99
        # Get the user's nickname from the request session
92
100
        nickname = req.user.nick
93
101
        req.write('  <p class="userhello"><span id="usernick">%s</span> '
136
144
        # We're already in help. Link to the exact current page
137
145
        # instead of the generic help page.
138
146
        return req.uri
139
 
    if reqapp is not None and conf.apps.app_url[reqapp].hashelp:
 
147
    if reqapp is not None and reqapp in conf.apps.app_url and \
 
148
        conf.apps.app_url[reqapp].hashelp:
140
149
        help_path = os.path.join('help', reqapp)
141
150
    else:
142
151
        help_path = 'help'