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

136 by mattgiuca
Added File Browser (browser) application. (Currently just stub).
1
# IVLE
2
# Copyright (C) 2007-2008 The University of Melbourne
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18
# App: File Browser
19
# Author: Matt Giuca
20
# Date: 9/1/2008
21
22
# The file browser application. Presents an Ajax-based interface to the
23
# student's subversion workspace.
185 by mattgiuca
Integrated the (second) Prototype browser (HTML+CSS but no code) into the main
24
# Note that there is virtually no server-side code for this application. It
25
# simply presents static HTML and JavaScript, and all server-side activities
26
# take place in the FileService app (for handling Ajax requests).
136 by mattgiuca
Added File Browser (browser) application. (Currently just stub).
27
28
from common import util
29
30
def handle(req):
31
    """Handler for the File Browser application."""
32
33
    # Set request attributes
34
    req.content_type = "text/html"
170 by mattgiuca
browser: Added CSS and JS files (not much in them).
35
    req.styles = ["media/browser/browser.css"]
36
    req.scripts = [
37
        "media/common/json2.js",
171 by mattgiuca
Added "util.js" in common. Contains useful utility functions.
38
        "media/common/util.js",
170 by mattgiuca
browser: Added CSS and JS files (not much in them).
39
        "media/browser/browser.js",
40
    ]
136 by mattgiuca
Added File Browser (browser) application. (Currently just stub).
41
    req.write_html_head_foot = True     # Have dispatch print head and foot
42
43
    # Start writing data
185 by mattgiuca
Integrated the (second) Prototype browser (HTML+CSS but no code) into the main
44
    req.write("""
45
<!-- Top bar section -->
46
47
<div id="topbar">
186 by mattgiuca
Added a bit of "chrome" (some CSS styling and minor touching up of the HTML).
48
<h2>IVLE File Browser</h2>
49
<p id="path"></p>
185 by mattgiuca
Integrated the (second) Prototype browser (HTML+CSS but no code) into the main
50
<p><input type="button" value="Refresh" onclick="action_refresh()" />
51
<input type="button" value="New File" onclick="action_newfile()" />
52
<input type="button" value="Commit All" onclick="action_svncommitall()" /></p>
53
</div>
54
<!-- End topbar -->
55
56
<!-- Centre section - files and side panel -->
57
<!-- Using a table-based layout, for reasons of sanity -->
58
<table id="middle"><tr>
59
60
<!-- File table -->
61
<td id="filetable">
62
63
<div id="filetablediv">
64
65
<table width="100%%">
66
<thead>
67
<tr class="rowhead">
68
    <th class="col-check"></th>
188 by mattgiuca
browser.js: Can now (shakily) handle directory listings. (lots of code!)
69
    <th colspan="3" class="col-filename"><a href="javascript:alert(&quot;Sort by name&quot;)" title="Sort by name">Filename</a>
185 by mattgiuca
Integrated the (second) Prototype browser (HTML+CSS but no code) into the main
70
        <img src="%s/images/interface/sortdown.png" alt="*" /></th>
71
    <th class="col-size"><a href="javascript:alert(&quot;Sort by file size&quot;)" title="Sort by file size">Size</a></th>
72
    <th class="col-date"><a href="javascript:alert(&quot;Sort by date modified&quot;)" title="Sort by date modified">Modified</a></th>
73
</tr>
74
</thead>
75
<tbody id="files">
76
</tbody>
77
</table>
78
</div>
79
</td>
80
<!-- End filetable -->
81
82
<!-- Side panel -->
83
84
<td id="sidepanel">
85
</td>
86
<!-- End sidepanel -->
87
88
</tr></table>
89
<!-- End middle -->
90
91
<!-- Bottom status bar -->
92
93
<div id="statusbar">
94
<table>
95
<tr><td>5 files, 14 kB</td></tr>
96
</table>
97
</div>
98
<!-- End statusbar -->
99
100
</body>
101
</html>
102
""" %
103
    # All the %ses above refer to the location of the IVLE media directory
186 by mattgiuca
Added a bit of "chrome" (some CSS styling and minor touching up of the HTML).
104
    util.make_path("media")
185 by mattgiuca
Integrated the (second) Prototype browser (HTML+CSS but no code) into the main
105
)
106