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

« back to all changes in this revision

Viewing changes to www/dispatch/html.py

  • Committer: mattgiuca
  • Date: 2008-01-30 22:43:35 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:339
console:
    Bugfix - error trying to "maximize" the window in the full console app.
    Minimize and maximize functions check that the mode is window pane.

    Added support for the Tab key on the console. Now inserts spaces
    (can be changed to '\t' through a constant at the top), and doesn't move
    focus away from the input box.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        req.write('  <link rel="stylesheet" type="text/css" href="%s" />\n'
74
74
            % cgi.escape(util.make_path(style)))
75
75
    for script in req.scripts:
76
 
        req.write('  <script type="text/javascript" src="%s"></script>\n'
 
76
        req.write('  <script type="text/javascript" src="%s" />\n'
77
77
            % cgi.escape(util.make_path(script)))
78
78
 
79
79
    req.write("</head>\n\n")
80
80
 
81
81
    # Open the body element and write a bunch of stuff there (the header)
82
82
    req.write("""<body>
83
 
<div id="ivleheader"></div>
84
 
<div id="ivleheader_text">
 
83
<div id="ivleheader">
85
84
  <h1>IVLE</h1>
86
85
  <h2>Informatics Virtual Learning Environment</h2>
87
86
""")
88
87
 
89
88
    if req.username:
90
 
        # Get the user's nickname from the request session
91
 
        nickname = req.get_session()['nick']
92
 
        req.write('  <p class="userhello">%s (<span '
93
 
            'class="username">%s</span>) |\n'
 
89
        req.write('  <p class="userhello">Welcome, <span '
 
90
            'class="username">%s</span> |\n'
94
91
            '    <a href="%s">Help</a> |\n'
95
92
            '    <a href="%s">Logout</a>\n'
96
93
            '  </p>\n' %
97
 
            (cgi.escape(nickname), cgi.escape(req.username),
 
94
            (cgi.escape(req.username),
98
95
             cgi.escape(get_help_url(req)),
99
96
             cgi.escape(util.make_path('logout'))))
100
97
    else:
101
98
        req.write('  <p class="userhello">Not logged in.</p>')
102
99
 
103
 
    # ivleheader_tabs is a separate div, so it can be positioned absolutely
104
 
    req.write('</div>\n<div id="ivleheader_tabs">\n')
105
 
 
106
100
    # If the "debuginfo" app is installed, display a warning to the admin to
107
101
    # make sure it is removed in production.
108
102
    if "debuginfo" in conf.apps.app_url:
110
104
            "app from conf.apps.app_url when placed into production."
111
105
            "</small></p>\n")
112
106
 
113
 
    # If req has a "no_agreement" attribute, then it is because the user has
114
 
    # not signed the agreement; therefore we are displaying the TOS page.
115
 
    # Do not show apps (see dispatch.login).
116
 
    if req.username and not hasattr(req, 'no_agreement'):
 
107
    if req.username:
117
108
        # Only print app tabs if logged in
118
109
        print_apps_list(req, req.app)
119
110
    req.write('</div>\n<div id="ivlebody">\n')
128
119
def get_help_url(req):
129
120
    """Gets the help URL most relevant to this page, to place as the
130
121
    "help" link at the top of the page."""
131
 
    reqapp = req.app if hasattr(req, 'app') else None
132
 
    if reqapp == 'help':
 
122
    if req.app == 'help':
133
123
        # We're already in help. Link to the exact current page
134
124
        # instead of the generic help page.
135
125
        return req.uri
136
 
    if reqapp is not None and conf.apps.app_url[reqapp].hashelp:
137
 
        help_path = os.path.join('help', reqapp)
 
126
    if conf.apps.app_url[req.app].hashelp:
 
127
        help_path = os.path.join('help', req.app)
138
128
    else:
139
129
        help_path = 'help'
140
130
    return util.make_path(help_path)