48
/* Only show special headings if we get subject listings */
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)
49
/* Wrap all this "special" stuff in a div, for styling purposes */
50
specialhomediv = document.createElement("div");
51
specialhomediv.setAttribute("id", "specialhome");
52
filetablediv.appendChild(specialhomediv);
55
/* Create the header row */
56
if (subjects.length > 0)
58
h2 = dom_make_text_elem("h2", "Subjects");
59
specialhomediv.appendChild(h2);
62
/* Create the contents */
63
for (var i=0; i<subjects.length; i++)
65
var subject = subjects[i];
66
var subjpath = subject.subj_short_name;
67
// Header, with link to offering home page.
68
h3 = $('<h3><span></span> <span style="font-weight: normal">– <a class="subjectaction">Subject home</a></span>');
69
h3.find('span:first-child').text(subject.subj_name);
70
h3.find('a').attr('href', subject.url);
71
$(specialhomediv).append(h3);
73
/* Print the file listing */
74
ul = document.createElement("ul");
76
ul.appendChild(make_subject_item(subjpath,
77
path_join("users", username, subjpath), PERSONALDIR,
78
"Your own files in this subject"));
81
var groups = subject.groups;
82
for (var j=0; j<subject.groups.length; j++)
60
h2 = dom_make_text_elem("h2", "Subjects");
61
specialhomediv.appendChild(h2);
84
var group = subject.groups[j];
85
ul.appendChild(make_subject_item(subjpath,
86
path_join("groups", subject.subj_short_name + "_" +
87
subject.year + "_" + subject.semester + "_" +
90
"This group's files in this subject"));
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;
69
// Header, with link to offering home page.
70
h3 = $('<h3><span></span> <span style="font-weight: normal">– <a class="subjectaction">Subject home</a></span>');
71
h3.find('span:first-child').text(subject.subj_name);
72
h3.find('a').attr('href', subject.url);
73
$(specialhomediv).append(h3);
75
/* Print the file listing */
76
ul = document.createElement("ul");
78
ul.appendChild(make_subject_item(subjpath,
79
path_join("users", username, subjpath), PERSONALDIR,
80
"Your own files in this subject"));
83
var groups = subject.groups;
84
for (var j=0; j<subject.groups.length; j++)
86
var group = subject.groups[j];
87
ul.appendChild(make_subject_item(subjpath,
88
path_join("groups", subject.subj_short_name + "_" +
89
subject.year + "_" + subject.semester + "_" +
92
"This group's files in this subject"));
95
specialhomediv.appendChild(ul);
97
/* Remove it from listing */
98
if (subject.subj_short_name in listing)
99
delete listing[subject.subj_short_name];
102
/* FIXME: Old Subjects? */
104
/* STUFF Section -- For the stuff directory */
105
/* Create the header */
106
h2 = dom_make_text_elem("h2", "Stuff");
107
specialhomediv.appendChild(h2);
108
/* Create the contents */
109
ul = document.createElement("ul");
110
ul.appendChild(make_subject_item("",
111
path_join("users", username, "stuff"), "stuff",
112
"Your own files not related to a subject"));
113
93
specialhomediv.appendChild(ul);
114
/* Remove stuff from the listing */
115
if ("stuff" in listing)
116
delete listing["stuff"];
118
/* JUNK Section -- All the rest */
119
/* Create the header row */
120
if (obj_length(listing) > 0)
122
h2 = dom_make_text_elem("h2", "Junk");
123
specialhomediv.appendChild(h2);
124
handle_dir_listing(path, listing);
95
/* Remove it from listing */
96
if (subject.subj_short_name in listing)
97
delete listing[subject.subj_short_name];
100
/* FIXME: Old Subjects? */
102
/* STUFF Section -- For the stuff directory */
103
/* Create the header */
104
h2 = dom_make_text_elem("h2", "Stuff");
105
specialhomediv.appendChild(h2);
106
/* Create the contents */
107
ul = document.createElement("ul");
108
ul.appendChild(make_subject_item("",
109
path_join("users", username, "stuff"), "stuff",
110
"Your own files not related to a subject"));
111
specialhomediv.appendChild(ul);
112
/* Remove stuff from the listing */
113
if ("stuff" in listing)
114
delete listing["stuff"];
116
/* JUNK Section -- All the rest */
117
/* Create the header row */
118
if (obj_length(listing) > 0)
120
h2 = dom_make_text_elem("h2", "Junk");
121
specialhomediv.appendChild(h2);
129
122
handle_dir_listing(path, listing);