213
213
function clearpage()
215
/* Note: For now clear just enough to repopulate with a dir listing.
216
* Later, will have to clear more to make way for other handlers.
217
* Possibly have a "full clear" for all handlers, and special
218
* less-violent clearers for each handler if the same handler is going to
219
* be used that was used last time. */
215
dom_removechildren(document.getElementById("path"));
216
dom_removechildren(document.getElementById("filesbody"));
219
/** Deletes all "dynamic" content on the page necessary to navigate from
220
* one directory listing to another (does not clear as much as clearpage
222
* This is the equivalent of calling clearpage() then
223
* setup_for_dir_listing(), assuming the page is already on a dir listing.
225
function clearpage_dir()
220
227
dom_removechildren(document.getElementById("path"));
221
228
dom_removechildren(document.getElementById("files"));
222
229
dom_removechildren(document.getElementById("sidepanel"));
303
310
return make_path(path_join(svn_icons_path, filename));
313
/** Initialises the DOM elements required to present a dir listing,
314
* assuming that clear_page has just been called or the page just
315
* loaded for the first time.
317
function setup_for_dir_listing()
319
var filesbody = document.getElementById("filesbody");
321
/* Using a table-based layout, for reasons of sanity */
322
/* One row, 2 columns */
323
var middle = document.createElement("table");
324
filesbody.appendChild(middle);
325
middle.setAttribute("id", "middle");
326
var middle_tbody = document.createElement("tbody");
327
middle.appendChild(middle_tbody);
328
var middle_tr = document.createElement("tr");
329
middle_tbody.appendChild(middle_tr);
331
/* Column 1: File table */
332
var filetable = document.createElement("td");
333
middle_tr.appendChild(filetable);
334
filetable.setAttribute("id", "filetable");
335
var filetablediv = document.createElement("div");
336
filetable.appendChild(filetablediv);
337
filetablediv.setAttribute("id", "filetablediv");
338
/* A nested table within this div - the actual files listing */
339
var filetabletable = document.createElement("table");
340
filetablediv.appendChild(filetabletable);
341
filetabletable.setAttribute("width", "100%");
342
var filetablethead = document.createElement("thead");
343
filetabletable.appendChild(filetablethead);
344
var filetablethead_tr = document.createElement("tr");
345
filetablethead.appendChild(filetablethead_tr);
346
filetablethead_tr.setAttribute("class", "rowhead");
348
var filetablethead_th = document.createElement("th");
349
filetablethead_tr.appendChild(filetablethead_th);
350
filetablethead_th.setAttribute("class", "col-check");
351
filetablethead_th = dom_make_link_elem("th", "Filename",
352
"Sort by filename", "")
353
filetablethead_tr.appendChild(filetablethead_th);
354
filetablethead_th.setAttribute("class", "col-filename");
355
filetablethead_th.setAttribute("colspan", 3);
356
filetablethead_th = dom_make_link_elem("th", "Size",
357
"Sort by file size", "")
358
filetablethead_tr.appendChild(filetablethead_th);
359
filetablethead_th.setAttribute("class", "col-size");
360
filetablethead_th = dom_make_link_elem("th", "Modified",
361
"Sort by date modified", "")
362
filetablethead_tr.appendChild(filetablethead_th);
363
filetablethead_th.setAttribute("class", "col-date");
365
var filetabletbody = document.createElement("tbody");
366
filetabletable.appendChild(filetabletbody);
367
filetabletbody.setAttribute("id", "files");
369
/* Column 2: Side-panel */
370
var sidepanel = document.createElement("td");
371
middle_tr.appendChild(sidepanel);
372
sidepanel.setAttribute("id", "sidepanel");
375
/* Now after the table "middle", there is a status bar */
376
var statusbar = dom_make_text_elem("div", "5 files, 14 kB");
377
filesbody.appendChild(statusbar);
378
statusbar.setAttribute("id", "statusbar");
306
381
/** Presents the directory listing.
308
383
function handle_dir_listing(path, listing)
385
setup_for_dir_listing();
310
386
var row_toggle = 1;
311
387
/* Nav through the top-level of the JSON to the actual listing object. */
312
388
var listing = listing.listing;