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)
48
/* Only show special headings if we get subject listings */
58
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,
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++)
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"));
93
specialhomediv.appendChild(ul);
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");
59
105
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 class="subjname"></span><span style="font-weight: normal"><span class="semester"></span> – <a class="subjectaction">Subject home</a></span></h3>');
69
h3.find('.subjname').text(subject.subj_name);
70
/* Non-current offerings need to show the semester, to avoid confusion
71
* about which offering we are talking about */
72
if (subject.state != "current")
74
h3.find('.semester').text(" (" + subject.year + " " + subject.semester_display + ")");
76
h3.find('a').attr('href', subject.url);
77
$(specialhomediv).append(h3);
79
/* Print the file listing */
106
/* Create the contents */
80
107
ul = document.createElement("ul");
82
ul.appendChild(make_subject_item(subjpath,
83
path_join("users", username, subjpath), PERSONALDIR,
84
"Your own files in this subject"));
87
var groups = subject.groups;
88
for (var j=0; j<subject.groups.length; j++)
90
var group = subject.groups[j];
91
ul.appendChild(make_subject_item(subjpath,
92
path_join("groups", subject.subj_short_name + "_" +
93
subject.year + "_" + subject.semester_url + "_" +
96
"This group's files in this subject"));
108
ul.appendChild(make_subject_item("",
109
path_join("users", username, "stuff"), "stuff",
110
"Your own files not related to a subject"));
99
111
specialhomediv.appendChild(ul);
112
/* Remove stuff from the listing */
113
if ("stuff" in listing)
114
delete listing["stuff"];
101
/* Remove it from listing */
102
if (subject.subj_short_name in listing)
103
delete listing[subject.subj_short_name];
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);
122
handle_dir_listing(path, listing);
106
/* FIXME: Old Subjects? */
108
/* STUFF Section -- For the stuff directory */
109
/* Create the header */
110
h2 = dom_make_text_elem("h2", "Stuff");
111
specialhomediv.appendChild(h2);
112
/* Create the contents */
113
ul = document.createElement("ul");
114
ul.appendChild(make_subject_item("",
115
path_join("users", username, "stuff"), "stuff",
116
"Your own files not related to a subject"));
117
specialhomediv.appendChild(ul);
118
/* Remove stuff from the listing */
119
if ("stuff" in listing)
120
delete listing["stuff"];
122
/* JUNK Section -- All the rest */
123
/* Create the header row */
124
if (obj_length(listing) > 0)
126
h2 = dom_make_text_elem("h2", "Junk");
127
specialhomediv.appendChild(h2);
128
127
handle_dir_listing(path, listing);
199
199
if (create_if_needed(repopath))
201
201
// Try a checkout
202
do_act("svncheckout", {"path": [repopath, localpath]});
202
do_action("svncheckout", current_path, {"path":
203
[repopath, localpath]});
206
207
li.setAttribute("class", "listing-dir");
209
211
button.setAttribute("type", "button");
210
212
button.setAttribute("value", "Checkout");
211
213
span.appendChild(button);
215
// Error: The directory listing could not be retrieved
216
// Make a link in case the user wants to investigate
217
li.appendChild(dom_make_link_elem("span", name, description,
218
app_path(this_app, username, path, name)));
219
span = dom_make_text_elem("span",
220
" (error \u2013 contact system administrator)",
221
"There was an error retrieving information about this "
223
span.setAttribute("class", "status");
224
li.appendChild(span);
228
217
/* Are we working in a subdirectory or parent? */