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 + ", semester "
75
+ subject.semester + ")");
77
h3.find('a').attr('href', subject.url);
78
$(specialhomediv).append(h3);
80
/* Print the file listing */
106
/* Create the contents */
81
107
ul = document.createElement("ul");
83
ul.appendChild(make_subject_item(subjpath,
84
path_join("users", username, subjpath), PERSONALDIR,
85
"Your own files in this subject"));
88
var groups = subject.groups;
89
for (var j=0; j<subject.groups.length; j++)
91
var group = subject.groups[j];
92
ul.appendChild(make_subject_item(subjpath,
93
path_join("groups", subject.subj_short_name + "_" +
94
subject.year + "_" + subject.semester + "_" +
97
"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"));
100
111
specialhomediv.appendChild(ul);
112
/* Remove stuff from the listing */
113
if ("stuff" in listing)
114
delete listing["stuff"];
102
/* Remove it from listing */
103
if (subject.subj_short_name in listing)
104
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);
107
/* FIXME: Old Subjects? */
109
/* STUFF Section -- For the stuff directory */
110
/* Create the header */
111
h2 = dom_make_text_elem("h2", "Stuff");
112
specialhomediv.appendChild(h2);
113
/* Create the contents */
114
ul = document.createElement("ul");
115
ul.appendChild(make_subject_item("",
116
path_join("users", username, "stuff"), "stuff",
117
"Your own files not related to a subject"));
118
specialhomediv.appendChild(ul);
119
/* Remove stuff from the listing */
120
if ("stuff" in listing)
121
delete listing["stuff"];
123
/* JUNK Section -- All the rest */
124
/* Create the header row */
125
if (obj_length(listing) > 0)
127
h2 = dom_make_text_elem("h2", "Junk");
128
specialhomediv.appendChild(h2);
129
127
handle_dir_listing(path, listing);
200
199
if (create_if_needed(repopath))
202
201
// Try a checkout
203
do_act("svncheckout", {"path": [repopath, localpath]});
202
do_action("svncheckout", current_path, {"path":
203
[repopath, localpath]});
207
207
li.setAttribute("class", "listing-dir");
210
211
button.setAttribute("type", "button");
211
212
button.setAttribute("value", "Checkout");
212
213
span.appendChild(button);
216
// Error: The directory listing could not be retrieved
217
// Make a link in case the user wants to investigate
218
li.appendChild(dom_make_link_elem("span", name, description,
219
app_path(this_app, username, path, name)));
220
span = dom_make_text_elem("span",
221
" (error \u2013 contact system administrator)",
222
"There was an error retrieving information about this "
224
span.setAttribute("class", "status");
225
li.appendChild(span);
229
217
/* Are we working in a subdirectory or parent? */