33
33
/** Present home directory
35
function home_listing(listing, subjects)
35
function home_listing(listing, subjects, path)
37
listing = listing.listing;
37
/* Nav through the top-level of the JSON to the actual listing object. */
38
var listing = listing.listing;
38
40
var filetablediv = document.getElementById("filetablediv");
39
41
var specialhomediv;
45
/* Wrap all this "special" stuff in a div, for styling purposes */
46
specialhomediv = document.createElement("div");
47
specialhomediv.setAttribute("id", "specialhome");
48
filetablediv.appendChild(specialhomediv);
51
/* Create the header row */
52
if (subjects.length > 0)
48
/* Only show special headings if we get subject listings */
54
h2 = dom_make_text_elem("h2", "Subjects");
51
/* Wrap all this "special" stuff in a div, for styling purposes */
52
specialhomediv = document.createElement("div");
53
specialhomediv.setAttribute("id", "specialhome");
54
filetablediv.appendChild(specialhomediv);
57
/* Create the header row */
58
if (subjects.length > 0)
60
h2 = dom_make_text_elem("h2", "Subjects");
61
specialhomediv.appendChild(h2);
64
/* Create the contents */
65
for (var i=0; i<subjects.length; i++)
67
var subject = subjects[i];
68
var subjpath = subject.subj_short_name;
70
h3 = dom_make_text_elem("h3", subject.subj_name);
71
specialhomediv.appendChild(h3);
73
/* Print the file listing */
74
ul = document.createElement("ul");
76
ul.appendChild(make_subject_item(subjpath, PERSONALDIR,
77
"Your own files in this subject"));
79
/* TODO: List groups */
81
specialhomediv.appendChild(ul);
83
/* Remove it from listing */
84
if (subject.subj_short_name in listing)
85
delete listing[subject.subj_short_name];
88
/* FIXME: Old Subjects? */
90
/* STUFF Section -- For the stuff directory */
91
/* Create the header */
92
h2 = dom_make_text_elem("h2", "Stuff");
55
93
specialhomediv.appendChild(h2);
58
/* Create the contents */
59
for (var i=0; i<subjects.length; i++)
61
var subject = subjects[i];
62
var path = subject.subj_short_name;
64
h3 = dom_make_text_elem("h3", subject.subj_name);
65
specialhomediv.appendChild(h3);
67
/* Print the file listing */
94
/* Create the contents */
68
95
ul = document.createElement("ul");
70
ul.appendChild(make_subject_item(path, PERSONALDIR,
71
"Your own files in this subject"));
73
/* TODO: List groups */
96
ul.appendChild(make_subject_item("", "stuff",
97
"Your own files not related to a subject"));
75
98
specialhomediv.appendChild(ul);
77
/* Remove it from listing */
78
if (subject.subj_short_name in listing)
79
delete listing[subject.subj_short_name];
82
/* FIXME: Old Subjects? */
84
/* STUFF Section -- For the stuff directory */
85
/* Create the header */
86
h2 = dom_make_text_elem("h2", "Stuff");
87
specialhomediv.appendChild(h2);
88
/* Create the contents */
89
ul = document.createElement("ul");
90
ul.appendChild(make_subject_item("", "stuff",
91
"Your own files not related to a subject"));
92
specialhomediv.appendChild(ul);
93
/* Remove stuff from the listing */
94
if ("stuff" in listing)
95
delete listing["stuff"];
97
/* JUNK Section -- All the rest */
98
/* Create the header row */
99
h2 = dom_make_text_elem("h2", "Junk");
100
specialhomediv.appendChild(h2);
99
/* Remove stuff from the listing */
100
if ("stuff" in listing)
101
delete listing["stuff"];
103
/* JUNK Section -- All the rest */
104
/* Create the header row */
105
if (obj_length(listing) > 0)
107
h2 = dom_make_text_elem("h2", "Junk");
108
specialhomediv.appendChild(h2);
109
handle_dir_listing(path, listing);
114
handle_dir_listing(path, listing);
103
118
/* Does an series of AJAX requests to find out the properties of this folder